tags:

views:

547

answers:

0

Hi, I am trying to implement as small a subset of GDI+ as possible in order to port an application (written in C++) from Windows to Linux. Right now I am having a problem to understand how Bitmap::LockBits is supposed to work.

According to MSDN, it has a signature like this:

Status LockBits(      
    const Rect *rect,
    UINT flags,
    PixelFormat format,
    BitmapData *lockedBitmapData
);

format is the format of pixels in the temporary buffer. This is giving me a headache: suppose that the bitmap is in format 24 bits per pixel, but I call LockBits with format=PixelFormat8bppIndexed. I assume that "indexed" means that a pixel value is an index to a palette, but which palette? If I set flags=ImageLockModeRead, this function is supposed to convert from my 24 bpp bitmap to 8 bpp indexed, but I don't see where it gets all the information.

What am I missing here? Does anybody have experience with this? Thanks in advance!