Runtime limits, yes, there’s no way the embedded microprocessor used can work on that much data at once. The whole thing has around 170k RAM usable for compiled pattern code, data, web requests, etc., and your arrays are limited to 10240 elements (40KB of data roughly) of that.
The flash storage is less of an issue, but still quite large. Source code is compressed, so I’m betting the saved file would be much smaller, not that it helps much!
If you really want a rainbow man, what I would do is get a black and white bitmap encoded as 1 bits per pixel, and use that to then paint a rainbow using hsv()
instead of a full color bitmap. You can use the B&W bitmap to mask any generated pattern, be it rainbow or rendered fire via the new Perlin noise functions, or whatever.
A fairly easy way to do this is using the XBM image format, which many tools still support exporting to it. It’s an old format that was used for embedding black and white icons/bitmaps into C programs. Something like GIMP can do it, as well as command line tools like imagemagick. There are also online converters.
An XBM file format is actually a C source code and while it encodes only 8 bits per element (about 1/4th efficient for Pixelblaze elements) it would still be leaps and bounds more efficient for your man image.
An XBM looks like this when opened with a text editor:
#define test_width 16
#define test_height 7
static unsigned char test_bits[] = {
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60 };
And this can be converted to a PB compatible array with a few syntax changes:
var test_width = 16
var test_height = 7
var test_bits = [
0x13, 0x00, 0x15, 0x00, 0x93, 0xcd, 0x55, 0xa5, 0x93, 0xc5, 0x00, 0x80,
0x00, 0x60 ];
I ran your man through a converter with some code to show these kinds of bitmaps, for showing on a 2D matrix, but could be adapted for POV:
//draws the burning man bitmap converted to XBM and ported, in rainbow, with a scrolling animation
var man_width = 50
var man_height = 50
var man_bits = [
0x3F, 0xFF, 0xCF, 0xFF, 0xE7, 0xFF, 0x01, 0x3F, 0xFC, 0x07, 0xFF, 0xE1,
0xFF, 0x03, 0x3F, 0xFC, 0x07, 0xFF, 0xC1, 0xFF, 0x01, 0x7F, 0xF8, 0x01,
0xFC, 0xF0, 0xFF, 0x01, 0x7F, 0xF8, 0x01, 0xF8, 0xF0, 0xFF, 0x03, 0xFF,
0x70, 0x20, 0x78, 0xF0, 0xFF, 0x03, 0xF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xFF, 0xFF, 0x03, 0xFF, 0x7F, 0xF8, 0xF8,
0xFF, 0xFF, 0x03, 0xFF, 0x7F, 0xF8, 0xF0, 0xFF, 0xFF, 0x03, 0xFF, 0x7F,
0xF8, 0xF0, 0xFF, 0xFF, 0x03, 0xFF, 0x7F, 0xFC, 0xF1, 0xFF, 0xFF, 0x03,
0xFF, 0x7F, 0xFC, 0xE1, 0xFF, 0xFF, 0x03, 0xFF, 0x3F, 0xFC, 0xF1, 0xFF,
0xFF, 0x03, 0xFF, 0x3F, 0xFC, 0xE1, 0xFF, 0xFF, 0x03, 0xFF, 0x3F, 0xFE,
0xE1, 0xFF, 0xFF, 0x03, 0xFF, 0x3F, 0xFE, 0xC3, 0xFF, 0xFF, 0x03, 0xFF,
0x0F, 0xFE, 0xC3, 0xFF, 0xFF, 0x03, 0xFF, 0x0F, 0xFE, 0x83, 0xFF, 0xFF,
0x03, 0xFF, 0x0F, 0xFF, 0x87, 0xFF, 0xFF, 0x03, 0xFF, 0x87, 0xFF, 0x0F,
0xFF, 0xFF, 0x03, 0xFF, 0x07, 0xFF, 0x0F, 0xFF, 0xFF, 0x03, 0xFF, 0xC7,
0xFF, 0x0F, 0xFF, 0xFF, 0x03, 0xFF, 0xC3, 0xFF, 0x1F, 0xFE, 0xFF, 0x03,
0xFF, 0xC7, 0xFF, 0x1F, 0xFF, 0xFF, 0x03, 0xFF, 0xC7, 0xFF, 0x3F, 0xFF,
0xFF, 0x03, ];
var colorBands = 7
function bitmap(bits, width, height, x, y) {
x = floor(x)
y = floor(y)
var index = floor(ceil(width/8) * y) + floor(x/8)
if (index >= bits.length || index < 0)
return 0
var byte = bits[index];
return (byte >> (x % 8)) & 0x1
}
export function beforeRender(delta) {
t1 = time(.1)
resetTransform();
//x will increase for each colorBand
translate(time(.15) * colorBands, 0)
}
export function render2D(index, x, y) {
//for color, we'll quantize x into 8 bands of color
h = floor(x)/colorBands
s = 1
//scale the x,y coordinates to the man bitmap size, wrapping x as it scrolls
//note: using mod(x * man_width, man_width) to "wrap" so that the man repeats as x scrolls past the 0-1 range
//note: using ! to invert the pixels since we want to draw white pixels, not black ones
v = !bitmap(man_bits, man_width, man_height, mod(x * man_width, man_width), y * man_height)
hsv(h, s, v)
}
That still leaves you with ~96% of your array element memory free.