From 13f1147b90293c045f6b8048a2fe4c10be389abb Mon Sep 17 00:00:00 2001 From: Stani Date: Sat, 27 Jun 2015 18:33:15 +0200 Subject: [PATCH] set default fill color to white for NewPdf --- pdf2d/graphiccontext.go | 5 +++-- pdf2d/samples/frame-image/frame-image.go | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pdf2d/graphiccontext.go b/pdf2d/graphiccontext.go index cbd6b3b..1ded040 100644 --- a/pdf2d/graphiccontext.go +++ b/pdf2d/graphiccontext.go @@ -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 } diff --git a/pdf2d/samples/frame-image/frame-image.go b/pdf2d/samples/frame-image/frame-image.go index 5956b6f..9234e04 100644 --- a/pdf2d/samples/frame-image/frame-image.go +++ b/pdf2d/samples/frame-image/frame-image.go @@ -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()