mp_traversals
Terrible Traversals
|
A color picker class using gradient color picking algorithm. More...
#include <GradientColorPicker.h>
Public Member Functions | |
GradientColorPicker (HSLAPixel color1, HSLAPixel color2, Point center, unsigned radius) | |
GradientColorPicker constructor. More... | |
HSLAPixel | getColor (unsigned x, unsigned y) |
Picks the color for pixel (x, y). More... | |
Public Member Functions inherited from ColorPicker | |
virtual | ~ColorPicker () |
Class destructor. More... | |
Private Attributes | |
HSLAPixel | color1 |
HSLAPixel | color2 |
Point | center |
unsigned | radius |
A color picker class using gradient color picking algorithm.
GradientColorPicker::GradientColorPicker | ( | HSLAPixel | color1, |
HSLAPixel | color2, | ||
Point | center, | ||
unsigned | radius | ||
) |
GradientColorPicker constructor.
|
virtual |
Picks the color for pixel (x, y).
The first color fades into the second color as you move from the initial fill point, the center, to the radius. Beyond the radius, all pixels should be just color2.
You should calculate the distance between two points using the standard euclidean distance formula.
Then, scale each of the three channels (H, S, and L) from color1 to color2 linearly from d = 0 to d = radius.
x | The x coordinate to pick a color for. |
y | The y coordinate to pick a color for. |
Implements ColorPicker.
|
private |
|
private |
|
private |
|
private |