本文整理汇总了Golang中github.com/llgcode/draw2d.GraphicContext.SetFillRule方法的典型用法代码示例。如果您正苦于以下问题:Golang GraphicContext.SetFillRule方法的具体用法?Golang GraphicContext.SetFillRule怎么用?Golang GraphicContext.SetFillRule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/llgcode/draw2d.GraphicContext
的用法示例。
在下文中一共展示了GraphicContext.SetFillRule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FillStyle
// FillStyle demonstrates the difference between even odd and non zero winding rule.
func FillStyle(gc draw2d.GraphicContext, x, y, width, height float64) {
sx, sy := width/232, height/220
gc.SetLineWidth(width / 40)
draw2d.Rect(gc, x+sx*0, y+sy*12, x+sx*232, y+sy*70)
wheel1 := new(draw2d.PathStorage)
wheel1.ArcTo(x+sx*52, y+sy*70, sx*40, sy*40, 0, 2*math.Pi)
wheel2 := new(draw2d.PathStorage)
wheel2.ArcTo(x+sx*180, y+sy*70, sx*40, sy*40, 0, -2*math.Pi)
gc.SetFillRule(draw2d.FillRuleEvenOdd)
gc.SetFillColor(color.NRGBA{0, 0xB2, 0, 0xFF})
gc.SetStrokeColor(image.Black)
gc.FillStroke(wheel1, wheel2)
draw2d.Rect(gc, x, y+sy*140, x+sx*232, y+sy*198)
wheel1 = new(draw2d.PathStorage)
wheel1.ArcTo(x+sx*52, y+sy*198, sx*40, sy*40, 0, 2*math.Pi)
wheel2 = new(draw2d.PathStorage)
wheel2.ArcTo(x+sx*180, y+sy*198, sx*40, sy*40, 0, -2*math.Pi)
gc.SetFillRule(draw2d.FillRuleWinding)
gc.SetFillColor(color.NRGBA{0, 0, 0xE5, 0xFF})
gc.FillStroke(wheel1, wheel2)
}
示例2: Main
// Main draws vertically spaced lines and returns the filename.
// This should only be used during testing.
func Main(gc draw2d.GraphicContext, ext string) (string, error) {
gc.SetFillRule(draw2d.FillRuleWinding)
gc.Clear()
// Draw the line
for x := 5.0; x < 297; x += 10 {
Draw(gc, x, 0, x, 210)
}
gc.ClearRect(100, 75, 197, 135)
draw2d.Ellipse(gc, 148.5, 105, 35, 25)
gc.SetFillColor(color.RGBA{0xff, 0xff, 0x44, 0xff})
gc.FillStroke()
// Return the output filename
return samples.Output("line", ext), nil
}