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

Detailed Description

Definition at line 22 of file PureImageImpl.h.

#include <PureImageImpl.h>

Public Member Functions

virtual ~PureImageImpl ()
 
TPureUInt getWidth () const
 
TPureUInt getHeight () const
 
TPureUInt getBitsPerPixels () const
 
TPURE_PIXEL_COMPONENT_ORDER getPixelComponentOrder () const
 
TPURE_PIXEL_COMPONENT_ORDER getOriginalPixelComponentOrder () const
 
TPureBool setPixelComponentOrder (TPURE_PIXEL_COMPONENT_ORDER corder)
 
PureColor getPixel (TPureUInt x, TPureUInt y)
 
PureColor getPixel (TPureUInt x, TPureUInt y) const
 
TPureBool setPixel (TPureUInt x, TPureUInt y, TPureUByte r, TPureUByte g, TPureUByte b, TPureUByte a=0)
 
TPureBool setPixel (TPureUInt x, TPureUInt y, PureColor clr)
 
TPureBool isChanged () const
 
const TPureUBytegetPixels () const
 
TPureUBytegetPixels ()
 
TPureUInt getPixelsSize () const
 
virtual void FlushResources ()
 
virtual TPureUInt getUsedSystemMemory () const
 
TPureBool cannibalize (PureImage &victim)
 Acquires the resources and properties of the given PureImage object, meaning that the given image will lose the pixels and other resources.
 

Private Member Functions

 PureImageImpl (PureImage *parent)
 Only Image or ImageManager can create it.
 
 PureImageImpl (const PureImageImpl &)
 
PureImageImploperator= (const PureImageImpl &)
 
TPureUInt getIndexToPixel (TPureUInt x, TPureUInt y) const
 Gets the index in pPixels to the pixel at the given (x,y) coordinate.
 
TPureBool swapColors (TPURE_PIXEL_COMPONENT_ORDER from, TPURE_PIXEL_COMPONENT_ORDER to, TPureByte swapcount)
 Transforms the color component order of the image to another.
 
bool initMembers (TPureUInt bits, TPureUInt w, TPureUInt h, TPIXCOMPORD clrCOrderOrig, TPIXCOMPORD clrCOrder, TPureBool upsDown, TPureBool chngd, TPureUByte *pxls, TPureUInt npxls)
 
TPureBool readBMP32pixels (HANDLE f)
 Used by readBMPpixels() for 32-bpp BMPs.
 
TPureBool readBMP24pixels (HANDLE f)
 Used by readBMPpixels() for 24-bpp BMPs.
 
unsigned char * readPaletteIndices (const HANDLE f)
 Reads palette indices from given file.
 
TPureBool readBMP8pixels (HANDLE f, const RGBQUAD *palette)
 Used by readBMPpixels() for 8-bpp BMPs.
 
TPureBool readBMP4pixels (HANDLE f, const RGBQUAD *palette)
 Used by readBMPpixels() for 4-bpp BMPs.
 
TPureBool readBMP1pixels (HANDLE f, const RGBQUAD *palette)
 Used by readBMPpixels() for 1-bpp BMPs.
 
TPureBool readBMPpixels (HANDLE f, const RGBQUAD *palette, WORD nBitCount)
 Reads pixels into memory in correct format.
 

Static Private Member Functions

static TPureBool setColorComponentsIndices (TPureByte &r, TPureByte &g, TPureByte &b, TPureByte &a, TPIXCOMPORD pxcord)
 Saves indices of the color components to the given params [-1 - 3].
 
static TPIXCOMPORD getIntermediatePixelCompOrder (TPIXCOMPORD from, TPIXCOMPORD to)
 Returns a 1-step intermediate pixel component order between the given 2.
 

Private Attributes

PureImage_pOwner
 The owner public object who creates this pimpl object.
 
TPureUInt nBits
 Bit depth (number of color bits per pixel).
 
TPureUInt nWidth
 Width (pixel).
 
TPureUInt nHeight
 Height (pixel).
 
TPIXCOMPORD clrCompOrderOrig
 Original color component order: right after loading.
 
TPIXCOMPORD clrCompOrder
 Actual color component order (swapColors(), setPixelComponentOrder() are changing it).
 
TPureBool bUpsideDown
 True if the 1st row is the last row and the last row is the 1st row.
 
TPureBool bChanged
 True if the pixel data has been changed since loading it from file.
 
TPureUBytepPixels
 Array of pixels.
 
TPureUInt nSizePixels
 Size of array of pixels.
 

Static Private Attributes

static TPureUInt nImagesTotal = 0
 

Friends

class PureImage
 
class PureImageManager
 

Constructor & Destructor Documentation

◆ ~PureImageImpl()

PureImage::PureImageImpl::~PureImageImpl ( )
virtual

Definition at line 28 of file PureImage.cpp.

◆ PureImageImpl() [1/2]

PureImage::PureImageImpl::PureImageImpl ( PureImage * parent)
explicitprivate

Only Image or ImageManager can create it.

Only ImageManager can create it.

Sets default values to members.

Definition at line 329 of file PureImage.cpp.

◆ PureImageImpl() [2/2]

PureImage::PureImageImpl::PureImageImpl ( const PureImageImpl & img)
private

Definition at line 337 of file PureImage.cpp.

Member Function Documentation

◆ cannibalize()

TPureBool PureImage::PureImageImpl::cannibalize ( PureImage & victim)

Acquires the resources and properties of the given PureImage object, meaning that the given image will lose the pixels and other resources.

This is a way of moving assets of an image to another image, MOVING, so no array copy is involved.

Returns
True on success, false on failure.

Definition at line 223 of file PureImage.cpp.

◆ FlushResources()

void PureImage::PureImageImpl::FlushResources ( )
virtual

Definition at line 199 of file PureImage.cpp.

◆ getBitsPerPixels()

TPureUInt PureImage::PureImageImpl::getBitsPerPixels ( ) const

Definition at line 50 of file PureImage.cpp.

◆ getHeight()

TPureUInt PureImage::PureImageImpl::getHeight ( ) const

Definition at line 44 of file PureImage.cpp.

◆ getIndexToPixel()

TPureUInt PureImage::PureImageImpl::getIndexToPixel ( TPureUInt x,
TPureUInt y ) const
private

Gets the index in pPixels to the pixel at the given (x,y) coordinate.

Definition at line 360 of file PureImage.cpp.

◆ getIntermediatePixelCompOrder()

TPIXCOMPORD PureImage::PureImageImpl::getIntermediatePixelCompOrder ( TPIXCOMPORD from,
TPIXCOMPORD to )
staticprivate

Returns a 1-step intermediate pixel component order between the given 2.

Useful if there is 2 steps between the given values. If there is less than 2 steps, the 2 given values will be returned.

Definition at line 293 of file PureImage.cpp.

◆ getOriginalPixelComponentOrder()

TPURE_PIXEL_COMPONENT_ORDER PureImage::PureImageImpl::getOriginalPixelComponentOrder ( ) const

Definition at line 62 of file PureImage.cpp.

◆ getPixel() [1/2]

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

Definition at line 104 of file PureImage.cpp.

◆ getPixel() [2/2]

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

Definition at line 125 of file PureImage.cpp.

◆ getPixelComponentOrder()

TPURE_PIXEL_COMPONENT_ORDER PureImage::PureImageImpl::getPixelComponentOrder ( ) const

Definition at line 56 of file PureImage.cpp.

◆ getPixels() [1/2]

TPureUByte * PureImage::PureImageImpl::getPixels ( )

Definition at line 187 of file PureImage.cpp.

◆ getPixels() [2/2]

const TPureUByte * PureImage::PureImageImpl::getPixels ( ) const

Definition at line 181 of file PureImage.cpp.

◆ getPixelsSize()

TPureUInt PureImage::PureImageImpl::getPixelsSize ( ) const

Definition at line 193 of file PureImage.cpp.

◆ getUsedSystemMemory()

TPureUInt PureImage::PureImageImpl::getUsedSystemMemory ( ) const
virtual

Definition at line 210 of file PureImage.cpp.

◆ getWidth()

TPureUInt PureImage::PureImageImpl::getWidth ( ) const

Definition at line 38 of file PureImage.cpp.

◆ initMembers()

bool PureImage::PureImageImpl::initMembers ( TPureUInt bits,
TPureUInt w,
TPureUInt h,
TPIXCOMPORD clrCOrderOrig,
TPIXCOMPORD clrCOrder,
TPureBool upsDown,
TPureBool chngd,
TPureUByte * pxls,
TPureUInt npxls )
private

Definition at line 439 of file PureImage.cpp.

◆ isChanged()

TPureBool PureImage::PureImageImpl::isChanged ( ) const

Definition at line 175 of file PureImage.cpp.

◆ operator=()

PureImage::PureImageImpl & PureImage::PureImageImpl::operator= ( const PureImageImpl & img)
private

Definition at line 347 of file PureImage.cpp.

◆ readBMP1pixels()

TPureBool PureImage::PureImageImpl::readBMP1pixels ( HANDLE f,
const RGBQUAD * palette )
private

Used by readBMPpixels() for 1-bpp BMPs.

Returns
True on success, false on error.

Definition at line 617 of file PureImage.cpp.

◆ readBMP24pixels()

TPureBool PureImage::PureImageImpl::readBMP24pixels ( HANDLE f)
private

Used by readBMPpixels() for 24-bpp BMPs.

Returns
True on success, false on error.

Definition at line 496 of file PureImage.cpp.

◆ readBMP32pixels()

TPureBool PureImage::PureImageImpl::readBMP32pixels ( HANDLE f)
private

Used by readBMPpixels() for 32-bpp BMPs.

Returns
True on success, false on error.

Definition at line 480 of file PureImage.cpp.

◆ readBMP4pixels()

TPureBool PureImage::PureImageImpl::readBMP4pixels ( HANDLE f,
const RGBQUAD * palette )
private

Used by readBMPpixels() for 4-bpp BMPs.

Returns
True on success, false on error.

Definition at line 576 of file PureImage.cpp.

◆ readBMP8pixels()

TPureBool PureImage::PureImageImpl::readBMP8pixels ( HANDLE f,
const RGBQUAD * palette )
private

Used by readBMPpixels() for 8-bpp BMPs.

Returns
True on success, false on error.

Definition at line 541 of file PureImage.cpp.

◆ readBMPpixels()

bool PureImage::PureImageImpl::readBMPpixels ( HANDLE f,
const RGBQUAD * palette,
WORD nBitCount )
private

Reads pixels into memory in correct format.

Returns
True on success, false on error.

Definition at line 653 of file PureImage.cpp.

◆ readPaletteIndices()

unsigned char * PureImage::PureImageImpl::readPaletteIndices ( const HANDLE f)
private

Reads palette indices from given file.

The buffer returned by this function should be freed by caller. Used by readBMPnpixels where n < 24, so where palette is available.

Returns
NULL on failure, otherwise pointer to palette indices.

Definition at line 512 of file PureImage.cpp.

◆ setColorComponentsIndices()

TPureBool PureImage::PureImageImpl::setColorComponentsIndices ( TPureByte & r,
TPureByte & g,
TPureByte & b,
TPureByte & a,
TPIXCOMPORD pxcord )
staticprivate

Saves indices of the color components to the given params [-1 - 3].

Only the a(lpha) can become -1 if the image has no alpha. That is not an error scenario.

Returns
True on success, false otherwise.

Definition at line 270 of file PureImage.cpp.

◆ setPixel() [1/2]

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

Definition at line 169 of file PureImage.cpp.

◆ setPixel() [2/2]

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

Definition at line 146 of file PureImage.cpp.

◆ setPixelComponentOrder()

TPureBool PureImage::PureImageImpl::setPixelComponentOrder ( TPURE_PIXEL_COMPONENT_ORDER corder)

Definition at line 68 of file PureImage.cpp.

◆ swapColors()

TPureBool PureImage::PureImageImpl::swapColors ( TPURE_PIXEL_COMPONENT_ORDER from,
TPURE_PIXEL_COMPONENT_ORDER to,
TPureByte swapcount )
private

Transforms the color component order of the image to another.

Returns
True on success, false otherwise.

Definition at line 374 of file PureImage.cpp.

Friends And Related Symbol Documentation

◆ PureImage

friend class PureImage
friend

Definition at line 138 of file PureImageImpl.h.

◆ PureImageManager

friend class PureImageManager
friend

Definition at line 139 of file PureImageImpl.h.

Member Data Documentation

◆ _pOwner

PureImage* PureImage::PureImageImpl::_pOwner
private

The owner public object who creates this pimpl object.

Definition at line 84 of file PureImageImpl.h.

◆ bChanged

TPureBool PureImage::PureImageImpl::bChanged
private

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

Definition at line 91 of file PureImageImpl.h.

◆ bUpsideDown

TPureBool PureImage::PureImageImpl::bUpsideDown
private

True if the 1st row is the last row and the last row is the 1st row.

Definition at line 90 of file PureImageImpl.h.

◆ clrCompOrder

TPIXCOMPORD PureImage::PureImageImpl::clrCompOrder
private

Actual color component order (swapColors(), setPixelComponentOrder() are changing it).

Definition at line 89 of file PureImageImpl.h.

◆ clrCompOrderOrig

TPIXCOMPORD PureImage::PureImageImpl::clrCompOrderOrig
private

Original color component order: right after loading.

Definition at line 88 of file PureImageImpl.h.

◆ nBits

TPureUInt PureImage::PureImageImpl::nBits
private

Bit depth (number of color bits per pixel).

Definition at line 85 of file PureImageImpl.h.

◆ nHeight

TPureUInt PureImage::PureImageImpl::nHeight
private

Height (pixel).

Definition at line 87 of file PureImageImpl.h.

◆ nImagesTotal

TPureUInt PureImage::PureImageImpl::nImagesTotal = 0
staticprivate

Definition at line 67 of file PureImageImpl.h.

◆ nSizePixels

TPureUInt PureImage::PureImageImpl::nSizePixels
private

Size of array of pixels.

Definition at line 93 of file PureImageImpl.h.

◆ nWidth

TPureUInt PureImage::PureImageImpl::nWidth
private

Width (pixel).

Definition at line 86 of file PureImageImpl.h.

◆ pPixels

TPureUByte* PureImage::PureImageImpl::pPixels
private

Array of pixels.

Definition at line 92 of file PureImageImpl.h.


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