git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3072 92316355-f0b4-4df1-b90c-862c8a59935fremotes/tiles
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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<BrushType>(-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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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; | |||||
| }; | |||||
| @@ -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 | |||||
| @@ -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 <pshpack2.h> // 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 <poppack.h> | |||||
| // 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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||
| @@ -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 | |||||