Commit 5108e15e authored by Adam Barth's avatar Adam Barth

Introduce painting.dart and move painting code to src/painting

parent 25b80399
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'package:sky/mojo/activity.dart'; import 'package:sky/mojo/activity.dart';
import 'package:sky/mojo/asset_bundle.dart'; import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
......
...@@ -6,7 +6,7 @@ library fitness; ...@@ -6,7 +6,7 @@ library fitness;
import 'package:playfair/playfair.dart' as playfair; import 'package:playfair/playfair.dart' as playfair;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
import 'user_data.dart'; import 'user_data.dart';
......
...@@ -4,7 +4,7 @@ import 'dart:async'; ...@@ -4,7 +4,7 @@ import 'dart:async';
import 'dart:math' as math; import 'dart:math' as math;
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:skysprites/skysprites.dart'; import 'package:skysprites/skysprites.dart';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'package:sky/mojo/asset_bundle.dart'; import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/button_base.dart'; import 'package:sky/src/widgets/button_base.dart';
......
...@@ -5,7 +5,7 @@ import 'dart:sky' as sky; ...@@ -5,7 +5,7 @@ import 'dart:sky' as sky;
import 'dart:math'; import 'dart:math';
import 'package:sky/mojo/activity.dart' as activity; import 'package:sky/mojo/activity.dart' as activity;
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/widgets.dart'; import 'package:sky/widgets.dart';
......
...@@ -18,14 +18,14 @@ Above this layer is the [animation](animation.dart) library, ...@@ -18,14 +18,14 @@ Above this layer is the [animation](animation.dart) library,
which provides core animation primitives, and the [gestures/](gestures/) which provides core animation primitives, and the [gestures/](gestures/)
directory, which define a gesture recognition and disambiguation system. directory, which define a gesture recognition and disambiguation system.
The next layer consists of the files in the [painting/](painting/) directory, The next layer consists of the [painting](painting.dart) library,
which provide APIs related to drawing graphics. Some of the code here which provides APIs related to drawing graphics. Some of the code here
uses the [animation](animation.dart) utilities mentioned above. uses the [animation](animation.dart) library mentioned above.
Layout primitives are provided in the next layer, found in the Layout primitives are provided in the next layer, found in the
[rendering](rendering.dart) library. They use `dart:sky` and the [rendering](rendering.dart) library. They use `dart:sky` and the
APIs exposed in [painting/](painting/) to provide a retained-mode layout and APIs exposed in the [painting](painting.dart) library to provide a retained-mode
rendering model for applications or documents. layout and rendering model for applications or documents.
Widgets are provided by the files in the [widgets](widgets.dart) Widgets are provided by the files in the [widgets](widgets.dart)
library, using a reactive framework. They use data given in the library, using a reactive framework. They use data given in the
...@@ -46,7 +46,7 @@ Here is a diagram summarizing all this: ...@@ -46,7 +46,7 @@ Here is a diagram summarizing all this:
| ++---------------------++ | | ++---------------------++ |
| | rendering | | Dart | | rendering | | Dart
| |---------+------------+ | | |---------+------------+ |
| | | painting/ | | | | | painting | |
+-+ +------------+ | +-+ +------------+ |
| gestures/ | animation | | | gestures/ | animation | |
+-----------+---+--------+ | +-----------+---+--------+ |
......
// 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.
/// The Sky render tree.
///
/// This library includes and re-exports all Sky rendering classes.
library painting;
export 'src/painting/box_painter.dart';
export 'src/painting/radial_reaction.dart';
export 'src/painting/shadows.dart';
export 'src/painting/text_painter.dart';
export 'src/painting/text_style.dart';
...@@ -7,7 +7,7 @@ import 'dart:sky' as sky; ...@@ -7,7 +7,7 @@ import 'dart:sky' as sky;
import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path; import 'dart:sky' show Point, Offset, Size, Rect, Color, Paint, Path;
import 'package:sky/base/image_resource.dart'; import 'package:sky/base/image_resource.dart';
import 'package:sky/painting/shadows.dart'; import 'package:sky/src/painting/shadows.dart';
/// An immutable set of offsets in each of the four cardinal directions /// An immutable set of offsets in each of the four cardinal directions
/// ///
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/text_style.dart'; import 'package:sky/src/painting/text_style.dart';
export 'package:sky/painting/text_style.dart'; export 'package:sky/src/painting/text_style.dart';
/// An immutable span of text /// An immutable span of text
abstract class TextSpan { abstract class TextSpan {
......
...@@ -384,6 +384,7 @@ scheduler.addPersistentFrameCallback((_) { ...@@ -384,6 +384,7 @@ scheduler.addPersistentFrameCallback((_) {
Dependencies Dependencies
------------ ------------
* [`package:sky/animation.dart`](../../animation.dart)
* [`package:sky/base`](../../base) * [`package:sky/base`](../../base)
* [`package:sky/mojo`](../../mojo) * [`package:sky/mojo`](../../mojo)
* [`package:sky/animation.dart`](../../animation.dart) * [`package:sky/painting.dart`](../../painting.dart)
...@@ -6,12 +6,11 @@ import 'dart:math' as math; ...@@ -6,12 +6,11 @@ import 'dart:math' as math;
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/base/debug.dart'; import 'package:sky/base/debug.dart';
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/painting/text_style.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:vector_math/vector_math.dart'; import 'package:vector_math/vector_math.dart';
export 'package:sky/painting/text_style.dart' show TextBaseline; export 'package:sky/painting.dart' show TextBaseline;
// GENERIC BOX RENDERING // GENERIC BOX RENDERING
// Anything that has a concept of x, y, width, height is going to derive from this // Anything that has a concept of x, y, width, height is going to derive from this
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
......
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting/text_painter.dart'; import 'package:sky/src/painting/text_painter.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
export 'package:sky/painting/text_painter.dart'; export 'package:sky/src/painting/text_painter.dart';
// Unfortunately, using full precision floating point here causes bad layouts // Unfortunately, using full precision floating point here causes bad layouts
// because floating point math isn't associative. If we add and subtract // because floating point math isn't associative. If we add and subtract
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/box_painter.dart'; import 'package:sky/src/painting/box_painter.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/src/painting/text_style.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
import 'package:vector_math/vector_math.dart'; import 'package:vector_math/vector_math.dart';
export 'package:sky/painting/box_painter.dart'; export 'package:sky/src/painting/box_painter.dart';
class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox> { class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox> {
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/painting/text_style.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
......
...@@ -502,6 +502,6 @@ Dependencies ...@@ -502,6 +502,6 @@ Dependencies
* `package:vector_math` * `package:vector_math`
* [`package:sky/animation.dart`](../../animation.dart) * [`package:sky/animation.dart`](../../animation.dart)
* [`package:sky/base`](../../base) * [`package:sky/base`](../../base)
* [`package:sky/painting`](../../painting) * [`package:sky/painting.dart`](../../painting.dart)
* [`package:sky/rendering.dart`](../../rendering.dart) * [`package:sky/rendering.dart`](../../rendering.dart)
* [`package:sky/theme`](../../theme) * [`package:sky/theme`](../../theme)
...@@ -6,7 +6,7 @@ import 'dart:sky' as sky; ...@@ -6,7 +6,7 @@ import 'dart:sky' as sky;
import 'package:vector_math/vector_math.dart'; import 'package:vector_math/vector_math.dart';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/widgets/animated_component.dart'; import 'package:sky/src/widgets/animated_component.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -9,8 +9,8 @@ import 'package:vector_math/vector_math.dart'; ...@@ -9,8 +9,8 @@ import 'package:vector_math/vector_math.dart';
import 'package:sky/base/image_resource.dart'; import 'package:sky/base/image_resource.dart';
import 'package:sky/mojo/asset_bundle.dart'; import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/mojo/net/image_cache.dart' as image_cache; import 'package:sky/mojo/net/image_cache.dart' as image_cache;
import 'package:sky/painting/text_painter.dart'; import 'package:sky/src/painting/text_painter.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/src/painting/text_style.dart';
import 'package:sky/src/rendering/block.dart'; import 'package:sky/src/rendering/block.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/flex.dart'; import 'package:sky/src/rendering/flex.dart';
...@@ -26,7 +26,7 @@ import 'package:sky/src/widgets/default_text_style.dart'; ...@@ -26,7 +26,7 @@ import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions; export 'package:sky/base/hit_test.dart' show EventDisposition, combineEventDispositions;
export 'package:sky/painting/text_style.dart'; export 'package:sky/src/painting/text_style.dart';
export 'package:sky/src/rendering/block.dart' show BlockDirection; export 'package:sky/src/rendering/block.dart' show BlockDirection;
export 'package:sky/src/rendering/box.dart' show BoxConstraints; export 'package:sky/src/rendering/box.dart' show BoxConstraints;
export 'package:sky/src/rendering/flex.dart' show FlexJustifyContent, FlexAlignItems, FlexDirection; export 'package:sky/src/rendering/flex.dart' show FlexJustifyContent, FlexAlignItems, FlexDirection;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/button_base.dart'; import 'package:sky/src/widgets/button_base.dart';
......
...@@ -6,7 +6,7 @@ import 'dart:async'; ...@@ -6,7 +6,7 @@ import 'dart:async';
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:mojo_services/keyboard/keyboard.mojom.dart'; import 'package:mojo_services/keyboard/keyboard.mojom.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/mojo/keyboard.dart'; import 'package:sky/mojo/keyboard.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/editable_text.dart'; import 'package:sky/src/widgets/editable_text.dart';
import 'package:sky/src/widgets/focus.dart'; import 'package:sky/src/widgets/focus.dart';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/shadows.dart'; import 'package:sky/theme/shadows.dart';
import 'package:sky/src/widgets/animated_container.dart'; import 'package:sky/src/widgets/animated_container.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart'; import 'package:sky/theme/colors.dart';
import 'package:sky/theme/shadows.dart'; import 'package:sky/theme/shadows.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
......
...@@ -5,8 +5,7 @@ ...@@ -5,8 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:sky' as sky; import 'dart:sky' as sky;
import 'package:sky/painting/radial_reaction.dart'; import 'package:sky/painting.dart';
import 'package:sky/painting/shadows.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/theme/shadows.dart'; import 'package:sky/theme/shadows.dart';
......
...@@ -7,7 +7,7 @@ import 'dart:sky' as sky; ...@@ -7,7 +7,7 @@ import 'dart:sky' as sky;
import 'package:newton/newton.dart'; import 'package:newton/newton.dart';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/rendering.dart'; import 'package:sky/rendering.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
import 'package:sky/theme/typography.dart' as typography; import 'package:sky/theme/typography.dart' as typography;
......
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
import 'package:sky/src/widgets/theme.dart'; import 'package:sky/src/widgets/theme.dart';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/flex.dart'; import 'package:sky/src/rendering/flex.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/theme/view_configuration.dart';
import 'package:sky/src/widgets/basic.dart'; import 'package:sky/src/widgets/basic.dart';
import 'package:sky/src/widgets/default_text_style.dart'; import 'package:sky/src/widgets/default_text_style.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
import 'package:sky/src/widgets/icon.dart'; import 'package:sky/src/widgets/icon.dart';
import 'package:sky/theme/shadows.dart';
import 'package:sky/theme/typography.dart' as typography;
import 'package:sky/theme/view_configuration.dart';
class ToolBar extends Component { class ToolBar extends Component {
......
...@@ -2,4 +2,5 @@ This directory provides constants for Material Design. ...@@ -2,4 +2,5 @@ This directory provides constants for Material Design.
http://www.google.com/design/spec/material-design/ http://www.google.com/design/spec/material-design/
Files in this directory only depend on ../painting/* and sky:dart. Files in this directory only depend on [painting.dart](../painting.dart) and
`sky:dart`.
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
import 'dart:sky' show Color, Offset; import 'dart:sky' show Color, Offset;
import 'package:sky/painting/box_painter.dart'; import 'package:sky/painting.dart';
const Map<int, List<BoxShadow>> shadows = const { const Map<int, List<BoxShadow>> shadows = const {
1: const [ 1: const [
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import 'dart:sky'; import 'dart:sky';
import 'package:sky/painting/text_style.dart'; import 'package:sky/painting.dart';
import 'package:sky/theme/colors.dart' as colors; import 'package:sky/theme/colors.dart' as colors;
// TODO(eseidel): Font weights are supposed to be language relative! // TODO(eseidel): Font weights are supposed to be language relative!
......
...@@ -14,7 +14,7 @@ import 'package:mojo/core.dart'; ...@@ -14,7 +14,7 @@ import 'package:mojo/core.dart';
import 'package:sky/animation.dart'; import 'package:sky/animation.dart';
import 'package:sky/mojo/asset_bundle.dart'; import 'package:sky/mojo/asset_bundle.dart';
import 'package:sky/mojo/shell.dart' as shell; import 'package:sky/mojo/shell.dart' as shell;
import 'package:sky/painting/text_painter.dart'; import 'package:sky/painting.dart';
import 'package:sky/src/rendering/box.dart'; import 'package:sky/src/rendering/box.dart';
import 'package:sky/src/rendering/object.dart'; import 'package:sky/src/rendering/object.dart';
import 'package:sky/src/widgets/framework.dart'; import 'package:sky/src/widgets/framework.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment