How can I set pixel data storage for BITMAP

163 views Asked by At

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?

1

There are 1 answers

0
Brian Tiffin On

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.