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

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: make bounds inclusive, add saturation test 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
Index: ui/gfx/color_utils.h
diff --git a/ui/gfx/color_utils.h b/ui/gfx/color_utils.h
index 6dd6300aa3bab7abdaaab1cbab3e15a3f1fbae22..18bb2c218f287ae8f956b6b4d8942791ab4e19e5 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.
+//
+// Any components of |lower_bound| or |upper_bound| that are -1 will be
+// ignored.
Matt Giuca 2014/05/22 05:03:52 This could be construed as "the component will be
calamity 2014/05/22 07:36:36 Done.
+//
+// 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

Powered by Google App Engine
This is Rietveld 408576698