Page 1 of 1

Can't get .png transparency to work

Posted: Tue Nov 27, 2012 8:04 am
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.

Re: Can't get .png transparency to work

Posted: Tue Nov 27, 2012 8:42 am
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

Re: Can't get .png transparency to work

Posted: Tue Nov 27, 2012 9:18 am
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?