It is currently Wed Jun 19, 2013 5:13 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: PNG with Alphachannel
PostPosted: Fri Dec 02, 2011 11:29 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 1468
Location: Germany
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


Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Fri Dec 02, 2011 11:33 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1624
Location: USA
I thought png only did 32bit w/alpha and 8bit w/alpha?

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Fri Dec 02, 2011 11:43 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
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.


Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Fri Dec 02, 2011 11:55 pm 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 1468
Location: Germany
Hi,

here is a code snippet for testing:
Code:
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 here is the picture (save it as GuzziForumLogo.png):

Image

And yes, it is 24bit with alphachannel. And it works in windows.
But not in Linux and not on Mac. :cry:

Bernd


Last edited by infratec on Fri Dec 02, 2011 11:58 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Fri Dec 02, 2011 11:58 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Works fine with me. Pb 4.6, lion, macbook air.
but that red color is ugly


Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Sat Dec 03, 2011 12:01 am 
Offline
Enthusiast
Enthusiast

Joined: Mon Feb 16, 2009 10:42 am
Posts: 531
Location: sweden
Sorry. thoght it was a bug.
here is working transparent :
Code:
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"
EndDataSection


Top
 Profile  
 
 Post subject: Re: PNG with Alphachannel
PostPosted: Sat Dec 03, 2011 12:13 am 
Offline
Addict
Addict

Joined: Sun Sep 07, 2008 12:45 pm
Posts: 1468
Location: Germany
Hi,

but when I set the colour of the box, than I don't need a transparent picture :!:

In windows it looks like this:

Image

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

Bernd


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye