| Home | Trees | Index | Help |
|---|
| Package ocempgui :: Package draw :: Module Complex :: Class FaderSurface |
|
object--+ |Surface--+ | FaderSurface
FaderSurface (width, height, alpha=255) -> FaderSurface
A pygame.Surface class, that supports alpha fading.
The FaderSurface is an enhanced 32-bit pygame.Surface, that supports
alpha blending and fading the surface in or out. It uses pixel-based
alpha values for transparency.
The 'alpha' attribute indicates the currently set alpha value for
the Surface and can be adjusted by either reassigning it directly or
using the set_alpha() method. Its value range is limited from 0
(transparent) to 255 (opaque) as supported by the pygame library.
fader.alpha = 155
fader.set_alpha (24)
Note that the set_alpha() method overrides the original set_alpha()
method from pygame.Surface.
The stepping value for fading operations can be read and set through
the 'step' attribute or set_step() method. Each call of the update()
method will increase (or decrease) the alpha value by the set step.
fader.step = 10
fader.set_step (5)
To in- or decrease the alpha channel so that you will receive a fade
in or fade out effect, you can use the update() method in a loop,
which constantly blits the surface.
while fader.update ():
screen.blit (fader, (10, 10))
pygame.display.update (fader_rect)
The update() method returns True as long as the alpha value has not
reached its upper or lower boundary.
Attributes:
alpha - The currently set alpha value.
step - The step range for increasing or decreasing the alpha value.
| Method Summary | |
|---|---|
__init__(self,
width,
height,
alpha)
| |
F.set_alpha (...) -> None | |
F.set_step (...) -> None | |
F.update () -> bool | |
| Inherited from Surface | |
Surface.copy(): return Surface create a new copy of a Surface | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
x.__repr__() <==> repr(x) | |
Surface.blit(source, dest, area=None, special_flags = 0): return Rect draw one image onto another | |
Surface.convert(Surface): return Surface Surface.convert(depth, flags=0): return Surface Surface.convert(masks, flags=0): return Surface Surface.convert(): return Surface change the pixel format of an image | |
Surface.convert_alpha(Surface): return Surface Surface.convert_alpha(): return Surface change the pixel format of an image including per pixel alphas | |
Surface.copy(): return Surface create a new copy of a Surface | |
Surface.fill(color, rect=None, special_flags=0): return Rect fill Surface with a solid color | |
Surface.get_abs_offset(): return (x, y) find the absolute position of a child subsurface inside its top level parent | |
Surface.get_abs_parent(): return Surface find the top level parent of a subsurface | |
Surface.get_alpha(): return int_value or None get the current Surface transparency value | |
Surface.get_at((x, y)): return Color get the color value at a single pixel | |
Surface.get_bitsize(): return int get the bit depth of the Surface pixel format | |
Surface.get_buffer(): return BufferProxy acquires a buffer object for the pixels of the Surface. | |
Surface.get_bytesize(): return int get the bytes used per Surface pixel | |
Surface.get_clip(): return Rect get the current clipping are of the Surface | |
Surface.get_colorkey(): return RGB or None Get the current transparent colorkey | |
Surface.get_flags(): return int get the additional flags used for the Surface | |
Surface.get_height(): return height get the height of the Surface | |
Surface.get_locked(): return bool test if the Surface is current locked | |
Surface.get_losses(): return (R, G, B, A) the significant bits used to convert between a color and a mapped integer | |
Surface.get_masks(): return (R, G, B, A) the bitmasks needed to convert between a color and a mapped integer | |
Surface.get_offset(): return (x, y) find the position of a child subsurface inside a parent | |
Surface.get_palette(): return [RGB, RGB, RGB, ...] get the color index palette for an 8bit Surface | |
Surface.get_palette_at(index): return RGB get the color for a single entry in a palette | |
Surface.get_parent(): return Surface find the parent of a subsurface | |
Surface.get_pitch(): return int get the number of bytes used per Surface row | |
Surface.get_rect(**kwargs): return Rect get the rectangular area of the Surface | |
Surface.get_shifts(): return (R, G, B, A) the bit shifts needed to convert between a color and a mapped integer | |
Surface.get_size(): return (width, height) get the dimensions of the Surface | |
Surface.get_width(): return width get the width of the Surface | |
Surface.lock(): return None lock the Surface memory for pixel access | |
Surface.map_rgb(Color): return mapped_int convert a color into a mapped color value | |
Surface.mustlock(): return bool test if the Surface requires locking | |
Surface.set_at((x, y), Color): return None set the color value for a single pixel | |
Surface.set_clip(rect): return None Surface.set_clip(None): return None set the current clipping area of the Surface | |
Surface.set_colorkey(Color, flags=0): return None Surface.set_colorkey(None): return None Set the transparent colorkey | |
Surface.set_palette([RGB, RGB, RGB, ...]): return None set the color palette for an 8bit Surface | |
Surface.set_at(index, RGB): return None set the color for a single index in an 8bit Surface palette | |
Surface.subsurface(Rect): return Surface create a new surface that references its parent | |
Surface.unlock(): return None unlock the Surface memory from pixel access | |
Surface.map_rgb(mapped_int): return Color convert a mapped integer color value into a Color | |
| Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) | |
| Property Summary | |
|---|---|
alpha: The currently set alpha value. | |
step: The step range for increasing or decreasing thealpha value. | |
| Method Details |
|---|
set_alpha(self, alpha=255)F.set_alpha (...) -> None Sets the alpha transparency value. Raises a TypeError, if the passed argument is not an integer. Raises a ValueError, if the passed argument is not in the range 0 <= alpha <= 255
|
set_step(self, step=-1)F.set_step (...) -> None Sets the step range to use for in- or decreasing the alpha value. Raises a TypeError, if the passed argument is not an integer. |
update(self)F.update () -> bool Updates the alpha channel of the surface. Updates the alpha channel of the surface and returns True, if the alpha channel was modified or False, if not. |
| Property Details |
|---|
alphaThe currently set alpha value.
|
stepThe step range for increasing or decreasing thealpha value.
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 | http://epydoc.sf.net |