MP5
Photomosaic
|
SourceImage extends the Image class and provides some additional data and functions suitable for the source image for the photomosaic. More...
#include "sourceimage.h"
Public Member Functions | |
SourceImage (const PNG &image, int resolution) | |
Default constructor. More... | |
HSLAPixel | getRegionColor (int row, int col) const |
Get the average color of a particular region. More... | |
int | getRows () const |
Retreive the number of row sub-regions the source image is broken into. More... | |
int | getColumns () const |
Retreive the number of column sub-regions the source image is broken into. More... | |
SourceImage extends the Image class and provides some additional data and functions suitable for the source image for the photomosaic.
The default constructor will take a number of rows and columns to divide the image into. The image will then be processes to find the average color of each region.
SourceImage::SourceImage | ( | const PNG & | image, |
int | resolution | ||
) |
Default constructor.
image | The image data from GraphicsMagick |
resolution | The resolution of the sub-regions. This will be the number of tiles in the larger of the two dimensions of the SourceImage. If the given resolution is greater than the largest dimension of the image, it will be automatically set to the pixel dimensions |
HSLAPixel SourceImage::getRegionColor | ( | int | row, |
int | col | ||
) | const |
Get the average color of a particular region.
Note, the row and column should be specified with a 0-based index. i.e., The top-left corner is (row, column) (0,0).
row | The row of the particular region in the image |
col | The column of the particular region in the image |
int SourceImage::getRows | ( | ) | const |
Retreive the number of row sub-regions the source image is broken into.
int SourceImage::getColumns | ( | ) | const |
Retreive the number of column sub-regions the source image is broken into.