[GDI+: 3/10] graphics implementation
Evan Stade
estade at gmail.com
Mon Jun 11 13:54:03 CDT 2007
Hi,
Changelog:
*Added first GDI+ graphics implementation
dlls/gdiplus/Makefile.in | 1 +
dlls/gdiplus/gdiplus.spec | 6 ++--
dlls/gdiplus/gdiplus_private.h | 5 +++
dlls/gdiplus/graphics.c | 67 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 76 insertions(+), 3 deletions(-)
-Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in
index 3f57760..a3de5d4 100644
--- a/dlls/gdiplus/Makefile.in
+++ b/dlls/gdiplus/Makefile.in
@@ -8,6 +8,7 @@ IMPORTS = gdi32 advapi32 kernel32 ntdl
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..b725b9e 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(ptr ptr)
+@ stdcall GdipCreateFromHWND(ptr 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..76ca99e
--- /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 = (GpGraphics*) 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;
+}
--
1.4.1
More information about the wine-patches
mailing list