Transforming surfaces

Playing with surfaces

PyGame have many function that can rotate, scale, or other fancy transformations. They are grouped in pygame.transform module. If have trouble with them just look at wikipedia.

pygame.transform.flip

pygame.transform.flip(Surface, xbool, ybool) flip vertically and horizontally

pygame.transform.scale

pygame.transform.scale(Surface, (width, height), DestSurface = None) resize to new resolution

pygame.transform.rotate

pygame.transform.rotate(Surface, angle) rotate an image

pygame.transform.rotozoom

pygame.transform.rotozoom(Surface, angle, scale) filtered scale and rotation

pygame.transform.scale2x

pygame.transform.scale2x(Surface, DestSurface = None) specialized image doubler

pygame.transform.smoothscale

pygame.transform.smoothscale(Surface, (width, height), DestSurface = None) scale a surface to an arbitrary size smoothly

pygame.transform.chop

pygame.transform.chop(Surface, rect) gets a copy of an image with an interior area removed

pygame.transform.laplacian

pygame.transform.laplacian(Surface, DestSurface = None) find edges in a surface

pygame.transform.average_surfaces

pygame.transform.average_surfaces(Surfaces, DestSurface = None) find the average surface from many surfaces

pygame.transform.threshold

pygame.transform.threshold(DestSurface, Surface, color, threshold = (0,0,0,0), diff_color = (0,0,0,0), change_return = True, Surface =None) finds which, and how many pixels in a surface are within a threshold of a color.