[gdiplus: 1/2] brush implementation [try3]
Evan Stade
estade at gmail.com
Thu Jun 14 18:09:07 CDT 2007
Hi,
Since the last time I submitted this patch, I got rid of a pointer
typecast, and added another null pointer check.
Changelog:
*added brush implementation and types
dlls/gdiplus/Makefile.in | 1 +
dlls/gdiplus/brush.c | 57 ++++++++++++++++++++++++++++++++++++++++
dlls/gdiplus/gdiplus.spec | 6 ++--
dlls/gdiplus/gdiplus_private.h | 11 +++++++-
4 files changed, 71 insertions(+), 4 deletions(-)
-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in
index d1089af..b2bd0c4 100644
--- a/dlls/gdiplus/Makefile.in
+++ b/dlls/gdiplus/Makefile.in
@@ -7,6 +7,7 @@ IMPORTLIB = libgdiplus.$(IMPLIBEXT)
IMPORTS = user32 gdi32 advapi32 kernel32 ntdll
C_SRCS = \
+ brush.c \
gdiplus.c \
graphics.c \
pen.c
diff --git a/dlls/gdiplus/brush.c b/dlls/gdiplus/brush.c
new file mode 100644
index 0000000..21599cc
--- /dev/null
+++ b/dlls/gdiplus/brush.c
@@ -0,0 +1,57 @@
+/*
+ * 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 "windef.h"
+#include "wingdi.h"
+#include "gdiplus.h"
+#include "gdiplus_private.h"
+
+GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
+{
+ COLORREF col = ARGB2COLORREF(color);
+
+ if(!sf) return InvalidParameter;
+
+ *sf = GdipAlloc(sizeof(GpSolidFill));
+ if(!sf) return OutOfMemory;
+
+ (*sf)->brush.gdibrush = CreateSolidBrush(col);
+ (*sf)->brush.bt = BrushTypeSolidColor;
+ (*sf)->brush.color = col;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
+{
+ if(!brush || !type) return InvalidParameter;
+
+ *type = brush->bt;
+
+ return Ok;
+}
+
+GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
+{
+ if(!brush) return InvalidParameter;
+
+ DeleteObject(brush->gdibrush);
+ GdipFree(brush);
+
+ return Ok;
+}
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 142011f..c7a4dc1 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -119,7 +119,7 @@
@ stub GdipCreateRegionRect
@ stub GdipCreateRegionRectI
@ stub GdipCreateRegionRgnData
-@ stub GdipCreateSolidFill
+@ stdcall GdipCreateSolidFill(long ptr)
@ stub GdipCreateStreamOnFile
@ stub GdipCreateStringFormat
@ stub GdipCreateTexture2
@@ -127,7 +127,7 @@
@ stub GdipCreateTexture
@ stub GdipCreateTextureIA
@ stub GdipCreateTextureIAI
-@ stub GdipDeleteBrush
+@ stdcall GdipDeleteBrush(ptr)
@ stub GdipDeleteCachedBitmap
@ stub GdipDeleteCustomLineCap
@ stub GdipDeleteFont
@@ -228,7 +228,7 @@
@ stub GdipGetAdjustableArrowCapMiddleInset
@ stub GdipGetAdjustableArrowCapWidth
@ stub GdipGetAllPropertyItems
-@ stub GdipGetBrushType
+@ stdcall GdipGetBrushType(ptr ptr)
@ stub GdipGetCellAscent
@ stub GdipGetCellDescent
@ stub GdipGetClip
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index f6e238a..6cb2e43 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -20,7 +20,6 @@ #ifndef __WINE_GP_PRIVATE_H_
#define __WINE_GP_PRIVATE_H_
#include "windef.h"
-#include "winbase.h"
#include "gdiplus.h"
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT)
@@ -40,4 +39,14 @@ struct GpGraphics{
HWND hwnd;
};
+struct GpBrush{
+ HBRUSH gdibrush;
+ GpBrushType bt;
+ COLORREF color;
+};
+
+struct GpSolidFill{
+ GpBrush brush;
+};
+
#endif
--
1.4.1
More information about the wine-patches
mailing list