writePath method

int writePath(
  1. VectorGraphicsBuffer buffer,
  2. Uint8List controlTypes,
  3. Float32List controlPoints,
  4. int fillType,
)

Write a new path to the buffer, returing the identifier assigned to it.

The fillType argument is either 1 for a fill or 0 for a stroke.

controlTypes is a buffer of the types of control points in order. controlPoints is a buffer of the control points in order.

Implementation

int writePath(
  VectorGraphicsBuffer buffer,
  Uint8List controlTypes,
  Float32List controlPoints,
  int fillType,
) {
  buffer._checkPhase(_CurrentSection.paths);
  assert(buffer._nextPathId < kMaxId);

  final int id = buffer._nextPathId;
  buffer._nextPathId += 1;

  buffer._putUint8(_pathTag);
  buffer._putUint8(fillType);
  buffer._putUint16(id);
  buffer._putUint32(controlTypes.length);
  buffer._putUint8List(controlTypes);
  buffer._putUint32(controlPoints.length);
  buffer._putFloat32List(controlPoints);
  return id;
}