[m-rev.] [PATCH 09/11] mercury_cairo: Add matrix.unpack.
Peter Wang
novalazy at gmail.com
Fri Sep 4 12:00:57 AEST 2015
extras/graphics/mercury_cairo/cairo.matrix.m:
Add `matrix.unpack' to return the components of a matrix.
---
extras/graphics/mercury_cairo/cairo.matrix.m | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/extras/graphics/mercury_cairo/cairo.matrix.m b/extras/graphics/mercury_cairo/cairo.matrix.m
index fbd09e3..e78c95b 100644
--- a/extras/graphics/mercury_cairo/cairo.matrix.m
+++ b/extras/graphics/mercury_cairo/cairo.matrix.m
@@ -87,6 +87,12 @@
%
:- pred multiply(matrix::in, matrix::in, matrix::in, io::di, io::uo) is det.
+ % matrix.unpack(Matrix, XX, YX, XY, YY, X0, Y0, !IO):
+ % Return the six components of Matrix.
+ %
+:- pred unpack(matrix::in, float::out, float::out, float::out, float::out,
+ float::out, float::out, io::di, io::uo) is det.
+
% matrix.transform_distance(Matrix, Dx0, Dy0, Dx, Dy, !IO):
% Transforms the distance vector (Dx0, Dy0) by Matrix.
%
@@ -211,6 +217,19 @@ invert(Matrix, !IO) :-
").
:- pragma foreign_proc("C",
+ unpack(Matrix::in, Xx::out, Yx::out, Xy::out, Yy::out, X0::out, Y0::out,
+ _IO0::di, _IO::uo),
+ [promise_pure, will_not_call_mercury],
+"
+ Xx = Matrix->xx;
+ Yx = Matrix->yx;
+ Xy = Matrix->xy;
+ Yy = Matrix->yy;
+ X0 = Matrix->x0;
+ Y0 = Matrix->y0;
+").
+
+:- pragma foreign_proc("C",
transform_distance(Matrix::in, Dx0::in, Dy0::in, Dx::out, Dy::out,
_IO0::di, _IO::uo),
[promise_pure, will_not_call_mercury],
--
2.1.2
More information about the reviews
mailing list