mp_mosaics
Monstrous Mosaics
SourceImage Class Reference

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...
 
LUVAPixel 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...
 

Static Private Member Functions

static uint64_t divide (uint64_t a, uint64_t b)
 

Private Attributes

PNG backingImage
 
int resolution
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SourceImage()

SourceImage::SourceImage ( const PNG &  image,
int  resolution 
)

Default constructor.

Parameters
imageThe image data from GraphicsMagick
resolutionThe 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

Member Function Documentation

◆ divide()

uint64_t SourceImage::divide ( uint64_t  a,
uint64_t  b 
)
staticprivate

◆ getColumns()

int SourceImage::getColumns ( ) const

Retreive the number of column sub-regions the source image is broken into.

Returns
The number of columns, or -1 if in an invalid state

◆ getRegionColor()

LUVAPixel 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).

Parameters
rowThe row of the particular region in the image
colThe column of the particular region in the image
Returns
The average color of the image

◆ getRows()

int SourceImage::getRows ( ) const

Retreive the number of row sub-regions the source image is broken into.

Returns
The number of rows, or -1 if in an invalid state

Member Data Documentation

◆ backingImage

PNG SourceImage::backingImage
private

◆ resolution

int SourceImage::resolution
private

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