a TBitmap behind of a TBitmap?

a TBitmap behind of a TBitmap?

Postby JC » Fri Mar 07, 2008 12:20 am

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!!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Otto » Fri Mar 07, 2008 5:35 am

bmponbmp.prg from the FIVEWIN samples




#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


Image
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Postby JC » Fri Mar 07, 2008 12:38 pm

Otto...

the function TransBmp() not exists in my source!!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Fri Mar 07, 2008 12:59 pm

How I can make the background of image of "theater masks" transparent?

Image
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Fri Mar 07, 2008 1:45 pm

Julio,

You need to use TransBmp(). It is included in FWH.

What FWH version are you using ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Fri Mar 07, 2008 1:49 pm

Antonio Linares wrote:Julio,

You need to use TransBmp(). It is included in FWH.

What FWH version are you using ?



Hi Linares... my version of fivewin is 2.26
I don't found this function there! :(
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Fri Mar 07, 2008 1:52 pm

Julio,

You need to upgrade FWH
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby RAMESHBABU » Fri Mar 07, 2008 2:25 pm

Mr.Julio,

Try this code.

Code: Select all  Expand view  RUN

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
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby Silvio » Fri Mar 07, 2008 3:35 pm

Dear jc,
You need My TTitleBar class but it is a beta class perhaps I send it to antonio at the end of the next week
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby JC » Fri Mar 07, 2008 3:48 pm

Silvio... please, send to me too the class!

Ramesh, I have try!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Fri Mar 07, 2008 3:53 pm

RAMESHBABU wrote:Mr.Julio,

Try this code.

Code: Select all  Expand view  RUN

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



Ramesh, thanks for your help but, not works!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby RAMESHBABU » Sat Mar 08, 2008 4:38 pm

Mr.Julio,


How did you paint the Title Bar ?. It is through any gradiation function or
a bitmap?

Can you post your code here for the dialog shown. I will try to solve it.

This is resulted output using the above function posted by me.

Image

The dialog background is painted using gradition function (not a bitmap)
and the title bar is a bitmap and the picture painted on the titlebar bitmap
is a bitmap.


- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby mmercado » Sun Mar 09, 2008 6:00 pm

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  RUN
#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
User avatar
mmercado
 
Posts: 782
Joined: Wed Dec 19, 2007 7:50 am
Location: Salamanca, Gto., México

Postby JC » Mon Mar 10, 2008 11:58 am

Antonio Linares wrote:Julio,

You need to upgrade FWH


Linares, sorry but I informed to you a wrong version of my fivewin... really, the version is 2.6 of 2005.

But, I still doesn't have a transbmp function :(
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby JC » Mon Mar 10, 2008 12:01 pm

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  RUN
#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


Hello Manuel Mercado...

Really, I don't understand you about the TsButton... I want other thing! the image of "theater masks" stay transparent, for the background appear! More less this!
Peace and lighting!

Júlio César M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 72 guests