pygame documentation | || Home || Help Contents || || CD || Channel || Font || Joystick || Movie || Rect || Sound || || Surface || pygame || UserRect || cdrom || constants || cursors || display || || draw || event || font || image || joystick || key || mixer || || mixer_music || mouse || movie || surfarray || time || transform || version ||

## pygame.transform

Contains routines to transform a Surface image.
All transformation functions take a source Surface and return a new copy of that surface in the same format as the original.
Some of the filters are 'destructive', which means if you transform the image one way, you can't transform the image back to the exact same way as it was before. If you plan on doing many transforms, it is good practice to keep the original untransformed image, and only translate that image.

flip | - flips a surface on either axis
rotate | - rotate a Surface
rotozoom | - smoothly scale and/or rotate an image
scale | - scale a Surface to an arbitrary size

flip
`pygame.transform.flip(Surface, xaxis, yaxis) -> Surface`

Flips the image on the x-axis or the y-axis if the argument for that axis is true.
The flip operation is nondestructive, you may flip the image as many times as you like, and always be able to recreate the exact original image.

rotate
`pygame.transform.rotate(Surface, angle) -> Surface`

Rotates the image counterclockwise with the given angle (in degrees). The angle can be any floating point value (negative rotation amounts will do clockwise rotations)
Unless rotating by 90 degree increments, the resulting image size will be larger than the original. There will be newly uncovered areas in the image. These will filled with either the current colorkey for the Surface, or the topleft pixel value. (with the alpha channel zeroed out if available)
This transformation is not filtered.

rotozoom
`pygame.transform.rotozoom(Surface, angle, zoom) -> Surface`

This will smoothly rotate and scale an image in one pass. The resulting image will always be a 32bit version of the original surface. The scale is a multiplier for the image size, and angle is the degrees to rotate counter clockwise.
It calls the SDL_rotozoom library which is compiled in.

scale
`pygame.transform.scale(Surface, size) -> Surface`

This will resize a surface to the given resolution. The size is simply any 2 number sequence representing the width and height.
This transformation is not filtered.