Grid to be flattened
Flattened grid
Takes a list of numbers, converts them to hexadecimal notation and arranges them into groups of 12, where each value is delimited by a comma and each group is separated by a line break.
Array of numbers to be formatted
A string of formatted hex values
Takes a grid of boolean values and converts it into XBM-formatted data which
is returned as a string. Optionally, the parameter arduinoHeader
can be
set to true to generate an XBM file specifically for Arduino.
Name of the variable to be used in the output file
The grid from which the XBM data shall be generated
Generate Arduino-compatible XBM (default false
)
XBM-formatted data
Takes XBM data as a string and tries to extract the height of the image by
looking for the corresponding #define
statement and returns it. If no such
statement can be found, 0 is returned.
XBM formatted data as a string
The height specified in the file, 0 on error
Takes XBM data as a string and tries to extract the data portion of the
image by looking for a block of hex values delimited by curly braces. If
found, the block is split using the comma character as delimiter and the hex
values are converted to binary strings which are padded to the length of a
byte. This is then converted to an array of characters and returned. If no
block matching the conditions is found, undefined
is returned.
XBM formatted data as a string
An array containing the data portion of the input as binary strings
Takes XBM data as a string and tries to extract the width of the image by
looking for the corresponding #define
statement and returns it. If no such
statement can be found, 0 is returned.
XBM formatted data as a string
The width specified in the file, 0 on error
Takes a string of XBM-formatted data, parses it and returns a matrix of the given width and height containing the data from the XBM as boolean values. If the contents of the string cannot be parsed, an error is thrown.
String containing XBM-formatted data
A matrix of boolean values
Generated using TypeDoc
Takes a matrix of boolean values and flattens it, i.e. returns a one-dimensional array with all the rows concatenated. Moreover, if the length of the rows is not evenly divisible by 8, they are padded to a length which is divisible by 8 by appending the required number of
false
values.