writeFill method

int writeFill(
  1. VectorGraphicsBuffer buffer,
  2. int color,
  3. int blendMode, [
  4. int? shaderId,
])

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

color is the 32-bit ARBG color representation used by Flutter internally. The blendMode 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 writeFill(
  VectorGraphicsBuffer buffer,
  int color,
  int blendMode, [
  int? shaderId,
]) {
  buffer._checkPhase(_CurrentSection.paints);

  final int paintId = buffer._nextPaintId++;
  assert(paintId < kMaxId);
  buffer._putUint8(_fillPaintTag);
  buffer._putUint32(color);
  buffer._putUint8(blendMode);
  buffer._putUint16(paintId);
  buffer._putUint16(shaderId ?? kMaxId);
  return paintId;
}