diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-11 14:47:03 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-11 14:47:03 +0000 |
commit | 880dc472ab2c987083db9eb83efb2930787f0b26 (patch) | |
tree | e890f6d4e1ba57e0efbf7c3f91d3e04bc5af122b /include/core | |
parent | 458849004892c05fa1dcbcf6d355dfcce028d77a (diff) |
add dox for Shaders, and how the paint's alpha modulates the shader's colors.
git-svn-id: http://skia.googlecode.com/svn/trunk@3909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPaint.h | 23 | ||||
-rw-r--r-- | include/core/SkShader.h | 11 |
2 files changed, 22 insertions, 12 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index b4ea89413d..54e12ffa4f 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -484,14 +484,21 @@ public: SkShader* getShader() const { return fShader; } /** Set or clear the shader object. - <p /> - Pass NULL to clear any previous shader. - As a convenience, the parameter passed is also returned. - If a previous shader exists, its reference count is decremented. - If shader is not NULL, its reference count is incremented. - @param shader May be NULL. The shader to be installed in the paint - @return shader - */ + * Shaders specify the source color(s) for what is being drawn. If a paint + * has no shader, then the paint's color is used. If the paint has a + * shader, then the shader's color(s) are use instead, but they are + * modulated by the paint's alpha. This makes it easy to create a shader + * once (e.g. bitmap tiling or gradient) and then change its transparency + * w/o having to modify the original shader... only the paint's alpha needs + * to be modified. + * <p /> + * Pass NULL to clear any previous shader. + * As a convenience, the parameter passed is also returned. + * If a previous shader exists, its reference count is decremented. + * If shader is not NULL, its reference count is incremented. + * @param shader May be NULL. The shader to be installed in the paint + * @return shader + */ SkShader* setShader(SkShader* shader); /** Get the paint's colorfilter. If there is a colorfilter, its reference diff --git a/include/core/SkShader.h b/include/core/SkShader.h index c48c36998b..0fb6454408 100644 --- a/include/core/SkShader.h +++ b/include/core/SkShader.h @@ -20,10 +20,13 @@ class SkPath; /** \class SkShader * - * SkShader is the based class for objects that return horizontal spans of - * colors during drawing. A subclass of SkShader is installed in a SkPaint - * calling paint.setShader(shader). After that any object (other than a bitmap) - * that is drawn with that paint will get its color(s) from the shader. + * Shaders specify the source color(s) for what is being drawn. If a paint + * has no shader, then the paint's color is used. If the paint has a + * shader, then the shader's color(s) are use instead, but they are + * modulated by the paint's alpha. This makes it easy to create a shader + * once (e.g. bitmap tiling or gradient) and then change its transparency + * w/o having to modify the original shader... only the paint's alpha needs + * to be modified. */ class SK_API SkShader : public SkFlattenable { public: |