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} white color.Color = color.RGBA{255, 255, 255, 255}
) )
// NewPdf creates a new pdf document with the draw2d fontfolder and // NewPdf creates a new pdf document with the draw2d fontfolder, adds
// already a page added. // a page and set fill color to white.
func NewPdf(orientationStr, unitStr, sizeStr string) *gofpdf.Fpdf { func NewPdf(orientationStr, unitStr, sizeStr string) *gofpdf.Fpdf {
pdf := gofpdf.New(orientationStr, unitStr, sizeStr, draw2d.GetFontFolder()) pdf := gofpdf.New(orientationStr, unitStr, sizeStr, draw2d.GetFontFolder())
pdf.AddPage() pdf.AddPage()
pdf.SetFillColor(255, 255, 255) // to be compatible with draw2d
return pdf return pdf
} }

View file

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