Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Antonio Linares » Tue Jan 06, 2009 7:37 am

Anser,

The class changes are exactly the ones that I commented you at the beginning of this thread:

use ABPaint() instead of DrawMasked() in Method Paint(). Thats all :-)
regards, saludos

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

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby anserkk » Tue Jan 06, 2009 8:23 am

Anser,

The class changes are exactly the ones that I commented you at the beginning of this thread:

use ABPaint() instead of DrawMasked() in Method Paint(). Thats all :-)


Yes Mr.Antonio, you are right. Unfortunately in between I got into trouble with the wrong .RES file issue and I was totally confused :? after that and went in the wrong direction.

Really appreciate your support :D

One more question. Do I have to follow the similiar steps in METHOD PAINT of TBitMap to display AlphaChannel BMP on a BITMAP control ? Or is there any other control available to display AlphaChannel BMP on a Dialog/Window/Folder ?

Code: Select all  Expand view
@04,14 BITMAP oBmp SIZE 43,55 of oFolder:aDialogs[1] RESOURCE "User76x112"

Image


Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Antonio Linares » Tue Jan 06, 2009 8:26 am

Anser,

It is the same issue:

Just modify Class TBitmap Method Paint() to use ABPaint() :-)
regards, saludos

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

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby anserkk » Tue Jan 06, 2009 8:38 am

Dear Mr.Antonio,
Just modify Class TBitmap Method Paint() to use ABPaint()


Which one should I replace with ABPaint
Is it

Code: Select all  Expand view
PalBmpDraw( ::hDC, ::nX, ::nY, ::hBitmap, ::hPalette,;
                        Super:nWidth(), Super:nHeight(),, ::lTransparent, ::nClrPane )


or

Code: Select all  Expand view
TransBmp( ::hBitmap, ::nWidth(), ::nHeight(), nZeroZeroClr, ::hDC,;
                         ::nX, ::nY, ::nWidth(), ::nHeight() )


Would have been nice If we could control this from our PRG itself without modifying the original class :D

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby anserkk » Tue Jan 06, 2009 9:18 am

I tried,

Code: Select all  Expand view
@04,14 BITMAP oBmp SIZE 43,55 of oFolder:aDialogs[1] RESOURCE "User76x112"
oBmp:bPainted:={ || ABPaint( oBmp:hDC, 0, 0, oBmp:hBitmap, 220 )}


But did't get the expected result

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Antonio Linares » Tue Jan 06, 2009 9:39 am

Anser,

The idea is to modify the class, but if you want to test it that way then try it like this:

oBmp:bPainted:={ | hDC | ABPaint( hDC, 0, 0, oBmp:hBitmap, 220 ) }
regards, saludos

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

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby anserkk » Tue Jan 06, 2009 9:47 am

Dear MR.Antonio,

Thankyou, solved

Image

Had to replace both PalBmpDraw() and TransBmp() with ABPaint() in the Method Paint()
Code: Select all  Expand view
IF ! ::lBmpAlpha  // New Data  .T. or .F.
  TransBmp( ::hBitmap, ::nWidth(), ::nHeight(), nZeroZeroClr, ::hDC,;
       ::nX, ::nY, Super:nWidth(), Super:nHeight() )
Else
   ABPaint( ::hDC, ::nX, ::nY, ::hBitmap, 220 )
Endif


Code: Select all  Expand view
IF ! ::lBmpAlpha  // New Data  .T. or .F.
    PalBmpDraw( ::hDC, ::nX, ::nY, ::hBitmap, ::hPalette,;
            ::nWidth(), ::nHeight(),, ::lTransparent, ::nClrPane )
Else
    ABPaint( ::hDC, ::nX, ::nY, ::hBitmap, 220 )
Endif


For Aesthetic purpose it is better to have a choice to use AlphaBmp's. Is it possible to include these changes in the future FWH updates with a Logical DATA to decide whether to display or not the AlphaChannel so that it does not effect backward compatibility.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby James Bott » Tue Jan 06, 2009 2:57 pm

>For Aesthetic purpose it is better to have a choice to use AlphaBmp's. Is it possible to include these changes in the future FWH updates with a Logical DATA to decide whether to display or not the AlphaChannel so that it does not effect backward compatibility.


Antonio, I would like to vote for this also.

regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Giovany Vecchi » Tue Jan 06, 2009 4:18 pm

Estou alterando a classe tOutLook para funcionar com Bmps Alpha channels tambem, quando estiver pronto eu aviso.

I am also altering the class tOutLook to work with Bmps Alpha channels, when it is ready I inform.
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Antonio Linares » Tue Jan 06, 2009 5:45 pm

Wouldn't it better if we could automatically detect if the bitmap has an alpha channel into it and automatically call the proper painting routine ? :-)
regards, saludos

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

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby anserkk » Tue Jan 06, 2009 5:54 pm

Antonio Linares wrote:Wouldn't it better if we could automatically detect if the bitmap has an alpha channel into it and automatically call the proper painting routine ? :-)

If it is possible to identify Alphachannel automatically then that would be the best solution.

Regards

Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Enrico Maria Giordano » Tue Jan 06, 2009 5:55 pm

Antonio Linares wrote:Wouldn't it better if we could automatically detect if the bitmap has an alpha channel into it and automatically call the proper painting routine ? :-)


Definitely! :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Giovany Vecchi » Tue Jan 06, 2009 6:30 pm

I am not sure, but he/she should have this function so that it was detected automatically

http://msdn.microsoft.com/en-us/library/ms532334(VS.85).aspx
User avatar
Giovany Vecchi
 
Posts: 223
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

Postby Antonio Linares » Tue Jan 06, 2009 8:01 pm

regards, saludos

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

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests