summaryrefslogtreecommitdiff
path: root/grid.go
diff options
context:
space:
mode:
authorKurt <kurt.w.jung@gmail.com>2018-04-01 21:10:50 -0400
committerKurt <kurt.w.jung@gmail.com>2018-04-01 21:10:50 -0400
commit160e539aee686d36d0fb6306037cea1e18b51e26 (patch)
tree385db1af3ccc37dd5da54c32f5ae9eec930bfc2b /grid.go
parent4a30efef16128980c97177c6260418380b0c17d2 (diff)
Add absolute value versions of Ht and Wd methods
Diffstat (limited to 'grid.go')
-rw-r--r--grid.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/grid.go b/grid.go
index 8e0cdfb..2805297 100644
--- a/grid.go
+++ b/grid.go
@@ -1,6 +1,7 @@
package gofpdf
import (
+ "math"
"strconv"
)
@@ -142,6 +143,12 @@ func NewGrid(x, y, w, h float64) (grid GridType) {
return
}
+// WdAbs returns the absolute value of dataWd, specified in logical data units,
+// that has been converted to the unit of measure specified in New().
+func (g GridType) WdAbs(dataWd float64) float64 {
+ return math.Abs(g.xm * dataWd)
+}
+
// Wd converts dataWd, specified in logical data units, to the unit of measure
// specified in New().
func (g GridType) Wd(dataWd float64) float64 {
@@ -154,6 +161,12 @@ func (g GridType) X(dataX float64) float64 {
return g.xm*dataX + g.xb
}
+// HtAbs returns the absolute value of dataHt, specified in logical data units,
+// that has been converted to the unit of measure specified in New().
+func (g GridType) HtAbs(dataHt float64) float64 {
+ return math.Abs(g.ym * dataHt)
+}
+
// Ht converts dataHt, specified in logical data units, to the unit of measure
// specified in New().
func (g GridType) Ht(dataHt float64) float64 {