Evan Stade : gdiplus: Added first GDI+ graphics implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jun 12 06:30:55 CDT 2007


Module: wine
Branch: master
Commit: d50be49775ce850e9f045e9c4272d3e8137e3159
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d50be49775ce850e9f045e9c4272d3e8137e3159

Author: Evan Stade <estade at gmail.com>
Date:   Mon Jun 11 11:54:03 2007 -0700

gdiplus: Added first GDI+ graphics implementation.

---

 dlls/gdiplus/Makefile.in       |    3 +-
 dlls/gdiplus/gdiplus.spec      |    6 ++--
 dlls/gdiplus/gdiplus_private.h |    5 +++
 dlls/gdiplus/graphics.c        |   67 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 77 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in
index a4edb46..d1089af 100644
--- a/dlls/gdiplus/Makefile.in
+++ b/dlls/gdiplus/Makefile.in
@@ -4,10 +4,11 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = gdiplus.dll
 IMPORTLIB = libgdiplus.$(IMPLIBEXT)
-IMPORTS   = gdi32 advapi32 kernel32 ntdll
+IMPORTS   = user32 gdi32 advapi32 kernel32 ntdll
 
 C_SRCS = \
 	gdiplus.c \
+	graphics.c \
 	pen.c
 
 @MAKE_DLL_RULES@
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 2bb3ba9..c80fbbb 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -81,8 +81,8 @@
 @ stub GdipCreateFontFromLogfontA
 @ stub GdipCreateFontFromLogfontW
 @ stub GdipCreateFromHDC2
-@ stub GdipCreateFromHDC
-@ stub GdipCreateFromHWND
+@ stdcall GdipCreateFromHDC(long ptr)
+@ stdcall GdipCreateFromHWND(long ptr)
 @ stub GdipCreateFromHWNDICM
 @ stub GdipCreateHBITMAPFromBitmap
 @ stub GdipCreateHICONFromBitmap
@@ -132,7 +132,7 @@
 @ stub GdipDeleteCustomLineCap
 @ stub GdipDeleteFont
 @ stub GdipDeleteFontFamily
-@ stub GdipDeleteGraphics
+@ stdcall GdipDeleteGraphics(ptr)
 @ stub GdipDeleteMatrix
 @ stub GdipDeletePath
 @ stub GdipDeletePathIter
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index 2d3a179..f6e238a 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -35,4 +35,9 @@ struct GpPen{
     HPEN gdipen;
 };
 
+struct GpGraphics{
+    HDC hdc;
+    HWND hwnd;
+};
+
 #endif
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
new file mode 100644
index 0000000..37af012
--- /dev/null
+++ b/dlls/gdiplus/graphics.c
@@ -0,0 +1,67 @@
+/*
+ * 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 "winuser.h"
+#include "wingdi.h"
+#include "gdiplus.h"
+#include "gdiplus_private.h"
+#include "wine/debug.h"
+
+GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
+{
+    if(hdc == NULL)
+        return OutOfMemory;
+
+    if(graphics == NULL)
+        return InvalidParameter;
+
+    *graphics = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+        sizeof(GpGraphics));
+    (*graphics)->hdc = hdc;
+    (*graphics)->hwnd = NULL;
+
+    return Ok;
+}
+
+GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics)
+{
+    GpStatus ret;
+
+    if((ret = GdipCreateFromHDC(GetDC(hwnd), graphics)) != Ok)
+        return ret;
+
+    (*graphics)->hwnd = hwnd;
+
+    return Ok;
+}
+
+GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
+{
+    if(!graphics) return InvalidParameter;
+    if(graphics->hwnd)
+        ReleaseDC(graphics->hwnd, graphics->hdc);
+
+    HeapFree(GetProcessHeap(), 0, graphics);
+
+    return Ok;
+}




More information about the wine-cvs mailing list