Debian Codegraph @

drawing/transformer.go

raw symbols SCIP
1 // Copyright 2010 The draw2d Authors. All rights reserved.
2 // created: 13/12/2010 by Laurent Le Goff
3
4 package drawing
5
6 // Transformer apply the Matrix transformation tr
7 type Transformer struct {
8 Tr Matrix
9 Flattener Flattener
10 }
11
12 // MoveTo implements the path builder interface.
13 func (t Transformer) MoveTo(x, y float64) {
14 u := x*t.Tr[0] + y*t.Tr[2] + t.Tr[4]
15 v := x*t.Tr[1] + y*t.Tr[3] + t.Tr[5]
16 t.Flattener.MoveTo(u, v)
17 }
18
19 // LineTo implements the path builder interface.
20 func (t Transformer) LineTo(x, y float64) {
21 u := x*t.Tr[0] + y*t.Tr[2] + t.Tr[4]
22 v := x*t.Tr[1] + y*t.Tr[3] + t.Tr[5]
23 t.Flattener.LineTo(u, v)
24 }
25
26 // LineJoin implements the path builder interface.
27 func (t Transformer) LineJoin() {
28 t.Flattener.LineJoin()
29 }
30
31 // Close implements the path builder interface.
32 func (t Transformer) Close() {
33 t.Flattener.Close()
34 }
35
36 // End implements the path builder interface.
37 func (t Transformer) End() {
38 t.Flattener.End()
39 }