if microsoft is going to play games with where they stuff their libraries, i will just checkin their libraries myself

This commit is contained in:
zeromus 2009-02-03 18:32:07 +00:00
parent fbff3694c6
commit a680b58121
33 changed files with 15969 additions and 19 deletions

View File

@ -50,7 +50,7 @@
FavorSizeOrSpeed="0"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;HAVE_LIBZ;NOMINMAX;DEBUG;WANTPROGINFO"
ExceptionHandling="1"
BufferSecurityCheck="false"
@ -72,7 +72,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -138,7 +138,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
StringPooling="true"
ExceptionHandling="1"
@ -161,7 +161,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -227,7 +227,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX;NDEBUG"
StringPooling="true"
ExceptionHandling="1"
@ -253,7 +253,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib gdiplus.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -313,6 +313,7 @@
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE"
/>
<Tool
@ -326,6 +327,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="gdiplus\gdiplus.lib gdiplus.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
/>
<Tool
Name="VCALinkTool"
@ -387,7 +389,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE"
StringPooling="true"
ExceptionHandling="1"
@ -413,7 +415,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2005-x32.lib zziplib-2005-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9,00"
Version="9.00"
Name="DeSmuME_VS2008"
ProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
RootNamespace="DeSmuME"
@ -51,7 +51,7 @@
FavorSizeOrSpeed="0"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
ExceptionHandling="1"
BufferSecurityCheck="false"
@ -71,7 +71,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -137,7 +137,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
@ -161,7 +161,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib gdiplus.lib directx\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib gdiplus.lib directx\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib"
OutputFile="$(OutDir)\$(ProjectName)_interim_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -227,7 +227,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
@ -250,7 +250,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_interim.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -316,7 +316,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;RELEASE"
StringPooling="true"
ExceptionHandling="1"
@ -339,7 +339,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
@ -405,7 +405,7 @@
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\gdiplus"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;SPU_INTERPOLATE;NOMINMAX;RELEASE"
StringPooling="true"
ExceptionHandling="1"
@ -429,7 +429,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
AdditionalDependencies="gdiplus\gdiplus.lib vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"

View File

@ -0,0 +1,73 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* Gdiplus.h
*
* Abstract:
*
* GDI+ public header file
*
\**************************************************************************/
#ifndef _GDIPLUS_H
#define _GDIPLUS_H
struct IDirectDrawSurface7;
typedef signed short INT16;
typedef unsigned short UINT16;
#include <pshpack8.h> // set structure packing to 8
namespace Gdiplus
{
namespace DllExports
{
#include "GdiplusMem.h"
};
#include "GdiplusBase.h"
#include "GdiplusEnums.h"
#include "GdiplusTypes.h"
#include "GdiplusInit.h"
#include "GdiplusPixelFormats.h"
#include "GdiplusColor.h"
#include "GdiplusMetaHeader.h"
#include "GdiplusImaging.h"
#include "GdiplusColorMatrix.h"
#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
#include <poppack.h> // pop structure packing back to previous state
#endif // !_GDIPLUS_HPP

Binary file not shown.

View File

@ -0,0 +1,40 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusBase.h
*
* Abstract:
*
* GDI+ base memory allocation class
*
\**************************************************************************/
#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

View File

@ -0,0 +1,925 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusBitmap.h
*
* Abstract:
*
* GDI+ Bitmap class
*
\**************************************************************************/
#ifndef _GDIPLUSBITMAP_H
#define _GDIPLUSBITMAP_H
inline
Image::Image(
IN const WCHAR* filename,
IN BOOL useEmbeddedColorManagement
)
{
nativeImage = NULL;
if(useEmbeddedColorManagement)
{
lastResult = DllExports::GdipLoadImageFromFileICM(
filename,
&nativeImage
);
}
else
{
lastResult = DllExports::GdipLoadImageFromFile(
filename,
&nativeImage
);
}
}
inline
Image::Image(
IN IStream* stream,
IN BOOL useEmbeddedColorManagement
)
{
nativeImage = NULL;
if(useEmbeddedColorManagement)
{
lastResult = DllExports::GdipLoadImageFromStreamICM(
stream,
&nativeImage
);
}
else
{
lastResult = DllExports::GdipLoadImageFromStream(
stream,
&nativeImage
);
}
}
inline Image*
Image::FromFile(
IN const WCHAR* filename,
IN BOOL useEmbeddedColorManagement
)
{
return new Image(
filename,
useEmbeddedColorManagement
);
}
inline Image*
Image::FromStream(
IN IStream* stream,
IN BOOL useEmbeddedColorManagement
)
{
return new Image(
stream,
useEmbeddedColorManagement
);
}
inline
Image::~Image()
{
DllExports::GdipDisposeImage(nativeImage);
}
inline Image*
Image::Clone()
{
GpImage *cloneimage = NULL;
SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage));
return new Image(cloneimage, lastResult);
}
inline UINT
Image::GetEncoderParameterListSize(
IN const CLSID* clsidEncoder
)
{
UINT size = 0;
SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage,
clsidEncoder,
&size));
return size;
}
inline Status
Image::GetEncoderParameterList(
IN const CLSID* clsidEncoder,
IN UINT size,
OUT EncoderParameters* buffer
)
{
return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage,
clsidEncoder,
size,
buffer));
}
inline Status
Image::Save(
IN const WCHAR* filename,
IN const CLSID* clsidEncoder,
IN const EncoderParameters *encoderParams
)
{
return SetStatus(DllExports::GdipSaveImageToFile(nativeImage,
filename,
clsidEncoder,
encoderParams));
}
inline Status
Image::Save(
IN IStream* stream,
IN const CLSID* clsidEncoder,
IN const EncoderParameters *encoderParams
)
{
return SetStatus(DllExports::GdipSaveImageToStream(nativeImage,
stream,
clsidEncoder,
encoderParams));
}
inline Status
Image::SaveAdd(
IN const EncoderParameters *encoderParams
)
{
return SetStatus(DllExports::GdipSaveAdd(nativeImage,
encoderParams));
}
inline Status
Image::SaveAdd(
IN Image* newImage,
IN const EncoderParameters *encoderParams
)
{
if ( newImage == NULL )
{
return SetStatus(InvalidParameter);
}
return SetStatus(DllExports::GdipSaveAddImage(nativeImage,
newImage->nativeImage,
encoderParams));
}
inline ImageType
Image::GetType() const
{
ImageType type = ImageTypeUnknown;
SetStatus(DllExports::GdipGetImageType(nativeImage, &type));
return type;
}
inline Status
Image::GetPhysicalDimension(
OUT SizeF* size
)
{
if (size == NULL)
{
return SetStatus(InvalidParameter);
}
REAL width, height;
Status status;
status = SetStatus(DllExports::GdipGetImageDimension(nativeImage,
&width, &height));
size->Width = width;
size->Height = height;
return status;
}
inline Status
Image::GetBounds(
OUT RectF *srcRect,
OUT Unit *srcUnit
)
{
return SetStatus(DllExports::GdipGetImageBounds(nativeImage,
srcRect, srcUnit));
}
inline UINT
Image::GetWidth()
{
UINT width = 0;
SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width));
return width;
}
inline UINT
Image::GetHeight()
{
UINT height = 0;
SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height));
return height;
}
inline REAL
Image::GetHorizontalResolution()
{
REAL resolution = 0.0f;
SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution));
return resolution;
}
inline REAL
Image::GetVerticalResolution()
{
REAL resolution = 0.0f;
SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution));
return resolution;
}
inline UINT
Image::GetFlags()
{
UINT flags = 0;
SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags));
return flags;
}
inline Status
Image::GetRawFormat(OUT GUID *format)
{
return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format));
}
inline PixelFormat
Image::GetPixelFormat()
{
PixelFormat format;
SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format));
return format;
}
inline INT
Image::GetPaletteSize()
{
INT size = 0;
SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size));
return size;
}
inline Status
Image::GetPalette(
OUT ColorPalette *palette,
IN INT size
)
{
return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size));
}
inline Status
Image::SetPalette(
IN const ColorPalette *palette
)
{
return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette));
}
inline Image*
Image::GetThumbnailImage(
IN UINT thumbWidth,
IN UINT thumbHeight,
IN GetThumbnailImageAbort callback,
IN VOID* callbackData
)
{
GpImage *thumbimage = NULL;
SetStatus(DllExports::GdipGetImageThumbnail(nativeImage,
thumbWidth, thumbHeight,
&thumbimage,
callback, callbackData));
Image *newImage = new Image(thumbimage, lastResult);
if (newImage == NULL)
{
DllExports::GdipDisposeImage(thumbimage);
}
return newImage;
}
inline UINT
Image::GetFrameDimensionsCount()
{
UINT count = 0;
SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage,
&count));
return count;
}
inline Status
Image::GetFrameDimensionsList(
OUT GUID* dimensionIDs,
IN UINT count
)
{
return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage,
dimensionIDs,
count));
}
inline UINT
Image::GetFrameCount(
IN const GUID* dimensionID
)
{
UINT count = 0;
SetStatus(DllExports::GdipImageGetFrameCount(nativeImage,
dimensionID,
&count));
return count;
}
inline Status
Image::SelectActiveFrame(
IN const GUID *dimensionID,
IN UINT frameIndex
)
{
return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage,
dimensionID,
frameIndex));
}
inline Status
Image::RotateFlip(
IN RotateFlipType rotateFlipType
)
{
return SetStatus(DllExports::GdipImageRotateFlip(nativeImage,
rotateFlipType));
}
inline UINT
Image::GetPropertyCount()
{
UINT numProperty = 0;
SetStatus(DllExports::GdipGetPropertyCount(nativeImage,
&numProperty));
return numProperty;
}
inline Status
Image::GetPropertyIdList(
IN UINT numOfProperty,
OUT PROPID* list
)
{
return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage,
numOfProperty, list));
}
inline UINT
Image::GetPropertyItemSize(
IN PROPID propId
)
{
UINT size = 0;
SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage,
propId,
&size));
return size;
}
inline Status
Image::GetPropertyItem(
IN PROPID propId,
IN UINT propSize,
OUT PropertyItem* buffer
)
{
return SetStatus(DllExports::GdipGetPropertyItem(nativeImage,
propId, propSize, buffer));
}
inline Status
Image::GetPropertySize(
OUT UINT* totalBufferSize,
OUT UINT* numProperties
)
{
return SetStatus(DllExports::GdipGetPropertySize(nativeImage,
totalBufferSize,
numProperties));
}
inline Status
Image::GetAllPropertyItems(
IN UINT totalBufferSize,
IN UINT numProperties,
OUT PropertyItem* allItems
)
{
if (allItems == NULL)
{
return SetStatus(InvalidParameter);
}
return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage,
totalBufferSize,
numProperties,
allItems));
}
inline Status
Image::RemovePropertyItem(
IN PROPID propId
)
{
return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId));
}
inline Status
Image::SetPropertyItem(
IN const PropertyItem* item
)
{
return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item));
}
inline Status
Image::GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return lastStatus;
}
inline
Image::Image(GpImage *nativeImage, Status status)
{
SetNativeImage(nativeImage);
lastResult = status;
}
inline VOID
Image::SetNativeImage(GpImage *nativeImage)
{
this->nativeImage = nativeImage;
}
inline
Bitmap::Bitmap(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement
)
{
GpBitmap *bitmap = NULL;
if(useEmbeddedColorManagement)
{
lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap);
}
else
{
lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap);
}
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN IStream *stream,
IN BOOL useEmbeddedColorManagement
)
{
GpBitmap *bitmap = NULL;
if(useEmbeddedColorManagement)
{
lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap);
}
else
{
lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap);
}
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN INT width,
IN INT height,
IN INT stride,
IN PixelFormat format,
IN BYTE *scan0
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromScan0(width,
height,
stride,
format,
scan0,
&bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN INT width,
IN INT height,
IN PixelFormat format
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromScan0(width,
height,
0,
format,
NULL,
&bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN INT width,
IN INT height,
IN Graphics* target)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromGraphics(width,
height,
target->nativeGraphics,
&bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN IDirectDrawSurface7 * surface
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface,
&bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN const BITMAPINFO* gdiBitmapInfo,
IN VOID* gdiBitmapData
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo,
gdiBitmapData,
&bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN HBITMAP hbm,
IN HPALETTE hpal
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN HICON hicon
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap);
SetNativeImage(bitmap);
}
inline
Bitmap::Bitmap(
IN HINSTANCE hInstance,
IN const WCHAR *bitmapName
)
{
GpBitmap *bitmap = NULL;
lastResult = DllExports::GdipCreateBitmapFromResource(hInstance,
bitmapName,
&bitmap);
SetNativeImage(bitmap);
}
inline Bitmap*
Bitmap::FromFile(
IN const WCHAR *filename,
IN BOOL useEmbeddedColorManagement
)
{
return new Bitmap(
filename,
useEmbeddedColorManagement
);
}
inline Bitmap*
Bitmap::FromStream(
IN IStream *stream,
IN BOOL useEmbeddedColorManagement
)
{
return new Bitmap(
stream,
useEmbeddedColorManagement
);
}
inline Bitmap*
Bitmap::FromDirectDrawSurface7(
IN IDirectDrawSurface7* surface
)
{
return new Bitmap(surface);
}
inline Bitmap*
Bitmap::FromBITMAPINFO(
IN const BITMAPINFO* gdiBitmapInfo,
IN VOID* gdiBitmapData)
{
return new Bitmap(gdiBitmapInfo, gdiBitmapData);
}
inline Bitmap*
Bitmap::FromHBITMAP(
IN HBITMAP hbm,
IN HPALETTE hpal
)
{
return new Bitmap(hbm, hpal);
}
inline Bitmap*
Bitmap::FromHICON(
IN HICON hicon
)
{
return new Bitmap(hicon);
}
inline Bitmap*
Bitmap::FromResource(
IN HINSTANCE hInstance,
IN const WCHAR *bitmapName)
{
return new Bitmap(hInstance, bitmapName);
}
inline Status
Bitmap::GetHBITMAP(
IN const Color& colorBackground,
OUT HBITMAP* hbmReturn
)
{
return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap(
static_cast<GpBitmap*>(nativeImage),
hbmReturn,
colorBackground.GetValue()));
}
inline Status
Bitmap::GetHICON(
OUT HICON* hiconReturn
)
{
return SetStatus(DllExports::GdipCreateHICONFromBitmap(
static_cast<GpBitmap*>(nativeImage),
hiconReturn));
}
inline Bitmap*
Bitmap::Clone(
IN const Rect& rect,
IN PixelFormat format
)
{
return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
}
inline Bitmap*
Bitmap::Clone(
IN INT x,
IN INT y,
IN INT width,
IN INT height,
IN PixelFormat format
)
{
GpBitmap* gpdstBitmap = NULL;
Bitmap* bitmap;
lastResult = DllExports::GdipCloneBitmapAreaI(
x,
y,
width,
height,
format,
(GpBitmap *)nativeImage,
&gpdstBitmap);
if (lastResult == Ok)
{
bitmap = new Bitmap(gpdstBitmap);
if (bitmap == NULL)
{
DllExports::GdipDisposeImage(gpdstBitmap);
}
return bitmap;
}
else
return NULL;
}
inline Bitmap*
Bitmap::Clone(
IN const RectF& rect,
IN PixelFormat format
)
{
return Clone(rect.X, rect.Y, rect.Width, rect.Height, format);
}
inline Bitmap*
Bitmap::Clone(
IN REAL x,
IN REAL y,
IN REAL width,
IN REAL height,
IN PixelFormat format
)
{
GpBitmap* gpdstBitmap = NULL;
Bitmap* bitmap;
SetStatus(DllExports::GdipCloneBitmapArea(
x,
y,
width,
height,
format,
(GpBitmap *)nativeImage,
&gpdstBitmap));
if (lastResult == Ok)
{
bitmap = new Bitmap(gpdstBitmap);
if (bitmap == NULL)
{
DllExports::GdipDisposeImage(gpdstBitmap);
}
return bitmap;
}
else
return NULL;
}
inline Bitmap::Bitmap(GpBitmap *nativeBitmap)
{
lastResult = Ok;
SetNativeImage(nativeBitmap);
}
inline Status
Bitmap::LockBits(
IN const Rect* rect,
IN UINT flags,
IN PixelFormat format,
OUT BitmapData* lockedBitmapData
)
{
return SetStatus(DllExports::GdipBitmapLockBits(
static_cast<GpBitmap*>(nativeImage),
rect,
flags,
format,
lockedBitmapData));
}
inline Status
Bitmap::UnlockBits(
IN BitmapData* lockedBitmapData
)
{
return SetStatus(DllExports::GdipBitmapUnlockBits(
static_cast<GpBitmap*>(nativeImage),
lockedBitmapData));
}
inline Status
Bitmap::GetPixel(
IN INT x,
IN INT y,
OUT Color *color)
{
ARGB argb;
Status status = SetStatus(DllExports::GdipBitmapGetPixel(
static_cast<GpBitmap *>(nativeImage),
x, y,
&argb));
if (status == Ok)
{
color->SetValue(argb);
}
return status;
}
inline Status
Bitmap::SetPixel(
IN INT x,
IN INT y,
IN const Color& color)
{
return SetStatus(DllExports::GdipBitmapSetPixel(
static_cast<GpBitmap *>(nativeImage),
x, y,
color.GetValue()));
}
inline Status
Bitmap::SetResolution(
IN REAL xdpi,
IN REAL ydpi)
{
return SetStatus(DllExports::GdipBitmapSetResolution(
static_cast<GpBitmap *>(nativeImage),
xdpi, ydpi));
}
#endif

