You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Thanks - those links look really neat - looks like ST7301/ST7303 should also be capable of greyscale. I guess given these are only on aliexpress and not eBay yet they must be quite new, but it sure sounds from that presentation like we should see a lot more screens appearing soon (although that's dated 2018!).

    How does the display actually look compared to something like a Memory LCD? Does it look just like a 'normal' black and while LCD like you might find on the Pixl, just it's super low power?

    I'm sure there are some hacks we can do to get the data in the right format - for instance I think this should work - although not having a display here at the moment I can't be sure:

    g = Graphics.createArrayBuffer(250,128,1,{msb:true});
    
    g.flip = function() {
      function interleave(x) { "jit"
        // We have a 24 bit number, which is the 2x columns of 12 pixels
        // If we can interleave them, we should be good, so use:
        // https://graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN
        var y = x>>12;
        x = x&0xFFF;
        x = (x | (x << 8)) & 0xFF00FF;
        x = (x | (x << 4)) & 0x0F0F0F;
        x = (x | (x << 2)) & 0x333333;
        x = (x | (x << 1)) & 0x555555;
        y = (y | (y << 8)) & 0xFF00FF;
        y = (y | (y << 4)) & 0x0F0F0F;
        y = (y | (y << 2)) & 0x333333;
        y = (y | (y << 1)) & 0x555555;
        return x | (y << 1);
      }
      var t = Graphics.createArrayBuffer(12,250,1,{msb:true});
      t.setRotation(1);
      for (var y=0;y<122;y+=12) {
        t.drawImage(g,0,-y);
        var b = new Uint24Array(t.buffer);
        E.mapInPlace(b,b,interleave);
        // output t.buffer
      }
    };
    

    Having said that, even that takes 2.5 sec to render (0.5s is drawImage). How fast is your current code with the inline c?

    You could do a similar thing without the intermediate image, using a graphics with vertical_byte and then inline C to take two columns of 12 pixels and interleave them, but that still means having to use inline C so it's not that much better than your current solution (if at all).

    I should add that if JIT gets better (for example by handling integer operations as ints rather than by sending them off to the JS maths lib) the code above should work quite well. It's just not great at the moment

About

Avatar for Gordon @Gordon started