<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: -",
    "macOS: 15.4.0 -",
    "tvOS: 18.4.0 -",
    "visionOS: 2.4.0 -",
    "watchOS: 11.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "hvf",
  "identifier" : "/documentation/hvf/ShapeWriter",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "hvf"
    ],
    "preciseIdentifier" : "s:3hvf11ShapeWriterP"
  },
  "title" : "ShapeWriter"
}
-->

# ShapeWriter

A protocol for creating a Shape part for rendering or to build an HVGL table

```
protocol ShapeWriter
```

## Topics

### Instance Properties

[`var axisCount: Int`](/documentation/hvf/ShapeWriter/axisCount)

The number of axes

[`var blendTypes: [SegmentBlendType]`](/documentation/hvf/ShapeWriter/blendTypes)

The blend type of each segment, in path order

[`var denseDeltaMatrix: [Double]`](/documentation/hvf/ShapeWriter/denseDeltaMatrix)

A dense matrix of segment delta values for extrema, in column order.
The columns correspond to the axis extrema, with minimum first, then maximum

[`var masterVector: [Double]`](/documentation/hvf/ShapeWriter/masterVector)

The master point segments, in path order. Each segment is in the order:
Curve: parallel factor, zero, off X, off Y
Not curve: on X, on Y, off X, off Y

[`var pathSizes: [UInt16]`](/documentation/hvf/ShapeWriter/pathSizes)

The number of segments in each path; must sum to totalSegmentCount

[`var totalSegmentCount: Int`](/documentation/hvf/ShapeWriter/totalSegmentCount)

The total number of segments (on/off pairs) in all paths

### Instance Methods

[`func denseDeltaOffset(axis: Int, extremum: AxisExtremum, segment: Int, point: SegmentPoint, coordinate: PointCoordinate) -> Int`](/documentation/hvf/ShapeWriter/denseDeltaOffset(axis:extremum:segment:point:coordinate:))

The offset of a coordinate in the denseDeltaMatrix
This function uses totalSegmentCount, which must be set correctly before calling

[`func finalize() -> Bool`](/documentation/hvf/ShapeWriter/finalize())

Call when done writing the Shape

[`func masterOffset(segment: Int, point: SegmentPoint, coordinate: PointCoordinate) -> Int`](/documentation/hvf/ShapeWriter/masterOffset(segment:point:coordinate:))

The offset of a coordinate in the masterVector

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)