Documentation ¶
Index ¶
- Variables
- func Ellipse(dst draw.Image, c image.Point, src image.Image, a, b, thick int, ...)
- func ParseDefaultFont(size float64) font.Face
- func Xor(r0, r1 image.Rectangle) (image.Rectangle, error)
- type Action
- type Box
- type Boxes
- func (b *Boxes) Add(n int)
- func (b *Boxes) Chop(bn, n int)
- func (b *Boxes) Delete(n0, n1 int)
- func (b *Boxes) Dump()
- func (b *Boxes) Dup(n int) *Box
- func (b *Boxes) Find(n, i, j int) (int, error)
- func (b *Boxes) Insert(p []byte, off int)
- func (b *Boxes) Merge(n int)
- func (b *Boxes) ReadAt(p []byte, off int64) (n int, err error)
- func (b *Boxes) Split(n int, at int)
- func (b *Boxes) Truncate(bn, n int)
- func (b *Boxes) WriteAt(p []byte, off int64) (n int, err error)
- type Cache
- type Chord
- type Click
- type ClickEvent
- type Colors
- type CommitEvent
- type Direction
- type Dot
- type Drawer
- type Font
- type Frame
- func (f *Frame) Bounds() (r image.Rectangle)
- func (f *Frame) Box(bn int) *Box
- func (f *Frame) Boxes() []*Box
- func (f *Frame) Bytes() []byte
- func (f *Frame) CleanRange()
- func (f *Frame) Delete(i, j int) (err error)
- func (f *Frame) Dirty() bool
- func (f *Frame) DirtyRange() []Range
- func (f *Frame) Draw(force bool)
- func (f *Frame) Handle(e interface{})
- func (f *Frame) Image() draw.Image
- func (f *Frame) IndexOf(pt image.Point) (bn, offset int)
- func (f *Frame) Insert(s []byte, i int) (err error)
- func (f *Frame) Mark()
- func (f *Frame) MarkRange(i, j int)
- func (f *Frame) Origin() image.Point
- func (f *Frame) PointOf(x int) (pt image.Point)
- func (f *Frame) RGBA() *image.RGBA
- func (f *Frame) Redraw(selecting bool)
- func (f *Frame) RedrawBox(i, j int)
- func (f *Frame) RedrawBytes(origin image.Point, width int, s []byte)
- func (f *Frame) RedrawRange(i, j int)
- func (f *Frame) Release()
- func (f *Frame) Resize(size image.Point)
- func (f *Frame) Size() image.Point
- type Handler
- type InsertEvent
- type Item
- type Machine
- type MarkEvent
- type Menu
- type MenuEvent
- type Mouse
- type Opt
- type Option
- type Range
- type Resolver
- type Sc
- func (s *Sc) Bounds() image.Rectangle
- func (s *Sc) Clicksb(pt image.Point, dir Direction)
- func (s *Sc) Dirty() bool
- func (s *Sc) Draw()
- func (s *Sc) EmbedBounds() image.Rectangle
- func (s *Sc) Handle(e interface{})
- func (s *Sc) Project(x, y float32) (float32, float32)
- func (s *Sc) RGBA() *image.RGBA
- func (s *Sc) Release()
- func (s *Sc) Size() image.Point
- type Scroller
- type Select
- func (s Select) Addr() (i, j int)
- func (s *Select) Clear()
- func (s *Select) Close()
- func (s *Select) DeltaRects() (r []image.Rectangle)
- func (s *Select) Draw(p, q image.Point, bg image.Image)
- func (s Select) Ep() image.Point
- func (s *Select) Open(i int)
- func (s *Select) Rects() (r []image.Rectangle)
- func (s *Select) Resize(size image.Point)
- func (s *Select) Seek(offset int64, whence int) (int64, error)
- func (s Select) Sp() image.Point
- func (s *Select) Sweep(j int)
- func (s *Select) Update(j int)
- type SelectEvent
- type Sender
- type SnarfEvent
- type State
- type StateFn
- type SweepEvent
- type Tick
- func (t *Tick) Cancel()
- func (t *Tick) Close() error
- func (t *Tick) Commit()
- func (t *Tick) Delete() (err error)
- func (t *Tick) Draw() error
- func (t *Tick) Find(p []byte, back bool) int
- func (t *Tick) FindAlpha(i int) (int, int)
- func (t *Tick) FindOrEOF(p []byte) int
- func (t *Tick) FindParity() int
- func (t *Tick) FindQuote() int
- func (t *Tick) FindSpecial(i int) (int, int)
- func (t *Tick) In(pt image.Point) bool
- func (t *Tick) Insert(p []byte) (err error)
- func (t *Tick) Next()
- func (t *Tick) Open(i int)
- func (t *Tick) Read(p []byte) (n int, err error)
- func (t *Tick) ReadByte() byte
- func (t *Tick) Rects() (r []image.Rectangle)
- func (t *Tick) Resize(size image.Point)
- func (t *Tick) Seek(offset int64, whence int) (int64, error)
- func (t *Tick) Selected() bool
- func (t *Tick) Size() int
- func (t *Tick) String() string
- func (t *Tick) Sweep(i int)
- func (t *Tick) Write(p []byte) (n int, err error)
- func (t *Tick) WriteRune(r rune) (err error)
Constants ¶
This section is empty.
Variables ¶
var ( AcmeColors = &Colors{ Back: image.NewUniform(color.RGBA{0, 0, 0, 0}), Text: image.NewUniform(color.RGBA{255, 0, 0, 255}), HText: image.NewUniform(color.RGBA{0, 0, 0, 255}), HBack: image.NewUniform(color.RGBA{255, 0, 0, 128}), } DefaultColors = defaultColors DarkGrayColors = &Colors{ Back: image.NewUniform(color.RGBA{33, 33, 33, 4}), Text: image.NewUniform(color.RGBA{0, 128 + 64, 128 + 64, 255}), HText: image.NewUniform(color.RGBA{0, 0, 0, 255}), HBack: image.NewUniform(color.RGBA{0, 128, 128, 64}), } GrayColors = &Colors{ Back: image.NewUniform(color.RGBA{48, 48, 48, 0}), Text: image.NewUniform(color.RGBA{99, 99, 99, 255}), HText: image.NewUniform(color.RGBA{0, 0, 0, 255}), HBack: image.NewUniform(color.RGBA{0, 128, 128, 64}), } )
var AlphaNum = []byte("*&!%-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
var Clip []byte
var DefaultOpt = Opt{ Inset: -2, Width: 100, Height: 33, FGColor: image.NewUniform(color.RGBA{44, 44, 44, 0}), BGColor: image.NewUniform(color.RGBA{22, 22, 22, 0}), BGColor2: image.NewUniform(color.RGBA{33, 33, 33, 0}), BRColor: image.NewUniform(color.RGBA{22, 22, 22, 0}), }
var Free = [...]byte{'"', '\'', '`'}
var HintColor = image.NewUniform(color.RGBA{255, 0, 0, 255})
var Lefts = [...]byte{'(', '{', '[', '<', '"', '\'', '`'}
var MenuColor = image.NewUniform(color.RGBA{128, 128, 128, 255})
var NL = []byte{'\n'}
var Rights = [...]byte{')', '}', ']', '>', '"', '\'', '`'}
Functions ¶
func Ellipse ¶
func Ellipse(dst draw.Image, c image.Point, src image.Image, a, b, thick int, sp image.Point, alpha, phi int)
Ellipse draws a filled ellipse at center point c and eccentricity a and b. The thick argument is ignored (until a line drawing function is available)
The method uses an efficient integer-based rasterization technique originally described in:
McIlroy, M.D.: There is no royal road to programs: a trilogy on raster ellipses and programming methodology, Computer Science TR155, AT&T Bell Laboratories, 1990
func ParseDefaultFont ¶
Types ¶
type Boxes ¶
type Boxes struct { Box []*Box // contains filtered or unexported fields }
func (*Boxes) Find ¶
Find starts at box n, assuming offset i, and advances to offset j. It returns the box number containing offset j, guaraneed to align on a box boundary.
type CommitEvent ¶
type Dot ¶
type Frame ¶
type Frame struct { Option Tick *Tick Cache Cache Menu *Menu Mouse *Mouse // contains filtered or unexported fields }
func New ¶
New initializes a new frame on disp. The first glyph of text is inserted at point p. If opt is nil, the default color, wrapping, and font settings are used.
func (*Frame) CleanRange ¶
func (f *Frame) CleanRange()
func (*Frame) DirtyRange ¶
func (*Frame) Handle ¶
func (f *Frame) Handle(e interface{})
Handle handles events sent to the frame. The key.Event and mouse.Events are handled.
func (*Frame) Redraw ¶
Redraw redraws the entire frame. The caller should check that the frame is Dirty before calling this in a tight loop
func (*Frame) RedrawRange ¶
type InsertEvent ¶
type Machine ¶
type Machine struct { Sink chan mouse.Event // Should only send events, no recieving. Sender // contains filtered or unexported fields }
Machine is the conduit that state transitions happen though. It contains a Skink chan for input mouse events that drive the StateFns
func NewMachine ¶
NewMachine initialize a new state machine with no-op functions for all chording events.
type Mouse ¶
type Mouse struct { Chord Chord Last []Click Down mouse.Button At image.Point *Machine // contains filtered or unexported fields }
type Option ¶
type Option struct { // Font is the font face for the frame *Font // Number of glyphs drawn on one line before wrapping Wrap int // Colors define the text and background colors for the rame // Text: glyph color // Back: background color // HText: highlighted glyph color // HBack: highlighted background color Colors Colors // contains filtered or unexported fields }
func (Option) FontHeight ¶
type Sc ¶
type Sc struct { Bar image.Rectangle BarColor, FrameColor image.Image // contains filtered or unexported fields }
func (*Sc) EmbedBounds ¶
type Select ¶
type Select struct { Img *image.RGBA // todo: use New Color image.Image // avoid redrawing the entire selection on the // canvas by caching the three rectangles representing // the selection R [3]image.Rectangle // contains filtered or unexported fields }
Select consists of 3 rectangles
func (*Select) DeltaRects ¶
type SelectEvent ¶
type SnarfEvent ¶
type StateFn ¶
StateFn is a state function that expresses a state transition. All StateFns return the next state as a transitionary StateFn