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

Unified Diff: include/effects/SkGradientShader.h

Issue 15893002: Add flag to gradients to interpolate colors in premul space. Experimental API to encapsulate the sh… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | « include/core/SkShader.h ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/effects/SkGradientShader.h
diff --git a/include/effects/SkGradientShader.h b/include/effects/SkGradientShader.h
index dbeb2fb069818b4e9dab862bd66cb2aecb3a6f51..ed0f1bf75b5454e5809fbfb1f09449d881b71110 100644
--- a/include/effects/SkGradientShader.h
+++ b/include/effects/SkGradientShader.h
@@ -1,4 +1,3 @@
-
/*
* Copyright 2006 The Android Open Source Project
*
@@ -6,7 +5,6 @@
* found in the LICENSE file.
*/
-
#ifndef SkGradientShader_DEFINED
#define SkGradientShader_DEFINED
@@ -21,6 +19,15 @@ class SkUnitMapper;
*/
class SK_API SkGradientShader {
public:
+ enum Flags {
+ /** By default gradients will interpolate their colors in unpremul space
+ * and then premultiply each of the results. By setting this flag, the
+ * gradients will premultiply their colors first, and then interpolate
+ * between them.
+ */
+ kInterpolateColorsInPremul_Flag = 1 << 0,
+ };
+
/** Returns a shader that generates a linear gradient between the two
specified points.
<p />
@@ -38,10 +45,11 @@ public:
@param mode The tiling mode
@param mapper May be NULL. Callback to modify the spread of the colors.
*/
- static SkShader* CreateLinear( const SkPoint pts[2],
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkUnitMapper* mapper = NULL);
+ static SkShader* CreateLinear(const SkPoint pts[2],
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0);
/** Returns a shader that generates a radial gradient given the center and radius.
<p />
@@ -60,10 +68,11 @@ public:
@param mode The tiling mode
@param mapper May be NULL. Callback to modify the spread of the colors.
*/
- static SkShader* CreateRadial( const SkPoint& center, SkScalar radius,
- const SkColor colors[], const SkScalar pos[], int count,
- SkShader::TileMode mode,
- SkUnitMapper* mapper = NULL);
+ static SkShader* CreateRadial(const SkPoint& center, SkScalar radius,
+ const SkColor colors[], const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0);
/** Returns a shader that generates a radial gradient given the start position, start radius, end position and end radius.
<p />
@@ -92,7 +101,8 @@ public:
const SkColor colors[],
const SkScalar pos[], int count,
SkShader::TileMode mode,
- SkUnitMapper* mapper = NULL);
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0);
/**
* Returns a shader that generates a conical gradient given two circles, or
@@ -101,13 +111,14 @@ public:
* 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);
+ SkScalar startRadius,
+ const SkPoint& end,
+ SkScalar endRadius,
+ const SkColor colors[],
+ const SkScalar pos[], int count,
+ SkShader::TileMode mode,
+ SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0);
/** Returns a shader that generates a sweep gradient given a center.
<p />
@@ -127,7 +138,8 @@ public:
*/
static SkShader* CreateSweep(SkScalar cx, SkScalar cy,
const SkColor colors[], const SkScalar pos[],
- int count, SkUnitMapper* mapper = NULL);
+ int count, SkUnitMapper* mapper = NULL,
+ uint32_t flags = 0);
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};
« no previous file with comments | « include/core/SkShader.h ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698