FotoSHOCK
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Static Public Member Functions | List of all members
FotoSHOCKcore::PixelData Class Reference

Class wrapping all pixel related information together. More...

#include <PixelData.hpp>

Public Member Functions

 PixelData ()
 Default constructor. More...
 
 PixelData (ValueType format, ColorSpace colorSpace, cmsHPROFILE profile=0)
 A constructor. More...
 
 PixelData (ValueType format, unsigned int usedBits, int numOfBands, ColorSpace colorSpace, cmsHPROFILE profile=0)
 
void colorSpace (ColorSpace cspace)
 Set the color space. More...
 
const ColorSpacecolorSpace () const
 Color space of an image. More...
 
void format (ValueType format)
 Set data type used for storing pixel data. More...
 
ValueType format () const
 Data type used for storing pixel data. More...
 
void usedBits (unsigned int usedBits)
 Set the number of used bits. More...
 
unsigned int usedBits () const
 The number of bits really used. More...
 
void numOfBands (int numOfBands)
 Set the number of bands (channels). More...
 
int numOfBands () const
 The number of bands present in image. More...
 
cmsUInt32Number cmsFormatter () const
 LittleCMS 2 formatter. More...
 
void cmsProfile (cmsHPROFILE profile)
 Set the LittleCMS 2 profile. More...
 
cmsHPROFILE cmsProfile () const
 Return the LittleCMS 2 profile. More...
 
xmlNodePtr serialize () const
 

Static Public Member Functions

static PixelData deserialize (const xmlNodePtr value)
 

Detailed Description

Class wrapping all pixel related information together.

PixelData class stores all necessary information about pixels in the image at one place.

It is also used to determine supported buffer formats for an operation.

Examples:
graph/example.cpp.

Constructor & Destructor Documentation

FotoSHOCKcore::PixelData::PixelData ( )

Default constructor.

Creates a PixelData object with the following properties:

  • PixelFormat::pixel_uint8 format
  • 8 used bits
  • sRGB colorspace
  • 3 bands
FotoSHOCKcore::PixelData::PixelData ( ValueType  format,
ColorSpace  colorSpace,
cmsHPROFILE  profile = 0 
)

A constructor.

Creates a PixelData object with the specified properties. The properties that are not set by this constructor are set to the default value derived from the passed options.

Parameters
formatthe underlying data type which is used to store pixel values (see ValueTypeEnum for supported formats)
colorSpacecolor space
profileLittleCMS 2 profile. Default value constructs sRGB profile. This is usefull especially when the colorSpace is "RGB", as it's exact behaviour depends on the profile.

Member Function Documentation

cmsUInt32Number FotoSHOCKcore::PixelData::cmsFormatter ( ) const

LittleCMS 2 formatter.

Returns
LittleCMS 2 formater for the PixelData object. This is a complete formatter, including information about the colorspace, number of bands, PixelFormat etc.
void FotoSHOCKcore::PixelData::cmsProfile ( cmsHPROFILE  profile)

Set the LittleCMS 2 profile.

Set the LittleCMS 2 profile. This is usefull especially when RGB is used, because the RGB specifics depends on the profile.

Profiles are closed automatically when they are not needed anymore.

Parameters
profileprofile to use. If profile is 0, sRGB profile is used
cmsHPROFILE FotoSHOCKcore::PixelData::cmsProfile ( ) const

Return the LittleCMS 2 profile.

Returns
LittleCMS 2 profile
void FotoSHOCKcore::PixelData::colorSpace ( ColorSpace  cspace)

Set the color space.

Parameters
cspacecolorspace. "ANY" and "SAME" can be used only to determine the allowed input/output formats in an ImageOperationDescriptor. The meaning is simillar to the PixelFormat::pixel_ANY and PixelFormat::pixel_SAME
const ColorSpace & FotoSHOCKcore::PixelData::colorSpace ( ) const

Color space of an image.

If the pixel has more bands that the colorspace channels, only the first bands are considered. If the pixel doesn't have enough bands, the behavior is undefined.

"ANY" and "SAME" can be used only to determine the allowed input/output formats in an ImageOperationDescriptor. The meaning is simillar to the PixelFormat::pixel_ANY and PixelFormat::pixel_SAME

void FotoSHOCKcore::PixelData::format ( ValueType  format)

Set data type used for storing pixel data.

The type is the same for all bands.

Parameters
formatformat defining the underlying data type for storing pixel values in an image.
ValueType FotoSHOCKcore::PixelData::format ( ) const

Data type used for storing pixel data.

Returns
format defining the underlying data type used for storing pixel values
void FotoSHOCKcore::PixelData::numOfBands ( int  numOfBands)

Set the number of bands (channels).

Parameters
numOfBandsnumber of channels. Values 0 and -1 have special meaning. They are used when specifying the supported formats in an ImageOperationDescriptor. The meaning is following:
  • 0 - operation can process image with arbitrary number of bands
  • -1 - output must have same number of bands as input
Examples:
graph/example.cpp.
int FotoSHOCKcore::PixelData::numOfBands ( ) const

The number of bands present in image.

Specifies how many channels (bands) the image has.

Values 0 and -1 have special meaning. They are used when specifying the supported formats in an image operation. The meaning is following:

  • 0 - operation can process image with arbitrary number of bands
  • -1 - output must have same number of bands as input
void FotoSHOCKcore::PixelData::usedBits ( unsigned int  usedBits)

Set the number of used bits.

This function can be used to specify that only a part of the possible precision for a given PixelFormat is used. Eg. you can use it to tell the application that the data uses only 10 bits of precision, even though they are stored using 16 bits. This is usefull when creating lookup tables (because while 10bit lookup table is viable, but 16bit LUT may be too to be used effectively)

Parameters
usedBitsnumber of bits, that are really used
unsigned int FotoSHOCKcore::PixelData::usedBits ( ) const

The number of bits really used.

Specifies how precise the numbers are. Eg. you can define that you use 10bit data even when format is 16bit. With this knowledge it's possible to construct Lookup tables etc.

Returns
number of used bits

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