本文整理汇总了Golang中github.com/google/gxui/math.Size.W方法的典型用法代码示例。如果您正苦于以下问题:Golang Size.W方法的具体用法?Golang Size.W怎么用?Golang Size.W使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/google/gxui/math.Size
的用法示例。
在下文中一共展示了Size.W方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: createGlyphPage
func createGlyphPage(resolution resolution, glyphMaxSizePixels math.Size) *glyphPage {
// Handle exceptionally large glyphs.
size := math.Size{W: glyphPageWidth, H: glyphPageHeight}.Max(glyphMaxSizePixels)
size.W = align(size.W, glyphSizeAlignment)
size.H = align(size.H, glyphSizeAlignment)
return &glyphPage{
resolution: resolution,
glyphMaxSizePixels: glyphMaxSizePixels,
size: size,
image: image.NewAlpha(image.Rect(0, 0, size.W, size.H)),
offsets: make(map[rune]math.Point),
rowHeight: 0,
rast: raster.NewRasterizer(glyphMaxSizePixels.W, glyphMaxSizePixels.H),
}
}
示例2: newGlyphPage
func newGlyphPage(face fnt.Face, r rune) *glyphPage {
// Start the page big enough to hold the initial rune.
b, _, _ := face.GlyphBounds(r)
bounds := rectangle26_6toRect(b)
size := math.Size{W: glyphPageWidth, H: glyphPageHeight}.Max(bounds.Size())
size.W = align(size.W, glyphSizeAlignment)
size.H = align(size.H, glyphSizeAlignment)
page := &glyphPage{
image: image.NewAlpha(image.Rect(0, 0, size.W, size.H)),
size: size,
entries: make(map[rune]glyphEntry),
rowHeight: 0,
}
page.add(face, r)
return page
}
示例3: DesiredSize
func (l *List) DesiredSize(min, max math.Size) math.Size {
if l.adapter == nil {
return min
}
count := math.Max(l.itemCount, 1)
var s math.Size
if l.orientation.Horizontal() {
s = math.Size{W: l.itemSize.W * count, H: l.itemSize.H}
} else {
s = math.Size{W: l.itemSize.W, H: l.itemSize.H * count}
}
if l.scrollBarEnabled {
if l.orientation.Horizontal() {
s.H += l.scrollBar.DesiredSize(min, max).H
} else {
s.W += l.scrollBar.DesiredSize(min, max).W
}
}
return s.Expand(l.outer.Padding()).Clamp(min, max)
}