← Playground

FeatherQR API

2.0.0.0 · 60 types · source 0d68c9d

namespace FeatherQR

#enum Compression obsolete

public enum Compression : int

Compression mode for QR code data serialization.

Notes

No API in this library accepts or returns this type. The serialization feature it described was removed before 1.0.0; the enum was left behind and shipped in 1.1.1, which is the only reason it still exists. Compress the bytes from GetRawData() yourself, as shown in docs/migration.md.

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

Automatic Encoding DetectionASCII-only (0x00-0x7F): No ECI header (maximum compatibility, smallest size)ISO-8859-1 compatible: Auto-upgrade to Iso8859_1 (ECI 3 header added)Unicode (emojis, CJK, etc.): Auto-upgrade to Utf8 (ECI 26 header added)Examples: "HELLO" β†’ No ECI header (ASCII-only, 29 bits for "HE") "CafΓ©" β†’ ECI 3 (ISO-8859-1, 41 bits for "Ca") "πŸŽ‰" β†’ ECI 26 (UTF-8, 41 bits + UTF-8 bytes) "こんにけは" β†’ ECI 26 (UTF-8, auto-detected)

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

Character Support:ASCII (0x00-0x7F): A-Z, 0-9, basic symbolsExtended Latin (0x80-0xFF): Γ€, Γ‡, Γ‘, Γ©, ΓΌ, etc.Use when:Content is Western European languages (English, French, Spanish, German, etc.)You need explicit ISO-8859-1 encoding declarationCompatibility with ISO-8859-1 readers is requiredCannot encode:Emojis (πŸŽ‰, πŸ˜€, etc.)CJK characters (ζ—₯本θͺž, δΈ­ζ–‡, ν•œκΈ€)Cyrillic beyond basic range

Utf8 = 26,

UTF-8 Unicode encoding - Universal character support. Adds an ECI header: 12 bits in Standard QR, 11 bits in rMQR.

Notes

Character Support:All Unicode characters (U+0000 to U+10FFFF)Emojis, CJK, Arabic, Hebrew, Cyrillic, etc.Multi-byte encoding: 1-4 bytes per characterSize Impact:ECI header: +12 bits in Standard QR, +11 bits in rMQRData encoding: Variable (1-4 bytes per character)Standard QR example: "πŸŽ‰" = 12 (header) + 4 + 9 + 32 (4-byte UTF-8) = 57 bitsStandard QR example: "CafΓ©" = 12 (header) + 4 + 9 + 40 (5 bytes: C,a,f,Γ©=C3A9) = 65 bitsUTF-8 Byte Examples: 'A' β†’ 0x41 (1 byte, ASCII) 'Γ©' β†’ 0xC3 0xA9 (2 bytes, Latin Extended) 'δΈ­' β†’ 0xE4 0xB8 0xAD (3 bytes, CJK) 'πŸŽ‰' β†’ 0xF0 0x9F 0x8E 0x89 (4 bytes, Emoji) Use when:Content includes emojis or symbolsContent includes CJK characters (Japanese, Chinese, Korean)Content includes non-Latin scripts (Cyrillic, Arabic, Hebrew, etc.)You need universal Unicode supportTrade-offs:Larger data size for non-ASCII characters (multi-byte encoding)ECI header adds 12 bits in Standard QR or 11 bits in rMQRFor Western European text, Iso8859_1 is more efficient

#struct MicroQRCodeCalculatedSize

public readonly struct MicroQRCodeCalculatedSize

Result of TryGetRequiredBufferSize : buffer size, matrix side length and selected version for a pending Micro QR encode.

property Version

public MicroQRVersion Version { get; }

The Micro QR version that will be produced.

property BufferSize

public int BufferSize { get; }

Required destination buffer size in bytes (one byte per module, quiet zone included).

property QrSize

public int QrSize { get; }

Matrix side length in modules, quiet zone included.

#class MicroQRCodeData

public class MicroQRCodeData

Represents Micro QR code data as a 2D boolean matrix (versions M1-M4, 11Γ—11 to 17Γ—17 modules).

Notes

Storage mirrors QRCodeData : core modules only (no quiet zone), bit-packed MSB-first in flat row-major order; the quiet zone is virtual and always reads light. Serialization uses the "QRX" container: "QRX" + symbol type (1 byte) + width (1 byte) + height (1 byte) + packed core bits. The legacy "QRR" format remains exclusive to Standard QR.

constructor MicroQRCodeData

public MicroQRCodeData(MicroQRVersion version, int quietZoneSize);

Initializes an empty matrix for the specified version.

constructor MicroQRCodeData

public MicroQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);

constructor MicroQRCodeData

public MicroQRCodeData(byte[] rawData, int quietZoneSize);

Deserializes Micro QR data previously produced by GetRawData .

property Version

public MicroQRVersion Version { get; }

Gets the Micro QR version (M1-M4).

indexer this[int row, int col]

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.

method GetModuleRectangles

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

Coordinates use the same space as the indexer (this[row, col]): one unit is one module, origin at the top-left including the quiet zone, X is the column and Y is the row. Consumers scale by the pixel size of one module; Size gives the total extent in modules. Three properties are contractual: rectangles never overlap, cover only dark modules, and cover every dark module. The decomposition shape and ordering are unspecified and may change between versions (currently maximal horizontal runs in row-major order, the same merge the built-in renderer draws).

method TryGetModuleRectangles

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.

method GetRawData

public byte[] GetRawData();

Serializes the core modules (quiet zone excluded) to a new byte array.

method GetModuleRectanglesMaxCount

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.

method GetRawData

public int GetRawData(IBufferWriter<byte> writer);

Writes the serialized data to the specified buffer writer without intermediate allocation.

method GetRawDataSize

public int GetRawDataSize();

Gets the serialized size in bytes ("QRX" header + packed core bits).

#struct MicroQRCodeDecodeInfo

public readonly struct MicroQRCodeDecodeInfo

Diagnostic information produced by a Micro QR code decode attempt.

Notes

Statuses are shared with the Standard QR decoder ( QRCodeDecodeStatus ); version, ECC level and mask pattern use the Micro QR domains.

property EccLevel

public MicroQREccLevel EccLevel { get; }

Error correction level read from the format information.

property Version

public MicroQRVersion Version { get; }

Micro QR version (M1-M4), or default (0) when the matrix was invalid.

property Status

public QRCodeDecodeStatus Status { get; }

Decode result status. Success when decoding succeeded.

property ErrorsCorrected

public int ErrorsCorrected { get; }

Number of codeword errors corrected by Reed-Solomon decoding.

property MaskPattern

public int MaskPattern { get; }

Mask pattern (0-3) read from the format information, or -1 when unknown.

#class MicroQRCodeDecoder

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

