![]() |
NDEVR
API Documentation
|
A QR Code symbol, which is a type of two-dimensional barcode. More...
Public Types | |
| enum class | Ecc { LOW = 0 , MEDIUM , QUARTILE , HIGH } |
| The error correction level in a QR Code symbol. More... | |
Public Member Functions | |
| QrCode (int ver, Ecc ecl, const Buffer< std::uint8_t > &dataCodewords, int msk) | |
| Creates a new QR Code with the given version number, error correction level, data codeword bytes, and mask number. | |
| Ecc | getErrorCorrectionLevel () const |
| Returns this QR Code's error correction level. | |
| int | getMask () const |
| Returns this QR Code's mask pattern index. | |
| bool | getModule (int x, int y) const |
| Returns the color of the module (pixel) at the given coordinates. | |
| int | getSize () const |
| Returns this QR Code's size (width and height in modules). | |
| int | getVersion () const |
| Returns this QR Code's version number. | |
| String | toSVG (uint04 border, RGBColor color, RGBColor background=Constant< RGBColor >::Invalid) const |
| Generates an SVG (Scalable Vector Graphics) string representation of this QR Code. | |
Static Public Member Functions | |
| static QrCode | encodeBinary (const uint01 *data, uint04 size, Ecc ecl) |
| Returns a QR Code representing the given binary data at the given error correction level. | |
| static QrCode | encodeLink (const char *text, Ecc ecl) |
| Returns a QR Code representing the given link text at the given error correction level. | |
| static QrCode | encodeSegments (const QrSegmentBuffer &segs, Ecc ecl, int minVersion=1, int maxVersion=40, int mask=-1, bool boostEcl=true) |
| Returns a QR Code representing the given segments with the given encoding parameters. | |
| static QrCode | encodeText (const char *text, Ecc ecl) |
| Returns a QR Code representing the given Unicode text string at the given error correction level. | |
Static Public Attributes | |
| static constexpr int | MAX_VERSION = 40 |
| The maximum QR Code version number (40). | |
| static constexpr int | MIN_VERSION = 1 |
| The minimum QR Code version number (1). | |
A QR Code symbol, which is a type of two-dimensional barcode.
Invented by Denso Wave and described in the ISO/IEC 18004 standard. Instances of this class represent an immutable square grid of dark and light cells. The class provides static factory functions to create a QR Code from text or binary data. The class covers the QR Code Model 2 specification, supporting all versions (sizes) from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
Ways to create a QR Code object:
|
strong |
The error correction level in a QR Code symbol.
Creates a new QR Code with the given version number, error correction level, data codeword bytes, and mask number.
This is a low-level API that most users should not use directly. A mid-level API is the encodeSegments() function.
| [in] | ver | The version number (1 to 40). |
| [in] | ecl | The error correction level. |
| [in] | dataCodewords | The raw data codeword bytes (excluding error correction). |
| [in] | msk | The mask pattern to apply (0-7), or -1 for automatic selection. |
Referenced by encodeBinary(), encodeLink(), encodeSegments(), and encodeText().
Returns a QR Code representing the given binary data at the given error correction level.
This function always encodes using the binary segment mode, not any text mode. The maximum number of bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
| [in] | data | Pointer to the raw binary data to encode. |
| [in] | size | The number of bytes in the data array. |
| [in] | ecl | The minimum error correction level to use. |
References QrCode().
Returns a QR Code representing the given link text at the given error correction level.
| [in] | text | A null-terminated text string representing a link/URL. |
| [in] | ecl | The minimum error correction level to use. |
References QrCode().
|
static |
Returns a QR Code representing the given segments with the given encoding parameters.
The smallest possible QR Code version within the given range is automatically chosen for the output. If boostEcl is true, then the ECC level of the result may be higher than the ecl argument if it can be done without increasing the version. The mask number is either between 0 to 7 (inclusive) to force that mask, or -1 to automatically choose an appropriate mask (which may be slow). This function allows the user to create a custom sequence of segments that switches between modes (such as alphanumeric and byte) to encode text in less space.
| [in] | segs | The buffer of QrSegment objects to encode. |
| [in] | ecl | The minimum error correction level to use. |
| [in] | minVersion | The minimum QR Code version to consider (default 1). |
| [in] | maxVersion | The maximum QR Code version to consider (default 40). |
| [in] | mask | The mask pattern to use (0-7), or -1 for automatic selection (default -1). |
| [in] | boostEcl | Whether to boost the ECC level if possible without increasing version (default true). |
References QrCode().
Returns a QR Code representing the given Unicode text string at the given error correction level.
As a conservative upper bound, this function is guaranteed to succeed for strings that have 2953 or fewer UTF-8 code units (not Unicode code points) if the low error correction level is used. The smallest possible QR Code version is automatically chosen for the output. The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
| [in] | text | A null-terminated UTF-8 encoded text string. |
| [in] | ecl | The minimum error correction level to use. |
References QrCode().
| Ecc QrCode::getErrorCorrectionLevel | ( | ) | const |
Returns this QR Code's error correction level.
| int QrCode::getMask | ( | ) | const |
Returns this QR Code's mask pattern index.
| bool QrCode::getModule | ( | int | x, |
| int | y ) const |
Returns the color of the module (pixel) at the given coordinates.
Returns false for light or true for dark. The top left corner has the coordinates (x=0, y=0). If the given coordinates are out of bounds, then false (light) is returned.
| [in] | x | The horizontal coordinate (column index). |
| [in] | y | The vertical coordinate (row index). |
| int QrCode::getSize | ( | ) | const |
Returns this QR Code's size (width and height in modules).
| int QrCode::getVersion | ( | ) | const |
Returns this QR Code's version number.
| String QrCode::toSVG | ( | uint04 | border, |
| RGBColor | color, | ||
| RGBColor | background = Constant< RGBColor >::Invalid ) const |
Generates an SVG (Scalable Vector Graphics) string representation of this QR Code.
| [in] | border | The number of border modules (quiet zone) to add around the QR Code. |
| [in] | color | The foreground color for dark modules. |
| [in] | background | The background color for light modules. If invalid, no background is drawn. |