Package ocempgui :: Package draw :: Module Complex :: Class FaderSurface
[show private | hide private]
[frames | no frames]

Type 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)
  set_alpha(self, alpha)
F.set_alpha (...) -> None
  set_step(self, step)
F.set_step (...) -> None
  update(self)
F.update () -> bool
    Inherited from Surface
  __copy__(...)
Surface.copy(): return Surface create a new copy of a Surface
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __repr__(x)
x.__repr__() <==> repr(x)
  blit(...)
Surface.blit(source, dest, area=None, special_flags = 0): return Rect draw one image onto another
  convert(...)
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
  convert_alpha(...)
Surface.convert_alpha(Surface): return Surface Surface.convert_alpha(): return Surface change the pixel format of an image including per pixel alphas
  copy(...)
Surface.copy(): return Surface create a new copy of a Surface
  fill(...)
Surface.fill(color, rect=None, special_flags=0): return Rect fill Surface with a solid color
  get_abs_offset(...)
Surface.get_abs_offset(): return (x, y) find the absolute position of a child subsurface inside its top level parent
  get_abs_parent(...)
Surface.get_abs_parent(): return Surface find the top level parent of a subsurface
  get_alpha(...)
Surface.get_alpha(): return int_value or None get the current Surface transparency value
  get_at(...)
Surface.get_at((x, y)): return Color get the color value at a single pixel
  get_bitsize(...)
Surface.get_bitsize(): return int get the bit depth of the Surface pixel format
  get_buffer(...)
Surface.get_buffer(): return BufferProxy acquires a buffer object for the pixels of the Surface.
  get_bytesize(...)
Surface.get_bytesize(): return int get the bytes used per Surface pixel
  get_clip(...)
Surface.get_clip(): return Rect get the current clipping are of the Surface
  get_colorkey(...)
Surface.get_colorkey(): return RGB or None Get the current transparent colorkey
  get_flags(...)
Surface.get_flags(): return int get the additional flags used for the Surface
  get_height(...)
Surface.get_height(): return height get the height of the Surface
  get_locked(...)
Surface.get_locked(): return bool test if the Surface is current locked
  get_losses(...)
Surface.get_losses(): return (R, G, B, A) the significant bits used to convert between a color and a mapped integer
  get_masks(...)
Surface.get_masks(): return (R, G, B, A) the bitmasks needed to convert between a color and a mapped integer
  get_offset(...)
Surface.get_offset(): return (x, y) find the position of a child subsurface inside a parent
  get_palette(...)
Surface.get_palette(): return [RGB, RGB, RGB, ...] get the color index palette for an 8bit Surface
  get_palette_at(...)
Surface.get_palette_at(index): return RGB get the color for a single entry in a palette
  get_parent(...)
Surface.get_parent(): return Surface find the parent of a subsurface
  get_pitch(...)
Surface.get_pitch(): return int get the number of bytes used per Surface row
  get_rect(...)
Surface.get_rect(**kwargs): return Rect get the rectangular area of the Surface
  get_shifts(...)
Surface.get_shifts(): return (R, G, B, A) the bit shifts needed to convert between a color and a mapped integer
  get_size(...)
Surface.get_size(): return (width, height) get the dimensions of the Surface
  get_width(...)
Surface.get_width(): return width get the width of the Surface
  lock(...)
Surface.lock(): return None lock the Surface memory for pixel access
  map_rgb(...)
Surface.map_rgb(Color): return mapped_int convert a color into a mapped color value
  mustlock(...)
Surface.mustlock(): return bool test if the Surface requires locking
  set_at(...)
Surface.set_at((x, y), Color): return None set the color value for a single pixel
  set_clip(...)
Surface.set_clip(rect): return None Surface.set_clip(None): return None set the current clipping area of the Surface
  set_colorkey(...)
Surface.set_colorkey(Color, flags=0): return None Surface.set_colorkey(None): return None Set the transparent colorkey
  set_palette(...)
Surface.set_palette([RGB, RGB, RGB, ...]): return None set the color palette for an 8bit Surface
  set_palette_at(...)
Surface.set_at(index, RGB): return None set the color for a single index in an 8bit Surface palette
  subsurface(...)
Surface.subsurface(Rect): return Surface create a new surface that references its parent
  unlock(...)
Surface.unlock(): return None unlock the Surface memory from pixel access
  unmap_rgb(...)
Surface.map_rgb(mapped_int): return Color convert a mapped integer color value into a Color
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
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
Overrides:
pygame.Surface.set_alpha

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

alpha

The currently set alpha value.
Get Method:
unknown-687691340(...)
Set Method:
unknown-687691396(...)

step

The step range for increasing or decreasing thealpha value.
Get Method:
unknown-687691452(...)
Set Method:
unknown-687691508(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 http://epydoc.sf.net