Package pajammin :: Package display :: Module image
[show private | hide private]
[frames | no frames]

Module pajammin.display.image

Support for loading and manipulating images.

The subclasses of ImageSpec can be used to give an abstract specification for an image. For example, the following object specifies the result of flipping and rotating an image loaded from a file:
>>> FlipImage(RotateImage(ImageFile('foo.gif', 90), horiz=True))

To retrieve the image specified by an ImageSpec, simply use its load() method. Image specifications are useful because they allow us to pickle an object that uses an image without pickling the image itself; or to describe an object that uses an image without loading the actual image.

The helper function imagespec_grid is used to generate a list of image specifications for subimages of equal size extracted from a single source image. It is typically used to load animation frames for an animated sprite.
Classes
CachedImage  
EmptyImage  
FlipImage  
ImageFile  
ImageSpec An abstract specification of an image.
PatternImage Use one image as a 'pattern' to overlay on a template image.
RotateImage  
ScaleImage  
SolidColor  
SubImage  
SuperImpose  
TileHoriz  
TileVert  

Function Summary
  imagespec_grid(imagespec, size, rows, border, reverse)
Return a list of image specifications for subimages, of equal size, extracted from the given image.

Function Details

imagespec_grid(imagespec, size, rows, border=1, reverse=False)

Return a list of image specifications for subimages, of equal size, extracted from the given image. This is typically used to load the frames for an animation.
Parameters:
size - The size of each subimage
rows - A list of numbers indicating the length of each row of images. E.g., for an image grid with 2 rows and 10 columns, rows should be [10, 10].
border - The size of the border area between images.