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

Unified Diff: ui/gfx/color_utils.h

Issue 2182633012: Add Matrix4x3 and tristimulus class to color utiliies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added test Created 4 years, 5 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') | no next file with comments »
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 fc8b44652869e4d8c678aff83420c0db416f8f4e..4abe087f8f5d3ca5581059a81f3276ccaa4e61a1 100644
--- a/ui/gfx/color_utils.h
+++ b/ui/gfx/color_utils.h
@@ -12,6 +12,42 @@ class SkBitmap;
namespace color_utils {
+// Tristimulus value, RGB, XYZ,, HSV, YUV, etc.
+struct GFX_EXPORT TriStim {
+ TriStim() {
+ values[0] = 0.0f;
+ values[1] = 0.0f;
+ values[2] = 0.0f;
+ }
+ TriStim(float a, float b, float c) {
+ values[0] = a;
+ values[1] = b;
+ values[2] = c;
+ }
+ float values[3];
+};
+
+// The fourth row is always 0,0,0,1
+struct GFX_EXPORT Matrix4x3 {
+ // Defaults to unity matrix.
+ Matrix4x3();
+
+ // Matrix multiplication.
+ Matrix4x3 operator*(const Matrix4x3& other) const;
+
+ // Color mapping.
+ TriStim operator*(const TriStim& color) const;
+
+ // Invert matrix.
+ Matrix4x3 Invert() const;
+
+ // Lookup, makes it look like the fourth row is there.
+ float lookup(int row, int col) const;
+
+ typedef float Quad[4];
+ Quad rows[3];
+};
+
// Represents an HSL color.
struct HSL {
double h;
« no previous file with comments | « no previous file | ui/gfx/color_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698