Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

sglImageLoader Class Reference

#include <sglImageLoader.hpp>

Inheritance diagram for sglImageLoader::

sglDataLoader List of all members.

Public Types

typedef void* (* loaderFunc )(const string &filepath, unsigned int &width, unsigned int &height, sglTexture::ExternalFormatEnum &format, sglTexture::TypeEnum &type)
typedef bool (* writerFunc )(const string &filepath, const void *image, unsigned int width, unsigned int height, sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type)

Public Methods

virtual ~sglImageLoader ()=0

Static Public Methods

void* loadImage (const string &filepath, unsigned int &width, unsigned int &height, sglTexture::ExternalFormatEnum &format, sglTexture::TypeEnum &type)
bool writeImage (const string &filepath, const void *image, unsigned int width, unsigned int height, sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type)
void registerImageLoader (const string &extension, loaderFunc image_loader_func)
void registerImageWriter (const string &extension, writerFunc image_writer_func)
loaderFunc getImageLoader (const string &extension)
writerFunc getImageWriter (const string &extension)
void* reformatImage (sglTexture::ExternalFormatEnum old_format, sglTexture::TypeEnum type, unsigned int num_s, unsigned int num_t, sglTexture::ExternalFormatEnum new_format, const void *old_image)
void scaleImageComponent (void *image, sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type, unsigned int num_s, unsigned int num_t, float scale, unsigned int component)
void* changeImageType (sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum old_type, unsigned int num_s, unsigned int num_t, sglTexture::TypeEnum new_type, const void *old_image)

Protected Methods

 sglImageLoader ()
 sglImageLoader (const sglImageLoader &)
sglImageLoader& operator= (const sglImageLoader &)

Detailed Description

Abstract base class for 3D models.

Definition at line 38 of file sglImageLoader.hpp.


Member Typedef Documentation

typedef void *(* sglImageLoader::loaderFunc)(const string &filepath, unsigned int &width, unsigned int &height, sglTexture::ExternalFormatEnum &format, sglTexture::TypeEnum &type)
 

The prototype for loader functions.

typedef bool(* sglImageLoader::writerFunc)(const string &filepath, const void *image, unsigned int width, unsigned int height, sglTexture::ExternalFormatEnum format, sglTexture::TypeEnum type)
 

The prototype for writer functions.


Constructor & Destructor Documentation

sglImageLoader::~sglImageLoader ( ) [pure virtual]
 

Destructor.


Member Function Documentation

void* sglImageLoader::loadImage ( const string & filepath,
unsigned int & width,
unsigned int & height,
sglTexture::ExternalFormatEnum & format,
sglTexture::TypeEnum & type ) [static]
 

Load the given image file using whatever loader has been registered for files of that type.

Parameters:
filepath   the full pathname of the file to load
width   on return contains the width of the image in pixels
height   on return contains the height of the image in pixels
format   on return contains the format of the image
type   on return contains the data type of the image
Returns:
NULL on failure, otherwise a pointer to the malloc'ed image data (which the user is responsible for free()ing)

bool sglImageLoader::writeImage ( const string & filepath,
const void * image,
unsigned int width,
unsigned int height,
sglTexture::ExternalFormatEnum format,
sglTexture::TypeEnum type ) [static]
 

Write the given image to a file using whatever loader has been registered for files of that type.

Parameters:
filepath   the full pathname of the file to write
image   the pixel data to write
width   the width of the image in pixels
height   the height of the image in pixels
format   the format of the image
type   the data type of the image
Returns:
false on failure

void sglImageLoader::registerImageLoader ( const string & extension,
loaderFunc image_loader_func ) [static]
 

Register a loader function pointer and the extension it supports. Note that a single function can support multiple extensions. Registering an extension a second time will replace the existing entry.

Parameters:
extension   extension string that the function supports.
image_loader_func   pointer to function supporting the extension

void sglImageLoader::registerImageWriter ( const string & extension,
writerFunc image_writer_func ) [static]
 

Register a writer function pointer and the extension it supports. Note that a single function can support multiple extensions. Registering an extension a second time will replace the existing entry.

Parameters:
extension   extension string that the function supports.
image_writer_func   pointer to function supporting the extension

loaderFunc sglImageLoader::getImageLoader ( const string & extension ) [static]
 

Get the registered image loader function pointer based on extension.

Parameters:
extension   extension to search on.
Returns:
function pointer, or NULL if not found

writerFunc sglImageLoader::getImageWriter ( const string & extension ) [static]
 

Get the registered image writer function pointer based on extension.

Parameters:
extension   extension to search on.
Returns:
function pointer, or NULL if not found

void* sglImageLoader::reformatImage ( sglTexture::ExternalFormatEnum old_format,
sglTexture::TypeEnum type,
unsigned int num_s,
unsigned int num_t,
sglTexture::ExternalFormatEnum new_format,
const void * old_image ) [static]
 

Create a new image with a new format from an old image.

Parameters:
old_format   the format of the old image
type   the type of the pixel data
num_s   the width of the image
num_t   the height of the image
new_format   the format of the image to be created
old_image   the original image
Returns:
NULL on failure, otherwise a pointer to the malloc'ed image data (which the user is responsible for free()ing)

void sglImageLoader::scaleImageComponent ( void * image,
sglTexture::ExternalFormatEnum format,
sglTexture::TypeEnum type,
unsigned int num_s,
unsigned int num_t,
float scale,
unsigned int component ) [static]
 

Scale the nth component of each pixel in the given image by the given scale factor.

Parameters:
image   the image to modify
format   the format of the image data
type   the type of each pixel
num_s   the width of the image
num_t   the height of the image
scale   the factor to multiply by
component   the component to scale

void* sglImageLoader::changeImageType ( sglTexture::ExternalFormatEnum format,
sglTexture::TypeEnum old_type,
unsigned int num_s,
unsigned int num_t,
sglTexture::TypeEnum new_type,
const void * old_image ) [static]
 

Create a new image with a new type from an old image.

Parameters:
the   format of the image
old_type   the type of the pixel data in the old image
num_s   the width of the image
num_t   the height of the image
new_type   the type of the pixel data in the new image
old_image   the original image
Returns:
NULL on failure, otherwise a pointer to the malloc'ed image data (which the user is responsible for free()ing)


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:08 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001