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

Unified Diff: sky/sdk/lib/framework/painting/shadows.dart

Issue 1175683002: Add a shadow to the FloatingActionButton. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: moved to painting/ Created 5 years, 6 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
Index: sky/sdk/lib/framework/painting/shadows.dart
diff --git a/sky/sdk/lib/framework/painting/shadows.dart b/sky/sdk/lib/framework/painting/shadows.dart
new file mode 100644
index 0000000000000000000000000000000000000000..06821118532d562738cc412c6e7db10dcc9ff8db
--- /dev/null
+++ b/sky/sdk/lib/framework/painting/shadows.dart
@@ -0,0 +1,31 @@
+// 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' as sky;
+
+/// Helper class to build a Paint DrawLooper that adds shadows to the Paint's
+/// operation.
+class ShadowDrawLooperBuilder {
+ var builder_ = new sky.LayerDrawLooperBuilder();
+
+ void addShadow(sky.Size offset, sky.Color color, double blur) {
+ builder_.addLayerOnTop(
+ new sky.DrawLooperLayerInfo()
+ ..setPaintBits(-1)
+ ..setOffset(offset.toPoint())
+ ..setColorMode(sky.TransferMode.srcMode),
+ (sky.Paint layerPaint) {
+ layerPaint.color = color;
+ layerPaint.setMaskFilter(
+ new sky.MaskFilter.Blur(sky.BlurStyle.normal,
+ blur,
+ highQuality: true));
+ });
+ }
+
+ sky.DrawLooper build() {
+ builder_.addLayerOnTop(new sky.DrawLooperLayerInfo(), (_) {});
+ return builder_.build();
+ }
+}
« no previous file with comments | « sky/sdk/lib/framework/components2/floating_action_button.dart ('k') | sky/sdk/lib/framework/rendering/box.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698