[GDI+: 9/10] brush implementation

Evan Stade estade at gmail.com
Mon Jun 11 15:01:34 CDT 2007


Hi,

Changelog:
*Added first GDI+ brush implementation (solidfill only)

 dlls/gdiplus/Makefile.in       |    1 +
 dlls/gdiplus/brush.c           |   59 ++++++++++++++++++++++++++++++++++++++++
 dlls/gdiplus/gdiplus_private.h |   10 +++++++
 3 files changed, 70 insertions(+), 0 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in
index a3de5d4..7a5c7ad 100644
--- a/dlls/gdiplus/Makefile.in
+++ b/dlls/gdiplus/Makefile.in
@@ -7,6 +7,7 @@ IMPORTLIB = libgdiplus.$(IMPLIBEXT)
 IMPORTS   = gdi32 advapi32 kernel32 ntdll user32
 
 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..775019d
--- /dev/null
+++ b/dlls/gdiplus/brush.c
@@ -0,0 +1,59 @@
+/*
+ * 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 <math.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "gdiplus.h"
+#include "gdiplus_private.h"
+
+GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **brush)
+{
+    COLORREF col = ARGB2COLORREF(color);
+
+    if(!brush)  return InvalidParameter;
+
+    *brush = (GpSolidFill*) GdipAlloc(sizeof(GpSolidFill));
+
+    (*brush)->brush.gdibrush = CreateSolidBrush(col);
+    (*brush)->brush.bt = BrushTypeSolidColor;
+    (*brush)->brush.color = col;
+
+    return Ok;
+}
+
+GpStatus WINGDIPAPI GdipGetBrushType(GpBrush *brush, GpBrushType *type)
+{
+    if(!brush)  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_private.h b/dlls/gdiplus/gdiplus_private.h
index f6e238a..269097f 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -40,4 +40,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