ops

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT, Unlicense Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 + 1
	TypePaintLen            = 1
	TypeColorLen            = 1 + 4
	TypeLinearGradientLen   = 1 + 8*2 + 4*2
	TypePassLen             = 1
	TypePopPassLen          = 1
	TypeInputLen            = 1
	TypeKeyInputHintLen     = 1 + 1
	TypeSaveLen             = 1 + 4
	TypeLoadLen             = 1 + 4
	TypeAuxLen              = 1
	TypeClipLen             = 1 + 4*4 + 1 + 1
	TypePopClipLen          = 1
	TypeCursorLen           = 2
	TypePathLen             = 8 + 1
	TypeStrokeLen           = 1 + 4
	TypeSemanticLabelLen    = 1
	TypeSemanticDescLen     = 1
	TypeSemanticClassLen    = 2
	TypeSemanticSelectedLen = 2
	TypeSemanticEnabledLen  = 2
	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 DataLen added in v1.1.0

func DataLen(o *Ops) int

DataLen returns the number of operation bytes currently buffered in o. Useful for callers that need to monitor growth of long-lived op.Ops (e.g. a text shaper's path buffer) and recycle them when they cross a memory threshold.

func DecodeCommand

func DecodeCommand(d []byte) scene.Command

func DecodeLoad

func DecodeLoad(data []byte) int

func DecodeOpacity

func DecodeOpacity(data []byte) float32

func DecodeSave

func DecodeSave(data []byte) int

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 uint32)

func Reserve added in v1.4.0

func Reserve(o *Ops, n int)

Reserve ensures o can hold at least n more bytes of op data without reallocating. Callers that know the approximate encoded size ahead of time (e.g. glyph path builders) avoid the doubling-growth garbage of writing into a fresh buffer.

func Reset

func Reset(o *Ops)

func Write

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

func Write1

func Write1(o *Ops, n int, ref1 any) []byte

func Write1String

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

func Write2

func Write2(o *Ops, n int, ref1, ref2 any) []byte

func Write2String

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

func Write3

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

func WriteMulti

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

Types

type ClipOp

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

func (*ClipOp) Decode

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

type EncodedOp

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

type Key

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

type OpType

type OpType byte
const (
	TypeMacro OpType = iota + firstOpIndex
	TypeCall
	TypeDefer
	TypeTransform
	TypePopTransform
	TypePushOpacity
	TypePopOpacity
	TypeImage
	TypePaint
	TypeColor
	TypeLinearGradient
	TypePass
	TypePopPass
	TypeInput
	TypeKeyInputHint
	TypeSave
	TypeLoad
	TypeAux
	TypeClip
	TypePopClip
	TypeCursor
	TypePath
	TypeStroke
	TypeSemanticLabel
	TypeSemanticDesc
	TypeSemanticClass
	TypeSemanticSelected
	TypeSemanticEnabled
	TypeActionInput
)

func (OpType) NumRefs

func (t OpType) NumRefs() uint32

func (OpType) Size

func (t OpType) Size() uint32

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
}

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
}

func (*Reader) Decode

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

func (*Reader) Reset

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

func (*Reader) ResetAt

func (r *Reader) ResetAt(ops *Ops, pc 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, uint32)

type StackKind

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

type StateOp

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

func Save

func Save(o *Ops) StateOp

func (StateOp) Load

func (s StateOp) Load()

Jump to

Keyboard shortcuts

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