++ed by:
Author image Mark A. Stratman
and 1 contributors


Barcode::DataMatrix::Engine - The engine which generates the data matrix bitmap.


Turn on/off general debugging information.


Represent the ASCII encoding type.


Represent the C40 encoding type. (upper case alphanumeric)


Represent the TEXT encoding type. (lower case alphanumeric)


Represent the BASE256 encoding type.


Represent the when there is no encoding type.


Represent the when the encoding type is automatically set.


Return a list of encoding types.

stringToType (type_name)

Return the integer representing the type from the type name.

typeToString (type_integer)

Return the type name from the integer representing the type.

stringToFormat (format_string)

Convert a "width x height" format string into an internal format specification.

setType (type_name)

Set the encoding type from the given type name.


Construct a Barcode::DataMatrix::Engine object.


Initialize some of the basic Barcode::DataMatrix::Engine data.


Handle special or control characters, which are prefixed by a tilde ~ when encoding.

CalcReed (ai, err)

Return the message as a Reed-Solomon encoded array.

A253 (i, j)

Return padding codewords via the 253-state algorithm.

For more information see http://grandzebu.net/informatique/codbar-en/datamatrix.htm.

The relevant text for this algorithm is reproduced here.

If the symbol is not full, pad CWs are required. After the last data CW, the 254 CW indicates the end of the datas or the return to ASCII method. First padding CW is 129 and next padding CWs are computed with the 253-state algorithm.

The 253-state algorithm

Let P be the number of data CWs from the beginning of the data, R a pseudo random number and CW the required pad CW.

    R = ((149 * P) MOD 253) + 1
    CW = (129 + R) MOD 254


Generate and return the bitmap representing the message.

ecc (format, ai)

Return the ECC200 (DataMatrix) array, formatted for the appropriate matrix size.

isIDigit (character_code)

Return true if the character code represents a digit.

isILower (character_code)

Return true if the character code represents a lower case letter.

isIUpper (character_code)

Return true if the character code represents an upper case letter.


Detect the encoding type.

EncodeASCII (i, ai, ai1, as)

Encode the message as ASCII.

SelectEncoding (j, ai, i)

Select a new encoding type for the message.

EncodeC40TEXT (i, ai, ai1, ai2, flag, flag1, flag2)

Encode the message as C40/TEXT.

state255 (V, P)

The 255-state algorithm. Used when encoding strings with the BASE256 type.

This information originally from http://grandzebu.net/informatique/codbar-en/datamatrix.htm.

Let P the number of data CWs from the beginning of datas (CW = code word). Let R be a pseudo random number, V the base 256 CW value and CW the required CW.

    R = ((149 * P) MOD 255) + 1
    CW = (V + R) MOD 256

hexary (src)

Return a string representation of the input hexadecimal number.

EncodeBASE256 (i, hint, src, stat, res, flag)

Encode the message as BASE256.

GenData (ai)

Generate and return the data for the DataMatrix bitmap from the input array.

FillBorder (ai, i, j, k, l)

Fill the border of the ECC200 data matrix bitmap.

FillCharData (ncol, nrow, array)

Fill the data matrix with the character data in the given message array.