View File

@ -0,0 +1,840 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusBrush.h
*
* Abstract:
*
* GDI+ Brush class
*
\**************************************************************************/
#ifndef _GDIPLUSBRUSH_H
#define _GDIPLUSBRUSH_H
class GraphicsPath;
//--------------------------------------------------------------------------
// Abstract base class for various brush types
//--------------------------------------------------------------------------
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);
}
private:
Brush(const Brush& brush);
Brush& operator=(const Brush& brush);
protected:
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;
};
//--------------------------------------------------------------------------
// 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()));
}
private:
SolidBrush(const SolidBrush &);
SolidBrush& operator=(const SolidBrush &);
protected:
SolidBrush()
{
}
};
//--------------------------------------------------------------------------
// Texture Brush Fill Object
//--------------------------------------------------------------------------
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);
}
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);
}
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);
}
TextureBrush(
IN Image* image,
IN WrapMode wrapMode,
const IN Rect &dstRect
)
{
GpTexture *texture = NULL;
lastResult = DllExports::GdipCreateTexture2I(
image->nativeImage,
wrapMode,
dstRect.X,
dstRect.Y,
dstRect.Width,
dstRect.Height,
&texture);
SetNativeBrush(texture);
}
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);
}
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);
}
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));
}
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;
}
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;
}
private:
TextureBrush(const TextureBrush &);
TextureBrush& operator=(const TextureBrush &);
protected:
TextureBrush()
{
}
};
//--------------------------------------------------------------------------
// Linear 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);
}
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));
}
Status GetRectangle(OUT Rect* rect) const
{
return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect));
}
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.0f)
{
return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale));
}
Status SetBlendTriangularShape(
IN REAL focus,
IN REAL scale = 1.0f
)
{
return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale));
}
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));
}
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;
}
private:
LinearGradientBrush(const LinearGradientBrush &);
LinearGradientBrush& operator=(const LinearGradientBrush &);
protected:
LinearGradientBrush()
{
}
};
//--------------------------------------------------------------------------
// PathGradientBrush object is defined
// in gdipluspath.h.
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
// Hatch Brush Object
//--------------------------------------------------------------------------
class HatchBrush : public Brush
{
public:
friend class Pen;
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;
}
private:
HatchBrush(const HatchBrush &);
HatchBrush& operator=(const HatchBrush &);
protected:
HatchBrush()
{
}
};
#endif

View File

@ -0,0 +1,51 @@
/**************************************************************************
*
* Copyright (c) 2000 Microsoft Corporation
*
* Module Name:
*
* CachedBitmap class definition
*
* Abstract:
*
* GDI+ 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.
*
* Look for class definition in GdiplusHeaders.h
*
**************************************************************************/
#ifndef _GDIPLUSCACHEDBITMAP_H
#define _GDIPLUSCACHEDBITMAP_H
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

View File

@ -0,0 +1,324 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusColor.h
*
* Abstract:
*
* GDI+ Color Object
*
\**************************************************************************/
#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 Red, Green, Blue values.
//
// Color values are not premultiplied.
Color(IN BYTE r,
IN BYTE g,
IN BYTE b)
{
Argb = MakeARGB(255, r, g, b);
}
Color(IN BYTE a,
IN BYTE r,
IN BYTE g,
IN BYTE b)
{
Argb = MakeARGB(a, r, g, b);
}
Color(IN ARGB argb)
{
Argb = argb;
}
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();
}
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:
// Common color constants
enum
{
AliceBlue = 0xFFF0F8FF,
AntiqueWhite = 0xFFFAEBD7,
Aqua = 0xFF00FFFF,
Aquamarine = 0xFF7FFFD4,
Azure = 0xFFF0FFFF,
Beige = 0xFFF5F5DC,
Bisque = 0xFFFFE4C4,
Black = 0xFF000000,
BlanchedAlmond = 0xFFFFEBCD,
Blue = 0xFF0000FF,
BlueViolet = 0xFF8A2BE2,
Brown = 0xFFA52A2A,
BurlyWood = 0xFFDEB887,
CadetBlue = 0xFF5F9EA0,
Chartreuse = 0xFF7FFF00,
Chocolate = 0xFFD2691E,
Coral = 0xFFFF7F50,
CornflowerBlue = 0xFF6495ED,
Cornsilk = 0xFFFFF8DC,
Crimson = 0xFFDC143C,
Cyan = 0xFF00FFFF,
DarkBlue = 0xFF00008B,
DarkCyan = 0xFF008B8B,
DarkGoldenrod = 0xFFB8860B,
DarkGray = 0xFFA9A9A9,
DarkGreen = 0xFF006400,
DarkKhaki = 0xFFBDB76B,
DarkMagenta = 0xFF8B008B,
DarkOliveGreen = 0xFF556B2F,
DarkOrange = 0xFFFF8C00,
DarkOrchid = 0xFF9932CC,
DarkRed = 0xFF8B0000,
DarkSalmon = 0xFFE9967A,
DarkSeaGreen = 0xFF8FBC8B,
DarkSlateBlue = 0xFF483D8B,
DarkSlateGray = 0xFF2F4F4F,
DarkTurquoise = 0xFF00CED1,
DarkViolet = 0xFF9400D3,
DeepPink = 0xFFFF1493,
DeepSkyBlue = 0xFF00BFFF,
DimGray = 0xFF696969,
DodgerBlue = 0xFF1E90FF,
Firebrick = 0xFFB22222,
FloralWhite = 0xFFFFFAF0,
ForestGreen = 0xFF228B22,
Fuchsia = 0xFFFF00FF,
Gainsboro = 0xFFDCDCDC,
GhostWhite = 0xFFF8F8FF,
Gold = 0xFFFFD700,
Goldenrod = 0xFFDAA520,
Gray = 0xFF808080,
Green = 0xFF008000,
GreenYellow = 0xFFADFF2F,
Honeydew = 0xFFF0FFF0,
HotPink = 0xFFFF69B4,
IndianRed = 0xFFCD5C5C,
Indigo = 0xFF4B0082,
Ivory = 0xFFFFFFF0,
Khaki = 0xFFF0E68C,
Lavender = 0xFFE6E6FA,
LavenderBlush = 0xFFFFF0F5,
LawnGreen = 0xFF7CFC00,
LemonChiffon = 0xFFFFFACD,
LightBlue = 0xFFADD8E6,
LightCoral = 0xFFF08080,
LightCyan = 0xFFE0FFFF,
LightGoldenrodYellow = 0xFFFAFAD2,
LightGray = 0xFFD3D3D3,
LightGreen = 0xFF90EE90,
LightPink = 0xFFFFB6C1,
LightSalmon = 0xFFFFA07A,
LightSeaGreen = 0xFF20B2AA,
LightSkyBlue = 0xFF87CEFA,
LightSlateGray = 0xFF778899,
LightSteelBlue = 0xFFB0C4DE,
LightYellow = 0xFFFFFFE0,
Lime = 0xFF00FF00,
LimeGreen = 0xFF32CD32,
Linen = 0xFFFAF0E6,
Magenta = 0xFFFF00FF,
Maroon = 0xFF800000,
MediumAquamarine = 0xFF66CDAA,
MediumBlue = 0xFF0000CD,
MediumOrchid = 0xFFBA55D3,
MediumPurple = 0xFF9370DB,
MediumSeaGreen = 0xFF3CB371,
MediumSlateBlue = 0xFF7B68EE,
MediumSpringGreen = 0xFF00FA9A,
MediumTurquoise = 0xFF48D1CC,
MediumVioletRed = 0xFFC71585,
MidnightBlue = 0xFF191970,
MintCream = 0xFFF5FFFA,
MistyRose = 0xFFFFE4E1,
Moccasin = 0xFFFFE4B5,
NavajoWhite = 0xFFFFDEAD,
Navy = 0xFF000080,
OldLace = 0xFFFDF5E6,
Olive = 0xFF808000,
OliveDrab = 0xFF6B8E23,
Orange = 0xFFFFA500,
OrangeRed = 0xFFFF4500,
Orchid = 0xFFDA70D6,
PaleGoldenrod = 0xFFEEE8AA,
PaleGreen = 0xFF98FB98,
PaleTurquoise = 0xFFAFEEEE,
PaleVioletRed = 0xFFDB7093,
PapayaWhip = 0xFFFFEFD5,
PeachPuff = 0xFFFFDAB9,
Peru = 0xFFCD853F,
Pink = 0xFFFFC0CB,
Plum = 0xFFDDA0DD,
PowderBlue = 0xFFB0E0E6,
Purple = 0xFF800080,
Red = 0xFFFF0000,
RosyBrown = 0xFFBC8F8F,
RoyalBlue = 0xFF4169E1,
SaddleBrown = 0xFF8B4513,
Salmon = 0xFFFA8072,
SandyBrown = 0xFFF4A460,
SeaGreen = 0xFF2E8B57,
SeaShell = 0xFFFFF5EE,
Sienna = 0xFFA0522D,
Silver = 0xFFC0C0C0,
SkyBlue = 0xFF87CEEB,
SlateBlue = 0xFF6A5ACD,
SlateGray = 0xFF708090,
Snow = 0xFFFFFAFA,
SpringGreen = 0xFF00FF7F,
SteelBlue = 0xFF4682B4,
Tan = 0xFFD2B48C,
Teal = 0xFF008080,
Thistle = 0xFFD8BFD8,
Tomato = 0xFFFF6347,
Transparent = 0x00FFFFFF,
Turquoise = 0xFF40E0D0,
Violet = 0xFFEE82EE,
Wheat = 0xFFF5DEB3,
White = 0xFFFFFFFF,
WhiteSmoke = 0xFFF5F5F5,
Yellow = 0xFFFFFF00,
YellowGreen = 0xFF9ACD32
};
// 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

