1

I have a following problem. Somewhere I have defined array for storing pixels of my bitmap.

unsigned int table[512*512];

I would like this array to be used as data. I've found CreateBitmap(), but it does not behave in desired way. Instead of bounding the pointer to my table it creates a kind of snapshot of my array.

CreateBitmap(512, 512, 32, 1, table);

It looks like this:

table[5000]=0x00FFFFFF;
PlaceWhereICreateBitmap();
table[5001]=0x00FFFFFF;
PlaceWhereIDisplayBitmap(); //only pixel no. 5000 is updated

I want to display both changes. I've also been reading about SetDIBits, but it copies array to the bitmap object. How can I set bitmap's buffer directly?

user2768609
  • 23
  • 1
  • 4
  • From what I can see, you are creating a pixel map with 32 planes and 1 bit for color. I'm going to assume Windows will treat `table` as 262144 bits. Color codes being 0 or 1 for each pel (1 bit each) across 32 planes. Try changing the Planes to 1 and the color bits per pixel to 32. So, `CreateBitMap(512, 512, 1, 32, table)` and see if later code makes more sense. – Brian Tiffin Dec 21 '13 at 15:12
  • Yes, the arguments were passed in wrong order, thank you :) Unfortunately, it still does not solve the problem. – user2768609 Dec 21 '13 at 18:09

1 Answers1

0

Take a look at the BitBlt bit-block transfer function.

BitBlt(hDC, xDest, yDest, Width, Height, hMemDC, xSRC, ySRC, SRCCOPY);

Google the page, there is a lot more than just SRCCOPY.

Brian Tiffin
  • 3,978
  • 1
  • 24
  • 34