07-20-2023, 01:46 AM
(07-19-2023, 02:37 AM)WhiteHexagon Wrote: Colors: There is a mysterious difference between the canvas2d and PP, possibly just the red and blue reversed.
Yep the colours for PinePhone vs JavaScript Canvas are swapped, probably ARGB vs RGBA. We should swap the colour bytes here:
https://github.com/lupyuen/pinephone-lvg...js#L41-L50
Code:
// Load the WebAssembly Pointer into a JavaScript Image Data
const imageDataArray = new Uint8Array(memory.buffer, ptr, len)
imageData.data.set(imageDataArray);
// TODO: Swap the Colour Bytes (ARGB vs RGBA)
// Render the Image Data to the HTML Canvas
context.clearRect(0, 0, canvas.width, canvas.height);
context.putImageData(imageData, 0, 0);
To use multiple fonts, check out the LVGL Widgets Demo:
https://github.com/lupyuen2/wip-pinephon...#L172-L187