gdiplus: Added basic matrix implementation.

This commit is contained in:
Evan Stade 2007-07-11 18:07:48 -07:00 committed by Alexandre Julliard
parent 6f4ab52824
commit f28262b47d
6 changed files with 70 additions and 2 deletions

View file

@ -11,6 +11,7 @@ C_SRCS = \
gdiplus.c \
graphics.c \
graphicspath.c \
matrix.c \
pen.c
@MAKE_DLL_RULES@

View file

@ -95,7 +95,7 @@
@ stub GdipCreateLineBrushFromRectWithAngle
@ stub GdipCreateLineBrushFromRectWithAngleI
@ stub GdipCreateLineBrushI
@ stub GdipCreateMatrix2
@ stdcall GdipCreateMatrix2(long long long long long long ptr)
@ stub GdipCreateMatrix3
@ stub GdipCreateMatrix3I
@ stub GdipCreateMatrix
@ -133,7 +133,7 @@
@ stub GdipDeleteFont
@ stub GdipDeleteFontFamily
@ stdcall GdipDeleteGraphics(ptr)
@ stub GdipDeleteMatrix
@ stdcall GdipDeleteMatrix(ptr)
@ stdcall GdipDeletePath(ptr)
@ stub GdipDeletePathIter
@ stdcall GdipDeletePen(ptr)

View file

@ -71,4 +71,8 @@ struct GpPath{
INT datalen; /* size of the arrays in pathdata */
};
struct GpMatrix{
REAL matrix[6];
};
#endif

58
dlls/gdiplus/matrix.c Normal file
View file

@ -0,0 +1,58 @@
/*
* Copyright (C) 2007 Google (Evan Stade)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
REAL dx, REAL dy, GpMatrix **matrix)
{
if(!matrix)
return InvalidParameter;
*matrix = GdipAlloc(sizeof(GpMatrix));
if(!*matrix) return OutOfMemory;
/* first row */
(*matrix)->matrix[0] = m11;
(*matrix)->matrix[1] = m12;
/* second row */
(*matrix)->matrix[2] = m21;
(*matrix)->matrix[3] = m22;
/* third row */
(*matrix)->matrix[4] = dx;
(*matrix)->matrix[5] = dy;
return Ok;
}
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
{
if(!matrix)
return InvalidParameter;
GdipFree(matrix);
return Ok;
}

View file

@ -60,6 +60,9 @@ GpStatus WINGDIPAPI GdipGetPathTypes(GpPath*,BYTE*,INT);
GpStatus WINGDIPAPI GdipGetPointCount(GpPath*,INT*);
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath*);
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
#ifdef __cplusplus
}
#endif

View file

@ -26,6 +26,7 @@ class GpGraphics {};
class GpBrush {};
class GpSolidFill {};
class GpPath {};
class GpMatrix {};
#else /* end of c++ declarations */
@ -34,6 +35,7 @@ typedef struct GpPen GpPen;
typedef struct GpBrush GpBrush;
typedef struct GpSolidFill GpSolidFill;
typedef struct GpPath GpPath;
typedef struct GpMatrix GpMatrix;
#endif /* end of c declarations */