diff options
author | Kurt Jung <kurt.w.jung@code.google.com> | 2013-11-07 20:49:59 -0500 |
---|---|---|
committer | Kurt Jung <kurt.w.jung@code.google.com> | 2013-11-07 20:49:59 -0500 |
commit | c99f8c8fbf0124fcd2f509132edad09349aa3710 (patch) | |
tree | e44e5f17d2d48a68259c7b81253e6f4a4f4cfce9 /def.go | |
parent | 4188061a94636ec37b26813d79824789f0deb7d5 (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.go | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -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 { |