setStrokeColor method

void setStrokeColor(
  1. PdfColor? color
)

Sets the stroke color for drawing

Implementation

void setStrokeColor(PdfColor? color) {
  var o = 0;
  assert(() {
    if (_page.settings.verbose) {
      o = _buf.offset;
      _buf.putString(' ' * (_indent));
    }
    return true;
  }());

  if (color is PdfColorCmyk) {
    PdfNumList(<double>[
      color.cyan,
      color.magenta,
      color.yellow,
      color.black,
    ]).output(_page, _buf);
    _buf.putString(' K ');
  } else {
    PdfNumList(<double>[
      color!.red,
      color.green,
      color.blue,
    ]).output(_page, _buf);
    _buf.putString(' RG ');
  }

  assert(() {
    if (_page.settings.verbose) {
      _buf.putString(' ' * math.max(0, _commentIndent - _buf.offset + o));
      _buf.putComment('setStrokeColor(${color?.toHex()})');
    }
    return true;
  }());
}