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

The SynchronousImageTask class transforms a source image into a collection of shapes approximating the source image. A wrapper around the asynchronous ImageTask class, this blocks when stepping the model. This is a convenience class for use in scripts and console programs where we would rather block/wait when geometrizing something. More...

#include <synchronousimagetask.h>

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

Classes

class  SynchronousImageTaskImpl
 

Public Member Functions

 SynchronousImageTask (Bitmap &target)
 
virtual ~SynchronousImageTask ()
 
SynchronousImageTaskoperator= (const SynchronousImageTask &)=delete
 
 SynchronousImageTask (const SynchronousImageTask &)=delete
 
Bitmap & getTarget ()
 getTarget Gets the target bitmap. More...
 
Bitmap & getCurrent ()
 getCurrent Gets the current bitmap. More...
 
void stepModel ()
 stepModel Steps the internal model, typically adding a shape. More...
 
void drawBackgroundRectangle ()
 drawBackgroundRectangle Convenience function that draws a background rectangle shape using the target image's background color. 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...
 
std::vector< geometrize::ShapeResult > getShapes () const
 getShapes Gets a vector of shapes generated so far by this task. More...
 

Private Attributes

std::unique_ptr< SynchronousImageTaskImpld
 

Detailed Description

The SynchronousImageTask class transforms a source image into a collection of shapes approximating the source image. A wrapper around the asynchronous ImageTask class, this blocks when stepping the model. This is a convenience class for use in scripts and console programs where we would rather block/wait when geometrizing something.

Constructor & Destructor Documentation

◆ SynchronousImageTask() [1/2]

geometrize::task::SynchronousImageTask::SynchronousImageTask ( Bitmap &  target)
86  : QObject{}, d{std::make_unique<SynchronousImageTask::SynchronousImageTaskImpl>(this, target)}
87 {
88 }

◆ ~SynchronousImageTask()

geometrize::task::SynchronousImageTask::~SynchronousImageTask ( )
virtual
91 {
92 }

◆ SynchronousImageTask() [2/2]

geometrize::task::SynchronousImageTask::SynchronousImageTask ( const SynchronousImageTask )
delete

Member Function Documentation

◆ drawBackgroundRectangle()

void geometrize::task::SynchronousImageTask::drawBackgroundRectangle ( )

drawBackgroundRectangle Convenience function that draws a background rectangle shape using the target image's background color.

110 {
111  d->drawBackgroundRectangle();
112 }

◆ getCurrent()

Bitmap & geometrize::task::SynchronousImageTask::getCurrent ( )

getCurrent Gets the current bitmap.

Returns
The current bitmap.
100 {
101  return d->getCurrent();
102 }

◆ getPreferences()

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

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

Returns
A reference to the current preferences of this task.
115 {
116  return d->getPreferences();
117 }

◆ getShapes()

std::vector< geometrize::ShapeResult > geometrize::task::SynchronousImageTask::getShapes ( ) const

getShapes Gets a vector of shapes generated so far by this task.

Returns
The vector of shapes generated so far by this task.
125 {
126  return d->getShapes();
127 }

◆ getTarget()

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

getTarget Gets the target bitmap.

Returns
The target bitmap.
95 {
96  return d->getTarget();
97 }

◆ operator=()

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

◆ setPreferences()

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

setPreferences Sets the preferences for this task.

Parameters
preferencesThe preferences to set.
120 {
121  d->setPreferences(preferences);
122 }

◆ stepModel()

void geometrize::task::SynchronousImageTask::stepModel ( )

stepModel Steps the internal model, typically adding a shape.

105 {
106  d->step();
107 }

Member Data Documentation

◆ d

std::unique_ptr<SynchronousImageTaskImpl> geometrize::task::SynchronousImageTask::d
private

The documentation for this class was generated from the following files:
geometrize::task::SynchronousImageTask::d
std::unique_ptr< SynchronousImageTaskImpl > d
Definition: synchronousimagetask.h:77