diff options
author | Kurt <kurt.w.jung@gmail.com> | 2018-04-01 21:10:50 -0400 |
---|---|---|
committer | Kurt <kurt.w.jung@gmail.com> | 2018-04-01 21:10:50 -0400 |
commit | 160e539aee686d36d0fb6306037cea1e18b51e26 (patch) | |
tree | 385db1af3ccc37dd5da54c32f5ae9eec930bfc2b | |
parent | 4a30efef16128980c97177c6260418380b0c17d2 (diff) |
Add absolute value versions of Ht and Wd methods
-rw-r--r-- | grid.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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 { |