Namespace Net.Codecrete.QrCodeGenerator
Classes
- DataSegment
A chunk of payload data to be carried by the QR code.
The payload data carried by a QR code is a sequence of data segments. Each segment is a sequence of bytes encoded with a specific encoding mode: numeric, alphanumeric, Kanji, or binary. Additionally, a segment can contain an extended character set indicator (ECI) or a Structured Append header.
Instances of this class represent such a data segment. They retain the data in the original unencoded form until the bit stream for the QR code is created.
- DataTooLongException
The exception that is thrown when the supplied data does not fit in the QR code.
- ECI
ECI (Extended Channel Interpretation) values for text and data encoding.
An ECI indicator is used to specify the character encoding of the data that follows.
If no ECI indicator is present, the default encoding according to the QR code specification is ISO-8859-1 (Latin-1). However, many QR code scanners either analyze the data and guess the encoding or assume UTF-8.
- ECIException
Exception thrown when an invalid ECI value is specified.
- EncodingInfo
Details about the QR code encoding.
The details can be collected during QR code generation for analysis purposes, but they are not used by the library itself. Collecting the information will make the QR code generation slower as the library will fully calcuate the penalty score for all data mask patterns, even if it is already clear that the pattern is not the best one.
- QrCode
Represents a QR code containing text or binary data.
QR codes are a type of two-dimensional barcodes, invented by Denso Wave and described in the ISO/IEC 18004 standard "QR code bar code symbology specification".
The data is represented as square grid of dark and light pixels (called modules by the QR code specification).
Depending on the amount of data, different sizes of the QR code are used. The QR code specification calls them version. Versions 1 (smallest) to 40 (largest) are available.
QR codes includes error correction data to ensure the QR code can be read despite difficult lighting conditions (e.g. reflections), dirt or partially covered pixels. Four error correction levels are available. The highest can recover about 30% of missing or damaged data.
A QR code instance can be converted to a PNG (ToPngBitmap(int, int, int, int)), SVG (ToSvgString(int, string, string)) or BMP ToBmpBitmap(int, int, int, int)) image. Or the QR code can be drawn or printed with custom code by either processing a list of rectangles covering the dark modules (ToRectangles()), or by querying the color of individual modules with GetModule(int, int).
Structs
- PenaltyScore
Information about the penalty score of a data mask pattern.
QR code use one out of eight patterns to improve the readability of the code. The penalty score measures how difficult it is to read a QR code with a given pattern.
The penaly score information can be collected for analysis purposes, but it is not used by the library itself. If the information is collected, the QR code generation will be slower as the library needs to fully calculate the penalty score even if it is already clear that the pattern is not the best one.
Note that in deviation from the QR code specification, the penalty score does not include the score contributed by the finder patterns.
- QrRectangle
A rectangular block of dark modules within a QR code.
The coordinates use the same system as GetModule(int, int): the top-left module is at (x=0, y=0), x extends to the right and y extends downwards. Each unit is one module (QR code pixel); no border is included.
Instances are produced by ToRectangles(), which merges adjacent dark modules into larger rectangles to reduce the number of shapes that need to be drawn.
Enums
- DataSegmentMode
Data segment mode.
Data segments can contain bytes as payload, or they can have a special function like ECI data segments. The mode describes what type of segment it is, and how the bytes are encoded.
- KanjiStrategy
Controls if the Kanji mode is used for data segments.
Kanji mode allows efficiently encoding text encoded in Shift-JIS, an encoding for Japanese text. It can also be used for any other data if it contains suitable byte combinations. However, many QR code scanners incorrectly assume that if Kanji mode is used, then it must be text encoded in Shift-JIS.
For the best compatibility with non-standard-compliant scanners, Kanji mode should only be used if the data is encoded in Shift-JIS.
- QrCode.Ecc
Error correction level in QR code symbol.