Method DrawQuadrilateral
DrawQuadrilateral(Quadrilateral, Color32, double)
Draws the outline of the specified quadrilateral with a solid color and thickness. Uses default stroke settings: Miter, Butt, and Center.
public Canvas DrawQuadrilateral(Quadrilateral quad, Color32 color, double thickness = 1)
Parameters
quadQuadrilateralThe four-cornered polygon to outline.
colorColor32The stroke color.
thicknessdoubleThe stroke thickness in pixels. Must be greater than zero. Defaults to 1.
Returns
Examples
var quad = new Quadrilateral(
new Point(50, 10), new Point(250, 10),
new Point(280, 110), new Point(20, 110));
var canvas = new Canvas(image);
canvas.DrawQuadrilateral(quad, new Color32(255, 0, 0), thickness: 2);
Exceptions
- ArgumentNullException
Thrown if
quadis null.- ArgumentOutOfRangeException
Thrown if
thicknessis less than or equal to zero.
DrawQuadrilateral(Quadrilateral, Pen)
Draws the outline of the specified quadrilateral using the given pen.
public Canvas DrawQuadrilateral(Quadrilateral quad, Pen pen)
Parameters
quadQuadrilateralThe four-cornered polygon to outline.
penPenThe pen that defines the stroke color, thickness, line join, line cap, miter limit, and alignment.
Returns
Examples
var quad = new Quadrilateral(
new Point(50, 10), new Point(250, 10),
new Point(280, 110), new Point(20, 110));
var pen = new Pen(new Color32(255, 0, 0), 3)
{
LineJoin = LineJoin.Round,
LineCap = LineCap.Round
};
var canvas = new Canvas(image);
canvas.DrawQuadrilateral(quad, pen);
Exceptions
- ArgumentNullException
Thrown if
quadorpenis null.