Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
Menge::ImageData Class Reference

Manged image data (see ManagedData). More...

#include <image.h>

Inheritance diagram for Menge::ImageData:
Menge::ManagedData

Public Member Functions

 ImageData ()
 Constructor.
 
 ~ImageData ()
 Destructor.
 
int getWidth () const
 Returns the width of the image (in pixels). More...
 
int getHeight () const
 Returns the height of the image (in pixels). More...
 
int getBpp () const
 Reports the bits per pixel. More...
 
void initGL () const
 Initializes the image for drawing in an OpenGL context.
 
void drawGL () const
 Draws the image onto a quad, centered on the origin of the x-y plane.
 
void bind () const
 Binds the image to use as a texture in OpenGL.
 
unsigned char getPixelAt (int x, int y) const
 Returns the red channel of the image at the given pixel. More...
 
- Public Member Functions inherited from Menge::ManagedData
 ManagedData ()
 Constructor.
 
virtual ~ManagedData ()
 Virtual destructor. More...
 
int incRef ()
 Increment references to the managed data. More...
 
int decRef ()
 Decrement references to the managed data. More...
 
bool isUnreferenced () const
 Reports if the data is referenced. More...
 

Static Public Member Functions

static void newGLContext ()
 The function to call when an OpenGL context has changed.
 
static void start ()
 Initializes the image system. More...
 
static void release ()
 Called when done using images.
 

Static Public Attributes

static std::map< std::string,
ImageData * > 
RESOURCES
 Mapping from image resources to its corresponding data.
 
static bool IS_REGISTERED = false
 Determines if the ImageData::newGLContext has been registered.
 

Friends

ImageDatareadImageData (const std::string &fileName)
 Loads the image from a file (specified by name) More...
 

Additional Inherited Members

- Protected Attributes inherited from Menge::ManagedData
int _refCount
 The number of data wrappers using this managed data.
 

Detailed Description

Manged image data (see ManagedData).

Member Function Documentation

int Menge::ImageData::getBpp ( ) const

Reports the bits per pixel.

Returns
Either 24 or 32, depending on whether the image has an alpha channel (32) or not (24).
int Menge::ImageData::getHeight ( ) const
inline

Returns the height of the image (in pixels).

Returns
The height of the image (in pixels).
unsigned char Menge::ImageData::getPixelAt ( int  x,
int  y 
) const

Returns the red channel of the image at the given pixel.

Parameters
xThe x-coordinate of the pixel.
yThe y-coordinate of the pixel.
Returns
the red channel of the image at the given pixel.
int Menge::ImageData::getWidth ( ) const
inline

Returns the width of the image (in pixels).

Returns
The width of the image (in pixels).
void Menge::ImageData::start ( )
static

Initializes the image system.

Must be called before images can be used. Essentially, it calls the SDL Image initialization

Friends And Related Function Documentation

ImageData* readImageData ( const std::string &  fileName)
friend

Loads the image from a file (specified by name)

Parameters
fileNameThe path to a valid image file.
Returns
A pointer to the underlying ImageData. If there is an error, NULL is returned.

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