Supported content: Numeric, Alphanumeric and Byte mode segments (ISO-8859-1 and UTF-8), all versions M1-M4 and all legal ECC levels, plus Kanji mode segments in M3 and M4 (decoded as JIS X 0208; this library never emits them). A Kanji cell outside the JIS X 0208 repertoire fails the whole symbol with UnmappedCharacter rather than substituting a replacement character. Micro QR has no ECI mode; byte segments use UTF-8 when the payload validates as UTF-8 and ISO-8859-1 otherwise (matching this library's encoder). Inputs are module matrices ( MicroQRCodeData or byte-per-module buffers as produced by MicroQRCodeGenerator ; a uniform light quiet zone border is detected and skipped automatically) or images via the TryDecodeImage overloads. Image detection targets clean, screen-rendered or scanned images: arbitrary rotation, mirroring, reflectance reversal, uniform or non-uniform scaling, translation and mild perspective distortion are supported. Micro QR image scanning is a separate, explicitly-typed entry point β€” QRCodeDecoder continues to scan Standard QR only.

method TryDecode

public static bool TryDecode(MicroQRCodeData data, out string text);

Decodes the text content from Micro QR code data.

method TryDecode

public static bool TryDecode(MicroQRCodeData data, out string text, out MicroQRCodeDecodeInfo info);

Decodes the text content from Micro QR code data, with diagnostic information.

method TryDecode

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.

method TryDecode

public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out MicroQRCodeDecodeInfo info);

Decodes the text content from a module matrix.

method TryDecodeImage

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.

method TryDecodeImage

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.

method GetMaxDecodedLength

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.

#class MicroQRCodeGenerator

public static class MicroQRCodeGenerator

Micro QR code generator based on ISO/IEC 18004 (versions M1-M4).

Notes

Micro QR constraints enforced by this generator (they differ per version, so invalid combinations throw instead of silently degrading): M1: Numeric mode only, ErrorDetectionOnly only.M2: Numeric/Alphanumeric, ECC L or M.M3: Numeric/Alphanumeric/Byte, ECC L or M.M4: Numeric/Alphanumeric/Byte, ECC L, M or Q. Micro QR has no ECI mode; text that is not ISO-8859-1-representable is encoded as raw UTF-8 bytes in Byte mode. Kanji mode is not written; MicroQRCodeDecoder does read the Kanji segments (M3 and M4) that other encoders produce, so the two directions are deliberately asymmetric.

method GetRequiredBufferSize obsolete

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.

method CreateMicroQRCode

public static MicroQRCodeData CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);

method CreateMicroQRCode

public static MicroQRCodeData CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, in MicroQRCodeGeneratorOptions options);

method CreateMicroQRCode

public static MicroQRCodeData CreateMicroQRCode(string plainText, MicroQREccLevel eccLevel, MicroQRVersion? requestedVersion = null, int quietZoneSize = 2);

Creates a Micro QR code from the provided plain text.

method CreateMicroQRCode

public static MicroQRCodeData CreateMicroQRCode(string plainText, MicroQREccLevel eccLevel, in MicroQRCodeGeneratorOptions options);

method TryGetRequiredBufferSize

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

false means the content does not fit, which here includes an encoding mode the version or ECC level does not offer, since the text is what picks the mode. Argument errors throw (rationale: specs/rmqr-encoder.md), and so does a Version range that offers eccLevel on no version at all, which no content could satisfy. Micro QR M1 holds 5 digits, so an overflow is an ordinary answer here. Pass the same options you will encode with: Segmentation can select a different version, so a buffer sized for one can be too small for the other.

method CreateMicroQRCode

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

Output format matches CreateQrCode : one byte per module (0 = light, 1 = dark), flat row-major, quiet zone included. Use TryGetRequiredBufferSize to size the destination.

method CreateMicroQRCode

public static int CreateMicroQRCode(ReadOnlySpan<char> textSpan, MicroQREccLevel eccLevel, Span<byte> destination, in MicroQRCodeGeneratorOptions options);

#struct MicroQRCodeGeneratorOptions

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

The smallest option set of the three symbologies: Micro QR has no ECI, and no fit strategy because M1-M4 are totally ordered by capacity.

property Segmentation

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.

property Version

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.

property QuietZoneSize

public int QuietZoneSize { get; init; }

Quiet zone width in modules. Defaults to 2, the ISO/IEC 18004 value for Micro QR; 0 is valid.

property MaskPattern

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

For reproducing a symbol produced elsewhere byte-for-byte (the pattern another encoder chose is reported by MaskPattern ), and for exercising a decoder against all four patterns. Micro QR numbers its patterns 0-3; they are not the Standard QR patterns of the same index. Like Version , an invalid value is an argument error and is rejected here rather than when a generator reads it.

property Default

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

Opt-in because it prices candidate versions; the search allocates nothing (Micro QR content never exceeds 35 characters). The plan respects each version's mode set β€” M1 is Numeric-only and M2 has no Byte mode β€” so a version is never selected for a plan whose runs it cannot carry. Size buffers with the same segmentation you encode with, the two can select different versions.

#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.

#struct MicroQRVersionRange

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

M1-M4 differ in the modes and ECC levels they offer, not only in capacity, so a range can leave nothing usable for two reasons. No version offering the requested ECC level is a contradiction and throws; none carrying the mode the text needs is a poor fit and returns false, since the text is what picks the mode.

constant MaxVersion

public const MicroQRVersion MaxVersion;

The highest Micro QR version, M4.

constant MinVersion

public const MicroQRVersion MinVersion;

The lowest Micro QR version, M1.

constructor MicroQRVersionRange

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).

property IsAny

public bool IsAny { get; }

Whether this range constrains nothing (the default).

property IsExact

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.

method Contains

public bool Contains(MicroQRVersion version);

Whether version falls inside this range.

method ToString

public override string ToString();

method AtLeast

public static MicroQRVersionRange AtLeast(MicroQRVersion version);

version or larger.

method AtMost

public static MicroQRVersionRange AtMost(MicroQRVersion version);

version or smaller.

method Between

public static MicroQRVersionRange Between(MicroQRVersion min, MicroQRVersion max);

An inclusive range from min to max .

method Exactly

public static MicroQRVersionRange Exactly(MicroQRVersion version);

Exactly version , with no automatic selection.

operator op_Implicit

public static MicroQRVersionRange op_Implicit(MicroQRVersion version);

A single version, as Exactly .

operator op_Implicit

public static MicroQRVersionRange op_Implicit(MicroQRVersion? version);

A single version, or Any when there is none, so an optional version needs no branch.

#struct ModuleRect

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

Coordinates use the same space as the matrix indexer: one unit is one module, origin at the top-left corner of the symbol including its quiet zone, X growing right and Y growing down. The module at column c, row r read via data[r, c] corresponds to the unit rectangle at X = c, Y = r. Renderers map to pixels by multiplying all four values by the pixel size of one module. No scale or pixel size is baked in, so the same value works for SVG path data (viewBox in module units), draw calls, and any other coordinate transform the consumer applies.

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

Coordinates use the same space as the matrix indexer: one unit is one module, origin at the top-left corner of the symbol including its quiet zone, X growing right and Y growing down. The module at column c, row r read via data[r, c] corresponds to the unit rectangle at X = c, Y = r. Renderers map to pixels by multiplying all four values by the pixel size of one module. No scale or pixel size is baked in, so the same value works for SVG path data (viewBox in module units), draw calls, and any other coordinate transform the consumer applies.

property Height

public int Height { get; init; }

Height in modules (always positive).

property Width

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).

#struct QRCodeCalculatedSize

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.

property IsValid

public bool IsValid { get; }

Validates that the calculated size values are within acceptable ranges.

property BufferSize

public int BufferSize { get; init; }

