mirror of
https://github.com/reactos/reactos.git
synced 2025-04-05 21:21:33 +00:00
parent
dcc512a245
commit
9f4d733d1f
4 changed files with 408 additions and 92 deletions
|
@ -27,329 +27,563 @@ class Brush : public GdiplusBase
|
|||
friend class Graphics;
|
||||
friend class Pen;
|
||||
|
||||
Brush *Clone(VOID) const
|
||||
virtual ~Brush()
|
||||
{
|
||||
return NULL;
|
||||
DllExports::GdipDeleteBrush(nativeBrush);
|
||||
}
|
||||
|
||||
Status GetLastStatus(VOID)
|
||||
Brush *
|
||||
Clone() const
|
||||
{
|
||||
return status;
|
||||
GpBrush *brush = NULL;
|
||||
SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush));
|
||||
if (lastStatus != Ok)
|
||||
return NULL;
|
||||
|
||||
Brush *newBrush = new Brush(brush, lastStatus);
|
||||
if (newBrush == NULL)
|
||||
{
|
||||
DllExports::GdipDeleteBrush(brush);
|
||||
}
|
||||
return newBrush;
|
||||
}
|
||||
|
||||
BrushType GetType(VOID)
|
||||
Status
|
||||
GetLastStatus() const
|
||||
{
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
BrushType
|
||||
GetType() const
|
||||
{
|
||||
BrushType type;
|
||||
SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type));
|
||||
return type;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable Status status;
|
||||
protected:
|
||||
GpBrush *nativeBrush;
|
||||
mutable Status lastStatus;
|
||||
|
||||
Brush()
|
||||
{
|
||||
}
|
||||
|
||||
Brush(GpBrush *brush, Status status) : nativeBrush(brush), lastStatus(status)
|
||||
{
|
||||
}
|
||||
|
||||
Status
|
||||
SetStatus(Status status) const
|
||||
{
|
||||
if (status == Ok)
|
||||
return status;
|
||||
this->status = status;
|
||||
if (status != Ok)
|
||||
lastStatus = status;
|
||||
return status;
|
||||
}
|
||||
|
||||
void
|
||||
SetNativeBrush(GpBrush *brush)
|
||||
{
|
||||
nativeBrush = brush;
|
||||
}
|
||||
|
||||
private:
|
||||
// Brush is not copyable
|
||||
Brush(const Brush &);
|
||||
Brush &
|
||||
operator=(const Brush &);
|
||||
};
|
||||
|
||||
class HatchBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
HatchBrush(HatchStyle hatchStyle, const Color &foreColor, const Color &backColor)
|
||||
{
|
||||
GpHatch *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateHatchBrush(hatchStyle, foreColor.GetValue(), backColor.GetValue(), &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
Status
|
||||
GetBackgroundColor(Color *color) const
|
||||
{
|
||||
return NotImplemented;
|
||||
if (!color)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
ARGB argb;
|
||||
GpHatch *hatch = GetNativeHatch();
|
||||
SetStatus(DllExports::GdipGetHatchBackgroundColor(hatch, &argb));
|
||||
|
||||
color->SetValue(argb);
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
Status
|
||||
GetForegroundColor(Color *color) const
|
||||
{
|
||||
return NotImplemented;
|
||||
if (!color)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
ARGB argb;
|
||||
GpHatch *hatch = GetNativeHatch();
|
||||
SetStatus(DllExports::GdipGetHatchForegroundColor(hatch, &argb));
|
||||
|
||||
color->SetValue(argb);
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
HatchStyle GetHatchStyle(VOID) const
|
||||
HatchStyle
|
||||
GetHatchStyle() const
|
||||
{
|
||||
return HatchStyleHorizontal;
|
||||
HatchStyle hatchStyle;
|
||||
GpHatch *hatch = GetNativeHatch();
|
||||
SetStatus(DllExports::GdipGetHatchStyle(hatch, &hatchStyle));
|
||||
return hatchStyle;
|
||||
}
|
||||
|
||||
protected:
|
||||
HatchBrush()
|
||||
{
|
||||
}
|
||||
|
||||
GpHatch *
|
||||
GetNativeHatch() const
|
||||
{
|
||||
return static_cast<GpHatch *>(nativeBrush);
|
||||
}
|
||||
};
|
||||
|
||||
class LinearGradientBrush : public Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
LinearGradientBrush(const PointF &point1, const PointF &point2, const Color &color1, const Color &color2)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrush(
|
||||
&point1, &point2, color1.GetValue(), color2.GetValue(), WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(const Rect &rect, const Color &color1, const Color &color2, REAL angle, BOOL isAngleScalable)
|
||||
LinearGradientBrush(
|
||||
const Rect &rect,
|
||||
const Color &color1,
|
||||
const Color &color2,
|
||||
REAL angle,
|
||||
BOOL isAngleScalable = FALSE)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrushFromRectWithAngleI(
|
||||
&rect, color1.GetValue(), color2.GetValue(), angle, isAngleScalable, WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(const Rect &rect, const Color &color1, const Color &color2, LinearGradientMode mode)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrushFromRectI(
|
||||
&rect, color1.GetValue(), color2.GetValue(), mode, WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(const Point &point1, const Point &point2, const Color &color1, const Color &color2)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrushI(
|
||||
&point1, &point2, color1.GetValue(), color2.GetValue(), WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(const RectF &rect, const Color &color1, const Color &color2, REAL angle, BOOL isAngleScalable)
|
||||
LinearGradientBrush(
|
||||
const RectF &rect,
|
||||
const Color &color1,
|
||||
const Color &color2,
|
||||
REAL angle,
|
||||
BOOL isAngleScalable = FALSE)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrushFromRectWithAngle(
|
||||
&rect, color1.GetValue(), color2.GetValue(), angle, isAngleScalable, WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
LinearGradientBrush(const RectF &rect, const Color &color1, const Color &color2, LinearGradientMode mode)
|
||||
{
|
||||
GpLineGradient *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateLineBrushFromRect(
|
||||
&rect, color1.GetValue(), color2.GetValue(), mode, WrapModeTile, &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
Status
|
||||
GetBlend(REAL *blendFactors, REAL *blendPositions, INT count)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLineBlend(gradient, blendFactors, blendPositions, count));
|
||||
}
|
||||
|
||||
INT GetBlendCount(VOID) const
|
||||
INT
|
||||
GetBlendCount() const
|
||||
{
|
||||
return 0;
|
||||
INT count = 0;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
SetStatus(DllExports::GdipGetLineBlendCount(gradient, &count));
|
||||
return count;
|
||||
}
|
||||
|
||||
BOOL GetGammaCorrection(VOID) const
|
||||
BOOL
|
||||
GetGammaCorrection() const
|
||||
{
|
||||
return FALSE;
|
||||
BOOL useGammaCorrection;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
SetStatus(DllExports::GdipGetLineGammaCorrection(gradient, &useGammaCorrection));
|
||||
return useGammaCorrection;
|
||||
}
|
||||
|
||||
INT GetInterpolationColorCount(VOID) const
|
||||
INT
|
||||
GetInterpolationColorCount() const
|
||||
{
|
||||
return 0;
|
||||
INT count = 0;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
SetStatus(DllExports::GdipGetLinePresetBlendCount(gradient, &count));
|
||||
return count;
|
||||
}
|
||||
|
||||
Status
|
||||
GetInterpolationColors(Color *presetColors, REAL *blendPositions, INT count) const
|
||||
{
|
||||
return NotImplemented;
|
||||
return SetStatus(NotImplemented);
|
||||
}
|
||||
|
||||
Status
|
||||
GetLinearColors(Color *colors) const
|
||||
{
|
||||
return NotImplemented;
|
||||
if (!colors)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
|
||||
ARGB argb[2];
|
||||
SetStatus(DllExports::GdipGetLineColors(gradient, argb));
|
||||
if (lastStatus == Ok)
|
||||
{
|
||||
colors[0] = Color(argb[0]);
|
||||
colors[1] = Color(argb[1]);
|
||||
}
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
Status
|
||||
GetRectangle(Rect *rect) const
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLineRectI(gradient, rect));
|
||||
}
|
||||
|
||||
Status
|
||||
GetRectangle(RectF *rect) const
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLineRect(gradient, rect));
|
||||
}
|
||||
|
||||
Status
|
||||
GetTransform(Matrix *matrix) const
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLineTransform(gradient, matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
WrapMode GetWrapMode(VOID) const
|
||||
WrapMode
|
||||
GetWrapMode() const
|
||||
{
|
||||
return WrapModeTile;
|
||||
|
||||
WrapMode wrapMode;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
SetStatus(DllExports::GdipGetLineWrapMode(gradient, &wrapMode));
|
||||
return wrapMode;
|
||||
}
|
||||
|
||||
Status
|
||||
MultiplyTransform(const Matrix *matrix, MatrixOrder order)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipMultiplyLineTransform(gradient, matrix->nativeMatrix, order));
|
||||
}
|
||||
|
||||
Status ResetTransform(VOID)
|
||||
Status
|
||||
ResetTransform()
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipResetLineTransform(gradient));
|
||||
}
|
||||
|
||||
Status
|
||||
RotateTransform(REAL angle, MatrixOrder order)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipRotateLineTransform(gradient, angle, order));
|
||||
}
|
||||
|
||||
Status
|
||||
ScaleTransform(REAL sx, REAL sy, MatrixOrder order)
|
||||
ScaleTransform(REAL sx, REAL sy, MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipScaleLineTransform(gradient, sx, sy, order));
|
||||
}
|
||||
|
||||
Status
|
||||
SetBlend(const REAL *blendFactors, const REAL *blendPositions, INT count)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineBlend(gradient, blendFactors, blendPositions, count));
|
||||
}
|
||||
|
||||
Status
|
||||
SetBlendBellShape(REAL focus, REAL scale)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineSigmaBlend(gradient, focus, scale));
|
||||
}
|
||||
|
||||
Status
|
||||
SetBlendTriangularShape(REAL focus, REAL scale)
|
||||
SetBlendTriangularShape(REAL focus, REAL scale = 1.0f)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineLinearBlend(gradient, focus, scale));
|
||||
}
|
||||
|
||||
Status
|
||||
SetGammaCorrection(BOOL useGammaCorrection)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineGammaCorrection(gradient, useGammaCorrection));
|
||||
}
|
||||
|
||||
Status
|
||||
SetInterpolationColors(const Color *presetColors, const REAL *blendPositions, INT count)
|
||||
{
|
||||
return NotImplemented;
|
||||
return SetStatus(NotImplemented);
|
||||
}
|
||||
|
||||
Status
|
||||
SetLinearColors(const Color &color1, const Color &color2)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineColors(gradient, color1.GetValue(), color2.GetValue()));
|
||||
}
|
||||
|
||||
Status
|
||||
SetTransform(const Matrix *matrix)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineTransform(gradient, matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status
|
||||
SetWrapMode(WrapMode wrapMode)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLineWrapMode(gradient, wrapMode));
|
||||
}
|
||||
|
||||
Status
|
||||
TranslateTransform(REAL dx, REAL dy, MatrixOrder order)
|
||||
TranslateTransform(REAL dx, REAL dy, MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipTranslateLineTransform(gradient, dx, dy, order));
|
||||
}
|
||||
|
||||
Status
|
||||
SetLinearPoints(const PointF &point1, const PointF &point2)
|
||||
{
|
||||
#if 1
|
||||
return SetStatus(NotImplemented);
|
||||
#else
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLinePoints(gradient, &point1, &point2));
|
||||
#endif
|
||||
}
|
||||
|
||||
Status
|
||||
GetLinearPoints(PointF *points) const
|
||||
{
|
||||
#if 1
|
||||
return SetStatus(NotImplemented);
|
||||
#else
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLinePoints(gradient, points));
|
||||
#endif
|
||||
}
|
||||
|
||||
Status
|
||||
SetLinearPoints(const Point &point1, const Point &point2)
|
||||
{
|
||||
#if 1
|
||||
return SetStatus(NotImplemented);
|
||||
#else
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipSetLinePointsI(gradient, &point1, &point2));
|
||||
#endif
|
||||
}
|
||||
|
||||
Status
|
||||
GetLinearPoints(Point *points) const
|
||||
{
|
||||
#if 1
|
||||
return SetStatus(NotImplemented);
|
||||
#else
|
||||
GpLineGradient *gradient = GetNativeGradient();
|
||||
return SetStatus(DllExports::GdipGetLinePointsI(gradient, points));
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
GpLineGradient *
|
||||
GetNativeGradient() const
|
||||
{
|
||||
return static_cast<GpLineGradient *>(nativeBrush);
|
||||
}
|
||||
};
|
||||
|
||||
class SolidBrush : Brush
|
||||
{
|
||||
public:
|
||||
friend class Pen;
|
||||
|
||||
SolidBrush(const Color &color)
|
||||
{
|
||||
GpSolidFill *brush = NULL;
|
||||
lastStatus = DllExports::GdipCreateSolidFill(color.GetValue(), &brush);
|
||||
SetNativeBrush(brush);
|
||||
}
|
||||
|
||||
Status
|
||||
GetColor(Color *color) const
|
||||
{
|
||||
return NotImplemented;
|
||||
if (!color)
|
||||
return SetStatus(InvalidParameter);
|
||||
|
||||
ARGB argb;
|
||||
GpSolidFill *fill = GetNativeFill();
|
||||
SetStatus(DllExports::GdipGetSolidFillColor(fill, &argb));
|
||||
|
||||
*color = Color(argb);
|
||||
return lastStatus;
|
||||
}
|
||||
|
||||
Status
|
||||
SetColor(const Color &color)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpSolidFill *fill = GetNativeFill();
|
||||
return SetStatus(DllExports::GdipSetSolidFillColor(fill, color.GetValue()));
|
||||
}
|
||||
|
||||
protected:
|
||||
SolidBrush()
|
||||
{
|
||||
}
|
||||
|
||||
GpSolidFill *
|
||||
GetNativeFill() const
|
||||
{
|
||||
return static_cast<GpSolidFill *>(nativeBrush);
|
||||
}
|
||||
};
|
||||
|
||||
class TextureBrush : Brush
|
||||
{
|
||||
public:
|
||||
TextureBrush(Image *image, WrapMode wrapMode, const RectF &dstRect)
|
||||
{
|
||||
}
|
||||
// Defined in "gdiplusheaders.h":
|
||||
TextureBrush(Image *image, WrapMode wrapMode, const RectF &dstRect);
|
||||
TextureBrush(Image *image, Rect &dstRect, ImageAttributes *imageAttributes);
|
||||
TextureBrush(Image *image, WrapMode wrapMode, INT dstX, INT dstY, INT dstWidth, INT dstHeight);
|
||||
TextureBrush(Image *image, WrapMode wrapMode, REAL dstX, REAL dstY, REAL dstWidth, REAL dstHeight);
|
||||
TextureBrush(Image *image, RectF &dstRect, ImageAttributes *imageAttributes);
|
||||
TextureBrush(Image *image, WrapMode wrapMode);
|
||||
TextureBrush(Image *image, WrapMode wrapMode, const Rect &dstRect);
|
||||
|
||||
TextureBrush(Image *image, Rect &dstRect, ImageAttributes *imageAttributes)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBrush(Image *image, WrapMode wrapMode, INT dstX, INT dstY, INT dstWidth, INT dstHeight)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBrush(Image *image, WrapMode wrapMode, REAL dstX, REAL dstY, REAL dstWidth, REAL dstHeight)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBrush(Image *image, RectF &dstRect, ImageAttributes *imageAttributes)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBrush(Image *image, WrapMode wrapMode)
|
||||
{
|
||||
}
|
||||
|
||||
TextureBrush(Image *image, WrapMode wrapMode, const Rect &dstRect)
|
||||
{
|
||||
}
|
||||
|
||||
Image *GetImage(VOID) const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
Image *
|
||||
GetImage() const;
|
||||
|
||||
Status
|
||||
GetTransform(Matrix *matrix) const
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipGetTextureTransform(texture, matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
WrapMode GetWrapMode(VOID) const
|
||||
WrapMode
|
||||
GetWrapMode() const
|
||||
{
|
||||
return WrapModeTile;
|
||||
WrapMode wrapMode;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
SetStatus(DllExports::GdipGetTextureWrapMode(texture, &wrapMode));
|
||||
return wrapMode;
|
||||
}
|
||||
|
||||
Status
|
||||
MultiplyTransform(Matrix *matrix, MatrixOrder order)
|
||||
MultiplyTransform(Matrix *matrix, MatrixOrder order = MatrixOrderPrepend)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipMultiplyTextureTransform(texture, matrix->nativeMatrix, order));
|
||||
}
|
||||
|
||||
Status ResetTransform(VOID)
|
||||
Status
|
||||
ResetTransform()
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipResetTextureTransform(texture));
|
||||
}
|
||||
|
||||
Status
|
||||
RotateTransform(REAL angle, MatrixOrder order)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipRotateTextureTransform(texture, angle, order));
|
||||
}
|
||||
|
||||
Status
|
||||
ScaleTransform(REAL sx, REAL sy, MatrixOrder order)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipScaleTextureTransform(texture, sx, sy, order));
|
||||
}
|
||||
|
||||
Status
|
||||
SetTransform(const Matrix *matrix)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipSetTextureTransform(texture, matrix->nativeMatrix));
|
||||
}
|
||||
|
||||
Status
|
||||
SetWrapMode(WrapMode wrapMode)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipSetTextureWrapMode(texture, wrapMode));
|
||||
}
|
||||
|
||||
Status
|
||||
TranslateTransform(REAL dx, REAL dy, MatrixOrder order)
|
||||
{
|
||||
return NotImplemented;
|
||||
GpTexture *texture = GetNativeTexture();
|
||||
return SetStatus(DllExports::GdipTranslateTextureTransform(texture, dx, dy, order));
|
||||
}
|
||||
|
||||
protected:
|
||||
GpTexture *
|
||||
GetNativeTexture() const
|
||||
{
|
||||
return static_cast<GpTexture *>(nativeBrush);
|
||||
}
|
||||
|
||||
TextureBrush()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
class ImageAttributes : public GdiplusBase
|
||||
{
|
||||
public:
|
||||
friend class TextureBrush;
|
||||
|
||||
ImageAttributes() : nativeImageAttr(NULL)
|
||||
{
|
||||
lastStatus = DllExports::GdipCreateImageAttributes(&nativeImageAttr);
|
||||
|
|
|
@ -24,6 +24,9 @@ class Matrix : public GdiplusBase
|
|||
friend class Pen;
|
||||
friend class Region;
|
||||
friend class GraphicsPath;
|
||||
friend class Brush;
|
||||
friend class LinearGradientBrush;
|
||||
friend class TextureBrush;
|
||||
|
||||
public:
|
||||
Matrix(const RectF &rect, const PointF *dstplg)
|
||||
|
|
Loading…
Reference in a new issue