Package pygext :: Package render :: Module utils
[frames | no frames]

Module pygext.render.utils

Utilities for generating graphics programmatically with surfarray
Function Summary
  color_array(xsize, ysize, r, g, b, a, values)
  color_slide(array, color1, color2)
Return an (r,g,b,a) array where 0.0 = color1 and 1.0 = color2 and interpolated values inbetween.
  colorize(surface, r, g, b)
  copy_alpha(src, dst)
  cut_array(array, minvalue, maxvalue)
Cut off values so that all elements < minvalue become minvalue and all elements > maxvalue become maxvalue.
  dist_array(xsize, ysize)
Returns a float array where each element is the distance to the center of the array.
  double(array)
Resize an (xsize,ysize,...) array into (xsize*2, ysize*2, ...)
  fractalize(a, delta)
Enlarge the image like soft_enlarge, but add random variation
  make_rgba(array, values)
Resize an (xsize,ysize) array into (xsize,ysize,values)
  make_stencil(alpha_array, r, g, b)
  scale_to_01(array)
Return a version of the array where all values are scaled to the range [0,1]
  soft_enlarge(array)
Resize an (xsize, ysize) array to (xsize*2-1, ysize*2-1) so that all intermediate values are interpolated.
  xy_arrays(xsize, ysize)
Returns xarray and yarray that have the specified shape.

Function Details

color_slide(array, color1, color2)

Return an (r,g,b,a) array where 0.0 = color1 and 1.0 = color2 and interpolated values inbetween.

Values less than 0.0 will all be color1 and values over 1.0 will all be color2.

cut_array(array, minvalue=None, maxvalue=None)

Cut off values so that all elements < minvalue become minvalue and all elements > maxvalue become maxvalue.

dist_array(xsize, ysize)

Returns a float array where each element is the distance to the center of the array.

double(array)

Resize an (xsize,ysize,...) array into (xsize*2, ysize*2, ...)

fractalize(a, delta)

Enlarge the image like soft_enlarge, but add random variation

make_rgba(array, values=4)

Resize an (xsize,ysize) array into (xsize,ysize,values)

scale_to_01(array)

Return a version of the array where all values are scaled to the range [0,1]

soft_enlarge(array)

Resize an (xsize, ysize) array to (xsize*2-1, ysize*2-1) so that all intermediate values are interpolated.

xy_arrays(xsize, ysize)

Returns xarray and yarray that have the specified shape.

E.g. xy_arrays(3,4) will return the arrays

[[0,0,0,0]   [[0,1,2,3]
 [1,1,1,1]    [0,1,2,3]
 [2,2,2,2]]   [0,1,2,3]]

Generated by Epydoc 2.1 on Mon Jun 12 18:21:21 2006 http://epydoc.sf.net