Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
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)
 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 & getTarget ()
 getTarget Gets the target bitmap. More...
 
Bitmap & getCurrent ()
 getCurrent Gets the current bitmap. 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

geometrize::task::ImageTask::ImageTask ( Bitmap &  target,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
236  : QObject(),
237  d{std::make_unique<ImageTask::ImageTaskImpl>(this, "", target, workerConnectionType)}
238 {
239 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
geometrize::task::ImageTask::ImageTask ( Bitmap &  target,
Bitmap &  background,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
241  : QObject(),
242  d{std::make_unique<ImageTask::ImageTaskImpl>(this, "", target, background, workerConnectionType)}
243 {
244 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
geometrize::task::ImageTask::ImageTask ( const std::string &  displayName,
Bitmap &  bitmap,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
246  : QObject(),
247  d{std::make_unique<ImageTask::ImageTaskImpl>(this, displayName, bitmap, workerConnectionType)}
248 {
249 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
geometrize::task::ImageTask::ImageTask ( const std::string &  displayName,
Bitmap &  bitmap,
const Bitmap &  initial,
Qt::ConnectionType  workerConnectionType = Qt::QueuedConnection 
)
251  : QObject(),
252  d{std::make_unique<ImageTask::ImageTaskImpl>(this, displayName, bitmap, initial, workerConnectionType)}
253 {
254 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
geometrize::task::ImageTask::ImageTask ( const ImageTask )
delete
geometrize::task::ImageTask::~ImageTask ( )
virtual
257 {
258 }

Member Function Documentation

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

drawBackgroundRectangle Convenience function that draws a background rectangle shape.

Parameters
colorThe color of the background rectangle.
316 {
317  d->drawBackgroundRectangle(color);
318 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
311 {
312  d->drawShape(shape, color);
313 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
Bitmap & geometrize::task::ImageTask::getCurrent ( )

getCurrent Gets the current bitmap.

Returns
The current bitmap.
266 {
267  return d->getCurrent();
268 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Here is the caller graph for this function:

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

getCurrent Gets the current bitmap, const-edition.

Returns
The current bitmap.
276 {
277  return d->getCurrent();
278 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
std::string geometrize::task::ImageTask::getDisplayName ( ) const

getDisplayName Gets the display name of the image task.

Returns
The display name of the image task.
291 {
292  return d->getDisplayName();
293 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
341 {
342  return d->getGeometrizer();
343 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
286 {
287  return d->getHeight();
288 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
331 {
332  return d->getPreferences();
333 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Here is the caller graph for this function:

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

getTarget Gets the target bitmap.

Returns
The target bitmap.
261 {
262  return d->getTarget();
263 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
const Bitmap & geometrize::task::ImageTask::getTarget ( ) const

getTarget Gets the target bitmap, const-edition.

Returns
The target bitmap.
271 {
272  return d->getTarget();
273 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
296 {
297  return d->getTaskId();
298 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
281 {
282  return d->getWidth();
283 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
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.
301 {
302  return d->isStepping();
303 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186
void geometrize::task::ImageTask::modelDidStep ( std::vector< geometrize::ShapeResult >  shapes)
private
326 {
327  d->modelDidStep(shapes);
328 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Here is the caller graph for this function:

void geometrize::task::ImageTask::modelWillStep ( )
private
321 {
322  d->modelWillStep();
323 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Here is the caller graph for this function:

ImageTask& geometrize::task::ImageTask::operator= ( const ImageTask )
delete
void geometrize::task::ImageTask::setPreferences ( preferences::ImageTaskPreferences  preferences)

setPreferences Sets the preferences for this task.

Parameters
preferencesThe preferences to set.
336 {
337  d->setPreferences(preferences);
338 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Here is the caller graph for this function:

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:

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:

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:

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:

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

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

Here is the caller graph for this function:

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

stepModel Steps the internal model, typically adding a shape.

306 {
307  d->stepModel();
308 }
std::unique_ptr< ImageTaskImpl > d
Definition: imagetask.h:186

Member Data Documentation

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

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