本文整理汇总了Golang中code/google/com/p/draw2d/draw2d.GraphicContext.Clear方法的典型用法代码示例。如果您正苦于以下问题:Golang GraphicContext.Clear方法的具体用法?Golang GraphicContext.Clear怎么用?Golang GraphicContext.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类code/google/com/p/draw2d/draw2d.GraphicContext
的用法示例。
在下文中一共展示了GraphicContext.Clear方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 (l *Label) draw(gc draw2d.GraphicContext) {
gc.Clear()
tw := float64(l.tbuf.Bounds().Max.X - l.tbuf.Bounds().Min.X)
th := float64(l.tbuf.Bounds().Max.Y - l.tbuf.Bounds().Min.Y)
gc.Translate((l.Size.X-tw)/2, (l.Size.Y-th)/2)
gc.DrawImage(l.tbuf)
}
示例3: ClearPaint
func ClearPaint(gc draw2d.GraphicContext) {
if true {
gc.Clear()
gc.SetFillColor(color.RGBA{155, 0, 0, 255})
gc.Fill()
}
}
示例4: draw
func (e *Entry) draw(gc draw2d.GraphicContext) {
if e.textOffset+e.runeOffsets[e.cursor] < 5 {
e.textOffset = 5 - e.runeOffsets[e.cursor]
}
if e.textOffset+e.runeOffsets[e.cursor] > e.Size.X-5 {
e.textOffset = e.Size.X - 5 - e.runeOffsets[e.cursor]
}
gc.Clear()
if e.HasKeyFocus {
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
safeRect(gc, geom.Coord{0, 0}, e.Size)
gc.Fill()
}
th := float64(e.textBuffer.Bounds().Max.Y - e.textBuffer.Bounds().Min.Y)
gc.Save()
gc.Translate(e.textOffset, 0)
if e.selecting {
start := e.runeOffsets[e.cursor]
end := e.runeOffsets[e.selectCursor]
if start > end {
start, end = end, start
}
gc.SetFillColor(color.RGBA{200, 200, 200, 255})
safeRect(gc, geom.Coord{start, 0}, geom.Coord{end, e.Size.Y})
gc.Fill()
}
gc.Translate(0, (e.Size.Y-th)/2)
gc.DrawImage(e.textBuffer)
gc.Restore()
if e.HasKeyFocus {
un := time.Duration(time.Now().UnixNano())
ms := un / time.Millisecond
ms = ms % 750
var intensity uint8 = 255
if ms > 550 {
diff := 650 - ms
if diff < 0 {
diff *= -1
}
intensity = uint8((diff * 255) / 200)
}
offset := float64(int(e.runeOffsets[e.cursor] + e.textOffset))
gc.SetStrokeColor(color.RGBA{A: intensity})
gc.MoveTo(offset, 0)
gc.LineTo(offset, e.Size.Y)
gc.Stroke()
e.Invalidate(geom.Rect{
Min: geom.Coord{offset - 1, 0},
Max: geom.Coord{offset + 1, e.Size.Y},
})
}
}
示例5: draw
func (b *Button) draw(gc draw2d.GraphicContext) {
gc.Clear()
gc.SetStrokeColor(color.Black)
if b.pressed {
gc.SetFillColor(color.RGBA{150, 150, 150, 255})
} else {
gc.SetFillColor(color.White)
}
safeRect(gc, geom.Coord{0, 0}, b.Size)
gc.FillStroke()
}
示例6: 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)
}
示例7: 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)
}
示例8: ClearPaint
func ClearPaint(gc draw2d.GraphicContext) {
gc.Clear()
}
示例9: 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()
}
示例10: drawBackground
func drawBackground(gc draw2d.GraphicContext) {
gc.SetFillColor(color.RGBA{0xFF, 0xFF, 0xFF, 0xFF})
gc.Clear()
}