set default fill color to white for NewPdf

This commit is contained in:
Stani 2015-06-27 18:33:15 +02:00
parent 2905171a22
commit 13f1147b90
2 changed files with 3 additions and 4 deletions

View File

@ -33,11 +33,12 @@ var (
white color.Color = color.RGBA{255, 255, 255, 255}
)
// NewPdf creates a new pdf document with the draw2d fontfolder and
// already a page added.
// NewPdf creates a new pdf document with the draw2d fontfolder, adds
// a page and set fill color to white.
func NewPdf(orientationStr, unitStr, sizeStr string) *gofpdf.Fpdf {
pdf := gofpdf.New(orientationStr, unitStr, sizeStr, draw2d.GetFontFolder())
pdf.AddPage()
pdf.SetFillColor(255, 255, 255) // to be compatible with draw2d
return pdf
}

View File

@ -5,7 +5,6 @@
package main
import (
"image/color"
"math"
"github.com/stanim/draw2d"
@ -24,7 +23,6 @@ func main() {
// Size of destination image
dw, dh := dest.GetPageSize()
// Draw frame
gc.SetFillColor(color.RGBA{0xff, 0xff, 0xff, 0xff})
draw2d.RoundRect(gc, lineWidth, lineWidth, dw-lineWidth, dh-lineWidth, 100, 100)
gc.SetLineWidth(lineWidth)
gc.FillStroke()