stripArgbColor function

int stripArgbColor(
  1. PdfColor color,
  2. double alpha
)

Straight (non-premultiplied) ARGB for strip vertex colors; the engine premultiplies vertex colors before BlendMode.modulate applies coverage.

Implementation

int stripArgbColor(PdfColor color, double alpha) {
  int ch(double v) {
    final c = v < 0 ? 0.0 : (v > 1 ? 1.0 : v);
    return (c * 255 + 0.5).toInt();
  }

  return (ch(alpha) << 24) |
      (ch(color.red) << 16) |
      (ch(color.green) << 8) |
      ch(color.blue);
}