FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Tranparent bitmap
Posts: 28
Joined: Mon Apr 27, 2009 03:37 PM
Tranparent bitmap
Posted: Fri Nov 13, 2009 02: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 (fw): Select all Collapse
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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Tranparent bitmap
Posted: Fri Nov 13, 2009 04:01 PM
The way I center a 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 :-)
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