gdiplus: Added GdipRotateMatrix.

This commit is contained in:
Evan Stade 2007-07-19 18:22:26 -07:00 committed by Alexandre Julliard
parent 477874797c
commit eb478be84c
3 changed files with 30 additions and 1 deletions

View File

@ -466,7 +466,7 @@
@ stdcall GdipRestoreGraphics(ptr long) @ stdcall GdipRestoreGraphics(ptr long)
@ stub GdipReversePath @ stub GdipReversePath
@ stub GdipRotateLineTransform @ stub GdipRotateLineTransform
@ stub GdipRotateMatrix @ stdcall GdipRotateMatrix(ptr long long)
@ stub GdipRotatePathGradientTransform @ stub GdipRotatePathGradientTransform
@ stub GdipRotatePenTransform @ stub GdipRotatePenTransform
@ stub GdipRotateTextureTransform @ stub GdipRotateTextureTransform

View File

@ -17,6 +17,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <math.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
@ -93,6 +94,33 @@ GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2,
return Ok; return Ok;
} }
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle,
GpMatrixOrder order)
{
REAL cos_theta, sin_theta, rotate[6];
if(!matrix)
return InvalidParameter;
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;
rotate[4] = 0.0;
rotate[5] = 0.0;
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, GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY,
GpMatrixOrder order) GpMatrixOrder order)
{ {

View File

@ -88,6 +88,7 @@ GpStatus WINGDIPAPI GdipTransformPath(GpPath*,GpMatrix*);
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**); GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*); GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder); GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder);
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix*,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder); GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT); GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder); GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);