diff --git a/draw2d/src/cmd/testdraw2d.go b/draw2d/src/cmd/testdraw2d.go index be718e5..533a477 100644 --- a/draw2d/src/cmd/testdraw2d.go +++ b/draw2d/src/cmd/testdraw2d.go @@ -13,8 +13,8 @@ import ( "math" "image" "image/png" - //"draw2d" - "draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d" + "draw2d" + //"draw2d.googlecode.com/svn/trunk/draw2d/src/pkg/draw2d" ) const ( @@ -421,9 +421,10 @@ func TestStar() { for i := 0.0 ; i < 360; i = i + 10 {// Go from 0 to 360 degrees in 10 degree steps gc.BeginPath() // Start a new path gc.Save() // Keep rotations temporary - gc.MoveTo(144, 144) + gc.Translate(144, 144) gc.Rotate(i * (math.Pi / 180.0)) // Rotate by degrees on stack from 'for' - gc.RLineTo(72, 0) + gc.MoveTo(0, 0) + gc.LineTo(72, 0) gc.Stroke() gc.Restore() // Get back the unrotated state } diff --git a/draw2d/src/pkg/draw2d/draw2d.go b/draw2d/src/pkg/draw2d/draw2d.go index 6744b55..fa37501 100644 --- a/draw2d/src/pkg/draw2d/draw2d.go +++ b/draw2d/src/pkg/draw2d/draw2d.go @@ -84,15 +84,15 @@ func (gc *GraphicContext) ComposeMatrixTransform(tr MatrixTransform) { } func (gc *GraphicContext) Rotate(angle float) { - gc.current.tr.Rotate(angle) + gc.current.tr = NewRotationMatrix(angle).Multiply(gc.current.tr) } func (gc *GraphicContext) Translate(tx, ty float) { - gc.current.tr.Translate(tx, ty) + gc.current.tr = NewTranslationMatrix(tx, ty).Multiply(gc.current.tr) } func (gc *GraphicContext) Scale(sx, sy float) { - gc.current.tr.Scale(sx, sy) + gc.current.tr = NewScaleMatrix(sx, sy).Multiply(gc.current.tr) } func (gc *GraphicContext) Clear() {