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

Unified Diff: include/effects/SkLumaColorFilter.h

Issue 25453004: Luminance-to-alpha color filter (SkLumaColorFilter). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Added test & more docs. Created 7 years, 2 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 | « gyp/public_headers.gypi ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkLumaColorFilter.h
diff --git a/include/effects/SkLumaColorFilter.h b/include/effects/SkLumaColorFilter.h
new file mode 100644
index 0000000000000000000000000000000000000000..fef06ab12ad7009563aee458948a9822f1c6c1e8
--- /dev/null
+++ b/include/effects/SkLumaColorFilter.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkLumaColorFilter_DEFINED
+#define SkLumaColorFilter_DEFINED
+
+#include "SkColorFilter.h"
+
+/**
+ * Luminance-to-alpha color filter, as defined in
+ * http://www.w3.org/TR/SVG/masking.html#Masking
+ * http://www.w3.org/TR/css-masking/#MaskValues
+ *
+ * Each color is scaled by the (unpremultiplied) luminance value:
+ *
+ * C' = [Lum * a, Lum * r, Lum * g, Lum * b]
+ *
+ */
+class SK_API SkLumaColorFilter : public SkColorFilter {
+public:
+ static SkColorFilter* Create();
+
+ virtual void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const SK_OVERRIDE;
+
+#if SK_SUPPORT_GPU
+ virtual GrEffectRef* asNewEffect(GrContext*) const SK_OVERRIDE;
+#endif
+
+ SkDEVCODE(virtual void toString(SkString* str) const SK_OVERRIDE;)
+ SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaColorFilter)
+
+protected:
+ SkLumaColorFilter(SkFlattenableReadBuffer& buffer);
+ virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+
+private:
+ SkLumaColorFilter();
+
+ typedef SkColorFilter INHERITED;
+};
+
+#endif
« no previous file with comments | « gyp/public_headers.gypi ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698