diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-06 20:31:56 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-06 20:31:56 +0000 |
commit | cb7be694c31f833c00a0dfb3529aaead3a4db62d (patch) | |
tree | 41bf84b12e7b0e128cb5b75f21abb037ca3f2cff /include | |
parent | d895b055a05992f5575fee08f0e1ccfe167b0f94 (diff) |
Add new gradient to support HTML Canvas2D two-point-radial-gradient. Ours is
called (for now at least) TwoPointConical, to distinguish it from the
existing one (TwoPointRadial), and to reflect its odd behavior where it draws
transparent outside the boundary of the "cone" between the two circles.
This impl is unsupported by GPU and Printing at the moment, and Chrome does not
yet invoke it.
Review URL: https://codereview.appspot.com/6299051
git-svn-id: http://skia.googlecode.com/svn/trunk@4197 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/effects/SkGradientShader.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h index 427b3da35c..748abd1801 100644 --- a/include/effects/SkGradientShader.h +++ b/include/effects/SkGradientShader.h @@ -93,6 +93,22 @@ public: const SkScalar pos[], int count, SkShader::TileMode mode, SkUnitMapper* mapper = NULL); + + /** + * Returns a shader that generates a conical gradient given two circles, or + * returns NULL if the inputs are invalid. The gradient interprets the + * two circles according to the following HTML spec. + * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient + */ + static SkShader* CreateTwoPointConical(const SkPoint& start, + SkScalar startRadius, + const SkPoint& end, + SkScalar endRadius, + const SkColor colors[], + const SkScalar pos[], int count, + SkShader::TileMode mode, + SkUnitMapper* mapper = NULL); + /** Returns a shader that generates a sweep gradient given a center. <p /> CreateSweep returns a shader with a reference count of 1. |