aboutsummaryrefslogtreecommitdiff
path: root/gc/gc.go
blob: 0170dac4cd6efa91d17567a72048b4149c7a1b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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)
	}
}