OLD | NEW |
(Empty) | |
| 1 library paint; |
| 2 |
| 3 class Matrix extends NativeFieldWrapperClass2 { |
| 4 static final Matrix IDENTITY = new Matrix.transformation(1, 0, 0, 1, 0, 0); |
| 5 |
| 6 // set a transformation |
| 7 external Matrix.transformation(double a, double b, double c, double d, double
e, double f); |
| 8 |
| 9 // translate by dx,dy |
| 10 external Matrix.translation(double dx, double dy); |
| 11 external void translate(double dx, double dy); |
| 12 |
| 13 // rotate theta radians clockwise around cx,cy |
| 14 external Matrix.rotation(double cx, double cy, double theta); |
| 15 external void rotate(double cx, double cy, double theta); |
| 16 |
| 17 // ... |
| 18 } |
| 19 |
| 20 class Filter { |
| 21 // ... |
| 22 } |
| 23 |
| 24 class Rect { |
| 25 const Rect({ this.x, this.y, this.width, this.height }); |
| 26 final double x; |
| 27 final double y; |
| 28 final double width; |
| 29 final double height; |
| 30 } |
| 31 |
| 32 class DisplayList extends NativeFieldWrapperClass2 { |
| 33 // Wraps an SkPictureRecorder. |
| 34 // All APIs throw once the recording has been ended. |
| 35 |
| 36 DisplayList({ this.cullRect }); |
| 37 // Creates an SkPictureRecorder and starts recording. |
| 38 // Note that Skia today assumes that the cullRect origin is (0,0), |
| 39 // but this API does not (because we may want to draw outside a |
| 40 // widget's bounds, inflating it on all sides, e.g. to draw a focus |
| 41 // outline, but yet still put the widget top left at 0,0). |
| 42 |
| 43 // Drawing commands outside these bounds (if set) may be optimised away. |
| 44 // However, this is not guaranteed. |
| 45 final Rect cullRect; |
| 46 |
| 47 // Drawing API - circles, lines, rectangles, gradients, etc |
| 48 // (defers to the canvas created when this class was instantiated) |
| 49 // ... |
| 50 external void pushTransform(); |
| 51 external Matrix get transform; |
| 52 external void set transform (Matrix value); |
| 53 external void popTransform(); |
| 54 |
| 55 external void drawPaintNode(PaintNode node, { Matrix transform: null, Filter f
ilter: null }); |
| 56 // Inserts a PaintNode (i.e. SkDrawable) into the recording. |
| 57 // assume: if (transform == null) transform = Matrix.IDENTITY; |
| 58 } |
| 59 |
| 60 class PaintNode extends NativeFieldWrapperClass2 { |
| 61 // Wraps an SkDrawable. |
| 62 // A PaintNode is inherently paintable, though that isn't exposed to |
| 63 // the Dart side. |
| 64 |
| 65 external setDisplayList(DisplayList picture); |
| 66 // Ends picture's recording and updates the SkDrawable to that new |
| 67 // picture, notifying the C++ side of the change so that the next |
| 68 // time we paint, we use this new picture. |
| 69 } |
| 70 |
| 71 external PaintNode rootPaintNode; |
OLD | NEW |