My goal is to have a custom-paletted image larger than RAM to be drawn to screen and for it to be supported by the default upload format for images in Upload a File within the ide. It uses the string format and you have told me that its difficult to have what I want. Yet I have demonstrate that with extract the palette from string and load into memory and use the Object method, I can almost correctly draw images.
The problem that remains :
@_jswrap_graphics_parseImage for if (jsvIsObject(image))
The issue here is that info->buffer = jsvGetArrayBufferBackingString(buf); doesn't respect ArrayBufferViews substring. Or rather that it always takes the 'real' string behind the view of a string. Thus I can't extract just the string data out of the string returned from the require("Storage").read('filename'), forcing me to draw the headerData as pixels, pushing all pixels by 30 or so forward making my images not aligned properly and having weird dots in top row.
I propose that this info->buffer = jsvGetArrayBufferBackingString(buf); could read the real string length and starting position, end position etc.. instead of defaulting to the 'real buffer'.
If thats not what you want to do then I suggest you change the default upload of image converter to use the Object method over the string method, but as I already highlighted, it has to save all pixel/buffer data into one file on its own. The palette data loaded into a flatString, so thats 2 files, one for the image object/palette/header, one for the pixel data. The image object file could load the other file.
I am willing to make these changes to save you the time and effort, if you tell me what you prefer.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Pastebin Code from my latest attempt
Above is a link to code snippet I tried.
My goal is to have a custom-paletted image larger than RAM to be drawn to screen and for it to be supported by the default upload format for images in
Upload a File
within the ide. It uses the string format and you have told me that itsdifficult
to have what I want. Yet I have demonstrate that with extract the palette from string and load into memory and use theObject
method, I canalmost
correctly draw images.The problem that remains :
@_jswrap_graphics_parseImage for
if (jsvIsObject(image))
compared to @_jswrap_graphics_parseImage for
else if (jsvIsString(image)
The issue here is that
info->buffer = jsvGetArrayBufferBackingString(buf);
doesn't respect ArrayBufferViews substring. Or rather that it always takes the 'real' string behind the view of a string. Thus I can't extract just the string data out of the string returned from therequire("Storage").read('filename')
, forcing me to draw the headerData as pixels, pushing all pixels by 30 or so forward making my images not aligned properly and having weird dots in top row.I propose that this
info->buffer = jsvGetArrayBufferBackingString(buf);
could read the real string length and starting position, end position etc.. instead of defaulting to the 'real buffer'.If thats not what you want to do then I suggest you change the default upload of image converter to use the Object method over the string method, but as I already highlighted, it has to save all pixel/buffer data into one file on its own. The palette data loaded into a flatString, so thats 2 files, one for the image object/palette/header, one for the pixel data. The image object file could load the other file.
I am willing to make these changes to save you the time and effort, if you tell me what you prefer.