 |
Geometrize
1.0
An application for geometrizing images into geometric primitives
|
Go to the documentation of this file.
8 #include "geometrize/shaperesult.h"
25 class ImageTaskWindow;
36 class TabletEventData;
105 std::vector<std::string>
getFilesWithExtension(
const std::string& dirPath,
const std::string& extension);
107 std::vector<std::string>
getFilesWithExtensions(
const std::string& dirPath,
const std::vector<std::string>& extensions);
113 std::vector<std::string>
getScriptsForPaths(
const std::vector<std::string>& dirPaths);
119 void openTask(
const std::string& url,
bool addToRecents);
133 bool stringEndsWith(
const std::string& str,
const std::string& suffix);
147 template<
typename T,
typename U,
typename V>
160 return v[randomInRange<int, std::size_t, std::size_t>(0, v.size() - 1)];
163 template<
typename T,
typename U,
typename V>
166 assert(lower <= upper);
176 int clampInt(
int value,
int lower,
int upper);
178 float clampFloat(
float value,
float lower,
float upper);
183 return (std::find(v.begin(), v.end(), t) != v.end());
186 std::vector<std::string>
split(
const std::string& s,
const char delimiter);
202 bool exportGIF(
const std::vector<geometrize::ShapeResult>& data,
203 std::uint32_t inputWidth,
204 std::uint32_t inputHeight,
205 std::uint32_t outputWidth,
206 std::uint32_t outputHeight,
207 std::size_t frameSkip,
208 const std::string& filePath);
242 void arrangeWidgetsInGrid(
const std::vector<QWidget*>& widgets,
int centerX,
int centerY,
int xDim,
int yDim,
int resizeX,
int resizeY);
void arrangeImageTaskWidgetsInGrid(int centerX, int centerY, int xDim, int yDim, int resizeX, int resizeY)
arrangeImageTaskWidgetsInGrid Arranges all the open image task widgets into a grid shape
Definition: util.cpp:540
void printToConsole(const std::string &str)
printToConsole A convenience function for printing a string to the command-line console.
Definition: util.cpp:87
std::string getFilenameTimestamp()
Definition: bindingswrapper.cpp:403
std::string getFormattedTimestamp(const std::string &formatString)
Definition: bindingswrapper.cpp:398
std::string getFileNameForFilePath(const std::string &filePath)
getFileNameForFilePath Gets the filename from the given local file path.
Definition: util.cpp:273
void fitWidgetsInGridOnPrimaryMonitor(const std::vector< QWidget * > &widgets)
fitWidgetsInGridOnPrimaryMonitor Fits the given widgets into a grid on the primary monitor
Definition: util.cpp:592
void clearGlobalClipboard()
Definition: bindingswrapper.cpp:210
T clamp(T value, U lower, V upper)
Definition: bindingswrapper.h:164
void debugBreak()
debugBreak Forces the debugger to break/halt the application when this is called.
Definition: util.cpp:75
std::vector< std::string > getAllNamedCommandHandlers()
Definition: bindingswrapper.cpp:368
std::string getHomeDirectoryLocation()
getHomeDirectoryLocation Returns a path to where the user's home directory is.
Definition: util.cpp:324
std::vector< std::string > getFilesWithExtensions(const std::string &, const std::vector< std::string > &)
Definition: bindingswrapper.cpp:145
bool createDirectory(const std::string &dirPath)
Definition: bindingswrapper.cpp:110
The LaunchWindow class models the UI for a launchpad for opening new task templates and recent tasks.
Definition: launchwindow.h:22
void fitImageTaskWidgetsInGridOnMonitor(int screenIdx)
Definition: bindingswrapper.cpp:458
std::string readFileAsString(const std::string &filePath)
Definition: bindingswrapper.cpp:115
int getCursorY()
getCursorY Gets the y-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:379
void setTranslatorsForLocale(const std::string &locale)
Definition: bindingswrapper.cpp:310
std::string getFirstFileWithExtensions(const std::string &dirPath, const std::vector< std::string > &extensions)
getFirstFileWithExtensions Gets the absolute file path to the first file with one of the given extens...
Definition: util.cpp:224
The TabletEventData class represents data produced from a Wacom pen/tablet event (in the context of a...
Definition: customtabletevent.h:56
static std::vector< LaunchWindow * > getTopLevelLaunchWindows()
getTopLevelLaunchWindows Gets all of the existing top level launch windows.
Definition: launchwindow.cpp:296
std::vector< std::string > getTemplateSearchPaths()
getTemplateSearchpaths Gets the directory paths that the program will search for project file templat...
Definition: searchpaths.cpp:26
bool directoryContainsFile(const std::string &dirPath, const std::string &fileName)
directoryContainsFile Checks if the directory contains the given file, returns true if it does.
Definition: util.cpp:135
std::vector< std::string > getScriptSearchPaths()
getScriptSearchPaths Gets the directory paths that the program will search for scripts....
Definition: searchpaths.cpp:21
std::vector< std::string > getScriptsForPath(const std::string &dirPath)
getScriptsForPath Gets the absolute file paths to the script files (*.chai) for the given directory,...
Definition: util.cpp:236
std::vector< std::string > getScriptsForPaths(const std::vector< std::string > &dirPaths)
getScriptsForPaths Gets the absolute file paths to the script files (*.chai) for the given directorie...
Definition: util.cpp:252
bool exportGIF(const std::vector< geometrize::ShapeResult > &data, std::uint32_t inputWidth, std::uint32_t inputHeight, std::uint32_t outputWidth, std::uint32_t outputHeight, const std::function< bool(std::size_t)> &frameSkipPredicate, const std::string &filePath)
exportGIF Exports shape data to a GIF image.
Definition: gifexporter.cpp:80
void sendCommandString(const std::string &target, const std::string &command)
Definition: bindingswrapper.cpp:378
QWidget * getWidgetByName(const std::string &widgetName)
getWidgetByName Returns the first found instance of the existing widget with the given name
Definition: util.cpp:423
std::vector< std::string > getSupportedLocaleCodes()
Definition: bindingswrapper.cpp:315
void printToAllScriptConsoleWidgets(const std::string &str)
Definition: bindingswrapper.cpp:70
void printToConsole(const std::string &str)
Definition: bindingswrapper.cpp:65
void broadcastCommandObject(Command &command)
Definition: bindingswrapper.cpp:393
std::vector< std::string > getAllNamedWidgets()
Definition: bindingswrapper.cpp:353
bool writeStringToFile(const std::string &str, const std::string &path)
Definition: bindingswrapper.cpp:255
static std::vector< ImageTaskWindow * > getExistingImageTaskWindows()
getExistingImageTaskWindows Gets all of the existing image task windows.
Definition: imagetaskwindow.cpp:881
void debugBreak()
Definition: bindingswrapper.cpp:80
void processApplicationEvents()
Definition: bindingswrapper.cpp:85
void clearGlobalClipboard()
clearGlobalClipboard Clears the global system clipboard contents.
Definition: util.cpp:289
std::string getFormattedTimestamp(const std::string &formatString)
getFormattedTimestamp Gets a formatted timestamp for the current local time
Definition: util.cpp:496
void fitWidgetsInGridOnMonitor(const std::vector< QWidget * > &widgets, int screenIdx)
Definition: bindingswrapper.cpp:453
std::vector< std::string > getAllNamedWidgets()
getAllWidgetNames Returns a vector containing the names of all the existing widgets in the applicatio...
Definition: util.cpp:399
void fitWidgetsInGridOnMonitor(const std::vector< QWidget * > &widgets, int screenIdx)
fitWidgetsInGridOnMonitor Fits the given widgets into a grid on the given monitor
Definition: util.cpp:572
void arrangeImageTaskWidgetsInGridOnPrimaryMonitor(int resizeX, int resizeY)
arrangeImageTaskWidgetsInGridOnPrimaryMonitor Arranges all the open image task widgets into a grid on...
Definition: util.cpp:567
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:155
The Command class provides a convenient way for a script to tell an object about something For exampl...
Definition: command.h:17
bool revealInDefaultApplication(const std::string &path)
revealInDefaultApplication Reveals the given path in the parent folder (or path with the filename tri...
Definition: util.cpp:283
int getCursorY()
Definition: bindingswrapper.cpp:300
void processApplicationEvents()
processApplicationEvents Processes all pending application events for the calling thread.
Definition: util.cpp:110
std::string getGlobalClipboardText()
getGlobalClipboardText Gets the global system clipboard text.
Definition: util.cpp:294
void messageBox(const std::string &str)
Definition: bindingswrapper.cpp:75
std::vector< std::string > getFilePathsForDirectory(const std::string &dirPath)
Definition: bindingswrapper.cpp:120
std::string getFilenameTimestamp()
getFilenameTimestamp Gets a filename timestamp string for the current local time
Definition: util.cpp:501
std::string getDirectoryForFilePath(const std::string &filePath)
getDirectoryForFilePath Gets the directory path from the given local file path.
Definition: util.cpp:262
std::vector< geometrize::dialog::ImageTaskWindow * > getImageTaskWindows()
Definition: bindingswrapper.cpp:55
void arrangeWidgetsInGrid(const std::vector< QWidget * > &widgets, int centerX, int centerY, int xDim, int yDim, int resizeX, int resizeY)
Definition: bindingswrapper.cpp:423
bool exportGIF(const std::vector< geometrize::ShapeResult > &data, const std::uint32_t inputWidth, const std::uint32_t inputHeight, const std::uint32_t outputWidth, const std::uint32_t outputHeight, const std::size_t frameSkip, const std::string &filePath)
Definition: bindingswrapper.cpp:330
geometrize::task::ImageTask * createImageTask(geometrize::Bitmap &bitmap)
Definition: bindingswrapper.cpp:45
std::string getDesktopDirectoryLocation()
Definition: bindingswrapper.cpp:250
The CommandHandler class provides an interface that all objects that can handle/process script comman...
Definition: commandhandler.h:19
std::string getHomeDirectoryLocation()
Definition: bindingswrapper.cpp:245
void setWidgetPosition(QWidget *widget, int x, int y)
Definition: bindingswrapper.cpp:418
bool directoriesExist(const std::vector< std::string > &dirPaths)
directoriesExist Checks if the given directories exist, returns true if all do.
Definition: util.cpp:130
void printToAllScriptConsoleWidgets(const std::string &str)
printToAllScriptConsoleWidgets A convenience function for printing a string to all the GUI console wi...
Definition: util.cpp:92
void setCursorPos(const int x, const int y)
setCursorPos Sets the cursor position in global screen coordinates.
Definition: util.cpp:384
int getCursorX()
Definition: bindingswrapper.cpp:295
std::string getApplicationDirectoryLocation()
getApplicationDirectory Get directory that the application is in.
Definition: util.cpp:314
std::string getOperatingSystemProductType()
getOperatingSystemProductType Returns the product name of the operating system this application is ru...
Definition: util.cpp:389
void arrangeImageTaskWidgetsInGrid(int centerX, int centerY, int xDim, int yDim, int resizeX, int resizeY)
Definition: bindingswrapper.cpp:428
std::string percentEncode(const std::string &str)
Definition: bindingswrapper.cpp:260
void setCursorPos(const int x, const int y)
Definition: bindingswrapper.cpp:305
std::vector< std::string > getSupportedImageFileExtensions()
Definition: bindingswrapper.cpp:161
std::vector< std::string > split(const std::string &s, const char delimiter)
Definition: bindingswrapper.cpp:285
int getCursorX()
getCursorX Gets the x-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:374
bool writeStringToFile(const std::string &str, const std::string &path)
writeStringToFile Writes the string to the file path, attempting to overwrite any existing file at th...
Definition: util.cpp:334
std::vector< std::string > getAllNamedGeometrizeWidgets()
getAllWidgetNames Returns a vector containing the names of all the widgets in the application with "g...
Definition: util.cpp:411
void arrangeImageTaskWidgetsInGridOnPrimaryMonitor(int resizeX, int resizeY)
Definition: bindingswrapper.cpp:448
std::string getUuidString()
Definition: bindingswrapper.cpp:408
std::string getApplicationDirectoryPath()
Definition: bindingswrapper.cpp:60
CommandHandler * getCommandHandlerByName(const std::string &name)
Definition: bindingswrapper.cpp:373
bool directoriesExist(const std::vector< std::string > &dirPaths)
Definition: bindingswrapper.cpp:100
geometrize::dialog::ImageTaskWindow * createImageTaskWindow()
Definition: bindingswrapper.cpp:35
std::string getOperatingSystemProductType()
Definition: bindingswrapper.cpp:290
void arrangeImageTaskWidgetsInGridOnMonitor(int screenIdx, int resizeX, int resizeY)
arrangeImageTaskWidgetsInGridOnMonitor Arranges all the open image task widgets into a grid on the gi...
Definition: util.cpp:557
int randomIntInRange(const int lower, const int upper)
Definition: bindingswrapper.cpp:265
void sendCommand(const std::string &target, const std::string &command)
sendCommand Sends a command to the given command handler
Definition: util.cpp:456
QString tabletEventDataToString(const TabletEventData &data)
tabletEventDataToString Helper function to convert a structure of tablet event data to a string
Definition: customtabletevent.cpp:44
bool directoryContainsFile(const std::string &dirPath, const std::string &fileName)
Definition: bindingswrapper.cpp:105
bool createDirectory(const std::string &dirPath)
createDirectory Creates the directory at the given path, recursively creating subdirectories if neede...
Definition: util.cpp:150
bool directoryExists(const std::string &dirPath)
Definition: bindingswrapper.cpp:95
Definition: commandlineparser.cpp:73
std::string getDesktopDirectoryLocation()
getDesktopDirectoryLocation Returns a path to where the user's desktop is.
Definition: util.cpp:329
std::vector< geometrize::dialog::LaunchWindow * > getLaunchWindows()
Definition: bindingswrapper.cpp:50
std::string getFirstFileWithExtension(const std::string &dirPath, const std::string &extension)
getFirstFileWithExtension Gets the absolute file path to the first file with the given extension in t...
Definition: util.cpp:214
void setTranslatorsForLocale(const QString &locale)
installTranslatorsForLocale Installs translators for the application.
Definition: localization.cpp:76
bool saveWidgetScreenshot(const std::string &path, QWidget *widget)
saveWidgetScreenshot Takes a screenshot of the given widget and saves it as a .png image to the given...
Definition: util.cpp:394
void messageBox(const std::string &str)
messageBox A convenience function for displaying a message box containing a message.
Definition: util.cpp:103
int randomInRange(const int lower, const int upper)
randomInRange Returns a random integer in the range [lower, upper], inclusive. Note that this uses th...
Definition: util.cpp:361
void arrangeWidgetsInGrid(const std::vector< QWidget * > &widgets, int centerX, int centerY, int xDim, int yDim, int resizeX, int resizeY)
arrangeWidgetsInGrid Arranges the given widgets into a grid shape
Definition: util.cpp:521
std::string getFirstFileWithExtensions(const std::string &dirPath, const std::vector< std::string > &extensions)
Definition: bindingswrapper.cpp:140
geometrize::dialog::LaunchWindow * createLaunchWindow()
Definition: bindingswrapper.cpp:40
std::vector< std::string > getFilePathsForDirectory(const std::string &dirPath)
getFilePathsForDirectory Gets the absolute file paths to the files in the given directory.
Definition: util.cpp:166
std::vector< std::string > getTemplateSearchPaths()
Definition: bindingswrapper.cpp:130
std::string percentEncode(const std::string &str)
percentEncode Returns a percent-encoded copy of the input string.
Definition: util.cpp:354
std::string getGlobalClipboardText()
Definition: bindingswrapper.cpp:215
void fitWidgetsInGridOnPrimaryMonitor(const std::vector< QWidget * > &widgets)
Definition: bindingswrapper.cpp:463
void setWidgetPosition(QWidget *widget, int x, int y)
setWidgetPosition Sets the widget to the given position.
Definition: util.cpp:516
bool saveWidgetScreenshot(const std::string &path, QWidget *widget)
Definition: bindingswrapper.cpp:343
std::string getApplicationDirectoryLocation()
Definition: bindingswrapper.cpp:235
bool stringBeginsWith(const std::string &str, const std::string &prefix)
stringBeginsWith Checks if a string begins with the given prefix.
Definition: util.cpp:304
bool stringEndsWith(const std::string &str, const std::string &suffix)
Definition: bindingswrapper.cpp:230
std::string getFirstFileWithExtension(const std::string &dirPath, const std::string &extension)
Definition: bindingswrapper.cpp:135
float randomFloatInRange(const float lower, const float upper)
Definition: bindingswrapper.cpp:270
void setGlobalClipboardText(const std::string &text)
setClipboardText Sets the global system clipboard text.
Definition: util.cpp:299
void arrangeWidgetsInGridOnPrimaryMonitor(const std::vector< QWidget * > &widgets, int resizeX, int resizeY)
Definition: bindingswrapper.cpp:443
T randomInRange(U lower, V upper)
Definition: bindingswrapper.h:148
bool directoryExists(const std::string &dirPath)
directoryExists Checks if a directory exists, returns true if it does.
Definition: util.cpp:125
bool fileExists(const std::string &filePath)
Definition: bindingswrapper.cpp:90
std::vector< std::string > getScriptSearchPaths()
Definition: bindingswrapper.cpp:125
QStringList getSupportedLocaleCodes()
getSupportedLocaleCodes Iterates over the embedded .qm files and extracts the ISO language codes from...
Definition: localization.cpp:212
QWidget * getWidgetByName(const std::string &widgetName)
Definition: bindingswrapper.cpp:363
void broadcastCommand(const std::string &command)
broadcastCommand Sends a command to all command handlers
Definition: util.cpp:480
std::vector< std::string > getFilesWithExtension(const std::string &dirPath, const std::string &extension)
Definition: bindingswrapper.cpp:156
std::string customTabletEventDataToString(const geometrize::scene::TabletEventData &data)
Definition: bindingswrapper.cpp:348
geometrize::script::CommandHandler * getCommandHandlerByName(const std::string &name)
getCommandHandlerByName Returns the first found instance of the existing command handler with the giv...
Definition: util.cpp:444
void setGlobalClipboardText(const std::string &text)
Definition: bindingswrapper.cpp:220
void arrangeWidgetsInGridOnMonitor(const std::vector< QWidget * > &widgets, int monitorId, int resizeX, int resizeY)
Definition: bindingswrapper.cpp:433
bool stringBeginsWith(const std::string &str, const std::string &prefix)
Definition: bindingswrapper.cpp:225
std::vector< std::string > getAllNamedGeometrizeWidgets()
Definition: bindingswrapper.cpp:358
std::string getAppDataLocation()
Definition: bindingswrapper.cpp:240
void arrangeWidgetsInGridOnMonitor(const std::vector< QWidget * > &widgets, int screenIdx, int resizeX, int resizeY)
arrangeWidgetsInGridOnMonitor Arranges the given widgets into a grid on the given monitor
Definition: util.cpp:545
void broadcastCommandString(const std::string &command)
Definition: bindingswrapper.cpp:388
std::string getFileNameForFilePath(const std::string &filePath)
Definition: bindingswrapper.cpp:181
void fitImageTaskWidgetsInGridOnPrimaryMonitor()
Definition: bindingswrapper.cpp:468
The ImageTask class transforms a source image into a collection of shapes approximating the source im...
Definition: imagetask.h:53
std::string getUuidString()
getUuidString Gets a Universally Unique Identifier (UUID) as a string
Definition: util.cpp:506
int clampInt(const int value, const int lower, const int upper)
Definition: bindingswrapper.cpp:275
void openTask(const std::string &url, const bool addToRecents)
Definition: bindingswrapper.cpp:186
void setLocaleAndUserInterfaceLanguage(const QString &isoCode)
setLocaleAndUserInterfaceLanguage Sets the application locale and user interface language to the give...
Definition: localization.cpp:226
void arrangeImageTaskWidgetsInGridOnMonitor(int monitorId, int resizeX, int resizeY)
Definition: bindingswrapper.cpp:438
std::vector< std::string > getScriptsForPath(const std::string &dirPath)
Definition: bindingswrapper.cpp:166
bool openInDefaultApplication(const std::string &path)
Definition: bindingswrapper.cpp:200
bool openInDefaultApplication(const std::string &path)
openInDefaultApplication Opens the given path in the default application.
Definition: util.cpp:278
bool fileExists(const std::string &filePath)
fileExists Checks if a file exists, returns true if it does.
Definition: util.cpp:120
std::string getAppDataLocation()
getAppDataLocation Returns a directory location where persistent application data can be stored.
Definition: util.cpp:319
void sendCommandObject(const std::string &target, Command &command)
Definition: bindingswrapper.cpp:383
std::vector< std::string > getAllNamedCommandHandlers()
getAllNamedCommandHandlers Gets all of the existing objects in the application that implement the Com...
Definition: util.cpp:434
void arrangeWidgetsInGridOnPrimaryMonitor(const std::vector< QWidget * > &widgets, int resizeX, int resizeY)
arrangeWidgetsInGridOnPrimaryMonitor Arranges the given widgets into a grid on the primary monitor
Definition: util.cpp:562
std::vector< std::string > getScriptsForPaths(const std::vector< std::string > &dirPaths)
Definition: bindingswrapper.cpp:171
void setLocaleAndUserInterfaceLanguage(const std::string &locale)
Definition: bindingswrapper.cpp:325
void fitImageTaskWidgetsInGridOnPrimaryMonitor()
fitImageTaskWidgetsInGridOnPrimaryMonitor Fits all of the open image task widgets into a grid on the ...
Definition: util.cpp:597
bool revealInDefaultApplication(const std::string &path)
Definition: bindingswrapper.cpp:205
void setWidgetSize(QWidget *widget, int width, int height)
setWidgetSize Sets the size of the given widget in pixels.
Definition: util.cpp:511
bool vectorContains(const std::vector< T > &v, const T &t)
Definition: bindingswrapper.h:181
float clampFloat(const float value, const float lower, const float upper)
Definition: bindingswrapper.cpp:280
The ImageTaskWindow class encapsulates the UI for manipiulating, running and viewing an image task th...
Definition: imagetaskwindow.h:31
void openTasks(const QStringList &urls, const bool addToRecents)
Definition: taskutil.cpp:58
std::vector< std::string > split(const std::string &s, const char delimiter)
split Splits a given string into a vector of tokens using the given delimiter.
Definition: util.cpp:367
void fitImageTaskWidgetsInGridOnMonitor(int screenIdx)
fitImageTaskWidgetsInGridOnMonitor Fits all of the open image task widgets into a grid on the given m...
Definition: util.cpp:587
T randomInVector(const std::vector< T > &v)
Definition: bindingswrapper.h:157
bool stringEndsWith(const std::string &str, const std::string &suffix)
stringEndsWith Checks if a string ends with the given suffix.
Definition: util.cpp:309
void setWidgetSize(QWidget *widget, int width, int height)
Definition: bindingswrapper.cpp:413
std::string getApplicationDirectoryPath()
getApplicationDirectoryPath Gets the directory that contains the application executable.
Definition: searchpaths.cpp:16
std::string getDirectoryForFilePath(const std::string &filePath)
Definition: bindingswrapper.cpp:176