View File

@ -0,0 +1,63 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusColorMatrix.h
*
* Abstract:
*
* GDI+ Color Matrix object, used with 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,
ColorAdjustTypeAny // Reserved
};
//----------------------------------------------------------------------------
// Color Map
//----------------------------------------------------------------------------
struct ColorMap
{
Color oldColor;
Color newColor;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,280 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusFont.h
*
* Abstract:
*
* GDI+ Font class
*
\**************************************************************************/
#ifndef _GDIPLUSFONT_H
#define _GDIPLUSFONT_H
inline
Font::Font(IN HDC hdc)
{
GpFont *font = NULL;
lastResult = DllExports::GdipCreateFontFromDC(hdc, &font);
SetNativeFont(font);
}
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);
}
SetNativeFont(font);
}
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);
}
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);
}
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);
SetNativeFont(font);
}
inline
Font::Font(
IN const WCHAR * familyName,
IN REAL emSize,
IN INT style,
IN Unit unit,
IN const FontCollection * fontCollection
)
{
nativeFont = NULL;
FontFamily family(familyName, fontCollection);
GpFontFamily *nativeFamily = family.nativeFamily;
lastResult = family.GetLastStatus();
if (lastResult != Ok)
{
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
lastResult = FontFamily::GenericSansSerif()->lastResult;
if (lastResult != Ok)
return;
}
lastResult = DllExports::GdipCreateFont(nativeFamily,
emSize,
style,
unit,
&nativeFont);
if (lastResult != Ok)
{
nativeFamily = FontFamily::GenericSansSerif()->nativeFamily;
lastResult = FontFamily::GenericSansSerif()->lastResult;
if (lastResult != Ok)
return;
lastResult = DllExports::GdipCreateFont(
nativeFamily,
emSize,
style,
unit,
&nativeFont);
}
}
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;
}
inline REAL
Font::GetHeight(IN REAL dpi) const
{
REAL height;
SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height));
return height;
}
inline
Font::Font(IN GpFont* font,
IN Status status)
{
lastResult = status;
SetNativeFont(font);
}
inline VOID
Font::SetNativeFont(GpFont *Font)
{
nativeFont = Font;
}
inline Status
Font::GetLastStatus(void) const
{
return lastResult;
}
inline Status
Font::SetStatus(IN Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
#endif

View File

@ -0,0 +1,134 @@
/**************************************************************************\
*
* 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;
}
inline Status
FontCollection::SetStatus(IN Status status) const
{
lastResult = status;
return lastResult;
}
inline
InstalledFontCollection::InstalledFontCollection()
{
nativeFontCollection = NULL;
lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection);
}
inline
InstalledFontCollection::~InstalledFontCollection()
{
}
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

View File

@ -0,0 +1,207 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusFontFamily.h
*
* Abstract:
*
* GDI+ Font Family class
*
\**************************************************************************/
#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
);
}
inline
FontFamily::FontFamily(
IN GpFontFamily *nativeOrig,
IN Status status
)
{
lastResult = status;
nativeFamily = nativeOrig;
}
inline const FontFamily *
FontFamily::GenericSansSerif()
{
if (GenericSansSerifFontFamily != NULL)
{
return GenericSansSerifFontFamily;
}
GenericSansSerifFontFamily =
(FontFamily*) GenericSansSerifFontFamilyBuffer;
GenericSansSerifFontFamily->lastResult =
DllExports::GdipGetGenericFontFamilySansSerif(
&(GenericSansSerifFontFamily->nativeFamily)
);
return GenericSansSerifFontFamily;
}
inline const FontFamily *
FontFamily::GenericSerif()
{
if (GenericSerifFontFamily != NULL)
{
return GenericSerifFontFamily;
}
GenericSerifFontFamily =
(FontFamily*) GenericSerifFontFamilyBuffer;
GenericSerifFontFamily->lastResult =
DllExports::GdipGetGenericFontFamilySerif(
&(GenericSerifFontFamily->nativeFamily)
);
return GenericSerifFontFamily;
}
inline const FontFamily *
FontFamily::GenericMonospace()
{
if (GenericMonospaceFontFamily != NULL)
{
return GenericMonospaceFontFamily;
}
GenericMonospaceFontFamily =
(FontFamily*) GenericMonospaceFontFamilyBuffer;
GenericMonospaceFontFamily->lastResult =
DllExports::GdipGetGenericFontFamilyMonospace(
&(GenericMonospaceFontFamily->nativeFamily)
);
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;
}
inline Status
FontFamily::GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return lastStatus;
}
inline Status
FontFamily::SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
#endif

View File

