FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Alpha Bitmaps on Button Bar
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Alpha Bitmaps on Button Bar
Posted: Tue Jul 14, 2009 10:33 PM
There is a problem with painting of some alpha bitmaps on buttonbars from version 9.04 onwards.



Code (fw): Select all Collapse
#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



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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Alpha Bitmaps on Button Bar
Posted: 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



A picture-viewer shows the original BMP < Down > transparent ( white Background )

The Result after Export, shows a transparent Black Background


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


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


Best Regards
Uwe :-)
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.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Alpha Bitmaps on Button Bar
Posted: Wed Jul 15, 2009 03: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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Alpha Bitmaps on Button Bar
Posted: Wed Jul 15, 2009 06: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
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Alpha Bitmaps on Button Bar
Posted: Wed Jul 15, 2009 03: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.


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


3. The Result.


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


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


Best Regards
Uwe :-)
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.
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Alpha Bitmaps on Button Bar
Posted: Thu Jul 16, 2009 06:40 PM

Uwe,

Many thanks for your tutorials. Really great :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion