Release 1.5.29.
[wine] / include / gdiplustypes.h
1 /*
2  * Copyright (C) 2007 Google (Evan Stade)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef _GDIPLUSTYPES_H
20 #define _GDIPLUSTYPES_H
21
22 typedef float REAL;
23
24 enum Status{
25     Ok                          = 0,
26     GenericError                = 1,
27     InvalidParameter            = 2,
28     OutOfMemory                 = 3,
29     ObjectBusy                  = 4,
30     InsufficientBuffer          = 5,
31     NotImplemented              = 6,
32     Win32Error                  = 7,
33     WrongState                  = 8,
34     Aborted                     = 9,
35     FileNotFound                = 10,
36     ValueOverflow               = 11,
37     AccessDenied                = 12,
38     UnknownImageFormat          = 13,
39     FontFamilyNotFound          = 14,
40     FontStyleNotFound           = 15,
41     NotTrueTypeFont             = 16,
42     UnsupportedGdiplusVersion   = 17,
43     GdiplusNotInitialized       = 18,
44     PropertyNotFound            = 19,
45     PropertyNotSupported        = 20,
46     ProfileNotFound             = 21
47 };
48
49
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53
54 typedef BOOL (CALLBACK * ImageAbort)(VOID *);
55 typedef ImageAbort DrawImageAbort;
56 typedef ImageAbort GetThumbnailImageAbort;
57
58 typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64
65 #ifdef __cplusplus
66
67 class Point
68 {
69 public:
70    Point()
71    {
72        X = Y = 0;
73    }
74
75    Point(IN const Point &pt)
76    {
77        X = pt.X;
78        Y = pt.Y;
79    }
80
81    /* FIXME: missing constructor that takes a Size */
82
83    Point(IN INT x, IN INT y)
84    {
85        X = x;
86        Y = y;
87    }
88
89    Point operator+(IN const Point& pt) const
90    {
91        return Point(X + pt.X, Y + pt.Y);
92    }
93
94    Point operator-(IN const Point& pt) const
95    {
96        return Point(X - pt.X, Y - pt.Y);
97    }
98
99    BOOL Equals(IN const Point& pt)
100    {
101        return (X == pt.X) && (Y == pt.Y);
102    }
103
104 public:
105     INT X;
106     INT Y;
107 };
108
109 class PointF
110 {
111 public:
112    PointF()
113    {
114        X = Y = 0.0f;
115    }
116
117    PointF(IN const PointF &pt)
118    {
119        X = pt.X;
120        Y = pt.Y;
121    }
122
123    /* FIXME: missing constructor that takes a SizeF */
124
125    PointF(IN REAL x, IN REAL y)
126    {
127        X = x;
128        Y = y;
129    }
130
131    PointF operator+(IN const PointF& pt) const
132    {
133        return PointF(X + pt.X, Y + pt.Y);
134    }
135
136    PointF operator-(IN const PointF& pt) const
137    {
138        return PointF(X - pt.X, Y - pt.Y);
139    }
140
141    BOOL Equals(IN const PointF& pt)
142    {
143        return (X == pt.X) && (Y == pt.Y);
144    }
145
146 public:
147     REAL X;
148     REAL Y;
149 };
150
151 class PathData
152 {
153 public:
154     PathData()
155     {
156         Count = 0;
157         Points = NULL;
158         Types = NULL;
159     }
160
161     ~PathData()
162     {
163         if (Points != NULL)
164         {
165             delete Points;
166         }
167
168         if (Types != NULL)
169         {
170             delete Types;
171         }
172     }
173
174 private:
175     PathData(const PathData &);
176     PathData& operator=(const PathData &);
177
178 public:
179     INT Count;
180     PointF* Points;
181     BYTE* Types;
182 };
183
184 /* FIXME: missing the methods. */
185 class RectF
186 {
187 public:
188     REAL X;
189     REAL Y;
190     REAL Width;
191     REAL Height;
192 };
193
194 /* FIXME: missing the methods. */
195 class Rect
196 {
197 public:
198     INT X;
199     INT Y;
200     INT Width;
201     INT Height;
202 };
203
204 class CharacterRange
205 {
206 public:
207     CharacterRange()
208     {
209         First = Length = 0;
210     }
211
212     CharacterRange(INT first, INT length)
213     {
214         First = first;
215         Length = length;
216     }
217
218     CharacterRange& operator=(const CharacterRange& rhs)
219     {
220         First = rhs.First;
221         Length = rhs.Length;
222         return *this;
223     }
224 public:
225     INT First;
226     INT Length;
227 };
228
229 #else /* end of c++ typedefs */
230
231 typedef struct Point
232 {
233     INT X;
234     INT Y;
235 } Point;
236
237 typedef struct PointF
238 {
239     REAL X;
240     REAL Y;
241 } PointF;
242
243 typedef struct PathData
244 {
245     INT Count;
246     PointF* Points;
247     BYTE* Types;
248 } PathData;
249
250 typedef struct RectF
251 {
252     REAL X;
253     REAL Y;
254     REAL Width;
255     REAL Height;
256 } RectF;
257
258 typedef struct Rect
259 {
260     INT X;
261     INT Y;
262     INT Width;
263     INT Height;
264 } Rect;
265
266 typedef struct CharacterRange
267 {
268     INT First;
269     INT Length;
270 } CharacterRange;
271
272 typedef enum Status Status;
273
274 #endif /* end of c typedefs */
275
276 #endif