Read the transparent color in a GIF
I have a little ActiveX control that reads gif images and displays them. Here is the code to load the images:
When this code returns I receive the image as an HBITMAP that I can then BitBlt for display.
IPicture *lpiPict; // THE IMAGE IS LOADED HERE
if( SUCCEEDED( ::OleLoadPicture( iStream, nFileSize, TRUE, IID_IPicture,(void**)&lpiPict) ) )
lpiPict->get_Handle( &ole_handle );
GetObject( (HANDLE)ole_handle, sizeof(BITMAP), &bm );
return (HANDLE)ole_handle; // RETURN THE IMAGE AS AN HBITMAP
Now I need transparency support, I already have the method to draw the HBITMAP with a transparent color. Now the question: In a GIF image the color that must be transparent is contained in the image palette. How can I get find out which color is from the data loaded in the IPicture structure?? or from the HBITMAP structure??
This way I can render the image with the transparent parts the creator intended and not a predefined transparent color chose by me...
thanks for any tips...