[1/3] add GDI+ public headers

Evan Stade estade at gmail.com
Fri Jun 1 19:46:00 CDT 2007


Hi,

These three patches add some tests for GDI+ pens, and just enough
implementation and headers to support them.

Differences from last submission:
*broke into 3 separate patches
*headers support C++ compilation

As Alexandre suggested the public headers use C++ constructs, like the
PSDK gdi+.  But instead of creating separate (private) c-only headers
that might result in a lot of duplication with the public headers, I
made use of macros and #ifdefs to make the public headers also support
C compilation.  Thus the headers will work as well with C++ as do the
PSDK headers, and additionally will compile in straight C.

Patch 1 changelog:
*Added public gdi+ headers

 include/gdiplus.h             |   55 +++++++++++++++++++++++++++++++++++++++++
 include/gdiplusenums.h        |   32 ++++++++++++++++++++++++
 include/gdiplusflat.h         |   36 +++++++++++++++++++++++++++
 include/gdiplusgpstubs.h      |   34 +++++++++++++++++++++++++
 include/gdiplusinit.h         |   51 ++++++++++++++++++++++++++++++++++++++
 include/gdiplusmem.h          |   35 ++++++++++++++++++++++++++
 include/gdipluspixelformats.h |   24 ++++++++++++++++++
 include/gdiplustypes.h        |   49 +++++++++++++++++++++++++++++++++++++
 8 files changed, 316 insertions(+), 0 deletions(-)

-Evan Stade
-------------- next part --------------
diff --git a/include/gdiplus.h b/include/gdiplus.h
new file mode 100644
index 0000000..f63d25f
--- /dev/null
+++ b/include/gdiplus.h
@@ -0,0 +1,55 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUS_H_
+#define _GDIPLUS_H_
+
+#ifdef __cplusplus 
+namespace Gdiplus
+{
+#endif
+
+    #ifdef __cplusplus 
+    namespace DllExports
+    {
+    #endif
+        #include "gdiplusmem.h"
+    #ifdef __cplusplus 
+    };
+    #endif
+
+    #include "gdiplustypes.h"
+    #include "gdiplusenums.h"
+    #include "gdiplusinit.h"
+    #include "gdipluspixelformats.h"
+    #include "gdiplusgpstubs.h"
+
+    #ifdef __cplusplus 
+    namespace DllExports
+    {
+    #endif
+        #include "gdiplusflat.h"
+    #ifdef __cplusplus 
+    };
+    #endif
+
+#ifdef __cplusplus 
+};
+#endif
+
+#endif /* _GDIPLUS_H_ */
diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h
new file mode 100644
index 0000000..04a5536
--- /dev/null
+++ b/include/gdiplusenums.h
@@ -0,0 +1,32 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSENUMS_H
+#define _GDIPLUSENUMS_H
+
+typedef enum {
+    UnitWorld = 0,
+    UnitDisplay = 1,
+    UnitPixel = 2,
+    UnitPoint = 3,
+    UnitInch = 4,
+    UnitDocument = 5,
+    UnitMillimeter = 6
+} Unit;
+
+#endif
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
new file mode 100644
index 0000000..511fc70
--- /dev/null
+++ b/include/gdiplusflat.h
@@ -0,0 +1,36 @@
+/*
+ * 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
+ */
+
+#ifndef _FLATAPI_H
+#define _FLATAPI_H
+
+#define WINGDIPAPI WINAPI
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, 
+    GpPen **pen);
+GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
new file mode 100644
index 0000000..d0dff02
--- /dev/null
+++ b/include/gdiplusgpstubs.h
@@ -0,0 +1,34 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSGPSTUBS_H
+#define _GDIPLUSGPSTUBS_H
+
+#ifdef __cplusplus 
+#define GP_OBJECT(x) class x {};
+#else
+#define GP_OBJECT(x) typedef struct x x;
+#endif
+
+typedef Status GpStatus;
+typedef Unit GpUnit;
+
+GP_OBJECT(GpGraphics)
+GP_OBJECT(GpPen)
+
+#endif
diff --git a/include/gdiplusinit.h b/include/gdiplusinit.h
new file mode 100644
index 0000000..25222d9
--- /dev/null
+++ b/include/gdiplusinit.h
@@ -0,0 +1,51 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSINIT_H
+#define _GDIPLUSINIT_H
+
+typedef struct _GdiplusStartupInput
+{
+    UINT32 GdiplusVersion;
+    void * DebugEventCallback;	
+    BOOL SuppressBackgroundThread;
+    BOOL SuppressExternalCodecs;
+} GdiplusStartupInput;
+
+typedef struct _GdiplusStartupOutput
+{
+    ULONG_PTR NotificationHook;
+    ULONG_PTR NotificationUnhook;
+} GdiplusStartupOutput;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+Status WINAPI GdiplusStartup(
+    OUT ULONG_PTR *token,
+    const GdiplusStartupInput *input,
+    OUT GdiplusStartupOutput *output);
+
+void WINAPI GdiplusShutdown(ULONG_PTR token);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdiplusmem.h b/include/gdiplusmem.h
new file mode 100644
index 0000000..dc471d3
--- /dev/null
+++ b/include/gdiplusmem.h
@@ -0,0 +1,35 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSMEM_H
+#define _GDIPLUSMEM_H
+
+#define WINGDIPAPI WINAPI
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void* WINGDIPAPI GdipAlloc(size_t size);
+void WINGDIPAPI GdipFree(void* ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/gdipluspixelformats.h b/include/gdipluspixelformats.h
new file mode 100644
index 0000000..b2110c1
--- /dev/null
+++ b/include/gdipluspixelformats.h
@@ -0,0 +1,24 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSPIXELFORMATS_H
+#define _GDIPLUSPIXELFORMATS_H
+
+typedef DWORD ARGB;
+
+#endif
diff --git a/include/gdiplustypes.h b/include/gdiplustypes.h
new file mode 100644
index 0000000..13e8536
--- /dev/null
+++ b/include/gdiplustypes.h
@@ -0,0 +1,49 @@
+/*
+ * 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
+ */
+
+#ifndef _GDIPLUSTYPES_H
+#define _GDIPLUSTYPES_H
+
+typedef float REAL;
+
+typedef enum {
+    Ok = 0,
+    GenericError = 1,
+    InvalidParameter = 2,
+    OutOfMemory = 3,
+    ObjectBusy = 4,
+    InsufficientBuffer = 5,
+    NotImplemented = 6,
+    Win32Error = 7,
+    WrongState = 8,
+    Aborted = 9,
+    FileNotFound = 10,
+    ValueOverflow = 11,
+    AccessDenied = 12,
+    UnknownImageFormat = 13,
+    FontFamilyNotFound = 14,
+    FontStyleNotFound = 15,
+    NotTrueTypeFont = 16,
+    UnsupportedGdiplusVersion = 17,
+    GdiplusNotInitialized = 18,
+    PropertyNotFound = 19,
+    PropertyNotSupported = 20,
+    ProfileNotFound = 21
+} Status;
+
+#endif
-- 
1.4.1


More information about the wine-patches mailing list