| // Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // TODO(mpcomplete): Figure out a better SkMatrix representation. |
| [ |
| Constructor(PictureRecorder recorder, Rect bounds), |
| RaisesException=Constructor, |
| ] interface Canvas { |
| void save(); |
| // TODO(jackson): Paint should be optional, but making it optional causes crash |
| void saveLayer(Rect bounds, /* optional */ Paint paint); |
| void restore(); |
| int getSaveCount(); // returns 1 for a clean canvas; each call to save() or saveLayer() increments it, and each call to restore() decrements it. |
| |
| void translate(float dx, float dy); |
| void scale(float sx, float sy); |
| void rotate(float radians); |
| void skew(float sx, float sy); |
| [RaisesException] void concat(Float32List matrix4); |
| |
| [RaisesException] void setMatrix(Float32List matrix4); |
| Float32List getTotalMatrix(); |
| |
| void clipRect(Rect rect); |
| void clipRRect(RRect rrect); |
| void clipPath(Path path); |
| |
| void drawColor(Color color, TransferMode transferMode); |
| void drawLine(Point p1, Point p2, Paint paint); |
| void drawPaint(Paint paint); |
| void drawRect(Rect rect, Paint paint); |
| void drawRRect(RRect rrect, Paint paint); |
| void drawDRRect(RRect outer, RRect inner, Paint paint); |
| void drawOval(Rect rect, Paint paint); |
| void drawCircle(Point c, float radius, Paint paint); |
| void drawPath(Path path, Paint paint); |
| void drawImage(Image image, Point p, Paint paint); |
| void drawImageRect(Image image, Rect src, Rect dst, Paint paint); |
| void drawPicture(Picture picture); |
| void drawDrawable(Drawable drawable); |
| void drawPaintingNode(PaintingNode paintingNode, Point p); |
| |
| // TODO(eseidel): Paint should be optional, but optional doesn't work. |
| [RaisesException] void drawAtlas(Image image, |
| sequence<RSTransform> transforms, sequence<Rect> rects, |
| sequence<Color> colors, TransferMode mode, Rect cullRect, Paint paint); |
| }; |