-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolorPicker.h
49 lines (45 loc) · 1.38 KB
/
colorPicker.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
43
44
45
46
47
48
49
/**
* @file colorPicker.h
*
* Definition of a color picker abstract base class.
*
*/
#ifndef COLORPICKER_H
#define COLORPICKER_H
#include "cs221util/PNG.h"
#include "cs221util/HSLAPixel.h"
using namespace cs221util;
/**
* colorPicker: a functor that determines the color that should be used
* given an x and y coordinate.
*
*/
class colorPicker
{
public:
/**
* Destructor: does nothing, but as it is virtual, you may overload it in
* derived classes if needed.
*/
virtual ~colorPicker(){};
/**
* Picks the color for pixel (x, y).
*
* This function **must** be defined in the subclass! It chooses a color for
* the given point (x,y) and returns it.
*
* For example, the gridColorPicker::operator()() function is defined so as
* to return a color if x or y is divisible by the grid spacing, and white
* otherwise. In this way, if you colored each pixel in an image whatever
* color the gridColorPicker chose, you would end up with a grid.
*
* For the other patterns, you will have to figure out how to "pick" the
* colors.
*
* @param x The x coordinate of the pixel we want to pick a color for.
* @param y The y coordinate of the pixel we want to pick a color for.
* @return The color that the pixel at (x, y) should be.
*/
virtual HSLAPixel operator()(int x, int y) = 0;
};
#endif