Image Class Reference

#include <image.h>

Class Description

This is the base image type defining the interface to images.

There are three differend kinds of images;

  • Physically contiguous
  • Striped
  • Tiled/Virtual/Versioned

The first kind is the fastest, but least memory efficient. If the system is not able to allocate the required memory in one piece, a striped image will be created. A striped image consists of several stripes of 1 or more rows of pixels.

The third type of image is the most versatile – It is stored as 128 pixel square tiles – tiles are copy-on-write, versioned, and have their own virtual memory system optimized for images. Texture layers are typically stored in this third type of image so that paint operations on them are easily undoable.

Note
In Mudbox (starting in Version 2012) Mudbox images are lower left origin. This in vertically flipped compared to QImages which are upper left origin. This was done so that GL textures and images have the same orientation, eliminating the need to perform a vertical flip when loading and unloading textures from the GPU.
+ Examples:

Definition at line 1504 of file image.h.

+ Inheritance diagram for Image:

Public Types

enum  ImageType { Type_Invalid = 0, Type_Memory, Type_Virtual }
 used to identify what type of image any particular instance is. More...
 
enum  Format {
  e8integer = 0, e16integer, e32integer, e16float,
  e32float, e16depth, e24depth, e32depth,
  eUnknown, eInvalid
}
 Image channel datatype type. More...
 
- Public Types inherited from Node
enum  DiagnosticLevel { dgnLevel1, dgnLevel2, dgnLevel3 }
 Indicates the level of validity checking that is performed in CheckValidity() More...
 

Public Member Functions

virtual ~Image (void)
 
void UnitTest (int iterations)
 cause the image storage mechanisms to be tested randomly for the specified number of iterations. More...
 
virtual bool isAllocated () const
 
ImageType getType () const
 return the image type. More...
 
const ImageDescriptorgetDescriptor () const
 get the full descriptor for the image More...
 
void setProxyDownsampleTo8Bit (bool downsampleTo8Bit=true)
 The default when generating proxys is to downsample them to 8 bit/channel this can make them significantly smaller. More...
 
bool getProxyDownsampleTo8Bit () const
 
void clearProxyImages ()
 clear and deallocate any proxy images. More...
 
void SetProxyInterruptFunction (ProxyInterruptFunction fcnPtr=0)
 When generating proxy images, periodically, the interrupt function will be polled. More...
 
unsigned char getProxyLevel () const
 get the Proxy level of the image – 0 = no proxying. More...
 
bool setProxyLevel (unsigned char newLevel)
 set the current proxy level More...
 
ImagegetProxyImage ()
 get the proxy image. More...
 
int xSize () const
 Get the x size of the image. More...
 
int ySize () const
 Get the y size of the image. More...
 
int cSize () const
 Get the channel count of the image. More...
 
int curWidth () const
 get the width of the current proxy level of the image More...
 
int curHeight () const
 get the height of the current proxy level of the image More...
 
ImageDescriptor::MemoryChannelOrder channelOrder () const
 Get the channel ordering of the image. More...
 
const ImgTilegetBounds () const
 returns the bounds of the image – the origin of this rect may not be at 0,0 More...
 
void getFillColor (void *fillPixel, const PixelDescriptor *pd=0) const
 Reads the fill color into the provided buffer, in the specified format – if no format is provided, it uses the pixel format of this image. More...
 
void setFillColor (const void *fillPixel, const PixelDescriptor *pd=0)
 Sets the fill color into the provided buffer, in the specified format – if no format is provided, it uses the pixel format of this image. More...
 
