Adam Barth b356d14635 Introduce package:sky/animation.dart
Move the animation libraries into src/animation and change importers to use
package:sky/animation.dart. Also, move scheduler.dart into the animation
library so that the animation library can be self-contained.
2015-09-08 09:44:01 -07:00
..
2015-09-08 09:44:01 -07:00
2015-09-08 09:44:01 -07:00
2015-09-08 09:44:01 -07:00

SKY SDK

Sky and Sky's SDK are designed as layered frameworks, where each layer depends on the ones below it but could be replaced wholesale.

The bottom-most layer is the Sky Platform, which is exposed to Dart code as various dart: packages, including dart:sky.

The base/ directory contains libraries that extend these core APIs to provide base classes for tree structures (base/node.dart), hit testing (base/hit_test.dart), and debugging (base/debug.dart).

Above this layer is the animation library, which provides core animation primitives, and the gestures/ directory, which define a gesture recognition and disambiguation system.

The next layer consists of the files in the painting/ directory, which provide APIs related to drawing graphics. Some of the code here uses the animation utilities mentioned above.

Layout primitives are provided in the next layer, found in the rendering library. They use dart:sky and the APIs exposed in painting/ to provide a retained-mode layout and rendering model for applications or documents.

Widgets are provided by the files in the widgets library, using a reactive framework. They use data given in the theme/ directory to select styles consistent with Material Design.

Alongside the above is the mojo/ directory, which contains anything that uses the Mojo IPC mechanism, typically as part of wrapping host operating system features. Some of those Host APIs are implemented in the host system's preferred language.

Here is a diagram summarizing all this:

+-----------------------------+ ------
|           YOUR APP          |
|  +----------------------+---+
|  |  widgets   (theme/)  |   |
| ++---------------------++   |
| |      rendering       |    |  Dart
| |---------+------------+    |
| |         | painting/  |    |
+-+         +------------+    |
| gestures/ | animation  |    |
+-----------+---+--------+    |
|    base/      |  mojo/      |
+------------+--+-+----+------+ -------
|  dart:sky  |    |    | Host |
+--------+---+    |    | APIs |  C++
|  Skia  |  Dart  |    +------+  ObjC
+--------+--------+           |  Java
|            Mojo             |
+-----------------------------+ -------
|    Host Operating System    |  C/C++
+-----------------------------+ -------

TODO(ianh): document dart:sky and the Host APIs somewhere

Sky Engine API

The Sky engine API provides efficient, immutable wrappers for common Skia C++ types, notably Color, Point, and Rect. Because these wrappers are immutable, they are suitable for storage in final member variables of widget classes. More complex Skia wrappers such as Paint and RRect are mutable, to more closely match the Skia APIs. We recommend constructing wrappers for complex Skia classes dynamically during the painting phase based on the underlying state of the widget.