A utility class for palettes.
More...
#include <Palette.hpp>
|
| typedef util::Color< GLfloat > | Color |
| |
|
| | Palette (std::string filename) |
| | Construct the palette from a file. More...
|
| |
| | Palette () |
| | Construct an empty palette with only black colors. More...
|
| |
| void | reread () |
| | Reread the file describing the palette. More...
|
| |
| Color | getColor (unsigned int index, double alpha=1) const |
| | Get a color from the palette. More...
|
| |
| Color | getColor (unsigned int ind1, unsigned int ind2, double w, double alpha=1) const |
| | Blend two colors in the palette together. More...
|
| |
| void | useColor (unsigned int index, double alpha=1) const |
| | Get a color and make it the current OpenGL color. More...
|
| |
| void | blend (unsigned int ind1, unsigned int ind2, double w, double alpha=1) const |
| | Blend two colors together and make the result the current OpenGL color. More...
|
| |
| void | select (unsigned int start, unsigned int end, double w, double alpha=1) const |
| | Select a color from a range in a palette and make it the current OpenGL color. More...
|
| |
| Color | selectColor (unsigned int start, unsigned int end, double w, double alpha=1) const |
| | Select a color from a range in a palette and returns it. More...
|
| |
A utility class for palettes.
This class provides an interface for VLAB palette files and their use for OpenGL.
Definition at line 23 of file Palette.hpp.
◆ Color
◆ Palette() [1/2]
| util::Palette::Palette |
( |
std::string |
filename | ) |
|
Construct the palette from a file.
- Parameters
-
| filename | File to read the palette from |
◆ Palette() [2/2]
| util::Palette::Palette |
( |
| ) |
|
Construct an empty palette with only black colors.
◆ blend() [1/2]
| static Color util::Palette::blend |
( |
const Color & |
c1, |
|
|
const Color & |
c2, |
|
|
double |
w |
|
) |
| |
|
static |
Blend two colors together.
◆ blend() [2/2]
| void util::Palette::blend |
( |
unsigned int |
ind1, |
|
|
unsigned int |
ind2, |
|
|
double |
w, |
|
|
double |
alpha = 1 |
|
) |
| const |
Blend two colors together and make the result the current OpenGL color.
- Parameters
-
| ind1 | Index of the first color |
| ind2 | Index of the second color |
| w | Blending coefficient, from 0 to 1. The color is linearly interpolated from ind1 to ind2. |
| alpha | Alpha value to use for this color. |
◆ getColor() [1/2]
| Color util::Palette::getColor |
( |
unsigned int |
ind1, |
|
|
unsigned int |
ind2, |
|
|
double |
w, |
|
|
double |
alpha = 1 |
|
) |
| const |
Blend two colors in the palette together.
- Parameters
-
| ind1 | Index of the first color (between 0 and 255) |
| ind2 | Index of the second color (between 0 and 255) |
| w | Blending coefficient, from 0 to 1. The color is linearly interpolated from ind1 to ind2. \parma alpha Alpha value to use for this color (between 0 and 1) |
◆ getColor() [2/2]
| Color util::Palette::getColor |
( |
unsigned int |
index, |
|
|
double |
alpha = 1 |
|
) |
| const |
Get a color from the palette.
- Parameters
-
| index | Index of the color in the palette (between 0 and 255) |
| alpha | Alpha value to use for this color (between 0 and 1) |
◆ reread()
| void util::Palette::reread |
( |
| ) |
|
Reread the file describing the palette.
◆ select()
| void util::Palette::select |
( |
unsigned int |
start, |
|
|
unsigned int |
end, |
|
|
double |
w, |
|
|
double |
alpha = 1 |
|
) |
| const |
Select a color from a range in a palette and make it the current OpenGL color.
- Parameters
-
| start | Index of the first color of the range |
| end | Index of the last color of the range |
| w | Position within the range, if the value correspond to a color in between two defined colors, they will be linearly interpolated. |
| alpha | Alpha value to use for this color. |
◆ selectColor()
| Color util::Palette::selectColor |
( |
unsigned int |
start, |
|
|
unsigned int |
end, |
|
|
double |
w, |
|
|
double |
alpha = 1 |
|
) |
| const |
Select a color from a range in a palette and returns it.
- Parameters
-
| start | Index of the first color of the range |
| end | Index of the last color of the range |
| w | Position within the range, if the value correspond to a color in between two defined colors, they will be linearly interpolated. |
| alpha | Alpha value to use for this color. |
◆ useColor()
| void util::Palette::useColor |
( |
unsigned int |
index, |
|
|
double |
alpha = 1 |
|
) |
| const |
Get a color and make it the current OpenGL color.
- Parameters
-
| index | Index of the color in the palette |
| alpha | Alpha value fo use for this color |
The documentation for this class was generated from the following file: