Toolbar images with transparency

Toolbar images with transparency

Postby codemaker » Mon Feb 06, 2012 9:09 pm

I am testing some toolbar options to implement in my program.
I have some .BMP files, some of them from \FWH\BITMAPS\32x32 are BMP files with transparency which is shown on image below correctly.
Then I decided to add more different BMP files (rightmost two) which are not transparent.

Image

I cannot figure out, what is the difference between the rightmost two BMP files and the rest of them I marked as shown with correct transparency. How can I design my own BMP to have transparencu on Toolbar. Tried PixelForm, doesn't work, the last BMP on right is created by PixelFormer PNG with transparency imported

I also used some PNG files with transparency and import them into PixelFormer and export as BMP with "premultiplied alpha" checked. I got the BMP with a black (alpha?) background. But, when I use them on Toolbar (see two righmost images above), they are not transparent.

I am missing something and I know I read something about grey pixel top-left of the image, but I think this was used when we started with FW, back to the 1.9.2 version, many years ago. And besides - what gray? There are houndreds of gray at least :)

Can somebody advice me what to do?
Before I solve this I cannot continue with what I try to do.

Thanks
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia

Re: Toolbar images with transparency

Postby codemaker » Mon Feb 06, 2012 9:33 pm

I took some rest, have something to eat and while I was chewing - I found the solution!
The BMP which shows ok had a background (255,0,255) - pink
The BMP PixelForm creates had background (0,0,0) - black

Then I remember I saw this part of code:
oImageList1:AddMasked( TBitmap():Define( "emailt1",, oWnd ), nRGB( 255, 0, 255 ) )

and I changed my PixelForm created image with black background to load this way

oImageList1:AddMasked( TBitmap():Define( "zupcat1",, oWnd ), nRGB( 0, 0, 0 ) )

Unfortunatelly my agony lasted longer because I was not able to find where to find the above sintax, so I had no idea about the parameters.
I just spoted these numbers, which look like a definition of FRGB color and gave it the shot.
Works

Let's move on, and this might save someone else hours of work
User avatar
codemaker
 
Posts: 208
Joined: Wed Dec 03, 2008 4:48 pm
Location: Belgrade, Serbia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 79 guests