wsp::Image Class Reference

Stores imagedata and is capable of loading pngs. More...

#include <image.h>

List of all members.

Public Member Functions

 Image ()
 Constructor.
virtual ~Image ()
 Destructor.
IMG_LOAD_ERROR LoadImage (const char *path, IMG_LOAD_TYPE loadtype=IMG_LOAD_TYPE_PATH)
IMG_LOAD_ERROR LoadImage (const unsigned char *path, IMG_LOAD_TYPE loadtype=IMG_LOAD_TYPE_BUFFER)
u32 GetWidth () const
u32 GetHeight () const
bool IsInitialized () const
void BindTexture (bool bilinear=true)

Protected Member Functions

bool _InitializeImage (u32 width, u32 height)
void _Flush ()
 Use this method if you've drawn something in the pixeldata.

Protected Attributes

u8 * _pixels
 Stores the pixeldata of this image. Use carefully.


Detailed Description

Stores imagedata and is capable of loading pngs.

Member Function Documentation

IMG_LOAD_ERROR wsp::Image::LoadImage ( const char *  path,
IMG_LOAD_TYPE  loadtype = IMG_LOAD_TYPE_PATH 
)

Loads an image from a file. Width and height have to be a multiple of 4, or it won't load. Once an Image is initialized, it can't be initialized again. Uses fopen(), so some basic filesystem initialization is required.

Parameters:
path The path to the file.
loadtype Set this to how you want to load this image. (This is probably a path)
Returns:
An error code based on loading status.
See also:
Image - Loading from buffer

IMG_LOAD_ERROR wsp::Image::LoadImage ( const unsigned char *  path,
IMG_LOAD_TYPE  loadtype = IMG_LOAD_TYPE_BUFFER 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
path The path to the file. (This is probably a buffer)
loadtype Set this to how you want to load this image.
See also:
Image - Loading from buffer

u32 wsp::Image::GetWidth (  )  const

Gets the width of this image.

Returns:
The width of the image. Returns 0 if no image is loaded.

u32 wsp::Image::GetHeight (  )  const

Gets the height of this image.

Returns:
The height of the image. Returns 0 if no image is loaded.

bool wsp::Image::IsInitialized (  )  const

Checks if the image is loaded.

Returns:
true if an image is stored, false if not.

void wsp::Image::BindTexture ( bool  bilinear = true  ) 

Used to select this image for the next texturing process. Most of the time you won't gonna use this.

Parameters:
bilinear Turns on bilinear filtering.

bool wsp::Image::_InitializeImage ( u32  width,
u32  height 
) [protected]

Initializes a clear image to draw on. It will be displayed as an RGBA8 texture, so its format should be ARGB. Don't mess with it if you don't know what you're doing. Once an Image is initialized, it can't be initialized again.

Parameters:
width The new width of the image.
height The new height of the image.
Returns:
True if it was successfully initialized, false if not.


The documentation for this class was generated from the following file:

Generated on Sun Jun 29 14:29:26 2008 for libwiisprite by  doxygen 1.5.5