How do put a object TBitmap on top of another. And the first be transparent... without it being shown the "square" of the object?
Something like a overlap effect with transparency!!
#include "FiveWin.ch"
FUNC main()
local oWnd, oBmp, oBmp1, hBitmap
DEFINE WINDOW oWnd TITLE "Bitmap on a bitmap"
hBitmap := ReadBitmap( 0, "..\bitmaps\book.bmp" )
@ 1, 1 BITMAP oBmp FILENAME "..\bitmaps\magic.bmp" OF oWnd
oBmp:bPainted = { || PaintTransparent( oBmp:hDC, hBitmap ),;
SetBkMode( oBmp:hDC, 1 ),;
SetTextColor( oBmp:hDC, CLR_YELLOW ),;
TextOut( oBmp:hDC, 5, 5, "Hello" ) }
ACTIVATE WINDOW oWnd
DeleteObject( hBitmap )
RETURN NIL
function PaintTransparent( hDC, hBitmap )
local hBmpOld := SelectObject( hDC, hBitmap )
local nZeroZeroClr := GetPixel( hDC, 0, 0 )
local nOldClr
SelectObject( hDC, hBmpOld )
nOldClr = SetBkColor( hDC, nRGB( 255, 255, 255 ) )
TransBmp( hBitmap, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ),;
nZeroZeroClr, hDC, 10, 20, nBmpWidth( hBitmap ), nBmpHeight( hBitmap ) )
SetBkColor( hDC, nOldClr )
return nil
Antonio Linares wrote:Julio,
You need to use TransBmp(). It is included in FWH.
What FWH version are you using ?
FUNCTION PaintBmp(oDlg, cFileRes, nRow, nCol)
LOCAL aBmpPal, hBitmap
IF FILE(cFileRes)
* This Code is for reading bitmap file from disk file
aBmpPal = PalBmpRead(oDlg:hDC, cFileRes )
ELSE
* This Code is for reading bitmap file resource
aBmpPal = PalBmpLoad( cFileRes )
ENDIF
hBitmap = aBmpPal[ 1 ]
DrawMasked( oDlg:hDC, hBitmap, nRow, nCol )
RETURN nil
RAMESHBABU wrote:Mr.Julio,
Try this code.
- Code: Select all Expand view
FUNCTION PaintBmp(oDlg, cFileRes, nRow, nCol)
LOCAL aBmpPal, hBitmap
IF FILE(cFileRes)
* This Code is for reading bitmap file from disk file
aBmpPal = PalBmpRead(oDlg:hDC, cFileRes )
ELSE
* This Code is for reading bitmap file resource
aBmpPal = PalBmpLoad( cFileRes )
ENDIF
hBitmap = aBmpPal[ 1 ]
DrawMasked( oDlg:hDC, hBitmap, nRow, nCol )
RETURN nil
and you will get the desired effect
Regards,
- Ramesh Babu P
#include "FiveWin.ch"
#include "TsButton.ch"
FUNC main()
local oWnd, oBmp, oBmp1, hBitmap
DEFINE DIALOG oWnd TITLE "Bitmap on a bitmap" COLOR CLR_BLACK, CLR_CYAN
setbkmode( ownd:hdc, 1 )
@ 1, 1 BITMAP oBmp FILENAME "..\bitmaps\magic1.bmp" OF oWnd NOBORDER TRANSPARENT
@20,10 SBUTTON OF oWnd FILENAME "..\bitmaps\book.bmp" SIZE 10, 20 PIXEL BITMAP
ACTIVATE DIALOG oWnd
DeleteObject( hBitmap )
RETURN NIL
Antonio Linares wrote:Julio,
You need to upgrade FWH
mmercado wrote:Hi Julio:
Why don't you try with TSButton ?, it's very simple...
Here using the same fwh sample with a dialog
- Code: Select all Expand view
#include "FiveWin.ch"
#include "TsButton.ch"
FUNC main()
local oWnd, oBmp, oBmp1, hBitmap
DEFINE DIALOG oWnd TITLE "Bitmap on a bitmap" COLOR CLR_BLACK, CLR_CYAN
setbkmode( ownd:hdc, 1 )
@ 1, 1 BITMAP oBmp FILENAME "..\bitmaps\magic1.bmp" OF oWnd NOBORDER TRANSPARENT
@20,10 SBUTTON OF oWnd FILENAME "..\bitmaps\book.bmp" SIZE 10, 20 PIXEL BITMAP
ACTIVATE DIALOG oWnd
DeleteObject( hBitmap )
RETURN NIL
Regards
Manuel Mercado
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 60 guests