summaryrefslogtreecommitdiff
path: root/def.go
diff options
context:
space:
mode:
authorKurt Jung <kurt.w.jung@code.google.com>2013-11-07 20:49:59 -0500
committerKurt Jung <kurt.w.jung@code.google.com>2013-11-07 20:49:59 -0500
commitc99f8c8fbf0124fcd2f509132edad09349aa3710 (patch)
treee44e5f17d2d48a68259c7b81253e6f4a4f4cfce9 /def.go
parent4188061a94636ec37b26813d79824789f0deb7d5 (diff)
Lawrence Kesteloot provided code to allow an image's extent to be determined prior to placement.
Diffstat (limited to 'def.go')
-rw-r--r--def.go14
1 files changed, 10 insertions, 4 deletions
diff --git a/def.go b/def.go
index 5d7edfd..afdc9f2 100644
--- a/def.go
+++ b/def.go
@@ -61,16 +61,22 @@ type ImageInfoType struct {
f string
dp string
trns []int
+ scale float64 // document scaling factor
+}
+
+// The width and height of the image in the units of the Fpdf object.
+func (info *ImageInfoType) Extent() (wd, ht float64) {
+ return info.w / info.scale, info.h / info.scale
}
// The width of the image in the units of the Fpdf object.
-func (info *ImageInfoType) Width(f *Fpdf) float64 {
- return info.w / f.k
+func (info *ImageInfoType) Width() float64 {
+ return info.w / info.scale
}
// The height of the image in the units of the Fpdf object.
-func (info *ImageInfoType) Height(f *Fpdf) float64 {
- return info.h / f.k
+func (info *ImageInfoType) Height() float64 {
+ return info.h / info.scale
}
type fontFileType struct {