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

Unified Diff: ui/gfx/color_utils.h

Issue 12335009: Implementation of principal-component color reduction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/color_utils.cc » ('j') | ui/gfx/color_utils.cc » ('J')
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 1beb7c6b12a672261d3cb1ace5ba6ef214c7b684..044526b37cb54e1bb972f3c17e50b7d495327f42 100644
--- a/ui/gfx/color_utils.h
+++ b/ui/gfx/color_utils.h
@@ -8,6 +8,8 @@
#include "base/basictypes.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/ui_export.h"
+#include "ui/gfx/rect.h"
+#include "ui/gfx/vector3d_f.h"
class SkBitmap;
@@ -77,6 +79,26 @@ UI_EXPORT SkColor InvertColor(SkColor color);
// Gets a Windows system color as a SkColor
UI_EXPORT SkColor GetSysSkColor(int which);
+// Apply a color reduction transform defined by |color_transform| vector to
+// |source_bitmap|. The result is put into |target_bitmap|, which is expected
+// to be initialized to the required size and type (SkBitmap::kA8_Config).
+// If |scale_result|, result is linearly scalled to fit 0-0xFF range. Otherwise,
+// data is clipped to fit the range.
+// Returns the effective processed range.
Alexei Svitkine (slow) 2013/02/21 16:49:59 Can the comment elaborate more on what "the effect
motek. 2013/02/21 18:38:43 Changed the return type, this whole idea wasn't an
+UI_EXPORT gfx::Rect ApplyColorReduction(const SkBitmap& source_bitmap,
+ const gfx::Vector3dF& color_transform,
+ bool scale_result,
+ SkBitmap* target_bitmap);
+
+// Compute a monochrome image representing the principal color component of
+// the |source_bitmap|. The result is stored in |target_bitmap|, which must be
+// initialized to the required size and type (SkBitmap::kA8_Config).
Alexei Svitkine (slow) 2013/02/21 16:49:59 Why not have the function do the initialization of
motek. 2013/02/21 18:38:43 In processing images it is generally expected that
+// Returns true if the conversion succeeded. Note that there might be legitimate
+// reasons for the process to fail even if all input was correct. This is a
+// condition the caller must be able to handle.
+UI_EXPORT bool ComputePrincipalComponentImage(const SkBitmap& source_bitmap,
+ SkBitmap* target_bitmap);
+
} // namespace color_utils
#endif // UI_GFX_COLOR_UTILS_H_
« no previous file with comments | « no previous file | ui/gfx/color_utils.cc » ('j') | ui/gfx/color_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698