I understood something.
If I have 2 sprites:
1- background.png (all red, no alpha)
2- foreground.png (all green, 50% alpha)

pyglet will display them perfectly.
but, doing a screenshot with color_buffer, it will be wrong.
It will produce a RGBA file. there will be the 50% alpha on the
foreground, but it will add 50% alpha on the background too !

here is the code:
http://paste.pocoo.org/show/185180/

On Mar 3, 4:24 pm, Philippe <[email protected]> wrote:
> I tried different encoder:
>         mgr = pyglet.image.get_buffer_manager()
>         # encoder = pyglet.image.codecs.png.PNGImageEncoder()
>         encoder = pyglet.image.codecs.pil.PILImageEncoder()
>         mgr.get_color_buffer().save("screenshot.png", encoder=encoder)
>
> But I never get a screenshot with alpha. It looks like a RGB, but I
> want RGBA
>
> On Mar 3, 3:31 pm, Tristam MacDonald <[email protected]> wrote:
>
> > On Wed, Mar 3, 2010 at 9:23 AM, Philippe <[email protected]> wrote:
> > > works well, but I get some issues with opacity.
> > > It seems that it does not handle correctly the alpha channel.
>
> > > any idea ?
>
> > Last time I tried it, the problem was that it *does* handle the alpha
> > channel correctly.
>
> > You probably don't want alpha in the image file, so either strip out the
> > alpha channel in Photoshop, or convert the result of get_colour_buffer() to
> > RGB format before writing it out.
>
> > --
> > Tristam MacDonaldhttp://swiftcoder.wordpress.com/

-- 
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.

Reply via email to