qgl.texture
index
/home/simon/svn/qgl/trunk/qgl/texture.py

This module contains facilites for working with and creating textures.
 
The Coords class is used for generating and manipulating texture coordinates.
Dont use it in an inner loop, its __getitem__ method is very slow.
 
The PackNode can recursively pack rectanges into a larger rectangle. The Pack
class uses the PackNode class to pack smaller images into one larger image.
This is useful for storing multiple images as one larger OpenGL texture which
helps avoid texture swaps.

 
Modules
       
pygame

 
Classes
       
__builtin__.object
Coords
Pack
PackNode

 
class Coords(__builtin__.object)
    A type for managing texture coordinates.
Use * and / for scaling, + and - for translating.
 
  Methods defined here:
__add__(self, vec2)
__div__(self, scalar)
__getitem__(self, i)
Index 0 is bottom left coordinate.
Index 1 is top left coordinate.
Index 2 is top right coordinate.
Index 3 is bottom right coordinate.
__iadd__(self, vec2)
__idiv__(self, scalar)
__imul__(self, scalar)
__init__(self, lrbt=(0.0, 1.0, 0.0, 1.0))
__isub__(self, vec2)
__mul__(self, scalar)
__repr__(self)
__sub__(self, vec2)

Data and other attributes defined here:
__slots__ = ('lrbt',)
lrbt = <member 'lrbt' of 'Coords' objects>

 
class Pack(__builtin__.object)
    The Pack class uses the PackNode class to paste smaller images into a 
larger image.
 
  Methods defined here:
__init__(self, size=(512, 512))
The size keyword specifies the size of the larger image, which 
smaller images will be packed into.
Once packing is complete, the .image attribute will contain a pygame
Surface which can be saved.
pack(self, img)
Pack a smaller image into the larger image, and return a 4 tuple of
normalized coordinates which contain the location of the pasted 
image. If no space is left in the parent image, ValueError is raised.

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'Pack' objects>
list of weak references to the object (if defined)

 
class PackNode(__builtin__.object)
    Creates an area which can recursively pack smaller areas into itself.
 
  Methods defined here:
__init__(self, area)
Creates an area (w,h) which will smaller areas can be packed into via
the insert method.
__repr__(self)
get_height(self)
get_width(self)
insert(self, area)
Insert an area into the current area. Returns a new Node representing
the new area.
Returns None if no space is available for the new area.

Properties defined here:
height
get = get_height(self)
width
get = get_width(self)

Data and other attributes defined here:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'PackNode' objects>
list of weak references to the object (if defined)