Geometrize  1.0
An application for geometrizing images into geometric primitives
Classes | Functions
geometrize::task Namespace Reference

Classes

class  ImageTask
 The ImageTask class transforms a source image into a collection of shapes approximating the source image. More...
 
class  ImageTaskWorker
 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...
 
class  ShapeCollection
 The ShapeCollection class is a wrapper for the vector of shapes that have been added to the image task so far. More...
 
class  SynchronousImageTask
 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...
 

Functions

ImageTaskcreateImageTaskAndWindow (const std::string &displayName, const std::string &taskUrl, const std::optional< geometrize::preferences::ImageTaskPreferences > &prefs)
 createImageTaskAndWindow Creates an image task, and immediately creates a graphical window for manipulating the task. More...
 
ImageTaskcreateImageTaskAndWindow (const std::string &displayName, const QImage &image, const std::optional< geometrize::preferences::ImageTaskPreferences > &prefs)
 createImageTaskAndWindow Creates an image task, and immediately creates a graphical window for manipulating the task. More...
 

Function Documentation

◆ createImageTaskAndWindow() [1/2]

ImageTask * geometrize::task::createImageTaskAndWindow ( const std::string &  displayName,
const QImage &  image,
const std::optional< geometrize::preferences::ImageTaskPreferences > &  prefs 
)

createImageTaskAndWindow Creates an image task, and immediately creates a graphical window for manipulating the task.

Parameters
displayNameThe display name of the image task.
imageThe image that the task will work on.
prefsInitial image task preferences to (optionally) set for the task.
Returns
The created image task object.
66 {
67  geometrize::Bitmap bitmap{image::convertImageToBitmapWithDownscaling(replaceAlphaInImage(image))};
68  ImageTask* task{new ImageTask(displayName, bitmap)};
69  if(prefs) {
70  task->setPreferences(*prefs);
71  }
72  dialog::ImageTaskWindow* imageTaskWindow{new dialog::ImageTaskWindow()};
73  imageTaskWindow->setImageTask(task);
74  imageTaskWindow->show();
75  return task;
76 }
Here is the call graph for this function:

◆ createImageTaskAndWindow() [2/2]

ImageTask * geometrize::task::createImageTaskAndWindow ( const std::string &  displayName,
const std::string &  taskUrl,
const std::optional< geometrize::preferences::ImageTaskPreferences > &  prefs 
)

createImageTaskAndWindow Creates an image task, and immediately creates a graphical window for manipulating the task.

Parameters
displayNameThe display name of the image task.
taskUrlThe URL of the task data source.
prefsInitial image task preferences to (optionally) set for the task.
Returns
The created image task object.
53 {
54  geometrize::Bitmap bitmap{image::convertImageToBitmapWithDownscaling(replaceAlphaInImage(geometrize::image::loadImage(taskUrl)))};
55  ImageTask* task{new ImageTask(displayName, bitmap)};
56  if(prefs) {
57  task->setPreferences(*prefs);
58  }
59  dialog::ImageTaskWindow* imageTaskWindow{new dialog::ImageTaskWindow()};
60  imageTaskWindow->setImageTask(task);
61  imageTaskWindow->show();
62  return task;
63 }
Here is the call graph for this function:
Here is the caller graph for this function:
geometrize::image::loadImage
QImage loadImage(const std::string &filePath)
loadImage Loads an image from the image at the file path. Converts to RGBA8888 format.
Definition: imageloader.cpp:64
geometrize::image::convertImageToBitmapWithDownscaling
geometrize::Bitmap convertImageToBitmapWithDownscaling(const QImage &image)
imageToBitmapWithDownscaling Creates a bitmap data object from the given image, downscaling in the pr...
Definition: imageloader.cpp:32