📄 gdipluspath.h
字号:
}
return SetStatus(DllExports::GdipWindingModeOutline(
nativePath, nativeMatrix, flatness
));
}
/**
* Warp the path object
* Once this is called, the resultant path is made of line segments and
* the original path information is lost.
* When matrix = NULL, the identity matrix is assumed.
*/
Status Warp(IN const PointF* destPoints,
IN INT count,
IN const RectF& srcRect,
IN const Matrix* matrix = NULL,
IN WarpMode warpMode = WarpModePerspective,
IN REAL flatness = FlatnessDefault)
{
GpMatrix* nativeMatrix = NULL;
if(matrix)
nativeMatrix = matrix->nativeMatrix;
return SetStatus(DllExports::GdipWarpPath(
nativePath,
nativeMatrix,
destPoints,
count,
srcRect.X,
srcRect.Y,
srcRect.Width,
srcRect.Height,
warpMode,
flatness));
}
/**
* Return the number of points in the current path
*/
INT GetPointCount() const
{
INT count = 0;
SetStatus(DllExports::GdipGetPointCount(nativePath, &count));
return count;
}
/**
* Return the path point type information
*/
Status GetPathTypes(OUT BYTE* types,
IN INT count) const
{
return SetStatus(DllExports::GdipGetPathTypes(nativePath, types, count));
}
/**
* Return the path point coordinate information
* @notes Should there be PathData that contains types[] and points[]
* for get & set purposes.
*/
Status GetPathPoints(OUT PointF* points,
IN INT count) const
{
return SetStatus(DllExports::GdipGetPathPoints(nativePath, points, count));
}
// integer version
Status GetPathPoints(OUT Point* points,
IN INT count) const
{
return SetStatus(DllExports::GdipGetPathPointsI(nativePath, points, count));
}
Status GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return lastStatus;
}
/**
* Hit testing operations
*
* inline implementation is in gdiplusgraphics.h.
*/
BOOL IsVisible(IN const PointF& point,
IN const Graphics* g = NULL) const
{
return IsVisible(point.X, point.Y, g);
}
BOOL IsVisible(IN REAL x,
IN REAL y,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN const Point& point,
IN const Graphics* g = NULL) const
{
return IsVisible(point.X, point.Y, g);
}
BOOL IsVisible(IN INT x,
IN INT y,
IN const Graphics* g = NULL) const;
BOOL IsOutlineVisible(IN const PointF& point,
IN const Pen* pen,
IN const Graphics* g = NULL) const
{
return IsOutlineVisible(point.X, point.Y, pen, g);
}
BOOL IsOutlineVisible(IN REAL x,
IN REAL y,
IN const Pen* pen,
IN const Graphics* g = NULL) const;
BOOL IsOutlineVisible(IN const Point& point,
IN const Pen* pen,
IN const Graphics* g = NULL) const
{
return IsOutlineVisible(point.X, point.Y, pen, g);
}
BOOL IsOutlineVisible(IN INT x,
IN INT y,
IN const Pen* pen,
IN const Graphics* g = NULL) const;
protected:
GraphicsPath(const GraphicsPath& path)
{
GpPath *clonepath = NULL;
SetStatus(DllExports::GdipClonePath(path.nativePath, &clonepath));
SetNativePath(clonepath);
}
#ifdef DCR_USE_NEW_250932
private:
GraphicsPath& operator=(const GraphicsPath &);
protected:
#else
GraphicsPath& operator=(const GraphicsPath& path)
{
path;
SetStatus(NotImplemented);
return *this;
}
#endif
GraphicsPath(GpPath* nativePath)
{
lastResult = Ok;
SetNativePath(nativePath);
}
VOID SetNativePath(GpPath *nativePath)
{
this->nativePath = nativePath;
}
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
protected:
GpPath* nativePath;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// GraphisPathIterator class
//--------------------------------------------------------------------------
class GraphicsPathIterator : public GdiplusBase
{
public:
GraphicsPathIterator(IN const GraphicsPath* path)
{
GpPath* nativePath = NULL;
if(path)
nativePath = path->nativePath;
GpPathIterator *iter = NULL;
lastResult = DllExports::GdipCreatePathIter(&iter, nativePath);
SetNativeIterator(iter);
}
~GraphicsPathIterator()
{
DllExports::GdipDeletePathIter(nativeIterator);
}
INT NextSubpath(OUT INT* startIndex,
OUT INT* endIndex,
OUT BOOL* isClosed)
{
INT resultCount;
SetStatus(DllExports::GdipPathIterNextSubpath(nativeIterator,
&resultCount, startIndex, endIndex, isClosed));
return resultCount;
}
INT NextSubpath(IN const GraphicsPath* path,
OUT BOOL* isClosed)
{
GpPath* nativePath = NULL;
INT resultCount;
if(path)
nativePath= path->nativePath;
SetStatus(DllExports::GdipPathIterNextSubpathPath(nativeIterator,
&resultCount, nativePath, isClosed));
return resultCount;
}
INT NextPathType(OUT BYTE* pathType,
OUT INT* startIndex,
OUT INT* endIndex)
{
INT resultCount;
SetStatus(DllExports::GdipPathIterNextPathType(nativeIterator,
&resultCount, pathType, startIndex, endIndex));
return resultCount;
}
INT NextMarker(OUT INT* startIndex,
OUT INT* endIndex)
{
INT resultCount;
SetStatus(DllExports::GdipPathIterNextMarker(nativeIterator,
&resultCount, startIndex, endIndex));
return resultCount;
}
INT NextMarker(IN const GraphicsPath* path)
{
GpPath* nativePath = NULL;
INT resultCount;
if(path)
nativePath= path->nativePath;
SetStatus(DllExports::GdipPathIterNextMarkerPath(nativeIterator,
&resultCount, nativePath));
return resultCount;
}
INT GetCount() const
{
INT resultCount;
SetStatus(DllExports::GdipPathIterGetCount(nativeIterator, &resultCount));
return resultCount;
}
INT GetSubpathCount() const
{
INT resultCount;
SetStatus(DllExports::GdipPathIterGetSubpathCount(nativeIterator, &resultCount));
return resultCount;
}
BOOL HasCurve() const
{
BOOL hasCurve;
SetStatus(DllExports::GdipPathIterHasCurve(nativeIterator, &hasCurve));
return hasCurve;
}
VOID Rewind()
{
SetStatus(DllExports::GdipPathIterRewind(nativeIterator));
}
INT Enumerate(OUT PointF *points,
OUT BYTE *types,
IN INT count)
{
INT resultCount;
SetStatus(DllExports::GdipPathIterEnumerate(nativeIterator,
&resultCount, points, types, count));
return resultCount;
}
INT CopyData(OUT PointF* points,
OUT BYTE* types,
IN INT startIndex,
IN INT endIndex)
{
INT resultCount;
SetStatus(DllExports::GdipPathIterCopyData(nativeIterator,
&resultCount, points, types, startIndex, endIndex));
return resultCount;
}
Status GetLastStatus() const
{
Status lastStatus = lastResult;
lastResult = Ok;
return lastStatus;
}
#ifdef DCR_USE_NEW_250932
private:
GraphicsPathIterator(const GraphicsPathIterator &);
GraphicsPathIterator& operator=(const GraphicsPathIterator &);
#endif
protected:
VOID SetNativeIterator(GpPathIterator *nativeIterator)
{
this->nativeIterator = nativeIterator;
}
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
protected:
GpPathIterator* nativeIterator;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Represent polygon gradient brush object
//--------------------------------------------------------------------------
class PathGradientBrush : public Brush
{
public:
friend class Pen;
PathGradientBrush(
IN const PointF* points,
IN INT count,
IN WrapMode wrapMode = WrapModeClamp)
{
GpPathGradient *brush = NULL;
lastResult = DllExports::GdipCreatePathGradient(
points, count,
wrapMode, &brush);
SetNativeBrush(brush);
}
PathGradientBrush(
IN const Point* points,
IN INT count,
IN WrapMode wrapMode = WrapModeClamp)
{
GpPathGradient *brush = NULL;
lastResult = DllExports::GdipCreatePathGradientI(
points, count,
wrapMode, &brush);
SetNativeBrush(brush);
}
PathGradientBrush(
IN const GraphicsPath* path
)
{
GpPathGradient *brush = NULL;
lastResult = DllExports::GdipCreatePathGradientFromPath(
path->nativePath, &brush);
SetNativeBrush(brush);
}
// Get/set colors
Status GetCenterColor(OUT Color* color) const
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -