Geometrize  1.0
An application for geometrizing images into geometric primitives
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
Functions
geometrize::script::bindings Namespace Reference

Functions

std::shared_ptr
< chaiscript::Module > 
createDefaultBindings ()
 createDefaultBindings Creates the default Chaiscript to C++ bindings. More...
 
std::shared_ptr
< chaiscript::Module > 
createLaunchWindowBindings ()
 createLaunchWindowBindings Creates the Chaiscript to C++ bindings for the Geometrize launch window. More...
 
std::shared_ptr
< chaiscript::Module > 
createImageTaskWindowBindings ()
 createImageTaskWindowBindings Creates the Chaiscript to C++ binding for the Geometrize image task window. More...
 
std::shared_ptr
< chaiscript::Module > 
createImageBindings ()
 createImageBindings Creates the Chaiscript to C++ bindings for image manipulation. More...
 
std::shared_ptr
< chaiscript::Module > 
createImageTaskBindings ()
 createImageTaskBindings Creates the Chaiscript to C++ bindings for Geometrize image tasks. More...
 
std::shared_ptr
< chaiscript::Module > 
createImageExportBindings ()
 createImageExportBindings Creates the Chaiscript to C++ bindings for saving images. More...
 
std::shared_ptr
< chaiscript::Module > 
createAnimatedGifExportBindings ()
 createGifExportBindings Creates the ChaiScript to C++ bindings for saving animated GIFs. More...
 
std::shared_ptr
< chaiscript::Module > 
createGeometrizeLibraryBindings ()
 createGeometrizeLibraryBindings Creates the Chaiscript to C++ bindings for all of the functionality in the Geometrize library. More...
 
std::shared_ptr
< chaiscript::Module > 
createTabletEventBindings ()
 createTabletEventBindings Creates the Chaiscript to C++ bindings for tablet events (e.g. Wacom pen input data). More...
 
std::shared_ptr
< chaiscript::Module > 
createMathBindings ()
 createMathBindings Creates the Chaiscript to C++ bindings for common math functions. More...
 
std::shared_ptr
< chaiscript::Module > 
createUserInterfacePuppeteerBindings ()
 createUserInterfacePuppeteerBindings Creates ChaiScript to C++ bindings for driving the user interface (primarily for testing purposes). More...
 
geometrize::dialog::ImageTaskWindowcreateImageTaskWindow ()
 
geometrize::dialog::LaunchWindowcreateLaunchWindow ()
 
geometrize::task::ImageTaskcreateImageTask (geometrize::Bitmap &bitmap)
 
std::string getApplicationDirectoryPath ()
 
void printToConsole (const std::string &str)
 
void printToAllScriptConsoleWidgets (const std::string &str)
 
void messageBox (const std::string &str)
 
void debugBreak ()
 
void processApplicationEvents ()
 
bool fileExists (const std::string &filePath)
 
bool directoryExists (const std::string &dirPath)
 
bool directoryContainsFile (const std::string &dirPath, const std::string &fileName)
 
std::string readFileAsString (const std::string &filePath)
 
std::vector< std::string > getFilePathsForDirectory (const std::string &dirPath)
 
std::vector< std::string > getScriptSearchPaths ()
 
std::vector< std::string > getTemplateSearchPaths ()
 
std::string getFirstFileWithExtension (const std::string &dirPath, const std::string &extension)
 
std::string getFirstFileWithExtensions (const std::string &dirPath, const std::vector< std::string > &extensions)
 
std::vector< std::string > getFilesWithExtensions (const std::string &, const std::vector< std::string > &)
 
std::vector< std::string > getFilesWithExtension (const std::string &dirPath, const std::string &extension)
 
std::vector< std::string > getSupportedImageFileExtensions ()
 
std::vector< std::string > getScriptsForPath (const std::string &dirPath)
 
void openTask (const std::string &url, const bool addToRecents)
 
bool openInDefaultApplication (const std::string &path)
 
bool revealInDefaultApplication (const std::string &path)
 
void clearGlobalClipboard ()
 
std::string getGlobalClipboardText ()
 
void setGlobalClipboardText (const std::string &text)
 
bool stringBeginsWith (const std::string &str, const std::string &prefix)
 
bool stringEndsWith (const std::string &str, const std::string &suffix)
 
std::string getApplicationDirectoryLocation ()
 
std::string getAppDataLocation ()
 
std::string getHomeDirectoryLocation ()
 
bool writeStringToFile (const std::string &str, const std::string &path)
 
std::string percentEncode (const std::string &str)
 
int randomIntInRange (const int lower, const int upper)
 
float randomFloatInRange (const float lower, const float upper)
 
int clampInt (const int value, const int lower, const int upper)
 
float clampFloat (const float value, const float lower, const float upper)
 
std::vector< std::string > split (const std::string &s, const char delimiter)
 
std::string getOperatingSystemProductType ()
 
int getCursorX ()
 
int getCursorY ()
 
void setCursorPos (const int x, const int y)
 
void setTranslatorsForLocale (const std::string &locale)
 
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)
 
bool saveDesktopScreenshot (const std::string &path)
 
bool saveWidgetScreenshot (const std::string &path, QWidget *widget)
 
std::string customTabletEventDataToString (const geometrize::scene::TabletEventData &data)
 
template<typename T , typename U , typename V >
randomInRange (U lower, V upper)
 
template<typename T >
randomInVector (const std::vector< T > &v)
 
template<typename T , typename U , typename V >
clamp (T value, U lower, V upper)
 
template<typename T >
bool vectorContains (const std::vector< T > &v, const T &t)
 

Function Documentation

template<typename T , typename U , typename V >
T geometrize::script::bindings::clamp ( value,
lower,
upper 
)
142 {
143  assert(lower <= upper);
144  if (value < lower) {
145  value = lower;
146  }
147  if (value > upper) {
148  value = upper;
149  }
150  return value;
151 }

