本文整理汇总了Golang中code/google/com/p/draw2d/draw2d.GraphicContext.FillStroke方法的典型用法代码示例。如果您正苦于以下问题:Golang GraphicContext.FillStroke方法的具体用法?Golang GraphicContext.FillStroke怎么用?Golang GraphicContext.FillStroke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/draw2d/draw2d.GraphicContext
的用法示例。
在下文中一共展示了GraphicContext.FillStroke方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: draw
func (c *Checkbox) draw(gc draw2d.GraphicContext) {
gc.Clear()
gc.SetStrokeColor(color.Black)
if c.pressed {
gc.SetFillColor(color.RGBA{155, 0, 0, 255})
} else {
gc.SetFillColor(color.RGBA{255, 0, 0, 255})
}
// Draw background rect
x, y := gc.LastPoint()
gc.MoveTo(0, 0)
gc.LineTo(c.Size.X, 0)
gc.LineTo(c.Size.X, c.Size.Y)
gc.LineTo(0, c.Size.Y)
gc.Close()
gc.FillStroke()
// Draw inner rect
if c.state {
gc.SetFillColor(color.Black)
gc.MoveTo(5, 5)
gc.LineTo(c.Size.X-5, 5)
gc.LineTo(c.Size.X-5, c.Size.Y-5)
gc.LineTo(5, c.Size.Y-5)
gc.Close()
gc.FillStroke()
}
gc.MoveTo(x, y)
}
示例2: draw
func (b *Button) draw(gc draw2d.GraphicContext) {
gc.SetStrokeColor(color.Black)
if b.pressed {
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
} else {
gc.SetFillColor(color.White)
}
safeRect(gc, Coord{0, 0}, b.Size)
gc.FillStroke()
}
示例3: draw
func (l *KeyGrab) draw(gc draw2d.GraphicContext) {
gc.Clear()
if l.HasKeyFocus {
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
safeRect(gc, geom.Coord{0, 0}, l.Size)
gc.FillStroke()
}
tw := float64(l.kbuf.Bounds().Max.X - l.kbuf.Bounds().Min.X)
th := float64(l.kbuf.Bounds().Max.Y - l.kbuf.Bounds().Min.Y)
gc.Translate((l.Size.X-tw)/2, (l.Size.Y-th)/2)
gc.DrawImage(l.kbuf)
}
示例4: drawPolygon
func drawPolygon(ctxt draw2d.GraphicContext, g *geos.Geometry, fillColor color.Color, strokeColor color.Color, width float64, scale func(x, y float64) (float64, float64)) {
ctxt.SetFillColor(fillColor)
ctxt.SetStrokeColor(strokeColor)
ctxt.SetLineWidth(width)
// exterior ring
ring := geos.Must(g.ExteriorRing())
cs, err := ring.coordSeq()
if err != nil {
log.Fatal(err)
}
lineCoordSeq(ctxt, cs, scale)
ctxt.FillStroke()
// interior rings...
}
示例5: draw
func (l *Label) draw(gc draw2d.GraphicContext) {
gc.SetStrokeColor(color.Black)
font := draw2d.GetFont(gc.GetFontData())
bounds := font.Bounds()
height := float64(bounds.YMax-bounds.YMin) * l.FontSize / float64(font.UnitsPerEm())
offset := l.Size.Y - (l.Size.Y-height)/2
safeRect(gc, Coord{0, 0}, l.Size)
gc.FillStroke()
gc.Translate(10, offset)
gc.SetFontSize(l.FontSize)
gc.FillString(l.Text)
}
示例6: draw
func (g *Grid) draw(gc draw2d.GraphicContext) {
gc.Clear()
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
safeRect(gc, geom.Coord{0, 0}, g.Size)
gc.FillStroke()
g.reflex()
_, minXs, _ := g.hflex.constrain(g.Size.X)
for _, x := range minXs[1:] {
gc.MoveTo(x, 0)
gc.LineTo(x, g.Size.Y)
}
_, minYs, _ := g.vflex.constrain(g.Size.Y)
for _, y := range minYs[1:] {
gc.MoveTo(0, y)
gc.LineTo(g.Size.X, y)
}
gc.Stroke()
// _, _, maxYs := g.vflex.constrain(g.Size.Y)
}
示例7: android
func android(gc draw2d.GraphicContext, x, y float64) {
gc.SetLineCap(draw2d.RoundCap)
gc.SetLineWidth(5)
gc.ArcTo(x+80, y+70, 50, 50, 180*(math.Pi/180), 360*(math.Pi/180)) // head
gc.FillStroke()
gc.MoveTo(x+60, y+25)
gc.LineTo(x+50, y+10)
gc.MoveTo(x+100, y+25)
gc.LineTo(x+110, y+10)
gc.Stroke()
draw2d.Circle(gc, x+60, y+45, 5) // left eye
gc.FillStroke()
draw2d.Circle(gc, x+100, y+45, 5) // right eye
gc.FillStroke()
draw2d.RoundRect(gc, x+30, y+75, x+30+100, y+75+90, 10, 10) // body
gc.FillStroke()
draw2d.Rect(gc, x+30, y+75, x+30+100, y+75+80)
gc.FillStroke()
draw2d.RoundRect(gc, x+5, y+80, x+5+20, y+80+70, 10, 10) // left arm
gc.FillStroke()
draw2d.RoundRect(gc, x+135, y+80, x+135+20, y+80+70, 10, 10) // right arm
gc.FillStroke()
draw2d.RoundRect(gc, x+50, y+150, x+50+20, y+150+50, 10, 10) // left leg
gc.FillStroke()
draw2d.RoundRect(gc, x+90, y+150, x+90+20, y+150+50, 10, 10) // right leg
gc.FillStroke()
}
示例8: draw
func (g *Grid) draw(gc draw2d.GraphicContext) {
gc.Clear()
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
safeRect(gc, geom.Coord{0, 0}, g.Size)
gc.FillStroke()
}