• Ok, got some time to work on this again and got some question:

    Q: How to pass a buffer and use the Graphics inside a module?

    Q: Lookup tables for char to barcode fillRect are very large, what is memory wise the best way to store them.

    Note: Got a EAN13 running and on the way for a module

        var charset = [0, 11, 13, 14, 19, 25, 28, 21, 22, 26],
            map = [13, 39, 114, 25, 51, 102, 19, 27, 108, 61, 33, 66, 35, 29, 92,
                   49, 57,  78, 47,  5,  80, 59, 17,  68, 55, 9, 72, 11, 23, 116],
    
     //used  toString(2).pad(7,"0")  to lookup  the bitcode for chars
    

    compared to the original source

    Lookup table for CODE128 is much bigger.

  • Sun 2021.05.02

    Hi @MaBe several years ago, I had similar questions and several chimed in to solve with snippets and links regarding 'Flat Strings'. Here was Gordon's well described response:

    ref post #2 http://forum.espruino.com/comments/14455­141/
    entire thread Definition of a flat string and example

    Some sample snippets:

    Flat String creation failing


    'Q: How to pass a buffer and use the Graphics inside a module?'

    Is the question on how to process the image creation within the developer designed module, and access that ('pass a buffer') content inside the module, back at the console side of the WebIDE?

    Use the array buffer to access the flat string, similar when using a pointer in 'C' perhaps?
    (See last pp in Gordon's response in the first link - ref post #2)

    Nicely done, if I might add! . . .

About

Avatar for Robin @Robin started