Mercurial > pygame
annotate docs/ref/transform.html @ 1849:301bc61643a9 math_module
merged changes from trunk
| author | lorenz |
|---|---|
| date | Mon, 16 Nov 2009 18:31:40 +0000 |
| parents | cfc16dce35e1 |
| children | f51d9315c3e5 |
| rev | line source |
|---|---|
| 627 | 1 |
| 2 <html> | |
| 3 <title>transform - Pygame Documentation</title> | |
| 4 <body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111> | |
| 5 | |
| 6 | |
| 651 | 7 <table cellpadding=0 cellspacing=0 border=0 style='border: 3px solid black;' width='100%'> |
| 8 <tr> | |
| 9 <td bgcolor='#c2fc20' style='padding: 6px;' align=center valign=center><a href='http://www.pygame.org/'><img src='../pygame_tiny.gif' border=0 width=200 height=60></a><br><b>pygame documentation</b></td> | |
| 10 <td bgcolor='#6aee28' style='border-left: 3px solid black; padding: 6px;' align=center valign=center> | |
| 627 | 11 || |
| 12 <a href=http://www.pygame.org>Pygame Home</a> || | |
| 13 <a href=../index.html>Help Contents</a> || | |
| 14 <a href=index.html>Reference Index</a> || | |
| 15 <br> <br> | |
| 16 | |
|
1323
1ca45b50f8ea
camera module with v4l2 support and colorspace conversion
Nirav Patel <nrp@eclecti.cc>
parents:
1264
diff
changeset
|
17 <a href="camera.html">Camera</a> || |
| 974 | 18 <a href="cdrom.html">Cdrom</a> || |
| 1037 | 19 <a href="color.html">Color</a> || |
| 974 | 20 <a href="cursors.html">Cursors</a> || |
| 21 <a href="display.html">Display</a> || | |
| 22 <a href="draw.html">Draw</a> || | |
| 23 <a href="event.html">Event</a> || | |
|
1448
c496066bc336
add examples module document page
Lenard Lindstrom <len-l@telus.net>
parents:
1419
diff
changeset
|
24 <a href="examples.html">Examples</a> || |
| 974 | 25 <a href="font.html">Font</a> || |
| 1849 | 26 <a href="freetype.html">Freetype</a> || |
| 1781 | 27 <a href="gfxdraw.html">Gfxdraw</a> || |
| 974 | 28 <a href="image.html">Image</a> || |
| 29 <a href="joystick.html">Joystick</a> || | |
| 30 <a href="key.html">Key</a> || | |
|
1373
d0e31483bd3b
Added a pygame.locals module page back into the docs
Lenard Lindstrom <len-l@telus.net>
parents:
1367
diff
changeset
|
31 <a href="locals.html">Locals</a> || |
| 974 | 32 <a href="mask.html">Mask</a> || |
|
1548
9379bdac652e
add event object comparison as per mailing list request
Lenard Lindstrom <len-l@telus.net>
parents:
1448
diff
changeset
|
33 <a href="midi.html">Midi</a> || |
| 974 | 34 <a href="mixer.html">Mixer</a> || |
| 35 <a href="mouse.html">Mouse</a> || | |
| 36 <a href="movie.html">Movie</a> || | |
| 37 <a href="music.html">Music</a> || | |
| 38 <a href="overlay.html">Overlay</a> || | |
| 39 <a href="pixelarray.html">Pixelarray</a> || | |
| 40 <a href="pygame.html">Pygame</a> || | |
| 41 <a href="rect.html">Rect</a> || | |
| 42 <a href="scrap.html">Scrap</a> || | |
| 43 <a href="sndarray.html">Sndarray</a> || | |
| 44 <a href="sprite.html">Sprite</a> || | |
| 45 <a href="surface.html">Surface</a> || | |
| 46 <a href="surfarray.html">Surfarray</a> || | |
|
1419
5f26c8759fa7
pygame.tests: added docs, go module and polished help messages
Lenard Lindstrom <len-l@telus.net>
parents:
1373
diff
changeset
|
47 <a href="tests.html">Tests</a> || |
| 974 | 48 <a href="time.html">Time</a> || |
| 49 <a href="transform.html">Transform</a> | |
| 651 | 50 </td></tr></table> |
| 627 | 51 <br> |
| 52 | |
| 53 | |
| 54 <a name="pygame.transform"> | |
| 55 <big><b>pygame.transform</big></b><br><ul> | |
| 56 <i>pygame module to transform surfaces</i><br> | |
| 57 <ul><small><table> | |
| 651 | 58 <tr><td><a href="transform.html#pygame.transform.flip">pygame.transform.flip</a> - <font size=-1>flip vertically and horizontally</font></td><td>flip vertically and horizontally</td></tr> |
| 59 <tr><td><a href="transform.html#pygame.transform.scale">pygame.transform.scale</a> - <font size=-1>resize to new resolution</font></td><td>resize to new resolution</td></tr> | |
| 60 <tr><td><a href="transform.html#pygame.transform.rotate">pygame.transform.rotate</a> - <font size=-1>rotate an image</font></td><td>rotate an image</td></tr> | |
| 61 <tr><td><a href="transform.html#pygame.transform.rotozoom">pygame.transform.rotozoom</a> - <font size=-1>filtered scale and rotation</font></td><td>filtered scale and rotation</td></tr> | |
| 62 <tr><td><a href="transform.html#pygame.transform.scale2x">pygame.transform.scale2x</a> - <font size=-1>specialized image doubler</font></td><td>specialized image doubler</td></tr> | |
|
834
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
63 <tr><td><a href="transform.html#pygame.transform.smoothscale">pygame.transform.smoothscale</a> - <font size=-1>scale a surface to an arbitrary size smoothly</font></td><td>scale a surface to an arbitrary size smoothly</td></tr> |
|
1363
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
64 <tr><td><a href="transform.html#pygame.transform.get_smoothscale_backend">pygame.transform.get_smoothscale_backend</a> - <font size=-1>return smoothscale filter version in use: 'GENERIC', 'MMX', or 'SSE'</font></td><td>return smoothscale filter version in use: 'GENERIC', 'MMX', or 'SSE'</td></tr> |
|
1367
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
65 <tr><td><a href="transform.html#pygame.transform.set_smoothscale_backend">pygame.transform.set_smoothscale_backend</a> - <font size=-1>set smoothscale filter version to one of: 'GENERIC', 'MMX', or 'SSE'</font></td><td>set smoothscale filter version to one of: 'GENERIC', 'MMX', or 'SSE'</td></tr> |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
66 <tr><td><a href="transform.html#pygame.transform.chop">pygame.transform.chop</a> - <font size=-1>gets a copy of an image with an interior area removed</font></td><td>gets a copy of an image with an interior area removed</td></tr> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
67 <tr><td><a href="transform.html#pygame.transform.laplacian">pygame.transform.laplacian</a> - <font size=-1>find edges in a surface</font></td><td>find edges in a surface</td></tr> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
68 <tr><td><a href="transform.html#pygame.transform.average_surfaces">pygame.transform.average_surfaces</a> - <font size=-1>find the average surface from many surfaces.</font></td><td>find the average surface from many surfaces.</td></tr> |
|
1264
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
69 <tr><td><a href="transform.html#pygame.transform.average_color">pygame.transform.average_color</a> - <font size=-1>finds the average color of a surface</font></td><td>finds the average color of a surface</td></tr> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
70 <tr><td><a href="transform.html#pygame.transform.threshold">pygame.transform.threshold</a> - <font size=-1>finds which, and how many pixels in a surface are within a threshold of a color.</font></td><td>finds which, and how many pixels in a surface are within a threshold of a color.</td></tr> |
| 627 | 71 </table></small></ul> |
| 72 <p><tt>A</tt> 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. </p> | |
| 629 | 73 <p>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 <tt>size.)</tt> </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
74 <!--COMMENTS:pygame.transform--> <br> |
| 627 | 75 |
| 76 | |
| 77 <a name="pygame.transform.flip"> | |
| 78 <big><b>pygame.transform.flip</big></b><br><ul> | |
| 79 <i>flip vertically and horizontally</i><br> | |
| 80 <tt>pygame.transform.flip(Surface, xbool, ybool): return Surface</tt><br> | |
| 81 <p>This can flip a Surface either vertically, horizontally, or both. Flipping a Surface is nondestructive and returns a new Surface with the same dimensions. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
82 <!--COMMENTS:pygame.transform.flip--> <br> |
| 627 | 83 <br></ul> |
| 84 | |
| 85 | |
| 86 <a name="pygame.transform.scale"> | |
| 87 <big><b>pygame.transform.scale</big></b><br><ul> | |
| 88 <i>resize to new resolution</i><br> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
89 <tt>pygame.transform.scale(Surface, (width, height), DestSurface = None): return Surface</tt><br> |
| 627 | 90 <p>Resizes the Surface to a new resolution. This is a fast scale operation that does not sample the results. </p> |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
91 <p>An optional destination surface can be used, rather than have it create a new one. This is quicker if you want to repeatedly scale something. However the destination must be the same size as the (width, height) passed in. Also the destination surface must be the same format. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
92 <!--COMMENTS:pygame.transform.scale--> <br> |
| 627 | 93 <br></ul> |
| 94 | |
| 95 | |
| 96 <a name="pygame.transform.rotate"> | |
| 97 <big><b>pygame.transform.rotate</big></b><br><ul> | |
| 98 <i>rotate an image</i><br> | |
| 99 <tt>pygame.transform.rotate(Surface, angle): return Surface</tt><br> | |
| 629 | 100 <p>Unfiltered counterclockwise rotation. The angle argument represents degrees and can be any floating point value. Negative angle amounts will rotate clockwise. </p> |
| 627 | 101 <p>Unless rotating by 90 degree increments, the image will be padded larger to hold the new size. If the image has pixel alphas, the padded area will be transparent. Otherwise pygame will pick a color that matches the Surface colorkey or the topleft pixel value. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
102 <!--COMMENTS:pygame.transform.rotate--> <br> |
| 627 | 103 <br></ul> |
| 104 | |
| 105 | |
| 106 <a name="pygame.transform.rotozoom"> | |
| 107 <big><b>pygame.transform.rotozoom</big></b><br><ul> | |
| 108 <i>filtered scale and rotation</i><br> | |
| 710 | 109 <tt>pygame.transform.rotozoom(Surface, angle, scale): return Surface</tt><br> |
| 629 | 110 <p>This is a combined scale and rotation transform. The resulting Surface will be a filtered 32-bit Surface. The scale argument is a floating point value that will be multiplied by the current resolution. The angle argument is a floating point value that represents the counterclockwise degrees to rotate. <tt>A</tt> negative rotation angle will rotate clockwise. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
111 <!--COMMENTS:pygame.transform.rotozoom--> <br> |
| 627 | 112 <br></ul> |
| 113 | |
| 114 | |
| 115 <a name="pygame.transform.scale2x"> | |
| 116 <big><b>pygame.transform.scale2x</big></b><br><ul> | |
| 117 <i>specialized image doubler</i><br> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
118 <tt>pygame.transform.scale2x(Surface, DestSurface = None): Surface</tt><br> |
| 627 | 119 <p>This will return a new image that is double the size of the original. It uses the AdvanceMAME Scale2X algorithm which does a 'jaggie-less' scale of bitmap graphics. </p> |
| 120 <p>This really only has an effect on simple images with solid colors. On photographic and antialiased images it will look like a regular unfiltered scale. </p> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
121 <p>An optional destination surface can be used, rather than have it create a new one. This is quicker if you want to repeatedly scale something. However the destination must be twice the size of the source surface passed in. Also the destination surface must be the same format. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
122 <!--COMMENTS:pygame.transform.scale2x--> <br> |
| 627 | 123 <br></ul> |
| 124 | |
| 125 | |
|
834
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
126 <a name="pygame.transform.smoothscale"> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
127 <big><b>pygame.transform.smoothscale</big></b><br><ul> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
128 <i>scale a surface to an arbitrary size smoothly</i><br> |
|
839
27d57af1f29d
Adding a pygame.mask.from_surface function but it's not working.
Rene Dudfield <renesd@gmail.com>
parents:
834
diff
changeset
|
129 <tt>pygame.transform.smoothscale(Surface, (width, height), DestSurface = None): return Surface</tt><br> |
|
834
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
130 <p>Uses one of two different algorithms for scaling each dimension of the input surface as required. For shrinkage, the output pixels are area averages of the colors they cover. For expansion, a bilinear filter is used. For the amd64 and i686 architectures, optimized <tt>MMX</tt> routines are included and will run much faster than other machine types. The size is a 2 number sequence for (width, height). This function only works for 24-bit or 32-bit surfaces. An exception will be thrown if the input surface bit depth is less than 24. </p> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
131 <p>New in pygame <tt>1.8</tt> </p> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
132 <!--COMMENTS:pygame.transform.smoothscale--> <br> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
133 <br></ul> |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
134 |
|
714963434e23
Added smoothscale function from Richard Goedeken.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
135 |
|
1363
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
136 <a name="pygame.transform.get_smoothscale_backend"> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
137 <big><b>pygame.transform.get_smoothscale_backend</big></b><br><ul> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
138 <i>return smoothscale filter version in use: 'GENERIC', 'MMX', or 'SSE'</i><br> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
139 <tt>pygame.transform.get_smoothscale_backend(): return String</tt><br> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
140 <p>Shows whether or not smoothscale is using <tt>MMX</tt> or <tt>SSE</tt> acceleration. If no acceleration is available then <tt>"GENERIC"</tt> is returned. For a x86 processor the level of acceleration to use is determined at runtime. </p> |
|
1367
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
141 <p>This function is provided for Pygame testing and debugging. </p> |
|
1363
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
142 <!--COMMENTS:pygame.transform.get_smoothscale_backend--> <br> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
143 <br></ul> |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
144 |
|
b56766170e70
color and transform doc updates
Lenard Lindstrom <len-l@telus.net>
parents:
1360
diff
changeset
|
145 |
|
1367
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
146 <a name="pygame.transform.set_smoothscale_backend"> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
147 <big><b>pygame.transform.set_smoothscale_backend</big></b><br><ul> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
148 <i>set smoothscale filter version to one of: 'GENERIC', 'MMX', or 'SSE'</i><br> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
149 <tt>pygame.transform.get_smoothscale_backend(type): return None</tt><br> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
150 <p>Sets smoothscale acceleration. Takes a string argument. <tt>A</tt> value of <tt>'GENERIC'</tt> turns off acceleration. <tt>'MMX'</tt> uses <tt>MMX</tt> instructions only. <tt>'SSE'</tt> allows <tt>SSE</tt> extensions as well. <tt>A</tt> value error is raised if type is not recognized or not supported by the current processor. </p> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
151 <p>This function is provided for Pygame testing and debugging. If smoothscale causes an invalid instruction error then it is a Pygame/SDL bug that should be reported. Use this function as a temporary fix only. </p> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
152 <!--COMMENTS:pygame.transform.set_smoothscale_backend--> <br> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
153 <br></ul> |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
154 |
|
4be2e6337c3f
add additional smoothscale testing capability to transform
Lenard Lindstrom <len-l@telus.net>
parents:
1363
diff
changeset
|
155 |
| 627 | 156 <a name="pygame.transform.chop"> |
| 157 <big><b>pygame.transform.chop</big></b><br><ul> | |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
158 <i>gets a copy of an image with an interior area removed</i><br> |
| 627 | 159 <tt>pygame.transform.chop(Surface, rect): return Surface</tt><br> |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
160 <p>Extracts a portion of an image. All vertical and horizontal pixels surrounding the given rectangle area are removed. The corner areas (diagonal to the rect) are then brought together. (The original image is not altered by this <tt>operation.)</tt> </p> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
161 <p><tt>NOTE:</tt> If you want a "crop" that returns the part of an image within a rect, you can blit with a rect to a new surface or copy a subsurface. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
629
diff
changeset
|
162 <!--COMMENTS:pygame.transform.chop--> <br> |
| 627 | 163 <br></ul> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
164 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
165 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
166 <a name="pygame.transform.laplacian"> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
167 <big><b>pygame.transform.laplacian</big></b><br><ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
168 <i>find edges in a surface</i><br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
169 <tt>pygame.transform.laplacian(Surface, DestSurface = None): return Surface</tt><br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
170 <p>Finds the edges in a surface using the laplacian algorithm. </p> |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
171 <p>New in pygame <tt>1.8</tt> </p> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
172 <!--COMMENTS:pygame.transform.laplacian--> <br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
173 <br></ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
174 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
175 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
176 <a name="pygame.transform.average_surfaces"> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
177 <big><b>pygame.transform.average_surfaces</big></b><br><ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
178 <i>find the average surface from many surfaces.</i><br> |
|
1821
cfc16dce35e1
cleaning camera module documentation and makeref on transform
Nirav Patel <nrp@eclecti.cc>
parents:
1781
diff
changeset
|
179 <tt>pygame.transform.average_surfaces(Surfaces, DestSurface = None, palette_colors = 1): return Surface</tt><br> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
180 <p>Takes a sequence of surfaces and returns a surface with average colors from each of the surfaces. </p> |
|
1821
cfc16dce35e1
cleaning camera module documentation and makeref on transform
Nirav Patel <nrp@eclecti.cc>
parents:
1781
diff
changeset
|
181 <p>palette_colors - if true we average the colors in palette, otherwise we average the pixel values. This is useful if the surface is actually greyscale colors, and not palette colors. </p> |
|
cfc16dce35e1
cleaning camera module documentation and makeref on transform
Nirav Patel <nrp@eclecti.cc>
parents:
1781
diff
changeset
|
182 <p>Note, this function currently does not handle palette using surfaces correctly. </p> |
|
cfc16dce35e1
cleaning camera module documentation and makeref on transform
Nirav Patel <nrp@eclecti.cc>
parents:
1781
diff
changeset
|
183 <p>New in pygame <tt>1.8</tt> palette_colors argument new in pygame <tt>1.9</tt> </p> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
184 <!--COMMENTS:pygame.transform.average_surfaces--> <br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
185 <br></ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
186 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
187 |
|
1264
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
188 <a name="pygame.transform.average_color"> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
189 <big><b>pygame.transform.average_color</big></b><br><ul> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
190 <i>finds the average color of a surface</i><br> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
191 <tt>pygame.transform.average_color(Surface, Rect = None): return Color</tt><br> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
192 <p>Finds the average color of a Surface or a region of a surface specified by a Rect, and returns it as a Color. </p> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
193 <!--COMMENTS:pygame.transform.average_color--> <br> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
194 <br></ul> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
195 |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
196 |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
197 <a name="pygame.transform.threshold"> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
198 <big><b>pygame.transform.threshold</big></b><br><ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
199 <i>finds which, and how many pixels in a surface are within a threshold of a color.</i><br> |
|
1360
7b18b561457f
Changed pygame.transform.threshold to behave like pygame 1.8 again.
Rene Dudfield <renesd@gmail.com>
parents:
1323
diff
changeset
|
200 <tt>pygame.transform.threshold(DestSurface, Surface, color, threshold = (0,0,0,0), diff_color = (0,0,0,0), change_return = 1, Surface = None, inverse = False): return num_threshold_pixels</tt><br> |
|
1264
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
201 <p>Finds which, and how many pixels in a surface are within a threshold of a color. </p> |
|
eeaeedcd46b8
transform module additions and changes
Nirav Patel <nrp@eclecti.cc>
parents:
1221
diff
changeset
|
202 <p>It can set the destination surface where all of the pixels not within the threshold are changed to diff_color. If inverse is optionally set to True, the pixels that are within the threshold are instead changed to diff_color. </p> |
|
1360
7b18b561457f
Changed pygame.transform.threshold to behave like pygame 1.8 again.
Rene Dudfield <renesd@gmail.com>
parents:
1323
diff
changeset
|
203 <p>If the optional second surface is given, it is used to threshold against rather than the specified color. That is, it will find each pixel in the first Surface that is within the threshold of the pixel at the same coordinates of the second Surface. </p> |
|
7b18b561457f
Changed pygame.transform.threshold to behave like pygame 1.8 again.
Rene Dudfield <renesd@gmail.com>
parents:
1323
diff
changeset
|
204 <p>If change_return is set to 0, it can be used to just count the number of pixels within the threshold if you set </p> |
|
7b18b561457f
Changed pygame.transform.threshold to behave like pygame 1.8 again.
Rene Dudfield <renesd@gmail.com>
parents:
1323
diff
changeset
|
205 <p>If change_return is set to 1, the pixels set in DestSurface will be those from the color. </p> |
|
7b18b561457f
Changed pygame.transform.threshold to behave like pygame 1.8 again.
Rene Dudfield <renesd@gmail.com>
parents:
1323
diff
changeset
|
206 <p>If change_return is set to 2, the pixels set in DestSurface will be those from the first Surface. </p> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
207 <p>You can use a threshold of (r,g,b,a) where the r,g,b can have different thresholds. So you could use an r threshold of 40 and a blue threshold of 2 if you like. </p> |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
902
diff
changeset
|
208 <p>New in pygame <tt>1.8</tt> </p> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
209 <!--COMMENTS:pygame.transform.threshold--> <br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
839
diff
changeset
|
210 <br></ul> |
| 627 | 211 <br></ul> |
| 212 | |
| 213 </body></html> |
