# Canvas class

An interface for recording graphical operations.

Canvas objects are used in creating Picture objects, which can themselves be used with a SceneBuilder to build a Scene. In normal usage, however, this is all handled by the framework.

A canvas has a current transformation matrix which is applied to all operations. Initially, the transformation matrix is the identity transform. It can be modified using the translate, scale, rotate, skew, and transform methods.

A canvas also has a current clip region which is applied to all operations. Initially, the clip region is infinite. It can be modified using the clipRect, clipRRect, and clipPath methods.

The current transform and clip can be saved and restored using the stack managed by the save, saveLayer, and restore methods.

## Constructors

Canvas(PictureRecorder recorder, [ Rect cullRect ])
  Creates a canvas for recording graphical operations into the given picture recorder. [...]

## Properties

hashCode → int
  The hash code for this object. [...]
  read-only, inherited
runtimeType → Type
  A representation of the runtime type of the object.
  read-only, inherited

## Methods

clipPath(Path path, { bool doAntiAlias: true }) → void
  Reduces the clip region to the intersection of the current clip and the given Path. [...]
clipRect(Rect rect, { ClipOp clipOp: ClipOp.intersect, bool doAntiAlias: true }) → void
  Reduces the clip region to the intersection of the current clip and the given rectangle. [...]
clipRRect(RRect rrect, { bool doAntiAlias: true }) → void
  Reduces the clip region to the intersection of the current clip and the given rounded rectangle. [...]
drawArc(Rect rect, double startAngle, double sweepAngle, bool useCenter, Paint paint) → void
  Draw an arc scaled to fit inside the given rectangle. It starts from startAngle radians around the oval up to startAngle + sweepAngle radians around the oval, with zero radians being the point on the right hand side of the oval that crosses the horizontal line that intersects the center of the rectangle and with positive angles going clockwise around the oval. If useCenter is true, the arc is closed back to the center, forming a circle sector. Otherwise, the arc is not closed, forming a circle segment. [...]
drawAtlas(Image atlas, List<RSTransform> transforms, List<Rect> rects, List<Color> colors, BlendMode blendMode, Rect cullRect, Paint paint) → void
drawCircle(Offset c, double radius, Paint paint) → void
  Draws a circle centered at the point given by the first argument and that has the radius given by the second argument, with the Paint given in the third argument. Whether the circle is filled or stroked (or both) is controlled by Paint.style.
drawColor(Color color, BlendMode blendMode) → void
  Paints the given Color onto the canvas, applying the given BlendMode, with the given color being the source and the background being the destination.
drawDRRect(RRect outer, RRect inner, Paint paint) → void
  Draws a shape consisting of the difference between two rounded rectangles with the given Paint. Whether this shape is filled or stroked (or both) is controlled by Paint.style. [...]
drawImage(Image image, Offset p, Paint paint) → void
  Draws the given Image into the canvas with its top-left corner at the given Offset. The image is composited into the canvas using the given Paint.
drawImageNine(Image image, Rect center, Rect dst, Paint paint) → void
  Draws the given Image into the canvas using the given Paint. [...]
drawImageRect(Image image, Rect src, Rect dst, Paint paint) → void
  Draws the subset of the given image described by the `src` argument into the canvas in the axis-aligned rectangle given by the `dst` argument. [...]
drawLine(Offset p1, Offset p2, Paint paint) → void
  Draws a line between the given points using the given paint. The line is stroked, the value of the Paint.style is ignored for this call. [...]
drawOval(Rect rect, Paint paint) → void
  Draws an axis-aligned oval that fills the given axis-aligned rectangle with the given Paint. Whether the oval is filled or stroked (or both) is controlled by Paint.style.
drawPaint(Paint paint) → void
  Fills the canvas with the given Paint. [...]
drawParagraph(Paragraph paragraph, Offset offset) → void
  Draws the text in the given Paragraph into this canvas at the given Offset. [...]
drawPath(Path path, Paint paint) → void
  Draws the given Path with the given Paint. Whether this shape is filled or stroked (or both) is controlled by Paint.style. If the path is filled, then sub-paths within it are implicitly closed (see Path.close).
drawPicture(Picture picture) → void
  Draw the given picture onto the canvas. To create a picture, see PictureRecorder.
drawPoints(PointMode pointMode, List<Offset> points, Paint paint) → void
  Draws a sequence of points according to the given PointMode. [...]
drawRawAtlas(Image atlas, Float32List rstTransforms, Float32List rects, Int32List colors, BlendMode blendMode, Rect cullRect, Paint paint) → void
drawRawPoints(PointMode pointMode, Float32List points, Paint paint) → void
  Draws a sequence of points according to the given PointMode. [...]
drawRect(Rect rect, Paint paint) → void
  Draws a rectangle with the given Paint. Whether the rectangle is filled or stroked (or both) is controlled by Paint.style.
drawRRect(RRect rrect, Paint paint) → void
  Draws a rounded rectangle with the given Paint. Whether the rectangle is filled or stroked (or both) is controlled by Paint.style.
drawShadow(Path path, Color color, double elevation, bool transparentOccluder) → void
  Draws a shadow for a Path representing the given material elevation. [...]
drawVertices(Vertices vertices, BlendMode blendMode, Paint paint) → void
getSaveCount() → int
  Returns the number of items on the save stack, including the initial state. This means it returns 1 for a clean canvas, and that each call to save and saveLayer increments it, and that each matching call to restore decrements it. [...]
restore() → void
  Pops the current save stack, if there is anything to pop. Otherwise, does nothing. [...]
rotate(double radians) → void
  Add a rotation to the current transform. The argument is in radians clockwise.
save() → void
  Saves a copy of the current transform and clip on the save stack. [...]
saveLayer(Rect bounds, Paint paint) → void
  Saves a copy of the current transform and clip on the save stack, and then creates a new group which subsequent calls will become a part of. When the save stack is later popped, the group will be flattened into a layer and have the given `paint`'s Paint.colorFilter and Paint.blendMode applied. [...]
scale(double sx, [ double sy ]) → void
  Add an axis-aligned scale to the current transform, scaling by the first argument in the horizontal direction and the second in the vertical direction. [...]
skew(double sx, double sy) → void
  Add an axis-aligned skew to the current transform, with the first argument being the horizontal skew in radians clockwise around the origin, and the second argument being the vertical skew in radians clockwise around the origin.
transform(Float64List matrix4) → void
  Multiply the current transform by the specified 4⨉4 transformation matrix specified as a list of values in column-major order.
translate(double dx, double dy) → void
  Add a translation to the current transform, shifting the coordinate space horizontally by the first argument and vertically by the second argument.
noSuchMethod(Invocation invocation) → dynamic
  Invoked when a non-existent method or property is accessed. [...]
  inherited
toString() → String
  Returns a string representation of this object.
  inherited

## Operators

operator ==(dynamic other) → bool
  The equality operator. [...]
  inherited