PhoenixPNG  0.1.0
Set of tools to ease use of png file
Loading...
Searching...
No Matches
PColorMap.h
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#ifndef __PCOLORMAP_H__
8#define __PCOLORMAP_H__
9
10#include <map>
11#include "PString.h"
12
14typedef unsigned char color_t;
15
29
31typedef std::map<float, PColorValue> PMapColorValue;
32
33PColorValue createColorValue(float value, const PString & color);
34PColorValue createColorValue(float value, color_t red, color_t green, color_t blue, color_t alpha = 255);
35void getColorValue(color_t & red, color_t & green, color_t & blue, color_t & alpha, const PColorValue & color);
36
39 public:
40 PColorMap();
41 PColorMap(const PColorMap & other);
42 virtual ~PColorMap();
43 PColorMap & operator = (const PColorMap & other);
44
45 void addColor(float value, const PString & color);
46 void addColor(float value, color_t red, color_t green, color_t blue, color_t alpha = 255);
47
48 void interpolate(color_t & red, color_t & green, color_t & blue, float value) const;
49 void interpolate(color_t & red, color_t & green, color_t & blue, color_t & alpha, float value) const;
50 void interpolate(PColorValue & output, float value) const;
51
52 protected:
53 void copyPColorMap(const PColorMap & other);
54
55 private:
59};
60
61void phoenix_interpolateColor(PColorValue & output, const PColorValue & colorMin, const PColorValue & colorMax, float value);
62PColorValue phoenix_interpolateColor(const PColorValue & colorMin, const PColorValue & colorMax, float value);
63
64#endif
65
unsigned char color_t
Type des of a color.
Definition PColorMap.h:14
void getColorValue(color_t &red, color_t &green, color_t &blue, color_t &alpha, const PColorValue &color)
Get the rgba values from PColorValue.
Definition PColorMap.cpp:62
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.
Definition PColorMap.cpp:75
PColorValue createColorValue(float value, const PString &color)
Create a PColorValue.
Definition PColorMap.cpp:15
std::map< float, PColorValue > PMapColorValue
Vector of a color value.
Definition PColorMap.h:31
PMapColorValue p_mapColor
Vector of the value.
Definition PColorMap.h:58
void addColor(float value, const PString &color)
Add a color in the PColorMap.
PColorMap()
Default constructor of PColorMap.
Definition PColorMap.cpp:97
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.
Definition PColorMap.h:17
color_t r
Red channel.
Definition PColorMap.h:21
color_t g
Green channel.
Definition PColorMap.h:23
float value
Value of the color.
Definition PColorMap.h:19
color_t a
Alpha channel.
Definition PColorMap.h:27
color_t b
Blue channel.
Definition PColorMap.h:25