Hi,
I have no Mac... but I want to make my programming running on a Mac!
I have only a few points which aren't working.
One of them:
I have an ImageGadget() on the window. The window is red.
The image is a 4 color PNG with alphachannel.
I use CatchImage() to load it.
Result:
The background of the image is not transparent. It is white.
On windows it is working.
Is there a 'special' trick for Mac?
I think I also tried a 24bit colour with alphachannel. Same effect.
Bernd
PNG with Alphachannel
Re: PNG with Alphachannel
I thought png only did 32bit w/alpha and 8bit w/alpha?
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
-
jesperbrannmark
- Enthusiast

- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: PNG with Alphachannel
I know this is very sensitive on the mac. even if i screwed up the image slightly on windows - it didnt display or showed up as wrong. on mac my program crashed.
So bottom line - be careful and put in extra checks (which you should do doing good practice). use if isimage(XXX) for... well... everything.
So bottom line - be careful and put in extra checks (which you should do doing good practice). use if isimage(XXX) for... well... everything.
Re: PNG with Alphachannel
Hi,
here is a code snippet for testing:And here is the picture (save it as GuzziForumLogo.png):

And yes, it is 24bit with alphachannel. And it works in windows.
But not in Linux and not on Mac.
Bernd
here is a code snippet for testing:
Code: Select all
UsePNGImageDecoder()
OpenWindow(0, 0, 0, 300, 250, "Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0, $0000CC)
CatchImage(0, ?Logo)
ImageGadget(0, 50, 50, 195, 150, ImageID(0))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
DataSection
Logo: IncludeBinary "GuzziForumLogo.png"
EndDataSection
And yes, it is 24bit with alphachannel. And it works in windows.
But not in Linux and not on Mac.
Bernd
Last edited by infratec on Fri Dec 02, 2011 11:58 pm, edited 1 time in total.
-
jesperbrannmark
- Enthusiast

- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: PNG with Alphachannel
Works fine with me. Pb 4.6, lion, macbook air.
but that red color is ugly
but that red color is ugly
-
jesperbrannmark
- Enthusiast

- Posts: 536
- Joined: Mon Feb 16, 2009 10:42 am
- Location: sweden
- Contact:
Re: PNG with Alphachannel
Sorry. thoght it was a bug.
here is working transparent :
here is working transparent :
Code: Select all
UsePNGImageDecoder()
OpenWindow(0, 0, 0, 300, 250, "Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
SetWindowColor(0, $0000CC)
CatchImage(0, ?Logo)
CreateImage(1,ImageWidth(0),ImageHeight(0))
StartDrawing(ImageOutput(1))
Box(0,0,ImageWidth(0),ImageHeight(0),$0000cc)
DrawAlphaImage(ImageID(0),0,0,254)
StopDrawing()
FreeImage(0)
ImageGadget(0, 50, 50, 195, 150, ImageID(1))
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
DataSection
Logo: IncludeBinary "Gussi.png"
EndDataSectionRe: PNG with Alphachannel
Hi,
but when I set the colour of the box, than I don't need a transparent picture
In windows it looks like this:

That was the reason for transparency.
It is in the lower right corner and overlaps the statusbar.
Bernd
but when I set the colour of the box, than I don't need a transparent picture
In windows it looks like this:

That was the reason for transparency.
It is in the lower right corner and overlaps the statusbar.
Bernd