Here is the caller graph for this function:

float geometrize::script::bindings::clampFloat ( const float  value,
const float  lower,
const float  upper 
)
235 {
236  return clamp<float, float, float>(value, lower, upper);
237 }

Here is the caller graph for this function:

int geometrize::script::bindings::clampInt ( const int  value,
const int  lower,
const int  upper 
)
230 {
231  return clamp<int, int, int>(value, lower, upper);
232 }

Here is the caller graph for this function:

void geometrize::script::bindings::clearGlobalClipboard ( )
170 {
172 }
void clearGlobalClipboard()
clearGlobalClipboard Clears the global system clipboard contents.
Definition: util.cpp:231

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createAnimatedGifExportBindings ( )

createGifExportBindings Creates the ChaiScript to C++ bindings for saving animated GIFs.

Returns
A shared pointer to a module encapsulating the bindings.
308 {
309  using namespace geometrize::script::bindings;
310 
311  auto module = createModule();
312 
314 
315  return module;
316 }
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:269
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createDefaultBindings ( )

createDefaultBindings Creates the default Chaiscript to C++ bindings.

Returns
A shared pointer to a module encapsulating the bindings.
83 {
84  auto module = createModule();
85 
87 
92 
99 
102 
104 
110 
112 
114 
117 
121 
124 
128 
130 
132 
133  ADD_FREE_FUN_TEMPLATE(randomInRange, float COMMA float COMMA float);
134  ADD_FREE_FUN_TEMPLATE(clamp, float COMMA float COMMA float);
135 
136  // Some specialized helper templates if in doubt
139 
142 
143  ADD_FREE_FUN_TEMPLATE(randomInVector, std::pair<int COMMA int>);
144  ADD_FREE_FUN_TEMPLATE(randomInVector, std::pair<float COMMA float>);
145 
146  ADD_FREE_FUN_TEMPLATE(vectorContains, std::pair<int COMMA int>);
147  ADD_FREE_FUN_TEMPLATE(vectorContains, std::pair<float COMMA float>);
148 
150 
152 
154 
155  return module;
156 }
bool openInDefaultApplication(const std::string &path)
openInDefaultApplication Opens the given path in the default application.
Definition: util.cpp:220
std::string getAppDataLocation()
getAppDataLocation Returns a directory location where persistent application data can be stored...
Definition: util.cpp:261
float randomFloatInRange(const float lower, const float upper)
Definition: bindingswrapper.cpp:224
bool fileExists(const std::string &filePath)
fileExists Checks if a file exists, returns true if it does.
Definition: util.cpp:87
void clearGlobalClipboard()
clearGlobalClipboard Clears the global system clipboard contents.
Definition: util.cpp:231
void setTranslatorsForLocale(const QString &locale)
installTranslatorsForLocale Installs translators for the application.
Definition: localization.cpp:74
void printToAllScriptConsoleWidgets(const std::string &str)
printToAllScriptConsoleWidgets A convenience function for printing a string to all the GUI console wi...
Definition: util.cpp:59
std::string getGlobalClipboardText()
getGlobalClipboardText Gets the global system clipboard text.
Definition: util.cpp:236
bool vectorContains(const std::vector< T > &v, const T &t)
Definition: bindingswrapper.h:158
int clampInt(const int value, const int lower, const int upper)
Definition: bindingswrapper.cpp:229
void processApplicationEvents()
processApplicationEvents Processes all pending application events for the calling thread...
Definition: util.cpp:77
std::string getHomeDirectoryLocation()
getHomeDirectoryLocation Returns a path to where the user's home directory is.
Definition: util.cpp:266
int randomIntInRange(const int lower, const int upper)
Definition: bindingswrapper.cpp:219
float clampFloat(const float value, const float lower, const float upper)
Definition: bindingswrapper.cpp:234
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:181
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:112
bool revealInDefaultApplication(const std::string &path)
revealInDefaultApplication Reveals the given path in the parent folder (or path with the filename tri...
Definition: util.cpp:225
bool stringEndsWith(const std::string &str, const std::string &suffix)
stringEndsWith Checks if a string ends with the given suffix.
Definition: util.cpp:251
std::vector< std::string > getSupportedImageFileExtensions()
Definition: bindingswrapper.cpp:135
T randomInVector(const std::vector< T > &v)
Definition: bindingswrapper.h:134
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:193
std::string percentEncode(const std::string &str)
percentEncode Returns a percent-encoded copy of the input string.
Definition: util.cpp:291
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:171
bool directoryExists(const std::string &dirPath)
directoryExists Checks if a directory exists, returns true if it does.
Definition: util.cpp:92
void sleep(const std::size_t ms)
sleep Causes the calling thread to sleep for the given length of time.
Definition: scriptutil.cpp:43
void printToConsole(const std::string &str)
printToConsole A convenience function for printing a string to the command-line console.
Definition: util.cpp:54
void openTask(const std::string &url, const bool addToRecents)
Definition: bindingswrapper.cpp:145
std::vector< std::string > getFilesWithExtension(const std::string &dirPath, const std::string &extension)
getFilesWithExtension Gets the absolute file paths to the files with the given extension in the given...
Definition: util.cpp:160
void messageBox(const std::string &str)
messageBox A convenience function for displaying a message box containing a message.
Definition: util.cpp:70
std::vector< std::string > getFilesWithExtensions(const std::string &, const std::vector< std::string > &)
Definition: bindingswrapper.cpp:119
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:97
std::string getApplicationDirectoryLocation()
getApplicationDirectory Get directory that the application is in.
Definition: util.cpp:256
#define COMMA
Definition: bindingshelpers.h:5
#define ADD_FREE_FUN_TEMPLATE(Name, Params)
Definition: bindingshelpers.h:9
bool stringBeginsWith(const std::string &str, const std::string &prefix)
stringBeginsWith Checks if a string begins with the given prefix.
Definition: util.cpp:246
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
std::string getApplicationDirectoryPath()
getApplicationDirectoryPath Gets the directory that contains the application executable.
Definition: searchpaths.cpp:16
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:123
T clamp(T value, T lower, T upper)
clamp Clamps a value within a range.
Definition: util.h:220
std::vector< std::string > getTemplateSearchPaths()
getTemplateSearchpaths Gets the directory paths that the program will search for project file templat...
Definition: searchpaths.cpp:26
void debugBreak()
debugBreak Forces the debugger to break/halt the application when this is called. ...
Definition: util.cpp:42
std::vector< std::string > getScriptSearchPaths()
getScriptSearchPaths Gets the directory paths that the program will search for scripts. These may include resources (":/resourcedir/"), relative ("../../templates"), or absolute directory paths ("C:/Users/admin/Desktop").
Definition: searchpaths.cpp:21
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:304
void setGlobalClipboardText(const std::string &text)
setClipboardText Sets the global system clipboard text.
Definition: util.cpp:241
std::string getOperatingSystemProductType()
getOperatingSystemProductType Returns the product name of the operating system this application is ru...
Definition: util.cpp:326
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:298
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:271

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createGeometrizeLibraryBindings ( )

createGeometrizeLibraryBindings Creates the Chaiscript to C++ bindings for all of the functionality in the Geometrize library.

Returns
A shared pointer to a module enscapsulating the bindings.
319 {
320  auto module = createModule();
321 
322  ADD_TYPE(Bitmap);
323  ADD_CONSTRUCTOR(Bitmap, Bitmap(std::uint32_t COMMA std::uint32_t COMMA geometrize::rgba));
324  ADD_CONSTRUCTOR(Bitmap, Bitmap(std::uint32_t COMMA std::uint32_t COMMA const std::vector<std::uint8_t>& data));
325  ADD_CONSTRUCTOR(Bitmap, Bitmap(const geometrize::Bitmap&));
326  ADD_MEMBER(Bitmap, getWidth);
327  ADD_MEMBER(Bitmap, getHeight);
328  ADD_MEMBER(Bitmap, copyData);
329  ADD_MEMBER(Bitmap, getDataRef);
330  ADD_MEMBER(Bitmap, getPixel);
331  ADD_MEMBER(Bitmap, setPixel);
332  ADD_MEMBER(Bitmap, fill);
333 
334  ADD_TYPE(rgba);
335  ADD_MEMBER(rgba, r);
336  ADD_MEMBER(rgba, g);
337  ADD_MEMBER(rgba, b);
338  ADD_MEMBER(rgba, a);
339 
340  using namespace geometrize::exporter;
341 
342  ADD_FREE_FUN(exportBitmapData);
344  ADD_FREE_FUN(exportShapeArray);
345  ADD_FREE_FUN(exportShapeJson);
346  ADD_FREE_FUN(exportSVG);
347 
348  ADD_TYPE(ImageRunner);
349  ADD_CONSTRUCTOR(ImageRunner, ImageRunner(const geometrize::Bitmap&));
350  ADD_CONSTRUCTOR(ImageRunner, ImageRunner(const geometrize::Bitmap& COMMA const geometrize::Bitmap&));
351  ADD_MEMBER(ImageRunner, step);
352  //ADD_MEMBER(ImageRunner, getCurrent);
353  //ADD_MEMBER(ImageRunner, getTarget);
354  ADD_MEMBER(ImageRunner, getModel);
355 
356  ADD_TYPE(Shape);
357  ADD_MEMBER(Shape, getType);
358  ADD_MEMBER(Shape, clone);
359 
360  ADD_BASE_CLASS(Shape, Circle);
361  ADD_TYPE(Circle);
362  ADD_CONSTRUCTOR(Circle, Circle(float COMMA float COMMA float));
363  ADD_MEMBER(Circle, m_x);
364  ADD_MEMBER(Circle, m_y);
365  ADD_MEMBER(Circle, m_r);
366 
367  ADD_BASE_CLASS(Shape, Ellipse);
368  ADD_TYPE(Ellipse);
369  ADD_CONSTRUCTOR(Ellipse, Ellipse(float COMMA float COMMA float COMMA float));
370  ADD_MEMBER(Ellipse, m_x);
371  ADD_MEMBER(Ellipse, m_y);
372  ADD_MEMBER(Ellipse, m_rx);
373  ADD_MEMBER(Ellipse, m_ry);
374 
375  ADD_BASE_CLASS(Shape, Line);
376  ADD_TYPE(Line);
377  ADD_CONSTRUCTOR(Line, Line(float COMMA float COMMA float COMMA float));
378  ADD_MEMBER(Line, m_x1);
379  ADD_MEMBER(Line, m_y1);
380  ADD_MEMBER(Line, m_x2);
381  ADD_MEMBER(Line, m_y2);
382 
383  ADD_BASE_CLASS(Shape, Polyline);
384  ADD_TYPE(Polyline);
385  ADD_CONSTRUCTOR(Polyline, Polyline(const std::vector<std::pair<float, float>>));
386 
387  // Make the polyline points vector accessible from scripts
388  chaiscript::bootstrap::standard_library::pair_type<std::pair<float, float>>("FloatPair", *module);
389  chaiscript::bootstrap::standard_library::vector_type<std::vector<std::pair<float, float>>>("IntPairVector", *module);
390  module->add(chaiscript::vector_conversion<std::vector<std::pair<float, float>>>());
391  ADD_MEMBER(Polyline, m_points);
392 
393  ADD_BASE_CLASS(Shape, QuadraticBezier);
394  ADD_TYPE(QuadraticBezier);
395  ADD_CONSTRUCTOR(QuadraticBezier, QuadraticBezier(float COMMA float COMMA float COMMA float COMMA float COMMA float));
396  ADD_MEMBER(QuadraticBezier, m_cx);
397  ADD_MEMBER(QuadraticBezier, m_cy);
398  ADD_MEMBER(QuadraticBezier, m_x1);
399  ADD_MEMBER(QuadraticBezier, m_y1);
400  ADD_MEMBER(QuadraticBezier, m_x2);
401  ADD_MEMBER(QuadraticBezier, m_y2);
402 
403  ADD_BASE_CLASS(Shape, Rectangle);
404  ADD_TYPE(Rectangle);
405  ADD_CONSTRUCTOR(Rectangle, Rectangle(float COMMA float COMMA float COMMA float));
406  ADD_MEMBER(Rectangle, m_x1);
407  ADD_MEMBER(Rectangle, m_y1);
408  ADD_MEMBER(Rectangle, m_x2);
409  ADD_MEMBER(Rectangle, m_y2);
410 
411  ADD_BASE_CLASS(Shape, RotatedEllipse);
412  ADD_TYPE(RotatedEllipse);
413  ADD_CONSTRUCTOR(RotatedEllipse, RotatedEllipse(float COMMA float COMMA float COMMA float COMMA float));
414  ADD_MEMBER(RotatedEllipse, m_x);
415  ADD_MEMBER(RotatedEllipse, m_y);
416  ADD_MEMBER(RotatedEllipse, m_rx);
417  ADD_MEMBER(RotatedEllipse, m_ry);
418  ADD_MEMBER(RotatedEllipse, m_angle);
419 
420  ADD_BASE_CLASS(Shape, RotatedRectangle);
421  ADD_TYPE(RotatedRectangle);
422  ADD_CONSTRUCTOR(RotatedRectangle, RotatedRectangle(float COMMA float COMMA float COMMA float COMMA float));
423  ADD_MEMBER(RotatedRectangle, m_x1);
424  ADD_MEMBER(RotatedRectangle, m_y1);
425  ADD_MEMBER(RotatedRectangle, m_x2);
426  ADD_MEMBER(RotatedRectangle, m_y2);
427  ADD_MEMBER(RotatedRectangle, m_angle);
428 
429  ADD_BASE_CLASS(Shape, Triangle);
430  ADD_TYPE(Triangle);
431  ADD_CONSTRUCTOR(Triangle, Triangle(float COMMA float COMMA float COMMA float COMMA float COMMA float));
432  ADD_MEMBER(Triangle, m_x1);
433  ADD_MEMBER(Triangle, m_y1);
434  ADD_MEMBER(Triangle, m_x2);
435  ADD_MEMBER(Triangle, m_y2);
436  ADD_MEMBER(Triangle, m_x3);
437  ADD_MEMBER(Triangle, m_y3);
438 
439  chaiscript::utility::add_class<geometrize::ShapeTypes>(*module,
440  "ShapeTypes",
441  {
442  { RECTANGLE, "RECTANGLE" },
443  { ROTATED_RECTANGLE, "ROTATED_RECTANGLE" },
444  { TRIANGLE, "TRIANGLE" },
445  { ELLIPSE, "ELLIPSE" },
446  { ROTATED_ELLIPSE, "ROTATED_ELLIPSE" },
447  { CIRCLE, "CIRCLE" },
448  { LINE, "LINE" },
449  { QUADRATIC_BEZIER, "QUADRATIC_BEZIER" },
450  { POLYLINE, "POLYLINE" }
451  });
452 
453  using namespace geometrize::core;
454 
455  ADD_FREE_FUN(defaultEnergyFunction);
456 
457  ADD_TYPE(Scanline);
458  ADD_MEMBER(Scanline, y);
459  ADD_MEMBER(Scanline, x1);
460  ADD_MEMBER(Scanline, x2);
461 
462  chaiscript::bootstrap::standard_library::vector_type<std::vector<Scanline>>("ScanlineVector", *module);
463 
464  using namespace geometrize::commonutil;
465 
466  ADD_FREE_FUN(seedRandomGenerator);
467  ADD_FREE_FUN(getAverageImageColor);
468 
469  ADD_FREE_FUN(shapesOverlap);
470  ADD_FREE_FUN(shapeContains);
471 
472  ADD_FREE_FUN(shapeToPixels);
473 
474  ADD_TYPE(Model);
475  ADD_CONSTRUCTOR(Model, Model(const geometrize::Bitmap&));
476  ADD_CONSTRUCTOR(Model, Model(const geometrize::Bitmap& COMMA const geometrize::Bitmap&));
477 
478  ADD_MEMBER(Model, reset);
479  ADD_MEMBER(Model, getWidth);
480  ADD_MEMBER(Model, getHeight);
481  ADD_MEMBER(Model, step);
482  //ADD_MEMBER(Model, drawShape);
483  //ADD_MEMBER(Model, getCurrent);
484  //ADD_MEMBER(Model, getTarget);
485  ADD_MEMBER(Model, setSeed);
486 
487  return module;
488 }
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
#define ADD_BASE_CLASS(Base, Derived)
Definition: bindingshelpers.h:13
#define COMMA
Definition: bindingshelpers.h:5
bool exportBitmap(const geometrize::Bitmap &bitmap, const std::string &filePath)
exportBitmap Exports the Geometrize bitmap data to an image format that Qt supports (depending on the...
Definition: imageexporter.cpp:24
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
#define ADD_CONSTRUCTOR(Class, Signature)
Definition: bindingshelpers.h:14

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createImageBindings ( )

createImageBindings Creates the Chaiscript to C++ bindings for image manipulation.

Returns
A shared pointer to a module encapsulating the bindings.
207 {
208  using namespace geometrize::image;
209 
210  auto module = createModule();
211 
212  ADD_TYPE(QImage);
213 
214  ADD_MEMBER(QImage, sizeInBytes);
215  ADD_MEMBER(QImage, colorCount);
216  ADD_MEMBER(QImage, depth);
217  ADD_MEMBER(QImage, isNull);
218  ADD_MEMBER(QImage, width);
219  ADD_MEMBER(QImage, height);
220 
221  chaiscript::utility::add_class<Qt::TransformationMode>(*module,
222  "TransformationMode",
223  {
224  { Qt::FastTransformation, "QtFastTransformation" },
225  { Qt::SmoothTransformation, "QtSmoothTransformation" }
226  });
227  ADD_MEMBER(QImage, scaledToWidth);
228  ADD_MEMBER(QImage, scaledToHeight);
229 
234 
235  return module;
236 }
geometrize::Bitmap convertImageToBitmapWithDownscaling(const QImage &image)
imageToBitmapWithDownscaling Creates a bitmap data object from the given image, downscaling in the pr...
Definition: imageloader.cpp:30
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
QImage loadImage(const std::string &filePath)
loadImage Loads an image from the image at the file path. Converts to RGBA8888 format.
Definition: imageloader.cpp:62
QImage convertImageToRgba8888(const QImage &image)
convertImageToRgba8888 Returns a copy of the image in the RGBA8888 format.
Definition: imageloader.cpp:74
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
Bitmap createBitmap(const QImage &image)
createBitmap Creates a bitmap data object from the given image.
Definition: imageloader.cpp:20

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createImageExportBindings ( )

createImageExportBindings Creates the Chaiscript to C++ bindings for saving images.

Returns
A shared pointer to a module encapsulating the bindings.
295 {
296  using namespace geometrize::exporter;
297 
298  auto module = createModule();
299 
303 
304  return module;
305 }
bool exportRasterizedSvg(const std::vector< geometrize::ShapeResult > &shapes, const std::uint32_t inputWidth, const std::uint32_t inputHeight, const std::uint32_t outputWidth, const std::uint32_t outputHeight, const std::string &filePath)
exportRasterizedSvg Exports the shape data as an image by rasterizing an SVG rendered from the shape ...
Definition: imageexporter.cpp:74
bool exportImage(const QImage &image, const std::string &filePath)
exportImage Exports the image data to an image format that Qt supports (depending on the file extensi...
Definition: imageexporter.cpp:30
bool exportBitmap(const geometrize::Bitmap &bitmap, const std::string &filePath)
exportBitmap Exports the Geometrize bitmap data to an image format that Qt supports (depending on the...
Definition: imageexporter.cpp:24
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8

Here is the call graph for this function:

Here is the caller graph for this function:

geometrize::task::ImageTask * geometrize::script::bindings::createImageTask ( geometrize::Bitmap &  bitmap)
40 {
41  return new task::ImageTask(bitmap);
42 }

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createImageTaskBindings ( )

createImageTaskBindings Creates the Chaiscript to C++ bindings for Geometrize image tasks.

Returns
A shared pointer to a module encapsulating the bindings.
239 {
240  using namespace geometrize::task;
241  using namespace geometrize::preferences;
242 
243  auto module = createModule();
244 
245  // Note we use synchronous-stepping image tasks for simplicity in scripts
247 
249 
250  ADD_MEMBER(SynchronousImageTask, stepModel);
251  ADD_MEMBER(SynchronousImageTask, drawBackgroundRectangle);
252  ADD_MEMBER(SynchronousImageTask, getTarget);
253  ADD_MEMBER(SynchronousImageTask, getCurrent);
254  ADD_MEMBER(SynchronousImageTask, getPreferences);
255  ADD_MEMBER(SynchronousImageTask, setPreferences);
256  ADD_MEMBER(SynchronousImageTask, getShapes);
257 
259 
261 
262  ADD_MEMBER(ImageTask, stepModel);
263  ADD_MEMBER(ImageTask, drawBackgroundRectangle);
264  //ADD_MEMBER(ImageTask, getTarget);
265  //ADD_MEMBER(ImageTask, getCurrent);
266  ADD_MEMBER(ImageTask, getPreferences);
267  ADD_MEMBER(ImageTask, setPreferences);
268  //ADD_MEMBER(ImageTask, getShapes);
269 
271 
273 
277 
278  ADD_MEMBER(ImageTaskPreferences, enableShapeTypes);
279  ADD_MEMBER(ImageTaskPreferences, disableShapeTypes);
280  ADD_MEMBER(ImageTaskPreferences, setShapeTypes);
281  ADD_MEMBER(ImageTaskPreferences, setShapeAlpha);
282  ADD_MEMBER(ImageTaskPreferences, setCandidateShapeCount);
283  ADD_MEMBER(ImageTaskPreferences, setMaxShapeMutations);
285  ADD_MEMBER(ImageTaskPreferences, setMaxThreads);
286 
287  ADD_MEMBER(ImageTaskPreferences, isScriptModeEnabled);
288  ADD_MEMBER(ImageTaskPreferences, setScriptModeEnabled);
289  ADD_MEMBER(ImageTaskPreferences, setScript);
290 
291  return module;
292 }
The SynchronousImageTask class transforms a source image into a collection of shapes approximating th...
Definition: synchronousimagetask.h:27
The ImageTaskPreferences class models the preferences associated with an image task.
Definition: imagetaskpreferences.h:28
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
geometrize::task::ImageTask * createImageTask(geometrize::Bitmap &bitmap)
Definition: bindingswrapper.cpp:39
The ImageTask class transforms a source image into a collection of shapes approximating the source im...
Definition: imagetask.h:50
#define ADD_CONSTRUCTOR(Class, Signature)
Definition: bindingshelpers.h:14

Here is the call graph for this function:

Here is the caller graph for this function:

geometrize::dialog::ImageTaskWindow * geometrize::script::bindings::createImageTaskWindow ( )
30 {
31  return new dialog::ImageTaskWindow();
32 }

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createImageTaskWindowBindings ( )

createImageTaskWindowBindings Creates the Chaiscript to C++ binding for the Geometrize image task window.

Returns
A shared pointer to a module encapsulating the bindings.
182 {
183  using namespace geometrize::dialog;
184  using namespace geometrize::common::ui;
185 
186  auto module = createModule();
187 
189 
190  ADD_BASE_CLASS(QMainWindow, ImageTaskWindow);
193 
195 
197 
200  ADD_MEMBER(ImageTaskWindow, getImageTask);
201  ADD_MEMBER(ImageTaskWindow, setImageTask);
202 
203  return module;
204 }
The ImageTaskWindow class encapsulates the UI for manipiulating, running and viewing an image task th...
Definition: imagetaskwindow.h:28
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
geometrize::dialog::ImageTaskWindow * createImageTaskWindow()
Definition: bindingswrapper.cpp:29
#define ADD_BASE_CLASS(Base, Derived)
Definition: bindingshelpers.h:13
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
#define ADD_CONSTRUCTOR(Class, Signature)
Definition: bindingshelpers.h:14

Here is the call graph for this function:

Here is the caller graph for this function:

geometrize::dialog::LaunchWindow * geometrize::script::bindings::createLaunchWindow ( )
35 {
36  return new dialog::LaunchWindow();
37 }

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createLaunchWindowBindings ( )

createLaunchWindowBindings Creates the Chaiscript to C++ bindings for the Geometrize launch window.

Returns
A shared pointer to a module encapsulating the bindings.
159 {
160  using namespace geometrize::dialog;
161  using namespace geometrize::common::ui;
162 
163  auto module = createModule();
164 
166 
167  ADD_BASE_CLASS(QMainWindow, LaunchWindow);
168  ADD_BASE_CLASS(QWidget, LaunchWindow);
169  ADD_BASE_CLASS(QObject, LaunchWindow);
170 
172 
174 
175  ADD_MEMBER(LaunchWindow, show);
176  ADD_MEMBER(LaunchWindow, hide);
177 
178  return module;
179 }
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
#define ADD_BASE_CLASS(Base, Derived)
Definition: bindingshelpers.h:13
geometrize::dialog::LaunchWindow * createLaunchWindow()
Definition: bindingswrapper.cpp:34
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
#define ADD_CONSTRUCTOR(Class, Signature)
Definition: bindingshelpers.h:14
The LaunchWindow class models the UI for a launchpad for opening new task templates and recent tasks...
Definition: launchwindow.h:19

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createMathBindings ( )

createMathBindings Creates the Chaiscript to C++ bindings for common math functions.

Returns
A shared pointer to a module encapsulating the bindings.
535 {
537 }
ModulePtr bootstrap(ModulePtr m=std::make_shared< Module >())
Definition: chaiscriptmathextras.h:550

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createTabletEventBindings ( )

createTabletEventBindings Creates the Chaiscript to C++ bindings for tablet events (e.g. Wacom pen input data).

Returns
A shared pointer to a module encapsulating the bindings.
491 {
492  using namespace geometrize::scene;
493 
494  auto module = createModule();
495 
496  chaiscript::utility::add_class<TabletEventType>(*module,
497  "TabletEventType",
498  {
499  { TabletEventType::Move, "Move" },
500  { TabletEventType::Press, "Press" },
501  { TabletEventType::Release, "Release" },
502  { TabletEventType::EnterProximity, "EnterProximity" },
503  { TabletEventType::LeaveProximity, "LeaveProximity" },
504  { TabletEventType::Unknown, "Unknown" }
505  });
506 
507  chaiscript::utility::add_class<TabletEventPointerType>(*module,
508  "TabletEventPointerType",
509  {
510  { TabletEventPointerType::UnknownPointer, "UnknownPointer" },
511  { TabletEventPointerType::Pen, "Pen" },
512  { TabletEventPointerType::Cursor, "Cursor" },
513  { TabletEventPointerType::Eraser, "Eraser" }
514  });
515 
517  ADD_MEMBER(TabletEventData, eventType);
518  ADD_MEMBER(TabletEventData, pointerType);
519  ADD_MEMBER(TabletEventData, xViewPos);
520  ADD_MEMBER(TabletEventData, yViewPos);
521  ADD_MEMBER(TabletEventData, xScenePos);
522  ADD_MEMBER(TabletEventData, yScenePos);
523  ADD_MEMBER(TabletEventData, pressure);
524  ADD_MEMBER(TabletEventData, tangentialPressure);
525  ADD_MEMBER(TabletEventData, rotation);
526  ADD_MEMBER(TabletEventData, xTilt);
527  ADD_MEMBER(TabletEventData, yTilt);
528 
530 
531  return module;
532 }
#define ADD_TYPE(Class)
Definition: bindingshelpers.h:12
#define ADD_MEMBER(Class, Name)
Definition: bindingshelpers.h:10
The TabletEventData class represents data produced from a Wacom pen/tablet event (in the context of a...
Definition: customtabletevent.h:55
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8
std::string customTabletEventDataToString(const geometrize::scene::TabletEventData &data)
Definition: bindingswrapper.cpp:292

Here is the call graph for this function:

Here is the caller graph for this function:

std::shared_ptr< chaiscript::Module > geometrize::script::bindings::createUserInterfacePuppeteerBindings ( )

createUserInterfacePuppeteerBindings Creates ChaiScript to C++ bindings for driving the user interface (primarily for testing purposes).

Returns
A shared pointer encapsulating the bindings.
540 {
541  auto module = createModule();
542 
546 
549 
550  return module;
551 }
int getCursorX()
getCursorX Gets the x-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:311
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:344
void setCursorPos(const int x, const int y)
setCursorPos Sets the cursor position in global screen coordinates.
Definition: util.cpp:321
bool saveDesktopScreenshot(const std::string &path)
saveDesktopScreenshot Takes a screenshot of the desktop and saves it as a .png image to the given pat...
Definition: util.cpp:331
int getCursorY()
getCursorY Gets the y-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:316
#define ADD_FREE_FUN(Name)
Definition: bindingshelpers.h:8

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::customTabletEventDataToString ( const geometrize::scene::TabletEventData data)
293 {
294  return geometrize::scene::tabletEventDataToString(data).toStdString();
295 }
QString tabletEventDataToString(const TabletEventData &data)
tabletEventDataToString Helper function to convert a structure of tablet event data to a string ...
Definition: customtabletevent.cpp:44

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::debugBreak ( )
65 {
67 }
void debugBreak()
debugBreak Forces the debugger to break/halt the application when this is called. ...
Definition: util.cpp:42

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::directoryContainsFile ( const std::string &  dirPath,
const std::string &  fileName 
)
85 {
86  return geometrize::util::directoryContainsFile(dirPath, fileName);
87 }
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:97

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::directoryExists ( const std::string &  dirPath)
80 {
81  return geometrize::util::directoryExists(dirPath);
82 }
bool directoryExists(const std::string &dirPath)
directoryExists Checks if a directory exists, returns true if it does.
Definition: util.cpp:92

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::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 
)
276 {
277  return geometrize::exporter::exportGIF(data, inputWidth, inputHeight, outputWidth, outputHeight, [frameSkip](std::size_t frameIndex) {
278  return frameSkip == 0U ? false : (frameIndex % frameSkip == 0);
279  }, filePath);
280 }
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

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::fileExists ( const std::string &  filePath)
75 {
76  return geometrize::util::fileExists(filePath);
77 }
bool fileExists(const std::string &filePath)
fileExists Checks if a file exists, returns true if it does.
Definition: util.cpp:87

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getAppDataLocation ( )
200 {
202 }
std::string getAppDataLocation()
getAppDataLocation Returns a directory location where persistent application data can be stored...
Definition: util.cpp:261

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getApplicationDirectoryLocation ( )
195 {
197 }
std::string getApplicationDirectoryLocation()
getApplicationDirectory Get directory that the application is in.
Definition: util.cpp:256

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getApplicationDirectoryPath ( )
45 {
47 }
std::string getApplicationDirectoryPath()
getApplicationDirectoryPath Gets the directory that contains the application executable.
Definition: searchpaths.cpp:16

Here is the call graph for this function:

Here is the caller graph for this function:

int geometrize::script::bindings::getCursorX ( )
250 {
252 }
int getCursorX()
getCursorX Gets the x-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:311

Here is the call graph for this function:

Here is the caller graph for this function:

int geometrize::script::bindings::getCursorY ( )
255 {
257 }
int getCursorY()
getCursorY Gets the y-coordinate of the cursor in global screen coordinates.
Definition: util.cpp:316

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getFilePathsForDirectory ( const std::string &  dirPath)
95 {
97 }
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:123

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getFilesWithExtension ( const std::string &  dirPath,
const std::string &  extension 
)
131 {
132  return getFilesWithExtensions(dirPath, { extension });
133 }
std::vector< std::string > getFilesWithExtensions(const std::string &, const std::vector< std::string > &)
Definition: bindingswrapper.cpp:119

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getFilesWithExtensions ( const std::string &  ,
const std::vector< std::string > &   
)
120 {
121  std::vector<std::string> files;
122 
123  //for(const std::string& extension : extensions) {
124  // TODO
125  //}
126 
127  return files;
128 }

Here is the caller graph for this function:

std::string geometrize::script::bindings::getFirstFileWithExtension ( const std::string &  dirPath,
const std::string &  extension 
)
110 {
111  return geometrize::util::getFirstFileWithExtension(dirPath, extension);
112 }
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:171

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getFirstFileWithExtensions ( const std::string &  dirPath,
const std::vector< std::string > &  extensions 
)
115 {
116  return geometrize::util::getFirstFileWithExtensions(dirPath, extensions);
117 }
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:181

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getGlobalClipboardText ( )
175 {
177 }
std::string getGlobalClipboardText()
getGlobalClipboardText Gets the global system clipboard text.
Definition: util.cpp:236

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getHomeDirectoryLocation ( )
205 {
207 }
std::string getHomeDirectoryLocation()
getHomeDirectoryLocation Returns a path to where the user's home directory is.
Definition: util.cpp:266

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::getOperatingSystemProductType ( )
245 {
247 }
std::string getOperatingSystemProductType()
getOperatingSystemProductType Returns the product name of the operating system this application is ru...
Definition: util.cpp:326

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getScriptSearchPaths ( )
100 {
102 }
std::vector< std::string > getScriptSearchPaths()
getScriptSearchPaths Gets the directory paths that the program will search for scripts. These may include resources (":/resourcedir/"), relative ("../../templates"), or absolute directory paths ("C:/Users/admin/Desktop").
Definition: searchpaths.cpp:21

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getScriptsForPath ( const std::string &  dirPath)
141 {
142  return geometrize::util::getScriptsForPath(dirPath);
143 }
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:193

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getSupportedImageFileExtensions ( )
136 {
138 }
std::vector< std::string > getReadableImageFileExtensions(const bool includeDotPrefix)
getReadableImageFileExtensions Gets the lower-case image file extensions that have read support...
Definition: formatsupport.cpp:11

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::getTemplateSearchPaths ( )
105 {
107 }
std::vector< std::string > getTemplateSearchPaths()
getTemplateSearchpaths Gets the directory paths that the program will search for project file templat...
Definition: searchpaths.cpp:26

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::messageBox ( const std::string &  str)
60 {
62 }
void messageBox(const std::string &str)
messageBox A convenience function for displaying a message box containing a message.
Definition: util.cpp:70

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::openInDefaultApplication ( const std::string &  path)
160 {
162 }
bool openInDefaultApplication(const std::string &path)
openInDefaultApplication Opens the given path in the default application.
Definition: util.cpp:220

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::openTask ( const std::string &  url,
const bool  addToRecents 
)
146 {
147  // Horrible workaround because QUrl doesn't handle Qt resource file prefixes well
148  // See: https://forum.qt.io/topic/1494/universal-solution-for-resource-prefix
149  // Note this breaks QUrl validation too (QUrl isValid chokes when given this modified url)
150  QString qUrl{QString::fromStdString(url)};
151  const QString strToReplace{":/"};
152  if(qUrl.startsWith(strToReplace)) {
153  qUrl.replace(0, strToReplace.size(), "qrc:///");
154  }
155 
156  geometrize::util::openTasks(QStringList(QString::fromStdString(url)), addToRecents);
157 }
void openTasks(const QStringList &urls, const bool addToRecents)
Definition: taskutil.cpp:56

Here is the call graph for this function:

Here is the caller graph for this function:

std::string geometrize::script::bindings::percentEncode ( const std::string &  str)
215 {
217 }
std::string percentEncode(const std::string &str)
percentEncode Returns a percent-encoded copy of the input string.
Definition: util.cpp:291

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::printToAllScriptConsoleWidgets ( const std::string &  str)
55 {
57 }
void printToAllScriptConsoleWidgets(const std::string &str)
printToAllScriptConsoleWidgets A convenience function for printing a string to all the GUI console wi...
Definition: util.cpp:59

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::printToConsole ( const std::string &  str)
50 {
52 }
void printToConsole(const std::string &str)
printToConsole A convenience function for printing a string to the command-line console.
Definition: util.cpp:54

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::processApplicationEvents ( )
70 {
72 }
void processApplicationEvents()
processApplicationEvents Processes all pending application events for the calling thread...
Definition: util.cpp:77

Here is the call graph for this function:

Here is the caller graph for this function:

float geometrize::script::bindings::randomFloatInRange ( const float  lower,
const float  upper 
)
225 {
226  return randomInRange<float, float, float>(lower, upper);
227 }

Here is the caller graph for this function:

template<typename T , typename U , typename V >
T geometrize::script::bindings::randomInRange ( lower,
upper 
)
126 {
127  return static_cast<T>(geometrize::util::randomInRange(static_cast<int>(lower), static_cast<int>(upper)));
128 }
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:298

Here is the call graph for this function:

Here is the caller graph for this function:

int geometrize::script::bindings::randomIntInRange ( const int  lower,
const int  upper 
)
220 {
221  return randomInRange<int, int, int>(lower, upper);
222 }

Here is the caller graph for this function:

template<typename T >
T geometrize::script::bindings::randomInVector ( const std::vector< T > &  v)
135 {
136  assert(!v.empty());
137  return v[randomInRange<int, std::size_t, std::size_t>(0, v.size() - 1)];
138 }

Here is the caller graph for this function:

std::string geometrize::script::bindings::readFileAsString ( const std::string &  filePath)
90 {
91  return geometrize::util::readFileAsString(filePath);
92 }
std::string readFileAsString(const std::string &filePath)
readFileAsString Reads a file, returning a string containing the contents.
Definition: util.cpp:112

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::revealInDefaultApplication ( const std::string &  path)
165 {
167 }
bool revealInDefaultApplication(const std::string &path)
revealInDefaultApplication Reveals the given path in the parent folder (or path with the filename tri...
Definition: util.cpp:225

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::saveDesktopScreenshot ( const std::string &  path)
283 {
285 }
bool saveDesktopScreenshot(const std::string &path)
saveDesktopScreenshot Takes a screenshot of the desktop and saves it as a .png image to the given pat...
Definition: util.cpp:331

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::saveWidgetScreenshot ( const std::string &  path,
QWidget *  widget 
)
288 {
289  return geometrize::util::saveWidgetScreenshot(path, widget);
290 }
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:344

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::setCursorPos ( const int  x,
const int  y 
)
260 {
262 }
void setCursorPos(const int x, const int y)
setCursorPos Sets the cursor position in global screen coordinates.
Definition: util.cpp:321

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::setGlobalClipboardText ( const std::string &  text)
180 {
182 }
void setGlobalClipboardText(const std::string &text)
setClipboardText Sets the global system clipboard text.
Definition: util.cpp:241

Here is the call graph for this function:

Here is the caller graph for this function:

void geometrize::script::bindings::setTranslatorsForLocale ( const std::string &  locale)
265 {
266  geometrize::setTranslatorsForLocale(QString::fromStdString(locale));
267 }
void setTranslatorsForLocale(const QString &locale)
installTranslatorsForLocale Installs translators for the application.
Definition: localization.cpp:74

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector< std::string > geometrize::script::bindings::split ( const std::string &  s,
const char  delimiter 
)
240 {
241  return geometrize::util::split(s, delimiter);
242 }
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:304

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::stringBeginsWith ( const std::string &  str,
const std::string &  prefix 
)
185 {
186  return geometrize::util::stringBeginsWith(str, prefix);
187 }
bool stringBeginsWith(const std::string &str, const std::string &prefix)
stringBeginsWith Checks if a string begins with the given prefix.
Definition: util.cpp:246

Here is the call graph for this function:

Here is the caller graph for this function:

bool geometrize::script::bindings::stringEndsWith ( const std::string &  str,
const std::string &  suffix 
)
190 {
191  return geometrize::util::stringEndsWith(str, suffix);
192 }
bool stringEndsWith(const std::string &str, const std::string &suffix)
stringEndsWith Checks if a string ends with the given suffix.
Definition: util.cpp:251

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T >
bool geometrize::script::bindings::vectorContains ( const std::vector< T > &  v,
const T &  t 
)
159 {
160  return (std::find(v.begin(), v.end(), t) != v.end());
161 }

Here is the caller graph for this function:

bool geometrize::script::bindings::writeStringToFile ( const std::string &  str,
const std::string &  path 
)
210 {
211  return geometrize::util::writeStringToFile(str, path);
212 }
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:271

Here is the call graph for this function:

Here is the caller graph for this function: