1 #ifndef TRANSFERFUNCTION_HPP
2 #define TRANSFERFUNCTION_HPP
43 typedef std::vector<std::pair<double, Colorf> >
value_list;
186 void add_rgba_point(
double pos,
Colorf col);
191 void add_hsva_point(
double pos,
Colorf col);
196 void remove_point(
double pos);
202 return values.size();
208 void move_point(
double old_pos,
double new_pos);
213 double next_pos(
double old_pos)
const;
218 double prev_pos(
double old_pos)
const;
221 double operator[](
int i)
const;
228 Colorf rgba_point(
double position)
const;
234 Colorf hsva_point(
double position)
const;
240 Colorf rgba(
double position)
const;
245 Colorf hsva(
double position)
const;
250 double alpha(
double position)
const;
256 return values.empty();
294 void adjust(
double minValue,
double maxValue);
300 return _interpolation;
305 void setInterpolation(Interpolation i);
309 void setPointList(
const value_list& lst);
320 Colorf interpolate(
double position,
double p1,
Colorf col1,
double p2,
Colorf col2)
const;
334 Colorf color(
double position)
const;
341 void add_point(
double pos,
Colorf col);
367 #endif // TRANSFERFUNCTION_HPP
static TransferFunction constant_yellow()
Scale in transparency.
Definition: TransferFunction.hpp:149
static TransferFunction constant_cyan()
Scale in transparency.
Definition: TransferFunction.hpp:155
virtual ~TransferFunction()
Virtual destructor.
Definition: TransferFunction.hpp:64
static TransferFunction constant_blue()
Scale in transparency.
Definition: TransferFunction.hpp:143
static TransferFunction scale_blue()
Scale in blue.
Definition: TransferFunction.hpp:101
static TransferFunction constant_green()
Scale in transparency.
Definition: TransferFunction.hpp:137
bool empty() const
Returns true if no points are defined.
Definition: TransferFunction.hpp:255
static TransferFunction scale_purple()
Scale in purple.
Definition: TransferFunction.hpp:119
std::vector< std::pair< double, Colorf > > value_list
Type of a list of value/colors.
Definition: TransferFunction.hpp:43
static TransferFunction scale_gray()
Scale in gray.
Definition: TransferFunction.hpp:83
static TransferFunction constant_red()
Scale in transparency.
Definition: TransferFunction.hpp:131
key_map keys
Mapping of the position to the index in the value list.
Definition: TransferFunction.hpp:353
static const double epsilon
epsilon used in floating point comparisons
Definition: TransferFunction.hpp:35
size_t size() const
Returns the number of points.
Definition: TransferFunction.hpp:201
Interpolation interpolation() const
Returns the current interpolation mode.
Definition: TransferFunction.hpp:299
static TransferFunction scale_green()
Scale in green.
Definition: TransferFunction.hpp:95
util::Color< float > Colorf
Type of a color.
Definition: TransferFunction.hpp:38
Interpolation
Type of interpolation.
Definition: TransferFunction.hpp:28
static TransferFunction constant_purple()
Scale in transparency.
Definition: TransferFunction.hpp:161
static TransferFunction constant_gray()
Scale in transparency.
Definition: TransferFunction.hpp:125
static TransferFunction scale_yellow()
Scale in yellow.
Definition: TransferFunction.hpp:107
static TransferFunction scale_cyan()
Scale in cyan.
Definition: TransferFunction.hpp:113
static TransferFunction scale_red()
Scale in red.
Definition: TransferFunction.hpp:89
bool clamp
If true, the colors left and right of the defined points are clamped.
Definition: TransferFunction.hpp:359
Defines the Color class template.
Class defining a transfer function as linear interpolation between set values.
Definition: TransferFunction.hpp:23
Interpolation _interpolation
Current interpolation mode.
Definition: TransferFunction.hpp:328
Colorf exteriorColor
Color left and right of the control points if not clamped.
Definition: TransferFunction.hpp:364
QMap< double, int > key_map
Type of the mapping from the position to the index in the value list.
Definition: TransferFunction.hpp:48
value_list values
List of values.
Definition: TransferFunction.hpp:349