13#ifndef ML_LUTITERATOR_H
14#define ML_LUTITERATOR_H
57 bool isValid (
void)
const {
return _valid; }
72 inline int operator () (
void)
const {
return _index; }
75 int getRow (
void)
const {
return _row; }
81 inline bool atEnd (
void)
const {
return _index >= _width; }
99 enum ConvMethod { CONV_NONE = 0, CONV_L_TO_RGB, CONV_RGB_TO_L } _convMethodId;
154 inline void operator ++ (
void) { ++_index; (this->*_inc)(); }
170 void inc1 (
void) { chn[0] += _dpLut; }
171 void inc2 (
void) { chn[0] += _dpLut; chn[1] += _dpLut; }
172 void inc3 (
void) { chn[0] += _dpLut; chn[1] += _dpLut; chn[2] += _dpLut; }
173 void inc4 (
void) { chn[0] += _dpLut; chn[1] += _dpLut; chn[2] += _dpLut; chn[3] += _dpLut; }
174 void inc5 (
void) { chn[0] += _dpLut; chn[3] += _dpLut; }
182 static_cast<double>(*chn[
G]),
183 static_cast<double>(*chn[
B]))); }
187 void convertAndInc (
void) { (this->*_incConvert)(); (this->*_incPointers)(); }
194 IncrementFnc
_inc, _incConvert, _incPointers;
243 _incConvert =
nullptr;
244 _incPointers =
nullptr;
253 _dummy =
new T[MAX_CHANNELS];
254 chn =
new T* [MAX_CHANNELS];
255 for (
int i = 0;
i < MAX_CHANNELS;
i++)
267 switch (_convMethodId)
269 case CONV_NONE:
break;
272 default: _valid =
false;
275 switch (_incMethodId)
282 default: _valid =
false;
299 switch (
lutData.getVisualType())
310 default: _valid =
false;
314 default: _valid =
false;
A LUTData object stores an instance of a LUT, rendered for a specified visual type,...
LUT iterator base class with type independent functionality and declarations.
ConvMethod
Conversion method id.
virtual ~LUTIteratorBase()
Destructor (declared here to make it virtual)
int _incMethodId
Pointer increment method id (= number of channel pointers to increment)
bool _valid
Iterator valid flag.
bool alphaNeedsInit(void) const
Alpha channel needs initialization.
int getWidth(void) const
Get LUT width.
LUTVisualType getTargetType(void) const
Get visual type used for storing (target type)
LUTVisualType _vtFrom
Source visual type, used by the LUT being rendered.
int getLayer(void) const
Get current layer.
int _width
Width of LUTData object.
bool isValid(void) const
Is iterator valid?
bool _initAlpha
Alpha channel needs initialization.
LUTIteratorBase(LUTVisualType vtFrom, LUTVisualType vtTo, int width, int row, int layer)
Constructor (protected, class can only be used by derived classes)
LUTVisualType getSourceType(void) const
Get visual type used for rendering (source type)
int getRow(void) const
Get current row.
LUTVisualType _vtTo
Target visual type, used by the LUTData object storing the rendered LUT.
int getNumChannels(void) const
Get number of (source) channels.
bool atEnd(void) const
End of index range reached?
The LUTIterator class template is used by a LUTFunction object for rendering into a LUTData object.
void convertLtoRGB(void)
Convert Luminance to RGB.
IncrementFnc _inc
Increment method pointers.
void clear(void)
Clean up.
T * _dummy
Dummy channel entries.
LUTIterator(LUTVisualType visualType, LUTData< T > &lutData)
Constructor for addressing a 1D-LUT visualType is the type of the LUT being rendered,...
T ** chn
Channel pointer array.
void convertAndInc(void)
Increment method including conversion.
~LUTIterator() override
Destructor.
void inc1(void)
! Increment methods
void convertRGBtoL(void)
Convert RGB to Luminance.
int _dpLut
Pointer increment.
void init(LUTData< T > &lutData)
Initialize.
#define MLLUT_EXPORT
System specific macro definitions.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLLUT_EXPORT double LUTConvertRGBtoL(double r, double g, double b)
Convert RGB to luminance.
MLLUT_EXPORT int LUTNumberOfChannels(LUTVisualType visualType)
Get number of channels for given LUTVisualType, or 0 if unknown.
LUTVisualType
LUT visual type constants to identify the visual interpretation of the individual LUT channels.
@ LUT_ABGR
Alpha, Blue, Green, Red.
@ LUT_BGR
Blue, Green, Red.
@ LUT_RGBA
Red, Green, Blue, Alpha.
@ LUT_LA
Luminance and Alpha.
@ LUT_RGB
Red, Green, Blue.
MLLUT_EXPORT int LUTAlphaChannelIndex(LUTVisualType visualType)
Get index of alpha channel, or -1 if none.
MLLUT_EXPORT LUTVisualType LUTReducedVisualType(LUTVisualType visualType)
Get reduced visual type, i.e. ignoring layout variants.