ReactOS 0.4.15-dev-5667-ged97270
gdiplustypes.h
Go to the documentation of this file.
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
22typedef float REAL;
23
25{
26 Ok = 0,
48};
49
50#ifdef __cplusplus
51extern "C"
52{
53#endif
54
58 typedef struct GdiplusAbort GdiplusAbort;
59
61
62#ifdef __cplusplus
63}
64#endif
65
66#ifdef __cplusplus
67
68class Size;
69
70class Point
71{
72 public:
73 Point()
74 {
75 X = Y = 0;
76 }
77
78 Point(IN const Point &pt)
79 {
80 X = pt.X;
81 Y = pt.Y;
82 }
83
84 Point(const Size &size);
85
86 Point(IN INT x, IN INT y)
87 {
88 X = x;
89 Y = y;
90 }
91
92 Point
93 operator+(IN const Point &pt) const
94 {
95 return Point(X + pt.X, Y + pt.Y);
96 }
97
98 Point
99 operator-(IN const Point &pt) const
100 {
101 return Point(X - pt.X, Y - pt.Y);
102 }
103
104 BOOL
105 Equals(IN const Point &pt) const
106 {
107 return (X == pt.X) && (Y == pt.Y);
108 }
109
110 public:
111 INT X;
112 INT Y;
113};
114
115class SizeF;
116
117class PointF
118{
119 public:
120 PointF()
121 {
122 X = Y = 0.0f;
123 }
124
125 PointF(IN const PointF &pt)
126 {
127 X = pt.X;
128 Y = pt.Y;
129 }
130
131 PointF(const SizeF &size);
132
134 {
135 X = x;
136 Y = y;
137 }
138
139 PointF
140 operator+(IN const PointF &pt) const
141 {
142 return PointF(X + pt.X, Y + pt.Y);
143 }
144
145 PointF
146 operator-(IN const PointF &pt) const
147 {
148 return PointF(X - pt.X, Y - pt.Y);
149 }
150
151 BOOL
152 Equals(IN const PointF &pt) const
153 {
154 return (X == pt.X) && (Y == pt.Y);
155 }
156
157 public:
158 REAL X;
159 REAL Y;
160};
161
162class PathData
163{
164 public:
165 PathData()
166 {
167 Count = 0;
168 Points = NULL;
169 Types = NULL;
170 }
171
172 ~PathData()
173 {
174 if (Points != NULL)
175 {
176 delete Points;
177 }
178
179 if (Types != NULL)
180 {
181 delete Types;
182 }
183 }
184
185 private:
186 PathData(const PathData &);
187 PathData &
188 operator=(const PathData &);
189
190 public:
191 INT Count;
192 PointF *Points;
193 BYTE *Types;
194};
195
196class SizeF
197{
198 public:
199 REAL Width;
200 REAL Height;
201
202 SizeF() : Width(0), Height(0)
203 {
204 }
205
206 SizeF(const SizeF &size) : Width(size.Width), Height(size.Height)
207 {
208 }
209
211 {
212 }
213
214 BOOL
215 Empty() const
216 {
217 return Width == 0 && Height == 0;
218 }
219
220 BOOL
221 Equals(const SizeF &sz) const
222 {
223 return Width == sz.Width && Height == sz.Height;
224 }
225
226 SizeF
227 operator+(const SizeF &sz) const
228 {
229 return SizeF(Width + sz.Width, Height + sz.Height);
230 }
231
232 SizeF
233 operator-(const SizeF &sz) const
234 {
235 return SizeF(Width - sz.Width, Height - sz.Height);
236 }
237};
238
239#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */
240
241class RectF
242{
243 public:
244 REAL X;
245 REAL Y;
246 REAL Width;
247 REAL Height;
248
249 RectF() : X(0), Y(0), Width(0), Height(0)
250 {
251 }
252
253 RectF(const PointF &location, const SizeF &size)
255 {
256 }
257
259 {
260 }
261
262 RectF *
263 Clone() const
264 {
265 return new RectF(X, Y, Width, Height);
266 }
267
268 BOOL
269 Contains(const PointF &pt) const
270 {
271 return Contains(pt.X, pt.Y);
272 }
273
274 BOOL
275 Contains(const RectF &rect) const
276 {
277 return X <= rect.X && rect.GetRight() <= GetRight() && Y <= rect.Y && rect.GetBottom() <= GetBottom();
278 }
279
280 BOOL
281 Contains(REAL x, REAL y) const
282 {
283 return X <= x && x < X + Width && Y <= y && y < Y + Height;
284 }
285
286 BOOL
287 Equals(const RectF &rect) const
288 {
289 return X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height;
290 }
291
292 REAL
293 GetBottom() const
294 {
295 return Y + Height;
296 }
297
298 VOID
299 GetBounds(RectF *rect) const
300 {
301 rect->X = X;
302 rect->Y = Y;
303 rect->Width = Width;
304 rect->Height = Height;
305 }
306
307 REAL
308 GetLeft() const
309 {
310 return X;
311 }
312
313 VOID
314 GetLocation(PointF *point) const
315 {
316 point->X = X;
317 point->Y = Y;
318 }
319
320 REAL
321 GetRight() const
322 {
323 return X + Width;
324 }
325
326 VOID
327 GetSize(SizeF *size) const
328 {
329 size->Width = Width;
330 size->Height = Height;
331 }
332
333 REAL
334 GetTop() const
335 {
336 return Y;
337 }
338
339 VOID
340 Inflate(REAL dx, REAL dy)
341 {
342 X -= dx;
343 Y -= dy;
344 Width += 2 * dx;
345 Height += 2 * dy;
346 }
347
348 VOID
349 Inflate(const PointF &point)
350 {
351 Inflate(point.X, point.Y);
352 }
353
354 static BOOL
355 Intersect(RectF &c, const RectF &a, const RectF &b)
356 {
357 // FIXME
358 return FALSE;
359 }
360
361 BOOL
362 Intersect(const RectF &rect)
363 {
364 return Intersect(*this, *this, rect);
365 }
366
367 BOOL
368 IntersectsWith(const RectF &rect) const
369 {
370 return GetLeft() < rect.GetRight() && GetTop() < rect.GetTop() && GetRight() > rect.GetLeft() &&
371 GetBottom() > rect.GetTop();
372 }
373
374 BOOL
375 IsEmptyArea() const
376 {
377 return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON);
378 }
379
380 VOID
382 {
383 X += dx;
384 Y += dy;
385 }
386
387 VOID
388 Offset(const PointF &point)
389 {
390 Offset(point.X, point.Y);
391 }
392
393 static BOOL
394 Union(RectF &c, const RectF &a, const RectF &b)
395 {
396 // FIXME
397 return FALSE;
398 }
399};
400
401class Size
402{
403 public:
404 INT Width;
405 INT Height;
406
407 Size() : Width(0), Height(0)
408 {
409 }
410
412 {
413 }
414
416 {
417 }
418
419 BOOL
420 Empty() const
421 {
422 return Width == 0 && Height == 0;
423 }
424
425 BOOL
426 Equals(const Size &sz) const
427 {
428 return Width == sz.Width && Height == sz.Height;
429 }
430
431 Size
432 operator+(const Size &sz) const
433 {
434 return Size(Width + sz.Width, Height + sz.Height);
435 }
436
437 Size
438 operator-(const Size &sz) const
439 {
440 return Size(Width - sz.Width, Height - sz.Height);
441 }
442};
443
444class Rect
445{
446 public:
447 INT X;
448 INT Y;
449 INT Width;
450 INT Height;
451
452 Rect() : X(0), Y(0), Width(0), Height(0)
453 {
454 }
455
457 {
458 }
459
461 {
462 }
463
464 Rect *
465 Clone() const
466 {
467 return new Rect(X, Y, Width, Height);
468 }
469
470 BOOL
471 Contains(const Point &pt) const
472 {
473 return Contains(pt.X, pt.Y);
474 }
475
476 BOOL
477 Contains(const Rect &rect) const
478 {
479 return X <= rect.X && rect.GetRight() <= GetRight() && Y <= rect.Y && rect.GetBottom() <= GetBottom();
480 }
481
482 BOOL
483 Contains(INT x, INT y) const
484 {
485 return X <= x && x < X + Width && Y <= y && y < Y + Height;
486 }
487
488 BOOL
489 Equals(const Rect &rect) const
490 {
491 return X == rect.X && Y == rect.Y && Width == rect.Width && Height == rect.Height;
492 }
493
494 INT
495 GetBottom() const
496 {
497 return Y + Height;
498 }
499
500 VOID
501 GetBounds(Rect *rect) const
502 {
503 rect->X = X;
504 rect->Y = Y;
505 rect->Width = Width;
506 rect->Height = Height;
507 }
508
509 INT
510 GetLeft() const
511 {
512 return X;
513 }
514
515 VOID
516 GetLocation(Point *point) const
517 {
518 point->X = X;
519 point->Y = Y;
520 }
521
522 INT
523 GetRight() const
524 {
525 return X + Width;
526 }
527
528 VOID
529 GetSize(Size *size) const
530 {
531 size->Width = Width;
532 size->Height = Height;
533 }
534
535 INT
536 GetTop() const
537 {
538 return Y;
539 }
540
541 VOID
542 Inflate(INT dx, INT dy)
543 {
544 X -= dx;
545 Y -= dy;
546 Width += 2 * dx;
547 Height += 2 * dy;
548 }
549
550 VOID
551 Inflate(const Point &point)
552 {
553 Inflate(point.X, point.Y);
554 }
555
556 static BOOL
557 Intersect(Rect &c, const Rect &a, const Rect &b)
558 {
559 // FIXME
560 return FALSE;
561 }
562
563 BOOL
564 Intersect(const Rect &rect)
565 {
566 return Intersect(*this, *this, rect);
567 }
568
569 BOOL
570 IntersectsWith(const Rect &rect) const
571 {
572 return GetLeft() < rect.GetRight() && GetTop() < rect.GetTop() && GetRight() > rect.GetLeft() &&
573 GetBottom() > rect.GetTop();
574 }
575
576 BOOL
577 IsEmptyArea() const
578 {
579 return Width <= 0 || Height <= 0;
580 }
581
582 VOID
583 Offset(INT dx, INT dy)
584 {
585 X += dx;
586 Y += dy;
587 }
588
589 VOID
590 Offset(const Point &point)
591 {
592 Offset(point.X, point.Y);
593 }
594
595 static BOOL
596 Union(Rect &c, const Rect &a, const Rect &b)
597 {
598 // FIXME
599 return FALSE;
600 }
601};
602
603class CharacterRange
604{
605 public:
607 {
608 First = Length = 0;
609 }
610
612 {
613 First = first;
614 Length = length;
615 }
616
618 operator=(const CharacterRange &rhs)
619 {
620 First = rhs.First;
621 Length = rhs.Length;
622 return *this;
623 }
624
625 public:
626 INT First;
627 INT Length;
628};
629
630inline Point::Point(const Size &size) : X(size.Width), Y(size.Height)
631{
632}
633
634inline PointF::PointF(const SizeF &size) : X(size.Width), Y(size.Height)
635{
636}
637
638#else /* end of c++ typedefs */
639
640typedef struct Point
641{
645
646typedef struct PointF
647{
651
652typedef struct PathData
653{
658
659typedef struct RectF
660{
666
667typedef struct Rect
668{
674
675typedef struct CharacterRange
676{
680
681typedef enum Status Status;
682
683#endif /* end of c typedefs */
684
685#endif
complex< _Tp > _STLP_CALL operator-(const complex< _Tp > &__z)
Definition: _complex.h:622
CHString WINAPI operator+(CHSTRING_WCHAR ch, const CHString &string)
Definition: chstring.cpp:1354
DWORD WINAPI GetSize(LPVOID)
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
float REAL
Definition: types.h:41
#define Y(I)
#define CALLBACK
Definition: compat.h:35
#define pt(x, y)
Definition: drawing.c:79
@ Empty
Definition: npfs.h:125
POINTL point
Definition: edittest.c:50
unsigned int BOOL
Definition: ntddk_ex.h:94
EmfPlusRecordType
Definition: gdiplusenums.h:455
ImageAbort DrawImageAbort
Definition: gdiplustypes.h:56
struct GdiplusAbort GdiplusAbort
Definition: gdiplustypes.h:58
struct Point Point
ImageAbort GetThumbnailImageAbort
Definition: gdiplustypes.h:57
BOOL(CALLBACK * ImageAbort)(VOID *)
Definition: gdiplustypes.h:55
Status
Definition: gdiplustypes.h:25
@ ProfileNotFound
Definition: gdiplustypes.h:47
@ Ok
Definition: gdiplustypes.h:26
@ GdiplusNotInitialized
Definition: gdiplustypes.h:44
@ WrongState
Definition: gdiplustypes.h:34
@ UnsupportedGdiplusVersion
Definition: gdiplustypes.h:43
@ PropertyNotSupported
Definition: gdiplustypes.h:46
@ FileNotFound
Definition: gdiplustypes.h:36
@ ObjectBusy
Definition: gdiplustypes.h:30
@ AccessDenied
Definition: gdiplustypes.h:38
@ ValueOverflow
Definition: gdiplustypes.h:37
@ InvalidParameter
Definition: gdiplustypes.h:28
@ OutOfMemory
Definition: gdiplustypes.h:29
@ NotTrueTypeFont
Definition: gdiplustypes.h:42
@ PropertyNotFound
Definition: gdiplustypes.h:45
@ Win32Error
Definition: gdiplustypes.h:33
@ Aborted
Definition: gdiplustypes.h:35
@ InsufficientBuffer
Definition: gdiplustypes.h:31
@ NotImplemented
Definition: gdiplustypes.h:32
@ FontStyleNotFound
Definition: gdiplustypes.h:41
@ FontFamilyNotFound
Definition: gdiplustypes.h:40
@ GenericError
Definition: gdiplustypes.h:27
@ UnknownImageFormat
Definition: gdiplustypes.h:39
float REAL
Definition: gdiplustypes.h:22
BOOL(CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType, UINT, UINT, const BYTE *, VOID *)
Definition: gdiplustypes.h:60
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
const GLint * first
Definition: glext.h:5794
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
unsigned int UINT
Definition: ndis.h:50
#define BOOL
Definition: nt_native.h:43
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
& rect
Definition: startmenu.cpp:1413
PointF * Points
Definition: gdiplustypes.h:655
BYTE * Types
Definition: gdiplustypes.h:656
REAL Y
Definition: gdiplustypes.h:649
REAL X
Definition: gdiplustypes.h:648
REAL Height
Definition: gdiplustypes.h:664
REAL X
Definition: gdiplustypes.h:661
REAL Width
Definition: gdiplustypes.h:663
REAL Y
Definition: gdiplustypes.h:662
INT Width
Definition: gdiplustypes.h:671
INT Height
Definition: gdiplustypes.h:672
INT X
Definition: gdiplustypes.h:669
INT Y
Definition: gdiplustypes.h:670
int32_t INT
Definition: typedefs.h:58
#define IN
Definition: typedefs.h:39
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:126
_In_ HFONT _Out_ PUINT Height
Definition: font.h:125
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
unsigned char BYTE
Definition: xxhash.c:193