contentstream

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context interface{ Done() <-chan struct{} }

type ExecutionContext

type ExecutionContext struct {
	GraphicsState *GraphicsState
	TextState     *TextState
	Resources     *semantic.Resources
}

type GraphicsState

type GraphicsState struct {
	CTM       coords.Matrix
	LineWidth float64
	// contains filtered or unexported fields
}

func (*GraphicsState) Restore

func (gs *GraphicsState) Restore() error

func (*GraphicsState) Save

func (gs *GraphicsState) Save()

type LineCap

type LineCap int

LineCap represents the line cap style (J operator).

const (
	LineCapButt LineCap = iota
	LineCapRound
	LineCapSquare
)

type LineJoin

type LineJoin int

LineJoin represents the line join style (j operator).

const (
	LineJoinMiter LineJoin = iota
	LineJoinRound
	LineJoinBevel
)

type OpBBox

type OpBBox struct {
	OpIndex int
	Rect    semantic.Rectangle
}

OpBBox represents the bounding box of an operation.

type OperatorHandler

type OperatorHandler interface {
	Handle(ctx *ExecutionContext, operands []semantic.Operand) error
}

type Path

type Path struct {
	Subpaths []Subpath
}

Path describes a graphics path made of subpaths.

type PathPoint

type PathPoint struct {
	X, Y                 float64
	Type                 PathPointType
	Control1X, Control1Y float64
	Control2X, Control2Y float64
}

PathPoint identifies a path segment and its coordinates.

type PathPointType

type PathPointType int

PathPointType enumerates path segment types.

const (
	PathMoveTo PathPointType = iota
	PathLineTo
	PathCurveTo
	PathClose
)

type Processor

type Processor interface {
	Process(ctx Context, stream []byte, state *GraphicsState) error
	RegisterHandler(op string, h OperatorHandler)
}

func NewProcessor

func NewProcessor() Processor

type Subpath

type Subpath struct {
	Points []PathPoint
	Closed bool
}

Subpath describes a portion of a path.

type TextRenderMode

type TextRenderMode int

TextRenderMode matches PDF text rendering modes set via Tr operator.

const (
	TextFill TextRenderMode = iota
	TextStroke
	TextFillStroke
	TextInvisible
	TextFillClip
	TextStrokeClip
	TextFillStrokeClip
	TextClip
)

type TextState

type TextState struct {
	Font           *semantic.Font
	FontSize       float64
	TextMatrix     coords.Matrix
	TextLineMatrix coords.Matrix
}

type Tracer

type Tracer struct {
}

Tracer calculates the bounding boxes of operations in a content stream.

func NewTracer

func NewTracer() *Tracer

func (*Tracer) Trace

func (t *Tracer) Trace(ops []semantic.Operation, resources *semantic.Resources) ([]OpBBox, error)

Trace executes the operations virtually and returns their bounding boxes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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