Index: ui/gfx/transform_util.h |
diff --git a/ui/gfx/transform_util.h b/ui/gfx/transform_util.h |
index b6da7b0782d3b63d461fa685912bff11b0c8cfda..b1e59efcc7c7344febdda6811b88a4d3756394f2 100644 |
--- a/ui/gfx/transform_util.h |
+++ b/ui/gfx/transform_util.h |
@@ -46,11 +46,45 @@ UI_EXPORT bool BlendDecomposedTransforms(DecomposedTransform* out, |
UI_EXPORT bool DecomposeTransform(DecomposedTransform* out, |
const Transform& transform); |
+// Set 3rd row and 3rd colum to (0, 0, 1, 0). Note that this flattening |
+// operation is not quite the same as an orthographic projection and is |
+// technically not a linear operation. |
+// |
+// One useful interpretation of doing this operation: |
+// - For x and y values, the new transform behaves effectively like an |
+// orthographic projection was added to the matrix sequence. |
+// - For z values, the new transform overrides any effect that the transform |
+// had on z, and instead it preserves the z value for any points that are |
+// transformed. |
+// - Because of linearity of transforms, this flattened transform also |
+// preserves the effect that any subsequent (multiplied from the right) |
+// transforms would have on z values. |
+// |
+UI_EXPORT void FlattenTransformTo2d(gfx::Transform& transform); |
danakj
2013/01/07 23:22:35
Why not a member of Transform?
shawnsingh
2013/01/07 23:59:53
No strong reason; I'll move it into class.
|
+ |
// Composes a transform from the given translation, scale, skew, prespective, |
// and rotation components following the routines detailed in this spec: |
// http://www.w3.org/TR/css3-3d-transforms/. |
UI_EXPORT Transform ComposeTransform(const DecomposedTransform& decomp); |
+// Constructs a transform from explicit 16 matrix elements. Elements should be |
+// given in column-major order. Recommended to use this only for unit tests. |
danakj
2013/01/07 23:22:35
Let's stick test-only things into test/
|
+UI_EXPORT Transform CreateGfxTransform( |
danakj
2013/01/07 23:22:35
The Gfx part is a bit redundant with the namespace
Ian Vollick
2013/01/08 00:41:21
How would you feel about adding some gfx::Transfor
|
+ double col1row1, double col1row2, double col1row3, double col1row4, |
+ double col2row1, double col2row2, double col2row3, double col2row4, |
+ double col3row1, double col3row2, double col3row3, double col3row4, |
+ double col4row1, double col4row2, double col4row3, double col4row4); |
+ |
+// Constructs a transform from explicit 2d elements. All other matrix elements |
+// remain the same as the corresponding elements of an identity matrix. |
+// Recommended to use this only for unit tests. |
+UI_EXPORT Transform CreateGfxTransform( |
+ double col1row1, double col1row2, double col2row1, |
+ double col2row2, double x_translation, double y_translation); |
+ |
+// Constructs a flattened version of the given transform. |
+UI_EXPORT Transform CreateFlattenedTransform(const Transform& transform); |
danakj
2013/01/07 23:22:35
Why are we breaking the pattern of always modifyin
shawnsingh
2013/01/07 23:59:53
not "breaking" so much as keeping status quo.... b
|
+ |
} // namespace gfx |
#endif // UI_GFX_TRANSFORM_UTIL_H_ |