public class QRCode
extends java.lang.Object
Image image = new QRCode.generate("John Doe");
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG |
static int |
ECC_HIGH
This variable represents high level error correction
|
static int |
ECC_LOW
This variable represents low level error correction
|
static int |
ECC_MEDIUM
This variable represents medium level error correction
|
static int |
ECC_QUARTILE
This variable represents quartile level error correction
|
Constructor and Description |
---|
QRCode() |
Modifier and Type | Method and Description |
---|---|
static int |
getBestVersion(java.lang.String text,
int errorCorrection) |
byte[][] |
getBytes(java.lang.String text)
This method returns the byte matrix that contains the values of each point of
the QRCode.
|
byte[][] |
getBytes(java.lang.String text,
int errorCorrection)
This method returns the byte matrix that contains the values of each point of
the QRCode.
|
byte[][] |
getBytes(java.lang.String text,
int errorCorrection,
int version)
This method returns the byte matrix that contains the values of each point of
the QRCode.
|
Image |
getImage(java.lang.String text)
This method returns an totalcross.ui.Image instance that contains the values
of each point of the QRCode.
|
Image |
getImage(java.lang.String text,
int ecc)
This method returns an totalcross.ui.Image instance that contains the values
of each point of the QRCode.
|
Image |
getImage(java.lang.String text,
int ecc,
int version)
This method returns an totalcross.ui.Image instance that contains the values
of each point of the QRCode.
|
public static final int ECC_LOW
public static final int ECC_MEDIUM
public static final int ECC_QUARTILE
public static final int ECC_HIGH
public static boolean DEBUG
public byte[][] getBytes(java.lang.String text, int errorCorrection, int version)
version
- The version of a QR code is a number between 1 and 40
(inclusive), which indicates the size of the QR code.
The width and height of a QR code are always equal (it
is square) and are equal to 4 * version + 17.errorCorrection
- The level of error correction is a number between 0
and 3 (inclusive), or can be one of the symbolic names
ECC_LOW, ECC_MEDIUM, ECC_QUARTILE and ECC_HIGH. Higher
levels of error correction sacrifice data capacity,
but allow a larger portion of the QR code to be
damaged or unreadable.text
- The text to encode.public byte[][] getBytes(java.lang.String text, int errorCorrection)
This method do some calculus to find the best version considering ecc and the given text
errorCorrection
- The level of error correction is a number between 0
and 3 (inclusive), or can be one of the symbolic names
ECC_LOW, ECC_MEDIUM, ECC_QUARTILE and ECC_HIGH. Higher
levels of error correction sacrifice data capacity,
but allow a larger portion of the QR code to be
damaged or unreadable.text
- The text to encode.public byte[][] getBytes(java.lang.String text)
This method do some calculus to find the best version considering ecc and the given text.
By default this method uses ECC_QUARTILE
as default ecc.
text
- The text to encode.public Image getImage(java.lang.String text, int ecc, int version) throws ImageException
text
- The text to encode.ImageException
public Image getImage(java.lang.String text, int ecc) throws ImageException
This method do some calculus to find the best version considering ecc and the given text.
text
- The text to encode.ecc
- The correction level.ImageException
public Image getImage(java.lang.String text) throws ImageException
This method do some calculus to find the best version considering ecc and the given text.
By default this method uses ECC_QUARTILE
as default ecc.
text
- The text to encode.ImageException
public static int getBestVersion(java.lang.String text, int errorCorrection)