Index: include/core/SkShader.h |
diff --git a/include/core/SkShader.h b/include/core/SkShader.h |
index 4f3fd29693a8ce56096c528017b0416115abb7d0..92883f0afbdda7905c2e7837a0246ad2578c152d 100644 |
--- a/include/core/SkShader.h |
+++ b/include/core/SkShader.h |
@@ -386,6 +386,16 @@ public: |
const SkMatrix* localMatrixOrNull, GrColor* paintColor, |
GrEffect** effect) const; |
+ /** |
+ * If the shader can represent its "average" luminance in a single color, return true and |
+ * if color is not NULL, return that color. If it cannot, return false and ignore the color |
+ * parameter. |
+ * |
+ * Note: if this returns true, the returned color will always be opaque, as only the RGB |
+ * components are used to compute luminance. |
+ */ |
+ bool asLuminanceColor(SkColor*) const; |
+ |
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
/** |
* If the shader is a custom shader which has data the caller might want, call this function |
@@ -472,6 +482,9 @@ protected: |
*/ |
virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
+ virtual bool onAsLuminanceColor(SkColor*) const { |
+ return false; |
+ } |
private: |
// This is essentially const, but not officially so it can be modified in |
// constructors. |