提交 aa80a912 编写于 作者: M Matt Perry

Change the ColorFilter constructor to ColorFilter.Mode, in case we want to add

more ColorFilter types.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1163373007.
上级 576ede16
......@@ -1170,6 +1170,7 @@ core_idl_files = get_path_info([
core_dart_files = get_path_info([
"painting/Color.dart",
"painting/ColorFilter.dart",
"painting/Gradient.dart",
"painting/MaskFilter.dart",
"painting/PaintingStyle.dart",
......
// 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.
part of dart.sky;
/// Extends the generated _ColorFilter interface via the PrivateDart attribute.
class ColorFilter extends _ColorFilter {
// This is the only ColorFilter type we need, but use a named constructor so
// we can add more in the future.
ColorFilter.Mode(Color color, TransferMode transferMode)
: super(color, transferMode) {}
}
......@@ -3,6 +3,7 @@
// found in the LICENSE file.
[
PrivateDart,
Constructor(Color color, TransferMode transferMode),
] interface ColorFilter {
};
......@@ -52,7 +52,7 @@ class SpriteNode extends TransformNode {
Paint paint = new Paint();
paint.setARGB((255.0*_opacity).toInt(), 255, 255, 255);
if (colorOverlay != null) {
paint.setColorFilter(new ColorFilter(colorOverlay, TransferMode.srcATopMode));
paint.setColorFilter(new ColorFilter.Mode(colorOverlay, TransferMode.srcATopMode));
}
if (transferMode != null) {
paint.setTransferMode(transferMode);
......@@ -68,4 +68,4 @@ class SpriteNode extends TransformNode {
}
}
}
\ No newline at end of file
}
......@@ -56,8 +56,8 @@ void main() {
(Paint layerPaint) {
layerPaint.color = const Color.fromARGB(128, 255, 255, 0);
layerPaint.setColorFilter(
new ColorFilter(const Color.fromARGB(128, 0, 0, 255),
TransferMode.srcInMode));
new ColorFilter.Mode(const Color.fromARGB(128, 0, 0, 255),
TransferMode.srcInMode));
layerPaint.setMaskFilter(
new MaskFilter.Blur(BlurStyle.normal, 3.0, highQuality: true));
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册