Read the transparent color in a GIF


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Read the transparent color in a GIF

  1. #1
    Join Date
    Feb 2005
    Posts
    9

    Read the transparent color in a GIF

    Hello,

    I have a little ActiveX control that reads gif images and displays them. Here is the code to load the images:

    Code:
    IPicture *lpiPict;   // THE IMAGE IS LOADED HERE
    
    if( SUCCEEDED( ::OleLoadPicture( iStream, nFileSize, TRUE, IID_IPicture,(void**)&lpiPict) ) )
    {
    	OLE_HANDLE ole_handle;
    	lpiPict->get_Handle( &ole_handle );
    	BITMAP bm;
    	GetObject( (HANDLE)ole_handle, sizeof(BITMAP), &bm );
    
    	return (HANDLE)ole_handle;  // RETURN THE IMAGE AS AN HBITMAP
    
    }
    When this code returns I receive the image as an HBITMAP that I can then BitBlt for display.

    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...

  2. #2
    Join Date
    Dec 2003
    Posts
    3,366
    as far as I can tell either a gif is stored as rgba to indicate transparency. But I am not 100% sure about this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center