[3/10] gdiplus: added GdipRotateMatrix [try2]
Evan Stade
estade at gmail.com
Wed Jul 18 21:38:43 CDT 2007
Hi,
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/matrix.c | 28 ++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
3 files changed, 30 insertions(+), 1 deletions(-)
--
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 60e623c..e4166e7 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -466,7 +466,7 @@
@ stdcall GdipRestoreGraphics(ptr long)
@ stub GdipReversePath
@ stub GdipRotateLineTransform
-@ stub GdipRotateMatrix
+@ stdcall GdipRotateMatrix(ptr long long)
@ stub GdipRotatePathGradientTransform
@ stub GdipRotatePenTransform
@ stub GdipRotateTextureTransform
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
index b9aa761..2b24ee9 100644
--- a/dlls/gdiplus/matrix.c
+++ b/dlls/gdiplus/matrix.c
@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
+#include <math.h>
#include "windef.h"
#include "winbase.h"
@@ -93,6 +94,33 @@ GpStatus WINGDIPAPI GdipMultiplyMatrix(G
return Ok;
}
+GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle,
+ GpMatrixOrder order)
+{
+ REAL cos_theta, sin_theta, rotate[6];
+
+ if(!matrix)
+ return InvalidParameter;
+
+ memset(rotate, 0, 6 * sizeof(REAL));
+
+ angle = deg2rad(angle);
+ cos_theta = cos(angle);
+ sin_theta = sin(angle);
+
+ rotate[0] = cos_theta;
+ rotate[1] = sin_theta;
+ rotate[2] = -sin_theta;
+ rotate[3] = cos_theta;
+
+ if(order == MatrixOrderAppend)
+ matrix_multiply(matrix->matrix, rotate, matrix->matrix);
+ else
+ matrix_multiply(rotate, matrix->matrix, matrix->matrix);
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY,
GpMatrixOrder order)
{
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 09e5a09..b0c9840 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -88,6 +88,7 @@ GpStatus WINGDIPAPI GdipTransformPath(Gp
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder);
+GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix*,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);
--
1.4.1
More information about the wine-patches
mailing list