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

[pygame] Behavior of pygame.transform.[smooth]scale(...)



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