Drawing PNG files with transparencies

Post Reply
toninhofwi
Posts: 161
Joined: Tue Oct 18, 2005 10:01 am

Drawing PNG files with transparencies

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Drawing PNG files with transparencies

Post by Antonio Linares »

Toninho,

Thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply