ops

package
Version: v0.0.0-...-e5d8a4b Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT, Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeMacroLen           = 1 + 4 + 4
	TypeCallLen            = 1 + 4 + 4
	TypeDeferLen           = 1
	TypePushTransformLen   = 1 + 4*6
	TypeTransformLen       = 1 + 1 + 4*6
	TypePopTransformLen    = 1
	TypeRedrawLen          = 1 + 8
	TypeImageLen           = 1
	TypePaintLen           = 1
	TypeColorLen           = 1 + 4
	TypeLinearGradientLen  = 1 + 8*2 + 4*2
	TypeAreaLen            = 1 + 1 + 4*4
	TypePopAreaLen         = 1
	TypePassLen            = 1
	TypePopPassLen         = 1
	TypePointerInputLen    = 1 + 1 + 1 + 2*4 + 2*4
	TypeClipboardReadLen   = 1
	TypeClipboardWriteLen  = 1
	TypeKeyInputLen        = 1 + 1
	TypeKeyFocusLen        = 1 + 1
	TypeKeySoftKeyboardLen = 1 + 1
	TypeSaveLen            = 1 + 4
	TypeLoadLen            = 1 + 4
	TypeAuxLen             = 1
	TypeClipLen            = 1 + 4*4 + 1 + 1
	TypePopClipLen         = 1
	TypeProfileLen         = 1
	TypeCursorLen          = 1 + 1
	TypePathLen            = 8 + 1
	TypeStrokeLen          = 1 + 4
)

Variables

This section is empty.

Functions

func AddCall

func AddCall(o *Ops, callOps *Ops, pc PC)

func DecodeCommand

func DecodeCommand(d []byte) scene.Command

func DecodeLoad

func DecodeLoad(data []byte) int

DecodeLoad decodes the state id of a load op.

func DecodeSave

func DecodeSave(data []byte) int

DecodeSave decodes the state id of a save op.

func DecodeTransform

func DecodeTransform(data []byte) (t f32.Affine2D, push bool)

func EncodeCommand

func EncodeCommand(out []byte, cmd scene.Command)

func FillMacro

func FillMacro(o *Ops, startPC PC)

func PopMacro

func PopMacro(o *Ops, id StackID)

func PopOp

func PopOp(o *Ops, kind StackKind, sid StackID, macroID int)

func Reset

func Reset(o *Ops)

func Write

func Write(o *Ops, n int) []byte

func Write1

func Write1(o *Ops, n int, ref1 interface{}) []byte

func Write2

func Write2(o *Ops, n int, ref1, ref2 interface{}) []byte

Types

type EncodedOp

type EncodedOp struct {
	Key  Key
	Data []byte
	Refs []interface{}
}

EncodedOp represents an encoded op returned by Reader.

type Key

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

Key is a unique key for a given op.

type OpType

type OpType byte
const (
	TypeMacro OpType = iota + firstOpIndex
	TypeCall
	TypeDefer
	TypePushTransform
	TypeTransform
	TypePopTransform
	TypeInvalidate
	TypeImage
	TypePaint
	TypeColor
	TypeLinearGradient
	TypeArea
	TypePopArea
	TypePass
	TypePopPass
	TypePointerInput
	TypeClipboardRead
	TypeClipboardWrite
	TypeKeyInput
	TypeKeyFocus
	TypeKeySoftKeyboard
	TypeSave
	TypeLoad
	TypeAux
	TypeClip
	TypePopClip
	TypeProfile
	TypeCursor
	TypePath
	TypeStroke
)

func (OpType) NumRefs

func (t OpType) NumRefs() int

func (OpType) Size

func (t OpType) Size() int

func (OpType) String

func (t OpType) String() string

type Ops

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

type PC

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

PC is an instruction counter for an operation list.

func PCFor

func PCFor(o *Ops) PC

type Reader

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

Reader parses an ops list.

func (*Reader) Decode

func (r *Reader) Decode() (EncodedOp, bool)

func (*Reader) Reset

func (r *Reader) Reset(ops *Ops)

Reset start reading from the beginning of ops.

func (*Reader) ResetAt

func (r *Reader) ResetAt(ops *Ops, pc PC)

ResetAt is like Reset, except it starts reading from pc.

type StackID

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

func PushMacro

func PushMacro(o *Ops) StackID

func PushOp

func PushOp(o *Ops, kind StackKind) (StackID, int)

type StackKind

type StackKind uint8
const (
	ClipStack StackKind = iota
	AreaStack
	TransStack
	PassStack
)

type StateOP

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

StateOp represents a saved operation snapshop to be restored later.

func Save

func Save(o *Ops) StateOP

Save the effective transformation.

func (StateOP) Load

func (s StateOP) Load()

load a previously saved operations state given its ID.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL