[PSDK] Update mmreg.h and rpcndr.h. CORE-13762
[reactos.git] / sdk / include / psdk / gdiplusheaders.h
1 /*
2 * GdiPlusHeaders.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19 #ifndef _GDIPLUSHEADERS_H
20 #define _GDIPLUSHEADERS_H
21
22 class Image : public GdiplusBase
23 {
24 public:
25 friend class Graphics;
26
27 Image(IStream *stream, BOOL useEmbeddedColorManagement = FALSE)
28 {
29 if (useEmbeddedColorManagement)
30 status = DllExports::GdipLoadImageFromStreamICM(stream, &image);
31 else
32 status = DllExports::GdipLoadImageFromStream(stream, &image);
33 }
34
35 Image(const WCHAR *filename, BOOL useEmbeddedColorManagement = FALSE)
36 {
37 if (useEmbeddedColorManagement)
38 status = DllExports::GdipLoadImageFromFileICM(filename, &image);
39 else
40 status = DllExports::GdipLoadImageFromFile(filename, &image);
41 }
42
43 Image *Clone(VOID)
44 {
45 Image *newImage = new Image();
46 SetStatus(DllExports::GdipCloneImage(image, newImage ? &newImage->image : NULL));
47 return newImage;
48 }
49
50 static Image *FromFile(const WCHAR *filename, BOOL useEmbeddedColorManagement = FALSE)
51 {
52 return new Image(filename, useEmbeddedColorManagement);
53 }
54
55 static Image *FromStream(IStream *stream, BOOL useEmbeddedColorManagement = FALSE)
56 {
57 return new Image(stream, useEmbeddedColorManagement);
58 }
59
60 Status GetAllPropertyItems(UINT totalBufferSize, UINT numProperties, PropertyItem *allItems)
61 {
62 return SetStatus(DllExports::GdipGetAllPropertyItems(image, totalBufferSize, numProperties, allItems));
63 }
64
65 Status GetBounds(RectF *srcRect, Unit *srcUnit)
66 {
67 return SetStatus(DllExports::GdipGetImageBounds(image, srcRect, srcUnit));
68 }
69
70 Status GetEncoderParameterList(const CLSID *clsidEncoder, UINT size, EncoderParameters *buffer)
71 {
72 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipGetEncoderParameterList(image, clsidEncoder, size, buffer));
73 }
74
75 UINT GetEncoderParameterListSize(const CLSID *clsidEncoder)
76 {
77 return 0; // FIXME: not available:
78 // UINT size;
79 // SetStatus(DllExports::GdipGetEncoderParameterListSize(image, clsidEncoder, &size));
80 // return size;
81 }
82
83 UINT GetFlags(VOID)
84 {
85 UINT flags;
86 SetStatus(DllExports::GdipGetImageFlags(image, &flags));
87 return flags;
88 }
89
90 UINT GetFrameCount(const GUID *dimensionID)
91 {
92 UINT count;
93 SetStatus(DllExports::GdipImageGetFrameCount(image, dimensionID, &count));
94 return count;
95 }
96
97 UINT GetFrameDimensionsCount(VOID)
98 {
99 UINT count;
100 SetStatus(DllExports::GdipImageGetFrameDimensionsCount(image, &count));
101 return count;
102 }
103
104 Status GetFrameDimensionsList(GUID *dimensionIDs, UINT count)
105 {
106 return SetStatus(DllExports::GdipImageGetFrameDimensionsList(image, dimensionIDs, count));
107 }
108
109 UINT GetHeight(VOID)
110 {
111 UINT height;
112 SetStatus(DllExports::GdipGetImageHeight(image, &height));
113 return height;
114 }
115
116 REAL GetHorizontalResolution(VOID)
117 {
118 REAL resolution;
119 SetStatus(DllExports::GdipGetImageHorizontalResolution(image, &resolution));
120 return resolution;
121 }
122
123 Status GetLastStatus(VOID)
124 {
125 return status;
126 }
127
128 Status GetPalette(ColorPalette *palette, INT size)
129 {
130 return SetStatus(DllExports::GdipGetImagePalette(image, palette, size));
131 }
132
133 INT GetPaletteSize(VOID)
134 {
135 INT size;
136 SetStatus(DllExports::GdipGetImagePaletteSize(image, &size));
137 return size;
138 }
139
140 Status GetPhysicalDimension(SizeF *size)
141 {
142 return SetStatus(DllExports::GdipGetImageDimension(image, size ? &size->Width : NULL, size ? &size->Height : NULL));
143 }
144
145 PixelFormat GetPixelFormat(VOID)
146 {
147 PixelFormat format;
148 SetStatus(DllExports::GdipGetImagePixelFormat(image, &format));
149 return format;
150 }
151
152 UINT GetPropertyCount(VOID)
153 {
154 UINT numOfProperty;
155 SetStatus(DllExports::GdipGetPropertyCount(image, &numOfProperty));
156 return numOfProperty;
157 }
158
159 Status GetPropertyIdList(UINT numOfProperty, PROPID *list)
160 {
161 return SetStatus(DllExports::GdipGetPropertyIdList(image, numOfProperty, list));
162 }
163
164 Status GetPropertyItem(PROPID propId, UINT propSize, PropertyItem *buffer)
165 {
166 return SetStatus(DllExports::GdipGetPropertyItem(image, propId, propSize, buffer));
167 }
168
169 UINT GetPropertyItemSize(PROPID propId)
170 {
171 UINT size;
172 SetStatus(DllExports::GdipGetPropertyItemSize(image, propId, &size));
173 return size;
174 }
175
176 Status GetPropertySize(UINT *totalBufferSize, UINT *numProperties)
177 {
178 return SetStatus(DllExports::GdipGetPropertySize(image, totalBufferSize, numProperties));
179 }
180
181 Status GetRawFormat(GUID *format)
182 {
183 return SetStatus(DllExports::GdipGetImageRawFormat(image, format));
184 }
185
186 Image *GetThumbnailImage(UINT thumbWidth, UINT thumbHeight, GetThumbnailImageAbort callback, VOID *callbackData)
187 {
188 Image *thumbImage = new Image();
189 SetStatus(DllExports::GdipGetImageThumbnail(image, thumbWidth, thumbHeight, thumbImage ? &thumbImage->image : NULL, callback, callbackData));
190 return thumbImage;
191 }
192
193 ImageType GetType(VOID)
194 {
195 ImageType type;
196 SetStatus(DllExports::GdipGetImageType(image, &type));
197 return type;
198 }
199
200 REAL GetVerticalResolution(VOID)
201 {
202 REAL resolution;
203 SetStatus(DllExports::GdipGetImageVerticalResolution(image, &resolution));
204 return resolution;
205 }
206
207 UINT GetWidth(VOID)
208 {
209 UINT width;
210 SetStatus(DllExports::GdipGetImageWidth(image, &width));
211 return width;
212 }
213
214 Status RemovePropertyItem(PROPID propId)
215 {
216 return SetStatus(DllExports::GdipRemovePropertyItem(image, propId));
217 }
218
219 Status RotateFlip(RotateFlipType rotateFlipType)
220 {
221 return SetStatus(DllExports::GdipImageRotateFlip(image, rotateFlipType));
222 }
223
224 Status Save(IStream *stream, const CLSID *clsidEncoder, const EncoderParameters *encoderParams)
225 {
226 return SetStatus(DllExports::GdipSaveImageToStream(image, stream, clsidEncoder, encoderParams));
227 }
228
229 Status Save(const WCHAR *filename, const CLSID *clsidEncoder, const EncoderParameters *encoderParams)
230 {
231 return SetStatus(DllExports::GdipSaveImageToFile(image, filename, clsidEncoder, encoderParams));
232 }
233
234 Status SaveAdd(const EncoderParameters* encoderParams)
235 {
236 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipSaveAdd(image, encoderParams));
237 }
238
239 Status SaveAdd(Image *newImage, const EncoderParameters *encoderParams)
240 {
241 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipSaveAddImage(image, newImage ? newImage->image : NULL, encoderParams));
242 }
243
244 Status SelectActiveFrame(const GUID *dimensionID, UINT frameIndex)
245 {
246 return SetStatus(DllExports::GdipImageSelectActiveFrame(image, dimensionID, frameIndex));
247 }
248
249 Status SetPalette(const ColorPalette* palette)
250 {
251 return SetStatus(DllExports::GdipSetImagePalette(image, palette));
252 }
253
254 Status SetPropertyItem(const PropertyItem* item)
255 {
256 return SetStatus(DllExports::GdipSetPropertyItem(image, item));
257 }
258
259 protected:
260 Image()
261 {
262 }
263
264 private:
265 mutable Status status;
266 GpImage *image;
267
268 Status SetStatus(Status status) const
269 {
270 if (status == Ok)
271 return status;
272 this->status = status;
273 return status;
274 }
275 };
276
277
278 class Bitmap : public Image
279 {
280 friend class CachedBitmap;
281
282 public:
283 // Bitmap(IDirectDrawSurface7 *surface) // <-- FIXME: compiler does not like this
284 // {
285 // status = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface, &bitmap);
286 // }
287
288 Bitmap(INT width, INT height, Graphics *target)
289 {
290 status = DllExports::GdipCreateBitmapFromGraphics(width, height, target ? target->graphics : NULL, &bitmap);
291 }
292
293 Bitmap(const BITMAPINFO *gdiBitmapInfo, VOID *gdiBitmapData)
294 {
295 status = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo, gdiBitmapData, &bitmap);
296 }
297
298 Bitmap(INT width, INT height, PixelFormat format)
299 {
300 }
301
302 Bitmap(HBITMAP hbm, HPALETTE hpal)
303 {
304 status = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap);
305 }
306
307 Bitmap(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0)
308 {
309 status = DllExports::GdipCreateBitmapFromScan0(width, height, stride, format, scan0, &bitmap);
310 }
311
312 Bitmap(const WCHAR *filename, BOOL useIcm)
313 {
314 if (useIcm)
315 status = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap);
316 else
317 status = DllExports::GdipCreateBitmapFromFile(filename, &bitmap);
318 }
319
320 Bitmap(HINSTANCE hInstance, const WCHAR *bitmapName)
321 {
322 status = DllExports::GdipCreateBitmapFromResource(hInstance, bitmapName, &bitmap);
323 }
324
325 Bitmap(HICON hicon)
326 {
327 status = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap);
328 }
329
330 Bitmap(IStream *stream, BOOL useIcm)
331 {
332 if (useIcm)
333 status = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap);
334 else
335 status = DllExports::GdipCreateBitmapFromStream(stream, &bitmap);
336 }
337
338 Bitmap *Clone(const Rect &rect, PixelFormat format)
339 {
340 Bitmap *dstBitmap = new Bitmap();
341 SetStatus(DllExports::GdipCloneBitmapAreaI(rect.X, rect.Y, rect.Width, rect.Height, format, bitmap, dstBitmap ? &dstBitmap->bitmap : NULL));
342 return dstBitmap;
343 }
344
345 Bitmap *Clone(const RectF &rect, PixelFormat format)
346 {
347 Bitmap *dstBitmap = new Bitmap();
348 SetStatus(DllExports::GdipCloneBitmapArea(rect.X, rect.Y, rect.Width, rect.Height, format, bitmap, dstBitmap ? &dstBitmap->bitmap : NULL));
349 return dstBitmap;
350 }
351
352 Bitmap *Clone(REAL x, REAL y, REAL width, REAL height, PixelFormat format)
353 {
354 Bitmap *dstBitmap = new Bitmap();
355 SetStatus(DllExports::GdipCloneBitmapArea(x, y, width, height, format, bitmap, dstBitmap ? &dstBitmap->bitmap : NULL));
356 return dstBitmap;
357 }
358
359 Bitmap *Clone(INT x, INT y, INT width, INT height, PixelFormat format)
360 {
361 Bitmap *dstBitmap = new Bitmap();
362 SetStatus(DllExports::GdipCloneBitmapAreaI(x, y, width, height, format, bitmap, dstBitmap ? &dstBitmap->bitmap : NULL));
363 return dstBitmap;
364 }
365
366 static Bitmap *FromBITMAPINFO(const BITMAPINFO *gdiBitmapInfo, VOID *gdiBitmapData)
367 {
368 return new Bitmap(gdiBitmapInfo, gdiBitmapData);
369 }
370
371 // static Bitmap *FromDirectDrawSurface7(IDirectDrawSurface7 *surface) // <-- FIXME: compiler does not like this
372 // {
373 // return new Bitmap(surface);
374 // }
375
376 static Bitmap *FromFile(const WCHAR *filename, BOOL useEmbeddedColorManagement)
377 {
378 return new Bitmap(filename, useEmbeddedColorManagement);
379 }
380
381 static Bitmap *FromHBITMAP(HBITMAP hbm, HPALETTE hpal)
382 {
383 return new Bitmap(hbm, hpal);
384 }
385
386 static Bitmap *FromHICON(HICON hicon)
387 {
388 return new Bitmap(hicon);
389 }
390
391 static Bitmap *FromResource(HINSTANCE hInstance, const WCHAR *bitmapName)
392 {
393 return new Bitmap(hInstance, bitmapName);
394 }
395
396 static Bitmap *FromStream(IStream *stream, BOOL useEmbeddedColorManagement)
397 {
398 return new Bitmap(stream, useEmbeddedColorManagement);
399 }
400
401 Status GetHBITMAP(const Color &colorBackground, HBITMAP *hbmReturn)
402 {
403 return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap(bitmap, hbmReturn, colorBackground.GetValue()));
404 }
405
406 Status GetHICON(HICON *hicon)
407 {
408 return SetStatus(DllExports::GdipCreateHICONFromBitmap(bitmap, hicon));
409 }
410
411 Status GetPixel(INT x, INT y, Color *color)
412 {
413 ARGB argb;
414 Status s = SetStatus(DllExports::GdipBitmapGetPixel(bitmap, x, y, &argb));
415 if (color != NULL)
416 color->SetValue(argb);
417 return s;
418 }
419
420 Status LockBits(const Rect *rect, UINT flags, PixelFormat format, BitmapData *lockedBitmapData)
421 {
422 return SetStatus(DllExports::GdipBitmapLockBits(bitmap, rect, flags, format, lockedBitmapData));
423 }
424
425 Status SetPixel(INT x, INT y, const Color &color)
426 {
427 return SetStatus(DllExports::GdipBitmapSetPixel(bitmap, x, y, color.GetValue()));
428 }
429
430 Status SetResolution(REAL xdpi, REAL ydpi)
431 {
432 return SetStatus(DllExports::GdipBitmapSetResolution(bitmap, xdpi, ydpi));
433 }
434
435 Status UnlockBits(BitmapData *lockedBitmapData)
436 {
437 return SetStatus(DllExports::GdipBitmapUnlockBits(bitmap, lockedBitmapData));
438 }
439
440 protected:
441 Bitmap()
442 {
443 }
444
445 private:
446 mutable Status status;
447 GpBitmap *bitmap;
448
449 Status SetStatus(Status status) const
450 {
451 if (status == Ok)
452 return status;
453 this->status = status;
454 return status;
455 }
456 };
457
458
459 class CachedBitmap : public GdiplusBase
460 {
461 public:
462 CachedBitmap(Bitmap *bitmap, Graphics *graphics)
463 {
464 status = DllExports::GdipCreateCachedBitmap(bitmap->bitmap, graphics ? graphics->graphics : NULL, &cachedBitmap);
465 }
466
467 Status GetLastStatus(VOID)
468 {
469 return status;
470 }
471
472 private:
473 mutable Status status;
474 GpCachedBitmap *cachedBitmap;
475 };
476
477
478 class FontCollection : public GdiplusBase
479 {
480 friend class FontFamily;
481
482 public:
483 FontCollection(VOID)
484 {
485 }
486
487 Status GetFamilies(INT numSought, FontFamily *gpfamilies, INT *numFound) const
488 {
489 return NotImplemented;
490 }
491
492 INT GetFamilyCount(VOID) const
493 {
494 return 0;
495 }
496
497 Status GetLastStatus(VOID)
498 {
499 return NotImplemented;
500 }
501
502 private:
503 GpFontCollection *fontCollection;
504 };
505
506
507 class FontFamily : public GdiplusBase
508 {
509 friend class Font;
510
511 public:
512 FontFamily(VOID)
513 {
514 }
515
516 FontFamily(const WCHAR *name, const FontCollection *fontCollection)
517 {
518 status = DllExports::GdipCreateFontFamilyFromName(name, fontCollection ? fontCollection->fontCollection : NULL, &fontFamily);
519 }
520
521 FontFamily *Clone(VOID)
522 {
523 return NULL;
524 }
525
526 static const FontFamily *GenericMonospace(VOID)
527 {
528 FontFamily *genericMonospace = new FontFamily();
529 genericMonospace->status = DllExports::GdipGetGenericFontFamilyMonospace(genericMonospace ? &genericMonospace->fontFamily : NULL);
530 return genericMonospace;
531 }
532
533 static const FontFamily *GenericSansSerif(VOID)
534 {
535 FontFamily *genericSansSerif = new FontFamily();
536 genericSansSerif->status = DllExports::GdipGetGenericFontFamilySansSerif(genericSansSerif ? &genericSansSerif->fontFamily : NULL);
537 return genericSansSerif;
538 }
539
540 static const FontFamily *GenericSerif(VOID)
541 {
542 FontFamily *genericSerif = new FontFamily();
543 genericSerif->status = DllExports::GdipGetGenericFontFamilyMonospace(genericSerif ? &genericSerif->fontFamily : NULL);
544 return genericSerif;
545 }
546
547 UINT16 GetCellAscent(INT style) const
548 {
549 UINT16 CellAscent;
550 SetStatus(DllExports::GdipGetCellAscent(fontFamily, style, &CellAscent));
551 return CellAscent;
552 }
553
554 UINT16 GetCellDescent(INT style) const
555 {
556 UINT16 CellDescent;
557 SetStatus(DllExports::GdipGetCellDescent(fontFamily, style, &CellDescent));
558 return CellDescent;
559 }
560
561 UINT16 GetEmHeight(INT style)
562 {
563 UINT16 EmHeight;
564 SetStatus(DllExports::GdipGetEmHeight(fontFamily, style, &EmHeight));
565 return EmHeight;
566 }
567
568 Status GetFamilyName(WCHAR name[LF_FACESIZE], WCHAR language) const
569 {
570 return SetStatus(DllExports::GdipGetFamilyName(fontFamily, name, language));
571 }
572
573 Status GetLastStatus(VOID) const
574 {
575 return status;
576 }
577
578 UINT16 GetLineSpacing(INT style) const
579 {
580 UINT16 LineSpacing;
581 SetStatus(DllExports::GdipGetLineSpacing(fontFamily, style, &LineSpacing));
582 return LineSpacing;
583 }
584
585 BOOL IsAvailable(VOID) const
586 {
587 return FALSE;
588 }
589
590 BOOL IsStyleAvailable(INT style) const
591 {
592 BOOL StyleAvailable;
593 SetStatus(DllExports::GdipIsStyleAvailable(fontFamily, style, &StyleAvailable));
594 return StyleAvailable;
595 }
596
597 private:
598 mutable Status status;
599 GpFontFamily *fontFamily;
600
601 Status SetStatus(Status status) const
602 {
603 if (status == Ok)
604 return status;
605 this->status = status;
606 return status;
607 }
608 };
609
610
611 class InstalledFontFamily : public FontFamily
612 {
613 public:
614 InstalledFontFamily(VOID)
615 {
616 }
617 };
618
619
620 class PrivateFontCollection : public FontCollection
621 {
622 public:
623 PrivateFontCollection(VOID)
624 {
625 }
626
627 Status AddFontFile(const WCHAR* filename)
628 {
629 return NotImplemented;
630 }
631
632 Status AddMemoryFont(const VOID *memory, INT length)
633 {
634 return NotImplemented;
635 }
636 };
637
638
639 class Font : public GdiplusBase
640 {
641 public:
642 friend class FontFamily;
643 friend class FontCollection;
644 friend class Graphics;
645
646 Font(const FontFamily *family, REAL emSize, INT style, Unit unit)
647 {
648 status = DllExports::GdipCreateFont(family->fontFamily, emSize, style, unit, &font);
649 }
650
651 Font(HDC hdc, const HFONT hfont)
652 {
653 }
654
655 Font(HDC hdc, const LOGFONTA *logfont)
656 {
657 status = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font);
658 }
659
660 Font(HDC hdc, const LOGFONTW *logfont)
661 {
662 status = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font);
663 }
664
665 Font(const WCHAR *familyName, REAL emSize, INT style, Unit unit, const FontCollection *fontCollection)
666 {
667 }
668
669 Font(HDC hdc)
670 {
671 status = DllExports::GdipCreateFontFromDC(hdc, &font);
672 }
673
674 Font *Clone(VOID) const
675 {
676 Font *cloneFont = new Font();
677 cloneFont->status = DllExports::GdipCloneFont(font, cloneFont ? &cloneFont->font : NULL);
678 return cloneFont;
679 }
680
681 Status GetFamily(FontFamily* family) const
682 {
683 return SetStatus(DllExports::GdipGetFamily(font, family ? &family->fontFamily : NULL));
684 }
685
686 REAL GetHeight(const Graphics* graphics) const
687 {
688 REAL height;
689 SetStatus(DllExports::GdipGetFontHeight(font, graphics ? graphics->graphics : NULL, &height));
690 return height;
691 }
692
693 REAL GetHeight(REAL dpi) const
694 {
695 REAL height;
696 SetStatus(DllExports::GdipGetFontHeightGivenDPI(font, dpi, &height));
697 return height;
698 }
699
700 Status GetLastStatus(VOID) const
701 {
702 return status;
703 }
704
705 Status GetLogFontA(const Graphics *g, LOGFONTA *logfontA) const
706 {
707 return SetStatus(DllExports::GdipGetLogFontA(font, g ? g->graphics : NULL, logfontA));
708 }
709
710 Status GetLogFontW(const Graphics *g, LOGFONTW *logfontW) const
711 {
712 return SetStatus(DllExports::GdipGetLogFontW(font, g ? g->graphics : NULL, logfontW));
713 }
714
715 REAL GetSize(VOID) const
716 {
717 REAL size;
718 SetStatus(DllExports::GdipGetFontSize(font, &size));
719 return size;
720 }
721
722 INT GetStyle(VOID) const
723 {
724 INT style;
725 SetStatus(DllExports::GdipGetFontStyle(font, &style));
726 return style;
727 }
728
729 Unit GetUnit(VOID) const
730 {
731 Unit unit;
732 SetStatus(DllExports::GdipGetFontUnit(font, &unit));
733 return unit;
734 }
735
736 BOOL IsAvailable(VOID) const
737 {
738 return FALSE;
739 }
740
741 protected:
742 Font()
743 {
744 }
745
746 private:
747 mutable Status status;
748 GpFont *font;
749
750 Status SetStatus(Status status) const
751 {
752 if (status == Ok)
753 return status;
754 this->status = status;
755 return status;
756 }
757 };
758
759
760 class Region : public GdiplusBase
761 {
762 public:
763 friend class Graphics;
764 friend class GraphicsPath;
765 friend class Matrix;
766
767 Region(const Rect &rect)
768 {
769 status = DllExports::GdipCreateRegionRectI(&rect, &region);
770 }
771
772 Region(VOID)
773 {
774 status = DllExports::GdipCreateRegion(&region);
775 }
776
777 Region(const BYTE *regionData, INT size)
778 {
779 status = DllExports::GdipCreateRegionRgnData(regionData, size, &region);
780 }
781
782 Region(const GraphicsPath *path)
783 {
784 status = DllExports::GdipCreateRegionPath(path->path, &region);
785 }
786
787 Region(HRGN hRgn)
788 {
789 status = DllExports::GdipCreateRegionHrgn(hRgn, &region);
790 }
791
792 Region(const RectF &rect)
793 {
794 status = DllExports::GdipCreateRegionRect(&rect, &region);
795 }
796
797 Region *Clone(VOID)
798 {
799 Region *cloneRegion = new Region();
800 cloneRegion->status = DllExports::GdipCloneRegion(region, cloneRegion ? &cloneRegion->region : NULL);
801 return cloneRegion;
802 }
803
804 Status Complement(const GraphicsPath *path)
805 {
806 return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeComplement));
807 }
808
809 Status Complement(const Region *region)
810 {
811 return SetStatus(DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeComplement));
812 }
813
814 Status Complement(const Rect &rect)
815 {
816 return SetStatus(DllExports::GdipCombineRegionRectI(region, &rect, CombineModeComplement));
817 }
818
819 Status Complement(const RectF &rect)
820 {
821 return SetStatus(DllExports::GdipCombineRegionRect(region, &rect, CombineModeComplement));
822 }
823
824 BOOL Equals(const Region *region, const Graphics *g) const
825 {
826 BOOL result;
827 SetStatus(DllExports::GdipIsEqualRegion(this->region, region ? region->region : NULL, g ? g->graphics : NULL, &result));
828 return result;
829 }
830
831 Status Exclude(const GraphicsPath *path)
832 {
833 return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeExclude));
834 }
835
836 Status Exclude(const RectF &rect)
837 {
838 return SetStatus(DllExports::GdipCombineRegionRect(region, &rect, CombineModeExclude));
839 }
840
841 Status Exclude(const Rect &rect)
842 {
843 return SetStatus(DllExports::GdipCombineRegionRectI(region, &rect, CombineModeExclude));
844 }
845
846 Status Exclude(const Region *region)
847 {
848 return SetStatus(DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeExclude));
849 }
850
851 static Region *FromHRGN(HRGN hRgn)
852 {
853 return new Region(hRgn);
854 }
855
856 Status GetBounds(Rect *rect, const Graphics *g) const
857 {
858 return SetStatus(DllExports::GdipGetRegionBoundsI(region, g ? g->graphics : NULL, rect));
859 }
860
861 Status GetBounds(RectF *rect, const Graphics *g) const
862 {
863 return SetStatus(DllExports::GdipGetRegionBounds(region, g ? g->graphics : NULL, rect));
864 }
865
866 Status GetData(BYTE *buffer, UINT bufferSize, UINT *sizeFilled) const
867 {
868 return SetStatus(DllExports::GdipGetRegionData(region, buffer, bufferSize, sizeFilled));
869 }
870
871 UINT GetDataSize(VOID) const
872 {
873 UINT bufferSize;
874 SetStatus(DllExports::GdipGetRegionDataSize(region, &bufferSize));
875 return bufferSize;
876 }
877
878 HRGN GetHRGN(const Graphics *g) const
879 {
880 HRGN hRgn;
881 SetStatus(DllExports::GdipGetRegionHRgn(region, g ? g->graphics : NULL, &hRgn));
882 return hRgn;
883 }
884
885 Status GetLastStatus(VOID)
886 {
887 return status;
888 }
889
890 Status GetRegionScans(const Matrix *matrix, Rect *rects, INT *count) const
891 {
892 return SetStatus(DllExports::GdipGetRegionScansI(region, rects, count, matrix ? matrix->matrix : NULL));
893 }
894
895 Status GetRegionScans(const Matrix *matrix, RectF *rects, INT *count) const
896 {
897 return SetStatus(DllExports::GdipGetRegionScans(region, rects, count, matrix ? matrix->matrix : NULL));
898 }
899
900 UINT GetRegionScansCount(const Matrix *matrix) const
901 {
902 UINT count;
903 SetStatus(DllExports::GdipGetRegionScansCount(region, &count, matrix ? matrix->matrix : NULL));
904 return count;
905 }
906
907 Status Intersect(const Rect &rect)
908 {
909 return SetStatus(DllExports::GdipCombineRegionRectI(region, &rect, CombineModeIntersect));
910 }
911
912 Status Intersect(const GraphicsPath *path)
913 {
914 return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeIntersect));
915 }
916
917 Status Intersect(const RectF &rect)
918 {
919 return SetStatus(DllExports::GdipCombineRegionRect(region, &rect, CombineModeIntersect));
920 }
921
922 Status Intersect(const Region *region)
923 {
924 return SetStatus(DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeIntersect));
925 }
926
927 BOOL IsEmpty(const Graphics *g) const
928 {
929 BOOL result;
930 SetStatus(DllExports::GdipIsEmptyRegion(region, g ? g->graphics : NULL, &result));
931 return result;
932 }
933
934 BOOL IsInfinite(const Graphics *g) const
935 {
936 BOOL result;
937 SetStatus(DllExports::GdipIsInfiniteRegion(region, g ? g->graphics : NULL, &result));
938 return result;
939 }
940
941 BOOL IsVisible(const PointF &point, const Graphics *g) const
942 {
943 BOOL result;
944 SetStatus(DllExports::GdipIsVisibleRegionPoint(region, point.X, point.Y, g ? g->graphics : NULL, &result));
945 return result;
946 }
947
948 BOOL IsVisible(const RectF &rect, const Graphics *g) const
949 {
950 BOOL result;
951 SetStatus(DllExports::GdipIsVisibleRegionRect(region, rect.X, rect.Y, rect.Width, rect.Height, g ? g->graphics : NULL, &result));
952 return result;
953 }
954
955 BOOL IsVisible(const Rect &rect, const Graphics *g) const
956 {
957 BOOL result;
958 SetStatus(DllExports::GdipIsVisibleRegionRectI(region, rect.X, rect.Y, rect.Width, rect.Height, g ? g->graphics : NULL, &result));
959 return result;
960 }
961
962 BOOL IsVisible(INT x, INT y, const Graphics *g) const
963 {
964 BOOL result;
965 SetStatus(DllExports::GdipIsVisibleRegionPointI(region, x, y, g ? g->graphics : NULL, &result));
966 return result;
967 }
968
969 BOOL IsVisible(REAL x, REAL y, const Graphics *g) const
970 {
971 BOOL result;
972 SetStatus(DllExports::GdipIsVisibleRegionPoint(region, x, y, g ? g->graphics : NULL, &result));
973 return result;
974 }
975
976 BOOL IsVisible(INT x, INT y, INT width, INT height, const Graphics *g) const
977 {
978 BOOL result;
979 SetStatus(DllExports::GdipIsVisibleRegionRectI(region, x, y, width, height, g ? g->graphics : NULL, &result));
980 return result;
981 }
982
983 BOOL IsVisible(const Point &point, const Graphics *g) const
984 {
985 BOOL result;
986 SetStatus(DllExports::GdipIsVisibleRegionPointI(region, point.X, point.Y, g ? g->graphics : NULL, &result));
987 return result;
988 }
989
990 BOOL IsVisible(REAL x, REAL y, REAL width, REAL height, const Graphics *g) const
991 {
992 BOOL result;
993 SetStatus(DllExports::GdipIsVisibleRegionRect(region, x, y, width, height, g ? g->graphics : NULL, &result));
994 return result;
995 }
996
997 Status MakeEmpty(VOID)
998 {
999 return SetStatus(DllExports::GdipSetEmpty(region));
1000 }
1001
1002 Status MakeInfinite(VOID)
1003 {
1004 return SetStatus(DllExports::GdipSetInfinite(region));
1005 }
1006
1007 Status Transform(const Matrix *matrix)
1008 {
1009 return SetStatus(DllExports::GdipTransformRegion(region, matrix ? matrix->matrix : NULL));
1010 }
1011
1012 Status Translate(REAL dx, REAL dy)
1013 {
1014 return SetStatus(DllExports::GdipTranslateRegion(region, dx, dy));
1015 }
1016
1017 Status Translate(INT dx, INT dy)
1018 {
1019 return SetStatus(DllExports::GdipTranslateRegionI(region, dx, dy));
1020 }
1021
1022 Status Union(const Rect &rect)
1023 {
1024 return SetStatus(DllExports::GdipCombineRegionRectI(region, &rect, CombineModeUnion));
1025 }
1026
1027 Status Union(const Region *region)
1028 {
1029 return SetStatus(DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeUnion));
1030 }
1031
1032 Status Union(const RectF &rect)
1033 {
1034 return SetStatus(DllExports::GdipCombineRegionRect(region, &rect, CombineModeUnion));
1035 }
1036
1037 Status Union(const GraphicsPath *path)
1038 {
1039 return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeUnion));
1040 }
1041
1042 Status Xor(const GraphicsPath *path)
1043 {
1044 return SetStatus(DllExports::GdipCombineRegionPath(region, path ? path->path : NULL, CombineModeXor));
1045 }
1046
1047 Status Xor(const RectF &rect)
1048 {
1049 return SetStatus(DllExports::GdipCombineRegionRect(region, &rect, CombineModeXor));
1050 }
1051
1052 Status Xor(const Rect &rect)
1053 {
1054 return SetStatus(DllExports::GdipCombineRegionRectI(region, &rect, CombineModeXor));
1055 }
1056
1057 Status Xor(const Region *region)
1058 {
1059 return SetStatus(DllExports::GdipCombineRegionRegion(this->region, region ? region->region : NULL, CombineModeXor));
1060 }
1061
1062 private:
1063 mutable Status status;
1064 GpRegion *region;
1065
1066 Status SetStatus(Status status) const
1067 {
1068 if (status == Ok)
1069 return status;
1070 this->status = status;
1071 return status;
1072 }
1073 };
1074
1075
1076 class CustomLineCap : public GdiplusBase
1077 {
1078 public:
1079 CustomLineCap(const GraphicsPath *fillPath, const GraphicsPath *strokePath, LineCap baseCap, REAL baseInset);
1080 CustomLineCap *Clone(VOID);
1081 LineCap GetBaseCap(VOID);
1082 REAL GetBaseInset(VOID);
1083 Status GetLastStatus(VOID);
1084 Status GetStrokeCaps(LineCap *startCap, LineCap *endCap);
1085 LineJoin GetStrokeJoin(VOID);
1086 REAL GetWidthScale(VOID);
1087 Status SetBaseCap(LineCap baseCap);
1088 Status SetBaseInset(REAL inset);
1089 Status SetStrokeCap(LineCap strokeCap);
1090 Status SetStrokeCaps(LineCap startCap, LineCap endCap);
1091 Status SetStrokeJoin(LineJoin lineJoin);
1092 Status SetWidthScale(IN REAL widthScale);
1093 protected:
1094 CustomLineCap();
1095 };
1096
1097 #endif /* _GDIPLUSHEADERS_H */