gumi

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Align_TOP     = 0x00
	Align_VCENTER = 0x01
	Align_BOTTOM  = 0x02
	Align_LEFT    = 0x00
	Align_HCENTER = 0x10
	Align_RIGHT   = 0x20

	Align_CENTER = Align_HCENTER | Align_VCENTER
)
View Source
const (
	KEY_UNKNOWN = iota
	// Alphabet
	KEY_A
	KEY_B
	KEY_C
	KEY_D
	KEY_E
	KEY_F
	KEY_G
	KEY_H
	KEY_I
	KEY_J
	KEY_K
	KEY_L
	KEY_M
	KEY_N
	KEY_O
	KEY_P
	KEY_Q
	KEY_R
	KEY_S
	KEY_T
	KEY_U
	KEY_V
	KEY_W
	KEY_X
	KEY_Y
	KEY_Z
	// Number
	KEY_0
	KEY_1
	KEY_2
	KEY_3
	KEY_4
	KEY_5
	KEY_6
	KEY_7
	KEY_8
	KEY_9
	// Special
	KEY_BACKQUOTE    // `
	KEY_QUOTE        // '
	KEY_LEFTBRACKET  // [
	KEY_RIGHTBRACKET // ]
	KEY_SEMICOLON    // ;
	KEY_MINUS        // -
	KEY_EQUAL        // =
	KEY_BACKSLASH    // \
	KEY_SLASH        // /
	KEY_COMMA        // ,
	KEY_PERIOD       // .
	// Function
	KEY_F1
	KEY_F2
	KEY_F3
	KEY_F4
	KEY_F5
	KEY_F6
	KEY_F7
	KEY_F8
	KEY_F9
	KEY_F10
	KEY_F11
	KEY_F12
	// Control
	KEY_ESC
	KEY_BACKSPACE
	KEY_SPACE
	KEY_ENTER
	KEY_SHIFT   // mac : Shift
	KEY_CONTROL // mac : Command, Control
	KEY_ALT     // mac : Option
	KEY_TAB
	// Arrow
	KEY_UP
	KEY_DOWN
	KEY_LEFT
	KEY_RIGHT
	// Mouse
	KEY_MOUSE1
	KEY_MOUSE2
	KEY_MOUSE3
)
View Source
const (
	VERSION_MAJOR = 0
	VERSION_MINOR = 1
	VERSION_PATCH = 0
)
View Source
const RulerDash1 = 2.
View Source
const RulerDash2 = 4.
View Source
const RulerWidth = 10

Variables

View Source
var (
	AUTOLENGTH = Length{
		Min: 0,
		Max: math.MaxUint16,
	}
	MAXLENGTH = Length{
		Min: math.MaxUint16,
		Max: math.MaxUint16,
	}
)
View Source
var Animation _Animation
View Source
var Drawing _Drawing
View Source
var Material _MaterialAnimation

Functions

func Capture

func Capture(name string, img image.Image) error

func GCD

func GCD(a, b int) int

func GGContextRGBASub

func GGContextRGBASub(rgba *image.RGBA, rect image.Rectangle) *gg.Context

func GUMIParents

func GUMIParents(e GUMI) string

func IsColorImage

func IsColorImage(img image.Image) (ok bool, c color.Color)

func ParseAlign

func ParseAlign(a Align) (v uint8, h uint8)

func Proportion

func Proportion(have, a, b uint16) (pa, pb uint16)

func Version

func Version() (major, minor, patch int)

Types

type ACanvas

