本文整理匯總了C#中IShape.GetPathIterator方法的典型用法代碼示例。如果您正苦於以下問題:C# IShape.GetPathIterator方法的具體用法?C# IShape.GetPathIterator怎麽用?C# IShape.GetPathIterator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IShape
的用法示例。
在下文中一共展示了IShape.GetPathIterator方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Area
////////////////////////////////////////////////////////////////////////////
//--------------------------------- REVISIONS ------------------------------
// Date Name Tracking # Description
// --------- ------------------- ------------- ----------------------
// 13JUN2009 James Shen Initial Creation
////////////////////////////////////////////////////////////////////////////
/**
* The <code>Area</code> class creates an area geometry from the
* specified {@link IShape} object. The geometry is explicitly
* closed, if the <code>IShape</code> is not already closed. The
* fill rule (even-odd or winding) specified by the geometry of the
* <code>IShape</code> is used to determine the resulting enclosed area.
* @param s the <code>IShape</code> from which the area is constructed
* @throws NullPointerException if <code>s</code> is null
*/
public Area(IShape s)
{
if (s is Area)
{
_curves = ((Area)s)._curves;
}
else
{
_curves = PathToCurves(s.GetPathIterator(null));
}
}
示例2: ToSVG
////////////////////////////////////////////////////////////////////////////
//--------------------------------- REVISIONS ------------------------------
// Date Name Tracking # Description
// --------- ------------------- ------------- ----------------------
// 13JUN2009 James Shen Initial Creation
////////////////////////////////////////////////////////////////////////////
/**
* To a SVG string.
* @param shape the shape object.
* @return a SVG string
*/
public static String ToSVG(IShape shape)
{
PathIterator pathIterator = shape.GetPathIterator(null);
StringBuilder svgString = new StringBuilder("<path d='");
int[] coords = new int[6];
int type;
while (!pathIterator.IsDone())
{
type = pathIterator.CurrentSegment(coords);
switch (type)
{
case PathIterator.SEG_CLOSE:
svgString.Append("Z ");
break;
case PathIterator.SEG_CUBICTO:
svgString.Append("C ");
svgString.Append(coords[0] + " ");
svgString.Append(coords[1] + " ");
svgString.Append(coords[2] + " ");
svgString.Append(coords[3] + " ");
svgString.Append(coords[4] + " ");
svgString.Append(coords[5]);
break;
case PathIterator.SEG_LINETO:
svgString.Append("L ");
svgString.Append(coords[0] + " ");
svgString.Append(coords[1]);
break;
case PathIterator.SEG_MOVETO:
svgString.Append("M ");
svgString.Append(coords[0] + " ");
svgString.Append(coords[1]);
break;
case PathIterator.SEG_QUADTO:
svgString.Append("Q ");
svgString.Append(coords[0] + " ");
svgString.Append(coords[1] + " ");
svgString.Append(coords[2] + " ");
svgString.Append(coords[3]);
break;
}
pathIterator.Next();
}
svgString.Append("' />");
return svgString.ToString();
}
示例3: Append
////////////////////////////////////////////////////////////////////////////
//--------------------------------- REVISIONS ------------------------------
// Date Name Tracking # Description
// --------- ------------------- ------------- ----------------------
// 13JUN2009 James Shen Initial Creation
////////////////////////////////////////////////////////////////////////////
/**
* Appends the geometry of the specified {@code IShape} object to the
* path, possibly connecting the new geometry to the existing path
* segments with a line segment.
* If the {@code connect} parameter is {@code true} and the
* path is not empty then any initial {@code moveTo} in the
* geometry of the appended {@code IShape}
* is turned into a {@code lineTo} segment.
* If the destination coordinates of such a connecting {@code lineTo}
* segment match the ending coordinates of a currently open
* subpath then the segment is omitted as superfluous.
* The winding rule of the specified {@code IShape} is ignored
* and the appended geometry is governed by the winding
* rule specified for this path.
*
* @param s the {@code IShape} whose geometry is appended
* to this path
* @param connect a bool to control whether or not to turn an initial
* {@code moveTo} segment into a {@code lineTo} segment
* to connect the new geometry to the existing path
*/
public void Append(IShape s, bool connect)
{
Append(s.GetPathIterator(null), connect);
}
示例4: Path
////////////////////////////////////////////////////////////////////////////
//--------------------------------- REVISIONS ------------------------------
// Date Name Tracking # Description
// --------- ------------------- ------------- ----------------------
// 13JUN2009 James Shen Initial Creation
////////////////////////////////////////////////////////////////////////////
/**
* Constructs a new int precision {@code Path} object
* from an arbitrary {@link IShape} object, transformed by an
* {@link AffineTransform} object.
* All of the initial geometry and the winding rule for this path are
* taken from the specified {@code IShape} object and transformed
* by the specified {@code AffineTransform} object.
*
* @param s the specified {@code IShape} object
* @param at the specified {@code AffineTransform} object
*/
public Path(IShape s, AffineTransform at)
{
if (s is Path)
{
Path p2D = (Path)s;
SetWindingRule(p2D._windingRule);
_numTypes = p2D._numTypes;
_pointTypes = new byte[p2D._pointTypes.Length];
Array.Copy(p2D._pointTypes, _pointTypes, _pointTypes.Length);
_numCoords = p2D._numCoords;
_intCoords = p2D.CloneCoords(at);
}
else
{
PathIterator pi = s.GetPathIterator(at);
SetWindingRule(pi.GetWindingRule());
_pointTypes = new byte[INIT_SIZE];
_intCoords = new int[INIT_SIZE * 2];
Append(pi, false);
}
}