6 * This file is part of the w32api package.
8 * THIS SOFTWARE IS NOT COPYRIGHTED
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
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.
19 #ifndef _GDIPLUSHEADERS_H
20 #define _GDIPLUSHEADERS_H
22 class Image
: public GdiplusBase
25 friend class Graphics
;
26 friend class TextureBrush
;
28 Image(IStream
*stream
, BOOL useEmbeddedColorManagement
= FALSE
) : nativeImage(NULL
)
30 if (useEmbeddedColorManagement
)
31 lastStatus
= DllExports::GdipLoadImageFromStreamICM(stream
, &nativeImage
);
33 lastStatus
= DllExports::GdipLoadImageFromStream(stream
, &nativeImage
);
36 Image(const WCHAR
*filename
, BOOL useEmbeddedColorManagement
= FALSE
) : nativeImage(NULL
)
38 if (useEmbeddedColorManagement
)
39 lastStatus
= DllExports::GdipLoadImageFromFileICM(filename
, &nativeImage
);
41 lastStatus
= DllExports::GdipLoadImageFromFile(filename
, &nativeImage
);
47 GpImage
*cloneimage
= NULL
;
48 SetStatus(DllExports::GdipCloneImage(nativeImage
, &cloneimage
));
49 return new Image(cloneimage
, lastStatus
);
54 DllExports::GdipDisposeImage(nativeImage
);
58 FromFile(const WCHAR
*filename
, BOOL useEmbeddedColorManagement
= FALSE
)
60 return new Image(filename
, useEmbeddedColorManagement
);
64 FromStream(IStream
*stream
, BOOL useEmbeddedColorManagement
= FALSE
)
66 return new Image(stream
, useEmbeddedColorManagement
);
70 GetAllPropertyItems(UINT totalBufferSize
, UINT numProperties
, PropertyItem
*allItems
)
73 return SetStatus(InvalidParameter
);
74 return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage
, totalBufferSize
, numProperties
, allItems
));
78 GetBounds(RectF
*srcRect
, Unit
*srcUnit
)
80 return SetStatus(DllExports::GdipGetImageBounds(nativeImage
, srcRect
, srcUnit
));
84 GetEncoderParameterList(const CLSID
*clsidEncoder
, UINT size
, EncoderParameters
*buffer
)
87 // FIXME: Not available yet
88 return SetStatus(NotImplemented
);
90 return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage
, clsidEncoder
, size
, buffer
));
95 GetEncoderParameterListSize(const CLSID
*clsidEncoder
)
98 // FIXME: Not available yet
99 return SetStatus(NotImplemented
);
102 SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage
, clsidEncoder
, &size
));
111 SetStatus(DllExports::GdipGetImageFlags(nativeImage
, &flags
));
116 GetFrameCount(const GUID
*dimensionID
)
119 SetStatus(DllExports::GdipImageGetFrameCount(nativeImage
, dimensionID
, &count
));
124 GetFrameDimensionsCount()
127 SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage
, &count
));
132 GetFrameDimensionsList(GUID
*dimensionIDs
, UINT count
)
134 return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage
, dimensionIDs
, count
));
141 SetStatus(DllExports::GdipGetImageHeight(nativeImage
, &height
));
146 GetHorizontalResolution()
148 REAL resolution
= 0.0f
;
149 SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage
, &resolution
));
160 GetPalette(ColorPalette
*palette
, INT size
)
162 return SetStatus(DllExports::GdipGetImagePalette(nativeImage
, palette
, size
));
169 SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage
, &size
));
174 GetPhysicalDimension(SizeF
*size
)
177 return SetStatus(InvalidParameter
);
179 return SetStatus(DllExports::GdipGetImageDimension(nativeImage
, &size
->Width
, &size
->Height
));
186 SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage
, &format
));
193 UINT numOfProperty
= 0;
194 SetStatus(DllExports::GdipGetPropertyCount(nativeImage
, &numOfProperty
));
195 return numOfProperty
;
199 GetPropertyIdList(UINT numOfProperty
, PROPID
*list
)
201 return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage
, numOfProperty
, list
));
205 GetPropertyItem(PROPID propId
, UINT propSize
, PropertyItem
*buffer
)
207 return SetStatus(DllExports::GdipGetPropertyItem(nativeImage
, propId
, propSize
, buffer
));
211 GetPropertyItemSize(PROPID propId
)
214 SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage
, propId
, &size
));
219 GetPropertySize(UINT
*totalBufferSize
, UINT
*numProperties
)
221 return SetStatus(DllExports::GdipGetPropertySize(nativeImage
, totalBufferSize
, numProperties
));
225 GetRawFormat(GUID
*format
)
227 return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage
, format
));
231 GetThumbnailImage(UINT thumbWidth
, UINT thumbHeight
, GetThumbnailImageAbort callback
, VOID
*callbackData
)
233 GpImage
*thumbImage
= NULL
;
234 SetStatus(DllExports::GdipGetImageThumbnail(
235 nativeImage
, thumbWidth
, thumbHeight
, &thumbImage
, callback
, callbackData
));
236 Image
*newImage
= new Image(thumbImage
, lastStatus
);
237 if (newImage
== NULL
)
239 DllExports::GdipDisposeImage(thumbImage
);
248 SetStatus(DllExports::GdipGetImageType(nativeImage
, &type
));
253 GetVerticalResolution()
255 REAL resolution
= 0.0f
;
256 SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage
, &resolution
));
264 SetStatus(DllExports::GdipGetImageWidth(nativeImage
, &width
));
269 RemovePropertyItem(PROPID propId
)
271 return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage
, propId
));
275 RotateFlip(RotateFlipType rotateFlipType
)
277 return SetStatus(DllExports::GdipImageRotateFlip(nativeImage
, rotateFlipType
));
281 Save(IStream
*stream
, const CLSID
*clsidEncoder
, const EncoderParameters
*encoderParams
)
283 return SetStatus(DllExports::GdipSaveImageToStream(nativeImage
, stream
, clsidEncoder
, encoderParams
));
287 Save(const WCHAR
*filename
, const CLSID
*clsidEncoder
, const EncoderParameters
*encoderParams
)
289 return SetStatus(DllExports::GdipSaveImageToFile(nativeImage
, filename
, clsidEncoder
, encoderParams
));
293 SaveAdd(const EncoderParameters
*encoderParams
)
296 // FIXME: Not available yet
297 return SetStatus(NotImplemented
);
299 return SetStatus(DllExports::GdipSaveAdd(nativeImage
, encoderParams
));
304 SaveAdd(Image
*newImage
, const EncoderParameters
*encoderParams
)
307 // FIXME: Not available yet
308 return SetStatus(NotImplemented
);
311 return SetStatus(InvalidParameter
);
313 return SetStatus(DllExports::GdipSaveAddImage(nativeImage
, newImage
->nativeImage
, encoderParams
));
318 SelectActiveFrame(const GUID
*dimensionID
, UINT frameIndex
)
320 return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage
, dimensionID
, frameIndex
));
324 SetPalette(const ColorPalette
*palette
)
326 return SetStatus(DllExports::GdipSetImagePalette(nativeImage
, palette
));
330 SetPropertyItem(const PropertyItem
*item
)
332 return SetStatus(DllExports::GdipSetPropertyItem(nativeImage
, item
));
339 return SetStatus(NotImplemented
);
343 SetLayout(const ImageLayout layout
)
345 return SetStatus(NotImplemented
);
350 GpImage
*nativeImage
;
351 mutable Status lastStatus
;
357 Image(GpImage
*image
, Status status
) : nativeImage(image
), lastStatus(status
)
362 SetStatus(Status status
) const
370 SetNativeImage(GpImage
*image
)
376 // Image is not copyable
377 Image(const Image
&);
379 operator=(const Image
&);
382 class Bitmap
: public Image
384 friend class CachedBitmap
;
387 // Bitmap(IDirectDrawSurface7 *surface) // <-- FIXME: compiler does not like this
389 // lastStatus = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface, &bitmap);
392 Bitmap(INT width
, INT height
, Graphics
*target
)
394 GpBitmap
*bitmap
= NULL
;
395 lastStatus
= DllExports::GdipCreateBitmapFromGraphics(width
, height
, target
? target
->graphics
: NULL
, &bitmap
);
396 SetNativeImage(bitmap
);
399 Bitmap(const BITMAPINFO
*gdiBitmapInfo
, VOID
*gdiBitmapData
)
401 GpBitmap
*bitmap
= NULL
;
402 lastStatus
= DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo
, gdiBitmapData
, &bitmap
);
403 SetNativeImage(bitmap
);
406 Bitmap(INT width
, INT height
, PixelFormat format
)
408 GpBitmap
*bitmap
= NULL
;
409 lastStatus
= DllExports::GdipCreateBitmapFromScan0(width
, height
, 0, format
, NULL
, &bitmap
);
410 SetNativeImage(bitmap
);
413 Bitmap(HBITMAP hbm
, HPALETTE hpal
)
415 GpBitmap
*bitmap
= NULL
;
416 lastStatus
= DllExports::GdipCreateBitmapFromHBITMAP(hbm
, hpal
, &bitmap
);
417 SetNativeImage(bitmap
);
420 Bitmap(INT width
, INT height
, INT stride
, PixelFormat format
, BYTE
*scan0
)
422 GpBitmap
*bitmap
= NULL
;
423 lastStatus
= DllExports::GdipCreateBitmapFromScan0(width
, height
, stride
, format
, scan0
, &bitmap
);
424 SetNativeImage(bitmap
);
427 Bitmap(const WCHAR
*filename
, BOOL useIcm
)
429 GpBitmap
*bitmap
= NULL
;
432 lastStatus
= DllExports::GdipCreateBitmapFromFileICM(filename
, &bitmap
);
434 lastStatus
= DllExports::GdipCreateBitmapFromFile(filename
, &bitmap
);
436 SetNativeImage(bitmap
);
439 Bitmap(HINSTANCE hInstance
, const WCHAR
*bitmapName
)
441 GpBitmap
*bitmap
= NULL
;
442 lastStatus
= DllExports::GdipCreateBitmapFromResource(hInstance
, bitmapName
, &bitmap
);
443 SetNativeImage(bitmap
);
448 GpBitmap
*bitmap
= NULL
;
449 lastStatus
= DllExports::GdipCreateBitmapFromHICON(hicon
, &bitmap
);
450 SetNativeImage(bitmap
);
453 Bitmap(IStream
*stream
, BOOL useIcm
)
455 GpBitmap
*bitmap
= NULL
;
457 lastStatus
= DllExports::GdipCreateBitmapFromStreamICM(stream
, &bitmap
);
459 lastStatus
= DllExports::GdipCreateBitmapFromStream(stream
, &bitmap
);
460 SetNativeImage(bitmap
);
464 Clone(const Rect
&rect
, PixelFormat format
)
466 return Clone(rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, format
);
470 Clone(const RectF
&rect
, PixelFormat format
)
472 return Clone(rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, format
);
476 Clone(REAL x
, REAL y
, REAL width
, REAL height
, PixelFormat format
)
478 GpBitmap
*bitmap
= NULL
;
479 lastStatus
= DllExports::GdipCloneBitmapArea(x
, y
, width
, height
, format
, GetNativeBitmap(), &bitmap
);
481 if (lastStatus
!= Ok
)
484 Bitmap
*newBitmap
= new Bitmap(bitmap
);
485 if (newBitmap
== NULL
)
487 DllExports::GdipDisposeImage(bitmap
);
494 Clone(INT x
, INT y
, INT width
, INT height
, PixelFormat format
)
496 GpBitmap
*bitmap
= NULL
;
497 lastStatus
= DllExports::GdipCloneBitmapAreaI(x
, y
, width
, height
, format
, GetNativeBitmap(), &bitmap
);
499 if (lastStatus
!= Ok
)
502 Bitmap
*newBitmap
= new Bitmap(bitmap
);
503 if (newBitmap
== NULL
)
505 DllExports::GdipDisposeImage(bitmap
);
512 FromBITMAPINFO(const BITMAPINFO
*gdiBitmapInfo
, VOID
*gdiBitmapData
)
514 return new Bitmap(gdiBitmapInfo
, gdiBitmapData
);
517 // static Bitmap *FromDirectDrawSurface7(IDirectDrawSurface7 *surface) // <-- FIXME: compiler does not like this
519 // return new Bitmap(surface);
523 FromFile(const WCHAR
*filename
, BOOL useEmbeddedColorManagement
)
525 return new Bitmap(filename
, useEmbeddedColorManagement
);
529 FromHBITMAP(HBITMAP hbm
, HPALETTE hpal
)
531 return new Bitmap(hbm
, hpal
);
535 FromHICON(HICON hicon
)
537 return new Bitmap(hicon
);
541 FromResource(HINSTANCE hInstance
, const WCHAR
*bitmapName
)
543 return new Bitmap(hInstance
, bitmapName
);
547 FromStream(IStream
*stream
, BOOL useEmbeddedColorManagement
)
549 return new Bitmap(stream
, useEmbeddedColorManagement
);
553 GetHBITMAP(const Color
&colorBackground
, HBITMAP
*hbmReturn
)
556 DllExports::GdipCreateHBITMAPFromBitmap(GetNativeBitmap(), hbmReturn
, colorBackground
.GetValue()));
560 GetHICON(HICON
*hicon
)
562 return SetStatus(DllExports::GdipCreateHICONFromBitmap(GetNativeBitmap(), hicon
));
566 GetPixel(INT x
, INT y
, Color
*color
)
569 Status s
= SetStatus(DllExports::GdipBitmapGetPixel(GetNativeBitmap(), x
, y
, &argb
));
571 color
->SetValue(argb
);
576 LockBits(const Rect
*rect
, UINT flags
, PixelFormat format
, BitmapData
*lockedBitmapData
)
578 return SetStatus(DllExports::GdipBitmapLockBits(GetNativeBitmap(), rect
, flags
, format
, lockedBitmapData
));
582 SetPixel(INT x
, INT y
, const Color
&color
)
584 return SetStatus(DllExports::GdipBitmapSetPixel(GetNativeBitmap(), x
, y
, color
.GetValue()));
588 SetResolution(REAL xdpi
, REAL ydpi
)
590 return SetStatus(DllExports::GdipBitmapSetResolution(GetNativeBitmap(), xdpi
, ydpi
));
594 UnlockBits(BitmapData
*lockedBitmapData
)
596 return SetStatus(DllExports::GdipBitmapUnlockBits(GetNativeBitmap(), lockedBitmapData
));
604 Bitmap(GpBitmap
*nativeBitmap
)
607 SetNativeImage(nativeBitmap
);
611 GetNativeBitmap() const
613 return static_cast<GpBitmap
*>(nativeImage
);
617 class CachedBitmap
: public GdiplusBase
620 CachedBitmap(Bitmap
*bitmap
, Graphics
*graphics
)
622 nativeCachedBitmap
= NULL
;
623 lastStatus
= DllExports::GdipCreateCachedBitmap(
624 bitmap
->GetNativeBitmap(), graphics
? graphics
->graphics
: NULL
, &nativeCachedBitmap
);
629 DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap
);
639 mutable Status lastStatus
;
640 GpCachedBitmap
*nativeCachedBitmap
;
643 // CachedBitmap is not copyable
644 CachedBitmap(const CachedBitmap
&);
646 operator=(const CachedBitmap
&);
649 class FontCollection
: public GdiplusBase
651 friend class FontFamily
;
654 FontCollection() : nativeFontCollection(NULL
), lastStatus(Ok
)
658 virtual ~FontCollection()
663 GetFamilies(INT numSought
, FontFamily
*gpfamilies
, INT
*numFound
) const
665 return SetStatus(NotImplemented
);
669 GetFamilyCount() const
672 lastStatus
= DllExports::GdipGetFontCollectionFamilyCount(nativeFontCollection
, &numFound
);
677 GetLastStatus() const
683 GpFontCollection
*nativeFontCollection
;
684 mutable Status lastStatus
;
687 SetStatus(Status status
) const
695 // FontCollection is not copyable
696 FontCollection(const FontCollection
&);
698 operator=(const FontCollection
&);
701 class FontFamily
: public GdiplusBase
710 FontFamily(const WCHAR
*name
, const FontCollection
*fontCollection
)
712 GpFontCollection
*theCollection
= fontCollection
? fontCollection
->nativeFontCollection
: NULL
;
713 status
= DllExports::GdipCreateFontFamilyFromName(name
, theCollection
, &fontFamily
);
722 static const FontFamily
*
725 FontFamily
*genericMonospace
= new FontFamily();
726 genericMonospace
->status
=
727 DllExports::GdipGetGenericFontFamilyMonospace(genericMonospace
? &genericMonospace
->fontFamily
: NULL
);
728 return genericMonospace
;
731 static const FontFamily
*
734 FontFamily
*genericSansSerif
= new FontFamily();
735 genericSansSerif
->status
=
736 DllExports::GdipGetGenericFontFamilySansSerif(genericSansSerif
? &genericSansSerif
->fontFamily
: NULL
);
737 return genericSansSerif
;
740 static const FontFamily
*
743 FontFamily
*genericSerif
= new FontFamily();
744 genericSerif
->status
=
745 DllExports::GdipGetGenericFontFamilyMonospace(genericSerif
? &genericSerif
->fontFamily
: NULL
);
750 GetCellAscent(INT style
) const
753 SetStatus(DllExports::GdipGetCellAscent(fontFamily
, style
, &CellAscent
));
758 GetCellDescent(INT style
) const
761 SetStatus(DllExports::GdipGetCellDescent(fontFamily
, style
, &CellDescent
));
766 GetEmHeight(INT style
)
769 SetStatus(DllExports::GdipGetEmHeight(fontFamily
, style
, &EmHeight
));
774 GetFamilyName(WCHAR name
[LF_FACESIZE
], WCHAR language
) const
776 return SetStatus(DllExports::GdipGetFamilyName(fontFamily
, name
, language
));
780 GetLastStatus() const
786 GetLineSpacing(INT style
) const
789 SetStatus(DllExports::GdipGetLineSpacing(fontFamily
, style
, &LineSpacing
));
800 IsStyleAvailable(INT style
) const
803 SetStatus(DllExports::GdipIsStyleAvailable(fontFamily
, style
, &StyleAvailable
));
804 return StyleAvailable
;
808 mutable Status status
;
809 GpFontFamily
*fontFamily
;
812 SetStatus(Status status
) const
816 this->status
= status
;
821 class InstalledFontFamily
: public FontFamily
824 InstalledFontFamily()
829 class PrivateFontCollection
: public FontCollection
832 PrivateFontCollection()
834 nativeFontCollection
= NULL
;
835 lastStatus
= DllExports::GdipNewPrivateFontCollection(&nativeFontCollection
);
838 virtual ~PrivateFontCollection()
840 DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection
);
844 AddFontFile(const WCHAR
*filename
)
846 return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection
, filename
));
850 AddMemoryFont(const VOID
*memory
, INT length
)
852 return SetStatus(DllExports::GdipPrivateAddMemoryFont(nativeFontCollection
, memory
, length
));
856 class Font
: public GdiplusBase
859 friend class FontFamily
;
860 friend class FontCollection
;
861 friend class Graphics
;
863 Font(const FontFamily
*family
, REAL emSize
, INT style
, Unit unit
)
865 status
= DllExports::GdipCreateFont(family
->fontFamily
, emSize
, style
, unit
, &font
);
868 Font(HDC hdc
, const HFONT hfont
)
872 Font(HDC hdc
, const LOGFONTA
*logfont
)
874 status
= DllExports::GdipCreateFontFromLogfontA(hdc
, logfont
, &font
);
877 Font(HDC hdc
, const LOGFONTW
*logfont
)
879 status
= DllExports::GdipCreateFontFromLogfontW(hdc
, logfont
, &font
);
882 Font(const WCHAR
*familyName
, REAL emSize
, INT style
, Unit unit
, const FontCollection
*fontCollection
)
888 status
= DllExports::GdipCreateFontFromDC(hdc
, &font
);
894 Font
*cloneFont
= new Font();
895 cloneFont
->status
= DllExports::GdipCloneFont(font
, cloneFont
? &cloneFont
->font
: NULL
);
900 GetFamily(FontFamily
*family
) const
902 return SetStatus(DllExports::GdipGetFamily(font
, family
? &family
->fontFamily
: NULL
));
906 GetHeight(const Graphics
*graphics
) const
909 SetStatus(DllExports::GdipGetFontHeight(font
, graphics
? graphics
->graphics
: NULL
, &height
));
914 GetHeight(REAL dpi
) const
917 SetStatus(DllExports::GdipGetFontHeightGivenDPI(font
, dpi
, &height
));
922 GetLastStatus() const
928 GetLogFontA(const Graphics
*g
, LOGFONTA
*logfontA
) const
930 return SetStatus(DllExports::GdipGetLogFontA(font
, g
? g
->graphics
: NULL
, logfontA
));
934 GetLogFontW(const Graphics
*g
, LOGFONTW
*logfontW
) const
936 return SetStatus(DllExports::GdipGetLogFontW(font
, g
? g
->graphics
: NULL
, logfontW
));
943 SetStatus(DllExports::GdipGetFontSize(font
, &size
));
951 SetStatus(DllExports::GdipGetFontStyle(font
, &style
));
959 SetStatus(DllExports::GdipGetFontUnit(font
, &unit
));
975 mutable Status status
;
979 SetStatus(Status status
) const
983 this->status
= status
;
988 class Region
: public GdiplusBase
991 friend class Graphics
;
992 friend class GraphicsPath
;
995 Region(const Rect
&rect
)
997 status
= DllExports::GdipCreateRegionRectI(&rect
, ®ion
);
1002 status
= DllExports::GdipCreateRegion(®ion
);
1005 Region(const BYTE
*regionData
, INT size
)
1007 status
= DllExports::GdipCreateRegionRgnData(regionData
, size
, ®ion
);
1010 Region(const GraphicsPath
*path
)
1012 status
= DllExports::GdipCreateRegionPath(path
->nativePath
, ®ion
);
1017 status
= DllExports::GdipCreateRegionHrgn(hRgn
, ®ion
);
1020 Region(const RectF
&rect
)
1022 status
= DllExports::GdipCreateRegionRect(&rect
, ®ion
);
1028 Region
*cloneRegion
= new Region();
1029 cloneRegion
->status
= DllExports::GdipCloneRegion(region
, cloneRegion
? &cloneRegion
->region
: NULL
);
1034 Complement(const GraphicsPath
*path
)
1036 GpPath
*thePath
= path
? path
->nativePath
: NULL
;
1037 return SetStatus(DllExports::GdipCombineRegionPath(region
, thePath
, CombineModeComplement
));
1041 Complement(const Region
*region
)
1043 GpRegion
*theRegion
= region
? region
->region
: NULL
;
1044 return SetStatus(DllExports::GdipCombineRegionRegion(this->region
, theRegion
, CombineModeComplement
));
1048 Complement(const Rect
&rect
)
1050 return SetStatus(DllExports::GdipCombineRegionRectI(region
, &rect
, CombineModeComplement
));
1054 Complement(const RectF
&rect
)
1056 return SetStatus(DllExports::GdipCombineRegionRect(region
, &rect
, CombineModeComplement
));
1060 Equals(const Region
*region
, const Graphics
*g
) const
1063 SetStatus(DllExports::GdipIsEqualRegion(
1064 this->region
, region
? region
->region
: NULL
, g
? g
->graphics
: NULL
, &result
));
1069 Exclude(const GraphicsPath
*path
)
1071 return SetStatus(DllExports::GdipCombineRegionPath(region
, path
? path
->nativePath
: NULL
, CombineModeExclude
));
1075 Exclude(const RectF
&rect
)
1077 return SetStatus(DllExports::GdipCombineRegionRect(region
, &rect
, CombineModeExclude
));
1081 Exclude(const Rect
&rect
)
1083 return SetStatus(DllExports::GdipCombineRegionRectI(region
, &rect
, CombineModeExclude
));
1087 Exclude(const Region
*region
)
1090 DllExports::GdipCombineRegionRegion(this->region
, region
? region
->region
: NULL
, CombineModeExclude
));
1096 return new Region(hRgn
);
1100 GetBounds(Rect
*rect
, const Graphics
*g
) const
1102 return SetStatus(DllExports::GdipGetRegionBoundsI(region
, g
? g
->graphics
: NULL
, rect
));
1106 GetBounds(RectF
*rect
, const Graphics
*g
) const
1108 return SetStatus(DllExports::GdipGetRegionBounds(region
, g
? g
->graphics
: NULL
, rect
));
1112 GetData(BYTE
*buffer
, UINT bufferSize
, UINT
*sizeFilled
) const
1114 return SetStatus(DllExports::GdipGetRegionData(region
, buffer
, bufferSize
, sizeFilled
));
1121 SetStatus(DllExports::GdipGetRegionDataSize(region
, &bufferSize
));
1126 GetHRGN(const Graphics
*g
) const
1129 SetStatus(DllExports::GdipGetRegionHRgn(region
, g
? g
->graphics
: NULL
, &hRgn
));
1140 GetRegionScans(const Matrix
*matrix
, Rect
*rects
, INT
*count
) const
1142 return SetStatus(DllExports::GdipGetRegionScansI(region
, rects
, count
, matrix
? matrix
->nativeMatrix
: NULL
));
1146 GetRegionScans(const Matrix
*matrix
, RectF
*rects
, INT
*count
) const
1148 return SetStatus(DllExports::GdipGetRegionScans(region
, rects
, count
, matrix
? matrix
->nativeMatrix
: NULL
));
1152 GetRegionScansCount(const Matrix
*matrix
) const
1155 SetStatus(DllExports::GdipGetRegionScansCount(region
, &count
, matrix
? matrix
->nativeMatrix
: NULL
));
1160 Intersect(const Rect
&rect
)
1162 return SetStatus(DllExports::GdipCombineRegionRectI(region
, &rect
, CombineModeIntersect
));
1166 Intersect(const GraphicsPath
*path
)
1168 GpPath
*thePath
= path
? path
->nativePath
: NULL
;
1169 return SetStatus(DllExports::GdipCombineRegionPath(region
, thePath
, CombineModeIntersect
));
1173 Intersect(const RectF
&rect
)
1175 return SetStatus(DllExports::GdipCombineRegionRect(region
, &rect
, CombineModeIntersect
));
1179 Intersect(const Region
*region
)
1182 DllExports::GdipCombineRegionRegion(this->region
, region
? region
->region
: NULL
, CombineModeIntersect
));
1186 IsEmpty(const Graphics
*g
) const
1189 SetStatus(DllExports::GdipIsEmptyRegion(region
, g
? g
->graphics
: NULL
, &result
));
1194 IsInfinite(const Graphics
*g
) const
1197 SetStatus(DllExports::GdipIsInfiniteRegion(region
, g
? g
->graphics
: NULL
, &result
));
1202 IsVisible(const PointF
&point
, const Graphics
*g
) const
1205 SetStatus(DllExports::GdipIsVisibleRegionPoint(region
, point
.X
, point
.Y
, g
? g
->graphics
: NULL
, &result
));
1210 IsVisible(const RectF
&rect
, const Graphics
*g
) const
1213 SetStatus(DllExports::GdipIsVisibleRegionRect(
1214 region
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, g
? g
->graphics
: NULL
, &result
));
1219 IsVisible(const Rect
&rect
, const Graphics
*g
) const
1222 SetStatus(DllExports::GdipIsVisibleRegionRectI(
1223 region
, rect
.X
, rect
.Y
, rect
.Width
, rect
.Height
, g
? g
->graphics
: NULL
, &result
));
1228 IsVisible(INT x
, INT y
, const Graphics
*g
) const
1231 SetStatus(DllExports::GdipIsVisibleRegionPointI(region
, x
, y
, g
? g
->graphics
: NULL
, &result
));
1236 IsVisible(REAL x
, REAL y
, const Graphics
*g
) const
1239 SetStatus(DllExports::GdipIsVisibleRegionPoint(region
, x
, y
, g
? g
->graphics
: NULL
, &result
));
1244 IsVisible(INT x
, INT y
, INT width
, INT height
, const Graphics
*g
) const
1247 SetStatus(DllExports::GdipIsVisibleRegionRectI(region
, x
, y
, width
, height
, g
? g
->graphics
: NULL
, &result
));
1252 IsVisible(const Point
&point
, const Graphics
*g
) const
1255 SetStatus(DllExports::GdipIsVisibleRegionPointI(region
, point
.X
, point
.Y
, g
? g
->graphics
: NULL
, &result
));
1260 IsVisible(REAL x
, REAL y
, REAL width
, REAL height
, const Graphics
*g
) const
1263 SetStatus(DllExports::GdipIsVisibleRegionRect(region
, x
, y
, width
, height
, g
? g
->graphics
: NULL
, &result
));
1270 return SetStatus(DllExports::GdipSetEmpty(region
));
1276 return SetStatus(DllExports::GdipSetInfinite(region
));
1280 Transform(const Matrix
*matrix
)
1282 return SetStatus(DllExports::GdipTransformRegion(region
, matrix
? matrix
->nativeMatrix
: NULL
));
1286 Translate(REAL dx
, REAL dy
)
1288 return SetStatus(DllExports::GdipTranslateRegion(region
, dx
, dy
));
1292 Translate(INT dx
, INT dy
)
1294 return SetStatus(DllExports::GdipTranslateRegionI(region
, dx
, dy
));
1298 Union(const Rect
&rect
)
1300 return SetStatus(DllExports::GdipCombineRegionRectI(region
, &rect
, CombineModeUnion
));
1304 Union(const Region
*region
)
1307 DllExports::GdipCombineRegionRegion(this->region
, region
? region
->region
: NULL
, CombineModeUnion
));
1311 Union(const RectF
&rect
)
1313 return SetStatus(DllExports::GdipCombineRegionRect(region
, &rect
, CombineModeUnion
));
1317 Union(const GraphicsPath
*path
)
1319 return SetStatus(DllExports::GdipCombineRegionPath(region
, path
? path
->nativePath
: NULL
, CombineModeUnion
));
1323 Xor(const GraphicsPath
*path
)
1325 return SetStatus(DllExports::GdipCombineRegionPath(region
, path
? path
->nativePath
: NULL
, CombineModeXor
));
1329 Xor(const RectF
&rect
)
1331 return SetStatus(DllExports::GdipCombineRegionRect(region
, &rect
, CombineModeXor
));
1335 Xor(const Rect
&rect
)
1337 return SetStatus(DllExports::GdipCombineRegionRectI(region
, &rect
, CombineModeXor
));
1341 Xor(const Region
*region
)
1344 DllExports::GdipCombineRegionRegion(this->region
, region
? region
->region
: NULL
, CombineModeXor
));
1348 mutable Status status
;
1352 SetStatus(Status status
) const
1356 this->status
= status
;
1361 class CustomLineCap
: public GdiplusBase
1364 CustomLineCap(const GraphicsPath
*fillPath
, const GraphicsPath
*strokePath
, LineCap baseCap
, REAL baseInset
= 0);
1381 GetStrokeCaps(LineCap
*startCap
, LineCap
*endCap
);
1390 SetBaseCap(LineCap baseCap
);
1393 SetBaseInset(REAL inset
);
1396 SetStrokeCap(LineCap strokeCap
);
1399 SetStrokeCaps(LineCap startCap
, LineCap endCap
);
1402 SetStrokeJoin(LineJoin lineJoin
);
1405 SetWidthScale(IN REAL widthScale
);
1408 GpCustomLineCap
*nativeCap
;
1409 mutable Status lastStatus
;
1411 CustomLineCap() : nativeCap(NULL
), lastStatus(Ok
)
1415 CustomLineCap(GpCustomLineCap
*nativeCap
, Status status
)
1417 lastStatus
= status
;
1418 SetNativeCap(nativeCap
);
1422 SetNativeCap(GpCustomLineCap
*cap
)
1428 SetStatus(Status status
) const
1431 lastStatus
= status
;
1436 // CustomLineCap is not copyable
1437 CustomLineCap(const CustomLineCap
&);
1439 operator=(const CustomLineCap
&);
1442 inline TextureBrush::TextureBrush(Image
*image
, WrapMode wrapMode
, const RectF
&dstRect
)
1444 GpTexture
*texture
= NULL
;
1445 lastStatus
= DllExports::GdipCreateTexture2(
1446 image
->nativeImage
, wrapMode
, dstRect
.X
, dstRect
.Y
, dstRect
.Width
, dstRect
.Height
, &texture
);
1447 SetNativeBrush(texture
);
1450 inline TextureBrush::TextureBrush(Image
*image
, Rect
&dstRect
, ImageAttributes
*imageAttributes
)
1452 GpTexture
*texture
= NULL
;
1453 GpImageAttributes
*attrs
= imageAttributes
? imageAttributes
->nativeImageAttr
: NULL
;
1454 lastStatus
= DllExports::GdipCreateTextureIA(
1455 image
->nativeImage
, attrs
, dstRect
.X
, dstRect
.Y
, dstRect
.Width
, dstRect
.Height
, &texture
);
1456 SetNativeBrush(texture
);
1459 inline TextureBrush::TextureBrush(Image
*image
, WrapMode wrapMode
, INT dstX
, INT dstY
, INT dstWidth
, INT dstHeight
)
1461 GpTexture
*texture
= NULL
;
1463 DllExports::GdipCreateTexture2I(image
->nativeImage
, wrapMode
, dstX
, dstY
, dstWidth
, dstHeight
, &texture
);
1464 SetNativeBrush(texture
);
1467 inline TextureBrush::TextureBrush(Image
*image
, WrapMode wrapMode
, REAL dstX
, REAL dstY
, REAL dstWidth
, REAL dstHeight
)
1469 GpTexture
*texture
= NULL
;
1471 DllExports::GdipCreateTexture2(image
->nativeImage
, wrapMode
, dstX
, dstY
, dstWidth
, dstHeight
, &texture
);
1472 SetNativeBrush(texture
);
1475 inline TextureBrush::TextureBrush(Image
*image
, RectF
&dstRect
, ImageAttributes
*imageAttributes
)
1477 GpTexture
*texture
= NULL
;
1478 GpImageAttributes
*attrs
= imageAttributes
? imageAttributes
->nativeImageAttr
: NULL
;
1479 lastStatus
= DllExports::GdipCreateTextureIA(
1480 image
->nativeImage
, attrs
, dstRect
.X
, dstRect
.Y
, dstRect
.Width
, dstRect
.Height
, &texture
);
1481 SetNativeBrush(texture
);
1484 inline TextureBrush::TextureBrush(Image
*image
, WrapMode wrapMode
)
1486 GpTexture
*texture
= NULL
;
1487 lastStatus
= DllExports::GdipCreateTexture(image
->nativeImage
, wrapMode
, &texture
);
1488 SetNativeBrush(texture
);
1491 inline TextureBrush::TextureBrush(Image
*image
, WrapMode wrapMode
, const Rect
&dstRect
)
1493 GpTexture
*texture
= NULL
;
1494 lastStatus
= DllExports::GdipCreateTexture2I(
1495 image
->nativeImage
, wrapMode
, dstRect
.X
, dstRect
.Y
, dstRect
.Width
, dstRect
.Height
, &texture
);
1496 SetNativeBrush(texture
);
1500 TextureBrush::GetImage() const
1503 return NULL
; // FIXME
1505 GpImage
*image
= NULL
;
1506 GpTexture
*texture
= GetNativeTexture();
1507 SetStatus(DllExports::GdipGetTextureImage(texture
, &image
));
1508 if (lastStatus
!= Ok
)
1511 Image
*newImage
= new Image(image
, lastStatus
);
1513 DllExports::GdipDisposeImage(image
);
1518 #endif /* _GDIPLUSHEADERS_H */