Canvas constructor

  1. PictureRecorder recorder,
  2. [Rect cullRect]

Creates a canvas for recording graphical operations into the given picture recorder.

Graphical operations that affect pixels entirely outside the given cullRect might be discarded by the implementation. However, the implementation might draw outside these bounds if, for example, a command draws partially inside and outside the cullRect. To ensure that pixels outside a given region are discarded, consider using a clipRect. The cullRect is optional; by default, all operations are kept.

To end the recording, call PictureRecorder.endRecording on the given recorder.


Canvas(PictureRecorder recorder, [ Rect? cullRect ]) : assert(recorder != null) { // ignore: unnecessary_null_comparison
  if (recorder.isRecording)
    throw ArgumentError('"recorder" must not already be associated with another Canvas.');
  cullRect ??= Rect.largest;
  _constructor(recorder, cullRect.left,, cullRect.right, cullRect.bottom);