[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Behavior of pygame.transform.[smooth]scale(...)
- To: pygame-users@xxxxxxxx
- Subject: [pygame] Behavior of pygame.transform.[smooth]scale(...)
- From: Ian Mallett <geometrian@xxxxxxxxx>
- Date: Sat, 14 Jul 2012 23:11:32 -0700
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Sun, 15 Jul 2012 02:11:13 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=7lK7yHCMtQpQyCedNGlPi2orpiuIOEMPf8XxYe8RDIw=; b=T/gLuFRRIMKNCzDSi4uSpe6k1tMBaP9qvNrzKyqVmkRTEth2HU6LDBt7CQinet1lVx r/jywKLAtjMEawhoEFiBxKogcEUZwM13JboF8TJm1MIeFwXEq41OZi021MiO+hpfo1yj wq6wTEXnMU1/SLhBQbAeysZT0YSl+pG/1s9b0ngk1s2/Dv1ZmXDwQGhWM1C0qInWz6T6 Zia3bg7/yZVos97oiCa72pIzwimCZfC/vQUlO1Rk/w5Hi05pgOZrIOnClt1WjNuhm153 JFSCVm0x2VF+lp73Xs2sP+fnCHvfYyz6gVH+098Lsy7fU6H/kcAsGqiOymT1FbZECDN/ VKIQ==
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Hi,
I was working with the pygame.transform.[smooth]scale(...) functions. For smoothscale, I assume that the final parameter is provided for a similar reason to pygame.transform.scale(...).
I wrote the following test code (adapted from my program), which works fairly obviously:
#Does not work
light_surf = pygame.Surface(screen_size)
temp = pygame.image.load("data/light_falloff.png")
light_falloff = pygame.transform.smoothscale(temp,screen_size,light_surf)
pygame.image.save(light_falloff,"1.png")
#Works
light_surf = pygame.Surface(screen_size)
temp = pygame.image.load("data/light_falloff.png").convert() #<--- Note only difference here
light_falloff = pygame.transform.smoothscale(temp,screen_size,light_surf)
pygame.image.save(light_falloff,"2.png")
In the first case, the returned surface is . . . cropped on one side, I guess. It's strange. In any case, no exceptions are thrown; the result is just incorrect. I assume this is because, as per the docs, the destination surface must be the same format as the source surface. It would be nice to have an exception thrown in that case.
Thanks,
Ian