iand / draw2d

A Fork of code.google.com/p/draw2d

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support addition of custom painters

GoogleCodeExporter opened this issue · comments

I would like to have a function to create a GraphicContext using an exotic 
image type I implemented. It could be basically a modified version of 
NewGraphicContext taking a painter as parameter like the one at the end of this 
message.

Regards,
Michael

////////////////////////
func NewGraphicContext2(img draw.Image, painter Painter) *ImageGraphicContext {
    width, height := img.Bounds().Dx(), img.Bounds().Dy()
    dpi := 92
    ftContext := freetype.NewContext()
    ftContext.SetDPI(dpi)
    ftContext.SetClip(img.Bounds())
    ftContext.SetDst(img)
    gc := &ImageGraphicContext{
        NewStackGraphicContext(),
        img,
        painter,
        raster.NewRasterizer(width, height),
        raster.NewRasterizer(width, height),
        ftContext,
        dpi,
    }
    return gc
}

Original issue reported on code.google.com by Michael....@googlemail.com on 11 May 2012 at 10:18

see NewGraphicContextWithPainter

Original comment by legoff.l...@gmail.com on 28 May 2012 at 7:59

  • Changed state: Fixed