I am not sure where to ask this about how to program a bitmap. I
would like to create a drawing program where I can manipulate bitmaps
in win32. I have done it in Direct X but it seems really different in
win32. I have created a drawing program that creates binary color
graphics but I would like to find out how I can program a bitmap in c+
+.
I am realize that this groups is about C++ so I am looking for a place
I can ask this question.
So far I have this:
void paint(HDC hdc, HWND hwnd){
int dwn, acc = 16;
int accLoc, dnLoc = 100;
DWORD palet[16];
palet[0] = 0xffffff;
palet[1] = 0x000000;
palet[2] = 0xff0000;
palet[3] = 0x00ff00;
palet[4] = 0x0000ff;
int data[] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,
1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,
1,1,2,2,3,3,3,2,2,3,3,3,2,2,1,1,
1,1,2,2,3,3,3,4,4,3,3,3,2,2,1,1,
1,1,2,2,3,3,3,4,4,3,3,3,2,2,1,1,
1,1,2,2,0,0,0,0,0,0,0,0,2,2,1,1,
1,1,2,2,0,0,0,0,0,0,0,0,2,2,1,1,
1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,
1,1,2,2,0,0,0,0,0,0,0,0,2,2,1,1,
1,1,2,2,2,2,2,2,2,2,2,2,2,2,1,1,
1,1,2,2,3,3,3,2,2,3,3,3,2,2,1,1,
1,1,2,2,3,3,3,4,4,3,3,3,2,2,1,1,
1,1,2,2,3,3,3,4,4,3,3,3,2,2,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
//Basically what I want to do is create the pallet then have an array
of bits that display the image as colors.
BITMAP bitmap = {0,16,16,4,1,1};
bitmap.bmBits = data;
HBITMAP hbitmap = CreateBitmapIndirect(&bitmap);
hdc = GetDC(hwnd);
HDC hdcmem = CreateCompatibleDC(hdc);
SelectObject(hdcmem, hbitmap);
BitBlt(hdc,100, 100,16, 16 , hdcmem, 2, 1, SRCCOPY);
DeleteDC(hdcmem);
ReleaseDC(hwnd, hdc);
}