Commit 0f8ae9f1 authored by Matt Perry's avatar Matt Perry

Add a MaskFilter interface to dart:sky to handle blur.

For this, I added back my previous CustomDart attribute for customizing the
generated Dart code of an interface.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1162843003
parent b53644f6
......@@ -52,6 +52,8 @@ void main() {
layerPaint.setColorFilter(
new ColorFilter(const Color.fromARGB(128, 0, 0, 255),
TransferMode.srcInMode));
layerPaint.setMaskFilter(
new MaskFilter.Blur(BlurStyle.normal, 3.0, highQuality: true));
})
..addLayerOnTop(
new DrawLooperLayerInfo()
......
......@@ -10,22 +10,25 @@ void beginFrame(double timeStamp) {
canvas.translate(size + 10.0, size + 10.0);
Paint paint = new Paint();
paint.setARGB(255, 0, 255, 0);
paint.color = const Color.fromARGB(255, 0, 255, 0);
var builder = new LayerDrawLooperBuilder()
// Shadow layer.
..addLayerOnTop(
new DrawLooperLayerInfo()
..setPaintBits(-1)
..setOffset(const Point(5.0, 5.0))
..setColorMode(TransferMode.srcInMode),
(Paint layerPaint) {
layerPaint.setARGB(128, 55, 55, 55);
// TODO(mpcomplete): add blur filter
layerPaint.color = const Color.fromARGB(128, 55, 55, 55);
layerPaint.setMaskFilter(
new MaskFilter.Blur(BlurStyle.normal, 5.0, highQuality: true));
})
// Main layer.
..addLayerOnTop(new DrawLooperLayerInfo(), (Paint) {});
paint.setDrawLooper(builder.build());
canvas.drawPaint(new Paint()..setARGB(255, 255, 255, 255));
canvas.drawPaint(
new Paint()..color = const Color.fromARGB(255, 255, 255, 255));
canvas.drawRect(new Rect.fromLTRB(-size, -size, size, size), paint);
view.picture = canvas.endRecording();
}
......
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