encode Segments
Returns a QR Code representing the specified segments with the specified encoding parameters. The smallest possible QR Code version within the specified range is automatically chosen for the output. Iff 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. This is a mid-level API; the high-level API is .encodeText and .encodeBinary.
Return
a QR Code (not null) representing the segments
Parameters
the segments to encode
the error correction level to use (not null) (boostable)
the minimum allowed version of the QR Code (at least 1)
the maximum allowed version of the QR Code (at most 40)
the mask number to use (between 0 and 7 (inclusive)), or −1 for automatic mask
increases the ECC level as long as it doesn't increase the version number
Throws
if the list of segments, any segment, or the error correction level is null
if 1 ≤ minVersion ≤ maxVersion ≤ 40 or −1 ≤ mask ≤ 7 is violated
if the segments fail to fit in the maxVersion QR Code at the ECL, which means they are too long