-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrainbowColorPicker.h
42 lines (36 loc) · 942 Bytes
/
rainbowColorPicker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef RAINBOWCOLORPICKER_H
#define RAINBOWCOLORPICKER_H
#include <stdint.h>
#include <map>
#include <utility>
#include "colorPicker.h"
/**
* rainbowColorPicker: a functor that determines the color that should be used
* given an x and a y coordinate using a rainbow pattern.
*
*/
class rainbowColorPicker : public colorPicker
{
public:
/**
* Constructs a new rainbowColorPicker.
*
* @param freq_ Frequency at which to cycle colors
*/
rainbowColorPicker(long double freq_);
/**
* Picks the color for pixel (x, y).
*
* @param x The x coordinate to pick a color for.
* @param y The y coordinat to pick a color for.
* @return The color chosen for (x, y).
*/
virtual HSLAPixel operator()(int x, int y);
private:
HSLAPixel nextColor();
typedef std::map<std::pair<int, int>, HSLAPixel> PNGmap;
size_t iter;
PNGmap prev;
long double freq;
};
#endif