PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
Loading...
Searching...
No Matches
PureImage Class Reference

Image class. More...

Detailed Description

Image class.

Definition at line 46 of file PureImageManager.h.

#include <PureImageManager.h>

+ Inheritance diagram for PureImage:

Classes

class  PureImageImpl
 

Public Member Functions

virtual ~PureImage ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
TPureUInt getWidth () const
 Gets the width of the image.
 
TPureUInt getHeight () const
 Gets the height of the image.
 
TPureUInt getBitsPerPixels () const
 Gets the bit depth of the image.
 
TPURE_PIXEL_COMPONENT_ORDER getPixelComponentOrder () const
 Gets the actual color component order.
 
TPURE_PIXEL_COMPONENT_ORDER getOriginalPixelComponentOrder () const
 Gets the original color component order.
 
TPureBool setPixelComponentOrder (TPURE_PIXEL_COMPONENT_ORDER corder)
 Transforms the color component order of the image to the given color component order.
 
PureColor getPixel (TPureUInt x, TPureUInt y)
 Gets the color of the pixel at the given (x,y) coordinate.
 
PureColor getPixel (TPureUInt x, TPureUInt y) const
 Gets the color of the pixel at the given (x,y) coordinate.
 
TPureBool setPixel (TPureUInt x, TPureUInt y, TPureUByte r, TPureUByte g, TPureUByte b, TPureUByte a=0)
 Sets the color of the pixel at the given (x,y) coordinate.
 
TPureBool setPixel (TPureUInt x, TPureUInt y, PureColor clr)
 Sets the color of the pixel at the given (x,y) coordinate.
 
TPureBool isChanged () const
 True if the pixel data has been changed since loading it from file.
 
const TPureUBytegetPixels () const
 Gets the pointer to the array of pixels, giving direct access to pixels.
 
TPureUBytegetPixels ()
 Gets the pointer to the array of pixels, giving direct access to pixels.
 
TPureUInt getPixelsSize () const
 Gets the size of the array of pixels.
 
virtual void FlushResources ()
 This can be used if you don't need the pixels of the image to be in the system memory anymore.
 
virtual TPureUInt getUsedSystemMemory () const
 Gets the amount of allocated system memory for this image.
 
- Public Member Functions inherited from PureFiledManaged
 PureFiledManaged ()
 
virtual ~PureFiledManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const std::string & getFilename () const
 Gets the filename.
 
- Public Member Functions inherited from PureManaged
 PureManaged ()
 
virtual ~PureManaged ()
 
CConsole & getManagedConsole () const
 Returns access to console preset with logger module name as this class.
 
const PureManagedgetUtiliser () const
 Returns the managed that utilizes this managed.
 
PureManagedgetUtiliser ()
 Returns the managed that utilizes this managed.
 
void SetUtiliser (PureManaged *pUtiliser)
 Sets the managed that utilizes this managed.
 
void DetachFrom ()
 Removes the managed from its manager.
 
PureManagergetManager () const
 Gets the manager of the managed.
 
const std::string & getName () const
 Gets the name.
 
void SetName (const std::string &name)
 Sets the name.
 

Static Public Member Functions

static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureFiledManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 
- Static Public Member Functions inherited from PureManaged
static const char * getLoggerModuleName ()
 Returns the logger module name of this class.
 

Protected Member Functions

 PureImage ()
 Only ImageManager can create it.
 
 PureImage (const PureImage &)
 
PureImageoperator= (const PureImage &)
 
- Protected Member Functions inherited from PureFiledManaged
 PureFiledManaged (const PureFiledManaged &other)
 
PureFiledManagedoperator= (const PureFiledManaged &other)
 
void SetFilename (const std::string &filename)
 Sets the filename.
 
- Protected Member Functions inherited from PureManaged
 PureManaged (const PureManaged &other)
 
PureManagedoperator= (const PureManaged &other)
 

Private Attributes

PureImageImplpImpl
 

Friends

class PureImageManager
 
class PureTextureManager
 

Constructor & Destructor Documentation

◆ ~PureImage()

PureImage::~PureImage ( )
virtual

Definition at line 675 of file PureImage.cpp.

◆ PureImage() [1/2]

PureImage::PureImage ( )
protected

Only ImageManager can create it.

Sets default values to members.

Exceptions
std::bad_alloc- This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller.

Definition at line 895 of file PureImage.cpp.

◆ PureImage() [2/2]

PureImage::PureImage ( const PureImage & img)
protected
Exceptions
std::bad_alloc- This class or its ancestor dynamically allocates memory with operator new, in case of failure the exception is not handled but propagated to caller.

Definition at line 906 of file PureImage.cpp.

Member Function Documentation

◆ FlushResources()

void PureImage::FlushResources ( )
virtual

This can be used if you don't need the pixels of the image to be in the system memory anymore.

Reimplemented from PureManaged.

Definition at line 869 of file PureImage.cpp.

◆ getBitsPerPixels()

TPureUInt PureImage::getBitsPerPixels ( ) const

Gets the bit depth of the image.

For loaded BMP images:

  • for 32 bit BMPs: 32
  • less than 32 bit BMPs: 24.
Returns
Bit depth of the image (bits per pixel).

Definition at line 735 of file PureImage.cpp.

◆ getHeight()

TPureUInt PureImage::getHeight ( ) const

Gets the height of the image.

Returns
Height of the image in pixels.

Definition at line 721 of file PureImage.cpp.

◆ getLoggerModuleName()