type ACanvas struct {
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func ACanvas0

func ACanvas0(w, h uint16, fn DrawingFn) *ACanvas

func (*ACanvas) Occur

func (s *ACanvas) Occur(event Event)

func (*ACanvas) String

func (s *ACanvas) String() string

type AEmpty

type AEmpty struct {
	VoidStructure
}

func AEmpty0

func AEmpty0() *AEmpty

func (AEmpty) Occur

func (AEmpty) Occur(event Event)

func (AEmpty) String

func (s AEmpty) String() string

type AImage

type AImage struct {
	VoidStructure
	BoundStore
	// contains filtered or unexported fields
}

func AImage0

func AImage0(img image.Image) *AImage

func (*AImage) Occur

func (s *AImage) Occur(event Event)

func (*AImage) String

func (s *AImage) String() string

type AText

type AText struct {
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func AText0

func AText0(str string, align Align) *AText

func AText1

func AText1(str string) *AText

func (*AText) Get

func (s *AText) Get() string

func (*AText) GetAlign

func (s *AText) GetAlign() Align

func (*AText) Occur

func (s *AText) Occur(event Event)

func (*AText) Set

func (s *AText) Set(str string)

func (*AText) SetAlign

func (s *AText) SetAlign(align Align)

func (*AText) String

func (s *AText) String() string

type Align

type Align uint8

type AnimFunc

type AnimFunc func(t float64) float64

type AnimFuncsCubic

type AnimFuncsCubic struct {
}

func (AnimFuncsCubic) Easing

func (AnimFuncsCubic) Easing(t float64) float64

func (AnimFuncsCubic) EasingIn

func (AnimFuncsCubic) EasingIn(t float64) float64

func (AnimFuncsCubic) EasingOut

func (AnimFuncsCubic) EasingOut(t float64) float64

type AnimFuncsQuad

type AnimFuncsQuad struct {
}

func (AnimFuncsQuad) Easing

func (AnimFuncsQuad) Easing(t float64) float64

func (AnimFuncsQuad) EasingIn

func (AnimFuncsQuad) EasingIn(t float64) float64

func (AnimFuncsQuad) EasingOut

func (AnimFuncsQuad) EasingOut(t float64) float64

type AnimFuncsQuart

type AnimFuncsQuart struct {
}

func (AnimFuncsQuart) Easing

func (AnimFuncsQuart) Easing(t float64) float64

func (AnimFuncsQuart) EasingIn

func (AnimFuncsQuart) EasingIn(t float64) float64

func (AnimFuncsQuart) EasingOut

func (AnimFuncsQuart) EasingOut(t float64) float64

type AnimFuncsQuint

type AnimFuncsQuint struct {
}

func (AnimFuncsQuint) Easing

func (AnimFuncsQuint) Easing(t float64) float64

func (AnimFuncsQuint) EasingIn

func (AnimFuncsQuint) EasingIn(t float64) float64

func (AnimFuncsQuint) EasingOut

func (AnimFuncsQuint) EasingOut(t float64) float64

type Blank

type Blank struct {
	L, B, R, T Length
}

func RegularBlank

func RegularBlank(regular Length) Blank

func SymmetryBlank

func SymmetryBlank(horizontal, vertical Length) Blank

func (*Blank) String

func (s *Blank) String() string

type BoundStore

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

type Dashgrid

type Dashgrid struct{}

func (Dashgrid) Horizontal

func (Dashgrid) Horizontal(pivot float64) DrawingFn

func (Dashgrid) Vertical

func (Dashgrid) Vertical(pivot float64) DrawingFn

type Distribute

type Distribute func(have int, lns []Length) []int

type Distributions

type Distributions struct {
}
var Distribution Distributions

func (Distributions) Minimalize

func (Distributions) Minimalize(have int, lns []Length) []int

func (Distributions) Order

func (Distributions) Order(have int, lns []Length) []int

type DrawingFn

type DrawingFn func(context *gg.Context, style *Style)

type Event

type Event interface {
	Kind() EventKind
}

type EventCursor

type EventCursor struct {
	X, Y uint16
}

func (EventCursor) Kind

func (EventCursor) Kind() EventKind

type EventKeyPress

type EventKeyPress struct {
	Key uint8
}

func (EventKeyPress) Kind

func (EventKeyPress) Kind() EventKind

type EventKeyRelease

type EventKeyRelease struct {
	Key uint8
}

func (EventKeyRelease) Kind

func (EventKeyRelease) Kind() EventKind

type EventKind

type EventKind uint8
const (
	KEYPRESS   EventKind = iota
	KEYRELEASE EventKind = iota
	CURSOR     EventKind = iota
	SCROLL     EventKind = iota
	RUNE       EventKind = iota
)

type EventRune

type EventRune struct {
	Rune rune
}

func (EventRune) Kind

func (EventRune) Kind() EventKind

type EventScroll

type EventScroll struct {
	X, Y uint16
}

func (EventScroll) Kind

func (EventScroll) Kind() EventKind

type GUMI

func LinkingFrom

func LinkingFrom(lks ...GUMI) (from GUMI)

func LinkingTo

func LinkingTo(lks ...GUMI) (to GUMI)

type GUMICacher

type GUMICacher interface {
}

type GUMIEventer

type GUMIEventer interface {
	Occur(event Event)
}

type GUMIRenderer

type GUMIRenderer interface {
	// contains filtered or unexported methods
}

type GUMIStructure

type GUMIStructure interface {
	Born(gumi GUMI)
	Breed(gumi []GUMI)
	Parent() GUMI
	Childrun() []GUMI
}

type Graduation

type Graduation struct{}

func (Graduation) Horizontal

func (Graduation) Horizontal(pivot float64) DrawingFn

func (Graduation) Vertical

func (Graduation) Vertical(pivot float64) DrawingFn

type Grid

type Grid struct{}

func (Grid) Horizontal

func (Grid) Horizontal(pivot float64) DrawingFn

func (Grid) Vertical

func (Grid) Vertical(pivot float64) DrawingFn

type Hint

type Hint struct{}

func (Hint) Horizontal

func (Hint) Horizontal(pivot float64) DrawingFn

func (Hint) Vertical

func (Hint) Vertical(pivot float64) DrawingFn

type Information

type Information struct {
	Dt int64
}

func DefaultInformation

func DefaultInformation() *Information

type Length

type Length struct {
	Min, Max uint16
}

func FixLength

func FixLength(fix uint16) Length

func MaxLength

func MaxLength(max uint16) Length

func MinLength

func MinLength(min uint16) Length

func (Length) String

func (s Length) String() string

type MTButton

type MTButton struct {
	//
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func MTButton0

func MTButton0(mcl MaterialColor, text string, onclick MTButtonClick) *MTButton

func MTButton1

func MTButton1(text string, onclick MTButtonClick) *MTButton

func (*MTButton) GetMaterialColor

func (s *MTButton) GetMaterialColor() MaterialColor

func (*MTButton) GetText

func (s *MTButton) GetText() string

func (*MTButton) Occur

func (s *MTButton) Occur(event Event)

func (*MTButton) OnClick

func (s *MTButton) OnClick(callback MTButtonClick)

func (*MTButton) OnFocus

func (s *MTButton) OnFocus(callback MTButtonClick)

func (*MTButton) ReferClick

func (s *MTButton) ReferClick() MTButtonClick

func (*MTButton) ReferFocus

func (s *MTButton) ReferFocus() MTButtonClick

func (*MTButton) SetMaterialColor

func (s *MTButton) SetMaterialColor(mc MaterialColor)

func (*MTButton) SetText

func (s *MTButton) SetText(txt string)

func (*MTButton) String

func (s *MTButton) String() string

type MTButtonClick

type MTButtonClick func()

type MTButtonFocus

type MTButtonFocus func(focus bool)

type MTProgress

type MTProgress struct {
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func MTProgress0

func MTProgress0(from, to MaterialColor, percent float64) *MTProgress

func MTProgress1

func MTProgress1(mcl MaterialColor, percent float64) *MTProgress

func (*MTProgress) Get

func (s *MTProgress) Get() float64

func (*MTProgress) GetFromMaterialColor

func (s *MTProgress) GetFromMaterialColor() MaterialColor

func (*MTProgress) GetToMaterialColor

func (s *MTProgress) GetToMaterialColor() MaterialColor

func (*MTProgress) Occur

func (s *MTProgress) Occur(event Event)

func (*MTProgress) Set

func (s *MTProgress) Set(percent float64)

func (*MTProgress) SetFromMaterialColor

func (s *MTProgress) SetFromMaterialColor(mcl MaterialColor)

func (*MTProgress) SetToMaterialColor

func (s *MTProgress) SetToMaterialColor(mcl MaterialColor)

func (*MTProgress) String

func (s *MTProgress) String() string

type MTRadio

type MTRadio struct {
	//
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func MTRadio0

func MTRadio0(from, to MaterialColor, active MTRadioActive) *MTRadio

func MTRadio1

func MTRadio1(active MTRadioActive) *MTRadio

func (*MTRadio) GetFromMaterialColor

func (s *MTRadio) GetFromMaterialColor() MaterialColor

func (*MTRadio) GetToMaterialColor

func (s *MTRadio) GetToMaterialColor() MaterialColor

func (*MTRadio) Occur

func (s *MTRadio) Occur(event Event)

func (*MTRadio) OnActive

func (s *MTRadio) OnActive(callback MTRadioActive)

func (*MTRadio) ReferActive

func (s *MTRadio) ReferActive() MTRadioActive

func (*MTRadio) SetFromMaterialColor

func (s *MTRadio) SetFromMaterialColor(mc MaterialColor)

func (*MTRadio) SetToMaterialColor

func (s *MTRadio) SetToMaterialColor(mc MaterialColor)

func (*MTRadio) String

func (s *MTRadio) String() string

type MTRadioActive

type MTRadioActive func(active bool)

type MTToggle

type MTToggle struct {
	//
	VoidStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func MTToggle0

func MTToggle0(from, to MaterialColor, active MTToggleActive) *MTToggle

func MTToggle1

func MTToggle1(active MTToggleActive) *MTToggle

func (*MTToggle) GetFromMaterialColor

func (s *MTToggle) GetFromMaterialColor() MaterialColor

func (*MTToggle) GetToMaterialColor

func (s *MTToggle) GetToMaterialColor() MaterialColor

func (*MTToggle) Occur

func (s *MTToggle) Occur(event Event)

func (*MTToggle) OnActive

func (s *MTToggle) OnActive(callback MTToggleActive)

func (*MTToggle) ReferActive

func (s *MTToggle) ReferActive() MTToggleActive

func (*MTToggle) SetFromMaterialColor

func (s *MTToggle) SetFromMaterialColor(mc MaterialColor)

func (*MTToggle) SetToMaterialColor

func (s *MTToggle) SetToMaterialColor(mc MaterialColor)

func (*MTToggle) String

func (s *MTToggle) String() string

type MTToggleActive

type MTToggleActive func(active bool)

type MaterialColor

type MaterialColor uint8
const (
	White  MaterialColor = iota
	Red    MaterialColor = iota
	Green  MaterialColor = iota
	Blue   MaterialColor = iota
	Yellow MaterialColor = iota
)

type MultipleStructure

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

func (*MultipleStructure) Born

func (s *MultipleStructure) Born(gumi GUMI)

func (*MultipleStructure) Breed

func (s *MultipleStructure) Breed(gumi []GUMI)

func (*MultipleStructure) Childrun

func (s *MultipleStructure) Childrun() []GUMI

func (*MultipleStructure) Parent

func (s *MultipleStructure) Parent() GUMI

type NBackground

type NBackground struct {
	SingleStructure
	BoundStore
	StyleStore
}

func NBackground0

func NBackground0() *NBackground

func (*NBackground) Occur

func (s *NBackground) Occur(event Event)

func (*NBackground) String

func (s *NBackground) String() string

type NButton

type NButton struct {
	SingleStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func NButton0

func NButton0(click func()) *NButton

func NButton1

func NButton1() *NButton

func (*NButton) Occur

func (s *NButton) Occur(event Event)

func (*NButton) OnClick

func (s *NButton) OnClick(callback NButtonClick)

func (*NButton) OnEnter

func (s *NButton) OnEnter(callback NButtonFocus)

func (*NButton) ReferClick

func (s *NButton) ReferClick() NButtonClick

func (*NButton) ReferEnter

func (s *NButton) ReferEnter() NButtonFocus

func (*NButton) String

func (s *NButton) String() string

type NButtonClick

type NButtonClick func()

type NButtonFocus

type NButtonFocus func(focus bool)

type NDo

type NDo struct {
	SingleStructure
	// contains filtered or unexported fields
}

func NDo0

func NDo0(
	fnDraw *struct{ Before, After func(frame *image.RGBA) },
	fnRect func(rect *image.Rectangle),
	fnUpdate func(info *Information, style *Style) (*Information, *Style),
	fnOccur func(event Event) Event,
) *NDo

func (*NDo) Occur

func (s *NDo) Occur(event Event)

func (*NDo) String

func (s *NDo) String() string

type NDrawing

type NDrawing struct {
	SingleStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func NDrawing0

func NDrawing0(beforedraw bool, drawFuncs ...DrawingFn) *NDrawing

func NDrawing1

func NDrawing1(drawFuncs ...DrawingFn) *NDrawing

func (*NDrawing) AfterDraw

func (s *NDrawing) AfterDraw(on bool) *NDrawing

func (*NDrawing) IsAfterDraw

func (s *NDrawing) IsAfterDraw() bool

func (*NDrawing) Occur

func (s *NDrawing) Occur(event Event)

func (*NDrawing) String

func (s *NDrawing) String() string

type NHorizontal

type NHorizontal struct {
	MultipleStructure
	// contains filtered or unexported fields
}

func NHorizontal0

func NHorizontal0(rule Distribute, childrun ...GUMI) *NHorizontal

func NHorizontal1

func NHorizontal1(childrun ...GUMI) *NHorizontal

func (*NHorizontal) Occur

func (s *NHorizontal) Occur(event Event)

func (*NHorizontal) String

func (s *NHorizontal) String() string

type NMargin

type NMargin struct {
	SingleStructure
	// contains filtered or unexported fields
}

func NMargin0

func NMargin0(sz Blank) *NMargin

func (*NMargin) Get

func (s *NMargin) Get() Blank

func (*NMargin) Occur

func (s *NMargin) Occur(event Event)

func (*NMargin) Set

func (s *NMargin) Set(sz Blank)

func (*NMargin) String

func (s *NMargin) String() string

type NSize

type NSize struct {
	SingleStructure
	// contains filtered or unexported fields
}

func NSize0

func NSize0(sz Size) *NSize

func (*NSize) Get

func (s *NSize) Get() Size

func (*NSize) Occur

func (s *NSize) Occur(event Event)

func (*NSize) Set

func (s *NSize) Set(sz Size)

func (*NSize) String

func (s *NSize) String() string

type NStyle

type NStyle struct {
	SingleStructure
	// contains filtered or unexported fields
}

func NStyle0

func NStyle0(s *Style) *NStyle

func (*NStyle) Get

func (s *NStyle) Get() *Style

func (*NStyle) Occur

func (s *NStyle) Occur(event Event)

func (*NStyle) Set

func (s *NStyle) Set(st *Style)

func (*NStyle) String

func (s *NStyle) String() string

type NToggle

type NToggle struct {
	SingleStructure
	BoundStore
	StyleStore
	// contains filtered or unexported fields
}

func NToggle0

func NToggle0(active NToggleActive) *NToggle

func (*NToggle) Occur

func (s *NToggle) Occur(event Event)

func (*NToggle) OnActive

func (s *NToggle) OnActive(callback NToggleActive)

func (*NToggle) ReferActive

func (s *NToggle) ReferActive() NToggleActive

func (*NToggle) String

func (s *NToggle) String() string

type NToggleActive

type NToggleActive func(active bool)

type NVertical

type NVertical struct {
	MultipleStructure
	// contains filtered or unexported fields
}

func NVertical0

func NVertical0(rule Distribute, childrun ...GUMI) *NVertical

func NVertical1

func NVertical1(childrun ...GUMI) *NVertical

func (*NVertical) Occur

func (s *NVertical) Occur(event Event)

func (*NVertical) String

func (s *NVertical) String() string

type Screen

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

func NewScreen

func NewScreen(w, h int) *Screen

func (*Screen) Draw

func (s *Screen) Draw()

func (*Screen) Event

func (s *Screen) Event(event Event)

func (*Screen) Frame

func (s *Screen) Frame() image.Image

func (*Screen) RGBA

func (s *Screen) RGBA() *image.RGBA

func (*Screen) Ready

func (s *Screen) Ready()

func (*Screen) Resize

func (s *Screen) Resize(w, h int)

func (*Screen) Root

func (s *Screen) Root(root GUMI)

func (*Screen) Update

func (s *Screen) Update(info *Information, style *Style)

type SingleStructure

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

func (*SingleStructure) Born

func (s *SingleStructure) Born(gumi GUMI)

func (*SingleStructure) Breed

func (s *SingleStructure) Breed(gumi []GUMI)

func (*SingleStructure) Childrun

func (s *SingleStructure) Childrun() []GUMI

func (*SingleStructure) Parent

func (s *SingleStructure) Parent() GUMI

type Size

type Size struct {
	Vertical   Length
	Horizontal Length
}

func (Size) String

func (s Size) String() string

type Style

type Style struct {
	Default  StyleDefault
	Material StyleMaterial
}

func DefaultStyle

func DefaultStyle() *Style

type StyleDefault

type StyleDefault struct {
	Font *gutl.Font
	//
	LineWidth float64
	//
	Line image.Image
	Face image.Image
}

type StyleMaterial

type StyleMaterial struct {
	White  [2]image.Image
	Red    [2]image.Image
	Green  [2]image.Image
	Blue   [2]image.Image
	Yellow [2]image.Image
}

func (*StyleMaterial) PalletteColor

func (s *StyleMaterial) PalletteColor(c MaterialColor) [2]color.Color

func (*StyleMaterial) PalletteImage

func (s *StyleMaterial) PalletteImage(c MaterialColor) [2]image.Image

type StyleStore

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

type VoidStructure

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

func (*VoidStructure) Born

func (s *VoidStructure) Born(gumi GUMI)

func (*VoidStructure) Breed

func (s *VoidStructure) Breed(gumi []GUMI)

func (*VoidStructure) Childrun

func (s *VoidStructure) Childrun() []GUMI

func (*VoidStructure) Parent

func (s *VoidStructure) Parent() GUMI

Directories

Path Synopsis
ex

Jump to

Keyboard shortcuts

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