~ubuntu-branches/ubuntu/maverick/pygame/maverick

« back to all changes in this revision

Viewing changes to src/surface.doc

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2010-01-14 17:02:11 UTC
  • mfrom: (1.3.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100114170211-21eop2ja7mr9vdcr
Tags: 1.9.1release-0ubuntu1
* New upstream version (lp: #433304)
* debian/control:
  - build-depends on libportmidi-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
Surfaces can have many extra attributes like alpha planes, colorkeys, source
30
30
rectangle clipping. These functions mainly effect how the Surface is blitted
31
 
to other Surfaces. The blit routines will attempt to use hardware acceleratio
32
 
 when possible, otherwise will use highly optimized software blitting methods.
 
31
to other Surfaces. The blit routines will attempt to use hardware acceleration
 
32
when possible, otherwise they will use highly optimized software blitting
 
33
methods.
33
34
 
34
35
There are three types of transparency supported in Pygame: colorkeys, 
35
36
surface alphas, and pixel alphas. Surface alphas can be mixed with colorkeys,
104
105
Pixel alphas will be ignored when blitting to an 8 bit Surface.
105
106
 
106
107
special_flags new in pygame 1.8.
 
108
 
 
109
For a surface with colorkey or blanket alpha, a blit to self may give slightly
 
110
different colors than a non self-blit.
107
111
<END>
108
112
 
109
113
 
110
114
 
111
 
 
112
 
 
113
115
convert
114
116
change the pixel format of an image
115
117
Surface.convert(Surface): return Surface
183
185
<END>
184
186
 
185
187
 
 
188
 
 
189
scroll
 
190
Shift the surface image in place
 
191
Surface.scroll(dx=0, dy=0): return None
 
192
 
 
193
Move the image by dx pixels right and dy pixels down. dx and dy may be negative
 
194
for left and up scrolls respectively. Areas of the surface that are not
 
195
overwritten retain their original pixel values. Scrolling is contained
 
196
by the Surface clip area. It is safe to have dx and dy values that exceed
 
197
the surface size.
 
198
<END>
 
199
 
 
200
 
 
201
 
186
202
set_colorkey
187
203
Set the transparent colorkey
188
204
Surface.set_colorkey(Color, flags=0): return None
309
325
<END>
310
326
 
311
327
 
 
328
 
312
329
get_locked
313
330
test if the Surface is current locked
314
331
Surface.get_locked(): return bool
318
335
<END>
319
336
 
320
337
 
 
338
 
321
339
get_locks
322
340
Gets the locks for the Surface
323
341
Surface.get_locks(): return tuple
326
344
<END>
327
345
 
328
346
 
 
347
 
329
348
get_at
330
349
get the color value at a single pixel
331
350
Surface.get_at((x, y)): return Color
332
351
 
333
 
Return the RGBA color value at the given pixel. If the Surface has no per
334
 
pixel alpha, then the alpha value will always be 255 (opaque). If the pixel
335
 
position is outside the area of the Surface an IndexError exception will
336
 
be raised.
 
352
Return a copy of the RGBA Color value at the given pixel. If the Surface has 
 
353
no per pixel alpha, then the alpha value will always be 255 (opaque). 
 
354
If the pixel position is outside the area of the Surface an IndexError 
 
355
exception will be raised.
337
356
 
338
357
Getting and setting pixels one at a time is generally too slow to be used
339
 
in a game or realtime situation.
 
358
in a game or realtime situation.  It is better to use methods which operate 
 
359
on many pixels at a time like with the blit, fill and draw methods - 
 
360
or by using surfarray/PixelArray.
340
361
 
341
362
This function will temporarily lock and unlock the Surface as needed.
 
363
 
 
364
Returning a Color instead of tuple, New in pygame 1.9.0.
 
365
Use tuple(surf.get_at((x,y))) if you want a tuple, and not a Color.
 
366
This should only matter if you want to use the color as a key in a dict.
342
367
<END>
343
368
 
344
369
 
358
383
<END>
359
384
 
360
385
 
 
386
 
361
387
get_palette
362
388
get the color index palette for an 8bit Surface
363
389
Surface.get_palette(): return [RGB, RGB, RGB, ...]
365
391
Return a list of up to 256 color elements that represent the indexed colors
366
392
used in an 8bit Surface. The returned list is a copy of the palette, and 
367
393
changes will have no effect on the Surface.
 
394
 
 
395
Returning a list of Color(with length 3) instances instead of tuples, New in pygame 1.9.0
368
396
<END>
369
397
 
370
398
 
 
399
 
371
400
get_palette_at
372
401
get the color for a single entry in a palette
373
402
Surface.get_palette_at(index): return RGB
374
403
 
375
404
Returns the red, green, and blue color values for a single index in a Surface
376
405
palette. The index should be a value from 0 to 255.
 
406
 
 
407
Returning Color(with length 3) instance instead of a tuple, New in pygame 1.9.0
377
408
<END>
378
409
 
379
410
 
500
531
<END>
501
532
 
502
533
 
 
534
 
503
535
get_offset
504
536
find the position of a child subsurface inside a parent
505
537
Surface.get_offset(): return (x, y)
672
704
<END>
673
705
 
674
706
 
 
707
 
675
708
get_losses
676
709
the significant bits used to convert between a color and a mapped integer
677
710
Surface.get_losses(): return (R, G, B, A)