~ubuntu-branches/ubuntu/feisty/pygame/feisty

« back to all changes in this revision

Viewing changes to docs/ref/pygame_surfarray.html

  • Committer: Bazaar Package Importer
  • Author(s): Ed Boraas
  • Date: 2002-02-20 06:39:24 UTC
  • Revision ID: james.westby@ubuntu.com-20020220063924-amlzj7tqkeods4eq
Tags: upstream-1.4
ImportĀ upstreamĀ versionĀ 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<title>pygame.surfarray</title>
 
3
<body bgcolor=#aaeebb text=#000000 link=#331111 vlink=#331111>
 
4
 
 
5
 
 
6
<table cellspacing=3 width=100%><tr><td bgcolor=#00000>
 
7
<table width=100%><tr><td bgcolor=c2fc20 align=center>
 
8
    <a href=http://www.pygame.org>
 
9
    <img src=../pygame_tiny.gif border=0 width=200 height=60></a><br>
 
10
    <b>pygame&nbsp;&nbsp;&nbsp;documentation</b>
 
11
</td><td bgcolor=6aee28 align=center valign=top width=100%>
 
12
 
 
13
        ||&nbsp;
 
14
        <a href=http://www.pygame.org>Home</a> &nbsp;||&nbsp;
 
15
        <a href=../index.html>Help Contents</a> &nbsp;||
 
16
        <br>&nbsp;<br>
 
17
 
 
18
|| <a href=pygame.html>pygame</a> || 
 
19
<a href=pygame_cdrom.html>cdrom</a> || 
 
20
<a href=pygame_constants.html>constants</a> || 
 
21
<a href=pygame_display.html>display</a> || 
 
22
<a href=pygame_draw.html>draw</a> || 
 
23
<a href=pygame_event.html>event</a> ||<br>
 
24
|| <a href=pygame_font.html>font</a> || 
 
25
<a href=pygame_image.html>image</a> || 
 
26
<a href=pygame_joystick.html>joystick</a> || 
 
27
<a href=pygame_key.html>key</a> || 
 
28
<a href=pygame_mixer.html>mixer</a> || 
 
29
<a href=pygame_mixer_music.html>mixer_music</a> ||<br>
 
30
|| <a href=pygame_mouse.html>mouse</a> || 
 
31
<a href=pygame_movie.html>movie</a> || 
 
32
<a href=pygame_surfarray.html>surfarray</a> || 
 
33
<a href=pygame_time.html>time</a> || 
 
34
<a href=pygame_transform.html>transform</a> ||<br>
 
35
&nbsp;<br>|| <a href=CD.html>CD</a> || 
 
36
<a href=Channel.html>Channel</a> || 
 
37
<a href=Clock.html>Clock</a> || 
 
38
<a href=Font.html>Font</a> || 
 
39
<a href=Joystick.html>Joystick</a> || 
 
40
<a href=Movie.html>Movie</a> ||<br>
 
41
|| <a href=Rect.html>Rect</a> || 
 
42
<a href=Sound.html>Sound</a> || 
 
43
<a href=Surface.html>Surface</a> ||<br>
 
44
&nbsp;<br>|| <a href=pygame_cursors.html>cursors</a> || 
 
45
<a href=pygame_sprite.html>sprite</a> || 
 
46
<a href=pygame_version.html>version</a> ||<br>
 
47
 
 
48
 
 
49
</td></tr></table></td></tr></table>
 
50
<br>
 
51
<h2 align=center>pygame.surfarray</h2>
 
52
Contains routines for mixing numeric arrays with
 
53
surfaces
 
54
 
 
55
<hr>
 
56
 
 
57
<table>
 
58
<tr><td><a href=#array2d>array2d</a></td><td> -
 
59
get a 2d array copied from a surface</td></tr>
 
60
 
 
61
 
 
62
<tr><td><a href=#array3d>array3d</a></td><td> -
 
63
get a 3d array copied from a surface</td></tr>
 
64
 
 
65
 
 
66
<tr><td><a href=#array_alpha>array_alpha</a></td><td> -
 
67
get an array with a surface pixel alpha values</td></tr>
 
68
 
 
69
 
 
70
<tr><td><a href=#array_colorkey>array_colorkey</a></td><td> -
 
71
get an array with a surface colorkey values</td></tr>
 
72
 
 
73
 
 
74
<tr><td><a href=#blit_array>blit_array</a></td><td> -
 
75
quickly transfer an array to a Surface</td></tr>
 
76
 
 
77
 
 
78
<tr><td><a href=#map_array>map_array</a></td><td> -
 
79
map an array with RGB values into mapped colors</td></tr>
 
80
 
 
81
 
 
82
<tr><td><a href=#pixels2d>pixels2d</a></td><td> -
 
83
get a 2d reference array to a surface</td></tr>
 
84
 
 
85
 
 
86
<tr><td><a href=#pixels3d>pixels3d</a></td><td> -
 
87
get a 3d reference array to a surface</td></tr>
 
88
 
 
89
 
 
90
<tr><td><a href=#pixels_alpha>pixels_alpha</a></td><td> -
 
91
get a reference array to a surface alpha data</td></tr>
 
92
 
 
93
 
 
94
</table>
 
95
 
 
96
<hr>
 
97
 
 
98
<a name=array2d><font size=+2><b>array2d
 
99
</b></font><br><font size=+1><tt>
 
100
pygame.surfarray.array2d(Surface) -> Array
 
101
</tt></font><ul>
 
102
This returns a new contigous 2d array. Think of it
 
103
as a 2d image array with a mapped pixel value at
 
