-
Notifications
You must be signed in to change notification settings - Fork 0
/
imageTileColorPicker.h
45 lines (40 loc) · 1.26 KB
/
imageTileColorPicker.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
/*
* File: imageTileColorPicker.h
* Definition of an image tile color picker.
*
*/
#ifndef _IMAGETILECOLORPICKER_H_
#define _IMAGETILECOLORPICKER_H_
#include "colorPicker.h"
/*
* imageTileColorPicker: a functor that determines the color that should be used
* given a point using color values from a different image.
*
*/
class ImageTileColorPicker : public ColorPicker
{
public:
/*
* Constructs a new ImageTileColorPicker.
*
* PRE: otherimage has dimensions at least 1x1
* PARAM: otherimage - image from which colors will be taken to draw on mainimage
*/
ImageTileColorPicker(PNG& otherimage);
/*
* Picks the color for pixel (x, y).
* img_other is tiled across the dimensions of img_main, starting at (0,0).
* The color from the tiled image at (x,y) is then selected.
*
* An image tiling looks like the same image repeated over and over again
* in a grid, starting at (0,0).
* You should be able to achieve this effect with some simple arithmetic operations.
*
* PARAM: p - The point for which you're picking a color
* RETURN: The color chosen for (p).
*/
virtual HSLAPixel operator()(PixelPoint p);
private:
PNG img_other; // image from which colors will be taken
};
#endif