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

Ogre::Image Class Reference

Class representing an image file. More...

#include <OgreImage.h>

List of all members.

Public Methods

 Image ()
 Standard constructor. More...

 Image (const Image &img)
 Copy-constructor - copies all the data from the target image. More...

virtual ~Image ()
 Standard destructor. More...

Image & operator= (const Image &img)
 Assignment operator- copies all the data from the target image. More...

Image & flipAroundY ()
 Flips (mirrors) the image around the Y-axis. More...

Image & flipAroundX ()
 Flips (mirrors) the image around the X-axis. More...

Image & loadRawData (const DataChunk &pData, ushort uWidth, ushort uHeight, PixelFormat eFormat)
 Loads raw data from memory. More...

Image & load (const String &strFileName)
 Loads an image file. More...

Image & load (const DataChunk &chunk, const String &type)
 Loads an image file from a chunk of memory. More...

uchargetData (void)
 Returns a pointer to the internal image buffer. More...

const uchargetData () const
 Returns a const pointer to the internal image buffer. More...

size_t getSize () const
 Returns the size of the data buffer. More...

ushort getWidth (void) const
 Gets the width of the image in pixels. More...

ushort getHeight (void) const
 Gets the height of the image in pixels. More...

ushort getRowSpan (void) const
 Gets the physical width in bytes of each row of pixels. More...

PixelFormat getFormat () const
 Returns the image format. More...

uchar getBPP () const
 Returns the number of bits per pixel. More...

bool getHasAlpha () const
 Returns true if the image has an alpha component. More...


Static Public Methods

uchar PF2PS (PixelFormat format)
uchar getNumElemBytes (PixelFormat format)
 Returns the size in bytes of an element of the given pixel format. More...

uchar PF2BPP (PixelFormat format)
uchar getNumElemBits (PixelFormat format)
 Returns the size in bits of an element of the given pixel format. More...

bool convReqsFlip (PixelFormat srcformat, PixelFormat destformat)
 Decides wether converting from a pixel format to another requires endian-flipping. More...

void applyGamma (uchar *byffer, Real gamma, uint size, uchar bpp)
 Does gamma adjustment. More...


Private Attributes

ushort m_uWidth
ushort m_uHeight
PixelFormat m_eFormat
uchar m_ucPixelSize
ucharm_pBuffer


Detailed Description

Class representing an image file.

Remarks:
The Image class usually holds uncompressed image data and is the only object that can be loaded in a texture. Image objects handle image data decoding themselves by the means of locating the correct Codec object for each data type.

Typically, you would want to use an Image object to load a texture when extra processing needs to be done on an image before it is loaded or when you want to blit to an existing texture.


Constructor & Destructor Documentation

Ogre::Image::Image  
 

Standard constructor.

Ogre::Image::Image const Image &    img
 

Copy-constructor - copies all the data from the target image.

Ogre::Image::~Image   [virtual]
 

Standard destructor.


Member Function Documentation

void Ogre::Image::applyGamma uchar   byffer,
Real    gamma,
uint    size,
uchar    bpp
[static]
 

Does gamma adjustment.

Note:
Basic algo taken from Titan Engine, copyright (c) 2000 Ignacio Castano Iguado

bool Ogre::Image::convReqsFlip PixelFormat    srcformat,
PixelFormat    destformat
[inline, static]
 

Decides wether converting from a pixel format to another requires endian-flipping.

Parameters:
srcformat  The source pixel format.
destformat  The destination pixel format.
Returns:
true if the conversion requires flipping, false otherwise. See Remarks.
Remarks:
If one of the two pixel formats is FMT_UNKNOWN or is not registered, no assumption can be made for the returned value.

Image & Ogre::Image::flipAroundX  
 

Flips (mirrors) the image around the X-axis.

