pygame.transform

pygame module to transform surfaces

A Surface transform is an operation that moves or resizes the pixels. All these functions take a Surface to operate on and return a new Surface with the results.

Some of the transforms are considered destructive. These means every time they are performed they lose pixel data. Common examples of this are resizing and rotating. For this reason, it is better to retransform the original surface than to keep transforming an image multiple times. (For example, suppose you are animating a bouncing spring which expands and contracts. If you applied the size changes incrementally to the previous images, you would lose detail. Instead, always begin with the original image and scale to the desired size.)

1. pygame.transform.flip

pygame.transform.flip(Surface, xbool, ybool): return Surface

2. pygame.transform.scale

pygame.transform.scale(Surface, (width, height), DestSurface = None): return Surface

3. pygame.transform.rotate

pygame.transform.rotate(Surface, angle): return Surface

4. pygame.transform.rotozoom

pygame.transform.rotozoom(Surface, angle, scale): return Surface

5. pygame.transform.scale2x

pygame.transform.scale2x(Surface, DestSurface = None): Surface

6. pygame.transform.chop

pygame.transform.chop(Surface, rect): return Surface
ch3n2k.com | Copyright (c) 2004-2020 czk.