當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Canvas.DrawRunes方法代碼示例

本文整理匯總了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)
}
開發者ID:langxj,項目名稱:gxui,代碼行數:11,代碼來源:default_textbox_line.go

示例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)
}
開發者ID:liulnn,項目名稱:gxui,代碼行數:17,代碼來源:label.go

示例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)
	}
}
開發者ID:langxj,項目名稱:gxui,代碼行數:22,代碼來源:code_editor_line.go


注:本文中的github.com/google/gxui.Canvas.DrawRunes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。