From c231f3cce3b20ed1b6a43d631ae2a779d15d78b7 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 18 Sep 2016 19:18:08 +0200 Subject: Add gc --- gc/gc.go | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 gc/gc.go diff --git a/gc/gc.go b/gc/gc.go new file mode 100644 index 0000000..0170dac --- /dev/null +++ b/gc/gc.go @@ -0,0 +1,81 @@ +package gc + +import ( + "image" + "log" + + "github.com/llgcode/draw2d" +) + +type GraphicContext struct { + *draw2d.StackGraphicContext +} + +func NewGraphicContext() *GraphicContext { + return &GraphicContext{draw2d.NewStackGraphicContext()} +} + +func (gc *GraphicContext) CreateStringPath(s string, x, y float64) float64 { + panic("not implemented") +} + +func (gc *GraphicContext) FillStringAt(text string, x, y float64) (cursor float64) { + panic("not implemented") +} + +func (gc *GraphicContext) GetStringBounds(s string) (left, top, right, bottom float64) { + panic("not implemented") +} + +func (gc *GraphicContext) StrokeString(text string) (cursor float64) { + return gc.StrokeStringAt(text, 0, 0) +} + +func (gc *GraphicContext) StrokeStringAt(text string, x, y float64) (cursor float64) { + width := gc.CreateStringPath(text, x, y) + gc.Stroke() + return width +} + +func (gc *GraphicContext) SetDPI(dpi int) { +} + +func (gc *GraphicContext) GetDPI() int { + return -1 +} + +func (gc *GraphicContext) Clear() { + log.Println("clear") +} + +func (gc *GraphicContext) ClearRect(x1, y1, x2, y2 int) { +} + +func (gc *GraphicContext) DrawImage(img image.Image) { +} + +func (gc *GraphicContext) FillString(text string) (cursor float64) { + log.Println("fillstring", text) + return 0 +} + +func (gc *GraphicContext) Stroke(paths ...*draw2d.PathStorage) { + log.Println("stroke", gc.Current) + for _, p := range paths { + log.Println("stroke", p) + } +} + +func (gc *GraphicContext) Fill(paths ...*draw2d.PathStorage) { + log.Println("fill", gc.Current) + for _, p := range paths { + log.Println("fill", p) + } +} + +func (gc *GraphicContext) FillStroke(paths ...*draw2d.PathStorage) { + log.Println("fillstroke", gc.Current) + for _, p := range paths { + log.Println("fillstroke", p) + } +} -- cgit v1.2.3