restoreContext method

void restoreContext()

This releases any resources used by this Graphics object. You must use this method once finished with it.

When using PdfPage, you can create another fresh Graphics instance, which will draw over this one.

Implementation

void restoreContext() {
  if (_contextQueue.isNotEmpty) {
    assert(() {
      _indent -= _indentAmount;
      if (_page.settings.verbose) {
        _buf.putString(' ' * (_indent));
      }
      return true;
    }());

    // restore graphics context
    _buf.putString('Q ');
    _context = _contextQueue.removeLast();

    assert(() {
      if (_page.settings.verbose) {
        _buf.putString(' ' * (_commentIndent - 2 - _indent));
        _buf.putComment('restoreContext()');
      }
      return true;
    }());
  }
}