You are reading a single comment by @d3nd3-o0 and its replies. Click here to read the full conversation.
  • 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 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))

        JsVar *buf = jsvObjectGetChild(image, "buffer", 0);
        info->buffer = jsvGetArrayBufferBackingString(buf);
        jsvUnLock(buf);
        info->bitmapOffset = imageOffset;
    

    compared to @_jswrap_graphics_parseImage for else if (jsvIsString(image)

    info->bitmapOffset += info->headerLength;
    // modify image start
    info->headerLength += (unsigned short)(paletteEntries*2);
    info->bitmapOffset += (unsigned short)(paletteEntries*2);
    

    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.

About

Avatar for d3nd3-o0 @d3nd3-o0 started