mp_mosaics
Monstrous Mosaics
MosaicCanvas Class Reference

This is the actual mosaic data-structure which will hold the matrix of sub-images to be written. More...

#include <mosaiccanvas.h>

Collaboration diagram for MosaicCanvas:
[legend]

Public Member Functions

 MosaicCanvas (int theRows, int theColumns)
 Default constructor. More...
 
 MosaicCanvas (const MosaicCanvas &source)
 Copy constructor. More...
 
int getRows () const
 Retrieve the number of rows of images. More...
 
int getColumns () const
 Retrieve the number of columns of images. More...
 
void setTile (int row, int column, TileImage *img)
 Set the TiledImage for a particular region. More...
 
const TileImagegetTile (int row, int column)
 Retrieve the current TileImage for a particular row and column. More...
 
PNG drawMosaic (int pixelsPerTile)
 Save the current MosaicCanvas as a file with the following pixels per tile. More...
 

Static Public Attributes

static bool enableOutput = false
 

Private Member Functions

TileImageimages (int x, int y)
 

Static Private Member Functions

static uint64_t divide (uint64_t a, uint64_t b)
 inline const TileImage& MosaicCanvas::images(int row, int col) const { return myImages[row * columns + col]; } More...
 

Private Attributes

int rows
 Number of image rows in the Mosaic. More...
 
int columns
 Number of image columns in the Mosaic. More...
 
vector< TileImage * > myImages
 The actual matrix of Image data. More...
 

Detailed Description

This is the actual mosaic data-structure which will hold the matrix of sub-images to be written.

This is effectively just a 2-D array of TileImage objects which can be accessed via convenience methods.

Constructor & Destructor Documentation

◆ MosaicCanvas() [1/2]

MosaicCanvas::MosaicCanvas ( int  theRows,
int  theColumns 
)

Default constructor.

Constructor.

Parameters
theRowsNumber of rows to divide the canvas into
theColumnsNumber of columns to divide the canvas into

◆ MosaicCanvas() [2/2]

MosaicCanvas::MosaicCanvas ( const MosaicCanvas source)

Copy constructor.

Parameters
sourceThe MosaicCanvas object to copy

Member Function Documentation

◆ divide()

uint64_t MosaicCanvas::divide ( uint64_t  a,
uint64_t  b 
)
inlinestaticprivate

inline const TileImage& MosaicCanvas::images(int row, int col) const { return myImages[row * columns + col]; }

◆ drawMosaic()

PNG MosaicCanvas::drawMosaic ( int  pixelsPerTile)

Save the current MosaicCanvas as a file with the following pixels per tile.

Parameters
pixelsPerTilepixels per Photomosaic tile
Returns
the Photomosaic as a PNG object

◆ getColumns()

int MosaicCanvas::getColumns ( ) const

Retrieve the number of columns of images.

Returns
The number of columns in the mosaic, or -1 on error
The number of columns in the mosaic, or -1 or error

◆ getRows()

int MosaicCanvas::getRows ( ) const

Retrieve the number of rows of images.

Returns
The number of rows in the mosaic, or -1 on error
The number or rows in the mosaic, or -1 on error

◆ getTile()

const TileImage & MosaicCanvas::getTile ( int  row,
int  column 
)

Retrieve the current TileImage for a particular row and column.

If the row or column is out of bounds, the default TileImage is returned. Note that row and tile indices should be zero-based.

Parameters
rowThe row
columnThe column
Returns
The current TileImage for a particular, or the default TileImage if none is set.

◆ images()

TileImage & MosaicCanvas::images ( int  x,
int  y 
)
inlineprivate

◆ setTile()

void MosaicCanvas::setTile ( int  row,
int  column,
TileImage img 
)

Set the TiledImage for a particular region.

Note that row and tile indices should be zero-based.

Parameters
rowThe row
columnThe column
imgThe TileImage to set
Returns
0 on success, or non-zero otherwise

Member Data Documentation

◆ columns

int MosaicCanvas::columns
private

Number of image columns in the Mosaic.

◆ enableOutput

bool MosaicCanvas::enableOutput = false
static

◆ myImages

vector<TileImage*> MosaicCanvas::myImages
private

The actual matrix of Image data.

◆ rows

int MosaicCanvas::rows
private

Number of image rows in the Mosaic.


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