本文整理匯總了Golang中github.com/google/gxui.Canvas.DrawRect方法的典型用法代碼示例。如果您正苦於以下問題:Golang Canvas.DrawRect方法的具體用法?Golang Canvas.DrawRect怎麽用?Golang Canvas.DrawRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/gxui.Canvas
的用法示例。
在下文中一共展示了Canvas.DrawRect方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Paint
func (t *PanelTab) Paint(c gxui.Canvas) {
s := t.Size()
var style Style
switch {
case t.IsMouseDown(gxui.MouseButtonLeft) && t.IsMouseOver():
style = t.theme.TabPressedStyle
case t.IsMouseOver():
style = t.theme.TabOverStyle
default:
style = t.theme.TabDefaultStyle
}
if l := t.Label(); l != nil {
l.SetColor(style.FontColor)
}
c.DrawRoundedRect(s.Rect(), 5.0, 5.0, 0.0, 0.0, style.Pen, style.Brush)
if t.HasFocus() {
style = t.theme.FocusedStyle
r := math.CreateRect(1, 1, s.W-1, s.H-1)
c.DrawRoundedRect(r, 4.0, 4.0, 0.0, 0.0, style.Pen, style.Brush)
}
if t.active {
style = t.theme.TabActiveHighlightStyle
r := math.CreateRect(1, s.H-1, s.W-1, s.H)
c.DrawRect(r, style.Brush)
}
t.Button.Paint(c)
}
示例2: Paint
// parts.DrawPaint overrides
func (b *SplitterBar) Paint(c gxui.Canvas) {
r := b.outer.Size().Rect()
c.DrawRect(r, gxui.CreateBrush(b.backgroundColor))
if b.foregroundColor != b.backgroundColor {
c.DrawRect(r.ContractI(1), gxui.CreateBrush(b.foregroundColor))
}
}
示例3: PaintProgress
func (b *ProgressBar) PaintProgress(c gxui.Canvas, r math.Rect, frac float32) {
r.Max.X = math.Lerp(r.Min.X, r.Max.X, frac)
c.DrawRect(r, gxui.CreateBrush(gxui.Gray50))
c.Push()
c.AddClip(r)
c.DrawCanvas(b.chevrons, math.Point{X: b.scroll})
c.Pop()
}
示例4: PaintProgress
func (b *ProgressBar) PaintProgress(c gxui.Canvas, r math.Rect, frac float32) {
r.Max.X = math.Lerp(r.Min.X, r.Max.X, frac)
c.DrawRect(r, gxui.CreateBrush(gxui.Gray50))
}
示例5: plot
func plot(c gxui.Canvas, x int, y int) {
brush := gxui.CreateBrush(gxui.White)
c.DrawRect(math.CreateRect(x, y, x+1, y+1), brush)
}