diff --git a/win32/gdiplus/include/Gdiplus.h b/win32/gdiplus/include/Gdiplus.h new file mode 100644 index 0000000..82393e7 --- /dev/null +++ b/win32/gdiplus/include/Gdiplus.h @@ -0,0 +1,156 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Gdiplus.h +* +* Abstract: +* +* GDI+ Native C++ public header file +* +\**************************************************************************/ + +#ifndef _GDIPLUS_H +#define _GDIPLUS_H + +struct IDirectDrawSurface7; + +typedef signed short INT16; +typedef unsigned short UINT16; + +#ifndef DCR_REMOVE_INTERNAL + +#ifndef DCR_USE_NEW_105760 + #define DCR_USE_NEW_105760 +#endif +#ifndef DCR_USE_NEW_127084 + #define DCR_USE_NEW_127084 +#endif +#ifndef DCR_USE_NEW_135429 + #define DCR_USE_NEW_135429 +#endif +#ifndef DCR_USE_NEW_140782 + #define DCR_USE_NEW_140782 +#endif +#ifndef DCR_USE_NEW_140855 + #define DCR_USE_NEW_140855 +#endif +#ifndef DCR_USE_NEW_140857 + #define DCR_USE_NEW_140857 +#endif +#ifndef DCR_USE_NEW_140861 + #define DCR_USE_NEW_140861 +#endif +#ifndef DCR_USE_NEW_145135 + #define DCR_USE_NEW_145135 +#endif +#ifndef DCR_USE_NEW_145138 + #define DCR_USE_NEW_145138 +#endif +#ifndef DCR_USE_NEW_145139 + #define DCR_USE_NEW_145139 +#endif +#ifndef DCR_USE_NEW_145804 + #define DCR_USE_NEW_145804 +#endif +#ifndef DCR_USE_NEW_146933 + #define DCR_USE_NEW_146933 +#endif +#ifndef DCR_USE_NEW_152154 + #define DCR_USE_NEW_152154 +#endif +#ifndef DCR_USE_NEW_175866 + #define DCR_USE_NEW_175866 +#endif + +#ifndef DCR_USE_NEW_188922 + #define DCR_USE_NEW_188922 +#endif +#ifndef DCR_USE_NEW_137252 + #define DCR_USE_NEW_137252 +#endif +#ifndef DCR_USE_NEW_202903 + #define DCR_USE_NEW_202903 +#endif +#ifndef DCR_USE_NEW_197819 + #define DCR_USE_NEW_197819 +#endif +#ifndef DCR_USE_NEW_186091 + #define DCR_USE_NEW_186091 +#endif +#ifndef DCR_USE_NEW_125467 + #define DCR_USE_NEW_125467 +#endif +#ifndef DCR_USE_NEW_168772 + #define DCR_USE_NEW_168772 +#endif +#ifndef DCR_USE_NEW_186764 + #define DCR_USE_NEW_186764 +#endif +#ifndef DCR_USE_NEW_174340 + #define DCR_USE_NEW_174340 +#endif +#ifndef DCR_USE_NEW_186151 + #define DCR_USE_NEW_186151 +#endif + +#ifndef DCR_USE_NEW_235072 + #define DCR_USE_NEW_235072 +#endif + +#endif // DCR_REMOVE_INTERNAL + +namespace Gdiplus +{ + namespace DllExports + { + #include "GdiplusMem.h" + }; + + #include "GdiplusBase.h" + + // The following headers are used internally as well + #include "GdiplusEnums.h" + #include "GdiplusTypes.h" + #include "GdiplusInit.h" + #include "GdiplusPixelFormats.h" + #include "GdiplusColor.h" + #include "GdiplusMetaHeader.h" + #include "GdiplusImaging.h" + #include "GdiplusColorMatrix.h" + + // The rest of these are used only by the application + + #include "GdiplusGpStubs.h" + #include "GdiplusHeaders.h" + + namespace DllExports + { + #include "GdiplusFlat.h" + }; + + + #include "GdiplusImageAttributes.h" + #include "GdiplusMatrix.h" + #include "GdiplusBrush.h" + #include "GdiplusPen.h" + #include "GdiplusStringFormat.h" + #include "GdiplusPath.h" + #include "GdiplusLineCaps.h" + #include "GdiplusMetafile.h" + #include "GdiplusGraphics.h" + #include "GdiplusCachedBitmap.h" + #include "GdiplusRegion.h" + #include "GdiplusFontCollection.h" + #include "GdiplusFontFamily.h" + #include "GdiplusFont.h" + #include "GdiplusBitmap.h" + #include "GdiplusImageCodec.h" + +}; // namespace Gdiplus + + + +#endif // !_GDIPLUS_HPP diff --git a/win32/gdiplus/include/GdiplusBase.h b/win32/gdiplus/include/GdiplusBase.h new file mode 100644 index 0000000..40a977d --- /dev/null +++ b/win32/gdiplus/include/GdiplusBase.h @@ -0,0 +1,40 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBase.h +* +* Abstract: +* +* Represents the base class for GDIPlus memory allocation. +* +\**************************************************************************/ + +#ifndef _GDIPLUSBASE_H +#define _GDIPLUSBASE_H + +class GdiplusBase +{ +public: + void (operator delete)(void* in_pVoid) + { + DllExports::GdipFree(in_pVoid); + } + void* (operator new)(size_t in_size) + { + return DllExports::GdipAlloc(in_size); + } + void (operator delete[])(void* in_pVoid) + { + DllExports::GdipFree(in_pVoid); + } + void* (operator new[])(size_t in_size) + { + return DllExports::GdipAlloc(in_size); + } +}; + +#endif + diff --git a/win32/gdiplus/include/GdiplusBitmap.h b/win32/gdiplus/include/GdiplusBitmap.h new file mode 100644 index 0000000..fbe0061 --- /dev/null +++ b/win32/gdiplus/include/GdiplusBitmap.h @@ -0,0 +1,1004 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBitmap.h +* +* Abstract: +* +* Bitmap related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSBITMAP_H +#define _GDIPLUSBITMAP_H + +// NOTE: +// Our current choice for the public API is to use constructors +// instead of static load functions to create image objects. +// +// I've kept the static load functions here for now so that +// existing test programs are not broken. But they should +// eventually be taken out. + +#ifndef DCR_USE_NEW_140782 + +inline +Image::Image( + IN const WCHAR* filename + ) +{ + nativeImage = NULL; + lastResult = DllExports::GdipLoadImageFromFile(filename, &nativeImage); +} + +inline +Image::Image( + IN IStream* stream + ) +{ + nativeImage = NULL; + lastResult = DllExports::GdipLoadImageFromStream(stream, &nativeImage); +} + +inline Image* +Image::FromFile( + IN const WCHAR* filename + ) +{ + return new Image(filename); +} + +inline Image* +Image::FromStream( + IN IStream* stream + ) +{ + return new Image(stream); +} + +#else + +inline +Image::Image( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement + ) +{ + nativeImage = NULL; + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipLoadImageFromFileICM( + filename, + &nativeImage + ); + } + else + { + lastResult = DllExports::GdipLoadImageFromFile( + filename, + &nativeImage + ); + } +} + +inline +Image::Image( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement + ) +{ + nativeImage = NULL; + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipLoadImageFromStreamICM( + stream, + &nativeImage + ); + } + else + { + lastResult = DllExports::GdipLoadImageFromStream( + stream, + &nativeImage + ); + } +} + +inline Image* +Image::FromFile( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Image( + filename, + useEmbeddedColorManagement + ); +} + +inline Image* +Image::FromStream( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Image( + stream, + useEmbeddedColorManagement + ); +} + +#endif + +inline +Image::~Image() +{ + DllExports::GdipDisposeImage(nativeImage); +} + +inline Image* +Image::Clone() +{ + GpImage *cloneimage = NULL; + + SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage)); + + return new Image(cloneimage, lastResult); +} + +// Encorder Parameter + +inline UINT +Image::GetEncoderParameterListSize( + IN const CLSID* clsidEncoder + ) +{ + UINT size = 0; + + SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage, + clsidEncoder, + &size)); + return size; +} + +inline Status +Image::GetEncoderParameterList( + IN const CLSID* clsidEncoder, + IN UINT size, + OUT EncoderParameters* buffer + ) +{ + return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage, + clsidEncoder, + size, + buffer)); +} + +// Save images + +inline Status +Image::Save( + IN const WCHAR* filename, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveImageToFile(nativeImage, + filename, + clsidEncoder, + encoderParams)); +} + +inline Status +Image::Save( + IN IStream* stream, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveImageToStream(nativeImage, + stream, + clsidEncoder, + encoderParams)); +} + +inline Status +Image::SaveAdd( + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveAdd(nativeImage, + encoderParams)); +} + +inline Status +Image::SaveAdd( + IN Image* newImage, + IN const EncoderParameters *encoderParams + ) +{ + if ( newImage == NULL ) + { + return SetStatus(InvalidParameter); + } + + return SetStatus(DllExports::GdipSaveAddImage(nativeImage, + newImage->nativeImage, + encoderParams)); +} + +// Get size and type information +inline ImageType +Image::GetType() const +{ + ImageType type = ImageTypeUnknown; + + SetStatus(DllExports::GdipGetImageType(nativeImage, &type)); + + return type; +} + +inline Status +Image::GetPhysicalDimension( + OUT SizeF* size + ) +{ + if (size == NULL) + { + return SetStatus(InvalidParameter); + } + + REAL width, height; + Status status; + + status = SetStatus(DllExports::GdipGetImageDimension(nativeImage, + &width, &height)); + + size->Width = width; + size->Height = height; + + return status; +} + +inline Status +Image::GetBounds( + OUT RectF *srcRect, + OUT Unit *srcUnit + ) +{ + return SetStatus(DllExports::GdipGetImageBounds(nativeImage, + srcRect, srcUnit)); +} + +inline UINT +Image::GetWidth() +{ + UINT width = 0; + + SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width)); + + return width; +} + +inline UINT +Image::GetHeight() +{ + UINT height = 0; + + SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height)); + + return height; +} + +inline REAL +Image::GetHorizontalResolution() +{ + REAL resolution = 0.0f; + + SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution)); + + return resolution; +} + +inline REAL +Image::GetVerticalResolution() +{ + REAL resolution = 0.0f; + + SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution)); + + return resolution; +} + +inline UINT +Image::GetFlags() +{ + UINT flags = 0; + + SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags)); + + return flags; +} + +inline Status +Image::GetRawFormat(OUT GUID *format) +{ + return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format)); +} + +inline PixelFormat +Image::GetPixelFormat() +{ + PixelFormat format; + + SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format)); + + return format; +} + +inline INT +Image::GetPaletteSize() +{ + INT size = 0; + + SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size)); + + return size; +} + +inline Status +Image::GetPalette( + OUT ColorPalette *palette, + IN INT size +) +{ + return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size)); +} + +inline Status +Image::SetPalette( + IN const ColorPalette *palette + ) +{ + return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette)); +} + +// Thumbnail support + +inline Image* +Image::GetThumbnailImage( + IN UINT thumbWidth, + IN UINT thumbHeight, + IN GetThumbnailImageAbort callback, + IN VOID* callbackData + ) +{ + GpImage *thumbimage = NULL; + + SetStatus(DllExports::GdipGetImageThumbnail(nativeImage, + thumbWidth, thumbHeight, + &thumbimage, + callback, callbackData)); + + Image *newImage = new Image(thumbimage, lastResult); + + if (newImage == NULL) + { + DllExports::GdipDisposeImage(thumbimage); + } + + return newImage; +} + +// Multi-frame support +inline UINT +Image::GetFrameDimensionsCount() +{ + UINT count = 0; + + SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage, + &count)); + + return count; +} + +inline Status +Image::GetFrameDimensionsList( + OUT GUID* dimensionIDs, + IN UINT count + ) +{ + return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage, + dimensionIDs, + count)); +} + +inline UINT +Image::GetFrameCount( + IN const GUID* dimensionID + ) +{ + UINT count = 0; + + SetStatus(DllExports::GdipImageGetFrameCount(nativeImage, + dimensionID, + &count)); + return count; +} + +inline Status +Image::SelectActiveFrame( + IN const GUID *dimensionID, + IN UINT frameIndex + ) +{ + return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage, + dimensionID, + frameIndex)); +} + +inline Status +Image::RotateFlip( + IN RotateFlipType rotateFlipType + ) +{ + return SetStatus(DllExports::GdipImageRotateFlip(nativeImage, + rotateFlipType)); +} + +// Image property related functions + +inline UINT +Image::GetPropertyCount() +{ + UINT numProperty = 0; + + SetStatus(DllExports::GdipGetPropertyCount(nativeImage, + &numProperty)); + + return numProperty; +} + +inline Status +Image::GetPropertyIdList( + IN UINT numOfProperty, + OUT PROPID* list + ) +{ + return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage, + numOfProperty, list)); +} + +inline UINT +Image::GetPropertyItemSize( + IN PROPID propId + ) +{ + UINT size = 0; + + SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage, + propId, + &size)); + + return size; +} + +inline Status +Image::GetPropertyItem( + IN PROPID propId, + IN UINT propSize, + OUT PropertyItem* buffer + ) +{ + return SetStatus(DllExports::GdipGetPropertyItem(nativeImage, + propId, propSize, buffer)); +} + +inline Status +Image::GetPropertySize( + OUT UINT* totalBufferSize, + OUT UINT* numProperties + ) +{ + return SetStatus(DllExports::GdipGetPropertySize(nativeImage, + totalBufferSize, + numProperties)); +} + +inline Status +Image::GetAllPropertyItems( + IN UINT totalBufferSize, + IN UINT numProperties, + OUT PropertyItem* allItems + ) +{ + if (allItems == NULL) + { + return SetStatus(InvalidParameter); + } + return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage, + totalBufferSize, + numProperties, + allItems)); +} + +inline Status +Image::RemovePropertyItem( + IN PROPID propId + ) +{ + return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId)); +} + +inline Status +Image::SetPropertyItem( + IN const PropertyItem* item + ) +{ + return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item)); +} + +// Get/SetLayout +// Support for Middle East localization (right-to-left mirroring) + +inline ImageLayout +Image::GetLayout() const +{ + ImageLayout layout; + + SetStatus(DllExports::GdipGetImageLayout(nativeImage, &layout)); + + return layout; +} + +inline Status +Image::SetLayout(IN const ImageLayout layout) +{ + return SetStatus( + DllExports::GdipSetImageLayout(nativeImage, layout) + ); +} + +inline Status +Image::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +inline +Image::Image(GpImage *nativeImage, Status status) +{ + SetNativeImage(nativeImage); + lastResult = status; +} + +inline VOID +Image::SetNativeImage(GpImage *nativeImage) +{ + this->nativeImage = nativeImage; +} + +inline +Bitmap::Bitmap( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement + ) +{ + GpBitmap *bitmap = NULL; + + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap); + } + else + { + lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap); + } + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement + ) +{ + GpBitmap *bitmap = NULL; + + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap); + } + else + { + lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap); + } + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN INT stride, + IN PixelFormat format, + IN BYTE *scan0 + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromScan0(width, + height, + stride, + format, + scan0, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN PixelFormat format + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromScan0(width, + height, + 0, + format, + NULL, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN Graphics* target) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromGraphics(width, + height, + target->nativeGraphics, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN IDirectDrawSurface7 * surface + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo, + gdiBitmapData, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HBITMAP hbm, + IN HPALETTE hpal + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HICON hicon + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HINSTANCE hInstance, + IN const WCHAR *bitmapName + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromResource(hInstance, + bitmapName, + &bitmap); + + SetNativeImage(bitmap); +} + + +inline Bitmap* +Bitmap::FromFile( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Bitmap( + filename, + useEmbeddedColorManagement + ); +} + +inline Bitmap* +Bitmap::FromStream( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Bitmap( + stream, + useEmbeddedColorManagement + ); +} + +inline Bitmap* +Bitmap::FromDirectDrawSurface7( + IN IDirectDrawSurface7* surface + ) +{ + return new Bitmap(surface); +} + +inline Bitmap* +Bitmap::FromBITMAPINFO( + IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData) +{ + return new Bitmap(gdiBitmapInfo, gdiBitmapData); +} + +inline Bitmap* +Bitmap::FromHBITMAP( + IN HBITMAP hbm, + IN HPALETTE hpal + ) +{ + return new Bitmap(hbm, hpal); +} + +inline Bitmap* +Bitmap::FromHICON( + IN HICON hicon + ) +{ + return new Bitmap(hicon); +} + +inline Bitmap* +Bitmap::FromResource( + IN HINSTANCE hInstance, + IN const WCHAR *bitmapName) +{ + return new Bitmap(hInstance, bitmapName); +} + +inline Status +Bitmap::GetHBITMAP( + IN const Color& colorBackground, + OUT HBITMAP* hbmReturn + ) +{ + return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap( + static_cast(nativeImage), + hbmReturn, + colorBackground.GetValue())); +} + +inline Status +Bitmap::GetHICON( + OUT HICON* hiconReturn + ) +{ + return SetStatus(DllExports::GdipCreateHICONFromBitmap( + static_cast(nativeImage), + hiconReturn)); +} + +inline Bitmap* +Bitmap::Clone( + IN const Rect& rect, + IN PixelFormat format + ) +{ + return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); +} + +inline Bitmap* +Bitmap::Clone( + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN PixelFormat format + ) +{ + GpBitmap* gpdstBitmap = NULL; + Bitmap* bitmap; + + lastResult = DllExports::GdipCloneBitmapAreaI( + x, + y, + width, + height, + format, + (GpBitmap *)nativeImage, + &gpdstBitmap); + + if (lastResult == Ok) + { + bitmap = new Bitmap(gpdstBitmap); + + if (bitmap == NULL) + { + DllExports::GdipDisposeImage(gpdstBitmap); + } + + return bitmap; + } + else + return NULL; +} + +inline Bitmap* +Bitmap::Clone( + IN const RectF& rect, + IN PixelFormat format + ) +{ + return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); +} + +inline Bitmap* +Bitmap::Clone( + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN PixelFormat format + ) +{ + GpBitmap* gpdstBitmap = NULL; + Bitmap* bitmap; + + SetStatus(DllExports::GdipCloneBitmapArea( + x, + y, + width, + height, + format, + (GpBitmap *)nativeImage, + &gpdstBitmap)); + + if (lastResult == Ok) + { + bitmap = new Bitmap(gpdstBitmap); + + if (bitmap == NULL) + { + DllExports::GdipDisposeImage(gpdstBitmap); + } + + return bitmap; + } + else + return NULL; +} + +inline Bitmap::Bitmap(GpBitmap *nativeBitmap) +{ + lastResult = Ok; + + SetNativeImage(nativeBitmap); +} + +inline Status +Bitmap::LockBits( + IN const Rect& rect, + IN UINT flags, + IN PixelFormat format, + OUT BitmapData* lockedBitmapData +) +{ + return SetStatus(DllExports::GdipBitmapLockBits( + static_cast(nativeImage), + &rect, + flags, + format, + lockedBitmapData)); +} + +inline Status +Bitmap::UnlockBits( + IN BitmapData* lockedBitmapData + ) +{ + return SetStatus(DllExports::GdipBitmapUnlockBits( + static_cast(nativeImage), + lockedBitmapData)); +} + +inline Status +Bitmap::GetPixel( + IN INT x, + IN INT y, + OUT Color *color) +{ + ARGB argb; + + Status status = SetStatus(DllExports::GdipBitmapGetPixel( + static_cast(nativeImage), + x, y, + &argb)); + + if (status == Ok) + { + color->SetValue(argb); + } + + return status; +} + +inline Status +Bitmap::SetPixel( + IN INT x, + IN INT y, + IN const Color& color) +{ + return SetStatus(DllExports::GdipBitmapSetPixel( + static_cast(nativeImage), + x, y, + color.GetValue())); +} + +inline Status +Bitmap::SetResolution( + IN REAL xdpi, + IN REAL ydpi) +{ + return SetStatus(DllExports::GdipBitmapSetResolution( + static_cast(nativeImage), + xdpi, ydpi)); +} +#endif diff --git a/win32/gdiplus/include/GdiplusBrush.h b/win32/gdiplus/include/GdiplusBrush.h new file mode 100644 index 0000000..a506f87 --- /dev/null +++ b/win32/gdiplus/include/GdiplusBrush.h @@ -0,0 +1,951 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBrush.h +* +* Abstract: +* +* Brush API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSBRUSH_H +#define _GDIPLUSBRUSH_H + +//-------------------------------------------------------------------------- +// Abstract base class for various brush types +//-------------------------------------------------------------------------- + +class GraphicsPath; + +class Brush : public GdiplusBase +{ +public: + friend class Pen; + friend class Graphics; + + virtual ~Brush() + { + DllExports::GdipDeleteBrush(nativeBrush); + } + + virtual Brush* Clone() const + { + GpBrush *brush = NULL; + + SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush)); + + Brush *newBrush = new Brush(brush, lastResult); + + if (newBrush == NULL) + { + DllExports::GdipDeleteBrush(brush); + } + + return newBrush; + } + + BrushType GetType() const + { + BrushType type = static_cast(-1); + + SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type)); + + return type; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + + Brush() + { + SetStatus(NotImplemented); + } + +#ifdef DCR_USE_NEW_250932 + +private: + Brush(const Brush& brush); + Brush& operator=(const Brush& brush); +protected: + +#else + + Brush(const Brush& brush) + { + brush; + SetStatus(NotImplemented); + } + + Brush& operator=(const Brush& brush) + { + brush; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Brush(GpBrush* nativeBrush, Status status) + { + lastResult = status; + SetNativeBrush(nativeBrush); + } + + VOID SetNativeBrush(GpBrush* nativeBrush) + { + this->nativeBrush = nativeBrush; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + GpBrush* nativeBrush; + mutable Status lastResult; +}; + +//-------------------------------------------------------------------------- +// Represent solid fill brush object +//-------------------------------------------------------------------------- + +class SolidBrush : public Brush +{ +public: + friend class Pen; + + SolidBrush(IN const Color& color) + { + GpSolidFill *brush = NULL; + + lastResult = DllExports::GdipCreateSolidFill(color.GetValue(), &brush); + + SetNativeBrush(brush); + } + + Status GetColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetSolidFillColor((GpSolidFill*)nativeBrush, + &argb)); + + *color = Color(argb); + + return lastResult; + } + + Status SetColor(IN const Color& color) + { + return SetStatus(DllExports::GdipSetSolidFillColor((GpSolidFill*)nativeBrush, + color.GetValue())); + } + +#ifdef DCR_USE_NEW_250932 + +private: + SolidBrush(const SolidBrush &); + SolidBrush& operator=(const SolidBrush &); + +#endif + +protected: + + SolidBrush() + { + } +}; + +class TextureBrush : public Brush +{ +public: + friend class Pen; + + TextureBrush(IN Image* image, + IN WrapMode wrapMode = WrapModeTile) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture( + image->nativeImage, + wrapMode, &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN const RectF &dstRect) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2( + image->nativeImage, + wrapMode, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + + TextureBrush(IN Image *image, + IN const RectF &dstRect, + IN const ImageAttributes *imageAttributes = NULL) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTextureIA( + image->nativeImage, + (imageAttributes)?imageAttributes->nativeImageAttr:NULL, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture + ); + + SetNativeBrush(texture); + } + + #ifdef DCR_USE_NEW_145138 + TextureBrush(IN Image *image, + IN const Rect &dstRect, + IN const ImageAttributes *imageAttributes = NULL) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTextureIAI( + image->nativeImage, + (imageAttributes)?imageAttributes->nativeImageAttr:NULL, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture + ); + + SetNativeBrush(texture); + } + #endif + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + + TextureBrush( + IN Image* image, + IN WrapMode wrapMode, + + #ifdef DCR_USE_NEW_145138 + const IN Rect &dstRect + #else + IN Rect &dstRect + #endif + ) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2I( + image->nativeImage, + wrapMode, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN REAL dstX, + IN REAL dstY, + IN REAL dstWidth, + IN REAL dstHeight) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2( + image->nativeImage, + wrapMode, + dstX, + dstY, + dstWidth, + dstHeight, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN INT dstX, + IN INT dstY, + IN INT dstWidth, + IN INT dstHeight) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2I( + image->nativeImage, + wrapMode, + dstX, + dstY, + dstWidth, + dstHeight, + &texture); + + SetNativeBrush(texture); + } + + /** + * Set/get brush transform + */ + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetTextureTransform((GpTexture*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateTextureTransform((GpTexture*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleTextureTransform((GpTexture*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateTextureTransform((GpTexture*)nativeBrush, + angle, order)); + } + + /** + * Set/get brush wrapping mode + */ + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetTextureWrapMode((GpTexture*)nativeBrush, + wrapMode)); + } + + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetTextureWrapMode((GpTexture*)nativeBrush, + &wrapMode)); + return wrapMode; + } + + // Get texture brush attributes + + Image *GetImage() const + { + GpImage *image; + + SetStatus(DllExports::GdipGetTextureImage((GpTexture *)nativeBrush, + &image)); + + Image *retimage = new Image(image, lastResult); + + if (retimage == NULL) + { + DllExports::GdipDisposeImage(image); + } + + return retimage; + } + +#ifdef DCR_USE_NEW_250932 + +private: + TextureBrush(const TextureBrush &); + TextureBrush& operator=(const TextureBrush &); + +#endif + +protected: + + TextureBrush() + { + } +}; + +//-------------------------------------------------------------------------- +// Represent line gradient brush object +//-------------------------------------------------------------------------- + +class LinearGradientBrush : public Brush +{ +public: + friend class Pen; + + LinearGradientBrush(IN const PointF& point1, + IN const PointF& point2, + IN const Color& color1, + IN const Color& color2) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrush(&point1, + &point2, + color1.GetValue(), + color2.GetValue(), + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Point& point1, + IN const Point& point2, + IN const Color& color1, + IN const Color& color2) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushI(&point1, + &point2, + color1.GetValue(), + color2.GetValue(), + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const RectF& rect, + IN const Color& color1, + IN const Color& color2, + IN LinearGradientMode mode) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRect(&rect, + color1.GetValue(), + color2.GetValue(), + mode, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Rect& rect, + IN const Color& color1, + IN const Color& color2, + IN LinearGradientMode mode) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectI(&rect, + color1.GetValue(), + color2.GetValue(), + mode, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const RectF& rect, + IN const Color& color1, + IN const Color& color2, + IN REAL angle, + IN BOOL isAngleScalable = FALSE) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectWithAngle(&rect, + color1.GetValue(), + color2.GetValue(), + angle, + isAngleScalable, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Rect& rect, + IN const Color& color1, + IN const Color& color2, + IN REAL angle, + IN BOOL isAngleScalable = FALSE) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectWithAngleI(&rect, + color1.GetValue(), + color2.GetValue(), + angle, + isAngleScalable, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + // Get/set point attributes + + Status SetLinearPoints(IN const PointF& point1, + IN const PointF& point2) + { + return SetStatus(DllExports::GdipSetLinePoints((GpLineGradient*)nativeBrush, + &point1, &point2)); + } + + Status GetLinearPoints(OUT PointF* points) const + { + return SetStatus(DllExports::GdipGetLinePoints((GpLineGradient*) nativeBrush, + points)); + } + + Status SetLinearPoints(IN const Point& point1, + IN const Point& point2) + { + return SetStatus(DllExports::GdipSetLinePointsI((GpLineGradient*)nativeBrush, + &point1, &point2)); + } + + Status GetLinearPoints(OUT Point* points) const + { + return SetStatus(DllExports::GdipGetLinePointsI((GpLineGradient*) nativeBrush, + points)); + } + // Get/set color attributes + + Status SetLinearColors(IN const Color& color1, + IN const Color& color2) + { + return SetStatus(DllExports::GdipSetLineColors((GpLineGradient*)nativeBrush, + color1.GetValue(), + color2.GetValue())); + } + + Status GetLinearColors(OUT Color* colors) const + { + ARGB argb[2]; + + if (colors == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetLineColors((GpLineGradient*) nativeBrush, argb)); + + if (lastResult == Ok) + { + // use bitwise copy operator for Color copy + colors[0] = Color(argb[0]); + colors[1] = Color(argb[1]); + } + + return lastResult; + } + + Status GetRectangle(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetLineRect((GpLineGradient*)nativeBrush, rect)); + } + + // integer version + Status GetRectangle(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect)); + } + + // Gamma correction in interporlation. + + Status SetGammaCorrection(IN BOOL useGammaCorrection) + { + return SetStatus(DllExports::GdipSetLineGammaCorrection((GpLineGradient*)nativeBrush, + useGammaCorrection)); + } + + BOOL GetGammaCorrection() const + { + BOOL useGammaCorrection; + + SetStatus(DllExports::GdipGetLineGammaCorrection((GpLineGradient*)nativeBrush, + &useGammaCorrection)); + + return useGammaCorrection; + } + + INT GetBlendCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetLineBlendCount((GpLineGradient*) + nativeBrush, + &count)); + + return count; + } + + Status SetBlend(IN const REAL* blendFactors, + IN const REAL* blendPositions, + IN INT count) + { + return SetStatus(DllExports::GdipSetLineBlend((GpLineGradient*) + nativeBrush, + blendFactors, + blendPositions, + count)); + } + + Status GetBlend(OUT REAL* blendFactors, + OUT REAL* blendPositions, + IN INT count) const + { + return SetStatus(DllExports::GdipGetLineBlend((GpLineGradient*)nativeBrush, + blendFactors, + blendPositions, + count)); + } + + INT GetInterpolationColorCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetLinePresetBlendCount((GpLineGradient*) + nativeBrush, + &count)); + + return count; + } + + Status SetInterpolationColors(IN const Color* presetColors, + IN const REAL* blendPositions, + IN INT count) + { + if ((count <= 0) || !presetColors) + return SetStatus(InvalidParameter); + + ARGB *argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; + + if (argbs) + { + for (INT i = 0; i < count; i++) + { + argbs[i] = presetColors[i].GetValue(); + } + + Status status = SetStatus(DllExports::GdipSetLinePresetBlend( + (GpLineGradient*) nativeBrush, + argbs, + blendPositions, + count)); + delete [] argbs; + return status; + } + else + { + return SetStatus(OutOfMemory); + } + } + + Status GetInterpolationColors(OUT Color* presetColors, + OUT REAL* blendPositions, + IN INT count) const + { + if ((count <= 0) || !presetColors) + return SetStatus(InvalidParameter); + + ARGB* argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; + + if (!argbs) + { + return SetStatus(OutOfMemory); + } + + Status status = SetStatus(DllExports::GdipGetLinePresetBlend((GpLineGradient*)nativeBrush, + argbs, + blendPositions, + count)); + if (status == Ok) + { + for (INT i = 0; i < count; i++) + { + presetColors[i] = Color(argbs[i]); + } + } + + delete [] argbs; + + return status; + } + + Status SetBlendBellShape(IN REAL focus, + IN REAL scale = 1.0) + { + return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale)); + } + + #ifdef DCR_USE_NEW_145135 + Status SetBlendTriangularShape( + IN REAL focus, + IN REAL scale = 1.0 + ) + #else + Status SetBlendTrianglarShape(IN REAL focus, + IN REAL scale = 1.0) + #endif + { + return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale)); + } + + /** + * Set/get brush transform + */ + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix *matrix) const + { + return SetStatus(DllExports::GdipGetLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetLineTransform((GpLineGradient*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateLineTransform((GpLineGradient*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleLineTransform((GpLineGradient*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateLineTransform((GpLineGradient*)nativeBrush, + angle, order)); + } + + /** + * Set/get brush wrapping mode + */ + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetLineWrapMode((GpLineGradient*)nativeBrush, + wrapMode)); + } + + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetLineWrapMode((GpLineGradient*) + nativeBrush, + &wrapMode)); + + return wrapMode; + } + +#ifdef DCR_USE_NEW_250932 + +private: + LinearGradientBrush(const LinearGradientBrush &); + LinearGradientBrush& operator=(const LinearGradientBrush &); + +#endif + +protected: + + LinearGradientBrush() + { + } +}; + +//-------------------------------------------------------------------------- +// PathGradientBrush object is defined +// in gdipluspath.h. +//-------------------------------------------------------------------------- + +//-------------------------------------------------------------------------- +// Represent hatch brush object +//-------------------------------------------------------------------------- + +class HatchBrush : public Brush +{ +public: + friend class Pen; + + // Constructors + + HatchBrush(IN HatchStyle hatchStyle, + IN const Color& foreColor, + IN const Color& backColor = Color()) + { + GpHatch *brush = NULL; + + lastResult = DllExports::GdipCreateHatchBrush(hatchStyle, + foreColor.GetValue(), + backColor.GetValue(), + &brush); + SetNativeBrush(brush); + } + + HatchStyle GetHatchStyle() const + { + HatchStyle hatchStyle; + + SetStatus(DllExports::GdipGetHatchStyle((GpHatch*)nativeBrush, + &hatchStyle)); + + return hatchStyle; + } + + Status GetForegroundColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = SetStatus(DllExports::GdipGetHatchForegroundColor( + (GpHatch*)nativeBrush, + &argb)); + + color->SetValue(argb); + + return status; + } + + Status GetBackgroundColor(OUT Color *color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = SetStatus(DllExports::GdipGetHatchBackgroundColor( + (GpHatch*)nativeBrush, + &argb)); + + color->SetValue(argb); + + return status; + } + +#ifdef DCR_USE_NEW_250932 + +private: + HatchBrush(const HatchBrush &); + HatchBrush& operator=(const HatchBrush &); + +#endif + +protected: + + HatchBrush() + { + } +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusCachedBitmap.h b/win32/gdiplus/include/GdiplusCachedBitmap.h new file mode 100644 index 0000000..28fd8ca --- /dev/null +++ b/win32/gdiplus/include/GdiplusCachedBitmap.h @@ -0,0 +1,71 @@ +/************************************************************************** +* +* Copyright (c) 2000 Microsoft Corporation +* +* Module Name: +* +* CachedBitmap class definition +* +* Abstract: +* +* CachedBitmap is a representation of an accelerated drawing +* that has restrictions on what operations are allowed in order +* to accelerate the drawing to the destination. +* +**************************************************************************/ + +#ifndef _GDIPLUSCACHEDBITMAP_H +#define _GDIPLUSCACHEDBITMAP_H + +/************************************************************************** +* +* Class Name: +* +* CachedBitmap +* +* Abstract: +* +* An object to store a bitmap prepared for rendering on a particular +* Graphics object. The memory storage for the CachedBitmap is opaque +* to the other Engine code, so the only operations supported are +* initializing the data (with a bitmap) and using the graphics to +* draw it on the screen with an integer offset. +* +* Look for the class definition in GdiplusHeaders.h +* +* Created: +* +* 04/23/2000 asecchia +* Created it. +* +**************************************************************************/ +inline +CachedBitmap::CachedBitmap( + IN Bitmap *bitmap, + IN Graphics *graphics) +{ + nativeCachedBitmap = NULL; + + lastResult = DllExports::GdipCreateCachedBitmap( + (GpBitmap *)bitmap->nativeImage, + graphics->nativeGraphics, + &nativeCachedBitmap + ); +} + +inline +CachedBitmap::~CachedBitmap() +{ + DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap); +} + +inline Status +CachedBitmap::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + return (lastStatus); +} + +#endif + diff --git a/win32/gdiplus/include/GdiplusColor.h b/win32/gdiplus/include/GdiplusColor.h new file mode 100644 index 0000000..72c21c2 --- /dev/null +++ b/win32/gdiplus/include/GdiplusColor.h @@ -0,0 +1,209 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusColor.h +* +* Abstract: +* +* Represents a GDI+ color. +* +\**************************************************************************/ + +#ifndef _GDIPLUSCOLOR_H +#define _GDIPLUSCOLOR_H + +//---------------------------------------------------------------------------- +// Color mode +//---------------------------------------------------------------------------- + +enum ColorMode +{ + ColorModeARGB32 = 0, + ColorModeARGB64 = 1 +}; + +//---------------------------------------------------------------------------- +// Color Channel flags +//---------------------------------------------------------------------------- + +enum ColorChannelFlags +{ + ColorChannelFlagsC = 0, + ColorChannelFlagsM, + ColorChannelFlagsY, + ColorChannelFlagsK, + ColorChannelFlagsLast +}; + +//---------------------------------------------------------------------------- +// Color +//---------------------------------------------------------------------------- + +class Color +{ +public: + + Color() + { + Argb = (ARGB)Color::Black; + } + + // Construct an opaque Color object with + // the specified R, G, B values. + + Color(IN BYTE r, + IN BYTE g, + IN BYTE b) + { + Argb = MakeARGB(255, r, g, b); + } + + // Construct a Color object with + // the specified A, R, G, B values. + // + // NOTE: R, G, B color values are not premultiplied. + + Color(IN BYTE a, + IN BYTE r, + IN BYTE g, + IN BYTE b) + { + Argb = MakeARGB(a, r, g, b); + } + + // Construct a Color object with + // the specified ARGB values. + // + // NOTE: R, G, B color components are not premultiplied. + + Color(IN ARGB argb) + { + Argb = argb; + } + + // Extract A, R, G, B components + + BYTE GetAlpha() const + { + return (BYTE) (Argb >> AlphaShift); + } + + BYTE GetA() const + { + return GetAlpha(); + } + + BYTE GetRed() const + { + return (BYTE) (Argb >> RedShift); + } + + BYTE GetR() const + { + return GetRed(); + } + + BYTE GetGreen() const + { + return (BYTE) (Argb >> GreenShift); + } + + BYTE GetG() const + { + return GetGreen(); + } + + BYTE GetBlue() const + { + return (BYTE) (Argb >> BlueShift); + } + + BYTE GetB() const + { + return GetBlue(); + } + + // Retrieve ARGB values + + ARGB GetValue() const + { + return Argb; + } + + VOID SetValue(IN ARGB argb) + { + Argb = argb; + } + + VOID SetFromCOLORREF(IN COLORREF rgb) + { + Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); + } + + COLORREF ToCOLORREF() const + { + return RGB(GetRed(), GetGreen(), GetBlue()); + } + +public: + + // Standard color constants + enum + { + Black = 0xff000000, + Silver = 0xffc0c0c0, + Gray = 0xff808080, + White = 0xffffffff, + Maroon = 0xff800000, + Red = 0xffff0000, + Purple = 0xff800080, + Fuchsia = 0xffff00ff, + Green = 0xff008000, + Lime = 0xff00ff00, + Olive = 0xff808000, + Yellow = 0xffffff00, + Navy = 0xff000080, + Blue = 0xff0000ff, + Teal = 0xff008080, + Aqua = 0xff00ffff + }; + + // Shift count and bit mask for A, R, G, B components + enum + { + AlphaShift = 24, + RedShift = 16, + GreenShift = 8, + BlueShift = 0 + }; + + enum + { + AlphaMask = 0xff000000, + RedMask = 0x00ff0000, + GreenMask = 0x0000ff00, + BlueMask = 0x000000ff + }; + + // Assemble A, R, G, B values into a 32-bit integer + static ARGB MakeARGB(IN BYTE a, + IN BYTE r, + IN BYTE g, + IN BYTE b) + { + return (((ARGB) (b) << BlueShift) | + ((ARGB) (g) << GreenShift) | + ((ARGB) (r) << RedShift) | + ((ARGB) (a) << AlphaShift)); + } + +protected: + + ARGB Argb; +}; + +#endif + diff --git a/win32/gdiplus/include/GdiplusColorMatrix.h b/win32/gdiplus/include/GdiplusColorMatrix.h new file mode 100644 index 0000000..d1d9ebc --- /dev/null +++ b/win32/gdiplus/include/GdiplusColorMatrix.h @@ -0,0 +1,63 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusColorMatrix.h +* +* Abstract: +* +* Class for color adjustment object passed to Graphics.DrawImage +* +\**************************************************************************/ + +#ifndef _GDIPLUSCOLORMATRIX_H +#define _GDIPLUSCOLORMATRIX_H + +//---------------------------------------------------------------------------- +// Color matrix +//---------------------------------------------------------------------------- + +struct ColorMatrix +{ + REAL m[5][5]; +}; + +//---------------------------------------------------------------------------- +// Color Matrix flags +//---------------------------------------------------------------------------- + +enum ColorMatrixFlags +{ + ColorMatrixFlagsDefault = 0, + ColorMatrixFlagsSkipGrays = 1, + ColorMatrixFlagsAltGray = 2 +}; + +//---------------------------------------------------------------------------- +// Color Adjust Type +//---------------------------------------------------------------------------- + +enum ColorAdjustType +{ + ColorAdjustTypeDefault, + ColorAdjustTypeBitmap, + ColorAdjustTypeBrush, + ColorAdjustTypePen, + ColorAdjustTypeText, + ColorAdjustTypeCount, // must be immediately after all the individual ones + ColorAdjustTypeAny // internal use: for querying if any type has recoloring +}; + +//---------------------------------------------------------------------------- +// Color Map +//---------------------------------------------------------------------------- + +struct ColorMap +{ + Color oldColor; + Color newColor; +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusEnums.h b/win32/gdiplus/include/GdiplusEnums.h new file mode 100644 index 0000000..42b620c --- /dev/null +++ b/win32/gdiplus/include/GdiplusEnums.h @@ -0,0 +1,1252 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusEnums.h +* +* Abstract: +* +* Various enumeration types +* +\**************************************************************************/ + +#ifndef _GDIPLUSENUMS_H +#define _GDIPLUSENUMS_H + + +//-------------------------------------------------------------------------- +// Default bezier flattening tolerance in device pixels. +//-------------------------------------------------------------------------- + +const float FlatnessDefault = 1.0f/4.0f; + +//-------------------------------------------------------------------------- +// Graphics and Container State cookies +//-------------------------------------------------------------------------- + +typedef UINT GraphicsState; +typedef UINT GraphicsContainer; + +//-------------------------------------------------------------------------- +// Fill mode constants +//-------------------------------------------------------------------------- + +enum FillMode +{ + FillModeAlternate, // 0 + FillModeWinding // 1 +}; + +//-------------------------------------------------------------------------- +// Quality mode constants +//-------------------------------------------------------------------------- + +enum QualityMode +{ + QualityModeInvalid = -1, + QualityModeDefault = 0, + QualityModeLow = 1, // for apps that need the best performance + QualityModeHigh = 2 // for apps that need the best rendering quality +}; + +//-------------------------------------------------------------------------- +// Alpha compositing mode constants +//-------------------------------------------------------------------------- + +enum CompositingMode +{ + CompositingModeSourceOver, // 0 + CompositingModeSourceCopy // 1 +}; + +//-------------------------------------------------------------------------- +// Alpha compositing quality constants +//-------------------------------------------------------------------------- + +enum CompositingQuality +{ + CompositingQualityInvalid = QualityModeInvalid, + CompositingQualityDefault = QualityModeDefault, + CompositingQualityHighSpeed = QualityModeLow, + CompositingQualityHighQuality = QualityModeHigh, + CompositingQualityGammaCorrected, + CompositingQualityAssumeLinear +}; + +//-------------------------------------------------------------------------- +// Unit constants +//-------------------------------------------------------------------------- + +enum Unit +{ + UnitWorld, // 0 -- World coordinate (non-physical unit) + UnitDisplay, // 1 -- Variable -- for PageTransform only + UnitPixel, // 2 -- Each unit is one device pixel. + UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch. + UnitInch, // 4 -- Each unit is 1 inch. + UnitDocument, // 5 -- Each unit is 1/300 inch. + UnitMillimeter // 6 -- Each unit is 1 millimeter. +}; + +//-------------------------------------------------------------------------- +// MetafileFrameUnit +// +// The frameRect for creating a metafile can be specified in any of these +// units. There is an extra frame unit value (MetafileFrameUnitGdi) so +// that units can be supplied in the same units that GDI expects for +// frame rects -- these units are in .01 (1/100ths) millimeter units +// as defined by GDI. +//-------------------------------------------------------------------------- +enum MetafileFrameUnit +{ + MetafileFrameUnitPixel = UnitPixel, + MetafileFrameUnitPoint = UnitPoint, + MetafileFrameUnitInch = UnitInch, + MetafileFrameUnitDocument = UnitDocument, + MetafileFrameUnitMillimeter = UnitMillimeter, + MetafileFrameUnitGdi // GDI compatible .01 MM units +}; + +//-------------------------------------------------------------------------- +// Coordinate space identifiers +//-------------------------------------------------------------------------- + +enum CoordinateSpace +{ + CoordinateSpaceWorld, // 0 + CoordinateSpacePage, // 1 + CoordinateSpaceDevice // 2 +}; + +//-------------------------------------------------------------------------- +// Various wrap modes for brushes +//-------------------------------------------------------------------------- + +enum WrapMode +{ + WrapModeTile, // 0 + WrapModeTileFlipX, // 1 + WrapModeTileFlipY, // 2 + WrapModeTileFlipXY, // 3 + WrapModeClamp // 4 +}; + +//-------------------------------------------------------------------------- +// Various hatch styles +//-------------------------------------------------------------------------- + +enum HatchStyle +{ + HatchStyleHorizontal, // 0 + HatchStyleVertical, // 1 + HatchStyleForwardDiagonal, // 2 + HatchStyleBackwardDiagonal, // 3 + HatchStyleCross, // 4 + HatchStyleDiagonalCross, // 5 + HatchStyle05Percent, // 6 + HatchStyle10Percent, // 7 + HatchStyle20Percent, // 8 + HatchStyle25Percent, // 9 + HatchStyle30Percent, // 10 + HatchStyle40Percent, // 11 + HatchStyle50Percent, // 12 + HatchStyle60Percent, // 13 + HatchStyle70Percent, // 14 + HatchStyle75Percent, // 15 + HatchStyle80Percent, // 16 + HatchStyle90Percent, // 17 + HatchStyleLightDownwardDiagonal, // 18 + HatchStyleLightUpwardDiagonal, // 19 + HatchStyleDarkDownwardDiagonal, // 20 + HatchStyleDarkUpwardDiagonal, // 21 + HatchStyleWideDownwardDiagonal, // 22 + HatchStyleWideUpwardDiagonal, // 23 + HatchStyleLightVertical, // 24 + HatchStyleLightHorizontal, // 25 + HatchStyleNarrowVertical, // 26 + HatchStyleNarrowHorizontal, // 27 + HatchStyleDarkVertical, // 28 + HatchStyleDarkHorizontal, // 29 + HatchStyleDashedDownwardDiagonal, // 30 + HatchStyleDashedUpwardDiagonal, // 31 + HatchStyleDashedHorizontal, // 32 + HatchStyleDashedVertical, // 33 + HatchStyleSmallConfetti, // 34 + HatchStyleLargeConfetti, // 35 + HatchStyleZigZag, // 36 + HatchStyleWave, // 37 + HatchStyleDiagonalBrick, // 38 + HatchStyleHorizontalBrick, // 39 + HatchStyleWeave, // 40 + HatchStylePlaid, // 41 + HatchStyleDivot, // 42 + HatchStyleDottedGrid, // 43 + HatchStyleDottedDiamond, // 44 + HatchStyleShingle, // 45 + HatchStyleTrellis, // 46 + HatchStyleSphere, // 47 + HatchStyleSmallGrid, // 48 + HatchStyleSmallCheckerBoard, // 49 + HatchStyleLargeCheckerBoard, // 50 + HatchStyleOutlinedDiamond, // 51 + HatchStyleSolidDiamond, // 52 + + HatchStyleTotal, // must be after all unique hatch styles + + HatchStyleLargeGrid = HatchStyleCross, // 4 an alias for the cross style + + HatchStyleMin = HatchStyleHorizontal, + HatchStyleMax = HatchStyleTotal - 1, +}; + +//-------------------------------------------------------------------------- +// Dash style constants +//-------------------------------------------------------------------------- + +enum DashStyle +{ + DashStyleSolid, // 0 + DashStyleDash, // 1 + DashStyleDot, // 2 + DashStyleDashDot, // 3 + DashStyleDashDotDot, // 4 + DashStyleCustom // 5 +}; + +//-------------------------------------------------------------------------- +// Dash cap constants +//-------------------------------------------------------------------------- + +enum DashCap +{ + DashCapFlat = 0, + DashCapRound = 2, + DashCapTriangle = 3 +}; + +//-------------------------------------------------------------------------- +// Line cap constants (only the lowest 8 bits are used). +//-------------------------------------------------------------------------- + +enum LineCap +{ + LineCapFlat = 0, + LineCapSquare = 1, + LineCapRound = 2, + LineCapTriangle = 3, + + LineCapNoAnchor = 0x10, // corresponds to flat cap + LineCapSquareAnchor = 0x11, // corresponds to square cap + LineCapRoundAnchor = 0x12, // corresponds to round cap + LineCapDiamondAnchor = 0x13, // corresponds to triangle cap + LineCapArrowAnchor = 0x14, // no correspondence + + LineCapCustom = 0xff, // custom cap + + LineCapAnchorMask = 0xf0 // mask to check for anchor or not. +}; + +//-------------------------------------------------------------------------- +// Custom Line cap type constants +//-------------------------------------------------------------------------- + +enum CustomLineCapType +{ + CustomLineCapTypeDefault = 0, + CustomLineCapTypeAdjustableArrow = 1 +}; + +//-------------------------------------------------------------------------- +// Line join constants +//-------------------------------------------------------------------------- + +enum LineJoin +{ + LineJoinMiter = 0, + LineJoinBevel = 1, + LineJoinRound = 2, + LineJoinMiterClipped = 3 +}; + +//-------------------------------------------------------------------------- +// Path point types (only the lowest 8 bits are used.) +// The lowest 3 bits are interpreted as point type +// The higher 5 bits are reserved for flags. +//-------------------------------------------------------------------------- + +enum PathPointType +{ + PathPointTypeStart = 0, // move + PathPointTypeLine = 1, // line + PathPointTypeBezier = 3, // default Beizer (= cubic Bezier) + PathPointTypePathTypeMask = 0x07, // type mask (lowest 3 bits). + PathPointTypeDashMode = 0x10, // currently in dash mode. + PathPointTypePathMarker = 0x20, // a marker for the path. + PathPointTypeCloseSubpath = 0x80, // closed flag + + // Path types used for advanced path. + + PathPointTypeBezier2 = 2, // quadratic Beizer + PathPointTypeBezier3 = 3, // cubic Bezier + PathPointTypeBezier4 = 4, // quartic (4th order) Beizer + PathPointTypeBezier5 = 5, // quintic (5th order) Bezier + PathPointTypeBezier6 = 6 // hexaic (6th order) Bezier +}; + + +//-------------------------------------------------------------------------- +// WarpMode constants +//-------------------------------------------------------------------------- + +enum WarpMode +{ + WarpModePerspective, // 0 + WarpModeBilinear // 1 +}; + +//-------------------------------------------------------------------------- +// LineGradient Mode +//-------------------------------------------------------------------------- + +enum LinearGradientMode +{ + LinearGradientModeHorizontal, // 0 + LinearGradientModeVertical, // 1 + LinearGradientModeForwardDiagonal, // 2 + LinearGradientModeBackwardDiagonal // 3 +}; + +//-------------------------------------------------------------------------- +// Region Comine Modes +//-------------------------------------------------------------------------- + +enum CombineMode +{ + CombineModeReplace, // 0 + CombineModeIntersect, // 1 + CombineModeUnion, // 2 + CombineModeXor, // 3 + CombineModeExclude, // 4 + CombineModeComplement // 5 (does exclude from) +}; + +//-------------------------------------------------------------------------- + // Image types +//-------------------------------------------------------------------------- + +enum ImageType +{ + ImageTypeUnknown, // 0 + ImageTypeBitmap, // 1 + ImageTypeMetafile // 2 +}; + +//-------------------------------------------------------------------------- +// Interpolation modes +//-------------------------------------------------------------------------- + +enum InterpolationMode +{ + InterpolationModeInvalid = QualityModeInvalid, + InterpolationModeDefault = QualityModeDefault, + InterpolationModeLowQuality = QualityModeLow, + InterpolationModeHighQuality = QualityModeHigh, + InterpolationModeBilinear, + InterpolationModeBicubic, + InterpolationModeNearestNeighbor, + InterpolationModeHighQualityBilinear, + InterpolationModeHighQualityBicubic +}; + +//-------------------------------------------------------------------------- +// Pen types +//-------------------------------------------------------------------------- +enum PenAlignment +{ + PenAlignmentCenter = 0, + PenAlignmentInset = 1, + PenAlignmentOutset = 2, + PenAlignmentLeft = 3, + PenAlignmentRight = 4 +}; + +//-------------------------------------------------------------------------- +// Brush types +//-------------------------------------------------------------------------- + +enum BrushType +{ + BrushTypeSolidColor = 0, + BrushTypeHatchFill = 1, + BrushTypeTextureFill = 2, + BrushTypePathGradient = 3, + BrushTypeLinearGradient = 4 +}; + +//-------------------------------------------------------------------------- +// Pen's Fill types +//-------------------------------------------------------------------------- + +enum PenType +{ + PenTypeSolidColor = BrushTypeSolidColor, + PenTypeHatchFill = BrushTypeHatchFill, + PenTypeTextureFill = BrushTypeTextureFill, + PenTypePathGradient = BrushTypePathGradient, + PenTypeLinearGradient = BrushTypeLinearGradient, + PenTypeUnknown = -1 +}; + +//-------------------------------------------------------------------------- +// Matrix Order +//-------------------------------------------------------------------------- + +enum MatrixOrder +{ + MatrixOrderPrepend = 0, + MatrixOrderAppend = 1 +}; + +//-------------------------------------------------------------------------- +// Generic font families +//-------------------------------------------------------------------------- + +enum GenericFontFamily +{ + GenericFontFamilySerif, + GenericFontFamilySansSerif, + GenericFontFamilyMonospace + +}; + +//-------------------------------------------------------------------------- +// FontStyle: face types and common styles +//-------------------------------------------------------------------------- + +// These should probably be flags + +// Must have: +// Regular = 0 +// Bold = 1 +// Italic = 2 +// BoldItalic = 3 + +enum FontStyle +{ + FontStyleRegular = 0, + FontStyleBold = 1, + FontStyleItalic = 2, + FontStyleBoldItalic = 3, + FontStyleUnderline = 4, + FontStyleStrikeout = 8 +}; + +//--------------------------------------------------------------------------- +// Smoothing Mode +//--------------------------------------------------------------------------- + +enum SmoothingMode +{ + SmoothingModeInvalid = QualityModeInvalid, + SmoothingModeDefault = QualityModeDefault, + SmoothingModeHighSpeed = QualityModeLow, + SmoothingModeHighQuality = QualityModeHigh, + SmoothingModeNone, + SmoothingModeAntiAlias +}; + +//--------------------------------------------------------------------------- +// Pixel Format Mode +//--------------------------------------------------------------------------- + +enum PixelOffsetMode +{ + PixelOffsetModeInvalid = QualityModeInvalid, + PixelOffsetModeDefault = QualityModeDefault, + PixelOffsetModeHighSpeed = QualityModeLow, + PixelOffsetModeHighQuality = QualityModeHigh, + PixelOffsetModeNone, // no pixel offset + PixelOffsetModeHalf // offset by -0.5, -0.5 for fast anti-alias perf +}; + +//--------------------------------------------------------------------------- +// Text Rendering Hint +//--------------------------------------------------------------------------- + +enum TextRenderingHint +{ +#ifdef DCR_USE_NEW_186764 + TextRenderingHintSystemDefault = 0, // Glyph with system default rendering hint + TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting +#else + TextRenderingHintSingleBitPerPixelGridFit = 0, // Glyph bitmap with hinting +#endif // DCR_USE_NEW_186764 + TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting + TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting + TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting + TextRenderingHintClearTypeGridFit // Glyph CT bitmap with hinting +}; + +//--------------------------------------------------------------------------- +// Metafile Types +//--------------------------------------------------------------------------- +enum MetafileType +{ + MetafileTypeInvalid, // Invalid metafile + MetafileTypeWmf, // Standard WMF + MetafileTypeWmfAldus, // Aldus Placeable Metafile format + MetafileTypeEmf, // EMF (not EMF+) + MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records + MetafileTypeEmfPlusDual // EMF+ with dual, down-level records +}; + +// Specifies the type of EMF to record +enum EmfType +{ + EmfTypeEmfOnly = MetafileTypeEmf, // no EMF+, only EMF + EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly, // no EMF, only EMF+ + EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual // both EMF+ and EMF +}; + +// All persistent objects must have a type listed here +enum ObjectType +{ + ObjectTypeInvalid, + ObjectTypeBrush, + ObjectTypePen, + ObjectTypePath, + ObjectTypeRegion, + ObjectTypeImage, + ObjectTypeFont, + ObjectTypeStringFormat, + ObjectTypeImageAttributes, + ObjectTypeCustomLineCap, + + ObjectTypeMax = ObjectTypeCustomLineCap, + ObjectTypeMin = ObjectTypeBrush +}; + +inline BOOL +ObjectTypeIsValid( + ObjectType type + ) +{ + return ((type >= ObjectTypeMin) && (type <= ObjectTypeMax)); +} + +//--------------------------------------------------------------------------- +// EMF+ Records +//--------------------------------------------------------------------------- + +// We have to change the WMF record numbers so that they don't conflict with +// the EMF and EMF+ record numbers. +/*enum EmfPlusRecordType;*/ +#define GDIP_EMFPLUS_RECORD_BASE 0x00004000 +#define GDIP_WMF_RECORD_BASE 0x00010000 +#define GDIP_WMF_RECORD_TO_EMFPLUS(n) (/*(EmfPlusRecordType)*/((n) | GDIP_WMF_RECORD_BASE)) +#define GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE)) +#define GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0) + +enum EmfPlusRecordType +{ + // Since we have to enumerate GDI records right along with GDI+ records, + // we list all the GDI records here so that they can be part of the + // same enumeration type which is used in the enumeration callback. + + WmfRecordTypeSetBkColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKCOLOR), + WmfRecordTypeSetBkMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKMODE), + WmfRecordTypeSetMapMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPMODE), + WmfRecordTypeSetROP2 = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETROP2), + WmfRecordTypeSetRelAbs = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETRELABS), + WmfRecordTypeSetPolyFillMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPOLYFILLMODE), + WmfRecordTypeSetStretchBltMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETSTRETCHBLTMODE), + WmfRecordTypeSetTextCharExtra = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCHAREXTRA), + WmfRecordTypeSetTextColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCOLOR), + WmfRecordTypeSetTextJustification = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTJUSTIFICATION), + WmfRecordTypeSetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWORG), + WmfRecordTypeSetWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWEXT), + WmfRecordTypeSetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTORG), + WmfRecordTypeSetViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTEXT), + WmfRecordTypeOffsetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETWINDOWORG), + WmfRecordTypeScaleWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEWINDOWEXT), + WmfRecordTypeOffsetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETVIEWPORTORG), + WmfRecordTypeScaleViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEVIEWPORTEXT), + WmfRecordTypeLineTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_LINETO), + WmfRecordTypeMoveTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_MOVETO), + WmfRecordTypeExcludeClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXCLUDECLIPRECT), + WmfRecordTypeIntersectClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_INTERSECTCLIPRECT), + WmfRecordTypeArc = GDIP_WMF_RECORD_TO_EMFPLUS(META_ARC), + WmfRecordTypeEllipse = GDIP_WMF_RECORD_TO_EMFPLUS(META_ELLIPSE), + WmfRecordTypeFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_FLOODFILL), + WmfRecordTypePie = GDIP_WMF_RECORD_TO_EMFPLUS(META_PIE), + WmfRecordTypeRectangle = GDIP_WMF_RECORD_TO_EMFPLUS(META_RECTANGLE), + WmfRecordTypeRoundRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_ROUNDRECT), + WmfRecordTypePatBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_PATBLT), + WmfRecordTypeSaveDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_SAVEDC), + WmfRecordTypeSetPixel = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPIXEL), + WmfRecordTypeOffsetClipRgn = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETCLIPRGN), + WmfRecordTypeTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_TEXTOUT), + WmfRecordTypeBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_BITBLT), + WmfRecordTypeStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHBLT), + WmfRecordTypePolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYGON), + WmfRecordTypePolyline = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYLINE), + WmfRecordTypeEscape = GDIP_WMF_RECORD_TO_EMFPLUS(META_ESCAPE), + WmfRecordTypeRestoreDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESTOREDC), + WmfRecordTypeFillRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FILLREGION), + WmfRecordTypeFrameRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FRAMEREGION), + WmfRecordTypeInvertRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_INVERTREGION), + WmfRecordTypePaintRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_PAINTREGION), + WmfRecordTypeSelectClipRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTCLIPREGION), + WmfRecordTypeSelectObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTOBJECT), + WmfRecordTypeSetTextAlign = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTALIGN), + WmfRecordTypeDrawText = GDIP_WMF_RECORD_TO_EMFPLUS(0x062F), // META_DRAWTEXT + WmfRecordTypeChord = GDIP_WMF_RECORD_TO_EMFPLUS(META_CHORD), + WmfRecordTypeSetMapperFlags = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPPERFLAGS), + WmfRecordTypeExtTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTTEXTOUT), + WmfRecordTypeSetDIBToDev = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETDIBTODEV), + WmfRecordTypeSelectPalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTPALETTE), + WmfRecordTypeRealizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_REALIZEPALETTE), + WmfRecordTypeAnimatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_ANIMATEPALETTE), + WmfRecordTypeSetPalEntries = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPALENTRIES), + WmfRecordTypePolyPolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYPOLYGON), + WmfRecordTypeResizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESIZEPALETTE), + WmfRecordTypeDIBBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBBITBLT), + WmfRecordTypeDIBStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBSTRETCHBLT), + WmfRecordTypeDIBCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBCREATEPATTERNBRUSH), + WmfRecordTypeStretchDIB = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHDIB), + WmfRecordTypeExtFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTFLOODFILL), + WmfRecordTypeSetLayout = GDIP_WMF_RECORD_TO_EMFPLUS(0x0149), // META_SETLAYOUT + WmfRecordTypeResetDC = GDIP_WMF_RECORD_TO_EMFPLUS(0x014C), // META_RESETDC + WmfRecordTypeStartDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x014D), // META_STARTDOC + WmfRecordTypeStartPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x004F), // META_STARTPAGE + WmfRecordTypeEndPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x0050), // META_ENDPAGE + WmfRecordTypeAbortDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x0052), // META_ABORTDOC + WmfRecordTypeEndDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x005E), // META_ENDDOC + WmfRecordTypeDeleteObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_DELETEOBJECT), + WmfRecordTypeCreatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPALETTE), + WmfRecordTypeCreateBrush = GDIP_WMF_RECORD_TO_EMFPLUS(0x00F8), // META_CREATEBRUSH + WmfRecordTypeCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPATTERNBRUSH), + WmfRecordTypeCreatePenIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPENINDIRECT), + WmfRecordTypeCreateFontIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEFONTINDIRECT), + WmfRecordTypeCreateBrushIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEBRUSHINDIRECT), + WmfRecordTypeCreateBitmapIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(0x02FD), // META_CREATEBITMAPINDIRECT + WmfRecordTypeCreateBitmap = GDIP_WMF_RECORD_TO_EMFPLUS(0x06FE), // META_CREATEBITMAP + WmfRecordTypeCreateRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEREGION), + + EmfRecordTypeHeader = EMR_HEADER, + EmfRecordTypePolyBezier = EMR_POLYBEZIER, + EmfRecordTypePolygon = EMR_POLYGON, + EmfRecordTypePolyline = EMR_POLYLINE, + EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO, + EmfRecordTypePolyLineTo = EMR_POLYLINETO, + EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE, + EmfRecordTypePolyPolygon = EMR_POLYPOLYGON, + EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX, + EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX, + EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX, + EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX, + EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX, + EmfRecordTypeEOF = EMR_EOF, + EmfRecordTypeSetPixelV = EMR_SETPIXELV, + EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS, + EmfRecordTypeSetMapMode = EMR_SETMAPMODE, + EmfRecordTypeSetBkMode = EMR_SETBKMODE, + EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE, + EmfRecordTypeSetROP2 = EMR_SETROP2, + EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE, + EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN, + EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT, + EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR, + EmfRecordTypeSetBkColor = EMR_SETBKCOLOR, + EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN, + EmfRecordTypeMoveToEx = EMR_MOVETOEX, + EmfRecordTypeSetMetaRgn = EMR_SETMETARGN, + EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT, + EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT, + EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX, + EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX, + EmfRecordTypeSaveDC = EMR_SAVEDC, + EmfRecordTypeRestoreDC = EMR_RESTOREDC, + EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM, + EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM, + EmfRecordTypeSelectObject = EMR_SELECTOBJECT, + EmfRecordTypeCreatePen = EMR_CREATEPEN, + EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT, + EmfRecordTypeDeleteObject = EMR_DELETEOBJECT, + EmfRecordTypeAngleArc = EMR_ANGLEARC, + EmfRecordTypeEllipse = EMR_ELLIPSE, + EmfRecordTypeRectangle = EMR_RECTANGLE, + EmfRecordTypeRoundRect = EMR_ROUNDRECT, + EmfRecordTypeArc = EMR_ARC, + EmfRecordTypeChord = EMR_CHORD, + EmfRecordTypePie = EMR_PIE, + EmfRecordTypeSelectPalette = EMR_SELECTPALETTE, + EmfRecordTypeCreatePalette = EMR_CREATEPALETTE, + EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES, + EmfRecordTypeResizePalette = EMR_RESIZEPALETTE, + EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE, + EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL, + EmfRecordTypeLineTo = EMR_LINETO, + EmfRecordTypeArcTo = EMR_ARCTO, + EmfRecordTypePolyDraw = EMR_POLYDRAW, + EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION, + EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT, + EmfRecordTypeBeginPath = EMR_BEGINPATH, + EmfRecordTypeEndPath = EMR_ENDPATH, + EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE, + EmfRecordTypeFillPath = EMR_FILLPATH, + EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH, + EmfRecordTypeStrokePath = EMR_STROKEPATH, + EmfRecordTypeFlattenPath = EMR_FLATTENPATH, + EmfRecordTypeWidenPath = EMR_WIDENPATH, + EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH, + EmfRecordTypeAbortPath = EMR_ABORTPATH, + EmfRecordTypeReserved_069 = 69, // Not Used + EmfRecordTypeGdiComment = EMR_GDICOMMENT, + EmfRecordTypeFillRgn = EMR_FILLRGN, + EmfRecordTypeFrameRgn = EMR_FRAMERGN, + EmfRecordTypeInvertRgn = EMR_INVERTRGN, + EmfRecordTypePaintRgn = EMR_PAINTRGN, + EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN, + EmfRecordTypeBitBlt = EMR_BITBLT, + EmfRecordTypeStretchBlt = EMR_STRETCHBLT, + EmfRecordTypeMaskBlt = EMR_MASKBLT, + EmfRecordTypePlgBlt = EMR_PLGBLT, + EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE, + EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS, + EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW, + EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA, + EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW, + EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16, + EmfRecordTypePolygon16 = EMR_POLYGON16, + EmfRecordTypePolyline16 = EMR_POLYLINE16, + EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16, + EmfRecordTypePolylineTo16 = EMR_POLYLINETO16, + EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16, + EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16, + EmfRecordTypePolyDraw16 = EMR_POLYDRAW16, + EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH, + EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT, + EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN, + EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA, + EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW, + EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE, + EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE, + EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE, + EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE, + EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD, + EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD, + EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT, + EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105, + EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106, + EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107, + EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108, + EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109, + EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110, + EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE, + EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA, + EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW, + EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND, + EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT, + EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT, + EmfRecordTypeReserved_117 = 117, // Not Used + EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL, + EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119, + EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120, + EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW, + EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW, + EmfRecordTypeMax = 122, + EmfRecordTypeMin = 1, + + // That is the END of the GDI EMF records. + + // Now we start the list of EMF+ records. We leave quite + // a bit of room here for the addition of any new GDI + // records that may be added later. + + EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE, + EmfPlusRecordTypeHeader, + EmfPlusRecordTypeEndOfFile, + + EmfPlusRecordTypeComment, + + EmfPlusRecordTypeGetDC, // the application grabbed the metafile dc + + EmfPlusRecordTypeMultiFormatStart, + EmfPlusRecordTypeMultiFormatSection, + EmfPlusRecordTypeMultiFormatEnd, + + // For all persistent objects + EmfPlusRecordTypeObject, // brush,pen,path,region,image,font,string-format + + // Drawing Records + EmfPlusRecordTypeClear, + EmfPlusRecordTypeFillRects, + EmfPlusRecordTypeDrawRects, + EmfPlusRecordTypeFillPolygon, + EmfPlusRecordTypeDrawLines, + EmfPlusRecordTypeFillEllipse, + EmfPlusRecordTypeDrawEllipse, + EmfPlusRecordTypeFillPie, + EmfPlusRecordTypeDrawPie, + EmfPlusRecordTypeDrawArc, + EmfPlusRecordTypeFillRegion, + EmfPlusRecordTypeFillPath, + EmfPlusRecordTypeDrawPath, + EmfPlusRecordTypeFillClosedCurve, + EmfPlusRecordTypeDrawClosedCurve, + EmfPlusRecordTypeDrawCurve, + EmfPlusRecordTypeDrawBeziers, + EmfPlusRecordTypeDrawImage, + EmfPlusRecordTypeDrawImagePoints, + EmfPlusRecordTypeDrawString, + + // Graphics State Records + EmfPlusRecordTypeSetRenderingOrigin, + EmfPlusRecordTypeSetAntiAliasMode, + EmfPlusRecordTypeSetTextRenderingHint, +#ifdef DCR_USE_NEW_188922 + EmfPlusRecordTypeSetTextContrast, +#else + EmfPlusRecordTypeSetGammaValue, +#endif // DCR_USE_NEW_188922 + EmfPlusRecordTypeSetInterpolationMode, + EmfPlusRecordTypeSetPixelOffsetMode, + EmfPlusRecordTypeSetCompositingMode, + EmfPlusRecordTypeSetCompositingQuality, + EmfPlusRecordTypeSave, + EmfPlusRecordTypeRestore, + EmfPlusRecordTypeBeginContainer, + EmfPlusRecordTypeBeginContainerNoParams, + EmfPlusRecordTypeEndContainer, + EmfPlusRecordTypeSetWorldTransform, + EmfPlusRecordTypeResetWorldTransform, + EmfPlusRecordTypeMultiplyWorldTransform, + EmfPlusRecordTypeTranslateWorldTransform, + EmfPlusRecordTypeScaleWorldTransform, + EmfPlusRecordTypeRotateWorldTransform, + EmfPlusRecordTypeSetPageTransform, + EmfPlusRecordTypeResetClip, + EmfPlusRecordTypeSetClipRect, + EmfPlusRecordTypeSetClipPath, + EmfPlusRecordTypeSetClipRegion, + EmfPlusRecordTypeOffsetClip, + + // New record types must be added here (at the end) -- do not add above, + // since that will invalidate previous metafiles! + EmfPlusRecordTypeDrawDriverString, + + // Have this here so you don't need to keep changing the value of + // EmfPlusRecordTypeMax every time you add a new record. + + EmfPlusRecordTotal, + + EmfPlusRecordTypeMax = EmfPlusRecordTotal-1, + EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader, +}; + +//--------------------------------------------------------------------------- +// StringFormatFlags +//--------------------------------------------------------------------------- + +//--------------------------------------------------------------------------- +// String format flags +// +// DirectionRightToLeft - For horizontal text, the reading order is +// right to left. This value is called +// the base embedding level by the Unicode +// bidirectional engine. +// For vertical text, columns are read from +// right to left. +// By default, horizontal or vertical text is +// read from left to right. +// +// DirectionVertical - Individual lines of text are vertical. In +// each line, characters progress from top to +// bottom. +// By default, lines of text are horizontal, +// each new line below the previous line. +// +// NoFitBlackBox - Allows parts of glyphs to overhang the +// bounding rectangle. +// By default glyphs are first aligned +// inside the margines, then any glyphs which +// still overhang the bounding box are +// repositioned to avoid any overhang. +// For example when an italic +// lower case letter f in a font such as +// Garamond is aligned at the far left of a +// rectangle, the lower part of the f will +// reach slightly further left than the left +// edge of the rectangle. Setting this flag +// will ensure the character aligns visually +// with the lines above and below, but may +// cause some pixels outside the formatting +// rectangle to be clipped or painted. +// +#ifndef DCR_USE_NEW_137252 +// NumberContextArabic - Causes any initial numeric in the string to +// be analysed for bidirection layout as if +// it was preceeded by Arabic text. +// +// DisableKashidaJustification - Arabic text will not be justified by the +// insertion of kashidas (i.e. extending the +// joining line between characters). Instead +// Arabic script will be justified by the +// widening of the whitespace between words. +// +#endif +// DisplayFormatControl - Causes control characters such as the +// left-to-right mark to be shown in the +// output with a representative glyph. +// +#ifndef DCR_USE_NEW_137252 +// DisableKerning - Disables Truetype and OpenType kerning. +// +// DisableLigatures - Disables Truetype and OpenType ligatures. +// +// LayoutLegacyBidi - Causes the bidirection algorithm to use +// slightly different classifications for +// '+', '-' and '/' that make their layout +// much closer to that expected by files +// generated in Windows or by Windows +// applications. +// +// NoChanges - A text imager created with this flag set +// does not support those APIs that change +// it's contents or formatting, but for most +// simple text will be significantly faster in +// performing measurement and drawing +// functions. +// +#endif +// NoFontFallback - Disables fallback to alternate fonts for +// characters not supported in the requested +// font. Any missing characters will be +// be displayed with the fonts missing glyph, +// usually an open square. +// +// NoWrap - Disables wrapping of text between lines +// when formatting within a rectangle. +// NoWrap is implied when a point is passed +// instead of a rectangle, or when the +// specified rectangle has a zero line length. +// +// NoClip - By default text is clipped to the +// formatting rectangle. Setting NoClip +// allows overhanging pixels to affect the +// device outside the formatting rectangle. +// Pixels at the end of the line may be +// affected if the glyphs overhang their +// cells, and either the NoFitBlackBox flag +// has been set, or the glyph extends to far +// to be fitted. +// Pixels above/before the first line or +// below/after the last line may be affected +// if the glyphs extend beyond their cell +// ascent / descent. This can occur rarely +// with unusual diacritic mark combinations. + +//--------------------------------------------------------------------------- + +enum StringFormatFlags +{ + StringFormatFlagsDirectionRightToLeft = 0x00000001, + StringFormatFlagsDirectionVertical = 0x00000002, + StringFormatFlagsNoFitBlackBox = 0x00000004, +#ifndef DCR_USE_NEW_137252 + StringFormatFlagsNumberContextArabic = 0x00000008, + StringFormatFlagsDisableKashidaJustification = 0x00000010, +#endif + StringFormatFlagsDisplayFormatControl = 0x00000020, +#ifndef DCR_USE_NEW_137252 + StringFormatFlagsDisableKerning = 0x00000040, + StringFormatFlagsDisableLigatures = 0x00000080, + StringFormatFlagsLayoutLegacyBidi = 0x00000100, + StringFormatFlagsNoChanges = 0x00000200, +#endif + StringFormatFlagsNoFontFallback = 0x00000400, + StringFormatFlagsMeasureTrailingSpaces = 0x00000800, + StringFormatFlagsNoWrap = 0x00001000, + StringFormatFlagsLineLimit = 0x00002000, + + StringFormatFlagsNoClip = 0x00004000 +}; + +//--------------------------------------------------------------------------- +// StringTrimming +//--------------------------------------------------------------------------- + +enum StringTrimming { + StringTrimmingNone = 0, + StringTrimmingCharacter = 1, + StringTrimmingWord = 2, + StringTrimmingEllipsisCharacter = 3, + StringTrimmingEllipsisWord = 4, + StringTrimmingEllipsisPath = 5 +}; + +#ifndef DCR_USE_NEW_137252 +//--------------------------------------------------------------------------- +// String units +// +// String units are like length units in CSS, they may be absolute, or +// they may be relative to a font size. +// +//--------------------------------------------------------------------------- + +enum StringUnit { + StringUnitWorld = UnitWorld, + StringUnitDisplay = UnitDisplay, + StringUnitPixel = UnitPixel, + StringUnitPoint = UnitPoint, + StringUnitInch = UnitInch, + StringUnitDocument = UnitDocument, + StringUnitMillimeter = UnitMillimeter, + StringUnitEm = 32 +}; +#endif + +#ifndef DCR_USE_NEW_152154 +//--------------------------------------------------------------------------- +// Line spacing flags +//--------------------------------------------------------------------------- + +enum LineSpacing { + LineSpacingWorld = UnitWorld, + LineSpacingDisplay = UnitDisplay, + LineSpacingPixel = UnitPixel, + LineSpacingPoint = UnitPoint, + LineSpacingInch = UnitInch, + LineSpacingDocument = UnitDocument, + LineSpacingMillimeter = UnitMillimeter, + + LineSpacingRecommended = 32, + LineSpacingAtLeast = 33, + LineSpacingAtLeastMultiple = 34, + LineSpacingCell = 35, + LineSpacingCellAtLeast = 36, + LineSpacingCellAtLeastMultiple = 37 +}; + +/// The following methods of linespacing are relative to the font size +// +// =========== Method =========== =============== Relative to =============== +// +// LineSpacingRecommended recommended line spacing specified by font +// LineSpacingAtLeast max(recommended, tallest glyph cell) +// LineSpacingAtLeastMultiple smallest multiple of recommended big enough +// for all glyph cells on the line +// LineSpacingCell cell height +// LineSpacingCellAtLeast max(font cell height, tallest glyph cell) +// LineSpacingCellAtLeastMultiple smallest multiple of cell height big enough +// for all glyph cells on the line +#endif + + +//--------------------------------------------------------------------------- +// National language digit substitution +//--------------------------------------------------------------------------- + +enum StringDigitSubstitute +{ + StringDigitSubstituteUser = 0, // As NLS setting + StringDigitSubstituteNone = 1, + StringDigitSubstituteNational = 2, + StringDigitSubstituteTraditional = 3 +}; + +//--------------------------------------------------------------------------- +// Hotkey prefix interpretation +//--------------------------------------------------------------------------- + +enum HotkeyPrefix +{ + HotkeyPrefixNone = 0, + HotkeyPrefixShow = 1, + HotkeyPrefixHide = 2 +}; + +//--------------------------------------------------------------------------- +// Text alignment flags +//--------------------------------------------------------------------------- + +enum StringAlignment +{ + // Left edge for left-to-right text, + // right for right-to-left text, + // and top for vertical + StringAlignmentNear = 0, + StringAlignmentCenter = 1, + StringAlignmentFar = 2 +}; + +//--------------------------------------------------------------------------- +// DriverStringOptions +//--------------------------------------------------------------------------- + +enum DriverStringOptions +{ + DriverStringOptionsCmapLookup = 1, + DriverStringOptionsVertical = 2, + DriverStringOptionsRealizedAdvance = 4, +#ifndef DCR_USE_NEW_137252 + DriverStringOptionsCompensateResolution = 8 +#endif +}; + +//--------------------------------------------------------------------------- +// Flush Intention flags +//--------------------------------------------------------------------------- + +enum FlushIntention +{ + FlushIntentionFlush = 0, // Flush all batched rendering operations + FlushIntentionSync = 1 // Flush all batched rendering operations + // and wait for them to complete +}; + +#ifndef DCR_USE_NEW_175866 + +//--------------------------------------------------------------------------- +// Window Change Notification types +//--------------------------------------------------------------------------- + +enum WindowNotifyEnum +{ + WindowNotifyEnumEnable = 0, + WindowNotifyEnumDisable, + WindowNotifyEnumPalette, + WindowNotifyEnumDisplay, + WindowNotifyEnumSysColor +}; + +#endif + +//--------------------------------------------------------------------------- +// Image encoder parameter related types +//--------------------------------------------------------------------------- + +#ifdef DCR_USE_NEW_145804 +enum EncoderParameterValueType +{ + EncoderParameterValueTypeByte = 1, // 8-bit unsigned int + EncoderParameterValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII + // code. NULL terminated. + EncoderParameterValueTypeShort = 3, // 16-bit unsigned int + EncoderParameterValueTypeLong = 4, // 32-bit unsigned int + EncoderParameterValueTypeRational = 5, // Two Longs. The first Long is the + // numerator, the second Long expresses the + // denomintor. + EncoderParameterValueTypeLongRange = 6, // Two longs which specify a range of + // integer values. The first Long specifies + // the lower end and the second one + // specifies the higher end. All values + // are inclusive at both ends + EncoderParameterValueTypeUndefined = 7, // 8-bit byte that can take any value + // depending on field definition + EncoderParameterValueTypeRationalRange = 8 // Two Rationals. The first Rational + // specifies the lower end and the second + // specifies the higher end. All values + // are inclusive at both ends +}; +#else +enum ValueType +{ + ValueTypeByte = 1, // 8-bit unsigned int + ValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII + // code. NULL terminated. + ValueTypeShort = 3, // 16-bit unsigned int + ValueTypeLong = 4, // 32-bit unsigned int + ValueTypeRational = 5, // Two Longs. The first Long is the + // numerator, the second Long expresses the + // denomintor. + ValueTypeLongRange = 6, // Two longs which specify a range of + // integer values. The first Long specifies + // the lower end and the second one + // specifies the higher end. All values + // are inclusive at both ends + ValueTypeUndefined = 7, // 8-bit byte that can take any value + // depending on field definition + ValueTypeRationalRange = 8 // Two Rationals. The first Rational + // specifies the lower end and the second + // specifies the higher end. All values + // are inclusive at both ends +}; +#endif + +//--------------------------------------------------------------------------- +// Image encoder value types +//--------------------------------------------------------------------------- + +enum EncoderValue +{ + EncoderValueColorTypeCMYK, + EncoderValueColorTypeYCCK, + EncoderValueCompressionLZW, + EncoderValueCompressionCCITT3, + EncoderValueCompressionCCITT4, + EncoderValueCompressionRle, + EncoderValueCompressionNone, + EncoderValueScanMethodInterlaced, + EncoderValueScanMethodNonInterlaced, + EncoderValueVersionGif87, + EncoderValueVersionGif89, + EncoderValueRenderProgressive, + EncoderValueRenderNonProgressive, + EncoderValueTransformRotate90, + EncoderValueTransformRotate180, + EncoderValueTransformRotate270, + EncoderValueTransformFlipHorizontal, + EncoderValueTransformFlipVertical, + #ifdef DCR_USE_NEW_140861 + EncoderValueMultiFrame, + #else + EncodeValueMultiFrame, + #endif + EncoderValueLastFrame, + EncoderValueFlush, + #ifdef DCR_USE_NEW_140861 + EncoderValueFrameDimensionTime, + EncoderValueFrameDimensionResolution, + EncoderValueFrameDimensionPage + #else + EncodeValueFrameDimensionTime, + EncodeValueFrameDimensionResolution, + EncodeValueFrameDimensionPage + #endif +}; + +//--------------------------------------------------------------------------- +// Graphics layout values (support for Middle East localization) +//--------------------------------------------------------------------------- + +enum GraphicsLayout +{ + GraphicsLayoutNormal, + GraphicsLayoutMirrored, + GraphicsLayoutMirroredIgnoreImages, + GraphicsLayoutMirroredForceImages +}; + +//--------------------------------------------------------------------------- +// Image layout values (support for Middle East localization) +//--------------------------------------------------------------------------- + +enum ImageLayout +{ + ImageLayoutNormal, + ImageLayoutIgnoreMirrored +}; + +enum EmfToWmfBitsFlags +{ + EmfToWmfBitsFlagsDefault = 0x00000000, + EmfToWmfBitsFlagsEmbedEmf = 0x00000001, + EmfToWmfBitsFlagsIncludeAPM = 0x00000002, + EmfToWmfBitsFlagsNoXORClip = 0x00000004 +}; + +#endif // !_GDIPLUSENUMS_H diff --git a/win32/gdiplus/include/GdiplusFlat.h b/win32/gdiplus/include/GdiplusFlat.h new file mode 100644 index 0000000..8b5369e --- /dev/null +++ b/win32/gdiplus/include/GdiplusFlat.h @@ -0,0 +1,2740 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFlat.h +* +* Abstract: +* +* Flat GDI+ API wrappers - header file +* +\**************************************************************************/ + +// TODO: this file style needs to be made internally consistent with the way +// it handles breaking the long argument lists across multiple lines + +#ifndef _FLATAPI_H +#define _FLATAPI_H + +#define WINGDIPAPI __stdcall + +// currently, only C++ wrapper API's force const. + +#define GDIPCONST const + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef DCR_USE_NEW_175866 + +VOID +WINGDIPAPI +GdipDisplayPaletteWindowNotify(WindowNotifyEnum notify); + +#endif + +//---------------------------------------------------------------------------- +// GraphicsPath methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePath(GpFillMode brushMode, GpPath **path); + +GpStatus WINGDIPAPI +GdipCreatePath2(GDIPCONST GpPointF*, GDIPCONST BYTE*, INT, GpFillMode, + GpPath **path); + +GpStatus WINGDIPAPI +GdipCreatePath2I(GDIPCONST GpPoint*, GDIPCONST BYTE*, INT, GpFillMode, + GpPath **path); + +GpStatus WINGDIPAPI +GdipClonePath(GpPath* path, GpPath **clonePath); + +GpStatus WINGDIPAPI +GdipDeletePath(GpPath* path); + +GpStatus WINGDIPAPI +GdipResetPath(GpPath* path); + +GpStatus WINGDIPAPI +GdipGetPointCount(GpPath* path, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathTypes(GpPath* path, BYTE* types, INT count); + +GpStatus WINGDIPAPI +GdipGetPathPoints(GpPath*, GpPointF* points, INT count); + +GpStatus WINGDIPAPI +GdipGetPathPointsI(GpPath*, GpPoint* points, INT count); + +GpStatus WINGDIPAPI +GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode); + +GpStatus WINGDIPAPI +GdipSetPathFillMode(GpPath *path, GpFillMode fillmode); + +GpStatus WINGDIPAPI +GdipGetPathData(GpPath *path, GpPathData* pathData); + +GpStatus WINGDIPAPI +GdipStartPathFigure(GpPath *path); + +GpStatus WINGDIPAPI +GdipClosePathFigure(GpPath *path); + +GpStatus WINGDIPAPI +GdipClosePathFigures(GpPath *path); + +GpStatus WINGDIPAPI +GdipSetPathMarker(GpPath* path); + +GpStatus WINGDIPAPI +GdipClearPathMarkers(GpPath* path); + +GpStatus WINGDIPAPI +GdipReversePath(GpPath* path); + +GpStatus WINGDIPAPI +GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint); + +GpStatus WINGDIPAPI +GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2); + +GpStatus WINGDIPAPI +GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, + REAL x3, REAL y3, REAL x4, REAL y4); + +GpStatus WINGDIPAPI +GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, + INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count); + +GpStatus WINGDIPAPI +GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, + REAL height); + +GpStatus WINGDIPAPI +GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect); + +GpStatus WINGDIPAPI +GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, + INT length, GDIPCONST GpFontFamily *family, INT style, + REAL emSize, GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, + INT length, GDIPCONST GpFontFamily *family, INT style, + REAL emSize, GDIPCONST Rect *layoutRect, + GDIPCONST GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2); + +GpStatus WINGDIPAPI +GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathArcI(GpPath *path, INT x, INT y, INT width, INT height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, INT y2, + INT x3, INT y3, INT x4, INT y4); + +GpStatus WINGDIPAPI +GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, INT count, + INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height); + +GpStatus WINGDIPAPI +GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count); + +GpStatus WINGDIPAPI +GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width, INT height); + +GpStatus WINGDIPAPI +GdipAddPathPieI(GpPath *path, INT x, INT y, INT width, INT height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness); + +GpStatus WINGDIPAPI +GdipWindingModeOutline( + GpPath *path, + GpMatrix *matrix, + REAL flatness +); + + +#ifdef DCR_USE_NEW_202903 + +GpStatus WINGDIPAPI +GdipWidenPath( + GpPath *nativePath, + GpPen *pen, + GpMatrix *matrix, + REAL flatness +); + +#else + +GpStatus WINGDIPAPI +GdipWidenPathWithMinimumResolutions(GpPath *path, GpPen *pen, REAL minXres, + REAL minYres, GpMatrix *matrix, BOOL removeSelftIntersects); + +#endif + +GpStatus WINGDIPAPI +GdipWarpPath(GpPath *path, GpMatrix* matrix, + GDIPCONST GpPointF *points, INT count, + REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, + WarpMode warpMode, REAL flatness); + +GpStatus WINGDIPAPI +GdipTransformPath(GpPath* path, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds, GDIPCONST GpMatrix *matrix, + GDIPCONST GpPen *pen); + +GpStatus WINGDIPAPI +GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds, GDIPCONST GpMatrix *matrix, + GDIPCONST GpPen *pen); + +GpStatus WINGDIPAPI +GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, GpPen *pen, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, + GpGraphics *graphics, BOOL *result); + + +//---------------------------------------------------------------------------- +// Path Enumeration methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePathIter(GpPathIterator **iterator, GpPath* path); + +GpStatus WINGDIPAPI +GdipDeletePathIter(GpPathIterator *iterator); + +GpStatus WINGDIPAPI +GdipPathIterNextSubpath(GpPathIterator* iterator, INT *resultCount, + INT* startIndex, INT* endIndex, BOOL* isClosed); + +GpStatus WINGDIPAPI +GdipPathIterNextSubpathPath(GpPathIterator* iterator, INT* resultCount, + GpPath* path, BOOL* isClosed); + +GpStatus WINGDIPAPI +GdipPathIterNextPathType(GpPathIterator* iterator, INT* resultCount, + BYTE* pathType, INT* startIndex, INT* endIndex); + +GpStatus WINGDIPAPI +GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount, + INT* startIndex, INT* endIndex); + +GpStatus WINGDIPAPI +GdipPathIterNextMarkerPath(GpPathIterator* iterator, INT* resultCount, + GpPath* path); + +GpStatus WINGDIPAPI +GdipPathIterGetCount(GpPathIterator* iterator, INT* count); + +GpStatus WINGDIPAPI +GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count); + +GpStatus WINGDIPAPI +GdipPathIterIsValid(GpPathIterator* iterator, BOOL* valid); + +GpStatus WINGDIPAPI +GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve); + +GpStatus WINGDIPAPI +GdipPathIterRewind(GpPathIterator* iterator); + +GpStatus WINGDIPAPI +GdipPathIterEnumerate(GpPathIterator* iterator, INT* resultCount, + GpPointF *points, BYTE *types, INT count); + +GpStatus WINGDIPAPI +GdipPathIterCopyData(GpPathIterator* iterator, INT* resultCount, + GpPointF* points, BYTE* types, INT startIndex, INT endIndex); + +//---------------------------------------------------------------------------- +// Matrix methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateMatrix(GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, + REAL dy, GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, + GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, + GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCloneMatrix(GpMatrix *matrix, GpMatrix **cloneMatrix); + +GpStatus WINGDIPAPI +GdipDeleteMatrix(GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, + REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipInvertMatrix(GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count); + +GpStatus WINGDIPAPI +GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count); + +GpStatus WINGDIPAPI +GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, + INT count); + +GpStatus WINGDIPAPI +GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, + INT count); + +GpStatus WINGDIPAPI +GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *matrixOut); + +GpStatus WINGDIPAPI +GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result); + +//---------------------------------------------------------------------------- +// Region methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateRegion(GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionPath(GpPath *path, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRgnData(GDIPCONST BYTE *regionData, INT size, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionHrgn(HRGN hRgn, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); + +GpStatus WINGDIPAPI +GdipDeleteRegion(GpRegion *region); + +GpStatus WINGDIPAPI +GdipSetInfinite(GpRegion *region); + +GpStatus WINGDIPAPI +GdipSetEmpty(GpRegion *region); + +GpStatus WINGDIPAPI +GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipTranslateRegionI(GpRegion *region, INT dx, INT dy); + +GpStatus WINGDIPAPI +GdipTransformRegion(GpRegion *region, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, + GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, + GpRect *rect); + +GpStatus WINGDIPAPI +GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn); + +GpStatus WINGDIPAPI +GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsEqualRegion(GpRegion *region, GpRegion *region2, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); + +GpStatus WINGDIPAPI +GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT * sizeFilled); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, + REAL height, GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, + INT height, GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetRegionScansCount(GpRegion *region, UINT* count, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetRegionScans(GpRegion *region, GpRectF* rects, INT* count, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetRegionScansI(GpRegion *region, GpRect* rects, INT* count, GpMatrix* matrix); + +//---------------------------------------------------------------------------- +// Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCloneBrush(GpBrush *brush, GpBrush **cloneBrush); + +GpStatus WINGDIPAPI +GdipDeleteBrush(GpBrush *brush); + +GpStatus WINGDIPAPI +GdipGetBrushType(GpBrush *brush, GpBrushType *type); + +//---------------------------------------------------------------------------- +// Hatch Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, + ARGB backcol, GpHatch **brush); + +GpStatus WINGDIPAPI +GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle); + +GpStatus WINGDIPAPI +GdipGetHatchForegroundColor(GpHatch *brush, ARGB* forecol); + +GpStatus WINGDIPAPI +GdipGetHatchBackgroundColor(GpHatch *brush, ARGB* backcol); + +//---------------------------------------------------------------------------- +// Texture Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateTexture(GpImage *image, GpWrapMode wrapmode, + GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, REAL x, + REAL y, REAL width, REAL height, GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, + REAL x, REAL y, REAL width, REAL height, + GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, INT x, + INT y, INT width, INT height, GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, + INT x, INT y, INT width, INT height, + GpTexture **texture); + + +GpStatus WINGDIPAPI +GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetTextureTransform(GpTexture *brush, GDIPCONST GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetTextureTransform(GpTexture* brush); + +GpStatus WINGDIPAPI +GdipMultiplyTextureTransform(GpTexture* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleTextureTransform(GpTexture* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateTextureTransform(GpTexture* brush, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipGetTextureImage(GpTexture *brush, GpImage **image); + +//---------------------------------------------------------------------------- +// Solid Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateSolidFill(ARGB color, GpSolidFill **brush); + +GpStatus WINGDIPAPI +GdipSetSolidFillColor(GpSolidFill *brush, ARGB color); + +GpStatus WINGDIPAPI +GdipGetSolidFillColor(GpSolidFill *brush, ARGB *color); + +//---------------------------------------------------------------------------- +// LineBrush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateLineBrush(GDIPCONST GpPointF* point1, + GDIPCONST GpPointF* point2, + ARGB color1, ARGB color2, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushI(GDIPCONST GpPoint* point1, + GDIPCONST GpPoint* point2, + ARGB color1, ARGB color2, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, + ARGB color1, ARGB color2, + LinearGradientMode mode, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect, + ARGB color1, ARGB color2, + LinearGradientMode mode, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect, + ARGB color1, ARGB color2, + REAL angle, + BOOL isAngleScalable, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect, + ARGB color1, ARGB color2, + REAL angle, + BOOL isAngleScalable, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipSetLinePoints(GpLineGradient *brush, + GDIPCONST GpPointF* point1, + GDIPCONST GpPointF* point2); + +GpStatus WINGDIPAPI +GdipSetLinePointsI(GpLineGradient *brush, + GDIPCONST GpPoint* point1, + GDIPCONST GpPoint* point2); + +GpStatus WINGDIPAPI +GdipGetLinePoints(GpLineGradient *brush, GpPointF* points); + +GpStatus WINGDIPAPI +GdipGetLinePointsI(GpLineGradient *brush, GpPoint* points); + +GpStatus WINGDIPAPI +GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2); + +GpStatus WINGDIPAPI +GdipGetLineColors(GpLineGradient *brush, ARGB* colors); + +GpStatus WINGDIPAPI +GdipGetLineRect(GpLineGradient *brush, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetLineRectI(GpLineGradient *brush, GpRect *rect); + +GpStatus WINGDIPAPI +GdipSetLineGammaCorrection(GpLineGradient *brush, BOOL useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetLineGammaCorrection(GpLineGradient *brush, BOOL *useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetLineBlendCount(GpLineGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetLineBlend(GpLineGradient *brush, REAL *blend, REAL* positions, + INT count); + +GpStatus WINGDIPAPI +GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, + REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetLineSigmaBlend(GpLineGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetLineWrapMode(GpLineGradient *brush, GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetLineTransform(GpLineGradient* brush); + +GpStatus WINGDIPAPI +GdipMultiplyLineTransform(GpLineGradient* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateLineTransform(GpLineGradient* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleLineTransform(GpLineGradient* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateLineTransform(GpLineGradient* brush, REAL angle, GpMatrixOrder order); + +//---------------------------------------------------------------------------- +// PathGradient Brush +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePathGradient(GDIPCONST GpPointF* points, + INT count, + GpWrapMode wrapMode, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipCreatePathGradientI(GDIPCONST GpPoint* points, + INT count, + GpWrapMode wrapMode, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipCreatePathGradientFromPath(GDIPCONST GpPath* path, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterColor( + GpPathGradient *brush, ARGB* colors); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterColor( + GpPathGradient *brush, ARGB colors); + +GpStatus WINGDIPAPI +GdipGetPathGradientSurroundColorsWithCount( + GpPathGradient *brush, ARGB* color, INT* count); + +GpStatus WINGDIPAPI +GdipSetPathGradientSurroundColorsWithCount( + GpPathGradient *brush, + GDIPCONST ARGB* color, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPath(GpPathGradient *brush, GpPath *path); + +GpStatus WINGDIPAPI +GdipSetPathGradientPath(GpPathGradient *brush, GDIPCONST GpPath *path); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterPoint( + GpPathGradient *brush, GpPointF* points); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterPointI( + GpPathGradient *brush, GpPoint* points); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterPoint( + GpPathGradient *brush, GDIPCONST GpPointF* points); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterPointI( + GpPathGradient *brush, GDIPCONST GpPoint* points); + +GpStatus WINGDIPAPI +GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect); + +GpStatus WINGDIPAPI +GdipGetPathGradientPointCount(GpPathGradient *brush, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT* count); + +GpStatus WINGDIPAPI +GdipSetPathGradientGammaCorrection(GpPathGradient *brush, BOOL useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetPathGradientGammaCorrection(GpPathGradient *brush, BOOL *useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetPathGradientBlendCount(GpPathGradient *brush, + INT *count); + +GpStatus WINGDIPAPI +GdipGetPathGradientBlend(GpPathGradient *brush, + REAL *blend, REAL *positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientBlend(GpPathGradient *brush, + GDIPCONST REAL *blend, GDIPCONST REAL *positions, INT count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPresetBlend(GpPathGradient *brush, ARGB *blend, + REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientSigmaBlend(GpPathGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetPathGradientLinearBlend(GpPathGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipGetPathGradientWrapMode(GpPathGradient *brush, + GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipSetPathGradientWrapMode(GpPathGradient *brush, + GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetPathGradientTransform(GpPathGradient *brush, + GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetPathGradientTransform(GpPathGradient *brush, + GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPathGradientTransform(GpPathGradient* brush); + +GpStatus WINGDIPAPI +GdipMultiplyPathGradientTransform(GpPathGradient* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslatePathGradientTransform(GpPathGradient* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScalePathGradientTransform(GpPathGradient* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotatePathGradientTransform(GpPathGradient* brush, REAL angle, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipGetPathGradientFocusScales(GpPathGradient *brush, REAL* xScale, REAL* yScale); + +GpStatus WINGDIPAPI +GdipSetPathGradientFocusScales(GpPathGradient *brush, REAL xScale, REAL yScale); + +//---------------------------------------------------------------------------- +// Pen methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen); + +GpStatus WINGDIPAPI +GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, + GpPen **pen); + +GpStatus WINGDIPAPI +GdipClonePen(GpPen *pen, GpPen **clonepen); + +GpStatus WINGDIPAPI +GdipDeletePen(GpPen *pen); + +GpStatus WINGDIPAPI +GdipSetPenWidth(GpPen *pen, REAL width); + +GpStatus WINGDIPAPI +GdipGetPenWidth(GpPen *pen, REAL *width); + +GpStatus WINGDIPAPI +GdipSetPenUnit(GpPen *pen, GpUnit unit); + +GpStatus WINGDIPAPI +GdipGetPenUnit(GpPen *pen, GpUnit *unit); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipSetPenLineCap197819(GpPen *pen, GpLineCap startCap, GpLineCap endCap, + GpDashCap dashCap); +#else +GpStatus WINGDIPAPI +GdipSetPenLineCap(GpPen *pen, GpLineCap startCap, GpLineCap endCap, + GpLineCap dashCap); +#endif // DCR_USE_NEW_197819 + + +GpStatus WINGDIPAPI +GdipSetPenStartCap(GpPen *pen, GpLineCap startCap); + +GpStatus WINGDIPAPI +GdipSetPenEndCap(GpPen *pen, GpLineCap endCap); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap); +#else +GpStatus WINGDIPAPI +GdipSetPenDashCap(GpPen *pen, GpLineCap dashCap); +#endif // DCR_USE_NEW_197819 + +GpStatus WINGDIPAPI +GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap); + +GpStatus WINGDIPAPI +GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap); +#else +GpStatus WINGDIPAPI +GdipGetPenDashCap(GpPen *pen, GpLineCap *dashCap); +#endif // DCR_USE_NEW_197819 + +GpStatus WINGDIPAPI +GdipSetPenLineJoin(GpPen *pen, GpLineJoin lineJoin); + +GpStatus WINGDIPAPI +GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin); + +GpStatus WINGDIPAPI +GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap); + +GpStatus WINGDIPAPI +GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap); + +GpStatus WINGDIPAPI +GdipSetPenMiterLimit(GpPen *pen, REAL miterLimit); + +GpStatus WINGDIPAPI +GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit); + +GpStatus WINGDIPAPI +GdipSetPenMode(GpPen *pen, GpPenAlignment penMode); + +GpStatus WINGDIPAPI +GdipGetPenMode(GpPen *pen, GpPenAlignment *penMode); + +GpStatus WINGDIPAPI +GdipSetPenTransform(GpPen *pen, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipGetPenTransform(GpPen *pen, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPenTransform(GpPen *pen); + +GpStatus WINGDIPAPI +GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipSetPenColor(GpPen *pen, ARGB argb); + +GpStatus WINGDIPAPI +GdipGetPenColor(GpPen *pen, ARGB *argb); + +GpStatus WINGDIPAPI +GdipSetPenBrushFill(GpPen *pen, GpBrush *brush); + +GpStatus WINGDIPAPI +GdipGetPenBrushFill(GpPen *pen, GpBrush **brush); + +GpStatus WINGDIPAPI +GdipGetPenFillType(GpPen *pen, GpPenType* type); + +GpStatus WINGDIPAPI +GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dashstyle); + +GpStatus WINGDIPAPI +GdipSetPenDashStyle(GpPen *pen, GpDashStyle dashstyle); + +GpStatus WINGDIPAPI +GdipGetPenDashOffset(GpPen *pen, REAL *offset); + +GpStatus WINGDIPAPI +GdipSetPenDashOffset(GpPen *pen, REAL offset); + +GpStatus WINGDIPAPI +GdipGetPenDashCount(GpPen *pen, INT *count); + +GpStatus WINGDIPAPI +GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenCompoundCount(GpPen *pen, INT *count); + +GpStatus WINGDIPAPI +GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenCompoundArray(GpPen *pen, REAL *dash, INT count); + +//---------------------------------------------------------------------------- +// CustomLineCap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath, + GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap); + +GpStatus WINGDIPAPI +GdipDeleteCustomLineCap(GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipCloneCustomLineCap(GpCustomLineCap* customCap, + GpCustomLineCap** clonedCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapType(GpCustomLineCap* customCap, + CustomLineCapType* capType); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, + GpLineCap startCap, GpLineCap endCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, + GpLineCap* startCap, GpLineCap* endCap); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin lineJoin); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin* lineJoin); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap baseCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap* baseCap); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL inset); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL* inset); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL widthScale); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL* widthScale); + +//---------------------------------------------------------------------------- +// AdjustableArrowCap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL isFilled, + GpAdjustableArrowCap **cap); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL height); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL* height); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL width); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL* width); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL middleInset); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL* middleInset); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL fillState); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL* fillState); + +//---------------------------------------------------------------------------- +// Image methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipLoadImageFromStream(IStream* stream, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromStreamICM(IStream* stream, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image); + +GpStatus WINGDIPAPI +GdipCloneImage(GpImage *image, GpImage **cloneImage); + +GpStatus WINGDIPAPI +GdipDisposeImage(GpImage *image); + +GpStatus WINGDIPAPI +GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, + GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveImageToStream(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveAddImage(GpImage *image, GpImage* newImage, + GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit); + +GpStatus WINGDIPAPI +GdipGetImageDimension(GpImage *image, REAL *width, REAL *height); + +GpStatus WINGDIPAPI +GdipGetImageType(GpImage *image, ImageType *type); + +GpStatus WINGDIPAPI +GdipGetImageWidth(GpImage *image, UINT *width); + +GpStatus WINGDIPAPI +GdipGetImageHeight(GpImage *image, UINT *height); + +GpStatus WINGDIPAPI +GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution); + +GpStatus WINGDIPAPI +GdipGetImageVerticalResolution(GpImage *image, REAL *resolution); + +GpStatus WINGDIPAPI +GdipGetImageFlags(GpImage *image, UINT *flags); + +GpStatus WINGDIPAPI +GdipGetImageRawFormat(GpImage *image, GUID *format); + +GpStatus WINGDIPAPI +GdipGetImagePixelFormat(GpImage *image, PixelFormat *format); + +GpStatus WINGDIPAPI +GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, + GpImage **thumbImage, + GetThumbnailImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, + UINT* size); + +GpStatus WINGDIPAPI +GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, + UINT size, EncoderParameters* buffer); + +GpStatus WINGDIPAPI +GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count); + +GpStatus WINGDIPAPI +GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count); + +GpStatus WINGDIPAPI +GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count); + +GpStatus WINGDIPAPI +GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, + UINT frameIndex); + +GpStatus WINGDIPAPI +GdipImageRotateFlip(GpImage *image, RotateFlipType rfType); + +GpStatus WINGDIPAPI +GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size); + +GpStatus WINGDIPAPI +GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette); + +GpStatus WINGDIPAPI +GdipGetImagePaletteSize(GpImage *image, INT *size); + +GpStatus WINGDIPAPI +GdipGetPropertyCount(GpImage *image, UINT* numOfProperty); + +GpStatus WINGDIPAPI +GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list); + +GpStatus WINGDIPAPI +GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size); + +GpStatus WINGDIPAPI +GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, + PropertyItem* buffer); + +GpStatus WINGDIPAPI +GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties); + +GpStatus WINGDIPAPI +GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, + UINT numProperties, PropertyItem* allItems); + +GpStatus WINGDIPAPI +GdipRemovePropertyItem(GpImage *image, PROPID propId); + +GpStatus WINGDIPAPI +GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item); + +GpStatus WINGDIPAPI +GdipImageForceValidation(GpImage *image); + +GpStatus WINGDIPAPI +GdipGetImageLayout(GpImage *image, ImageLayout* layout); + +GpStatus WINGDIPAPI +GdipSetImageLayout(GpImage *image, GDIPCONST ImageLayout layout); + +//---------------------------------------------------------------------------- +// Bitmap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateBitmapFromStream(IStream* stream, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromStreamICM(IStream* stream, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromScan0(INT width, + INT height, + INT stride, + PixelFormat format, + BYTE* scan0, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromGraphics(INT width, + INT height, + GpGraphics* target, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromDirectDrawSurface(IDirectDrawSurface7* surface, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* gdiBitmapInfo, + VOID* gdiBitmapData, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromHBITMAP(HBITMAP hbm, + HPALETTE hpal, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, + HBITMAP* hbmReturn, + ARGB background); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromHICON(HICON hicon, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateHICONFromBitmap(GpBitmap* bitmap, + HICON* hbmReturn); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromResource(HINSTANCE hInstance, + GDIPCONST WCHAR* lpBitmapName, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, + PixelFormat format, + GpBitmap *srcBitmap, + GpBitmap **dstBitmap); + +GpStatus WINGDIPAPI +GdipCloneBitmapAreaI(INT x, + INT y, + INT width, + INT height, + PixelFormat format, + GpBitmap *srcBitmap, + GpBitmap **dstBitmap); + +GpStatus WINGDIPAPI +GdipBitmapLockBits(GpBitmap* bitmap, + GDIPCONST GpRect* rect, + UINT flags, + PixelFormat format, + BitmapData* lockedBitmapData); + +GpStatus WINGDIPAPI +GdipBitmapUnlockBits(GpBitmap* bitmap, + BitmapData* lockedBitmapData); + +GpStatus WINGDIPAPI +GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y, ARGB *color); + +GpStatus WINGDIPAPI +GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y, ARGB color); + +GpStatus WINGDIPAPI +GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi); + +//---------------------------------------------------------------------------- +// ImageAttributes methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateImageAttributes(GpImageAttributes **imageattr); + +GpStatus WINGDIPAPI +GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, + GpImageAttributes **cloneImageattr); + +GpStatus WINGDIPAPI +GdipDisposeImageAttributes(GpImageAttributes *imageattr); + +GpStatus WINGDIPAPI +GdipSetImageAttributesToIdentity(GpImageAttributes *imageattr, + ColorAdjustType type); +GpStatus WINGDIPAPI +GdipResetImageAttributes(GpImageAttributes *imageattr, + ColorAdjustType type); + +GpStatus WINGDIPAPI +GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + GDIPCONST ColorMatrix* colorMatrix, + GDIPCONST ColorMatrix* grayMatrix, + ColorMatrixFlags flags); + +GpStatus WINGDIPAPI +GdipSetImageAttributesThreshold(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + REAL threshold); + +GpStatus WINGDIPAPI +GdipSetImageAttributesGamma(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + REAL gamma); + +GpStatus WINGDIPAPI +GdipSetImageAttributesNoOp(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag); + +GpStatus WINGDIPAPI +GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + ARGB colorLow, + ARGB colorHigh); + +GpStatus WINGDIPAPI +GdipSetImageAttributesOutputChannel(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + ColorChannelFlags channelFlags); + +GpStatus WINGDIPAPI +GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + GDIPCONST WCHAR *colorProfileFilename); + +GpStatus WINGDIPAPI +GdipSetImageAttributesRemapTable(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + UINT mapSize, + GDIPCONST ColorMap *map); +GpStatus WINGDIPAPI +GdipSetImageAttributesWrapMode( + GpImageAttributes *imageAttr, + WrapMode wrap, + ARGB argb, + BOOL clamp +); + +GpStatus WINGDIPAPI +GdipSetImageAttributesICMMode( + GpImageAttributes *imageAttr, + BOOL on +); + +GpStatus WINGDIPAPI +GdipGetImageAttributesAdjustedPalette( + GpImageAttributes *imageAttr, + ColorPalette * colorPalette, + ColorAdjustType colorAdjustType +); + +//---------------------------------------------------------------------------- +// Graphics methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipFlush(GpGraphics *graphics, GpFlushIntention intention); + +GpStatus WINGDIPAPI +GdipCreateFromHDC(HDC hdc, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipDeleteGraphics(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipGetDC(GpGraphics* graphics, HDC * hdc); + +GpStatus WINGDIPAPI +GdipReleaseDC(GpGraphics* graphics, HDC hdc); + +GpStatus WINGDIPAPI +GdipSetCompositingMode(GpGraphics *graphics, CompositingMode compositingMode); + +GpStatus WINGDIPAPI +GdipGetCompositingMode(GpGraphics *graphics, CompositingMode *compositingMode); + +GpStatus WINGDIPAPI +GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y); + +GpStatus WINGDIPAPI +GdipGetRenderingOrigin(GpGraphics *graphics, INT *x, INT *y); + +GpStatus WINGDIPAPI +GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality compositingQuality); + +GpStatus WINGDIPAPI +GdipGetCompositingQuality(GpGraphics *graphics, CompositingQuality *compositingQuality); + +GpStatus WINGDIPAPI +GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode smoothingMode); + +GpStatus WINGDIPAPI +GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *smoothingMode); + +GpStatus WINGDIPAPI +GdipSetPixelOffsetMode(GpGraphics* graphics, PixelOffsetMode pixelOffsetMode); + +GpStatus WINGDIPAPI +GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode); + +GpStatus WINGDIPAPI +GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint mode); + +GpStatus WINGDIPAPI +GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *mode); + +#ifdef DCR_USE_NEW_188922 +GpStatus WINGDIPAPI +GdipSetTextContrast(GpGraphics *graphics, UINT contrast); + +GpStatus WINGDIPAPI +GdipGetTextContrast(GpGraphics *graphics, UINT * contrast); +#else +GpStatus WINGDIPAPI +GdipSetTextGammaValue(GpGraphics *graphics, UINT gammaValue); + +GpStatus WINGDIPAPI +GdipGetTextGammaValue(GpGraphics *graphics, UINT * gammaValue); +#endif // DCR_USE_NEW_188922 + + +GpStatus WINGDIPAPI +GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode interpolationMode); + +GpStatus WINGDIPAPI +GdipGetInterpolationMode(GpGraphics *graphics, InterpolationMode *interpolationMode); + +GpStatus WINGDIPAPI +GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetWorldTransform(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipMultiplyWorldTransform(GpGraphics *graphics, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateWorldTransform(GpGraphics *graphics, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPageTransform(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit); + +GpStatus WINGDIPAPI +GdipGetPageScale(GpGraphics *graphics, REAL *scale); + +GpStatus WINGDIPAPI +GdipSetPageUnit(GpGraphics *graphics, GpUnit unit); + +GpStatus WINGDIPAPI +GdipSetPageScale(GpGraphics *graphics, REAL scale); + +GpStatus WINGDIPAPI +GdipGetDpiX(GpGraphics *graphics, REAL* dpi); + +GpStatus WINGDIPAPI +GdipGetDpiY(GpGraphics *graphics, REAL* dpi); + +GpStatus WINGDIPAPI +GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace destSpace, + GpCoordinateSpace srcSpace, GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace destSpace, + GpCoordinateSpace srcSpace, GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipGetNearestColor(GpGraphics *graphics, ARGB* argb); + +// Create the Win9x Halftone Palette (even on NT) with correct Desktop colors +HPALETTE WINGDIPAPI +GdipCreateHalftonePalette(); + +GpStatus WINGDIPAPI +GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, + REAL x2, REAL y2); + +GpStatus WINGDIPAPI +GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, + INT x2, INT y2); + +GpStatus WINGDIPAPI +GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, + REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); + +GpStatus WINGDIPAPI +GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, + INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); + +GpStatus WINGDIPAPI +GdipDrawBeziers(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, + INT count); + +GpStatus WINGDIPAPI +GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, + INT count); + +GpStatus WINGDIPAPI +GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawPolygon(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawPolygonI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path); + +GpStatus WINGDIPAPI +GdipDrawCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawCurveI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawCurve2(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve3(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count, INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve3I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count, INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipDrawClosedCurveI(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPointF *points, INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPoint *points, INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipGraphicsClear(GpGraphics *graphics, ARGB color); + +GpStatus WINGDIPAPI +GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpRectF *rects, INT count); + +GpStatus WINGDIPAPI +GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpRect *rects, INT count); + +GpStatus WINGDIPAPI +GdipFillPolygon(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillPolygonI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillPolygon2(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipFillPieI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path); + +GpStatus WINGDIPAPI +GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count, + REAL tension, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count, + REAL tension, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillRegion(GpGraphics *graphics, GpBrush *brush, + GpRegion *region); + +GpStatus WINGDIPAPI +GdipDrawImage(GpGraphics *graphics, GpImage *image, REAL x, REAL y); + +GpStatus WINGDIPAPI +GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y); + +GpStatus WINGDIPAPI +GdipDrawImageRect(GpGraphics *graphics, GpImage *image, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawImagePoints(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPointF *dstpoints, INT count); + +GpStatus WINGDIPAPI +GdipDrawImagePointsI(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPoint *dstpoints, INT count); + +GpStatus WINGDIPAPI +GdipDrawImagePointRect(GpGraphics *graphics, GpImage *image, REAL x, + REAL y, REAL srcx, REAL srcy, REAL srcwidth, + REAL srcheight, GpUnit srcUnit); + +GpStatus WINGDIPAPI +GdipDrawImagePointRectI(GpGraphics *graphics, GpImage *image, INT x, + INT y, INT srcx, INT srcy, INT srcwidth, + INT srcheight, GpUnit srcUnit); + +GpStatus WINGDIPAPI +GdipDrawImageRectRect(GpGraphics *graphics, GpImage *image, REAL dstx, + REAL dsty, REAL dstwidth, REAL dstheight, + REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, + INT dsty, INT dstwidth, INT dstheight, + INT srcx, INT srcy, INT srcwidth, INT srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPointF *points, INT count, REAL srcx, + REAL srcy, REAL srcwidth, REAL srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImagePointsRectI(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPoint *points, INT count, INT srcx, + INT srcy, INT srcwidth, INT srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPoint( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF & destPoint, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPointI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point & destPoint, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestRect( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST RectF & destRect, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestRectI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Rect & destRect, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPoints( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF * destPoints, + INT count, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPointsI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point * destPoints, + INT count, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPoint( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF & destPoint, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPointI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point & destPoint, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestRect( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST RectF & destRect, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestRectI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Rect & destRect, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPoints( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF * destPoints, + INT count, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPointsI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point * destPoints, + INT count, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipPlayMetafileRecord( + GDIPCONST GpMetafile * metafile, + EmfPlusRecordType recordType, + UINT flags, + UINT dataSize, + GDIPCONST BYTE * data + ); + +GpStatus WINGDIPAPI +GdipSetClipGraphics(GpGraphics *graphics, GpGraphics *srcgraphics, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, + REAL width, REAL height, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, + INT width, INT height, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipPath(GpGraphics *graphics, GpPath *path, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipHrgn(GpGraphics *graphics, HRGN hRgn, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipResetClip(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipTranslateClip(GpGraphics *graphics, REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipTranslateClipI(GpGraphics *graphics, INT dx, INT dy); + +GpStatus WINGDIPAPI +GdipGetClip(GpGraphics *graphics, GpRegion *region); + +GpStatus WINGDIPAPI +GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetClipBoundsI(GpGraphics *graphics, GpRect *rect); + +GpStatus WINGDIPAPI +GdipIsClipEmpty(GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect); + +GpStatus WINGDIPAPI +GdipIsVisibleClipEmpty(GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePointI(GpGraphics *graphics, INT x, INT y, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRect(GpGraphics *graphics, REAL x, REAL y, + REAL width, REAL height, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, + INT width, INT height, BOOL *result); + +GpStatus WINGDIPAPI +GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state); + +GpStatus WINGDIPAPI +GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state); + +GpStatus WINGDIPAPI +GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF* dstrect, + GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state); + +GpStatus WINGDIPAPI +GdipBeginContainerI(GpGraphics *graphics, GDIPCONST GpRect* dstrect, + GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state); + +GpStatus WINGDIPAPI +GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer* state); + +GpStatus WINGDIPAPI +GdipEndContainer(GpGraphics *graphics, GraphicsContainer state); + +GpStatus +GdipGetMetafileHeaderFromWmf( + HMETAFILE hWmf, + GDIPCONST APMFileHeader * apmFileHeader, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromEmf( + HENHMETAFILE hEmf, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromFile( + GDIPCONST WCHAR* filename, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromStream( + IStream * stream, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromMetafile( + GpMetafile * metafile, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetHemfFromMetafile( + GpMetafile * metafile, + HENHMETAFILE * hEmf + ); + +GpStatus WINGDIPAPI +GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromWmf(HMETAFILE hWmf, BOOL deleteWmf, + GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromEmf(HENHMETAFILE hEmf, BOOL deleteEmf, + GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromFile(GDIPCONST WCHAR* file, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR* file, GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromStream(IStream * stream, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipRecordMetafile( + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileI( + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileFileName( + GDIPCONST WCHAR* fileName, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileFileNameI( + GDIPCONST WCHAR* fileName, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileStream( + IStream * stream, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileStreamI( + IStream * stream, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipSetMetafileDownLevelRasterizationLimit( + GpMetafile * metafile, + UINT metafileRasterizationLimitDpi + ); + +GpStatus WINGDIPAPI +GdipGetMetafileDownLevelRasterizationLimit( + GDIPCONST GpMetafile * metafile, + UINT * metafileRasterizationLimitDpi + ); + +GpStatus WINGDIPAPI +GdipGetImageDecodersSize(UINT *numDecoders, UINT *size); + +GpStatus WINGDIPAPI +GdipGetImageDecoders(UINT numDecoders, + UINT size, + ImageCodecInfo *decoders); + +GpStatus WINGDIPAPI +GdipGetImageEncodersSize(UINT *numEncoders, UINT *size); + +GpStatus WINGDIPAPI +GdipGetImageEncoders(UINT numEncoders, + UINT size, + ImageCodecInfo *encoders); + +GpStatus WINGDIPAPI +GdipAddImageCodec(GDIPCONST ImageCodecInfo *codec); + +GpStatus WINGDIPAPI +GdipRemoveImageCodec(GDIPCONST ImageCodecInfo *codec); + +#ifndef DCR_USE_NEW_186091 +GpStatus WINGDIPAPI +GdipGetGraphicsPixel(GpGraphics* graphics, REAL x, REAL y, ARGB* argb); +#endif + +GpStatus WINGDIPAPI +GdipComment(GpGraphics* graphics, UINT sizeData, GDIPCONST BYTE * data); + +GpStatus WINGDIPAPI +GdipGetGraphicsLayout(GpGraphics* graphics, GraphicsLayout* layout); + +GpStatus WINGDIPAPI +GdipSetGraphicsLayout(GpGraphics* graphics, GDIPCONST GraphicsLayout layout); + +//---------------------------------------------------------------------------- +// FontFamily +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, + GpFontCollection *fontCollection, + GpFontFamily **FontFamily); + +GpStatus WINGDIPAPI +GdipDeleteFontFamily(GpFontFamily *FontFamily); + +GpStatus WINGDIPAPI +GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily); + + +GpStatus WINGDIPAPI +GdipGetFamilyName( + GDIPCONST GpFontFamily *family, + WCHAR name[LF_FACESIZE], + LANGID language +); + +GpStatus WINGDIPAPI +GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL * IsStyleAvailable); + +GpStatus WINGDIPAPI +GdipFontCollectionEnumerable( + GpFontCollection* fontCollection, + GpGraphics* graphics, + INT * numFound +); + +GpStatus WINGDIPAPI GdipFontCollectionEnumerate( + GpFontCollection* fontCollection, + INT numSought, + GpFontFamily* gpfamilies[], + INT* numFound, + GpGraphics* graphics +); + +//----------------------------------- +// New API +//----------------------------------- + +GpStatus WINGDIPAPI +GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 * EmHeight); + +GpStatus WINGDIPAPI +GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellAscent); + +GpStatus WINGDIPAPI +GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellDescent); + +GpStatus WINGDIPAPI +GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 * LineSpacing); + + +//---------------------------------------------------------------------------- +// Font +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateFontFromDC( + HDC hdc, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFontFromLogfontA( + HDC hdc, + GDIPCONST LOGFONTA *logfont, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFontFromLogfontW( + HDC hdc, + GDIPCONST LOGFONTW *logfont, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFont( + GDIPCONST GpFontFamily *fontFamily, + REAL emSize, + INT style, + Unit unit, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCloneFont(GpFont* font, GpFont** cloneFont); + +GpStatus WINGDIPAPI +GdipDeleteFont(GpFont* font); + +GpStatus WINGDIPAPI +GdipGetFamily(GpFont *font, GpFontFamily **family); + +GpStatus WINGDIPAPI +GdipGetFontStyle(GpFont *font, INT *style); + +GpStatus WINGDIPAPI +GdipGetFontSize(GpFont *font, REAL *size); + +GpStatus WINGDIPAPI +GdipGetFontUnit(GpFont *font, Unit *unit); + +GpStatus WINGDIPAPI +GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height); + +#ifdef DCR_USE_NEW_125467 +GpStatus WINGDIPAPI +GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height); +#endif + +GpStatus WINGDIPAPI +GdipGetLogFontA(GpFont * font, GpGraphics *graphics, LOGFONTA * logfontA); + +GpStatus WINGDIPAPI +GdipGetLogFontW(GpFont * font, GpGraphics *graphics, LOGFONTW * logfontW); + +// FontCollection + +GpStatus WINGDIPAPI +GdipNewInstalledFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipNewPrivateFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipDeletePrivateFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipGetFontCollectionFamilyCount( + GpFontCollection* fontCollection, + INT * numFound +); + +GpStatus WINGDIPAPI +GdipGetFontCollectionFamilyList( + GpFontCollection* fontCollection, + INT numSought, + GpFontFamily* gpfamilies[], + INT* numFound +); + +#ifndef DCR_USE_NEW_235072 +GpStatus WINGDIPAPI +GdipInstallFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); + +GpStatus WINGDIPAPI +GdipUninstallFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); +#endif + +GpStatus WINGDIPAPI +GdipPrivateAddFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); + +GpStatus WINGDIPAPI +GdipPrivateAddMemoryFont( + GpFontCollection* fontCollection, + GDIPCONST void* memory, + INT length +); + +//---------------------------------------------------------------------------- +// Text +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipDrawString( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *stringFormat, + GDIPCONST GpBrush *brush +); + +GpStatus WINGDIPAPI +GdipMeasureString( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *stringFormat, + RectF *boundingBox, + INT *codepointsFitted, + INT *linesFilled +); + +#ifndef DCR_USE_NEW_174340 +GpStatus WINGDIPAPI +GdipMeasureStringRegion( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF &layoutRect, + GDIPCONST GpStringFormat *stringFormat, + INT firstCharacterIndex, + INT characterCount, + GpRegion *region +); +#endif + +#ifdef DCR_USE_NEW_174340 +GpStatus +WINGDIPAPI +GdipMeasureCharacterRanges( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF &layoutRect, + GDIPCONST GpStringFormat *stringFormat, + INT regionCount, + GpRegion **regions +); +#endif + +GpStatus WINGDIPAPI +GdipDrawDriverString( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST GpBrush *brush, + GDIPCONST PointF *positions, + INT flags, + GDIPCONST GpMatrix *matrix +); + +GpStatus WINGDIPAPI +GdipMeasureDriverString( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST PointF *positions, + INT flags, + GDIPCONST GpMatrix *matrix, + RectF *boundingBox +); + +#ifndef DCR_USE_NEW_168772 +GpStatus WINGDIPAPI +GdipDriverStringPointToCodepoint( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST PointF *positions, + INT flags, + GpMatrix *matrix, + GDIPCONST PointF *hit, + INT *index, + BOOL *rightEdge, + REAL *distance +); +#endif + +//---------------------------------------------------------------------------- +// String format APIs +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateStringFormat( + INT formatAttributes, + LANGID language, + GpStringFormat **format +); + +GpStatus WINGDIPAPI +GdipStringFormatGetGenericDefault(GpStringFormat **format); + +GpStatus WINGDIPAPI +GdipStringFormatGetGenericTypographic(GpStringFormat **format); + +GpStatus WINGDIPAPI +GdipDeleteStringFormat(GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat); + +GpStatus WINGDIPAPI +GdipSetStringFormatFlags(GpStringFormat *format, INT flags); + +GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags); + +#ifndef DCR_USE_NEW_152154 +GpStatus WINGDIPAPI +GdipSetStringFormatLineSpacing(GpStringFormat *format, REAL amount, + LineSpacing method); + +GpStatus WINGDIPAPI +GdipGetStringFormatLineSpacingAmount(GDIPCONST GpStringFormat *format, REAL *amount); +GpStatus WINGDIPAPI +GdipGetStringFormatLineSpacingMethod(GDIPCONST GpStringFormat *format, LineSpacing *method); +#endif + +GpStatus WINGDIPAPI +GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align); + +GpStatus WINGDIPAPI +GdipGetStringFormatAlign(GDIPCONST GpStringFormat *format, StringAlignment *align); + +GpStatus WINGDIPAPI +GdipSetStringFormatLineAlign(GpStringFormat *format, + StringAlignment align); + +GpStatus WINGDIPAPI +GdipGetStringFormatLineAlign(GDIPCONST GpStringFormat *format, + StringAlignment *align); + +GpStatus WINGDIPAPI +GdipSetStringFormatTrimming( + GpStringFormat *format, + StringTrimming trimming +); + +GpStatus WINGDIPAPI +GdipGetStringFormatTrimming( + GDIPCONST GpStringFormat *format, + StringTrimming *trimming +); + +GpStatus WINGDIPAPI +GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hotkeyPrefix); + +GpStatus WINGDIPAPI +GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); + +GpStatus WINGDIPAPI +GdipSetStringFormatTabStops(GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); + +GpStatus WINGDIPAPI +GdipGetStringFormatTabStops(GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); + +GpStatus WINGDIPAPI +GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format, INT * count); + +#ifdef DCR_USE_NEW_146933 +GpStatus WINGDIPAPI +GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, + StringDigitSubstitute substitute); + +GpStatus WINGDIPAPI +GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format, LANGID *language, + StringDigitSubstitute *substitute); +#endif // DCR_USE_NEW_146933 + +#ifdef DCR_USE_NEW_174340 +GpStatus WINGDIPAPI +GdipGetStringFormatMeasurableCharacterRangeCount( + GDIPCONST GpStringFormat *format, + INT *count +); + +GpStatus WINGDIPAPI +GdipSetStringFormatMeasurableCharacterRanges( + GpStringFormat *format, + INT rangeCount, + GDIPCONST CharacterRange *ranges +); +#endif + +//---------------------------------------------------------------------------- +// Cached Bitmap APIs +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateCachedBitmap( + GpBitmap *bitmap, + GpGraphics *graphics, + GpCachedBitmap **cachedBitmap +); + +GpStatus WINGDIPAPI +GdipDeleteCachedBitmap(GpCachedBitmap *cachedBitmap); + +GpStatus WINGDIPAPI +GdipDrawCachedBitmap( + GpGraphics *graphics, + GpCachedBitmap *cachedBitmap, + INT x, + INT y +); + +UINT WINGDIPAPI +GdipEmfToWmfBits( + HENHMETAFILE hemf, + UINT cbData16, + LPBYTE pData16, + INT iMapMode, + INT eFlags +); + +#ifdef __cplusplus +} +#endif + +#endif // !_FLATAPI_H diff --git a/win32/gdiplus/include/GdiplusFont.h b/win32/gdiplus/include/GdiplusFont.h new file mode 100644 index 0000000..c9ff050 --- /dev/null +++ b/win32/gdiplus/include/GdiplusFont.h @@ -0,0 +1,299 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFont.h +* +* Abstract: +* +* Font related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSFONT_H +#define _GDIPLUSFONT_H + +inline +Font::Font(IN HDC hdc) +{ + GpFont *font = NULL; + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +#ifdef DCR_USE_NEW_127084 +inline +Font::Font(IN HDC hdc, + IN const HFONT hfont) +{ + GpFont *font = NULL; + + if (hfont) + { + LOGFONTA lf; + + if(GetObjectA(hfont, sizeof(LOGFONTA), &lf)) + lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font); + else + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} +#endif + +inline +Font::Font(IN HDC hdc, + IN const LOGFONTW* logfont) +{ + GpFont *font = NULL; + if (logfont) + { + lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font(IN HDC hdc, + IN const LOGFONTA* logfont) +{ + GpFont *font = NULL; + + if (logfont) + { + lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font( + IN const FontFamily * family, + IN REAL emSize, + IN INT style, + IN Unit unit +) +{ + GpFont *font = NULL; + + lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL, + emSize, + style, + unit, + &font); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font( + IN const WCHAR * familyName, + IN REAL emSize, + IN INT style, + IN Unit unit, + IN const FontCollection * fontCollection +) +{ + FontFamily family(familyName, fontCollection); + + GpFont * font = NULL; + + lastResult = family.GetLastStatus(); + + if (lastResult == Ok) + { + lastResult = DllExports::GdipCreateFont(family.nativeFamily, + emSize, + style, + unit, + &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline Status +Font::GetLogFontA(IN const Graphics *g, + OUT LOGFONTA *logfontA) const +{ + return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA)); + +} + +inline Status +Font::GetLogFontW(IN const Graphics *g, + OUT LOGFONTW *logfontW) const +{ + return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW)); +} + + +inline Font* +Font::Clone() const +{ + GpFont *cloneFont = NULL; + + SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont)); + + return new Font(cloneFont, lastResult); +} + +inline +Font::~Font() +{ + DllExports::GdipDeleteFont(nativeFont); +} + +// Operations + +inline BOOL +Font::IsAvailable() const +{ + return (nativeFont ? TRUE : FALSE); +} + +inline Status +Font::GetFamily(OUT FontFamily *family) const +{ + if (family == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily)); + family->SetStatus(status); + + return SetStatus(status); +} + +inline INT +Font::GetStyle() const +{ + INT style; + + SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style)); + + return style; +} + +inline REAL +Font::GetSize() const +{ + REAL size; + SetStatus(DllExports::GdipGetFontSize(nativeFont, &size)); + return size; +} + +inline Unit +Font::GetUnit() const +{ + Unit unit; + SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit)); + return unit; +} + +inline REAL +Font::GetHeight(IN const Graphics *graphics) const +{ + REAL height; + SetStatus(DllExports::GdipGetFontHeight( + nativeFont, + graphics ? graphics->nativeGraphics : NULL, + &height + )); + return height; +} + + +#ifdef DCR_USE_NEW_125467 +inline REAL +Font::GetHeight(IN REAL dpi = 0) const +{ + REAL height; + SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height)); + return height; +} +#endif + + +// protected method +inline +Font::Font(IN GpFont* font, + IN Status status) +{ + lastResult = status; + SetNativeFont(font); +} + +// protected method +inline VOID +Font::SetNativeFont(GpFont *Font) +{ + nativeFont = Font; +} + +inline Status +Font::GetLastStatus(void) const +{ + return lastResult; +} + +// protected method +inline Status +Font::SetStatus(IN Status status) const +{ + if (status != Ok) + return (lastResult = status); + else + return status; +} + +#endif diff --git a/win32/gdiplus/include/GdiplusFontCollection.h b/win32/gdiplus/include/GdiplusFontCollection.h new file mode 100644 index 0000000..d2257ba --- /dev/null +++ b/win32/gdiplus/include/GdiplusFontCollection.h @@ -0,0 +1,149 @@ +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFontCollection.h +* +* Abstract: +* +* Font collections (Installed and Private) +* +\**************************************************************************/ + +#ifndef _GDIPLUSFONTCOLL_H +#define _GDIPLUSFONTCOLL_H + +inline +FontCollection::FontCollection() +{ + nativeFontCollection = NULL; +} + +inline +FontCollection::~FontCollection() +{ +} + +inline INT +FontCollection::GetFamilyCount() const +{ + INT numFound = 0; + + lastResult = DllExports::GdipGetFontCollectionFamilyCount( + nativeFontCollection, &numFound); + + + + return numFound; +} + +inline Status +FontCollection::GetFamilies( + IN INT numSought, + OUT FontFamily * gpfamilies, + OUT INT * numFound +) const +{ + if (numSought <= 0 || gpfamilies == NULL || numFound == NULL) + { + return SetStatus(InvalidParameter); + } + *numFound = 0; + GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought]; + + if (nativeFamilyList == NULL) + { + return SetStatus(OutOfMemory); + } + + Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList( + nativeFontCollection, + numSought, + nativeFamilyList, + numFound + )); + if (status == Ok) + { + for (INT i = 0; i < *numFound; i++) + { + DllExports::GdipCloneFontFamily(nativeFamilyList[i], + &gpfamilies[i].nativeFamily); + } + } + + delete [] nativeFamilyList; + + return status; +} + +inline Status FontCollection::GetLastStatus () const +{ + return lastResult; +} + +// protected method +inline Status +FontCollection::SetStatus(IN Status status) const +{ + lastResult = status; + return lastResult; +} + +inline +InstalledFontCollection::InstalledFontCollection() +{ + nativeFontCollection = NULL; + lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection); +} + +inline +InstalledFontCollection::~InstalledFontCollection() +{ +} + +#ifndef DCR_USE_NEW_235072 +inline Status +InstalledFontCollection::InstallFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipInstallFontFile(nativeFontCollection, filename)); +} + +inline Status +InstalledFontCollection::UninstallFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipUninstallFontFile(nativeFontCollection, filename)); +} +#endif + +inline +PrivateFontCollection::PrivateFontCollection() +{ + nativeFontCollection = NULL; + lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection); +} + +inline +PrivateFontCollection::~PrivateFontCollection() +{ + DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection); +} + +inline Status +PrivateFontCollection::AddFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename)); +} + +inline Status +PrivateFontCollection::AddMemoryFont(IN const void* memory, + IN INT length) +{ + return SetStatus(DllExports::GdipPrivateAddMemoryFont( + nativeFontCollection, + memory, + length)); +} + +#endif // _GDIPLUSFONTCOLL_H diff --git a/win32/gdiplus/include/GdiplusFontFamily.h b/win32/gdiplus/include/GdiplusFontFamily.h new file mode 100644 index 0000000..ef2f3dd --- /dev/null +++ b/win32/gdiplus/include/GdiplusFontFamily.h @@ -0,0 +1,271 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFontFamily.h +* +* Abstract: +* +* Font family API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUS_FONT_FAMILY_H +#define _GDIPLUS_FONT_FAMILY_H + +inline +FontFamily::FontFamily() : + nativeFamily (NULL), + lastResult (Ok) +{ +} + +inline +FontFamily::FontFamily( + IN const WCHAR* name, + IN const FontCollection* fontCollection +) +{ + nativeFamily = NULL; + lastResult = DllExports::GdipCreateFontFamilyFromName( + name, + fontCollection ? fontCollection->nativeFontCollection : NULL, + &nativeFamily + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif +} + +// private method +inline +FontFamily::FontFamily( + IN GpFontFamily *nativeOrig, + IN Status status +) +{ + lastResult = status; + nativeFamily = nativeOrig; +} + +// Generic font family access + +inline const FontFamily * +FontFamily::GenericSansSerif() +{ + if (GenericSansSerifFontFamily != NULL) + { + return GenericSansSerifFontFamily; + } + + GenericSansSerifFontFamily = + (FontFamily*) GenericSansSerifFontFamilyBuffer; + + GenericSansSerifFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilySansSerif( + &(GenericSansSerifFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericSansSerifFontFamily->lastResult >= 10) + GenericSansSerifFontFamily->lastResult = NotFound; +#endif + + return GenericSansSerifFontFamily; +} + +inline const FontFamily * +FontFamily::GenericSerif() +{ + if (GenericSerifFontFamily != NULL) + { + return GenericSerifFontFamily; + } + + GenericSerifFontFamily = + (FontFamily*) GenericSerifFontFamilyBuffer; + + GenericSerifFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilySerif( + &(GenericSerifFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericSerifFontFamily->lastResult >= 10) + GenericSerifFontFamily->lastResult = NotFound; +#endif + + return GenericSerifFontFamily; +} + +inline const FontFamily * +FontFamily::GenericMonospace() +{ + if (GenericMonospaceFontFamily != NULL) + { + return GenericMonospaceFontFamily; + } + + GenericMonospaceFontFamily = + (FontFamily*) GenericMonospaceFontFamilyBuffer; + + GenericMonospaceFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilyMonospace( + &(GenericMonospaceFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericMonospaceFontFamily->lastResult >= 10) + GenericMonospaceFontFamily->lastResult = NotFound; +#endif + + return GenericMonospaceFontFamily; +} + +inline FontFamily::~FontFamily() +{ + DllExports::GdipDeleteFontFamily (nativeFamily); +} + +inline FontFamily * +FontFamily::Clone() const +{ + GpFontFamily * clonedFamily = NULL; + + SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily)); + + return new FontFamily(clonedFamily, lastResult); +} + +inline Status +FontFamily::GetFamilyName( + IN WCHAR name[LF_FACESIZE], + IN LANGID language +) const +{ + return SetStatus(DllExports::GdipGetFamilyName(nativeFamily, + name, + language)); +} + +inline BOOL +FontFamily::IsStyleAvailable(IN INT style) const +{ + BOOL StyleAvailable; + Status status; + + status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable)); + + if (status != Ok) + StyleAvailable = FALSE; + + return StyleAvailable; +} + + +inline UINT16 +FontFamily::GetEmHeight(IN INT style) const +{ + UINT16 EmHeight; + + SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight)); + + return EmHeight; +} + +inline UINT16 +FontFamily::GetCellAscent(IN INT style) const +{ + UINT16 CellAscent; + + SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent)); + + return CellAscent; +} + +inline UINT16 +FontFamily::GetCellDescent(IN INT style) const +{ + UINT16 CellDescent; + + SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent)); + + return CellDescent; +} + + +inline UINT16 +FontFamily::GetLineSpacing(IN INT style) const +{ + UINT16 LineSpacing; + + SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing)); + + return LineSpacing; + +} + +#ifdef TEXTV2 + +// The following APIs return data from the font OS/2 table + +inline INT16 +FontFamily::GetTypographicAscent(IN INT style) const +{ + INT16 TypographicAscent; + + SetStatus(DllExports::GdipGetTypographicAscent(nativeFamily, style, &TypographicAscent)); + + return TypographicAscent; +} + +inline INT16 +FontFamily::GetTypographicDescent(IN INT style) const +{ + INT16 TypographicDescent; + + SetStatus(DllExports::GdipGetTypographicDescent(nativeFamily, style, &TypographicDescent)); + + return TypographicDescent; +} + +inline INT16 +FontFamily::GetTypographicLineGap(IN INT style) const +{ + INT16 TypographicLineGap; + + SetStatus(DllExports::GdipGetTypographicLineGap(nativeFamily, style, &TypographicLineGap)); + + return TypographicLineGap; +} + +#endif + +/////////////////////////////////////////////////////////// + +// GetLastStatus - return last error code and clear error code + +inline Status +FontFamily::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +// protected method +inline Status +FontFamily::SetStatus(Status status) const +{ + if (status != Ok) + return (lastResult = status); + else + return status; +} + +#endif diff --git a/win32/gdiplus/include/GdiplusGpStubs.h b/win32/gdiplus/include/GdiplusGpStubs.h new file mode 100644 index 0000000..121288d --- /dev/null +++ b/win32/gdiplus/include/GdiplusGpStubs.h @@ -0,0 +1,107 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusGpStubs.h +* +* Abstract: +* +* GDI+ Native C++ public header file +* +\**************************************************************************/ + +#ifndef _GDIPLUSGPSTUBS_H +#define _GDIPLUSGPSTUBS_H + +//--------------------------------------------------------------------------- +// GDI+ classes for forward reference +//--------------------------------------------------------------------------- + +class Graphics; +class Pen; +class Brush; +class Matrix; +class Bitmap; +class Metafile; +class GraphicsPath; +class PathIterator; +class Region; +class Image; +class TextureBrush; +class HatchBrush; +class SolidBrush; +class LinearGradientBrush; +class PathGradientBrush; +class Font; +class FontFamily; +class FontCollection; +class InstalledFontCollection; +class PrivateFontCollection; +class ImageAttributes; +class CachedBitmap; + +//--------------------------------------------------------------------------- +// Internal GDI+ classes for internal type checking +//--------------------------------------------------------------------------- +class GpGraphics {}; + +class GpBrush {}; +class GpTexture : public GpBrush {}; +class GpSolidFill : public GpBrush {}; +class GpLineGradient : public GpBrush {}; +class GpPathGradient : public GpBrush {}; +class GpHatch : public GpBrush {}; + +class GpPen {}; +class GpCustomLineCap {}; +class GpAdjustableArrowCap : public GpCustomLineCap {}; + +class GpImage {}; +class GpBitmap : public GpImage {}; +class GpMetafile : public GpImage {}; +class GpImageAttributes {}; + +class GpPath {}; +class GpRegion {}; +class GpPathIterator {}; + +class GpFontFamily {}; +class GpFont {}; +class GpStringFormat {}; +class GpFontCollection {}; +class GpInstalledFontCollection : public GpFontCollection {}; +class GpPrivateFontCollection : public GpFontCollection {}; + +class GpCachedBitmap; + +typedef Status GpStatus; +typedef FillMode GpFillMode; +typedef WrapMode GpWrapMode; +typedef Unit GpUnit; +typedef CoordinateSpace GpCoordinateSpace; +typedef PointF GpPointF; +typedef Point GpPoint; +typedef RectF GpRectF; +typedef Rect GpRect; +typedef SizeF GpSizeF; +typedef HatchStyle GpHatchStyle; +typedef DashStyle GpDashStyle; +typedef LineCap GpLineCap; +typedef DashCap GpDashCap; + + +typedef PenAlignment GpPenAlignment; + +typedef LineJoin GpLineJoin; +typedef PenType GpPenType; + +typedef Matrix GpMatrix; +typedef BrushType GpBrushType; +typedef MatrixOrder GpMatrixOrder; +typedef FlushIntention GpFlushIntention; +typedef PathData GpPathData; + +#endif // !_GDIPLUSGPSTUBS.HPP + diff --git a/win32/gdiplus/include/GdiplusGraphics.h b/win32/gdiplus/include/GdiplusGraphics.h new file mode 100644 index 0000000..7b39a6e --- /dev/null +++ b/win32/gdiplus/include/GdiplusGraphics.h @@ -0,0 +1,2726 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusGraphics.h +* +* Abstract: +* +* Declarations for Graphics class +* +\**************************************************************************/ + +#ifndef _GDIPLUSGRAPHICS_H +#define _GDIPLUSGRAPHICS_H + +/** + * Represent a graphics context + */ +class Graphics : public GdiplusBase +{ +public: + friend class Region; + friend class GraphicsPath; + friend class Image; + friend class Bitmap; + friend class Metafile; + friend class Font; + friend class FontFamily; + friend class FontCollection; + friend class CachedBitmap; + + // Get a graphics context from an existing Win32 HDC or HWND + static Graphics* FromHDC(IN HDC hdc) + { + return new Graphics(hdc); + } + + static Graphics* FromHDC(IN HDC hdc, + IN HANDLE hdevice) + { + return new Graphics(hdc, hdevice); + } + + static Graphics* FromHWND(IN HWND hwnd, + IN BOOL icm = FALSE) + { + return new Graphics(hwnd, icm); + } + + static Graphics* FromImage(IN Image *image) + { + return new Graphics(image); + } + + Graphics(IN HDC hdc) + { + GpGraphics *graphics = NULL; + + lastResult = DllExports::GdipCreateFromHDC(hdc, &graphics); + + SetNativeGraphics(graphics); + } + + Graphics(IN HDC hdc, + IN HANDLE hdevice) + { + GpGraphics *graphics = NULL; + + lastResult = DllExports::GdipCreateFromHDC2(hdc, hdevice, &graphics); + + SetNativeGraphics(graphics); + } + + Graphics(IN HWND hwnd, + IN BOOL icm = FALSE) + { + GpGraphics *graphics = NULL; + + if (icm) + { + lastResult = DllExports::GdipCreateFromHWNDICM(hwnd, &graphics); + } + else + { + lastResult = DllExports::GdipCreateFromHWND(hwnd, &graphics); + } + + SetNativeGraphics(graphics); + } + + Graphics(IN Image* image) + { + GpGraphics *graphics = NULL; + + if (image != NULL) + { + lastResult = DllExports::GdipGetImageGraphicsContext( + image->nativeImage, &graphics); + } + SetNativeGraphics(graphics); + } + + ~Graphics() + { + DllExports::GdipDeleteGraphics(nativeGraphics); + } + + VOID Flush(IN FlushIntention intention = FlushIntentionFlush) + { + DllExports::GdipFlush(nativeGraphics, intention); + } + + //------------------------------------------------------------------------ + // Interop methods + //------------------------------------------------------------------------ + + // Locks the graphics until ReleaseDC is called + HDC GetHDC() + { + HDC hdc = NULL; + + SetStatus(DllExports::GdipGetDC(nativeGraphics, &hdc)); + + return hdc; + } + + VOID ReleaseHDC(IN HDC hdc) + { + SetStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc)); + } + + //------------------------------------------------------------------------ + // Rendering modes + //------------------------------------------------------------------------ + + Status SetRenderingOrigin(IN INT x, IN INT y) + { + return SetStatus( + DllExports::GdipSetRenderingOrigin( + nativeGraphics, x, y + ) + ); + } + + Status GetRenderingOrigin(OUT INT *x, OUT INT *y) const + { + return SetStatus( + DllExports::GdipGetRenderingOrigin( + nativeGraphics, x, y + ) + ); + } + + Status SetCompositingMode(IN CompositingMode compositingMode) + { + return SetStatus(DllExports::GdipSetCompositingMode(nativeGraphics, + compositingMode)); + } + + CompositingMode GetCompositingMode() const + { + CompositingMode mode; + + SetStatus(DllExports::GdipGetCompositingMode(nativeGraphics, + &mode)); + + return mode; + } + + Status SetCompositingQuality(IN CompositingQuality compositingQuality) + { + return SetStatus(DllExports::GdipSetCompositingQuality( + nativeGraphics, + compositingQuality)); + } + + CompositingQuality GetCompositingQuality() const + { + CompositingQuality quality; + + SetStatus(DllExports::GdipGetCompositingQuality( + nativeGraphics, + &quality)); + + return quality; + } + + Status SetTextRenderingHint(IN TextRenderingHint newMode) + { +#ifndef DCR_USE_NEW_186764 + /* temporarly set the high bit to warn that we are using the new definition for the flag */ + newMode = (TextRenderingHint) (newMode | 0x0f000); +#endif // DCR_USE_NEW_186764 + return SetStatus(DllExports::GdipSetTextRenderingHint(nativeGraphics, + newMode)); + } + + TextRenderingHint GetTextRenderingHint() const + { + TextRenderingHint hint; + + SetStatus(DllExports::GdipGetTextRenderingHint(nativeGraphics, + &hint)); + + return hint; + } + +#ifdef DCR_USE_NEW_188922 + Status SetTextContrast(IN UINT contrast) + { + return SetStatus(DllExports::GdipSetTextContrast(nativeGraphics, + contrast)); + } + + UINT GetTextContrast() const + { + UINT contrast; + + SetStatus(DllExports::GdipGetTextContrast(nativeGraphics, + &contrast)); + + return contrast; + } +#else + Status SetTextGammaValue(IN UINT gammaValue) + { + return SetStatus(DllExports::GdipSetTextGammaValue(nativeGraphics, + gammaValue)); + } + + UINT GetTextGammaValue() const + { + UINT gammaValue; + + SetStatus(DllExports::GdipGetTextGammaValue(nativeGraphics, + &gammaValue)); + + return gammaValue; + } + +#endif // DCR_USE_NEW_188922 + + + InterpolationMode GetInterpolationMode() const + { + InterpolationMode mode = InterpolationModeInvalid; + + SetStatus(DllExports::GdipGetInterpolationMode(nativeGraphics, + &mode)); + + return mode; + } + + Status SetInterpolationMode(IN InterpolationMode interpolationMode) + { + return SetStatus(DllExports::GdipSetInterpolationMode(nativeGraphics, + interpolationMode)); + } + + SmoothingMode GetSmoothingMode() const + { + SmoothingMode smoothingMode = SmoothingModeInvalid; + + SetStatus(DllExports::GdipGetSmoothingMode(nativeGraphics, + &smoothingMode)); + + return smoothingMode; + } + + Status SetSmoothingMode(IN SmoothingMode smoothingMode) + { + return SetStatus(DllExports::GdipSetSmoothingMode(nativeGraphics, + smoothingMode)); + } + + PixelOffsetMode GetPixelOffsetMode() const + { + PixelOffsetMode pixelOffsetMode = PixelOffsetModeInvalid; + + SetStatus(DllExports::GdipGetPixelOffsetMode(nativeGraphics, + &pixelOffsetMode)); + + return pixelOffsetMode; + } + + Status SetPixelOffsetMode(IN PixelOffsetMode pixelOffsetMode) + { + return SetStatus(DllExports::GdipSetPixelOffsetMode(nativeGraphics, + pixelOffsetMode)); + } + + //------------------------------------------------------------------------ + // Manipulate the current world transform + //------------------------------------------------------------------------ + + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetWorldTransform(nativeGraphics, + matrix->nativeMatrix)); + } + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetWorldTransform(nativeGraphics)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyWorldTransform(nativeGraphics, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateWorldTransform(nativeGraphics, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleWorldTransform(nativeGraphics, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateWorldTransform(nativeGraphics, + angle, order)); + } + + /** + * Return the current world transform + */ + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetWorldTransform(nativeGraphics, + matrix->nativeMatrix)); + } + + /** + * Manipulate the current page transform + */ + + Status SetPageUnit(IN Unit unit) + { + return SetStatus(DllExports::GdipSetPageUnit(nativeGraphics, + unit)); + } + + Status SetPageScale(IN REAL scale) + { + return SetStatus(DllExports::GdipSetPageScale(nativeGraphics, + scale)); + } + + /** + * Retrieve the current page transform information + * notes @ these are atomic + */ + Unit GetPageUnit() const + { + Unit unit; + + SetStatus(DllExports::GdipGetPageUnit(nativeGraphics, &unit)); + + return unit; + } + + REAL GetPageScale() const + { + REAL scale; + + SetStatus(DllExports::GdipGetPageScale(nativeGraphics, &scale)); + + return scale; + } + + REAL GetDpiX() const + { + REAL dpi; + + SetStatus(DllExports::GdipGetDpiX(nativeGraphics, &dpi)); + + return dpi; + } + + REAL GetDpiY() const + { + REAL dpi; + + SetStatus(DllExports::GdipGetDpiY(nativeGraphics, &dpi)); + + return dpi; + } + + /** + * Transform points in the current graphics context + */ + // float version + Status TransformPoints(IN CoordinateSpace destSpace, + IN CoordinateSpace srcSpace, + IN OUT PointF* pts, + IN INT count) const + { + return SetStatus(DllExports::GdipTransformPoints(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + } + + // integer version + Status TransformPoints(IN CoordinateSpace destSpace, + IN CoordinateSpace srcSpace, + IN OUT Point* pts, + IN INT count) const + { + + return SetStatus(DllExports::GdipTransformPointsI(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + } + + //------------------------------------------------------------------------ + // GetNearestColor (for <= 8bpp surfaces) + // Note: alpha is ignored + //------------------------------------------------------------------------ + Status GetNearestColor(IN OUT Color* color) const + { + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + ARGB argb = color->GetValue(); + + Status status = SetStatus(DllExports::GdipGetNearestColor(nativeGraphics, &argb)); + + color->SetValue(argb); + + return status; + } + + /** + * Vector drawing methods + * + * @notes Do we need a set of methods that take + * integer coordinate parameters? + */ + + // float version + Status DrawLine(IN const Pen* pen, + IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2) + { + return SetStatus(DllExports::GdipDrawLine(nativeGraphics, + pen->nativePen, x1, y1, x2, + y2)); + } + + Status DrawLine(IN const Pen* pen, + IN const PointF& pt1, + IN const PointF& pt2) + { + return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y); + } + + Status DrawLines(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawLines(nativeGraphics, + pen->nativePen, + points, count)); + } + + // int version + Status DrawLine(IN const Pen* pen, + IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2) + { + return SetStatus(DllExports::GdipDrawLineI(nativeGraphics, + pen->nativePen, + x1, + y1, + x2, + y2)); + } + + Status DrawLine(IN const Pen* pen, + IN const Point& pt1, + IN const Point& pt2) + { + return DrawLine(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y); + } + + Status DrawLines(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawLinesI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawArc(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawArc(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + Status DrawArc(IN const Pen* pen, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + // int version + Status DrawArc(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawArcI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + + Status DrawArc(IN const Pen* pen, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawArc(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + // float version + Status DrawBezier(IN const Pen* pen, + IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2, + IN REAL x3, + IN REAL y3, + IN REAL x4, + IN REAL y4) + { + return SetStatus(DllExports::GdipDrawBezier(nativeGraphics, + pen->nativePen, x1, y1, + x2, y2, x3, y3, x4, y4)); + } + + Status DrawBezier(IN const Pen* pen, + IN const PointF& pt1, + IN const PointF& pt2, + IN const PointF& pt3, + IN const PointF& pt4) + { + return DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + } + + Status DrawBeziers(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawBeziers(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // int version + Status DrawBezier(IN const Pen* pen, + IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2, + IN INT x3, + IN INT y3, + IN INT x4, + IN INT y4) + { + return SetStatus(DllExports::GdipDrawBezierI(nativeGraphics, + pen->nativePen, + x1, + y1, + x2, + y2, + x3, + y3, + x4, + y4)); + } + + Status DrawBezier(IN const Pen* pen, + IN const Point& pt1, + IN const Point& pt2, + IN const Point& pt3, + IN const Point& pt4) + { + return DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + } + + Status DrawBeziers(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawBeziersI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawRectangle(IN const Pen* pen, + IN const RectF& rect) + { + return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawRectangle(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawRectangle(nativeGraphics, + pen->nativePen, x, y, + width, height)); + } + + Status DrawRectangles(IN const Pen* pen, + IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipDrawRectangles(nativeGraphics, + pen->nativePen, + rects, count)); + } + + // integer version + Status DrawRectangle(IN const Pen* pen, + IN const Rect& rect) + { + return DrawRectangle(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawRectangle(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipDrawRectangleI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + Status DrawRectangles(IN const Pen* pen, + IN const Rect* rects, + IN INT count) + { + return SetStatus(DllExports::GdipDrawRectanglesI(nativeGraphics, + pen->nativePen, + rects, + count)); + } + + // float version + Status DrawEllipse(IN const Pen* pen, + IN const RectF& rect) + { + return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawEllipse(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawEllipse(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + // integer version + Status DrawEllipse(IN const Pen* pen, + IN const Rect& rect) + { + return DrawEllipse(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawEllipse(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipDrawEllipseI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + // floating point version + Status DrawPie(IN const Pen* pen, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status DrawPie(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawPie(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // integer point version + Status DrawPie(IN const Pen* pen, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status DrawPie(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawPieI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // float version + Status DrawPolygon(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawPolygon(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // integer version + Status DrawPolygon(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawPolygonI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawPath(IN const Pen* pen, + IN const GraphicsPath* path) + { + return SetStatus(DllExports::GdipDrawPath(nativeGraphics, + pen ? pen->nativePen : NULL, + path ? path->nativePath : NULL)); + } + + // float version + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawCurve(nativeGraphics, + pen->nativePen, points, + count)); + } + + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawCurve2(nativeGraphics, + pen->nativePen, points, + count, tension)); + } + + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipDrawCurve3(nativeGraphics, + pen->nativePen, points, + count, offset, + numberOfSegments, tension)); + } + + // integer version + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawCurveI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawCurve2I(nativeGraphics, + pen->nativePen, + points, + count, + tension)); + } + + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipDrawCurve3I(nativeGraphics, + pen->nativePen, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // float version + Status DrawClosedCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawClosedCurve(nativeGraphics, + pen->nativePen, + points, count)); + } + + Status DrawClosedCurve(IN const Pen *pen, + IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawClosedCurve2(nativeGraphics, + pen->nativePen, + points, count, + tension)); + } + + // integer version + Status DrawClosedCurve(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawClosedCurveI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + Status DrawClosedCurve(IN const Pen *pen, + IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawClosedCurve2I(nativeGraphics, + pen->nativePen, + points, + count, + tension)); + } + + Status Clear(IN const Color &color) + { + return SetStatus(DllExports::GdipGraphicsClear( + nativeGraphics, + color.GetValue())); + } + + // float version + Status FillRectangle(IN const Brush* brush, + IN const RectF& rect) + { + return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillRectangle(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipFillRectangle(nativeGraphics, + brush->nativeBrush, x, y, + width, height)); + } + + Status FillRectangles(IN const Brush* brush, + IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipFillRectangles(nativeGraphics, + brush->nativeBrush, + rects, count)); + } + + // integer version + Status FillRectangle(IN const Brush* brush, + IN const Rect& rect) + { + return FillRectangle(brush, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status FillRectangle(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipFillRectangleI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height)); + } + + Status FillRectangles(IN const Brush* brush, + IN const Rect* rects, + IN INT count) + { + return SetStatus(DllExports::GdipFillRectanglesI(nativeGraphics, + brush->nativeBrush, + rects, + count)); + } + + // float version + Status FillPolygon(IN const Brush* brush, + IN const PointF* points, + IN INT count) + { + return FillPolygon(brush, points, count, FillModeAlternate); + } + + Status FillPolygon(IN const Brush* brush, + IN const PointF* points, + IN INT count, + IN FillMode fillMode) + { + return SetStatus(DllExports::GdipFillPolygon(nativeGraphics, + brush->nativeBrush, + points, count, fillMode)); + } + + // integer version + Status FillPolygon(IN const Brush* brush, + IN const Point* points, + IN INT count) + { + return FillPolygon(brush, points, count, FillModeAlternate); + } + + Status FillPolygon(IN const Brush* brush, + IN const Point* points, + IN INT count, + IN FillMode fillMode) + { + return SetStatus(DllExports::GdipFillPolygonI(nativeGraphics, + brush->nativeBrush, + points, count, + fillMode)); + } + + // float version + Status FillEllipse(IN const Brush* brush, + IN const RectF& rect) + { + return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillEllipse(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipFillEllipse(nativeGraphics, + brush->nativeBrush, x, y, + width, height)); + } + + // integer version + Status FillEllipse(IN const Brush* brush, + IN const Rect& rect) + { + return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillEllipse(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipFillEllipseI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height)); + } + + // float version + Status FillPie(IN const Brush* brush, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status FillPie(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipFillPie(nativeGraphics, + brush->nativeBrush, x, y, + width, height, startAngle, + sweepAngle)); + } + + // integer version + Status FillPie(IN const Brush* brush, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status FillPie(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipFillPieI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + Status FillPath(IN const Brush* brush, + IN const GraphicsPath* path) + { + return SetStatus(DllExports::GdipFillPath(nativeGraphics, + brush->nativeBrush, + path->nativePath)); + } + + // float version + Status FillClosedCurve(IN const Brush* brush, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipFillClosedCurve(nativeGraphics, + brush->nativeBrush, + points, count)); + + } + + Status FillClosedCurve(IN const Brush* brush, + IN const PointF* points, + IN INT count, + IN FillMode fillMode, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipFillClosedCurve2(nativeGraphics, + brush->nativeBrush, + points, count, + tension, fillMode)); + } + + // integer version + Status FillClosedCurve(IN const Brush* brush, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipFillClosedCurveI(nativeGraphics, + brush->nativeBrush, + points, + count)); + } + + Status FillClosedCurve(IN const Brush* brush, + IN const Point* points, + IN INT count, + IN FillMode fillMode, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipFillClosedCurve2I(nativeGraphics, + brush->nativeBrush, + points, count, + tension, fillMode)); + } + + // float version + Status FillRegion(IN const Brush* brush, + IN const Region* region) + { + return SetStatus(DllExports::GdipFillRegion(nativeGraphics, + brush->nativeBrush, + region->nativeRegion)); + } + + // DrawString and MeasureString + Status + DrawString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN const Brush *brush + ) + { + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + DrawString( + const WCHAR *string, + INT length, + const Font *font, + const PointF &origin, + const Brush *brush + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + DrawString( + const WCHAR *string, + INT length, + const Font *font, + const PointF &origin, + const StringFormat *stringFormat, + const Brush *brush + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + stringFormat ? stringFormat->nativeFormat : NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + OUT RectF *boundingBox, + OUT INT *codepointsFitted = 0, + OUT INT *linesFilled = 0 + ) const + { + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + boundingBox, + codepointsFitted, + linesFilled + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const SizeF &layoutRectSize, + IN const StringFormat *stringFormat, + OUT SizeF *size, + OUT INT *codepointsFitted = 0, + OUT INT *linesFilled = 0 + ) const + { + RectF layoutRect(0, 0, layoutRectSize.Width, layoutRectSize.Height); + RectF boundingBox; + Status status; + + if (size == NULL) + { + return SetStatus(InvalidParameter); + } + + status = SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + size ? &boundingBox : NULL, + codepointsFitted, + linesFilled + )); + + if (size && status == Ok) + { + size->Width = boundingBox.Width; + size->Height = boundingBox.Height; + } + + return status; + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const PointF &origin, + IN const StringFormat *stringFormat, + OUT RectF *boundingBox + ) const + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + stringFormat ? stringFormat->nativeFormat : NULL, + boundingBox, + NULL, + NULL + )); + } + + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + OUT RectF *boundingBox + ) const + { + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + NULL, + boundingBox, + NULL, + NULL + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const PointF &origin, + OUT RectF *boundingBox + ) const + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + NULL, + boundingBox, + NULL, + NULL + )); + } + + +#ifdef DCR_USE_NEW_174340 + Status + MeasureCharacterRanges( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN INT regionCount, + OUT Region *regions + ) const + { + if (!regions || regionCount <= 0) + { + return InvalidParameter; + } + + GpRegion **nativeRegions = new GpRegion* [regionCount]; + + if (!nativeRegions) + { + return OutOfMemory; + } + + for (INT i = 0; i < regionCount; i++) + { + nativeRegions[i] = regions[i].nativeRegion; + } + + Status status = SetStatus(DllExports::GdipMeasureCharacterRanges( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + regionCount, + nativeRegions + )); + + delete [] nativeRegions; + + return status; + } +#endif + + +#ifndef DCR_USE_NEW_174340 + Status + MeasureStringRegion( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN INT firstCharacterIndex, + IN INT characterCount, + OUT Region *region + ) const + { + if (region == NULL) + { + return SetStatus(InvalidParameter); + } + + return (SetStatus(DllExports::GdipMeasureStringRegion( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + firstCharacterIndex, + characterCount, + region->nativeRegion))); + } +#endif + + Status DrawDriverString( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const Brush *brush, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix + ) + { + return SetStatus(DllExports::GdipDrawDriverString( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + brush ? brush->nativeBrush : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL + )); + } + + Status MeasureDriverString( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix, + OUT RectF *boundingBox + ) const + { + return SetStatus(DllExports::GdipMeasureDriverString( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL, + boundingBox + )); + } + +#ifndef DCR_USE_NEW_168772 + Status DriverStringPointToCodepoint( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix, + IN const PointF &hit, + OUT INT *index, + OUT BOOL *rightEdge, + OUT REAL *distance + ) + { + return SetStatus(DllExports::GdipDriverStringPointToCodepoint( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL, + &hit, + index, + rightEdge, + distance + )); + } +#endif + + // Draw a cached bitmap on this graphics destination offset by + // x, y. Note this will fail with WrongState if the CachedBitmap + // native format differs from this Graphics. + + Status DrawCachedBitmap(IN CachedBitmap *cb, + IN INT x, + IN INT y) + { + return SetStatus(DllExports::GdipDrawCachedBitmap( + nativeGraphics, + cb->nativeCachedBitmap, + x, y + )); + } + + /** + * Draw images (both bitmap and vector) + */ + // float version + Status DrawImage(IN Image* image, + IN const PointF& point) + { + return DrawImage(image, point.X, point.Y); + } + + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y) + { + return SetStatus(DllExports::GdipDrawImage(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y)); + } + + Status DrawImage(IN Image* image, + IN const RectF& rect) + { + return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawImageRect(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + width, + height)); + } + + // integer version + Status DrawImage(IN Image* image, + IN const Point& point) + { + return DrawImage(image, point.X, point.Y); + } + + Status DrawImage(IN Image* image, + IN INT x, + IN INT y) + { + return SetStatus(DllExports::GdipDrawImageI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y)); + } + + Status DrawImage(IN Image* image, + IN const Rect& rect) + { + return DrawImage(image, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawImage(IN Image* image, + IN INT x, + IN INT y, + IN INT width, + IN INT height) { + return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + width, + height)); + } + + /** + * Affine or perspective blt + * destPoints.length = 3: rect => parallelogram + * destPoints[0] <=> top-left corner of the source rectangle + * destPoints[1] <=> top-right corner + * destPoints[2] <=> bottom-left corner + * destPoints.length = 4: rect => quad + * destPoints[3] <=> bottom-right corner + * + * @notes Perspective blt only works for bitmap images. + */ + Status DrawImage(IN Image* image, + IN const PointF* destPoints, + IN INT count) + { + if (count != 3 && count != 4) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipDrawImagePoints(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, count)); + } + + Status DrawImage(IN Image* image, + IN const Point* destPoints, + IN INT count) + { + if (count != 3 && count != 4) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipDrawImagePointsI(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, + count)); + } + + /** + * We need another set of methods similar to the ones above + * that take an additional Rect parameter to specify the + * portion of the source image to be drawn. + */ + // float version + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit) + { + return SetStatus(DllExports::GdipDrawImagePointRect(nativeGraphics, + image ? image->nativeImage + : NULL, + x, y, + srcx, srcy, + srcwidth, srcheight, srcUnit)); + } + + Status DrawImage(IN Image* image, + IN const RectF& destRect, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImageRectRect(nativeGraphics, + image ? image->nativeImage + : NULL, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, srcy, + srcwidth, srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + Status DrawImage(IN Image* image, + IN const PointF* destPoints, + IN INT count, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImagePointsRect(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, count, + srcx, srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + // integer version + Status DrawImage(IN Image* image, + IN INT x, + IN INT y, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit) + { + return SetStatus(DllExports::GdipDrawImagePointRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit)); + } + + Status DrawImage(IN Image* image, + IN const Rect& destRect, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImageRectRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + Status DrawImage(IN Image* image, + IN const Point* destPoints, + IN INT count, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImagePointsRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, + count, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + // The following methods are for playing an EMF+ to a graphics + // via the enumeration interface. Each record of the EMF+ is + // sent to the callback (along with the callbackData). Then + // the callback can invoke the Metafile::PlayRecord method + // to play the particular record. + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF & destPoint, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPoint( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point & destPoint, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPointI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const RectF & destRect, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestRect( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Rect & destRect, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestRectI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF * destPoints, + IN INT count, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPoints( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point * destPoints, + IN INT count, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPointsI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF & destPoint, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point & destPoint, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const RectF & destRect, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Rect & destRect, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF * destPoints, + IN INT count, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point * destPoints, + IN INT count, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + /** + * Clipping region operations + * + * @notes Simply incredible redundancy here. + */ + Status SetClip(IN const Graphics* g, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics, + g->nativeGraphics, + combineMode)); + } + + Status SetClip(IN const RectF& rect, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + } + + Status SetClip(IN const Rect& rect, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + } + + Status SetClip(IN const GraphicsPath* path, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipPath(nativeGraphics, + path->nativePath, + combineMode)); + } + + Status SetClip(IN const Region* region, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + combineMode)); + } + + // This is different than the other SetClip methods because it assumes + // that the HRGN is already in device units, so it doesn't transform + // the coordinates in the HRGN. + Status SetClip(IN HRGN hRgn, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipHrgn(nativeGraphics, hRgn, + combineMode)); + } + + Status IntersectClip(IN const RectF& rect) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + } + + Status IntersectClip(IN const Rect& rect) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + } + + Status IntersectClip(IN const Region* region) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + CombineModeIntersect)); + } + + Status ExcludeClip(IN const RectF& rect) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + } + + Status ExcludeClip(IN const Rect& rect) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + } + + Status ExcludeClip(IN const Region* region) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + CombineModeExclude)); + } + + Status ResetClip() + { + return SetStatus(DllExports::GdipResetClip(nativeGraphics)); + } + + Status TranslateClip(IN REAL dx, + IN REAL dy) + { + return SetStatus(DllExports::GdipTranslateClip(nativeGraphics, dx, dy)); + } + + Status TranslateClip(IN INT dx, + IN INT dy) + { + return SetStatus(DllExports::GdipTranslateClipI(nativeGraphics, + dx, dy)); + } + + /** + * GetClip region from graphics context + */ + Status GetClip(OUT Region* region) const + { + return SetStatus(DllExports::GdipGetClip(nativeGraphics, + region->nativeRegion)); + } + + /** + * Hit testing operations + */ + Status GetClipBounds(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetClipBounds(nativeGraphics, rect)); + } + + Status GetClipBounds(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetClipBoundsI(nativeGraphics, rect)); + } + + BOOL IsClipEmpty() const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsClipEmpty(nativeGraphics, &booln)); + + return booln; + } + + Status GetVisibleClipBounds(OUT RectF *rect) const + { + + return SetStatus(DllExports::GdipGetVisibleClipBounds(nativeGraphics, + rect)); + } + + Status GetVisibleClipBounds(OUT Rect *rect) const + { + return SetStatus(DllExports::GdipGetVisibleClipBoundsI(nativeGraphics, + rect)); + } + + BOOL IsVisibleClipEmpty() const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleClipEmpty(nativeGraphics, &booln)); + + return booln; + } + + BOOL IsVisible(IN INT x, + IN INT y) const + { + return IsVisible(Point(x,y)); + } + + BOOL IsVisible(IN const Point& point) const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics, + point.X, + point.Y, + &booln)); + + return booln; + } + + BOOL IsVisible(IN INT x, + IN INT y, + IN INT width, + IN INT height) const + { + return IsVisible(Rect(x, y, width, height)); + } + + BOOL IsVisible(IN const Rect& rect) const + { + + BOOL booln = TRUE; + + SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + &booln)); + return booln; + } + + BOOL IsVisible(IN REAL x, + IN REAL y) const + { + return IsVisible(PointF(x, y)); + } + + BOOL IsVisible(IN const PointF& point) const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics, + point.X, + point.Y, + &booln)); + + return booln; + } + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) const + { + return IsVisible(RectF(x, y, width, height)); + } + + BOOL IsVisible(IN const RectF& rect) const + { + BOOL booln = TRUE; + + SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + &booln)); + return booln; + } + + /** + * Save/restore graphics state + */ + GraphicsState Save() const + { + GraphicsState gstate; + + SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate)); + + return gstate; + } + + Status Restore(IN GraphicsState gstate) + { + return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics, + gstate)); + } + + /** + * Begin and end container drawing + */ + GraphicsContainer BeginContainer(IN const RectF &dstrect, + IN const RectF &srcrect, + IN Unit unit) + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainer(nativeGraphics, &dstrect, + &srcrect, unit, &state)); + + return state; + } + + /** + * Begin and end container drawing + */ + GraphicsContainer BeginContainer(IN const Rect &dstrect, + IN const Rect &srcrect, + IN Unit unit) + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainerI(nativeGraphics, &dstrect, + &srcrect, unit, &state)); + + return state; + } + + GraphicsContainer BeginContainer() + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainer2(nativeGraphics, &state)); + + return state; + } + + Status EndContainer(IN GraphicsContainer state) + { + return SetStatus(DllExports::GdipEndContainer(nativeGraphics, state)); + } + + // only valid when recording metafiles + Status AddMetafileComment(IN const BYTE * data, + IN UINT sizeData) + { + return SetStatus(DllExports::GdipComment(nativeGraphics, sizeData, data)); + } + + /** + * Get/SetLayout + * Support for Middle East localization (right-to-left mirroring) + */ + GraphicsLayout GetLayout() const + { + GraphicsLayout layout; + + SetStatus(DllExports::GdipGetGraphicsLayout(nativeGraphics, &layout)); + + return layout; + } + + Status SetLayout(IN const GraphicsLayout layout) + { + return SetStatus( + DllExports::GdipSetGraphicsLayout(nativeGraphics, layout) + ); + } + + static HPALETTE GetHalftonePalette() + { + return DllExports::GdipCreateHalftonePalette(); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Graphics(const Graphics &); + Graphics& operator=(const Graphics &); +protected: + +#else + + Graphics(const Graphics& graphics) + { + graphics; + SetStatus(NotImplemented); + } + + Graphics& operator=(const Graphics& graphics) + { + graphics; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Graphics(GpGraphics* graphics) + { + lastResult = Ok; + SetNativeGraphics(graphics); + } + + VOID SetNativeGraphics(GpGraphics *graphics) + { + this->nativeGraphics = graphics; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + // Methods necessary to subclass Graphics for extension test. + + GpGraphics* GetNativeGraphics() const + { + return this->nativeGraphics; + } + + GpPen* GetNativePen(const Pen* pen) + { + return pen->nativePen; + } + +protected: + GpGraphics* nativeGraphics; + mutable Status lastResult; + +}; + +//---------------------------------------------------------------------------- +// Extra implementation of GraphicsPath methods that use Graphics +//---------------------------------------------------------------------------- + +/** + * Get the bounds of the path object with the given transform. + * This is not always the tightest bounds. + */ + +inline Status +GraphicsPath::GetBounds( + OUT RectF* bounds, + IN const Matrix* matrix, + IN const Pen* pen) const +{ + GpMatrix* nativeMatrix = NULL; + GpPen* nativePen = NULL; + + if (matrix) + nativeMatrix = matrix->nativeMatrix; + + if (pen) + nativePen = pen->nativePen; + + return SetStatus(DllExports::GdipGetPathWorldBounds(nativePath, bounds, + nativeMatrix, nativePen)); +} + +// integer version +inline Status +GraphicsPath::GetBounds( + OUT Rect* bounds, + IN const Matrix* matrix, + IN const Pen* pen +) const +{ + GpMatrix* nativeMatrix = NULL; + GpPen* nativePen = NULL; + + if (matrix) + nativeMatrix = matrix->nativeMatrix; + + if (pen) + nativePen = pen->nativePen; + + return SetStatus(DllExports::GdipGetPathWorldBoundsI(nativePath, bounds, + nativeMatrix, nativePen)); +} + +//---------------------------------------------------------------------------- +// Hit testing operations +//---------------------------------------------------------------------------- + +inline BOOL +GraphicsPath::IsVisible( + IN REAL x, + IN REAL y, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + + if (g) + nativeGraphics = g->nativeGraphics; + + SetStatus(DllExports::GdipIsVisiblePathPoint(nativePath, + x, y, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsVisible( + IN INT x, + IN INT y, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + + if (g) + nativeGraphics = g->nativeGraphics; + + SetStatus(DllExports::GdipIsVisiblePathPointI(nativePath, + x, y, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsOutlineVisible( + IN REAL x, + IN REAL y, + IN const Pen* pen, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + GpPen* nativePen = NULL; + + if(g) + nativeGraphics = g->nativeGraphics; + if(pen) + nativePen = pen->nativePen; + + SetStatus(DllExports::GdipIsOutlineVisiblePathPoint(nativePath, + x, y, nativePen, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsOutlineVisible( + IN INT x, + IN INT y, + IN const Pen* pen, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + GpPen* nativePen = NULL; + + if(g) + nativeGraphics = g->nativeGraphics; + if(pen) + nativePen = pen->nativePen; + + SetStatus(DllExports::GdipIsOutlineVisiblePathPointI(nativePath, + x, y, nativePen, nativeGraphics, + &booln)); + return booln; +} + +#endif diff --git a/win32/gdiplus/include/GdiplusHeaders.h b/win32/gdiplus/include/GdiplusHeaders.h new file mode 100644 index 0000000..f80205d --- /dev/null +++ b/win32/gdiplus/include/GdiplusHeaders.h @@ -0,0 +1,793 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusHeaders.h +* +* Abstract: +* +* GDI+ Native C++ public header file +* +\**************************************************************************/ + +#ifndef _GDIPLUSHEADERS_H +#define _GDIPLUSHEADERS_H + +//-------------------------------------------------------------------------- +// Abstract base class for regions +//-------------------------------------------------------------------------- + +// Include the class declarations here and have inline class implementation +// in separate file to avoid circular references. + +class Region : public GdiplusBase +{ +public: + friend class Graphics; + + Region(); + Region(IN const RectF& rect); + Region(IN const Rect& rect); + Region(IN const GraphicsPath* path); + Region(IN const BYTE* regionData, IN INT size); + Region(IN HRGN hRgn); + static Region* FromHRGN(IN HRGN hRgn); + + ~Region(); + Region* Clone() const; + + Status MakeInfinite(); + Status MakeEmpty(); + + // Get the size of the buffer needed for the GetData method + UINT GetDataSize() const; + + // buffer - where to put the data + // bufferSize - how big the buffer is (should be at least as big as GetDataSize()) + // sizeFilled - if not NULL, this is an OUT param that says how many bytes + // of data were written to the buffer. + Status GetData(OUT BYTE* buffer, + IN UINT bufferSize, + OUT UINT* sizeFilled = NULL) const; + + Status Intersect(IN const Rect& rect); + Status Intersect(IN const RectF& rect); + Status Intersect(IN const GraphicsPath* path); + Status Intersect(IN const Region* region); + Status Union(IN const Rect& rect); + Status Union(IN const RectF& rect); + Status Union(IN const GraphicsPath* path); + Status Union(IN const Region* region); + Status Xor(IN const Rect& rect); + Status Xor(IN const RectF& rect); + Status Xor(IN const GraphicsPath* path); + Status Xor(IN const Region* region); + Status Exclude(IN const Rect& rect); + Status Exclude(IN const RectF& rect); + Status Exclude(IN const GraphicsPath* path); + Status Exclude(IN const Region* region); + Status Complement(IN const Rect& rect); + Status Complement(IN const RectF& rect); + Status Complement(IN const GraphicsPath* path); + Status Complement(IN const Region* region); + Status Translate(IN REAL dx, + IN REAL dy); + Status Translate(IN INT dx, + IN INT dy); + Status Transform(IN const Matrix* matrix); + + Status GetBounds(OUT Rect* rect, + IN const Graphics* g) const; + + Status GetBounds(OUT RectF* rect, + IN const Graphics* g) const; + + HRGN GetHRGN (IN const Graphics * g) const; + + BOOL IsEmpty(IN const Graphics *g) const; + BOOL IsInfinite(IN const Graphics *g) const; + + BOOL IsVisible(IN INT x, + IN INT y, + IN const Graphics* g = NULL) const + { + return IsVisible(Point(x, y), g); + } + + BOOL IsVisible(IN const Point& point, + IN const Graphics* g = NULL) const; + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN const Graphics* g = NULL) const + { + return IsVisible(PointF(x, y), g); + } + + BOOL IsVisible(IN const PointF& point, + IN const Graphics* g = NULL) const; + + BOOL IsVisible(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN const Graphics* g) const + { + return IsVisible(Rect(x, y, width, height), g); + } + + BOOL IsVisible(IN const Rect& rect, + IN const Graphics* g = NULL) const; + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN const Graphics* g = NULL) const + { + return IsVisible(RectF(x, y, width, height), g); + } + + BOOL IsVisible(IN const RectF& rect, + IN const Graphics* g = NULL) const; + + BOOL Equals(IN const Region* region, + IN const Graphics* g) const; + + UINT GetRegionScansCount(IN const Matrix* matrix) const; + Status GetRegionScans(IN const Matrix* matrix, + OUT RectF* rects, + OUT INT* count) const; + Status GetRegionScans(IN const Matrix* matrix, + OUT Rect* rects, + OUT INT* count) const; + Status GetLastStatus() const; + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Region(const Region ®ion); + Region& operator=(const Region ®ion); +protected: + +#else + Region(const Region ®ion) + { + region; // reference parameter + SetStatus(NotImplemented); + } + + Region& operator=(const Region ®ion) + { + region; // reference parameter + SetStatus(NotImplemented); + return *this; + } +#endif + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + Region(GpRegion* nativeRegion); + + VOID SetNativeRegion(GpRegion* nativeRegion); + +protected: + GpRegion* nativeRegion; + mutable Status lastResult; +}; + + +//-------------------------------------------------------------------------- +// Abstract base class for FontFamily +//-------------------------------------------------------------------------- + +class FontFamily : public GdiplusBase +{ +public: + friend class Font; + friend class Graphics; + friend class GraphicsPath; + friend class FontCollection; + + FontFamily(); + + FontFamily( + IN const WCHAR *name, + IN const FontCollection *fontCollection = NULL + ); + + ~FontFamily(); + + static const FontFamily *GenericSansSerif(); + static const FontFamily *GenericSerif(); + static const FontFamily *GenericMonospace(); + + Status GetFamilyName( + OUT WCHAR name[LF_FACESIZE], + IN LANGID language = 0 + ) const; + +// Copy operator + FontFamily * Clone() const; + + BOOL IsAvailable() const + { + return (nativeFamily != NULL); + }; + + BOOL IsStyleAvailable(IN INT style) const; + + UINT16 GetEmHeight (IN INT style) const; + UINT16 GetCellAscent (IN INT style) const; + UINT16 GetCellDescent (IN INT style) const; + UINT16 GetLineSpacing (IN INT style) const; + + /////////////////////////////////////////////////////////// + + Status GetLastStatus() const; + +#ifdef DCR_USE_NEW_250932 + +private: + FontFamily(const FontFamily &); + FontFamily& operator=(const FontFamily &); + +#endif + +protected: + Status SetStatus(Status status) const; + + // private constructor for copy + FontFamily(GpFontFamily * nativeFamily, Status status); + +/////////////////////////////////////// +// Data members +protected: + + GpFontFamily *nativeFamily; + mutable Status lastResult; +}; + +static FontFamily *GenericSansSerifFontFamily = NULL; +static FontFamily *GenericSerifFontFamily = NULL; +static FontFamily *GenericMonospaceFontFamily = NULL; + +static BYTE GenericSansSerifFontFamilyBuffer[sizeof(FontFamily)] = {0}; +static BYTE GenericSerifFontFamilyBuffer [sizeof(FontFamily)] = {0}; +static BYTE GenericMonospaceFontFamilyBuffer[sizeof(FontFamily)] = {0}; + + +//-------------------------------------------------------------------------- +// Abstract base class for fonts +//-------------------------------------------------------------------------- + +class Font : public GdiplusBase +{ +public: + friend class Graphics; + + Font(IN HDC hdc); + Font(IN HDC hdc, + IN const LOGFONTA* logfont); + Font(IN HDC hdc, + IN const LOGFONTW* logfont); +#ifdef DCR_USE_NEW_127084 + Font(IN HDC hdc, + IN const HFONT hfont); +#endif + Font( + IN const FontFamily * family, + IN REAL emSize, + IN INT style = FontStyleRegular, + IN Unit unit = UnitPoint + ); + + Font( + IN const WCHAR * familyName, + IN REAL emSize, + IN INT style = FontStyleRegular, + IN Unit unit = UnitPoint, + IN const FontCollection * fontCollection = NULL + ); + + Status GetLogFontA(IN const Graphics* g, + OUT LOGFONTA * logfontA) const; + Status GetLogFontW(IN const Graphics* g, + OUT LOGFONTW * logfontW) const; + + Font* Clone() const; + ~Font(); + BOOL IsAvailable() const; + INT GetStyle() const; + REAL GetSize() const; + Unit GetUnit() const; + Status GetLastStatus() const; + REAL GetHeight(IN const Graphics *graphics = NULL) const; +#ifdef DCR_USE_NEW_125467 + REAL GetHeight(IN REAL dpi) const; +#endif + + Status GetFamily(OUT FontFamily *family) const; + +#ifdef DCR_USE_NEW_250932 + +private: + Font(const Font &); + Font& operator=(const Font &); + +#endif + +protected: + Font(GpFont* font, Status status); + VOID SetNativeFont(GpFont *Font); + Status SetStatus(Status status) const; + +protected: + /* + * handle to native line texture object + */ + + GpFont* nativeFont; + mutable Status lastResult; +}; + +//-------------------------------------------------------------------------- +// Abstract base classes for font collections +//-------------------------------------------------------------------------- + +class FontCollection : public GdiplusBase +{ +public: + friend class FontFamily; + + FontCollection(); + virtual ~FontCollection(); + + INT GetFamilyCount() const; // number of enumerable families in the collection + + Status GetFamilies( // enumerate the fonts in a collection + IN INT numSought, + OUT FontFamily * gpfamilies, + OUT INT * numFound + ) const; + + Status GetLastStatus() const; + +#ifdef DCR_USE_NEW_250932 + +private: + FontCollection(const FontCollection &); + FontCollection& operator=(const FontCollection &); + +#endif + +protected: + Status SetStatus(Status status) const ; + + GpFontCollection *nativeFontCollection; + mutable Status lastResult; +}; + + +class InstalledFontCollection : public FontCollection +{ +public: + InstalledFontCollection(); + ~InstalledFontCollection(); + +#ifdef DCR_USE_NEW_250932 + +private: + InstalledFontCollection(const InstalledFontCollection &); + InstalledFontCollection& operator=(const InstalledFontCollection &); + +#endif + +protected: +#ifndef DCR_USE_NEW_235072 + Status InstallFontFile(IN const WCHAR* filename); + Status UninstallFontFile(IN const WCHAR* filename); +#endif + Status SetStatus(Status status) const ; +}; + + +class PrivateFontCollection : public FontCollection +{ +public: + PrivateFontCollection(); + ~PrivateFontCollection(); + + Status AddFontFile(IN const WCHAR* filename); + Status AddMemoryFont(IN const VOID* memory, + IN INT length); + +#ifdef DCR_USE_NEW_250932 + +private: + PrivateFontCollection(const PrivateFontCollection &); + PrivateFontCollection& operator=(const PrivateFontCollection &); + +#endif +}; + + +//-------------------------------------------------------------------------- +// Abstract base class for bitmap image and metafile +//-------------------------------------------------------------------------- + +// !!! Note: +// Include the class declarations here and have the inline class +// implementation in a separate file. This is done to resolve a +// circular dependency since one of the Bitmap methods needs to +// access the private member nativeGraphics of the Graphics object. + +class Image : public GdiplusBase +{ +public: + friend class Brush; + friend class TextureBrush; + friend class Graphics; + +#ifndef DCR_USE_NEW_140782 + Image( + IN const WCHAR* filename + ); + + Image( + IN IStream* stream + ); + + static Image* FromFile( + IN const WCHAR* filename + ); + + static Image* FromStream( + IN IStream* stream + ); +#else + Image( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Image( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Image* FromFile( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Image* FromStream( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); +#endif + + virtual ~Image(); + virtual Image* Clone(); + + Status Save(IN const WCHAR* filename, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams = NULL); + Status Save(IN IStream* stream, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams = NULL); + Status SaveAdd(IN const EncoderParameters* encoderParams); + Status SaveAdd(IN Image* newImage, + IN const EncoderParameters* encoderParams); + + ImageType GetType() const; + Status GetPhysicalDimension(OUT SizeF* size); + Status GetBounds(OUT RectF* srcRect, + OUT Unit* srcUnit); + + UINT GetWidth(); + UINT GetHeight(); + REAL GetHorizontalResolution(); + REAL GetVerticalResolution(); + UINT GetFlags(); + Status GetRawFormat(OUT GUID *format); + PixelFormat GetPixelFormat(); + + INT GetPaletteSize(); + Status GetPalette(OUT ColorPalette* palette, + IN INT size); + Status SetPalette(IN const ColorPalette* palette); + + Image* GetThumbnailImage(IN UINT thumbWidth, + IN UINT thumbHeight, + IN GetThumbnailImageAbort callback = NULL, + IN VOID* callbackData = NULL); + UINT GetFrameDimensionsCount(); + Status GetFrameDimensionsList(OUT GUID* dimensionIDs, + IN UINT count); + UINT GetFrameCount(IN const GUID* dimensionID); + Status SelectActiveFrame(IN const GUID* dimensionID, + IN UINT frameIndex); + Status RotateFlip(IN RotateFlipType rotateFlipType); + UINT GetPropertyCount(); + Status GetPropertyIdList(IN UINT numOfProperty, + OUT PROPID* list); + UINT GetPropertyItemSize(IN PROPID propId); + Status GetPropertyItem(IN PROPID propId, + IN UINT propSize, + OUT PropertyItem* buffer); + Status GetPropertySize(OUT UINT* totalBufferSize, + OUT UINT* numProperties); + Status GetAllPropertyItems(IN UINT totalBufferSize, + IN UINT numProperties, + OUT PropertyItem* allItems); + Status RemovePropertyItem(IN PROPID propId); + Status SetPropertyItem(IN const PropertyItem* item); + + UINT GetEncoderParameterListSize(IN const CLSID* clsidEncoder); + Status GetEncoderParameterList(IN const CLSID* clsidEncoder, + IN UINT size, + OUT EncoderParameters* buffer); + + // Support for Middle East localization (right-to-left mirroring) + ImageLayout GetLayout() const; + Status SetLayout(IN const ImageLayout layout); + + Status GetLastStatus() const; + +protected: + + Image() {} + + Image(GpImage *nativeImage, Status status); + + VOID SetNativeImage(GpImage* nativeImage); + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + GpImage* nativeImage; + mutable Status lastResult; + mutable Status loadStatus; + +#ifdef DCR_USE_NEW_250932 + +private: + +#else + +protected: + +#endif + + // Disable copy constructor and assignment operator + + Image(IN const Image& C); + Image& operator=(IN const Image& C); +}; + +class Bitmap : public Image +{ +public: + friend class Image; + friend class CachedBitmap; + + Bitmap( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Bitmap( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Bitmap* FromFile( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Bitmap* FromStream( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Bitmap(IN INT width, + IN INT height, + IN INT stride, PixelFormat format, + IN BYTE* scan0); + Bitmap(IN INT width, + IN INT height, + IN PixelFormat format = PixelFormat32bppARGB); + Bitmap(IN INT width, + IN INT height, + IN Graphics* target); + + Bitmap* Clone(IN const Rect& rect, + IN PixelFormat format); + Bitmap* Clone(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN PixelFormat format); + Bitmap* Clone(IN const RectF& rect, + IN PixelFormat format); + Bitmap* Clone(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN PixelFormat format); + + Status LockBits(IN const Rect& rect, + IN UINT flags, + IN PixelFormat format, + OUT BitmapData* lockedBitmapData); + Status UnlockBits(IN BitmapData* lockedBitmapData); + Status GetPixel(IN INT x, + IN INT y, + OUT Color *color); + Status SetPixel(IN INT x, + IN INT y, + IN const Color &color); + Status SetResolution(IN REAL xdpi, + IN REAL ydpi); + + // GDI interop: + + Bitmap(IN IDirectDrawSurface7* surface); + Bitmap(IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData); + Bitmap(IN HBITMAP hbm, + IN HPALETTE hpal); + Bitmap(IN HICON hicon); + Bitmap(IN HINSTANCE hInstance, + IN const WCHAR * bitmapName); + static Bitmap* FromDirectDrawSurface7(IN IDirectDrawSurface7* surface); + static Bitmap* FromBITMAPINFO(IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData); + static Bitmap* FromHBITMAP(IN HBITMAP hbm, + IN HPALETTE hpal); + static Bitmap* FromHICON(IN HICON hicon); + static Bitmap* FromResource(IN HINSTANCE hInstance, + IN const WCHAR * bitmapName); + + Status GetHBITMAP(IN const Color& colorBackground, + OUT HBITMAP *hbmReturn); + Status GetHICON(HICON *hicon); + +#ifdef DCR_USE_NEW_250932 +private: + Bitmap(const Bitmap &); + Bitmap& operator=(const Bitmap &); +#endif + +protected: + Bitmap(GpBitmap *nativeBitmap); +}; + +class CustomLineCap : public GdiplusBase +{ +public: + friend class Pen; + + CustomLineCap( + IN const GraphicsPath* fillPath, + IN const GraphicsPath* strokePath, + IN LineCap baseCap = LineCapFlat, + IN REAL baseInset = 0 + ); + virtual ~CustomLineCap(); + + CustomLineCap* Clone() const; + + Status SetStrokeCap(IN LineCap strokeCap) + { + // This changes both start and and caps. + + return SetStrokeCaps(strokeCap, strokeCap); + } + + Status SetStrokeCaps(IN LineCap startCap, + IN LineCap endCap); + Status GetStrokeCaps(OUT LineCap* startCap, + OUT LineCap* endCap) const; + Status SetStrokeJoin(IN LineJoin lineJoin); + LineJoin GetStrokeJoin() const; + Status SetBaseCap(IN LineCap baseCap); + LineCap GetBaseCap() const; + Status SetBaseInset(IN REAL inset); + REAL GetBaseInset() const; + Status SetWidthScale(IN REAL widthScale); + REAL GetWidthScale() const; + +protected: + CustomLineCap(); + +#ifdef DCR_USE_NEW_250932 + +private: + CustomLineCap(const CustomLineCap &); + CustomLineCap& operator=(const CustomLineCap &); +protected: + +#else + + CustomLineCap(const CustomLineCap& customLineCap) + { + customLineCap; + SetStatus(NotImplemented); + } + + CustomLineCap& operator=(const CustomLineCap& customLineCap) + { + customLineCap; + SetStatus(NotImplemented); + return *this; + } + +#endif + + CustomLineCap(GpCustomLineCap* nativeCap, Status status) + { + lastResult = status; + SetNativeCap(nativeCap); + } + + VOID SetNativeCap(GpCustomLineCap* nativeCap) + { + this->nativeCap = nativeCap; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpCustomLineCap* nativeCap; + mutable Status lastResult; +}; + +class CachedBitmap : public GdiplusBase +{ + friend class Graphics; + +public: + CachedBitmap(IN Bitmap *bitmap, + IN Graphics *graphics); + virtual ~CachedBitmap(); + + Status GetLastStatus() const; + +#ifdef DCR_USE_NEW_250932 + +private: + CachedBitmap(const CachedBitmap &); + CachedBitmap& operator=(const CachedBitmap &); + +#endif + +protected: + GpCachedBitmap *nativeCachedBitmap; + mutable Status lastResult; +}; + +#endif // !_GDIPLUSHEADERS.HPP diff --git a/win32/gdiplus/include/GdiplusImageAttributes.h b/win32/gdiplus/include/GdiplusImageAttributes.h new file mode 100644 index 0000000..0a51477 --- /dev/null +++ b/win32/gdiplus/include/GdiplusImageAttributes.h @@ -0,0 +1,397 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Image Attributes +* +* Abstract: +* +* Class for color adjustment object passed to Graphics.DrawImage +* +\**************************************************************************/ + +#ifndef _GDIPLUSIMAGEATTRIBUTES_H +#define _GDIPLUSIMAGEATTRIBUTES_H + +class GpImageAttributes; + +// There are 5 possible sets of color adjustments: +// ColorAdjustDefault, +// ColorAdjustBitmap, +// ColorAdjustBrush, +// ColorAdjustPen, +// ColorAdjustText, + +// Bitmaps, Brushes, Pens, and Text will all use any color adjustments +// that have been set into the default ImageAttributes until their own +// color adjustments have been set. So as soon as any "Set" method is +// called for Bitmaps, Brushes, Pens, or Text, then they start from +// scratch with only the color adjustments that have been set for them. +// Calling Reset removes any individual color adjustments for a type +// and makes it revert back to using all the default color adjustments +// (if any). The SetToIdentity method is a way to force a type to +// have no color adjustments at all, regardless of what previous adjustments +// have been set for the defaults or for that type. + +class ImageAttributes : public GdiplusBase +{ + friend class Graphics; + friend class TextureBrush; + +public: + + ImageAttributes() + { + nativeImageAttr = NULL; + lastResult = DllExports::GdipCreateImageAttributes(&nativeImageAttr); + } + + ~ImageAttributes() + { + DllExports::GdipDisposeImageAttributes(nativeImageAttr); + } + + ImageAttributes* Clone() const + { + GpImageAttributes* clone; + + SetStatus(DllExports::GdipCloneImageAttributes( + nativeImageAttr, + &clone)); + + return new ImageAttributes(clone, lastResult); + } + + // Set to identity, regardless of what the default color adjustment is. + Status + SetToIdentity( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesToIdentity( + nativeImageAttr, + type)); + } + + // Remove any individual color adjustments, and go back to using the default + Status + Reset( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipResetImageAttributes( + nativeImageAttr, + type)); + } + + Status + SetColorMatrix( + IN const ColorMatrix *colorMatrix, + IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + TRUE, + colorMatrix, + NULL, + mode)); + } + + Status ClearColorMatrix( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + FALSE, + NULL, + NULL, + ColorMatrixFlagsDefault)); + } + + Status + SetColorMatrices( + IN const ColorMatrix *colorMatrix, + IN const ColorMatrix *grayMatrix, + IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + TRUE, + colorMatrix, + grayMatrix, + mode)); + } + + Status ClearColorMatrices( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + FALSE, + NULL, + NULL, + ColorMatrixFlagsDefault)); + } + + Status SetThreshold( + IN REAL threshold, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesThreshold( + nativeImageAttr, + type, + TRUE, + threshold)); + } + + Status ClearThreshold( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesThreshold( + nativeImageAttr, + type, + FALSE, + 0.0)); + } + + Status SetGamma( + IN REAL gamma, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesGamma( + nativeImageAttr, + type, + TRUE, + gamma)); + } + + Status ClearGamma( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesGamma( + nativeImageAttr, + type, + FALSE, + 0.0)); + } + + Status SetNoOp( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesNoOp( + nativeImageAttr, + type, + TRUE)); + } + + Status ClearNoOp( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesNoOp( + nativeImageAttr, + type, + FALSE)); + } + + Status SetColorKey( + IN const Color& colorLow, + IN const Color& colorHigh, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorKeys( + nativeImageAttr, + type, + TRUE, + colorLow.GetValue(), + colorHigh.GetValue())); + } + + Status ClearColorKey( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorKeys( + nativeImageAttr, + type, + FALSE, + NULL, + NULL)); + } + + Status SetOutputChannel( + IN ColorChannelFlags channelFlags, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( + nativeImageAttr, + type, + TRUE, + channelFlags)); + } + + Status ClearOutputChannel( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( + nativeImageAttr, + type, + FALSE, + ColorChannelFlagsLast)); + } + + Status SetOutputChannelColorProfile( + IN const WCHAR *colorProfileFilename, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( + nativeImageAttr, + type, + TRUE, + colorProfileFilename)); + } + + Status ClearOutputChannelColorProfile( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( + nativeImageAttr, + type, + FALSE, + NULL)); + } + + Status SetRemapTable( + IN UINT mapSize, + IN const ColorMap *map, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesRemapTable( + nativeImageAttr, + type, + TRUE, + mapSize, + map)); + } + + Status ClearRemapTable( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesRemapTable( + nativeImageAttr, + type, + FALSE, + 0, + NULL)); + } + + Status SetBrushRemapTable(IN UINT mapSize, + IN const ColorMap *map) + { + return this->SetRemapTable(mapSize, map, ColorAdjustTypeBrush); + } + + Status ClearBrushRemapTable() + { + return this->ClearRemapTable(ColorAdjustTypeBrush); + } + + Status SetWrapMode(IN WrapMode wrap, + IN const Color& color = Color(), + IN BOOL clamp = FALSE) + { + ARGB argb = color.GetValue(); + + return SetStatus(DllExports::GdipSetImageAttributesWrapMode( + nativeImageAttr, wrap, argb, clamp)); + } + + #ifndef DCR_USE_NEW_145139 + Status SetICMMode(IN BOOL on) + { + on; + // This is not implemented. + // The supported method for doing ICM conversion from the embedded + // ICC profile is to use the Bitmap constructor from a file or stream + // and specify TRUE for the useIcm parameter. This will cause the + // image to be ICM converted when it's loaded from the file/stream + // if the profile exists. + return SetStatus(NotImplemented); +// DllExports::GdipSetImageAttributesICMMode(nativeImageAttr, on) + } + #endif + + // The flags of the palette are ignored. + Status GetAdjustedPalette(IN OUT ColorPalette* colorPalette, + IN ColorAdjustType colorAdjustType) const + { + return SetStatus(DllExports::GdipGetImageAttributesAdjustedPalette( + nativeImageAttr, colorPalette, colorAdjustType)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +#ifdef DCR_USE_NEW_250932 + +private: + ImageAttributes(const ImageAttributes &); + ImageAttributes& operator=(const ImageAttributes &); + +#endif + +protected: + ImageAttributes(GpImageAttributes* imageAttr, Status status) + { + SetNativeImageAttr(imageAttr); + lastResult = status; + } + + VOID SetNativeImageAttr(GpImageAttributes* nativeImageAttr) + { + this->nativeImageAttr = nativeImageAttr; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpImageAttributes* nativeImageAttr; + mutable Status lastResult; +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusImageCodec.h b/win32/gdiplus/include/GdiplusImageCodec.h new file mode 100644 index 0000000..e9c02de --- /dev/null +++ b/win32/gdiplus/include/GdiplusImageCodec.h @@ -0,0 +1,73 @@ +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusImageCodec.h +* +* Abstract: +* +* APIs for imaging codecs. +* +\**************************************************************************/ + +#ifndef _GDIPLUSIMAGECODEC_H +#define _GDIPLUSIMAGECODEC_H + +//-------------------------------------------------------------------------- +// Codec Management APIs +//-------------------------------------------------------------------------- + +inline Status +GetImageDecodersSize( + OUT UINT *numDecoders, + OUT UINT *size) +{ + return DllExports::GdipGetImageDecodersSize(numDecoders, size); +} + + +inline Status +GetImageDecoders( + IN UINT numDecoders, + IN UINT size, + OUT ImageCodecInfo *decoders) +{ + return DllExports::GdipGetImageDecoders(numDecoders, size, decoders); +} + + +inline Status +GetImageEncodersSize( + OUT UINT *numEncoders, + OUT UINT *size) +{ + return DllExports::GdipGetImageEncodersSize(numEncoders, size); +} + + +inline Status +GetImageEncoders( + IN UINT numEncoders, + IN UINT size, + OUT ImageCodecInfo *encoders) +{ + return DllExports::GdipGetImageEncoders(numEncoders, size, encoders); +} + +inline Status +AddImageCodec( + IN const ImageCodecInfo* codec) +{ + return DllExports::GdipAddImageCodec(codec); +} + +inline Status +RemoveImageCodec( + IN const ImageCodecInfo* codec) +{ + return DllExports::GdipRemoveImageCodec(codec); +} + +#endif // _GDIPLUSIMAGECODEC_H diff --git a/win32/gdiplus/include/GdiplusImaging.h b/win32/gdiplus/include/GdiplusImaging.h new file mode 100644 index 0000000..022d224 --- /dev/null +++ b/win32/gdiplus/include/GdiplusImaging.h @@ -0,0 +1,540 @@ +/**************************************************************************\ +* +* Copyright (c) 1999-2000 Microsoft Corporation +* +* Module Name: +* +* GdiplusImaging.h +* +* Abstract: +* +* GUIDs defined and used by the imaging library +* +\**************************************************************************/ +#ifndef _GDIPLUSIMAGING_H +#define _GDIPLUSIMAGING_H + +//--------------------------------------------------------------------------- +// Image file format identifiers +//--------------------------------------------------------------------------- + +DEFINE_GUID(ImageFormatUndefined, 0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatMemoryBMP, 0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatBMP, 0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatEMF, 0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatWMF, 0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatJPEG, 0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatPNG, 0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatGIF, 0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +#ifndef DCR_USE_NEW_140855 +DEFINE_GUID(ImageFormatPhotoCD, 0xb96b3cb3,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatFlashPIX, 0xb96b3cb4,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +#endif +DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); + +//--------------------------------------------------------------------------- +// Predefined multi-frame dimension IDs +//--------------------------------------------------------------------------- + +DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72); +DEFINE_GUID(FrameDimensionResolution, 0x84236f7b,0x3bd3,0x428f,0x8d,0xab,0x4e,0xa1,0x43,0x9c,0xa3,0x15); +DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83); + +//--------------------------------------------------------------------------- +// Property sets +//--------------------------------------------------------------------------- + +DEFINE_GUID(FormatIDImageInformation, 0xe5836cbe,0x5eef,0x4f1d,0xac,0xde,0xae,0x4c,0x43,0xb6,0x08,0xce); +DEFINE_GUID(FormatIDJpegAppHeaders, 0x1c4afdcd,0x6177,0x43cf,0xab,0xc7,0x5f,0x51,0xaf,0x39,0xee,0x85); + +#ifndef DCR_USE_NEW_140855 +//--------------------------------------------------------------------------- +// Decoder parameter sets +//--------------------------------------------------------------------------- +DEFINE_GUID(DecoderTransColor, 0xb7a98c8f,0xdce7,0x457d,0xbf,0xa5,0xce,0xa7,0x1b,0xd1,0x4d,0xd6); +DEFINE_GUID(DecoderTransRange, 0xabeed189,0xd988,0x4d03,0xb4,0x25,0x57,0x10,0x55,0xc7,0x6a,0xd1); +DEFINE_GUID(DecoderOutputChannel, 0x2ff8f51e,0x724d,0x45fe,0x86,0xce,0x17,0x77,0xa0,0x56,0xda,0x60); +DEFINE_GUID(DecoderIconRes, 0x5c656eec,0xe94f,0x45ba,0xa6,0xf6,0x10,0x62,0xe8,0x5f,0x4a,0x7f); +#endif + +//--------------------------------------------------------------------------- +// Encoder parameter sets +//--------------------------------------------------------------------------- + +DEFINE_GUID(EncoderCompression, 0xe09d739d,0xccd4,0x44ee,0x8e,0xba,0x3f,0xbf,0x8b,0xe4,0xfc,0x58); +DEFINE_GUID(EncoderColorDepth, 0x66087055,0xad66,0x4c7c,0x9a,0x18,0x38,0xa2,0x31,0x0b,0x83,0x37); +DEFINE_GUID(EncoderScanMethod, 0x3a4e2661,0x3109,0x4e56,0x85,0x36,0x42,0xc1,0x56,0xe7,0xdc,0xfa); +DEFINE_GUID(EncoderVersion, 0x24d18c76,0x814a,0x41a4,0xbf,0x53,0x1c,0x21,0x9c,0xcc,0xf7,0x97); +DEFINE_GUID(EncoderRenderMethod, 0x6d42c53a,0x229a,0x4825,0x8b,0xb7,0x5c,0x99,0xe2,0xb9,0xa8,0xb8); +DEFINE_GUID(EncoderQuality, 0x1d5be4b5,0xfa4a,0x452d,0x9c,0xdd,0x5d,0xb3,0x51,0x05,0xe7,0xeb); +DEFINE_GUID(EncoderTransformation,0x8d0eb2d1,0xa58e,0x4ea8,0xaa,0x14,0x10,0x80,0x74,0xb7,0xb6,0xf9); +DEFINE_GUID(EncoderLuminanceTable,0xedb33bce,0x0266,0x4a77,0xb9,0x04,0x27,0x21,0x60,0x99,0xe7,0x17); +DEFINE_GUID(EncoderChrominanceTable,0xf2e455dc,0x09b3,0x4316,0x82,0x60,0x67,0x6a,0xda,0x32,0x48,0x1c); +DEFINE_GUID(EncoderSaveFlag,0x292266fc,0xac40,0x47bf,0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde); + +DEFINE_GUID(CodecIImageBytes,0x025d1823,0x6c7d,0x447b,0xbb, 0xdb, 0xa3, 0xcb, 0xc3, 0xdf, 0xa2, 0xfc); + +MIDL_INTERFACE("025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC") +IImageBytes : public IUnknown +{ +public: + // Return total number of bytes in the IStream + + STDMETHOD(CountBytes)( + OUT UINT *pcb + ) = 0; + + // Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the + // pointer to the beginning of the locked memory chunk in "ppvBytes" + + STDMETHOD(LockBytes)( + IN UINT cb, + IN ULONG ulOffset, + OUT const VOID ** ppvBytes + ) = 0; + + // Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the + // stream + + STDMETHOD(UnlockBytes)( + IN const VOID *pvBytes, + IN UINT cb, + IN ULONG ulOffset + ) = 0; +}; + +//-------------------------------------------------------------------------- +// ImageCodecInfo structure +//-------------------------------------------------------------------------- + +class ImageCodecInfo +{ +public: + CLSID Clsid; + GUID FormatID; + const WCHAR* CodecName; + const WCHAR* DllName; + const WCHAR* FormatDescription; + const WCHAR* FilenameExtension; + const WCHAR* MimeType; + DWORD Flags; + DWORD Version; + DWORD SigCount; + DWORD SigSize; + const BYTE* SigPattern; + const BYTE* SigMask; +}; + +//-------------------------------------------------------------------------- +// Information flags about image codecs +//-------------------------------------------------------------------------- + +enum ImageCodecFlags +{ + ImageCodecFlagsEncoder = 0x00000001, + ImageCodecFlagsDecoder = 0x00000002, + ImageCodecFlagsSupportBitmap = 0x00000004, + ImageCodecFlagsSupportVector = 0x00000008, + ImageCodecFlagsSeekableEncode = 0x00000010, + ImageCodecFlagsBlockingDecode = 0x00000020, + + ImageCodecFlagsBuiltin = 0x00010000, + ImageCodecFlagsSystem = 0x00020000, + ImageCodecFlagsUser = 0x00040000 +}; + +//--------------------------------------------------------------------------- +// Access modes used when calling Image::LockBits +//--------------------------------------------------------------------------- + +enum ImageLockMode +{ + ImageLockModeRead = 0x0001, + ImageLockModeWrite = 0x0002, + ImageLockModeUserInputBuf= 0x0004 +}; + +//--------------------------------------------------------------------------- +// Information about image pixel data +//--------------------------------------------------------------------------- + +class BitmapData +{ +public: + UINT Width; + UINT Height; + INT Stride; + PixelFormat PixelFormat1; + VOID* Scan0; + UINT_PTR Reserved; +}; + +//--------------------------------------------------------------------------- +// Image flags +//--------------------------------------------------------------------------- + +enum ImageFlags +{ + ImageFlagsNone = 0, + + // Low-word: shared with SINKFLAG_x + + ImageFlagsScalable = 0x0001, + ImageFlagsHasAlpha = 0x0002, + ImageFlagsHasTranslucent = 0x0004, + ImageFlagsPartiallyScalable = 0x0008, + + // Low-word: color space definition + + ImageFlagsColorSpaceRGB = 0x0010, + ImageFlagsColorSpaceCMYK = 0x0020, + ImageFlagsColorSpaceGRAY = 0x0040, + ImageFlagsColorSpaceYCBCR = 0x0080, + ImageFlagsColorSpaceYCCK = 0x0100, + + // Low-word: image size info + + ImageFlagsHasRealDPI = 0x1000, + ImageFlagsHasRealPixelSize = 0x2000, + + // High-word + + ImageFlagsReadOnly = 0x00010000, + ImageFlagsCaching = 0x00020000 +}; + +enum RotateFlipType +{ + RotateNoneFlipNone = 0, + Rotate90FlipNone = 1, + Rotate180FlipNone = 2, + Rotate270FlipNone = 3, + + RotateNoneFlipX = 4, + Rotate90FlipX = 5, + Rotate180FlipX = 6, + Rotate270FlipX = 7, + + RotateNoneFlipY = Rotate180FlipX, + Rotate90FlipY = Rotate270FlipX, + Rotate180FlipY = RotateNoneFlipX, + Rotate270FlipY = Rotate90FlipX, + + RotateNoneFlipXY = Rotate180FlipNone, + Rotate90FlipXY = Rotate270FlipNone, + Rotate180FlipXY = RotateNoneFlipNone, + Rotate270FlipXY = Rotate90FlipNone +}; + +//--------------------------------------------------------------------------- +// Encoder Parameter structure +//--------------------------------------------------------------------------- +class EncoderParameter +{ +public: + GUID Guid; // GUID of the parameter + ULONG NumberOfValues; // Number of the parameter values + ULONG Type; // Value type, like ValueTypeLONG etc. + VOID* Value; // A pointer to the parameter values +}; + +//--------------------------------------------------------------------------- +// Encoder Parameters structure +//--------------------------------------------------------------------------- +class EncoderParameters +{ +public: + UINT Count; // Number of parameters in this structure + EncoderParameter Parameter[1]; // Parameter values +}; + +//--------------------------------------------------------------------------- +// Property Item +//--------------------------------------------------------------------------- +class PropertyItem +{ +public: + PROPID id; // ID of this property + ULONG length; // Length of the property value, in bytes + WORD type; // Type of the value, as one of TAG_TYPE_XXX + // defined above + VOID* value; // property value +}; + +#ifdef DCR_USE_NEW_140857 +//--------------------------------------------------------------------------- +// Image property types +//--------------------------------------------------------------------------- +#define PropertyTagTypeByte 1 +#define PropertyTagTypeASCII 2 +#define PropertyTagTypeShort 3 +#define PropertyTagTypeLong 4 +#define PropertyTagTypeRational 5 +#define PropertyTagTypeUndefined 7 +#define PropertyTagTypeSLONG 9 +#define PropertyTagTypeSRational 10 +#endif + +//--------------------------------------------------------------------------- +// Image property ID tags +//--------------------------------------------------------------------------- + +#define PropertyTagExifIFD 0x8769 +#define PropertyTagGpsIFD 0x8825 + +#define PropertyTagNewSubfileType 0x00FE +#define PropertyTagSubfileType 0x00FF +#define PropertyTagImageWidth 0x0100 +#define PropertyTagImageHeight 0x0101 +#define PropertyTagBitsPerSample 0x0102 +#define PropertyTagCompression 0x0103 +#define PropertyTagPhotometricInterp 0x0106 +#define PropertyTagThreshHolding 0x0107 +#define PropertyTagCellWidth 0x0108 +#define PropertyTagCellHeight 0x0109 +#define PropertyTagFillOrder 0x010A +#define PropertyTagDocumentName 0x010D +#define PropertyTagImageDescription 0x010E +#define PropertyTagEquipMake 0x010F +#define PropertyTagEquipModel 0x0110 +#define PropertyTagStripOffsets 0x0111 +#define PropertyTagOrientation 0x0112 +#define PropertyTagSamplesPerPixel 0x0115 +#define PropertyTagRowsPerStrip 0x0116 +#define PropertyTagStripBytesCount 0x0117 +#define PropertyTagMinSampleValue 0x0118 +#define PropertyTagMaxSampleValue 0x0119 +#define PropertyTagXResolution 0x011A // Image resolution in width direction +#define PropertyTagYResolution 0x011B // Image resolution in height direction +#define PropertyTagPlanarConfig 0x011C // Image data arrangement +#define PropertyTagPageName 0x011D +#define PropertyTagXPosition 0x011E +#define PropertyTagYPosition 0x011F +#define PropertyTagFreeOffset 0x0120 +#define PropertyTagFreeByteCounts 0x0121 +#define PropertyTagGrayResponseUnit 0x0122 +#define PropertyTagGrayResponseCurve 0x0123 +#define PropertyTagT4Option 0x0124 +#define PropertyTagT6Option 0x0125 +#define PropertyTagResolutionUnit 0x0128 // Unit of X and Y resolution +#define PropertyTagPageNumber 0x0129 +#define PropertyTagTransferFuncition 0x012D +#define PropertyTagSoftwareUsed 0x0131 +#define PropertyTagDateTime 0x0132 +#define PropertyTagArtist 0x013B +#define PropertyTagHostComputer 0x013C +#define PropertyTagPredictor 0x013D +#define PropertyTagWhitePoint 0x013E +#define PropertyTagPrimaryChromaticities 0x013F +#define PropertyTagColorMap 0x0140 +#define PropertyTagHalftoneHints 0x0141 +#define PropertyTagTileWidth 0x0142 +#define PropertyTagTileLength 0x0143 +#define PropertyTagTileOffset 0x0144 +#define PropertyTagTileByteCounts 0x0145 +#define PropertyTagInkSet 0x014C +#define PropertyTagInkNames 0x014D +#define PropertyTagNumberOfInks 0x014E +#define PropertyTagDotRange 0x0150 +#define PropertyTagTargetPrinter 0x0151 +#define PropertyTagExtraSamples 0x0152 +#define PropertyTagSampleFormat 0x0153 +#define PropertyTagSMinSampleValue 0x0154 +#define PropertyTagSMaxSampleValue 0x0155 +#define PropertyTagTransferRange 0x0156 + +#define PropertyTagJPEGProc 0x0200 +#define PropertyTagJPEGInterFormat 0x0201 +#define PropertyTagJPEGInterLength 0x0202 +#define PropertyTagJPEGRestartInterval 0x0203 +#define PropertyTagJPEGLosslessPredictors 0x0205 +#define PropertyTagJPEGPointTransforms 0x0206 +#define PropertyTagJPEGQTables 0x0207 +#define PropertyTagJPEGDCTables 0x0208 +#define PropertyTagJPEGACTables 0x0209 + +#define PropertyTagYCbCrCoefficients 0x0211 +#define PropertyTagYCbCrSubsampling 0x0212 +#define PropertyTagYCbCrPositioning 0x0213 +#define PropertyTagREFBlackWhite 0x0214 + +#define PropertyTagICCProfile 0x8773 // This TAG is defined by ICC + // for embedded ICC in TIFF +#define PropertyTagGamma 0x0301 +#define PropertyTagICCProfileDescriptor 0x0302 +#define PropertyTagSRGBRenderingIntent 0x0303 + +#define PropertyTagImageTitle 0x0320 +#define PropertyTagCopyright 0x8298 + +// Extra TAGs (Like Adobe Image Information tags etc.) + +#define PropertyTagResolutionXUnit 0x5001 +#define PropertyTagResolutionYUnit 0x5002 +#define PropertyTagResolutionXLengthUnit 0x5003 +#define PropertyTagResolutionYLengthUnit 0x5004 +#define PropertyTagPrintFlags 0x5005 +#define PropertyTagPrintFlagsVersion 0x5006 +#define PropertyTagPrintFlagsCrop 0x5007 +#define PropertyTagPrintFlagsBleedWidth 0x5008 +#define PropertyTagPrintFlagsBleedWidthScale 0x5009 +#define PropertyTagHalftoneLPI 0x500A +#define PropertyTagHalftoneLPIUnit 0x500B +#define PropertyTagHalftoneDegree 0x500C +#define PropertyTagHalftoneShape 0x500D +#define PropertyTagHalftoneMisc 0x500E +#define PropertyTagHalftoneScreen 0x500F +#define PropertyTagJPEGQuality 0x5010 +#define PropertyTagGridSize 0x5011 +#define PropertyTagThumbnailFormat 0x5012 // 1 = JPEG, 0 = RAW RGB +#define PropertyTagThumbnailWidth 0x5013 +#define PropertyTagThumbnailHeight 0x5014 +#define PropertyTagThumbnailColorDepth 0x5015 +#define PropertyTagThumbnailPlanes 0x5016 +#define PropertyTagThumbnailRawBytes 0x5017 +#define PropertyTagThumbnailSize 0x5018 +#define PropertyTagThumbnailCompressedSize 0x5019 +#define PropertyTagColorTransferFunction 0x501A +#define PropertyTagThumbnailData 0x501B// RAW thumbnail bits in + // JPEG format or RGB format + // depends on + // PropertyTagThumbnailFormat + +// Thumbnail related TAGs + +#define PropertyTagThumbnailImageWidth 0x5020 // Thumbnail width +#define PropertyTagThumbnailImageHeight 0x5021 // Thumbnail height +#define PropertyTagThumbnailBitsPerSample 0x5022 // Number of bits per + // component +#define PropertyTagThumbnailCompression 0x5023 // Compression Scheme +#define PropertyTagThumbnailPhotometricInterp 0x5024 // Pixel composition +#define PropertyTagThumbnailImageDescription 0x5025 // Image Tile +#define PropertyTagThumbnailEquipMake 0x5026 // Manufacturer of Image + // Input equipment +#define PropertyTagThumbnailEquipModel 0x5027 // Model of Image input + // equipment +#define PropertyTagThumbnailStripOffsets 0x5028 // Image data location +#define PropertyTagThumbnailOrientation 0x5029 // Orientation of image +#define PropertyTagThumbnailSamplesPerPixel 0x502A // Number of components +#define PropertyTagThumbnailRowsPerStrip 0x502B // Number of rows per strip +#define PropertyTagThumbnailStripBytesCount 0x502C // Bytes per compressed + // strip +#define PropertyTagThumbnailResolutionX 0x502D // Resolution in width + // direction +#define PropertyTagThumbnailResolutionY 0x502E // Resolution in height + // direction +#define PropertyTagThumbnailPlanarConfig 0x502F // Image data arrangement +#define PropertyTagThumbnailResolutionUnit 0x5030 // Unit of X and Y + // Resolution +#define PropertyTagThumbnailTransferFunction 0x5031 // Transfer function +#define PropertyTagThumbnailSoftwareUsed 0x5032 // Software used +#define PropertyTagThumbnailDateTime 0x5033 // File change date and + // time +#define PropertyTagThumbnailArtist 0x5034 // Person who created the + // image +#define PropertyTagThumbnailWhitePoint 0x5035 // White point chromaticity +#define PropertyTagThumbnailPrimaryChromaticities 0x5036 + // Chromaticities of + // primaries +#define PropertyTagThumbnailYCbCrCoefficients 0x5037 // Color space transforma- + // tion coefficients +#define PropertyTagThumbnailYCbCrSubsampling 0x5038 // Subsampling ratio of Y + // to C +#define PropertyTagThumbnailYCbCrPositioning 0x5039 // Y and C position +#define PropertyTagThumbnailRefBlackWhite 0x503A // Pair of black and white + // reference values +#define PropertyTagThumbnailCopyRight 0x503B // CopyRight holder + +#define PropertyTagLuminanceTable 0x5090 +#define PropertyTagChrominanceTable 0x5091 + +#define PropertyTagFrameDelay 0x5100 +#define PropertyTagLoopCount 0x5101 + +#define PropertyTagPixelUnit 0x5110 // Unit specifier for pixel/unit +#define PropertyTagPixelPerUnitX 0x5111 // Pixels per unit in X +#define PropertyTagPixelPerUnitY 0x5112 // Pixels per unit in Y +#define PropertyTagPaletteHistogram 0x5113 // Palette histogram + +// EXIF specific tag + +#define PropertyTagExifExposureTime 0x829A +#define PropertyTagExifFNumber 0x829D + +#define PropertyTagExifExposureProg 0x8822 +#define PropertyTagExifSpectralSense 0x8824 +#define PropertyTagExifISOSpeed 0x8827 +#define PropertyTagExifOECF 0x8828 + +#define PropertyTagExifVer 0x9000 +#define PropertyTagExifDTOrig 0x9003 // Date & time of original +#define PropertyTagExifDTDigitized 0x9004 // Date & time of digital data generation + +#define PropertyTagExifCompConfig 0x9101 +#define PropertyTagExifCompBPP 0x9102 + +#define PropertyTagExifShutterSpeed 0x9201 +#define PropertyTagExifAperture 0x9202 +#define PropertyTagExifBrightness 0x9203 +#define PropertyTagExifExposureBias 0x9204 +#define PropertyTagExifMaxAperture 0x9205 +#define PropertyTagExifSubjectDist 0x9206 +#define PropertyTagExifMeteringMode 0x9207 +#define PropertyTagExifLightSource 0x9208 +#define PropertyTagExifFlash 0x9209 +#define PropertyTagExifFocalLength 0x920A +#define PropertyTagExifMakerNote 0x927C +#define PropertyTagExifUserComment 0x9286 +#define PropertyTagExifDTSubsec 0x9290 // Date & Time subseconds +#define PropertyTagExifDTOrigSS 0x9291 // Date & Time original subseconds +#define PropertyTagExifDTDigSS 0x9292 // Date & TIme digitized subseconds + +#define PropertyTagExifFPXVer 0xA000 +#define PropertyTagExifColorSpace 0xA001 +#define PropertyTagExifPixXDim 0xA002 +#define PropertyTagExifPixYDim 0xA003 +#define PropertyTagExifRelatedWav 0xA004 // related sound file +#define PropertyTagExifInterop 0xA005 +#define PropertyTagExifFlashEnergy 0xA20B +#define PropertyTagExifSpatialFR 0xA20C // Spatial Frequency Response +#define PropertyTagExifFocalXRes 0xA20E // Focal Plane X Resolution +#define PropertyTagExifFocalYRes 0xA20F // Focal Plane Y Resolution +#define PropertyTagExifFocalResUnit 0xA210 // Focal Plane Resolution Unit +#define PropertyTagExifSubjectLoc 0xA214 +#define PropertyTagExifExposureIndex 0xA215 +#define PropertyTagExifSensingMethod 0xA217 +#define PropertyTagExifFileSource 0xA300 +#define PropertyTagExifSceneType 0xA301 +#define PropertyTagExifCfaPattern 0xA302 + +#define PropertyTagGpsVer 0x0000 +#define PropertyTagGpsLatitudeRef 0x0001 +#define PropertyTagGpsLatitude 0x0002 +#define PropertyTagGpsLongitudeRef 0x0003 +#define PropertyTagGpsLongitude 0x0004 +#define PropertyTagGpsAltitudeRef 0x0005 +#define PropertyTagGpsAltitude 0x0006 +#define PropertyTagGpsGpsTime 0x0007 +#define PropertyTagGpsGpsSatellites 0x0008 +#define PropertyTagGpsGpsStatus 0x0009 +#define PropertyTagGpsGpsMeasureMode 0x00A +#define PropertyTagGpsGpsDop 0x000B // Measurement precision +#define PropertyTagGpsSpeedRef 0x000C +#define PropertyTagGpsSpeed 0x000D +#define PropertyTagGpsTrackRef 0x000E +#define PropertyTagGpsTrack 0x000F +#define PropertyTagGpsImgDirRef 0x0010 +#define PropertyTagGpsImgDir 0x0011 +#define PropertyTagGpsMapDatum 0x0012 +#define PropertyTagGpsDestLatRef 0x0013 +#define PropertyTagGpsDestLat 0x0014 +#define PropertyTagGpsDestLongRef 0x0015 +#define PropertyTagGpsDestLong 0x0016 +#define PropertyTagGpsDestBearRef 0x0017 +#define PropertyTagGpsDestBear 0x0018 +#define PropertyTagGpsDestDistRef 0x0019 +#define PropertyTagGpsDestDist 0x001A + +#endif diff --git a/win32/gdiplus/include/GdiplusInit.h b/win32/gdiplus/include/GdiplusInit.h new file mode 100644 index 0000000..ac4c6f0 --- /dev/null +++ b/win32/gdiplus/include/GdiplusInit.h @@ -0,0 +1,99 @@ +/************************************************************************** +* +* Copyright (c) 2000 Microsoft Corporation +* +* Module Name: +* +* Gdiplus init +* +* Abstract: +* +* GDI+ startup/shutdown API's +* +* Created: +* +* 09/02/2000 agodfrey +* Created it. +* +**************************************************************************/ + +#ifndef _GDIPLUSINIT_H +#define _GDIPLUSINIT_H + +// Used for debug event notification (debug builds only) + +enum DebugEventLevel +{ + DebugEventLevelFatal, + DebugEventLevelWarning +}; + +// Callback function that GDI+ can call, on debug builds, for assertions +// and warnings. + +typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message); + +// Notification functions which the user must call appropriately if +// "SuppressBackgroundThread" (below) is set. + +typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token); +typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token); + +// Input structure for GdiplusStartup() + +struct GdiplusStartupInput +{ + UINT32 GdiplusVersion; // Must be 1 + DebugEventProc DebugEventCallback; // Ignored on free builds + BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call + // the hook/unhook functions properly + BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use + // its internal image codecs. + + GdiplusStartupInput( + DebugEventProc debugEventCallback = NULL, + BOOL suppressBackgroundThread = FALSE, + BOOL suppressExternalCodecs = FALSE) + { + GdiplusVersion = 1; + DebugEventCallback = debugEventCallback; + SuppressBackgroundThread = suppressBackgroundThread; + SuppressExternalCodecs = suppressExternalCodecs; + } +}; + +// Output structure for GdiplusStartup() + +struct GdiplusStartupOutput +{ + // The following 2 fields are NULL if SuppressBackgroundThread is FALSE. + // Otherwise, they are functions which must be called appropriately to + // replace the background thread. + // + // These should be called on the application's main message loop - i.e. + // a message loop which is active for the lifetime of GDI+. + // "NotificationHook" should be called before starting the loop, + // and "NotificationUnhook" should be called after the loop ends. + + NotificationHookProc NotificationHook; + NotificationUnhookProc NotificationUnhook; +}; + +// GDI+ initialization. Must be called before GDI+ API's are used. +// +// token - may not be NULL - accepts a token to be passed in the corresponding +// GdiplusShutdown call. +// input - may not be NULL +// output - may be NULL only if input->SuppressBackgroundThread is FALSE. + +extern "C" Status WINAPI GdiplusStartup( + OUT ULONG_PTR *token, + const GdiplusStartupInput *input, + OUT GdiplusStartupOutput *output); + +// GDI+ termination. Must be called before GDI+ is unloaded. GDI+ API's may not +// be called after this. + +extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token); + +#endif diff --git a/win32/gdiplus/include/GdiplusLineCaps.h b/win32/gdiplus/include/GdiplusLineCaps.h new file mode 100644 index 0000000..e8a2951 --- /dev/null +++ b/win32/gdiplus/include/GdiplusLineCaps.h @@ -0,0 +1,253 @@ +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusLineCaps.h +* +* Abstract: +* +* APIs for Custom Line Caps +* +\**************************************************************************/ + +#ifndef _GDIPLUSLINECAPS_H +#define _GDIPLUSLINECAPS_H + +inline +CustomLineCap::CustomLineCap( + IN const GraphicsPath* fillPath, + IN const GraphicsPath* strokePath, + IN LineCap baseCap, + IN REAL baseInset + ) +{ + nativeCap = NULL; + GpPath* nativeFillPath = NULL; + GpPath* nativeStrokePath = NULL; + + if(fillPath) + nativeFillPath = fillPath->nativePath; + if(strokePath) + nativeStrokePath = strokePath->nativePath; + + lastResult = DllExports::GdipCreateCustomLineCap( + nativeFillPath, nativeStrokePath, + baseCap, baseInset, &nativeCap); +} + +inline +CustomLineCap::CustomLineCap() +{ + // This is used for default constructor for subclasses. + // So don't create a nativeCap. + + nativeCap = NULL; + lastResult = Ok; +} + +inline +CustomLineCap::~CustomLineCap() +{ + DllExports::GdipDeleteCustomLineCap(nativeCap); +} + +inline Status +CustomLineCap::SetStrokeCaps( + IN LineCap startCap, + IN LineCap endCap) +{ + return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap, + startCap, endCap)); +} + +inline Status +CustomLineCap::GetStrokeCaps( + OUT LineCap* startCap, + OUT LineCap* endCap) const +{ + return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap, + startCap, endCap)); +} + +inline Status +CustomLineCap::SetStrokeJoin( + IN LineJoin lineJoin) +{ + return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin)); +} + +inline LineJoin +CustomLineCap::GetStrokeJoin() const +{ + LineJoin lineJoin; + + SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin)); + + return lineJoin; +} + +inline Status +CustomLineCap::SetBaseCap(IN LineCap baseCap) +{ + return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap)); +} + +inline LineCap +CustomLineCap::GetBaseCap() const +{ + LineCap baseCap; + SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap)); + + return baseCap; +} + +inline Status +CustomLineCap::SetBaseInset(IN REAL inset) +{ + return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset)); +} + +inline REAL +CustomLineCap::GetBaseInset() const +{ + REAL inset; + SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset)); + + return inset; +} + + +inline Status +CustomLineCap::SetWidthScale(IN REAL widthScale) +{ + return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale)); +} + +inline REAL +CustomLineCap::GetWidthScale() const +{ + REAL widthScale; + SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale)); + + return widthScale; +} + +inline CustomLineCap* +CustomLineCap::Clone() const +{ + GpCustomLineCap *newNativeLineCap = NULL; + + SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &newNativeLineCap)); + + if (lastResult == Ok) + { + CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap, lastResult); + if (newLineCap == NULL) + { + SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap)); + } + + return newLineCap; + } + + return NULL; +} + +class AdjustableArrowCap : public CustomLineCap +{ +public: + + AdjustableArrowCap( + IN REAL height, + IN REAL width, + IN BOOL isFilled = TRUE + ) + { + GpAdjustableArrowCap* cap = NULL; + + lastResult = DllExports::GdipCreateAdjustableArrowCap( + height, width, isFilled, &cap); + SetNativeCap(cap); + } + + Status SetHeight(IN REAL height) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight( + cap, height)); + } + + REAL GetHeight() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL height; + SetStatus(DllExports::GdipGetAdjustableArrowCapHeight( + cap, &height)); + + return height; + } + + Status SetWidth(IN REAL width) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth( + cap, width)); + } + + REAL GetWidth() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL width; + SetStatus(DllExports::GdipGetAdjustableArrowCapWidth( + cap, &width)); + + return width; + } + + Status SetMiddleInset(IN REAL middleInset) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset( + cap, middleInset)); + } + + REAL GetMiddleInset() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL middleInset; + SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset( + cap, &middleInset)); + + return middleInset; + } + + Status SetFillState(IN BOOL isFilled) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState( + cap, isFilled)); + } + + BOOL IsFilled() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + BOOL isFilled; + SetStatus(DllExports::GdipGetAdjustableArrowCapFillState( + cap, &isFilled)); + + return isFilled; + } + +#ifdef DCR_USE_NEW_250932 + +private: + AdjustableArrowCap(const AdjustableArrowCap &); + AdjustableArrowCap& operator=(const AdjustableArrowCap &); + +#endif + +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusMatrix.h b/win32/gdiplus/include/GdiplusMatrix.h new file mode 100644 index 0000000..7fa3df8 --- /dev/null +++ b/win32/gdiplus/include/GdiplusMatrix.h @@ -0,0 +1,309 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMatrix.h +* +* Abstract: +* +* GDI+ Matrix class +* +\**************************************************************************/ + +class Matrix : public GdiplusBase +{ +public: + friend class Graphics; + friend class GraphicsPath; + friend class TextureBrush; + friend class LinearGradientBrush; + friend class PathGradientBrush; + friend class Pen; + friend class Region; + + // Default constructor - set to identity matrix + + Matrix() + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix(&matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN REAL m11, + IN REAL m12, + IN REAL m21, + IN REAL m22, + IN REAL dx, + IN REAL dy) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, + dx, dy, &matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN const RectF& rect, + IN const PointF* dstplg) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix3(&rect, + dstplg, + &matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN const Rect& rect, + IN const Point* dstplg) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix3I(&rect, + dstplg, + &matrix); + + SetNativeMatrix(matrix); + } + + ~Matrix() + { + DllExports::GdipDeleteMatrix(nativeMatrix); + } + + Matrix *Clone() const + { + GpMatrix *cloneMatrix = NULL; + + SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, + &cloneMatrix)); + + if (lastResult != Ok) + return NULL; + + return new Matrix(cloneMatrix); + } + + Status GetElements(OUT REAL *m) const + { + return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m)); + } + + Status SetElements(IN REAL m11, + IN REAL m12, + IN REAL m21, + IN REAL m22, + IN REAL dx, + IN REAL dy) + { + return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, + m11, m12, m21, m22, dx, dy)); + } + + REAL OffsetX() const + { + REAL elements[6]; + + if (GetElements(&elements[0]) == Ok) + return elements[4]; + else + return 0.0f; + } + + REAL OffsetY() const + { + REAL elements[6]; + + if (GetElements(&elements[0]) == Ok) + return elements[5]; + else + return 0.0f; + } + + Status Reset() + { + // set identity matrix elements + return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, + 1.0, 0.0, 0.0, 1.0, 0.0, 0.0)); + } + + Status Multiply(IN const Matrix *matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, + matrix->nativeMatrix, + order)); + } + + Status Translate(IN REAL offsetX, + IN REAL offsetY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order)); + } + + Status Scale(IN REAL scaleX, + IN REAL scaleY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order)); + } + + Status Rotate(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + } + + Status RotateAt(IN REAL angle, + IN const PointF& center, + IN MatrixOrder order = MatrixOrderPrepend) + { + if(order == MatrixOrderPrepend) + { + SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); + SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); + } + else + { + SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); + SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); + } + } + + Status Shear(IN REAL shearX, + IN REAL shearY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order)); + } + + Status Invert() + { + return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix)); + } + + // float version + Status TransformPoints(IN OUT PointF* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix, pts, count)); + } + + Status TransformPoints(IN OUT Point* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix, + pts, + count)); + } + + Status TransformVectors(IN OUT PointF* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipVectorTransformMatrixPoints(nativeMatrix, pts, count)); + } + + Status TransformVectors(IN OUT Point* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(nativeMatrix, + pts, + count)); + } + + BOOL IsInvertible() const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result)); + + return result; + } + + BOOL IsIdentity() const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result)); + + return result; + } + + BOOL Equals(IN const Matrix *matrix) const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, + matrix->nativeMatrix, &result)); + + return result; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Matrix(const Matrix &); + Matrix& operator=(const Matrix &); +protected: + +#else + + Matrix(const Matrix& matrix) + { + matrix; + SetStatus(NotImplemented); + SetNativeMatrix(NULL); + } + + Matrix& operator=(const Matrix& matrix) + { + matrix; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Matrix(GpMatrix *nativeMatrix) + { + lastResult = Ok; + SetNativeMatrix(nativeMatrix); + } + + VOID SetNativeMatrix(GpMatrix *nativeMatrix) + { + this->nativeMatrix = nativeMatrix; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpMatrix *nativeMatrix; + mutable Status lastResult; +}; diff --git a/win32/gdiplus/include/GdiplusMem.h b/win32/gdiplus/include/GdiplusMem.h new file mode 100644 index 0000000..5f92c1e --- /dev/null +++ b/win32/gdiplus/include/GdiplusMem.h @@ -0,0 +1,49 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMem.h +* +* Abstract: +* +* Flat GDI+ Memory Allocators - header file +* +\**************************************************************************/ + +// TODO: this file style needs to be made internally consistent with the way +// it handles breaking the long argument lists across multiple lines + +#ifndef _GDIPLUSMEM_H +#define _GDIPLUSMEM_H + +#define WINGDIPAPI __stdcall + +// currently, only C++ wrapper API's force const. + +#ifdef _GDIPLUS_H +#define GDIPCONST const +#else +#define GDIPCONST +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------------- +// Memory Allocation APIs +//---------------------------------------------------------------------------- + +void* WINGDIPAPI +GdipAlloc(size_t size); + +void WINGDIPAPI +GdipFree(void* ptr); + +#ifdef __cplusplus +} +#endif + +#endif // !_GDIPLUSMEM_H diff --git a/win32/gdiplus/include/GdiplusMetaHeader.h b/win32/gdiplus/include/GdiplusMetaHeader.h new file mode 100644 index 0000000..79b5bc9 --- /dev/null +++ b/win32/gdiplus/include/GdiplusMetaHeader.h @@ -0,0 +1,213 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Metafile headers +* +* Abstract: +* +* Declarations for various metafile header structures. +* +\**************************************************************************/ + +#ifndef _GDIPLUSMETAHEADER_H +#define _GDIPLUSMETAHEADER_H + +typedef struct +{ + DWORD iType; // Record type EMR_HEADER + DWORD nSize; // Record size in bytes. This may be greater + // than the sizeof(ENHMETAHEADER). + RECTL rclBounds; // Inclusive-inclusive bounds in device units + RECTL rclFrame; // Inclusive-inclusive Picture Frame of metafile in .01 mm units + DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE. + DWORD nVersion; // Version number + DWORD nBytes; // Size of the metafile in bytes + DWORD nRecords; // Number of records in the metafile + WORD nHandles; // Number of handles in the handle table + // Handle index zero is reserved. + WORD sReserved; // Reserved. Must be zero. + DWORD nDescription; // Number of chars in the unicode description string + // This is 0 if there is no description string + DWORD offDescription; // Offset to the metafile description record. + // This is 0 if there is no description string + DWORD nPalEntries; // Number of entries in the metafile palette. + SIZEL szlDevice; // Size of the reference device in pels + SIZEL szlMillimeters; // Size of the reference device in millimeters +} ENHMETAHEADER3; + +// Aldus Placeable Metafiles + +// Placeable Metafiles were created by Aldus Corporation as a non-standard +// way of specifying how a metafile is mapped and scaled on an output device. +// Placeable metafiles are quite wide-spread, but not directly supported by +// the Windows API. To playback a placeable metafile using the Windows API, +// you will first need to strip the placeable metafile header from the file. +// This is typically performed by copying the metafile to a temporary file +// starting at file offset 22 (0x16). The contents of the temporary file may +// then be used as input to the Windows GetMetaFile(), PlayMetaFile(), +// CopyMetaFile(), etc. GDI functions. + +// Each placeable metafile begins with a 22-byte header, +// followed by a standard metafile: + +#include // set structure packing to 2 + +typedef struct +{ + INT16 Left; + INT16 Top; + INT16 Right; + INT16 Bottom; +} APMRect16; + +typedef struct +{ + UINT32 Key; // GDIP_WMF_ALDUSKEY + INT16 Hmf; // Metafile HANDLE number (always 0) + APMRect16 BoundingBox; // Coordinates in metafile units + INT16 Inch; // Number of metafile units per inch + UINT32 Reserved; // Reserved (always 0) + INT16 Checksum; // Checksum value for previous 10 WORDs +} APMFileHeader; + +#include + +// Key contains a special identification value that indicates the presence +// of a placeable metafile header and is always 0x9AC6CDD7. + +// Handle is used to stored the handle of the metafile in memory. When written +// to disk, this field is not used and will always contains the value 0. + +// Left, Top, Right, and Bottom contain the coordinates of the upper-left +// and lower-right corners of the image on the output device. These are +// measured in twips. + +// A twip (meaning "twentieth of a point") is the logical unit of measurement +// used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720 +// twips equal 1/2 inch, while 32,768 twips is 22.75 inches. + +// Inch contains the number of twips per inch used to represent the image. +// Normally, there are 1440 twips per inch; however, this number may be +// changed to scale the image. A value of 720 indicates that the image is +// double its normal size, or scaled to a factor of 2:1. A value of 360 +// indicates a scale of 4:1, while a value of 2880 indicates that the image +// is scaled down in size by a factor of two. A value of 1440 indicates +// a 1:1 scale ratio. + +// Reserved is not used and is always set to 0. + +// Checksum contains a checksum value for the previous 10 WORDs in the header. +// This value can be used in an attempt to detect if the metafile has become +// corrupted. The checksum is calculated by XORing each WORD value to an +// initial value of 0. + +// If the metafile was recorded with a reference Hdc that was a display. +#define GDIP_EMFPLUSFLAGS_DISPLAY 0x00000001 + +class MetafileHeader +{ +public: + MetafileType Type; + UINT Size; // Size of the metafile (in bytes) + UINT Version; // EMF+, EMF, or WMF version + UINT EmfPlusFlags; + REAL DpiX; + REAL DpiY; + INT X; // Bounds in device units + INT Y; + INT Width; + INT Height; + union + { + METAHEADER WmfHeader; + ENHMETAHEADER3 EmfHeader; + }; + INT EmfPlusHeaderSize; // size of the EMF+ header in file + INT LogicalDpiX; // Logical Dpi of reference Hdc + INT LogicalDpiY; // usually valid only for EMF+ files + +public: + // Get the metafile type + MetafileType GetType() const { return Type; } + + // Get the size of the metafile in BYTEs + UINT GetMetafileSize() const { return Size; } + + // If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF version + UINT GetVersion() const { return Version; } + + // Get the EMF+ flags associated with the metafile + UINT GetEmfPlusFlags() const { return EmfPlusFlags; } + + // Get the X Dpi of the metafile + REAL GetDpiX() const { return DpiX; } + + // Get the Y Dpi of the metafile + REAL GetDpiY() const { return DpiY; } + + // Get the bounds of the metafile in device units + VOID GetBounds (OUT Rect *rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Is it any type of WMF (standard or Aldus Placeable Metafile)? + BOOL IsWmf() const + { + return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfAldus)); + } + + // Is this an Aldus Placeable Metafile? + BOOL IsWmfAldus() const { return (Type == MetafileTypeWmf); } + + // Is this an EMF (not an EMF+)? + BOOL IsEmf() const { return (Type == MetafileTypeEmf); } + + // Is this an EMF or EMF+ file? + BOOL IsEmfOrEmfPlus() const { return (Type >= MetafileTypeEmf); } + + // Is this an EMF+ file? + BOOL IsEmfPlus() const { return (Type >= MetafileTypeEmfPlusOnly); } + + // Is this an EMF+ dual (has dual, down-level records) file? + BOOL IsEmfPlusDual() const { return (Type == MetafileTypeEmfPlusDual); } + + // Is this an EMF+ only (no dual records) file? + BOOL IsEmfPlusOnly() const { return (Type == MetafileTypeEmfPlusOnly); } + + // If it's an EMF+ file, was it recorded against a display Hdc? + BOOL IsDisplay() const + { + return (IsEmfPlus() && + ((EmfPlusFlags & GDIP_EMFPLUSFLAGS_DISPLAY) != 0)); + } + + // Get the WMF header of the metafile (if it is a WMF) + const METAHEADER * GetWmfHeader() const + { + if (IsWmf()) + { + return &WmfHeader; + } + return NULL; + } + + // Get the EMF header of the metafile (if it is an EMF) + const ENHMETAHEADER3 * GetEmfHeader() const + { + if (IsEmfOrEmfPlus()) + { + return &EmfHeader; + } + return NULL; + } +}; + +#endif + diff --git a/win32/gdiplus/include/GdiplusMetafile.h b/win32/gdiplus/include/GdiplusMetafile.h new file mode 100644 index 0000000..7efa1d6 --- /dev/null +++ b/win32/gdiplus/include/GdiplusMetafile.h @@ -0,0 +1,374 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMetafile.h +* +* Abstract: +* +* Metafile related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSMETAFILE_H +#define _GDIPLUSMETAFILE_H + +class Metafile : public Image +{ +public: + friend class Image; + + // Read a metafile + Metafile() + { + SetNativeImage(NULL); + lastResult = Ok; + } + + // Playback a metafile from a HMETAFILE + // If deleteWmf is TRUE, then when the metafile is deleted, + // the hWmf will also be deleted. Otherwise, it won't be. + Metafile(IN HMETAFILE hWmf, + IN const APMFileHeader * apmFileHeader, + IN BOOL deleteWmf = FALSE) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf, apmFileHeader, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a HENHMETAFILE + // If deleteEmf is TRUE, then when the metafile is deleted, + // the hEmf will also be deleted. Otherwise, it won't be. + Metafile(IN HENHMETAFILE hEmf, + IN BOOL deleteEmf = FALSE) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a file + Metafile(IN const WCHAR* filename) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromFile(filename, &metafile); + + SetNativeImage(metafile); + } + + // Playback a WMF metafile from a file + Metafile(IN const WCHAR* filename, + IN const APMFileHeader * apmFileHeader + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename, apmFileHeader, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a stream + Metafile(IN IStream* stream) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromStream(stream, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafile( + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafile( + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileI( + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileName(fileName, + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileName(fileName, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileNameI(fileName, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a stream + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStream(stream, + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a stream + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStream(stream, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Write a metafile to a stream with down-level GDI records + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStreamI(stream, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + static Status GetMetafileHeader( + IN HMETAFILE hWmf, + IN const APMFileHeader * apmFileHeader, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromWmf(hWmf, apmFileHeader, header); + } + + static Status GetMetafileHeader( + IN HENHMETAFILE hEmf, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header); + } + + static Status GetMetafileHeader( + IN const WCHAR* filename, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromFile(filename, header); + } + + static Status GetMetafileHeader( + IN IStream * stream, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromStream(stream, header); + } + + Status GetMetafileHeader( + OUT MetafileHeader * header + ) const + { + return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile( + (GpMetafile *)nativeImage, + header)); + } + + // Once this method is called, the Metafile object is in an invalid state + // and can no longer be used. It is the responsiblity of the caller to + // invoke DeleteEnhMetaFile to delete this hEmf. + + HENHMETAFILE GetHENHMETAFILE() + { + HENHMETAFILE hEmf; + + SetStatus(DllExports::GdipGetHemfFromMetafile((GpMetafile *)nativeImage, &hEmf)); + + return hEmf; + } + + // Used in conjuction with Graphics::EnumerateMetafile to play an EMF+ + // The data must be DWORD aligned if it's an EMF or EMF+. It must be + // WORD aligned if it's a WMF. + Status + PlayRecord( + IN EmfPlusRecordType recordType, + IN UINT flags, + IN UINT dataSize, + IN const BYTE * data + ) const + { + return SetStatus(DllExports::GdipPlayMetafileRecord( + (GpMetafile *)nativeImage, + recordType, + flags, + dataSize, + data)); + } + + // If you're using a printer HDC for the metafile, but you want the + // metafile rasterized at screen resolution, then use this API to set + // the rasterization dpi of the metafile to the screen resolution, + // e.g. 96 dpi or 120 dpi. + Status SetDownLevelRasterizationLimit( + IN UINT metafileRasterizationLimitDpi + ) + { + return SetStatus(DllExports::GdipSetMetafileDownLevelRasterizationLimit( + (GpMetafile *)nativeImage, + metafileRasterizationLimitDpi)); + } + + UINT GetDownLevelRasterizationLimit() const + { + UINT metafileRasterizationLimitDpi = 0; + + SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit( + (GpMetafile *)nativeImage, + &metafileRasterizationLimitDpi)); + + return metafileRasterizationLimitDpi; + } + + static UINT EmfToWmfBits( + IN HENHMETAFILE hemf, + IN UINT cbData16, + IN LPBYTE pData16, + IN INT iMapMode = MM_ANISOTROPIC, + IN EmfToWmfBitsFlags eFlags = EmfToWmfBitsFlagsDefault + ) + { + return DllExports::GdipEmfToWmfBits( + hemf, + cbData16, + pData16, + iMapMode, + eFlags); + } + +#ifdef DCR_USE_NEW_250932 + +private: + Metafile(const Metafile &); + Metafile& operator=(const Metafile &); + +#endif +}; + +#endif // !_METAFILE_H diff --git a/win32/gdiplus/include/GdiplusPath.h b/win32/gdiplus/include/GdiplusPath.h new file mode 100644 index 0000000..cff0e1d --- /dev/null +++ b/win32/gdiplus/include/GdiplusPath.h @@ -0,0 +1,1686 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusPath.h +* +* Abstract: +* +* Path related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSPATH_H +#define _GDIPLUSPATH_H + +class GraphicsPath : public GdiplusBase +{ +public: + friend class Graphics; + friend class Region; + friend class PathGradientBrush; + friend class GraphicsPathIterator; + friend class CustomLineCap; + + // Path constructors + + GraphicsPath(IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath(fillMode, &nativePath); + } + + GraphicsPath(IN const PointF* points, + IN const BYTE* types, + IN INT count, + IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath2(points, + types, + count, + fillMode, + &nativePath); + } + + GraphicsPath(IN const Point* points, + IN const BYTE* types, + IN INT count, + IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath2I(points, + types, + count, + fillMode, + &nativePath); + } + + ~GraphicsPath() + { + DllExports::GdipDeletePath(nativePath); + } + + /** + * Make a copy of the current path object + */ + GraphicsPath* Clone() const + { + GpPath *clonepath = NULL; + + SetStatus(DllExports::GdipClonePath(nativePath, &clonepath)); + + return new GraphicsPath(clonepath); + } + + /** + * Reset the path object to empty (and fill mode to FillModeAlternate) + */ + Status Reset() + { + return SetStatus(DllExports::GdipResetPath(nativePath)); + } + + /** + * Get path fill mode information + */ + FillMode GetFillMode() const + { + FillMode fillmode = FillModeAlternate; + + SetStatus(DllExports::GdipGetPathFillMode(nativePath, &fillmode)); + + return fillmode; + } + + /** + * Set path fill mode information + */ + Status SetFillMode(IN FillMode fillmode) + { + return SetStatus(DllExports::GdipSetPathFillMode(nativePath, fillmode)); + } + + /** + * Set/get path data + */ + Status GetPathData(OUT PathData* pathData) const + { + if (pathData == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count = GetPointCount(); + + if ((count <= 0) || (pathData->Count>0 && pathData->CountCount = 0; + if (pathData->Points) + { + delete pathData->Points; + pathData->Points = NULL; + } + + if (pathData->Types) + { + delete pathData->Types; + pathData->Types = NULL; + } + + if (count <= 0) + { + return lastResult; + } + } + + if (pathData->Count == 0) + { + pathData->Points = new PointF[count]; + if (pathData->Points == NULL) + { + return SetStatus(OutOfMemory); + + } + pathData->Types = new byte[count]; + if (pathData->Types == NULL) + { + delete pathData->Points; + pathData->Points = NULL; + + return SetStatus(OutOfMemory); + } + pathData->Count = count; + } + + return SetStatus(DllExports::GdipGetPathData(nativePath, pathData)); + } + + /** + * Start/end a subpath + */ + Status StartFigure() + { + return SetStatus(DllExports::GdipStartPathFigure(nativePath)); + } + + Status CloseFigure() + { + return SetStatus(DllExports::GdipClosePathFigure(nativePath)); + } + + Status CloseAllFigures() + { + return SetStatus(DllExports::GdipClosePathFigures(nativePath)); + } + + Status SetMarker() + { + return SetStatus(DllExports::GdipSetPathMarker(nativePath)); + } + + Status ClearMarkers() + { + return SetStatus(DllExports::GdipClearPathMarkers(nativePath)); + } + + Status Reverse() + { + return SetStatus(DllExports::GdipReversePath(nativePath)); + } + + Status GetLastPoint(OUT PointF* lastPoint) const + { + return SetStatus(DllExports::GdipGetPathLastPoint(nativePath, lastPoint)); + } + + /** + * Add lines to the path object + */ + // float version + Status AddLine(IN const PointF& pt1, + IN const PointF& pt2) + { + return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y); + } + + Status AddLine(IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2) + { + return SetStatus(DllExports::GdipAddPathLine(nativePath, x1, y1, x2, y2)); + } + + Status AddLines(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathLine2(nativePath, points, count)); + } + + // integer version + Status AddLine(IN const Point& pt1, + IN const Point& pt2) + { + return AddLine(pt1.X, + pt1.Y, + pt2.X, + pt2.Y); + } + + Status AddLine(IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2) + { + return SetStatus(DllExports::GdipAddPathLineI(nativePath, + x1, + y1, + x2, + y2)); + } + + Status AddLines(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathLine2I(nativePath, + points, + count)); + } + + /** + * Add an arc to the path object + */ + // float version + Status AddArc(IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddArc(rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status AddArc(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathArc(nativePath, x, y, width, height, + startAngle, sweepAngle)); + } + + // integer version + Status AddArc(IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddArc(rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status AddArc(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathArcI(nativePath, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + /** + * Add Bezier curves to the path object + */ + // float version + Status AddBezier(IN const PointF& pt1, + IN const PointF& pt2, + IN const PointF& pt3, + IN const PointF& pt4) + { + return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, + pt4.Y); + } + + Status AddBezier(IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2, + IN REAL x3, + IN REAL y3, + IN REAL x4, + IN REAL y4) + { + return SetStatus(DllExports::GdipAddPathBezier(nativePath, x1, y1, x2, y2, + x3, y3, x4, y4)); + } + + Status AddBeziers(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathBeziers(nativePath, points, count)); + } + + // integer version + Status AddBezier(IN const Point& pt1, + IN const Point& pt2, + IN const Point& pt3, + IN const Point& pt4) + { + return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, + pt4.Y); + } + + Status AddBezier(IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2, + IN INT x3, + IN INT y3, + IN INT x4, + IN INT y4) + { + return SetStatus(DllExports::GdipAddPathBezierI(nativePath, + x1, + y1, + x2, + y2, + x3, + y3, + x4, + y4)); + } + + Status AddBeziers(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathBeziersI(nativePath, + points, + count)); + } + + // float version + Status AddCurve(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathCurve(nativePath, + points, + count)); + } + + Status AddCurve(IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve2(nativePath, + points, + count, + tension)); + } + + Status AddCurve(IN const PointF* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve3(nativePath, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // integer version + Status AddCurve(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathCurveI(nativePath, + points, + count)); + } + + Status AddCurve(IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve2I(nativePath, + points, + count, + tension)); + } + + Status AddCurve(IN const Point* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve3I(nativePath, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // float version + Status AddClosedCurve(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathClosedCurve(nativePath, + points, + count)); + } + + Status AddClosedCurve(IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathClosedCurve2(nativePath, + points, + count, + tension)); + } + + // integer version + Status AddClosedCurve(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathClosedCurveI(nativePath, + points, + count)); + } + + + Status AddClosedCurve(IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathClosedCurve2I(nativePath, + points, + count, + tension)); + } + + + /** + * Add closed shapes to the path object + */ + + // float version + Status AddRectangle(IN const RectF& rect) + { + return SetStatus(DllExports::GdipAddPathRectangle(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + } + + Status AddRectangles(IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathRectangles(nativePath, + rects, + count)); + } + + // integer version + Status AddRectangle(IN const Rect& rect) + { + return SetStatus(DllExports::GdipAddPathRectangleI(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + } + + Status AddRectangles(IN const Rect* rects, INT count) + { + return SetStatus(DllExports::GdipAddPathRectanglesI(nativePath, + rects, + count)); + } + + // float version + Status AddEllipse(IN const RectF& rect) + { + return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + } + + Status AddEllipse(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipAddPathEllipse(nativePath, + x, + y, + width, + height)); + } + + // integer version + Status AddEllipse(IN const Rect& rect) + { + return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + } + + Status AddEllipse(IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipAddPathEllipseI(nativePath, + x, + y, + width, + height)); + } + + // float version + Status AddPie(IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, + sweepAngle); + } + + Status AddPie(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathPie(nativePath, x, y, width, height, + startAngle, sweepAngle)); + } + + // integer version + Status AddPie(IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddPie(rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status AddPie(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathPieI(nativePath, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // float version + Status AddPolygon(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathPolygon(nativePath, points, count)); + } + + // integer version + Status AddPolygon(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathPolygonI(nativePath, points, count)); + } + + Status AddPath(IN const GraphicsPath* addingPath, + IN BOOL connect) + { + GpPath* nativePath2 = NULL; + if(addingPath) + nativePath2 = addingPath->nativePath; + + return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect)); + } + + // AddString point version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const PointF &origin, + IN const StringFormat *format + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipAddPathString( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &rect, + format ? format->nativeFormat : NULL + )); + } + + // AddString rectangle version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const RectF &layoutRect, + IN const StringFormat *format + ) + { + return SetStatus(DllExports::GdipAddPathString( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &layoutRect, + format ? format->nativeFormat : NULL + )); + } + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const Point &origin, + IN const StringFormat *format + ) + { + Rect rect(origin.X, origin.Y, 0, 0); + + return SetStatus(DllExports::GdipAddPathStringI( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &rect, + format ? format->nativeFormat : NULL + )); + } + + // AddString rectangle version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const Rect &layoutRect, + IN const StringFormat *format + ) + { + return SetStatus(DllExports::GdipAddPathStringI( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &layoutRect, + format ? format->nativeFormat : NULL + )); + } + + /** + * Transforms the path object + */ + Status Transform(IN const Matrix* matrix) + { + if(matrix) + return SetStatus(DllExports::GdipTransformPath(nativePath, matrix->nativeMatrix)); + else + return Ok; // No need to transform. + } + + /** + * Get the bounds of the path object with the given transform. + * This is not always the tightest bounds. + * + * Defined in GdiplusGraphics.h. + */ + Status GetBounds(OUT RectF* bounds, + IN const Matrix* matrix = NULL, + IN const Pen* pen = NULL) const; + + // integer version (defined in GdiplusGraphics.h) + Status GetBounds(OUT Rect* bounds, + IN const Matrix* matrix = NULL, + IN const Pen* pen = NULL) const; + + /** + * Flatten the path object + * Once this is called, the resultant path is made of line segments and + * the original path information is lost. + * When matrix = NULL, the identity matrix is assumed. + */ + Status Flatten(IN const Matrix* matrix = NULL, + IN REAL flatness = FlatnessDefault) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + { + nativeMatrix = matrix->nativeMatrix; + } + + return SetStatus(DllExports::GdipFlattenPath( + nativePath, + nativeMatrix, + flatness + )); + } + +#ifdef DCR_USE_NEW_202903 + + Status Widen( + IN const Pen* pen, + IN const Matrix* matrix = NULL, + IN REAL flatness = FlatnessDefault + ) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPath( + nativePath, + pen->nativePen, + nativeMatrix, + flatness + )); + } + +#else + + /** + * Widen the path object + * When removeSelfIntersects is TRUE, this returns the widened path + * without self intersections. + * When it is FALSE, it returns the widened path with selfintersections. + * The latter is faster and is usually safficient for filling. + */ + Status Widen(IN const Pen* pen, + IN const Matrix* matrix = NULL, + IN BOOL removeSelfIntersects = TRUE) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, + 0, 0, nativeMatrix, removeSelfIntersects)); + } + + /** + * Widen the path object + * This is equivalent to Widen() method except that + * The widths of the widened path are larger than the given + * minimum resolutions in x and y coordinates after the transform. + * This is usefull when widening a path with the limited device resolutions. + */ + + Status Widen(IN const Pen* pen, + IN REAL minXres, + IN REAL minYres, + IN const Matrix* matrix = NULL, + IN BOOL removeSelfIntersects = TRUE) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, + minXres, minYres, nativeMatrix, removeSelfIntersects)); + } + +#endif // DCR_USE_NEW_202903 + + Status Outline( + IN const Matrix *matrix = NULL, + IN REAL flatness = FlatnessDefault + ) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + { + nativeMatrix = matrix->nativeMatrix; + } + + return SetStatus(DllExports::GdipWindingModeOutline( + nativePath, nativeMatrix, flatness + )); + } + + /** + * Warp the path object + * Once this is called, the resultant path is made of line segments and + * the original path information is lost. + * When matrix = NULL, the identity matrix is assumed. + */ + Status Warp(IN const PointF* destPoints, + IN INT count, + IN const RectF& srcRect, + IN const Matrix* matrix = NULL, + IN WarpMode warpMode = WarpModePerspective, + IN REAL flatness = FlatnessDefault) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWarpPath( + nativePath, + nativeMatrix, + destPoints, + count, + srcRect.X, + srcRect.Y, + srcRect.Width, + srcRect.Height, + warpMode, + flatness)); + } + + /** + * Return the number of points in the current path + */ + INT GetPointCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPointCount(nativePath, &count)); + + return count; + } + + /** + * Return the path point type information + */ + Status GetPathTypes(OUT BYTE* types, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathTypes(nativePath, types, count)); + } + + /** + * Return the path point coordinate information + * @notes Should there be PathData that contains types[] and points[] + * for get & set purposes. + */ + Status GetPathPoints(OUT PointF* points, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathPoints(nativePath, points, count)); + } + + // integer version + Status GetPathPoints(OUT Point* points, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathPointsI(nativePath, points, count)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + + /** + * Hit testing operations + * + * inline implementation is in gdiplusgraphics.h. + */ + + BOOL IsVisible(IN const PointF& point, + IN const Graphics* g = NULL) const + { + return IsVisible(point.X, point.Y, g); + } + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN const Graphics* g = NULL) const; + + BOOL IsVisible(IN const Point& point, + IN const Graphics* g = NULL) const + { + return IsVisible(point.X, point.Y, g); + } + + BOOL IsVisible(IN INT x, + IN INT y, + IN const Graphics* g = NULL) const; + + BOOL IsOutlineVisible(IN const PointF& point, + IN const Pen* pen, + IN const Graphics* g = NULL) const + { + return IsOutlineVisible(point.X, point.Y, pen, g); + } + + BOOL IsOutlineVisible(IN REAL x, + IN REAL y, + IN const Pen* pen, + IN const Graphics* g = NULL) const; + + BOOL IsOutlineVisible(IN const Point& point, + IN const Pen* pen, + IN const Graphics* g = NULL) const + { + return IsOutlineVisible(point.X, point.Y, pen, g); + } + + BOOL IsOutlineVisible(IN INT x, + IN INT y, + IN const Pen* pen, + IN const Graphics* g = NULL) const; + +protected: + + GraphicsPath(const GraphicsPath& path) + { + GpPath *clonepath = NULL; + SetStatus(DllExports::GdipClonePath(path.nativePath, &clonepath)); + SetNativePath(clonepath); + } + +#ifdef DCR_USE_NEW_250932 + +private: + GraphicsPath& operator=(const GraphicsPath &); +protected: + +#else + + GraphicsPath& operator=(const GraphicsPath& path) + { + path; + SetStatus(NotImplemented); + return *this; + } + +#endif + + GraphicsPath(GpPath* nativePath) + { + lastResult = Ok; + SetNativePath(nativePath); + } + + VOID SetNativePath(GpPath *nativePath) + { + this->nativePath = nativePath; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPath* nativePath; + mutable Status lastResult; +}; + + +//-------------------------------------------------------------------------- +// GraphisPathIterator class +//-------------------------------------------------------------------------- + +class GraphicsPathIterator : public GdiplusBase +{ +public: + + GraphicsPathIterator(IN const GraphicsPath* path) + { + GpPath* nativePath = NULL; + if(path) + nativePath = path->nativePath; + + GpPathIterator *iter = NULL; + lastResult = DllExports::GdipCreatePathIter(&iter, nativePath); + SetNativeIterator(iter); + } + + ~GraphicsPathIterator() + { + DllExports::GdipDeletePathIter(nativeIterator); + } + + + INT NextSubpath(OUT INT* startIndex, + OUT INT* endIndex, + OUT BOOL* isClosed) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextSubpath(nativeIterator, + &resultCount, startIndex, endIndex, isClosed)); + + return resultCount; + } + + + INT NextSubpath(IN const GraphicsPath* path, + OUT BOOL* isClosed) + { + GpPath* nativePath = NULL; + + INT resultCount; + + if(path) + nativePath= path->nativePath; + + SetStatus(DllExports::GdipPathIterNextSubpathPath(nativeIterator, + &resultCount, nativePath, isClosed)); + + return resultCount; + } + + INT NextPathType(OUT BYTE* pathType, + OUT INT* startIndex, + OUT INT* endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextPathType(nativeIterator, + &resultCount, pathType, startIndex, endIndex)); + + return resultCount; + } + + INT NextMarker(OUT INT* startIndex, + OUT INT* endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextMarker(nativeIterator, + &resultCount, startIndex, endIndex)); + + return resultCount; + } + + + INT NextMarker(IN const GraphicsPath* path) + { + GpPath* nativePath = NULL; + + INT resultCount; + + if(path) + nativePath= path->nativePath; + + SetStatus(DllExports::GdipPathIterNextMarkerPath(nativeIterator, + &resultCount, nativePath)); + + return resultCount; + } + + INT GetCount() const + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterGetCount(nativeIterator, &resultCount)); + + return resultCount; + } + + INT GetSubpathCount() const + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterGetSubpathCount(nativeIterator, &resultCount)); + + return resultCount; + } + + BOOL HasCurve() const + { + BOOL hasCurve; + + SetStatus(DllExports::GdipPathIterHasCurve(nativeIterator, &hasCurve)); + + return hasCurve; + } + + VOID Rewind() + { + SetStatus(DllExports::GdipPathIterRewind(nativeIterator)); + } + + INT Enumerate(OUT PointF *points, + OUT BYTE *types, + IN INT count) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterEnumerate(nativeIterator, + &resultCount, points, types, count)); + + return resultCount; + } + + INT CopyData(OUT PointF* points, + OUT BYTE* types, + IN INT startIndex, + IN INT endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterCopyData(nativeIterator, + &resultCount, points, types, startIndex, endIndex)); + + return resultCount; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +#ifdef DCR_USE_NEW_250932 + +private: + GraphicsPathIterator(const GraphicsPathIterator &); + GraphicsPathIterator& operator=(const GraphicsPathIterator &); + +#endif + +protected: + VOID SetNativeIterator(GpPathIterator *nativeIterator) + { + this->nativeIterator = nativeIterator; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPathIterator* nativeIterator; + mutable Status lastResult; +}; + + +//-------------------------------------------------------------------------- +// Represent polygon gradient brush object +//-------------------------------------------------------------------------- + +class PathGradientBrush : public Brush +{ +public: + friend class Pen; + + PathGradientBrush( + IN const PointF* points, + IN INT count, + IN WrapMode wrapMode = WrapModeClamp) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradient( + points, count, + wrapMode, &brush); + SetNativeBrush(brush); + } + + PathGradientBrush( + IN const Point* points, + IN INT count, + IN WrapMode wrapMode = WrapModeClamp) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradientI( + points, count, + wrapMode, &brush); + + SetNativeBrush(brush); + } + + PathGradientBrush( + IN const GraphicsPath* path + ) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradientFromPath( + path->nativePath, &brush); + SetNativeBrush(brush); + } + + // Get/set colors + + Status GetCenterColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetPathGradientCenterColor( + (GpPathGradient*) nativeBrush, &argb)); + + color->SetValue(argb); + + return lastResult; + } + + Status SetCenterColor(IN const Color& color) + { + SetStatus(DllExports::GdipSetPathGradientCenterColor( + (GpPathGradient*) nativeBrush, + color.GetValue())); + + return lastResult; + } + + INT GetPointCount() const + { + INT count; + + SetStatus(DllExports::GdipGetPathGradientPointCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + INT GetSurroundColorCount() const + { + INT count; + + SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status GetSurroundColors(OUT Color* colors, + IN OUT INT* count) const + { + if(colors == NULL || count == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count1; + + SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( + (GpPathGradient*) nativeBrush, &count1)); + + if(lastResult != Ok) + return lastResult; + + if((*count < count1) || (count1 <= 0)) + return SetStatus(InsufficientBuffer); + + ARGB* argbs = (ARGB*) new ARGB[count1]; + if(argbs == NULL) + return SetStatus(OutOfMemory); + + SetStatus(DllExports::GdipGetPathGradientSurroundColorsWithCount( + (GpPathGradient*)nativeBrush, argbs, &count1)); + + if(lastResult == Ok) + { + for(INT i = 0; i < count1; i++) + { + colors[i].SetValue(argbs[i]); + } + *count = count1; + } + + delete [] argbs; + return lastResult; + } + + Status SetSurroundColors(IN const Color* colors, + IN OUT INT* count) + { + if(colors == NULL || count == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count1 = GetPointCount(); + + if((*count > count1) || (count1 <= 0)) + return SetStatus(InvalidParameter); + + count1 = *count; + + ARGB* argbs = (ARGB*) new ARGB[count1]; + if(argbs == NULL) + return SetStatus(OutOfMemory); + + for(INT i = 0; i < count1; i++) + { + argbs[i] = colors[i].GetValue(); + } + + SetStatus(DllExports::GdipSetPathGradientSurroundColorsWithCount( + (GpPathGradient*)nativeBrush, argbs, &count1)); + + if(lastResult == Ok) + *count = count1; + + delete [] argbs; + + return lastResult; + } + + Status GetGraphicsPath(OUT GraphicsPath* path) const + { + if(path == NULL) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPathGradientPath( + (GpPathGradient*)nativeBrush, path->nativePath)); + } + + Status SetGraphicsPath(IN const GraphicsPath* path) + { + if(path == NULL) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipSetPathGradientPath( + (GpPathGradient*)nativeBrush, path->nativePath)); + } + + Status GetCenterPoint(OUT PointF* point) const + { + return SetStatus(DllExports::GdipGetPathGradientCenterPoint( + (GpPathGradient*)nativeBrush, + point)); + } + + + Status GetCenterPoint(OUT Point* point) const + { + return SetStatus(DllExports::GdipGetPathGradientCenterPointI( + (GpPathGradient*)nativeBrush, + point)); + } + + Status SetCenterPoint(IN const PointF& point) + { + return SetStatus(DllExports::GdipSetPathGradientCenterPoint( + (GpPathGradient*)nativeBrush, + &point)); + } + + Status SetCenterPoint(IN const Point& point) + { + return SetStatus(DllExports::GdipSetPathGradientCenterPointI( + (GpPathGradient*)nativeBrush, + &point)); + } + + Status GetRectangle(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetPathGradientRect( + (GpPathGradient*)nativeBrush, rect)); + } + + Status GetRectangle(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetPathGradientRectI( + (GpPathGradient*)nativeBrush, rect)); + } + + // Gamma correction. + + Status SetGammaCorrection(IN BOOL useGammaCorrection) + { + return SetStatus(DllExports::GdipSetPathGradientGammaCorrection( + (GpPathGradient*)nativeBrush, useGammaCorrection)); + } + + BOOL GetGammaCorrection() const + { + BOOL useGammaCorrection; + + SetStatus(DllExports::GdipGetPathGradientGammaCorrection( + (GpPathGradient*)nativeBrush, &useGammaCorrection)); + + return useGammaCorrection; + } + + INT GetBlendCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPathGradientBlendCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status GetBlend(OUT REAL* blendFactors, + OUT REAL* blendPositions, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathGradientBlend( + (GpPathGradient*)nativeBrush, + blendFactors, blendPositions, count)); + } + + Status SetBlend(IN const REAL* blendFactors, + IN const REAL* blendPositions, + IN INT count) + { + return SetStatus(DllExports::GdipSetPathGradientBlend( + (GpPathGradient*)nativeBrush, + blendFactors, blendPositions, count)); + } + + INT GetInterpolationColorCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPathGradientPresetBlendCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status SetInterpolationColors(IN const Color* presetColors, + IN const REAL* blendPositions, + IN INT count) + { + if ((count <= 0) || !presetColors) + { + return SetStatus(InvalidParameter); + } + + ARGB* argbs = (ARGB*) new ARGB[count]; + if(argbs) + { + for(INT i = 0; i < count; i++) + { + argbs[i] = presetColors[i].GetValue(); + } + + Status status = SetStatus(DllExports::GdipSetPathGradientPresetBlend( + (GpPathGradient*) nativeBrush, + argbs, + blendPositions, + count)); + delete[] argbs; + return status; + } + else + { + return SetStatus(OutOfMemory); + } + } + + Status GetInterpolationColors(OUT Color* presetColors, + OUT REAL* blendPositions, + IN INT count) const + { + if ((count <= 0) || !presetColors) + { + return SetStatus(InvalidParameter); + } + + ARGB* argbs = (ARGB*) new ARGB[count]; + + if (!argbs) + { + return SetStatus(OutOfMemory); + } + + GpStatus status = SetStatus(DllExports::GdipGetPathGradientPresetBlend( + (GpPathGradient*)nativeBrush, + argbs, + blendPositions, + count)); + + for(INT i = 0; i < count; i++) + { + presetColors[i] = Color(argbs[i]); + } + delete [] argbs; + + return status; + } + + Status SetBlendBellShape(IN REAL focus, + IN REAL scale = 1.0) + { + return SetStatus(DllExports::GdipSetPathGradientSigmaBlend( + (GpPathGradient*)nativeBrush, focus, scale)); + } + + #ifdef DCR_USE_NEW_145135 + Status SetBlendTriangularShape( + IN REAL focus, + IN REAL scale = 1.0 + ) + #else + Status SetBlendTrianglarShape(IN REAL focus, + IN REAL scale = 1.0) + #endif + { + return SetStatus(DllExports::GdipSetPathGradientLinearBlend( + (GpPathGradient*)nativeBrush, focus, scale)); + } + + /** + * Get/set brush transform + */ + Status GetTransform(OUT Matrix *matrix) const + { + return SetStatus(DllExports::GdipGetPathGradientTransform( + (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); + } + + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetPathGradientTransform( + (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetPathGradientTransform((GpPathGradient*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyPathGradientTransform((GpPathGradient*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslatePathGradientTransform((GpPathGradient*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScalePathGradientTransform((GpPathGradient*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotatePathGradientTransform((GpPathGradient*)nativeBrush, + angle, order)); + } + + /** + * Get/set brush focus scales + */ + Status GetFocusScales(OUT REAL* xScale, + OUT REAL* yScale) const + { + return SetStatus(DllExports::GdipGetPathGradientFocusScales( + (GpPathGradient*) nativeBrush, xScale, yScale)); + } + + Status SetFocusScales(IN REAL xScale, + IN REAL yScale) + { + return SetStatus(DllExports::GdipSetPathGradientFocusScales( + (GpPathGradient*) nativeBrush, xScale, yScale)); + } + + /** + * Get/set brush wrapping mode + */ + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetPathGradientWrapMode( + (GpPathGradient*) nativeBrush, &wrapMode)); + + return wrapMode; + } + + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetPathGradientWrapMode( + (GpPathGradient*) nativeBrush, wrapMode)); + } + +#ifdef DCR_USE_NEW_250932 + +private: + PathGradientBrush(const PathGradientBrush &); + PathGradientBrush& operator=(const PathGradientBrush &); + +#endif + +protected: + + PathGradientBrush() + { + } +}; + + +#endif // !_GRAPHICSPATH_HPP diff --git a/win32/gdiplus/include/GdiplusPen.h b/win32/gdiplus/include/GdiplusPen.h new file mode 100644 index 0000000..20653db --- /dev/null +++ b/win32/gdiplus/include/GdiplusPen.h @@ -0,0 +1,519 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusPen.h +* +* Abstract: +* +* Pen API related declarations +* +\**************************************************************************/ +#ifndef _GDIPLUSPEN_H +#define _GDIPLUSPEN_H + +//-------------------------------------------------------------------------- +// class for various pen types +//-------------------------------------------------------------------------- + +class Pen : public GdiplusBase +{ +public: + friend class GraphicsPath; + friend class Graphics; + + // abstract Clone() can't be implemented here because it can't + // new an object with pure virtual functions + + // Constructors + + Pen(IN const Color& color, + IN REAL width = 1.0f) + { + Unit unit = UnitWorld; + nativePen = NULL; + lastResult = DllExports::GdipCreatePen1(color.GetValue(), + width, unit, &nativePen); + } + + Pen(IN const Brush* brush, + IN REAL width = 1.0f) + { + Unit unit = UnitWorld; + nativePen = NULL; + lastResult = DllExports::GdipCreatePen2(brush->nativeBrush, + width, unit, &nativePen); + } + + ~Pen() + { + DllExports::GdipDeletePen(nativePen); + } + + Pen* Clone() const + { + GpPen *clonePen = NULL; + + lastResult = DllExports::GdipClonePen(nativePen, &clonePen); + + return new Pen(clonePen, lastResult); + } + + Status SetWidth(IN REAL width) + { + return SetStatus(DllExports::GdipSetPenWidth(nativePen, width)); + } + + REAL GetWidth() const + { + REAL width; + + SetStatus(DllExports::GdipGetPenWidth(nativePen, &width)); + + return width; + } + + // Set/get line caps: start, end, and dash + + // Line cap and join APIs by using LineCap and LineJoin enums. + + #ifdef DCR_USE_NEW_197819 + Status SetLineCap(IN LineCap startCap, + IN LineCap endCap, + IN DashCap dashCap) + { + return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen, + startCap, endCap, dashCap)); + } + #else + Status SetLineCap(IN LineCap startCap, + IN LineCap endCap, + IN LineCap dashCap) + { + return SetStatus(DllExports::GdipSetPenLineCap(nativePen, + startCap, endCap, dashCap)); + } + #endif // DCR_USE_NEW_197819 + + Status SetStartCap(IN LineCap startCap) + { + return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap)); + } + + Status SetEndCap(IN LineCap endCap) + { + return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap)); + } + + #ifdef DCR_USE_NEW_197819 + Status SetDashCap(IN DashCap dashCap) + { + return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen, + dashCap)); + } + #else + Status SetDashCap(IN LineCap dashCap) + { + return SetStatus(DllExports::GdipSetPenDashCap(nativePen, dashCap)); + } + #endif // DCR_USE_NEW_197819 + + LineCap GetStartCap() const + { + LineCap startCap; + + SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap)); + + return startCap; + } + + LineCap GetEndCap() const + { + LineCap endCap; + + SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap)); + + return endCap; + } + + #ifdef DCR_USE_NEW_197819 + DashCap GetDashCap() const + { + DashCap dashCap; + + SetStatus(DllExports::GdipGetPenDashCap197819(nativePen, + &dashCap)); + + return dashCap; + } + #else + LineCap GetDashCap() const + { + LineCap dashCap; + + SetStatus(DllExports::GdipGetPenDashCap(nativePen, &dashCap)); + + return dashCap; + } + #endif // DCR_USE_NEW_197819 + + + // Set/get line join + + Status SetLineJoin(IN LineJoin lineJoin) + { + return SetStatus(DllExports::GdipSetPenLineJoin(nativePen, lineJoin)); + } + + LineJoin GetLineJoin() const + { + LineJoin lineJoin; + + SetStatus(DllExports::GdipGetPenLineJoin(nativePen, &lineJoin)); + + return lineJoin; + } + + Status SetCustomStartCap(IN const CustomLineCap* customCap) + { + GpCustomLineCap* nativeCap = NULL; + if(customCap) + nativeCap = customCap->nativeCap; + + return SetStatus(DllExports::GdipSetPenCustomStartCap(nativePen, nativeCap)); + } + + Status GetCustomStartCap(OUT CustomLineCap* customCap) const + { + if(!customCap) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCustomStartCap(nativePen, &(customCap->nativeCap))); + } + + Status SetCustomEndCap(IN const CustomLineCap* customCap) + { + GpCustomLineCap* nativeCap = NULL; + if(customCap) + nativeCap = customCap->nativeCap; + + return SetStatus(DllExports::GdipSetPenCustomEndCap(nativePen, nativeCap)); + } + + Status GetCustomEndCap(OUT CustomLineCap* customCap) const + { + if(!customCap) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCustomEndCap(nativePen, &(customCap->nativeCap))); + } + + Status SetMiterLimit(IN REAL miterLimit) + { + return SetStatus(DllExports::GdipSetPenMiterLimit(nativePen, miterLimit)); + } + + REAL GetMiterLimit() const + { + REAL miterLimit; + + SetStatus(DllExports::GdipGetPenMiterLimit(nativePen, &miterLimit)); + + return miterLimit; + } + + // Set/get pen mode + Status SetAlignment(IN PenAlignment penAlignment) + { + return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment)); + } + + PenAlignment GetAlignment() const + { + PenAlignment penAlignment; + + SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment)); + + return penAlignment; + } + + // Set/get pen transform + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetPenTransform(nativePen, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetPenTransform(nativePen, matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetPenTransform(nativePen)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslatePenTransform(nativePen, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScalePenTransform(nativePen, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotatePenTransform(nativePen, + angle, order)); + } + + PenType GetPenType() const + { + PenType type; + SetStatus(DllExports::GdipGetPenFillType(nativePen, &type)); + + return type; + } + + Status SetColor(IN const Color& color) + { + return SetStatus(DllExports::GdipSetPenColor(nativePen, + color.GetValue())); + } + + Status SetBrush(IN const Brush* brush) + { + return SetStatus(DllExports::GdipSetPenBrushFill(nativePen, + brush->nativeBrush)); + } + + Status GetColor(OUT Color* color) const + { + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + PenType type = GetPenType(); + + if (type != PenTypeSolidColor) + { + return WrongState; + } + + ARGB argb; + + SetStatus(DllExports::GdipGetPenColor(nativePen, + &argb)); + if (lastResult == Ok) + { + color->SetValue(argb); + } + + return lastResult; + } + + Brush* GetBrush() const + { + PenType type = GetPenType(); + + Brush* brush = NULL; + + switch(type) + { + case PenTypeSolidColor: + brush = new SolidBrush(); + break; + + case PenTypeHatchFill: + brush = new HatchBrush(); + break; + + case PenTypeTextureFill: + brush = new TextureBrush(); + break; + + case PenTypePathGradient: + brush = new Brush(); + break; + + case PenTypeLinearGradient: + brush = new LinearGradientBrush(); + break; + + default: + break; + } + + if(brush) + { + GpBrush* nativeBrush; + + SetStatus(DllExports::GdipGetPenBrushFill(nativePen, &nativeBrush)); + brush->SetNativeBrush(nativeBrush); + } + + return brush; + } + + DashStyle GetDashStyle() const + { + DashStyle dashStyle; + + SetStatus(DllExports::GdipGetPenDashStyle(nativePen, &dashStyle)); + + return dashStyle; + } + + Status SetDashStyle(IN DashStyle dashStyle) + { + return SetStatus(DllExports::GdipSetPenDashStyle(nativePen, dashStyle)); + } + + REAL GetDashOffset() const + { + REAL dashOffset; + + SetStatus(DllExports::GdipGetPenDashOffset(nativePen, &dashOffset)); + + return dashOffset; + } + + Status SetDashOffset(IN REAL dashOffset) + { + return SetStatus(DllExports::GdipSetPenDashOffset(nativePen, dashOffset)); + } + + Status SetDashPattern(IN const REAL* dashArray, IN INT count) + { + return SetStatus(DllExports::GdipSetPenDashArray(nativePen, dashArray, + count)); + } + + INT GetDashPatternCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPenDashCount(nativePen, &count)); + + return count; + } + + Status GetDashPattern(OUT REAL* dashArray, + IN INT count) const + { + if (dashArray == NULL || count <= 0) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenDashArray(nativePen, + dashArray, + count)); + } + + Status SetCompoundArray(IN const REAL* compoundArray, + IN INT count) + { + return SetStatus(DllExports::GdipSetPenCompoundArray(nativePen, compoundArray, + count)); + } + + INT GetCompoundArrayCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPenCompoundCount(nativePen, &count)); + + return count; + } + + Status GetCompoundArray(OUT REAL* compoundArray, + IN INT count) const + { + if (compoundArray == NULL || count <= 0) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen, + compoundArray, + count)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Pen(const Pen &); + Pen& operator=(const Pen &); +protected: + +#else + + Pen(const Pen& pen) + { + pen; + SetStatus(NotImplemented); + SetNativePen(NULL); + } + + Pen& operator=(const Pen& pen) + { + pen; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Pen(GpPen* nativePen, Status status) + { + lastResult = status; + SetNativePen(nativePen); + } + + VOID SetNativePen(GpPen* nativePen) + { + this->nativePen = nativePen; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPen* nativePen; + mutable Status lastResult; +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusPixelFormats.h b/win32/gdiplus/include/GdiplusPixelFormats.h new file mode 100644 index 0000000..f9dc599 --- /dev/null +++ b/win32/gdiplus/include/GdiplusPixelFormats.h @@ -0,0 +1,201 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Gdiplus pixel formats +* +* Abstract: +* +* Definitions for color types, palettes, pixel format IDs. +* +\**************************************************************************/ + +#ifndef _GDIPLUSPIXELFORMATS_H +#define _GDIPLUSPIXELFORMATS_H + +/* + * 32-bit and 64-bit ARGB pixel value + */ + +typedef DWORD ARGB; +typedef DWORDLONG ARGB64; + +#define ALPHA_SHIFT 24 +#define RED_SHIFT 16 +#define GREEN_SHIFT 8 +#define BLUE_SHIFT 0 +#define ALPHA_MASK ((ARGB) 0xff << ALPHA_SHIFT) + +/* + * In-memory pixel data formats: + * bits 0-7 = format index + * bits 8-15 = pixel size (in bits) + * bits 16-23 = flags + * bits 24-31 = reserved + */ + +#ifndef DCR_USE_NEW_105760 + +enum PixelFormat +{ + PixelFormatIndexed = 0x00010000, // Indexes into a palette + PixelFormatGDI = 0x00020000, // Is a GDI-supported format + PixelFormatAlpha = 0x00040000, // Has an alpha component + PixelFormatPAlpha = 0x00080000, // Uses pre-multiplied alpha + PixelFormatExtended = 0x00100000, // Uses extended color (16 bits per channel) + PixelFormatCanonical = 0x00200000, // ? + + PixelFormatUndefined = 0, + PixelFormatDontCare = 0, + + PixelFormat1bppIndexed = 1 | ( 1 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat4bppIndexed = 2 | ( 4 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat8bppIndexed = 3 | ( 8 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat16bppGrayScale = 4 | (16 << 8) | PixelFormatExtended, + PixelFormat16bppRGB555 = 5 | (16 << 8) | PixelFormatGDI, + PixelFormat16bppRGB565 = 6 | (16 << 8) | PixelFormatGDI, + PixelFormat16bppARGB1555 = 7 | (16 << 8) | PixelFormatAlpha + | PixelFormatGDI, + PixelFormat24bppRGB = 8 | (24 << 8) | PixelFormatGDI, + PixelFormat32bppRGB = 9 | (32 << 8) | PixelFormatGDI, + PixelFormat32bppARGB = 10 | (32 << 8) | PixelFormatAlpha + | PixelFormatGDI + | PixelFormatCanonical, + PixelFormat32bppPARGB = 11 | (32 << 8) | PixelFormatAlpha + | PixelFormatPAlpha + | PixelFormatGDI, + PixelFormat48bppRGB = 12 | (48 << 8) | PixelFormatExtended, + PixelFormat64bppARGB = 13 | (64 << 8) | PixelFormatAlpha + | PixelFormatCanonical + | PixelFormatExtended, + PixelFormat64bppPARGB = 14 | (64 << 8) | PixelFormatAlpha + | PixelFormatPAlpha + | PixelFormatExtended, + PixelFormat24bppBGR = 15 | (24 << 8) | PixelFormatGDI, + PixelFormatMax = 16 +}; + +#else + +typedef INT PixelFormat; + +#define PixelFormatIndexed 0x00010000 // Indexes into a palette +#define PixelFormatGDI 0x00020000 // Is a GDI-supported format +#define PixelFormatAlpha 0x00040000 // Has an alpha component +#define PixelFormatPAlpha 0x00080000 // Uses pre-multiplied alpha +#define PixelFormatExtended 0x00100000 // Uses extended color (16 bits per channel) +#define PixelFormatCanonical 0x00200000 // ? + +#define PixelFormatUndefined 0 +#define PixelFormatDontCare 0 + +#define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended) +#define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI) +#define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI) +#define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI) +#define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI) +#define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI) +#define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical) +#define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI) +#define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended) +#define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended) +#define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended) +#define PixelFormatMax 15 + +#endif + + +/* + * Return the pixel size for the specified format (in bits) + */ + +inline UINT +GetPixelFormatSize( + PixelFormat pixfmt + ) +{ + return (pixfmt >> 8) & 0xff; +} + +/* + * Determine if the specified pixel format is an indexed color format + */ + +inline BOOL +IsIndexedPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatIndexed) != 0; +} + +/* + * Determine if the pixel format can have alpha channel + */ + +inline BOOL +IsAlphaPixelFormat( + PixelFormat pixfmt +) +{ + return (pixfmt & PixelFormatAlpha) != 0; +} + +/* + * Determine if the pixel format is an extended format, + * i.e. supports 16-bit per channel + */ + +inline BOOL +IsExtendedPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatExtended) != 0; +} + +/* + * Determine if the pixel format is canonical format: + * PixelFormat32bppARGB + * PixelFormat32bppPARGB + * PixelFormat64bppARGB + * PixelFormat64bppPARGB + */ + +inline BOOL +IsCanonicalPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatCanonical) != 0; +} + +/* + * Color palette + * palette entries are limited to 32bpp ARGB pixel format + */ + +enum PaletteFlags +{ + PaletteFlagsHasAlpha = 0x0001, + PaletteFlagsGrayScale = 0x0002, + PaletteFlagsHalftone = 0x0004 +}; + +struct ColorPalette +{ +public: + UINT Flags; // palette flags + UINT Count; // number of color entries + ARGB Entries[1]; // palette color entries +}; + +#endif diff --git a/win32/gdiplus/include/GdiplusRegion.h b/win32/gdiplus/include/GdiplusRegion.h new file mode 100644 index 0000000..dd1d20e --- /dev/null +++ b/win32/gdiplus/include/GdiplusRegion.h @@ -0,0 +1,498 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusRegion.h +* +* Abstract: +* +* Region API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSREGION_H +#define _GDIPLUSREGION_H + +/** + * Construct a new region object + */ + +inline +Region::Region() +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegion(®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const RectF& rect) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRect(&rect, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const Rect& rect) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRectI(&rect, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const GraphicsPath* path) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionPath(path->nativePath, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const BYTE* regionData, IN INT size) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRgnData(regionData, size, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN HRGN hRgn) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionHrgn(hRgn, ®ion); + + SetNativeRegion(region); +} + +inline +Region* Region::FromHRGN(IN HRGN hRgn) +{ + GpRegion *region = NULL; + + if (DllExports::GdipCreateRegionHrgn(hRgn, ®ion) == Ok) + { + Region* newRegion = new Region(region); + + if (newRegion == NULL) + { + DllExports::GdipDeleteRegion(region); + } + + return newRegion; + } + else + return NULL; +} + +inline +Region::~Region() +{ + DllExports::GdipDeleteRegion(nativeRegion); +} + +/** + * Make a copy of the region object + */ +inline Region* +Region::Clone() const +{ + GpRegion *region = NULL; + + SetStatus(DllExports::GdipCloneRegion(nativeRegion, ®ion)); + + return new Region(region); +} + +inline Status +Region::MakeInfinite() +{ + return SetStatus(DllExports::GdipSetInfinite(nativeRegion)); +} + +inline Status +Region::MakeEmpty() +{ + return SetStatus(DllExports::GdipSetEmpty(nativeRegion)); +} + +/** + * Region operations + */ +inline Status +Region::Intersect(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeIntersect)); +} + +inline Status +Region::Union(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeUnion)); +} + +inline Status +Region::Union(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeUnion)); +} + +inline Status +Region::Union(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeUnion)); +} + +inline Status +Region::Union(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeUnion)); +} + +inline Status +Region::Xor(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeXor)); +} + +inline Status +Region::Xor(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeXor)); +} + +inline Status +Region::Xor(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeXor)); +} + +inline Status +Region::Xor(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeXor)); +} + +inline Status +Region::Exclude(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, + region->nativeRegion, CombineModeExclude)); +} + +inline Status +Region::Complement(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, + path->nativePath, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, + region->nativeRegion, CombineModeComplement)); +} + +/** + * Transform operations + */ +inline Status +Region::Translate(IN REAL dx, + IN REAL dy) +{ + return SetStatus(DllExports::GdipTranslateRegion(nativeRegion, dx, dy)); +} + +inline Status +Region::Translate(IN INT dx, + IN INT dy) +{ + return SetStatus(DllExports::GdipTranslateRegionI(nativeRegion, dx, dy)); +} + +inline Status +Region::Transform(IN const Matrix* matrix) +{ + return SetStatus(DllExports::GdipTransformRegion(nativeRegion, matrix->nativeMatrix)); +} + +/** + * Get region attributes + */ +inline Status +Region::GetBounds(OUT RectF* rect, + IN const Graphics* g) const +{ + return SetStatus(DllExports::GdipGetRegionBounds(nativeRegion, + g->nativeGraphics, + rect)); +} + +inline Status +Region::GetBounds(OUT Rect* rect, + IN const Graphics* g) const +{ + return SetStatus(DllExports::GdipGetRegionBoundsI(nativeRegion, + g->nativeGraphics, + rect)); +} + +inline HRGN +Region::GetHRGN(IN const Graphics* g) const +{ + HRGN hrgn; + + SetStatus(DllExports::GdipGetRegionHRgn(nativeRegion, + g->nativeGraphics, + &hrgn)); + + return hrgn; +} + +inline BOOL +Region::IsEmpty(IN const Graphics *g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsEmptyRegion(nativeRegion, + g->nativeGraphics, + &booln)); + + return booln; +} + +inline BOOL +Region::IsInfinite(IN const Graphics *g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsInfiniteRegion(nativeRegion, + g->nativeGraphics, + &booln)); + + return booln; +} + +inline BOOL +Region::Equals(IN const Region* region, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsEqualRegion(nativeRegion, + region->nativeRegion, + g->nativeGraphics, + &booln)); + return booln; +} + +// Get the size of the buffer needed for the GetData method +inline UINT +Region::GetDataSize() const +{ + UINT bufferSize = 0; + + SetStatus(DllExports::GdipGetRegionDataSize(nativeRegion, &bufferSize)); + + return bufferSize; +} + +// buffer - where to put the data +// bufferSize - how big the buffer is (should be at least as big as GetDataSize()) +// sizeFilled - if not NULL, this is an OUT param that says how many bytes +// of data were written to the buffer. +inline Status +Region::GetData(OUT BYTE* buffer, + IN UINT bufferSize, + OUT UINT* sizeFilled) const +{ + return SetStatus(DllExports::GdipGetRegionData(nativeRegion, buffer, bufferSize, sizeFilled)); +} + +/** + * Hit testing operations + */ +inline BOOL +Region::IsVisible(IN const PointF& point, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionPoint(nativeRegion, + point.X, point.Y, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const RectF& rect, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionRect(nativeRegion, rect.X, + rect.Y, rect.Width, + rect.Height, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const Point& point, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + + SetStatus(DllExports::GdipIsVisibleRegionPointI(nativeRegion, + point.X, + point.Y, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const Rect& rect, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionRectI(nativeRegion, + rect.X, + rect.Y, + rect.Width, + rect.Height, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline UINT +Region::GetRegionScansCount(IN const Matrix* matrix) const +{ + UINT count = 0; + + SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion, + &count, + matrix->nativeMatrix)); + return count; +} + +inline Status +Region::GetRegionScans( + IN const Matrix* matrix, + OUT RectF* rects, + IN OUT INT* count) const +{ + return SetStatus(DllExports::GdipGetRegionScans(nativeRegion, + rects, + count, + matrix->nativeMatrix)); +} + +// If rects is NULL, return the count of rects in the region. +// Otherwise, assume rects is big enough to hold all the region rects +// and fill them in and return the number of rects filled in. +// The rects are returned in the units specified by the matrix +// (which is typically a world-to-device transform). +// Note that the number of rects returned can vary, depending on the +// matrix that is used. +inline Status +Region::GetRegionScans( + IN const Matrix* matrix, + OUT Rect* rects, // NULL to just get the count + IN OUT INT* count) const +{ + return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion, + rects, + count, + matrix->nativeMatrix)); +} + +// protected method +inline Region::Region(GpRegion* nativeRegion) +{ + SetNativeRegion(nativeRegion); +} + +// protected method +inline VOID Region::SetNativeRegion(GpRegion* nativeRegion) +{ + this->nativeRegion = nativeRegion; +} + +inline Status Region::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +#endif // !_GDIPLUSREGION_H diff --git a/win32/gdiplus/include/GdiplusStringFormat.h b/win32/gdiplus/include/GdiplusStringFormat.h new file mode 100644 index 0000000..f6a4518 --- /dev/null +++ b/win32/gdiplus/include/GdiplusStringFormat.h @@ -0,0 +1,381 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusStringFormat.h +* +* Abstract: +* +* String format specification for DrawString and text APIs +* +\**************************************************************************/ + +#ifndef _GDIPLUSSTRINGFORMAT_H +#define _GDIPLUSSTRINGFORMAT_H + + +class StringFormat : public GdiplusBase +{ +public: + friend class Graphics; + friend class GraphicsPath; + + + StringFormat( + IN INT formatFlags = 0, + IN LANGID language = LANG_NEUTRAL + ) + { + nativeFormat = NULL; + lastError = DllExports::GdipCreateStringFormat( + formatFlags, + language, + &nativeFormat + ); + } + + static const StringFormat *GenericDefault(); + static const StringFormat *GenericTypographic(); + + // Constructor based on existing string format + + StringFormat( + IN const StringFormat *format + ) + { + nativeFormat = NULL; + lastError = DllExports::GdipCloneStringFormat( + format ? format->nativeFormat : NULL, + &nativeFormat + ); + } + + StringFormat *Clone() const + { + GpStringFormat *clonedStringFormat = NULL; + + lastError = DllExports::GdipCloneStringFormat( + nativeFormat, + &clonedStringFormat + ); + + if (lastError == Ok) + return new StringFormat(clonedStringFormat, lastError); + else + return NULL; + } + + ~StringFormat() + { + DllExports::GdipDeleteStringFormat(nativeFormat); + } + + Status SetFormatFlags(IN INT flags) + { + return SetStatus(DllExports::GdipSetStringFormatFlags( + nativeFormat, + flags + )); + } + + INT GetFormatFlags() const + { + INT flags; + SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags)); + return flags; + } + +#ifndef DCR_USE_NEW_152154 + Status SetLineSpacing( + IN REAL amount = 1.0f, + IN LineSpacing method = LineSpacingRecommended + ) + { + return SetStatus(DllExports::GdipSetStringFormatLineSpacing( + nativeFormat, + amount, + method + )); + } +#endif + + Status SetAlignment(IN StringAlignment align) + { + return SetStatus(DllExports::GdipSetStringFormatAlign( + nativeFormat, + align + )); + } + + StringAlignment GetAlignment() const + { + StringAlignment alignment; + SetStatus(DllExports::GdipGetStringFormatAlign( + nativeFormat, + &alignment + )); + return alignment; + } + + Status SetLineAlignment(IN StringAlignment align) + { + return SetStatus(DllExports::GdipSetStringFormatLineAlign( + nativeFormat, + align + )); + } + + StringAlignment GetLineAlignment() const + { + StringAlignment alignment; + SetStatus(DllExports::GdipGetStringFormatLineAlign( + nativeFormat, + &alignment + )); + return alignment; + } + + Status SetHotkeyPrefix(IN HotkeyPrefix hotkeyPrefix) + { + return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix( + nativeFormat, + (INT)hotkeyPrefix + )); + } + + HotkeyPrefix GetHotkeyPrefix() const + { + HotkeyPrefix hotkeyPrefix; + SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix( + nativeFormat, + (INT*)&hotkeyPrefix + )); + return hotkeyPrefix; + } + + Status SetTabStops( + IN REAL firstTabOffset, + IN INT count, + IN const REAL *tabStops + ) + { + return SetStatus(DllExports::GdipSetStringFormatTabStops( + nativeFormat, + firstTabOffset, + count, + tabStops + )); + } + + INT GetTabStopCount() const + { + INT count; + SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count)); + return count; + } + + Status GetTabStops( + IN INT count, + OUT REAL *firstTabOffset, + OUT REAL *tabStops + ) const + { + return SetStatus(DllExports::GdipGetStringFormatTabStops( + nativeFormat, + count, + firstTabOffset, + tabStops + )); + } + +#ifdef DCR_USE_NEW_146933 + Status SetDigitSubstitution( + IN LANGID language, + IN StringDigitSubstitute substitute + ) + { + return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution( + nativeFormat, + language, + substitute + )); + } + + LANGID GetDigitSubstitutionLanguage( + ) const + { + LANGID language; + SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( + nativeFormat, + &language, + NULL + )); + return language; + } + + StringDigitSubstitute GetDigitSubstitutionMethod( + ) const + { + StringDigitSubstitute substitute; + SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( + nativeFormat, + NULL, + &substitute + )); + return substitute; + } +#endif // DCR_USE_NEW_146933 + + // String trimming. How to handle more text than can be displayed + // in the limits available. + + Status SetTrimming(IN StringTrimming trimming) + { + return SetStatus(DllExports::GdipSetStringFormatTrimming( + nativeFormat, + trimming + )); + } + + StringTrimming GetTrimming() const + { + StringTrimming trimming; + SetStatus(DllExports::GdipGetStringFormatTrimming( + nativeFormat, + &trimming + )); + return trimming; + } + +#ifdef DCR_USE_NEW_174340 + Status SetMeasurableCharacterRanges( + IN INT rangeCount, + IN const CharacterRange *ranges + ) + { + return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges( + nativeFormat, + rangeCount, + ranges + )); + } + + INT GetMeasurableCharacterRangeCount() + { + INT count; + SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount( + nativeFormat, + &count + )); + return count; + } +#endif + + // GetLastStatus - return last error code and clear error code + + Status GetLastStatus() const + { + Status lastStatus = lastError; + lastError = Ok; + + return lastStatus; + } + +protected: + + Status SetStatus(GpStatus newStatus) const + { + if (newStatus == Ok) + { + return Ok; + } + else + { + return lastError = newStatus; + } + } + + +// Not allowed and move to private + StringFormat(const StringFormat &source) + { + nativeFormat = NULL; + lastError = DllExports::GdipCloneStringFormat( + source.nativeFormat, + &nativeFormat + ); + } + + StringFormat& operator=(const StringFormat &source) + { + DllExports::GdipDeleteStringFormat(nativeFormat); + lastError = DllExports::GdipCloneStringFormat( + source.nativeFormat, + &nativeFormat + ); + return *this; + } + + + // private constructor for copy + StringFormat(GpStringFormat * clonedStringFormat, Status status) + { + lastError = status; + nativeFormat = clonedStringFormat; + + } + + GpStringFormat *nativeFormat; + mutable Status lastError; +}; + +// Generic constant string formats. + +static BYTE GenericTypographicStringFormatBuffer[sizeof(StringFormat)] = {0}; +static BYTE GenericDefaultStringFormatBuffer[sizeof(StringFormat)] = {0}; + +static StringFormat *GenericTypographicStringFormat = NULL; +static StringFormat *GenericDefaultStringFormat = NULL; + +// Define the generic string formats + + +inline const StringFormat *StringFormat::GenericDefault() +{ + if (GenericDefaultStringFormat != NULL) + { + return GenericDefaultStringFormat; + } + + GenericDefaultStringFormat = + (StringFormat*)GenericDefaultStringFormatBuffer; + + GenericDefaultStringFormat->lastError = + DllExports::GdipStringFormatGetGenericDefault( + &(GenericDefaultStringFormat->nativeFormat) + ); + + return GenericDefaultStringFormat; +} + +inline const StringFormat *StringFormat::GenericTypographic() +{ + if (GenericTypographicStringFormat != NULL) + { + return GenericTypographicStringFormat; + } + + GenericTypographicStringFormat = + (StringFormat*)GenericTypographicStringFormatBuffer; + + GenericTypographicStringFormat->lastError = + DllExports::GdipStringFormatGetGenericTypographic( + &GenericTypographicStringFormat->nativeFormat + ); + + return GenericTypographicStringFormat; +} + +#endif // !_GDIPLUSSTRINGFORMAT_H diff --git a/win32/gdiplus/include/GdiplusTypes.h b/win32/gdiplus/include/GdiplusTypes.h new file mode 100644 index 0000000..58c584d --- /dev/null +++ b/win32/gdiplus/include/GdiplusTypes.h @@ -0,0 +1,826 @@ +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusTypes.h +* +* Abstract: +* +* Basic types used by GDI+ +* +\**************************************************************************/ + +#ifndef _GDIPLUSTYPES_H +#define _GDIPLUSTYPES_H + +#ifndef DCR_USE_NEW_175866 + +//-------------------------------------------------------------------------- +// LIB version initialization functions +//-------------------------------------------------------------------------- + +typedef VOID (__cdecl *DEBUGEVENTFUNCTION)(INT level, CHAR *message); + +extern "C" BOOL __stdcall InitializeGdiplus(DEBUGEVENTFUNCTION); +extern "C" VOID __stdcall UninitializeGdiplus(); + +#endif + +//-------------------------------------------------------------------------- +// Callback functions +//-------------------------------------------------------------------------- + +extern "C" { +typedef BOOL (CALLBACK * ImageAbort)(VOID *); +typedef ImageAbort DrawImageAbort; +typedef ImageAbort GetThumbnailImageAbort; +} + +// Callback for EnumerateMetafile methods. The parameters are: + +// recordType WMF, EMF, or EMF+ record type +// flags (always 0 for WMF/EMF records) +// dataSize size of the record data (in bytes), or 0 if no data +// data pointer to the record data, or NULL if no data +// callbackData pointer to callbackData, if any + +// This method can then call Metafile::PlayRecord to play the +// record that was just enumerated. If this method returns +// FALSE, the enumeration process is aborted. Otherwise, it continues. + +extern "C" { +typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*); +} + +//-------------------------------------------------------------------------- +// Primitive data types +// +// NOTE: +// Types already defined in standard header files: +// INT8 +// UINT8 +// INT16 +// UINT16 +// INT32 +// UINT32 +// INT64 +// UINT64 +// +// Avoid using the following types: +// LONG - use INT +// ULONG - use UINT +// DWORD - use UINT32 +//-------------------------------------------------------------------------- + +typedef float REAL; + +#define REAL_MAX FLT_MAX +#define REAL_MIN FLT_MIN +#define REAL_TOLERANCE (FLT_MIN * 100) +#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */ + +//-------------------------------------------------------------------------- +// Forward declarations of various internal classes +//-------------------------------------------------------------------------- + +class Size; +class SizeF; +class Point; +class PointF; +class Rect; +class RectF; +class CharacterRange; + +//-------------------------------------------------------------------------- +// Return values from any GDI+ API +//-------------------------------------------------------------------------- + +enum Status +{ + Ok = 0, + GenericError = 1, + InvalidParameter = 2, + OutOfMemory = 3, + ObjectBusy = 4, + InsufficientBuffer = 5, + NotImplemented = 6, + Win32Error = 7, + WrongState = 8, + Aborted = 9, +#ifdef DCR_USE_NEW_135429 + FileNotFound = 10, + ValueOverflow = 11, + AccessDenied = 12, + UnknownImageFormat = 13, + FontFamilyNotFound = 14, + FontStyleNotFound = 15, + NotTrueTypeFont = 16, +#else + NotFound = 10, + ValueOverflow = 11, +#endif + UnsupportedGdiplusVersion = 17, + GdiplusNotInitialized + +}; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class SizeF +{ +public: + + // Default constructor + SizeF() + { + Width = Height = 0.0f; + } + + SizeF(IN const SizeF& size) + { + Width = size.Width; + Height = size.Height; + } + + SizeF(IN REAL width, + IN REAL height) + { + Width = width; + Height = height; + } + + SizeF operator+(IN const SizeF& sz) const + { + return SizeF(Width + sz.Width, + Height + sz.Height); + } + + SizeF operator-(IN const SizeF& sz) const + { + return SizeF(Width - sz.Width, + Height - sz.Height); + } + + BOOL Equals(IN const SizeF& sz) const + { + return (Width == sz.Width) && (Height == sz.Height); + } + + BOOL Empty() const + { + return (Width == 0.0f && Height == 0.0f); + } + +public: + + REAL Width; + REAL Height; +}; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Size +{ +public: + + // Default constructor + Size() + { + Width = Height = 0; + } + + Size(IN const Size& size) + { + Width = size.Width; + Height = size.Height; + } + + Size(IN INT width, + IN INT height) + { + Width = width; + Height = height; + } + + Size operator+(IN const Size& sz) const + { + return Size(Width + sz.Width, + Height + sz.Height); + } + + Size operator-(IN const Size& sz) const + { + return Size(Width - sz.Width, + Height - sz.Height); + } + + BOOL Equals(IN const Size& sz) const + { + return (Width == sz.Width) && (Height == sz.Height); + } + + BOOL Empty() const + { + return (Width == 0 && Height == 0); + } + +public: + + INT Width; + INT Height; +}; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class PointF +{ +public: + PointF() + { + X = Y = 0.0f; + } + + PointF(IN const PointF &point) + { + X = point.X; + Y = point.Y; + } + + PointF(IN const SizeF &size) + { + X = size.Width; + Y = size.Height; + } + + PointF(IN REAL x, + IN REAL y) + { + X = x; + Y = y; + } + + PointF operator+(IN const PointF& point) const + { + return PointF(X + point.X, + Y + point.Y); + } + + PointF operator-(IN const PointF& point) const + { + return PointF(X - point.X, + Y - point.Y); + } + + BOOL Equals(IN const PointF& point) + { + return (X == point.X) && (Y == point.Y); + } + +public: + + REAL X; + REAL Y; +}; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Point +{ +public: + Point() + { + X = Y = 0; + } + + Point(IN const Point &point) + { + X = point.X; + Y = point.Y; + } + + Point(IN const Size &size) + { + X = size.Width; + Y = size.Height; + } + + Point(IN INT x, + IN INT y) + { + X = x; + Y = y; + } + + Point operator+(IN const Point& point) const + { + return Point(X + point.X, + Y + point.Y); + } + + Point operator-(IN const Point& point) const + { + return Point(X - point.X, + Y - point.Y); + } + + BOOL Equals(IN const Point& point) + { + return (X == point.X) && (Y == point.Y); + } + +public: + + INT X; + INT Y; +}; + +//-------------------------------------------------------------------------- +// Represents a rectangle in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class RectF +{ +public: + + // Default constructor + + RectF() + { + X = Y = Width = Height = 0.0f; + } + + RectF(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + RectF(IN const PointF& location, + IN const SizeF& size) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + RectF* Clone() const + { + return new RectF(X, Y, Width, Height); + } + + VOID GetLocation(OUT PointF* point) const + { + point->X = X; + point->Y = Y; + } + + VOID GetSize(OUT SizeF* size) const + { + size->Width = Width; + size->Height = Height; + } + + VOID GetBounds(OUT RectF* rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Return the left, top, right, and bottom + // coordinates of the rectangle + + REAL GetLeft() const + { + return X; + } + + REAL GetTop() const + { + return Y; + } + + REAL GetRight() const + { + return X+Width; + } + + REAL GetBottom() const + { + return Y+Height; + } + + // Determine if the rectangle is empty + BOOL IsEmptyArea() const + { + return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON); + } + + BOOL Equals(IN const RectF & rect) const + { + return X == rect.X && + Y == rect.Y && + Width == rect.Width && + Height == rect.Height; + } + + BOOL Contains(IN REAL x, + IN REAL y) const + { + return x >= X && x < X+Width && + y >= Y && y < Y+Height; + } + + BOOL Contains(IN const PointF& pt) const + { + return Contains(pt.X, pt.Y); + } + + BOOL Contains(IN const RectF& rect) const + { + return (X <= rect.X) && (rect.GetRight() <= GetRight()) && + (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); + } + + VOID Inflate(IN REAL dx, + IN REAL dy) + { + X -= dx; + Y -= dy; + Width += 2*dx; + Height += 2*dy; + } + + VOID Inflate(IN const PointF& point) + { + Inflate(point.X, point.Y); + } + + // Intersect the current rect with the specified object + + BOOL Intersect(IN const RectF& rect) + { + return Intersect(*this, *this, rect); + } + + // Intersect rect a and b and save the result into c + // Notice that c may be the same object as a or b. + + static BOOL Intersect(OUT RectF& c, + IN const RectF& a, + IN const RectF& b) + { + REAL right = min(a.GetRight(), b.GetRight()); + REAL bottom = min(a.GetBottom(), b.GetBottom()); + REAL left = max(a.GetLeft(), b.GetLeft()); + REAL top = max(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + // Determine if the specified rect intersects with the + // current rect object. + + BOOL IntersectsWith(IN const RectF& rect) const + { + return (GetLeft() < rect.GetRight() && + GetTop() < rect.GetTop() && + GetRight() > rect.GetLeft() && + GetBottom() > rect.GetTop()); + } + + static BOOL Union(OUT RectF& c, + IN const RectF& a, + IN const RectF& b) + { + REAL right = max(a.GetRight(), b.GetRight()); + REAL bottom = max(a.GetBottom(), b.GetBottom()); + REAL left = min(a.GetLeft(), b.GetLeft()); + REAL top = min(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + VOID Offset(IN const PointF& point) + { + Offset(point.X, point.Y); + } + + VOID Offset(IN REAL dx, + IN REAL dy) + { + X += dx; + Y += dy; + } + +public: + + REAL X; + REAL Y; + REAL Width; + REAL Height; +}; + +//-------------------------------------------------------------------------- +// Represents a rectangle in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Rect +{ +public: + + // Default constructor + + Rect() + { + X = Y = Width = Height = 0; + } + + Rect(IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + Rect(IN const Point& location, + IN const Size& size) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + Rect* Clone() const + { + return new Rect(X, Y, Width, Height); + } + + VOID GetLocation(OUT Point* point) const + { + point->X = X; + point->Y = Y; + } + + VOID GetSize(OUT Size* size) const + { + size->Width = Width; + size->Height = Height; + } + + VOID GetBounds(OUT Rect* rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Return the left, top, right, and bottom + // coordinates of the rectangle + + INT GetLeft() const + { + return X; + } + + INT GetTop() const + { + return Y; + } + + INT GetRight() const + { + return X+Width; + } + + INT GetBottom() const + { + return Y+Height; + } + + // Determine if the rectangle is empty + BOOL IsEmptyArea() const + { + return (Width <= 0) || (Height <= 0); + } + + BOOL Equals(IN const Rect & rect) const + { + return X == rect.X && + Y == rect.Y && + Width == rect.Width && + Height == rect.Height; + } + + BOOL Contains(IN INT x, + IN INT y) const + { + return x >= X && x < X+Width && + y >= Y && y < Y+Height; + } + + BOOL Contains(IN const Point& pt) const + { + return Contains(pt.X, pt.Y); + } + + BOOL Contains(IN Rect& rect) const + { + return (X <= rect.X) && (rect.GetRight() <= GetRight()) && + (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); + } + + VOID Inflate(IN INT dx, + IN INT dy) + { + X -= dx; + Y -= dy; + Width += 2*dx; + Height += 2*dy; + } + + VOID Inflate(IN const Point& point) + { + Inflate(point.X, point.Y); + } + + // Intersect the current rect with the specified object + + BOOL Intersect(IN const Rect& rect) + { + return Intersect(*this, *this, rect); + } + + // Intersect rect a and b and save the result into c + // Notice that c may be the same object as a or b. + + static BOOL Intersect(OUT Rect& c, + IN const Rect& a, + IN const Rect& b) + { + INT right = min(a.GetRight(), b.GetRight()); + INT bottom = min(a.GetBottom(), b.GetBottom()); + INT left = max(a.GetLeft(), b.GetLeft()); + INT top = max(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + // Determine if the specified rect intersects with the + // current rect object. + + BOOL IntersectsWith(IN const Rect& rect) const + { + return (GetLeft() < rect.GetRight() && + GetTop() < rect.GetTop() && + GetRight() > rect.GetLeft() && + GetBottom() > rect.GetTop()); + } + + static BOOL Union(OUT Rect& c, + IN const Rect& a, + IN const Rect& b) + { + INT right = max(a.GetRight(), b.GetRight()); + INT bottom = max(a.GetBottom(), b.GetBottom()); + INT left = min(a.GetLeft(), b.GetLeft()); + INT top = min(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + VOID Offset(IN const Point& point) + { + Offset(point.X, point.Y); + } + + VOID Offset(IN INT dx, + IN INT dy) + { + X += dx; + Y += dy; + } + +public: + + INT X; + INT Y; + INT Width; + INT Height; +}; + +// A user must mange memory for PathData. + +class PathData +{ +public: + PathData() + { + Count = 0; + Points = NULL; + Types = NULL; + } + + ~PathData() + { + if (Points != NULL) + { + delete Points; + } + + if (Types != NULL) + { + delete Types; + } + } + +#ifdef DCR_USE_NEW_250932 + +private: + PathData(const PathData &); + PathData& operator=(const PathData &); + +#endif + +public: + INT Count; + PointF* Points; + BYTE* Types; +}; + + +//----------------------------- +// text character range +//----------------------------- + +class CharacterRange +{ +public: + CharacterRange( + INT first, + INT length + ) : + First (first), + Length (length) + {} + + CharacterRange() : First(0), Length(0) + {} + + CharacterRange & operator = (const CharacterRange &rhs) + { + First = rhs.First; + Length = rhs.Length; + return *this; + } + + INT First; + INT Length; +}; + +#endif // !_GDIPLUSTYPES_HPP diff --git a/win32/gdiplus/lib/gdiplus.dll b/win32/gdiplus/lib/gdiplus.dll new file mode 100644 index 0000000..10deae6 Binary files /dev/null and b/win32/gdiplus/lib/gdiplus.dll differ diff --git a/win32/gdiplus/lib/gdiplus.lib b/win32/gdiplus/lib/gdiplus.lib new file mode 100644 index 0000000..71fff4a Binary files /dev/null and b/win32/gdiplus/lib/gdiplus.lib differ