Skip to main content

Module vector

Module vector 

Source
Expand description

Vector graphics frame and primitive types.

This module models a resolution-independent, scene-graph-style vector frame so the same VectorFrame can round-trip through both SVG 1.1 and PDF 1.4 without lossy conversion. The primitive set is the intersection of what those two formats represent natively:

  • paths built from move / line / quadratic / cubic / elliptic-arc / close commands,
  • solid + linear-gradient + radial-gradient paints,
  • stroke style (width, cap, join, miter limit, dash),
  • even-odd / non-zero fill rules,
  • 2D affine transforms,
  • group nodes (transform, opacity, optional clip),
  • embedded raster passthrough via ImageRef (carries a child VideoFrame — the rasterizer paints the image into vector space).

Text nodes are intentionally deferred to round 2 — text needs font handling and tight scribe coupling that will land alongside the oxideav-svg parser (#349). Round 1 is shape-only.

No rasterizer / SVG parser / PDF writer lives in oxideav-core; those are downstream tasks (#349 / #350 / #351). This module ships only the data types every consumer of the vector pipeline needs to agree on.

Structs§

DashPattern
Dash pattern for a stroke. array is an alternating dash-on / dash-off length list (in user units); offset is the phase offset from the path start.
GradientStop
One color stop along a gradient. offset is in 0.0..=1.0.
Group
A grouping node — applies a transform / opacity / optional clip path to all descendants. Mirrors SVG <g> and PDF q ... Q graphic-state blocks.
ImageRef
An embedded raster image painted into vector space.
LinearGradient
A linear gradient: color stops sweep along the line startend.
Path
A geometric path expressed as a sequence of drawing commands.
PathNode
A drawn path with optional fill and stroke.
Point
2D point in user-space coordinates.
RadialGradient
A radial gradient: color stops sweep from focal outward to a circle of radius radius centered on center. When focal is None, it defaults to center (the common case).
Rect
Axis-aligned rectangle in user-space coordinates.
Rgba
32-bit straight (non-premultiplied) RGBA color.
Stroke
Stroke style for a path’s outline.
Transform2D
A 2D affine transform stored as the column-major matrix
VectorFrame
A decoded vector-graphics frame.
ViewBox
User-coordinate system rectangle. Mirrors the SVG viewBox attribute and the PDF MediaBox / CropBox rectangles.

Enums§

FillRule
Fill rule for self-intersecting and compound paths. Matches SVG’s fill-rule attribute and PDF’s f (non-zero) vs. f* (even-odd) painting operators.
LineCap
How an open path’s endpoints are drawn.
LineJoin
How two stroke segments meet at a corner.
MaskKind
How to interpret a soft mask’s rasterised pixels as a coverage modulator.
Node
One node in the scene tree.
Paint
A paint server — what fills the inside of a path or strokes its outline. The variant set is the SVG/PDF intersection.
PathCommand
A single path-construction command.
SpreadMethod
What happens past the gradient endpoints. Mirrors SVG spreadMethod="pad|reflect|repeat" and PDF gradient Extend arrays.