@ -0,0 +1,107 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusGpStubs.h
*
* Abstract:
*
* Private GDI+ 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;
//---------------------------------------------------------------------------
// Private 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,671 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusHeaders.h
*
* Abstract:
*
* GDI+ Region, Font, Image, CustomLineCap class definitions.
*
*
* Class definition and inline class implementation are separated into
* different files to avoid circular dependencies.
*
\**************************************************************************/
#ifndef _GDIPLUSHEADERS_H
#define _GDIPLUSHEADERS_H
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();
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:
private:
Region(const Region &region);
Region& operator=(const Region &region);
protected:
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;
};
//--------------------------------------------------------------------------
// 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;
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;
private:
FontFamily(const FontFamily &);
FontFamily& operator=(const FontFamily &);
protected:
Status SetStatus(Status status) const;
FontFamily(GpFontFamily * nativeFamily, Status status);
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};
//--------------------------------------------------------------------------
// Font
//--------------------------------------------------------------------------
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);
Font(IN HDC hdc,
IN const HFONT hfont);
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) const;
REAL GetHeight(IN REAL dpi) const;
Status GetFamily(OUT FontFamily *family) const;
private:
Font(const Font &);
Font& operator=(const Font &);
protected:
Font(GpFont* font, Status status);
VOID SetNativeFont(GpFont *Font);
Status SetStatus(Status status) const;
protected:
GpFont* nativeFont;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Font Collection
//--------------------------------------------------------------------------
class FontCollection : public GdiplusBase
{
public:
friend class FontFamily;
FontCollection();
virtual ~FontCollection();
INT GetFamilyCount() const;
Status GetFamilies(
IN INT numSought,
OUT FontFamily * gpfamilies,
OUT INT * numFound
) const;
Status GetLastStatus() const;
private:
FontCollection(const FontCollection &);
FontCollection& operator=(const FontCollection &);
protected:
Status SetStatus(Status status) const ;
GpFontCollection *nativeFontCollection;
mutable Status lastResult;
};
class InstalledFontCollection : public FontCollection
{
public:
InstalledFontCollection();
~InstalledFontCollection();
private:
InstalledFontCollection(const InstalledFontCollection &);
InstalledFontCollection& operator=(const InstalledFontCollection &);
protected:
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);
private:
PrivateFontCollection(const PrivateFontCollection &);
PrivateFontCollection& operator=(const PrivateFontCollection &);
};
//--------------------------------------------------------------------------
// Abstract base class for Image and Metafile
//--------------------------------------------------------------------------
class Image : public GdiplusBase
{
public:
friend class Brush;
friend class TextureBrush;
friend class Graphics;
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
);
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);
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;
private:
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);
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);
private:
Bitmap(const Bitmap &);
Bitmap& operator=(const Bitmap &);
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;
// This changes both the start and end cap.
Status SetStrokeCap(IN LineCap strokeCap)
{
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;
Status GetLastStatus() const;
protected:
CustomLineCap();
private:
CustomLineCap(const CustomLineCap &);
CustomLineCap& operator=(const CustomLineCap &);
protected:
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 Graphics;
public:
CachedBitmap(IN Bitmap *bitmap,
IN Graphics *graphics);
virtual ~CachedBitmap();
Status GetLastStatus() const;
private:
CachedBitmap(const CachedBitmap &);
CachedBitmap& operator=(const CachedBitmap &);
protected:
GpCachedBitmap *nativeCachedBitmap;
mutable Status lastResult;
};
#endif // !_GDIPLUSHEADERS.HPP

View File

@ -0,0 +1,59 @@
/**************************************************************************\
*
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusImageCodec.h
*
* Abstract:
*
* GDI+ Codec Image APIs
*
\**************************************************************************/
#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);
}
#endif // _GDIPLUSIMAGECODEC_H

View File

@ -0,0 +1,526 @@
/**************************************************************************\
*
* Copyright (c) 1999-2000 Microsoft Corporation
*
* Module Name:
*
* GdiplusImaging.h
*
* Abstract:
*
* GDI+ Imaging GUIDs
*
\**************************************************************************/
#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);
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);
//---------------------------------------------------------------------------
// 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 PixelFormat;
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
};
//---------------------------------------------------------------------------
// 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
//---------------------------------------------------------------------------
// 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

View File

@ -0,0 +1,97 @@
/**************************************************************************
*
* Copyright (c) 2000-2001 Microsoft Corporation
*
* Module Name:
*
* Gdiplus initialization
*
* Abstract:
*
* GDI+ Startup and Shutdown APIs
*
**************************************************************************/
#ifndef _GDIPLUSINIT_H
#define _GDIPLUSINIT_H
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 not be called from DllMain - can cause deadlock.
//
// Must be called before GDI+ API's or constructors 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.
// Must not be called from DllMain - can cause deadlock.
//
// GDI+ API's may not be called after GdiplusShutdown. Pay careful attention
// to GDI+ object destructors.
extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token);
#endif

View File

@ -0,0 +1,262 @@
/**************************************************************************\
*
* Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusLineCaps.h
*
* Abstract:
*
* GDI+ CustomLineCap APIs
*
\**************************************************************************/
#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()
{
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;
}
inline Status
CustomLineCap::GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return (lastStatus);
}
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;
}
private:
AdjustableArrowCap(const AdjustableArrowCap &);
AdjustableArrowCap& operator=(const AdjustableArrowCap &);
};
#endif

View File

@ -0,0 +1,307 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, 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 is 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;
}
private:
Matrix(const Matrix &);
Matrix& operator=(const Matrix &);
protected:
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;
};

View File

@ -0,0 +1,38 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusMem.h
*
* Abstract:
*
* GDI+ Private Memory Management APIs
*
\**************************************************************************/
#ifndef _GDIPLUSMEM_H
#define _GDIPLUSMEM_H
#ifdef __cplusplus
extern "C" {
#endif
#define WINGDIPAPI __stdcall
//----------------------------------------------------------------------------
// Memory Allocation APIs
//----------------------------------------------------------------------------
void* WINGDIPAPI
GdipAlloc(size_t size);
void WINGDIPAPI
GdipFree(void* ptr);
#ifdef __cplusplus
}
#endif
#endif // !_GDIPLUSMEM_H

View File

