annotate docs/ref/pixelarray.html @ 3172:d1b367fc08bc tests-returncode

Use a return code of 1 when the tests fail.
author Thomas Kluyver <takowl@gmail.com>
date Wed, 09 Jan 2013 10:13:57 +0000
parents 8d9ce368f8d3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
3
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
4 <html xmlns="http://www.w3.org/1999/xhtml">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
5 <head>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
7
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
8 <title>pygame.PixelArray &mdash; Pygame v1.9.2 documentation</title>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
9 <link rel="stylesheet" href="../_static/pygame.css" type="text/css" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
10 <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
11 <script type="text/javascript">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
12 var DOCUMENTATION_OPTIONS = {
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
13 URL_ROOT: '../',
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
14 VERSION: '1.9.2',
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
15 COLLAPSE_INDEX: false,
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
16 FILE_SUFFIX: '.html',
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
17 HAS_SOURCE: true
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
18 };
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
19 </script>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
20 <script type="text/javascript" src="../_static/jquery.js"></script>
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
21 <script type="text/javascript" src="../_static/underscore.js"></script>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
22 <script type="text/javascript" src="../_static/doctools.js"></script>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
23 <link rel="shortcut icon" href="../_static/pygame.ico"/>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
24 <link rel="top" title="Pygame v1.9.2 documentation" href="../index.html" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
25 <link rel="next" title="pygame.pixelcopy" href="pixelcopy.html" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
26 <link rel="prev" title="pygame.Overlay" href="overlay.html" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
27 </head>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
28 <body>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
29
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
30 <div class="document">
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
31
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
32 <div class="header">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
33 <table>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
34 <tr>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
35 <td class="logo">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
36 <a href="http://www.pygame.org/">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
37 <img src="../_static/pygame_tiny.png"/>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
38 </a>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
39 <h5>pygame documentation</h5>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
40 </td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
41 <td class="pagelinks">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
42 <p class="top">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
43 ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
44 <a href="http://www.pygame.org/">Pygame Home</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
45 <a href="../index.html">Help Contents</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
46 <a href="../genindex.html">Reference Index</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
47 </p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
48 <p class="bottom">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
49 <a href="camera.html">camera</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
50 <a href="cdrom.html">cdrom</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
51 <a href="color.html">Color</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
52 <a href="cursors.html">cursors</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
53 <a href="display.html">display</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
54 <a href="draw.html">draw</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
55 <a href="event.html">event</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
56 <a href="examples.html">examples</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
57 <a href="font.html">font</a> ||
3065
0a3be7313aa4 Enable pygame._freetype extension module build by default
Lenard Lindstrom <len-l@telus.net>
parents: 2245
diff changeset
58 <a href="freetype.html">freetype</a> ||
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
59 <a href="gfxdraw.html">gfxdraw</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
60 <a href="image.html">image</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
61 <a href="joystick.html">joystick</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
62 <a href="key.html">key</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
63 <a href="locals.html">locals</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
64 <a href="mask.html">mask</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
65 <a href="math.html">math</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
66 <a href="midi.html">midi</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
67 <a href="mixer.html">mixer</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
68 <a href="mouse.html">mouse</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
69 <a href="movie.html">movie</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
70 <a href="music.html">music</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
71 <a href="overlay.html">Overlay</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
72 <a href="pixelarray.html">PixelArray</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
73 <a href="pixelcopy.html">pixelcopy</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
74 <a href="pygame.html">pygame</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
75 <a href="rect.html">Rect</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
76 <a href="scrap.html">scrap</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
77 <a href="sndarray.html">sndarray</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
78 <a href="sprite.html">sprite</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
79 <a href="surface.html">Surface</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
80 <a href="surfarray.html">surfarray</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
81 <a href="tests.html">tests</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
82 <a href="time.html">time</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
83 <a href="transform.html">transform</a> ||
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
84 <a href="pygame.html#module-pygame.version">version</a>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
85 </p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
86 </td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
87 </tr>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
88 </table>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
89 </div>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
90
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
91 <div class="documentwrapper">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
92 <div class="body">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
93
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
94 <div class="sectionwrapper">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
95 <div class="section" id="pygame-pixelarray">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
96 <dl class="definition class">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
97 <dt class="title" id="pygame.PixelArray">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
98 <em class="property">class </em><tt class="descclassname">pygame.</tt><tt class="descname">PixelArray</tt><a class="headerlink" href="#pygame.PixelArray" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
99 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
100 <div class="line"><span class="summaryline">pygame object for direct pixel access of surfaces</span></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
101 <div class="line"><span class="signature">PixelArray(Surface) -&gt; PixelArray</span></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
102 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
103 <table border="1" class="toc docutils">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
104 <colgroup>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
105 <col width="31%" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
106 <col width="1%" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
107 <col width="68%" />
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
108 </colgroup>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
109 <tbody valign="top">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
110 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.surface">pygame.PixelArray.surface</a></td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
111 <td>—</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
112 <td>Gets the Surface the PixelArray uses.</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
113 </tr>
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
114 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.itemsize">pygame.PixelArray.itemsize</a></td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
115 <td>—</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
116 <td>Returns the byte size of a pixel array item</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
117 </tr>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
118 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.ndim">pygame.PixelArray.ndim</a></td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
119 <td>—</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
120 <td>Returns the number of dimensions.</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
121 </tr>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
122 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.shape">pygame.PixelArray.shape</a></td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
123 <td>—</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
124 <td>Returns the array size.</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
125 </tr>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
126 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.strides">pygame.PixelArray.strides</a></td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
127 <td>—</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
128 <td>Returns byte offsets for each array dimension.</td>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
129 </tr>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
130 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.make_surface">pygame.PixelArray.make_surface</a></td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
131 <td>—</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
132 <td>Creates a new Surface from the current PixelArray.</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
133 </tr>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
134 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.replace">pygame.PixelArray.replace</a></td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
135 <td>—</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
136 <td>Replaces the passed color in the PixelArray with another one.</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
137 </tr>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
138 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.extract">pygame.PixelArray.extract</a></td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
139 <td>—</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
140 <td>Extracts the passed color from the PixelArray.</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
141 </tr>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
142 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.compare">pygame.PixelArray.compare</a></td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
143 <td>—</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
144 <td>Compares the PixelArray with another one.</td>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
145 </tr>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
146 <tr><td><a class="toc reference external" href="pixelarray.html#pygame.PixelArray.transpose">pygame.PixelArray.transpose</a></td>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
147 <td>—</td>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
148 <td>Exchanges the x and y axis.</td>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
149 </tr>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
150 </tbody>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
151 </table>
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
152 <p>The PixelArray wraps a Surface and provides direct access to the
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
153 surface&#8217;s pixels. A pixel array can be one or two dimensional.
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
154 A two dimensional array, like its surface, is indexed [column, row].
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
155 Pixel arrays support slicing, both for returning a subarray or
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
156 for assignment. A pixel array sliced on a single column or row
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
157 returns a one dimensional pixel array. Arithmetic and other operations
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
158 are not supported. A pixel array can be safely assigned to itself.
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
159 Finally, pixel arrays export an array struct interface, allowing
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
160 them to interact with <a class="tooltip reference internal" href="pixelcopy.html#module-pygame.pixelcopy" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.pixelcopy</span></tt><span class="tooltip-content">pygame module for general pixel array copying</span></a> methods and NumPy
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
161 arrays.</p>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
162 <p>A PixelArray pixel item can be assigned a raw integer values, a
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
163 <a class="tooltip reference internal" href="color.html#pygame.Color" title=""><tt class="xref py py-class docutils literal"><span class="pre">pygame.Color</span></tt><span class="tooltip-content">pygame object for color representations</span></a> instance, or a (r, g, b[, a]) tuple.</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
164 <div class="highlight-python"><div class="highlight"><pre><span class="n">pxarray</span><span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">]</span> <span class="o">=</span> <span class="mh">0xFF00FF</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
165 <span class="n">pxarray</span><span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">]</span> <span class="o">=</span> <span class="n">pygame</span><span class="o">.</span><span class="n">Color</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">)</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
166 <span class="n">pxarray</span><span class="p">[</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">)</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
167 </pre></div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
168 </div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
169 <p>However, only a pixel&#8217;s integer value is returned. So, to compare a pixel
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
170 to a particular color the color needs to be first mapped using
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
171 the <a class="reference internal" href="surface.html#pygame.Surface.map_rgb" title="pygame.Surface.map_rgb"><tt class="xref py py-meth docutils literal"><span class="pre">Surface.map_rgb()</span></tt></a> method of the Surface object for which the
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
172 PixelArray was created.</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
173 <div class="highlight-python"><div class="highlight"><pre><span class="n">pxarray</span> <span class="o">=</span> <span class="n">pygame</span><span class="o">.</span><span class="n">PixelArray</span><span class="p">(</span><span class="n">surface</span><span class="p">)</span>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
174 <span class="c"># Check, if the first pixel at the topleft corner is blue</span>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
175 <span class="k">if</span> <span class="n">pxarray</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">surface</span><span class="o">.</span><span class="n">map_rgb</span><span class="p">((</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">)):</span>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
176 <span class="o">...</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
177 </pre></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
178 </div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
179 <p>When assigning to a range of of pixels, a non tuple sequence of colors or
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
180 a PixelArray can be used as the value. For a sequence, the length must
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
181 match the PixelArray width.</p>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
182 <div class="highlight-python"><div class="highlight"><pre><span class="n">pxarray</span><span class="p">[</span><span class="n">a</span><span class="p">:</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="mh">0xFF00FF</span> <span class="c"># set all pixels to 0xFF00FF</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
183 <span class="n">pxarray</span><span class="p">[</span><span class="n">a</span><span class="p">:</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mh">0xFF00FF</span><span class="p">,</span> <span class="mh">0xAACCEE</span><span class="p">,</span> <span class="o">...</span> <span class="p">)</span> <span class="c"># first pixel = 0xFF00FF,</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
184 <span class="c"># second pixel = 0xAACCEE, ...</span>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
185 <span class="n">pxarray</span><span class="p">[</span><span class="n">a</span><span class="p">:</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">),</span> <span class="p">(</span><span class="mi">170</span><span class="p">,</span> <span class="mi">204</span><span class="p">,</span> <span class="mi">238</span><span class="p">),</span> <span class="o">...</span><span class="p">]</span> <span class="c"># same as above</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
186 <span class="n">pxarray</span><span class="p">[</span><span class="n">a</span><span class="p">:</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="p">[(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">),</span> <span class="mh">0xAACCEE</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="c"># same as above</span>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
187 <span class="n">pxarray</span><span class="p">[</span><span class="n">a</span><span class="p">:</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="n">otherarray</span><span class="p">[</span><span class="n">x</span><span class="p">:</span><span class="n">y</span><span class="p">]</span> <span class="c"># slice sizes must match</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
188 </pre></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
189 </div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
190 <p>For PixelArray assignment, if the right hand side array has a row length
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
191 of 1, then the column is broadcast over the target array&#8217;s rows. An
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
192 array of height 1 is broadcast over the target&#8217;s columns, and is equivalent
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
193 to assigning a 1D PixelArray.</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
194 <p>Subscipt slices can also be used to assign to a rectangular subview of
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
195 the target PixelArray.</p>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
196 <div class="highlight-python"><div class="highlight"><pre><span class="c"># Create some new PixelArray objects providing a different view</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
197 <span class="c"># of the original array/surface.</span>
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
198 <span class="n">newarray</span> <span class="o">=</span> <span class="n">pxarray</span><span class="p">[</span><span class="mi">2</span><span class="p">:</span><span class="mi">4</span><span class="p">,</span> <span class="mi">3</span><span class="p">:</span><span class="mi">5</span><span class="p">]</span>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
199 <span class="n">otherarray</span> <span class="o">=</span> <span class="n">pxarray</span><span class="p">[::</span><span class="mi">2</span><span class="p">,</span> <span class="p">::</span><span class="mi">2</span><span class="p">]</span>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
200 </pre></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
201 </div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
202 <p>Subscript slices can also be used to do fast rectangular pixel manipulations
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
203 instead of iterating over the x or y axis. The</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
204 <div class="highlight-python"><div class="highlight"><pre><span class="n">pxarray</span><span class="p">[::</span><span class="mi">2</span><span class="p">,</span> <span class="p">:]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="c"># Make even columns black.</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
205 <span class="n">pxarray</span><span class="p">[::</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="c"># Same as [::2, :]</span>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
206 </pre></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
207 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
208 <p>During its lifetime, the PixelArray locks the surface, thus you explicitly
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
209 have to delete it once its not used anymore and the surface should perform
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
210 operations in the same scope. A simple <tt class="docutils literal"><span class="pre">:</span></tt> slice index for the column can
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
211 be omitted.</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
212 <div class="highlight-python"><div class="highlight"><pre><span class="n">pxarray</span><span class="p">[::</span><span class="mi">2</span><span class="p">,</span> <span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="c"># Same as pxarray[::2, :]</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
213 <span class="n">pxarray</span><span class="p">[</span><span class="o">...</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="c"># Same as pxarray[:]</span>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
214 </pre></div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
215 </div>
2245
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
216 <p>A note about PixelArray to PixelArray assignment, for arrays with an
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
217 item size of 3 (created from 24 bit surfaces) pixel values are translated
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
218 from the source to the destinations format. The red, green, and blue
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
219 color elements of each pixel are shifted to match the format of the
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
220 target surface. For all other pixel sizes no such remapping occurs.
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
221 This should change in later Pygame releases, where format conversions
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
222 are performed for all pixel sizes. To avoid code breakage when full mapped
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
223 copying is implemented it is suggested PixelArray to PixelArray copies be
5a558a74e434 Add note to PixelArray doc about future indend changes that will break PixelArray to PixelArray assignments in some cases
Lenard Lindstrom <len-l@telus.net>
parents: 2240
diff changeset
224 only between surfaces of identical format.</p>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
225 <p>New in pygame 1.9.2</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
226 <blockquote>
3092
8d9ce368f8d3 Rebuild docs with Sphinx 1.0.2 and Docutils 0.7
Lenard Lindstrom <len-l@telus.net>
parents: 3065
diff changeset
227 <ul class="simple">
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
228 <li>array struct interface</li>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
229 <li>transpose method</li>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
230 <li>broadcasting for a length 1 dimension</li>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
231 </ul>
3092
8d9ce368f8d3 Rebuild docs with Sphinx 1.0.2 and Docutils 0.7
Lenard Lindstrom <len-l@telus.net>
parents: 3065
diff changeset
232 </blockquote>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
233 <p>Changed in pyame 1.9.2</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
234 <blockquote>
3092
8d9ce368f8d3 Rebuild docs with Sphinx 1.0.2 and Docutils 0.7
Lenard Lindstrom <len-l@telus.net>
parents: 3065
diff changeset
235 <ul class="simple">
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
236 <li>A 2D PixelArray can have a length 1 dimension.
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
237 Only an integer index on a 2D PixelArray returns a 1D array.</li>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
238 <li>For assignment, a tuple can only be a color. Any other sequence type
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
239 is a sequence of colors.</li>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
240 </ul>
3092
8d9ce368f8d3 Rebuild docs with Sphinx 1.0.2 and Docutils 0.7
Lenard Lindstrom <len-l@telus.net>
parents: 3065
diff changeset
241 </blockquote>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
242 <dl class="definition attribute">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
243 <dt class="title" id="pygame.PixelArray.surface">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
244 <tt class="descname">surface</tt><a class="headerlink" href="#pygame.PixelArray.surface" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
245 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
246 <div class="line"><span class="summaryline">Gets the Surface the PixelArray uses.</span></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
247 <div class="line"><span class="signature">surface -&gt; Surface</span></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
248 </div>
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
249 <p>The Surface the PixelArray was created for.</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
250 </dd></dl>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
251
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
252 <dl class="definition attribute">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
253 <dt class="title" id="pygame.PixelArray.itemsize">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
254 <tt class="descname">itemsize</tt><a class="headerlink" href="#pygame.PixelArray.itemsize" title="Permalink to this definition">¶</a></dt>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
255 <dd><div class="line-block">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
256 <div class="line"><span class="summaryline">Returns the byte size of a pixel array item</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
257 <div class="line"><span class="signature">itemsize -&gt; int</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
258 </div>
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
259 <p>This is the same as <a class="reference internal" href="surface.html#pygame.Surface.get_bytesize" title="pygame.Surface.get_bytesize"><tt class="xref py py-meth docutils literal"><span class="pre">Surface.get_bytesize()</span></tt></a> for the
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
260 pixel array&#8217;s surface.</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
261 <p>New in pygame 1.9.2</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
262 </dd></dl>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
263
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
264 <dl class="definition attribute">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
265 <dt class="title" id="pygame.PixelArray.ndim">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
266 <tt class="descname">ndim</tt><a class="headerlink" href="#pygame.PixelArray.ndim" title="Permalink to this definition">¶</a></dt>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
267 <dd><div class="line-block">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
268 <div class="line"><span class="summaryline">Returns the number of dimensions.</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
269 <div class="line"><span class="signature">ndim -&gt; int</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
270 </div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
271 <p>A pixel array can be 1 or 2 dimensional.</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
272 <p>New in pygame 1.9.2</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
273 </dd></dl>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
274
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
275 <dl class="definition attribute">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
276 <dt class="title" id="pygame.PixelArray.shape">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
277 <tt class="descname">shape</tt><a class="headerlink" href="#pygame.PixelArray.shape" title="Permalink to this definition">¶</a></dt>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
278 <dd><div class="line-block">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
279 <div class="line"><span class="summaryline">Returns the array size.</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
280 <div class="line"><span class="signature">shape -&gt; tuple of int&#8217;s</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
281 </div>
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
282 <p>A tuple or length <a class="reference internal" href="#pygame.PixelArray.ndim" title="pygame.PixelArray.ndim"><tt class="xref py py-attr docutils literal"><span class="pre">ndim</span></tt></a> giving the length of each
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
283 dimension. Analogous to <a class="reference internal" href="surface.html#pygame.Surface.get_size" title="pygame.Surface.get_size"><tt class="xref py py-meth docutils literal"><span class="pre">Surface.get_size()</span></tt></a>.</p>
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
284 <p>New in pygame 1.9.2</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
285 </dd></dl>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
286
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
287 <dl class="definition attribute">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
288 <dt class="title" id="pygame.PixelArray.strides">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
289 <tt class="descname">strides</tt><a class="headerlink" href="#pygame.PixelArray.strides" title="Permalink to this definition">¶</a></dt>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
290 <dd><div class="line-block">
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
291 <div class="line"><span class="summaryline">Returns byte offsets for each array dimension.</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
292 <div class="line"><span class="signature">strides -&gt; tuple of int&#8217;s</span></div>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
293 </div>
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
294 <p>A tuple or length <a class="reference internal" href="#pygame.PixelArray.ndim" title="pygame.PixelArray.ndim"><tt class="xref py py-attr docutils literal"><span class="pre">ndim</span></tt></a> byte counts. When a stride is
2218
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
295 multiplied by the corresponding index it gives the offset
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
296 of that index from the start of the array. A stride is negative
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
297 for an array that has is inverted (has a negative step).</p>
7b81f1162a96 Add an array struct interface and the ndim, itemsize, shape, strides, and _pixels_address properties.
Lenard Lindstrom <len-l@telus.net>
parents: 2217
diff changeset
298 <p>New in pygame 1.9.2</p>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
299 </dd></dl>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
300
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
301 <dl class="definition method">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
302 <dt class="title" id="pygame.PixelArray.make_surface">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
303 <tt class="descname">make_surface</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.PixelArray.make_surface" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
304 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
305 <div class="line"><span class="summaryline">Creates a new Surface from the current PixelArray.</span></div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
306 <div class="line"><span class="signature">make_surface() -&gt; Surface</span></div>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
307 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
308 <p>Creates a new Surface from the current PixelArray. Depending on the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
309 current PixelArray the size, pixel order etc. will be different from the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
310 original Surface.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
311 <div class="highlight-python"><div class="highlight"><pre><span class="c"># Create a new surface flipped around the vertical axis.</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
312 <span class="n">sf</span> <span class="o">=</span> <span class="n">pxarray</span><span class="p">[:,::</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">make_surface</span> <span class="p">()</span>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
313 </pre></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
314 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
315 <p>New in pygame 1.8.1.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
316 </dd></dl>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
317
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
318 <dl class="definition method">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
319 <dt class="title" id="pygame.PixelArray.replace">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
320 <tt class="descname">replace</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.PixelArray.replace" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
321 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
322 <div class="line"><span class="summaryline">Replaces the passed color in the PixelArray with another one.</span></div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
323 <div class="line"><span class="signature">replace(color, repcolor, distance=0, weights=(0.299, 0.587, 0.114)) -&gt; None</span></div>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
324 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
325 <p>Replaces the pixels with the passed color in the PixelArray by changing
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
326 them them to the passed replacement color.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
327 <p>It uses a simple weighted euclidian distance formula to calculate the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
328 distance between the colors. The distance space ranges from 0.0 to 1.0
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
329 and is used as threshold for the color detection. This causes the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
330 replacement to take pixels with a similar, but not exactly identical
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
331 color, into account as well.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
332 <p>This is an in place operation that directly affects the pixels of the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
333 PixelArray.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
334 <p>New in pygame 1.8.1.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
335 </dd></dl>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
336
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
337 <dl class="definition method">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
338 <dt class="title" id="pygame.PixelArray.extract">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
339 <tt class="descname">extract</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.PixelArray.extract" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
340 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
341 <div class="line"><span class="summaryline">Extracts the passed color from the PixelArray.</span></div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
342 <div class="line"><span class="signature">extract(color, distance=0, weights=(0.299, 0.587, 0.114)) -&gt; PixelArray</span></div>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
343 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
344 <p>Extracts the passed color by changing all matching pixels to white, while
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
345 non-matching pixels are changed to black. This returns a new PixelArray
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
346 with the black/white color mask.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
347 <p>It uses a simple weighted euclidian distance formula to calculate the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
348 distance between the colors. The distance space ranges from 0.0 to 1.0
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
349 and is used as threshold for the color detection. This causes the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
350 extraction to take pixels with a similar, but not exactly identical
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
351 color, into account as well.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
352 <p>New in pygame 1.8.1.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
353 </dd></dl>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
354
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
355 <dl class="definition method">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
356 <dt class="title" id="pygame.PixelArray.compare">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
357 <tt class="descname">compare</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.PixelArray.compare" title="Permalink to this definition">¶</a></dt>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
358 <dd><div class="line-block">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
359 <div class="line"><span class="summaryline">Compares the PixelArray with another one.</span></div>
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
360 <div class="line"><span class="signature">compare(array, distance=0, weights=(0.299, 0.587, 0.114)) -&gt; PixelArray</span></div>
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
361 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
362 <p>Compares the contents of the PixelArray with those from the passed
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
363 PixelArray. It returns a new PixelArray with a black/white color mask
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
364 that indicates the differences (white) of both arrays. Both PixelArray
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
365 objects must have indentical bit depths and dimensions.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
366 <p>It uses a simple weighted euclidian distance formula to calculate the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
367 distance between the colors. The distance space ranges from 0.0 to 1.0
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
368 and is used as threshold for the color detection. This causes the
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
369 comparision to mark pixels with a similar, but not exactly identical
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
370 color, as black.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
371 <p>New in pygame 1.8.1.</p>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
372 </dd></dl>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
373
2240
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
374 <dl class="definition method">
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
375 <dt class="title" id="pygame.PixelArray.transpose">
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
376 <tt class="descname">transpose</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.PixelArray.transpose" title="Permalink to this definition">¶</a></dt>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
377 <dd><div class="line-block">
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
378 <div class="line"><span class="summaryline">Exchanges the x and y axis.</span></div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
379 <div class="line"><span class="signature">transpose() -&gt; PixelArray</span></div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
380 </div>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
381 <p>This method returns a new view of the pixel array with the rows and
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
382 columns swapped. So for a (w, h) sized array a (h, w) slice is returned.
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
383 If an array is one dimensional, then a length 1 x dimension is added,
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
384 resulting in a 2D pixel array.</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
385 <p>New in pygame 1.9.2</p>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
386 </dd></dl>
be3228f63883 Make PixelArray more internally consistent
Lenard Lindstrom <len-l@telus.net>
parents: 2239
diff changeset
387
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
388 </dd></dl>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
389
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
390 </div>
1553
ebd545641c8b merging with python3 branch r 2048
Lenard Lindstrom <len-l@telus.net>
parents: 1548
diff changeset
391
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
392 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
393 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
394 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
395 <div class="clearer"></div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
396 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
397 <div class="related">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
398 <h3>Navigation</h3>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
399 <ul>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
400 <li class="right" style="margin-right: 10px">
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
401 <a href="../genindex.html" title="General Index"
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
402 accesskey="I">index</a></li>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
403 <li class="right" >
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
404 <a href="pixelcopy.html" title="pygame.pixelcopy"
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
405 accesskey="N">next</a> |</li>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
406 <li class="right" >
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
407 <a href="overlay.html" title="pygame.Overlay"
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
408 accesskey="P">previous</a> |</li>
2239
ca88e9308d44 regenerated html docs. Should all have doc comments from the website now.
Rene Dudfield <renesd@gmail.com>
parents: 2225
diff changeset
409 <li><a href="../index.html">Pygame v1.9.2 documentation</a> &raquo;</li>
ca88e9308d44 regenerated html docs. Should all have doc comments from the website now.
Rene Dudfield <renesd@gmail.com>
parents: 2225
diff changeset
410 <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>
ca88e9308d44 regenerated html docs. Should all have doc comments from the website now.
Rene Dudfield <renesd@gmail.com>
parents: 2225
diff changeset
411
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
412 </ul>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
413 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
414 <div class="footer">
2225
5f65dd2d9267 regenerate sphinx docs
Rene Dudfield <renesd@gmail.com>
parents: 2218
diff changeset
415 &copy; Copyright 2011, Pygame Developers.
2198
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
416 </div>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
417 </body>
da4302429d3b replace makeref.py generated documents with makeref2.py documents
Lenard Lindstrom <len-l@telus.net>
parents: 2148
diff changeset
418 </html>