Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: sky/examples/raw/shadow.dart

Issue 1158693005: Add an API to set the ColorFilter on a Paint object. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: abarth Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/examples/raw/painting.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « sky/examples/raw/painting.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698