mirror of
https://github.com/reactos/reactos.git
synced 2025-06-12 14:58:29 +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 Graphics;
|
||||||
friend class Pen;
|
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;
|
BrushType type;
|
||||||
SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type));
|
SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type));
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
mutable Status status;
|
|
||||||
GpBrush *nativeBrush;
|
GpBrush *nativeBrush;
|
||||||
|
mutable Status lastStatus;
|
||||||
|
|
||||||
|
Brush()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Brush(GpBrush *brush, Status status) : nativeBrush(brush), lastStatus(status)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetStatus(Status status) const
|
SetStatus(Status status) const
|
||||||
{
|
{
|
||||||
if (status == Ok)
|
if (status != Ok)
|
||||||
return status;
|
lastStatus = status;
|
||||||
this->status = status;
|
|
||||||
return 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
|
class HatchBrush : public Brush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
friend class Pen;
|
||||||
|
|
||||||
HatchBrush(HatchStyle hatchStyle, const Color &foreColor, const Color &backColor)
|
HatchBrush(HatchStyle hatchStyle, const Color &foreColor, const Color &backColor)
|
||||||
{
|
{
|
||||||
|
GpHatch *brush = NULL;
|
||||||
|
lastStatus = DllExports::GdipCreateHatchBrush(hatchStyle, foreColor.GetValue(), backColor.GetValue(), &brush);
|
||||||
|
SetNativeBrush(brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetBackgroundColor(Color *color) const
|
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
|
Status
|
||||||
GetForegroundColor(Color *color) const
|
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
|
class LinearGradientBrush : public Brush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
friend class Pen;
|
||||||
|
|
||||||
LinearGradientBrush(const PointF &point1, const PointF &point2, const Color &color1, const Color &color2)
|
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)
|
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)
|
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)
|
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
|
Status
|
||||||
GetBlend(REAL *blendFactors, REAL *blendPositions, INT count)
|
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
|
Status
|
||||||
GetInterpolationColors(Color *presetColors, REAL *blendPositions, INT count) const
|
GetInterpolationColors(Color *presetColors, REAL *blendPositions, INT count) const
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
return SetStatus(NotImplemented);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetLinearColors(Color *colors) const
|
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
|
Status
|
||||||
GetRectangle(Rect *rect) const
|
GetRectangle(Rect *rect) const
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipGetLineRectI(gradient, rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetRectangle(RectF *rect) const
|
GetRectangle(RectF *rect) const
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipGetLineRect(gradient, rect));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetTransform(Matrix *matrix) const
|
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
|
Status
|
||||||
MultiplyTransform(const Matrix *matrix, MatrixOrder order)
|
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
|
Status
|
||||||
RotateTransform(REAL angle, MatrixOrder order)
|
RotateTransform(REAL angle, MatrixOrder order)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipRotateLineTransform(gradient, angle, order));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
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
|
Status
|
||||||
SetBlend(const REAL *blendFactors, const REAL *blendPositions, INT count)
|
SetBlend(const REAL *blendFactors, const REAL *blendPositions, INT count)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineBlend(gradient, blendFactors, blendPositions, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetBlendBellShape(REAL focus, REAL scale)
|
SetBlendBellShape(REAL focus, REAL scale)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineSigmaBlend(gradient, focus, scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
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
|
Status
|
||||||
SetGammaCorrection(BOOL useGammaCorrection)
|
SetGammaCorrection(BOOL useGammaCorrection)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineGammaCorrection(gradient, useGammaCorrection));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetInterpolationColors(const Color *presetColors, const REAL *blendPositions, INT count)
|
SetInterpolationColors(const Color *presetColors, const REAL *blendPositions, INT count)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
return SetStatus(NotImplemented);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetLinearColors(const Color &color1, const Color &color2)
|
SetLinearColors(const Color &color1, const Color &color2)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineColors(gradient, color1.GetValue(), color2.GetValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetTransform(const Matrix *matrix)
|
SetTransform(const Matrix *matrix)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineTransform(gradient, matrix->nativeMatrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetWrapMode(WrapMode wrapMode)
|
SetWrapMode(WrapMode wrapMode)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpLineGradient *gradient = GetNativeGradient();
|
||||||
|
return SetStatus(DllExports::GdipSetLineWrapMode(gradient, wrapMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
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
|
class SolidBrush : Brush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
friend class Pen;
|
||||||
|
|
||||||
SolidBrush(const Color &color)
|
SolidBrush(const Color &color)
|
||||||
{
|
{
|
||||||
|
GpSolidFill *brush = NULL;
|
||||||
|
lastStatus = DllExports::GdipCreateSolidFill(color.GetValue(), &brush);
|
||||||
|
SetNativeBrush(brush);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetColor(Color *color) const
|
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
|
Status
|
||||||
SetColor(const Color &color)
|
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
|
class TextureBrush : Brush
|
||||||
{
|
{
|
||||||
public:
|
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)
|
Image *
|
||||||
{
|
GetImage() const;
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status
|
Status
|
||||||
GetTransform(Matrix *matrix) const
|
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
|
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
|
Status
|
||||||
RotateTransform(REAL angle, MatrixOrder order)
|
RotateTransform(REAL angle, MatrixOrder order)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpTexture *texture = GetNativeTexture();
|
||||||
|
return SetStatus(DllExports::GdipRotateTextureTransform(texture, angle, order));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
ScaleTransform(REAL sx, REAL sy, MatrixOrder order)
|
ScaleTransform(REAL sx, REAL sy, MatrixOrder order)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpTexture *texture = GetNativeTexture();
|
||||||
|
return SetStatus(DllExports::GdipScaleTextureTransform(texture, sx, sy, order));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetTransform(const Matrix *matrix)
|
SetTransform(const Matrix *matrix)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpTexture *texture = GetNativeTexture();
|
||||||
|
return SetStatus(DllExports::GdipSetTextureTransform(texture, matrix->nativeMatrix));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
SetWrapMode(WrapMode wrapMode)
|
SetWrapMode(WrapMode wrapMode)
|
||||||
{
|
{
|
||||||
return NotImplemented;
|
GpTexture *texture = GetNativeTexture();
|
||||||
|
return SetStatus(DllExports::GdipSetTextureWrapMode(texture, wrapMode));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status
|
Status
|
||||||
TranslateTransform(REAL dx, REAL dy, MatrixOrder order)
|
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:
|
public:
|
||||||
friend class Graphics;
|
friend class Graphics;
|
||||||
|
friend class TextureBrush;
|
||||||
|
|
||||||
Image(IStream *stream, BOOL useEmbeddedColorManagement = FALSE) : nativeImage(NULL)
|
Image(IStream *stream, BOOL useEmbeddedColorManagement = FALSE) : nativeImage(NULL)
|
||||||
{
|
{
|
||||||
|
@ -1438,4 +1439,80 @@ class CustomLineCap : public GdiplusBase
|
||||||
operator=(const CustomLineCap &);
|
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 */
|
#endif /* _GDIPLUSHEADERS_H */
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
class ImageAttributes : public GdiplusBase
|
class ImageAttributes : public GdiplusBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
friend class TextureBrush;
|
||||||
|
|
||||||
ImageAttributes() : nativeImageAttr(NULL)
|
ImageAttributes() : nativeImageAttr(NULL)
|
||||||
{
|
{
|
||||||
lastStatus = DllExports::GdipCreateImageAttributes(&nativeImageAttr);
|
lastStatus = DllExports::GdipCreateImageAttributes(&nativeImageAttr);
|
||||||
|
|
|
@ -24,6 +24,9 @@ class Matrix : public GdiplusBase
|
||||||
friend class Pen;
|
friend class Pen;
|
||||||
friend class Region;
|
friend class Region;
|
||||||
friend class GraphicsPath;
|
friend class GraphicsPath;
|
||||||
|
friend class Brush;
|
||||||
|
friend class LinearGradientBrush;
|
||||||
|
friend class TextureBrush;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Matrix(const RectF &rect, const PointF *dstplg)
|
Matrix(const RectF &rect, const PointF *dstplg)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue