Tranparent bitmap

Tranparent bitmap

Postby Gary Woodley » Fri Nov 13, 2009 2:25 pm

Hi,

I am using a modified PaintTranparent function as below to create a bitmap in a window. Is there any way I can use centering rather than recalculate the x and y co-ordinates? Then I will only have to scale the image, assuming thats possible.

Code: Select all  Expand view

FUNCTION PaintTransparent( hDC, hBitmap, nRow, nCol )
   LOCAL hBmpOld := SelectObject( hDC, hBitmap )
   LOCAL nZeroZeroClr := GetPixel( hDC, 0, 0 )
   LOCAL nOldClr
     
   DEFAULT nRow:= 375
   DEFAULT nCol:= 250

   SelectObject( hDC, hBmpOld )
   nOldClr = SetBkColor( hDC, CLR_WHITE )
   TransBmp( hBitmap, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ), nZeroZeroClr, hDC, nRow, nCol, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ) )
   SetBkColor( hDC, nOldClr )
               
RETURN NIL
 


Thanks

Gary
Gary Woodley
 
Posts: 28
Joined: Mon Apr 27, 2009 3:37 pm
Location: Oxford UK

Re: Tranparent bitmap

Postby ukoenig » Fri Nov 13, 2009 4:01 pm

The way I center a Image :

Image

FUNCTION W_ALPHA( hDC )
LOCAL oBmp1

nWidth := GetSysMetrics(0)
nHeight := GetSysMetrics(1)
DEFINE BITMAP oBMP1 FILENAME c_path + "\IMAGES\Deco1.BMP"
nTop := ( nHeight / 2 ) - ( oBmp1:nHeight / 2 )
nLeft := (nWidth / 2 ) - ( oBmp1:nWidth / 2 )
ABPaint( hDC, nLeft, nTop, oBmp1:hBitmap, 220 )

RETURN NIL

Best Regards
Uwe :lol:
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: Google [Bot] and 77 guests