applyShader method

void applyShader(
  1. PdfShading shader
)

Apply a shader

Implementation

void applyShader(PdfShading shader) {
  var o = 0;
  assert(() {
    if (_page.pdfDocument.settings.verbose) {
      o = _buf.offset;
      _buf.putString(' ' * (_indent));
    }
    return true;
  }());

  // The shader needs to be registered in the page resources
  _page.addShader(shader);
  _buf.putString('${shader.name} sh ');
  _page.altered = true;

  assert(() {
    if (_page.pdfDocument.settings.verbose) {
      _buf.putString(' ' * math.max(0, _commentIndent - _buf.offset + o));
      _buf.putComment('applyShader(${shader.ref()})');
    }
    return true;
  }());
}