Remarks:
An example of an original and flipped image:
                        flip axis
                            |
                originalimg|gmilanigiro
                00000000000|00000000000
                00000000000|00000000000
                00000000000|00000000000
                00000000000|00000000000
                00000000000|00000000000
                

Image & Ogre::Image::flipAroundY  
 

Flips (mirrors) the image around the Y-axis.

Remarks:
An example of an original and flipped image:
 
                originalimg
                00000000000
                00000000000
                00000000000
                00000000000
                00000000000
                ------------> flip axis
                00000000000
                00000000000
                00000000000
                00000000000
                00000000000
                originalimg
                

uchar Ogre::Image::getBPP   const
 

Returns the number of bits per pixel.

const uchar* Ogre::Image::getData   const
 

Returns a const pointer to the internal image buffer.

const uchar * Ogre::Image::getData void   
 

Returns a pointer to the internal image buffer.

PixelFormat Ogre::Image::getFormat   const
 

Returns the image format.

bool Ogre::Image::getHasAlpha   const
 

Returns true if the image has an alpha component.

ushort Ogre::Image::getHeight void    const
 

Gets the height of the image in pixels.

uchar Ogre::Image::getNumElemBits PixelFormat    format [inline, static]
 

Returns the size in bits of an element of the given pixel format.

Returns:
The size in bits of an element. See Remarks.
Remarks:
Passing PF_UNKNOWN will result in returning a size of 0 bits while passing an unregistered pixel format will result in returning a size of 256 bits.

uchar Ogre::Image::getNumElemBytes PixelFormat    format [inline, static]
 

Returns the size in bytes of an element of the given pixel format.

Returns:
The size in bytes of an element. See Remarks.
Remarks:
Passing PF_UNKNOWN will result in returning a size of 0 bytes while passing an unregistered pixel format will result in returning a size of 256 bytes.

ushort Ogre::Image::getRowSpan void    const
 

Gets the physical width in bytes of each row of pixels.

size_t Ogre::Image::getSize   const
 

Returns the size of the data buffer.

ushort Ogre::Image::getWidth void    const
 

Gets the width of the image in pixels.

Image & Ogre::Image::load const DataChunk   chunk,
const String   type
 

Loads an image file from a chunk of memory.

Remarks:
This method works in the same way as the filename-based load method except it loads the image from a DataChunk object, ie a chunk of memory. This DataChunk is expected to contain the encoded data as it would be held in a file.

This method is here to support loading from compressed archives where you decompress the data from the archive into memory first. This method will then decode the data and return a raw image data stream.

Parameters:
chunk  The source data.
type  The type of the image. Used to decide what decompression codec to use.
See also:
Image::load( const String& strFileName )

Image & Ogre::Image::load const String   strFileName
 

Loads an image file.

Remarks:
This method loads an image into memory held in the object. The pixel format will be either greyscale or RGB with an optional Alpha component. The type can be determined by calling getFormat().
Parameters:
strFileName  Name of a file file to load.
Note:
The memory associated with this buffer is destroyed with the Image object.

Image & Ogre::Image::loadRawData const DataChunk   pData,
ushort    uWidth,
ushort    uHeight,
PixelFormat    eFormat
 

Loads raw data from memory.

The pixel format has to be specified.

Image & Ogre::Image::operator= const Image &    img
 

Assignment operator- copies all the data from the target image.

uchar Ogre::Image::PF2BPP PixelFormat    format [inline, static]
 

Deprecated:
Use getNumElemBits instead.

uchar Ogre::Image::PF2PS PixelFormat    format [inline, static]
 

Deprecated:
Use getNumElemBytes instead.


Member Data Documentation

PixelFormat Ogre::Image::m_eFormat [private]
 

uchar* Ogre::Image::m_pBuffer [private]
 

uchar Ogre::Image::m_ucPixelSize [private]
 

ushort Ogre::Image::m_uHeight [private]
 

ushort Ogre::Image::m_uWidth [private]
 

Copyright © 2002 by The OGRE Team