ops

package
v0.0.0-...-a9b3df6 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT, Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeMacroLen            = 1 + 4 + 4
	TypeCallLen             = 1 + 4 + 4 + 4 + 4
	TypeDeferLen            = 1
	TypeTransformLen        = 1 + 1 + 4*6
	TypePopTransformLen     = 1
	TypePushOpacityLen      = 1 + 4
	TypePopOpacityLen       = 1
	TypeRedrawLen           = 1 + 8
	TypeImageLen            = 1
	TypePaintLen            = 1
	TypeColorLen            = 1 + 4
	TypeLinearGradientLen   = 1 + 8*2 + 4*2
	TypePassLen             = 1
	TypePopPassLen          = 1
	TypePointerInputLen     = 1 + 1 + 1*2 + 2*4 + 2*4
	TypeClipboardReadLen    = 1
	TypeClipboardWriteLen   = 1
	TypeSourceLen           = 1
	TypeTargetLen           = 1
	TypeOfferLen            = 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           = 2
	TypePathLen             = 8 + 1
	TypeStrokeLen           = 1 + 4
	TypeSemanticLabelLen    = 1
	TypeSemanticDescLen     = 1
	TypeSemanticClassLen    = 2
	TypeSemanticSelectedLen = 2
	TypeSemanticEnabledLen  = 2
	TypeSnippetLen          = 1 + 4 + 4
	TypeSelectionLen        = 1 + 2*4 + 2*4 + 4 + 4
	TypeActionInputLen      = 1 + 1
)

Variables

This section is empty.

Functions

func AddCall

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

func BeginMulti

func BeginMulti(o *Ops)

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 DecodeOpacity

func DecodeOpacity(data []byte) float32

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 EndMulti

func EndMulti(o *Ops)

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 Write1String

func Write1String(o *Ops, n int, ref1 string) []byte

func Write2

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

func Write2String

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

func Write3

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

func WriteMulti

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

Types

type ClipOp

type ClipOp struct {
	Bounds  image.Rectangle
	Outline bool
	Shape   Shape
}

ClipOp is the shadow of clip.Op.

func (*ClipOp) Decode

func (op *ClipOp) Decode(data []byte)

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
	TypeTransform
	TypePopTransform
	TypePushOpacity
	TypePopOpacity
	TypeInvalidate
	TypeImage
	TypePaint
	TypeColor
	TypeLinearGradient
	TypePass
	TypePopPass
	TypePointerInput
	TypeClipboardRead
	TypeClipboardWrite
	TypeSource
	TypeTarget
	TypeOffer
	TypeKeyInput
	TypeKeyFocus
	TypeKeySoftKeyboard
	TypeSave
	TypeLoad
	TypeAux
	TypeClip
	TypePopClip
	TypeProfile
	TypeCursor
	TypePath
	TypeStroke
	TypeSemanticLabel
	TypeSemanticDesc
	TypeSemanticClass
	TypeSemanticSelected
	TypeSemanticEnabled
	TypeSnippet
	TypeSelection
	TypeActionInput
)

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

func (PC) Add

func (pc PC) Add(op OpType) 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 Shape

type Shape byte
const (
	Path Shape = iota
	Ellipse
	Rect
)

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
	TransStack
	PassStack
	OpacityStack
)

type StateOp

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

StateOp represents a saved operation snapshot 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.

Jump to

Keyboard shortcuts

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