https://git.reactos.org/?p=reactos.git;a=commitdiff;h=265a890d7c417323aace1…
commit 265a890d7c417323aace1e74386eb78d98f05281
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Jan 1 19:10:47 2020 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Jan 1 19:10:47 2020 +0900
[SDK][INCLUDE] Improve gdiplusgraphics.h (#2222)
CORE-16585
---
sdk/include/psdk/gdiplusbase.h | 10 ++++
sdk/include/psdk/gdiplusgraphics.h | 102 ++++++++++++++++++---------------
sdk/include/psdk/gdiplusmetafile.h | 7 +++
sdk/include/psdk/gdiplusstringformat.h | 7 +++
4 files changed, 81 insertions(+), 45 deletions(-)
diff --git a/sdk/include/psdk/gdiplusbase.h b/sdk/include/psdk/gdiplusbase.h
index 92e3aafc7c5..7eeb5156b5e 100644
--- a/sdk/include/psdk/gdiplusbase.h
+++ b/sdk/include/psdk/gdiplusbase.h
@@ -61,6 +61,7 @@ class Matrix;
class Metafile;
class Pen;
class Region;
+class StringFormat;
// get native
GpBrush *&
@@ -72,6 +73,9 @@ getNat(const CachedBitmap *cb);
GpCustomLineCap *&
getNat(const CustomLineCap *cap);
+GpFont *&
+getNat(const Font *font);
+
GpFontCollection *&
getNat(const FontCollection *fc);
@@ -90,10 +94,16 @@ getNat(const ImageAttributes *ia);
GpMatrix *&
getNat(const Matrix *matrix);
+GpMetafile *&
+getNat(const Metafile *metafile);
+
GpPen *&
getNat(const Pen *pen);
GpRegion *&
getNat(const Region *region);
+GpStringFormat *&
+getNat(const StringFormat *sf);
+
#endif /* _GDIPLUSBASE_H */
diff --git a/sdk/include/psdk/gdiplusgraphics.h b/sdk/include/psdk/gdiplusgraphics.h
index d93dd542694..4f7bfff799f 100644
--- a/sdk/include/psdk/gdiplusgraphics.h
+++ b/sdk/include/psdk/gdiplusgraphics.h
@@ -25,6 +25,7 @@ class Graphics : public GdiplusBase
friend class Font;
friend class Bitmap;
friend class CachedBitmap;
+ friend class ImageAttributes;
public:
Graphics(Image *image)
@@ -248,7 +249,9 @@ class Graphics : public GdiplusBase
INT flags,
const Matrix *matrix)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipDrawDriverString(
+ nativeGraphics, text, length, font ? getNat(font) : NULL, brush ?
getNat(brush) : NULL, positions, flags,
+ matrix ? getNat(matrix) : NULL));
}
Status
@@ -569,13 +572,17 @@ class Graphics : public GdiplusBase
const StringFormat *stringFormat,
const Brush *brush)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipDrawString(
+ nativeGraphics, string, length, font ? getNat(font) : NULL, &layoutRect,
+ stringFormat ? getNat(stringFormat) : NULL, brush ? brush->nativeBrush :
NULL));
}
Status
DrawString(const WCHAR *string, INT length, const Font *font, const PointF
&origin, const Brush *brush)
{
- return NotImplemented;
+ RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
+ return SetStatus(DllExports::GdipDrawString(
+ nativeGraphics, string, length, font ? getNat(font) : NULL, &rect, NULL,
brush ? getNat(brush) : NULL));
}
Status
@@ -587,7 +594,10 @@ class Graphics : public GdiplusBase
const StringFormat *stringFormat,
const Brush *brush)
{
- return NotImplemented;
+ RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
+ return SetStatus(DllExports::GdipDrawString(
+ nativeGraphics, string, length, font ? getNat(font) : NULL, &rect,
+ stringFormat ? getNat(stringFormat) : NULL, brush ? getNat(brush) : NULL));
}
Status
@@ -599,12 +609,12 @@ class Graphics : public GdiplusBase
Status
EnumerateMetafile(
const Metafile *metafile,
- const Metafile &destPoint,
+ const PointF &destPoint,
EnumerateMetafileProc callback,
VOID *callbackData = NULL,
- ImageAttributes *imageAttributes = NULL)
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -613,10 +623,10 @@ class Graphics : public GdiplusBase
const Point *destPoints,
INT count,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -626,10 +636,10 @@ class Graphics : public GdiplusBase
const Rect &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -638,10 +648,10 @@ class Graphics : public GdiplusBase
const PointF *destPoints,
INT count,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -649,10 +659,10 @@ class Graphics : public GdiplusBase
const Metafile *metafile,
const Rect &destRect,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -662,10 +672,10 @@ class Graphics : public GdiplusBase
const RectF &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -673,23 +683,23 @@ class Graphics : public GdiplusBase
const Metafile *metafile,
const RectF &destRect,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
EnumerateMetafile(
const Metafile *metafile,
const PointF &destPoint,
- const Rect &srcRect,
+ const RectF &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -700,10 +710,10 @@ class Graphics : public GdiplusBase
const Rect &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -713,35 +723,35 @@ class Graphics : public GdiplusBase
const Rect &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
EnumerateMetafile(
const Metafile *metafile,
- const Point *destPoints,
+ const PointF *destPoints,
INT count,
const RectF &srcRect,
Unit srcUnit,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
EnumerateMetafile(
const Metafile *metafile,
- const PointF &destPoint,
+ const Point &destPoint,
EnumerateMetafileProc callback,
- VOID *callbackData,
- ImageAttributes *imageAttributes)
+ VOID *callbackData = NULL,
+ const ImageAttributes *imageAttributes = NULL)
{
- return NotImplemented;
+ return SetStatus(NotImplemented);
}
Status
@@ -1344,7 +1354,7 @@ class Graphics : public GdiplusBase
Status
Restore(GraphicsState gstate)
{
- return NotImplemented;
+ return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics, gstate));
}
Status
@@ -1356,7 +1366,9 @@ class Graphics : public GdiplusBase
GraphicsState
Save()
{
- return 0;
+ GraphicsState gstate;
+ SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate));
+ return gstate;
}
Status
diff --git a/sdk/include/psdk/gdiplusmetafile.h b/sdk/include/psdk/gdiplusmetafile.h
index ca9336281b9..9a217200272 100644
--- a/sdk/include/psdk/gdiplusmetafile.h
+++ b/sdk/include/psdk/gdiplusmetafile.h
@@ -242,6 +242,13 @@ class Metafile : public Image
{
return static_cast<GpMetafile *>(nativeImage);
}
+
+ // get native
+ friend inline GpMetafile *&
+ getNat(const Metafile *metafile)
+ {
+ return reinterpret_cast<GpMetafile *&>(const_cast<Metafile
*>(metafile)->nativeImage);
+ }
};
#endif /* _GDIPLUSMETAFILE_H */
diff --git a/sdk/include/psdk/gdiplusstringformat.h
b/sdk/include/psdk/gdiplusstringformat.h
index b94f06fff4c..471cb7d6e62 100644
--- a/sdk/include/psdk/gdiplusstringformat.h
+++ b/sdk/include/psdk/gdiplusstringformat.h
@@ -211,6 +211,13 @@ class StringFormat : public GdiplusBase
lastStatus = status;
return status;
}
+
+ // get native
+ friend inline GpStringFormat *&
+ getNat(const StringFormat *sf)
+ {
+ return const_cast<StringFormat *>(sf)->nativeFormat;
+ }
};
#endif /* _GDIPLUSSTRINGFORMAT_H */