Index: sky/sdk/lib/framework/paint.dart |
diff --git a/sky/sdk/lib/framework/paint.dart b/sky/sdk/lib/framework/paint.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b3fb034999566f32b8654e53996f6f2490f8ea80 |
--- /dev/null |
+++ b/sky/sdk/lib/framework/paint.dart |
@@ -0,0 +1,71 @@ |
+library paint; |
+ |
+class Matrix extends NativeFieldWrapperClass2 { |
+ static final Matrix IDENTITY = new Matrix.transformation(1, 0, 0, 1, 0, 0); |
+ |
+ // set a transformation |
+ external Matrix.transformation(double a, double b, double c, double d, double e, double f); |
+ |
+ // translate by dx,dy |
+ external Matrix.translation(double dx, double dy); |
+ external void translate(double dx, double dy); |
+ |
+ // rotate theta radians clockwise around cx,cy |
+ external Matrix.rotation(double cx, double cy, double theta); |
+ external void rotate(double cx, double cy, double theta); |
+ |
+ // ... |
+} |
+ |
+class Filter { |
+ // ... |
+} |
+ |
+class Rect { |
+ const Rect({ this.x, this.y, this.width, this.height }); |
+ final double x; |
+ final double y; |
+ final double width; |
+ final double height; |
+} |
+ |
+class DisplayList extends NativeFieldWrapperClass2 { |
+ // Wraps an SkPictureRecorder. |
+ // All APIs throw once the recording has been ended. |
+ |
+ DisplayList({ this.cullRect }); |
+ // Creates an SkPictureRecorder and starts recording. |
+ // Note that Skia today assumes that the cullRect origin is (0,0), |
+ // but this API does not (because we may want to draw outside a |
+ // widget's bounds, inflating it on all sides, e.g. to draw a focus |
+ // outline, but yet still put the widget top left at 0,0). |
+ |
+ // Drawing commands outside these bounds (if set) may be optimised away. |
+ // However, this is not guaranteed. |
+ final Rect cullRect; |
+ |
+ // Drawing API - circles, lines, rectangles, gradients, etc |
+ // (defers to the canvas created when this class was instantiated) |
+ // ... |
+ external void pushTransform(); |
+ external Matrix get transform; |
+ external void set transform (Matrix value); |
+ external void popTransform(); |
+ |
+ external void drawPaintNode(PaintNode node, { Matrix transform: null, Filter filter: null }); |
+ // Inserts a PaintNode (i.e. SkDrawable) into the recording. |
+ // assume: if (transform == null) transform = Matrix.IDENTITY; |
+} |
+ |
+class PaintNode extends NativeFieldWrapperClass2 { |
+ // Wraps an SkDrawable. |
+ // A PaintNode is inherently paintable, though that isn't exposed to |
+ // the Dart side. |
+ |
+ external setDisplayList(DisplayList picture); |
+ // Ends picture's recording and updates the SkDrawable to that new |
+ // picture, notifying the C++ side of the change so that the next |
+ // time we paint, we use this new picture. |
+} |
+ |
+external PaintNode rootPaintNode; |