![]() |
Public API Reference |
A simple color gradient. More...
#include <csgfx/gradient.h>
Public Member Functions | |
| void | Clear () |
| Clear all shades. | |
| csGradient () | |
| Construct an empty gradient. | |
| csGradient (csColor4 first, csColor4 last) | |
Construct with first at position 0 and last at 1. | |
| csPtr< iGradientShades > | GetShades () |
| Get the array of shades. | |
| bool | Render (csRGBcolor *pal, size_t count, float begin=0.0f, float end=1.0f) const |
| Interpolate the colors over a part of the gradient. | |
| bool | Render (csRGBpixel *pal, size_t count, float begin=0.0f, float end=1.0f) const |
| Interpolate the colors over a part of the gradient. | |
| void | AddShade (const csGradientShade &shade) |
| Add a shade. | |
| void | AddShade (const csColor4 &color, float position) |
| Add a shade. | |
| void | AddShade (const csColor4 &left, const csColor4 &right, float position) |
| Add a shade. | |
Protected Attributes | |
| csArray< csGradientShade > | shades |
| The entries in this gradient. | |
A simple color gradient.
If you ever have worked with an image creation/manipulation program with a slightly higher niveau than Windows Paint then you probably know what this is.
Colors(here called 'shades') can be placed at arbitrary positions; although commonly a range of [0;1] is used, negative positions and positions larger than 1 are supported.
Shades contain actually two colors, a 'left' and 'right' one. You can think of this as, when approaching from one side, you'll get closer and closer to the respective color. If you step over a shade, you have the other color, but you're getting farther and farther from it (and towards the next color) when moving on. This feature can be used for sharp transitions; for smooth ones they are simply set to the same value.
For some examples see the iGradient documentation.
Definition at line 57 of file gradient.h.
Construct an empty gradient.
| csGradient::csGradient | ( | csColor4 | first, |
| csColor4 | last | ||
| ) |
Construct with first at position 0 and last at 1.
| void csGradient::AddShade | ( | const csGradientShade & | shade | ) | [virtual] |
| void csGradient::AddShade | ( | const csColor4 & | color, |
| float | position | ||
| ) | [virtual] |
| void csGradient::AddShade | ( | const csColor4 & | left, |
| const csColor4 & | right, | ||
| float | position | ||
| ) | [virtual] |
| void csGradient::Clear | ( | ) | [virtual] |
Clear all shades.
Implements iGradient.
| csPtr<iGradientShades> csGradient::GetShades | ( | ) | [virtual] |
Get the array of shades.
Implements iGradient.
| bool csGradient::Render | ( | csRGBcolor * | pal, |
| size_t | count, | ||
| float | begin = 0.0f, |
||
| float | end = 1.0f |
||
| ) | const [virtual] |
Interpolate the colors over a part of the gradient.
| pal | Array of csRGBcolor the gradient should be rendered to. |
| count | Number of palette entries to render. |
| begin | Start position. Can be anywhere in the gradient. |
| end | End position. Can be anywhere in the gradient. |
begin doesn't have to be smaller than end. begin and end can both lie completely 'outside' the gradient (i.e. both smaller/large than the first resp. last shade's position.) Implements iGradient.
| bool csGradient::Render | ( | csRGBpixel * | pal, |
| size_t | count, | ||
| float | begin = 0.0f, |
||
| float | end = 1.0f |
||
| ) | const [virtual] |
Interpolate the colors over a part of the gradient.
| pal | Array of csRGBpixel the gradient should be rendered to. |
| count | Number of palette entries to render. |
| begin | Start position. Can be anywhere in the gradient. |
| end | End position. Can be anywhere in the gradient. |
begin doesn't have to be smaller than end. begin and end can both lie completely 'outside' the gradient (i.e. both smaller/large than the first resp. last shade's position.) Implements iGradient.
csArray<csGradientShade> csGradient::shades [protected] |
The entries in this gradient.
Definition at line 62 of file gradient.h.