Can't get .png transparency to work

Linux specific forum
nospam
Enthusiast
Enthusiast
Posts: 130
Joined: Mon Nov 12, 2012 9:15 am

Can't get .png transparency to work

Post by nospam »

Hi,

Does anyone know how to get the ImageGadget to display a .png image that has a transparent background?

I have this code:

Code: Select all

UsePNGImageDecoder()
LoadImage(#Img_0,"/media/boot/MASTER/temp/m2na.png")
ImageGadget(#Image_3, 1130, 780, 16, 16, ImageID(#Img_0))
According to the help text:
When an image is loaded, it is converted either in 24-bit (if the image depth is less or equal to 24-bit) or in 32-bit (if the image has an alpha-channel).
I see nothing that implies transparency isn't suported. I loaded the image in Gnome Image Viewer and GIMP in Linux and with Snagit in Window$. I also created a simple app in Visual Studio 2010. All 4 tests confirmed that the image definitely has a transparent background but it's not displayed as transparent in PB 5.

OS: Linux Mint 14 Nadia (derived from Ubuntu 12.10)
Kernel: 3.5.0-17-generic

Edit: I loaded several images with transparency into different ToolBarImageButtons and they display correctly.
User avatar
Shardik
Addict
Addict
Posts: 2067
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Can't get .png transparency to work

Post by Shardik »

One solution could be to grab the background and draw the transparent PNG image into the background image:
http://www.purebasic.fr/english/viewtop ... 04&start=2
nospam
Enthusiast
Enthusiast
Posts: 130
Joined: Mon Nov 12, 2012 9:15 am

Re: Can't get .png transparency to work

Post by nospam »

Shardik wrote:One solution could be to grab the background and draw the transparent PNG image into the background image:
http://www.purebasic.fr/english/viewtop ... 04&start=2
Ok, I see what's going on. Thanks for that. Is this aparent lack of support for transparency in ImageGadgets a known problem?
Post Reply