Geometrize 1.0
C++ library for geometrizing images into geometric primitives
Classes | Public Member Functions | Private Attributes | List of all members
geometrize::ImageRunner Class Reference

The ImageRunner class is a helper class for creating a set of primitives from a source image. More...

#include <imagerunner.h>

Classes

class  ImageRunnerImpl
 

Public Member Functions

 ImageRunner (const geometrize::Bitmap &targetBitmap)
 ImageRunner Creates an new image runner with the given target bitmap. Uses the average color of the target as the starting image. More...
 
 ImageRunner (const geometrize::Bitmap &targetBitmap, const geometrize::Bitmap &initialBitmap)
 ImageRunner Creates an image runner with the given target bitmap, starting from the given initial bitmap. The target bitmap and initial bitmap must be the same size (width and height). More...
 
 ~ImageRunner ()
 
ImageRunneroperator= (const ImageRunner &)=delete
 
 ImageRunner (const ImageRunner &)=delete
 
std::vector< geometrize::ShapeResultstep (const geometrize::ImageRunnerOptions &options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator=nullptr, geometrize::core::EnergyFunction energyFunction=nullptr, geometrize::ShapeAcceptancePreconditionFunction addShapePrecondition=nullptr)
 step Updates the internal model once. More...
 
geometrize::BitmapgetCurrent ()
 getCurrent Gets the current bitmap with the primitives drawn on it. More...
 
geometrize::BitmapgetTarget ()
 getTarget Gets the target bitmap. More...
 
const geometrize::BitmapgetCurrent () const
 getCurrent Gets the current bitmap with the primitives drawn on it, const-edition. More...
 
const geometrize::BitmapgetTarget () const
 getTarget Gets the target bitmap, const-edition. More...
 
geometrize::ModelgetModel ()
 getModel Gets the underlying model. More...
 

Private Attributes

std::unique_ptr< ImageRunner::ImageRunnerImpld
 

Detailed Description

The ImageRunner class is a helper class for creating a set of primitives from a source image.

Author
Sam Twidale (https://samcodes.co.uk/)

Constructor & Destructor Documentation

◆ ImageRunner() [1/3]

geometrize::ImageRunner::ImageRunner ( const geometrize::Bitmap targetBitmap)

ImageRunner Creates an new image runner with the given target bitmap. Uses the average color of the target as the starting image.

Parameters
targetBitmapThe target bitmap to replicate with shapes.
73 :
74 d{std::unique_ptr<ImageRunner::ImageRunnerImpl>(new ImageRunner::ImageRunnerImpl(targetBitmap))}
75{}
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:90

◆ ImageRunner() [2/3]

geometrize::ImageRunner::ImageRunner ( const geometrize::Bitmap targetBitmap,
const geometrize::Bitmap initialBitmap 
)

ImageRunner Creates an image runner with the given target bitmap, starting from the given initial bitmap. The target bitmap and initial bitmap must be the same size (width and height).

Parameters
targetBitmapThe target bitmap to replicate with shapes.
initialBitmapThe starting bitmap.
77 :
78 d{std::unique_ptr<ImageRunner::ImageRunnerImpl>(new ImageRunner::ImageRunnerImpl(targetBitmap, initialBitmap))}
79{}

◆ ~ImageRunner()

geometrize::ImageRunner::~ImageRunner ( )
82{}

◆ ImageRunner() [3/3]

geometrize::ImageRunner::ImageRunner ( const ImageRunner )
delete

Member Function Documentation

◆ getCurrent() [1/2]

geometrize::Bitmap & geometrize::ImageRunner::getCurrent ( )

getCurrent Gets the current bitmap with the primitives drawn on it.

Returns
The current bitmap.
93{
94 return d->getCurrent();
95}

◆ getCurrent() [2/2]

const geometrize::Bitmap & geometrize::ImageRunner::getCurrent ( ) const

getCurrent Gets the current bitmap with the primitives drawn on it, const-edition.

Returns
The current bitmap.
103{
104 return d->getCurrent();
105}

◆ getModel()

geometrize::Model & geometrize::ImageRunner::getModel ( )

getModel Gets the underlying model.

Returns
The model.
113{
114 return d->getModel();
115}

◆ getTarget() [1/2]

geometrize::Bitmap & geometrize::ImageRunner::getTarget ( )

getTarget Gets the target bitmap.

Returns
The target bitmap.
98{
99 return d->getTarget();
100}

◆ getTarget() [2/2]

const geometrize::Bitmap & geometrize::ImageRunner::getTarget ( ) const

getTarget Gets the target bitmap, const-edition.

Returns
The target bitmap.
108{
109 return d->getTarget();
110}

◆ operator=()

ImageRunner & geometrize::ImageRunner::operator= ( const ImageRunner )
delete

◆ step()

std::vector< geometrize::ShapeResult > geometrize::ImageRunner::step ( const geometrize::ImageRunnerOptions options,
std::function< std::shared_ptr< geometrize::Shape >()>  shapeCreator = nullptr,
geometrize::core::EnergyFunction  energyFunction = nullptr,
geometrize::ShapeAcceptancePreconditionFunction  addShapePrecondition = nullptr 
)

step Updates the internal model once.

Parameters
optionsVarious configurable settings for doing the step e.g. the shape types to consider.
shapeCreatorAn optional function for creating and mutating shapes
energyFunctionAn optional function to calculate the energy (if unspecified a default implementation is used).
addShapePreconditionAn optional function to determine whether to accept a shape (if unspecified a default implementation is used).
Returns
A vector containing data about the shapes just added to the internal model.
88{
89 return d->step(options, shapeCreator, energyFunction, addShapePrecondition);
90}

Member Data Documentation

◆ d

std::unique_ptr<ImageRunner::ImageRunnerImpl> geometrize::ImageRunner::d
private

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