Merge pull request #113 from redstarcoder/pathbuilder_copypath

Add GetPath to the GraphicContext interface.
This commit is contained in:
llgcode 2016-10-24 10:08:26 +02:00 committed by GitHub
commit 401ee667f2
2 changed files with 6 additions and 0 deletions

View File

@ -132,6 +132,10 @@ func (gc *StackGraphicContext) BeginPath() {
gc.Current.Path.Clear() gc.Current.Path.Clear()
} }
func (gc *StackGraphicContext) GetPath() draw2d.Path {
return *gc.Current.Path.Copy()
}
func (gc *StackGraphicContext) IsEmpty() bool { func (gc *StackGraphicContext) IsEmpty() bool {
return gc.Current.Path.IsEmpty() return gc.Current.Path.IsEmpty()
} }

2
gc.go
View File

@ -14,6 +14,8 @@ type GraphicContext interface {
PathBuilder PathBuilder
// BeginPath creates a new path // BeginPath creates a new path
BeginPath() BeginPath()
// GetPath copies the current path, then returns it
GetPath() Path
// GetMatrixTransform returns the current transformation matrix // GetMatrixTransform returns the current transformation matrix
GetMatrixTransform() Matrix GetMatrixTransform() Matrix
// SetMatrixTransform sets the current transformation matrix // SetMatrixTransform sets the current transformation matrix