summaryrefslogtreecommitdiff
path: root/grc/gui/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui/Utils.py')
-rw-r--r--grc/gui/Utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/grc/gui/Utils.py b/grc/gui/Utils.py
index 782a7e3a01..38fde80465 100644
--- a/grc/gui/Utils.py
+++ b/grc/gui/Utils.py
@@ -143,3 +143,13 @@ def make_screenshot(flow_graph, file_path, transparent_bg=False):
if file_path.endswith('.pdf') or file_path.endswith('.svg'):
cr.show_page()
psurf.finish()
+
+
+def scale(coor, reverse=False):
+ factor = Constants.DPI_SCALING if not reverse else 1 / Constants.DPI_SCALING
+ return tuple(int(x * factor) for x in coor)
+
+
+def scale_scalar(coor, reverse=False):
+ factor = Constants.DPI_SCALING if not reverse else 1 / Constants.DPI_SCALING
+ return int(coor * factor)