Geometrize  1.0
An application for geometrizing images into geometric primitives
Classes | Signals | Public Member Functions | Private Member Functions | Private Attributes | List of all members
geometrize::task::ImageTask Class Reference

The ImageTask class transforms a source image into a collection of shapes approximating the source image. More...

#include <imagetask.h>

Inheritance diagram for geometrize::task::ImageTask:
Inheritance graph
[legend]
Collaboration diagram for geometrize::task::ImageTask:
Collaboration graph
[legend]

Classes

class  ImageTaskImpl
 

Signals

void signal_step (geometrize::ImageRunnerOptions options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator, geometrize::core::EnergyFunction energyFunction, geometrize::ShapeAcceptancePreconditionFunction addShapePrecondition)
 signal_step Signal that the image task emits to make the internal model step. More...
 
void signal_drawShape (std::shared_ptr< geometrize::Shape > shape, geometrize::rgba color)
 signal_drawShape Signal that the image task emits to draw a shape to the internal model. More...
 
void signal_modelWillStep ()
 signal_modelWillStep Signal that is emitted immediately before the underlying image task model is stepped. More...
 
void signal_modelDidStep (std::vector< geometrize::ShapeResult > shapes)
 signal_modelDidStep Signal that is emitted immediately after the underlying image task model is stepped. More...
 
void signal_preferencesSet ()
 signal_preferencesSet Signal that is emitted immediately after the image task preferences are set. More...
 

Public Member Functions

 ImageTask (Bitmap &target, Qt::ConnectionType workerConnectionType=Qt::QueuedConnection)
 
 ImageTask (Bitmap &target, Bitmap &background, Qt::ConnectionType workerConnectionType=Qt::QueuedConnection)
 
 ImageTask (const std::string &displayName, Bitmap &bitmap, Qt::ConnectionType workerConnectionType=Qt::QueuedConnection)
 
 ImageTask (const std::string &displayName, Bitmap &bitmap, const Bitmap &initial, Qt::ConnectionType workerConnectionType=Qt::QueuedConnection)
 
ImageTaskoperator= (const ImageTask &)=delete
 
 ImageTask (const ImageTask &)=delete
 
virtual ~ImageTask ()
 
geometrize::script::GeometrizerEnginegetGeometrizer ()
 getGeometrizer Gets a reference to the script-based engine used to turn images into shapes. More...
 
Bitmap & getTargetMutable ()
 getTarget Gets the target bitmap, non-const edition. More...
 
Bitmap & getCurrentMutable ()
 getCurrent Gets the current bitmap, non-const edition. More...
 
const Bitmap & getTarget () const
 getTarget Gets the target bitmap, const-edition. More...
 
const Bitmap & getCurrent () const
 getCurrent Gets the current bitmap, const-edition. More...
 
std::uint32_t getWidth () const
 getWidth Gets the width of the images used by the image task. More...
 
std::uint32_t getHeight () const
 getHeight Gets the height of the images used by the image task. More...
 
std::string getDisplayName () const
 getDisplayName Gets the display name of the image task. More...
 
std::size_t getTaskId () const
 getTaskId Gets the unique id of the image task. More...
 
bool isStepping () const
 isStepping Returns true if the internal model is currently stepping. More...
 
void stepModel ()
 stepModel Steps the internal model, typically adding a shape. More...
 
void drawShape (const std::shared_ptr< geometrize::Shape > shape, geometrize::rgba color)
 drawShape Draws a shape with the given color to the internal model. More...
 
void drawBackgroundRectangle (geometrize::rgba color)
 drawBackgroundRectangle Convenience function that draws a background rectangle shape. More...
 
geometrize::preferences::ImageTaskPreferencesgetPreferences ()
 getPreferences Gets a reference to the current preferences of this task. More...
 
void setPreferences (preferences::ImageTaskPreferences preferences)
 setPreferences Sets the preferences for this task. More...
 

Private Member Functions

void modelWillStep ()
 
void modelDidStep (std::vector< geometrize::ShapeResult > shapes)
 

Private Attributes

std::unique_ptr< ImageTaskImpld
 

Detailed Description

The ImageTask class transforms a source image into a collection of shapes approximating the source image.

Constructor & Destructor Documentation

◆ ImageTask() [1/5]

geometrize::task::ImageTask::ImageTask ( Bitmap &  target,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
298  : QObject(),
299  d{std::make_unique<ImageTask::ImageTaskImpl>(this, "", target, workerConnectionType)}
300 {
301 }

◆ ImageTask() [2/5]

geometrize::task::ImageTask::ImageTask ( Bitmap &  target,
Bitmap &  background,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
303  : QObject(),
304  d{std::make_unique<ImageTask::ImageTaskImpl>(this, "", target, background, workerConnectionType)}
305 {
306 }

◆ ImageTask() [3/5]

geometrize::task::ImageTask::ImageTask ( const std::string &  displayName,
Bitmap &  bitmap,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
308  : QObject(),
309  d{std::make_unique<ImageTask::ImageTaskImpl>(this, displayName, bitmap, workerConnectionType)}
310 {
311 }

◆ ImageTask() [4/5]

geometrize::task::ImageTask::ImageTask ( const std::string &  displayName,
Bitmap &  bitmap,
const Bitmap &  initial,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
313  : QObject(),
314  d{std::make_unique<ImageTask::ImageTaskImpl>(this, displayName, bitmap, initial, workerConnectionType)}
315 {
316 }

◆ ImageTask() [5/5]

geometrize::task::ImageTask::ImageTask ( const ImageTask )
delete

◆ ~ImageTask()

geometrize::task::ImageTask::~ImageTask ( )
virtual
319 {
320 }

Member Function Documentation

◆ drawBackgroundRectangle()

void geometrize::task::ImageTask::drawBackgroundRectangle ( geometrize::rgba  color)

drawBackgroundRectangle Convenience function that draws a background rectangle shape.

Parameters
colorThe color of the background rectangle.
378 {
379  d->drawBackgroundRectangle(color);
380 }

◆ drawShape()

void geometrize::task::ImageTask::drawShape ( const std::shared_ptr< geometrize::Shape >  shape,
geometrize::rgba  color 
)

drawShape Draws a shape with the given color to the internal model.

Parameters
shapeThe shape to add to the model.
colorThe color of the shape.
373 {
374  d->drawShape(shape, color);
375 }

◆ getCurrent()

const Bitmap & geometrize::task::ImageTask::getCurrent ( ) const

getCurrent Gets the current bitmap, const-edition.

Returns
The current bitmap.
338 {
339  return d->getCurrent();
340 }
Here is the caller graph for this function:

◆ getCurrentMutable()

Bitmap & geometrize::task::ImageTask::getCurrentMutable ( )

getCurrent Gets the current bitmap, non-const edition.

Returns
The current bitmap.
328 {
329  return d->getCurrent();
330 }

◆ getDisplayName()

std::string geometrize::task::ImageTask::getDisplayName ( ) const

getDisplayName Gets the display name of the image task.

Returns
The display name of the image task.
353 {
354  return d->getDisplayName();
355 }

◆ getGeometrizer()

geometrize::script::GeometrizerEngine & geometrize::task::ImageTask::getGeometrizer ( )

getGeometrizer Gets a reference to the script-based engine used to turn images into shapes.

Returns
The script-based engine used to turn images into shapes.
403 {
404  return d->getGeometrizer();
405 }

◆ getHeight()

std::uint32_t geometrize::task::ImageTask::getHeight ( ) const

getHeight Gets the height of the images used by the image task.

Returns
The height of the images used by the image task.
348 {
349  return d->getHeight();
350 }

◆ getPreferences()

preferences::ImageTaskPreferences & geometrize::task::ImageTask::getPreferences ( )

getPreferences Gets a reference to the current preferences of this task.

Returns
A reference to the current preferences of this task.
393 {
394  return d->getPreferences();
395 }
Here is the caller graph for this function:

◆ getTarget()

const Bitmap & geometrize::task::ImageTask::getTarget ( ) const

getTarget Gets the target bitmap, const-edition.

Returns
The target bitmap.
333 {
334  return d->getTarget();
335 }

◆ getTargetMutable()

Bitmap & geometrize::task::ImageTask::getTargetMutable ( )

getTarget Gets the target bitmap, non-const edition.

Returns
The target bitmap.
323 {
324  return d->getTarget();
325 }

◆ getTaskId()

std::size_t geometrize::task::ImageTask::getTaskId ( ) const

getTaskId Gets the unique id of the image task.

Returns
The unique id of the image task.
358 {
359  return d->getTaskId();
360 }

◆ getWidth()

std::uint32_t geometrize::task::ImageTask::getWidth ( ) const

getWidth Gets the width of the images used by the image task.

Returns
The width of the images used by the image task.
343 {
344  return d->getWidth();
345 }

◆ isStepping()

bool geometrize::task::ImageTask::isStepping ( ) const

isStepping Returns true if the internal model is currently stepping.

Returns
True if the internal model is currently stepping, else false.
363 {
364  return d->isStepping();
365 }

◆ modelDidStep()

void geometrize::task::ImageTask::modelDidStep ( std::vector< geometrize::ShapeResult >  shapes)
private
388 {
389  d->modelDidStep(shapes);
390 }
Here is the caller graph for this function:

◆ modelWillStep()

void geometrize::task::ImageTask::modelWillStep ( )
private
383 {
384  d->modelWillStep();
385 }
Here is the caller graph for this function:

◆ operator=()

ImageTask& geometrize::task::ImageTask::operator= ( const ImageTask )
delete

◆ setPreferences()

void geometrize::task::ImageTask::setPreferences ( preferences::ImageTaskPreferences  preferences)

setPreferences Sets the preferences for this task.

Parameters
preferencesThe preferences to set.
398 {
399  d->setPreferences(preferences);
400 }
Here is the caller graph for this function:

◆ signal_drawShape

void geometrize::task::ImageTask::signal_drawShape ( std::shared_ptr< geometrize::Shape >  shape,
geometrize::rgba  color 
)
signal

signal_drawShape Signal that the image task emits to draw a shape to the internal model.

Parameters
shapeThe shape to draw.
colorThe color of the shape to draw.
Here is the caller graph for this function:

◆ signal_modelDidStep

void geometrize::task::ImageTask::signal_modelDidStep ( std::vector< geometrize::ShapeResult >  shapes)
signal

signal_modelDidStep Signal that is emitted immediately after the underlying image task model is stepped.

Parameters
shapesThe shapes that were added in the last step.
Here is the caller graph for this function:

◆ signal_modelWillStep

void geometrize::task::ImageTask::signal_modelWillStep ( )
signal

signal_modelWillStep Signal that is emitted immediately before the underlying image task model is stepped.

Here is the caller graph for this function:

◆ signal_preferencesSet

void geometrize::task::ImageTask::signal_preferencesSet ( )
signal

signal_preferencesSet Signal that is emitted immediately after the image task preferences are set.

Here is the caller graph for this function:

◆ signal_step

void geometrize::task::ImageTask::signal_step ( geometrize::ImageRunnerOptions  options,
std::function< std::shared_ptr< geometrize::Shape >()>  shapeCreator,
geometrize::core::EnergyFunction  energyFunction,
geometrize::ShapeAcceptancePreconditionFunction  addShapePrecondition 
)
signal

signal_step Signal that the image task emits to make the internal model step.

Here is the caller graph for this function:

◆ stepModel()

void geometrize::task::ImageTask::stepModel ( )

stepModel Steps the internal model, typically adding a shape.

368 {
369  d->stepModel();
370 }

Member Data Documentation

◆ d

std::unique_ptr<ImageTaskImpl> geometrize::task::ImageTask::d
private

The documentation for this class was generated from the following files:
geometrize::task::ImageTask::d
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:188