mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Adds new Layer class
This commit is contained in:
parent
32359d4b62
commit
7b4f41e36c
19
examples/game/lib/layer.dart
Normal file
19
examples/game/lib/layer.dart
Normal file
@ -0,0 +1,19 @@
|
||||
part of sprites;
|
||||
|
||||
class Layer extends Node with SpritePaint {
|
||||
Paint _cachedPaint = new Paint()
|
||||
..setFilterQuality(FilterQuality.low)
|
||||
..isAntiAlias = false;
|
||||
|
||||
void _prePaint(PaintingCanvas canvas, Matrix4 matrix) {
|
||||
super._prePaint(canvas, matrix);
|
||||
|
||||
_updatePaint(_cachedPaint);
|
||||
canvas.saveLayer(null, _cachedPaint);
|
||||
}
|
||||
|
||||
void _postPaint(PaintingCanvas canvas, Matrix4 totalMatrix) {
|
||||
canvas.restore();
|
||||
super._postPaint(canvas, totalMatrix);
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,7 @@ import 'package:vector_math/vector_math.dart';
|
||||
part 'action.dart';
|
||||
part 'color_secuence.dart';
|
||||
part 'image_map.dart';
|
||||
part 'layer.dart';
|
||||
part 'node.dart';
|
||||
part 'node3d.dart';
|
||||
part 'node_with_size.dart';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user