Page 1 of 1

Jpg background instead of Bmp

PostPosted: Tue Jun 03, 2008 9:41 pm
by Rick Lipkin
To All

I use very nice bitmaps as backgrounds to my applications ( on paint ) . Typically the bitmaps are 1 to 3 mb and depending on where the application is started .. if in a WAN situation .. a 3mg bitmap takes a very long time to run on the local workstation.

Here is a snipit from my current code .. just curious if there is a native FWH ( no third party please ) way to substitute the same image in .jpg format rather than bitmap ..

Rick Lipkin
SC Dept of Health, USA

//----- main menu -------//

xMESSAGE := "User "+xLOGIN+" Rights "+cRIGHTS+ ;
" Default= "+cDEFA+" Rdd= "+cRDD+ ;
" Revision "+DTOC(dEXE)+;
" -r"+str(nSCR1,4)+" x "+STR(nSCR2,4)

DEFINE ICON oICO RESOURCE "COUPLE"

DEFINE WINDOW oWind ;
FROM 0,2 to 28,78 ;
TITLE "PCAS Time and Data entry Program" ;
MENU BuildMenu(cOLDDEFA,dEXE,cRDD,nSCR1,nSCR2) ;
ICON oICO ;
MDI

DEFINE BITMAP oBMAP FILENAME (cOLDDEFA+"\PCAS.BMP") of oWind

SET MESSAGE OF oWind ;
to xMESSAGE CLOCK

ACTIVATE WINDOW oWind ;
MAXIMIZED ;
ON PAINT ( IF( xTEXT = "/NL", ,PalBmpDraw( hDC, 0,0, oBMAP:hBitmap, oBMAP:hPalette, nSCR1, nSCR2 )));
ON INIT ( IF( xTEXT = "/NL", , MSGLOGO( cDEFA+"\SPLASH.BMP",2 )), ;
oWIND:Select(), oWIND:Refresh() ) ;
VALID ( IIF( !lExitPgm, ExitPgm( .T. ) , .F. ))

RETURN( NIL )

PostPosted: Tue Jun 03, 2008 10:07 pm
by Antonio Linares
Rick,

You can use a TImage object (supports JPG and many other formats) instead of a TBitmap object. In your code you just have to replace DEFINE BITMAP ... with DEFINE IMAGE ...

But FreeImage.dll is required. Its free and its the only requirement. Have a look in folder DLL

Have a look also to samples\TestImg.prg