Page 3 of 4

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

Posted: Tue Jan 06, 2009 7:37 am
by Antonio Linares
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 :-)

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

Posted: Tue Jan 06, 2009 8:23 am
by anserkk
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

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


Regards

Anser

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

Posted: Tue Jan 06, 2009 8:26 am
by Antonio Linares
Anser,

It is the same issue:

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

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

Posted: Tue Jan 06, 2009 8:38 am
by anserkk
Dear Mr.Antonio,
Just modify Class TBitmap Method Paint() to use ABPaint()
Which one should I replace with ABPaint
Is it

Code: Select all

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

Code: Select all

 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

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

Posted: Tue Jan 06, 2009 9:18 am
by anserkk
I tried,

Code: Select all

@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

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

Posted: Tue Jan 06, 2009 9:39 am
by Antonio Linares
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 ) }

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

Posted: Tue Jan 06, 2009 9:47 am
by anserkk
Dear MR.Antonio,

Thankyou, solved

Image

Had to replace both PalBmpDraw() and TransBmp() with ABPaint() in the Method Paint()

Code: Select all

 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

 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

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

Posted: Tue Jan 06, 2009 2:57 pm
by James Bott
>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

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

Posted: Tue Jan 06, 2009 3:46 pm
by Enrico Maria Giordano
+1

EMG

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

Posted: Tue Jan 06, 2009 4:18 pm
by Giovany Vecchi
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.

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

Posted: Tue Jan 06, 2009 5:45 pm
by Antonio Linares
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 ? :-)

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

Posted: Tue Jan 06, 2009 5:54 pm
by anserkk
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

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

Posted: Tue Jan 06, 2009 5:55 pm
by Enrico Maria Giordano
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

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

Posted: Tue Jan 06, 2009 6:30 pm
by Giovany Vecchi
I am not sure, but he/she should have this function so that it was detected automatically

http://msdn.microsoft.com/en-us/library ... S.85).aspx

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

Posted: Tue Jan 06, 2009 8:01 pm
by Antonio Linares