// NewGraphicContextWithPainter creates a new Graphic context from an image and a Painter (see Freetype-go) func NewGraphicContextWithPainter(img draw.Image, painter Painter) *GraphicContext { width, height := img.Bounds().Dx(), img.Bounds().Dy() dpi := 92 gc := &GraphicContext{ draw2dbase.NewStackGraphicContext(), img, painter, raster.NewRasterizer(width, height), raster.NewRasterizer(width, height), &truetype.GlyphBuf{}, dpi, } return gc }
// NewContext creates a new Context. func NewContext() *Context { return &Context{ r: raster.NewRasterizer(0, 0), fontSize: 12, dpi: 72, scale: 12 << 6, } }