Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

ZE::ZImage Class Reference

#include <ZE_ZImage.h>

Inherits ZE::ZObject.

List of all members.


Detailed Description

ZImage image drawing class, class wraps common features of SDL_Surface. Inherited from ZObject.


Public Methods

 ZImage ()
 Default Constructor.

 ZImage (string filename)
 Constructor to Construct from File.

 ZImage (SDL_Surface *surface)
 Constructor to Construct from SDL_Surface*.

 ZImage (SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h)
 Constructor to Construct from part of an SDL_Surface*.

 ~ZImage ()
 Destructor, frees memory.

void Open (string filename)
 Opens a file.

void OpenFromImage (SDL_Surface *img, Sint16 x, Sint16 y, Sint16 w, Sint16 h)
 Cuts part of an existing image to create the new image.

void Attach (SDL_Surface *surface)
 Attach an existing surface to class.

void Release ()
 Releases image.

void SetColorKey (Uint8 red, Uint8 green, Uint8 blue)
 Set Color Key (transparent color) of Image.

void Bind ()
 OpenGL related bind call.

void Draw (int x, int y)
 Draw Image to Screen.

bool IsLoaded ()
 Check if file is loaded.

SDL_Surface * Surface ()
 Get SDL_Surface. Get SDL_Surface pointer to actual image data.

int Width ()
 Get Width.

int Height ()
 Get Height.


Protected Attributes

GLfloat rTexMaxX
 Texture X width ratio, used internally by OpenGL.

GLfloat rTexMaxY
 Texture Y width ratio, used internally by OpenGL.

SDL_Surface * rImage
 Stored texture for future use.

unsigned int rTexID
 Texture ID for OpenGL.

unsigned int rWidth
 Current draw width of Texture.

unsigned int rHeight
 Current draw height of Texture.


Constructor & Destructor Documentation

ZE::ZImage::ZImage  
 

Default Constructor, initializes variables.

ZE::ZImage::ZImage string    filename
 

Constructor is same as calling ZImage::Open() on passed filename.

Parameters:
filename  File to open as rImage.

ZE::ZImage::ZImage SDL_Surface *    surface
 

Constructor is same as calling ZImage::Attach() on passed SDL_Surface*.

Parameters:
surface  SDL_Surface* to use as rImage.

ZE::ZImage::ZImage SDL_Surface *    img,
Sint16    x,
Sint16    y,
Sint16    w,
Sint16    h
 

Constructor is same as calling ZImage::OpenFromImage.

Parameters:
img  Image to take new image from.
x  X Coordinate in source of top left corner.
y  Y Coordinate in source of top left corner.
w  Width of new image.
h  Height of new image.

ZE::ZImage::~ZImage  
 

Destructor calls ZImage::Release().


Member Function Documentation

void ZE::ZImage::Open string    filename
 

Open a file using ZEngine. Loads into rImage member of class.

Parameters:
filename  File to open as rImage.

void ZE::ZImage::OpenFromImage SDL_Surface *    img,
Sint16    x,
Sint16    y,
Sint16    w,
Sint16    h
 

Cut part of an SDL_Surface to create a new Image.

Parameters:
img  Image to take new image from.
x  X Coordinate in source of top left corner.
y  Y Coordinate in source of top left corner.
w  Width of new image.
h  Height of new image.

void ZE::ZImage::Attach SDL_Surface *    surface
 

Attach a pointer to instance of ZImage. (NOTE: Should not be used on a surface that is owned elsewhere.)

Parameters:
surface  SDL_Surface* to use as rImage.

void ZE::ZImage::Release  
 

Frees memory via call to SDL_FreeSurface for the image.

void ZE::ZImage::SetColorKey Uint8    red,
Uint8    green,
Uint8    blue
 

Set color which will not be drawn in image.

Parameters:
red  Red component of colorkey (0-255).
green  Green component of colorkey (0-255).
blue  Blue component of colorkey (0-255).

void ZE::ZImage::Bind  
 

OpenGL related bind call, only available in case you want to bind image in 3D. Draw uses this but the average user should never need to call this.

void ZE::ZImage::Draw int    x,
int    y
 

Draw Image to screen at specified location.

Parameters:
x  X coord to draw Image to.
y  Y coord to draw Image to.

bool ZE::ZImage::IsLoaded  
 

Check if file is loaded and pointer to data is non-NULL.

Returns:
Loaded or Unloaded state of data.

SDL_Surface * ZE::ZImage::Surface  
 

Returns:
SDL_Surface* of rImage.

int ZE::ZImage::Width  
 

Get Current Width of Image.

Returns:
Image Width.

int ZE::ZImage::Height  
 

Get Current Height of Image.

Returns:
Image Height.


The documentation for this class was generated from the following files:
Generated on Sun Dec 1 02:44:14 2002 for ZEngine by doxygen1.2.18