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; |