Skip to main content

Module vector

Module vector 

Source
Expand description

Vector data (VectorObjectList.VectorData, an external chunk).

Vector layers store no pixels; CSP draws them from this data when it opens the file. Big endian (spec: docs/spec/05-vector.md):

u32 0, u32 length of the objects
object × n:
  header (header_size bytes)
    +0  u32 header_size (76, 88, 92, 96) +4  u32 72
    +8  u32 point_size (88, 104)       +12 u32 88
    +16 u32 point_count                +20 u32 flags
    +24 i32 bbox x0, y0, x1, y1 (layer pixels)
    +40 u32 main colour R, G, B        +52 u32 sub colour R, G, B
    +64 f64 opacity (1.0)
    +72 …  brush style ids (u32 × 1–3), the brush size (f64), u32
  point × point_count (point_size bytes)
    +0 f64 x  +8 f64 y  +16 i32 bbox x0, y0, x1, y1  +32 u32 flags
    +36 … f32 values (pressure, width ratio, …), +88 f64 x, y (104-byte points)

Coordinates are layer pixels; add LayerOffsetX/Y for the canvas. The parser keeps every byte, so unknown fields are written back unchanged.

Structs§

Point
Typed view of one point.
VectorData
All objects of one VectorData payload.
VectorObject
One stroke or shape. header and every point keep their raw bytes.

Constants§

FLAG_CLOSED
Header flag (+20) of a closed shape.