本文整理匯總了Golang中github.com/google/gxui.Canvas.DrawRunes方法的典型用法代碼示例。如果您正苦於以下問題:Golang Canvas.DrawRunes方法的具體用法?Golang Canvas.DrawRunes怎麽用?Golang Canvas.DrawRunes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/google/gxui.Canvas
的用法示例。
在下文中一共展示了Canvas.DrawRunes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: PaintText
func (t *DefaultTextBoxLine) PaintText(c gxui.Canvas) {
runes := []rune(t.textbox.controller.Line(t.lineIndex))
f := t.textbox.font
offsets := f.Layout(&gxui.TextBlock{
Runes: runes,
AlignRect: t.Size().Rect().OffsetX(t.caretWidth),
H: gxui.AlignLeft,
V: gxui.AlignBottom,
})
c.DrawRunes(f, runes, offsets, t.textbox.textColor)
}
示例2: Paint
// parts.DrawPaint overrides
func (l *Label) Paint(c gxui.Canvas) {
r := l.outer.Size().Rect()
t := l.text
if !l.multiline {
t = strings.Replace(t, "\n", " ", -1)
}
runes := []rune(t)
offsets := l.font.Layout(&gxui.TextBlock{
Runes: runes,
AlignRect: r,
H: l.horizontalAlignment,
V: l.verticalAlignment,
})
c.DrawRunes(l.font, runes, offsets, l.color)
}
示例3: PaintGlyphs
func (t *CodeEditorLine) PaintGlyphs(c gxui.Canvas, info CodeEditorLinePaintInfo) {
start, _ := info.LineSpan.Span()
runes, offsets, font := info.Runes, info.GlyphOffsets, info.Font
remaining := interval.IntDataList{info.LineSpan}
for _, l := range t.ce.layers {
if l != nil && l.Color() != nil {
color := *l.Color()
for _, span := range l.Spans().Overlaps(info.LineSpan) {
interval.Visit(&remaining, span, func(vs, ve uint64, _ int) {
s, e := vs-start, ve-start
c.DrawRunes(font, runes[s:e], offsets[s:e], color)
})
interval.Remove(&remaining, span)
}
}
}
for _, span := range remaining {
s, e := span.Span()
s, e = s-start, e-start
c.DrawRunes(font, runes[s:e], offsets[s:e], t.ce.textColor)
}
}