[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] [BUG] SRCALPHA - unexpected behaviour.
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] [BUG] SRCALPHA - unexpected behaviour.
- From: "René Dudfield" <renesd@xxxxxxxxx>
- Date: Sat, 18 Aug 2007 12:20:22 +1000
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Fri, 17 Aug 2007 22:20:31 -0400
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=S1ULJGXWWxvxFHYpUXmHUk77cs653VmSuOu2Fvj4Yq8Rmr1F2MkSVqfr8ekcIzZGrO/DOF5sHdxNwGaS/6hEtrHmZXSX0nEyhvkCFw77nE2ubgLtr7QG44yaPzNW8RUNyc+lFR7TyT5JzcJFxt7U11W5UaZCbDLlhNivrh2Ac10=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ol07WA/Wb0/QjodzUv3pRyQh23ytY21sLFaNHVtTjxF9j8tPaK2KiJzHgHO6cw7sA5FF2jcDz63nSLVqdJmI1RdDE+RsyljKhbvj0GhLX0HWpdrrObK45iu4y0XSA91xpYs3+OmxUqcl+J4etXxM4MdkWRMJCICgwWtGg9dzAe0=
- In-reply-to: <46C638CF.2000301@xxxxxxxxx>
- References: <64ddb72c0708171537r300925b5gc0bb77c9ef08ab5e@xxxxxxxxxxxxxx> <46C638CF.2000301@xxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
oh yeah...
I should have put:
import pygame
surf = pygame.Surface((100, 100), pygame.SRCALPHA)
flags = surf.get_flags()
depth = surf.get_bitsize()
if depth == 32:
assert(flags & pygame.SRCALPHA == pygame.SRCALPHA)
else:
print "surface default is not 32bit"
On 8/18/07, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
> Actually in this case the surface depth should be a required argument.
> The surface depth is not guaranteed to be 32 bits. My display is set at
> 24 bits, and so that is the default depth for any new surface on my
> machine. If you want per-pixel alpha then is must be explicitly specified.
>
>
> René Dudfield wrote:
> > After a chat on irc today, this unexpected behaviour popped up again.
> > It's bit me a few times, as well as people in irc.
> >
> >
> > import pygame
> > surf = pygame.Surface((100, 100), pygame.SRCALPHA)
> > flags = surf.get_flags()
> > depth = surf.get_bitsize()
> > assert(depth == 32)
> > assert(flags & pygame.SRCALPHA == pygame.SRCALPHA)
> >
> > You would expect that surface to have the SRCALPHA flag if the surface
> > was 32bit right?
> >
> > It doesn't at the moment. But is there a good reason why it does not?
> >
> > I can understand that if the surface returned was 16bit, or 8bit that
> > the SRCALPHA flag is not set. However if it's 32bit, then I think it
> > probably should be set.
> >
> > What do you think? Is there something we're missing?
> >
> > Can you see something breaking if I change this? So that if SRCALPHA
> > is specified, and the bitsize is 32, then use the SRCALPHA flag. If
> > someone specifies the SRCALPHA flag I think they expect it to be used
> > - especially if the surface is 32 bit anyway.
> >
>
>