Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes

xl7::direct3d::images::Image Class Reference

#include <Image.h>

Inheritance diagram for xl7::direct3d::images::Image:
xl7::direct3d::images::PNG xl7::direct3d::images::Targa

List of all members.

Public Types

enum  Format { RGB = 3, ARGB = 4 }

Public Member Functions

 Image (void)
virtual ~Image (void)
 Image (const Image &rhs)
virtual Imageoperator= (const Image &rhs)
const unsigned char * GetBuffer () const
unsigned GetBufferSize () const
Format GetFormat () const
unsigned GetWidth () const
unsigned GetHeight () const
bool IsGood () const
bool IsLocked () const
unsigned char * GetRGB (const unsigned x, const unsigned y) const
unsigned char * GetARGB (const unsigned x, const unsigned y) const
unsigned char GetR (const unsigned x, const unsigned y) const
unsigned char GetG (const unsigned x, const unsigned y) const
unsigned char GetB (const unsigned x, const unsigned y) const
unsigned char GetA (const unsigned x, const unsigned y) const
unsigned char * Lock ()
bool Unlock ()
void Resize (const unsigned new_width, const unsigned new_height, const Format bytes_per_pixel, const bool fast_nn=false)
virtual bool CreateTransparent (const unsigned width, const unsigned height)
virtual bool CreateOpaque (const unsigned width, const unsigned height, const Format bytes_per_pixel=ARGB)
virtual bool LoadFromFile (const cl7::string_type &file_name)

Protected Member Functions

void _CleanUp ()
void _FlipVertically ()

Static Protected Member Functions

static bool _BadHeaderError (const cl7::string_type &file_name)
static bool _BadFormatError (const cl7::string_type &file_name)

Protected Attributes

unsigned char * _buffer
unsigned _buffer_size
Format _bytes_per_pixel
unsigned _width
unsigned _height
bool _is_good
bool _is_locked

Member Enumeration Documentation

The data format of the image data buffer.

Enumerator:
RGB 
ARGB 

Constructor & Destructor Documentation

xl7::direct3d::images::Image::Image ( void   ) 

Default constructor.

xl7::direct3d::images::Image::~Image ( void   )  [virtual]

Destructor.

xl7::direct3d::images::Image::Image ( const Image rhs  ) 

Copy constructor.


Member Function Documentation

bool xl7::direct3d::images::Image::_BadFormatError ( const cl7::string_type file_name  )  [static, protected]

Fires a bad-format error message and returns false.

bool xl7::direct3d::images::Image::_BadHeaderError ( const cl7::string_type file_name  )  [static, protected]

Fires a bad-header error message and returns false.

void xl7::direct3d::images::Image::_CleanUp (  )  [protected]

Deallocates memory used.

void xl7::direct3d::images::Image::_FlipVertically (  )  [protected]

Flips the image vertically.

bool xl7::direct3d::images::Image::CreateOpaque ( const unsigned  width,
const unsigned  height,
const Format  bytes_per_pixel = ARGB 
) [virtual]

Creates an opaque image.

bool xl7::direct3d::images::Image::CreateTransparent ( const unsigned  width,
const unsigned  height 
) [virtual]

Creates a transparent image.

unsigned char xl7::direct3d::images::Image::GetA ( const unsigned  x,
const unsigned  y 
) const

Returns the alpha component of a single pixel at the specified position.

unsigned char * xl7::direct3d::images::Image::GetARGB ( const unsigned  x,
const unsigned  y 
) const

Returns the color data of a single pixel at the specified position.

unsigned char xl7::direct3d::images::Image::GetB ( const unsigned  x,
const unsigned  y 
) const

Returns the blue component of a single pixel at the specified position.

const unsigned char* xl7::direct3d::images::Image::GetBuffer (  )  const [inline]

Returns the image data buffer.

unsigned xl7::direct3d::images::Image::GetBufferSize (  )  const [inline]

Returns the size of the buffer, in bytes.

Format xl7::direct3d::images::Image::GetFormat (  )  const [inline]

Returns the color format (equals the number of bytes per pixel).

unsigned char xl7::direct3d::images::Image::GetG ( const unsigned  x,
const unsigned  y 
) const

Returns the green component of a single pixel at the specified position.

unsigned xl7::direct3d::images::Image::GetHeight (  )  const [inline]

Returns the height of the image, in pixels.

unsigned char xl7::direct3d::images::Image::GetR ( const unsigned  x,
const unsigned  y 
) const

Returns the red component of a single pixel at the specified position.

unsigned char * xl7::direct3d::images::Image::GetRGB ( const unsigned  x,
const unsigned  y 
) const

Returns the color data of a single pixel at the specified position.

unsigned xl7::direct3d::images::Image::GetWidth (  )  const [inline]

Returns the width of the image, in pixels.

bool xl7::direct3d::images::Image::IsGood (  )  const [inline]

Returns true, if the image was successfully initialized.

bool xl7::direct3d::images::Image::IsLocked (  )  const [inline]

Returns true, if the buffer has been locked for direct read/write access.

virtual bool xl7::direct3d::images::Image::LoadFromFile ( const cl7::string_type file_name  )  [inline, virtual]

Loads the image.

Reimplemented in xl7::direct3d::images::PNG, and xl7::direct3d::images::Targa.

unsigned char * xl7::direct3d::images::Image::Lock (  ) 

Locks the buffer for direct read/write access.

Image & xl7::direct3d::images::Image::operator= ( const Image rhs  )  [virtual]

Copy assignment operator.

Reimplemented in xl7::direct3d::images::PNG, and xl7::direct3d::images::Targa.

void xl7::direct3d::images::Image::Resize ( const unsigned  new_width,
const unsigned  new_height,
const Format  bytes_per_pixel,
const bool  fast_nn = false 
)

Resizes the image to the specified width, height and format.

bool xl7::direct3d::images::Image::Unlock (  ) 

Unlocks the buffer.


Member Data Documentation

unsigned char* xl7::direct3d::images::Image::_buffer [protected]

The image data buffer.

The size of the buffer, in bytes.

The color format (equals the number of bytes per pixel).

The height of the image, in pixels.

True, if the image was successfully initialized.

True, if the buffer has been locked for direct read/write access.

The width of the image, in pixels.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines