![]() |
PURE API 0.5
PR00F's Ultimate Rendering Engine full documentation
|
Image manager class. More...
Image manager class.
Definition at line 116 of file PureImageManager.h.
#include <PureImageManager.h>
Classes | |
class | PureImageManagerImpl |
Public Member Functions | |
PureImageManager () | |
virtual | ~PureImageManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
virtual PureImage * | createFromFile (const char *filename) |
Creates an Image object from the given file. | |
PureImage * | createBlank (TPureUInt width, TPureUInt height, TPureUInt bpp) |
Creates a blank Image object as specified. | |
virtual void | WriteList () const |
From PureFiledManager, adding logging image size data. | |
![]() | |
PureFiledManager () | |
virtual | ~PureFiledManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
PureFiledManaged * | getByFilename (const char *filename) const |
Gets the FiledManaged by the specified filename. | |
![]() | |
PureManager () | |
virtual | ~PureManager () |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
TPureInt | getCount () const |
Gets the number of managed objects. | |
TPureBool | isEmpty () const |
Is the number of manageds 0? | |
TPureInt | getSize () const |
Gets the number of allocated slots for managed objects; getSize() >= getCount(). | |
PureManaged * | getAttachedAt (TPureInt ind) const |
Gets the pointer to the managed at the given index. | |
TPureInt | getAttachedIndex (const PureManaged &m) const |
Gets the index of the given managed. | |
void | PreAlloc (TPureInt count) |
Allocates count free slots for manageds. | |
TPureBool | hasAttached (const PureManaged &m) const |
Gets whether the given managed is managed by this manager. | |
virtual void | Attach (PureManaged &m) |
Adds the given managed to the manager, if the managed has no manager yet. | |
virtual void | Detach (PureManaged &m) |
Removes the given managed from the manager, so the managed will have no manager. | |
void | DeleteAttachedInstance (PureManaged &m) |
Removes the given managed from the manager and destructs it. | |
void | DeleteAll () |
Removes and destructs every managed element in the manager. | |
virtual void | HandleManagedPropertyChanged (PureManaged &m) |
Should be invoked when a managed's property got changed from a different kind of manager or managed. | |
virtual TPureUInt | getUsedSystemMemory () const |
Gets the amount of allocated system memory for all manageds owner by this manager. | |
Static Public Member Functions | |
static TPureUInt | getColorConversionSwapCount (TPIXCOMPORD from, TPIXCOMPORD to) |
Calculates the number of swaps needed from the given color component order to the other. | |
static TPIXCOMPORD | getMirroredPixelComponentOrder (TPIXCOMPORD corder) |
Transforms the given color component order to its mirrored form. | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
![]() | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
Protected Member Functions | |
PureImageManager (const PureImageManager &) | |
PureImageManager & | operator= (const PureImageManager &) |
virtual void | WriteListCallback (const PureManaged &mngd) const |
From PureFiledManager, adding W x H x BPP. | |
![]() | |
PureFiledManager (const PureFiledManager &) | |
PureFiledManager & | operator= (const PureFiledManager &) |
![]() | |
PureManager (const PureManager &other) | |
PureManager & | operator= (const PureManager &) |
Private Attributes | |
PureImageManagerImpl * | pImpl |
PureImageManager::PureImageManager | ( | ) |
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 276 of file PureImageManager.cpp.
|
virtual |
Definition at line 283 of file PureImageManager.cpp.
|
protected |
Definition at line 454 of file PureImageManager.cpp.
Creates a blank Image object as specified.
width | Width of the new image. Cannot be 0. |
height | Height of the new image. Cannot be 0. |
bpp | Bits per pixel. Currently only 24 is supported. |
Definition at line 415 of file PureImageManager.cpp.
|
virtual |
Creates an Image object from the given file.
Only BMP format is supported at this time. Can load any bit depth BMP in theory, but below 16 bits, the rules are the following:
Note that with 32 bit BMP files you can utilize real alpha component of pixel colors, but not all image editing applications save real alpha values into 32 bit color depth bitmap files.
For example, IrfanView and MS Paint save 0 or 255 for every pixel's alpha component even if the source image was a true transparent PNG: 0 for background and 255 for foreground pixels. This can be ok in some cases, but usually not good enough from quality perspective in most cases, since the edges of a shape will look sharp.
Adobe Flash properly saves transparency data to 32 bit color depth bitmap file without any hassle.
Adobe Photoshop CS2 is a bit tricky but can work properly. If you open a transparent PNG without background, or remove background of an image, it will look transparent, but when you save that into a 32 bit depth BMP file, 0 alpha will be set for all pixels which basically makes this BMP useless for us from transparency perspective. To work around this problem, you also need to manually edit the transparency channel on the Channels tab. By default it is black (0) even when background is removed. I read the trick here: https://stackoverflow.com/questions/7369649/how-to-convert-32-bit-bmp-to-contain-alpha-channel
In Photoshop, removing the background and saving to a different format like PNG would automatically save alpha values properly without the need of manually editing the transparency channel, but for a proper BMP we need to deal with this hassle. Note that loading the true transparent BMP again in Photoshop will also work fine, although there will be white background displayed but transparency channel will be properly loaded from the 32bit BMP.
If you want to utilize transparency of 32 bit bitmaps properly, follow the instructions given in at PureMaterial::setBlendFuncs().
The BMP loader implemented in PURE is not compatible with all BMP formats, and this might lead to texture misalignment once you create texture from such BMP file and apply it to an Object3D instance. One case of such misalignment issue is if you export the BMP with color space information. Some applications like GIMP give option to skip writing color space information, so a workaround for this issue can be if you are selecting the option "Do not write color space information": https://github.com/proof88/PRooFPS-dd/issues/271 .
If you do not have such control over the BMP exporting procedure, then as another workaround you need to manually adjust the texture UV-coordinates. Texture UV-coordinates can be accessed using PureMaterial::getTexcoords(). Note that in case the geometry of your PureObject3D instance is already stored in video memory, you need to re-upload geometry to video memory after correcting the texture coordinates. This can be done by setting the already set vertex transfer mode again for the PureObject3D instace, e.g.:
PureObject3D* obj = (... create your object ...); (... adjust texture coordinates by writing to obj.getMaterial().getTexcoords() ...); obj.setVertexTransferMode( obj.getVertexTransferMode() );
Reimplemented from PureFiledManager.
Reimplemented in PureTextureManager.
Definition at line 365 of file PureImageManager.cpp.
|
static |
Calculates the number of swaps needed from the given color component order to the other.
Calculates the number of needed swaps needed from the given color component order to the other.
Definition at line 227 of file PureImageManager.cpp.
CConsole & PureImageManager::getConsole | ( | ) | 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.
Definition at line 296 of file PureImageManager.cpp.
|
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.
Definition at line 309 of file PureImageManager.cpp.
|
static |
Transforms the given color component order to its mirrored form.
Definition at line 252 of file PureImageManager.cpp.
|
protected |
Definition at line 460 of file PureImageManager.cpp.
|
virtual |
From PureFiledManager, adding logging image size data.
Reimplemented from PureFiledManager.
Reimplemented in PureTextureManager.
Definition at line 481 of file PureImageManager.cpp.
|
protectedvirtual |
From PureFiledManager, adding W x H x BPP.
Reimplemented from PureFiledManager.
Reimplemented in PureTextureManager.
Definition at line 470 of file PureImageManager.cpp.
|
private |
Definition at line 154 of file PureImageManager.h.