MP4
Stacks and Queues
colorPicker Class Referenceabstract

colorPicker: a functor that determines the color that should be used given an x and y coordinate. More...

#include "colorPicker.h"

+ Inheritance diagram for colorPicker:

Public Member Functions

virtual ~colorPicker ()
 Destructor: does nothing, but as it is virtual, you may overload it in derived classes if needed. More...
 
virtual RGBAPixel operator() (int x, int y)=0
 Picks the color for pixel (x, y). More...
 

Detailed Description

colorPicker: a functor that determines the color that should be used given an x and y coordinate.

Author
CS 225 Staff
Date
Fall 2010

Constructor & Destructor Documentation

virtual colorPicker::~colorPicker ( )
inlinevirtual

Destructor: does nothing, but as it is virtual, you may overload it in derived classes if needed.

Member Function Documentation

virtual RGBAPixel colorPicker::operator() ( int  x,
int  y 
)
pure virtual

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.

Parameters
xThe x coordinate of the pixel we want to pick a color for.
yThe y coordinate of the pixel we want to pick a color for.
Returns
The color that the pixel at (x, y) should be.

Implemented in gradientColorPicker, gridColorPicker, solidColorPicker, and rainbowColorPicker.


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