diff --git a/index.html b/index.html index c72b2fc..ba10b37 100644 --- a/index.html +++ b/index.html @@ -328,6 +328,11 @@ Set to 0 to wrap using the image's width instead, e.g. an 8px wide image adds a newline every 8th byte. +
+ + + Adds a dot/hash ascii-art comment after each row of bytes. Forces one image row per output line, regardless of "Bytes per row". +
diff --git a/js/script.js b/js/script.js index 3831f4e..de90217 100644 --- a/js/script.js +++ b/js/script.js @@ -24,6 +24,7 @@ const settings = { rotation: 0, esp32Format: false, bytesPerRow: 16, + showAsciiPreview: false, }; function bitswap(b) { @@ -47,7 +48,8 @@ function resolveWrapWidth(canvasWidth) { // Accumulates formatted bytes (prefix/value/separator, wrapped every // wrapWidth bytes) so our ConversionFunctions can use this formatting. // horizontal888 always wraps once per image row (canvasWidth) regardless -// of settings.bytesPerRow. +// of settings.bytesPerRow. When settings.showAsciiPreview is on, wrapWidth +// is ignored in favor of explicit endRow() calls (see makeAsciiRowTracker). function makeByteWriter(wrapWidth) { let out = ''; let count = 0; @@ -56,23 +58,52 @@ function makeByteWriter(wrapWidth) { const byteSet = bitswap(value).toString(16).padStart(hexWidth, '0'); out += `${settings.prefix}${byteSet}${settings.separator}`; count++; - if (count >= wrapWidth) { + if (!settings.showAsciiPreview && count >= wrapWidth) { out += '\n'; count = 0; } }, + // Ends the current line early with a dot/hash ascii-art comment for the + // row of pixels just written. Only called when settings.showAsciiPreview + // is on, so it always wins over wrapWidth-based wrapping. + endRow(asciiRow) { + out += `// ${asciiRow.split('').join(' ')}\n`; + count = 0; + }, result() { return out; }, }; } +// Builds a per-image-row ascii-art tracker (. for off, # for on) used +// when settings.showAsciiPreview is on. Call once per pixel with the same +// `index` used to read that pixel's channel data; flushes to the writer as +// a comment at the end of each image row, mirroring the row-boundary math +// packBitsHorizontal uses to flush partial bytes. +function makeAsciiRowTracker(canvasWidth, dataLength) { + let row = ''; + return (index, isOn, writer) => { + if (!settings.showAsciiPreview) return; + row += isOn ? '#' : '.'; + const pixelIndex = index / 4; + const isRowEnd = pixelIndex !== 0 && ((pixelIndex + 1) % canvasWidth) === 0; + const isImageEnd = index === dataLength - 4; + if (isRowEnd || isImageEnd) { + writer.endRow(row); + row = ''; + } + }; +} + // Shared by horizontal1bit/horizontalAlpha: pack 8 samples (one per pixel, // MSB first) into a byte, resetting early at the end of a row or the image // so a partial final byte is still zero-padded instead of dropped. function packBitsHorizontal(data, canvasWidth, writer, sampleAt) { let byteIndex = 7; let number = 0; + const trackAscii = makeAsciiRowTracker(canvasWidth, data.length); for (let index = 0; index < data.length; index += 4) { - if (sampleAt(data, index) > settings.ditheringThreshold) { + const isOn = sampleAt(data, index) > settings.ditheringThreshold; + if (isOn) { number += 2 ** byteIndex; } byteIndex--; @@ -88,6 +119,8 @@ function packBitsHorizontal(data, canvasWidth, writer, sampleAt) { number = 0; byteIndex = 7; } + + trackAscii(index, isOn, writer); } } @@ -126,6 +159,7 @@ const ConversionFunctions = { // eslint-disable-next-line no-unused-vars horizontal565(data, canvasWidth) { const writer = makeByteWriter(resolveWrapWidth(canvasWidth)); + const trackAscii = makeAsciiRowTracker(canvasWidth, data.length); // format is RGBA, so move 4 steps per pixel for (let index = 0; index < data.length; index += 4) { const r = data[index]; @@ -135,6 +169,7 @@ const ConversionFunctions = { // eslint-disable-next-line no-bitwise const rgb = ((r & 0b11111000) << 8) | ((g & 0b11111100) << 3) | ((b & 0b11111000) >> 3); writer.push(rgb, 4); + trackAscii(index, (r + g + b) / 3 > settings.ditheringThreshold, writer); } return writer.result(); }, @@ -142,6 +177,7 @@ const ConversionFunctions = { // image row per output line horizontal888(data, canvasWidth) { const writer = makeByteWriter(canvasWidth); + const trackAscii = makeAsciiRowTracker(canvasWidth, data.length); // format is RGBA, so move 4 steps per pixel for (let index = 0; index < data.length; index += 4) { // Split into RGB and pack into a single 24-bit value (MSB first) @@ -151,6 +187,7 @@ const ConversionFunctions = { // eslint-disable-next-line no-bitwise const rgb = (r << 16) | (g << 8) | (b); writer.push(rgb, 8); + trackAscii(index, (r + g + b) / 3 > settings.ditheringThreshold, writer); } return writer.result(); }, @@ -870,6 +907,16 @@ function glyphComment(image, indent = '') { return `${indent}// '${image.glyph}', ${image.canvas.width}x${image.canvas.height}px\n`; } +// Removes the trailing separator comma left after the last byte value. +// When settings.showAsciiPreview is on, the string always ends with a +// dot/hash ascii-art comment line instead (see makeAsciiRowTracker), so the +// comma sits just before that comment rather than at the true end. +function stripTrailingComma(str) { + return settings.showAsciiPreview + ? str.replace(/,(\s*\/\/[^\n]*)\n?\s*$/, '$1') + : str.replace(/,\s*$/, ''); +} + // Output the image string to the textfield // eslint-disable-next-line no-unused-vars function generateOutputString() { @@ -887,7 +934,7 @@ function generateOutputString() { code = imageToString(image); // Trim whitespace from end and remove trailing comma - code = code.replace(/,\s*$/, ''); + code = stripTrailingComma(code); code = `\t${code.split('\n').join('\n\t')}\n`; // const variableCount = images.length() > 1 ? count++ : ''; @@ -922,7 +969,7 @@ function generateOutputString() { outputString += comment + code; }); - outputString = outputString.replace(/,\s*$/, ''); + outputString = stripTrailingComma(outputString); outputString = `const ${getImageType()} ${ getIdentifier() @@ -944,7 +991,7 @@ function generateOutputString() { } }); - outputString = outputString.replace(/,\s*$/, ''); + outputString = stripTrailingComma(outputString); outputString = `const ${getByteType()} ${ getIdentifier() }Bitmap` @@ -1003,7 +1050,7 @@ function generateOutputString() { outputString += code; }); // Trim whitespace from end and remove trailing comma - outputString = outputString.replace(/,\s*$/g, ''); + outputString = stripTrailingComma(outputString); } } diff --git a/tests/golden/ascii_preview.txt b/tests/golden/ascii_preview.txt new file mode 100644 index 0000000..00f0683 --- /dev/null +++ b/tests/golden/ascii_preview.txt @@ -0,0 +1,25 @@ +// 'test_pattern', 32x24px +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x0f, 0x0f, 0x7f, 0xff, // . . . . # # # # . . . . # # # # . # # # # # # # # # # # # # # # +0x0f, 0x0f, 0xbf, 0xff, // . . . . # # # # . . . . # # # # # . # # # # # # # # # # # # # # +0x0f, 0x0f, 0xdf, 0xff, // . . . . # # # # . . . . # # # # # # . # # # # # # # # # # # # # +0x0f, 0x0f, 0xef, 0xff, // . . . . # # # # . . . . # # # # # # # . # # # # # # # # # # # # +0x0f, 0x0f, 0xf7, 0xff, // . . . . # # # # . . . . # # # # # # # # . # # # # # # # # # # # +0x0f, 0x0f, 0xfb, 0xff, // . . . . # # # # . . . . # # # # # # # # # . # # # # # # # # # # +0x0f, 0x0f, 0xfd, 0xff, // . . . . # # # # . . . . # # # # # # # # # # . # # # # # # # # # +0x0f, 0x0f, 0xfe, 0xff, // . . . . # # # # . . . . # # # # # # # # # # # . # # # # # # # # +0x0f, 0x0f, 0xff, 0x7f, // . . . . # # # # . . . . # # # # # # # # # # # # . # # # # # # # +0x0f, 0x0f, 0xff, 0xbf, // . . . . # # # # . . . . # # # # # # # # # # # # # . # # # # # # +0x0f, 0x0f, 0xff, 0xdf, // . . . . # # # # . . . . # # # # # # # # # # # # # # . # # # # # +0x0f, 0x0f, 0xff, 0xee // . . . . # # # # . . . . # # # # # # # # # # # # # # # . # # # . \ No newline at end of file diff --git a/tests/golden/ascii_preview_arduino.txt b/tests/golden/ascii_preview_arduino.txt new file mode 100644 index 0000000..8be6e07 --- /dev/null +++ b/tests/golden/ascii_preview_arduino.txt @@ -0,0 +1,33 @@ +// 'test_pattern', 32x24px +const unsigned char epd_bitmap_test_pattern [] PROGMEM = { + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # + 0x0f, 0x0f, 0x7f, 0xff, // . . . . # # # # . . . . # # # # . # # # # # # # # # # # # # # # + 0x0f, 0x0f, 0xbf, 0xff, // . . . . # # # # . . . . # # # # # . # # # # # # # # # # # # # # + 0x0f, 0x0f, 0xdf, 0xff, // . . . . # # # # . . . . # # # # # # . # # # # # # # # # # # # # + 0x0f, 0x0f, 0xef, 0xff, // . . . . # # # # . . . . # # # # # # # . # # # # # # # # # # # # + 0x0f, 0x0f, 0xf7, 0xff, // . . . . # # # # . . . . # # # # # # # # . # # # # # # # # # # # + 0x0f, 0x0f, 0xfb, 0xff, // . . . . # # # # . . . . # # # # # # # # # . # # # # # # # # # # + 0x0f, 0x0f, 0xfd, 0xff, // . . . . # # # # . . . . # # # # # # # # # # . # # # # # # # # # + 0x0f, 0x0f, 0xfe, 0xff, // . . . . # # # # . . . . # # # # # # # # # # # . # # # # # # # # + 0x0f, 0x0f, 0xff, 0x7f, // . . . . # # # # . . . . # # # # # # # # # # # # . # # # # # # # + 0x0f, 0x0f, 0xff, 0xbf, // . . . . # # # # . . . . # # # # # # # # # # # # # . # # # # # # + 0x0f, 0x0f, 0xff, 0xdf, // . . . . # # # # . . . . # # # # # # # # # # # # # # . # # # # # + 0x0f, 0x0f, 0xff, 0xee // . . . . # # # # . . . . # # # # # # # # # # # # # # # . # # # . +}; + +// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 400) +const int epd_bitmap_allArray_LEN = 1; +const unsigned char* epd_bitmap_allArray[1] = { + epd_bitmap_test_pattern +}; diff --git a/tests/golden/ascii_preview_bytes_per_row_ignored.txt b/tests/golden/ascii_preview_bytes_per_row_ignored.txt new file mode 100644 index 0000000..00f0683 --- /dev/null +++ b/tests/golden/ascii_preview_bytes_per_row_ignored.txt @@ -0,0 +1,25 @@ +// 'test_pattern', 32x24px +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x33, 0x33, 0x00, 0xff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xcc, 0xcc, 0x00, 0xff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x0f, 0x0f, 0x7f, 0xff, // . . . . # # # # . . . . # # # # . # # # # # # # # # # # # # # # +0x0f, 0x0f, 0xbf, 0xff, // . . . . # # # # . . . . # # # # # . # # # # # # # # # # # # # # +0x0f, 0x0f, 0xdf, 0xff, // . . . . # # # # . . . . # # # # # # . # # # # # # # # # # # # # +0x0f, 0x0f, 0xef, 0xff, // . . . . # # # # . . . . # # # # # # # . # # # # # # # # # # # # +0x0f, 0x0f, 0xf7, 0xff, // . . . . # # # # . . . . # # # # # # # # . # # # # # # # # # # # +0x0f, 0x0f, 0xfb, 0xff, // . . . . # # # # . . . . # # # # # # # # # . # # # # # # # # # # +0x0f, 0x0f, 0xfd, 0xff, // . . . . # # # # . . . . # # # # # # # # # # . # # # # # # # # # +0x0f, 0x0f, 0xfe, 0xff, // . . . . # # # # . . . . # # # # # # # # # # # . # # # # # # # # +0x0f, 0x0f, 0xff, 0x7f, // . . . . # # # # . . . . # # # # # # # # # # # # . # # # # # # # +0x0f, 0x0f, 0xff, 0xbf, // . . . . # # # # . . . . # # # # # # # # # # # # # . # # # # # # +0x0f, 0x0f, 0xff, 0xdf, // . . . . # # # # . . . . # # # # # # # # # # # # # # . # # # # # +0x0f, 0x0f, 0xff, 0xee // . . . . # # # # . . . . # # # # # # # # # # # # # # # . # # # . \ No newline at end of file diff --git a/tests/golden/ascii_preview_horizontal565.txt b/tests/golden/ascii_preview_horizontal565.txt new file mode 100644 index 0000000..291b2d2 --- /dev/null +++ b/tests/golden/ascii_preview_horizontal565.txt @@ -0,0 +1,25 @@ +// 'test_pattern', 32x24px +0xf800, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x1082, 0x2104, 0x3186, 0x4228, 0x52aa, 0x632c, 0x73ae, 0x8c51, 0x9cd3, 0xad55, 0xbdd7, 0xce79, 0xdefb, 0xef7d, 0xffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # . # # # # # # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # . # # # # # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # . # # # # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # . # # # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # . # # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # . # # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # # . # # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # # # . # # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # # # # . # # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # # # # # . # # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, // . . . . . . . . . . . . # # # # # # # # # # # # # # . # # # # # +0xf800, 0xf800, 0xf800, 0xf800, 0x07e0, 0x07e0, 0x07e0, 0x07e0, 0x001f, 0x001f, 0x001f, 0x001f, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, 0x001f // . . . . . . . . . . . . # # # # # # # # # # # # # # # . # # # . \ No newline at end of file diff --git a/tests/golden/ascii_preview_horizontal888.txt b/tests/golden/ascii_preview_horizontal888.txt new file mode 100644 index 0000000..8d1f4e4 --- /dev/null +++ b/tests/golden/ascii_preview_horizontal888.txt @@ -0,0 +1,25 @@ +// 'test_pattern', 32x24px +0x00ff0000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // . . # # . . # # . . # # . . # # . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00111111, 0x00222222, 0x00333333, 0x00444444, 0x00555555, 0x00666666, 0x00777777, 0x00888888, 0x00999999, 0x00aaaaaa, 0x00bbbbbb, 0x00cccccc, 0x00dddddd, 0x00eeeeee, 0x00ffffff, // # # . . # # . . # # . . # # . . . . . . . . . . # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # . # # # # # # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # . # # # # # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # . # # # # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # . # # # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # . # # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # . # # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # # . # # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # # # . # # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # # # # . # # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # # # # # . # # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, // . . . . . . . . . . . . # # # # # # # # # # # # # # . # # # # # +0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00000000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x000000ff // . . . . . . . . . . . . # # # # # # # # # # # # # # # . # # # . \ No newline at end of file diff --git a/tests/golden/output_adafruit_gfx.txt b/tests/golden/output_adafruit_gfx.txt index f8c637a..68216c2 100644 --- a/tests/golden/output_adafruit_gfx.txt +++ b/tests/golden/output_adafruit_gfx.txt @@ -1,4 +1,4 @@ -const unsigned char epd_bitmapBitmap [] PROGMEM = { +const unsigned char epd_bitmap_Bitmap [] PROGMEM = { // 'test_pattern', 32x24px 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, @@ -8,12 +8,12 @@ const unsigned char epd_bitmapBitmap [] PROGMEM = { 0x0f, 0x0f, 0xff, 0x7f, 0x0f, 0x0f, 0xff, 0xbf, 0x0f, 0x0f, 0xff, 0xdf, 0x0f, 0x0f, 0xff, 0xee }; -const GFXbitmapGlyph epd_bitmapGlyphs [] PROGMEM = { +const GFXbitmapGlyph epd_bitmap_Glyphs [] PROGMEM = { { 0, 32, 24, 0, '0' }// 'test_pattern' }; -const GFXbitmapFont epd_bitmapFont PROGMEM = { - (uint8_t *)epd_bitmapBitmap, - (GFXbitmapGlyph *)epd_bitmapGlyphs, +const GFXbitmapFont epd_bitmap_Font PROGMEM = { + (uint8_t *)epd_bitmap_Bitmap, + (GFXbitmapGlyph *)epd_bitmap_Glyphs, 1 }; diff --git a/tests/golden/output_adafruit_gfx_esp32.txt b/tests/golden/output_adafruit_gfx_esp32.txt index dc7d45a..21ed39f 100644 --- a/tests/golden/output_adafruit_gfx_esp32.txt +++ b/tests/golden/output_adafruit_gfx_esp32.txt @@ -1,4 +1,4 @@ -const uint8_t epd_bitmapBitmap [] = { +const uint8_t epd_bitmap_Bitmap [] = { // 'test_pattern', 32x24px 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, @@ -8,12 +8,12 @@ const uint8_t epd_bitmapBitmap [] = { 0x0f, 0x0f, 0xff, 0x7f, 0x0f, 0x0f, 0xff, 0xbf, 0x0f, 0x0f, 0xff, 0xdf, 0x0f, 0x0f, 0xff, 0xee }; -const GFXbitmapGlyph epd_bitmapGlyphs [] = { +const GFXbitmapGlyph epd_bitmap_Glyphs [] = { { 0, 32, 24, 0, '0' }// 'test_pattern' }; -const GFXbitmapFont epd_bitmapFont = { - (uint8_t *)epd_bitmapBitmap, - (GFXbitmapGlyph *)epd_bitmapGlyphs, +const GFXbitmapFont epd_bitmap_Font = { + (uint8_t *)epd_bitmap_Bitmap, + (GFXbitmapGlyph *)epd_bitmap_Glyphs, 1 }; diff --git a/tests/golden/output_arduino_single.txt b/tests/golden/output_arduino_single.txt index 44ca337..633ec37 100644 --- a/tests/golden/output_arduino_single.txt +++ b/tests/golden/output_arduino_single.txt @@ -1,4 +1,4 @@ -const unsigned char epd_bitmap [] PROGMEM = { +const unsigned char epd_bitmap_ [] PROGMEM = { // 'test_pattern', 32x24px 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, diff --git a/tests/golden/output_arduino_single_esp32.txt b/tests/golden/output_arduino_single_esp32.txt index 400c530..55e7fc0 100644 --- a/tests/golden/output_arduino_single_esp32.txt +++ b/tests/golden/output_arduino_single_esp32.txt @@ -1,4 +1,4 @@ -const uint8_t epd_bitmap [] = { +const uint8_t epd_bitmap_ [] = { // 'test_pattern', 32x24px 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0x33, 0x33, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, 0xcc, 0xcc, 0x00, 0xff, diff --git a/tests/test_conversions.py b/tests/test_conversions.py index a26d268..7f9ac36 100644 --- a/tests/test_conversions.py +++ b/tests/test_conversions.py @@ -46,6 +46,8 @@ BASE_SETTINGS = { "prefix": "0x", "separator": ", ", "esp32Format": False, + "bytesPerRow": 16, + "showAsciiPreview": False, } OUTPUT_FORMAT_IDS = { @@ -104,6 +106,27 @@ SCENARIOS = [ ("dithering_threshold_low", {"ditheringThreshold": 64}, None), ("dithering_threshold_high", {"ditheringThreshold": 200}, None), ("bitswap", {"bitswap": True}, None), + ("ascii_preview", {"showAsciiPreview": True}, None), + ( + "ascii_preview_bytes_per_row_ignored", + {"showAsciiPreview": True, "bytesPerRow": 3}, + None, + ), + ( + "ascii_preview_horizontal565", + {"showAsciiPreview": True, "drawMode": "horizontal565"}, + None, + ), + ( + "ascii_preview_horizontal888", + {"showAsciiPreview": True, "drawMode": "horizontal888"}, + None, + ), + ( + "ascii_preview_arduino", + {"showAsciiPreview": True, "outputFormat": "arduino"}, + None, + ), ("remove_zeroes_commas", {"prefix": "", "separator": ""}, None), # scale=1 (original) on a canvas larger than the image so the # background actually shows through in the margins. @@ -207,6 +230,8 @@ def apply_settings(page, settings): set_checkbox(page, "#bitswap", settings["bitswap"]) page.fill("#prefix", settings["prefix"]) page.fill("#separator", settings["separator"]) + page.fill("#bytesPerRow", str(settings["bytesPerRow"])) + set_checkbox(page, "#showAsciiPreview", settings["showAsciiPreview"]) # esp32Format checkbox only exists in the DOM (visible) for non-plain # output formats; plain output has no type/PROGMEM declarations to affect. if settings["outputFormat"] != "plain": @@ -237,12 +262,18 @@ def roundtrip_eligible(settings): "Paste byte array" box: other draw modes aren't supported by the parser, bitswap mangles the byte stream with no importer to undo it, and the parser splits bytes on commas, so a separator without one (e.g. the - empty string used to strip formatting) can't be read back.""" + empty string used to strip formatting) can't be read back. showAsciiPreview + and a non-default bytesPerRow are excluded too: run_roundtrip reloads a + fresh page and never restores those two, so the re-exported text would use + default formatting and not textually match the original even though the + underlying pixel data round-trips fine.""" return ( settings["drawMode"] in ("horizontal1bit", "vertical1bit") and settings["outputFormat"] == "plain" and not settings["bitswap"] and "," in settings["separator"] + and not settings["showAsciiPreview"] + and settings["bytesPerRow"] == BASE_SETTINGS["bytesPerRow"] )