本文整理汇总了Golang中github.com/BurntSushi/wingo/render.NewBorder函数的典型用法代码示例。如果您正苦于以下问题:Golang NewBorder函数的具体用法?Golang NewBorder怎么用?Golang NewBorder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewBorder函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: borderImages
func (f *Full) borderImages(
width, height int) (*xgraphics.Image, *xgraphics.Image) {
imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ABorderColor,
width, height, 0, 0)
imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.IBorderColor,
width, height, 0, 0)
return imgA.Image, imgI.Image
}
示例2: pieceImages
func (f *Borders) pieceImages(borderTypes, gradientType, gradientDir,
width, height int) (*xgraphics.Image, *xgraphics.Image) {
imgA := render.NewBorder(f.X, borderTypes,
f.theme.AThinColor, f.theme.ABorderColor,
width, height, gradientType, gradientDir)
imgI := render.NewBorder(f.X, borderTypes,
f.theme.IThinColor, f.theme.IBorderColor,
width, height, gradientType, gradientDir)
return imgA.Image, imgI.Image
}
示例3: newTitleBar
func (f *Full) newTitleBar() *piece {
imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
1, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
1, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
win := f.newPieceWindow("titlebar", 0)
win.MROpt(fX|fY|fH,
f.theme.BorderSize, f.theme.BorderSize,
0, f.theme.TitleSize)
return newPiece(win, imgA.Image, imgI.Image)
}
示例4: newButtonMinimize
func (f *Full) newButtonMinimize() *piece {
imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
f.theme.TitleSize, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
f.theme.TitleSize, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
xgraphics.Blend(imgA.Image, f.theme.AMinimizeButton, image.ZP)
xgraphics.Blend(imgI.Image, f.theme.IMinimizeButton, image.ZP)
win := f.newPieceWindow("minimize", 0)
win.MROpt(fY|fW|fH,
0, f.theme.BorderSize,
f.theme.TitleSize, f.theme.TitleSize)
return newPiece(win, imgA.Image, imgI.Image)
}
示例5: UpdateTitle
func (f *Full) UpdateTitle() {
if f == nil {
return
}
title := f.client.Name()
font := f.theme.Font
fontSize := f.theme.FontSize
aFontColor := f.theme.AFontColor.ImageColor()
iFontColor := f.theme.IFontColor.ImageColor()
ew, eh := xgraphics.TextMaxExtents(font, fontSize, title)
eh += misc.TextBreathe
imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
ew, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
ew, f.theme.TitleSize,
render.GradientVert, render.GradientRegular)
y := (f.theme.TitleSize-eh)/2 - 1
x2, _, err := imgA.Text(0, y, aFontColor, fontSize, font, title)
if err != nil {
logger.Warning.Printf("Could not draw window title for window %s "+
"because: %v", f.client, err)
}
_, _, err = imgI.Text(0, y, iFontColor, fontSize, font, title)
if err != nil {
logger.Warning.Printf("Could not draw window title for window %s "+
"because: %v", f.client, err)
}
f.titleText.Create(
imgA.SubImage(image.Rect(0, 0, x2, imgA.Bounds().Max.Y)),
imgI.SubImage(image.Rect(0, 0, x2, imgI.Bounds().Max.Y)))
f.titleText.MROpt(fW, 0, 0, x2, 0)
if f.client.State() == Active {
f.titleText.Active()
} else {
f.titleText.Inactive()
}
}
示例6: UpdateIcon
func (f *Full) UpdateIcon() {
size := f.theme.TitleSize
imgA := render.NewBorder(f.X, 0, render.NoColor, f.theme.ATitleColor,
size, size, render.GradientVert, render.GradientRegular)
imgI := render.NewBorder(f.X, 0, render.NoColor, f.theme.ITitleColor,
size, size, render.GradientVert, render.GradientRegular)
img := f.client.Icon(size-4, size-4)
sub := image.Rect(2, 2, size-2, size-2)
xgraphics.Blend(imgA.SubImage(sub), img, image.ZP)
xgraphics.Blend(imgI.SubImage(sub), img, image.ZP)
f.icon.Create(imgA.Image, imgI.Image)
if f.client.State() == Active {
f.icon.Active()
} else {
f.icon.Inactive()
}
}