Display Alpha channel 32 bit BMP on ButtonBMP (Solved)

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post by Antonio Linares »

Anser,

It is the same issue:

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

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

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

Post 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
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post 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 ) }
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

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

Post 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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

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

Post 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
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

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

Post 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.
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

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

Post 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 ? :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

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

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

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

Post 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
User avatar
Giovany Vecchi
Posts: 129
Joined: Mon Jun 05, 2006 9:39 pm
Location: Brasil

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

Post 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
Post Reply