summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils.h
diff options
context:
space:
mode:
authorglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-09 01:07:42 +0000
committerglen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-09 01:07:42 +0000
commit4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f (patch)
tree69a1e9f78b3a5fa8b909cfab336826b09c44235f /skia/ext/skia_utils.h
parent5085ee0b4bfbe4625e63ee6975bb95702e13e0aa (diff)
downloadchromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.zip
chromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.tar.gz
chromium_src-4a19063d1459a4c9c8c4c50ed86eb9048f69ea3f.tar.bz2
This is the first pass at themes.
This CL is paired with http://codereview.chromium.org/67284 This CL (for commit purposes) includes http://codereview.chromium.org/67284 BUG=4463,11232,11233,11234,11235 Review URL: http://codereview.chromium.org/99030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15704 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/skia_utils.h')
-rw-r--r--skia/ext/skia_utils.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/skia/ext/skia_utils.h b/skia/ext/skia_utils.h
index 98fa1b0..0f61b18 100644
--- a/skia/ext/skia_utils.h
+++ b/skia/ext/skia_utils.h
@@ -10,6 +10,12 @@
namespace skia {
+struct HSL {
+ double h;
+ double s;
+ double l;
+};
+
// Creates a vertical gradient shader. The caller owns the shader.
// Example usage to avoid leaks:
// paint.setShader(gfx::CreateGradientShader(0, 10, red, blue))->safeUnref();
@@ -22,10 +28,27 @@ SkShader* CreateGradientShader(int start_point,
SkColor end_color);
// Convert a premultiplied SkColor to a HSL value.
-void SkColorToHSL(SkPMColor c, float hsl[3]);
+void SkColorToHSL(SkPMColor c, HSL& hsl);
// Convert a HSL color to a premultiplied SkColor.
-SkPMColor HSLToSKColor(U8CPU alpha, float hsl[3]);
+SkPMColor HSLToSKColor(U8CPU alpha, HSL hsl);
+
+// Shift an HSL value. The shift values are in the range of 0-1,
+// with the option to specify -1 for 'no change'. The shift values are
+// defined as:
+// hsl_shift[0] (hue): The absolute hue value - 0 and 1 map
+// to 0 and 360 on the hue color wheel (red).
+// hsl_shift[1] (saturation): A saturation shift, with the
+// following key values:
+// 0 = remove all color.
+// 0.5 = leave unchanged.
+// 1 = fully saturate the image.
+// hsl_shift[2] (lightness): A lightness shift, with the
+// following key values:
+// 0 = remove all lightness (make all pixels black).
+// 0.5 = leave unchanged.
+// 1 = full lightness (make all pixels white).
+SkColor HSLShift(skia::HSL hsl, skia::HSL shift);
} // namespace skia