FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Drawing PNG files with transparencies
Posts: 182
Joined: Tue Oct 18, 2005 10:01 AM
Drawing PNG files with transparencies
Posted: Mon Apr 06, 2009 06:43 PM

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.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Drawing PNG files with transparencies
Posted: Mon Apr 06, 2009 07:06 PM

Toninho,

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion