 |
Geometrize
1.0
An application for geometrizing images into geometric primitives
|
◆ ImageTaskWindowImpl() [1/2]
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ImageTaskWindowImpl |
( |
ImageTaskWindow * |
pQ | ) |
|
|
inline |
85 ui{std::make_unique<Ui::ImageTaskWindow>()},
90 q->setAttribute(Qt::WA_DeleteOnClose);
93 q->tabifyDockWidget(
ui->runnerSettingsDock,
ui->scriptsDock);
94 q->tabifyDockWidget(
ui->runnerSettingsDock,
ui->exporterDock);
96 ui->runnerSettingsDock->raise();
98 ui->consoleWidget->setVisible(
false);
105 ui->imageViewContainer->layout()->addWidget(
m_svgView);
116 connect(
ui->actionScript_Console, &QAction::toggled, [
this](
const bool checked) {
117 setConsoleVisibility(checked);
119 connect(
ui->actionPixmap_Results_View, &QAction::toggled, [
this](
const bool checked) {
120 setPixmapViewVisibility(checked);
122 connect(
ui->actionVector_Results_View, &QAction::toggled, [
this](
const bool checked) {
123 setVectorViewVisibility(checked);
132 ui->imageTaskRunnerWidget->setImageTask(nextTask);
133 ui->scriptsWidget->setImageTask(nextTask);
136 const auto taskIdForSerialization = [](
const task::ImageTask& task) {
137 std::string s = std::to_string(task.getWidth()) +
"_" + std::to_string(task.getHeight()) +
"_";
139 QCryptographicHash hash(QCryptographicHash::Md5);
140 hash.addData(
reinterpret_cast<const char*
>(task.getTarget().getDataRef().data()), task.getTarget().getDataRef().size());
141 const QByteArray result = hash.result().toHex();
142 const std::string hashStr = std::string(result.begin(), result.end());
150 assert(0 &&
"Auto save path for image task file must not be empty");
159 assert(0 &&
"Auto load path for image task file must not be empty");
165 if(currentTask ==
nullptr) {
172 ui->imageTaskRunnerWidget->syncUserInterface();
173 ui->scriptsWidget->syncUserInterface();
184 chaiscript::ChaiScript* engine = geometrizer.getEngine();
187 ui->scriptsWidget->evaluateBeforeStepScripts();
201 ui->scriptsWidget->evaluateAfterStepScripts();
208 const QString windowTitle = [currentTask]() {
211 if(currentTask !=
nullptr) {
212 title.append(
" ").append(QString::fromStdString(currentTask->getDisplayName()));
216 q->setWindowTitle(windowTitle);
218 if(currentTask !=
nullptr) {
225 if(currentTask !=
nullptr) {
226 const auto getStartingColor = [
this]() {
228 if(prefs.shouldUseCustomImageTaskBackgroundOverrideColor()) {
230 return geometrize::rgba{
static_cast<std::uint8_t
>(color[0]),
static_cast<std::uint8_t
>(color[1]),
static_cast<std::uint8_t
>(color[2]),
static_cast<std::uint8_t
>(color[3]) };
232 return geometrize::commonutil::getAverageImageColor(
m_task->
getTarget());
234 currentTask->drawBackgroundRectangle(getStartingColor());
237 if(currentTask !=
nullptr) {
238 ui->consoleWidget->setEngine(currentTask->getGeometrizer().getEngine());
240 ui->consoleWidget->setEngine(
nullptr);
243 ui->imageTaskRunnerWidget->syncUserInterface();
244 ui->scriptsWidget->syncUserInterface();
246 if(currentTask !=
nullptr) {
249 ui->imageTaskImageWidget->setTargetImage(QImage());
254 #if defined DATASLINGER_INCLUDED
256 geometrize::installImageSlingerUserInterface(
q);
260 if(lastTask !=
nullptr) {
261 destroyTask(lastTask);
267 const float opacity{value * (1.0f / 255.0f)};
273 assert(!image.isNull());
276 const geometrize::Bitmap& target{m_task->getTarget()};
277 const int targetWidth{static_cast<int>(target.getWidth())};
278 const int targetHeight{static_cast<int>(target.getHeight())};
279 if(targetWidth != image.width() || targetHeight != image.height()) {
280 const QString selectedImageSize(tr(
"%1x%2",
"Dimensions of an image e.g. width-x-height, 1024x800").arg(QLocale().toString(image.width())).arg(QLocale().toString(image.height())));
281 const QString targetImageSize(tr(
"%1x%2",
"Dimensions of an image e.g. width-x-height, 1024x800").arg(QLocale().toString(targetWidth)).arg(QLocale().toString(targetHeight)));
282 QMessageBox::warning(
284 tr(
"Image has incorrect dimensions",
"Title of an error dialog shown when the user selects an image that was the wrong resolution/size"),
285 tr(
"Selected image must have the same dimensions as the current target image. Size was %1, but should have been %2",
286 "Error message shown when the user selects an image that was the wrong resolution/size").arg(selectedImageSize).arg(targetImageSize));
298 const QImage imageCopy{image.copy()};
299 addPostStepCb([this, imageCopy]() {
300 Bitmap target = geometrize::image::createBitmap(imageCopy);
301 switchTargetImage(target);
304 Bitmap target = geometrize::image::createBitmap(image);
305 switchTargetImage(target);
311 setShouldKeepStepping(!shouldKeepStepping());
314 if(shouldKeepStepping()) {
326 ui->imageTaskRunnerWidget->syncUserInterface();
327 ui->scriptsWidget->syncUserInterface();
339 ui->scriptsWidget->evaluateOnTimedUpdateEventScripts();
344 ui->scriptsWidget->evaluateBeforeAddShapeScripts();
350 engine->set_global(chaiscript::var(
m_shapes.
back().shape->clone()),
"lastAddedShape");
351 engine->set_global(chaiscript::var(
m_shapes.
back().score),
"lastAddedShapeScore");
352 engine->set_global(chaiscript::var(
m_shapes.
back().color),
"lastAddedShapeColor");
354 ui->scriptsWidget->evaluateAfterAddShapeScripts();
356 if(!
ui->scriptsWidget->evaluateStopConditionScripts()) {
360 ui->scriptsWidget->evaluateOnStopConditionMetScripts();
370 #if defined DATASLINGER_INCLUDED
375 geometrize::exporter::SVGExportOptions options;
376 options.rotatedEllipseExportMode = geometrize::exporter::RotatedEllipseSVGExportMode::POLYGON;
378 for(
const auto& result : shapes) {
379 geometrize::sendSvgShapeData(geometrize::exporter::getSingleShapeSVGData(result.color, *result.shape, options));
394 engine->set_global(chaiscript::var(lastX),
"targetImageLastMouseX");
395 engine->set_global(chaiscript::var(lastY),
"targetImageLastMouseY");
396 engine->set_global(chaiscript::var(x),
"targetImageMouseX");
397 engine->set_global(chaiscript::var(y),
"targetImageMouseY");
399 ui->scriptsWidget->evaluateOnMouseMoveEventScripts();
403 engine->set_global(chaiscript::var(x),
"targetImageLastMouseX");
404 engine->set_global(chaiscript::var(y),
"targetImageLastMouseY");
405 engine->set_global(chaiscript::var(x),
"targetImageMouseX");
406 engine->set_global(chaiscript::var(y),
"targetImageMouseY");
408 ui->scriptsWidget->evaluateOnMouseDownEventScripts();
413 engine->set_global(chaiscript::var(lastX),
"targetImageLastMouseX");
414 engine->set_global(chaiscript::var(lastY),
"targetImageLastMouseY");
415 engine->set_global(chaiscript::var(x),
"targetImageMouseX");
416 engine->set_global(chaiscript::var(y),
"targetImageMouseY");
418 ui->scriptsWidget->evaluateOnMouseMoveEventScripts();
422 engine->set_global(chaiscript::var(x),
"targetImageLastMouseX");
423 engine->set_global(chaiscript::var(y),
"targetImageLastMouseY");
424 engine->set_global(chaiscript::var(x),
"targetImageMouseX");
425 engine->set_global(chaiscript::var(y),
"targetImageMouseY");
427 ui->scriptsWidget->evaluateOnMouseUpEventScripts();
431 engine->set_global(chaiscript::var(x),
"targetImageLastMouseX");
432 engine->set_global(chaiscript::var(y),
"targetImageLastMouseY");
433 engine->set_global(chaiscript::var(x),
"targetImageMouseX");
434 engine->set_global(chaiscript::var(y),
"targetImageMouseY");
435 engine->set_global(chaiscript::var(amount),
"targetImageWheelMoveAmount");
437 ui->scriptsWidget->evaluateOnMouseWheelEventScripts();
443 const std::string keyString = QKeySequence(key).toString().toStdString();
446 engine->set_global(chaiscript::var(keyString),
"targetImageLastKeyDown");
447 engine->set_global(chaiscript::var(
true),
"targetImageKeyDown_" + keyString);
448 engine->set_global(chaiscript::var(ctrlModifier),
"targetImageControlModifierDown");
451 engine->set_global(chaiscript::var(keyString),
"targetImageLastKeyDownPersistent");
453 ui->scriptsWidget->evaluateOnKeyDownEventScripts();
457 const std::string keyString = QKeySequence(key).toString().toStdString();
460 engine->set_global(chaiscript::var(
""),
"targetImageLastKeyDown");
461 engine->set_global(chaiscript::var(
false),
"targetImageKeyDown_" + keyString);
462 engine->set_global(chaiscript::var(ctrlModifier),
"targetImageControlModifierDown");
464 ui->scriptsWidget->evaluateOnKeyUpEventScripts();
475 engine->set_global(chaiscript::var(data),
"lastTabletEvent");
477 ui->scriptsWidget->evaluateOnPenInputEventScripts();
480 std::shared_ptr<geometrize::Shape> aoiShape = engine->eval<std::shared_ptr<geometrize::Shape>>(
"aoi");
481 engine->set_global(chaiscript::var(aoiShape->clone()),
"aoi");
493 ui->scriptsWidget->evaluateOnPenProximityEnterEventScripts();
496 ui->scriptsWidget->evaluateOnPenProximityExitEventScripts();
527 const float initialTargetImageOpacity{0};
528 ui->imageTaskImageWidget->setTargetImageOpacity(
static_cast<unsigned int>(initialTargetImageOpacity));
◆ ImageTaskWindowImpl() [2/2]
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ImageTaskWindowImpl |
( |
const ImageTaskWindowImpl & |
| ) |
|
|
delete |
◆ ~ImageTaskWindowImpl()
geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::~ImageTaskWindowImpl |
( |
| ) |
|
|
inline |
544 if(lastTask !=
nullptr) {
545 destroyTask(lastTask);
◆ addPostStepCb()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::addPostStepCb |
( |
const std::function< void()> & |
f | ) |
|
|
inlineprivate |
◆ clearModel()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::clearModel |
( |
| ) |
|
|
inlineprivate |
◆ clearPostStepCbs()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::clearPostStepCbs |
( |
| ) |
|
|
inlineprivate |
◆ close()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::close |
( |
| ) |
|
|
inline |
◆ disconnectTask()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::disconnectTask |
( |
| ) |
|
|
inlineprivate |
◆ getCommandHandlerName()
std::string geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getCommandHandlerName |
( |
| ) |
const |
|
inline |
729 return q->objectName().toStdString();
◆ getExistingImageTaskWindows()
static std::vector<ImageTaskWindow*> geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getExistingImageTaskWindows |
( |
| ) |
|
|
inlinestatic |
551 std::vector<ImageTaskWindow*> windows;
552 const QWidgetList allWidgets = QApplication::allWidgets();
553 for (QWidget* widget : allWidgets) {
555 windows.push_back(w);
◆ getImageTask()
task::ImageTask* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::getImageTask |
( |
| ) |
|
|
inline |
◆ handleCommand()
671 const QString s = QString::fromStdString(command.
getCommand());
681 if(s ==
"click_start_stop_button") {
682 ui->imageTaskRunnerWidget->runStopButtonClicked();
684 if(s ==
"click_step_button") {
685 ui->imageTaskRunnerWidget->stepButtonClicked();
687 if(s ==
"click_clear_button") {
688 ui->imageTaskRunnerWidget->clearButtonClicked();
691 if(s ==
"toggle_script_console") {
692 ui->actionScript_Console->toggle();
694 if(s ==
"show_script_console") {
695 ui->actionScript_Console->setChecked(
true);
697 if(s ==
"hide_script_console") {
698 ui->actionScript_Console->setChecked(
false);
701 if(s ==
"toggle_pixmap_view") {
702 ui->actionPixmap_Results_View->toggle();
704 if(s ==
"show_pixmap_view") {
705 ui->actionPixmap_Results_View->setChecked(
true);
707 if(s ==
"hide_pixmap_view") {
708 ui->actionPixmap_Results_View->setChecked(
false);
711 if(s ==
"toggle_vector_view") {
712 ui->actionVector_Results_View->toggle();
714 if(s ==
"show_vector_view") {
715 ui->actionVector_Results_View->setChecked(
true);
717 if(s ==
"hide_vector_view") {
718 ui->actionVector_Results_View->setChecked(
false);
◆ isRunning()
bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::isRunning |
( |
| ) |
const |
|
inlineprivate |
◆ loadSettingsTemplate() [1/2]
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::loadSettingsTemplate |
( |
| ) |
|
|
inline |
◆ loadSettingsTemplate() [2/2]
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::loadSettingsTemplate |
( |
task::ImageTask * |
task, |
|
|
const std::string & |
path |
|
) |
| |
|
inline |
632 if(task ==
nullptr) {
636 assert(0 &&
"Auto load path for image task file must not be empty");
638 task->getPreferences().load(path);
◆ onLanguageChange()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::onLanguageChange |
( |
| ) |
|
|
inline |
665 ui->retranslateUi(
q);
◆ operator=()
◆ populateUi()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::populateUi |
( |
| ) |
|
|
inlineprivate |
◆ processPostStepCbs()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::processPostStepCbs |
( |
| ) |
|
|
inlineprivate |
◆ revealLaunchWindow()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::revealLaunchWindow |
( |
| ) |
|
|
inline |
◆ saveSettingsTemplate() [1/2]
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::saveSettingsTemplate |
( |
| ) |
const |
|
inline |
◆ saveSettingsTemplate() [2/2]
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::saveSettingsTemplate |
( |
task::ImageTask * |
task, |
|
|
const std::string & |
path |
|
) |
| const |
|
inline |
653 if(task ==
nullptr) {
657 assert(0 &&
"Auto save path for image task file must not be empty");
659 task->getPreferences().save(path);
◆ setCommandHandlerName()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setCommandHandlerName |
( |
const std::string & |
name | ) |
|
|
inline |
724 q->setObjectName(QString::fromStdString(name));
◆ setConsoleVisibility()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setConsoleVisibility |
( |
const bool |
visible | ) |
|
|
inline |
591 if(
ui->actionScript_Console->isChecked() != visible) {
592 ui->actionScript_Console->setChecked(visible);
594 ui->consoleWidget->setVisible(visible);
◆ setImageTask()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setImageTask |
( |
task::ImageTask * |
task | ) |
|
|
inline |
573 task::ImageTask* lastTask{
m_task};
574 task::ImageTask* nextTask{task};
◆ setPixmapViewVisibility()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setPixmapViewVisibility |
( |
const bool |
visible | ) |
|
|
inline |
599 if(
ui->actionPixmap_Results_View->isChecked() != visible) {
600 ui->actionPixmap_Results_View->setChecked(visible);
◆ setShouldKeepStepping()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setShouldKeepStepping |
( |
const bool |
stepping | ) |
|
|
inlineprivate |
◆ setTargetImage()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setTargetImage |
( |
const QImage & |
image | ) |
|
|
inlineprivate |
826 ui->imageTaskImageWidget->setTargetImage(image);
◆ setVectorViewVisibility()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::setVectorViewVisibility |
( |
const bool |
visible | ) |
|
|
inline |
611 if(
ui->actionVector_Results_View->isChecked() != visible) {
612 ui->actionVector_Results_View->setChecked(visible);
◆ shouldKeepStepping()
bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::shouldKeepStepping |
( |
| ) |
const |
|
inlineprivate |
◆ stepModel()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::stepModel |
( |
| ) |
|
|
inlineprivate |
◆ switchCurrentImage()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::switchCurrentImage |
( |
Bitmap & |
bitmap | ) |
|
|
inlineprivate |
788 currentBitmap = bitmap;
◆ switchTargetImage()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::switchTargetImage |
( |
Bitmap & |
bitmap | ) |
|
|
inlineprivate |
782 targetBitmap = bitmap;
◆ updateStartStopButtonText()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStartStopButtonText |
( |
| ) |
|
|
inlineprivate |
761 ui->imageTaskRunnerWidget->setRunStopButtonText(tr(
"Start",
"Text on a button that the user presses to make the app start/begin transforming an image into shapes"));
763 ui->imageTaskRunnerWidget->setRunStopButtonText(tr(
"Stop",
"Text on a button that the user presses to make the app stop/pause transforming an image into shapes"));
◆ updateStats()
void geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::updateStats |
( |
| ) |
|
|
inlineprivate |
805 ui->statsDockContents->setSimilarity(
m_shapes.
back().score * 100.0f);
808 ui->statsDockContents->setTimeRunning(
static_cast<int>(
m_timeRunning / 1000.0f));
◆ m_onPostStepCbs
std::vector<std::function<void()> > geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_onPostStepCbs |
|
private |
Connection for the window to do work just after the image task finishes a step
◆ m_pixmapView
Manager for scenes containing the pixmap/vector-based representations of the shapes etc
◆ m_sceneManager
Collection of shapes added so far
◆ m_scriptEngineUpdateTimer
QTimer geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimer |
|
private |
Resolution of the time running timer in milliseconds
◆ m_scriptEngineUpdateTimerResolution
float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_scriptEngineUpdateTimerResolution {100.0f} |
|
private |
Timer used to call an update function on the script engine of the associated image task
◆ m_shapes
One-shot callbacks triggered when the image task finishes a step
◆ m_shouldKeepStepping
bool geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_shouldKeepStepping {false} |
|
private |
The view that holds the vector-based scene
◆ m_svgView
The view that holds the raster/pixel-based scene
◆ m_task
task::ImageTask* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_task {nullptr} |
|
private |
◆ m_taskDidStepConnection
QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskDidStepConnection {} |
|
private |
Connection for the window to do work just prior the image task starts a step
◆ m_taskPreferencesSetConnection
QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskPreferencesSetConnection {} |
|
private |
The image task currently set and manipulated via this window
◆ m_taskWillStepConnection
QMetaObject::Connection geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_taskWillStepConnection {} |
|
private |
Connection for telling the dialog when the image task preferences are set
◆ m_timeRunning
float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunning {0.0f} |
|
private |
Timer used to keep track of how long the image task has been in the "running" state
◆ m_timeRunningTimer
QTimer geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimer |
|
private |
Whether to continually step i.e. whether to start another step after stepping once
◆ m_timeRunningTimerResolutionMs
const float geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::m_timeRunningTimerResolutionMs {100.0f} |
|
private |
Total time that the image task has been in the "running" state
ImageTaskWindow* geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::q {nullptr} |
|
private |
◆ ui
std::unique_ptr<Ui::ImageTaskWindow> geometrize::dialog::ImageTaskWindow::ImageTaskWindowImpl::ui {nullptr} |
|
private |
The documentation for this class was generated from the following file:
void reset()
reset Resets the state of the scenes, removing shapes etc.
Definition: imagetaskscenemanager.cpp:173
void didSwitchImageTask(task::ImageTask *lastTask, task::ImageTask *currentTask)
didSwitchImageTask Signal dispatched immediately after an image task is set on the image task window.
void signal_modelWillStep()
signal_modelWillStep Signal that is emitted immediately before the underlying image task model is ste...
void clear()
Definition: shapecollection.cpp:23
QString openLoadImageTaskSettingsDialog(QWidget *parent)
Definition: uiactions.cpp:212
const Bitmap & getTarget() const
getTarget Gets the target bitmap, const-edition.
Definition: imagetask.cpp:332
void signal_onTargetImageMouseMoveEvent(double lastX, double lastY, double x, double y, bool ctrlModifier)
void updateStartStopButtonText()
Definition: imagetaskwindow.cpp:758
The TabletEventData class represents data produced from a Wacom pen/tablet event (in the context of a...
Definition: customtabletevent.h:56
void openLaunchWindow()
Definition: uiactions.cpp:42
bool isLaunchWindowOpen()
Definition: uiactions.cpp:51
void setImageTask(task::ImageTask *task)
Definition: imagetaskwindow.cpp:571
bool shouldKeepStepping() const
Definition: imagetaskwindow.cpp:747
task::ImageTask * getImageTask()
Definition: imagetaskwindow.cpp:566
TabletProximityEventFilter & getSharedTabletProximityEventFilterInstance()
getSharedTabletProximityEventFilterInstance Gets a reference to the shared instance of the tablet pro...
Definition: tabletproximityeventfilter.cpp:32
const Bitmap & getCurrent() const
getCurrent Gets the current bitmap, const-edition.
Definition: imagetask.cpp:337
void setVectorViewVisibility(const bool visible)
Definition: imagetaskwindow.cpp:609
void updateScenes(const QPixmap &pixmap, const std::vector< geometrize::ShapeResult > &shapes)
updateScenes Updates the scenes to show the latest image/shapes.
Definition: imagetaskscenemanager.cpp:168
QString openSaveImageTaskSettingsDialog(QWidget *parent)
Definition: uiactions.cpp:220
QTimer m_timeRunningTimer
Whether to continually step i.e. whether to start another step after stepping once
Definition: imagetaskwindow.cpp:863
std::uint32_t getHeight() const
getHeight Gets the height of the images used by the image task.
Definition: imagetask.cpp:347
QImage createImage(const Bitmap &data)
createImage Creates an image from the bitmap data object. Assumes RGBA8888 format.
Definition: imageloader.cpp:48
std::string getImageTaskPreferencesAutoSavePath(const std::string &hashOfFirstTargetImage)
getImageTaskPreferencesAutoSavePath Gets the absolute path to where the image task preferences config...
Definition: imagetaskpreferences.cpp:24
std::vector< std::function< void()> > m_onPostStepCbs
Connection for the window to do work just after the image task finishes a step
Definition: imagetaskwindow.cpp:854
void disconnectTask()
Definition: imagetaskwindow.cpp:811
void setPixmapViewVisibility(const bool visible)
Definition: imagetaskwindow.cpp:597
void signal_onTargetImageMousePressEvent(double x, double y, bool ctrlModifier)
std::size_t getTaskId() const
getTaskId Gets the unique id of the image task.
Definition: imagetask.cpp:357
void populateUi()
Definition: imagetaskwindow.cpp:733
void fitVectorSceneInView(ImageTaskGraphicsView &svgView)
fitVectorSceneInView Fits the SVG/vector scene into the given view.
Definition: imagetaskscenemanager.cpp:183
geometrize::task::ShapeCollection m_shapes
One-shot callbacks triggered when the image task finishes a step
Definition: imagetaskwindow.cpp:856
void processPostStepCbs()
Definition: imagetaskwindow.cpp:839
QString getApplicationVersionString()
getApplicationVersionString Gets the application version as a string in VERSION.MAJOR....
Definition: versioninfo.cpp:13
void signal_onTargetImageMouseReleaseEvent(double x, double y, bool ctrlModifier)
void setTargetPixmapOpacity(float opacity)
setTargetPixmapOpacity Sets the opacity of the target pixmap.
Definition: imagetaskscenemanager.cpp:163
void signal_onTargetImageKeyPressEvent(int key, bool ctrlModifier)
The CustomTabletEvent class represents a tablet event (specifically from a Wacom Pro pen) that can be...
Definition: customtabletevent.h:88
ImageTaskWindow()
Definition: imagetaskwindow.cpp:871
std::array< std::int32_t, 4 > getCustomImageTaskBackgroundOverrideColor() const
getCustomImageTaskBackgroundOverrideColor Gets the preference for the custom image task background ov...
Definition: globalpreferences.cpp:498
void fitScenesInViews(ImageTaskGraphicsView &pixmapView, ImageTaskGraphicsView &svgView)
fitScenesInViews Fits the scenes into their respective views.
Definition: imagetaskscenemanager.cpp:188
const std::vector< geometrize::ShapeResult > & getShapeVector() const
Definition: shapecollection.cpp:29
The ImageTaskGraphicsView class models a graphics view for viewing the images and shapes used and/or ...
Definition: imagetaskgraphicsview.h:22
static QString getApplicationName()
getApplicationName Gets the name of the application.
Definition: strings.cpp:9
Bitmap & getCurrentMutable()
getCurrent Gets the current bitmap, non-const edition.
Definition: imagetask.cpp:327
QPixmap createPixmap(const Bitmap &data)
createPixmap Creates a pixmap from the bitmap data object. Assumes RGBA8888 format.
Definition: imageloader.cpp:59
The GlobalPreferences class models the preferences associated with the application as a whole....
Definition: globalpreferences.h:44
void didLoadSettingsTemplate()
didLoadSettingsTemplate Signal dispatched immediately after a settings template is applied to the ima...
std::string getCommand() const
Definition: command.cpp:15
void signal_onTargetImageTabletEvent(const geometrize::scene::CustomTabletEvent &event)
QMetaObject::Connection m_taskDidStepConnection
Connection for the window to do work just prior the image task starts a step
Definition: imagetaskwindow.cpp:853
void loadSettingsTemplate()
Definition: imagetaskwindow.cpp:621
void signal_onTargetImageWheelEvent(double x, double y, int amount, bool ctrlModifier)
void willSwitchImageTask(task::ImageTask *lastTask, task::ImageTask *nextTask)
willSwitchImageTask Signal dispatched immediately before an image task is set on the image task windo...
float m_scriptEngineUpdateTimerResolution
Timer used to call an update function on the script engine of the associated image task
Definition: imagetaskwindow.cpp:868
const float m_timeRunningTimerResolutionMs
Total time that the image task has been in the "running" state
Definition: imagetaskwindow.cpp:865
bool isRunning() const
Definition: imagetaskwindow.cpp:739
void signal_onTargetImageKeyReleaseEvent(int key, bool ctrlModifier)
Bitmap & getTargetMutable()
getTarget Gets the target bitmap, non-const edition.
Definition: imagetask.cpp:322
ImageTaskWindow * q
Definition: imagetaskwindow.cpp:848
geometrize::script::GeometrizerEngine & getGeometrizer()
getGeometrizer Gets a reference to the script-based engine used to turn images into shapes.
Definition: imagetask.cpp:402
void didSaveSettingsTemplate()
didSaveSettingsTemplate Signal dispatched immediately after a settings template based on the current ...
QTimer m_scriptEngineUpdateTimer
Resolution of the time running timer in milliseconds
Definition: imagetaskwindow.cpp:867
void signal_afterAppendShapes(const std::vector< geometrize::ShapeResult > &)
bool m_shouldKeepStepping
The view that holds the vector-based scene
Definition: imagetaskwindow.cpp:862
void signal_onTabletEnterProximity()
signal_onTabletEnterProximity Signal dispatched when a Wacom tablet enter proximity event is received
std::size_t size() const
Definition: shapecollection.cpp:18
std::unique_ptr< Ui::ImageTaskWindow > ui
Definition: imagetaskwindow.cpp:847
void stepModel()
Definition: imagetaskwindow.cpp:767
std::uint32_t getWidth() const
getWidth Gets the width of the images used by the image task.
Definition: imagetask.cpp:342
geometrize::scene::ImageTaskGraphicsView * m_svgView
The view that holds the raster/pixel-based scene
Definition: imagetaskwindow.cpp:860
void clearPostStepCbs()
Definition: imagetaskwindow.cpp:834
void signal_onTabletLeaveProximity()
signal_onTabletLeaveProximity Signal dispatched when a Wacom tablet leave proximity event is received
bool empty() const
Definition: shapecollection.cpp:13
QMetaObject::Connection m_taskPreferencesSetConnection
The image task currently set and manipulated via this window
Definition: imagetaskwindow.cpp:851
QMetaObject::Connection m_taskWillStepConnection
Connection for telling the dialog when the image task preferences are set
Definition: imagetaskwindow.cpp:852
void signal_onTargetImageHoverMoveEvent(double lastX, double lastY, double x, double y, bool ctrlModifier)
void fitPixmapSceneInView(ImageTaskGraphicsView &pixmapView)
fitPixmapSceneInView Fits the pixmap scene into the given view.
Definition: imagetaskscenemanager.cpp:178
void signal_beforeAppendShapes(const std::vector< geometrize::ShapeResult > &)
geometrize::scene::ImageTaskGraphicsView * m_pixmapView
Manager for scenes containing the pixmap/vector-based representations of the shapes etc
Definition: imagetaskwindow.cpp:859
void saveSettingsTemplate() const
Definition: imagetaskwindow.cpp:642
task::ImageTask * m_task
Definition: imagetaskwindow.cpp:850
void setConsoleVisibility(const bool visible)
Definition: imagetaskwindow.cpp:589
void setShouldKeepStepping(const bool stepping)
Definition: imagetaskwindow.cpp:752
The ImageTask class transforms a source image into a collection of shapes approximating the source im...
Definition: imagetask.h:53
float m_timeRunning
Timer used to keep track of how long the image task has been in the "running" state
Definition: imagetaskwindow.cpp:864
void signal_sizeChanged(std::size_t to)
void setViews(ImageTaskGraphicsView &pixmapView, ImageTaskGraphicsView &svgView)
setViews Associates the given views with the scenes managed by this class.
Definition: imagetaskscenemanager.cpp:153
void appendShapes(const std::vector< geometrize::ShapeResult > &shapes)
Definition: shapecollection.cpp:34
bool isStepping() const
isStepping Returns true if the internal model is currently stepping.
Definition: imagetask.cpp:362
geometrize::preferences::GlobalPreferences & getGlobalPreferences()
getGlobalPreferences Shorthand function that gets a reference to the shared global preferences object...
Definition: globalpreferences.cpp:32
void signal_modelDidStep(std::vector< geometrize::ShapeResult > shapes)
signal_modelDidStep Signal that is emitted immediately after the underlying image task model is stepp...
geometrize::ShapeResult & back()
Definition: shapecollection.cpp:42
geometrize::preferences::ImageTaskPreferences & getPreferences()
getPreferences Gets a reference to the current preferences of this task.
Definition: imagetask.cpp:392
void signal_preferencesSet()
signal_preferencesSet Signal that is emitted immediately after the image task preferences are set.
void updateStats()
Definition: imagetaskwindow.cpp:791
void setAreaOfInfluenceShape(const geometrize::Shape &shape)
setAreaOfInfluenceShape Sets up a area of influence visual for the given shape.
Definition: imagetaskscenemanager.cpp:193
void stepModel()
stepModel Steps the internal model, typically adding a shape.
Definition: imagetask.cpp:367
void bringLaunchWindowToFront()
Definition: uiactions.cpp:56
std::string getDisplayName() const
getDisplayName Gets the display name of the image task.
Definition: imagetask.cpp:352
void setTargetPixmap(const QPixmap &pixmap)
setTargetPixmap Sets the pixmap that provides the target/goal image visualization.
Definition: imagetaskscenemanager.cpp:158
geometrize::scene::ImageTaskSceneManager m_sceneManager
Collection of shapes added so far
Definition: imagetaskwindow.cpp:858
void setTargetImage(const QImage &image)
Definition: imagetaskwindow.cpp:824