From 8380dd94585d5ddc45b229e5467613fab63ef8af Mon Sep 17 00:00:00 2001 From: redstarcoder Date: Mon, 17 Oct 2016 19:36:31 -0400 Subject: [PATCH 1/3] Added CopyPath to the GraphicContext interface. --- draw2dbase/stack_gc.go | 4 ++++ gc.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/draw2dbase/stack_gc.go b/draw2dbase/stack_gc.go index 12723c7..8c394fd 100644 --- a/draw2dbase/stack_gc.go +++ b/draw2dbase/stack_gc.go @@ -132,6 +132,10 @@ func (gc *StackGraphicContext) BeginPath() { gc.Current.Path.Clear() } +func (gc *StackGraphicContext) CopyPath() *draw2d.Path { + return gc.Current.Path.Copy() +} + func (gc *StackGraphicContext) IsEmpty() bool { return gc.Current.Path.IsEmpty() } diff --git a/gc.go b/gc.go index 6266c16..d76a7ca 100644 --- a/gc.go +++ b/gc.go @@ -14,6 +14,8 @@ type GraphicContext interface { PathBuilder // BeginPath creates a new path BeginPath() + // CopyPath copies the current path, then returns it + CopyPath() *Path // GetMatrixTransform returns the current transformation matrix GetMatrixTransform() Matrix // SetMatrixTransform sets the current transformation matrix From 4a3322e29e0b46e6ae264b695a86e14c98e9f9e3 Mon Sep 17 00:00:00 2001 From: redstarcoder Date: Wed, 19 Oct 2016 14:53:36 -0400 Subject: [PATCH 2/3] CopyPath -> GetPath. Also return Path instead of *Path. --- draw2dbase/stack_gc.go | 4 ++-- gc.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/draw2dbase/stack_gc.go b/draw2dbase/stack_gc.go index 8c394fd..a5b01d8 100644 --- a/draw2dbase/stack_gc.go +++ b/draw2dbase/stack_gc.go @@ -132,8 +132,8 @@ func (gc *StackGraphicContext) BeginPath() { gc.Current.Path.Clear() } -func (gc *StackGraphicContext) CopyPath() *draw2d.Path { - return gc.Current.Path.Copy() +func (gc *StackGraphicContext) GetPath() draw2d.Path { + return *gc.Current.Path.Copy() } func (gc *StackGraphicContext) IsEmpty() bool { diff --git a/gc.go b/gc.go index d76a7ca..b5c20be 100644 --- a/gc.go +++ b/gc.go @@ -15,7 +15,7 @@ type GraphicContext interface { // BeginPath creates a new path BeginPath() // CopyPath copies the current path, then returns it - CopyPath() *Path + GetPath() Path // GetMatrixTransform returns the current transformation matrix GetMatrixTransform() Matrix // SetMatrixTransform sets the current transformation matrix From b9005c988d81d0f246f071f5b614f9c38d7fee46 Mon Sep 17 00:00:00 2001 From: redstarcoder Date: Wed, 19 Oct 2016 15:01:45 -0400 Subject: [PATCH 3/3] Fixed comment --- gc.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc.go b/gc.go index b5c20be..af34060 100644 --- a/gc.go +++ b/gc.go @@ -14,7 +14,7 @@ type GraphicContext interface { PathBuilder // BeginPath creates a new path BeginPath() - // CopyPath copies the current path, then returns it + // GetPath copies the current path, then returns it GetPath() Path // GetMatrixTransform returns the current transformation matrix GetMatrixTransform() Matrix