Module Image :: Class Image
[frames | no frames]

Class Image


The Image object

This object gives access to Images in Blender.
Method Summary
int getBindCode()
Get the Image's bindcode.
int getDepth()
Get the pixel depth of this image.
string getFilename()
Get the filename of the image file loaded into this Image object.
string getName()
Get the name of this Image object.
list of 2 ints getSize()
Get the [width, height] dimensions (in pixels) of this image.
int getXRep()
Get the number of repetitions in the x (horizontal) axis for this Image.
int getYRep()
Get the number of repetitions in the y (vertical) axis for this Image.
  glFree()
Delete this image's data from OpenGL texture memory, only (the image itself is not removed from Blender's memory).
int glLoad()
Load this image's data into OpenGL texture memory, if it is not already loaded (image.bindcode is 0 if it is not loaded yet).
  reload()
Reloads this image from the filesystem.
  setName(name)
Set the name of this Image object.
  setXRep(xrep)
Texture tiling: set the number of x repetitions for this Image.
  setYRep(yrep)
Texture tiling: set the number of y repetitions for this Image.

Class Variable Summary
  bindcode: Texture's bind code (readonly).
  depth: The pixel depth of the image.
  filename: The filename (path) to the image file loaded into this Image object.
  name: The name of this Image object.
  size: The [width, height] dimensions of the image (in pixels).
  xrep: Texture tiling: the number of repetitions in the x (horizontal) axis.
  yrep: Texture tiling: the number of repetitions in the y (vertical) axis.

Method Details

getBindCode()

Get the Image's bindcode. This is for texture loading using BGL calls. See, for example, BGL.glBindTexture and glLoad.
Returns:
int

getDepth()

Get the pixel depth of this image.
Returns:
int

getFilename()

Get the filename of the image file loaded into this Image object.
Returns:
string

getName()

Get the name of this Image object.
Returns:
string

getSize()

Get the [width, height] dimensions (in pixels) of this image.
Returns:
list of 2 ints

getXRep()

Get the number of repetitions in the x (horizontal) axis for this Image. This is for texture tiling.
Returns:
int

getYRep()

Get the number of repetitions in the y (vertical) axis for this Image. This is for texture tiling.
Returns:
int

glFree()

Delete this image's data from OpenGL texture memory, only (the image itself is not removed from Blender's memory). Internally, glDeleteTextures (see BGL.glDeleteTextures) is used, but this method also updates Blender's Image object so that its bind code is set to 0. See also Image.glLoad, Image.getBindCode.

glLoad()

Load this image's data into OpenGL texture memory, if it is not already loaded (image.bindcode is 0 if it is not loaded yet).
Returns:
the texture's bind code.
           (type=int)

Note: Usually you don't need to call this method. It is only necessary if you want to draw textured objects in the Scripts window and the image's bind code is zero at that moment, otherwise Blender itself can take care of binding / unbinding textures. Calling this method for an image with nonzero bind code simply returns the image's bind code value (see getBindCode).

reload()

Reloads this image from the filesystem. If used within a loop you need to redraw the Window to see the change in the image, e.g. with Window.RedrawAll().
Returns:
None

Warning: if the image file is corrupt or still being written, it will be replaced by a blank image in Blender, but no error will be returned.

setName(name)

Set the name of this Image object.
Parameters:
name - The new name.
           (type=string)

setXRep(xrep)

Texture tiling: set the number of x repetitions for this Image.
Parameters:
xrep - The new value in [1, 16].
           (type=int)

setYRep(yrep)

Texture tiling: set the number of y repetitions for this Image.
Parameters:
yrep - The new value in [1, 16].
           (type=int)

Class Variable Details

bindcode

Texture's bind code (readonly).

depth

The pixel depth of the image.

filename

The filename (path) to the image file loaded into this Image object.

name

The name of this Image object.

size

The [width, height] dimensions of the image (in pixels).

xrep

Texture tiling: the number of repetitions in the x (horizontal) axis.

yrep

Texture tiling: the number of repetitions in the y (vertical) axis.

Generated by Epydoc 2.1 on Tue Jan 4 13:43:05 2005 http://epydoc.sf.net