Possible, to include Image-Format-Detection => PalBmpDraw ?

Possible, to include Image-Format-Detection => PalBmpDraw ?

Postby ukoenig » Tue Nov 16, 2010 6: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 )

Image

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

Image

Code: Select all  Expand view

// --------- 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 :roll:
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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests