mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

Each layer is supposed to reexport the parts of the previous layer that are part of its API. - In painting.dart, export from dart:ui all the Canvas-related APIs that make sense to be used at higher levels, e.g. PaintingStyle. - Delete painting/shadows.dart. It was dead code. - In rendering/object.dart, export all of painting.dart. - In widgets/basic.dart, export all of painting.dart and animation.dart. Some classes in animation/ are renamed to make this less disruptive and confusing to the namespace. - Split out Stocks back into an import model rather than a part model, so that it's easier to manage its dependencies on a per-file basis. - Move Ticker to scheduler library. - Remove as many redundant imports as possible now. - Some minor nit picking cleanup in various files.
40 lines
1.4 KiB
Dart
40 lines
1.4 KiB
Dart
part of flutter_sprites;
|
|
|
|
/// A [Node] that provides an intermediate rendering surface in the sprite
|
|
/// rendering tree. A [Layer] can be used to change the opacity, color, or to
|
|
/// apply an effect to a set of nodes. All nodes that are children to the
|
|
/// [Layer] will be rendered into the surface. If the area that is needed for
|
|
/// the children to be drawn is know, the [layerRect] property should be set as
|
|
/// this can enhance performance.
|
|
class Layer extends Node with SpritePaint {
|
|
|
|
/// The area that the children of the [Layer] will occupy. This value is
|
|
/// treated as a hint to the rendering system and may in some cases be
|
|
/// ignored. If the area isn't known, the layerRect can be set to [null].
|
|
///
|
|
/// myLayer.layerRect = new Rect.fromLTRB(0.0, 0.0, 200.0, 100.0);
|
|
Rect layerRect;
|
|
|
|
/// Creates a new layer. The layerRect can optionally be passed as an argument
|
|
/// if it is known.
|
|
///
|
|
/// var myLayer = new Layer();
|
|
Layer([this.layerRect = null]);
|
|
|
|
Paint _cachedPaint = new Paint()
|
|
..filterQuality = FilterQuality.low
|
|
..isAntiAlias = false;
|
|
|
|
void _prePaint(Canvas canvas, Matrix4 matrix) {
|
|
super._prePaint(canvas, matrix);
|
|
|
|
_updatePaint(_cachedPaint);
|
|
canvas.saveLayer(layerRect, _cachedPaint);
|
|
}
|
|
|
|
void _postPaint(Canvas canvas, Matrix4 totalMatrix) {
|
|
canvas.restore();
|
|
super._postPaint(canvas, totalMatrix);
|
|
}
|
|
}
|