base

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2021 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BarDirectionBottomTop = "bottom-top"
	BarDirectionLeftRight = "left-right"
)
View Source
const (
	GraphDirUp   = "up"
	GraphDirDown = "down"
)
View Source
const (
	HAlighCenter = "center"
	HAlignLeft   = "left"
	HAlignRight  = "right"
)
View Source
const (
	VAlighMiddle = "middle"
	VAlignTop    = "top"
	VAlignBottom = "bottom"
)

Variables

View Source
var BGRAColorModel = color.ModelFunc(
	func(c color.Color) color.Color {
		if _, ok := c.(BGRAColor); ok {
			return c
		}
		r, g, b, a := c.RGBA()
		return BGRAColor{R: uint8(r >> 8), G: uint8(g >> 8), B: uint8(b >> 8), A: uint8(a >> 8)}
	},
)

Functions

func RegisterMarkup

func RegisterMarkup(mk *markup.Markup)

Types

type BGRA

type BGRA struct {
	// Pix holds the image's pixels, in B, G, R, A order on small endian systems
	// and A, R, G, B on big endian systems.
	// See http://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t
	// The pixel at (x, y) starts at Pix[(y-Rect.Min.Y)*Stride + (x-Rect.Min.X)*4].
	Pix []uint8
	// Stride is the Pix stride (in bytes) between vertically adjacent pixels.
	Stride int
	// Rect is the image's bounds.
	Rect image.Rectangle
}

BGRA is an in-memory image whose At method returns BGRAColor values.

func NewBGRA

func NewBGRA(r image.Rectangle) *BGRA

NewBGRA returns a new BGRA with the given bounds.

func (*BGRA) At

func (self *BGRA) At(x, y int) color.Color

func (*BGRA) Bounds

func (self *BGRA) Bounds() image.Rectangle

func (*BGRA) ColorModel

func (self *BGRA) ColorModel() color.Model

func (*BGRA) PixOffset

func (self *BGRA) PixOffset(x, y int) int

PixOffset returns the index of the first element of Pix that corresponds to the pixel at (x, y).

func (*BGRA) Set

func (self *BGRA) Set(x, y int, c color.Color)

type BGRAColor

type BGRAColor struct {
	B, G, R, A uint8
}

BGRAColor represents a traditional 32-bit alpha-premultiplied color, having 8 bits for each of alpha, red, green and blue.

func (BGRAColor) RGBA

func (c BGRAColor) RGBA() (r, g, b, a uint32)

type Bar

type Bar struct {
	Base
	// contains filtered or unexported fields
}

func NewBar

func NewBar(p ui.ParentDrawable) *Bar

func (*Bar) BgColor

func (b *Bar) BgColor() color.Color

func (*Bar) Direction

func (b *Bar) Direction() string

func (*Bar) Draw

func (b *Bar) Draw(x, y int, im draw.Image)

func (*Bar) FgColor

func (b *Bar) FgColor() color.Color

func (*Bar) Radius

func (b *Bar) Radius() int

func (*Bar) SetBgColor

func (b *Bar) SetBgColor(v color.Color)

func (*Bar) SetDirection

func (b *Bar) SetDirection(v string)

func (*Bar) SetFgColor

func (b *Bar) SetFgColor(v color.Color)

func (*Bar) SetHeight

func (b *Bar) SetHeight(v int)

func (*Bar) SetRadius

func (b *Bar) SetRadius(v int)

func (*Bar) SetValue

func (b *Bar) SetValue(v float64)

func (*Bar) SetWidth

func (b *Bar) SetWidth(v int)

func (*Bar) Value

func (b *Bar) Value() float64

type Base

type Base struct {
	// contains filtered or unexported fields
}

func NewBase

func NewBase(p ui.ParentDrawable) Base

func (*Base) Children added in v0.2.3

func (b *Base) Children() []ui.Drawable

func (*Base) Context

func (b *Base) Context() ui.Context

func (*Base) Height

func (b *Base) Height() int

func (*Base) Init

func (b *Base) Init() error

func (Base) Notify

func (b Base) Notify()

func (*Base) OnHeightChange

func (b *Base) OnHeightChange(c func(int))

func (*Base) OnLeftClick

func (b *Base) OnLeftClick() func(ui.Event) bool

func (*Base) OnPointerEnter added in v0.2.3

func (b *Base) OnPointerEnter() func(ui.Event) bool

func (*Base) OnPointerLeave added in v0.2.3

func (b *Base) OnPointerLeave() func(ui.Event) bool

func (*Base) OnPointerMove added in v0.2.3

func (b *Base) OnPointerMove() func(ui.Event) bool

func (*Base) OnRightClick

func (b *Base) OnRightClick() func(ui.Event) bool

func (*Base) OnVisibleChange

func (b *Base) OnVisibleChange(c func(bool))

func (*Base) OnWidthChange

func (b *Base) OnWidthChange(c func(int))

func (*Base) Parent

func (b *Base) Parent() ui.ParentDrawable

func (*Base) SendEvent

func (b *Base) SendEvent(ev ui.Event) bool

func (*Base) SetContext

func (b *Base) SetContext(ctx ui.Context)

func (*Base) SetOnLeftClick

func (b *Base) SetOnLeftClick(cb func(ui.Event) bool)

func (*Base) SetOnPointerEnter added in v0.2.3

func (b *Base) SetOnPointerEnter(cb func(ui.Event) bool)

func (*Base) SetOnPointerLeave added in v0.2.3

func (b *Base) SetOnPointerLeave(cb func(ui.Event) bool)

func (*Base) SetOnPointerMove added in v0.2.3

func (b *Base) SetOnPointerMove(cb func(ui.Event) bool)

func (*Base) SetOnRightClick

func (b *Base) SetOnRightClick(cb func(ui.Event) bool)

func (*Base) SetVisible

func (b *Base) SetVisible(v bool)

func (Base) Visible

func (b Base) Visible() bool

func (*Base) Width

func (b *Base) Width() int

type Circle added in v0.3.0

type Circle struct {
	Base
	// contains filtered or unexported fields
}

func NewCircle added in v0.3.0

func NewCircle(p ui.ParentDrawable) *Circle

func (*Circle) Color added in v0.3.0

func (b *Circle) Color() color.Color

func (*Circle) Draw added in v0.3.0

func (r *Circle) Draw(x, y int, im draw.Image)

func (*Circle) Radius added in v0.3.0

func (b *Circle) Radius() int

func (*Circle) SendEvent added in v0.3.0

func (s *Circle) SendEvent(ev ui.Event) bool

func (*Circle) SetColor added in v0.3.0

func (b *Circle) SetColor(v color.Color)

func (*Circle) SetContext added in v0.3.0

func (c *Circle) SetContext(ctx ui.Context)

func (*Circle) SetRadius added in v0.3.0

func (b *Circle) SetRadius(v int)

type Col

type Col struct {
	Base
	// contains filtered or unexported fields
}

func NewCol

func NewCol(p ui.ParentDrawable) *Col

func (*Col) Add

func (c *Col) Add(d ui.Drawable)

func (*Col) Align

func (c *Col) Align() string

func (*Col) ChildContext

func (c *Col) ChildContext(i int) ui.Context

func (*Col) Children

func (c *Col) Children() []ui.Drawable

func (*Col) Draw

func (c *Col) Draw(x, y int, im draw.Image)

func (*Col) SendEvent

func (c *Col) SendEvent(ev ui.Event) bool

func (*Col) SetAlign

func (c *Col) SetAlign(v string)

func (*Col) SetContext

func (c *Col) SetContext(ctx ui.Context)

type Graph

type Graph struct {
	Base
	// contains filtered or unexported fields
}

func NewGraph

func NewGraph(p ui.ParentDrawable) *Graph

func (*Graph) Color

func (b *Graph) Color() color.Color

func (*Graph) Data

func (b *Graph) Data() []float64

func (*Graph) Direction

func (b *Graph) Direction() string

func (Graph) Draw

func (g Graph) Draw(xt, yt int, im draw.Image)

func (*Graph) SetColor

func (b *Graph) SetColor(v color.Color)

func (*Graph) SetData

func (b *Graph) SetData(v []float64)

func (*Graph) SetDirection

func (b *Graph) SetDirection(v string)

func (*Graph) SetHeight

func (b *Graph) SetHeight(v int)

func (*Graph) SetWidth

func (b *Graph) SetWidth(v int)

type Image

type Image struct {
	Base
	// contains filtered or unexported fields
}

func NewImage

func NewImage(p ui.ParentDrawable) *Image

func (*Image) Draw

func (i *Image) Draw(x, y int, im draw.Image)

func (*Image) Image

func (i *Image) Image() image.Image

func (*Image) Path

func (i *Image) Path() string

func (*Image) SetHeight

func (i *Image) SetHeight(v int)

func (*Image) SetImage

func (i *Image) SetImage(v image.Image)

func (*Image) SetPath

func (i *Image) SetPath(p string)

func (*Image) SetWidth

func (i *Image) SetWidth(v int)

type Layers

type Layers struct {
	Base
	// contains filtered or unexported fields
}

func NewLayers

func NewLayers(p ui.ParentDrawable) *Layers

func (*Layers) Add

func (l *Layers) Add(d ui.Drawable)

func (*Layers) ChildContext

func (c *Layers) ChildContext(i int) ui.Context

func (*Layers) Children

func (c *Layers) Children() []ui.Drawable

func (*Layers) Draw

func (l *Layers) Draw(x, y int, im draw.Image)

func (*Layers) HAlign

func (l *Layers) HAlign() string

func (*Layers) SendEvent

func (c *Layers) SendEvent(ev ui.Event) bool

func (*Layers) SetContext

func (l *Layers) SetContext(ctx ui.Context)

func (*Layers) SetHAlign

func (l *Layers) SetHAlign(v string)

func (*Layers) SetVAlign

func (l *Layers) SetVAlign(v string)

func (*Layers) VAlign

func (l *Layers) VAlign() string

type Pattern

type Pattern struct {
	Base
	// contains filtered or unexported fields
}

func NewPattern

func NewPattern(p ui.ParentDrawable) *Pattern

func (*Pattern) Add

func (p *Pattern) Add(d ui.Drawable)

func (*Pattern) ChildContext

func (p *Pattern) ChildContext(i int) ui.Context

func (*Pattern) Children

func (p *Pattern) Children() []ui.Drawable

func (*Pattern) Draw

func (p *Pattern) Draw(dx, dy int, im draw.Image)

func (*Pattern) SendEvent

func (p *Pattern) SendEvent(ev ui.Event) bool

func (*Pattern) SetContext

func (p *Pattern) SetContext(ctx ui.Context)

func (*Pattern) SetHeight

func (p *Pattern) SetHeight(v int)

func (*Pattern) SetWidth

func (p *Pattern) SetWidth(v int)

type Rect

type Rect struct {
	Base
	// contains filtered or unexported fields
}

func NewRect

func NewRect(p ui.ParentDrawable) *Rect

func (*Rect) Add

func (s *Rect) Add(d ui.Drawable)

func (*Rect) ChildContext

func (c *Rect) ChildContext(i int) ui.Context

func (*Rect) Children

func (r *Rect) Children() []ui.Drawable

func (*Rect) Color

func (b *Rect) Color() color.Color

func (*Rect) Draw

func (r *Rect) Draw(x, y int, im draw.Image)

func (*Rect) Radius added in v0.3.0

func (b *Rect) Radius() int

func (*Rect) SendEvent

func (s *Rect) SendEvent(ev ui.Event) bool

func (*Rect) SetColor

func (b *Rect) SetColor(v color.Color)

func (*Rect) SetContext

func (c *Rect) SetContext(ctx ui.Context)

func (*Rect) SetHeight

func (b *Rect) SetHeight(v int)

func (*Rect) SetRadius added in v0.3.0

func (b *Rect) SetRadius(v int)

func (*Rect) SetWidth

func (b *Rect) SetWidth(v int)

type Row

type Row struct {
	Base
	// contains filtered or unexported fields
}

func NewRow

func NewRow(p ui.ParentDrawable) *Row

