2
<title>pygame.transform</title>
3
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
6
<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
7
<table width=100%><tr><td bgcolor=c2fc20 align=center>
8
<a href=http://www.pygame.org>
9
<img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
10
<b>pygame documentation</b>
11
</td><td bgcolor=6aee28 align=center valign=top width=100%>
14
<a href=http://www.pygame.org>Home</a> ||
15
<a href=../index.html>Help Contents</a> ||
18
|| <a href=pygame.html>pygame</a> ||
19
<a href=pygame_cdrom.html>cdrom</a> ||
20
<a href=pygame_constants.html>constants</a> ||
21
<a href=pygame_display.html>display</a> ||
22
<a href=pygame_draw.html>draw</a> ||
23
<a href=pygame_event.html>event</a> ||<br>
24
|| <a href=pygame_font.html>font</a> ||
25
<a href=pygame_image.html>image</a> ||
26
<a href=pygame_joystick.html>joystick</a> ||
27
<a href=pygame_key.html>key</a> ||
28
<a href=pygame_mixer.html>mixer</a> ||
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
30
|| <a href=pygame_mouse.html>mouse</a> ||
31
<a href=pygame_movie.html>movie</a> ||
32
<a href=pygame_surfarray.html>surfarray</a> ||
33
<a href=pygame_time.html>time</a> ||
34
<a href=pygame_transform.html>transform</a> ||<br>
35
<br>|| <a href=CD.html>CD</a> ||
36
<a href=Channel.html>Channel</a> ||
37
<a href=Clock.html>Clock</a> ||
38
<a href=Font.html>Font</a> ||
39
<a href=Joystick.html>Joystick</a> ||
40
<a href=Movie.html>Movie</a> ||<br>
41
|| <a href=Rect.html>Rect</a> ||
42
<a href=Sound.html>Sound</a> ||
43
<a href=Surface.html>Surface</a> ||<br>
44
<br>|| <a href=pygame_cursors.html>cursors</a> ||
45
<a href=pygame_sprite.html>sprite</a> ||
46
<a href=pygame_version.html>version</a> ||<br>
49
</td></tr></table></td></tr></table>
51
<h2 align=center>pygame.transform</h2>
52
Contains routines to transform a Surface image.
54
All transformation functions take a source Surface and
55
return a new copy of that surface in the same format as
59
filters are 'destructive', which means if you transform
60
the image one way, you can't transform the image back to
61
the exact same way as it was before. If you plan on doing
62
many transforms, it is good practice to keep the original
63
untransformed image, and only translate that image.
68
<tr><td><a href=#flip>flip</a></td><td> -
69
flips a surface on either axis</td></tr>
72
<tr><td><a href=#rotate>rotate</a></td><td> -
73
rotate a Surface</td></tr>
76
<tr><td><a href=#rotozoom>rotozoom</a></td><td> -
77
smoothly scale and/or rotate an image</td></tr>
80
<tr><td><a href=#scale>scale</a></td><td> -
81
scale a Surface to an arbitrary size</td></tr>
88
<a name=flip><font size=+2><b>flip
89
</b></font><br><font size=+1><tt>
90
pygame.transform.flip(Surface, xaxis, yaxis) -> Surface
92
Flips the image on the x-axis or the y-axis if the argument
93
for that axis is true.
95
The flip operation is nondestructive, you may flip the image
96
as many times as you like, and always be able to recreate the
100
<a name=rotate><font size=+2><b>rotate
101
</b></font><br><font size=+1><tt>
102
pygame.transform.rotate(Surface, angle) -> Surface
104
Rotates the image counterclockwise with the given angle
105
(in degrees). The angle can be any floating point value
106
(negative rotation amounts will do clockwise rotations)
108
Unless rotating by 90 degree increments, the resulting image
109
size will be larger than the original. There will be newly
110
uncovered areas in the image. These will filled with either
111
the current colorkey for the Surface, or the topleft pixel value.
112
(with the alpha channel zeroed out if available)
114
This transformation is not filtered.
117
<a name=rotozoom><font size=+2><b>rotozoom
118
</b></font><br><font size=+1><tt>
119
pygame.transform.rotozoom(Surface, angle, zoom) -> Surface
121
The angle argument is the number of degrees to rotate
122
counter-clockwise. The angle can be any floating point value.
123
(negative rotation amounts will do clockwise rotations)
125
This will smoothly rotate and scale an image in one pass.
126
The resulting image will always be a 32bit version of the
127
original surface. The scale is a multiplier for the image
128
size, and angle is the degrees to rotate counter clockwise.
130
It calls the SDL_rotozoom library which is compiled in.
131
Note that the code in SDL_rotozoom is fairly messy and your
132
resulting image could be shifted and contain artifacts.
135
<a name=scale><font size=+2><b>scale
136
</b></font><br><font size=+1><tt>
137
pygame.transform.scale(Surface, size) -> Surface
139
This will resize a surface to the given resolution.
140
The size is simply any 2 number sequence representing
141
the width and height.
143
This transformation is not filtered.