Mercurial > pygame
annotate docs/ref/surface.html @ 1849:301bc61643a9 math_module
merged changes from trunk
| author | lorenz |
|---|---|
| date | Mon, 16 Nov 2009 18:31:40 +0000 |
| parents | 02c1e8e9c102 |
| children |
| rev | line source |
|---|---|
| 627 | 1 |
| 2 <html> | |
| 3 <title>surface - 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:
1234
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:
1323
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:
1525
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.Surface"> | |
| 55 <big><b>pygame.Surface</big></b><br><ul> | |
| 56 <i>pygame object for representing images</i><br> | |
| 57 <tt>pygame.Surface((width, height), flags=0, depth=0, masks=None): return Surface</tt><br> | |
| 58 <tt>pygame.Surface((width, height), flags=0, Surface): return Surface</tt><br> | |
| 59 <ul><small><table> | |
| 651 | 60 <tr><td><a href="surface.html#Surface.blit">Surface.blit</a> - <font size=-1>draw one image onto another</font></td><td>draw one image onto another</td></tr> |
| 61 <tr><td><a href="surface.html#Surface.convert">Surface.convert</a> - <font size=-1>change the pixel format of an image</font></td><td>change the pixel format of an image</td></tr> | |
| 62 <tr><td><a href="surface.html#Surface.convert_alpha">Surface.convert_alpha</a> - <font size=-1>change the pixel format of an image including per pixel alphas</font></td><td>change the pixel format of an image including per pixel alphas</td></tr> | |
| 63 <tr><td><a href="surface.html#Surface.copy">Surface.copy</a> - <font size=-1>create a new copy of a Surface</font></td><td>create a new copy of a Surface</td></tr> | |
| 64 <tr><td><a href="surface.html#Surface.fill">Surface.fill</a> - <font size=-1>fill Surface with a solid color</font></td><td>fill Surface with a solid color</td></tr> | |
|
1525
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
65 <tr><td><a href="surface.html#Surface.scroll">Surface.scroll</a> - <font size=-1>Shift the surface image in place</font></td><td>Shift the surface image in place</td></tr> |
| 651 | 66 <tr><td><a href="surface.html#Surface.set_colorkey">Surface.set_colorkey</a> - <font size=-1>Set the transparent colorkey</font></td><td>Set the transparent colorkey</td></tr> |
| 67 <tr><td><a href="surface.html#Surface.get_colorkey">Surface.get_colorkey</a> - <font size=-1>Get the current transparent colorkey</font></td><td>Get the current transparent colorkey</td></tr> | |
| 68 <tr><td><a href="surface.html#Surface.set_alpha">Surface.set_alpha</a> - <font size=-1>set the alpha value for the full Surface image</font></td><td>set the alpha value for the full Surface image</td></tr> | |
| 69 <tr><td><a href="surface.html#Surface.get_alpha">Surface.get_alpha</a> - <font size=-1>get the current Surface transparency value</font></td><td>get the current Surface transparency value</td></tr> | |
| 70 <tr><td><a href="surface.html#Surface.lock">Surface.lock</a> - <font size=-1>lock the Surface memory for pixel access</font></td><td>lock the Surface memory for pixel access</td></tr> | |
| 71 <tr><td><a href="surface.html#Surface.unlock">Surface.unlock</a> - <font size=-1>unlock the Surface memory from pixel access</font></td><td>unlock the Surface memory from pixel access</td></tr> | |
| 72 <tr><td><a href="surface.html#Surface.mustlock">Surface.mustlock</a> - <font size=-1>test if the Surface requires locking</font></td><td>test if the Surface requires locking</td></tr> | |
| 73 <tr><td><a href="surface.html#Surface.get_locked">Surface.get_locked</a> - <font size=-1>test if the Surface is current locked</font></td><td>test if the Surface is current locked</td></tr> | |
|
1137
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
74 <tr><td><a href="surface.html#Surface.get_locks">Surface.get_locks</a> - <font size=-1>Gets the locks for the Surface</font></td><td>Gets the locks for the Surface</td></tr> |
| 651 | 75 <tr><td><a href="surface.html#Surface.get_at">Surface.get_at</a> - <font size=-1>get the color value at a single pixel</font></td><td>get the color value at a single pixel</td></tr> |
| 76 <tr><td><a href="surface.html#Surface.set_at">Surface.set_at</a> - <font size=-1>set the color value for a single pixel</font></td><td>set the color value for a single pixel</td></tr> | |
| 77 <tr><td><a href="surface.html#Surface.get_palette">Surface.get_palette</a> - <font size=-1>get the color index palette for an 8bit Surface</font></td><td>get the color index palette for an 8bit Surface</td></tr> | |
| 78 <tr><td><a href="surface.html#Surface.get_palette_at">Surface.get_palette_at</a> - <font size=-1>get the color for a single entry in a palette</font></td><td>get the color for a single entry in a palette</td></tr> | |
| 79 <tr><td><a href="surface.html#Surface.set_palette">Surface.set_palette</a> - <font size=-1>set the color palette for an 8bit Surface</font></td><td>set the color palette for an 8bit Surface</td></tr> | |
| 80 <tr><td><a href="surface.html#Surface.set_palette_at">Surface.set_palette_at</a> - <font size=-1>set the color for a single index in an 8bit Surface palette</font></td><td>set the color for a single index in an 8bit Surface palette</td></tr> | |
| 81 <tr><td><a href="surface.html#Surface.map_rgb">Surface.map_rgb</a> - <font size=-1>convert a color into a mapped color value</font></td><td>convert a color into a mapped color value</td></tr> | |
| 82 <tr><td><a href="surface.html#Surface.unmap_rgb">Surface.unmap_rgb</a> - <font size=-1>convert a mapped integer color value into a Color</font></td><td>convert a mapped integer color value into a Color</td></tr> | |
| 83 <tr><td><a href="surface.html#Surface.set_clip">Surface.set_clip</a> - <font size=-1>set the current clipping area of the Surface</font></td><td>set the current clipping area of the Surface</td></tr> | |
|
1036
e0f8354aa687
Some documentation updates... mainly updating sprite docs. More to do...
Rene Dudfield <renesd@gmail.com>
parents:
974
diff
changeset
|
84 <tr><td><a href="surface.html#Surface.get_clip">Surface.get_clip</a> - <font size=-1>get the current clipping area of the Surface</font></td><td>get the current clipping area of the Surface</td></tr> |
| 651 | 85 <tr><td><a href="surface.html#Surface.subsurface">Surface.subsurface</a> - <font size=-1>create a new surface that references its parent</font></td><td>create a new surface that references its parent</td></tr> |
| 86 <tr><td><a href="surface.html#Surface.get_parent">Surface.get_parent</a> - <font size=-1>find the parent of a subsurface</font></td><td>find the parent of a subsurface</td></tr> | |
| 87 <tr><td><a href="surface.html#Surface.get_abs_parent">Surface.get_abs_parent</a> - <font size=-1>find the top level parent of a subsurface</font></td><td>find the top level parent of a subsurface</td></tr> | |
| 88 <tr><td><a href="surface.html#Surface.get_offset">Surface.get_offset</a> - <font size=-1>find the position of a child subsurface inside a parent</font></td><td>find the position of a child subsurface inside a parent</td></tr> | |
| 89 <tr><td><a href="surface.html#Surface.get_abs_offset">Surface.get_abs_offset</a> - <font size=-1>find the absolute position of a child subsurface inside its top level parent</font></td><td>find the absolute position of a child subsurface inside its top level parent</td></tr> | |
| 90 <tr><td><a href="surface.html#Surface.get_size">Surface.get_size</a> - <font size=-1>get the dimensions of the Surface</font></td><td>get the dimensions of the Surface</td></tr> | |
| 91 <tr><td><a href="surface.html#Surface.get_width">Surface.get_width</a> - <font size=-1>get the width of the Surface</font></td><td>get the width of the Surface</td></tr> | |
| 92 <tr><td><a href="surface.html#Surface.get_height">Surface.get_height</a> - <font size=-1>get the height of the Surface</font></td><td>get the height of the Surface</td></tr> | |
| 93 <tr><td><a href="surface.html#Surface.get_rect">Surface.get_rect</a> - <font size=-1>get the rectangular area of the Surface</font></td><td>get the rectangular area of the Surface</td></tr> | |
| 94 <tr><td><a href="surface.html#Surface.get_bitsize">Surface.get_bitsize</a> - <font size=-1>get the bit depth of the Surface pixel format</font></td><td>get the bit depth of the Surface pixel format</td></tr> | |
| 95 <tr><td><a href="surface.html#Surface.get_bytesize">Surface.get_bytesize</a> - <font size=-1>get the bytes used per Surface pixel</font></td><td>get the bytes used per Surface pixel</td></tr> | |
| 96 <tr><td><a href="surface.html#Surface.get_flags">Surface.get_flags</a> - <font size=-1>get the additional flags used for the Surface</font></td><td>get the additional flags used for the Surface</td></tr> | |
| 97 <tr><td><a href="surface.html#Surface.get_pitch">Surface.get_pitch</a> - <font size=-1>get the number of bytes used per Surface row</font></td><td>get the number of bytes used per Surface row</td></tr> | |
| 98 <tr><td><a href="surface.html#Surface.get_masks">Surface.get_masks</a> - <font size=-1>the bitmasks needed to convert between a color and a mapped integer</font></td><td>the bitmasks needed to convert between a color and a mapped integer</td></tr> | |
|
1234
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
99 <tr><td><a href="surface.html#Surface.set_masks">Surface.set_masks</a> - <font size=-1>set the bitmasks needed to convert between a color and a mapped integer</font></td><td>set the bitmasks needed to convert between a color and a mapped integer</td></tr> |
| 651 | 100 <tr><td><a href="surface.html#Surface.get_shifts">Surface.get_shifts</a> - <font size=-1>the bit shifts needed to convert between a color and a mapped integer</font></td><td>the bit shifts needed to convert between a color and a mapped integer</td></tr> |
|
1234
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
101 <tr><td><a href="surface.html#Surface.set_shifts">Surface.set_shifts</a> - <font size=-1>sets the bit shifts needed to convert between a color and a mapped integer</font></td><td>sets the bit shifts needed to convert between a color and a mapped integer</td></tr> |
| 651 | 102 <tr><td><a href="surface.html#Surface.get_losses">Surface.get_losses</a> - <font size=-1>the significant bits used to convert between a color and a mapped integer</font></td><td>the significant bits used to convert between a color and a mapped integer</td></tr> |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
103 <tr><td><a href="surface.html#Surface.get_bounding_rect">Surface.get_bounding_rect</a> - <font size=-1>find the smallest rect containing data</font></td><td>find the smallest rect containing data</td></tr> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
104 <tr><td><a href="surface.html#Surface.get_buffer">Surface.get_buffer</a> - <font size=-1>acquires a buffer object for the pixels of the Surface.</font></td><td>acquires a buffer object for the pixels of the Surface.</td></tr> |
| 627 | 105 </table></small></ul> |
| 106 <p><tt>A</tt> pygame Surface is used to represent any image. The Surface has a fixed resolution and pixel format. Surfaces with 8bit pixels use a color palette to map to 24bit color. </p> | |
| 651 | 107 <p>Call <tt><a href="surface.html#pygame.Surface">pygame.Surface</a> - <font size=-1>pygame object for representing images</font></tt> to create a new image object. The Surface will be cleared to all black. The only required arguments are the sizes. With no additional arguments, the Surface will be created in a format that best matches the display Surface. </p> |
| 627 | 108 <p>The pixel format can be controlled by passing the bit depth or an existing Surface. The flags argument is a bitmask of additional features for the surface. You can pass any combination of these flags: </p> |
| 109 <pre> HWSURFACE, creates the image in video memory | |
| 110 SRCALPHA, the pixel format will include a per-pixel alpha | |
| 111 </pre><p>Both flags are only a request, and may not be possible for all displays and formats. </p> | |
| 112 <p>Advance users can combine a set of bitmasks with a depth value. The masks are a set of 4 integers representing which bits in a pixel will represent each color. Normal Surfaces should not require the masks argument. </p> | |
| 1839 | 113 <p>Surfaces can have many extra attributes like alpha planes, colorkeys, source rectangle clipping. These functions mainly effect how the Surface is blitted to other Surfaces. The blit routines will attempt to use hardware acceleration when possible, otherwise they will use highly optimized software blitting methods. </p> |
| 114 <p>There are three types of transparency supported in Pygame: colorkeys, surface alphas, and pixel alphas. Surface alphas can be mixed with colorkeys, but an image with per pixel alphas cannot use the other modes. Colorkey transparency makes a single color value transparent. Any pixels matching the colorkey will not be drawn. The surface alpha value is a single value that changes the transparency for the entire image. <tt>A</tt> surface alpha of 255 is opaque, and a value of 0 is completely transparent. </p> | |
| 627 | 115 <p>Per pixel alphas are different because they store a transparency value for every pixel. This allows for the most precise transparency effects, but it also the slowest. Per pixel alphas cannot be mixed with surface alpha and colorkeys. </p> |
| 116 <p>There is support for pixel access for the Surfaces. Pixel access on hardware surfaces is slow and not recommended. Pixels can be accessed using the get_at() and set_at() functions. These methods are fine for simple access, but will be considerably slow when doing of pixel work with them. If you plan on doing a lot of pixel level work, it is recommended to use the <tt>pygame.surfarray</tt> module, which can treat the surfaces like large multidimensional arrays (and it's quite quick). </p> | |
| 117 <p>Any functions that directly access a surface's pixel data will need that surface to be lock()'ed. These functions can lock() and unlock() the surfaces themselves without assistance. But, if a function will be called many times, there will be a lot of overhead for multiple locking and unlocking of the surface. It is best to lock the surface manually before making the function call many times, and then unlocking when you are finished. All functions that need a locked surface will say so in their docs. Remember to leave the Surface locked only while necessary. </p> | |
| 651 | 118 <p>Surface pixels are stored internally as a single number that has all the colors encoded into it. Use the <tt><a href="surface.html#Surface.map_rgb">Surface.map_rgb</a> - <font size=-1>convert a color into a mapped color value</font></tt> and <tt><a href="surface.html#Surface.unmap_rgb">Surface.unmap_rgb</a> - <font size=-1>convert a mapped integer color value into a Color</font></tt> to convert between individual red, green, and blue values into a packed integer for that Surface. </p> |
| 119 <p>Surfaces can also reference sections of other Surfaces. These are created with the <tt><a href="surface.html#Surface.subsurface">Surface.subsurface</a> - <font size=-1>create a new surface that references its parent</font></tt> method. Any change to either Surface will effect the other. </p> | |
| 627 | 120 <p>Each Surface contains a clipping area. By default the clip area covers the entire Surface. If it is changed, all drawing operations will only effect the smaller area. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
121 <!--COMMENTS:pygame.Surface--> <br> |
| 627 | 122 |
| 123 | |
| 124 <a name="Surface.blit"> | |
| 125 <big><b>Surface.blit</big></b><br><ul> | |
| 126 <i>draw one image onto another</i><br> | |
| 710 | 127 <tt>Surface.blit(source, dest, area=None, special_flags = 0): return Rect</tt><br> |
| 627 | 128 <p>Draws a source Surface onto this Surface. The draw can be positioned with the dest argument. Dest can either be pair of coordinates representing the upper left corner of the source. <tt>A</tt> Rect can also be passed as the destination and the topleft corner of the rectangle will be used as the position for the blit. The size of the destination rectangle does not effect the blit. </p> |
| 129 <p>An optional area rectangle can be passed as well. This represents a smaller portion of the source Surface to draw. </p> | |
|
1221
25886fe3a0e8
Bugfix and test for transform.threshold, updated docs (thanks Nirav), added basic tagging to run_tests.py/test_runner.py.
akalias
parents:
1137
diff
changeset
|
130 <p>An optional special flags is for passing in new in <tt>1.8.0:</tt> <tt>BLEND_ADD</tt>, <tt>BLEND_SUB</tt>, <tt>BLEND_MULT</tt>, <tt>BLEND_MIN</tt>, <tt>BLEND_MAX</tt> new in <tt>1.8.1:</tt> <tt>BLEND_RGBA_ADD</tt>, <tt>BLEND_RGBA_SUB</tt>, <tt>BLEND_RGBA_MULT</tt>, <tt>BLEND_RGBA_MIN</tt>, <tt>BLEND_RGBA_MAX</tt> <tt>BLEND_RGB_ADD</tt>, <tt>BLEND_RGB_SUB</tt>, <tt>BLEND_RGB_MULT</tt>, <tt>BLEND_RGB_MIN</tt>, <tt>BLEND_RGB_MAX</tt> With other special blitting flags perhaps added in the future. </p> |
| 710 | 131 <p>The return rectangle is the area of the affected pixels, excluding any pixels outside the destination Surface, or outside the clipping area. </p> |
| 627 | 132 <p>Pixel alphas will be ignored when blitting to an 8 bit Surface. </p> |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
133 <p>special_flags new in pygame <tt>1.8</tt>. </p> |
|
1524
28a601e11e62
fix surface self-blits for colorkey and blanket alpha: Bugzilla Bug 19
Lenard Lindstrom <len-l@telus.net>
parents:
1448
diff
changeset
|
134 <p>For a surface with colorkey or blanket alpha, a blit to self may give slightly different colors than a non self-blit. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
135 <!--COMMENTS:Surface.blit--> <br> |
| 627 | 136 <br></ul> |
| 137 | |
| 138 | |
| 139 <a name="Surface.convert"> | |
| 140 <big><b>Surface.convert</big></b><br><ul> | |
| 141 <i>change the pixel format of an image</i><br> | |
| 142 <tt>Surface.convert(Surface): return Surface</tt><br> | |
| 143 <tt>Surface.convert(depth, flags=0): return Surface</tt><br> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
144 <tt>Surface.convert(masks, flags=0): return Surface</tt><br> |
| 627 | 145 <tt>Surface.convert(): return Surface</tt><br> |
| 651 | 146 <p>Creates a new copy of the Surface with the pixel format changed. The new pixel format can be determined from another existing Surface. Otherwise depth, flags, and masks arguments can be used, similar to the <tt><a href="surface.html#pygame.Surface">pygame.Surface</a> - <font size=-1>pygame object for representing images</font></tt> call. </p> |
| 627 | 147 <p>If no arguments are passed the new Surface will have the same pixel format as the display Surface. This is always the fastest format for blitting. It is a good idea to convert all Surfaces before they are blitted many times. </p> |
| 651 | 148 <p>The converted Surface will have no pixel alphas. They will be stripped if the original had them. See <tt><a href="surface.html#Surface.convert_alpha">Surface.convert_alpha</a> - <font size=-1>change the pixel format of an image including per pixel alphas</font></tt> for preserving or creating per-pixel alphas. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
149 <!--COMMENTS:Surface.convert--> <br> |
| 627 | 150 <br></ul> |
| 151 | |
| 152 | |
| 153 <a name="Surface.convert_alpha"> | |
| 154 <big><b>Surface.convert_alpha</big></b><br><ul> | |
| 155 <i>change the pixel format of an image including per pixel alphas</i><br> | |
| 156 <tt>Surface.convert_alpha(Surface): return Surface</tt><br> | |
| 157 <tt>Surface.convert_alpha(): return Surface</tt><br> | |
|
1038
2fab82895a31
Fixed numerous doc comments. Removed wrong Rect.clip_ip() entry.
marcus
parents:
1037
diff
changeset
|
158 <p>Creates a new copy of the surface with the desired pixel format. The new surface will be in a format suited for quick blitting to the given format with per pixel alpha. If no surface is given, the new surface will be optimized for blitting to the current display. </p> |
| 651 | 159 <p>Unlike the <tt><a href="surface.html#Surface.convert">Surface.convert</a> - <font size=-1>change the pixel format of an image</font></tt> method, the pixel format for the new image will not be exactly the same as the requested source, but it will be optimized for fast alpha blitting to the destination. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
160 <!--COMMENTS:Surface.convert_alpha--> <br> |
| 627 | 161 <br></ul> |
| 162 | |
| 163 | |
| 164 <a name="Surface.copy"> | |
| 165 <big><b>Surface.copy</big></b><br><ul> | |
| 166 <i>create a new copy of a Surface</i><br> | |
| 167 <tt>Surface.copy(): return Surface</tt><br> | |
| 168 <p>Makes a duplicate copy of a Surface. The new Surface will have the same pixel formats, color palettes, and transparency settings as the original. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
169 <!--COMMENTS:Surface.copy--> <br> |
| 627 | 170 <br></ul> |
| 171 | |
| 172 | |
| 173 <a name="Surface.fill"> | |
| 174 <big><b>Surface.fill</big></b><br><ul> | |
| 175 <i>fill Surface with a solid color</i><br> | |
|
819
f10c63453e4e
Marcus has added in blend modes for the surface.fill function.
Rene Dudfield <renesd@gmail.com>
parents:
810
diff
changeset
|
176 <tt>Surface.fill(color, rect=None, special_flags=0): return Rect</tt><br> |
| 627 | 177 <p>Fill the Surface with a solid color. If no rect argument is given the entire Surface will be filled. The rect argument will limit the fill to a specific area. The fill will also be contained by the Surface clip area. </p> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
178 <p>The color argument can be either a <tt>RGB</tt> sequence, a <tt>RGBA</tt> sequence or a mapped color index. If using <tt>RGBA</tt>, the Alpha <tt>(A</tt> part of <tt>RGBA)</tt> is ignored unless the surface uses per pixel alpha (Surface has the <tt>SRCALPHA</tt> flag). </p> |
|
1221
25886fe3a0e8
Bugfix and test for transform.threshold, updated docs (thanks Nirav), added basic tagging to run_tests.py/test_runner.py.
akalias
parents:
1137
diff
changeset
|
179 <p>An optional special_flags is for passing in new in <tt>1.8.0:</tt> <tt>BLEND_ADD</tt>, <tt>BLEND_SUB</tt>, <tt>BLEND_MULT</tt>, <tt>BLEND_MIN</tt>, <tt>BLEND_MAX</tt> new in <tt>1.8.1:</tt> <tt>BLEND_RGBA_ADD</tt>, <tt>BLEND_RGBA_SUB</tt>, <tt>BLEND_RGBA_MULT</tt>, <tt>BLEND_RGBA_MIN</tt>, <tt>BLEND_RGBA_MAX</tt> <tt>BLEND_RGB_ADD</tt>, <tt>BLEND_RGB_SUB</tt>, <tt>BLEND_RGB_MULT</tt>, <tt>BLEND_RGB_MIN</tt>, <tt>BLEND_RGB_MAX</tt> With other special blitting flags perhaps added in the future. </p> |
| 710 | 180 <p>This will return the affected Surface area. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
181 <!--COMMENTS:Surface.fill--> <br> |
| 627 | 182 <br></ul> |
| 183 | |
| 184 | |
|
1525
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
185 <a name="Surface.scroll"> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
186 <big><b>Surface.scroll</big></b><br><ul> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
187 <i>Shift the surface image in place</i><br> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
188 <tt>Surface.scroll(dx=0, dy=0): return None</tt><br> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
189 <p>Move the image by dx pixels right and dy pixels down. dx and dy may be negative for left and up scrolls respectively. Areas of the surface that are not overwritten retain their original pixel values. Scrolling is contained by the Surface clip area. It is safe to have dx and dy values that exceed the surface size. </p> |
| 1849 | 190 <p>New in Pygame <tt>1.9</tt> </p> |
|
1525
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
191 <!--COMMENTS:Surface.scroll--> <br> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
192 <br></ul> |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
193 |
|
48ab3db38416
add Surface.scroll method
Lenard Lindstrom <len-l@telus.net>
parents:
1524
diff
changeset
|
194 |
| 627 | 195 <a name="Surface.set_colorkey"> |
| 196 <big><b>Surface.set_colorkey</big></b><br><ul> | |
| 197 <i>Set the transparent colorkey</i><br> | |
| 198 <tt>Surface.set_colorkey(Color, flags=0): return None</tt><br> | |
| 199 <tt>Surface.set_colorkey(None): return None</tt><br> | |
| 200 <p>Set the current color key for the Surface. When blitting this Surface onto a destination, and pixels that have the same color as the colorkey will be transparent. The color can be an <tt>RGB</tt> color or a mapped color integer. If None is passed, the colorkey will be unset. </p> | |
| 201 <p>The colorkey will be ignored if the Surface is formatted to use per pixel alpha values. The colorkey can be mixed with the full Surface alpha value. </p> | |
| 202 <p>The optional flags argument can be set to <tt>pygame.RLEACCEL</tt> to provide better performance on non accelerated displays. An <tt>RLEACCEL</tt> Surface will be slower to modify, but quicker to blit as a source. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
203 <!--COMMENTS:Surface.set_colorkey--> <br> |
| 627 | 204 <br></ul> |
| 205 | |
| 206 | |
| 207 <a name="Surface.get_colorkey"> | |
| 208 <big><b>Surface.get_colorkey</big></b><br><ul> | |
| 209 <i>Get the current transparent colorkey</i><br> | |
| 210 <tt>Surface.get_colorkey(): return RGB or None</tt><br> | |
| 211 <p>Return the current colorkey value for the Surface. If the colorkey is not set then None is returned. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
212 <!--COMMENTS:Surface.get_colorkey--> <br> |
| 627 | 213 <br></ul> |
| 214 | |
| 215 | |
| 216 <a name="Surface.set_alpha"> | |
| 217 <big><b>Surface.set_alpha</big></b><br><ul> | |
| 218 <i>set the alpha value for the full Surface image</i><br> | |
| 219 <tt>Surface.set_alpha(value, flags=0): return None</tt><br> | |
| 220 <tt>Surface.set_alpha(None): return None</tt><br> | |
| 221 <p>Set the current alpha value fo r the Surface. When blitting this Surface onto a destination, the pixels will be drawn slightly transparent. The alpha value is an integer from 0 to 255, 0 is fully transparent and 255 is fully opaque. If None is passed for the alpha value, then the Surface alpha will be disabled. </p> | |
| 222 <p>This value is different than the per pixel Surface alpha. If the Surface format contains per pixel alphas, then this alpha value will be ignored. If the Surface contains per pixel alphas, setting the alpha value to None will disable the per pixel transparency. </p> | |
| 223 <p>The optional flags argument can be set to <tt>pygame.RLEACCEL</tt> to provide better performance on non accelerated displays. An <tt>RLEACCEL</tt> Surface will be slower to modify, but quicker to blit as a source. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
224 <!--COMMENTS:Surface.set_alpha--> <br> |
| 627 | 225 <br></ul> |
| 226 | |
| 227 | |
| 228 <a name="Surface.get_alpha"> | |
| 229 <big><b>Surface.get_alpha</big></b><br><ul> | |
| 230 <i>get the current Surface transparency value</i><br> | |
| 231 <tt>Surface.get_alpha(): return int_value or None</tt><br> | |
| 232 <p>Return the current alpha value for the Surface. If the alpha value is not set then None is returned. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
233 <!--COMMENTS:Surface.get_alpha--> <br> |
| 627 | 234 <br></ul> |
| 235 | |
| 236 | |
| 237 <a name="Surface.lock"> | |
| 238 <big><b>Surface.lock</big></b><br><ul> | |
| 239 <i>lock the Surface memory for pixel access</i><br> | |
| 240 <tt>Surface.lock(): return None</tt><br> | |
| 241 <p>Lock the pixel data of a Surface for access. On accelerated Surfaces, the pixel data may be stored in volatile video memory or nonlinear compressed forms. When a Surface is locked the pixel memory becomes available to access by regular software. Code that reads or writes pixel values will need the Surface to be locked. </p> | |
| 242 <p>Surfaces should not remain locked for more than necessary. <tt>A</tt> locked Surface can often not be displayed or managed by Pygame. </p> | |
| 651 | 243 <p>Not all Surfaces require locking. The <tt><a href="surface.html#Surface.mustlock">Surface.mustlock</a> - <font size=-1>test if the Surface requires locking</font></tt> method can determine if it is actually required. There is no performance penalty for locking and unlocking a Surface that does not need it. </p> |
| 627 | 244 <p>All pygame functions will automatically lock and unlock the Surface data as needed. If a section of code is going to make calls that will repeatedly lock and unlock the Surface many times, it can be helpful to wrap the block inside a lock and unlock pair. </p> |
| 245 <p>It is safe to nest locking and unlocking calls. The surface will only be unlocked after the final lock is released. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
246 <!--COMMENTS:Surface.lock--> <br> |
| 627 | 247 <br></ul> |
| 248 | |
| 249 | |
| 250 <a name="Surface.unlock"> | |
| 251 <big><b>Surface.unlock</big></b><br><ul> | |
| 252 <i>unlock the Surface memory from pixel access</i><br> | |
| 253 <tt>Surface.unlock(): return None</tt><br> | |
| 651 | 254 <p>Unlock the Surface pixel data after it has been locked. The unlocked Surface can once again be drawn and managed by Pygame. See the <tt><a href="surface.html#Surface.lock">Surface.lock</a> - <font size=-1>lock the Surface memory for pixel access</font></tt> documentation for more details. </p> |
| 627 | 255 <p>All pygame functions will automatically lock and unlock the Surface data as needed. If a section of code is going to make calls that will repeatedly lock and unlock the Surface many times, it can be helpful to wrap the block inside a lock and unlock pair. </p> |
| 256 <p>It is safe to nest locking and unlocking calls. The surface will only be unlocked after the final lock is released. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
257 <!--COMMENTS:Surface.unlock--> <br> |
| 627 | 258 <br></ul> |
| 259 | |
| 260 | |
| 261 <a name="Surface.mustlock"> | |
| 262 <big><b>Surface.mustlock</big></b><br><ul> | |
| 263 <i>test if the Surface requires locking</i><br> | |
| 264 <tt>Surface.mustlock(): return bool</tt><br> | |
| 265 <p>Returns True if the Surface is required to be locked to access pixel data. Usually pure software Surfaces do not require locking. This method is rarely needed, since it is safe and quickest to just lock all Surfaces as needed. </p> | |
| 266 <p>All pygame functions will automatically lock and unlock the Surface data as needed. If a section of code is going to make calls that will repeatedly lock and unlock the Surface many times, it can be helpful to wrap the block inside a lock and unlock pair. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
267 <!--COMMENTS:Surface.mustlock--> <br> |
| 627 | 268 <br></ul> |
| 269 | |
| 270 | |
| 271 <a name="Surface.get_locked"> | |
| 272 <big><b>Surface.get_locked</big></b><br><ul> | |
| 273 <i>test if the Surface is current locked</i><br> | |
| 274 <tt>Surface.get_locked(): return bool</tt><br> | |
|
1137
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
275 <p>Returns True when the Surface is locked. It doesn't matter how many times the Surface is locked. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
276 <!--COMMENTS:Surface.get_locked--> <br> |
| 627 | 277 <br></ul> |
| 278 | |
| 279 | |
|
1137
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
280 <a name="Surface.get_locks"> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
281 <big><b>Surface.get_locks</big></b><br><ul> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
282 <i>Gets the locks for the Surface</i><br> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
283 <tt>Surface.get_locks(): return tuple</tt><br> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
284 <p>Returns the currently existing locks for the Surface. </p> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
285 <!--COMMENTS:Surface.get_locks--> <br> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
286 <br></ul> |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
287 |
|
ec3ced33488f
Reworked locking code to be more strict about locking.
marcus
parents:
1038
diff
changeset
|
288 |
| 627 | 289 <a name="Surface.get_at"> |
| 290 <big><b>Surface.get_at</big></b><br><ul> | |
| 291 <i>get the color value at a single pixel</i><br> | |
| 292 <tt>Surface.get_at((x, y)): return Color</tt><br> | |
| 1839 | 293 <p>Return a copy of the <tt>RGBA</tt> Color value at the given pixel. If the Surface has no per pixel alpha, then the alpha value will always be 255 (opaque). If the pixel position is outside the area of the Surface an IndexError exception will be raised. </p> |
| 294 <p>Getting and setting pixels one at a time is generally too slow to be used in a game or realtime situation. It is better to use methods which operate on many pixels at a time like with the blit, fill and draw methods - or by using surfarray/PixelArray. </p> | |
| 627 | 295 <p>This function will temporarily lock and unlock the Surface as needed. </p> |
| 1839 | 296 <p>Returning a Color instead of tuple, New in pygame <tt>1.9.0</tt>. Use <tt>tuple(surf.get_at((x,y)))</tt> if you want a tuple, and not a Color. This should only matter if you want to use the color as a key in a dict. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
297 <!--COMMENTS:Surface.get_at--> <br> |
| 627 | 298 <br></ul> |
| 299 | |
| 300 | |
| 301 <a name="Surface.set_at"> | |
| 302 <big><b>Surface.set_at</big></b><br><ul> | |
| 303 <i>set the color value for a single pixel</i><br> | |
| 304 <tt>Surface.set_at((x, y), Color): return None</tt><br> | |
| 305 <p>Set the <tt>RGBA</tt> or mapped integer color value for a single pixel. If the Surface does not have per pixel alphas, the alpha value is ignored. Settting pixels outside the Surface area or outside the Surface clipping will have no effect. </p> | |
| 306 <p>Getting and setting pixels one at a time is generally too slow to be used in a game or realtime situation. </p> | |
| 307 <p>This function will temporarily lock and unlock the Surface as needed. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
308 <!--COMMENTS:Surface.set_at--> <br> |
| 627 | 309 <br></ul> |
| 310 | |
| 311 | |
| 312 <a name="Surface.get_palette"> | |
| 313 <big><b>Surface.get_palette</big></b><br><ul> | |
| 314 <i>get the color index palette for an 8bit Surface</i><br> | |
| 315 <tt>Surface.get_palette(): return [RGB, RGB, RGB, ...]</tt><br> | |
| 316 <p>Return a list of up to 256 color elements that represent the indexed colors used in an 8bit Surface. The returned list is a copy of the palette, and changes will have no effect on the Surface. </p> | |
| 1839 | 317 <p>Returning a list of Color(with length 3) instances instead of tuples, New in pygame <tt>1.9.0</tt> </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
318 <!--COMMENTS:Surface.get_palette--> <br> |
| 627 | 319 <br></ul> |
| 320 | |
| 321 | |
| 322 <a name="Surface.get_palette_at"> | |
| 323 <big><b>Surface.get_palette_at</big></b><br><ul> | |
| 324 <i>get the color for a single entry in a palette</i><br> | |
| 325 <tt>Surface.get_palette_at(index): return RGB</tt><br> | |
| 326 <p>Returns the red, green, and blue color values for a single index in a Surface palette. The index should be a value from 0 to 255. </p> | |
| 1839 | 327 <p>Returning Color(with length 3) instance instead of a tuple, New in pygame <tt>1.9.0</tt> </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
328 <!--COMMENTS:Surface.get_palette_at--> <br> |
| 627 | 329 <br></ul> |
| 330 | |
| 331 | |
| 332 <a name="Surface.set_palette"> | |
| 333 <big><b>Surface.set_palette</big></b><br><ul> | |
| 334 <i>set the color palette for an 8bit Surface</i><br> | |
| 335 <tt>Surface.set_palette([RGB, RGB, RGB, ...]): return None</tt><br> | |
| 336 <p>Set the full palette for an 8bit Surface. This will replace the colors in the existing palette. <tt>A</tt> partial palette can be passed and only the first colors in the original palette will be changed. </p> | |
| 337 <p>This function has no effect on a Surface with more than 8bits per pixel. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
338 <!--COMMENTS:Surface.set_palette--> <br> |
| 627 | 339 <br></ul> |
| 340 | |
| 341 | |
| 342 <a name="Surface.set_palette_at"> | |
| 343 <big><b>Surface.set_palette_at</big></b><br><ul> | |
| 344 <i>set the color for a single index in an 8bit Surface palette</i><br> | |
| 345 <tt>Surface.set_at(index, RGB): return None</tt><br> | |
| 346 <p>Set the palette value for a single entry in a Surface palette. The index should be a value from 0 to 255. </p> | |
| 347 <p>This function has no effect on a Surface with more than 8bits per pixel. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
348 <!--COMMENTS:Surface.set_palette_at--> <br> |
| 627 | 349 <br></ul> |
| 350 | |
| 351 | |
| 352 <a name="Surface.map_rgb"> | |
| 353 <big><b>Surface.map_rgb</big></b><br><ul> | |
| 354 <i>convert a color into a mapped color value</i><br> | |
| 355 <tt>Surface.map_rgb(Color): return mapped_int</tt><br> | |
| 356 <p>Convert an <tt>RGBA</tt> color into the mapped integer value for this Surface. The returned integer will contain no more bits than the bit depth of the Surface. Mapped color values are not often used inside Pygame, but can be passed to most functions that require a Surface and a color. </p> | |
| 357 <p>See the Surface object documentation for more information about colors and pixel formats. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
358 <!--COMMENTS:Surface.map_rgb--> <br> |
| 627 | 359 <br></ul> |
| 360 | |
| 361 | |
| 362 <a name="Surface.unmap_rgb"> | |
| 363 <big><b>Surface.unmap_rgb</big></b><br><ul> | |
| 364 <i>convert a mapped integer color value into a Color</i><br> | |
| 365 <tt>Surface.map_rgb(mapped_int): return Color</tt><br> | |
| 366 <p>Convert an mapped integer color into the <tt>RGB</tt> color components for this Surface. Mapped color values are not often used inside Pygame, but can be passed to most functions that require a Surface and a color. </p> | |
| 367 <p>See the Surface object documentation for more information about colors and pixel formats. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
368 <!--COMMENTS:Surface.unmap_rgb--> <br> |
| 627 | 369 <br></ul> |
| 370 | |
| 371 | |
| 372 <a name="Surface.set_clip"> | |
| 373 <big><b>Surface.set_clip</big></b><br><ul> | |
| 374 <i>set the current clipping area of the Surface</i><br> | |
| 375 <tt>Surface.set_clip(rect): return None</tt><br> | |
| 376 <tt>Surface.set_clip(None): return None</tt><br> | |
| 377 <p>Each Surface has an active clipping area. This is a rectangle that represents the only pixels on the Surface that can be modified. If None is passed for the rectangle the full Surface will be available for changes. </p> | |
| 378 <p>The clipping area is always restricted to the area of the Surface itself. If the clip rectangle is too large it will be shrunk to fit inside the Surface. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
379 <!--COMMENTS:Surface.set_clip--> <br> |
| 627 | 380 <br></ul> |
| 381 | |
| 382 | |
| 383 <a name="Surface.get_clip"> | |
| 384 <big><b>Surface.get_clip</big></b><br><ul> | |
|
1036
e0f8354aa687
Some documentation updates... mainly updating sprite docs. More to do...
Rene Dudfield <renesd@gmail.com>
parents:
974
diff
changeset
|
385 <i>get the current clipping area of the Surface</i><br> |
| 627 | 386 <tt>Surface.get_clip(): return Rect</tt><br> |
| 387 <p>Return a rectangle of the current clipping area. The Surface will always return a valid rectangle that will never be outside the bounds of the image. If the Surface has had None set for the clipping area, the Surface will return a rectangle with the full area of the Surface. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
388 <!--COMMENTS:Surface.get_clip--> <br> |
| 627 | 389 <br></ul> |
| 390 | |
| 391 | |
| 392 <a name="Surface.subsurface"> | |
| 393 <big><b>Surface.subsurface</big></b><br><ul> | |
| 394 <i>create a new surface that references its parent</i><br> | |
| 395 <tt>Surface.subsurface(Rect): return Surface</tt><br> | |
| 396 <p>Returns a new Surface that shares its pixels with its new parent. The new Surface is considered a child of the original. Modifications to either Surface pixels will effect each other. Surface information like clipping area and color keys are unique to each Surface. </p> | |
| 397 <p>The new Surface will inherit the palette, color key, and alpha settings from its parent. </p> | |
| 398 <p>It is possible to have any number of subsurfaces and subsubsurfaces on the parent. It is also possible to subsurface the display Surface if the display mode is not hardware accelerated. </p> | |
| 651 | 399 <p>See the <tt><a href="surface.html#Surface.get_offset">Surface.get_offset</a> - <font size=-1>find the position of a child subsurface inside a parent</font></tt>, <tt><a href="surface.html#Surface.get_parent">Surface.get_parent</a> - <font size=-1>find the parent of a subsurface</font></tt> to learn more about the state of a subsurface. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
400 <!--COMMENTS:Surface.subsurface--> <br> |
| 627 | 401 <br></ul> |
| 402 | |
| 403 | |
| 404 <a name="Surface.get_parent"> | |
| 405 <big><b>Surface.get_parent</big></b><br><ul> | |
| 406 <i>find the parent of a subsurface</i><br> | |
| 407 <tt>Surface.get_parent(): return Surface</tt><br> | |
| 408 <p>Returns the parent Surface of a subsurface. If this is not a subsurface then None will be returned. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
409 <!--COMMENTS:Surface.get_parent--> <br> |
| 627 | 410 <br></ul> |
| 411 | |
| 412 | |
| 413 <a name="Surface.get_abs_parent"> | |
| 414 <big><b>Surface.get_abs_parent</big></b><br><ul> | |
| 415 <i>find the top level parent of a subsurface</i><br> | |
| 416 <tt>Surface.get_abs_parent(): return Surface</tt><br> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
417 <p>Returns the parent Surface of a subsurface. If this is not a subsurface then this surface will be returned. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
418 <!--COMMENTS:Surface.get_abs_parent--> <br> |
| 627 | 419 <br></ul> |
| 420 | |
| 421 | |
| 422 <a name="Surface.get_offset"> | |
| 423 <big><b>Surface.get_offset</big></b><br><ul> | |
| 424 <i>find the position of a child subsurface inside a parent</i><br> | |
| 425 <tt>Surface.get_offset(): return (x, y)</tt><br> | |
| 426 <p>Get the offset position of a child subsurface inside of a parent. If the Surface is not a subsurface this will return (0, 0). </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
427 <!--COMMENTS:Surface.get_offset--> <br> |
| 627 | 428 <br></ul> |
| 429 | |
| 430 | |
| 431 <a name="Surface.get_abs_offset"> | |
| 432 <big><b>Surface.get_abs_offset</big></b><br><ul> | |
| 433 <i>find the absolute position of a child subsurface inside its top level parent</i><br> | |
| 434 <tt>Surface.get_abs_offset(): return (x, y)</tt><br> | |
| 435 <p>Get the offset position of a child subsurface inside of its top level parent Surface. If the Surface is not a subsurface this will return (0, 0). </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
436 <!--COMMENTS:Surface.get_abs_offset--> <br> |
| 627 | 437 <br></ul> |
| 438 | |
| 439 | |
| 440 <a name="Surface.get_size"> | |
| 441 <big><b>Surface.get_size</big></b><br><ul> | |
| 442 <i>get the dimensions of the Surface</i><br> | |
| 443 <tt>Surface.get_size(): return (width, height)</tt><br> | |
| 444 <p>Return the width and height of the Surface in pixels. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
445 <!--COMMENTS:Surface.get_size--> <br> |
| 627 | 446 <br></ul> |
| 447 | |
| 448 | |
| 449 <a name="Surface.get_width"> | |
| 450 <big><b>Surface.get_width</big></b><br><ul> | |
| 451 <i>get the width of the Surface</i><br> | |
| 452 <tt>Surface.get_width(): return width</tt><br> | |
| 453 <p>Return the width of the Surface in pixels. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
454 <!--COMMENTS:Surface.get_width--> <br> |
| 627 | 455 <br></ul> |
| 456 | |
| 457 | |
| 458 <a name="Surface.get_height"> | |
| 459 <big><b>Surface.get_height</big></b><br><ul> | |
| 460 <i>get the height of the Surface</i><br> | |
| 461 <tt>Surface.get_height(): return height</tt><br> | |
| 462 <p>Return the height of the Surface in pixels. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
463 <!--COMMENTS:Surface.get_height--> <br> |
| 627 | 464 <br></ul> |
| 465 | |
| 466 | |
| 467 <a name="Surface.get_rect"> | |
| 468 <big><b>Surface.get_rect</big></b><br><ul> | |
| 469 <i>get the rectangular area of the Surface</i><br> | |
| 470 <tt>Surface.get_rect(**kwargs): return Rect</tt><br> | |
| 471 <p>Returns a new rectangle covering the entire surface. This rectangle will always start at 0, 0 with a width. and height the same size as the image. </p> | |
| 472 <p>You can pass keyword argument values to this function. These named values will be applied to the attributes of the Rect before it is returned. An example would be <tt>'mysurf.get_rect(center=(100,100))'</tt> to create a rectangle for the Surface centered at a given position. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
473 <!--COMMENTS:Surface.get_rect--> <br> |
| 627 | 474 <br></ul> |
| 475 | |
| 476 | |
| 477 <a name="Surface.get_bitsize"> | |
| 478 <big><b>Surface.get_bitsize</big></b><br><ul> | |
| 479 <i>get the bit depth of the Surface pixel format</i><br> | |
| 480 <tt>Surface.get_bitsize(): return int</tt><br> | |
| 481 <p>Returns the number of bits used to represent each pixel. This value may not exactly fill the number of bytes used per pixel. For example a 15 bit Surface still requires a full 2 bytes. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
482 <!--COMMENTS:Surface.get_bitsize--> <br> |
| 627 | 483 <br></ul> |
| 484 | |
| 485 | |
| 486 <a name="Surface.get_bytesize"> | |
| 487 <big><b>Surface.get_bytesize</big></b><br><ul> | |
| 488 <i>get the bytes used per Surface pixel</i><br> | |
| 489 <tt>Surface.get_bytesize(): return int</tt><br> | |
| 490 <p>Return the number of bytes used per pixel. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
491 <!--COMMENTS:Surface.get_bytesize--> <br> |
| 627 | 492 <br></ul> |
| 493 | |
| 494 | |
| 495 <a name="Surface.get_flags"> | |
| 496 <big><b>Surface.get_flags</big></b><br><ul> | |
| 497 <i>get the additional flags used for the Surface</i><br> | |
| 498 <tt>Surface.get_flags(): return int</tt><br> | |
|
756
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
499 <p>Returns a set of current Surface features. Each feature is a bit in the flags bitmask. Typical flags are <tt>HWSURFACE</tt>, <tt>RLEACCEL</tt>, <tt>SRCALPHA</tt>, and <tt>SRCCOLORKEY</tt>. </p> |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
500 <p>Here is a more complete list of flags. <tt>A</tt> full list can be found in <tt>SDL_video.h</tt> </p> |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
501 <pre> SWSURFACE 0x00000000 # Surface is in system memory |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
502 HWSURFACE 0x00000001 # Surface is in video memory |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
503 ASYNCBLIT 0x00000004 # Use asynchronous blits if possible |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
504 </pre><p>Available for <tt><a href="display.html#pygame.display.set_mode">pygame.display.set_mode</a> - <font size=-1>initialize a window or screen for display</font></tt> </p> |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
505 <pre> ANYFORMAT 0x10000000 # Allow any video depth/pixel-format |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
506 HWPALETTE 0x20000000 # Surface has exclusive palette |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
507 DOUBLEBUF 0x40000000 # Set up double-buffered video mode |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
508 FULLSCREEN 0x80000000 # Surface is a full screen display |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
509 OPENGL 0x00000002 # Create an OpenGL rendering context |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
510 OPENGLBLIT 0x0000000A # Create an OpenGL rendering context |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
511 # and use it for blitting. Obsolete. |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
512 RESIZABLE 0x00000010 # This video mode may be resized |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
513 NOFRAME 0x00000020 # No window caption or edge frame |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
514 </pre><p>Used internally (read-only) </p> |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
515 <pre> HWACCEL 0x00000100 # Blit uses hardware acceleration |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
516 SRCCOLORKEY 0x00001000 # Blit uses a source color key |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
517 RLEACCELOK 0x00002000 # Private flag |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
518 RLEACCEL 0x00004000 # Surface is RLE encoded |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
519 SRCALPHA 0x00010000 # Blit uses source alpha blending |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
520 PREALLOC 0x01000000 # Surface uses preallocated memory |
|
333b0c31e389
New docs, with bug fixes from doc comments.
Rene Dudfield <renesd@gmail.com>
parents:
710
diff
changeset
|
521 </pre> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
522 <!--COMMENTS:Surface.get_flags--> <br> |
| 627 | 523 <br></ul> |
| 524 | |
| 525 | |
| 526 <a name="Surface.get_pitch"> | |
| 527 <big><b>Surface.get_pitch</big></b><br><ul> | |
| 528 <i>get the number of bytes used per Surface row</i><br> | |
| 529 <tt>Surface.get_pitch(): return int</tt><br> | |
| 530 <p>Return the number of bytes separating each row in the Surface. Surfaces in video memory are not always linearly packed. Subsurfaces will also have a larger pitch than their real width. </p> | |
| 531 <p>This value is not needed for normal Pygame usage. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
532 <!--COMMENTS:Surface.get_pitch--> <br> |
| 627 | 533 <br></ul> |
| 534 | |
| 535 | |
| 536 <a name="Surface.get_masks"> | |
| 537 <big><b>Surface.get_masks</big></b><br><ul> | |
| 538 <i>the bitmasks needed to convert between a color and a mapped integer</i><br> | |
| 539 <tt>Surface.get_masks(): return (R, G, B, A)</tt><br> | |
| 540 <p>Returns the bitmasks used to isolate each color in a mapped integer. </p> | |
| 541 <p>This value is not needed for normal Pygame usage. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
542 <!--COMMENTS:Surface.get_masks--> <br> |
| 627 | 543 <br></ul> |
| 544 | |
| 545 | |
|
1234
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
546 <a name="Surface.set_masks"> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
547 <big><b>Surface.set_masks</big></b><br><ul> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
548 <i>set the bitmasks needed to convert between a color and a mapped integer</i><br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
549 <tt>Surface.set_masks((r,g,b,a)): return None</tt><br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
550 <p>This is not needed for normal Pygame usage. New in pygame <tt>1.8.1</tt> </p> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
551 <!--COMMENTS:Surface.set_masks--> <br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
552 <br></ul> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
553 |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
554 |
| 627 | 555 <a name="Surface.get_shifts"> |
| 556 <big><b>Surface.get_shifts</big></b><br><ul> | |
| 557 <i>the bit shifts needed to convert between a color and a mapped integer</i><br> | |
| 558 <tt>Surface.get_shifts(): return (R, G, B, A)</tt><br> | |
| 559 <p>Returns the pixel shifts need to convert between each color and a mapped integer. </p> | |
| 560 <p>This value is not needed for normal Pygame usage. </p> | |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
561 <!--COMMENTS:Surface.get_shifts--> <br> |
| 627 | 562 <br></ul> |
| 563 | |
| 564 | |
|
1234
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
565 <a name="Surface.set_shifts"> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
566 <big><b>Surface.set_shifts</big></b><br><ul> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
567 <i>sets the bit shifts needed to convert between a color and a mapped integer</i><br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
568 <tt>Surface.get_shifts((r,g,b,a)): return None</tt><br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
569 <p>This is not needed for normal Pygame usage. New in pygame <tt>1.8.1</tt> </p> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
570 <!--COMMENTS:Surface.set_shifts--> <br> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
571 <br></ul> |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
572 |
|
2ad2aa11e514
Added Surface.set_masks and .set_shifts useful for using data in
Rene Dudfield <renesd@gmail.com>
parents:
1221
diff
changeset
|
573 |
| 627 | 574 <a name="Surface.get_losses"> |
| 575 <big><b>Surface.get_losses</big></b><br><ul> | |
| 576 <i>the significant bits used to convert between a color and a mapped integer</i><br> | |
| 577 <tt>Surface.get_losses(): return (R, G, B, A)</tt><br> | |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
578 <p>Return the least significant number of bits stripped from each color in a mapped integer. </p> |
| 627 | 579 <p>This value is not needed for normal Pygame usage. </p> |
|
640
228ab19991cf
Updated header image, and docs links.
Rene Dudfield <renesd@gmail.com>
parents:
627
diff
changeset
|
580 <!--COMMENTS:Surface.get_losses--> <br> |
| 627 | 581 <br></ul> |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
582 |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
583 |
|
957
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
584 <a name="Surface.get_bounding_rect"> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
585 <big><b>Surface.get_bounding_rect</big></b><br><ul> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
586 <i>find the smallest rect containing data</i><br> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
587 <tt>Surface.get_bounding_rect(min_alpha = 1): return Rect</tt><br> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
588 <p>Returns the smallest rectangular region that contains all the pixels in the surface that have an alpha value greater than or equal to the minimum alpha value. </p> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
589 <p>This function will temporarily lock and unlock the Surface as needed. </p> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
590 <p>New in pygame <tt>1.8</tt>. </p> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
591 <!--COMMENTS:Surface.get_bounding_rect--> <br> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
592 <br></ul> |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
593 |
|
a1b08375b132
Added display.set_mode() resolution enhancement as posted by Lorenz Quack.
marcus
parents:
862
diff
changeset
|
594 |
|
862
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
595 <a name="Surface.get_buffer"> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
596 <big><b>Surface.get_buffer</big></b><br><ul> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
597 <i>acquires a buffer object for the pixels of the Surface.</i><br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
598 <tt>Surface.get_buffer(): return BufferProxy</tt><br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
599 <p>Return a buffer object for the pixels of the Surface. The buffer can be used for direct pixel access and manipulation. </p> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
600 <p>This method implicitly locks the Surface. The lock will be released, once the returned BufferProxy object is deleted. </p> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
601 <p>New in pygame <tt>1.8</tt>. </p> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
602 <!--COMMENTS:Surface.get_buffer--> <br> |
|
57ac2edacc4d
Mask can now get bounding rects of set bits.
Rene Dudfield <renesd@gmail.com>
parents:
819
diff
changeset
|
603 <br></ul> |
| 627 | 604 <br></ul> |
| 605 | |
| 606 </body></html> |
