13#ifndef ML_LUTFLINEAR_H
14#define ML_LUTFLINEAR_H
38 double pos()
const {
return _v[0]; }
43 double r()
const {
return _v[1]; }
45 double g()
const {
return _v[2]; }
47 double b()
const {
return _v[3]; }
49 double a()
const {
return _v[4]; }
79 double &operator [](
int idx) {
86 const double &operator [](
int idx)
const {
92 return this->pos()<p.
pos();
97 return this->pos()>p.
pos();
182 _alphaFactor = factor;
243 template <
typename T>
Helper class that stores a list of typed enum values and their string names.
Untyped base class for LUTData template classes.
A LUTData object stores an instance of a LUT, rendered for a specified visual type,...
A color/gray LUT with sampling points and linear, nearest neighbor or truncated interpolation inbetwe...
virtual double getStartIndex(void) const
Get start index.
void readStateFromTree(TreeNode *parent) override
Reads the object state from the children of the given parent node.
float getAlphaFactor() const
Get the global alpha factor.
const LUTRGBAPoint & getPoint(int idx) const
Get a point at given index.
ColorInterpolation _colorInterpolation
Color interpolation mode.
bool _relativeUsesNativeRange
Flag specifying whether the native index range is used as the range for relative mapping,...
bool isValid(void) const override
Return true if the LUT function is valid.
bool renderLUTRescaled(LUTDataBase *lutData, LUTIteratorBase *lutIterator, double minIndex, double maxIndex) const override
Render rescaled LUT into lutData using lutIterator to access and increment the LUT pointers.
void setAlphaFactor(float factor)
Set the global alpha factor (default is 1.)
bool renderLUTNative(LUTDataBase *lutData, LUTIteratorBase *lutIterator) const override
Render the lookup table into lutData using lutIterator to access and increment the LUT pointers.
const LUTRGBAPointList & getPoints() const
Get sampling point table as a const reference.
void setVisualType(LUTVisualType visualType)
Set the visual type of the table (this affects how the points in the list are handled)
ML_SET_ADDSTATE_VERSION(1)
double getNativeMinIndex(void) const override
Get native minimum index.
void copyPoint(int idx, double *array) const
Copy the point at table index idx to the given array (ordered like in the LUTIterator)
virtual void setColorInterpolation(ColorInterpolation c)
Set color interpolation mode.
virtual bool setPoints(const LUTRGBAPointList &points)
Set table with sampling points, data is copied to internal storage.
virtual double getEndIndex(void) const
Get end index.
void setRelativeUsesNativeRange(bool flag)
Specify whether the native index range (given by the first and last index position in the sampling po...
static EnumValues< ColorInterpolation > getColorInterpolationValues()
Color interpolation values.
virtual ColorInterpolation getColorInterpolation(void) const
Get color interpolation mode.
bool renderLUT(LUTData< T > *lutData, LUTIterator< T > *lutIterator, double startIndex, double endIndex) const
Render the LUT table between startIndex and endIndex into lutData using lutIterator to access and inc...
LUTRGBAPointList & getModifiablePoints()
Get modifiable sampling point table.
LUTRGBAPointList _points
LUT sampling point table.
ML_CLASS_HEADER(LUTFLinear)
LUTFLinear(void)
Constructor.
bool relativeUsesNativeRange() const
Return true if the native index range (given by the first and last index position in the sampling poi...
void addStateToTree(TreeNode *parent) const override
Attaches the object state as children of the given parent node.
double getNativeMaxIndex(void) const override
Get native maximum index.
int insertPoint(const LUTRGBAPoint &point)
Insert a given point and return the resulting index in the sampling point table.
ColorInterpolation
Color interpolation constants.
@ InterpolateHLS
Interpolation in HLS space, closest H direction.
@ InterpolateRGB
Interpolation in RGB space.
@ InterpolateHLSneg
Interpolation in HLS space, negative H direction.
@ InterpolateConstant
Interpolation by floor() truncation.
@ InterpolateSRGB
Convert to linear RGB, interpolate and convert back.
@ InterpolateHLSpos
Interpolation in HLS space, positive H direction.
void setPoint(int idx, const LUTRGBAPoint &point)
Set a point at given index, does not check if position is correct!
void removePoint(int idx)
Remove the point at the given index.
float _alphaFactor
Global alpha factor.
Common base class for lookup tables.
LUT iterator base class with type independent functionality and declarations.
The LUTIterator class template is used by a LUTFunction object for rendering into a LUTData object.
A LUT sampling point with index position and RGBA channel values,.
double r() const
Access the color/alpha components.
double pos() const
Get index position of point.
double l() const
Return luminance (assuming that R == G == B)
void setPos(double posArg)
Set index position of point.
LUTRGBAPoint(double posArg, double rArg, double gArg, double bArg, double aArg)
Explicit value constructor.
void setRGBA(double rArg, double gArg, double bArg, double aArg)
void setRGB(double rArg, double gArg, double bArg)
void setL(double lArg)
Set R, G, B components to luminance l.
LUTRGBAPoint()
Default constructor.
The class TreeNode is the abstract base class for the import/export of ML objects.
#define MLLUT_EXPORT
System specific macro definitions.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
std::vector< LUTRGBAPoint > LUTRGBAPointList
Type definition for a vector of sampling points.
LUTVisualType
LUT visual type constants to identify the visual interpretation of the individual LUT channels.