| // 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. |
| interface Canvas { |
| // Height and width are used for culling optimizations and do not necessarily |
| // imply that the Canvas is backed by a buffer with any specific bounds. |
| readonly attribute float height; |
| readonly attribute float width; |
| |
| void save(); |
| // TODO(jackson): Paint should be optional, but making it optional causes crash |
| void saveLayer(Rect bounds, /* optional */ Paint paint); |
| void restore(); |
| |
| void translate(float dx, float dy); |
| void scale(float sx, float sy); |
| void rotate(float radians); |
| void skew(float sx, float sy); |
| void concat(Float32List matrix4); |
| |
| void clipRect(Rect rect); |
| void clipRRect(RRect rrect); |
| void clipPath(Path path); |
| |
| void drawLine(float x0, float y0, float x1, float y1, Paint paint); |
| void drawPicture(Picture picture); |
| void drawPaint(Paint paint); |
| void drawRect(Rect rect, Paint paint); |
| void drawRRect(RRect rrect, Paint paint); |
| void drawOval(Rect rect, Paint paint); |
| void drawCircle(float x, float y, float radius, Paint paint); |
| void drawPath(Path path, Paint paint); |
| void drawImage(Image image, float x, float y, Paint paint); |
| }; |