提交 85670ba0 编写于 作者: M Matt Perry

Expose and use constants for DrawLooperLayerInfo.setPaintBits to dart.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1175403002.
上级 dcea5368
......@@ -1169,6 +1169,7 @@ core_idl_files = get_path_info([
core_dart_files = get_path_info([
"painting/Color.dart",
"painting/ColorFilter.dart",
"painting/DrawLooperLayerInfo.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;
/// Paint masks for DrawLooperLayerInfo.setPaintBits. These specify which
/// aspects of the layer's paint should replace the corresponding aspects on
/// the draw's paint.
///
/// PaintBits.all means use the layer's paint completely.
/// 0 means ignore the layer's paint... except for colorMode, which is
/// always applied.
class PaintBits {
static const int style = 0x1;
static const int testSkewx = 0x2;
static const int pathEffect = 0x4;
static const int maskFilter = 0x8;
static const int shader = 0x10;
static const int colorFilter = 0x20;
static const int xfermode = 0x40;
static const int all = 0xFFFFFFFF;
}
......@@ -5,23 +5,9 @@
[
Constructor(),
] interface DrawLooperLayerInfo {
// Bits specifies which aspects of the layer's paint should replace the
// corresponding aspects on the draw's paint.
// ENTIRE_PAINT_BITS means use the layer's paint completely.
// 0 means ignore the layer's paint... except for colorMode, which is
// always applied.
// TODO(mpcomplete): maybe these should each be functions (e.g. useStyle()).
// TODO(mpcomplete): the IDL compiler doesn't use these for anything?
// TODO(mpcomplete): dart style says to name these like 'styleBit'.
const unsigned long STYLE_BIT = 0x1;
const unsigned long TEXT_SKEWX_BIT = 0x2;
const unsigned long PATH_EFFECT_BIT = 0x4;
const unsigned long MASK_FILTER_BIT = 0x8;
const unsigned long SHADER_BIT = 0x10;
const unsigned long COLOR_FILTER_BIT = 0x20;
const unsigned long XFERMODE_BIT = 0x40;
const unsigned long ENTIRE_PAINT_BITS = -1;
// Specifies which aspects of the layer's paint should replace the
// corresponding aspects on the draw's paint. Use PaintBits, defined in
// DrawLooperLayerInfo.dart.
void setPaintBits(unsigned long bits);
void setColorMode(TransferMode mode);
// TODO(eseidel): Offset should be a Size not a Point.
......
......@@ -51,7 +51,7 @@ void main() {
new DrawLooperLayerInfo()
..setOffset(const Point(150.0, 0.0))
..setColorMode(TransferMode.srcMode)
..setPaintBits(-1),
..setPaintBits(PaintBits.all),
(Paint layerPaint) {
layerPaint.color = const Color.fromARGB(128, 255, 255, 0);
layerPaint.setColorFilter(
......@@ -64,13 +64,16 @@ void main() {
new DrawLooperLayerInfo()
..setOffset(const Point(75.0, 75.0))
..setColorMode(TransferMode.srcMode)
..setPaintBits(-1),
..setPaintBits(PaintBits.shader),
(Paint layerPaint) {
Gradient redYellow = new Gradient.radial(
new Point(0.0, 0.0), radius/3.0,
[const Color(0xFFFFFF00), const Color(0xFFFF0000)],
null, TileMode.mirror);
layerPaint.setShader(redYellow);
// Since we're don't set PaintBits.maskFilter, this has no effect.
layerPaint.setMaskFilter(
new MaskFilter.blur(BlurStyle.normal, 50.0, highQuality: true));
})
..addLayerOnTop(
new DrawLooperLayerInfo()..setOffset(const Point(225.0, 75.0)),
......
......@@ -15,7 +15,7 @@ void beginFrame(double timeStamp) {
// Shadow layer.
..addLayerOnTop(
new DrawLooperLayerInfo()
..setPaintBits(-1)
..setPaintBits(PaintBits.all)
..setOffset(const Point(5.0, 5.0))
..setColorMode(TransferMode.srcInMode),
(Paint layerPaint) {
......
......@@ -12,7 +12,7 @@ class ShadowDrawLooperBuilder {
void addShadow(sky.Size offset, sky.Color color, double blur) {
builder_.addLayerOnTop(
new sky.DrawLooperLayerInfo()
..setPaintBits(-1)
..setPaintBits(PaintBits.all)
..setOffset(offset.toPoint())
..setColorMode(sky.TransferMode.srcMode),
(sky.Paint layerPaint) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册