PLAYGROUND (experimental)

barcode_128

Generate Barcode 128
barcode_128(
    text, 
    [list=true], 
    [x], 
    [y], 
    [width], 
    [height], 
    [center], 
    [stroke=#000000], 
    [fill=#FFFFFF], 
    [weight=1.00]
) -> NULL || List of 0,1 for each bar

Generate Barcode 128

Arguments

NameTypeRequiredDefaultDescription
textyes-Text to use
list-trueIf true, return a list of points, and don't draw (width, height, stroke, fill & weight are ignored)
x--X top left position
y--Y top left position
width--Width of individual bar
height--Height of individual bar
center--If true, x/y are the center
stroke-#000000Stroke color
fill-#FFFFFFFill color
weight-1.00Stroke weight (thickness)

Full example

canvas(width=1000, height=450, center=true);
var texte = "1234567890";
var cb = barcode_128(texte, list=true);
console(cb);

coord_scale(3); 

barcode_128(
    texte, 
    x=0, y=0, center=true,
    width=3, height=100, fill="#000"
);
text(texte, 0, 50, ax=MIDDLE);

save(whoami(png=true));