@ -0,0 +1,381 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusMetafile.h
*
* Abstract:
*
* GDI+ Metafile class
*
\**************************************************************************/
#ifndef _GDIPLUSMETAFILE_H
#define _GDIPLUSMETAFILE_H
class Metafile : public Image
{
public:
friend class Image;
// 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 WmfPlaceableFileHeader * wmfPlaceableFileHeader,
IN BOOL deleteWmf = FALSE)
{
GpMetafile * metafile = NULL;
lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf,
wmfPlaceableFileHeader,
&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);
}
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 WmfPlaceableFileHeader * wmfPlaceableFileHeader
)
{
GpMetafile * metafile = NULL;
lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename,
wmfPlaceableFileHeader,
&metafile);
SetNativeImage(metafile);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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);
}
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 WmfPlaceableFileHeader * wmfPlaceableFileHeader,
OUT MetafileHeader * header
)
{
return DllExports::GdipGetMetafileHeaderFromWmf(hWmf,
wmfPlaceableFileHeader,
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 Metafile::EmfToWmfBits(
IN HENHMETAFILE hemf,
IN UINT cbData16,
OUT LPBYTE pData16,
IN INT iMapMode = MM_ANISOTROPIC,
IN INT eFlags = EmfToWmfBitsFlagsDefault
)
{
return DllExports::GdipEmfToWmfBits(
hemf,
cbData16,
pData16,
iMapMode,
eFlags);
}
protected:
Metafile()
{
SetNativeImage(NULL);
lastResult = Ok;
}
private:
Metafile(const Metafile &);
Metafile& operator=(const Metafile &);
};
#endif // !_METAFILE_H

View File

@ -0,0 +1,221 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* Metafile headers
*
* Abstract:
*
* GDI+ Metafile Related 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 .01mm unit
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 desc 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;
// Placeable WMFs
// Placeable Metafiles were created 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;
} PWMFRect16;
typedef struct
{
UINT32 Key; // GDIP_WMF_PLACEABLEKEY
INT16 Hmf; // Metafile HANDLE number (always 0)
PWMFRect16 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
} WmfPlaceableFileHeader;
#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+
public:
MetafileType GetType() const { return Type; }
UINT GetMetafileSize() const { return Size; }
// If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF ver
UINT GetVersion() const { return Version; }
// Get the EMF+ flags associated with the metafile
UINT GetEmfPlusFlags() const { return EmfPlusFlags; }
REAL GetDpiX() const { return DpiX; }
REAL GetDpiY() const { return DpiY; }
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 Placeable Metafile)?
BOOL IsWmf() const
{
return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfPlaceable));
}
// Is this an Placeable Metafile?
BOOL IsWmfPlaceable() const { return (Type == MetafileTypeWmfPlaceable); }
// 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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,475 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusPen.h
*
* Abstract:
*
* GDI+ Pen class
*
\**************************************************************************/
#ifndef _GDIPLUSPEN_H
#define _GDIPLUSPEN_H
//--------------------------------------------------------------------------
// Pen class
//--------------------------------------------------------------------------
class Pen : public GdiplusBase
{
public:
friend class GraphicsPath;
friend class Graphics;
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.
Status SetLineCap(IN LineCap startCap,
IN LineCap endCap,
IN DashCap dashCap)
{
return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen,
startCap, endCap, dashCap));
}
Status SetStartCap(IN LineCap startCap)
{
return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap));
}
Status SetEndCap(IN LineCap endCap)
{
return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap));
}
Status SetDashCap(IN DashCap dashCap)
{
return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen,
dashCap));
}
LineCap GetStartCap() const
{
LineCap startCap;
SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap));
return startCap;
}
LineCap GetEndCap() const
{
LineCap endCap;
SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap));
return endCap;
}
DashCap GetDashCap() const
{
DashCap dashCap;
SetStatus(DllExports::GdipGetPenDashCap197819(nativePen,
&dashCap));
return dashCap;
}
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;
}
Status SetAlignment(IN PenAlignment penAlignment)
{
return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment));
}
PenAlignment GetAlignment() const
{
PenAlignment penAlignment;
SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment));
return penAlignment;
}
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;
}
private:
Pen(const Pen &);
Pen& operator=(const Pen &);
protected:
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

View File

@ -0,0 +1,124 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* Gdiplus Pixel Formats
*
* Abstract:
*
* GDI+ Pixel Formats
*
\**************************************************************************/
#ifndef _GDIPLUSPIXELFORMATS_H
#define _GDIPLUSPIXELFORMATS_H
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
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 // Pre-multiplied alpha
#define PixelFormatExtended 0x00100000 // Extended color 16 bits/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
inline UINT
GetPixelFormatSize(
PixelFormat pixfmt
)
{
return (pixfmt >> 8) & 0xff;
}
inline BOOL
IsIndexedPixelFormat(
PixelFormat pixfmt
)
{
return (pixfmt & PixelFormatIndexed) != 0;
}
inline BOOL
IsAlphaPixelFormat(
PixelFormat pixfmt
)
{
return (pixfmt & PixelFormatAlpha) != 0;
}
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;
}
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

View File

@ -0,0 +1,514 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusRegion.h
*
* Abstract:
*
* GDI+ Region class implementation
*
\**************************************************************************/
#ifndef _GDIPLUSREGION_H
#define _GDIPLUSREGION_H
inline
Region::Region()
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegion(&region);
SetNativeRegion(region);
}
inline
Region::Region(IN const RectF& rect)
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegionRect(&rect, &region);
SetNativeRegion(region);
}
inline
Region::Region(IN const Rect& rect)
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegionRectI(&rect, &region);
SetNativeRegion(region);
}
inline
Region::Region(IN const GraphicsPath* path)
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegionPath(path->nativePath, &region);
SetNativeRegion(region);
}
inline
Region::Region(IN const BYTE* regionData, IN INT size)
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegionRgnData(regionData, size,
&region);
SetNativeRegion(region);
}
inline
Region::Region(IN HRGN hRgn)
{
GpRegion *region = NULL;
lastResult = DllExports::GdipCreateRegionHrgn(hRgn, &region);
SetNativeRegion(region);
}
inline
Region* Region::FromHRGN(IN HRGN hRgn)
{
GpRegion *region = NULL;
if (DllExports::GdipCreateRegionHrgn(hRgn, &region) == Ok)
{
Region* newRegion = new Region(region);
if (newRegion == NULL)
{
DllExports::GdipDeleteRegion(region);
}
return newRegion;
}
else
return NULL;
}
inline
Region::~Region()
{
DllExports::GdipDeleteRegion(nativeRegion);
}
inline Region*
Region::Clone() const
{
GpRegion *region = NULL;
SetStatus(DllExports::GdipCloneRegion(nativeRegion, &region));
return new Region(region);
}
inline Status
Region::MakeInfinite()
{
return SetStatus(DllExports::GdipSetInfinite(nativeRegion));
}
inline Status
Region::MakeEmpty()
{
return SetStatus(DllExports::GdipSetEmpty(nativeRegion));
}
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));
}
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));
}
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;
}
// 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 RectF* rects,
IN OUT INT* count) const
{
return SetStatus(DllExports::GdipGetRegionScans(nativeRegion,
rects,
count,
matrix->nativeMatrix));
}
inline Status
Region::GetRegionScans(
IN const Matrix* matrix,
OUT Rect* rects,
IN OUT INT* count) const
{
return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion,
rects,
count,
matrix->nativeMatrix));
}
inline Region::Region(GpRegion* nativeRegion)
{
SetNativeRegion(nativeRegion);
}
inline VOID Region::SetNativeRegion(GpRegion* nativeRegion)
{
this->nativeRegion = nativeRegion;
}
inline Status Region::GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return lastStatus;
}
#endif // !_GDIPLUSREGION_H

