[SDK][INCLUDE] Implement Gdiplus::Brush (#2205)

CORE-16585
This commit is contained in:
Katayama Hirofumi MZ 2019-12-31 14:54:41 +09:00 committed by GitHub
parent dcc512a245
commit 9f4d733d1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 408 additions and 92 deletions

View file

@ -23,6 +23,7 @@ class Image : public GdiplusBase
{
public:
friend class Graphics;
friend class TextureBrush;
Image(IStream *stream, BOOL useEmbeddedColorManagement = FALSE) : nativeImage(NULL)
{
@ -1438,4 +1439,80 @@ class CustomLineCap : public GdiplusBase
operator=(const CustomLineCap &);
};
inline TextureBrush::TextureBrush(Image *image, WrapMode wrapMode, const RectF &dstRect)
{
GpTexture *texture = NULL;
lastStatus = DllExports::GdipCreateTexture2(
image->nativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, Rect &dstRect, ImageAttributes *imageAttributes)
{
GpTexture *texture = NULL;
GpImageAttributes *attrs = imageAttributes ? imageAttributes->nativeImageAttr : NULL;
lastStatus = DllExports::GdipCreateTextureIA(
image->nativeImage, attrs, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, WrapMode wrapMode, INT dstX, INT dstY, INT dstWidth, INT dstHeight)
{
GpTexture *texture = NULL;
lastStatus =
DllExports::GdipCreateTexture2I(image->nativeImage, wrapMode, dstX, dstY, dstWidth, dstHeight, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, WrapMode wrapMode, REAL dstX, REAL dstY, REAL dstWidth, REAL dstHeight)
{
GpTexture *texture = NULL;
lastStatus =
DllExports::GdipCreateTexture2(image->nativeImage, wrapMode, dstX, dstY, dstWidth, dstHeight, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, RectF &dstRect, ImageAttributes *imageAttributes)
{
GpTexture *texture = NULL;
GpImageAttributes *attrs = imageAttributes ? imageAttributes->nativeImageAttr : NULL;
lastStatus = DllExports::GdipCreateTextureIA(
image->nativeImage, attrs, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, WrapMode wrapMode)
{
GpTexture *texture = NULL;
lastStatus = DllExports::GdipCreateTexture(image->nativeImage, wrapMode, &texture);
SetNativeBrush(texture);
}
inline TextureBrush::TextureBrush(Image *image, WrapMode wrapMode, const Rect &dstRect)
{
GpTexture *texture = NULL;
lastStatus = DllExports::GdipCreateTexture2I(
image->nativeImage, wrapMode, dstRect.X, dstRect.Y, dstRect.Width, dstRect.Height, &texture);
SetNativeBrush(texture);
}
inline Image *
TextureBrush::GetImage() const
{
#if 1
return NULL; // FIXME
#else
GpImage *image = NULL;
GpTexture *texture = GetNativeTexture();
SetStatus(DllExports::GdipGetTextureImage(texture, &image));
if (lastStatus != Ok)
return NULL;
Image *newImage = new Image(image, lastStatus);
if (!newImage)
DllExports::GdipDisposeImage(image);
return newImage;
#endif
}
#endif /* _GDIPLUSHEADERS_H */