Mitsuba Renderer  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mitsuba::FormatConverter Class Referenceabstract

Bitmap format conversion helper class. More...

#include <mitsuba/core/bitmap.h>

Public Types

typedef Bitmap::EComponentFormat Format
 
typedef std::pair< Format, FormatConversion
 
typedef std::map< Conversion,
FormatConverter * > 
ConverterMap
 

Public Member Functions

virtual void convert (Bitmap::EPixelFormat sourceFormat, Float sourceGamma, const void *_source, Bitmap::EPixelFormat destFormat, Float destGamma, void *_dest, size_t count, Float multiplier=1.0f, Spectrum::EConversionIntent intent=Spectrum::EReflectance, int channelCount=-1) const =0
 Transform pixels based on the conversion implemented by this class. More...
 
virtual Conversion getConversion () const =0
 Return the format conversion implemented by this FormatConverter instance. More...
 
virtual ~FormatConverter ()
 Virtual destructor to delete instances using pointers to the base type. More...
 

Static Public Member Functions

static const FormatConvertergetInstance (Conversion con)
 Return a FormatConverter instance, which can convert from conv.first to conv.second. More...
 
static void staticInitialization ()
 Execute static initialization code (run once at program startup) More...
 
static void staticShutdown ()
 Release any resources allocated in staticInitialization. More...
 

Detailed Description

Bitmap format conversion helper class.

This class implements efficient conversions between different bitmap component formats. For instance, to transform an 8-bit based image to floating point values, a suitable converter can be obtained as follows:

FormatConverter *cvt = FormatConverter::getInstance(
std::make_pair(Bitmap::EUInt8, Bitmap::EFloat)
);
cvt->convert(...);

The convert methods in Bitmap rely on this class and may be more convenient to use.

Remarks
This is not a color management system. Depending on the target type, out-of-gamut values may be clipped component-wise. If a luminance scale factor is applied, that is also done component-wise (instead of scaling in a space that is based on human perception, such as xyY or CIELab). If this and smarter gamut remapping are needed, a library such as lcms2 will be more appropriate.
See Also
Bitmap::convert(EComponentFormat, Float);
Bitmap::convert(Spectrum *);

Member Typedef Documentation

Constructor & Destructor Documentation

virtual mitsuba::FormatConverter::~FormatConverter ( )
inlinevirtual

Virtual destructor to delete instances using pointers to the base type.

Member Function Documentation

virtual void mitsuba::FormatConverter::convert ( Bitmap::EPixelFormat  sourceFormat,
Float  sourceGamma,
const void *  _source,
Bitmap::EPixelFormat  destFormat,
Float  destGamma,
void *  _dest,
size_t  count,
Float  multiplier = 1.0f,
Spectrum::EConversionIntent  intent = Spectrum::EReflectance,
int  channelCount = -1 
) const
pure virtual

Transform pixels based on the conversion implemented by this class.

Note that the alpha channel is assumed to be linear in both the source and target bitmap, hence it won't be affected by Gamma-related transformations.

Parameters
pixelFormatPixel format of the source bitmap
sourceGammaGamma value associated with pixels from the source bitmap. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB.
sourcePointer to the first pixel of the source bitmap
destFormatPixel format of the destination bitmap
destGammaGamma value associated with pixels from the destination bitmap. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB.
destPointer to the first pixel of the destination bitmap
countHow many pixels should be transformed?
multiplierAn optional multiplicative factor that will be applied to all color/luminance/spectrum values in linear space (alpha and weight values will not be affected).
intentWhen converting from RGB to spectral color values, this flag specifies how ambiguities in this highly under-constrained problem should be resolved.
channelCountNumber of channels (not including a weight channel, if any). Only needs to be specified for general multi-channel images.
See Also
getConversion()
virtual Conversion mitsuba::FormatConverter::getConversion ( ) const
pure virtual

Return the format conversion implemented by this FormatConverter instance.

Returns
A format pair, where the first element indicates the source format, and the second element is the target format.
static const FormatConverter* mitsuba::FormatConverter::getInstance ( Conversion  con)
static

Return a FormatConverter instance, which can convert from conv.first to conv.second.

static void mitsuba::FormatConverter::staticInitialization ( )
static

Execute static initialization code (run once at program startup)

static void mitsuba::FormatConverter::staticShutdown ( )
static

Release any resources allocated in staticInitialization.


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