The ImageTaskWorker class transforms a source image into a collection of shapes. It is made to be run on its own thread to avoid blocking the UI.
More...
#include <imagetaskworker.h>
|
| ImageTaskWorker (Bitmap &bitmap) |
|
| ImageTaskWorker (Bitmap &bitmap, const Bitmap &initial) |
|
ImageTaskWorker & | operator= (const ImageTaskWorker &)=delete |
|
| ImageTaskWorker (const ImageTaskWorker &)=delete |
|
virtual | ~ImageTaskWorker () |
|
void | step (geometrize::ImageRunnerOptions options, std::function< std::shared_ptr< geometrize::Shape >()> shapeCreator, geometrize::core::EnergyFunction energyFunction=nullptr, geometrize::ShapeAcceptancePreconditionFunction addShapePreconditionFunction=nullptr) |
| step Steps the image task worker. Emits the willStep signal when called, and didStep signal on completion. More...
|
|
bool | isStepping () const |
| isStepping Returns true if the internal model is currently stepping. More...
|
|
void | drawShape (std::shared_ptr< geometrize::Shape > shape, geometrize::rgba color) |
| drawShape Draws a shape with the given color to the image task. Emits the willStep signal when called, and didStep signal on completion. More...
|
|
geometrize::Bitmap & | getCurrent () |
| getCurrent Gets the current working bitmap. More...
|
|
geometrize::Bitmap & | getTarget () |
| getTarget Gets the current target bitmap. More...
|
|
const geometrize::Bitmap & | getCurrent () const |
| getCurrent Gets the current working bitmap, const-edition. More...
|
|
const geometrize::Bitmap & | getTarget () const |
| getTarget Gets the current target bitmap, const-edition. More...
|
|
ImageRunner & | getRunner () |
|
The ImageTaskWorker class transforms a source image into a collection of shapes. It is made to be run on its own thread to avoid blocking the UI.
◆ ImageTaskWorker() [1/3]
geometrize::task::ImageTaskWorker::ImageTaskWorker |
( |
Bitmap & |
bitmap | ) |
|
|
explicit |
◆ ImageTaskWorker() [2/3]
geometrize::task::ImageTaskWorker::ImageTaskWorker |
( |
Bitmap & |
bitmap, |
|
|
const Bitmap & |
initial |
|
) |
| |
◆ ImageTaskWorker() [3/3]
geometrize::task::ImageTaskWorker::ImageTaskWorker |
( |
const ImageTaskWorker & |
| ) |
|
|
delete |
◆ ~ImageTaskWorker()
geometrize::task::ImageTaskWorker::~ImageTaskWorker |
( |
| ) |
|
|
virtual |
◆ drawShape()
void geometrize::task::ImageTaskWorker::drawShape |
( |
std::shared_ptr< geometrize::Shape > |
shape, |
|
|
geometrize::rgba |
color |
|
) |
| |
drawShape Draws a shape with the given color to the image task. Emits the willStep signal when called, and didStep signal on completion.
- Parameters
-
shape | The shape to draw. |
color | The color of the shape to draw. |
44 const geometrize::ShapeResult result{
m_runner.getModel().drawShape(shape, color)};
◆ getCurrent() [1/2]
geometrize::Bitmap & geometrize::task::ImageTaskWorker::getCurrent |
( |
| ) |
|
getCurrent Gets the current working bitmap.
- Returns
- The current working bitmap.
◆ getCurrent() [2/2]
const geometrize::Bitmap & geometrize::task::ImageTaskWorker::getCurrent |
( |
| ) |
const |
getCurrent Gets the current working bitmap, const-edition.
- Returns
- The current working bitmap.
◆ getRunner()
geometrize::ImageRunner & geometrize::task::ImageTaskWorker::getRunner |
( |
| ) |
|
◆ getTarget() [1/2]
geometrize::Bitmap & geometrize::task::ImageTaskWorker::getTarget |
( |
| ) |
|
getTarget Gets the current target bitmap.
- Returns
- The current target bitmap.
◆ getTarget() [2/2]
const geometrize::Bitmap & geometrize::task::ImageTaskWorker::getTarget |
( |
| ) |
const |
getTarget Gets the current target bitmap, const-edition.
- Returns
- The current target bitmap.
◆ isStepping()
bool geometrize::task::ImageTaskWorker::isStepping |
( |
| ) |
const |
isStepping Returns true if the internal model is currently stepping.
- Returns
- True if the internal model is currently stepping, else false.
◆ operator=()
◆ signal_didStep
void geometrize::task::ImageTaskWorker::signal_didStep |
( |
std::vector< geometrize::ShapeResult > |
shapes | ) |
|
|
signal |
◆ signal_willStep
void geometrize::task::ImageTaskWorker::signal_willStep |
( |
| ) |
|
|
signal |
◆ step()
void geometrize::task::ImageTaskWorker::step |
( |
geometrize::ImageRunnerOptions |
options, |
|
|
std::function< std::shared_ptr< geometrize::Shape >()> |
shapeCreator, |
|
|
geometrize::core::EnergyFunction |
energyFunction = nullptr , |
|
|
geometrize::ShapeAcceptancePreconditionFunction |
addShapePreconditionFunction = nullptr |
|
) |
| |
step Steps the image task worker. Emits the willStep signal when called, and didStep signal on completion.
- Parameters
-
options | The options to provide the image runner when stepping. |
shapeCreator | A function that produces the shapes when stepping. |
energyFunction | An optional function to calculate the energy (if unspecified a default implementation is used). |
addShapePreconditionFunction | An optional function to determine whether to accept a shape (if unspecified a default implementation is used). |
35 const std::vector<geometrize::ShapeResult> results{
m_runner.step(options, shapeCreator, energyFunction, addShapePreconditionFunction)};
◆ m_runner
ImageRunner geometrize::task::ImageTaskWorker::m_runner |
|
private |
◆ m_working
std::atomic<bool> geometrize::task::ImageTaskWorker::m_working |
|
private |
The documentation for this class was generated from the following files: