[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Alpha channels and per pixel alpha



Right, a surface created from an image with an alpha channel will have per-pixel alpha. If it doesn't then the image may have a blanket alpha or a colorkey instead.

Lenard

Brian Fisher wrote:
It would help to see your code and have an example image attached, cause loading .png's with alpha and blitting with transparency works fine for me without any trouble or special stuff.

On Wed, Jun 10, 2009 at 2:11 PM, Bjorn Samuelsson <bjorn_sam@xxxxxxxxxxx <mailto:bjorn_sam@xxxxxxxxxxx>> wrote:

    Hey all,
I'm trying to make a small 2d game and I'm wondering how you would
    go about to load a png-image with an alpha channel and keep it's
    alpha values?
    I have confirmed the images alpha channel but when i load it in
    pygame it's alpha values are always 255.
    I've tried Surface.convert_alpha but that doesn't make a difference.
    At the moment I've resorted to saving my alpha channels separate
    and loading both image and alpha channel so that i can call
    Surface.set_at to change the image's per pixel alpha value.
    But that solution seems less than optimal so i figured i would ask
    you guys.
regards
    Björn
ps. I apologize if this topic has been discussed at length already
    but i've been looking around and i just can't seem to find a
    simple solution. ds.

    ------------------------------------------------------------------------
    Invite your mail contacts to join your friends list with Windows
    Live Spaces. It's easy! Try it!
    <http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us>