void getTile (int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
 Reads a rectangular region of pixels from the image into a buffer. More...
 
void getSubTile (int x, int y, int nx, int ny, void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
 Reads a rectangular region of pixels from the image into a buffer. More...
 
void getTile (const ImgTile &srcTile, void *data, const PixelDescriptor *pd=0)
 Reads a rectangular region of pixels from the image into a buffer. More...
 
virtual void getSubTile (const ImgTile &srcTile, void *data, const ImgTile &targetBounds, const PixelDescriptor *pd=0)
 Reads a rectangular region of pixels from the image into a buffer. More...
 
void setTile (int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
 Writes a rectangular region of pixels to the image from a buffer. More...
 
void setSubTile (int x, int y, int nx, int ny, const void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
 Writes a rectangular region of pixels from the image into a buffer. More...
 
void setTile (const ImgTile &dstTile, const void *data, const PixelDescriptor *pd=0)
 Writes a rectangular region of pixels to the image from a buffer. More...
 
virtual void setSubTile (const ImgTile &dstTile, const void *data, const ImgTile &sourceBounds, const PixelDescriptor *pd=0)
 Writes a rectangular region of pixels from the image into a buffer. More...
 
void copyTile (int x, int y, int nx, int ny, Image &fromImg, int ox, int oy)
 Copies a rectangular region of pixels from a source image to this image. More...
 
virtual void copyTile (const ImgTile &dstTile, Image &fromImg, int ox, int oy)
 Copies a rectangular region of pixels from a source image to this image. More...
 
virtual void copyAll (Image &fromImg)
 Copies all of the pixels from a source image to this image. More...
 
virtual void Clear ()
 Clear all the pixels of the image to 0 in all channels. More...
 
void fillTile (int x, int y, int nx, int ny, void *pixelData, const PixelDescriptor *pd=0, const ImgTile *maskTile=0)
 Fills a rectangular region of pixels in the image with a constant color. More...
 
void fillTile (const ImgTile &dstTile, const void *pixelData, const PixelDescriptor *pd, const ImgTile *maskTile)
 Fills a rectangular region of pixels in the image with a constant color. More...
 
virtual void fillTile (const ImgTile &dstTile, const void *pixelData, const PixelDescriptor *pd=0)
 Fills a rectangular region of pixels in the image with a constant color. More...
 
virtual void getPageSize (int &nx, int &ny)
 Returns the size of an image page. More...
 
ImgPageIteratorgetPageIterator (int x, int y, int nx, int ny)
 Returns a tile iterator that will iterate over the pages of this image in an optimal order. More...
 
virtual ImgPageIteratorgetPageIterator (const ImgTile &srcTile)
 Returns a tile iterator that will iterate over the pages of this image in an optimal order. More...
 
ImgLockPageIteratorlockPageSet (int x, int y, int nx, int ny, ImgLockPageIterator::AccessMode mode)
 Returns a tile iterator that will iterate over the pages of this image in an optimal order. More...
 
virtual ImgLockPageIteratorlockPageSet (const ImgTile &srcTile, ImgLockPageIterator::AccessMode mode)
 Returns a tile iterator that will iterate over the pages of this image in an optimal order. More...
 
void CopyInverseLuminance (const Image &srcImage)
 copies 1-luminance from the source image into this image More...
 
void CopyLuminance (const Image &srcImage)
 copies the luminance of the source image into this image More...
 
virtual void PutInverseLuminance (Image &targetImage) const
 copies 1-luminance of this image to the target image More...
 
virtual void PutLuminance (Image &targetImage) const
 copies the luminance of this image to the target image More...
 
virtual QString SupportedExtensions (bool bRGBAOnly=false, bool bRead=true, bool bDesc=false, bool bPSD=true, QString sDelimiter=";") const
 Returns the supported file extensions, separated by ';'. More...
 
virtual void Create (unsigned int iWidth, unsigned int iHeight, unsigned int iChannelCount, Format eFormat=e8integer, bool Tiled=false, ImageDescriptor::MemoryChannelOrder eOrder=ImageDescriptor::orderRGBA)
 Create a new image. More...
 
virtual void Load (const QString &sFileName, int iLayerIndex=0, bool tiled=false)
 Load a whole image from an external file. More...
 
virtual bool GetPSDLayerMeta (void *pPSDFile, int iLayerIndex, QString &layerName, int &blendMode, float &opacity, bool &locked, bool &visible, bool &transLocked)
 
virtual bool LoadPSDLayer (void *pPSDFile, int iLayerIndex, bool Tiled=false, bool premult=true)
 Load this image from a layer in a Photoshop file. More...
 
virtual ImageComputeDifferenceMask (Image *otherImg, int expansionRadius, int AARadius, bool &anyDiffs)
 
virtual bool SavePSDLayerMeta (void *pPSDFile, int iLayerIndex, const QString &pLayerName, float opacity=1.0f, bool visible=true, bool locked=false, int xOff=0, int yOff=0, int blendMode=-1)
 Save this image metadata to the layer metadata in a Photoshop file. More...
 
virtual bool SavePSDLayer (void *pPSDFile, int iLayerIndex, const QString &pLayerName, float opacity=1.0f, bool visible=true, bool locked=false, bool needs_unpremult=true, int xOff=0, int yOff=0)
 Save this image to a layer in a Photoshop file. More...
 
virtual voidOpenPSDFile (const QString &pFileName, bool writing=false)
 Open a PSD file for reading or writing – returns a pointer to blind data representing the open file, or NULL if it was unable to open the file. More...
 
virtual bool GetPSDFileInfo (void *psdFile, int *width, int *height, int *numChannels, int *bitDepth, int *numLayers, int *curLayer)
 Returns the basic file scope metadata for a PSD file. More...
 
virtual bool SetPSDFileInfo (void *psdFile, int width, int height, int numChannels, int bitDepth, int numLayers, int curLayer)
 Sets the file scope metadata for a writable PSD file. More...
 
virtual bool ClosePSDFile (void *psdFile)
 Close a PSD file. More...
 
virtual void Save (const QString &sFileName, bool bForce=true, Material *pMaterial=NULL, float uStart=0.0f, float vStart=0.0f, bool force_1_Channel_To_4_Channel=false)
 Save the image to an external file. More...
 
virtual unsigned int Width (void) const
 Return the width of the image in pixels. More...
 
virtual unsigned int Height (void) const
 Return the height of the image in pixels. More...
 
virtual Format Format (void) const
 Return the format of the image. More...
 
virtual unsigned int ChannelCount (void) const
 Return the number of channels in the image. More...
 
virtual unsigned int BytesPerPixel (void) const
 Return the number of bytes used by a pixel. More...
 
unsigned int curBytesPerPixel () const
 Return the number of bytes used by a pixel at the current proxy level. More...
 
virtual unsigned int TotalBytes (void) const
 Return the number of bytes used by the whole image. More...
 
unsigned int curTotalBytes (void) const
 Return the number of bytes used by the whole image (current proxy level) More...
 
virtual void SetValueAt (unsigned int iXPos, unsigned int iYPos, unsigned int iChannel, float fValue)
 Set value for a specified texel. More...
 
virtual float ValueAt (unsigned int iXPos, unsigned int iYPos, unsigned int iChannel) const
 Get the value at a given coordinate. More...
 
virtual float ValueAt (float fXPos, float fYPos, unsigned int iChannel) const
 Get interpolated value at a given coordinate. More...
 
virtual void SetColorAt (unsigned int iXPos, unsigned int iYPos, const Color &cColor)
 Set value for a specified texel. More...
 
virtual Color ColorAt (unsigned int iXPos, unsigned int iYPos) const
 Get the value at a given coordinate. More...
 
virtual Color ColorAt (float fXPos, float fYPos) const
 Get interpolated value at a given coordinate. More...
 
virtual QImageConvertToQImage ()
 Create a QImage object from the image data for display purposes. More...
 
virtual void ConvertFromQImage (QImage &qImg, bool tiled=false)
 Creates the image from a QImage. More...
 
virtual bool Fragmented () const
 returns true if the image is not stored in one physically contiguous piece of CPU visible memory – If so, you must use lockPageSet to get at portions of the image data... More...
 
virtual bool Tiled () const
 returns true if this is a tiled and versioned image More...
 
bool Versioned () const
 returns true if this is a tiled and versioned image More...
 
virtual bool NewVersion ()
 checkpoint and create a new version of this image. More...
 
virtual bool PrevVersion ()
 makes the previous version current – used for undo returns true if it worked, false otherwise marks the proxy dirty More...
 
virtual bool NextVersion ()
 makes the next version current – used for redo returns true if it worked, false otherwise marks the proxy dirty More...
 
virtual int NumVersions ()
 returns the number of versions. returns 1 for unversioned images More...
 
virtual bool MergeOldestVersions ()
 merges the oldest two versions – used to limit the number of items on the undo queue. More...
 
virtual bool PurgeNewerVersions ()
 Creating a new version will implicitly purge nerer versions, but if another operation takes place that puts a new item on the undo queue, this should be called to purge newer versions of this image returns true if it worked, false otherwise. More...
 
virtual bool PurgeAllButCurrentVersion ()
 Releases all but the current version – used to flush the undo queue. More...
 
virtual voidData (int iRow=-1, bool writing=true)
 Get a pointer to the raw data of a row of the image. More...
 
virtual const voidData (int iRow=-1, bool writing=false) const
 
virtual void DrawUVs (Material *pMaterial, float uStart=0.0f, float vStart=0.0f, bool baseLevel=true)
 Draw the uv mesh for a given material into this image – either the base or active level. More...
 
virtual void scaleTileBilinear_4Chan_uchar (float x, float y, float nx, float ny, unsigned int *data, int dx, int dy, int dnx, int dny, float xScale, float yScale) const
 Fast, thread safe image scaler. More...
 
virtual void GenerateUpscaled (Image *targetImg, int factor)
 This upscales an image with good filtering (bilinear to Lanczos as needed based on the scale factor. More...
 
virtual bool isDirty () const
 Query if the contents of this image have changed since the last call to setClean. More...
 
virtual void setDirty ()
 Explicitly set the image state to dirty. More...
 
virtual void setClean ()
 explicitly set the image state to clean. More...
 
virtual void VerticalFlip ()
 vertically flip the image (make it upside down) More...
 
virtual void AdjustImageCacheSize ()
 Causes the image cache size to adjust based on the amount of memory available. More...
 
virtual void ConvertTo4Channel ()
 makes the image 4 channels. with the alphas 1.0. More...
 
- Public Member Functions inherited from Node
 Node (const QString &sStringID="", const QString &sDisplayName="")
 Standard constructor. More...
 
virtual ~Node (void)
 
virtual void Initialize (void)
 
void LoadTemplate (const QString &sFileName="", bool bStartEvent=false)
 Use an external XML file to initialize the attributes. More...
 
void SaveTemplate (const QString &sFileName="", bool bSaveOnlyVisible=false)
 Save current attributes as an XML template. More...
 
unsigned int Version (void) const
 Returns the current version of the node. This number increases when the content of the node changed (when ContentChanged() called). More...
 
void SetVersion (unsigned int iVersion)
 Sets the current version number for the node. More...
 
unsigned int ReferenceCount (void) const
 Returns the number of pointers referencing this node. More...
 
AttributeReferencePointer (unsigned int iIndex) const
 Returns the address of an attribute which refers to this node. The type of the attribute is always aptr. More...
 
NodeReferenceNode (unsigned int iIndex) const
 Returns the address of a node referencing this node. More...
 
virtual QString Name (const ClassDesc *pClass=0) const
 Deprecated. More...
 
virtual void SetName (const QString &sName)
 Deprecated. More...
 
virtual QString StringID (const ClassDesc *pClass=0) const
 Returns the string id of the node. More...
 
virtual void SetStringID (const QString &sStringID)
 Sets the string id of the node. More...
 
virtual QString DisplayName (void) const
 Returns the display name of the node. More...
 
virtual void SetDisplayName (const QString &sDisplayName)
 Sets the display name of the node. More...
 
virtual QString HelpID (void) const
 Returns the help entry id of the node. Can be overwritten in derived classes. More...
 
virtual void SetHelpID (const QString &sHelpID)
 Sets the help entry id of the node. More...
 
void Annex (Node *pSource, const QString &sCategory="")
 Relink all the attributes of the source node to this one. More...
 
virtual void Serialize (Stream &s)
 Serializes the node. More...
 
bool IsKindOf (const ClassDesc *pClass) const
 Returns true if this node is derived from the pClass class. More...
 
void ContentChanged (void) const
 This function must be called if the content of the node is changed. More...
 
virtual void CheckValidity (DiagnosticLevel iLevel=dgnLevel2) const
 Checks the validity of this node. More...
 
virtual void CopyTo (Node *pNode) const
 
virtual NodeDuplicate (void) const
 
virtual void OnNodeEvent (const Attribute &cAttribute, NodeEventType cType)
 This function is called if an event occurs with any of the attributes of the node. More...
 
virtual void OnEvent (const EventGate &cEvent)
 This function is called when a generic event occurs. See EventGate class. More...
 
void RequestDeferredEvent (Attribute &cAttribute)
 Request for a deferred event, which will occur only in the main loop. More...
 
unsigned int AttributeCount (void) const
 Returns the number of attributes owned by the node. More...
 
AttributeAttributeByIndex (int iIndex) const
 Returns a specified attribute (or 0 if iIndex is greater than the number of attributes). More...
 
AttributeAttributeByName (const QString &sName) const
 Returns a specified attribute by its name. Returns 0 if the attribute not found. More...
 
AttributeAttributeByID (const QString &sID) const
 Returns a specified attribute by its ID. Returns 0 if the attribute not found. More...
 
void SetAttributeValue (const QString &sAttributeID, const QString &sNewValue)
 Set the value of an attribute from a string. More...
 
QString AttributeValue (const QString &sAttributeID) const
 Returns the current value of an attribute as a string. More...
 
void LogAttributes (void) const
 Write all attributes into the log file. More...
 
virtual QWidgetCreatePropertiesWindow (QWidget *pParent)
 Create a window which displays the attributes of the node. Can be overriden to provide a custom interface. More...
 
AttributeAddAttribute (Attribute::AttributeType type, const QString &id)
 Allows SDK users to add attributes at runtime. More...
 
NodeNext (void) const
 Returns the next node in the chain. Used to enumerate the current nodes. See also First(). More...
 
int ID (void) const
 Returns an ID for the node. The ID is unique in the whole application life. More...
 
bool SetID (int iID)
 Set ID for the node. More...
 

Static Public Member Functions

static QString AllSupportedExtensions (bool bRGBAOnly=false, bool bRead=true, bool bDesc=false, bool bPSD=true, QString sDelimiter=";")
 
static ImageDescriptor::MemoryChannelOrder optimizedChannelOrder ()
 
static void ConvertPixels (void *dst, const void *src, int numPix, const PixelDescriptor &dstDesc, const PixelDescriptor *srcDesc=0)
 
static void MultiplyRGBByAlpha_uc4 (unsigned char *buffer, int numPixels)
 multiply alpha into RGB for the specified number of pixels. More...
 
- Static Public Member Functions inherited from Node
static void StartHashing ()
 This is called once in main once static ctors are done. More...
 
static NodeFirst (void)
 This function will return the first node in the memory. Used to enumerate all the current nodes. See also Next(). More...
 
static NodeByID (int iID)
 Returns the node with the specified ID, or zero if such a node does not exists. More...
 
static NodeByName (const QString &sClass, const QString &sName)
 Search for a node with the name sName. More...
 

Protected Member Functions

 Image (void)
 
void markProxyDirty ()
 
virtual bool regenerateProxy ()
 
bool isProxyDirty () const
 
virtual bool GenerateProxy (Image *targetImg, int level, bool DownsampleTo8Bits=true)
 

Protected Attributes

unsigned char m_FillPixel [16]
 
ImageDescriptor m_Descriptor
 
ImageType m_ImageType
 
unsigned char m_ProxyLevel
 
Imagem_pProxyImages [MAX_PROXY_LEVEL+1]
 
bool m_bDownsampleProxyTo8Bit
 
ProxyInterruptFunction m_pProxyIntFcn
 

Friends

class ImgPageIterator
 
class ImgLockPageIterator
 

Additional Inherited Members

- Public Attributes inherited from Node
AttributeThisPointer m_pThis
 
 DECLARE_CLASS
 

Member Enumeration Documentation

enum ImageType

used to identify what type of image any particular instance is.

Enumerator
Type_Invalid 
Type_Memory 

physically contiguous image or striped

Type_Virtual 

Tiled & versioned, not contiguous.

Definition at line 1515 of file image.h.

1515  {
1516  Type_Invalid = 0,
1517  Type_Memory,
1518  Type_Virtual
1519  } ImageType;
Tiled & versioned, not contiguous.
Definition: image.h:1518
physically contiguous image or striped
Definition: image.h:1517
ImageType
used to identify what type of image any particular instance is.
Definition: image.h:1515
enum Format

Image channel datatype type.

Enumerator
e8integer 
e16integer 
e32integer 
e16float 
e32float 
e16depth 
e24depth 
e32depth 
eUnknown 
eInvalid 

Definition at line 1522 of file image.h.

Constructor & Destructor Documentation

virtual ~Image ( void  )
virtual
Image ( void  )
protected

Member Function Documentation

void markProxyDirty ( )
inlineprotected

Definition at line 1553 of file image.h.

1554  {
1555  for (int i = 0; i < MAX_PROXY_LEVEL+1; ++i) {
1556  if (m_pProxyImages[i]) {
1557  delete m_pProxyImages[i]; m_pProxyImages[i] = 0;
1558  }
1559  }
1560  }
Image * m_pProxyImages[MAX_PROXY_LEVEL+1]
Definition: image.h:1548
#define MAX_PROXY_LEVEL
Definition: image.h:1476
virtual bool regenerateProxy ( )
protectedvirtual
bool isProxyDirty ( ) const
inlineprotected

Definition at line 1563 of file image.h.

1564  { return (m_ProxyLevel > 0) ? (m_pProxyImages[m_ProxyLevel] == 0) : false; }
unsigned char m_ProxyLevel
Definition: image.h:1547
Image * m_pProxyImages[MAX_PROXY_LEVEL+1]
Definition: image.h:1548
virtual bool GenerateProxy ( Image targetImg,
int  level,
bool  DownsampleTo8Bits = true 
)
protectedvirtual
void UnitTest ( int  iterations)

cause the image storage mechanisms to be tested randomly for the specified number of iterations.

virtual bool isAllocated ( ) const
virtual
static QString AllSupportedExtensions ( bool  bRGBAOnly = false,
bool  bRead = true,
bool  bDesc = false,
bool  bPSD = true,
QString  sDelimiter = ";" 
)
static
ImageType getType ( ) const
inline

return the image type.

Definition at line 1598 of file image.h.

1598 { return m_ImageType; }
ImageType m_ImageType
Definition: image.h:1545
const ImageDescriptor& getDescriptor ( ) const
inline

get the full descriptor for the image

Definition at line 1601 of file image.h.

1601 { return m_Descriptor; }
ImageDescriptor m_Descriptor
Definition: image.h:1543
void setProxyDownsampleTo8Bit ( bool  downsampleTo8Bit = true)
inline

The default when generating proxys is to downsample them to 8 bit/channel this can make them significantly smaller.

This is not appropriate for bump or normal maps where greater precision is required. This API lets you turn off the downsampling on a per image basis

Definition at line 1608 of file image.h.

1609  {
1610  if (m_bDownsampleProxyTo8Bit != downsampleTo8Bit) {
1611  m_bDownsampleProxyTo8Bit = downsampleTo8Bit;
1612  markProxyDirty();
1613  }
1614  }
bool m_bDownsampleProxyTo8Bit
Definition: image.h:1549
void markProxyDirty()
Definition: image.h:1553
bool getProxyDownsampleTo8Bit ( ) const
inline

Definition at line 1616 of file image.h.

1616 { return m_bDownsampleProxyTo8Bit; }
bool m_bDownsampleProxyTo8Bit
Definition: image.h:1549
void clearProxyImages ( )
inline

clear and deallocate any proxy images.

Definition at line 1619 of file image.h.

1619 { markProxyDirty(); }
void markProxyDirty()
Definition: image.h:1553
void SetProxyInterruptFunction ( ProxyInterruptFunction  fcnPtr = 0)
inline

When generating proxy images, periodically, the interrupt function will be polled.

if it returns true, the proxy generation will be interrupted. Any work done in this function should complete very quickly. (budget no more than 10 milliseconds)

Definition at line 1624 of file image.h.

1625  { m_pProxyIntFcn = fcnPtr; }
ProxyInterruptFunction m_pProxyIntFcn
Definition: image.h:1551
unsigned char getProxyLevel ( ) const
inline

get the Proxy level of the image – 0 = no proxying.

1 = 0.5x, 2 = 0.25x, 3 = 0.125x.

Note: Currently only tiled images may be proxied. Attempting to set a non 0 proxy level on any other type of image will result in an exception being thrown.

Definition at line 1635 of file image.h.

1635 { return m_ProxyLevel; }
unsigned char m_ProxyLevel
Definition: image.h:1547
bool setProxyLevel ( unsigned char  newLevel)
inline

set the current proxy level

Definition at line 1638 of file image.h.

1638  {
1639  if ( xSize()>>newLevel == 0 || ySize()>>newLevel == 0 )
1640  return false;
1641  if (newLevel > MAX_PROXY_LEVEL) newLevel = MAX_PROXY_LEVEL;
1642  if (newLevel != m_ProxyLevel) {
1643  m_ProxyLevel = newLevel;
1644  }
1645 
1646  return true;
1647  }
unsigned char m_ProxyLevel
Definition: image.h:1547
int ySize() const
Get the y size of the image.
Definition: image.h:1672
int xSize() const
Get the x size of the image.
Definition: image.h:1669
#define MAX_PROXY_LEVEL
Definition: image.h:1476
Image* getProxyImage ( )
inline

get the proxy image.

If the proxy level is 0, it just returns this image. If the proxy is dirty, it gets regenerated first before returning. Note – if the interrupt function is set, and the generation of the proxy is interrupted, this will return NULL

Definition at line 1654 of file image.h.

1655  {
1656  if (m_ProxyLevel == 0) return this;
1657 
1659 
1660  bool generated = regenerateProxy();
1661  if (!generated && m_pProxyImages[m_ProxyLevel] != 0) {
1662  delete m_pProxyImages[m_ProxyLevel];
1664  }
1665  return m_pProxyImages[m_ProxyLevel];
1666  }
unsigned char m_ProxyLevel
Definition: image.h:1547
virtual bool regenerateProxy()
Image * m_pProxyImages[MAX_PROXY_LEVEL+1]
Definition: image.h:1548
int xSize ( ) const
inline

Get the x size of the image.

Definition at line 1669 of file image.h.

1669 { return m_Descriptor.xSize(); }
ImageDescriptor m_Descriptor
Definition: image.h:1543
int xSize() const
return the x Size of the image
Definition: image.h:1421
int ySize ( ) const
inline

Get the y size of the image.

Definition at line 1672 of file image.h.

1672 { return m_Descriptor.ySize(); }
ImageDescriptor m_Descriptor
Definition: image.h:1543
int ySize() const
return the y Size of the image
Definition: image.h:1424
int cSize ( ) const
inline

Get the channel count of the image.

Definition at line 1675 of file image.h.

1675 { return m_Descriptor.cSize(); }
ImageDescriptor m_Descriptor
Definition: image.h:1543
int cSize() const
return the channel count of the image
Definition: image.h:1427
int curWidth ( ) const
inline

get the width of the current proxy level of the image

Definition at line 1678 of file image.h.

1678 { return Width() >> getProxyLevel(); }
virtual unsigned int Width(void) const
Return the width of the image in pixels.
unsigned char getProxyLevel() const
get the Proxy level of the image – 0 = no proxying.
Definition: image.h:1635
int curHeight ( ) const
inline

get the height of the current proxy level of the image

Definition at line 1681 of file image.h.

1681 { return Height() >> getProxyLevel(); }
virtual unsigned int Height(void) const
Return the height of the image in pixels.
unsigned char getProxyLevel() const
get the Proxy level of the image – 0 = no proxying.
Definition: image.h:1635
ImageDescriptor::MemoryChannelOrder channelOrder ( ) const
inline

Get the channel ordering of the image.

Definition at line 1684 of file image.h.

1684 { return m_Descriptor.m_channelOrder; }
ImageDescriptor m_Descriptor
Definition: image.h:1543
MemoryChannelOrder m_channelOrder
channel ordering
Definition: image.h:1286
const ImgTile& getBounds ( ) const
inline

returns the bounds of the image – the origin of this rect may not be at 0,0

Definition at line 1687 of file image.h.

1687 { return m_Descriptor.getBounds(); }
ImageDescriptor m_Descriptor
Definition: image.h:1543
const ImgTile & getBounds() const
return the bounds of the image
Definition: image.h:1439
void getFillColor ( void fillPixel,
const PixelDescriptor pd = 0 
) const

Reads the fill color into the provided buffer, in the specified format – if no format is provided, it uses the pixel format of this image.

Parameters
fillPixelPointer to the target where the fill color will be written
pdDesired pixelformat for the fill color – if 0, it uses the pixel format of this image
void setFillColor ( const void fillPixel,
const PixelDescriptor pd = 0 
)

Sets the fill color into the provided buffer, in the specified format – if no format is provided, it uses the pixel format of this image.

Parameters
fillPixelPointer to the source where the fill color will be read from
pdDesired pixelformat for the fill color – if 0, it uses the pixel format of this image
void getTile ( int  x,
int  y,
int  nx,
int  ny,
void data,
const PixelDescriptor pd = 0 
)
inline

Reads a rectangular region of pixels from the image into a buffer.

The buffer must be exactly the size of the region being read. If the region is outside or partly outside the bounds of the image, those areas of the target buffer will be filled with the image's FillColor

Note
this operation is atomic – no other threads can write to the image while this is being performed.
Parameters
xx coord of the lower left corner of the region to be read.
yy coord of the lower left corner of the region to be read.
nxwidth of the region to be read.
nyheight of the region to be read.
dataPointer to the target buffer.
pdDesired pixelformat for the buffer color – if 0, it uses the pixel format of this image

Definition at line 1733 of file image.h.

1735  { getTile(ImgTile(x, y, nx, ny), data, pd); }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
void getTile(int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
Definition: image.h:1733
void getSubTile ( int  x,
int  y,
int  nx,
int  ny,
void data,
int  dx,
int  dy,
int  dnx,
int  dny,
const PixelDescriptor pd = 0 
)
inline

Reads a rectangular region of pixels from the image into a buffer.

The buffer may be be different than the size of the region being read. If the region is outside or partly outside the bounds of the image, those areas of the target buffer will be filled with the image's FillColor

Note
this operation is atomic – no other threads can write to the image while this is being performed.
Parameters
xx coord of the lower left corner of the region to be read.
yy coord of the lower left corner of the region to be read.
nxwidth of the region to be read.
nyheight of the region to be read.
dataPointer to the target buffer.
dxx coord of the lower left corner of the buffer (in image coords).
dyy coord of the lower left corner of the buffer (in image coords).
dnxwidth of the target buffer.
dnyheight of the target buffer.
pdDesired pixelformat for the buffer color – if 0, it uses the pixel format of this image

Definition at line 1762 of file image.h.

1765  { getSubTile(ImgTile(x, y, nx, ny), data, ImgTile(dx, dy, dnx, dny), pd); }
GLenum GLint GLint y
Definition: GLee.h:876
int int int int * dy
Definition: GLee.h:10535
GLfloat ny
Definition: GLee.h:5410
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
GLenum GLint x
Definition: GLee.h:876
void getSubTile(int x, int y, int nx, int ny, void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
Definition: image.h:1762
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
int int int * dx
Definition: GLee.h:10535
void getTile ( const ImgTile srcTile,
void data,
const PixelDescriptor pd = 0 
)
inline

Reads a rectangular region of pixels from the image into a buffer.

The buffer must be exactly the size of the region being read. If the region is outside or partly outside the bounds of the image, those areas of the target buffer will be filled with the image's FillColor

Note
this operation is atomic – no other threads can write to the image while this is being performed.
Parameters
srcTilethe rectangle of the image to be read into the buffer.
dataPointer to the target buffer.
pdDesired pixelformat for the buffer color – if 0, it uses the pixel format of this image

Definition at line 1784 of file image.h.

1786  { getSubTile(srcTile, data, srcTile, pd); }
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
void getSubTile(int x, int y, int nx, int ny, void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Reads a rectangular region of pixels from the image into a buffer.
Definition: image.h:1762
virtual void getSubTile ( const ImgTile srcTile,
void data,
const ImgTile targetBounds,
const PixelDescriptor pd = 0 
)
virtual

Reads a rectangular region of pixels from the image into a buffer.

The buffer may be be different than the size of the region being read. If the region is outside or partly outside the bounds of the image, those areas of the target buffer will be filled with the image's FillColor

Note
this operation is atomic – no other threads can write to the image while this is being performed.
this is the only member of the getTile family that must be provided by subclasses of this Image class.
Parameters
srcTileThe rectangle of the image to be read into the buffer.
dataPointer to the target buffer.
targetBoundsbounds of the target buffer (in image coords).
pdDesired pixelformat for the buffer color – if 0, it uses the pixel format of this image
void setTile ( int  x,
int  y,
int  nx,
int  ny,
void data,
const PixelDescriptor pd = 0 
)
inline

Writes a rectangular region of pixels to the image from a buffer.

The buffer must be exactly the size of the region being written. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
Parameters
xx coord of the lower left corner of the region to be written.
yy coord of the lower left corner of the region to be written.
nxwidth of the region to be written.
nyheight of the region to be written.
dataPointer to the source buffer.
pdPixelformat for the buffer color – if 0, it uses the pixel format of this image
+ Examples:

Definition at line 1833 of file image.h.

1835  { setTile(ImgTile(x, y, nx, ny), data, pd); }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
void setTile(int x, int y, int nx, int ny, void *data, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels to the image from a buffer.
Definition: image.h:1833
void setSubTile ( int  x,
int  y,
int  nx,
int  ny,
const void data,
int  dx,
int  dy,
int  dnx,
int  dny,
const PixelDescriptor pd = 0 
)
inline

Writes a rectangular region of pixels from the image into a buffer.

The buffer may be be different than the size of the region being written. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
Parameters
xx coord of the lower left corner of the region to be written.
yy coord of the lower left corner of the region to be written.
nxwidth of the region to be written.
nyheight of the region to be written.
dataPointer to the source buffer.
dxx coord of the lower left corner of the buffer (in image coords).
dyy coord of the lower left corner of the buffer (in image coords).
dnxwidth of the target buffer.
dnyheight of the target buffer.
pdPixelformat for the buffer color – if 0, it uses the pixel format of this image

Definition at line 1864 of file image.h.

1867  { setSubTile(ImgTile(x, y, nx, ny), data, ImgTile(dx, dy, dnx, dny), pd); }
GLenum GLint GLint y
Definition: GLee.h:876
int int int int * dy
Definition: GLee.h:10535
GLfloat ny
Definition: GLee.h:5410
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
void setSubTile(int x, int y, int nx, int ny, const void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels from the image into a buffer.
Definition: image.h:1864
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
int int int * dx
Definition: GLee.h:10535
void setTile ( const ImgTile dstTile,
const void data,
const PixelDescriptor pd = 0 
)
inline

Writes a rectangular region of pixels to the image from a buffer.

The buffer must be exactly the size of the region being written. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
Parameters
dstTilerectangle of the image to be written.
dataPointer to the source buffer.
pdDesired pixelformat for the buffer color – if 0, it uses the pixel format of this image

Definition at line 1885 of file image.h.

1887  { setSubTile(dstTile, data, dstTile, pd); }
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
void setSubTile(int x, int y, int nx, int ny, const void *data, int dx, int dy, int dnx, int dny, const PixelDescriptor *pd=0)
Writes a rectangular region of pixels from the image into a buffer.
Definition: image.h:1864
virtual void setSubTile ( const ImgTile dstTile,
const void data,
const ImgTile sourceBounds,
const PixelDescriptor pd = 0 
)
virtual

Writes a rectangular region of pixels from the image into a buffer.

The buffer may be be different than the size of the region being written. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
this is the only member of the setTile family that must be provided by subclasses of this Image class.
Parameters
dstTilerectangle of the image to be written.
dataPointer to the source buffer.
sourceBoundsbounds of the source buffer (in image coords).
pdPixelformat for the buffer color – if 0, it uses the pixel format of this image
void copyTile ( int  x,
int  y,
int  nx,
int  ny,
Image fromImg,
int  ox,
int  oy 
)
inline

Copies a rectangular region of pixels from a source image to this image.

If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written. Regions outsude the bounds of the source image will be filled with the FillColor of the source image.

Note
this operation is atomic – no other threads can read or write to the target image while this is being performed, and no other threads can write to the source image.
Format conversions are automatically performed as required.
Parameters
xx target coord of the lower left corner of the region to be copied.
yy target coord of the lower left corner of the region to be copied.
nxwidth of the region to be copied.
nyheight of the region to be copied.
fromImgThe source image.
oxx source coord of the lower left corner of the region to be copied (in souce image coordinates).
oyy source coord of the lower left corner of the region to be copied (in souce image coordinates). .

Definition at line 1937 of file image.h.

1939  { copyTile(ImgTile(x, y, nx, ny), fromImg, ox, oy); }
GLenum GLint GLint y
Definition: GLee.h:876
void copyTile(int x, int y, int nx, int ny, Image &fromImg, int ox, int oy)
Copies a rectangular region of pixels from a source image to this image.
Definition: image.h:1937
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
virtual void copyTile ( const ImgTile dstTile,
Image fromImg,
int  ox,
int  oy 
)
virtual

Copies a rectangular region of pixels from a source image to this image.

If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written. Regions outsude the bounds of the source image will be filled with the FillColor of the source image.

Note
this operation is atomic – no other threads can read or write to the target image while this is being performed, and no other threads can write to the source image.
Format conversions are automatically performed as required.
this is the only member of the copyTile family that must be provided by subclasses of this Image class.
Parameters
dstTiletarget rectangle to be copied.
fromImageThe source image.
oxx source coord of the lower left corner of the region to be copied (in souce image coordinates).
oyy source coord of the lower left corner of the region to be copied (in souce image coordinates). .
virtual void copyAll ( Image fromImg)
inlinevirtual

Copies all of the pixels from a source image to this image.

If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written. Regions outsude the bounds of the source image will be filled with the FillColor of the source image.

Note
this operation is atomic – no other threads can read or write to the target image while this is being performed, and no other threads can write to the source image.
Format conversions are automatically performed as required.
Parameters
fromImageThe source image.

Definition at line 1981 of file image.h.

1982  {
1983  ImgTile srcBounds(fromImg.getBounds());
1984  copyTile(srcBounds, fromImg, srcBounds.x, srcBounds.y);
1985  }
void copyTile(int x, int y, int nx, int ny, Image &fromImg, int ox, int oy)
Copies a rectangular region of pixels from a source image to this image.
Definition: image.h:1937
virtual void Clear ( )
virtual

Clear all the pixels of the image to 0 in all channels.

void fillTile ( int  x,
int  y,
int  nx,
int  ny,
void pixelData,
const PixelDescriptor pd = 0,
const ImgTile maskTile = 0 
)
inline

Fills a rectangular region of pixels in the image with a constant color.

Optionally a rectangular region can be "masked off" and not filled. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
Parameters
xx target coord of the lower left corner of the region to be filled.
yy target coord of the lower left corner of the region to be filled.
nxwidth of the region to be filled.
nyheight of the region to be filled.
pixelDataPointer to the source pixel data. If 0, all 0s are used instead.
pdPixelformat for the source pixel color – if 0, it uses the pixel format of this image
masktTilean optional pointer to a mask rectangle. If present, the contents of this rectangle of the image will remain unchanged by this operation.

Definition at line 2015 of file image.h.

2018  { fillTile(ImgTile(x, y, nx, ny), pixelData, pd, maskTile); }
GLenum GLint GLint y
Definition: GLee.h:876
void fillTile(int x, int y, int nx, int ny, void *pixelData, const PixelDescriptor *pd=0, const ImgTile *maskTile=0)
Fills a rectangular region of pixels in the image with a constant color.
Definition: image.h:2015
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
void fillTile ( const ImgTile dstTile,
const void pixelData,
const PixelDescriptor pd,
const ImgTile maskTile 
)

Fills a rectangular region of pixels in the image with a constant color.

Optionally a rectangular region can be "masked off" and not filled. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
Parameters
dstTileRectangle of the image to be written.
pixelDataPointer to the source pixel data. If 0, all 0s are used instead.
pdPixelformat for the source pixel color – if 0, it uses the pixel format of this image
masktTilean optional pointer to a mask rectangle. If present, the contents of this rectangle of the image will remain unchanged by this operation.
virtual void fillTile ( const ImgTile dstTile,
const void pixelData,
const PixelDescriptor pd = 0 
)
virtual

Fills a rectangular region of pixels in the image with a constant color.

Optionally a rectangular region can be "masked off" and not filled. If the image has dynamic bounds, the image bounds will be expanded as required so that the entire operation can complete. Otherwise the region that is outside the bounds of the image will not be written.

Note
this operation is atomic – no other threads can read or write to the image while this is being performed.
this is the only member of the fillTile family that must be provided by subclasses of this Image class.
Parameters
dstTileRectangle of the image to be written.
pixelDataPointer to the source pixel data. If 0, all 0s are used instead.
pdPixelformat for the source pixel color – if 0, it uses the pixel format of this image
virtual void getPageSize ( int nx,
int ny 
)
virtual

Returns the size of an image page.

Some images may be carved up into 1 or more image pages – this method returns the page size for this image. MemoryImages will be a single page that is the size of the entire images. virtualImages will have have a page size of 128 x 128 pixels.

Parameters
nxwidth of a page
nyheight of a page
ImgPageIterator* getPageIterator ( int  x,
int  y,
int  nx,
int  ny 
)
inline

Returns a tile iterator that will iterate over the pages of this image in an optimal order.

For MemoryImages and other non paged images this iterator will only produce one tile.

Parameters
xx origin of the region to iterate over
yyorigin of the region to iterate over
nxwidth of the region to iterate over
nyheight of the region to iterate over
Returns
the tileIterator
Note
this function allocates the iterator – when the caller is finished with it, the caller must delete it.

Definition at line 2092 of file image.h.

2093  { return getPageIterator(ImgTile(x, y, nx, ny)); }
GLenum GLint GLint y
Definition: GLee.h:876
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
ImgPageIterator * getPageIterator(int x, int y, int nx, int ny)
Returns a tile iterator that will iterate over the pages of this image in an optimal order...
Definition: image.h:2092
virtual ImgPageIterator* getPageIterator ( const ImgTile srcTile)
virtual

Returns a tile iterator that will iterate over the pages of this image in an optimal order.

For MemoryImages and other non paged images this iterator will only produce one tile.

Parameters
srcTilethe region to iterate over
Returns
the tileIterator
Note
this function allocates the iterator – when the caller is finished with it, the caller must delete it.
ImgLockPageIterator* lockPageSet ( int  x,
int  y,
int  nx,
int  ny,
ImgLockPageIterator::AccessMode  mode 
)
inline

Returns a tile iterator that will iterate over the pages of this image in an optimal order.

These pages are locked at the start of this operation, and unlocked 1 by one as they are iterated over. For MemoryImages and other non paged images this iterator will only produce one tile.

Parameters
xx origin of the region to lock and iterate over
yyorigin of the region to lock and iterate over
nxwidth of the region to lock and iterate over
nyheight of the region to lock and iterate over
modethe access mode – read only, read/write or write only.
Returns
the tileIterator
Note
this function allocates the iterator – when the caller is finished with it, the caller must delete it.

Definition at line 2123 of file image.h.

2125  { return lockPageSet(ImgTile(x, y, nx, ny), mode); }
GLenum GLint GLint y
Definition: GLee.h:876
GLint mode
Definition: GLee.h:4479
GLfloat ny
Definition: GLee.h:5410
GLenum GLint x
Definition: GLee.h:876
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
ImgLockPageIterator * lockPageSet(int x, int y, int nx, int ny, ImgLockPageIterator::AccessMode mode)
Returns a tile iterator that will iterate over the pages of this image in an optimal order...
Definition: image.h:2123
virtual ImgLockPageIterator* lockPageSet ( const ImgTile srcTile,
ImgLockPageIterator::AccessMode  mode 
)
virtual

Returns a tile iterator that will iterate over the pages of this image in an optimal order.

These pages are locked at the start of this operation, and unlocked 1 by one as they are iterated over. For MemoryImages and other non paged images this iterator will only produce one tile.

Parameters
srcTilethe region to lock and iterate over
modethe access mode – read only, read/write or write only.
Returns
the tileIterator
Note
this function allocates the iterator – when the caller is finished with it, the caller must delete it.
static ImageDescriptor::MemoryChannelOrder optimizedChannelOrder ( )
static
static void ConvertPixels ( void dst,
const void src,
int  numPix,
const PixelDescriptor dstDesc,
const PixelDescriptor srcDesc = 0 
)
static
void CopyInverseLuminance ( const Image srcImage)

copies 1-luminance from the source image into this image

void CopyLuminance ( const Image srcImage)

copies the luminance of the source image into this image

virtual void PutInverseLuminance ( Image targetImage) const
virtual

copies 1-luminance of this image to the target image

virtual void PutLuminance ( Image targetImage) const
virtual

copies the luminance of this image to the target image

virtual QString SupportedExtensions ( bool  bRGBAOnly = false,
bool  bRead = true,
bool  bDesc = false,
bool  bPSD = true,
QString  sDelimiter = ";" 
) const
virtual

Returns the supported file extensions, separated by ';'.

Parameters
bRGBAOnlytrue to return a list of file formats that support 4 channels. false to return a list of all supported formats. Not all returned formats may support 4 channels (like JPEG).
bReadtrue to return list of readable formats, false for writable formats. Not all readable formats may be writable and vice versa.
bDesctrue to prepend descriptive text to each extension. i.e "JPG [8 bit, RGB]"
bPSDtrue to support PSD files...
virtual void Create ( unsigned int  iWidth,
unsigned int  iHeight,
unsigned int  iChannelCount,
Format  eFormat = e8integer,
bool  Tiled = false,
ImageDescriptor::MemoryChannelOrder  eOrder = ImageDescriptor::orderRGBA 
)
virtual

Create a new image.

Data will be undefined. The Tiled argument creates a tiled versioned image. (the Data method will not work on these type of images, you must use get/set/copy tile or page locking to access them)

+ Examples:
virtual void Load ( const QString sFileName,
int  iLayerIndex = 0,
bool  tiled = false 
)
virtual

Load a whole image from an external file.

The extension in the filename must be included. If the file is a PSD file, the bottom bost image layer is loaded into this image.

virtual bool GetPSDLayerMeta ( void pPSDFile,
int  iLayerIndex,
QString layerName,
int blendMode,
float &  opacity,
bool &  locked,
bool &  visible,
bool &  transLocked 
)
virtual
virtual bool LoadPSDLayer ( void pPSDFile,
int  iLayerIndex,
bool  Tiled = false,
bool  premult = true 
)
virtual

Load this image from a layer in a Photoshop file.

The image will be created at the bit-depth and format of the PSD file (either 8 bit int, 16 bit int, or 32 bit float), and will be the size of the PSD file (not the size of the layer, which can be smaller). The image will be tiled as specified. The pPSDFile must have been created with OpenPSDFile. 0 is the bottom layer, and they increase as you go up in the layer stack.

virtual Image* ComputeDifferenceMask ( Image otherImg,
int  expansionRadius,
int  AARadius,
bool &  anyDiffs 
)
virtual
virtual bool SavePSDLayerMeta ( void pPSDFile,
int  iLayerIndex,
const QString pLayerName,
float  opacity = 1.0f,
bool  visible = true,
bool  locked = false,
int  xOff = 0,
int  yOff = 0,
int  blendMode = -1 
)
virtual

Save this image metadata to the layer metadata in a Photoshop file.

The image must be the same size and bit-depth as the PSD file The pPSDFile must have been created with PSDOpen. 0 is the bottom layer, and they increase as you go up in the layer stack -1 for the layer index indicates that you want to save the RGB of this image into the composite image in the PSD file. In that case, the remaining parameters are ignored. All layer metadata must be set before any layer images are written

virtual bool SavePSDLayer ( void pPSDFile,
int  iLayerIndex,
const QString pLayerName,
float  opacity = 1.0f,
bool  visible = true,
bool  locked = false,
bool  needs_unpremult = true,
int  xOff = 0,
int  yOff = 0 
)
virtual

Save this image to a layer in a Photoshop file.

The image must be the same size and bit-depth as the PSD file The pPSDFile must have been created with PSDOpen. 0 is the bottom layer, and they increase as you go up in the layer stack -1 for the layer index indicates that you want to save the RGB of this image into the composite image in the PSD file. In that case, the remaining parameters are ignored. The layer metata for this and all other layers must have been set before calling this function.

virtual void* OpenPSDFile ( const QString pFileName,
bool  writing = false 
)
virtual

Open a PSD file for reading or writing – returns a pointer to blind data representing the open file, or NULL if it was unable to open the file.

When creating a PSD file, first open it, then set the FileInfo, then save the layes from the bottom up (index 0 to n), and lastly save the composite layer (index -1.) Then close the file.

virtual bool GetPSDFileInfo ( void psdFile,
int width,
int height,
int numChannels,
int bitDepth,
int numLayers,
int curLayer 
)
virtual

Returns the basic file scope metadata for a PSD file.

Returns true if successful. (if any of the pointers are NULL, the informaton is not retrieved)

virtual bool SetPSDFileInfo ( void psdFile,
int  width,
int  height,
int  numChannels,
int  bitDepth,
int  numLayers,
int  curLayer 
)
virtual

Sets the file scope metadata for a writable PSD file.

Returns true if successful. This must be called before saving any layers.

virtual bool ClosePSDFile ( void psdFile)
virtual

Close a PSD file.

virtual void Save ( const QString sFileName,
bool  bForce = true,
Material pMaterial = NULL,
float  uStart = 0.0f,
float  vStart = 0.0f,
bool  force_1_Channel_To_4_Channel = false 
)
virtual

Save the image to an external file.

The extension of the file will determine the file type. If bForce is true the image should be saved even it means data loss. Otherwise an exception should drop. Optionally, when saving to PSD, if you specify a material and a uv offset for this texture, it can draw the base uv mesh on a layer above the image layer.

virtual unsigned int Width ( void  ) const
virtual

Return the width of the image in pixels.

virtual unsigned int Height ( void  ) const
virtual

Return the height of the image in pixels.

virtual Format Format ( void  ) const
virtual

Return the format of the image.

virtual unsigned int ChannelCount ( void  ) const
virtual

Return the number of channels in the image.

virtual unsigned int BytesPerPixel ( void  ) const
virtual

Return the number of bytes used by a pixel.

unsigned int curBytesPerPixel ( ) const
inline

Return the number of bytes used by a pixel at the current proxy level.

Definition at line 2304 of file image.h.

2304 { return (getProxyLevel() != 0) ? ChannelCount() : BytesPerPixel(); }
virtual unsigned int BytesPerPixel(void) const
Return the number of bytes used by a pixel.
virtual unsigned int ChannelCount(void) const
Return the number of channels in the image.
unsigned char getProxyLevel() const
get the Proxy level of the image – 0 = no proxying.
Definition: image.h:1635
virtual unsigned int TotalBytes ( void  ) const
virtual

Return the number of bytes used by the whole image.

unsigned int curTotalBytes ( void  ) const
inline

Return the number of bytes used by the whole image (current proxy level)

Definition at line 2310 of file image.h.

2310 { return curWidth() * curHeight() * curBytesPerPixel(); }
int curWidth() const
get the width of the current proxy level of the image
Definition: image.h:1678
unsigned int curBytesPerPixel() const
Return the number of bytes used by a pixel at the current proxy level.
Definition: image.h:2304
int curHeight() const
get the height of the current proxy level of the image
Definition: image.h:1681
virtual void SetValueAt ( unsigned int  iXPos,
unsigned int  iYPos,
unsigned int  iChannel,
float  fValue 
)
virtual

Set value for a specified texel.

For integer maps 1 should be mapped for the maximum value (255 for 8 bit images and 65535 for 16 bit images) This fcn is very slow and deprecated. Use LockPageSet, or the fast templated pixel accessor classes.

virtual float ValueAt ( unsigned int  iXPos,
unsigned int  iYPos,
unsigned int  iChannel 
) const
virtual

Get the value at a given coordinate.

This fcn is very slow and deprecated. Use LockPageSet, or the fast templated pixel accessor classes.

virtual float ValueAt ( float  fXPos,
float  fYPos,
unsigned int  iChannel 
) const
virtual

Get interpolated value at a given coordinate.

This fcn is very slow and deprecated. Use LockPageSet, or the fast templated pixel accessor classes.

virtual void SetColorAt ( unsigned int  iXPos,
unsigned int  iYPos,
const Color cColor 
)
virtual

Set value for a specified texel.

For integer maps 1 should be mapped for the maximum value (255 for 8 bit images and 65535 for 16 bit images)

virtual Color ColorAt ( unsigned int  iXPos,
unsigned int  iYPos 
) const
virtual

Get the value at a given coordinate.

virtual Color ColorAt ( float  fXPos,
float  fYPos 
) const
virtual

Get interpolated value at a given coordinate.

virtual QImage* ConvertToQImage ( )
virtual

Create a QImage object from the image data for display purposes.

This function allocates the QImage – the caller will have to delete it when done with the image.

virtual void ConvertFromQImage ( QImage qImg,
bool  tiled = false 
)
virtual

Creates the image from a QImage.

virtual bool Fragmented ( ) const
virtual

returns true if the image is not stored in one physically contiguous piece of CPU visible memory – If so, you must use lockPageSet to get at portions of the image data...

virtual bool Tiled ( ) const
virtual

returns true if this is a tiled and versioned image

bool Versioned ( ) const
inline

returns true if this is a tiled and versioned image

Definition at line 2358 of file image.h.

2358 { return Tiled(); }
virtual bool Tiled() const
returns true if this is a tiled and versioned image
virtual bool NewVersion ( )
virtual

checkpoint and create a new version of this image.

returns true if it worked, false otherwise

virtual bool PrevVersion ( )
virtual

makes the previous version current – used for undo returns true if it worked, false otherwise marks the proxy dirty

virtual bool NextVersion ( )
virtual

makes the next version current – used for redo returns true if it worked, false otherwise marks the proxy dirty

virtual int NumVersions ( )
virtual

returns the number of versions. returns 1 for unversioned images

virtual bool MergeOldestVersions ( )
virtual

merges the oldest two versions – used to limit the number of items on the undo queue.

returns true if it worked, false otherwise

virtual bool PurgeNewerVersions ( )
virtual

Creating a new version will implicitly purge nerer versions, but if another operation takes place that puts a new item on the undo queue, this should be called to purge newer versions of this image returns true if it worked, false otherwise.

virtual bool PurgeAllButCurrentVersion ( )
virtual

Releases all but the current version – used to flush the undo queue.

returns true if it worked, false otherwise

virtual void* Data ( int  iRow = -1,
bool  writing = true 
)
virtual

Get a pointer to the raw data of a row of the image.

If the given row index is -1, then a pointer - if exists - to the whole data block is returned. These are deprecated and are going away shortly. DO NOT USE THEM IN NEW CODE. Use LockPageSet instead. These will not work on tiled images at all.

virtual const void* Data ( int  iRow = -1,
bool  writing = false 
) const
virtual
virtual void DrawUVs ( Material pMaterial,
float  uStart = 0.0f,
float  vStart = 0.0f,
bool  baseLevel = true 
)
virtual

Draw the uv mesh for a given material into this image – either the base or active level.

uv offset can be specified for tiled materials. These offsets should be 0.0, 1.0, 1.0 etc... The default is to draw from 0.0, 0.0 to 1.0, 1.0 marks the proxy dirty

virtual void scaleTileBilinear_4Chan_uchar ( float  x,
float  y,
float  nx,
float  ny,
unsigned int data,
int  dx,
int  dy,
int  dnx,
int  dny,
float  xScale,
float  yScale 
) const
virtual

Fast, thread safe image scaler.

Works only on 4 channel 8 bit/channel images Note: Not a permanent part of the API.

virtual void GenerateUpscaled ( Image targetImg,
int  factor 
)
virtual

This upscales an image with good filtering (bilinear to Lanczos as needed based on the scale factor.

The upscaled image will be the same bit depth as the source Current factors supported is 2. Soon to come, 4, 8, and 16. this function only works on tiled images. Not yet implemented TODO.

static void MultiplyRGBByAlpha_uc4 ( unsigned char *  buffer,
int  numPixels 
)
static

multiply alpha into RGB for the specified number of pixels.

4 Byte per pixel, 8 bit unsigned char per channel only.

virtual bool isDirty ( ) const
virtual

Query if the contents of this image have changed since the last call to setClean.

virtual void setDirty ( )
virtual

Explicitly set the image state to dirty.

All calls to the image class that change the contents of an image will automatically set the dirty flag, so in the normal course of affairs, you should not have to call this function.

virtual void setClean ( )
virtual

explicitly set the image state to clean.

virtual void VerticalFlip ( )
virtual

vertically flip the image (make it upside down)

virtual void AdjustImageCacheSize ( )
virtual

Causes the image cache size to adjust based on the amount of memory available.

virtual void ConvertTo4Channel ( )
virtual

makes the image 4 channels. with the alphas 1.0.

Friends And Related Function Documentation

friend class ImgPageIterator
friend

Definition at line 1509 of file image.h.

friend class ImgLockPageIterator
friend

Definition at line 1510 of file image.h.

Member Data Documentation

unsigned char m_FillPixel[16]
protected

Definition at line 1542 of file image.h.

ImageDescriptor m_Descriptor
protected

Definition at line 1543 of file image.h.

ImageType m_ImageType
protected

Definition at line 1545 of file image.h.

unsigned char m_ProxyLevel
protected

Definition at line 1547 of file image.h.

Image* m_pProxyImages[MAX_PROXY_LEVEL+1]
protected

Definition at line 1548 of file image.h.

bool m_bDownsampleProxyTo8Bit
protected

Definition at line 1549 of file image.h.

ProxyInterruptFunction m_pProxyIntFcn
protected

Definition at line 1551 of file image.h.


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