namespace FeatherQR
#enum DecodeStatus
public enum DecodeStatus : int
Result status of a decode attempt, shared by the Standard QR, Micro QR and rMQR decoders.
Success = 0,
Decoding succeeded.
InvalidMatrix = 1,
The input is not a valid 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: an ECI assignment it does not map to a charset (it reads 1, 3 and 27 as ISO-8859-1, 26 as UTF-8 and 20 as Shift_JIS). 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 symbol 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
#enum EciMode
public enum EciMode : int
The character encoding declared in the symbol, as an ECI assignment.
Default = 0,
Picks the encoding from the content, which is what you want unless a reader demands otherwise.
Notes
Iso8859_1 = 3,
ISO-8859-1, covering ASCII plus Western European letters such as Γ, Γ, Γ, Γ© and ΓΌ.
Notes
Utf8 = 26,
UTF-8, which covers every Unicode character: emoji, CJK, Cyrillic, Arabic, Hebrew and the rest.
Notes
public readonly struct Fnc1Mode : IEquatable<Fnc1Mode>
The FNC1 mode a Standard QR or rMQR symbol carries (ISO/IEC 18004:2006 6.4.8, ISO/IEC 23941 7.4.8): written through Fnc1 and Fnc1 , read on Fnc1 and Fnc1 .
Notes
public bool IsFirstPosition { get; }
true when the symbol carries FNC1 in first position: its text is a GS1 element string.
public bool IsSecondPosition { get; }
true when the symbol carries FNC1 in second position: its text follows the industry format ApplicationIndicator names.
public int? ApplicationIndicator { get; }
The application indicator as on the wire in second position (0-99 as its value, or a letter's ASCII value plus 100), and null in first position and without FNC1. 00 is the value 0, so a missing indicator is null rather than a number.
public static Fnc1Mode FirstPosition { get; }
FNC1 in first position: GS1 data, an element string with U+001D as the separator.
property None
public static Fnc1Mode None { get; }
No FNC1, the default: the symbol's text is read as it is.
public static Fnc1Mode SecondPosition(char letter);
FNC1 in second position with a one-letter application indicator, A to Z or a to z, carried as its ASCII value plus 100.
public static Fnc1Mode SecondPosition(int number);
FNC1 in second position with a two-digit application indicator, 00 to 99. A letter indicator is given to SecondPosition .
public readonly struct ImagePoint : IEquatable<ImagePoint>
A position in an image, in continuous pixel coordinates: (0, 0) is the top-left corner of the top-left pixel and (width, height) the bottom-right corner of the image, so the value plots directly in SkiaSharp, a canvas or System.Drawing.
Notes
property X
public float X { get; }
Horizontal position in pixels, increasing to the right.
property Y
public float Y { get; }
Vertical position in pixels, increasing downward.
public readonly struct MicroQRCodeCalculatedSize : IEquatable<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).
property Size
public int Size { get; }
Matrix side length in modules, quiet zone included.
public sealed class MicroQRCodeData
A Micro QR code as a module matrix, ready to render, serialize or decode.
Notes
public MicroQRCodeData(MicroQRVersion version, int quietZoneSize);
Creates an empty matrix sized for the given version.
public MicroQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);
public MicroQRCodeData(byte[] rawData, int quietZoneSize);
Restores a Micro QR code from bytes written by GetRawData .
Notes
public MicroQRVersion Version { get; }
The Micro QR code version, M1 to M4.
public bool this[int row, int col] { get; }
The module at the given position.
Notes
property Size
public int Size { get; }
Side length in modules, quiet zone included.
public ModuleRect[] GetModuleRectangles();
The dark modules as merged rectangles, for drawing the Micro QR code with any graphics API: SVG paths, draw calls, vector output.
Notes
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the rectangles of GetModuleRectangles into the buffer you provide, without allocating.
public byte[] GetRawData();
Serializes the Micro QR code so it can be stored, sent or cached.
Notes
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);
Serializes the Micro QR code into a buffer writer, without allocating a byte array.
public int GetRawDataSize();
How many bytes GetRawData produces for this Micro QR code.
public readonly struct MicroQRCodeDecodeInfo : IEquatable<MicroQRCodeDecodeInfo>
Diagnostic information produced by a Micro QR code decode attempt.
Notes
public DecodeStatus Status { get; }
Decode result status. Success when decoding succeeded.
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 SymbolCorners Corners { get; }
Where the symbol sits in the image, when decoded from one. See SymbolCorners . Empty for a matrix-level decode or a failed one.
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 from a Micro QR code.
public static bool TryDecode(MicroQRCodeData data, out string text, out MicroQRCodeDecodeInfo info);
Decodes the text from a Micro QR code and reports what it found.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, Span<char> destination, out int charsWritten, out MicroQRCodeDecodeInfo info);
Decodes the text into the buffer you provide, without allocating.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out MicroQRCodeDecodeInfo info);
Decodes the text from a module matrix.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out MicroQRCodeDecodeInfo info);
Finds and decodes a Micro QR code in a grayscale image, writing into the buffer you provide without allocating.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out MicroQRCodeDecodeInfo info);
Finds and decodes a Micro QR code in a grayscale image.
public static int GetMaxDecodedLength(MicroQRVersion version);
The most characters a Micro QR code of this version can decode to, across every error correction level and mode. Use it to size the destination of the allocation-free overloads.
public static class MicroQRCodeGenerator
Encodes text into a Micro QR code (ISO/IEC 18004), versions M1 to M4.
Notes
public static MicroQRCodeData Create(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, in MicroQRCodeGeneratorOptions options = null);
Encodes text into a Micro QR code.
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, MicroQREccLevel eccLevel, out MicroQRCodeCalculatedSize size, in MicroQRCodeGeneratorOptions options = null);
Reports how large the Micro QR code will be, or false when the content does not fit.
Notes
public static int Create(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, Span<byte> destination, in MicroQRCodeGeneratorOptions options = null);
Encodes text into the buffer you provide, without allocating.
Notes
public 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; set; }
How the content is split into encoding-mode segments (see MicroQRSegmentation ). Defaults to Optimal . 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; set; }
The versions the generator may choose from. Defaults to Any . A MicroQRVersion or its nullable converts implicitly, so a null means automatic.
public bool AllowKanji { get; set; }
Write text in Kanji mode where it can be: 13 bits a character, where UTF-8 takes 24 bits a kana or kanji. Off by default.
Notes
public int QuietZoneSize { get; set; }
Quiet zone width in modules. Defaults to 2, the ISO/IEC 18004 value for Micro QR. 0 is valid.
public int? MaskPattern { get; set; }
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 QREccLevel : 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.
Optimal = 0,
The default: the mixed-mode split with the fewest total bits. Text JIS X 0208 holds apart from its ASCII characters can be written as Kanji runs beside runs of that ASCII, when AllowKanji is set and that is the smaller symbol. 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 Latin-1 run the charset heuristic would read as UTF-8 or Shift_JIS), in which case it reports "does not fit" rather than emitting a stream that decodes differently. A U+FEFF inside UTF-8 content never opens a Byte run, where a reader would drop it as a byte order mark: the run opens a character early and keeps it interior.
Notes
Single = 1,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte, or Kanji for text JIS X 0208 holds entirely when AllowKanji is set). The cheapest to encode: one pass over the content and no version search, and the bit stream every release before 2.0.0 emitted.
#enum MicroQRVersion
public enum MicroQRVersion : int
Micro QR version (ISO/IEC 18004), which fixes the size: M1 is 11 Γ 11 modules, M2 13 Γ 13, M3 15 Γ 15 and M4 17 Γ 17.
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 QRVersionRange .
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>
Result of TryGetRequiredBufferSize : buffer size, matrix side length and selected version for a pending QR code encode.
public int BufferSize { get; }
Required destination buffer size in bytes (one byte per module, quiet zone included).
property Size
public int Size { get; }
Matrix side length in modules, quiet zone included.
public int Version { get; }
The QR code version (1-40) that will be produced.
public sealed class QRCodeData
A Standard QR code as a module matrix, ready to render, serialize or decode.
Notes
public QRCodeData(ReadOnlySpan<byte> rawDataSpan, int quietZoneSize);
Restores a QR code from bytes written by GetRawData , without copying them into an array first.
Notes
public QRCodeData(byte[] rawData, int quietZoneSize);
Restores a QR code from bytes written by GetRawData .
Notes
public QRCodeData(int version, int quietZoneSize);
Creates an empty matrix sized for the given version.
public bool this[int row, int col] { get; }
The module at the given position.
Notes
property Size
public int Size { get; }
Side length in modules, quiet zone included.
public int Version { get; }
The QR code version, 1 to 40.
public ModuleRect[] GetModuleRectangles();
The dark modules as merged rectangles, for drawing the QR code with any graphics API: SVG paths, draw calls, vector output.
Notes
public bool IsFinderPattern(int row, int col);
Tells whether a module belongs to one of the three finder patterns, so a renderer can style them apart.
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the rectangles of GetModuleRectangles into the buffer you provide, without allocating.
public byte[] GetRawData();
Serializes the QR code so it can be stored, sent or cached.
Notes
public int GetFinderPatternIndex(int row, int col);
Tells which finder pattern a module belongs to, so each corner can be styled separately.
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);
Serializes the QR code into a buffer writer, without allocating a byte array.
Notes
public int GetRawDataSize();
How many bytes GetRawData produces for this QR code.
public readonly struct QRCodeDecodeInfo : IEquatable<QRCodeDecodeInfo>
Diagnostic information produced by a QR code decode attempt.
public DecodeStatus Status { get; }
Decode result status. Success when decoding succeeded.
property Fnc1
public Fnc1Mode Fnc1 { get; }
The FNC1 mode, when the symbol carries one (GS1 data, or an industry format with its application indicator). See Fnc1Mode . default, neither position, for a symbol that carries none or a failed decode.
public QREccLevel EccLevel { get; }
Error correction level read from the format information.
public QRStructuredAppend StructuredAppend { get; }
The Structured Append header, when the symbol is one of a set. See QRStructuredAppend . Empty for a symbol that carries none, or a failed decode.
public SymbolCorners Corners { get; }
Where the symbol sits in the image, when decoded from one. See SymbolCorners . Empty for a matrix-level decode or a failed one.
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.
public static class QRCodeDecoder
Decodes a Standard QR code (ISO/IEC 18004) back into text, correcting errors as it goes.
Notes
public static bool TryDecode(QRCodeData data, out string text);
Decodes the text from a QR code.
public static bool TryDecode(QRCodeData data, out string text, out QRCodeDecodeInfo info);
Decodes the text from a QR code and reports what it found.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, Span<char> destination, out int charsWritten, out QRCodeDecodeInfo info);
Decodes the text into the buffer you provide, without allocating.
public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out QRCodeDecodeInfo info);
Decodes the text from a module matrix.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out QRCodeDecodeInfo info);
Finds and decodes a QR code in a grayscale image, writing into the buffer you provide without allocating.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out QRCodeDecodeInfo info);
Finds and decodes a QR code in a grayscale image.
public static int GetMaxDecodedLength(int version);
The most characters a QR code of this version can decode to, across every error correction level and mode. Use it to size the destination of the allocation-free overloads.
public static class QRCodeGenerator
Encodes text into a Standard QR code (ISO/IEC 18004), versions 1 to 40.
Notes
public static QRCodeData Create(ReadOnlySpan<char> textSpan, QREccLevel eccLevel, in QRCodeGeneratorOptions options = null);
Encodes text into a QR code.
public static QRCodeData[] CreateStructuredAppend(ReadOnlySpan<char> textSpan, QREccLevel eccLevel, in QRCodeGeneratorOptions options = null);
Encodes text as a Structured Append set: up to sixteen QR codes that a reader reassembles into one message.
Notes
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, QREccLevel eccLevel, out QRCodeCalculatedSize size, in QRCodeGeneratorOptions options = null);
Reports how large the QR code will be, or false when the content does not fit.
Notes
public static int Create(ReadOnlySpan<char> textSpan, QREccLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options = null);
Encodes text into the buffer you provide, without allocating.
Notes
public 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; set; }
Character encoding declaration. The default auto-detects ASCII (no ECI), ISO-8859-1 (assignment 3) or UTF-8 (assignment 26) from the content, and with AllowKanji Kanji mode (no ECI) for text JIS X 0208 holds.
property Fnc1
public Fnc1Mode Fnc1 { get; set; }
The FNC1 mode to write (ISO/IEC 18004:2006 6.4.8): FirstPosition for GS1 data, or second position with an application indicator for an industry format registered with AIM. Defaults to None .
Notes
public QRSegmentation Segmentation { get; set; }
How the content is split into encoding-mode segments (see QRSegmentation ). Defaults to Optimal . 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 QRVersionRange Version { get; set; }
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 AllowKanji { get; set; }
Write text in Kanji mode where it can be: 13 bits a character and no ECI header, where UTF-8 takes 24 bits a kana or kanji behind a 12-bit ECI header. Off by default.
Notes
public bool BoostEccLevel { get; set; }
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; set; }
Include a UTF-8 byte order mark. Ignored unless the content is written as UTF-8 in Byte mode. Asking for one keeps text that AllowKanji would write in Kanji mode in UTF-8. 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; set; }
Quiet zone width in modules. Defaults to 4, the ISO/IEC 18004 value, and 0 is valid.
public int? MaskPattern { get; set; }
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 QREccLevel
public enum QREccLevel : 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 QRSegmentation
public enum QRSegmentation : 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.
Optimal = 0,
The default: the mixed-mode split with the fewest total bits. Text JIS X 0208 holds apart from its ASCII characters can be written as Kanji runs beside runs of that ASCII, with no ECI header, when AllowKanji is set, the charset is left to the library and that is the smaller symbol. 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. A U+FEFF inside UTF-8 content never opens a Byte run, where a reader would drop it as a byte order mark: the run opens a character early and keeps it interior.
Notes
Single = 1,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte, or Kanji for text JIS X 0208 holds entirely when AllowKanji is set and the charset is left to the library). The cheapest to encode: one pass over the content and no version search, and the bit stream every release before 2.0.0 emitted.
public readonly struct QRStructuredAppend : IEquatable<QRStructuredAppend>
The Structured Append header a Standard QR symbol carries when it is one of a set of up to sixteen symbols that together hold one message (ISO/IEC 18004 Structured Append). Micro QR and rMQR do not define it.
Notes
public bool IsEmpty { get; }
true when the symbol carried no Structured Append header, or the decode did not succeed.
public byte Parity { get; }
The set's parity byte, the same on every symbol of one set.
public int Count { get; }
How many symbols the set has, 1 to 16.
public int Index { get; }
This symbol's position in the set, 0-based, as on the wire. Less than Count whenever the value is not empty. Both are 0 on the empty value.
public readonly struct QRVersionRange : IEquatable<QRVersionRange>
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 QRVersionRange(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 QRVersionRange 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 QRVersionRange AtLeast(int version);
version or larger.
public static QRVersionRange AtMost(int version);
version or smaller.
public static QRVersionRange Between(int min, int max);
An inclusive range from min to max .
public static QRVersionRange Exactly(int version);
Exactly version , with no automatic selection.
public static QRVersionRange op_Implicit(int version);
A single version, as Exactly . Lets an option set read Version = 15.
public static QRVersionRange op_Implicit(int? version);
A single version, or Any when there is none.
Notes
public readonly struct RmQRCodeCalculatedSize : IEquatable<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 sealed class RmQRCodeData
An rMQR code as a module matrix, ready to render, serialize or decode.
Notes
public RmQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);
public RmQRCodeData(RmQRVersion version, int quietZoneSize);
Creates an empty matrix sized for the given version.
public RmQRCodeData(byte[] rawData, int quietZoneSize);
Restores an rMQR code from bytes written by GetRawData .
Notes
public RmQRVersion Version { get; }
The rMQR code version.
public bool this[int row, int col] { get; }
The module at the given position.
Notes
public int Height { get; }
Height in modules, quiet zone included.
public int Width { get; }
Width in modules, quiet zone included.
public ModuleRect[] GetModuleRectangles();
The dark modules as merged rectangles, for drawing the rMQR code with any graphics API: SVG paths, draw calls, vector output.
Notes
public bool TryGetModuleRectangles(Span<ModuleRect> destination, out int written);
Writes the rectangles of GetModuleRectangles into the buffer you provide, without allocating.
public byte[] GetRawData();
Serializes the rMQR code so it can be stored, sent or cached.
Notes
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);
Serializes the rMQR code into a buffer writer, without allocating a byte array.
public int GetRawDataSize();
How many bytes GetRawData produces for this rMQR code.
public readonly struct RmQRCodeDecodeInfo : IEquatable<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, and on success the FNC1 mode when the symbol carries one. rMQR has a single data mask, so there is no mask pattern to report, and it does not define Structured Append.
public DecodeStatus Status { get; }
Decode outcome. Success when text was produced.
property Fnc1
public Fnc1Mode Fnc1 { get; }
The FNC1 mode, when the symbol carries one (GS1 data, or an industry format with its application indicator). See Fnc1Mode . default, neither position, for a symbol that carries none or a failed decode.
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 SymbolCorners Corners { get; }
Where the symbol sits in the image, when decoded from one. See SymbolCorners . Empty for a matrix-level decode or a failed one.
public int ErrorsCorrected { get; }
Total Reed-Solomon codeword corrections across all blocks (0 for a clean symbol).
public static class RmQRCodeDecoder
Decodes an rMQR code (ISO/IEC 23941) back into text, correcting errors as it goes.
Notes
public static bool TryDecode(ReadOnlySpan<byte> modules, int width, int height, Span<char> destination, out int charsWritten, out RmQRCodeDecodeInfo info);
Decodes the text into the buffer you provide, without allocating.
public static bool TryDecode(ReadOnlySpan<byte> modules, int width, int height, out string text, out RmQRCodeDecodeInfo info);
Decodes the text from a module matrix.
public static bool TryDecode(RmQRCodeData data, out string text);
Decodes the text from an rMQR code.
public static bool TryDecode(RmQRCodeData data, out string text, out RmQRCodeDecodeInfo info);
Decodes the text from an rMQR code and reports what it found.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, Span<char> destination, out int charsWritten, out RmQRCodeDecodeInfo info);
Finds and decodes an rMQR code in a grayscale image, writing into the buffer you provide without allocating.
public static bool TryDecodeImage(ReadOnlySpan<byte> luminance, int width, int height, out string text, out RmQRCodeDecodeInfo info);
Finds and decodes an rMQR code in a grayscale image.
public static int GetMaxDecodedLength(RmQRVersion version);
The most characters an rMQR code of this version can decode to, across every error correction level and mode. Use it to size the destination of the allocation-free overloads.
public static class RmQRCodeGenerator
Encodes text into a rectangular rMQR code (ISO/IEC 23941), versions R7x43 to R17x139.
Notes
public static RmQRCodeData Create(ReadOnlySpan<char> textSpan, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);
Encodes text into an rMQR code.
public static bool TryGetRequiredBufferSize(ReadOnlySpan<char> text, RmQREccLevel eccLevel, out RmQRCodeCalculatedSize size, in RmQRCodeGeneratorOptions options = null);
Reports how large the rMQR code will be, or false when the content does not fit.
Notes
public static int Create(ReadOnlySpan<char> textSpan, RmQREccLevel eccLevel, Span<byte> destination, in RmQRCodeGeneratorOptions options = null);
Encodes text into the buffer you provide, without allocating.
Notes
public 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 Create(text, eccLevel).
Notes
public EciMode EciMode { get; set; }
Character encoding declaration. The default auto-detects ASCII (no ECI), ISO-8859-1 (assignment 3) or UTF-8 (assignment 26) from the content, and with AllowKanji Kanji mode (no ECI) for text JIS X 0208 holds.
Notes
property Fnc1
public Fnc1Mode Fnc1 { get; set; }
The FNC1 mode to write (ISO/IEC 23941 7.4.8, as ISO/IEC 18004:2006 6.4.8): FirstPosition for GS1 data, or second position with an application indicator for an industry format registered with AIM. Defaults to None .
Notes
public RmQRFitStrategy FitStrategy { get; set; }
How to choose among the versions that hold the content. Defaults to MinimizeArea , the choice both reference encoders make.
public RmQRHeight? Height { get; set; }
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; set; }
Whether to split the content into mixed-mode segments. Defaults to Optimal . Size a destination buffer with the same value you encode with: the two modes can select different versions.
public RmQRVersion? Version { get; set; }
A specific version, or null (the default) to fit one automatically by FitStrategy and Height .
public bool AllowKanji { get; set; }
Write text in Kanji mode where it can be: 13 bits a character and no ECI header, where UTF-8 takes 24 bits a kana or kanji behind an 11-bit ECI header. Off by default.
Notes
public int QuietZoneSize { get; set; }
Quiet zone width in modules. Defaults to 2, the ISO/IEC 23941 value, and 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.
Optimal = 0,
The default: the mixed-mode split with the fewest total bits. Text JIS X 0208 holds apart from its ASCII characters can be written as Kanji runs beside runs of that ASCII, with no ECI header, when AllowKanji is set, the charset is left to the library and that is the smaller symbol. 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. A U+FEFF inside UTF-8 content never opens a Byte run, where a reader would drop it as a byte order mark: the run opens a character early and keeps it interior.
Notes
Single = 1,
One segment in the single mode that can represent the whole content (Numeric, else Alphanumeric, else Byte, or Kanji for text JIS X 0208 holds entirely when AllowKanji is set and the charset is left to the library). The cheapest to encode: one pass over the content and no version search, and the bit stream every release before 2.0.0 emitted.
#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.
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.
public readonly struct SymbolCorners : IEquatable<SymbolCorners>
Where a decoded symbol sits in the image: the four outer corners of its module area, quiet zone excluded, in the input image's continuous pixel coordinates (see ImagePoint ).
Notes
public ImagePoint BottomLeft { get; }
The corner at the symbol's bottom-left.
public ImagePoint BottomRight { get; }
The corner at the symbol's bottom-right.
public ImagePoint TopLeft { get; }
The corner beside the symbol's top-left finder pattern.
public ImagePoint TopRight { get; }
The corner at the symbol's top-right.
public bool IsEmpty { get; }
true when no corners were reported: the decode did not succeed, or it ran on a module matrix rather than an image.
namespace FeatherQR.Gs1
public readonly ref struct Gs1Element
One element of an element string as spans into it: the AI, its value and the AI's offset. The AI is 2 to 4 digits, the value excludes the separator.
property Ai
public ReadOnlySpan<char> Ai { get; }
The application identifier, 2 to 4 digits.
public ReadOnlySpan<char> Value { get; }
The value, without the separator that may follow it.
public int Offset { get; }
Where the AI starts in the element string.
public ref struct Gs1ElementEnumerator
Enumerates the elements of an element string without allocating, usable in foreach. It splits as a reader does ( EnumerateElements ): an AI of predefined length takes its length, any other value runs to the next separator, an unknown AI with a known length is read, a redundant or trailing separator is skipped, and the enumeration stops at the first element it cannot split. TryValidate says why.
public Gs1Element Current { get; }
The element last read by MoveNext .
public Gs1ElementEnumerator GetEnumerator();
Returns this enumerator, for foreach.
public bool MoveNext();
Advances to the next element: false at the end of the text, and at the first element that cannot be split.
public static class Gs1ElementString
Conversions between a GS1 element string (AI values with the group separator U+001D after each variable-length value another follows), its (AI) text and a GS1 Digital Link URI, and the checks the GS1 General Specifications define on the data. Every member takes a ReadOnlySpan of Char , so a String converts without an overload, and none throws for its input.
Notes
public static string DictionaryRelease { get; }
The release of the GS1 Barcode Syntax Dictionary this library's table was generated from, as the dictionary names it (2026-01-27). An AI assigned after that release is read as data but not checked or built, so UnknownAi from a building member means an AI newer than this release or a typo.
public static Gs1ElementEnumerator EnumerateElements(ReadOnlySpan<char> elementString);
Splits an element string into its elements without allocating: foreach (var element in Gs1ElementString.EnumerateElements(text)). Runs what splitting needs and no more: an AI of predefined length (Table 7-6, known to the table or not) takes its length and any other value runs to the next separator, an unknown AI whose first two digits give its length is read, a redundant or trailing separator is skipped, and the enumeration stops at the first element it cannot split. TryValidate says why.
public static bool TryFromDigitalLink(ReadOnlySpan<char> uri, Span<char> destination, out int charsWritten, out Gs1Error error);
Reads the GS1 data out of a Digital Link URI into destination without allocating. TryGetFromDigitalLinkLength gives the length to reserve. See TryFromDigitalLink .
public static bool TryFromDigitalLink(ReadOnlySpan<char> uri, out string elementString, out Gs1Error error);
Reads the GS1 data out of a Digital Link URI with any stem: the primary key and its qualifiers from the end of the path, then the numeric query keys in URI order, percent-decoded. Runs what reading needs, the URI's structure: the scheme and host, the key qualifier order, that a numeric query key is an AI the table knows and a data attribute not already in the path, and that a value decodes. The values' own checks are TryValidate 's.
Notes
public static bool TryFromHri(ReadOnlySpan<char> hri, Span<char> destination, out int charsWritten, out Gs1Error error);
Builds the element string of (AI) text into destination without allocating. TryGetFromHriLength gives the length to reserve. See TryFromHri .
public static bool TryFromHri(ReadOnlySpan<char> hri, out string elementString, out Gs1Error error);
Builds the element string of (AI) text, (01)09520123456788(10)ABC: each AI in parentheses and its value after it, up to the next unescaped (, with a literal ( in a value written \( and a \ written \\ (a \ before any other character is itself). Runs every check TryValidate runs, and puts the separator after every value that needs one.
Notes
public static bool TryGetFromDigitalLinkLength(ReadOnlySpan<char> uri, out int length, out Gs1Error error);
The length of the element string TryFromDigitalLink would read from this URI, after the same reading.
public static bool TryGetFromHriLength(ReadOnlySpan<char> hri, out int length, out Gs1Error error);
The length of the element string TryFromHri would build, after the same checks.
public static bool TryGetReadLength(ReadOnlySpan<char> text, Fnc1Mode fnc1, out int length, out Gs1Error error);
The length of the (AI) text TryRead would give, after the same reading.
public static bool TryGetToDigitalLinkLength(ReadOnlySpan<char> elementString, out int length, out Gs1Error error, string? stem = null);
The length of the URI TryToDigitalLink would build for this element string and stem, after the same checks.
public static bool TryGetToHriLength(ReadOnlySpan<char> elementString, out int length, out Gs1Error error);
The length of the (AI) text TryToHri would produce, after the same checks.
public static bool TryRead(ReadOnlySpan<char> text, Fnc1Mode fnc1, Span<char> destination, out int charsWritten, out Gs1Error error);
Reads what a decoder returned as GS1 data into destination without allocating. TryGetReadLength gives the length to reserve, and the text is never longer than twice the input. See TryRead .
public static bool TryRead(ReadOnlySpan<char> text, Fnc1Mode fnc1, out string hri, out Gs1Error error);
Reads what a decoder returned as GS1 data: with FNC1 in first position the text is an element string and comes back as (AI) text, as TryToHri gives it, otherwise the text is read as a Digital Link URI, as TryFromDigitalLink reads it, and its element string comes back as (AI) text. false when it is neither. The decode-side mirror of CreateGs1, independent of which decode entry point read the symbol.
public static bool TryToDigitalLink(ReadOnlySpan<char> elementString, Span<char> destination, out int charsWritten, out Gs1Error error, string? stem = null);
Builds a GS1 Digital Link URI into destination without allocating. TryGetToDigitalLinkLength gives the length to reserve. See TryToDigitalLink .
public static bool TryToDigitalLink(ReadOnlySpan<char> elementString, out string uri, out Gs1Error error, string? stem = null);
Builds a GS1 Digital Link URI (URI Syntax 1.7.0, uncompressed) from an element string: the primary key and its key qualifiers in the path, every other AI as a query parameter in the lexical order of the AIs, each AI once, reserved characters percent-encoded. With no stem the canonical https://id.gs1.org, so the result is the canonical form of section 4.12. Runs every check TryValidate runs, plus what a URI can carry: a primary key must be present and every AI outside the path must be a data attribute.
Notes
public static bool TryToHri(ReadOnlySpan<char> elementString, Span<char> destination, out int charsWritten, out Gs1Error error);
Formats an element string as its (AI) text into destination without allocating. TryGetToHriLength gives the length to reserve. See TryToHri .
public static bool TryToHri(ReadOnlySpan<char> elementString, out string hri, out Gs1Error error);
Formats an element string as its (AI) text, (01)09520123456788(10)ABC: each AI in parentheses and its value after it, a literal ( in a value written \( and a \ written \\. Runs what splitting needs and no more (an unknown AI whose first two digits give its length is read, a redundant or trailing separator is skipped), so a string TryValidate would refuse can still format.
Notes
public static bool TryValidate(ReadOnlySpan<char> elementString, out Gs1Error error);
Runs every check on an element string: AI lengths and character sets, check digits and check character pairs, dates and the other linters, requisite and exclusive pairings, repeated AIs. true with default error when it passes.
Notes
public readonly struct Gs1Error : IEquatable<Gs1Error>
Why a conversion or check refused its input: the Kind , and where in the input ( Offset and Length , both 0 when the kind names no place). The default is None . ToString is the message the generator entry points put in their Gs1FormatException .
public Gs1Error(Gs1ErrorKind kind, int offset, int length);
Creates an error. offset and length are positions in the input the error is about, 0 where the kind names no place.
property Kind
public Gs1ErrorKind Kind { get; }
What was wrong.
public int Length { get; }
How many characters of the input it covers. 0 when the kind names no place or a missing thing.
public int Offset { get; }
Where it starts in the input, in characters. 0 when the kind names no place.
public override string ToString();
The kind, the place and a sentence, such as InvalidCheckDigit at 15 (1 character): the check digit is wrong.
#enum Gs1ErrorKind
public enum Gs1ErrorKind : int
The kinds of Gs1Error : why a conversion or check refused its input. Later releases may add members at the end.
None = 0,
No error. The default of Gs1Error .
DestinationTooSmall = 1,
The caller's destination span is shorter than the result. Nothing was written.
InvalidText = 2,
The text has no element where one must be: an empty input, or (AI) text that is malformed, with an unbalanced or empty parenthesis, a non-digit AI, or a stray character outside the elements.
NotAUri = 3,
The input is not an http or https URI with a path.
CompressedUri = 4,
The URI is a compressed GS1 Digital Link URI, which this library does not read.
InvalidPercentEncoding = 5,
A percent escape in the URI is not % and two hexadecimal digits, does not decode to UTF-8, or decodes to a control character.
UnexpectedSeparator = 6,
A separator (U+001D) where no value can end: at the start of the element string, or right after another separator.
UnknownAi = 7,
An AI the table does not know, where building refuses it, or digits that no AI of the General Specifications' length table can start.
AiNotAllowedInUri = 8,
An AI a GS1 Digital Link URI cannot carry: (03), (8014), (8200), or one the table does not flag as a data attribute.
MissingPrimaryKey = 9,
No primary key AI for the path of a GS1 Digital Link URI.
InvalidKeyQualifierSequence = 10,
The key qualifiers after the primary key are not in one of the orders the table allows, or a qualifier of that key is in the query instead of the path.
EmptyValue = 11,
An element with no value.
ValueTooShort = 12,
A value shorter than its AI's format requires.
ValueTooLong = 13,
A value longer than its AI's format allows.
InvalidCharacter = 14,
A character outside the character set of its component (digits, CSET 82, CSET 39 or CSET 64 with its padding rule).
InvalidCheckDigit = 15,
A wrong check digit or check character pair.
InvalidDate = 16,
A date or time component that no calendar or clock holds: month 13, day 31 of a short month, 29 February of a common year, hour 24.
InvalidValue = 17,
A value that another rule of its AI refuses: an ISO 3166 or 4217 code not in the list, a yes/no flag, a zero or non-zero rule, a coordinate out of range, an IBAN, a coupon field, a position in a sequence.
MissingRequiredAi = 18,
An AI the table says this AI requires on the same item is missing.
ExcludedAiPair = 19,
Two AIs the table says cannot appear together.
RepeatedAi = 20,
The same AI twice with different values in an element string, or twice at all in a Digital Link URI.
public sealed class Gs1FormatException : FormatException
Thrown by the generator entry points (CreateGs1, CreateGs1DigitalLink) when the data is not valid GS1 data, or is data a Digital Link URI cannot carry. Nothing on Gs1ElementString throws for its input.
Notes
public Gs1FormatException(Gs1Error error);
Creates the exception for an error of the data.
public Gs1Error Error { get; }
What was wrong, and where in the text the caller passed.
public static class Gs1QRCodeGenerator
GS1 entry points on QRCodeGenerator : CreateGs1 writes a GS1 QR Code, the data under FNC1 in first position, and CreateGs1DigitalLink a plain QR Code holding the data's GS1 Digital Link URI. With C# 14 they are reachable as QRCodeGenerator.CreateGs1(...). On older language versions call them on this class.
Notes
public static QRCodeData CreateGs1(ReadOnlySpan<char> text, QREccLevel eccLevel, in QRCodeGeneratorOptions options = null);
public static QRCodeData CreateGs1DigitalLink(ReadOnlySpan<char> text, QREccLevel eccLevel, in QRCodeGeneratorOptions options = null, string? stem = null);
public static QRCodeData CreateGs1DigitalLink(ReadOnlySpan<char> text, QREccLevel eccLevel, in QRCodeGeneratorOptions options);
public static bool TryGetRequiredBufferSizeGs1(ReadOnlySpan<char> text, QREccLevel eccLevel, out QRCodeCalculatedSize size, in QRCodeGeneratorOptions options = null);
public static bool TryGetRequiredBufferSizeGs1DigitalLink(ReadOnlySpan<char> text, QREccLevel eccLevel, out QRCodeCalculatedSize size, in QRCodeGeneratorOptions options = null, string? stem = null);
public static int CreateGs1(ReadOnlySpan<char> text, QREccLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options = null);
public static int CreateGs1DigitalLink(ReadOnlySpan<char> text, QREccLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options = null, string? stem = null);
public static class Gs1RmQRCodeGenerator
GS1 entry points on RmQRCodeGenerator : CreateGs1 writes the data under FNC1 in first position into an rMQR code, and CreateGs1DigitalLink the data's GS1 Digital Link URI as plain text. With C# 14 they are reachable as RmQRCodeGenerator.CreateGs1(...). On older language versions call them on this class.
Notes
public static RmQRCodeData CreateGs1(ReadOnlySpan<char> text, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);
public static RmQRCodeData CreateGs1DigitalLink(ReadOnlySpan<char> text, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null, string? stem = null);
public static RmQRCodeData CreateGs1DigitalLink(ReadOnlySpan<char> text, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options);
public static bool TryGetRequiredBufferSizeGs1(ReadOnlySpan<char> text, RmQREccLevel eccLevel, out RmQRCodeCalculatedSize size, in RmQRCodeGeneratorOptions options = null);
public static bool TryGetRequiredBufferSizeGs1DigitalLink(ReadOnlySpan<char> text, RmQREccLevel eccLevel, out RmQRCodeCalculatedSize size, in RmQRCodeGeneratorOptions options = null, string? stem = null);
public static int CreateGs1(ReadOnlySpan<char> text, RmQREccLevel eccLevel, Span<byte> destination, in RmQRCodeGeneratorOptions options = null);
public static int CreateGs1DigitalLink(ReadOnlySpan<char> text, RmQREccLevel eccLevel, Span<byte> destination, in RmQRCodeGeneratorOptions options = null, string? stem = null);
namespace FeatherQR.SkiaSharp
public sealed class CircleFinderPatternShape : FinderPatternShape
Three nested ovals, circles on a square area.
field Default
public static readonly CircleFinderPatternShape Default;
A ready-made instance to use as-is.
public override bool RequiresAntialiasing { get; }
On, so the curves do not come out jagged.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public sealed class CircleModuleShape : ModuleShape
Draws modules as circles.
field Default
public static readonly CircleModuleShape Default;
A ready-made instance to use as-is.
public override bool RequiresAntialiasing { get; }
On, so the curves do not come out jagged.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
#class FinderPatternShape
public abstract class FinderPatternShape
How the finder patterns, the large squares in the corners, are drawn: three of them on Standard QR, one on Micro QR and rMQR.
Notes
constructor FinderPatternShape
protected FinderPatternShape();
property RequiresAntialiasing
public abstract bool RequiresAntialiasing { get; }
Whether the shape needs antialiasing. It decides the finder pattern's antialiasing on its own, so false turns antialiasing off even where the module shape asked for it. Return true for curves, false for straight edges.
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
Draws the dark modules of a finder pattern. The light ring is left undrawn.
#enum GradientDirection
public enum GradientDirection : int
Defines the direction of gradient flow for symbol rendering.
Notes
None = 0,
No gradient. Use solid color specified in symbol 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 sealed class GradientOptions : IEquatable<GradientOptions>
Gradient configuration for symbol 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(ReadOnlySpan<SKColor> colors, GradientDirection direction = 1, ReadOnlySpan<float> colorPositions = null);
Initializes a new instance of GradientOptions . Both spans are copied, so the caller keeps ownership of whatever it passed.
Notes
public GradientDirection Direction { get; init; }
The gradient direction.
Notes
public ReadOnlySpan<SKColor> Colors { get; }
Gradient colors, in flow order.
Notes
public ReadOnlySpan<float> ColorPositions { get; }
Color stops (0.0 to 1.0), or empty when the colors are evenly distributed.
Notes
public bool Equals(GradientOptions? other);
public override int GetHashCode();
public sealed class IconData : IEquatable<IconData>
The logo or image drawn at the center of a QR code, and its size.
Notes
constructor IconData obsolete
public IconData();
Creates an icon whose members are set through an object initializer.
Notes
public IconData(IconShape icon, int iconSizePercent = 10, int iconBorderWidth = 2, int? iconSizeModules = null, int? iconBorderModules = null, int maxCoreOccupancyPercent = 30);
Creates an icon without an object initializer, for consumers whose language version predates C# 9.
Notes
property Icon
public IconShape Icon { get; init; }
What to draw at the center.
public int IconBorderWidth { get; init; }
Width of the background-colored padding around the icon, in pixels. Ignored once IconSizeModules is set. Being in pixels, it does not shrink with the symbol, so on a symbol only a few pixels across it reaches past the drawing area. Size the icon in modules to keep the padding proportional.
public int IconSizePercent { get; init; }
Icon size as a percentage of the symbol's side, quiet zone included, 1 to 100. Ignored once IconSizeModules is set.
public int MaxCoreOccupancyPercent { get; init; }
How much of the QR code the icon and its border may cover, as a percentage. 30 by default. Only checked when the size is given in modules. Rendering throws when the icon exceeds it.
public int? IconBorderModules { get; init; }
Width of the padding around the icon, in modules. 1 when omitted.
public int? IconSizeModules { get; init; }
Icon size in modules, which keeps the icon aligned to the grid. Setting it switches sizing to modules, and IconSizePercent and IconBorderWidth stop applying.
public static IconData FromImage(SKBitmap image, int iconSizePercent = 10, int iconBorderWidth = 2);
Creates an icon sized as a percentage of the symbol's side.
public static IconData FromImageByModules(SKBitmap image, int iconSizeModules, int iconBorderModules = 1, int maxCoreOccupancyPercent = 30);
Creates an icon sized in modules, so it lines up with the QR code grid.
Notes
#class IconShape
public abstract class IconShape
How the icon at the center of a symbol is drawn.
constructor IconShape
protected IconShape();
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);
Draws the icon.
public sealed class ImageIconShape : IconShape
Draws an image as the icon.
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
Draws an image as the icon, with a caption beside it.
public ImageTextIconShape(SKBitmap image, string text, SKColor textColor, SKFont font, SKTextAlign horizontalAlign = 1, TextVerticalAlignment verticalAlign = 0, int textPadding = 0);
Creates the icon from an image and a caption.
public override void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);
public sealed class MicroQRCodeImageBuilder : SymbolImageBuilderBase<MicroQRCodeImageBuilder>
Turns text into a Micro QR image, as PNG, JPEG, WebP or SVG.
Notes
public MicroQRCodeImageBuilder(MicroQRCodeData microQrCodeData);
Starts a builder that draws a Micro QR code you have already generated. The Micro QR code is drawn exactly as given, so only the appearance options apply and the encoding options throw InvalidOperationException .
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);
Sets how much damage the Micro QR code should survive.
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 Optimal . Never selects a larger version, and produces the identical Micro QR code when a split would not shrink it.
public MicroQRCodeImageBuilder WithVersion(MicroQRVersion version);
Pins the version instead of letting the content choose it.
Notes
public MicroQRCodeImageBuilder WithVersion(MicroQRVersionRange versionRange);
Narrows the versions the generator may choose from, for a Micro QR code that has to reach or stay under a physical size.
public static byte[] GetImageBytes(MicroQRCodeData microQrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the Micro QR code and returns an image in the format you choose.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, MicroQREccLevel eccLevel = 2, int size = 512, int quality = 100);
Encodes the content and returns an image in the format you choose.
public static byte[] GetPngBytes(MicroQRCodeData microQrCodeData, int size = 512);
Renders the Micro QR code and returns a PNG image.
public static byte[] GetPngBytes(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and returns a PNG image.
public static byte[] GetSvgBytes(MicroQRCodeData microQrCodeData, int size = 512);
Renders the Micro QR code and returns an SVG document as UTF-8 bytes.
public static byte[] GetSvgBytes(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and returns an SVG document as UTF-8 bytes.
public static string GetSvgString(MicroQRCodeData microQrCodeData, int size = 512);
Renders the Micro QR code and returns an SVG document as a string.
public static string GetSvgString(string content, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and returns an SVG document as a string.
public static void SavePng(MicroQRCodeData microQrCodeData, Stream output, int size = 512);
Renders the Micro QR code and writes a PNG to a stream.
public static void SavePng(string content, Stream output, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and writes a PNG to a stream.
public static void SaveSvg(MicroQRCodeData microQrCodeData, Stream output, int size = 512);
Renders the Micro QR code and writes an SVG document to a stream.
public static void SaveSvg(string content, Stream output, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and writes an SVG document to a stream.
public static void WriteImage(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the Micro QR code and writes an image in the format you choose to a buffer writer.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, MicroQREccLevel eccLevel = 2, int size = 512, int quality = 100);
Encodes the content and writes an image in the format you choose to a buffer writer.
public static void WritePng(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the Micro QR code and writes a PNG to a buffer writer.
public static void WritePng(string content, IBufferWriter<byte> writer, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and writes a PNG to a buffer writer.
public static void WriteSvg(MicroQRCodeData microQrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the Micro QR code and writes an SVG document to a buffer writer.
public static void WriteSvg(string content, IBufferWriter<byte> writer, MicroQREccLevel eccLevel = 2, int size = 512);
Encodes the content and writes an SVG document to a buffer writer.
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
How the individual modules of a symbol are drawn.
constructor ModuleShape
protected ModuleShape();
property RequiresAntialiasing
public abstract bool RequiresAntialiasing { get; }
Whether the shape needs antialiasing. Return true for curves, false for straight edges.
method Draw
public abstract void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
Draws one module.
public sealed class QRCodeImageBuilder : SymbolImageBuilderBase<QRCodeImageBuilder>
Turns text into a Standard QR image, as PNG, JPEG, WebP or SVG.
Notes
public QRCodeImageBuilder(QRCodeData qrCodeData);
Starts a builder that draws a QR code you have already generated. The QR code 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.
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);
Sets the character encoding to declare in the QR code.
public QRCodeImageBuilder WithErrorCorrection(QREccLevel eccLevel);
Sets how much damage the QR code should survive: L recovers 7% of it, M 15%, Q 25% and H 30%.
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 QR code size. Recommended together with WithIcon : the spare capacity absorbs the modules the icon covers.
public QRCodeImageBuilder WithIcon(IconData? iconData);
Draws an icon over the center of the QR code.
Notes
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(QRSegmentation segmentation);
Split the content into mixed-mode segments when that lowers the version (see QRSegmentation ). Defaults to Optimal . Never selects a larger version, and produces the identical QR code when a split would not shrink it.
public QRCodeImageBuilder WithVersion(QRVersionRange versionRange);
Narrows the versions the generator may choose from, for a QR code that has to reach or stay under a physical size.
public QRCodeImageBuilder WithVersion(int version);
Pins the version instead of letting the content choose it.
Notes
public static byte[] GetImageBytes(QRCodeData qrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the QR code and returns an image in the format you choose.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, QREccLevel eccLevel = 1, int size = 512, int quality = 100);
Encodes the content and returns an image in the format you choose.
public static byte[] GetPngBytes(QRCodeData qrCodeData, int size = 512);
Renders the QR code and returns a PNG image.
public static byte[] GetPngBytes(string content, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and returns a PNG image.
public static byte[] GetSvgBytes(QRCodeData qrCodeData, int size = 512);
Renders the QR code and returns an SVG document as UTF-8 bytes.
public static byte[] GetSvgBytes(string content, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and returns an SVG document as UTF-8 bytes.
public static string GetSvgString(QRCodeData qrCodeData, int size = 512);
Renders the QR code and returns an SVG document as a string.
public static string GetSvgString(string content, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and returns an SVG document as a string.
public static void SavePng(QRCodeData qrCodeData, Stream output, int size = 512);
Renders the QR code and writes a PNG to a stream.
public static void SavePng(string content, Stream output, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and writes a PNG to a stream.
public static void SaveSvg(QRCodeData qrCodeData, Stream output, int size = 512);
Renders the QR code and writes an SVG document to a stream.
public static void SaveSvg(string content, Stream output, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and writes an SVG document to a stream.
public static void WriteImage(QRCodeData qrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the QR code and writes an image in the format you choose to a buffer writer.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, QREccLevel eccLevel = 1, int size = 512, int quality = 100);
Encodes the content and writes an image in the format you choose to a buffer writer.
public static void WritePng(QRCodeData qrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the QR code and writes a PNG to a buffer writer.
public static void WritePng(string content, IBufferWriter<byte> writer, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and writes a PNG to a buffer writer.
public static void WriteSvg(QRCodeData qrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the QR code and writes an SVG document to a buffer writer.
public static void WriteSvg(string content, IBufferWriter<byte> writer, QREccLevel eccLevel = 1, int size = 512);
Encodes the content and writes an SVG document to a buffer writer.
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 sealed class RectangleFinderPatternShape : FinderPatternShape
The standard finder pattern: three nested squares.
field Default
public static readonly RectangleFinderPatternShape Default;
A ready-made instance to use as-is.
public override bool RequiresAntialiasing { get; }
Off: straight edges render cleanly without it.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public sealed class RectangleModuleShape : ModuleShape
Draws modules as squares, the standard look.
field Default
public static readonly RectangleModuleShape Default;
A ready-made instance to use as-is.
public override bool RequiresAntialiasing { get; }
Off, so neighbouring modules do not show a gray seam between them.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public sealed class RmQRCodeImageBuilder : SymbolImageBuilderBase<RmQRCodeImageBuilder>
Turns text into a rectangular rMQR image, as PNG, JPEG, WebP or SVG.
Notes
public RmQRCodeImageBuilder(RmQRCodeData rmQrCodeData);
Starts a builder that draws an rMQR code you have already generated. The rMQR code is drawn exactly as given, so only the appearance options apply and the encoding options throw InvalidOperationException .
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);
Sets the character encoding to declare in the rMQR code.
public RmQRCodeImageBuilder WithErrorCorrection(RmQREccLevel eccLevel);
Sets how much damage the rMQR code should survive, M or H.
public RmQRCodeImageBuilder WithFitStrategy(RmQRFitStrategy fitStrategy);
Configure how the version is chosen among those that hold the content. The default, MinimizeArea , takes the fewest modules and may prefer a taller, narrower rMQR code. Use MinimizeHeight or WithHeight for the flattest fit.
public RmQRCodeImageBuilder WithHeight(RmQRHeight height);
Restrict automatic version selection to one rMQR code 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 Optimal . Fewer modules is not the same as a smaller image: a flatter, wider rMQR code can render onto a larger grid.
public RmQRCodeImageBuilder WithVersion(RmQRVersion version);
Pins the version instead of letting the content choose it.
public RmQRCodeImageBuilder WithWidth(int width);
Configure the image width in pixels. The height follows the rMQR code aspect ratio (rounded to whole pixels), the background covers the whole image and the rMQR code 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. WithSize (letterbox into an exact canvas) or WithModulePixelSize (exact matrix) take precedence when also called.
public static byte[] GetImageBytes(RmQRCodeData rmQrCodeData, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the rMQR code and returns an image in the format you choose.
public static byte[] GetImageBytes(string content, SKEncodedImageFormat format, RmQREccLevel eccLevel = 0, int size = 512, int quality = 100);
Encodes the content and returns an image in the format you choose.
public static byte[] GetPngBytes(RmQRCodeData rmQrCodeData, int size = 512);
Renders the rMQR code and returns a PNG image.
public static byte[] GetPngBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and returns a PNG image.
public static byte[] GetSvgBytes(RmQRCodeData rmQrCodeData, int size = 512);
Renders the rMQR code and returns an SVG document as UTF-8 bytes.
public static byte[] GetSvgBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and returns an SVG document as UTF-8 bytes.
public static string GetSvgString(RmQRCodeData rmQrCodeData, int size = 512);
Renders the rMQR code and returns an SVG document as a string.
public static string GetSvgString(string content, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and returns an SVG document as a string.
public static void SavePng(RmQRCodeData rmQrCodeData, Stream output, int size = 512);
Renders the rMQR code and writes a PNG to a stream.
public static void SavePng(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and writes a PNG to a stream.
public static void SaveSvg(RmQRCodeData rmQrCodeData, Stream output, int size = 512);
Renders the rMQR code and writes an SVG document to a stream.
public static void SaveSvg(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and writes an SVG document to a stream.
public static void WriteImage(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, SKEncodedImageFormat format, int size = 512, int quality = 100);
Renders the rMQR code and writes an image in the format you choose to a buffer writer.
public static void WriteImage(string content, IBufferWriter<byte> writer, SKEncodedImageFormat format, RmQREccLevel eccLevel = 0, int size = 512, int quality = 100);
Encodes the content and writes an image in the format you choose to a buffer writer.
public static void WritePng(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the rMQR code and writes a PNG to a buffer writer.
public static void WritePng(string content, IBufferWriter<byte> writer, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and writes a PNG to a buffer writer.
public static void WriteSvg(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, int size = 512);
Renders the rMQR code and writes an SVG document to a buffer writer.
public static void WriteSvg(string content, IBufferWriter<byte> writer, RmQREccLevel eccLevel = 0, int size = 512);
Encodes the content and writes an 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
Two nested rounded rectangles around an oval, a circle on a square area.
field Default
public static readonly RoundedRectangleCircleFinderPatternShape Default;
A ready-made instance to use as-is.
public RoundedRectangleCircleFinderPatternShape(float cornerRadiusPercent = 0.3);
Creates the shape with a corner radius of your own.
public override bool RequiresAntialiasing { get; }
On, so the curves do not come out jagged.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public sealed class RoundedRectangleFinderPatternShape : FinderPatternShape
Three nested rounded rectangles.
field Default
public static readonly RoundedRectangleFinderPatternShape Default;
A ready-made instance to use as-is.
public RoundedRectangleFinderPatternShape(float cornerRadiusPercent = 0.2);
Creates the shape with a corner radius of your own.
public override bool RequiresAntialiasing { get; }
On, so the curves do not come out jagged.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public sealed class RoundedRectangleModuleShape : ModuleShape
Draws modules as rounded squares.
field Default
public static readonly RoundedRectangleModuleShape Default;
A ready-made instance to use as-is.
public RoundedRectangleModuleShape(float cornerRadiusPercent = 0.3);
Creates the shape with a corner radius of your own.
public override bool RequiresAntialiasing { get; }
On, so the curves do not come out jagged.
public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);
public static class SKCanvasExtensions
Draws a QR, Micro QR or rMQR code 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, FinderPatternShape? finderPatternShape = null);
Draws a Micro QR code into an area of the canvas.
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, FinderPatternShape? finderPatternShape = null);
Draws a Micro QR code into an area of this size.
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);
Draws a QR code into an area of the canvas.
Notes
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);
Draws a QR code into an area of this size.
Notes
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, FinderPatternShape? finderPatternShape = null);
Draws a rMQR code into an area of the canvas.
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, FinderPatternShape? finderPatternShape = null);
Draws a rMQR code into an area of this size.
Notes
public abstract class SymbolImageBuilderBase<TSelf>
Shared implementation for the symbology-specific QR image builders ( QRCodeImageBuilder , MicroQRCodeImageBuilder , RmQRCodeImageBuilder ): the fluent options every symbology supports, canvas layout, and the complete raster/SVG output surface. Symbology-specific concerns, such as error correction and version types and icon overlays, live on the derived builders.
Notes
public SKBitmap ToBitmap();
Renders the symbol as an SKBitmap , which the caller disposes.
public SKImage ToImage();
Renders the symbol as an SKImage , which the caller disposes.
public TSelf WithBackgroundColor(SKColor backgroundColor);
Sets the color behind the symbol, quiet zone included. White by default.
public TSelf WithClearColor(SKColor? clearColor);
Sets the padding around the symbol when the canvas is larger than the content, which is also the color the canvas is cleared with before the symbol is drawn.
Notes
public TSelf WithCodeColor(SKColor codeColor);
Sets the color of the dark modules, black by default.
Notes
public TSelf WithColors(SKColor codeColor, SKColor backgroundColor);
Sets the two colors a symbol always has, the modules and what is behind them.
Notes
public TSelf WithFinderPatternShape(FinderPatternShape finderPatternShape);
Draws the finder patterns as a shape of their own.
Notes
public TSelf WithFormat(SKEncodedImageFormat format, int quality = 100);
Sets the encoded image format and quality. PNG at 100 by default.
public TSelf WithGradient(GradientOptions? gradientOptions);
Paints the modules with a gradient instead of one solid color.
Notes
public TSelf WithModulePixelSize(int modulePixelSize);
Gives every module an exact pixel size, so the symbol comes out crisp at any version.
Notes
public TSelf WithModuleShape(ModuleShape moduleShape, float sizePercent = 1);
Draws the modules as a shape other than plain squares.
Notes
public TSelf WithQuietZone(int size);
Sets the width of the light border around the symbol.
Notes
public TSelf WithSize(int width, int height);
Sets the output image size in pixels.
Notes
public byte[] ToByteArray();
Renders the symbol and returns the encoded image bytes.
public string ToSvgString();
Renders the symbol as an SVG document and returns it as a string.
Notes
public void SaveTo(IBufferWriter<byte> writer);
Renders the symbol and writes the encoded image to a buffer writer, skipping the intermediate buffering the stream overload does.
public void SaveTo(Stream output);
Renders the symbol and writes the encoded image to a stream.
public void SaveToSvg(IBufferWriter<byte> writer);
Renders the symbol as an SVG document and writes it to a buffer writer.
Notes
public void SaveToSvg(Stream output);
Renders the symbol as an SVG document and writes it to a stream.
Notes
public static class SymbolRenderer
Draws a QR, Micro QR or rMQR code onto a SkiaSharp canvas, with full control over colors, shapes, gradients and icon overlays. Use it when the image builders do not give you the control you need.
Notes
public static SKRect GetFinderPatternRect(QRCodeData data, int patternIndex, SKRect renderArea);
Where one of the three finder patterns lands inside a rendered QR code, so you can draw over or around it.
Notes
public static ValueTuple<SKRect, SKRect> GetIconRects(QRCodeData data, SKRect area, IconData iconData);
Works out where an icon and its border land inside a QR code.
Notes
public static void Render(SKCanvas canvas, SKRect area, MicroQRCodeData data, SKColor codeColor, SKColor backgroundColor, ModuleShape? moduleShape = null, float moduleSizePercent = 1, GradientOptions? gradientOptions = null, FinderPatternShape? finderPatternShape = null);
Draws a Micro QR code into an area of the 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);
Draws a QR code into an area of the 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, FinderPatternShape? finderPatternShape = null);
Draws a rectangular rMQR code into an area of the canvas, at a uniform module scale and centered, never stretched.
Notes
#enum TextVerticalAlignment
public enum TextVerticalAlignment : int
Where the text sits relative to the icon.
Bottom = 0,
Below the icon.
Center = 1,
Centered on the icon.
Nothing matches that.