FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Missing < transparent > using PalBmpDraw ???
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Missing < transparent > using PalBmpDraw ???
Posted: Sun Jun 03, 2012 10:24 AM
Hello,

I noticed a missing Alphschannel using :
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, , aRect[4] )
( needed, to calculate a new Image-size )

No Problem using :

REDEFINE IMAGE oIMG1 OF oDlg FILENAME cImage1 ;
ID 110 PIXEL ADJUST BORDER




REDEFINE IMAGE oIMG1 OF oDlg FILENAME cImage1 ;
ID 110 PIXEL ADJUST BORDER
oIMG1:cTooltip := "Original"
oIMG1:bPainted := { |hDC| ( DRAW_IMG(oIMG1, hDC, cImage1 ), oSay3:Refresh() ) }


// Needed to calculate Image-size, if original size or adjusted to Resource !!!

FUNCTION DRAW_IMG( oImage, hDC, cImage )
LOCAL oImg, aRect[4]

aRect := GETCLIENTRECT( oImage:hWnd )

IF FILE( cImage )
DEFINE IMAGE oImg FILENAME cImage
// Image resized to Resource-size
IF oImg:nWidth > aRect[4] .and. oImg:nHeight > aRect[3]
PalBmpDraw( hDC, 0, 0, oImg:hBitmap, , aRect[4], aRect[3] )
ENDIF
// Original-size can be used
IF oImg:nWidth < aRect[4] .and. oImg:nHeight < aRect[3]
PalBmpDraw( hDC, 0, 0, oImg:hBitmap )
ENDIF
...
...



Tested with a original FWH-sample < Imgtest.prg >
Alphablended BMP not sopported

Code (fw): Select all Collapse
#include "Fivewin.ch"

FUNCTION MAIN()
LOCAL oWnd

LOCAL hBmp

DEFINE WINDOW oWnd

hBmp = READBITMAP( 0, ".\bitmaps\logo2.bmp" )

ACTIVATE WINDOW oWnd;
ON PAINT SFONDO( oWnd, hDC, hBmp );
MAXIMIZED

IF hBmp != 0; DELETEOBJECT( hBmp ); ENDIF

RETURN NIL

// -------------

STATIC FUNCTION SFONDO( oWnd, hDC, hBmp )
LOCAL nTop    := 0
LOCAL nLeft   := 0
LOCAL nWidth  := oWnd:nWidth()
LOCAL nHeight := oWnd:nHeight()

IF hBmp = 0; RETURN NIL; ENDIF

PALBMPDRAW( hDC, nTop, nLeft, hBmp, , nWidth, nHeight )

RETURN NIL


Is there still something missing ?

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