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

Unified Diff: ui/gfx/color_analysis.h

Issue 2690513002: Port Android palette API for deriving a prominent color from an image. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | ui/gfx/color_analysis.cc » ('j') | ui/gfx/color_analysis.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_analysis.h
diff --git a/ui/gfx/color_analysis.h b/ui/gfx/color_analysis.h
index 7ac91464e1890b06b8c2c955d7fbb29b28e7ecc3..ec0e2b0bdd80a73a8031190b18b955abfd2f7edd 100644
--- a/ui/gfx/color_analysis.h
+++ b/ui/gfx/color_analysis.h
@@ -108,6 +108,27 @@ GFX_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap,
// for |lower_bound|, |upper_bound| and |sampler|.
GFX_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap);
+// Color flags.
+enum ColorFlags {
+ // Luminosity.
+ LIGHT = 1,
+ NORMAL = 1 << 1,
+ DARK = 1 << 2,
+ // Saturation.
+ VIBRANT = 1 << 3,
+ MUTED = 1 << 4,
+};
+
+// Returns a single RGB color that represents the bitmap. |color_profile| is a
+// bitwise combination of ColorFlags values (precisely one from each category
+// should be used). If a value is succesfully calculated, the return value is
sadrul 2017/02/10 19:36:44 I think it'd be better to use two different enums,
Evan Stade 2017/02/13 19:01:13 Done.
+// fully opaque. For failure, the return value is transparent. This currently
+// calculates one color at a time. We could save computation by calculating
+// multiple colors at once, but there's currently no need to calculate multiple
+// colors.
+GFX_EXPORT SkColor CalculateProminentColorOfBitmap(const SkBitmap& bitmap,
+ int color_profile);
+
// Compute color covariance matrix for the input bitmap.
GFX_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap);
« no previous file with comments | « no previous file | ui/gfx/color_analysis.cc » ('j') | ui/gfx/color_analysis.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698