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

Side by Side Diff: ui/gfx/color_analysis.h

Issue 12335009: Implementation of principal-component color reduction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved to another fileset to make iOS build happy. Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/color_analysis.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_COLOR_ANALYSIS_H_ 5 #ifndef UI_GFX_COLOR_ANALYSIS_H_
6 #define UI_GFX_COLOR_ANALYSIS_H_ 6 #define UI_GFX_COLOR_ANALYSIS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 uint32_t brightness_limit, 95 uint32_t brightness_limit,
96 KMeanImageSampler* sampler); 96 KMeanImageSampler* sampler);
97 97
98 // Computes a dominant color for an SkBitmap using the above algorithm and 98 // Computes a dominant color for an SkBitmap using the above algorithm and
99 // reasonable defaults for |darkness_limit|, |brightness_limit| and |sampler|. 99 // reasonable defaults for |darkness_limit|, |brightness_limit| and |sampler|.
100 UI_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap); 100 UI_EXPORT SkColor CalculateKMeanColorOfBitmap(const SkBitmap& bitmap);
101 101
102 // Compute color covariance matrix for the input bitmap. 102 // Compute color covariance matrix for the input bitmap.
103 UI_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap); 103 UI_EXPORT gfx::Matrix3F ComputeColorCovariance(const SkBitmap& bitmap);
104 104
105 // Apply a color reduction transform defined by |color_transform| vector to
106 // |source_bitmap|. The result is put into |target_bitmap|, which is expected
107 // to be initialized to the required size and type (SkBitmap::kA8_Config).
108 // If |fit_to_range|, result is transfored linearly to fit 0-0xFF range.
109 // Otherwise, data is clipped.
110 // Returns true if the target has been computed.
111 UI_EXPORT bool ApplyColorReduction(const SkBitmap& source_bitmap,
112 const gfx::Vector3dF& color_transform,
113 bool fit_to_range,
114 SkBitmap* target_bitmap);
115
116 // Compute a monochrome image representing the principal color component of
117 // the |source_bitmap|. The result is stored in |target_bitmap|, which must be
118 // initialized to the required size and type (SkBitmap::kA8_Config).
119 // Returns true if the conversion succeeded. Note that there might be legitimate
120 // reasons for the process to fail even if all input was correct. This is a
121 // condition the caller must be able to handle.
122 UI_EXPORT bool ComputePrincipalComponentImage(const SkBitmap& source_bitmap,
123 SkBitmap* target_bitmap);
124
105 } // namespace color_utils 125 } // namespace color_utils
106 126
107 #endif // UI_GFX_COLOR_ANALYSIS_H_ 127 #endif // UI_GFX_COLOR_ANALYSIS_H_
OLDNEW
« 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