本文整理匯總了Golang中github.com/google/gxui.Canvas.DrawLines方法的典型用法代碼示例。如果您正苦於以下問題:Golang Canvas.DrawLines方法的具體用法?Golang Canvas.DrawLines怎麽用?Golang Canvas.DrawLines使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/gxui.Canvas
的用法示例。
在下文中一共展示了Canvas.DrawLines方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: draw
func draw(p Pendulum, canvas gxui.Canvas, x, y int) {
attachment := math.Point{X: ANIMATION_WIDTH/2 + x, Y: y}
phi := p.GetPhi()
ball := math.Point{X: x + ANIMATION_WIDTH/2 + math.Round(float32(l*omath.Sin(phi))), Y: y + math.Round(float32(l*omath.Cos(phi)))}
line := gxui.Polygon{gxui.PolygonVertex{attachment, 0}, gxui.PolygonVertex{ball, 0}}
canvas.DrawLines(line, gxui.DefaultPen)
m := math.Point{int(BALL_RADIUS), int(BALL_RADIUS)}
rect := math.Rect{ball.Sub(m), ball.Add(m)}
canvas.DrawRoundedRect(rect, BALL_RADIUS, BALL_RADIUS, BALL_RADIUS, BALL_RADIUS, gxui.TransparentPen, gxui.CreateBrush(gxui.Yellow))
}
示例2: drawTimeAxis
func drawTimeAxis(canvas gxui.Canvas) {
p := gxui.Polygon{
gxui.PolygonVertex{
Position: math.Point{
X: 0,
Y: 400,
},
RoundedRadius: 0,
},
gxui.PolygonVertex{
Position: math.Point{
X: 400,
Y: 400,
},
RoundedRadius: 0,
},
}
canvas.DrawLines(p, gxui.CreatePen(1.0, gxui.White))
}
示例3: Draw
func (s Snake) Draw(canvas gxui.Canvas) {
bendCount := len(s.bends)
p := make(gxui.Polygon, 2+bendCount)
p[0] = gxui.PolygonVertex{
Position: s.head,
RoundedRadius: 0,
}
for i, bend := range s.bends {
p[i+1] = gxui.PolygonVertex{
Position: bend.point,
RoundedRadius: 0,
}
}
p[bendCount+1] = gxui.PolygonVertex{
Position: s.tail,
RoundedRadius: 0,
}
canvas.DrawLines(p, gxui.CreatePen(float32(s.width), gxui.Green70))
}
示例4: drawVerticalLines
func (f Field) drawVerticalLines(canvas gxui.Canvas) {
for x := f.cellWidth; x < f.width; x += f.cellWidth {
p := make(gxui.Polygon, 2)
p[0] = gxui.PolygonVertex{
Position: math.Point{
X: x,
Y: 0,
},
RoundedRadius: 0,
}
p[1] = gxui.PolygonVertex{
Position: math.Point{
X: x,
Y: f.height,
},
RoundedRadius: 0,
}
canvas.DrawLines(p, gxui.CreatePen(1, gxui.Gray80))
}
}
示例5: drawHorizontalLines
func (f Field) drawHorizontalLines(canvas gxui.Canvas) {
for y := f.cellHeight; y < f.height; y += f.cellHeight {
p := make(gxui.Polygon, 2)
p[0] = gxui.PolygonVertex{
Position: math.Point{
X: 0,
Y: y,
},
RoundedRadius: 0,
}
p[1] = gxui.PolygonVertex{
Position: math.Point{
X: f.width,
Y: y,
},
RoundedRadius: 0,
}
canvas.DrawLines(p, gxui.CreatePen(1, gxui.Gray80))
}
}