Barcod...:Engine(3pm)

πŸ“¦
version 0.10 Β· 2 versions
  • 0.10 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 0.10 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Barcode::DataMatrix::Engine β€” bestie, this is the engine that generates the data matrix bitmap. like, the actual pixel-makin' machinery. no cap. πŸ’–

it lives in the perl manual as Barcod...:Engine(3pm) (the name got a lil truncated in the header, we don't talk about it πŸ™ˆ) and it's part of the User Contributed Perl Documentation.


πŸŽ€ THE WHOLE VIBE, ITEM BY ITEM πŸŽ€

okay so here's every constant, every method, every lil function in this engine. don't skip any, i know it's long, we're getting through it together πŸ’…

DEBUG

turn general debugging info on / off. that's it, that's the whole thing. flip it when u wanna see what's going on under the hood 🫢

E_ASCII

represents the ASCII encoding type.

E_C40

represents the C40 encoding type. (upper case alphanumeric, periodt ✨)

E_TEXT

represents the TEXT encoding type. (lower case alphanumeric, so cute)

E_BASE256

represents the BASE256 encoding type.

E_NONE

represents when there is no encoding type at all. the void. the empty vibes πŸ’€

E_AUTO

represents when the encoding type is automatically set. let the engine cook πŸ‘‘

Types

returns a list of encoding types. all of them. the whole squad 🌈

stringToType (type_name)

gives u back the integer that represents the type, from the type name. name in, number out πŸŽ€

typeToString (type_integer)

the reverse glow-up: gives u back the type name from the integer representing it.

stringToFormat (format_string)

converts a "width x height" format string into an internal format specification. literally translating for the engine.

setType (type_name)

sets the encoding type from the given type name. as advertised, fr fr.

new

constructs a Barcode::DataMatrix::Engine object. birth of a legend ✨

init

initializes some of the basic Barcode::DataMatrix::Engine data. some of it. not all. we're being honest here.

ProcessTilde

handles special or control characters, which are prefixed by a tilde ~ when encoding. the tilde is doing the heavy lifting 🫑

CalcReed (ai, err)

returns the message as a Reed-Solomon encoded array. fancy math, slay.

A253 (i, j)

returns padding codewords via the 253-state algorithm.

for more info, the original points at 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

CreateBitmap

generates and returns the bitmap representing the message. the moment u came for πŸ’–

ecc (format, ai)

returns the ECC200 (DataMatrix) array, formatted for the appropriate matrix size. tailored. bespoke. iconic.

isIDigit (character_code)

returns true if the character code represents a digit. 0-9 girlies rise πŸ“

isILower (character_code)

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

isIUpper (character_code)

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

DetectEncoding

detects the encoding type. sherlock holmes but for bytes πŸ”

EncodeASCII (i, ai, ai1, as)

encodes the message as ASCII.

SelectEncoding (j, ai, i)

selects a new encoding type for the message. choosing. picking. deciding. πŸ’…

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

encodes the message as C40/TEXT.

state255 (V, P)

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

this info originally comes 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)

returns a string representation of the input hexadecimal number. hex but make it text 🧚

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

encodes the message as BASE256.

GenData (ai)

generates and returns the data for the DataMatrix bitmap from the input array. building the whole thing from scratch, main character energy πŸ‘‘

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

fills the border of the ECC200 data matrix bitmap. framing the fit ✨

FillCharData (ncol, nrow, array)

fills the data matrix with the character data in the given message array. the final lil sprinkle πŸŽ€


lowkey a whole lotta math in here bestie but every single piece matters, don't skip the padding, don't skip the borders, it's all doing something πŸ’œ

this page is from the User Contributed Perl Documentation, shipped with perl v5.34.0 and dated 2022-06-08, and it's filed under Barcod...:Engine(3pm). bye bestie, go make some matrices πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from