Geometrize  1.0
C++ library for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
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::ShapeResult
step (const geometrize::ImageRunnerOptions &options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator=nullptr, geometrize::core::EnergyFunction energyFunction=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::ImageRunnerImpl
d
 

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

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.
70  :
71  d{std::unique_ptr<ImageRunner::ImageRunnerImpl>(new ImageRunner::ImageRunnerImpl(targetBitmap))}
72 {}
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
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.
74  :
75  d{std::unique_ptr<ImageRunner::ImageRunnerImpl>(new ImageRunner::ImageRunnerImpl(targetBitmap, initialBitmap))}
76 {}
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
geometrize::ImageRunner::~ImageRunner ( )
79 {}
geometrize::ImageRunner::ImageRunner ( const ImageRunner )
delete

Member Function Documentation

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

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

Returns
The current bitmap.
87 {
88  return d->getCurrent();
89 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
const geometrize::Bitmap & geometrize::ImageRunner::getCurrent ( ) const

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

Returns
The current bitmap.
97 {
98  return d->getCurrent();
99 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
geometrize::Model & geometrize::ImageRunner::getModel ( )

getModel Gets the underlying model.

Returns
The model.
107 {
108  return d->getModel();
109 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
geometrize::Bitmap & geometrize::ImageRunner::getTarget ( )

getTarget Gets the target bitmap.

Returns
The target bitmap.
92 {
93  return d->getTarget();
94 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
const geometrize::Bitmap & geometrize::ImageRunner::getTarget ( ) const

getTarget Gets the target bitmap, const-edition.

Returns
The target bitmap.
102 {
103  return d->getTarget();
104 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87
ImageRunner& geometrize::ImageRunner::operator= ( const ImageRunner )
delete
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 
)

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).
Returns
A vector containing data about the shapes just added to the internal model.
82 {
83  return d->step(options, shapeCreator, energyFunction);
84 }
std::unique_ptr< ImageRunner::ImageRunnerImpl > d
Definition: imagerunner.h:87

Member Data Documentation

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

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