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

Unified Diff: ui/gfx/color_analysis.h

Issue 291653004: Add extra overloads for color analysis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits 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 | « no previous file | ui/gfx/color_analysis.cc » ('j') | no next file with comments »
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 dcbfabc9d7757d20ee6e0cf8f26c986fe5fd843f..3b5ebe85f398d47ef1fe1ffe026d9b890878a49f 100644
--- a/ui/gfx/color_analysis.h
+++ b/ui/gfx/color_analysis.h
@@ -52,10 +52,10 @@ class GFX_EXPORT GridSampler : public KMeanImageSampler {
GFX_EXPORT SkColor FindClosestColor(const uint8_t* image, int width, int height,
SkColor color);
-// Returns an SkColor that represents the calculated dominant color in the png.
-// This uses a KMean clustering algorithm to find clusters of pixel colors in
-// RGB space.
-// |png| represents the data of a png encoded image.
+// Returns an SkColor that represents the calculated dominant color in the
+// image. This uses a KMean clustering algorithm to find clusters of pixel
+// colors in RGB space.
+// |png|/|bitmap| represents the data of a png/bitmap encoded image.
// |darkness_limit| represents the minimum sum of the RGB components that is
// acceptable as a color choice. This can be from 0 to 765.
// |brightness_limit| represents the maximum sum of the RGB components that is
@@ -94,9 +94,19 @@ GFX_EXPORT SkColor CalculateKMeanColorOfPNG(
uint32_t darkness_limit,
uint32_t brightness_limit,
KMeanImageSampler* sampler);
-
-// Computes a dominant color for an SkBitmap using the above algorithm and
-// reasonable defaults for |darkness_limit|, |brightness_limit| and |sampler|.
+// Computes a dominant color using the above algorithm and reasonable defaults
+// for |darkness_limit|, |brightness_limit| and |sampler|.
+GFX_EXPORT SkColor CalculateKMeanColorOfPNG(
+ scoped_refptr<base::RefCountedMemory> png);
+
+// Returns an SkColor that represents the calculated dominant color in the
+// image. See CalculateKMeanColorOfPNG() for details.
+GFX_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap,
+ uint32_t darkness_limit,
+ uint32_t brightness_limit,
+ KMeanImageSampler* sampler);
+// Computes a dominant color using the above algorithm and reasonable defaults
+// for |darkness_limit|, |brightness_limit| and |sampler|.
GFX_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap);
// Compute color covariance matrix for the input bitmap.
« no previous file with comments | « no previous file | ui/gfx/color_analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698