PixelDescriptor Class Reference

#include <image.h>

Class Description

Describe an image pixel; how to interpret a piece of pixel data.

Note
The internal format preferred by MudBox is always PreMultiplied.

When you provide image data to these Image classes, it will be converted to the preferred internal representation as specified above. When image data is queried, it will almost always be returned in the preferred internal channel ordering, and will always be returned PreMultiplied.

Definition at line 1255 of file image.h.

+ Inheritance diagram for PixelDescriptor:

Public Types

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

 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

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...
 

Member Enumeration Documentation

Describe the data type of a single channel of a pixel.

Enumerator
uChar 

unsigned 8 bit char

uShort 

unsigned 16 bit short.

sHalf 

S10E5 half precision floating point.

sFloat 

IEEE754 single precision.

sChar 

signed 8 bit char (not currently supported)

sShort 

signed 16 bit short (not currently supported)

uInt 

unsigned 32 bit int (not currently supported)

sInt 

signed 32 bit int (not currently supported)

sDouble 

IEEE754 double precision (not currently supported)

Definition at line 1258 of file image.h.

1258  {
1259  uChar = 0,
1260  uShort = 1,
1261  sHalf = 2,
1262  sFloat = 3,
1264  sChar = 4,
1265  sShort = 5,
1266  uInt = 6,
1267  sInt = 7,
1268  sDouble = 8
1269  } ChannelType;
IEEE754 single precision.
Definition: image.h:1262
S10E5 half precision floating point.
Definition: image.h:1261
IEEE754 double precision (not currently supported)
Definition: image.h:1268
unsigned 32 bit int (not currently supported)
Definition: image.h:1266
signed 32 bit int (not currently supported)
Definition: image.h:1267
ChannelType
Describe the data type of a single channel of a pixel.
Definition: image.h:1258
unsigned 16 bit short.
Definition: image.h:1260
signed 16 bit short (not currently supported)
Definition: image.h:1265
signed 8 bit char (not currently supported)
Definition: image.h:1264
unsigned 8 bit char
Definition: image.h:1259

Describe channel ordering for 4 channel images – these are the order of the channels in memory, not in registers or uInts.

Enumerator
orderNONE 

This is invalid for 4 channel images – used for 1 channel.

orderRGBA 

standard RGBA

orderABGR 

reverse of RGBA

orderBGRA 

Optimal ordering on windows & Mac.

orderARGB 

Reverse of BGRA.

orderRGB 

RGB – for 3 channel images.

orderBGR 

Reverse of RGB for 3 channel images.

Definition at line 1273 of file image.h.

1273  {
1274  orderNONE = 0,
1275  orderRGBA = 1,
1276  orderABGR = 2,
1277  orderBGRA = 3,
1278  orderARGB = 4,
1279  orderRGB = 5,
1280  orderBGR = 6
MemoryChannelOrder
Describe channel ordering for 4 channel images – these are the order of the channels in memory...
Definition: image.h:1273
Reverse of RGB for 3 channel images.
Definition: image.h:1280
RGB – for 3 channel images.
Definition: image.h:1279
Optimal ordering on windows & Mac.
Definition: image.h:1277
This is invalid for 4 channel images – used for 1 channel.
Definition: image.h:1274

Constructor & Destructor Documentation

PixelDescriptor ( char  cCount,
ChannelType  channelType,
MemoryChannelOrder  channelOrder,
bool  PreMultiplied 
)
inline

Definition at line 1292 of file image.h.

1296  : m_cCount (cCount)
1299  , m_PreMultiplied(PreMultiplied) {}
bool m_PreMultiplied
true if RGB is premultiplied by A
Definition: image.h:1287
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
ChannelType m_channelType
Channel type.
Definition: image.h:1285
ChannelType channelType() const
Get the channel type of the image/pixel.
Definition: image.h:1323
MemoryChannelOrder channelOrder() const
Get the channel ordering of the image/pixel.
Definition: image.h:1326
MemoryChannelOrder m_channelOrder
channel ordering
Definition: image.h:1286

Member Function Documentation

int channelSize ( ) const
inline

return the size of a pixel channel in bytes

Definition at line 1302 of file image.h.

1302  {
1303  static const unsigned char s_channelByteCount[] = {1, 2, 2, 4, 1, 2, 4, 4, 8};
1304  return s_channelByteCount[m_channelType];
1305  }
ChannelType m_channelType
Channel type.
Definition: image.h:1285
int channelBitSize ( ) const
inline

return the size of a pixel channel in bits

Definition at line 1308 of file image.h.

1308  {
1309  return channelSize() * 8;
1310  }
int channelSize() const
return the size of a pixel channel in bytes
Definition: image.h:1302
int pixelSize ( ) const
inline

return the size of a pixel in bytes

Definition at line 1313 of file image.h.

1313  {
1314  return channelSize() * m_cCount;
1315  }
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
int channelSize() const
return the size of a pixel channel in bytes
Definition: image.h:1302
int pixelBitSize ( ) const
inline

return the size of a pixel in bits

Definition at line 1318 of file image.h.

1318  {
1319  return pixelSize() * 8;
1320  }
int pixelSize() const
return the size of a pixel in bytes
Definition: image.h:1313
ChannelType channelType ( ) const
inline

Get the channel type of the image/pixel.

Definition at line 1323 of file image.h.

1323 { return m_channelType; }
ChannelType m_channelType
Channel type.
Definition: image.h:1285
MemoryChannelOrder channelOrder ( ) const
inline

Get the channel ordering of the image/pixel.

Definition at line 1326 of file image.h.

1326 { return m_channelOrder; }
MemoryChannelOrder m_channelOrder
channel ordering
Definition: image.h:1286
bool premultiplied ( ) const
inline

returns true if the RGB values are premultiplied by the A values, false otherwise.

Default is true...

Definition at line 1330 of file image.h.

1330 { return m_PreMultiplied; }
bool m_PreMultiplied
true if RGB is premultiplied by A
Definition: image.h:1287
int channelCount ( ) const
inline

return the number of channels – 1, 2, 3, or 4

Definition at line 1333 of file image.h.

1333 { return m_cCount; }
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
void setChannelCount ( int  c)
inline

set the number of channels – 1, 2, 3, or 4

Definition at line 1336 of file image.h.

1336 { m_cCount = c; }
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
const GLubyte * c
Definition: GLee.h:5419
bool operator== ( const PixelDescriptor pd) const
inline

returns true if the pixel descriptors are equal

Definition at line 1339 of file image.h.

1340  { return (m_cCount == pd.m_cCount &&
1341  m_channelType == pd.m_channelType &&
1342  m_channelOrder == pd.m_channelOrder &&
1343  m_PreMultiplied == pd.m_PreMultiplied);
1344  }
bool m_PreMultiplied
true if RGB is premultiplied by A
Definition: image.h:1287
char m_cCount
number of channels in the image – 1, 3, or 4
Definition: image.h:1284
ChannelType m_channelType
Channel type.
Definition: image.h:1285
MemoryChannelOrder m_channelOrder
channel ordering
Definition: image.h:1286

Member Data Documentation

char m_cCount
protected

number of channels in the image – 1, 3, or 4

Definition at line 1284 of file image.h.

ChannelType m_channelType
protected

Channel type.

Definition at line 1285 of file image.h.

MemoryChannelOrder m_channelOrder
protected

channel ordering

Definition at line 1286 of file image.h.

bool m_PreMultiplied
protected

true if RGB is premultiplied by A

Definition at line 1287 of file image.h.


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