PdfColor constructor

PdfColor(
  1. int red,
  2. int green,
  3. int blue, [
  4. int alpha = 255,
])

Initializes a new instance of the PdfColor class with Red, Green, Blue and Alpha channels.

//Creates a new PDF document.
PdfDocument document = PdfDocument()
  ..pages.add().graphics.drawString(
      'Hello World!', PdfStandardFont(PdfFontFamily.helvetica, 12),
      //Using PDF color set pen.
      pen: PdfPen(PdfColor(200, 120, 80)));
//Saves the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();

Implementation

PdfColor(int red, int green, int blue, [int alpha = 255]) {
  _helper = PdfColorHelper(this);
  _black = 0;
  _cyan = 0;
  _magenta = 0;
  _yellow = 0;
  _gray = 0;
  _red = red;
  _green = green;
  _blue = blue;
  _helper.alpha = alpha;
  _helper.isFilled = _helper.alpha != 0;
  _assignCMYK(_red, _green, _blue);
}