Page 1 of 1

Drawing PNG files with transparencies

Posted: Mon Apr 06, 2009 6:43 pm
by toninhofwi
Hi,

This is the way to draw PNG images using FWH and freeimage:

hBmp = PngToBitmap( hDC, "c:\myfile.png" )
ABPaint( hDC, 10, 10, hBmp )


---cut---
HB_FUNC( PNGTOBITMAP )
{
HDC hDC = ( HDC ) hb_parnl( 1 );

FIBITMAP *dib;

FREE_IMAGE_FORMAT fiSource;

fiSource = FreeImage_GetFileType( ( LPSTR ) hb_parcx( 2 ), 0 );

dib = FreeImage_Load( fiSource, ( LPSTR ) hb_parcx( 2 ), 0 );

hb_retnl( ( LONG ) CreateDIBitmap( hDC, FreeImage_GetInfoHeader( dib ), CBM_INIT, FreeImage_GetBits( dib ), FreeImage_GetInfo( dib ), DIB_RGB_COLORS ) );
}
---cut---


Regards,

Toninho.

Re: Drawing PNG files with transparencies

Posted: Mon Apr 06, 2009 7:06 pm
by Antonio Linares
Toninho,

Thanks! :-)