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

Unified Diff: sky/engine/core/painting/MaskFilter.dart

Issue 1162843003: Add a MaskFilter interface to dart:sky to handle blur. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: . 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
Index: sky/engine/core/painting/MaskFilter.dart
diff --git a/sky/engine/core/painting/MaskFilter.dart b/sky/engine/core/painting/MaskFilter.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c7014509bac72f29d91c4b5570f41c2fc84f769b
--- /dev/null
+++ b/sky/engine/core/painting/MaskFilter.dart
@@ -0,0 +1,27 @@
+// 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.
+
+// Extends the generated _MaskFilter interface via the CustomDart attribute.
+
eseidel 2015/06/02 20:49:45 Do we need "part dart:sky" lines at the top of the
Matt Perry 2015/06/02 21:03:42 Not for this one - CustomDart files are appended t
+/// Blur styles. These mirror SkBlurStyle and must be kept in sync.
+enum BlurStyle {
+ normal, /// Fuzzy inside and outside.
eseidel 2015/06/02 20:49:45 Is this the correct Dart enum naming style?
Matt Perry 2015/06/02 21:03:42 According to https://www.dartlang.org/articles/sty
+ solid, /// Solid inside, fuzzy outside.
+ outer, /// Nothing inside, fuzzy outside.
+ inner, /// Fuzzy inside, nothing outside.
+}
+
+class MaskFilter extends _MaskFilter {
+ MaskFilter.Blur(BlurStyle style, double sigma,
+ {bool ignoreTransform: false, bool highQuality: false})
+ : super(style.index, sigma, _makeBlurFlags(ignoreTransform, highQuality));
+
+ // Convert constructor parameters to the SkBlurMaskFilter::BlurFlags type.
+ static int _makeBlurFlags(bool ignoreTransform, bool highQuality) {
+ int flags = 0;
+ if (ignoreTransform) flags |= 0x01;
+ if (highQuality) flags |= 0x02;
+ return flags;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698