FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Possible, to include Image-Format-Detection => PalBmpDraw ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Possible, to include Image-Format-Detection => PalBmpDraw ?
Posted: Tue Nov 16, 2010 06:10 PM
Hello,

using PalBmpDraw with Quality-setting I noticed, it works reverse using BMP-Image-Format.

is it possible, to include a Formatdetection inside the Class ?
For the Moment, I have to check the extension before using < PalBmpDraw >.
IF cFileExt( cFileName ) = "BMP"
...
...

BMP with reduced Quality using ,, .T.
PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight ), , .T. ) !!! only for non BMP
( used as well for the JPG-Image-selection, to change a Bitmap from Resource )



PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight ) // used for BMP



Code (fw): Select all Collapse
// --------- Brush --------------------
REDEFINE BITMAP oBMP1  ID 120  ADJUST  RESOURCE "Blanc"  OF oDlg1 
oBMP1:bPainted := {|hDC| BMP_BRUSH( oBMP1, hDC, cSBRUSH[nOBJECT] ) }    

// --------- Image -------------------
REDEFINE BITMAP oBMP2  ID 220  ADJUST  RESOURCE "Blanc"  OF oDlg1 
oBMP2:bPainted := {|hDC| BMP_IMAGE( oBMP2, hDC, cSIMAGE[nOBJECT]) }

// ---------- BMP BRUSH ( adjusted ) --------------

FUNCTION BMP_BRUSH( oBitmap, hDC, cBitmap )
LOCAL oImage

IF FILE( c_path + "\Images\" + cBitmap )
     DEFINE IMAGE oImage FILENAME c_path + "\Images\" + cBitmap
     // Formattest needed !!!!
     // ---------------------------
     IF cFileExt ( cBitmap ) = "BMP"
         PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight ) 
     ELSE
         PalBmpDraw( hDC, 0, 0, oImage:hBitmap, , oBitmap:nWidth, oBitmap:nHeight, , .T. ) 
     ENDIF     
     DeleteObject( oImage )
ELSE
     MsgAlert( "File : " + CRLF + ;
     c_path + "\Images\" + cBitmap + CRLF + ; 
     "not found !", "ATTENTION" ) 
ENDIF

RETURN( NIL )


Best regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.

Continue the discussion