ImageDescriptor Class Reference

#include <image.h>

Class Description

Describe an image, specifically how to interpret pixel data.

This class derives from PixelDescriptor and adds a bounding rectangle and spatial resolution.

Definition at line 1353 of file image.h.

+ Inheritance diagram for ImageDescriptor:

Public Types

enum  ResUnit { k_PixelsPerInch = 1, k_PixelsPerCentimeter = 2 }
 Resolution units (mainly used so resolution is preserved in PSD & TIFF files) More...
 
- Public Types inherited from PixelDescriptor
enum  ChannelType {
  uChar = 0, uShort = 1, sHalf = 2, sFloat = 3,
  sChar = 4, sShort = 5, uInt = 6, sInt = 7,
  sDouble = 8
}
 Describe the data type of a single channel of a pixel. More...
 
enum  MemoryChannelOrder {
  orderNONE = 0, orderRGBA = 1, orderABGR = 2, orderBGRA = 3,
  orderARGB = 4, orderRGB = 5, orderBGR = 6
}
 Describe channel ordering for 4 channel images – these are the order of the channels in memory, not in registers or uInts. More...
 

Public Member Functions

 ImageDescriptor (int x, int y, int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
 Constructor – make a descriptor... More...
 
 ImageDescriptor (int nx, int ny, MemoryChannelOrder order=orderRGBA, bool premult=true, char nc=4, ChannelType ct=uChar)
 Constructor – make a descriptor... More...
 
 ImageDescriptor ()
 default constructor – RGBA, premult, 4 channel uChar, size 0 x 0 pixels. More...
 
int numBytes () const
 return the number of bytes the raw image pixels will occupy – not necessarily accurate for VirtualImages More...
 
int strideBytes () const
 return the number of bytes wide that the image is More...
 
int xSize () const
 return the x Size of the image More...
 
int ySize () const
 return the y Size of the image More...
 
int cSize () const
 return the channel count of the image More...
 
bool sizeEqual (const ImageDescriptor &o) const
 return true if the x and y dimensions are equal More...
 
void setSize (int nx, int ny)
 Set the size of the image in pixels. More...
 
const ImgTilegetBounds () const
 return the bounds of the image More...
 
void getResolutionInfo (float &xRes, float &yRes, ResUnit &unit) const
 return the horizontal and vertical resolution of the image More...
 
void setResolutionInfo (float xRes, float yRes, ResUnit unit)
 set the horizontal and vertical resolution of the image More...
 
- Public Member Functions inherited from PixelDescriptor
 PixelDescriptor (char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
 
int channelSize () const
 return the size of a pixel channel in bytes More...
 
int channelBitSize () const
 return the size of a pixel channel in bits More...
 
int pixelSize () const
 return the size of a pixel in bytes More...
 
int pixelBitSize () const
 return the size of a pixel in bits More...
 
ChannelType channelType () const
 Get the channel type of the image/pixel. More...
 
MemoryChannelOrder channelOrder () const
 Get the channel ordering of the image/pixel. More...
 
bool premultiplied () const
 returns true if the RGB values are premultiplied by the A values, false otherwise. More...
 
int channelCount () const
 return the number of channels – 1, 2, 3, or 4 More...
 
void setChannelCount (int c)
 set the number of channels – 1, 2, 3, or 4 More...
 
bool operator== (const PixelDescriptor &pd) const
 returns true if the pixel descriptors are equal More...
 

Protected Attributes

ImgTile m_Bounds
 Bounds of the image – some images may not have a 0,0 origin. More...
 
float m_xResolution
 horizontal resolution in pixels per unit More...
 
float m_yResolution
 vertical resolution in pixels per unit More...
 
ResUnit m_ResolutionUnits
 units – 1 == inch, 2 == centimeter (same as in PSD files) More...
 
- Protected Attributes inherited from PixelDescriptor
char m_cCount
 number of channels in the image – 1, 3, or 4 More...
 
ChannelType m_channelType
 Channel type. More...
 
MemoryChannelOrder m_channelOrder
 channel ordering More...
 
bool m_PreMultiplied
 true if RGB is premultiplied by A More...
 

Friends

class Image
 

Member Enumeration Documentation

enum ResUnit

Resolution units (mainly used so resolution is preserved in PSD & TIFF files)

Enumerator
k_PixelsPerInch 

pixels per inch

k_PixelsPerCentimeter 

pixels per centimeter

Definition at line 1357 of file image.h.

1357  { k_PixelsPerInch = 1,
1359  };

Constructor & Destructor Documentation

ImageDescriptor ( int  x,
int  y,
int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar 
)
inline

Constructor – make a descriptor...

Parameters
xx origin of the image
yy origin of the image
nxxSize of the image
nyySize of the image
orderchannel ordering of the image
premultAre the RGB channels premultiplied by the A?
ncnumber of channels – currently only 4 is supported
ctdata type of the channels – currently only uChar is supported.

Definition at line 1382 of file image.h.

1385  :
1386  PixelDescriptor(nc, ct, order, premult),
1387  m_Bounds(x, y, nx, ny),
1388  m_xResolution(100.0f), m_yResolution(100.0f),
PixelDescriptor(char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
Definition: image.h:1292
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
ResUnit m_ResolutionUnits
units – 1 == inch, 2 == centimeter (same as in PSD files)
Definition: image.h:1366
float m_xResolution
horizontal resolution in pixels per unit
Definition: image.h:1364
float m_yResolution
vertical resolution in pixels per unit
Definition: image.h:1365
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
GLclampf f
Definition: GLee.h:9303
ImageDescriptor ( int  nx,
int  ny,
MemoryChannelOrder  order = orderRGBA,
bool  premult = true,
char  nc = 4,
ChannelType  ct = uChar 
)
inline

Constructor – make a descriptor...

Parameters
nxxSize of the image
nyySize of the image
orderchannel ordering of the image
premultAre the RGB channels premultiplied by the A?
ncnumber of channels – currently only 4 is supported
ctdata type of the channels – currently only uChar is supported.

Definition at line 1401 of file image.h.

1404  :
1405  PixelDescriptor(nc, ct, order, premult),
1406  m_Bounds(0, 0, nx, ny) {}
PixelDescriptor(char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
Definition: image.h:1292
GLfloat ny
Definition: GLee.h:5410
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
ImageDescriptor ( )
inline

default constructor – RGBA, premult, 4 channel uChar, size 0 x 0 pixels.

Definition at line 1409 of file image.h.

1409  :
1410  PixelDescriptor(4, uChar, orderRGBA, true),
1411  m_Bounds(0,0,0,0) {}
PixelDescriptor(char cCount, ChannelType channelType, MemoryChannelOrder channelOrder, bool PreMultiplied)
Definition: image.h:1292
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
unsigned 8 bit char
Definition: image.h:1259

Member Function Documentation

int numBytes ( ) const
inline

return the number of bytes the raw image pixels will occupy – not necessarily accurate for VirtualImages

Definition at line 1415 of file image.h.

1415 { return m_Bounds.nx * m_Bounds.ny * pixelSize(); }
int nx
x size of the tile (width)
Definition: image.h:965
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
int ny
y size of the tile (height)
Definition: image.h:966
int pixelSize() const
return the size of a pixel in bytes
Definition: image.h:1313
int strideBytes ( ) const
inline

return the number of bytes wide that the image is

Definition at line 1418 of file image.h.

1418 { return m_Bounds.nx * pixelSize(); }
int nx
x size of the tile (width)
Definition: image.h:965
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
int pixelSize() const
return the size of a pixel in bytes
Definition: image.h:1313
int xSize ( ) const
inline

return the x Size of the image

Definition at line 1421 of file image.h.

1421 { return m_Bounds.nx; }
int nx
x size of the tile (width)
Definition: image.h:965
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
int ySize ( ) const
inline

return the y Size of the image

Definition at line 1424 of file image.h.

1424 { return m_Bounds.ny; }
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
int ny
y size of the tile (height)
Definition: image.h:966
int cSize ( ) const
inline

return the channel count of the image

Definition at line 1427 of file image.h.

1427 { return m_cCount; }
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
bool sizeEqual ( const ImageDescriptor o) const
inline

return true if the x and y dimensions are equal

Parameters
othe other descriptor to compare against.

Definition at line 1432 of file image.h.

1433  { return ((xSize() == o.xSize()) && (ySize() == o.ySize())); }
int ySize() const
return the y Size of the image
Definition: image.h:1424
int xSize() const
return the x Size of the image
Definition: image.h:1421
void setSize ( int  nx,
int  ny 
)
inline

Set the size of the image in pixels.

Definition at line 1436 of file image.h.

1436 { m_Bounds.nx = nx; m_Bounds.ny = ny; }
int nx
x size of the tile (width)
Definition: image.h:965
GLfloat ny
Definition: GLee.h:5410
GLfloat GLfloat GLfloat GLfloat nx
Definition: GLee.h:5412
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
int ny
y size of the tile (height)
Definition: image.h:966
const ImgTile& getBounds ( ) const
inline

return the bounds of the image

Definition at line 1439 of file image.h.

1439 { return m_Bounds; }
ImgTile m_Bounds
Bounds of the image – some images may not have a 0,0 origin.
Definition: image.h:1362
void getResolutionInfo ( float &  xRes,
float &  yRes,
ResUnit unit 
) const
inline

return the horizontal and vertical resolution of the image

Parameters
xResreturned X Resolution in Pixels per unit
yResreturned y Resolution in Pixels per unit
unitreturned resolution unit

Definition at line 1447 of file image.h.

1448  {
1449  xRes = m_xResolution; yRes = m_yResolution, unit = m_ResolutionUnits;
1450  }
ResUnit m_ResolutionUnits
units – 1 == inch, 2 == centimeter (same as in PSD files)
Definition: image.h:1366
float m_xResolution
horizontal resolution in pixels per unit
Definition: image.h:1364
float m_yResolution
vertical resolution in pixels per unit
Definition: image.h:1365
void setResolutionInfo ( float  xRes,
float  yRes,
ResUnit  unit 
)
inline

set the horizontal and vertical resolution of the image

Parameters
xResnew X Resolution in Pixels per unit
yResnew y Resolution in Pixels per unit
unitnew resolution unit

Definition at line 1458 of file image.h.

1459  {
1460  m_xResolution = xRes; m_yResolution = yRes, m_ResolutionUnits = unit;
1461  }
ResUnit m_ResolutionUnits
units – 1 == inch, 2 == centimeter (same as in PSD files)
Definition: image.h:1366
float m_xResolution
horizontal resolution in pixels per unit
Definition: image.h:1364
float m_yResolution
vertical resolution in pixels per unit
Definition: image.h:1365

Friends And Related Function Documentation

friend class Image
friend

Definition at line 1463 of file image.h.

Member Data Documentation

ImgTile m_Bounds
protected

Bounds of the image – some images may not have a 0,0 origin.

Definition at line 1362 of file image.h.

float m_xResolution
protected

horizontal resolution in pixels per unit

Definition at line 1364 of file image.h.

float m_yResolution
protected

vertical resolution in pixels per unit

Definition at line 1365 of file image.h.

ResUnit m_ResolutionUnits
protected

units – 1 == inch, 2 == centimeter (same as in PSD files)

Definition at line 1366 of file image.h.


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