/// <summary> /// Returns the coordinates and type of the current path segment in /// the iteration. /// The return value is the path segment type: /// SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. /// A float array of length 6 must be passed in and may be used to /// store the coordinates of the point(s). /// Each point is stored as a pair of float x,y coordinates. /// SEG_MOVETO and SEG_LINETO types will return one point, /// SEG_QUADTO will return two points, /// SEG_CUBICTO will return 3 points /// and SEG_CLOSE will not return any points. </summary> /// <seealso cref= #SEG_MOVETO </seealso> /// <seealso cref= #SEG_LINETO </seealso> /// <seealso cref= #SEG_QUADTO </seealso> /// <seealso cref= #SEG_CUBICTO </seealso> /// <seealso cref= #SEG_CLOSE </seealso> public virtual int CurrentSegment(float[] coords) { if (Done) { throw new NoSuchElementException("roundrect iterator out of bounds"); } double[] ctrls = Ctrlpts[Index]; int nc = 0; for (int i = 0; i < ctrls.Length; i += 4) { coords[nc++] = (float)(x + ctrls[i + 0] * w + ctrls[i + 1] * Aw); coords[nc++] = (float)(y + ctrls[i + 2] * h + ctrls[i + 3] * Ah); } if (Affine != null) { Affine.Transform(coords, 0, coords, 0, nc / 2); } return(Types[Index]); }
/// <summary> /// Returns the coordinates and type of the current path segment in /// the iteration. /// The return value is the path segment type: /// SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. /// A float array of length 6 must be passed in and may be used to /// store the coordinates of the point(s). /// Each point is stored as a pair of float x,y coordinates. /// SEG_MOVETO and SEG_LINETO types will return one point, /// SEG_QUADTO will return two points, /// SEG_CUBICTO will return 3 points /// and SEG_CLOSE will not return any points. </summary> /// <seealso cref= #SEG_MOVETO </seealso> /// <seealso cref= #SEG_LINETO </seealso> /// <seealso cref= #SEG_QUADTO </seealso> /// <seealso cref= #SEG_CUBICTO </seealso> /// <seealso cref= #SEG_CLOSE </seealso> public virtual int CurrentSegment(float[] coords) { if (Done) { throw new NoSuchElementException("arc iterator out of bounds"); } double angle = AngStRad; if (Index == 0) { coords[0] = (float)(x + System.Math.Cos(angle) * w); coords[1] = (float)(y + System.Math.Sin(angle) * h); if (Affine != null) { Affine.Transform(coords, 0, coords, 0, 1); } return(PathIterator_Fields.SEG_MOVETO); } if (Index > ArcSegs) { if (Index == ArcSegs + LineSegs) { return(PathIterator_Fields.SEG_CLOSE); } coords[0] = (float)x; coords[1] = (float)y; if (Affine != null) { Affine.Transform(coords, 0, coords, 0, 1); } return(PathIterator_Fields.SEG_LINETO); } angle += Increment * (Index - 1); double relx = System.Math.Cos(angle); double rely = System.Math.Sin(angle); coords[0] = (float)(x + (relx - Cv * rely) * w); coords[1] = (float)(y + (rely + Cv * relx) * h); angle += Increment; relx = System.Math.Cos(angle); rely = System.Math.Sin(angle); coords[2] = (float)(x + (relx + Cv * rely) * w); coords[3] = (float)(y + (rely - Cv * relx) * h); coords[4] = (float)(x + relx * w); coords[5] = (float)(y + rely * h); if (Affine != null) { Affine.Transform(coords, 0, coords, 0, 3); } return(PathIterator_Fields.SEG_CUBICTO); }
public virtual int CurrentSegment(double[] coords) { int segtype; int numpoints; if (Prevcurve != null) { // Need to finish off junction between curves if (Thiscurve == null || Thiscurve.Order == 0) { return(PathIterator_Fields.SEG_CLOSE); } coords[0] = Thiscurve.X0; coords[1] = Thiscurve.Y0; segtype = PathIterator_Fields.SEG_LINETO; numpoints = 1; } else if (Thiscurve == null) { throw new NoSuchElementException("area iterator out of bounds"); } else { segtype = Thiscurve.getSegment(coords); numpoints = Thiscurve.Order; if (numpoints == 0) { numpoints = 1; } } if (Transform != null) { Transform.Transform(coords, 0, coords, 0, numpoints); } return(segtype); }