const char * PureImage::getLoggerModuleName ( )
static

Returns the logger module name of this class.

Intentionally not virtual, so derived class should hide this instead of overriding. Not even private, so user can also access this from outside, for any reason like controlling log filtering per logger module name.

Returns
The logger module name of this class.

Definition at line 701 of file PureImage.cpp.

◆ getManagedConsole()

CConsole & PureImage::getManagedConsole ( ) const

Returns access to console preset with logger module name as this class.

Intentionally not virtual, so the getConsole() in derived class should hide this instead of overriding.

Returns
Console instance used by this class.

Definition at line 688 of file PureImage.cpp.

◆ getOriginalPixelComponentOrder()

TPURE_PIXEL_COMPONENT_ORDER PureImage::getOriginalPixelComponentOrder ( ) const

Gets the original color component order.

For loaded BMPs:

  • 32 bit BMPs: PURE_BGRA
  • 24 bit BMPs: PURE_BGR
  • less then 24 bit BMPs: PURE_RGB.
Returns
Original pixel component order.

Definition at line 762 of file PureImage.cpp.

◆ getPixel() [1/2]

PureColor PureImage::getPixel ( TPureUInt x,
TPureUInt y )

Gets the color of the pixel at the given (x,y) coordinate.

Returns
The color of the pixel at the given (x,y) coordinate. Black if the pixels are no more in memory.

Definition at line 786 of file PureImage.cpp.

◆ getPixel() [2/2]

PureColor PureImage::getPixel ( TPureUInt x,
TPureUInt y ) const

Gets the color of the pixel at the given (x,y) coordinate.

Returns
The color of the pixel at the given (x,y) coordinate. Black if the pixels are no more in memory.

Definition at line 798 of file PureImage.cpp.

◆ getPixelComponentOrder()

TPURE_PIXEL_COMPONENT_ORDER PureImage::getPixelComponentOrder ( ) const

Gets the actual color component order.

Same result as getOriginalPixelComponentOrder(), if the order hasn't been changed by swapColors() or setPixelComponentOrder() yet.

Returns
Pixel component order.

Definition at line 747 of file PureImage.cpp.

◆ getPixels() [1/2]

TPureUByte * PureImage::getPixels ( )

Gets the pointer to the array of pixels, giving direct access to pixels.

Gets the pointer to the array of pixels, providing direct access to pixels.

Returns
Pointer to array of pixels.

Definition at line 849 of file PureImage.cpp.

◆ getPixels() [2/2]

const TPureUByte * PureImage::getPixels ( ) const

Gets the pointer to the array of pixels, giving direct access to pixels.

Gets the pointer to the array of pixels, providing direct access to pixels.

Returns
Pointer to array of pixels.

Definition at line 839 of file PureImage.cpp.

◆ getPixelsSize()

TPureUInt PureImage::getPixelsSize ( ) const

Gets the size of the array of pixels.

Returns
Size of the array of pixels in Bytes. 0 if the array has been deleted by FlushResources().

Definition at line 860 of file PureImage.cpp.

◆ getUsedSystemMemory()

TPureUInt PureImage::getUsedSystemMemory ( ) const
virtual

Gets the amount of allocated system memory for this image.

Returns
Amount of used system memory in Bytes.

Reimplemented from PureFiledManaged.

Reimplemented in PureTexture.

Definition at line 880 of file PureImage.cpp.

◆ getWidth()

TPureUInt PureImage::getWidth ( ) const

Gets the width of the image.

Returns
Width of the image in pixels.

Definition at line 711 of file PureImage.cpp.

◆ isChanged()

TPureBool PureImage::isChanged ( ) const

True if the pixel data has been changed since loading it from file.

Definition at line 829 of file PureImage.cpp.

◆ operator=()

PureImage & PureImage::operator= ( const PureImage & )
protected

Definition at line 916 of file PureImage.cpp.

◆ setPixel() [1/2]

TPureBool PureImage::setPixel ( TPureUInt x,
TPureUInt y,
PureColor clr )

Sets the color of the pixel at the given (x,y) coordinate.

Has no effect if the pixels are no longer in system memory (see FlushResources()). This is considered as an error.

Returns
True on success, false otherwise.

Definition at line 820 of file PureImage.cpp.

◆ setPixel() [2/2]

TPureBool PureImage::setPixel ( TPureUInt x,
TPureUInt y,
TPureUByte r,
TPureUByte g,
TPureUByte b,
TPureUByte a = 0 )

Sets the color of the pixel at the given (x,y) coordinate.

Has no effect if the pixels are no longer in system memory (see FlushResources()). This is considered as an error.

Returns
True on success, false otherwise.

Definition at line 809 of file PureImage.cpp.

◆ setPixelComponentOrder()

TPureBool PureImage::setPixelComponentOrder ( TPURE_PIXEL_COMPONENT_ORDER cord)

Transforms the color component order of the image to the given color component order.

Has no effect if the pixels are no longer in system memory (see FlushResources()).

Returns
True on success, false otherwise.

Definition at line 774 of file PureImage.cpp.

Friends And Related Symbol Documentation

◆ PureImageManager

friend class PureImageManager
friend

Definition at line 108 of file PureImageManager.h.

◆ PureTextureManager

friend class PureTextureManager
friend

Definition at line 109 of file PureImageManager.h.

Member Data Documentation

◆ pImpl

PureImageImpl* PureImage::pImpl
private

Definition at line 104 of file PureImageManager.h.


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