예제 #1
0
파일: aw-util.go 프로젝트: xormplus/ui-1
func DrawDefaultElement(x, y, w, h float64, bg color.Color, ctx vg.Context) {

	// Shadow
	ctx.BeginPath()
	ctx.StrokeColor(color.RGBA{100, 100, 100, 100})
	ctx.RoundedRect(x, y, w, h, 30)
	ctx.StrokeWidth(1)
	ctx.Stroke()
	ctx.FillPaint(ctx.BoxGradient(x, y, w, h, h*.5, h, bg, bg))
	ctx.Fill()
}
예제 #2
0
파일: element.go 프로젝트: xormplus/ui-1
func (self *Element) Draw(ctx vg.Context) {
	x, y, w, h := self.Bounds()
	x, y = self.Clamp(x, y)

	// draw background
	c := CloneColor(self.ActiveBackground)
	bg := ctx.BoxGradient(x, y, w, h, h, h, c, c)

	ctx.BeginPath()
	ctx.RoundedRect(x, y, w, h, self.CornerRadius)
	ctx.FillPaint(bg)
	ctx.Fill()
	ctx.StrokeWidth(self.BorderWidth)
	ctx.StrokeColor(c.Lighten(-0.5))
	ctx.Stroke()

	if self.DrawCB != nil {
		self.DrawCB(ctx)
	}
}