Index: sky/examples/raw/shadow.dart |
diff --git a/sky/examples/raw/shadow.dart b/sky/examples/raw/shadow.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a83602e88d4dc0fbbd7634f656a7c042805f135b |
--- /dev/null |
+++ b/sky/examples/raw/shadow.dart |
@@ -0,0 +1,34 @@ |
+// 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. |
+ |
+import 'dart:sky'; |
+ |
+void beginFrame(double timeStamp) { |
+ var size = 100.0; |
+ PictureRecorder canvas = new PictureRecorder(view.width, view.height); |
+ canvas.translate(size + 10.0, size + 10.0); |
+ |
+ Paint paint = new Paint(); |
+ paint.setARGB(255, 0, 255, 0); |
+ var builder = new LayerDrawLooperBuilder() |
+ // Shadow layer. |
+ ..addLayerOnTop( |
+ new DrawLooperLayerInfo()..setOffset(5.0, 5.0)..setColorMode(5), |
+ (Paint layerPaint) { |
+ layerPaint.setARGB(128, 55, 55, 55); |
+ // TODO(mpcomplete): add blur filter |
+ }) |
+ // Main layer. |
+ ..addLayerOnTop(new DrawLooperLayerInfo(), (Paint) {}); |
+ paint.setDrawLooper(builder.build()); |
+ |
+ canvas.drawPaint(new Paint()..setARGB(255, 255, 255, 255)); |
+ canvas.drawRect(new Rect.fromLTRB(-size, -size, size, size), paint); |
+ view.picture = canvas.endRecording(); |
+} |
+ |
+void main() { |
+ view.setBeginFrameCallback(beginFrame); |
+ view.scheduleFrame(); |
+} |