Missing < transparent > using PalBmpDraw ???

Missing < transparent > using PalBmpDraw ???

Postby ukoenig » 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


Image

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
...
...

Image

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

Code: Select all  Expand view

#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.
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 102 guests