/// <summary> /// Draws the polygon within the specified clipping rectangle. /// </summary> /// <param name="rc">The render context.</param> /// <param name="clippingRectangle">The clipping rectangle.</param> /// <param name="points">The points.</param> /// <param name="minDistSquared">The squared minimum distance between points.</param> /// <param name="fill">The fill color.</param> /// <param name="stroke">The stroke color.</param> /// <param name="strokeThickness">The stroke thickness.</param> /// <param name="lineStyle">The line style.</param> /// <param name="lineJoin">The line join.</param> /// <param name="aliased">The aliased.</param> public static void DrawClippedPolygon( this IRenderContext rc, OxyRect clippingRectangle, IList <ScreenPoint> points, double minDistSquared, OxyColor fill, OxyColor stroke, double strokeThickness = 1.0, LineStyle lineStyle = LineStyle.Solid, LineJoin lineJoin = LineJoin.Miter, bool aliased = false) { if (lineStyle == LineStyle.None) { return; } var outputBuffer = new List <ScreenPoint>(); ReducePoints(points, minDistSquared, outputBuffer); if (rc.SetClip(clippingRectangle)) { rc.DrawPolygon(outputBuffer, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased); rc.ResetClip(); return; } var clippedPoints = SutherlandHodgmanClipping.ClipPolygon(clippingRectangle, outputBuffer); rc.DrawPolygon(clippedPoints, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased); }
/// <summary> /// Draws the polygon within the specified clipping rectangle. /// </summary> /// <param name="rc">The render context.</param> /// <param name="clippingRectangle">The clipping rectangle.</param> /// <param name="points">The points.</param> /// <param name="minDistSquared">The squared minimum distance between points.</param> /// <param name="fill">The fill color.</param> /// <param name="stroke">The stroke color.</param> /// <param name="strokeThickness">The stroke thickness.</param> /// <param name="lineStyle">The line style.</param> /// <param name="lineJoin">The line join.</param> /// <param name="aliased">The aliased.</param> public static void DrawClippedPolygon( this IRenderContext rc, OxyRect clippingRectangle, IList <ScreenPoint> points, double minDistSquared, OxyColor fill, OxyColor stroke, double strokeThickness = 1.0, LineStyle lineStyle = LineStyle.Solid, LineJoin lineJoin = LineJoin.Miter, bool aliased = false) { if (lineStyle == LineStyle.None) { return; } // TODO: minDistSquared should be implemented or removed if (rc.SetClip(clippingRectangle)) { rc.DrawPolygon(points, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased); rc.ResetClip(); return; } var clippedPoints = SutherlandHodgmanClipping.ClipPolygon(clippingRectangle, points); rc.DrawPolygon(clippedPoints, fill, stroke, strokeThickness, lineStyle.GetDashArray(), lineJoin, aliased); }
/// <summary> /// The draw clipped polygon. /// </summary> /// <param name="rc"> /// The render context. /// </param> /// <param name="points"> /// The points. /// </param> /// <param name="clippingRectangle"> /// The clipping rectangle. /// </param> /// <param name="minDistSquared"> /// The min dist squared. /// </param> /// <param name="fill"> /// The fill. /// </param> /// <param name="stroke"> /// The stroke. /// </param> /// <param name="strokeThickness"> /// The stroke thickness. /// </param> /// <param name="lineStyle"> /// The line style. /// </param> /// <param name="lineJoin"> /// The line join. /// </param> /// <param name="aliased"> /// The aliased. /// </param> public static void DrawClippedPolygon( this IRenderContext rc, IList <ScreenPoint> points, OxyRect clippingRectangle, double minDistSquared, OxyColor fill, OxyColor stroke, double strokeThickness = 1.0, LineStyle lineStyle = LineStyle.Solid, OxyPenLineJoin lineJoin = OxyPenLineJoin.Miter, bool aliased = false) { var clippedPoints = SutherlandHodgmanClipping.ClipPolygon(clippingRectangle, points); rc.DrawPolygon( clippedPoints, fill, stroke, strokeThickness, LineStyleHelper.GetDashArray(lineStyle), lineJoin, aliased); }