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

Unified Diff: ui/gfx/color_utils.h

Issue 289283004: Add ability to constrain dominant color selection to a HSL range. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove C++11 features Created 6 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 | « ui/gfx/color_analysis_unittest.cc ('k') | ui/gfx/color_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_utils.h
diff --git a/ui/gfx/color_utils.h b/ui/gfx/color_utils.h
index 6dd6300aa3bab7abdaaab1cbab3e15a3f1fbae22..9446654cdbedd27c40e93fd3ddcbe34d725f7c67 100644
--- a/ui/gfx/color_utils.h
+++ b/ui/gfx/color_utils.h
@@ -29,6 +29,20 @@ GFX_EXPORT double RelativeLuminance(SkColor color);
GFX_EXPORT void SkColorToHSL(SkColor c, HSL* hsl);
GFX_EXPORT SkColor HSLToSkColor(const HSL& hsl, SkAlpha alpha);
+// Determines whether the given |hsl| falls within the given range for each
+// component. All components of |hsl| are expected to be in the range [0, 1].
+//
+// If a component is negative in either |lower_bound| or |upper_bound|, that
+// component will be ignored.
+//
+// For hue, the lower bound should be in the range [0, 1] and the upper bound
+// should be in the range [(lower bound), (lower bound + 1)].
+// For saturation and value, bounds should be specified in the range [0, 1],
+// with the lower bound less than the upper bound.
+GFX_EXPORT bool IsWithinHSLRange(const HSL& hsl,
+ const HSL& lower_bound,
+ const HSL& upper_bound);
+
// 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
« no previous file with comments | « ui/gfx/color_analysis_unittest.cc ('k') | ui/gfx/color_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698