104
each index.
 
105
<br>&nbsp;<br>
 
106
This function will temporarily lock the surface.
 
107
</ul><br>&nbsp;<br>
 
108
 
 
109
<a name=array3d><font size=+2><b>array3d
 
110
</b></font><br><font size=+1><tt>
 
111
pygame.surfarray.array3d(Surface) -> Array
 
112
</tt></font><ul>
 
113
This returns a new contigous 3d array. Think of it
 
114
as a 2d image array with an RGB array for each
 
115
pixel value.
 
116
<br>&nbsp;<br>
 
117
This function will temporarily lock the surface.
 
118
</ul><br>&nbsp;<br>
 
119
 
 
120
<a name=array_alpha><font size=+2><b>array_alpha
 
121
</b></font><br><font size=+1><tt>
 
122
pygame.surfarray.array_alpha(Surface) -> Array
 
123
</tt></font><ul>
 
124
This returns a new contigous 2d array with the
 
125
alpha values of an image as unsigned bytes. If the
 
126
surface has no alpha, an array of all opaque values
 
127
is returned.
 
128
<br>&nbsp;<br>
 
129
This function will temporarily lock the surface.
 
130
</ul><br>&nbsp;<br>
 
131
 
 
132
<a name=array_colorkey><font size=+2><b>array_colorkey
 
133
</b></font><br><font size=+1><tt>
 
134
pygame.surfarray.array_colorkey(Surface) -> Array
 
135
</tt></font><ul>
 
136
This returns a new contigous 2d array with the
 
137
colorkey values of an image as unsigned bytes. If the
 
138
surface has no colorkey, an array of all opaque values
 
139
is returned. Otherwise the array is either 0's or 255's.
 
140
<br>&nbsp;<br>
 
141
This function will temporarily lock the surface.
 
142
</ul><br>&nbsp;<br>
 
143
 
 
144
<a name=blit_array><font size=+2><b>blit_array
 
145
</b></font><br><font size=+1><tt>
 
146
pygame.surfarray.blit_array(surf, array) -> None
 
147
</tt></font><ul>
 
148
Transfer an array of any type (3d or 2d) onto a
 
149
Surface. The array must be the same dimensions as
 
150
the destination Surface. While you can assign the
 
151
values of an array to the pixel referenced arrays,
 
152
using this blit method will usually be quicker
 
153
because of it's smarter handling of noncontiguous
 
154
arrays. Plus it allows you to blit from any image
 
155
array type to any surface format in one step, no
 
156
internal conversions.
 
157
<br>&nbsp;<br>
 
158
This function will temporarily lock the surface.
 
159
</ul><br>&nbsp;<br>
 
160
 
 
161
<a name=map_array><font size=+2><b>map_array
 
162
</b></font><br><font size=+1><tt>
 
163
pygame.surfarray.map_array(surf, array3d) -> array2d
 
164
</tt></font><ul>
 
165
Create a new array with the RGB pixel values of a
 
166
3d array into mapped color values in a 2D array.
 
167
<br>&nbsp;<br>
 
168
Just so you know, this can also map a 2D array
 
169
with RGB values into a 1D array of mapped color
 
170
values
 
171
</ul><br>&nbsp;<br>
 
172
 
 
173
<a name=pixels2d><font size=+2><b>pixels2d
 
174
</b></font><br><font size=+1><tt>
 
175
pygame.surfarray.pixels2d(Surface) -> Array
 
176
</tt></font><ul>
 
177
This returns a new noncontigous 2d array that
 
178
directly effects a Surface's contents. Think of it
 
179
as a 2d image array with a mapped pixel value at
 
180
each index.
 
181
<br>&nbsp;<br>
 
182
This will not work on 24bit surfaces, since there
 
183
is no native 24bit data type to access the pixel
 
184
values.
 
185
<br>&nbsp;<br>
 
186
This function will lock the given surface, and it
 
187
will remained locked for as long as the pixel array
 
188
exists
 
189
</ul><br>&nbsp;<br>
 
190
 
 
191
<a name=pixels3d><font size=+2><b>pixels3d
 
192
</b></font><br><font size=+1><tt>
 
193
pygame.surfarray.pixels3d(Surface) -> Array
 
194
</tt></font><ul>
 
195
This returns a new noncontigous 3d array that
 
196
directly effects a Surface's contents. Think of it
 
197
as a 2d image array with an RGB array for each
 
198
pixel value.
 
199
<br>&nbsp;<br>
 
200
This will only work for 24 and 32 bit surfaces,
 
201
where the RGB components can be accessed as 8-bit
 
202
components.
 
203
<br>&nbsp;<br>
 
204
This function will lock the given surface, and it
 
205
will remained locked for as long as the pixel array
 
206
exists
 
207
</ul><br>&nbsp;<br>
 
208
 
 
209
<a name=pixels_alpha><font size=+2><b>pixels_alpha
 
210
</b></font><br><font size=+1><tt>
 
211
pygame.surfarray.pixels_alpha(Surface) -> Array
 
212
</tt></font><ul>
 
213
This returns a new noncontigous array that directly
 
214
effects a Surface's alpha contents.
 
215
<br>&nbsp;<br>
 
216
This will only work for 32bit surfaces with a pixel
 
217
alpha channel enabled.
 
218
<br>&nbsp;<br>
 
219
This function will lock the given surface, and it
 
220
will remained locked for as long as the pixel array
 
221
exists
 
222
</ul><br>&nbsp;<br>
 
223
 
 
224
 
 
225
<hr>
 
226
</body></html>