Documentation
¶
Index ¶
- Constants
- func AddDrag[T any](wo *World, convert func(interval [2]geom.Point, drag T) *Sorm)
- func Bytes(bs []byte) io.RuneScanner
- func GetSystemFont(err error) (string, float64, error)
- func Int[T constraints.Integer](i T) io.RuneScanner
- func Makealine(vg *Context, font *Font, size float64, runes []rune) float64
- func MakealineReader(vg *Context, font *Font, size float64, rd io.RuneScanner) float64
- func MakealineStrict(vg *Context, font *Font, size float64, runes []rune) float64
- func Pretty(pretty bool) func(*rpeg) error
- func Replay(vg *Context, segs []Segment)
- func Runes(rs []rune) io.RuneScanner
- func Size(size int) func(*rpeg) error
- func String(s string) io.RuneScanner
- type Activator
- type ActivatorPainter
- type Click
- type Config
- type Context
- func (c *Context) Also()
- func (c *Context) Arc(cx, cy, r, a0, a1 float64, dir nanovgo.Direction)
- func (c *Context) ArcTo(x1, y1, x2, y2, radius float64)
- func (c *Context) BeginFrame(windowWidth, windowHeight int, devicePixelRatio float64)
- func (c *Context) BeginPath()
- func (c *Context) BezierTo(c1x, c1y, c2x, c2y, x, y float64)
- func (c *Context) Block(block func())
- func (c *Context) CancelFrame()
- func (c *Context) Circle(cx, cy, r float64)
- func (c *Context) ClosePath()
- func (c *Context) CreateFontFromMemory(name string, data []byte, freeData uint8) int
- func (c *Context) CreateImageFromGoImage(imageFlag nanovgo.ImageFlags, img image.Image) int
- func (c *Context) CreateImageRGBA(w, h int, imageFlags nanovgo.ImageFlags, data []byte) int
- func (c *Context) CurrentTransform() nanovgo.TransformMatrix
- func (c *Context) DebugDumpPathCache()
- func (c *Context) Delete()
- func (c *Context) DeleteImage(img int)
- func (c *Context) Ellipse(cx, cy, rx, ry float64)
- func (c *Context) EndFrame() (oldhash [512]byte)
- func (c *Context) Fill()
- func (c *Context) FindFont(name string) int
- func (c *Context) FontBlur() float64
- func (c *Context) FontFace() string
- func (c *Context) FontFaceID() int
- func (c *Context) FontSize() float64
- func (c *Context) GlobalAlpha() float64
- func (c *Context) ImageSize(img int) (int, int, error)
- func (c *Context) IntersectScissor(x, y, w, h float64)
- func (c *Context) LineCap() nanovgo.LineCap
- func (c *Context) LineJoin() nanovgo.LineCap
- func (c *Context) LineTo(x, y float64)
- func (c *Context) MiterLimit() float64
- func (c *Context) MoveTo(x, y float64)
- func (c *Context) PathWinding(winding nanovgo.Winding)
- func (c *Context) QuadTo(cx, cy, x, y float64)
- func (c *Context) Rect(x, y, w, h float64)
- func (c *Context) Replay(sub *Context)
- func (c *Context) Reset()
- func (c *Context) ResetScissor()
- func (c *Context) ResetTransform()
- func (c *Context) Restore()
- func (c *Context) Rotate(angle float64)
- func (c *Context) RoundedRect(x, y, w, h, r float64)
- func (c *Context) Save()
- func (c *Context) Scale(x, y float64)
- func (c *Context) Scissor(x, y, w, h float64)
- func (c *Context) SetFillColor(color nanovgo.Color)
- func (c *Context) SetFillPaint(paint nanovgo.Paint)
- func (c *Context) SetFontBlur(blur float64)
- func (c *Context) SetFontFace(font string)
- func (c *Context) SetFontFaceID(font int)
- func (c *Context) SetFontSize(size float64)
- func (c *Context) SetGlobalAlpha(alpha float64)
- func (c *Context) SetLineCap(cap nanovgo.LineCap)
- func (c *Context) SetLineJoin(joint nanovgo.LineCap)
- func (c *Context) SetMiterLimit(limit float64)
- func (c *Context) SetStrokeColor(color nanovgo.Color)
- func (c *Context) SetStrokePaint(paint nanovgo.Paint)
- func (c *Context) SetStrokeWidth(width float64)
- func (c *Context) SetTextAlign(align nanovgo.Align)
- func (c *Context) SetTextLetterSpacing(spacing float64)
- func (c *Context) SetTextLineHeight(lineHeight float64)
- func (c *Context) SetTransform(t nanovgo.TransformMatrix)
- func (cx *Context) SetTransformByValue(a, b, c, d, e, f float64)
- func (c *Context) SkewX(angle float64)
- func (c *Context) SkewY(angle float64)
- func (c *Context) Stroke()
- func (c *Context) StrokeWidth() float64
- func (c *Context) Sub() *Context
- func (c *Context) TextAlign() nanovgo.Align
- func (c *Context) TextBounds(x, y float64, runes []rune) (float64, geom.Rectangle)
- func (c *Context) TextLetterSpacing() float64
- func (c *Context) TextLineHeight() float64
- func (c *Context) TextMetrics() (float64, float64, float64)
- func (c *Context) TextRune(x, y float64, runes []rune) float64
- func (c *Context) Translate(x, y float64)
- func (c *Context) UpdateImage(img int, data []byte) error
- type Drop
- type Eqn
- type Equation
- type EventPoint
- type EventTraceLast
- type Events
- func (u *Events) Anywhere() Matcher
- func (u *Events) In(r geom.Rectangle) Matcher
- func (u *Events) Match(pattern Regexp) bool
- func (u *Events) MatchDeadline(pattern Regexp, deadline time.Time) bool
- func (u *Events) MatchFreshness(pattern Regexp, freshness time.Duration) bool
- func (u *Events) MatchIn(pattern Regexp, r geom.Rectangle) bool
- func (u *Events) MatchInDeadline(pattern Regexp, rect geom.Rectangle, deadline time.Time) bool
- func (u *Events) MatchInDuration(pattern Regexp, rect geom.Rectangle, duration time.Duration) bool
- func (u *Events) MatchInFreshness(pattern Regexp, rect geom.Rectangle, freshness time.Duration) bool
- func (u *Events) MatchInIndef(pattern Regexp, rect geom.Rectangle) bool
- func (u *Events) MatchInNochoke(pattern Regexp, r geom.Rectangle) bool
- func (u *Events) MatchIndef(pattern Regexp) bool
- func (u *Events) SetDeadline(t time.Time)
- type Font
- func (f *Font) Advance(r rune) float64
- func (f *Font) Captoem(cap float64) float64
- func (f *Font) CaptoemFixed(cap fixed.Int26_6) fixed.Int26_6
- func (f *Font) Emtocap(em float64) float64
- func (f *Font) EmtocapFixed(em fixed.Int26_6) fixed.Int26_6
- func (font *Font) Measure(cap float64, runes []rune) float64
- func (font *Font) MeasureReader(cap float64, rd io.RuneScanner) float64
- func (f *Font) PureAdvance(r rune) float64
- func (f *Font) Segments(r rune) []Segment
- func (f *Font) TrueXBearing(r rune) float64
- func (f *Font) Width(r rune) float64
- type Hover
- type Index
- type Key
- type Matcher
- func (m Matcher) Anywhere() Matcher
- func (m Matcher) Deadline(t time.Time) Matcher
- func (m Matcher) Duration(d time.Duration) Matcher
- func (m Matcher) Indef() Matcher
- func (m Matcher) Match(pattern Regexp) bool
- func (m Matcher) Nochoke() Matcher
- func (m Matcher) Rect() geom.Rectangle
- func (m Matcher) WithZ(z int) Matcher
- func (m Matcher) Z() int
- type NanovgoDestination
- func (n *NanovgoDestination) AbsArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
- func (n *NanovgoDestination) AbsCubeTo(x1, y1, x2, y2, x, y float32)
- func (n *NanovgoDestination) AbsHLineTo(x float32)
- func (n *NanovgoDestination) AbsLineTo(x, y float32)
- func (n *NanovgoDestination) AbsQuadTo(x1, y1, x, y float32)
- func (n *NanovgoDestination) AbsSmoothCubeTo(x2, y2, x, y float32)
- func (n *NanovgoDestination) AbsSmoothQuadTo(x, y float32)
- func (n *NanovgoDestination) AbsVLineTo(y float32)
- func (n *NanovgoDestination) ClosePathAbsMoveTo(x, y float32)
- func (n *NanovgoDestination) ClosePathEndPath()
- func (n *NanovgoDestination) ClosePathRelMoveTo(x, y float32)
- func (n *NanovgoDestination) RelArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
- func (n *NanovgoDestination) RelCubeTo(x1, y1, x2, y2, x, y float32)
- func (n *NanovgoDestination) RelHLineTo(x float32)
- func (n *NanovgoDestination) RelLineTo(x, y float32)
- func (n *NanovgoDestination) RelQuadTo(x1, y1, x, y float32)
- func (n *NanovgoDestination) RelSmoothCubeTo(x2, y2, x, y float32)
- func (n *NanovgoDestination) RelSmoothQuadTo(x, y float32)
- func (n *NanovgoDestination) RelVLineTo(y float32)
- func (n *NanovgoDestination) Reset(m iconvg.Metadata)
- func (n *NanovgoDestination) SetCReg(adj uint8, incr bool, c iconvg.Color)
- func (n *NanovgoDestination) SetCSel(cSel uint8)
- func (n *NanovgoDestination) SetLOD(lod0, lod1 float32)
- func (n *NanovgoDestination) SetNReg(adj uint8, incr bool, f float32)
- func (n *NanovgoDestination) SetNSel(nSel uint8)
- func (n *NanovgoDestination) StartPath(adj uint8, x, y float32)
- type Oscilloscope
- type Press
- type Regexp
- type Release
- type RenderFont
- type RenderImage
- type RenderOp
- type Renderer
- type Scroll
- type Scrollptr
- type Segment
- type Sequence
- type Sorm
- func (s *Sorm) Betweener() *Sorm
- func (s *Sorm) Cond(f func(Matcher)) *Sorm
- func (s *Sorm) CondFill(f func(rect geom.Rectangle) nanovgo.Paint) *Sorm
- func (s *Sorm) CondFillStroke(f func(rect geom.Rectangle) (nanovgo.Paint, nanovgo.Paint)) *Sorm
- func (s *Sorm) CondStroke(f func(rect geom.Rectangle) nanovgo.Paint) *Sorm
- func (s *Sorm) Fill(p nanovgo.Paint) *Sorm
- func (s *Sorm) FillStroke(p nanovgo.Paint) *Sorm
- func (s *Sorm) Hoverride() *Sorm
- func (s *Sorm) Lmb(wo *World, f func()) *Sorm
- func (s *Sorm) Override() *Sorm
- func (s *Sorm) Rectangle() geom.Rectangle
- func (s *Sorm) Resize(x, y float64) *Sorm
- func (s Sorm) String() string
- func (s *Sorm) Stroke(p nanovgo.Paint) *Sorm
- func (s *Sorm) Strokewidth(w float64) *Sorm
- func (s *Sorm) Voverride() *Sorm
- type Sormer
- type SpriteUnit
- type Sweep
- type Symbol
- type Unclick
- type Windower
- type World
- func (wo *World) BaseWorld() *World
- func (wo *World) Between(f func() *Sorm) (s *Sorm)
- func (wo *World) BetweenVoid(w, h complex128) (s *Sorm)
- func (wo *World) Canvas(w, h complex128, run func(vgo *Context, wt geom.Geom, rect geom.Rectangle)) (s *Sorm)
- func (wo *World) Cat(a, b []*Sorm) (s *Sorm)
- func (wo *World) Circle(d float64) (s *Sorm)
- func (wo *World) Compound(args ...*Sorm) (s *Sorm)
- func (wo *World) Cond(f func(m Matcher)) (s *Sorm)
- func (wo *World) CondFill(f func(geom.Rectangle) nanovgo.Paint) (s *Sorm)
- func (wo *World) CondStroke(f func(geom.Rectangle) nanovgo.Paint) (s *Sorm)
- func (wo *World) Crop() (s *Sorm)
- func (wo *World) Develop() []RenderOp
- func (wo *World) Equation(eqn Equation) (s *Sorm)
- func (wo *World) Fill(p nanovgo.Paint) (s *Sorm)
- func (wo *World) Halign(amt float64) (s *Sorm)
- func (wo *World) Hfollow() (s *Sorm)
- func (wo *World) Hscroll(idx *Index, du float64) (s *Sorm)
- func (wo *World) Hshrink() (s *Sorm)
- func (wo *World) Identity(key any) (s *Sorm)
- func (wo *World) Illustration(w, h complex128, mode string, src io.Reader) (s *Sorm)
- func (wo *World) Key(k any) (v *any)
- func (wo *World) Limit(w, h float64) (s *Sorm)
- func (wo *World) NewBottomUpText(font []byte) func(size float64, str []rune) *Sorm
- func (wo *World) NewText(font []byte) func(size float64, str []rune) *Sorm
- func (wo *World) NewTopDownText(font []byte) func(size float64, str []rune) *Sorm
- func (wo *World) NewVectorText(font []byte) func(size float64, str []rune) *Sorm
- func (wo *World) NewVectorTextReader(font []byte) func(size float64, rd io.RuneScanner) *Sorm
- func (wo *World) Next() bool
- func (wo *World) Noround() (s *Sorm)
- func (wo *World) Posttransform(x, y float64) (s *Sorm)
- func (wo *World) Prevkey(key any) *Sorm
- func (wo *World) Rectangle(w, h complex128) (s *Sorm)
- func (wo *World) Renderer() Renderer
- func (wo *World) ResetDrags()
- func (wo *World) Root(s ...*Sorm)
- func (wo *World) Round() (s *Sorm)
- func (wo *World) Roundrect(w, h complex128, r float64) (s *Sorm)
- func (wo *World) Run(onevent func())
- func (wo *World) Sequence(q Sequence) (s *Sorm)
- func (wo *World) Sink(f func(drop any)) (s *Sorm)
- func (wo *World) Source() (s *Sorm)
- func (wo *World) Stroke(p nanovgo.Paint) (s *Sorm)
- func (wo *World) Strokewidth(w float64) (s *Sorm)
- func (wo *World) Transform(m geom.Geom) (s *Sorm)
- func (wo *World) Valign(amt float64) (s *Sorm)
- func (wo *World) Vfollow() (s *Sorm)
- func (wo *World) Void(w, h complex128) (s *Sorm)
- func (wo *World) Vscroll(idx *Index, du float64) (s *Sorm)
- func (wo *World) Vshrink() (s *Sorm)
- func (wo *World) Whereis(s *Sorm) *Sorm
- func (wo *World) Windower() Windower
Constants ¶
const ( RuneDelete = '\x7f' // ASCII Delete RuneBackspace = '\b' // ASCII Backspace RuneLeft = '\x11' // ASCII Device Control 1 — Left cursor key RuneDown = '\x12' // ASCII Device Control 2 — Down ... RuneUp = '\x13' // ASCII Device Control 3 — Up ... RuneRight = '\x14' // ASCII Device Control 4 — Right ... )
Special values of rune.
If one needs to enter those code points, they either writing a terminal emulator and should insert such special characters using Ctrl+Shift+<Key> instead, or they are plainly doing something wrong.
Variables ¶
This section is empty.
Functions ¶
func Bytes ¶
func Bytes(bs []byte) io.RuneScanner
func Int ¶
func Int[T constraints.Integer](i T) io.RuneScanner
func MakealineReader ¶
func MakealineStrict ¶
func Runes ¶
func Runes(rs []rune) io.RuneScanner
func String ¶
func String(s string) io.RuneScanner
Types ¶
type Activator ¶
Activator — это любой объект, на котором может быть сконцентрирован фокус ввода. Этот объект может обрабатывать свои события внутри метода Activate. В системе есть какое-то глобальное поле, которое обозначает текущий сфокусированный объект.
Activate возвращает Silence, когда объект не среагировал на событие, Ack, когда среагировал и Deactivate, когда объект сбросил с себя фокус.
Activator временный и умирает после смены фокуса.
type ActivatorPainter ¶
ActivatorPainter — это Activator, который может рисовать себя во время Drag.
type Config ¶
type Config struct {
// Default window frame after launch.
// Effective if not zero.
WindowRect image.Rectangle
// If not nil, events are not received from user, but replayed from this reader
// as recorded after pressing F5.
ReplayReader io.Reader
}
Config is the starting setup for Contraption.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is a draw list with the interface of Nanovgo.
It is interpreted by the backend to draw on screen or to do anything else. TODO All transformations must be resolved by Context, not by the backend.
func (*Context) BeginFrame ¶
func (*Context) CancelFrame ¶
func (c *Context) CancelFrame()
func (*Context) CreateFontFromMemory ¶
func (*Context) CreateImageFromGoImage ¶
func (*Context) CreateImageRGBA ¶
func (*Context) CurrentTransform ¶
func (c *Context) CurrentTransform() nanovgo.TransformMatrix
func (*Context) DebugDumpPathCache ¶
func (c *Context) DebugDumpPathCache()
func (*Context) DeleteImage ¶
func (*Context) FontFaceID ¶
func (*Context) GlobalAlpha ¶
func (*Context) IntersectScissor ¶
func (*Context) MiterLimit ¶
func (*Context) PathWinding ¶
func (*Context) ResetScissor ¶
func (c *Context) ResetScissor()
func (*Context) ResetTransform ¶
func (c *Context) ResetTransform()
func (*Context) RoundedRect ¶
func (*Context) SetFillColor ¶
func (*Context) SetFillPaint ¶
func (*Context) SetFontBlur ¶
func (*Context) SetFontFace ¶
func (*Context) SetFontFaceID ¶
func (*Context) SetFontSize ¶
func (*Context) SetGlobalAlpha ¶
func (*Context) SetLineCap ¶
func (*Context) SetLineJoin ¶
func (*Context) SetMiterLimit ¶
func (*Context) SetStrokeColor ¶
func (*Context) SetStrokePaint ¶
func (*Context) SetStrokeWidth ¶
func (*Context) SetTextAlign ¶
func (*Context) SetTextLetterSpacing ¶
func (*Context) SetTextLineHeight ¶
func (*Context) SetTransform ¶
func (c *Context) SetTransform(t nanovgo.TransformMatrix)
func (*Context) SetTransformByValue ¶
func (*Context) StrokeWidth ¶
func (*Context) TextBounds ¶
func (*Context) TextLetterSpacing ¶
func (*Context) TextLineHeight ¶
type Drop ¶
type Drop struct {
Paths []string
// contains filtered or unexported fields
}
Drag is an event of dragged and dropped into application file.
type EventPoint ¶
type EventPoint struct {
E interface{}
Pt geom.Point
T time.Time
Rs int
// contains filtered or unexported fields
}
func (EventPoint) String ¶
func (ev EventPoint) String() string
type EventTraceLast ¶
type EventTraceLast struct {
StartedAt time.Time // Time of a first matched event.
FirstTouch geom.Point
Duration time.Duration // Duration of match.
Freshness time.Duration // Difference between start of match and now.
Box geom.Rectangle // Total cursor position distribution of a match.
Choked bool
}
type Events ¶
type Events struct {
Trace []EventPoint
Last EventTraceLast
Now time.Time
Dt time.Duration
Viewport geom.Point
MatchCount int
RecordPath string
// contains filtered or unexported fields
}
func (*Events) MatchDeadline ¶
func (*Events) MatchFreshness ¶
func (*Events) MatchInDeadline ¶
func (*Events) MatchInDuration ¶
func (*Events) MatchInFreshness ¶
func (*Events) MatchInIndef ¶
func (*Events) MatchInNochoke ¶
func (*Events) MatchIndef ¶
func (*Events) SetDeadline ¶
type Font ¶
type Font struct {
Data []byte
Parsed *sfnt.Font
FreeTypeParsed *truetype.Font
Vgoid int
Name string
// contains filtered or unexported fields
}
Font is a multipurpose wrapper for a loaded to memory TrueType font.
func (*Font) MeasureReader ¶
func (font *Font) MeasureReader(cap float64, rd io.RuneScanner) float64
func (*Font) PureAdvance ¶
func (*Font) TrueXBearing ¶
type Matcher ¶
type Matcher struct {
// contains filtered or unexported fields
}
Matcher is a builder interface for regular expressions.
type NanovgoDestination ¶
func (*NanovgoDestination) AbsArcTo ¶
func (n *NanovgoDestination) AbsArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
func (*NanovgoDestination) AbsCubeTo ¶
func (n *NanovgoDestination) AbsCubeTo(x1, y1, x2, y2, x, y float32)
func (*NanovgoDestination) AbsHLineTo ¶
func (n *NanovgoDestination) AbsHLineTo(x float32)
func (*NanovgoDestination) AbsLineTo ¶
func (n *NanovgoDestination) AbsLineTo(x, y float32)
func (*NanovgoDestination) AbsQuadTo ¶
func (n *NanovgoDestination) AbsQuadTo(x1, y1, x, y float32)
func (*NanovgoDestination) AbsSmoothCubeTo ¶
func (n *NanovgoDestination) AbsSmoothCubeTo(x2, y2, x, y float32)
func (*NanovgoDestination) AbsSmoothQuadTo ¶
func (n *NanovgoDestination) AbsSmoothQuadTo(x, y float32)
func (*NanovgoDestination) AbsVLineTo ¶
func (n *NanovgoDestination) AbsVLineTo(y float32)
func (*NanovgoDestination) ClosePathAbsMoveTo ¶
func (n *NanovgoDestination) ClosePathAbsMoveTo(x, y float32)
func (*NanovgoDestination) ClosePathEndPath ¶
func (n *NanovgoDestination) ClosePathEndPath()
func (*NanovgoDestination) ClosePathRelMoveTo ¶
func (n *NanovgoDestination) ClosePathRelMoveTo(x, y float32)
func (*NanovgoDestination) RelArcTo ¶
func (n *NanovgoDestination) RelArcTo(rx, ry, xAxisRotation float32, largeArc, sweep bool, x, y float32)
func (*NanovgoDestination) RelCubeTo ¶
func (n *NanovgoDestination) RelCubeTo(x1, y1, x2, y2, x, y float32)
func (*NanovgoDestination) RelHLineTo ¶
func (n *NanovgoDestination) RelHLineTo(x float32)
func (*NanovgoDestination) RelLineTo ¶
func (n *NanovgoDestination) RelLineTo(x, y float32)
func (*NanovgoDestination) RelQuadTo ¶
func (n *NanovgoDestination) RelQuadTo(x1, y1, x, y float32)
func (*NanovgoDestination) RelSmoothCubeTo ¶
func (n *NanovgoDestination) RelSmoothCubeTo(x2, y2, x, y float32)
func (*NanovgoDestination) RelSmoothQuadTo ¶
func (n *NanovgoDestination) RelSmoothQuadTo(x, y float32)
func (*NanovgoDestination) RelVLineTo ¶
func (n *NanovgoDestination) RelVLineTo(y float32)
func (*NanovgoDestination) Reset ¶
func (n *NanovgoDestination) Reset(m iconvg.Metadata)
func (*NanovgoDestination) SetCReg ¶
func (n *NanovgoDestination) SetCReg(adj uint8, incr bool, c iconvg.Color)
func (*NanovgoDestination) SetCSel ¶
func (n *NanovgoDestination) SetCSel(cSel uint8)
func (*NanovgoDestination) SetLOD ¶
func (n *NanovgoDestination) SetLOD(lod0, lod1 float32)
func (*NanovgoDestination) SetNReg ¶
func (n *NanovgoDestination) SetNReg(adj uint8, incr bool, f float32)
func (*NanovgoDestination) SetNSel ¶
func (n *NanovgoDestination) SetNSel(nSel uint8)
func (*NanovgoDestination) StartPath ¶
func (n *NanovgoDestination) StartPath(adj uint8, x, y float32)
type Oscilloscope ¶
type Oscilloscope struct {
// contains filtered or unexported fields
}
type Press ¶
Press is a keyboard key press event, representing the key code with Rune.
Rune part is not matched in regular expressions.
type Release ¶
Release is a keyboard key release event, representing the key code with optional Rune if releasing emitted a text enter.
Rune part is not matched in regular expressions.
type RenderImage ¶
type RenderOp ¶
type RenderOp struct {
Tag op.Op
Args [10]float64
Iargs [10]int
Fontsiz float64
Hfont int
Himage int
Lsp float64
Fblur float64
Strokep nanovgo.Paint
Strokec nanovgo.Color
Fillp nanovgo.Paint
Fillc nanovgo.Color
Strokew float64
Linecap nanovgo.LineCap
nanovgo.Direction
nanovgo.Winding
nanovgo.Align
nanovgo.TransformMatrix
nanovgo.GlyphPosition
Runes []rune
Left, Right int
}
type Renderer ¶
type Renderer interface {
Run(c *Context)
}
Renderer is an object that takes a context and interprets every graphics operation in it to obtain some graphical output. Typically, Renderer is called with the periodicity of the screen refresh.
type Scroll ¶
type Scroll int
Scroll is a vertical mouse scroll event. Positive values represent scrolling up, negative — scrolling down.
type Segment ¶
type Segment struct {
// Op is the operator.
// 'M' — move, one coordinate
// 'L' — line, one coordinate
// 'Q' — quadratic bezier, two coordinates
// 'C' — cubic bezier, three coordinates
Op byte
// Args is up to three (x, y) coordinates. The Y axis increases down.
Args [3]geom.Point
}
Segment is a segment of a vector path. It is based on golang.org/x/image/font/sfnt.Segment.
func (Segment) LastComponent ¶
type Sequence ¶
Sequence is the thing that can generate elements for a compound.
func SliceSequence ¶
type Sorm ¶
type Sorm struct {
Size point
// contains filtered or unexported fields
}
func (*Sorm) CondFillStroke ¶
func (*Sorm) CondStroke ¶
func (*Sorm) Strokewidth ¶
type Sweep ¶
type Sweep int
Sweep is a horizontal mouse scroll event. Negative values represent scrolling left, positive — scrolling right.
type Unclick ¶
type Unclick int
Unclick is a mouse button release event, representing a button number.
type Windower ¶
type Windower interface {
SetupInputCallbacks(emit func(ev any, pt geom.Point, t time.Time), u *Events)
PollEvents(u *Events)
WaitEvents(u *Events)
Next(u *Events) (ok bool, w, h int, scale float64)
Develop(u *Events)
}
Windower is an object that enables Contraption to communicate with the operating system. Windower receives input events and manages the window state.
Windower does not handle screen refresh blocking, it must be handled by the Renderer.
type World ¶
type World struct {
*Events
Vgo *Context
Wwin, Hwin float64
BeforeVgo func()
// contains filtered or unexported fields
}
func (*World) BaseWorld ¶
BaseWorld returns itself. This method allows to access base World class from user worlds.
func (*World) Between ¶
Between adds a Sorm from given constructor between every other shape in a compound.
func (*World) BetweenVoid ¶
func (wo *World) BetweenVoid(w, h complex128) (s *Sorm)
BetweenVoid adds a Void between every other shape of a compound.
func (*World) Canvas ¶
func (wo *World) Canvas(w, h complex128, run func(vgo *Context, wt geom.Geom, rect geom.Rectangle)) (s *Sorm)
Canvas gives a direct access to Nanovgo for painting a vector image.
func (*World) Cat ¶
Cat returns a Compound from two Sorm sources. Its intended usage is for defining user's own abstractions.
func (*World) Compound ¶
Compound is a shape container. It combines multiple Sorms into a single shape. Every other container is just a rebranded Compound.
func (*World) CondStroke ¶
func (*World) Develop ¶
Develop applies the layout and renders the next frame. See package description for preferred use of Contraption.
func (*World) Halign ¶
Halign aligns elements horizontally.
If amt == 0, elements are aligned to the left, if 0.5 to the middle and if 1 to the right. Values between those are acceptable.
amt is clipped to the range 0 < amt < 1.
func (*World) Hshrink ¶
Hshrink shrinks the horizontal size of a stretchy compound to the size of the children with the maximum known horizontal size.
func (*World) Identity ¶
Identity gives a compound the key on which it can be retrieved from the layout tree on the next event loop cycle.
func (*World) Illustration ¶
Illustration is a static, unchangeable image. Src is decoded by image.Decoder. You must register codecs for every type of image you want to use with this shape.
If w or h are zero, the corresponding axis of the resulting shape will be sized as the original picture.
Negative sizes will result in a stretched image, whose size is fully controlled by the parent compound.
mode is determining how the image will be resized if the proportions of the parent compound and the proportions of the image are different.
Available modes are
- "stretch": the image will be stretched without preserving proportions.
- "zoom": the smallest dimension of the image will be resized to the largest available dimension.
- "pad": the smallest dimension of the image will be resized to the smallest available dimension.
The image won't be cropped in any of those cases. Use Scissor in the parent compound to limit the size of an image.
The texture from the image may be interpolated to a smaller size. Deallocation of the texture is the subject to the two-frame policy like any other resource in Contraption.
func (*World) Key ¶
Key is a temporary key-value storage for on-screen state. The value is deleted if it had been not accessed for two frames.
func (*World) Limit ¶
Limit limits the maximum compound size to specified limits. If a given size is negative, it limits the corresponding size of a compound by the rules of negative units for shapes.
TODO Imaginary limits.
func (*World) NewBottomUpText ¶
func (*World) NewTopDownText ¶
func (*World) NewVectorText ¶
func (*World) NewVectorTextReader ¶
TODO This is the main and preferred method to do vector text. TODO Pool of (Runes)
func (*World) Next ¶
Next prepares the Contraption for rendering the next frame. See package description for preferred use of Contraption.
func (*World) Posttransform ¶
Posttransform applies transformation that only affects objects visually. It doesn't affect object sizes for layout.
func (*World) Rectangle ¶
func (wo *World) Rectangle(w, h complex128) (s *Sorm)
Rectangle is a rectangle shape.
func (*World) ResetDrags ¶
func (wo *World) ResetDrags()
func (*World) Roundrect ¶
func (wo *World) Roundrect(w, h complex128, r float64) (s *Sorm)
Roundrect is a rounded rectangle shape.
func (*World) Run ¶
func (wo *World) Run(onevent func())
Run runs the world, calling the onevent function on every event.
func (*World) Sequence ¶
Sequence transforms external data to stream of shapes.
Modifiers in Sequence right now are ignored, but can trigger a panic in future versions.
func (*World) Sink ¶
Sink marks area of current compound as a drag sink. When program receives Release(1) event with mouse cursor inside a sink, it calls given function with the drag value.
func (*World) Source ¶
Source marks area of current compound as a drag source. It uses compound's identity (set with Identity modifier) as a drag value.
func (*World) Strokewidth ¶
Strokewidth sets the stroke width.
func (*World) Valign ¶
Valign aligns elements vertically. If amt == 0, elements are aligned to the top, if 0.5 to the center and if 1 to the bottom. Values between those are acceptable.
amt is clipped to the range 0 < amt < 1.
func (*World) Void ¶
func (wo *World) Void(w, h complex128) (s *Sorm)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
backends
|
|
|
examples
|
|
|
pdview
command
|
|
|
keymap
module
|
|
|
sink
module
|
|
|
fontstashmini/truetype
This library processes TrueType files:
|
This library processes TrueType files: |