document
This commit is contained in:
parent
94ef483cbd
commit
cf01bf3026
3 changed files with 7 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2010 The draw2d Authors. All rights reserved.
|
||||
// created: 13/12/2010 by Laurent Le Goff
|
||||
|
||||
// Package draw2dkit procides helpers to draw common figure and draw using a Path or a GraphicContext
|
||||
// Package draw2dkit provides helpers to draw common figures using a Path or a GraphicContext
|
||||
package draw2dkit
|
||||
|
||||
import (
|
||||
|
@ -9,7 +9,7 @@ import (
|
|||
"math"
|
||||
)
|
||||
|
||||
// Rectangle draws a rectangle using a PathBuilder
|
||||
// Rectangle draws a rectangle using a path
|
||||
func Rectangle(path draw2d.PathBuilder, x1, y1, x2, y2 float64) {
|
||||
path.MoveTo(x1, y1)
|
||||
path.LineTo(x2, y1)
|
||||
|
@ -18,7 +18,7 @@ func Rectangle(path draw2d.PathBuilder, x1, y1, x2, y2 float64) {
|
|||
path.Close()
|
||||
}
|
||||
|
||||
// RoundedRectangle draws a rounded rectangle using a PathBuilder
|
||||
// RoundedRectangle draws a rounded rectangle using a path
|
||||
func RoundedRectangle(path draw2d.PathBuilder, x1, y1, x2, y2, arcWidth, arcHeight float64) {
|
||||
arcWidth = arcWidth / 2
|
||||
arcHeight = arcHeight / 2
|
||||
|
@ -33,13 +33,13 @@ func RoundedRectangle(path draw2d.PathBuilder, x1, y1, x2, y2, arcWidth, arcHeig
|
|||
path.Close()
|
||||
}
|
||||
|
||||
// Ellipse draws an ellipse using a PathBuilder
|
||||
// Ellipse draws an ellipse using a path
|
||||
func Ellipse(path draw2d.PathBuilder, cx, cy, rx, ry float64) {
|
||||
path.ArcTo(cx, cy, rx, ry, 0, -math.Pi*2)
|
||||
path.Close()
|
||||
}
|
||||
|
||||
// Circle draws a circle using a PathBuilder
|
||||
// Circle draws a circle using a path
|
||||
func Circle(path draw2d.PathBuilder, cx, cy, radius float64) {
|
||||
path.ArcTo(cx, cy, radius, radius, 0, -math.Pi*2)
|
||||
path.Close()
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"math"
|
||||
)
|
||||
|
||||
// Droid draws a droid at specified position
|
||||
func Droid(gc draw2d.GraphicContext, x, y float64) {
|
||||
gc.SetLineCap(draw2d.RoundCap)
|
||||
gc.SetLineWidth(5)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"github.com/llgcode/draw2d"
|
||||
)
|
||||
|
||||
// Gopher draw a gopher using a gc thanks to https://github.com/golang-samples/gopher-vector/
|
||||
// Gopher draw a gopher using a GraphicContext thanks to https://github.com/golang-samples/gopher-vector/
|
||||
func Gopher(gc draw2d.GraphicContext, x, y, w, h float64) {
|
||||
// Initialize Stroke Attribute
|
||||
gc.SetLineWidth(3)
|
||||
|
|
Loading…
Reference in a new issue