Alpha Bitmaps on Button Bar

Alpha Bitmaps on Button Bar

Postby nageswaragunupudi » Tue Jul 14, 2009 10:33 pm

There is a problem with painting of some alpha bitmaps on buttonbars from version 9.04 onwards.

Image

Code: Select all  Expand view  RUN
#include 'fivewin.ch'

function Main()

   local oWnd, oBar

   DEFINE WINDOW oWnd TITLE 'Alpha Bitmaps on Button Bar'

   DEFINE BUTTONBAR oBar OF oWnd SIZE 64,64 2007

   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\up.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\down.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\plus.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\minus.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\phone.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\info.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\user.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\world.bmp'
   DEFINE BUTTON OF oBar FILE '\fwh\bitmaps\32x32\info.bmp'

   ACTIVATE WINDOW oWnd

return nil
 


These buttonbars were working properly in earlier versions. Upgrading the application with latest FWH versions is producing unacceptable look.

Here is the screenshot of the same program in version 9.03

Image

Similar is the case with some bitmaps in XBrowse also. The problem basically observed with 'many' ( not all ) alpha bitmaps in 32x32 folder

Can this be fixed ?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Alpha Bitmaps on Button Bar

Postby ukoenig » Wed Jul 15, 2009 12:02 am

Buttons and Buttonbar are working with real Hight-Resolution-Alpha-Channel-BMP's now.
The Bitmaps ( Down, Minus, Plus, Up ) have Alpha-Channels, but doesn't work.
I exported them as < Premultiplied Alpha > and it worked.
For the Test, I converted the transparent Background of BMP < Down >.
It is easy and 100 % working, to change them with Pixelformer => Import / Export

viewtopic.php?f=3&t=15008&p=77576&hilit=pixelformer#p77576

Image

A picture-viewer shows the original BMP < Down > transparent ( white Background )
Image
The Result after Export, shows a transparent Black Background
Image

Choose < Import > to convert BMP < UP >( with checked background ) :
Image

For Export, activate BMP-Format : < Premultipled Alpha >
Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Alpha Bitmaps on Button Bar

Postby nageswaragunupudi » Wed Jul 15, 2009 3:53 am

The Bitmaps ( Down, Minus, Plus, Up ) have Alpha-Channels, but doesn't work.
I exported them as < Premultiplied Alpha > and it worked.


That is the point. Most of the alpha bitmaps in the 32x32 folder are straight, not premultiplied alpha bitmaps and ABPaint works only with bitmaps with premultiplied alpha information.

Wish FWH provides these bitmaps converted as premultiplied, so that laymen like me can use them straight. Or still better ABpaint recognizes if the alpha is premultiplied or not and use appropriate painting algorithm. I am a novice in this area, but as a layman on the subject, I would like if this is provided by FW
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Alpha Bitmaps on Button Bar

Postby nageswaragunupudi » Wed Jul 15, 2009 6:58 am

Mr Uwe

Thanks

I downloaded pixelformer and converted all these bmps. Now all work excellently with the new ABPaint() of FWH
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10646
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Alpha Bitmaps on Button Bar

Postby ukoenig » Wed Jul 15, 2009 3:09 pm

To make it complete, the LOGO-Solution and Button-Convert :

Painting a Alpha-Blended-BMP-Logo from any Image ( for Buttons, it is the same ).
( You don't need to know anything about Layers.
That makes it easy for more inexperienced Graphic-application users )

A normal JPG-Photo ( Angelina.jpg ) is used.

1. We have to define on < Image-Properties > from the Top, that we want to work on a transparent Image.
We select < RGB-Colors with Alpha-Channel >.
We use the Brush ( transparent ) and paint the Background of the Photo.
There is a Tool < Magic Wall >. It detects the borders of a Color to be filled with a transparent Brush.
Inside a Photo, there is no single Background-Color.
This Tool is useful, to fill a Button-Background ( transparent ), if just 1 Color is detected.
This way, the old Buttons with a defined Background-Color, can easely converted to Alpha-Blended BMP's.
The Transparent-Level can be adjusted with a Dbl-Click on the Transparent-Symbol.
Image

2. We Export the Image as BMP with the < Premultiplied Alpha > Selection
Image

3. The Result.
Image

Changing a FWH-Button to Alpha-Blended BMP
1. We change the Propertie to Transparent
2. We set the transparent-level to 100 %
Image

We use the < Magic wall > to select the purple area, we want to change to transparent.
We fill the area, using the bucket-tool.
Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Alpha Bitmaps on Button Bar

Postby Antonio Linares » Thu Jul 16, 2009 6:40 pm

Uwe,

Many thanks for your tutorials. Really great :-)
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 42 guests