diff options
author | Dimitri Sokolyuk <demon@dim13.org> | 2016-09-18 19:18:08 +0200 |
---|---|---|
committer | Dimitri Sokolyuk <demon@dim13.org> | 2016-09-18 19:18:08 +0200 |
commit | c231f3cce3b20ed1b6a43d631ae2a779d15d78b7 (patch) | |
tree | 0214a9b12e65378ab42dc9359e38078ae25cd4ee /gc | |
parent | 3ff749c98c4593ff35b2f82de222db9f97954f29 (diff) |
Add gcv0.1
Diffstat (limited to 'gc')
-rw-r--r-- | gc/gc.go | 81 |
1 files changed, 81 insertions, 0 deletions
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) + } +} |