mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 19:43:31 +08:00
[SDK][INCLUDE] Refinement of Gdiplus headers (#2217)
Define getNat helper functions in gdiplusbase.h and use them. CORE-16585
This commit is contained in:
parent
9ba5594599
commit
84de8c3f25
@ -47,4 +47,53 @@ class GdiplusBase
|
||||
}
|
||||
};
|
||||
|
||||
class Brush;
|
||||
class CachedBitmap;
|
||||
class CustomLineCap;
|
||||
class Font;
|
||||
class FontCollection;
|
||||
class FontFamily;
|
||||
class Graphics;
|
||||
class GraphicsPath;
|
||||
class Image;
|
||||
class ImageAttributes;
|
||||
class Matrix;
|
||||
class Metafile;
|
||||
class Pen;
|
||||
class Region;
|
||||
|
||||
// get native
|
||||
GpBrush *&
|
||||
getNat(const Brush *brush);
|
||||
|
||||
GpCachedBitmap *&
|
||||
getNat(const CachedBitmap *cb);
|
||||
|
||||
GpCustomLineCap *&
|
||||
getNat(const CustomLineCap *cap);
|
||||
|
||||
GpFontCollection *&
|
||||
getNat(const FontCollection *fc);
|
||||
|
||||
GpGraphics *&
|
||||
getNat(const Graphics *graphics);
|
||||
|
||||
GpPath *&
|
||||
getNat(const GraphicsPath *path);
|
||||
|
||||
GpImage *&
|
||||
getNat(const Image *image);
|
||||
|
||||
GpImageAttributes *&
|
||||
getNat(const ImageAttributes *ia);
|
||||
|
||||
GpMatrix *&
|
||||
getNat(const Matrix *matrix);
|
||||
|
||||
GpPen *&
|
||||
getNat(const Pen *pen);
|
||||
|
||||
GpRegion *&
|
||||
getNat(const Region *region);
|
||||
|
||||
#endif /* _GDIPLUSBASE_H */
|
||||
|
@ -19,8 +19,6 @@
|
||||
#ifndef _GDIPLUSBRUSH_H
|
||||
#define _GDIPLUSBRUSH_H
|
||||
|
||||
class Image;
|
||||
|
||||
class Brush : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
@ -302,7 +300,7 @@ class LinearGradientBrush : public Brush
|
||||
GetTransform(Matrix *matrix) const
|
||||
{
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLineTransform(gradient, matrix->nativeMatrix));
|
||||
return SetStatus(DllExports::GdipGetLineTransform(gradient, getNat(matrix)));
|
||||
}
|
||||
|
||||
WrapMode
|
||||
@ -319,7 +317,7 @@ class LinearGradientBrush : public Brush
|
||||
MultiplyTransform(const Matrix *matrix, MatrixOrder order)
|
||||
{
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipMultiplyLineTransform(gradient, matrix->nativeMatrix, order));
|
||||
return SetStatus(DllExports::GdipMultiplyLineTransform(gradient, getNat(matrix), order));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -388,7 +386,7 @@ class LinearGradientBrush : public Brush
|
||||
SetTransform(const Matrix *matrix)
|
||||
{
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineTransform(gradient, matrix->nativeMatrix));
|
||||
return SetStatus(DllExports::GdipSetLineTransform(gradient, getNat(matrix)));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -502,10 +500,6 @@ class SolidBrush : Brush
|
||||
}
|
||||
};
|
||||
|
||||
// get native
|
||||
GpImage *&
|
||||
getNat(const Image *image);
|
||||
|
||||
class TextureBrush : Brush
|
||||
{
|
||||
public:
|
||||
@ -520,7 +514,7 @@ class TextureBrush : Brush
|
||||
TextureBrush(Image *image, Rect &dstRect, ImageAttributes *imageAttributes)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
GpImageAttributes *attrs = imageAttributes ? imageAttributes->nativeImageAttr : NULL;
|
||||
GpImageAttributes *attrs = imageAttributes ? getNat(imageAttributes) : NULL;
|
||||
lastStatus = DllExports::GdipCreateTextureIA(
|
||||
getNat(image), attrs, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
|
||||
SetNativeBrush(texture);
|
||||
@ -544,7 +538,7 @@ class TextureBrush : Brush
|
||||
TextureBrush(Image *image, RectF &dstRect, ImageAttributes *imageAttributes)
|
||||
{
|
||||
GpTexture *texture = NULL;
|
||||
GpImageAttributes *attrs = imageAttributes ? imageAttributes->nativeImageAttr : NULL;
|
||||
GpImageAttributes *attrs = imageAttributes ? getNat(imageAttributes) : NULL;
|
||||
lastStatus = DllExports::GdipCreateTextureIA(
|
||||
getNat(image), attrs, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
|
||||
SetNativeBrush(texture);
|
||||
@ -573,7 +567,7 @@ class TextureBrush : Brush
|
||||
GetTransform(Matrix *matrix) const
|
||||
{
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipGetTextureTransform(texture, matrix->nativeMatrix));
|
||||
return SetStatus(DllExports::GdipGetTextureTransform(texture, getNat(matrix)));
|
||||
}
|
||||
|
||||
WrapMode
|
||||
@ -589,7 +583,7 @@ class TextureBrush : Brush
|
||||
MultiplyTransform(Matrix *matrix, MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipMultiplyTextureTransform(texture, matrix->nativeMatrix, order));
|
||||
return SetStatus(DllExports::GdipMultiplyTextureTransform(texture, getNat(matrix), order));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -617,7 +611,7 @@ class TextureBrush : Brush
|
||||
SetTransform(const Matrix *matrix)
|
||||
{
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipSetTextureTransform(texture, matrix->nativeMatrix));
|
||||
return SetStatus(DllExports::GdipSetTextureTransform(texture, getNat(matrix)));
|
||||
}
|
||||
|
||||
Status
|
||||
|
@ -19,39 +19,6 @@
|
||||
#ifndef _GDIPLUSGRAPHICS_H
|
||||
#define _GDIPLUSGRAPHICS_H
|
||||
|
||||
class Image;
|
||||
class ImageAttributes;
|
||||
class CachedBitmap;
|
||||
class Region;
|
||||
class Font;
|
||||
class GraphicsPath;
|
||||
class Metafile;
|
||||
|
||||
// get native
|
||||
GpImage *&
|
||||
getNat(const Image *image);
|
||||
|
||||
GpPen *&
|
||||
getNat(const Pen *pen);
|
||||
|
||||
GpBrush *&
|
||||
getNat(const Brush *brush);
|
||||
|
||||
GpCachedBitmap *&
|
||||
getNat(const CachedBitmap *cb);
|
||||
|
||||
GpImageAttributes *&
|
||||
getNat(const ImageAttributes *ia);
|
||||
|
||||
GpRegion *&
|
||||
getNat(const Region *region);
|
||||
|
||||
GpMatrix *&
|
||||
getNat(const Matrix *matrix);
|
||||
|
||||
GpPath *&
|
||||
getNat(const GraphicsPath *path);
|
||||
|
||||
class Graphics : public GdiplusBase
|
||||
{
|
||||
friend class Region;
|
||||
@ -1401,7 +1368,7 @@ class Graphics : public GdiplusBase
|
||||
Status
|
||||
SetClip(const Graphics *g, CombineMode combineMode = CombineModeReplace)
|
||||
{
|
||||
return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics, g ? g->nativeGraphics : NULL, combineMode));
|
||||
return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics, g ? getNat(g) : NULL, combineMode));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -1553,9 +1520,9 @@ class Graphics : public GdiplusBase
|
||||
|
||||
// get native
|
||||
friend inline GpGraphics *&
|
||||
getNat(const Graphics *graph)
|
||||
getNat(const Graphics *graphics)
|
||||
{
|
||||
return const_cast<Graphics *>(graph)->nativeGraphics;
|
||||
return const_cast<Graphics *>(graphics)->nativeGraphics;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -310,7 +310,7 @@ class Image : public GdiplusBase
|
||||
if (!newImage)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
return SetStatus(DllExports::GdipSaveAddImage(nativeImage, newImage->nativeImage, encoderParams));
|
||||
return SetStatus(DllExports::GdipSaveAddImage(nativeImage, getNat(newImage), encoderParams));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -386,10 +386,6 @@ class Image : public GdiplusBase
|
||||
}
|
||||
};
|
||||
|
||||
// get native
|
||||
GpGraphics *&
|
||||
getNat(const Graphics *graph);
|
||||
|
||||
class Bitmap : public Image
|
||||
{
|
||||
friend class CachedBitmap;
|
||||
@ -714,6 +710,13 @@ class FontCollection : public GdiplusBase
|
||||
FontCollection(const FontCollection &);
|
||||
FontCollection &
|
||||
operator=(const FontCollection &);
|
||||
|
||||
// get native
|
||||
friend inline GpFontCollection *&
|
||||
getNat(const FontCollection *fc)
|
||||
{
|
||||
return const_cast<FontCollection *>(fc)->nativeFontCollection;
|
||||
}
|
||||
};
|
||||
|
||||
class FontFamily : public GdiplusBase
|
||||
@ -727,7 +730,7 @@ class FontFamily : public GdiplusBase
|
||||
|
||||
FontFamily(const WCHAR *name, const FontCollection *fontCollection)
|
||||
{
|
||||
GpFontCollection *theCollection = fontCollection ? fontCollection->nativeFontCollection : NULL;
|
||||
GpFontCollection *theCollection = fontCollection ? getNat(fontCollection) : NULL;
|
||||
status = DllExports::GdipCreateFontFamilyFromName(name, theCollection, &fontFamily);
|
||||
}
|
||||
|
||||
@ -834,6 +837,13 @@ class FontFamily : public GdiplusBase
|
||||
this->status = status;
|
||||
return status;
|
||||
}
|
||||
|
||||
// get native
|
||||
friend inline GpFontFamily *&
|
||||
getNat(const FontFamily *ff)
|
||||
{
|
||||
return const_cast<FontFamily *>(ff)->fontFamily;
|
||||
}
|
||||
};
|
||||
|
||||
class InstalledFontFamily : public FontFamily
|
||||
@ -1001,6 +1011,13 @@ class Font : public GdiplusBase
|
||||
this->status = status;
|
||||
return status;
|
||||
}
|
||||
|
||||
// get native
|
||||
friend inline GpFont *&
|
||||
getNat(const Font *font)
|
||||
{
|
||||
return const_cast<Font *>(font)->font;
|
||||
}
|
||||
};
|
||||
|
||||
class Region : public GdiplusBase
|
||||
@ -1027,7 +1044,7 @@ class Region : public GdiplusBase
|
||||
|
||||
Region(const GraphicsPath *path)
|
||||
{
|
||||
lastStatus = DllExports::GdipCreateRegionPath(path->nativePath, &nativeRegion);
|
||||
lastStatus = DllExports::GdipCreateRegionPath(getNat(path), &nativeRegion);
|
||||
}
|
||||
|
||||
Region(HRGN hRgn)
|
||||
@ -1052,7 +1069,7 @@ class Region : public GdiplusBase
|
||||
Status
|
||||
Complement(const GraphicsPath *path)
|
||||
{
|
||||
GpPath *thePath = path ? path->nativePath : NULL;
|
||||
GpPath *thePath = path ? getNat(path) : NULL;
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, thePath, CombineModeComplement));
|
||||
}
|
||||
|
||||
@ -1088,7 +1105,7 @@ class Region : public GdiplusBase
|
||||
Exclude(const GraphicsPath *path)
|
||||
{
|
||||
return SetStatus(
|
||||
DllExports::GdipCombineRegionPath(nativeRegion, path ? path->nativePath : NULL, CombineModeExclude));
|
||||
DllExports::GdipCombineRegionPath(nativeRegion, path ? getNat(path) : NULL, CombineModeExclude));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -1159,22 +1176,20 @@ class Region : public GdiplusBase
|
||||
Status
|
||||
GetRegionScans(const Matrix *matrix, Rect *rects, INT *count) const
|
||||
{
|
||||
return SetStatus(
|
||||
DllExports::GdipGetRegionScansI(nativeRegion, rects, count, matrix ? matrix->nativeMatrix : NULL));
|
||||
return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion, rects, count, matrix ? getNat(matrix) : NULL));
|
||||
}
|
||||
|
||||
Status
|
||||
GetRegionScans(const Matrix *matrix, RectF *rects, INT *count) const
|
||||
{
|
||||
return SetStatus(
|
||||
DllExports::GdipGetRegionScans(nativeRegion, rects, count, matrix ? matrix->nativeMatrix : NULL));
|
||||
return SetStatus(DllExports::GdipGetRegionScans(nativeRegion, rects, count, matrix ? getNat(matrix) : NULL));
|
||||
}
|
||||
|
||||
UINT
|
||||
GetRegionScansCount(const Matrix *matrix) const
|
||||
{
|
||||
UINT count;
|
||||
SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion, &count, matrix ? matrix->nativeMatrix : NULL));
|
||||
SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion, &count, matrix ? getNat(matrix) : NULL));
|
||||
return count;
|
||||
}
|
||||
|
||||
@ -1187,7 +1202,7 @@ class Region : public GdiplusBase
|
||||
Status
|
||||
Intersect(const GraphicsPath *path)
|
||||
{
|
||||
GpPath *thePath = path ? path->nativePath : NULL;
|
||||
GpPath *thePath = path ? getNat(path) : NULL;
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, thePath, CombineModeIntersect));
|
||||
}
|
||||
|
||||
@ -1303,7 +1318,7 @@ class Region : public GdiplusBase
|
||||
Status
|
||||
Transform(const Matrix *matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipTransformRegion(nativeRegion, matrix ? matrix->nativeMatrix : NULL));
|
||||
return SetStatus(DllExports::GdipTransformRegion(nativeRegion, matrix ? getNat(matrix) : NULL));
|
||||
}
|
||||
|
||||
Status
|
||||
@ -1340,15 +1355,13 @@ class Region : public GdiplusBase
|
||||
Status
|
||||
Union(const GraphicsPath *path)
|
||||
{
|
||||
return SetStatus(
|
||||
DllExports::GdipCombineRegionPath(nativeRegion, path ? path->nativePath : NULL, CombineModeUnion));
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path ? getNat(path) : NULL, CombineModeUnion));
|
||||
}
|
||||
|
||||
Status
|
||||
Xor(const GraphicsPath *path)
|
||||
{
|
||||
return SetStatus(
|
||||
DllExports::GdipCombineRegionPath(nativeRegion, path ? path->nativePath : NULL, CombineModeXor));
|
||||
return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path ? getNat(path) : NULL, CombineModeXor));
|
||||
}
|
||||
|
||||
Status
|
||||
|
@ -27,8 +27,8 @@ inline CustomLineCap::CustomLineCap(
|
||||
: nativeCap(NULL)
|
||||
{
|
||||
nativeCap = NULL;
|
||||
GpPath *nativeFillPath = fillPath ? fillPath->nativePath : NULL;
|
||||
GpPath *nativeStrokePath = strokePath ? strokePath->nativePath : NULL;
|
||||
GpPath *nativeFillPath = fillPath ? getNat(fillPath) : NULL;
|
||||
GpPath *nativeStrokePath = strokePath ? getNat(strokePath) : NULL;
|
||||
lastStatus = DllExports::GdipCreateCustomLineCap(nativeFillPath, nativeStrokePath, baseCap, baseInset, &nativeCap);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Matrix : public GdiplusBase
|
||||
Equals(const Matrix *matrix)
|
||||
{
|
||||
BOOL result;
|
||||
SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, &result));
|
||||
SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, matrix ? getNat(matrix) : NULL, &result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ class Matrix : public GdiplusBase
|
||||
Status
|
||||
Multiply(const Matrix *matrix, MatrixOrder order)
|
||||
{
|
||||
return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, matrix ? matrix->nativeMatrix : NULL, order));
|
||||
return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, matrix ? getNat(matrix) : NULL, order));
|
||||
}
|
||||
|
||||
REAL OffsetX(VOID)
|
||||
|
@ -19,9 +19,6 @@
|
||||
#ifndef _GDIPLUSPATH_H
|
||||
#define _GDIPLUSPATH_H
|
||||
|
||||
class FontFamily;
|
||||
class Graphics;
|
||||
|
||||
class GraphicsPath : public GdiplusBase
|
||||
{
|
||||
friend class Region;
|
||||
@ -233,10 +230,7 @@ class GraphicsPath : public GdiplusBase
|
||||
Status
|
||||
AddPath(const GraphicsPath *addingPath, BOOL connect)
|
||||
{
|
||||
GpPath *nativePath2 = NULL;
|
||||
if (addingPath)
|
||||
nativePath2 = addingPath->nativePath;
|
||||
|
||||
GpPath *nativePath2 = addingPath ? getNat(addingPath) : NULL;
|
||||
return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect));
|
||||
}
|
||||
|
||||
@ -383,10 +377,7 @@ class GraphicsPath : public GdiplusBase
|
||||
Status
|
||||
Flatten(const Matrix *matrix, REAL flatness)
|
||||
{
|
||||
GpMatrix *nativeMatrix = NULL;
|
||||
if (matrix)
|
||||
nativeMatrix = matrix->nativeMatrix;
|
||||
|
||||
GpMatrix *nativeMatrix = matrix ? getNat(matrix) : NULL;
|
||||
return SetStatus(DllExports::GdipFlattenPath(nativePath, nativeMatrix, flatness));
|
||||
}
|
||||
|
||||
@ -553,10 +544,7 @@ class GraphicsPath : public GdiplusBase
|
||||
WarpMode warpMode,
|
||||
REAL flatness)
|
||||
{
|
||||
GpMatrix *nativeMatrix = NULL;
|
||||
if (matrix)
|
||||
nativeMatrix = matrix->nativeMatrix;
|
||||
|
||||
GpMatrix *nativeMatrix = matrix ? getNat(matrix) : NULL;
|
||||
return SetStatus(DllExports::GdipWarpPath(
|
||||
nativePath, nativeMatrix, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode,
|
||||
flatness));
|
||||
|
@ -19,12 +19,6 @@
|
||||
#ifndef _GDIPLUSPEN_H
|
||||
#define _GDIPLUSPEN_H
|
||||
|
||||
class CustomLineCap;
|
||||
|
||||
// get native
|
||||
GpCustomLineCap *&
|
||||
getNat(const CustomLineCap *cap);
|
||||
|
||||
class Pen : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
@ -33,7 +27,7 @@ class Pen : public GdiplusBase
|
||||
|
||||
Pen(const Brush *brush, REAL width = 1.0f) : nativePen(NULL)
|
||||
{
|
||||
lastStatus = DllExports::GdipCreatePen2(brush->nativeBrush, width, UnitWorld, &nativePen);
|
||||
lastStatus = DllExports::GdipCreatePen2(getNat(brush), width, UnitWorld, &nativePen);
|
||||
}
|
||||
|
||||
Pen(const Color &color, REAL width = 1.0f) : nativePen(NULL)
|
||||
@ -218,7 +212,7 @@ class Pen : public GdiplusBase
|
||||
Status
|
||||
GetTransform(Matrix *matrix)
|
||||
{
|
||||
return SetStatus(DllExports::GdipGetPenTransform(nativePen, matrix->nativeMatrix));
|
||||
return SetStatus(DllExports::GdipGetPenTransform(nativePen, getNat(matrix)));
|
||||
}
|
||||
|
||||
REAL
|
||||
@ -235,7 +229,7 @@ class Pen : public GdiplusBase
|
||||
#if 1
|
||||
return SetStatus(NotImplemented);
|
||||
#else
|
||||
return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, matrix->nativeMatrix, order));
|
||||
return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, getNat(matrix), order));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -266,7 +260,7 @@ class Pen : public GdiplusBase
|
||||
Status
|
||||
SetBrush(const Brush *brush)
|
||||
{
|
||||
GpBrush *theBrush = brush ? brush->nativeBrush : NULL;
|
||||
GpBrush *theBrush = brush ? getNat(brush) : NULL;
|
||||
return SetStatus(DllExports::GdipSetPenBrushFill(nativePen, theBrush));
|
||||
}
|
||||
|
||||
@ -353,7 +347,7 @@ class Pen : public GdiplusBase
|
||||
Status
|
||||
SetTransform(const Matrix *matrix)
|
||||
{
|
||||
GpMatrix *mat = matrix ? matrix->nativeMatrix : NULL;
|
||||
GpMatrix *mat = matrix ? getNat(matrix) : NULL;
|
||||
return SetStatus(DllExports::GdipSetPenTransform(nativePen, mat));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user