func (*Row) Add

func (c *Row) Add(d ui.Drawable)

func (*Row) Align

func (c *Row) Align() string

func (*Row) ChildContext

func (c *Row) ChildContext(i int) ui.Context

func (*Row) Children

func (c *Row) Children() []ui.Drawable

func (Row) Draw

func (r Row) Draw(x, y int, im draw.Image)

func (*Row) SendEvent

func (c *Row) SendEvent(ev ui.Event) bool

func (*Row) SetAlign

func (c *Row) SetAlign(v string)

func (*Row) SetContext

func (c *Row) SetContext(ctx ui.Context)

type Sizer

type Sizer struct {
	Base
	// contains filtered or unexported fields
}

func NewSizer

func NewSizer(p ui.ParentDrawable) *Sizer

func (*Sizer) Add

func (s *Sizer) Add(d ui.Drawable)

func (*Sizer) ChildContext

func (c *Sizer) ChildContext(i int) ui.Context

func (*Sizer) Children

func (r *Sizer) Children() []ui.Drawable

func (*Sizer) Draw

func (s *Sizer) Draw(tx, ty int, im draw.Image)

func (*Sizer) HAlign

func (s *Sizer) HAlign() string

func (*Sizer) PaddingBottom

func (s *Sizer) PaddingBottom() int

func (*Sizer) PaddingLeft

func (s *Sizer) PaddingLeft() int

func (*Sizer) PaddingRight

func (s *Sizer) PaddingRight() int

func (*Sizer) PaddingTop

func (s *Sizer) PaddingTop() int

func (*Sizer) SendEvent

func (s *Sizer) SendEvent(ev ui.Event) bool

func (*Sizer) SetContext

func (c *Sizer) SetContext(ctx ui.Context)

func (*Sizer) SetHAlign

func (s *Sizer) SetHAlign(v string)

func (*Sizer) SetHeight

func (s *Sizer) SetHeight(v int)

func (*Sizer) SetPaddingBottom

func (s *Sizer) SetPaddingBottom(v int)

func (*Sizer) SetPaddingLeft

func (s *Sizer) SetPaddingLeft(v int)

func (*Sizer) SetPaddingRight

func (s *Sizer) SetPaddingRight(v int)

func (*Sizer) SetPaddingTop

func (s *Sizer) SetPaddingTop(v int)

func (*Sizer) SetVAlign

func (s *Sizer) SetVAlign(v string)

func (*Sizer) SetWidth

func (s *Sizer) SetWidth(v int)

func (*Sizer) VAlign

func (s *Sizer) VAlign() string

type Text

type Text struct {
	Base
	// contains filtered or unexported fields
}

func NewIcon

func NewIcon(p ui.ParentDrawable) *Text

func NewText

func NewText(p ui.ParentDrawable) *Text

func (*Text) Color

func (t *Text) Color() color.Color

func (*Text) Draw

func (t *Text) Draw(x, y int, im draw.Image)

func (*Text) Font

func (t *Text) Font() string

func (*Text) FontSize

func (t *Text) FontSize() float64

func (*Text) Init

func (t *Text) Init() error

func (*Text) MaxWidth

func (t *Text) MaxWidth() int

func (*Text) SetColor

func (t *Text) SetColor(c color.Color)

func (*Text) SetFont

func (t *Text) SetFont(f string)

func (*Text) SetFontSize

func (t *Text) SetFontSize(f float64)

func (*Text) SetMaxWidth

func (t *Text) SetMaxWidth(i int)

func (*Text) SetText

func (t *Text) SetText(s string)

func (*Text) Text

func (t *Text) Text() string

type WatchBool

type WatchBool struct {
	V bool
	// contains filtered or unexported fields
}

func (*WatchBool) Add

func (w *WatchBool) Add(c func(bool))

func (*WatchBool) Set

func (w *WatchBool) Set(v bool)

type WatchInt

type WatchInt struct {
	V int
	// contains filtered or unexported fields
}

func (*WatchInt) Add

func (w *WatchInt) Add(c func(int))

func (*WatchInt) Set

func (w *WatchInt) Set(v int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL