namespace FeatherQR
#enum Compression obsolete
public enum Compression : int
Compression mode for QR code data serialization.
Notes
Uncompressed = 0,
No compression
Deflate = 1,
DEFLATE compression (RFC 1951)
GZip = 2,
GZIP compression (RFC 1952)
#enum ECCLevel
public enum ECCLevel : int
The error correction level: how much of a symbol can be damaged, dirty or covered while the code still scans. Higher levels leave less room for content, so the same text may need a larger symbol.
L = 0,
7% may be lost before recovery is not possible
M = 1,
15% may be lost before recovery is not possible
Q = 2,
25% may be lost before recovery is not possible
H = 3,
30% may be lost before recovery is not possible
#enum EciMode
public enum EciMode : int
ECI (Extended Channel Interpretation) mode for character encoding.
Default = 0,
Auto-detect encoding and add appropriate ECI header (recommended for most use cases).
Notes
Iso8859_1 = 3,
ISO-8859-1 (Latin-1) encoding - Western European characters. Adds an ECI header: 12 bits in Standard QR, 11 bits in rMQR.
Notes
Utf8 = 26,
UTF-8 Unicode encoding - Universal character support. Adds an ECI header: 12 bits in Standard QR, 11 bits in rMQR.
Notes
public readonly struct MicroQRCodeCalculatedSize
Result of TryGetRequiredBufferSize : buffer size, matrix side length and selected version for a pending Micro QR encode.
public MicroQRVersion Version { get; }
The Micro QR version that will be produced.
public int BufferSize { get; }
Required destination buffer size in bytes (one byte per module, quiet zone included).
public int QrSize { get; }
Matrix side length in modules, quiet zone included.
public class MicroQRCodeData
Represents Micro QR code data as a 2D boolean matrix (versions M1-M4, 11Γ11 to 17Γ17 modules).
Notes
public MicroQRCodeData(MicroQRVersion version, int quietZoneSize);
Initializes an empty matrix for the specified version.
public MicroQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);
public MicroQRCodeData(byte[] rawData, int quietZoneSize);
Deserializes Micro QR data previously produced by GetRawData .
public MicroQRVersion Version { get; }
Gets the Micro QR version (M1-M4).
public bool this[int row, int col] { get; }
Gets the module state at the specified position (quiet zone included). Quiet zone positions always read false.
property Size
public int Size { get; }
Gets the matrix side length in modules, including the quiet zone.
public ModuleRect[] GetModuleRectangles();
Gets the dark modules as merged rectangles in module coordinates, for rendering with any graphics API without SkiaSharp (SVG path data, draw calls, vector output).
Notes
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the dark modules as merged rectangles into a caller-provided buffer. Same contract as GetModuleRectangles without allocations.
public byte[] GetRawData();
Serializes the core modules (quiet zone excluded) to a new byte array.
public int GetModuleRectanglesMaxCount();
Gets an upper bound on the number of rectangles GetModuleRectangles can return, suitable for sizing a pooled buffer for TryGetModuleRectangles . O(1), no matrix scan.
public int GetRawData(IBufferWriter<byte> writer);
Writes the serialized data to the specified buffer writer without intermediate allocation.
public int GetRawDataSize();
Gets the serialized size in bytes ("QRX" header + packed core bits).
public readonly struct MicroQRCodeDecodeInfo
Diagnostic information produced by a Micro QR code decode attempt.
Notes
public MicroQREccLevel EccLevel { get; }
Error correction level read from the format information.
public MicroQRVersion Version { get; }
Micro QR version (M1-M4), or default (0) when the matrix was invalid.
public QRCodeDecodeStatus Status { get; }
Decode result status. Success when decoding succeeded.
public int ErrorsCorrected { get; }
Number of codeword errors corrected by Reed-Solomon decoding.
public int MaskPattern { get; }
Mask pattern (0-3) read from the format information, or -1 when unknown.
public static class MicroQRCodeDecoder
Micro QR code decoder based on ISO/IEC 18004. Decodes Micro QR module matrices back into text, including Reed-Solomon error correction.
Notes
public static bool TryDecode(MicroQRCodeData data, out string text);
Decodes the text content from Micro QR code data.
public static bool TryDecode(MicroQRCodeData data, out string text, out MicroQRCodeDecodeInfo info);
Decodes the text content from Micro QR code data, with diagnostic information.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, Span<char> destination, out int charsWritten, out MicroQRCodeDecodeInfo info);
Decodes the text content from a module matrix into a caller-provided buffer without per-call heap allocation.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out MicroQRCodeDecodeInfo info);
Decodes the text content from a module matrix.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out MicroQRCodeDecodeInfo info);
Detects and decodes a Micro QR code from grayscale image pixels into a caller-provided buffer without per-call heap allocation.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out MicroQRCodeDecodeInfo info);
Detects and decodes a Micro QR code from grayscale image pixels.
public static int GetMaxDecodedLength(MicroQRVersion version);
Calculates the maximum possible decoded character count for a Micro QR version, across all ECC levels and encoding modes. Use to size the destination buffer for the allocation-free TryDecode overload.
public static class MicroQRCodeGenerator
Micro QR code generator based on ISO/IEC 18004 (versions M1-M4).
Notes
public static MicroQRCodeCalculatedSize GetRequiredBufferSize(ReadOnlySpan<char> text, MicroQREccLevel eccLevel, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);
Calculates the required buffer size for encoding the specified text as a Micro QR code.
public static MicroQRCodeData CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);
public static MicroQRCodeData CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, in MicroQRCodeGeneratorOptions options);
public static MicroQRCodeData CreateMicroQRCode(string plainText, MicroQREccLevel eccLevel, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);
Creates a Micro QR code from the provided plain text.
public static MicroQRCodeData CreateMicroQRCode(string plainText, MicroQREccLevel eccLevel, in MicroQRCodeGeneratorOptions options);
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, MicroQREccLevel eccLevel, out MicroQRCodeCalculatedSize size, in MicroQRCodeGeneratorOptions options = null);
Calculates the required buffer size, matrix size and version for encoding the specified text as a Micro QR code, reporting content that does not fit as false rather than as an exception.
Notes
public static int CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, Span<byte> destination, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);
Creates a Micro QR code and writes the module matrix into the caller-provided buffer without per-call heap allocation.
Notes
public static int CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, Span<byte> destination, in MicroQRCodeGeneratorOptions options);
public readonly struct MicroQRCodeGeneratorOptions : IEquatable<MicroQRCodeGeneratorOptions>
Optional settings for MicroQRCodeGenerator . default is the complete default configuration (automatic version, 2-module quiet zone), so set only what you need: new MicroQRCodeGeneratorOptions { Version = MicroQRVersion.M3, QuietZoneSize = 0 }.
Notes
public MicroQRSegmentation Segmentation { get; init; }
How the content is split into encoding-mode segments (see MicroQRSegmentation ). Defaults to Single . Optimal never selects a larger version, and emits the identical bit stream when a split would not shrink the symbol. Size a destination buffer with the same value you encode with.
public MicroQRVersionRange Version { get; init; }
The versions the generator may choose from. Defaults to Any ; a MicroQRVersion or its nullable converts implicitly, so a null means automatic.
public int QuietZoneSize { get; init; }
Quiet zone width in modules. Defaults to 2, the ISO/IEC 18004 value for Micro QR; 0 is valid.
public int? MaskPattern { get; init; }
Pin one of the four Micro QR data mask patterns (0-3, ISO/IEC 18004 Table 10) instead of the automatic edge-score selection. null (the default) selects the highest-scoring pattern. Any pattern yields a valid, decodable symbol; the automatic choice merely optimizes scan reliability.
Notes
public static MicroQRCodeGeneratorOptions Default { get; }
The default configuration, identical to default.
#enum MicroQREccLevel
public enum MicroQREccLevel : int
Micro QR Code error correction level (ISO/IEC 18004). Micro QR levels differ from Standard QR ECCLevel : version M1 supports error detection only, and level H does not exist.
ErrorDetectionOnly = 0,
Error detection only, no correction capacity. Valid only for version M1.
L = 1,
~7% recovery capacity. Valid for versions M2-M4.
M = 2,
~15% recovery capacity. Valid for versions M2-M4.
Q = 3,
~25% recovery capacity. Valid for version M4 only.
#enum MicroQRSegmentation
public enum MicroQRSegmentation : int
How MicroQRCodeGenerator splits the content into encoding-mode segments. Micro QR capacities are tiny (5 digits at M1, 15 Byte-mode characters at M4-L), so mixing modes (for example a short prefix followed by a numeric tail) can drop the symbol a version, or encode content no single mode fits at all.
Single = 0,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte). The default, and the cheapest to encode.
Optimal = 1,
The mixed-mode split with the fewest total bits. Never selects a larger version than Single , emits the Single bit stream verbatim when a split would not shrink the symbol, and additionally encodes content that overflows every version in a single mode β unless the minimal-bit plan would be misread on decode (a relocated byte order mark, or a Latin-1 run the charset heuristic would read as UTF-8), in which case it reports "does not fit" rather than emitting a stream that decodes differently.
Notes
#enum MicroQRVersion
public enum MicroQRVersion : int
Micro QR Code symbol version (ISO/IEC 18004). Determines symbol size: M1 = 11Γ11, M2 = 13Γ13, M3 = 15Γ15, M4 = 17Γ17 modules.
M1 = 1,
11Γ11 modules. Numeric mode only, error detection only.
M2 = 2,
13Γ13 modules. Numeric and Alphanumeric modes, ECC L/M.
M3 = 3,
15Γ15 modules. Numeric, Alphanumeric and Byte modes, ECC L/M.
M4 = 4,
17Γ17 modules. Numeric, Alphanumeric and Byte modes, ECC L/M/Q.
public readonly struct MicroQRVersionRange : IEquatable<MicroQRVersionRange>
The Micro QR versions a generator may choose from: the smallest one in the range that holds the content is used. The Micro QR counterpart of QRCodeVersionRange .
Notes
constant MaxVersion
public const MicroQRVersion MaxVersion;
The highest Micro QR version, M4.
constant MinVersion
public const MicroQRVersion MinVersion;
The lowest Micro QR version, M1.
public MicroQRVersionRange(MicroQRVersion min, MicroQRVersion max);
An inclusive range from min to max .
property Max
public MicroQRVersion Max { get; }
The highest permitted version (M4 when unbounded above).
property Min
public MicroQRVersion Min { get; }
The lowest permitted version (M1 when unbounded below).
public bool IsAny { get; }
Whether this range constrains nothing (the default).
public bool IsExact { get; }
Whether this range pins a single version.
property Any
public static MicroQRVersionRange Any { get; }
Every version, M1 to M4. Identical to default.
public bool Contains(MicroQRVersion version);
Whether version falls inside this range.
public override string ToString();
public static MicroQRVersionRange AtLeast(MicroQRVersion version);
version or larger.
public static MicroQRVersionRange AtMost(MicroQRVersion version);
version or smaller.
public static MicroQRVersionRange Between(MicroQRVersion min, MicroQRVersion max);
An inclusive range from min to max .
public static MicroQRVersionRange Exactly(MicroQRVersion version);
Exactly version , with no automatic selection.
public static MicroQRVersionRange op_Implicit(MicroQRVersion version);
A single version, as Exactly .
public static MicroQRVersionRange op_Implicit(MicroQRVersion? version);
A single version, or Any when there is none, so an optional version needs no branch.
public readonly struct ModuleRect : IEquatable<ModuleRect>
An axis-aligned rectangle of dark modules, in module coordinates. Produced by the GetModuleRectangles family on QRCodeData , MicroQRCodeData , and RmQRCodeData .
Notes
constructor ModuleRect
public ModuleRect(int X, int Y, int Width, int Height);
An axis-aligned rectangle of dark modules, in module coordinates. Produced by the GetModuleRectangles family on QRCodeData , MicroQRCodeData , and RmQRCodeData .
Notes
public int Height { get; init; }
Height in modules (always positive).
public int Width { get; init; }
Width in modules (always positive).
property X
public int X { get; init; }
Column of the left edge (0-based, including the quiet zone if present).
property Y
public int Y { get; init; }
Row of the top edge (0-based, including the quiet zone if present).
public readonly struct QRCodeCalculatedSize : IEquatable<QRCodeCalculatedSize>
Calculated QR code size information.
constructor QRCodeCalculatedSize
public QRCodeCalculatedSize(int BufferSize, int QrSize, int Version);
Calculated QR code size information.
public bool IsValid { get; }
Validates that the calculated size values are within acceptable ranges.
public int BufferSize { get; init; }
Required buffer size for the QR code matrix data (in bytes). Calculated as QrSize Γ QrSize.
public int QrSize { get; init; }
QR code size in modules per side (including quiet zone if specified)
public int Version { get; init; }
QR code version (1-40) determined by data capacity requirements
public class QRCodeData
Represents QR code data as a 2D boolean matrix.
Notes
public QRCodeData(ReadOnlySpan<byte> rawDataSpan, int quietZoneSize);
Initializes a new instance of the QRCodeData class from serialized raw data.
Notes
public QRCodeData(byte[] rawData, int quietZoneSize);
Initializes a new instance of the QRCodeData class from serialized raw data.
Notes
public QRCodeData(int version, int quietZoneSize);
Initializes with the specified version.
public bool this[int row, int col] { get; }
Gets or sets the module state at the specified position.
Notes
property Size
public int Size { get; }
Gets the size of the QR code matrix (modules per side).
public int Version { get; }
Get the QR code version (1-40)
public ModuleRect[] GetModuleRectangles();
Gets the dark modules as merged rectangles in module coordinates, for rendering with any graphics API without SkiaSharp (SVG path data, draw calls, vector output).
Notes
public bool IsFinderPattern(int row, int col);
Checks if the specified module position (excluding quiet zone) is part of a finder pattern.
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the dark modules as merged rectangles into a caller-provided buffer. Same contract as GetModuleRectangles without allocations.
public byte[] GetRawData();
Serializes the QR code data to a byte array.
Notes
public int GetFinderPatternIndex(int row, int col);
Gets the finder pattern index for the specified module position (excluding quiet zone).
public int GetModuleRectanglesMaxCount();
Gets an upper bound on the number of rectangles GetModuleRectangles can return, suitable for sizing a pooled buffer for TryGetModuleRectangles . O(1), no matrix scan.
public int GetRawData(IBufferWriter<byte> writer);
Writes the serialized QR code data to the specified buffer writer.
Notes
public int GetRawDataSize();
Calculates the required buffer size for serialization.
public readonly struct QRCodeDecodeInfo
Diagnostic information produced by a QR code decode attempt.
public ECCLevel EccLevel { get; }
Error correction level read from the format information.
public QRCodeDecodeStatus Status { get; }
Decode result status. Success when decoding succeeded.
public int ErrorsCorrected { get; }
Total number of codeword errors corrected by Reed-Solomon decoding.
public int MaskPattern { get; }
Mask pattern (0-7) read from the format information, or -1 when unknown.
public int Version { get; }
QR code version (1-40), or 0 when the matrix was invalid.
#enum QRCodeDecodeStatus
public enum QRCodeDecodeStatus : int
Result status of a QR code decode attempt.
Success = 0,
Decoding succeeded.
InvalidMatrix = 1,
The input is not a valid QR module matrix (invalid size or no dark modules).
FormatInformationInvalid = 2,
Both format information copies are corrupted beyond BCH correction capacity.
DataUncorrectable = 3,
One or more Reed-Solomon blocks contain more errors than the ECC level can correct.
InvalidBitstream = 4,
The data bitstream is malformed (invalid segment values or truncated data).
UnsupportedContent = 5,
The bitstream is well-formed but uses a feature this decoder does not support (FNC1, Structured Append, or an unsupported ECI charset). A property of the symbol's structure, not of its text; see UnmappedCharacter for the per-character case.
DestinationTooSmall = 6,
The destination buffer is too small for the decoded text.
NotDetected = 7,
No QR code was detected in the image (finder patterns not found or inconsistent).
UnmappedCharacter = 8,
The symbol was read correctly, but one character has no mapping under the charset this decoder applies, so no text is produced.
Notes
public static class QRCodeDecoder
QR code decoder based on ISO/IEC 18004 standard. Decodes QR module matrices back into text, including Reed-Solomon error correction.
Notes
public static bool TryDecode(QRCodeData data, out string text);
Decodes the text content from QR code data.
public static bool TryDecode(QRCodeData data, out string text, out QRCodeDecodeInfo info);
Decodes the text content from QR code data, with diagnostic information.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, Span<char> destination, out int charsWritten, out QRCodeDecodeInfo info);
Decodes the text content from a module matrix into a caller-provided buffer without per-call heap allocation.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out QRCodeDecodeInfo info);
Decodes the text content from a module matrix.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out QRCodeDecodeInfo info);
Detects and decodes a QR code from grayscale image pixels into a caller-provided buffer without per-call heap allocation.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out QRCodeDecodeInfo info);
Detects and decodes a QR code from grayscale image pixels.
public static int GetMaxDecodedLength(int version);
Calculates the maximum possible decoded character count for a QR code version, across all ECC levels and encoding modes. Use to size the destination buffer for the allocation-free TryDecode overload.
public static class QRCodeGenerator
QR code generator based on ISO/IEC 18004 standard. Supports QR code versions 1-40 with multiple encoding modes and error correction levels.
Notes
public static QRCodeCalculatedSize GetRequiredBufferSize(ReadOnlySpan<char> text, ECCLevel eccLevel, bool utf8BOM = false, EciMode eciMode = 0, int quietZoneSize = 4);
Calculates the required buffer size for encoding the specified text as a QR code.
public static QRCodeData CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, bool utf8BOM = false, EciMode eciMode = 0, int requestedVersion = -1, int quietZoneSize = 4);
Creates a QR code from the provided plain text.
public static QRCodeData CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, in QRCodeGeneratorOptions options);
public static QRCodeData CreateQrCode(string plainText, ECCLevel eccLevel, bool utf8BOM = false, EciMode eciMode = 0, int requestedVersion = -1, int quietZoneSize = 4);
Creates a QR code from the provided plain text.
public static QRCodeData CreateQrCode(string plainText, ECCLevel eccLevel, in QRCodeGeneratorOptions options);
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, ECCLevel eccLevel, out QRCodeCalculatedSize size, in QRCodeGeneratorOptions options = null);
Calculates the required buffer size, matrix size and version for encoding the specified text as a QR code, reporting content that does not fit as false rather than as an exception.
Notes
public static int CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, Span<byte> destination, bool utf8BOM = false, EciMode eciMode = 0, int requestedVersion = -1, int quietZoneSize = 4);
Creates a QR code from the provided plain text and writes the module matrix into the caller-provided buffer without per-call heap allocation.
Notes
public static int CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options);
public static int CreateQrCode(string plainText, ECCLevel eccLevel, Span<byte> destination, bool utf8BOM = false, EciMode eciMode = 0, int requestedVersion = -1, int quietZoneSize = 4);
Creates a QR code from the provided plain text and writes the module matrix into the caller-provided buffer without per-call heap allocation.
public static int CreateQrCode(string plainText, ECCLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options);
public readonly struct QRCodeGeneratorOptions : IEquatable<QRCodeGeneratorOptions>
Optional settings for QRCodeGenerator . default is the complete default configuration, so set only what you need: new QRCodeGeneratorOptions { EciMode = EciMode.Utf8, QuietZoneSize = 0 }.
Notes
public EciMode EciMode { get; init; }
Character encoding declaration. The default auto-detects ASCII (no ECI), ISO-8859-1 (assignment 3) or UTF-8 (assignment 26) from the content.
public QRCodeSegmentation Segmentation { get; init; }
How the content is split into encoding-mode segments (see QRCodeSegmentation ). Defaults to Single . Optimal never selects a larger version, emits the identical bit stream when a split would not shrink the symbol, and defers to the single-mode stream when Utf8BOM would actually write a byte order mark. Size a destination buffer with the same value you encode with.
public QRCodeVersionRange Version { get; init; }
The versions the generator may choose from. Defaults to Any ; an int or int? converts implicitly, so Version = 15 pins one and a null means automatic.
public bool BoostEccLevel { get; init; }
Raise the error correction level above the requested one when the chosen version's capacity allows it, without changing the version. The requested level becomes the minimum; the version is still chosen for it, so boosting never produces a larger symbol, only spends padding that would otherwise be wasted. Recommended when an icon or custom module shape overlays the symbol.
Notes
public bool Utf8BOM { get; init; }
Include a UTF-8 byte order mark. Ignored unless the content is written as UTF-8 in Byte mode. When a BOM would be written, Optimal emits the single-mode stream instead of a split (the BOM is a stream-level prefix, and a split would relocate it into the middle of the decoded text).
public int QuietZoneSize { get; init; }
Quiet zone width in modules. Defaults to 4, the ISO/IEC 18004 value; 0 is valid.
public int? MaskPattern { get; init; }
Pin one of the eight ISO/IEC 18004 data mask patterns (0-7) instead of the automatic penalty-scored selection. null (the default) selects the lowest-penalty pattern. Any pattern yields a valid, decodable symbol; the automatic choice merely optimizes scan reliability.
Notes
public static QRCodeGeneratorOptions Default { get; }
The default configuration, identical to default.
#enum QRCodeSegmentation
public enum QRCodeSegmentation : int
How QRCodeGenerator splits the content into encoding-mode segments. Mixed content (for example a URL prefix followed by a long numeric identifier) packs into fewer bits when each run is encoded in its densest mode, which can drop the symbol by one or more versions.
Single = 0,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte). The default, and the cheapest to encode.
Optimal = 1,
The mixed-mode split with the fewest total bits. Never selects a larger version than Single , emits the Single bit stream verbatim when a split would not shrink the symbol, and additionally encodes content that overflows every version in a single mode β unless the minimal-bit plan would be misread on decode (a relocated byte order mark), in which case it reports "does not fit" rather than emitting a stream that decodes differently.
Notes
public readonly struct QRCodeVersionRange : IEquatable<QRCodeVersionRange>
The Standard QR versions a generator may choose from: the smallest one in the range that holds the content is used. A fixed version is Exactly , the degenerate case, rather than a separate setting.
Notes
constant MaxVersion
public const int MaxVersion;
The highest version defined by ISO/IEC 18004.
constant MinVersion
public const int MinVersion;
The lowest version defined by ISO/IEC 18004.
public QRCodeVersionRange(int min, int max);
An inclusive range from min to max .
public bool IsAny { get; }
Whether this range constrains nothing (the default).
public bool IsExact { get; }
Whether this range pins a single version.
property Max
public int Max { get; }
The highest permitted version (40 when unbounded above).
property Min
public int Min { get; }
The lowest permitted version (1 when unbounded below).
property Any
public static QRCodeVersionRange Any { get; }
Every version, 1 to 40. Identical to default.
public bool Contains(int version);
Whether version falls inside this range.
public override string ToString();
public static QRCodeVersionRange AtLeast(int version);
version or larger.
public static QRCodeVersionRange AtMost(int version);
version or smaller.
public static QRCodeVersionRange Between(int min, int max);
An inclusive range from min to max .
public static QRCodeVersionRange Exactly(int version);
Exactly version , with no automatic selection.
public static QRCodeVersionRange op_Implicit(int version);
A single version, as Exactly . Lets an option set read Version = 15.
public static QRCodeVersionRange op_Implicit(int? version);
A single version, or Any when there is none.
Notes
public readonly struct RmQRCodeCalculatedSize
Result of TryGetRequiredBufferSize : the byte count of the byte-per-module matrix, its dimensions (quiet zone included) and the version that will be used.
public RmQRVersion Version { get; }
The rMQR version that will be generated (requested or automatically selected).
public int BufferSize { get; }
Required destination size in bytes ( Width Γ Height ).
public int Height { get; }
Matrix height in modules, quiet zone included.
public int Width { get; }
Matrix width in modules, quiet zone included.
public class RmQRCodeData
Represents rMQR code data as a 2D boolean matrix (versions R7x43-R17x139, rectangular: 7-17 modules high, 27-139 modules wide).
Notes
public RmQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);
public RmQRCodeData(RmQRVersion version, int quietZoneSize);
Initializes an empty (all light) matrix for the specified version.
public RmQRCodeData(byte[] rawData, int quietZoneSize);
Deserializes rMQR data previously produced by GetRawData .
public RmQRVersion Version { get; }
Gets the rMQR version (R7x43-R17x139).
public bool this[int row, int col] { get; }
Gets the module state at the specified position (quiet zone included). Quiet zone positions always read false.
public int Height { get; }
Gets the matrix height in modules, including the quiet zone.
public int Width { get; }
Gets the matrix width in modules, including the quiet zone.
public ModuleRect[] GetModuleRectangles();
Gets the dark modules as merged rectangles in module coordinates, for rendering with any graphics API without SkiaSharp (SVG path data, draw calls, vector output).
Notes
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the dark modules as merged rectangles into a caller-provided buffer. Same contract as GetModuleRectangles without allocations.
public byte[] GetRawData();
Serializes the core modules (quiet zone excluded) to a new byte array.
public int GetModuleRectanglesMaxCount();
Gets an upper bound on the number of rectangles GetModuleRectangles can return, suitable for sizing a pooled buffer for TryGetModuleRectangles . O(1), no matrix scan.
public int GetRawData(IBufferWriter<byte> writer);
Writes the serialized data to the specified buffer writer without intermediate allocation.
public int GetRawDataSize();
Gets the serialized size in bytes ("QRX" header + packed core bits).
public readonly struct RmQRCodeDecodeInfo
Diagnostic information from an rMQR decode attempt ( RmQRCodeDecoder ): status, and when the format information could be read, the version and ECC level plus the number of Reed-Solomon codeword corrections applied. rMQR has a single data mask, so there is no mask pattern to report.
public QRCodeDecodeStatus Status { get; }
Decode outcome; Success when text was produced.
public RmQREccLevel EccLevel { get; }
The ECC level read from the format information (valid once the format decoded).
public RmQRVersion Version { get; }
The symbol version (from the physical dimensions), or 0 when the input is not an rMQR matrix.
public int ErrorsCorrected { get; }
Total Reed-Solomon codeword corrections across all blocks (0 for a clean symbol).
public static class RmQRCodeDecoder
rMQR Code (ISO/IEC 23941) decoder: module matrix β text. Sibling of QRCodeDecoder and MicroQRCodeDecoder ; explicitly typed so Standard QR scanning stays unaffected. Matrix-level and image-level decoding ( TryDecodeImage ).
Notes
public static bool TryDecode(ReadOnlySpan<byte> modules, int width, int height, Span<char> destination, out int charsWritten, out RmQRCodeDecodeInfo info);
Decodes the text content from a module matrix into a caller-provided buffer without per-call heap allocation.
public static bool TryDecode(ReadOnlySpan<byte> modules, int width, int height, out string text, out RmQRCodeDecodeInfo info);
Decodes the text content from a module matrix.
public static bool TryDecode(RmQRCodeData data, out string text);
Decodes the text content of an RmQRCodeData matrix.
public static bool TryDecode(RmQRCodeData data, out string text, out RmQRCodeDecodeInfo info);
Decodes the text content of an RmQRCodeData matrix with diagnostics.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out RmQRCodeDecodeInfo info);
Detects and decodes an rMQR Code from grayscale image pixels into a caller-provided buffer without per-call heap allocation.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out RmQRCodeDecodeInfo info);
Detects and decodes an rMQR Code from grayscale image pixels.
public static int GetMaxDecodedLength(RmQRVersion version);
Calculates the maximum possible decoded character count for an rMQR version, across ECC levels and encoding modes. Use to size the destination buffer for the allocation-free TryDecode overload.
public static class RmQRCodeGenerator
rMQR Code (ISO/IEC 23941, R7x43-R17x139) generator: text β rectangular module matrix. Sibling of QRCodeGenerator and MicroQRCodeGenerator with rMQR-typed version, ECC and fit parameters.
Notes
public static RmQRCodeData CreateRmQRCode(ReadOnlySpan<char> textSpan, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);
public static RmQRCodeData CreateRmQRCode(string plainText, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);
Creates an rMQR code from the provided plain text.
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, RmQREccLevel eccLevel, out RmQRCodeCalculatedSize size, in RmQRCodeGeneratorOptions options = null);
Calculates the required buffer size, dimensions and version for encoding the specified text as an rMQR code, reporting a content overflow as false rather than as an exception.
Notes
public static int CreateRmQRCode(ReadOnlySpan<char> textSpan, RmQREccLevel eccLevel, Span<byte> destination, in RmQRCodeGeneratorOptions options = null);
Creates an rMQR code and writes the module matrix into the caller-provided buffer without per-call heap allocation.
Notes
public readonly struct RmQRCodeGeneratorOptions : IEquatable<RmQRCodeGeneratorOptions>
Optional settings for RmQRCodeGenerator . default is the complete default configuration and is what an omitted argument sends, so the shortest correct call is CreateRmQRCode(text, eccLevel).
Notes
public EciMode EciMode { get; init; }
Character encoding declaration. The default auto-detects ASCII (no ECI), ISO-8859-1 (assignment 3) or UTF-8 (assignment 26) from the content.
Notes
public RmQRFitStrategy FitStrategy { get; init; }
How to choose among the versions that hold the content. Defaults to MinimizeArea , the choice both reference encoders make.
public RmQRHeight? Height { get; init; }
Restrict automatic fitting to one symbol height, or null (the default) to consider every height. Must agree with Version when both are set.
public RmQRSegmentation Segmentation { get; init; }
Whether to split the content into mixed-mode segments. Defaults to Single . Size a destination buffer with the same value you encode with: the two modes can select different versions.
public RmQRVersion? Version { get; init; }
A specific version, or null (the default) to fit one automatically by FitStrategy and Height .
public int QuietZoneSize { get; init; }
Quiet zone width in modules. Defaults to 2, the ISO/IEC 23941 value; 0 is valid.
public static RmQRCodeGeneratorOptions Default { get; }
The default configuration, identical to default.
#enum RmQREccLevel
public enum RmQREccLevel : int
rMQR Code error correction level (ISO/IEC 23941). rMQR defines only two levels; the numeric value is the ECC bit carried in the format information.
M = 0,
Medium: about 15% of codewords recoverable.
H = 1,
High: about 30% of codewords recoverable.
#enum RmQRFitStrategy
public enum RmQRFitStrategy : int
How RmQRCodeGenerator chooses among the rMQR versions that can hold the content when no exact version is requested. rMQR sizes are two-dimensional, so "smallest" is a policy: fewest modules, narrowest, or shortest.
MinimizeArea = 0,
Fewest modules (height Γ width); ties prefer the smaller height, i.e. the wider symbol. The default.
MinimizeWidth = 1,
Smallest width; ties prefer the smaller height.
MinimizeHeight = 2,
Smallest height; ties prefer the smaller width.
#enum RmQRHeight
public enum RmQRHeight : int
Fixed rMQR symbol height in modules for automatic width selection ("fixed height, automatic width"): the generator only considers the versions of this height and picks among them by RmQRFitStrategy . Values are the module heights themselves.
H7 = 7,
7 modules high (widths 43-139).
H9 = 9,
9 modules high (widths 43-139).
H11 = 11,
11 modules high (widths 27-139).
H13 = 13,
13 modules high (widths 27-139).
H15 = 15,
15 modules high (widths 43-139).
H17 = 17,
17 modules high (widths 43-139).
#enum RmQRSegmentation
public enum RmQRSegmentation : int
How RmQRCodeGenerator splits the content into encoding-mode segments. rMQR capacities are small, so mixing modes (for example a Byte prefix followed by a Numeric tail) can drop the symbol by one or more versions.
Single = 0,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte). The default, and the cheapest to encode.
Optimal = 1,
The mixed-mode split with the fewest total bits. Never selects a symbol with more core modules than Single , emits the Single bit stream verbatim when a split would not shrink it, and additionally encodes content that overflows every version in a single mode β unless the minimal-bit plan would be misread on decode (a relocated byte order mark), in which case it reports "does not fit" rather than emitting a stream that decodes differently.
Notes
#enum RmQRVersion
public enum RmQRVersion : int
rMQR Code symbol version (ISO/IEC 23941): 32 rectangular sizes named R{height}x{width}. Values follow the ISO version index (height-major order) plus one, so (int)version - 1 is the 5-bit version index carried in the format information and (int)version is libzint's rMQR version number.
R7x43 = 1,
7 Γ 43 modules.
R7x59 = 2,
7 Γ 59 modules.
R7x77 = 3,
7 Γ 77 modules.
R7x99 = 4,
7 Γ 99 modules.
R7x139 = 5,
7 Γ 139 modules.
R9x43 = 6,
9 Γ 43 modules.
R9x59 = 7,
9 Γ 59 modules.
R9x77 = 8,
9 Γ 77 modules.
R9x99 = 9,
9 Γ 99 modules.
R9x139 = 10,
9 Γ 139 modules.
R11x27 = 11,
11 Γ 27 modules.
R11x43 = 12,
11 Γ 43 modules.
R11x59 = 13,
11 Γ 59 modules.
R11x77 = 14,
11 Γ 77 modules.
R11x99 = 15,
11 Γ 99 modules.
R11x139 = 16,
11 Γ 139 modules.
R13x27 = 17,
13 Γ 27 modules.
R13x43 = 18,
13 Γ 43 modules.
R13x59 = 19,
13 Γ 59 modules.
R13x77 = 20,
13 Γ 77 modules.
R13x99 = 21,
13 Γ 99 modules.
R13x139 = 22,
13 Γ 139 modules.
R15x43 = 23,
15 Γ 43 modules.
R15x59 = 24,
15 Γ 59 modules.
R15x77 = 25,
15 Γ 77 modules.
R15x99 = 26,
15 Γ 99 modules.
R15x139 = 27,
15 Γ 139 modules.
R17x43 = 28,
17 Γ 43 modules.
R17x59 = 29,
17 Γ 59 modules.
R17x77 = 30,
17 Γ 77 modules.
R17x99 = 31,
17 Γ 99 modules.
R17x139 = 32,
17 Γ 139 modules.
namespace FeatherQR.SkiaSharp
public sealed class CircleFinderPatternShape : FinderPatternShape
Circular finder pattern. (three nested circles, 7x7, 5x5, 3x3)
field Default
public static readonly CircleFinderPatternShape Default;
Gets the default instance.
public bool RequiresAntialiasing { get; }
Requires antialiasing to prevent jagged edges on curves.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);
public sealed class CircleModuleShape : ModuleShape
Draws modules as circles.
field Default
public static readonly CircleModuleShape Default;
Gets the default instance.
public bool RequiresAntialiasing { get; }
Requires antialiasing to prevent jagged edges on curves.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public abstract class FinderPatternShape
Defines the shape of QR code finder pattern (position detection patterns).
constructor FinderPatternShape
protected FinderPatternShape();
public bool RequiresAntialiasing { get; }
Gets whether this shape requires antialiasing for smooth rendering. Curved shapes such as circles and rounded rectangles should return true ; straight-edged shapes such as rectangles can return false .
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
Draw a finder pattern at the specified location.
public virtual void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);
Draw a finder pattern at the specified location with background color support.
public virtual void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);
Draw a finder pattern at the specified location using an existing background paint.
Notes
#enum GradientDirection
public enum GradientDirection : int
Defines the direction of gradient flow for QR code rendering.
Notes
None = 0,
No gradient. Use solid color specified in QR code rendering options. However, if solid is required, it's better to omit gradient options entirely.
LeftToRight = 1,
Gradient flows from left edge to right edge horizontally.
RightToLeft = 2,
Gradient flows from right edge to left edge horizontally.
TopToBottom = 3,
Gradient flows from top edge to bottom edge vertically.
BottomToTop = 4,
Gradient flows from bottom edge to top edge vertically.
TopLeftToBottomRight = 5,
Gradient flows diagonally from top-left corner to bottom-right corner.
TopRightToBottomLeft = 6,
Gradient flows diagonally from top-right corner to bottom-left corner.
BottomLeftToTopRight = 7,
Gradient flows diagonally from bottom-left corner to top-right corner.
BottomRightToTopLeft = 8,
Gradient flows diagonally from bottom-right corner to top-left corner.
public class GradientOptions : IEquatable<GradientOptions>
Defines gradient configuration for QR code rendering.
Notes
field Default
public static readonly GradientOptions Default;
A ready-made gradient: dark orange to firebrick, running from the top-left corner to the bottom-right. Use it when you want a gradient without choosing colors.
public GradientOptions(SKColor[] colors, GradientDirection direction = 1, float[]? colorPositions = null);
Initializes a new instance of the GradientOptions record.
public GradientDirection Direction { get; init; }
The gradient direction.
Notes
public SKColor[] Colors { get; init; }
Gradient colors for multi-color gradients.
Notes
public float[]? ColorPositions { get; init; }
Optional color stops (0.0 to 1.0) for the gradient.
Notes
public class IconData
The logo or image drawn at the center of a QR code, and its size.
Notes
constructor IconData obsolete
public IconData();
property Icon
public IconShape Icon { get; set; }
The icon shape to overlay on the QR code.
public int IconBorderWidth { get; set; }
The border width around the icon in pixels. Creates a background-colored padding around the icon. Ignored when IconSizeModules is set.
public int IconSizePercent { get; set; }
The size of the icon as a percentage of the QR code size (1-100). Ignored when IconSizeModules is set.
public int MaxCoreOccupancyPercent { get; set; }
Maximum allowed icon occupancy of the QR core area, as a percentage (1-100). Used only for module-based sizing. Default is 30.
public int? IconBorderModules { get; set; }
The border width around the icon in QR modules. When IconSizeModules is set and this is null, defaults to 1.
public int? IconSizeModules { get; set; }
The size of the icon body in QR modules. When set, module-based sizing is used and IconSizePercent / IconBorderWidth are ignored.
public static IconData FromImage(SKBitmap image, int iconSizePercent = 10, int iconBorderWidth = 2);
Create IconData from a bitmap image using percent/pixel sizing.
public static IconData FromImageByModules(SKBitmap image, int iconSizeModules, int iconBorderModules = 1, int maxCoreOccupancyPercent = 30);
Create IconData from a bitmap image using module-based sizing.
Notes
#class IconShape
public abstract class IconShape
Defines the shape and rendering behavior of a QR code center icon/logo.
constructor IconShape
protected IconShape();
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);
Draw an icon bitmap at the specified location.
public sealed class ImageIconShape : IconShape
Icon shape that draws an image.
public ImageIconShape(SKBitmap image);
Creates an icon from an image.
public override void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);
public sealed class ImageTextIconShape : IconShape
Icon shape that draws an image with text positioned relative to it.
public ImageTextIconShape(SKBitmap image, string text, SKColor textColor, SKFont font, SKTextAlign horizontalAlign = 1, TextVerticalAlignment verticalAlign = 0, int textPadding = 0);
Creates an icon shape that displays an image with text positioned relative to it.
public override void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);
public class MicroQRCodeImageBuilder : QRCodeImageBuilderBase<MicroQRCodeImageBuilder>
High-level builder for creating Micro QR code images with fluent configuration and static methods.
Notes
public MicroQRCodeImageBuilder(MicroQRCodeData microQrCodeData);
Starts a builder that draws a Micro QR code you have already generated. The symbol is used exactly as given, so only the appearance options apply. Every encoding option throws InvalidOperationException on a builder created this way.
public MicroQRCodeImageBuilder(string content);
Starts a builder that will encode content when you ask for an image. Error correction, version and every other option keep their defaults until you set them.
public MicroQRCodeImageBuilder WithErrorCorrection(MicroQREccLevel eccLevel);
Configure the error correction level for the Micro QR code.
Notes
public MicroQRCodeImageBuilder WithMaskPattern(int? maskPattern);
Pin one of the four Micro QR data mask patterns (0-3) instead of the automatic edge-score selection; see MaskPattern .
public MicroQRCodeImageBuilder WithSegmentation(MicroQRSegmentation segmentation);
Split the content into mixed-mode segments when that lowers the version (see MicroQRSegmentation ). Defaults to Single . Never selects a larger version, and produces the identical symbol when a split would not shrink it.
public MicroQRCodeImageBuilder WithVersion(MicroQRVersion version);
Configure the Micro QR version to generate.
Notes
public MicroQRCodeImageBuilder WithVersion(MicroQRVersionRange versionRange);
Configure the versions the generator may choose from, rather than a single one.
Notes
public static byte[] GetImageBytes(MicroQRCodeData microQrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate a Micro QR code as image byte array with specified format.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, MicroQREccLevel eccLevel = 2, int size = 512, int quality = 100);
Generate a Micro QR code as image byte array with specified format.
public static byte[] GetPngBytes(MicroQRCodeData microQrCodeData, int size = 512);
Generate a Micro QR code as PNG byte array with default settings.
public static byte[] GetPngBytes(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code as PNG byte array with default settings.
public static byte[] GetSvgBytes(MicroQRCodeData microQrCodeData, int size = 512);
Generate a Micro QR code as SVG (UTF-8 encoded) byte array with default settings.
public static byte[] GetSvgBytes(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code as SVG (UTF-8 encoded) byte array with default settings.
public static string GetSvgString(MicroQRCodeData microQrCodeData, int size = 512);
Generate a Micro QR code as SVG document string with default settings.
public static string GetSvgString(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code as SVG document string with default settings.
public static void SavePng(MicroQRCodeData microQrCodeData, Stream output, int size = 512);
Generate a Micro QR code and save to stream with default PNG settings.
public static void SavePng(string content, Stream output, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code and save to stream with default PNG settings.
public static void SaveSvg(MicroQRCodeData microQrCodeData, Stream output, int size = 512);
Generate a Micro QR code and save as SVG to stream with default settings.
public static void SaveSvg(string content, Stream output, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code and save as SVG to stream with default settings.
public static void WriteImage(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate a Micro QR code and write to an IBufferWriter with specified format.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, MicroQREccLevel eccLevel = 2, int size = 512, int quality = 100);
Generate a Micro QR code and write to an IBufferWriter with specified format.
public static void WritePng(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate a Micro QR code and write to an IBufferWriter with default PNG settings.
public static void WritePng(string content, IBufferWriter<byte> writer, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code and write to an IBufferWriter with default PNG settings.
public static void WriteSvg(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate a Micro QR code and write as SVG (UTF-8 encoded) to an IBufferWriter with default settings.
public static void WriteSvg(string content, IBufferWriter<byte> writer, MicroQREccLevel eccLevel = 2, int size = 512);
Generate a Micro QR code and write as SVG (UTF-8 encoded) to an IBufferWriter with default settings.
public static class MicroQRCodeImageDecoder
Decodes Micro QR codes from SkiaSharp bitmaps. Extends MicroQRCodeDecoder , so with C# 14 the overloads are also reachable as MicroQRCodeDecoder.TryDecode(bitmap, ...); on older language versions call them on this class.
public static bool TryDecode(SKBitmap bitmap, out string text);
public static bool TryDecode(SKBitmap bitmap, out string text, out MicroQRCodeDecodeInfo info);
#class ModuleShape
public abstract class ModuleShape
Defines the shape of QR code modules
constructor ModuleShape
protected ModuleShape();
property RequiresAntialiasing
public bool RequiresAntialiasing { get; }
Gets whether this shape requires antialiasing for smooth rendering.
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
Draw a module at the specified location.
public static class QRCodeExtensions
Extension methods that render a QR, Micro QR or rMQR symbol onto an SKCanvas you already have, instead of producing an image file.
Notes
public static void Render(SKCanvas canvas, MicroQRCodeData data, SKRect area, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Renders a Micro QR code on the canvas with custom colors.
Notes
public static void Render(SKCanvas canvas, MicroQRCodeData data, int width, int height, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Renders a Micro QR code on the canvas with default colors.
Notes
public static void Render(SKCanvas canvas, QRCodeData data, SKRect area, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, IconData? iconData = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null, FinderPatternShape? finderPatternShape = null);
Renders a QR code on the canvas with custom colors.
public static void Render(SKCanvas canvas, QRCodeData data, int width, int height, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, IconData? iconData = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null, FinderPatternShape? finderPatternShape = null);
Renders a QR code on the canvas with default colors.
public static void Render(SKCanvas canvas, RmQRCodeData data, SKRect area, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Renders an rMQR code on the canvas with custom colors.
Notes
public static void Render(SKCanvas canvas, RmQRCodeData data, int width, int height, SKColor? clearColor = null, SKColor? codeColor = null, SKColor? backgroundColor = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Renders an rMQR code on the canvas with default colors.
Notes
public class QRCodeImageBuilder : QRCodeImageBuilderBase<QRCodeImageBuilder>
High-level builder for creating QR code images with fluent configuration and static methods.
Notes
public QRCodeImageBuilder(QRCodeData qrCodeData);
Starts a builder that draws a QR code you have already generated. The symbol is used exactly as given, so only the appearance options apply. Most encoding options throw InvalidOperationException on a builder created this way; WithErrorCorrection and WithEciMode are accepted and then ignored, because they shipped that way in 1.1.1.
public QRCodeImageBuilder(string content);
Starts a builder that will encode content when you ask for an image. Error correction, version and every other option keep their defaults until you set them.
public QRCodeImageBuilder WithEciMode(EciMode eciMode);
Configure the ECI (Extended Channel Interpretation) mode for character encoding.
public QRCodeImageBuilder WithErrorCorrection(ECCLevel eccLevel);
Configure the error correction level for the QR code.
public QRCodeImageBuilder WithErrorCorrectionBoost(bool boostEccLevel = true);
Raise the error correction level above the one configured with WithErrorCorrection when the chosen version's capacity allows it, without changing the version or the symbol size. Recommended together with WithIcon : the spare capacity absorbs the modules the icon covers.
public QRCodeImageBuilder WithFinderPatternShape(FinderPatternShape? finderPatternShape);
Configure the shape of the finder patterns.
public QRCodeImageBuilder WithIcon(IconData? iconData);
Configure an icon to overlay on the center of the QR code.
public QRCodeImageBuilder WithMaskPattern(int? maskPattern);
Pin one of the eight data mask patterns (0-7) instead of the automatic penalty-scored selection; see MaskPattern .
public QRCodeImageBuilder WithSegmentation(QRCodeSegmentation segmentation);
Split the content into mixed-mode segments when that lowers the version (see QRCodeSegmentation ). Defaults to Single . Never selects a larger version, and produces the identical symbol when a split would not shrink it.
public QRCodeImageBuilder WithVersion(QRCodeVersionRange versionRange);
Configure the versions the generator may choose from, rather than a single one.
Notes
public QRCodeImageBuilder WithVersion(int version);
Configure the QR code version to generate.
Notes
public static byte[] GetImageBytes(QRCodeData qrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate a QR code as image byte array with specified format.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, ECCLevel eccLevel = 1, int size = 512, int quality = 100);
Generate a QR code as image byte array with specified format.
public static byte[] GetPngBytes(QRCodeData qrCodeData, int size = 512);
Generate a QR code as PNG byte array with default settings.
public static byte[] GetPngBytes(string content, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code as PNG byte array with default settings.
public static byte[] GetSvgBytes(QRCodeData qrCodeData, int size = 512);
Generate a QR code as SVG (UTF-8 encoded) byte array with default settings.
public static byte[] GetSvgBytes(string content, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code as SVG (UTF-8 encoded) byte array with default settings.
public static string GetSvgString(QRCodeData qrCodeData, int size = 512);
Generate a QR code as SVG document string with default settings.
public static string GetSvgString(string content, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code as SVG document string with default settings.
public static void SavePng(QRCodeData qrCodeData, Stream output, int size = 512);
Generate a QR code and save to stream with default PNG settings.
public static void SavePng(string content, Stream output, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code and save to stream with default PNG settings.
public static void SaveSvg(QRCodeData qrCodeData, Stream output, int size = 512);
Generate a QR code and save as SVG to stream with default settings.
public static void SaveSvg(string content, Stream output, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code and save as SVG to stream with default settings.
public static void WriteImage(QRCodeData qrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate a QR code and write to an IBufferWriter with specified format.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, ECCLevel eccLevel = 1, int size = 512, int quality = 100);
Generate a QR code and write to an IBufferWriter with specified format.
public static void WritePng(QRCodeData qrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate a QR code and write to an IBufferWriter with default PNG settings.
public static void WritePng(string content, IBufferWriter<byte> writer, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code and write to an IBufferWriter with default PNG settings.
public static void WriteSvg(QRCodeData qrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate a QR code and write as SVG (UTF-8 encoded) to an IBufferWriter with default settings.
public static void WriteSvg(string content, IBufferWriter<byte> writer, ECCLevel eccLevel = 1, int size = 512);
Generate a QR code and write as SVG (UTF-8 encoded) to an IBufferWriter with default settings.
public abstract class QRCodeImageBuilderBase<TSelf>
Shared implementation for the symbology-specific QR image builders ( QRCodeImageBuilder , MicroQRCodeImageBuilder ): the fluent options every symbology supports, canvas layout, and the complete raster/SVG output surface. Symbology-specific concerns, error correction and version types, icon overlays, finder pattern styling, live on the derived builders.
Notes
public SKBitmap ToBitmap();
Generate the symbol image and return as SKBitmap.
public SKImage ToImage();
Generate the symbol image and return as SKImage.
public TSelf WithColors(SKColor? codeColor = null, SKColor? backgroundColor = null, SKColor? clearColor = null);
Configure the colors used in the image.
public TSelf WithFormat(SKEncodedImageFormat format, int quality = 100);
Configure the output image format and quality.
public TSelf WithGradient(GradientOptions? gradientOptions);
Configure gradient options for the modules.
public TSelf WithModulePixelSize(int modulePixelSize);
Configure content size from pixels-per-module.
Notes
public TSelf WithModuleShape(ModuleShape? moduleShape, float sizePercent = 1);
Configure the shape of the modules.
Notes
public TSelf WithQuietZone(int size);
Configure the quiet zone size (light border) around the symbol.
Notes
public TSelf WithSize(int width, int height);
Configure the output image size in absolute pixels.
Notes
public byte[] ToByteArray();
Generate the symbol image and return as byte array.
public string ToSvgString();
Generate the symbol and return as SVG document string.
Notes
public void SaveTo(IBufferWriter<byte> writer);
Generate the symbol image and write to an IBufferWriter. This is more efficient than SaveTo(Stream) as it avoids intermediate buffering.
public void SaveTo(Stream output);
Generate the symbol image and save to stream.
public void SaveToSvg(IBufferWriter<byte> writer);
Generate the symbol and write as SVG document to an IBufferWriter.
Notes
public void SaveToSvg(Stream output);
Generate the symbol and save as SVG document to stream.
Notes
public static class QRCodeImageDecoder
Decodes QR codes from SkiaSharp bitmaps. Extends QRCodeDecoder , so with C# 14 the overloads are also reachable as QRCodeDecoder.TryDecode(bitmap, ...); on older language versions call them on this class.
public static bool TryDecode(SKBitmap bitmap, out string text);
public static bool TryDecode(SKBitmap bitmap, out string text, out QRCodeDecodeInfo info);
public static class QRCodeRenderer
Provides low-level rendering capabilities for QR codes to SkiaSharp canvases. Offers fine-grained control over appearance, including colors, shapes, gradients, and icon overlays.
public static SKRect GetFinderPatternRect(QRCodeData data, int patternIndex, SKRect renderArea);
Gets the rectangle area for a specified finder pattern in the rendered QR code area.
Notes
public static ValueTuple<SKRect, SKRect> GetIconRects(QRCodeData data, SKRect area, IconData iconData);
Calculates icon and border rectangles for the given QR code area.
Notes
public static void Render(SKCanvas canvas, SKRect area, MicroQRCodeData data, SKColor? codeColor, SKColor? backgroundColor, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Render the specified Micro QR data into the given area of the target canvas.
Notes
public static void Render(SKCanvas canvas, SKRect area, QRCodeData data, SKColor? codeColor, SKColor? backgroundColor, IconData? iconData = null, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null, FinderPatternShape? finderPatternShape = null);
Render the specified data into the given area of the target canvas.
Notes
public static void Render(SKCanvas canvas, SKRect area, RmQRCodeData data, SKColor? codeColor, SKColor? backgroundColor, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null);
Renders an rMQR code onto the canvas. The rectangular symbol (quiet zone included) is drawn with a uniform module scale and centered in area (letterbox); the whole area receives the background.
Notes
public sealed class RectangleFinderPatternShape : FinderPatternShape
Standard QR code finder pattern (three nested squares, 7x7, 5x5, 3x3).
field Default
public static readonly RectangleFinderPatternShape Default;
Gets the default instance.
public bool RequiresAntialiasing { get; }
Antialiasing disabled; straight-edged rectangles render cleanly without it.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);
public sealed class RectangleModuleShape : ModuleShape
Draw modules as rectangles.
field Default
public static readonly RectangleModuleShape Default;
Gets the default instance.
public bool RequiresAntialiasing { get; }
Antialiasing disabled to prevent gray borders between modules.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public class RmQRCodeImageBuilder : QRCodeImageBuilderBase<RmQRCodeImageBuilder>
High-level builder for creating rMQR code images with fluent configuration and static methods.
Notes
public RmQRCodeImageBuilder(RmQRCodeData rmQrCodeData);
Starts a builder that draws an rMQR code you have already generated. The symbol is used exactly as given, so only the appearance options apply. Every encoding option throws InvalidOperationException on a builder created this way.
public RmQRCodeImageBuilder(string content);
Starts a builder that will encode content when you ask for an image. Error correction, version and fit keep their defaults until you set them.
public RmQRCodeImageBuilder WithEciMode(EciMode eciMode);
Configure the ECI character encoding declaration.
public RmQRCodeImageBuilder WithErrorCorrection(RmQREccLevel eccLevel);
Configure the error correction level (M or H).
public RmQRCodeImageBuilder WithFitStrategy(RmQRFitStrategy fitStrategy);
Configure how the version is chosen among those that hold the content (default MinimizeArea , fewest modules; note it may prefer a taller, narrower symbol, use MinimizeHeight or WithHeight for the flattest fit).
public RmQRCodeImageBuilder WithHeight(RmQRHeight height);
Restrict automatic version selection to one symbol height (fixed height, automatic width). Must agree with WithVersion when both are used.
public RmQRCodeImageBuilder WithSegmentation(RmQRSegmentation segmentation);
Split the content into mixed-mode segments when that lowers the module count (see RmQRSegmentation ). Defaults to Single . Fewer modules is not the same as a smaller image: a flatter, wider symbol can render onto a larger grid.
public RmQRCodeImageBuilder WithVersion(RmQRVersion version);
Configure the exact rMQR version to generate.
public RmQRCodeImageBuilder WithWidth(int width);
Configure the image width in pixels; the height follows the symbol aspect ratio (rounded to whole pixels), the background covers the whole image and the symbol is drawn at a uniform module scale inside it. This is the static helpers' sizing rule and the default (512) when no size is configured. QRCodeImageBuilderBase (letterbox into an exact canvas) or QRCodeImageBuilderBase (exact matrix) take precedence when also called.
public static byte[] GetImageBytes(RmQRCodeData rmQrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate an rMQR code as image byte array with specified format.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, RmQREccLevel eccLevel = 0, int size = 512, int quality = 100);
Generate an rMQR code as image byte array with specified format.
public static byte[] GetPngBytes(RmQRCodeData rmQrCodeData, int size = 512);
Generate an rMQR code as PNG byte array with default settings.
public static byte[] GetPngBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code as PNG byte array with default settings.
public static byte[] GetSvgBytes(RmQRCodeData rmQrCodeData, int size = 512);
Generate an rMQR code as SVG byte array.
public static byte[] GetSvgBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code as SVG byte array.
public static string GetSvgString(RmQRCodeData rmQrCodeData, int size = 512);
Generate an rMQR code as SVG string.
public static string GetSvgString(string content, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code as SVG string.
public static void SavePng(RmQRCodeData rmQrCodeData, Stream output, int size = 512);
Generate an rMQR code and save as PNG to stream.
public static void SavePng(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code and save as PNG to stream.
public static void SaveSvg(RmQRCodeData rmQrCodeData, Stream output, int size = 512);
Generate an rMQR code and save as SVG to stream.
public static void SaveSvg(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code and save as SVG to stream.
public static void WriteImage(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Generate an rMQR code and write encoded image bytes to a buffer writer.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, RmQREccLevel eccLevel = 0, int size = 512, int quality = 100);
Generate an rMQR code and write encoded image bytes to a buffer writer.
public static void WritePng(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate an rMQR code and write PNG bytes to a buffer writer.
public static void WritePng(string content, IBufferWriter<byte> writer, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code and write PNG bytes to a buffer writer.
public static void WriteSvg(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, int size = 512);
Generate an rMQR code and write the SVG document to a buffer writer.
public static void WriteSvg(string content, IBufferWriter<byte> writer, RmQREccLevel eccLevel = 0, int size = 512);
Generate an rMQR code and write the SVG document to a buffer writer.
public static class RmQRCodeImageDecoder
Decodes rMQR Codes from SkiaSharp bitmaps. Extends RmQRCodeDecoder , so with C# 14 the overloads are also reachable as RmQRCodeDecoder.TryDecode(bitmap, ...); on older language versions call them on this class.
public static bool TryDecode(SKBitmap bitmap, out string text);
public static bool TryDecode(SKBitmap bitmap, out string text, out RmQRCodeDecodeInfo info);
public sealed class RoundedRectangleCircleFinderPatternShape : FinderPatternShape
Rounded rectangle outer with circular center finder pattern. Three nested shapes: outer rounded rectangle (7Γ7), middle rounded rectangle (5Γ5), inner circle (3Γ3).
field Default
public static readonly RoundedRectangleCircleFinderPatternShape Default;
Gets the default instance.
public RoundedRectangleCircleFinderPatternShape(float cornerRadiusPercent = 0.3);
Initializes a new instance with the specified corner radius.
public bool RequiresAntialiasing { get; }
Requires antialiasing to prevent jagged edges on curves.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);
public sealed class RoundedRectangleFinderPatternShape : FinderPatternShape
Rounded rectangle outer with circular center finder pattern. Three nested shapes: outer rounded rectangle (7Γ7), middle rounded rectangle (5Γ5), inner rounded rectangle (3Γ3).
field Default
public static readonly RoundedRectangleFinderPatternShape Default;
Gets the default instance.
public RoundedRectangleFinderPatternShape(float cornerRadiusPercent = 0.2);
Initializes a new instance with the specified corner radius.
public bool RequiresAntialiasing { get; }
Requires antialiasing to prevent jagged edges on curves.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);
public sealed class RoundedRectangleModuleShape : ModuleShape
Draws modules as rounded rectangles.
field Default
public static readonly RoundedRectangleModuleShape Default;
Gets the default instance.
public RoundedRectangleModuleShape(float cornerRadiusPercent = 0.3);
Initializes a new instance with the specified corner radius.
public bool RequiresAntialiasing { get; }
Requires antialiasing to prevent jagged edges on curves.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
#enum TextVerticalAlignment
public enum TextVerticalAlignment : int
Specifies the vertical alignment of text relative to the icon.
Bottom = 0,
Text is positioned below the icon (default).
Center = 1,
Text is centered vertically with the icon.
Top = 2,
Text is positioned above the icon.
public readonly struct Vector2Slim : IEquatable<Vector2Slim>
int version of Vector2, slim implementation
Notes
field One
public static readonly Vector2Slim One;
Returns the vector (1,1).
field UnitX
public static readonly Vector2Slim UnitX;
Returns the vector (1,0).
field UnitY
public static readonly Vector2Slim UnitY;
Returns the vector (0,1).
field Zero
public static readonly Vector2Slim Zero;
Returns the vector (0,0).
public Vector2Slim(int value);
Creates a vector with both components set to the same value.
public Vector2Slim(int x, int y);
Creates a vector from its two components.
property X
public int X { get; }
The X component of the vector.
property Y
public int Y { get; }
The Y component of the vector.
public void CopyTo(Span<int> span);
Copies the vector elements to the specified span.
public void CopyTo(Span<int> span, int index);
Copies the vector elements to the specified span starting at the specified index.
public void CopyTo(int[] array);
Copies the vector elements to the specified array.
public void CopyTo(int[] array, int index);
Copies the vector elements to the specified array starting at the specified index.
Nothing matches that.