16 size_t nbChannel(color.size());
17 color_t red(0), green(0), blue(0), alpha(0);
19 PString redHex(color.substr(0lu, 2lu));
20 red = (
color_t)strtol(redHex.c_str(), NULL, 16);
23 PString greenHex(color.substr(2lu, 2lu));
24 green = (
color_t)strtol(greenHex.c_str(), NULL, 16);
27 PString blueHex(color.substr(4lu, 2lu));
28 blue = (
color_t)strtol(blueHex.c_str(), NULL, 16);
31 PString alphaHex(color.substr(6lu, 2lu));
32 alpha = (
color_t)strtol(alphaHex.c_str(), NULL, 16);
47 colorValue.
value = value;
76 float ratio((value - colorMin.
value)/(colorMax.
value - colorMin.
value));
78 output.
r = colorMax.
r*ratio + colorMin.
r*(1.0f - ratio);
79 output.
g = colorMax.
g*ratio + colorMin.
g*(1.0f - ratio);
80 output.
b = colorMax.
b*ratio + colorMin.
b*(1.0f - ratio);
81 output.
a = colorMax.
a*ratio + colorMin.
a*(1.0f - ratio);
179 PMapColorValue::const_iterator itMin(
p_mapColor.begin());
180 if(value <= itMin->second.value){
181 output = itMin->second;
184 PMapColorValue::const_reverse_iterator rit(
p_mapColor.rbegin());
185 if(value >= rit->second.value){
186 output = rit->second;
189 PMapColorValue::const_iterator itMax(itMin);
192 if(value > itMin->second.value && value < itMax->second.value){
void getColorValue(color_t &red, color_t &green, color_t &blue, color_t &alpha, const PColorValue &color)
Get the rgba values from PColorValue.
void phoenix_interpolateColor(PColorValue &output, const PColorValue &colorMin, const PColorValue &colorMax, float value)
Interpolate a color with a value by respect to min an max color.
PColorValue createColorValue(float value, const PString &color)
Create a PColorValue.
unsigned char color_t
Type des of a color.
void phoenix_interpolateColor(PColorValue &output, const PColorValue &colorMin, const PColorValue &colorMax, float value)
Interpolate a color with a value by respect to min an max color.
PColorValue createColorValue(float value, const PString &color)
Create a PColorValue.
PMapColorValue p_mapColor
Vector of the value.
void addColor(float value, const PString &color)
Add a color in the PColorMap.
PColorMap()
Default constructor of PColorMap.
void copyPColorMap(const PColorMap &other)
Copy function of PColorMap.
PColorMap & operator=(const PColorMap &other)
Definition of equal operator of PColorMap.
void initialisationPColorMap()
Initialisation function of the class PColorMap.
void interpolate(color_t &red, color_t &green, color_t &blue, float value) const
Interpolate color by respect to the given value.
virtual ~PColorMap()
Destructor of PColorMap.
Color related to a value.
float value
Value of the color.