Required buffer size for the QR code matrix data (in bytes). Calculated as QrSize Γ— QrSize.

property QrSize

public int QrSize { get; init; }

QR code size in modules per side (including quiet zone if specified)

property Version

public int Version { get; init; }

QR code version (1-40) determined by data capacity requirements

#class QRCodeData

public class QRCodeData

Represents QR code data as a 2D boolean matrix.

Notes

QR code structure: - Version: 1-40 (determines size: 21Γ—21 to 177Γ—177) - Module matrix: 2D array of boolean values (dark/light) - Serialization format: "QRR" header + size + bit-packed data

constructor QRCodeData

public QRCodeData(ReadOnlySpan<byte> rawDataSpan, int quietZoneSize);

Initializes a new instance of the QRCodeData class from serialized raw data.

Notes

This constructor deserializes QR code data that was previously serialized using GetRawData . The raw data contains only the core QR code modules (excluding quiet zone). Data format: "QRR" header (3 bytes) + base size (1 byte) + bit-packed module data The quiet zone (white border) can be added during deserialization by specifying the quietZoneSize parameter. This overload is useful for high-performance scenarios where you want to deserialize from existing memory buffers (e.g., Memory , ArraySegment , or stack-allocated arrays) without allocating a new byte array.

constructor QRCodeData

public QRCodeData(byte[] rawData, int quietZoneSize);

Initializes a new instance of the QRCodeData class from serialized raw data.

Notes

This constructor deserializes QR code data that was previously serialized using GetRawData . The raw data contains only the core QR code modules (excluding quiet zone). Data format: "QRR" header (3 bytes) + base size (1 byte) + bit-packed module data The quiet zone (white border) can be added during deserialization by specifying the quietZoneSize parameter.

constructor QRCodeData

public QRCodeData(int version, int quietZoneSize);

Initializes with the specified version.

indexer this[int row, int col]

public bool this[int row, int col] { get; }

Gets or sets the module state at the specified position.

Notes

Quiet zone positions always read false (the quiet zone is light by definition and is not stored). The internal setter only accepts core positions, quiet zone modules cannot be modified.

property Size

public int Size { get; }

Gets the size of the QR code matrix (modules per side).

property Version

public int Version { get; }

Get the QR code version (1-40)

method GetModuleRectangles

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

Coordinates use the same space as the indexer (this[row, col]): one unit is one module, origin at the top-left including the quiet zone, X is the column and Y is the row. Consumers scale by the pixel size of one module; Size gives the total extent in modules. Three properties are contractual: rectangles never overlap, cover only dark modules, and cover every dark module. The decomposition shape and ordering are unspecified and may change between versions (currently maximal horizontal runs in row-major order, the same merge the built-in renderer draws).

method IsFinderPattern

public bool IsFinderPattern(int row, int col);

Checks if the specified module position (excluding quiet zone) is part of a finder pattern.

method TryGetModuleRectangles

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.

method GetRawData

public byte[] GetRawData();

Serializes the QR code data to a byte array.

Notes

The serialized data contains only the core QR code modules (excluding quiet zone). The quiet zone can be added when deserializing via the #ctor constructor. Format: "QRR" header (3 bytes) + base size (1 byte) + bit-packed module data

method GetFinderPatternIndex

public int GetFinderPatternIndex(int row, int col);

Gets the finder pattern index for the specified module position (excluding quiet zone).

method GetModuleRectanglesMaxCount

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.

method GetRawData

public int GetRawData(IBufferWriter<byte> writer);

Writes the serialized QR code data to the specified buffer writer.

Notes

This method writes only the core QR mode modules (excluding quiet zone). The quiet zone can be added when deserializing via the #ctor constructor. Format: "QRR" header (3 bytes) + base size (1 byte) + bit-packed module data This overload is useful for high-performance scenarios where memory allocations need to be minimized, such as response writing or streaming.

method GetRawDataSize

public int GetRawDataSize();

Calculates the required buffer size for serialization.

#struct QRCodeDecodeInfo

public readonly struct QRCodeDecodeInfo

Diagnostic information produced by a QR code decode attempt.

property EccLevel

public ECCLevel EccLevel { get; }

Error correction level read from the format information.

property Status

public QRCodeDecodeStatus Status { get; }

Decode result status. Success when decoding succeeded.

property ErrorsCorrected

public int ErrorsCorrected { get; }

Total number of codeword errors corrected by Reed-Solomon decoding.

property MaskPattern

public int MaskPattern { get; }

Mask pattern (0-7) read from the format information, or -1 when unknown.

property Version

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

Today this means a Kanji mode cell outside JIS X 0208 β€” in practice one of the 83 characters Microsoft CP932 adds in NEC row 13 (circled digits, roman numerals, unit ligatures). It is deliberately distinct from UnsupportedContent : that says the symbol uses a feature this library does not implement, and no reader choice changes it, whereas this says the symbol is well formed and a CP932-capable reader would read it. A caller that wants to fall back to such a reader should branch on exactly this status.

#class QRCodeDecoder

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

Supported content: Numeric, Alphanumeric and Byte mode segments (ISO-8859-1 and UTF-8, with or without ECI headers), the full version range 1-40 and all ECC levels. Kanji mode is decoded as JIS X 0208; the generator never emits it, so Kanji is a read-only mode here. A Kanji cell outside the JIS X 0208 repertoire (most visibly the NEC row 13 characters CP932 adds, such as circled digits) fails the WHOLE symbol with UnmappedCharacter rather than substituting a replacement character; that status is distinct from UnsupportedContent so a caller can tell "a CP932 reader would read this" from "this uses a feature we do not implement". FNC1 and Structured Append are the latter. Byte segments without an ECI header have no declared charset. The decoder uses UTF-8 when the payload is valid UTF-8 (or carries a BOM) and ISO-8859-1 otherwise.

method TryDecode

public static bool TryDecode(QRCodeData data, out string text);

Decodes the text content from QR code data.

method TryDecode

public static bool TryDecode(QRCodeData data, out string text, out QRCodeDecodeInfo info);

Decodes the text content from QR code data, with diagnostic information.

method TryDecode

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.

method TryDecode

public static bool TryDecode(ReadOnlySpan<byte> modules, int size, out string text, out QRCodeDecodeInfo info);

Decodes the text content from a module matrix.

method TryDecodeImage

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.

method TryDecodeImage

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.

method GetMaxDecodedLength

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.

#class QRCodeGenerator

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

Encoding modes written here are Numeric, Alphanumeric and Byte (ISO-8859-1 / UTF-8, with ECI). Kanji mode is never written, Japanese text goes out as UTF-8 in Byte mode; QRCodeDecoder does read Kanji segments other encoders produce, so the two directions are deliberately asymmetric.

method GetRequiredBufferSize obsolete

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.

method CreateQrCode

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.

method CreateQrCode

public static QRCodeData CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, in QRCodeGeneratorOptions options);

method CreateQrCode

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.

method CreateQrCode

public static QRCodeData CreateQrCode(string plainText, ECCLevel eccLevel, in QRCodeGeneratorOptions options);

method TryGetRequiredBufferSize

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

false means the content does not fit, and nothing else: argument errors throw (rationale: specs/rmqr-encoder.md). When Version is narrower than Any , that means no version in that range holds the content, not merely that it exceeds version 40. BoostEccLevel has no effect here: the boost never changes the version, and the buffer size depends only on the version. Pass the same options you will encode with: Segmentation and EciMode can select different versions, so a buffer sized for one can be too small for the other.

method CreateQrCode

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

Output format: one byte per module (0 = light, 1 = dark), flat row-major order, quiet zone included. Module at (row, col) is destination[row * qrSize + col] where qrSize is QrSize returned by TryGetRequiredBufferSize . Usage flow for allocation-free generation: if (!QRCodeGenerator.TryGetRequiredBufferSize(text, ECCLevel.M, out var calculated, QRCodeGeneratorOptions.Default)) return; // content does not fit version 40 at this ECC level var buffer = ArrayPool<byte>.Shared.Rent(calculated.BufferSize); var written = QRCodeGenerator.CreateQrCode(text, ECCLevel.M, buffer); var matrix = buffer.AsSpan(0, written); // ... consume matrix ... ArrayPool<byte>.Shared.Return(buffer); Only the first BufferSize bytes of destination are written (every byte of that region is written, so a dirty pooled buffer is fine); any remaining bytes are left untouched.

method CreateQrCode

public static int CreateQrCode(ReadOnlySpan<char> textSpan, ECCLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options);

method CreateQrCode

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.

method CreateQrCode

public static int CreateQrCode(string plainText, ECCLevel eccLevel, Span<byte> destination, in QRCodeGeneratorOptions options);

#struct QRCodeGeneratorOptions

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

Standard QR specific rather than shared: the three generators agree on almost nothing. Version is a different type in each, QuietZoneSize has a different specified default in each, Micro QR has no ECI, and rMQR carries fit options that mean nothing here.

property EciMode

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.

property Segmentation

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.

property Version

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.

property BoostEccLevel

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

Off by default: a raised level rewrites the format information and can change the chosen mask, so a default of on would silently change every existing symbol. Sizing is unaffected either way, the buffer size depends only on the version.

property Utf8BOM

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).

property QuietZoneSize

public int QuietZoneSize { get; init; }

Quiet zone width in modules. Defaults to 4, the ISO/IEC 18004 value; 0 is valid.

property MaskPattern

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

For reproducing a symbol produced elsewhere byte-for-byte (the pattern another encoder chose is reported by MaskPattern ), and for exercising a decoder against all eight patterns. Like Version , an invalid value is an argument error and is rejected here rather than when a generator reads it.

property Default

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

Opt-in because it searches candidate versions; the search itself allocates nothing for typical content and rents pooled buffers for long content. When Utf8BOM would actually write a byte order mark (a UTF-8 Byte-mode stream), the split is disabled and the Single stream is emitted: the BOM is a stream-level prefix, and a split would relocate it into the middle of the decoded text. Content whose single mode is Numeric or Alphanumeric never carries a BOM and still splits. Size buffers with the same segmentation you encode with, the two can select different versions.

#struct QRCodeVersionRange

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

Both bounds are inclusive, unlike Range whose end is exclusive. That is why 1..40 is not usable here: it would read as 1 to 40 and mean 1 to 39.

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.

constructor QRCodeVersionRange

public QRCodeVersionRange(int min, int max);

An inclusive range from min to max .

property IsAny

public bool IsAny { get; }

Whether this range constrains nothing (the default).

property IsExact

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.

method Contains

public bool Contains(int version);

Whether version falls inside this range.

method ToString

public override string ToString();

method AtLeast

public static QRCodeVersionRange AtLeast(int version);

version or larger.

method AtMost

public static QRCodeVersionRange AtMost(int version);

version or smaller.

method Between

public static QRCodeVersionRange Between(int min, int max);

An inclusive range from min to max .

method Exactly

public static QRCodeVersionRange Exactly(int version);

Exactly version , with no automatic selection.

operator op_Implicit

public static QRCodeVersionRange op_Implicit(int version);

A single version, as Exactly . Lets an option set read Version = 15.

operator op_Implicit

public static QRCodeVersionRange op_Implicit(int? version);

A single version, or Any when there is none.

Notes

Lets a caller whose version is optional pass it through without branching. -1 is not accepted as a second spelling of Any : a mistyped or defaulted value must fail rather than silently produce an automatically sized symbol.

#struct RmQRCodeCalculatedSize

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.

property Version

public RmQRVersion Version { get; }

The rMQR version that will be generated (requested or automatically selected).

property BufferSize

public int BufferSize { get; }

Required destination size in bytes ( Width Γ— Height ).

property Height

public int Height { get; }

Matrix height in modules, quiet zone included.

property Width

public int Width { get; }

Matrix width in modules, quiet zone included.

#class RmQRCodeData

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

Storage mirrors MicroQRCodeData : core modules only (no quiet zone), bit-packed MSB-first in flat row-major order; the quiet zone is virtual and always reads light. Serialization uses the "QRX" container: "QRX" + symbol type (1 byte, 2 = rMQR) + width (1 byte) + height (1 byte) + packed core bits. Micro QR (symbol type 1) and the legacy Standard QR "QRR" streams are rejected.

constructor RmQRCodeData

public RmQRCodeData(ReadOnlySpan<byte> rawData, int quietZoneSize);

constructor RmQRCodeData

public RmQRCodeData(RmQRVersion version, int quietZoneSize);

Initializes an empty (all light) matrix for the specified version.

constructor RmQRCodeData

public RmQRCodeData(byte[] rawData, int quietZoneSize);

Deserializes rMQR data previously produced by GetRawData .

property Version

public RmQRVersion Version { get; }

Gets the rMQR version (R7x43-R17x139).

indexer this[int row, int col]

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 Height

public int Height { get; }

Gets the matrix height in modules, including the quiet zone.

property Width

public int Width { get; }

Gets the matrix width in modules, including the quiet zone.

method GetModuleRectangles

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

Coordinates use the same space as the indexer (this[row, col]): one unit is one module, origin at the top-left including the quiet zone, X is the column and Y is the row. Consumers scale by the pixel size of one module; Width and Height give the total extent in modules. Three properties are contractual: rectangles never overlap, cover only dark modules, and cover every dark module. The decomposition shape and ordering are unspecified and may change between versions (currently maximal horizontal runs in row-major order, the same merge the built-in renderer draws).

method TryGetModuleRectangles

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.

method GetRawData

public byte[] GetRawData();

Serializes the core modules (quiet zone excluded) to a new byte array.

method GetModuleRectanglesMaxCount

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.

method GetRawData

public int GetRawData(IBufferWriter<byte> writer);

Writes the serialized data to the specified buffer writer without intermediate allocation.

method GetRawDataSize

public int GetRawDataSize();

Gets the serialized size in bytes ("QRX" header + packed core bits).

#struct RmQRCodeDecodeInfo

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.

property Status

public QRCodeDecodeStatus Status { get; }

Decode outcome; Success when text was produced.

property EccLevel

public RmQREccLevel EccLevel { get; }

The ECC level read from the format information (valid once the format decoded).

property Version

public RmQRVersion Version { get; }

The symbol version (from the physical dimensions), or 0 when the input is not an rMQR matrix.

property ErrorsCorrected

public int ErrorsCorrected { get; }

Total Reed-Solomon codeword corrections across all blocks (0 for a clean symbol).

#class RmQRCodeDecoder

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

Every overload accepts an rMQR matrix with or without a light quiet zone: the dark bounding box (finder corner top-left, sub-finder corner bottom-right, timing patterns on all four edges) locates the core, so uniform and asymmetric borders are stripped automatically. Reed-Solomon corrections are applied at full block strength (⌊ecc/2βŒ‹ per block) and reported in ErrorsCorrected . Numeric, Alphanumeric and Byte segments (ISO-8859-1 / UTF-8, with or without ECI) are supported, plus Kanji segments decoded as JIS X 0208; the generator never emits Kanji, so it is a read-only mode here. A Kanji cell outside the JIS X 0208 repertoire fails the whole symbol with UnmappedCharacter rather than substituting a replacement character.

method TryDecode

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.

method TryDecode

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.

method TryDecode

public static bool TryDecode(RmQRCodeData data, out string text);

Decodes the text content of an RmQRCodeData matrix.

method TryDecode

public static bool TryDecode(RmQRCodeData data, out string text, out RmQRCodeDecodeInfo info);

Decodes the text content of an RmQRCodeData matrix with diagnostics.

method TryDecodeImage

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.

method TryDecodeImage

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.

method GetMaxDecodedLength

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.

#class RmQRCodeGenerator

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

Version selection: an exact RmQRVersion , or automatic fit among the versions that hold the content by RmQRFitStrategy (default MinimizeArea : fewest modules, the choice both reference encoders make; note it can prefer a taller, narrower symbol, e.g. 12 digits at M give R11x27 (297 modules) rather than R7x43 (301); use MinimizeHeight or a fixed RmQRHeight for the flattest symbol), optionally restricted to one height. Modes: Numeric, Alphanumeric and Byte. Byte mode emits ECI assignment 3 for ISO-8859-1 and assignment 26 for UTF-8 (automatically selected by default, or explicitly requested). Kanji is not written, use UTF-8 instead; RmQRCodeDecoder does read the Kanji segments other encoders produce, so the two directions are deliberately asymmetric. The quiet zone defaults to the ISO/IEC 23941 value of 2 modules.

method CreateRmQRCode

public static RmQRCodeData CreateRmQRCode(ReadOnlySpan<char> textSpan, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);

method CreateRmQRCode

public static RmQRCodeData CreateRmQRCode(string plainText, RmQREccLevel eccLevel, in RmQRCodeGeneratorOptions options = null);

Creates an rMQR code from the provided plain text.

method TryGetRequiredBufferSize

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

false means the content does not fit, and nothing else: argument errors throw (rationale: specs/rmqr-encoder.md). rMQR holds 5-150 bytes, so an overflow is an ordinary answer here rather than a defect, which is why this is the only sizing method on this type. Pass the same options you will encode with: segmentation and ECI can select different versions, so a buffer sized for one can be too small for the other.

method CreateRmQRCode

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

Output format matches the other generators: one byte per module (0 = light, 1 = dark), flat row-major over the full width, quiet zone included. Use TryGetRequiredBufferSize to size the destination.

#struct RmQRCodeGeneratorOptions

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

rMQR specific rather than shared: Version is a different type in each symbology, QuietZoneSize has a different specified default, and FitStrategy , Height and Segmentation have no meaning outside rMQR. There is no version range here because rMQR's 32 versions are not totally ordered; fit is constrained by strategy and height instead.

property EciMode

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

Only Default , Iso8859_1 and Utf8 are accepted. Declaring Latin-1 over content it cannot represent throws rather than silently re-encoding.

property FitStrategy

public RmQRFitStrategy FitStrategy { get; init; }

How to choose among the versions that hold the content. Defaults to MinimizeArea , the choice both reference encoders make.

property Height

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.

property Segmentation

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.

property Version

public RmQRVersion? Version { get; init; }

A specific version, or null (the default) to fit one automatically by FitStrategy and Height .

property QuietZoneSize

public int QuietZoneSize { get; init; }

Quiet zone width in modules. Defaults to 2, the ISO/IEC 23941 value; 0 is valid.

property Default

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

Opt-in because it searches candidate versions; the search itself allocates nothing, and content no split can help is ruled out before it starts. Fewer core modules is not the same as a smaller image: RmQRFitStrategy ranks by core modules while the quiet zone adds to each dimension, so a flatter symbol can render onto a larger grid. Size buffers with the same segmentation you encode with.

#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

#class CircleFinderPatternShape

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.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Requires antialiasing to prevent jagged edges on curves.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);

#class CircleModuleShape

public sealed class CircleModuleShape : ModuleShape

Draws modules as circles.

field Default

public static readonly CircleModuleShape Default;

Gets the default instance.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Requires antialiasing to prevent jagged edges on curves.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

#class FinderPatternShape

public abstract class FinderPatternShape

Defines the shape of QR code finder pattern (position detection patterns).

constructor FinderPatternShape

protected FinderPatternShape();

property RequiresAntialiasing

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.

method Draw

public virtual void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);

Draw a finder pattern at the specified location with background color support.

method Draw

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

The default implementation preserves compatibility with custom finder shapes that override the color-based overload. Built-in shapes override this overload so the renderer can reuse its background paint. The renderer may set the paint's blend mode to Clear while drawing on an isolated layer so transparent and translucent light modules reveal the background rendered beneath the finder pattern. Implementations should therefore draw with this paint directly instead of copying only its color. The renderer owns backgroundPaint and may reuse it across calls; implementations must not modify or dispose it. Custom shapes should override this overload when they need to reuse the renderer's configured background paint or when they must support non-opaque backgrounds (blend modes). Existing custom shapes may continue to override Draw , but that overload cannot use the renderer's blend mode.

#enum GradientDirection

public enum GradientDirection : int

Defines the direction of gradient flow for QR code rendering.

Notes

Linear gradients flow in a straight line across the entire QR code area. The direction determines the start and end points of the gradient. Common Use Cases: LeftToRight or TopToBottom : Simple horizontal/vertical gradients TopLeftToBottomRight : Diagonal gradients for dynamic appearance None : Use when solid color is desired (disables gradient)

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.

#class GradientOptions

public class GradientOptions : IEquatable<GradientOptions>

Defines gradient configuration for QR code rendering.

Notes

This record configures linear gradients that are applied across the entire QR code. Gradients can flow in various directions (horizontal, vertical, diagonal). For simple two-color gradients, specify two colors in Colors . For multi-color gradients, provide additional colors and optionally specify ColorPositions .

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.

constructor GradientOptions

public GradientOptions(SKColor[] colors, GradientDirection direction = 1, float[]? colorPositions = null);

Initializes a new instance of the GradientOptions record.

property Direction

public GradientDirection Direction { get; init; }

The gradient direction.

Notes

Determines the start and end points of the gradient across the QR code area.

property Colors

public SKColor[] Colors { get; init; }

Gradient colors for multi-color gradients.

Notes

At least 2 colors are required. The gradient flows from the first color to the last color in the direction specified by Direction .

property ColorPositions

public float[]? ColorPositions { get; init; }

Optional color stops (0.0 to 1.0) for the gradient.

Notes

If null, colors are evenly distributed across the gradient. If specified, the array length must match Colors length. Values must be in ascending order from 0.0 (start) to 1.0 (end). For example: [0.0f, 0.3f, 1.0f] for three colors.

#class IconData

public class IconData

The logo or image drawn at the center of a QR code, and its size.

Notes

The icon covers modules, so the symbol relies on error correction to stay readable. Use the highest error correction level ( H ) and keep the icon small. When the size is given in modules, rendering throws if the icon and its border span more than MaxCoreOccupancyPercent percent of the core width; sizes given as a percentage of the image are not checked against the symbol at all.

constructor IconData obsolete

public IconData();

property Icon

public IconShape Icon { get; set; }

The icon shape to overlay on the QR code.

property IconBorderWidth

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.

property IconSizePercent

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.

property MaxCoreOccupancyPercent

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.

property IconBorderModules

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.

property IconSizeModules

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.

method FromImage

public static IconData FromImage(SKBitmap image, int iconSizePercent = 10, int iconBorderWidth = 2);

Create IconData from a bitmap image using percent/pixel sizing.

method FromImageByModules

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

Prefer combining this with WithModulePixelSize so each module maps to an integer pixel size. Optional WithSize can then set a larger canvas; content is centered and padded. Validation against QR size/core occupancy happens at render time.

#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.

#class ImageIconShape

public sealed class ImageIconShape : IconShape

Icon shape that draws an image.

constructor ImageIconShape

public ImageIconShape(SKBitmap image);

Creates an icon from an image.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);

#class ImageTextIconShape

public sealed class ImageTextIconShape : IconShape

Icon shape that draws an image with text positioned relative to it.

constructor ImageTextIconShape

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.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKRect borderRect, SKColor backgroundColor);

#class MicroQRCodeImageBuilder

public class MicroQRCodeImageBuilder : QRCodeImageBuilderBase<MicroQRCodeImageBuilder>

High-level builder for creating Micro QR code images with fluent configuration and static methods.

Notes

This builder mirrors QRCodeImageBuilder for the Micro QR symbology (ISO/IEC 18004, versions M1-M4). Version and error correction use the Micro QR-typed MicroQRVersion / MicroQREccLevel , and the default quiet zone is the 2 modules the specification requires (Standard QR uses 4). Micro QR has a single finder pattern and no high error-correction headroom, so the Standard QR styling options that depend on those (icon overlays and custom finder pattern shapes) are intentionally not offered.

constructor MicroQRCodeImageBuilder

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.

constructor MicroQRCodeImageBuilder

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.

method WithErrorCorrection

public MicroQRCodeImageBuilder WithErrorCorrection(MicroQREccLevel eccLevel);

Configure the error correction level for the Micro QR code.

Notes

Legal combinations are version-dependent: M1 supports ErrorDetectionOnly only, M2/M3 support L and M, M4 supports L, M, and Q. Illegal combinations throw when the symbol is generated.

method WithMaskPattern

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 .

method WithSegmentation

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.

method WithVersion

public MicroQRCodeImageBuilder WithVersion(MicroQRVersion version);

Configure the Micro QR version to generate.

Notes

The pinned-version case of the WithVersion overload.

method WithVersion

public MicroQRCodeImageBuilder WithVersion(MicroQRVersionRange versionRange);

Configure the versions the generator may choose from, rather than a single one.

Notes

See MicroQRVersionRange for which empty ranges throw and which are a poor fit.

method GetImageBytes

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.

method GetImageBytes

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.

method GetPngBytes

public static byte[] GetPngBytes(MicroQRCodeData microQrCodeData, int size = 512);

Generate a Micro QR code as PNG byte array with default settings.

method GetPngBytes

public static byte[] GetPngBytes(string content, MicroQREccLevel eccLevel = 2, int size = 512);

Generate a Micro QR code as PNG byte array with default settings.

method GetSvgBytes

public static byte[] GetSvgBytes(MicroQRCodeData microQrCodeData, int size = 512);

Generate a Micro QR code as SVG (UTF-8 encoded) byte array with default settings.

method GetSvgBytes

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.

method GetSvgString

public static string GetSvgString(MicroQRCodeData microQrCodeData, int size = 512);

Generate a Micro QR code as SVG document string with default settings.

method GetSvgString

public static string GetSvgString(string content, MicroQREccLevel eccLevel = 2, int size = 512);

Generate a Micro QR code as SVG document string with default settings.

method SavePng

public static void SavePng(MicroQRCodeData microQrCodeData, Stream output, int size = 512);

Generate a Micro QR code and save to stream with default PNG settings.

method SavePng

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.

method SaveSvg

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.

method SaveSvg

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.

method WriteImage

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.

method WriteImage

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.

method WritePng

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.

method WritePng

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.

method WriteSvg

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.

method WriteSvg

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.

#class MicroQRCodeImageDecoder

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.

method TryDecode

public static bool TryDecode(SKBitmap bitmap, out string text);

method TryDecode

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.

#class QRCodeExtensions

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

Each method clears the whole canvas before drawing, so anything already on it is lost. To place a symbol inside a larger drawing, wrap the call in Save and ClipRect , or call QRCodeRenderer directly, which draws only the symbol.

method Render

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

Micro QR does not offer the Standard QR icon overlay or custom finder pattern shape options (single finder pattern, no error-correction headroom for overlays).

method Render

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

Micro QR does not offer the Standard QR icon overlay or custom finder pattern shape options (single finder pattern, no error-correction headroom for overlays).

method Render

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.

method Render

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.

method Render

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

The rectangular symbol (quiet zone included) is drawn with a uniform module scale and centered in the area (letterbox); the whole area receives the background color. rMQR offers no icon overlay or finder styling options.

method Render

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

The rectangular symbol (quiet zone included) is drawn with a uniform module scale and centered in the area (letterbox); the whole area receives the background color. rMQR offers no icon overlay or finder styling options.

#class QRCodeImageBuilder

public class QRCodeImageBuilder : QRCodeImageBuilderBase<QRCodeImageBuilder>

High-level builder for creating QR code images with fluent configuration and static methods.

Notes

This builder provides both simple static methods for quick QR code generation and a fluent API for advanced customization. Quick Generation (Static Methods): Use static methods like GetPngBytes for one-liner QR code creation with default settings. Advanced Configuration (Fluent API): Chain the shared options ( QRCodeImageBuilderBase , QRCodeImageBuilderBase , QRCodeImageBuilderBase , QRCodeImageBuilderBase , QRCodeImageBuilderBase ) with the Standard QR-specific options ( WithErrorCorrection , WithVersion , WithIcon , WithFinderPatternShape ) to customize appearance.

constructor QRCodeImageBuilder

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.

constructor QRCodeImageBuilder

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.

method WithEciMode

public QRCodeImageBuilder WithEciMode(EciMode eciMode);

Configure the ECI (Extended Channel Interpretation) mode for character encoding.

method WithErrorCorrection

public QRCodeImageBuilder WithErrorCorrection(ECCLevel eccLevel);

Configure the error correction level for the QR code.

method WithErrorCorrectionBoost

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.

method WithFinderPatternShape

public QRCodeImageBuilder WithFinderPatternShape(FinderPatternShape? finderPatternShape);

Configure the shape of the finder patterns.

method WithIcon

public QRCodeImageBuilder WithIcon(IconData? iconData);

Configure an icon to overlay on the center of the QR code.

method WithMaskPattern

public QRCodeImageBuilder WithMaskPattern(int? maskPattern);

Pin one of the eight data mask patterns (0-7) instead of the automatic penalty-scored selection; see MaskPattern .

method WithSegmentation

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.

method WithVersion

public QRCodeImageBuilder WithVersion(QRCodeVersionRange versionRange);

Configure the versions the generator may choose from, rather than a single one.

Notes

For a symbol that must reach, or not exceed, a physical size. An int? converts implicitly, so an optional version needs no branch.

method WithVersion

public QRCodeImageBuilder WithVersion(int version);

Configure the QR code version to generate.

Notes

The pinned case of WithVersion ; -1 is Any .

method GetImageBytes

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.

method GetImageBytes

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.

method GetPngBytes

public static byte[] GetPngBytes(QRCodeData qrCodeData, int size = 512);

Generate a QR code as PNG byte array with default settings.

method GetPngBytes

public static byte[] GetPngBytes(string content, ECCLevel eccLevel = 1, int size = 512);

Generate a QR code as PNG byte array with default settings.

method GetSvgBytes

public static byte[] GetSvgBytes(QRCodeData qrCodeData, int size = 512);

Generate a QR code as SVG (UTF-8 encoded) byte array with default settings.

method GetSvgBytes

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.

method GetSvgString

public static string GetSvgString(QRCodeData qrCodeData, int size = 512);

Generate a QR code as SVG document string with default settings.

method GetSvgString

public static string GetSvgString(string content, ECCLevel eccLevel = 1, int size = 512);

Generate a QR code as SVG document string with default settings.

method SavePng

public static void SavePng(QRCodeData qrCodeData, Stream output, int size = 512);

Generate a QR code and save to stream with default PNG settings.

method SavePng

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.

method SaveSvg

public static void SaveSvg(QRCodeData qrCodeData, Stream output, int size = 512);

Generate a QR code and save as SVG to stream with default settings.

method SaveSvg

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.

method WriteImage

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.

method WriteImage

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.

method WritePng

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.

method WritePng

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.

method WriteSvg

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.

method WriteSvg

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.

#class QRCodeImageBuilderBase

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

The self-referential type parameter keeps fluent chains typed to the concrete builder, so shared and symbology-specific options mix freely without casts: new MicroQRCodeImageBuilder("...").WithSize(256, 256).WithVersion(MicroQRVersion.M4). Deriving from this class outside the library is not supported: the abstract hooks that connect a symbology's data model to the shared output pipeline are private protected.

method ToBitmap

public SKBitmap ToBitmap();

Generate the symbol image and return as SKBitmap.

method ToImage

public SKImage ToImage();

Generate the symbol image and return as SKImage.

method WithColors

public TSelf WithColors(SKColor? codeColor = null, SKColor? backgroundColor = null, SKColor? clearColor = null);

Configure the colors used in the image.

method WithFormat

public TSelf WithFormat(SKEncodedImageFormat format, int quality = 100);

Configure the output image format and quality.

method WithGradient

public TSelf WithGradient(GradientOptions? gradientOptions);

Configure gradient options for the modules.

method WithModulePixelSize

public TSelf WithModulePixelSize(int modulePixelSize);

Configure content size from pixels-per-module.

Notes

Sets each module to an exact integer pixel size. Content side length is matrixSize * modulePixelSize. Used alone, the output image matches the content size. Used with QRCodeImageBuilderBase , the content is centered on the larger canvas and padded with clearColor. If the canvas is smaller than the content, rendering throws.

method WithModuleShape

public TSelf WithModuleShape(ModuleShape? moduleShape, float sizePercent = 1);

Configure the shape of the modules.

Notes

Note: Custom module shapes reduce scan margin; sizes below 0.8 may affect readability. On Standard QR they also affect finder patterns unless a custom finder pattern shape is explicitly set via its WithFinderPatternShape option.

method WithQuietZone

public TSelf WithQuietZone(int size);

Configure the quiet zone size (light border) around the symbol.

Notes

When not called, the builder uses its symbology's specification default: 4 modules for Standard QR, 2 for Micro QR and rMQR. Ignored when the builder was given pre-built symbol data (the data already carries its quiet zone).

method WithSize

public TSelf WithSize(int width, int height);

Configure the output image size in absolute pixels.

Notes

Used alone, this sets an exact canvas size. For the square symbologies the module pixel size then becomes imageSize / matrixSize, which may be fractional and can change when the version changes; the rectangular rMQR builder fits the symbol into the canvas with a uniform module scale instead (letterbox, the leftover pad keeps clearColor). Used with QRCodeImageBuilderBase , this sets the canvas size while module pixels define the content size (matrixSize * modulePixelSize). The canvas must be at least as large as the content on both sides; extra space is padded and the content is centered. Padding uses clearColor from QRCodeImageBuilderBase .

method ToByteArray

public byte[] ToByteArray();

Generate the symbol image and return as byte array.

method ToSvgString

public string ToSvgString();

Generate the symbol and return as SVG document string.

Notes

See QRCodeImageBuilderBase for rendering behavior.

method SaveTo

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.

method SaveTo

public void SaveTo(Stream output);

Generate the symbol image and save to stream.

method SaveToSvg

public void SaveToSvg(IBufferWriter<byte> writer);

Generate the symbol and write as SVG document to an IBufferWriter.

Notes

See QRCodeImageBuilderBase for rendering behavior. Data is written in writer-provided segments, so segmented writers (e.g. PipeWriter) work without a single contiguous buffer for the whole document.

method SaveToSvg

public void SaveToSvg(Stream output);

Generate the symbol and save as SVG document to stream.

Notes

The symbol is drawn as vector shapes via SKSvgCanvas , so the output scales without quality loss. All builder options apply. The root element carries a viewBox, so the document scales its content when embedded at a different size (img element, CSS). For plain rectangular modules, shape-rendering="crispEdges" is added to avoid antialiasing seams between modules; custom shapes keep antialiasing for smooth curves. QRCodeImageBuilderBase is ignored, SVG is a vector format, not an SKEncodedImageFormat . Size options ( QRCodeImageBuilderBase , QRCodeImageBuilderBase , or the symbology's default canvas) define the SVG viewport in units. The stream is left open after writing.

#class QRCodeImageDecoder

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.

method TryDecode

public static bool TryDecode(SKBitmap bitmap, out string text);

method TryDecode

public static bool TryDecode(SKBitmap bitmap, out string text, out QRCodeDecodeInfo info);

#class QRCodeRenderer

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.

method GetFinderPatternRect

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

The finder patterns are the large squares typically located at three corners of a QR code. This method calculates their positions based on the QR code's size and quiet zone, ensuring accurate placement within the specified rendering area.

method GetIconRects

public static ValueTuple<SKRect, SKRect> GetIconRects(QRCodeData data, SKRect area, IconData iconData);

Calculates icon and border rectangles for the given QR code area.

Notes

When IconSizeModules is set, sizing is module-based and percent/pixel values are ignored. Module-based icons are validated against QR size and core occupancy at render time. Icon rectangles are snapped to the module grid; even module sizes cannot be geometrically centered on an odd QR matrix.

method Render

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

Micro QR has a single finder pattern and no error-correction headroom for overlays, so the Standard QR options for icons and custom finder pattern shapes are intentionally not available. See Render for the module-run merge behavior shared with Standard QR.

method Render

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

With the default rectangle shape at moduleSizePercent 1.0, horizontal runs of dark modules are drawn as single merged rectangles (fewer native draw calls). Merged and per-module rendering are pixel-identical under axis-preserving canvas transforms (translation/scale); under rotation, shared-edge rounding may differ at sub-pixel level. Any custom module shape or a module size below 1.0 falls back to per-module drawing.

method Render

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

rMQR has one finder pattern and no error-correction headroom for overlays, so there are no icon or finder-shape options. Module runs are merged as for the other symbologies (see Render ).

#class RectangleFinderPatternShape

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.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Antialiasing disabled; straight-edged rectangles render cleanly without it.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);

#class RectangleModuleShape

public sealed class RectangleModuleShape : ModuleShape

Draw modules as rectangles.

field Default

public static readonly RectangleModuleShape Default;

Gets the default instance.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Antialiasing disabled to prevent gray borders between modules.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

#class RmQRCodeImageBuilder

public class RmQRCodeImageBuilder : QRCodeImageBuilderBase<RmQRCodeImageBuilder>

High-level builder for creating rMQR code images with fluent configuration and static methods.

Notes

This builder mirrors QRCodeImageBuilder / MicroQRCodeImageBuilder for the rMQR symbology (ISO/IEC 23941, R7x43-R17x139). Version, error correction and fit use the rMQR-typed RmQRVersion / RmQREccLevel / RmQRFitStrategy / RmQRHeight , and the default quiet zone is the 2 modules the specification requires. rMQR symbols are rectangular. With QRCodeImageBuilderBase the image is exactly the matrix at that scale; with QRCodeImageBuilderBase the symbol is fitted into the canvas with a uniform module scale and centered (letterbox, never stretched); with WithWidth (the static helpers' size, and the 512-pixel default when nothing is configured) the image is that wide, 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 (the height rounding can leave a few pixels of background at the sides on the widest versions; there is no clear-colour pad, so an opaque background gives an opaque image). rMQR has a single finder pattern and no error-correction headroom for overlays, so the Standard QR styling options that depend on those (icon overlays and custom finder pattern shapes) are intentionally not offered.

constructor RmQRCodeImageBuilder

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.

constructor RmQRCodeImageBuilder

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.

method WithEciMode

public RmQRCodeImageBuilder WithEciMode(EciMode eciMode);

Configure the ECI character encoding declaration.

method WithErrorCorrection

public RmQRCodeImageBuilder WithErrorCorrection(RmQREccLevel eccLevel);

Configure the error correction level (M or H).

method WithFitStrategy

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).

method WithHeight

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.

method WithSegmentation

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.

method WithVersion

public RmQRCodeImageBuilder WithVersion(RmQRVersion version);

Configure the exact rMQR version to generate.

method WithWidth

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.

method GetImageBytes

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.

method GetImageBytes

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.

method GetPngBytes

public static byte[] GetPngBytes(RmQRCodeData rmQrCodeData, int size = 512);

Generate an rMQR code as PNG byte array with default settings.

method GetPngBytes

public static byte[] GetPngBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);

Generate an rMQR code as PNG byte array with default settings.

method GetSvgBytes

public static byte[] GetSvgBytes(RmQRCodeData rmQrCodeData, int size = 512);

Generate an rMQR code as SVG byte array.

method GetSvgBytes

public static byte[] GetSvgBytes(string content, RmQREccLevel eccLevel = 0, int size = 512);

Generate an rMQR code as SVG byte array.

method GetSvgString

public static string GetSvgString(RmQRCodeData rmQrCodeData, int size = 512);

Generate an rMQR code as SVG string.

method GetSvgString

public static string GetSvgString(string content, RmQREccLevel eccLevel = 0, int size = 512);

Generate an rMQR code as SVG string.

method SavePng

public static void SavePng(RmQRCodeData rmQrCodeData, Stream output, int size = 512);

Generate an rMQR code and save as PNG to stream.

method SavePng

public static void SavePng(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);

Generate an rMQR code and save as PNG to stream.

method SaveSvg

public static void SaveSvg(RmQRCodeData rmQrCodeData, Stream output, int size = 512);

Generate an rMQR code and save as SVG to stream.

method SaveSvg

public static void SaveSvg(string content, Stream output, RmQREccLevel eccLevel = 0, int size = 512);

Generate an rMQR code and save as SVG to stream.

method WriteImage

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.

method WriteImage

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.

method WritePng

public static void WritePng(RmQRCodeData rmQrCodeData, IBufferWriter<byte> writer, int size = 512);

Generate an rMQR code and write PNG bytes to a buffer writer.

method WritePng

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.

method WriteSvg

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.

method WriteSvg

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.

#class RmQRCodeImageDecoder

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.

method TryDecode

public static bool TryDecode(SKBitmap bitmap, out string text);

method TryDecode

public static bool TryDecode(SKBitmap bitmap, out string text, out RmQRCodeDecodeInfo info);

#class RoundedRectangleCircleFinderPatternShape

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.

constructor RoundedRectangleCircleFinderPatternShape

public RoundedRectangleCircleFinderPatternShape(float cornerRadiusPercent = 0.3);

Initializes a new instance with the specified corner radius.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Requires antialiasing to prevent jagged edges on curves.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);

#class RoundedRectangleFinderPatternShape

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.

constructor RoundedRectangleFinderPatternShape

public RoundedRectangleFinderPatternShape(float cornerRadiusPercent = 0.2);

Initializes a new instance with the specified corner radius.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Requires antialiasing to prevent jagged edges on curves.

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKColor backgroundColor);

method Draw

public override void Draw(SKCanvas canvas, SKRect rect, SKPaint paint, SKPaint backgroundPaint);

#class RoundedRectangleModuleShape

public sealed class RoundedRectangleModuleShape : ModuleShape

Draws modules as rounded rectangles.

field Default

public static readonly RoundedRectangleModuleShape Default;

Gets the default instance.

constructor RoundedRectangleModuleShape

public RoundedRectangleModuleShape(float cornerRadiusPercent = 0.3);

Initializes a new instance with the specified corner radius.

property RequiresAntialiasing

public bool RequiresAntialiasing { get; }

Requires antialiasing to prevent jagged edges on curves.

method Draw

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.

#struct Vector2Slim

public readonly struct Vector2Slim : IEquatable<Vector2Slim>

int version of Vector2, slim implementation

Notes

ref: https://github.com/dotnet/corefx/blob/v3.1.32/src/System.Numerics.Vectors/src/System/Numerics/Vector2_Intrinsics.cs

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).

constructor Vector2Slim

public Vector2Slim(int value);

Creates a vector with both components set to the same value.

constructor Vector2Slim

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.

method CopyTo

public void CopyTo(Span<int> span);

Copies the vector elements to the specified span.

method CopyTo

public void CopyTo(Span<int> span, int index);

Copies the vector elements to the specified span starting at the specified index.

method CopyTo

public void CopyTo(int[] array);

Copies the vector elements to the specified array.

method CopyTo

public void CopyTo(int[] array, int index);

Copies the vector elements to the specified array starting at the specified index.