Commit 12e3eadd authored by Evan Stade's avatar Evan Stade Committed by Alexandre Julliard

gdiplus: Added GdipMultiplyMatrix.

parent 024800cb
......@@ -424,7 +424,7 @@
@ stub GdipMeasureDriverString
@ stub GdipMeasureString
@ stub GdipMultiplyLineTransform
@ stub GdipMultiplyMatrix
@ stdcall GdipMultiplyMatrix(ptr ptr long)
@ stub GdipMultiplyPathGradientTransform
@ stub GdipMultiplyPenTransform
@ stub GdipMultiplyTextureTransform
......
......@@ -25,6 +25,28 @@
#include "gdiplus.h"
#include "gdiplus_private.h"
/* Multiplies two matrices of the form
*
* idx:0 idx:1 0
* idx:2 idx:3 0
* idx:4 idx:5 1
*
* and puts the output in out.
* */
static void matrix_multiply(GDIPCONST REAL * left, GDIPCONST REAL * right, REAL * out)
{
REAL temp[6];
int i, odd;
for(i = 0; i < 6; i++){
odd = i % 2;
temp[i] = left[i - odd] * right[odd] + left[i - odd + 1] * right[odd + 2] +
(i >= 4 ? right[odd + 4] : 0.0);
}
memcpy(out, temp, 6 * sizeof(REAL));
}
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
REAL dx, REAL dy, GpMatrix **matrix)
{
......@@ -57,6 +79,20 @@ GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
return Ok;
}
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2,
GpMatrixOrder order)
{
if(!matrix || !matrix2)
return InvalidParameter;
if(order == MatrixOrderAppend)
matrix_multiply(matrix->matrix, matrix2->matrix, matrix->matrix);
else
matrix_multiply(matrix2->matrix, matrix->matrix, matrix->matrix);
return Ok;
}
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts,
INT count)
{
......
......@@ -151,6 +151,12 @@ enum DashStyle
DashStyleCustom
};
enum MatrixOrder
{
MatrixOrderPrepend = 0,
MatrixOrderAppend = 1
};
#ifndef __cplusplus
typedef enum Unit Unit;
......@@ -166,6 +172,7 @@ typedef enum InterpolationMode InterpolationMode;
typedef enum PixelOffsetMode PixelOffsetMode;
typedef enum DashCap DashCap;
typedef enum DashStyle DashStyle;
typedef enum MatrixOrder MatrixOrder;
#endif /* end of c typedefs */
......
......@@ -87,6 +87,7 @@ GpStatus WINGDIPAPI GdipTransformPath(GpPath*,GpMatrix*);
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder);
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*);
......
......@@ -52,5 +52,6 @@ typedef RectF GpRectF;
typedef LineJoin GpLineJoin;
typedef DashCap GpDashCap;
typedef DashStyle GpDashStyle;
typedef MatrixOrder GpMatrixOrder;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment