Terrible Traversals
GradientColorPicker Class Reference

A color picker class using gradient color picking algorithm. More...

#include <GradientColorPicker.h>

Inheritance diagram for GradientColorPicker:
Collaboration diagram for GradientColorPicker:

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

Detailed Description

A color picker class using gradient color picking algorithm.

Constructor & Destructor Documentation

◆ GradientColorPicker()

GradientColorPicker::GradientColorPicker ( HSLAPixel  color1,
HSLAPixel  color2,
Point  center,
unsigned  radius 

GradientColorPicker constructor.

Member Function Documentation

◆ getColor()

HSLAPixel GradientColorPicker::getColor ( unsigned  x,
unsigned  y 

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.

xThe x coordinate to pick a color for.
yThe y coordinate to pick a color for.
The color selected for (x, y).

Implements ColorPicker.

Member Data Documentation

◆ center

Point GradientColorPicker::center

◆ color1

HSLAPixel GradientColorPicker::color1

◆ color2

HSLAPixel GradientColorPicker::color2

◆ radius

unsigned GradientColorPicker::radius

The documentation for this class was generated from the following files: