writeStroke method

int writeStroke(
  1. VectorGraphicsBuffer buffer,
  2. int color,
  3. int strokeCap,
  4. int strokeJoin,
  5. int blendMode,
  6. double strokeMiterLimit,
  7. double strokeWidth, [
  8. int? shaderId,
])

Encode a paint object in the current buffer, returning the identifier assigned to it.

color is the 32-bit ARBG color representation used by Flutter internally. The strokeCap, strokeJoin, blendMode, style fields should be the index of the corresponding enumeration.

This method is only used to write the paint used for fill commands. To write a paint used for a stroke command, see writeStroke.

Implementation

int writeStroke(
  VectorGraphicsBuffer buffer,
  int color,
  int strokeCap,
  int strokeJoin,
  int blendMode,
  double strokeMiterLimit,
  double strokeWidth, [
  int? shaderId,
]) {
  buffer._checkPhase(_CurrentSection.paints);
  final int paintId = buffer._nextPaintId++;
  assert(paintId < kMaxId);
  buffer._putUint8(_strokePaintTag);
  buffer._putUint32(color);
  buffer._putUint8(strokeCap);
  buffer._putUint8(strokeJoin);
  buffer._putUint8(blendMode);
  buffer._putFloat32(strokeMiterLimit);
  buffer._putFloat32(strokeWidth);
  buffer._putUint16(paintId);
  buffer._putUint16(shaderId ?? kMaxId);
  return paintId;
}