branch: externals/scanner
commit efe6d3658f9a120bb672c9ed3907b39ba5b0f763
Author: Raffael Stocker <[email protected]>
Commit: Raffael Stocker <[email protected]>
add conversion function from paper size to corner pixel coordinates
---
scanner.el | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scanner.el b/scanner.el
index dce56d60df..cd99954a85 100644
--- a/scanner.el
+++ b/scanner.el
@@ -597,6 +597,15 @@ y-dimension. If no size is configured, return nil."
'user-switches 'scanner-scanimage-switches)
"The arguments list used for preview scans.")
+(defun scanner--cm-to-pixels (cm resolution)
+ (floor (* (/ cm 2.54) resolution)))
+
+(defun scanner--corner-pixels (size resolution)
+ (list 0
+ 0
+ (scanner--cm-to-pixels (car size) resolution)
+ (scanner--cm-to-pixels (cadr size) resolution)))
+
(defun scanner--program-args (argspec &rest args)
"Return an arguments list as specified in ARGSPEC, assuming ARGS.