本文整理汇总了Golang中code/google/com/p/draw2d/draw2d.GraphicContext.CubicCurveTo方法的典型用法代码示例。如果您正苦于以下问题:Golang GraphicContext.CubicCurveTo方法的具体用法?Golang GraphicContext.CubicCurveTo怎么用?Golang GraphicContext.CubicCurveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/draw2d/draw2d.GraphicContext
的用法示例。
在下文中一共展示了GraphicContext.CubicCurveTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: TestDrawCubicCurve
func TestDrawCubicCurve(gc draw2d.GraphicContext) {
// draw a cubic curve
x, y := 25.6, 128.0
x1, y1 := 102.4, 230.4
x2, y2 := 153.6, 25.6
x3, y3 := 230.4, 128.0
gc.SetStrokeColor(color.NRGBA{0, 0, 0, 0xFF})
gc.SetLineWidth(10)
gc.MoveTo(x, y)
gc.CubicCurveTo(x1, y1, x2, y2, x3, y3)
gc.Stroke()
gc.SetStrokeColor(color.NRGBA{0xFF, 0, 0, 0xFF})
gc.SetLineWidth(6)
// draw segment of curve
gc.MoveTo(x, y)
gc.LineTo(x1, y1)
gc.LineTo(x2, y2)
gc.LineTo(x3, y3)
gc.Stroke()
}
示例2: gordon
func gordon(gc draw2d.GraphicContext, x, y, w, h float64) {
h23 := (h * 2) / 3
blf := color.RGBA{0, 0, 0, 0xff}
wf := color.RGBA{0xff, 0xff, 0xff, 0xff}
nf := color.RGBA{0x8B, 0x45, 0x13, 0xff}
brf := color.RGBA{0x8B, 0x45, 0x13, 0x99}
brb := color.RGBA{0x8B, 0x45, 0x13, 0xBB}
gc.MoveTo(x, y+h)
gc.CubicCurveTo(x, y+h, x+w/2, y-h, x+w, y+h)
gc.Close()
gc.SetFillColor(brb)
gc.Fill()
draw2d.RoundRect(gc, x, y+h, x+w, y+h+h, 10, 10)
gc.Fill()
draw2d.Circle(gc, x, y+h, w/12) // left ear
gc.SetFillColor(brf)
gc.Fill()
draw2d.Circle(gc, x, y+h, w/12-10)
gc.SetFillColor(nf)
gc.Fill()
draw2d.Circle(gc, x+w, y+h, w/12) // right ear
gc.SetFillColor(brf)
gc.Fill()
draw2d.Circle(gc, x+w, y+h, w/12-10)
gc.SetFillColor(nf)
gc.Fill()
draw2d.Circle(gc, x+w/3, y+h23, w/9) // left eye
gc.SetFillColor(wf)
gc.Fill()
draw2d.Circle(gc, x+w/3+10, y+h23, w/10-10)
gc.SetFillColor(blf)
gc.Fill()
draw2d.Circle(gc, x+w/3+15, y+h23, 5)
gc.SetFillColor(wf)
gc.Fill()
draw2d.Circle(gc, x+w-w/3, y+h23, w/9) // right eye
gc.Fill()
draw2d.Circle(gc, x+w-w/3+10, y+h23, w/10-10)
gc.SetFillColor(blf)
gc.Fill()
draw2d.Circle(gc, x+w-(w/3)+15, y+h23, 5)
gc.SetFillColor(wf)
gc.Fill()
gc.SetFillColor(wf)
draw2d.RoundRect(gc, x+w/2-w/8, y+h+30, x+w/2-w/8+w/8, y+h+30+w/6, 5, 5) // left tooth
gc.Fill()
draw2d.RoundRect(gc, x+w/2, y+h+30, x+w/2+w/8, y+h+30+w/6, 5, 5) // right tooth
gc.Fill()
draw2d.Ellipse(gc, x+(w/2), y+h+30, w/6, w/12) // snout
gc.SetFillColor(nf)
gc.Fill()
draw2d.Ellipse(gc, x+(w/2), y+h+10, w/10, w/12) // nose
gc.SetFillColor(blf)
gc.Fill()
}