[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - include/basegfx
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 1 14:19:56 UTC 2020
include/basegfx/matrix/b2dhommatrix.hxx | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
New commits:
commit 3ce519f41724fa4bd61e761b0442b21e6c65232a
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Mar 28 20:15:00 2020 +0100
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Wed Apr 1 16:19:24 2020 +0200
basegfx: add convenience access. and creator to B2DHomMatrix
In SVG, CSS, HTML Canvas it is usual to define a matrix with
a,b,c,d,e,f attributes, where the values correcpond to the
following:
[a,c,e]
[b,d,f]
[0,0,1]
This change adds accessors and creator to B2DHomMatrix, so it is
easier to deal with other matrices that are defined like that.
Change-Id: I6927513b1a70ad5eb70d7fe14a00de4a767f176a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91310
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
(cherry picked from commit cc7dc7552adb84dbd6954d01d2f347029d9302bc)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91450
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
diff --git a/include/basegfx/matrix/b2dhommatrix.hxx b/include/basegfx/matrix/b2dhommatrix.hxx
index 9f2c8a338412..0015b2a78fce 100644
--- a/include/basegfx/matrix/b2dhommatrix.hxx
+++ b/include/basegfx/matrix/b2dhommatrix.hxx
@@ -47,6 +47,33 @@ namespace basegfx
B2DHomMatrix(B2DHomMatrix&& rMat);
~B2DHomMatrix();
+ /** Convenience creator for declaration of the matrix that is commonly
+ used by web standards (SVG, CSS, HTML).
+
+ Values a,b,c,d,e,f represent the following values in the matrix:
+ [a,c,e] [a,c,e]
+ [b,d,f] or [b,d,f]
+ [0,0,1]
+
+ */
+ static B2DHomMatrix abcdef(double da, double db, double dc, double dd, double de, double df)
+ {
+ return B2DHomMatrix(da, dc, de, db, dd, df);
+ }
+
+ // Convenience accessor for value at 0,0 position in the matrix
+ double a() { return get(0,0); }
+ // Convenience accessor for value at 1,0 position in the matrix
+ double b() { return get(1,0); }
+ // Convenience accessor for value at 0,1 position in the matrix
+ double c() { return get(0,1); }
+ // Convenience accessor for value at 1,1 position in the matrix
+ double d() { return get(1,1); }
+ // Convenience accessor for value at 0,2 position in the matrix
+ double e() { return get(0,2); }
+ // Convenience accessor for value at 1,2 position in the matrix
+ double f() { return get(1,2); }
+
/** constructor to allow setting all needed values for a 3x2 matrix at once. The
parameter f_0x1 e.g. is the same as using set(0, 1, f)
*/
More information about the Libreoffice-commits
mailing list