View File

@ -0,0 +1,333 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusStringFormat.h
*
* Abstract:
*
* GDI+ StringFormat class
*
\**************************************************************************/
#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();
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;
}
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
));
}
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;
}
Status SetTrimming(IN StringTrimming trimming)
{
return SetStatus(DllExports::GdipSetStringFormatTrimming(
nativeFormat,
trimming
));
}
StringTrimming StringFormat::GetTrimming() const
{
StringTrimming trimming;
SetStatus(DllExports::GdipGetStringFormatTrimming(
nativeFormat,
&trimming
));
return trimming;
}
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;
}
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;
}
}
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;
}
StringFormat(GpStringFormat * clonedStringFormat, Status status)
{
lastError = status;
nativeFormat = clonedStringFormat;
}
GpStringFormat *nativeFormat;
mutable Status lastError;
};
static BYTE GenericTypographicStringFormatBuffer[sizeof(StringFormat)] = {0};
static BYTE GenericDefaultStringFormatBuffer[sizeof(StringFormat)] = {0};
inline const StringFormat *StringFormat::GenericDefault()
{
StringFormat * genericDefaultStringFormat =
(StringFormat*)GenericDefaultStringFormatBuffer;
genericDefaultStringFormat->lastError =
DllExports::GdipStringFormatGetGenericDefault(
&(genericDefaultStringFormat->nativeFormat)
);
return genericDefaultStringFormat;
}
inline const StringFormat *StringFormat::GenericTypographic()
{
StringFormat * genericTypographicStringFormat =
(StringFormat*)GenericTypographicStringFormatBuffer;
genericTypographicStringFormat->lastError =
DllExports::GdipStringFormatGetGenericTypographic(
&genericTypographicStringFormat->nativeFormat
);
return genericTypographicStringFormat;
}
#endif // !_GDIPLUSSTRINGFORMAT_H

View File

@ -0,0 +1,760 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusTypes.h
*
* Abstract:
*
* GDI+ Types
*
\**************************************************************************/
#ifndef _GDIPLUSTYPES_H
#define _GDIPLUSTYPES_H
//--------------------------------------------------------------------------
// 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 common classes
//--------------------------------------------------------------------------
class Size;
class SizeF;
class Point;
class PointF;
class Rect;
class RectF;
class CharacterRange;
//--------------------------------------------------------------------------
// Status return values from GDI+ methods
//--------------------------------------------------------------------------
enum Status
{
Ok = 0,
GenericError = 1,
InvalidParameter = 2,
OutOfMemory = 3,
ObjectBusy = 4,
InsufficientBuffer = 5,
NotImplemented = 6,
Win32Error = 7,
WrongState = 8,
Aborted = 9,
FileNotFound = 10,
ValueOverflow = 11,
AccessDenied = 12,
UnknownImageFormat = 13,
FontFamilyNotFound = 14,
FontStyleNotFound = 15,
NotTrueTypeFont = 16,
UnsupportedGdiplusVersion = 17,
GdiplusNotInitialized = 18,
PropertyNotFound = 19,
PropertyNotSupported = 20
};
//--------------------------------------------------------------------------
// Represents a dimension in a 2D coordinate system (floating-point coordinates)
//--------------------------------------------------------------------------
class SizeF
{
public:
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:
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:
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;
}
REAL GetLeft() const
{
return X;
}
REAL GetTop() const
{
return Y;
}
REAL GetRight() const
{
return X+Width;
}
REAL GetBottom() const
{
return Y+Height;
}
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);
}
BOOL Intersect(IN const RectF& rect)
{
return Intersect(*this, *this, rect);
}
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();
}
BOOL IntersectsWith(IN const RectF& rect) const
{
return (GetLeft() < rect.GetRight() &&
GetTop() < rect.GetBottom() &&
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:
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;
}
INT GetLeft() const
{
return X;
}
INT GetTop() const
{
return Y;
}
INT GetRight() const
{
return X+Width;
}
INT GetBottom() const
{
return Y+Height;
}
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);
}
BOOL Intersect(IN const Rect& rect)
{
return Intersect(*this, *this, rect);
}
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();
}
BOOL IntersectsWith(IN const Rect& rect) const
{
return (GetLeft() < rect.GetRight() &&
GetTop() < rect.GetBottom() &&
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;
};
class PathData
{
public:
PathData()
{
Count = 0;
Points = NULL;
Types = NULL;
}
~PathData()
{
if (Points != NULL)
{
delete Points;
}
if (Types != NULL)
{
delete Types;
}
}
private:
PathData(const PathData &);
PathData& operator=(const PathData &);
public:
INT Count;
PointF* Points;
BYTE* Types;
};
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

View File

@ -0,0 +1,377 @@
/**************************************************************************\
*
* Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* Image Attributes
*
* Abstract:
*
* GDI+ Image Attributes used with Graphics.DrawImage
*
* 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.
*
\********************************************************************F******/
#ifndef _GDIPLUSIMAGEATTRIBUTES_H
#define _GDIPLUSIMAGEATTRIBUTES_H
class GpImageAttributes;
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);
}
Status
SetToIdentity(
IN ColorAdjustType type = ColorAdjustTypeDefault
)
{
return SetStatus(DllExports::GdipSetImageAttributesToIdentity(
nativeImageAttr,
type));
}
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));
}
// 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;
}
private:
ImageAttributes(const ImageAttributes &);
ImageAttributes& operator=(const ImageAttributes &);
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