[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Create alpha surfaces
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Create alpha surfaces
- From: Willem <willemsh@xxxxxxxxx>
- Date: Tue, 13 Sep 2005 22:03:39 +0200
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Tue, 13 Sep 2005 16:03:56 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=AFTMqG1pMPWEZixm7v0rb5YvwAy/o2LKFKgjv+ocECuCkh/crkBXyfX5B10Y1nNgb2GH3vfSb989mF4wdd7qEFTYcz1ddMaiDhv9D4r7xia9NbPzLsB3IZhxiGvMRmFBzxEV+TMFRpN2iJkcdT13Zb5cOqG/PKHhtqYIL1FqFBw=
- In-reply-to: <1126624208.8256.11.camel@petebox>
- References: <4326DD59.9040103@gmail.com> <1126624208.8256.11.camel@petebox>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
- User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)
Pete Shinners wrote:
> When you create the Surface, include the SRCALPHA flag. This will pretty
> much do what you want. The best way to test if the Surface really has
> per pixel alphas is to see if there is an alpha mask.
>
> size = 100, 100
> surf_with_alpha = pygame.Surface(size, pygame.SRCALPHA, 32)
> test_perpixel_alpha = surf_with_alpha.get_masks()[3] != 0
>
> Also, in the case where you already have an image and want to add
> perpixel alpha, you can call Surface.convert_alpha().
>
It works now, but then again, I had tried every possible combination of
flags and depth and I couldn't make it work before, I don't know.
Thanks again,
--willem