Jpg background instead of Bmp

Jpg background instead of Bmp

Postby Rick Lipkin » Tue Jun 03, 2008 9:41 pm

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 )
User avatar
Rick Lipkin
 
Posts: 2642
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Tue Jun 03, 2008 10:07 pm

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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41456
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 136 guests