Class QrPolygon
- Namespace
- Net.Codecrete.QrCodeGenerator
- Assembly
- QrCodeGenerator.dll
A closed loop of the outline of the dark modules of a QR code.
Consecutive vertices are joined by axis-parallel edges, alternating between horizontal and vertical; the closing edge from the last vertex back to the first one is implied. The first vertex is the topmost one, the leftmost of those. A vertex can occur twice in the loop where the outline touches itself at a single corner point.
A loop around a group of dark modules runs clockwise (with y extending downwards), a loop around a hole within such a group runs counterclockwise. With this winding, filling the polygons of a QR code produces the dark modules under both the nonzero rule (the SVG default) and the even-odd rule (the XAML default).
Instances are produced by ToOutlines().
public sealed class QrPolygon : IEquatable<QrPolygon>
- Inheritance
-
QrPolygon
- Implements
- Inherited Members
Constructors
QrPolygon(IReadOnlyList<QrPoint>)
Initializes a new polygon with the specified vertices.
public QrPolygon(IReadOnlyList<QrPoint> vertices)
Parameters
verticesIReadOnlyList<QrPoint>The corners of the loop, in drawing order (copied).
Exceptions
- ArgumentNullException
verticesisnull.
Properties
Vertices
The corners of this loop, in drawing order.
public IReadOnlyList<QrPoint> Vertices { get; }
Property Value
- IReadOnlyList<QrPoint>
The vertices.
Methods
Equals(QrPolygon)
Determines whether this polygon is equal to the specified polygon.
public bool Equals(QrPolygon other)
Parameters
otherQrPolygonThe polygon to compare with.
Returns
- bool
trueif both polygons have the same vertices, in the same order.
Equals(object)
Determines whether this polygon is equal to the specified object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with.
Returns
GetHashCode()
Returns the hash code for this polygon.
public override int GetHashCode()
Returns
- int
The hash code.
ToString()
Returns a string representation of this polygon.
public override string ToString()
Returns
- string
A string with the vertices.
Operators
operator ==(QrPolygon, QrPolygon)
Determines whether two polygons are equal.
public static bool operator ==(QrPolygon left, QrPolygon right)
Parameters
Returns
- bool
trueif both polygons have the same vertices, in the same order.
operator !=(QrPolygon, QrPolygon)
Determines whether two polygons are not equal.
public static bool operator !=(QrPolygon left, QrPolygon right)
Parameters
Returns
- bool
trueif the polygons differ in a vertex.