FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 07: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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 08: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 :-)

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 ?

@04,14 BITMAP oBmp SIZE 43,55 of oFolder:aDialogs[1] RESOURCE "User76x112"




Regards

Anser
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 08:26 AM

Anser,

It is the same issue:

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 08:38 AM
Dear Mr.Antonio,
Just modify Class TBitmap Method Paint() to use ABPaint()


Which one should I replace with ABPaint
Is it

 PalBmpDraw( ::hDC, ::nX, ::nY, ::hBitmap, ::hPalette,;
                        Super:nWidth(), Super:nHeight(),, ::lTransparent, ::nClrPane )


or

 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 :-)

Regards

Anser
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 09:18 AM
I tried,

@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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 09: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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 09:47 AM
Dear MR.Antonio,

Thankyou, solved



Had to replace both PalBmpDraw() and TransBmp() with ABPaint() in the Method Paint()
 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


 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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 02: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 03:46 PM

+1

EMG

Posts: 244
Joined: Mon Jun 05, 2006 09:39 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 04: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.

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 05: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
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 05: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 05: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
Posts: 244
Joined: Mon Jun 05, 2006 09:39 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 06: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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Display Alpha channel 32 bit BMP on ButtonBMP (Solved)
Posted: Tue Jan 06, 2009 08:01 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com