You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I'm not quite sure I understand what you want to do - you want to just copy the 'old' buffer back into m?

    I think the issue is that the image buffer itself has a really strange pixel order (because of the zigzag:true needed when sending to the LEDs, and also the setRotation(1)). You're then using that as data for drawImage which expects the data to be in a simple scanline format, and not rotated.

    If you do just want to restore the old data, try:

    var m = Graphics.createArrayBuffer(16,8,24,{zigz­ag:true});
    m.flip = function(){ SPI2.send4bit(m.buffer, 0b0001, 0b0011); };
    var mCopy = Graphics.createArrayBuffer(16,8,24,{zigz­ag:true});
    
    // save data away
    mCopy.buffer.set(m.buffer);
    // copy it back
    m.buffer.set(mCopy.buffer);
    

    That should work, and would be way faster as it just copies the raw data rather than trying to encode/decode it into pixels.

About

Avatar for Gordon @Gordon started