summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'skia/ext/skia_utils.h')
-rw-r--r--skia/ext/skia_utils.h34
1 files changed, 31 insertions, 3 deletions
diff --git a/skia/ext/skia_utils.h b/skia/ext/skia_utils.h
index 52d9d62..769d9d4 100644
--- a/skia/ext/skia_utils.h
+++ b/skia/ext/skia_utils.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,11 +6,16 @@
#define SKIA_EXT_SKIA_UTILS_H_
#include "third_party/skia/include/core/SkColor.h"
-
-class SkShader;
+#include "third_party/skia/include/core/SkShader.h"
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();
@@ -21,6 +26,29 @@ SkShader* CreateGradientShader(int start_point,
int end_point,
SkColor start_color,
SkColor end_color);
+
+// Convert an SkColor to a HSL value.
+void SkColorToHSL(SkColor c, HSL& hsl);
+
+// Convert a HSL color to an SkColor.
+SkColor HSLToSkColor(U8CPU alpha, HSL hsl);
+
+// HSL-Shift an SkColor. 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(SkColor color, skia::HSL shift);
+
} // namespace skia
#endif // SKIA_EXT_SKIA_UTILS_H_