PixelDescriptor Class Reference

This reference page is linked to from the following overview topics: Images.



Detailed 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 1067 of file image.h.

#include <image.h>

Inheritance diagram for PixelDescriptor:
Inheritance graph
[legend]

List of all members.

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
int  channelBitSize () const
  return the size of a pixel channel in bits
int  pixelSize () const
  return the size of a pixel in bytes
int  pixelBitSize () const
  return the size of a pixel in bits
ChannelType  channelType () const
  Get the channel type of the image/pixel.
MemoryChannelOrder  channelOrder () const
  Get the channel ordering of the image/pixel.
bool  premultiplied () const
  returns true if the RGB values are premultiplied by the A values, false otherwise.
int  channelCount () const
  return the number of channels -- 1, 3, or 4
bool  operator== (const PixelDescriptor &pd) const
  returns true if the pixel descriptors are equal

Protected Attributes

char  m_cCount
  number of channels in the image -- 1, 3, or 4
ChannelType  m_channelType
  Channel type.
MemoryChannelOrder  m_channelOrder
  channel ordering
bool  m_PreMultiplied
  true if RGB is premultiplied by A

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 1070 of file image.h.

                 {
        uChar   = 0,  
        uShort  = 1,  
        sHalf   = 2,  
        sFloat  = 3,  
        sChar   = 4,  
        sShort  = 5,  
        uInt    = 6,  
        sInt    = 7,  
        sDouble = 8   
    } ChannelType;

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 1085 of file image.h.


Constructor & Destructor Documentation

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

Definition at line 1104 of file image.h.


Member Function Documentation

int channelSize ( ) const [inline]

return the size of a pixel channel in bytes

Definition at line 1114 of file image.h.

                            {
        const unsigned char s_channelByteCount[] = {1, 2, 2, 4, 1, 2, 4, 4, 8};
        return s_channelByteCount[m_channelType];
    }
int channelBitSize ( ) const [inline]

return the size of a pixel channel in bits

Definition at line 1120 of file image.h.

                               {
        return channelSize() * 8;
    }
int pixelSize ( ) const [inline]

return the size of a pixel in bytes

Definition at line 1125 of file image.h.

                          {
        return channelSize() * m_cCount;
    }
int pixelBitSize ( ) const [inline]

return the size of a pixel in bits

Definition at line 1130 of file image.h.

                             {
        return pixelSize() * 8;
    }
ChannelType channelType ( ) const [inline]

Get the channel type of the image/pixel.

Definition at line 1135 of file image.h.

{ return m_channelType; }
MemoryChannelOrder channelOrder ( ) const [inline]

Get the channel ordering of the image/pixel.

Definition at line 1138 of file image.h.

{ return m_channelOrder; }
bool premultiplied ( ) const [inline]

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

Default is true...

Definition at line 1142 of file image.h.

{ return m_PreMultiplied; }
int channelCount ( ) const [inline]

return the number of channels -- 1, 3, or 4

Definition at line 1145 of file image.h.

{ return m_cCount; }
bool operator== ( const PixelDescriptor pd ) const [inline]

returns true if the pixel descriptors are equal

Definition at line 1148 of file image.h.

    { return (m_cCount         == pd.m_cCount        &&
              m_channelType    == pd.m_channelType   &&
              m_channelOrder   == pd.m_channelOrder  &&
              m_PreMultiplied  == pd.m_PreMultiplied);
    }

Member Data Documentation

char m_cCount [protected]

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

Definition at line 1096 of file image.h.

Channel type.

Definition at line 1097 of file image.h.

channel ordering

Definition at line 1098 of file image.h.

bool m_PreMultiplied [protected]

true if RGB is premultiplied by A

Definition at line 1099 of file image.h.


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

PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor
PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor PixelDescriptor