I've spent another day digging into this problem. I made a test png with just four pixels so I can see the data. It is indeed being decoded as all zeros.
I was able to get QuartzImageDecoder to work one time, but I can't reproduce it. I was experimenting running the OSX default python2.6 instead of my framework build 2.7.2 in virtualenv. I'm using virtualenv and pyobjc v2.2. Does anybody know of incompatibilities with pyglet, virtualenv, and pyobjc2.2? Winston Wolff Stratolab - Games for Learning tel: (917) 543 8852 web: www.stratolab.com On Apr 6, 2012, at 5:27 PM, Winston Wolff wrote: > Hi Phillip- > > Thanks for taking the time to examine my problem. My example then is probably > a bad one because the corners are indeed transparent, but there are > non-transparent pixels later on. > >> What happens when you run >> python image_display.py pyglet.png > > Attached is a screenshot which shows that pyglet.png does not show up when > rendered by pyglet, but does appear with Preview.app. > > Winston Wolff > Stratolab - Games for Learning > tel: (917) 543 8852 > web: www.stratolab.com > <image_display_of_pyglet_png.png> > On Apr 6, 2012, at 5:16 PM, Phillip Nguyen wrote: > >>> Load an image using the default decoder, i.e. QuartzImageDecoder. >>> raw png data: '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01,' >>> image data: >>> '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x >>> 00\x00' >>> >>> Now remove the QuartzImageDecoder so we use the >>> pyglet.image.codecs.png.PNGImageDecoder. >>> raw png data: '\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x01,' >>> image data: >>> '\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff\x00\xff\xff\xff\x00' >> >> The QuartzImageDecoder premultiplies the color components by their >> alpha value during the decoding process. Unfortunately, there doesn't >> seem to be any alternative in cocoa to premultiplying alpha if you >> also want to be able to handle image data that might not be in nice >> formats. The pixels that you are looking at have zero alpha value, >> and so they become all zeros. You should be able to still render the >> image however. What happens when you run >> >> python image_display.py pyglet.png >> >> in the pyglet/examples directory? >> >> --phillip >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pyglet-users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/pyglet-users?hl=en. >> >> > > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
