[SDK][INCLUDE] Improve gdiplusgraphics.h (#2222)

CORE-16585
This commit is contained in:
Katayama Hirofumi MZ 2020-01-01 19:10:47 +09:00 committed by GitHub
parent 91f3c8f81a
commit 265a890d7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 81 additions and 45 deletions

View file

@ -61,6 +61,7 @@ class Matrix;
class Metafile; class Metafile;
class Pen; class Pen;
class Region; class Region;
class StringFormat;
// get native // get native
GpBrush *& GpBrush *&
@ -72,6 +73,9 @@ getNat(const CachedBitmap *cb);
GpCustomLineCap *& GpCustomLineCap *&
getNat(const CustomLineCap *cap); getNat(const CustomLineCap *cap);
GpFont *&
getNat(const Font *font);
GpFontCollection *& GpFontCollection *&
getNat(const FontCollection *fc); getNat(const FontCollection *fc);
@ -90,10 +94,16 @@ getNat(const ImageAttributes *ia);
GpMatrix *& GpMatrix *&
getNat(const Matrix *matrix); getNat(const Matrix *matrix);
GpMetafile *&
getNat(const Metafile *metafile);
GpPen *& GpPen *&
getNat(const Pen *pen); getNat(const Pen *pen);
GpRegion *& GpRegion *&
getNat(const Region *region); getNat(const Region *region);
GpStringFormat *&
getNat(const StringFormat *sf);
#endif /* _GDIPLUSBASE_H */ #endif /* _GDIPLUSBASE_H */

View file

@ -25,6 +25,7 @@ class Graphics : public GdiplusBase
friend class Font; friend class Font;
friend class Bitmap; friend class Bitmap;
friend class CachedBitmap; friend class CachedBitmap;
friend class ImageAttributes;
public: public:
Graphics(Image *image) Graphics(Image *image)
@ -248,7 +249,9 @@ class Graphics : public GdiplusBase
INT flags, INT flags,
const Matrix *matrix) 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 Status
@ -569,13 +572,17 @@ class Graphics : public GdiplusBase
const StringFormat *stringFormat, const StringFormat *stringFormat,
const Brush *brush) 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 Status
DrawString(const WCHAR *string, INT length, const Font *font, const PointF &origin, const Brush *brush) 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 Status
@ -587,7 +594,10 @@ class Graphics : public GdiplusBase
const StringFormat *stringFormat, const StringFormat *stringFormat,
const Brush *brush) 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 Status
@ -599,12 +609,12 @@ class Graphics : public GdiplusBase
Status Status
EnumerateMetafile( EnumerateMetafile(
const Metafile *metafile, const Metafile *metafile,
const Metafile &destPoint, const PointF &destPoint,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData = NULL, VOID *callbackData = NULL,
ImageAttributes *imageAttributes = NULL) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -613,10 +623,10 @@ class Graphics : public GdiplusBase
const Point *destPoints, const Point *destPoints,
INT count, INT count,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -626,10 +636,10 @@ class Graphics : public GdiplusBase
const Rect &srcRect, const Rect &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -638,10 +648,10 @@ class Graphics : public GdiplusBase
const PointF *destPoints, const PointF *destPoints,
INT count, INT count,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -649,10 +659,10 @@ class Graphics : public GdiplusBase
const Metafile *metafile, const Metafile *metafile,
const Rect &destRect, const Rect &destRect,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -662,10 +672,10 @@ class Graphics : public GdiplusBase
const RectF &srcRect, const RectF &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -673,23 +683,23 @@ class Graphics : public GdiplusBase
const Metafile *metafile, const Metafile *metafile,
const RectF &destRect, const RectF &destRect,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
EnumerateMetafile( EnumerateMetafile(
const Metafile *metafile, const Metafile *metafile,
const PointF &destPoint, const PointF &destPoint,
const Rect &srcRect, const RectF &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -700,10 +710,10 @@ class Graphics : public GdiplusBase
const Rect &srcRect, const Rect &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -713,35 +723,35 @@ class Graphics : public GdiplusBase
const Rect &srcRect, const Rect &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
EnumerateMetafile( EnumerateMetafile(
const Metafile *metafile, const Metafile *metafile,
const Point *destPoints, const PointF *destPoints,
INT count, INT count,
const RectF &srcRect, const RectF &srcRect,
Unit srcUnit, Unit srcUnit,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
EnumerateMetafile( EnumerateMetafile(
const Metafile *metafile, const Metafile *metafile,
const PointF &destPoint, const Point &destPoint,
EnumerateMetafileProc callback, EnumerateMetafileProc callback,
VOID *callbackData, VOID *callbackData = NULL,
ImageAttributes *imageAttributes) const ImageAttributes *imageAttributes = NULL)
{ {
return NotImplemented; return SetStatus(NotImplemented);
} }
Status Status
@ -1344,7 +1354,7 @@ class Graphics : public GdiplusBase
Status Status
Restore(GraphicsState gstate) Restore(GraphicsState gstate)
{ {
return NotImplemented; return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics, gstate));
} }
Status Status
@ -1356,7 +1366,9 @@ class Graphics : public GdiplusBase
GraphicsState GraphicsState
Save() Save()
{ {
return 0; GraphicsState gstate;
SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate));
return gstate;
} }
Status Status

View file

@ -242,6 +242,13 @@ class Metafile : public Image
{ {
return static_cast<GpMetafile *>(nativeImage); 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 */ #endif /* _GDIPLUSMETAFILE_H */

View file

@ -211,6 +211,13 @@ class StringFormat : public GdiplusBase
lastStatus = status; lastStatus = status;
return status; return status;
} }
// get native
friend inline GpStringFormat *&
getNat(const StringFormat *sf)
{
return const_cast<StringFormat *>(sf)->nativeFormat;
}
}; };
#endif /* _GDIPLUSSTRINGFORMAT_H */ #endif /* _GDIPLUSSTRINGFORMAT_H */