writeDrawVertices method

void writeDrawVertices(
  1. VectorGraphicsBuffer buffer,
  2. Float32List vertices,
  3. Uint16List? indices,
  4. int? paintId,
)

Encode a draw vertices command in the current buffer.

The indices are the index buffer used and is optional.

Implementation

void writeDrawVertices(
  VectorGraphicsBuffer buffer,
  Float32List vertices,
  Uint16List? indices,
  int? paintId,
) {
  buffer._checkPhase(_CurrentSection.commands);
  buffer._addCommandsTag();

  // Type Tag
  // Vertex Length
  // Vertex Buffer
  // Index Length
  // Index Buffer (If non zero)
  // Paint Id.
  buffer._putUint8(_drawVerticesTag);
  buffer._putUint16(paintId ?? kMaxId);
  buffer._putUint16(vertices.length);
  buffer._putFloat32List(vertices);
  if (indices != null) {
    buffer._putUint16(indices.length);
    buffer._putUint16List(indices);
  } else {
    buffer._putUint16(0);
  }
}