Bitmap format conversion helper class. More...
#include <mitsuba/core/bitmap.h>
Public Types | |
typedef Bitmap::EComponentFormat | Format |
typedef std::pair< Format, Format > | Conversion |
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 FormatConverter * | getInstance (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... | |
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:
The convert
methods in Bitmap rely on this class and may be more convenient to use.
typedef std::pair<Format, Format> mitsuba::FormatConverter::Conversion |
typedef std::map<Conversion, FormatConverter *> mitsuba::FormatConverter::ConverterMap |
|
inlinevirtual |
Virtual destructor to delete instances using pointers to the base type.
|
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.
pixelFormat | Pixel format of the source bitmap |
sourceGamma | Gamma value associated with pixels from the source bitmap. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB. |
source | Pointer to the first pixel of the source bitmap |
destFormat | Pixel format of the destination bitmap |
destGamma | Gamma value associated with pixels from the destination bitmap. Special values: 1.0 denotes a linear space, and -1.0 corresponds to sRGB. |
dest | Pointer to the first pixel of the destination bitmap |
count | How many pixels should be transformed? |
multiplier | An optional multiplicative factor that will be applied to all color/luminance/spectrum values in linear space (alpha and weight values will not be affected). |
intent | When converting from RGB to spectral color values, this flag specifies how ambiguities in this highly under-constrained problem should be resolved. |
channelCount | Number of channels (not including a weight channel, if any). Only needs to be specified for general multi-channel images. |
|
pure virtual |
Return the format conversion implemented by this FormatConverter
instance.
|
static |
Return a FormatConverter instance, which can convert from conv.first
to conv.second
.
|
static |
Execute static initialization code (run once at program startup)
|
static |
Release any resources allocated in staticInitialization.