ChartCanvas extension
The android.graphics.Canvas calls of the renderers, drawing with a ChartPaint.
PaintStyle.FILL_AND_STROKE draws a fill pass and then a stroke pass. A ChartPaint.pathEffect dashes lines
and strokes as Skia does; fills are never dashed. Its lengths are device px, as on Android: they are divided by
Utils.devicePixelRatio when the line is dashed. Android's val n = c.save(); …; c.restoreToCount(n) becomes
final n = c.getSaveCount(); c.save(); …; c.restoreToCount(n).
A line, rectangle or circle with a NaN coordinate or radius, and text anchored at a NaN position, is not drawn: Skia draws nothing for it, while Flutter's canvas asserts on it in debug builds. Infinite coordinates are drawn as Flutter draws them. A circle with a radius of 0 or less is not drawn either, as Android's canvas does.
- on
Methods
-
clipRectM(
MutableRect rect) → void -
Available on Canvas, provided by the ChartCanvas extension
Intersects the clip withrect, without antialiasing like Android's rectangle clip, likeCanvas.clipRect(RectF). -
drawCircleP(
double cx, double cy, double radius, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Draws a circle around (cx,cy) withradiusin the style ofpaint, likeCanvas.drawCircle. -
drawColorP(
Color color) → void -
Available on Canvas, provided by the ChartCanvas extension
Fills the clip withcolorblended source over, likeCanvas.drawColor(int). -
drawLineP(
double x1, double y1, double x2, double y2, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Draws a line from (x1,y1) to (x2,y2), always stroked, likeCanvas.drawLine. -
drawLinesP(
Float32List pts, int offset, int count, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Drawscountfloats ofptsfromoffsetas separate lines, four floats (x0, y0, x1, y1) per line, always stroked, likeCanvas.drawLines(pts, offset, count, paint). Floats past the last whole line are ignored. With a dash effect every line starts the pattern anew, as in Skia. -
drawPathP(
Path path, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Drawspathin the style ofpaint, its stroke dashed when ChartPaint.pathEffect is set, likeCanvas.drawPath. -
drawRectP(
MutableRect rect, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Drawsrectin the style ofpaint, likeCanvas.drawRect(RectF, Paint). -
drawRoundRectP(
MutableRect rect, double rx, double ry, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Drawsrectwith corners of radiirxandryin the style ofpaint, likeCanvas.drawRoundRect. -
drawText(
String text, double x, double y, ChartPaint paint) → void -
Available on Canvas, provided by the ChartCanvas extension
Drawstextwith its baseline aty; ChartPaint.textAlign says whetherxis its left edge, center or right edge, likeCanvas.drawText(text, x, y, paint). -
saveCount(
) → int -
Available on Canvas, provided by the ChartCanvas extension
The number of saved states on the stack, likeCanvas.getSaveCount().