From cb7be694c31f833c00a0dfb3529aaead3a4db62d Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Wed, 6 Jun 2012 20:31:56 +0000 Subject: 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 --- include/effects/SkGradientShader.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') 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.

CreateSweep returns a shader with a reference count of 1. -- cgit v1.2.3