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 SetAlpha (Uint8 alpha)
 Sets Alpha (transparency) value of Image.

void SetColorKey (Uint32 color)
 Set Color Key (transparent color) of Image.

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

bool IsLoaded ()
 Check if file is loaded.

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

int GetWidth ()
 Get Width.

int GetHeight ()
 Get Height.

string GetFilename ()
 Get filename of image.


Protected Attributes

ImageData rImage
 Class containing image and filename.


Constructor & Destructor Documentation

ZE::ZImage::ZImage  
 

Default Constructor, does nothing.

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::SetAlpha Uint8    alpha
 

Set Alpha channel of an Image, only used in 32 bit mode.

Parameters:
alpha Number 0-255 describing translucency of image. (0 = transparent, 255 = opaque)

void ZE::ZImage::SetColorKey Uint32    color
 

Set color which will not be drawn in image.

Parameters:
color Uint32 color describing color to use as transparent.

void ZE::ZImage::Draw Sint16    x,
Sint16    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::GetImage  
 

Returns:
SDL_Surface* of rImage.

int ZE::ZImage::GetWidth  
 

Get Width of Image.

Returns:
Image Width.

int ZE::ZImage::GetHeight  
 

Get Height of Image.

Returns:
Image Height.

string ZE::ZImage::GetFilename  
 

Get filename of image or if Image doesn't have a specific filename string describing origin of image.

Returns:
Image Filename.


The documentation for this class was generated from the following files:
Generated on Wed Nov 20 01:18:06 2002 for ZEngine by doxygen1.3-rc1