g.getPixel

Posted on
  • Why does g.getPixel return the number 215 for a white pixel??
    I was expecting 255, confused about the logic/math behind 215.

  • On Bangle.js, 8 bit images use the Web Safe 216 color palette

    Why are we using 8 bit colors? Is that the max? The LCD specs read 18 bit?
    If we are using 8 bits only per pixel then shouldn't we have double the space on the frame buffer, meaning we could have more than 240x160 pixels in doublebuffer mode?

  • Why does g.getPixel return the number 215 for a white pixel?

    As you noted, it's the 216 color palette. Colour 255 is also white, but if you created the image somewhere else it'll use the first matching colour, which would be 215

    Why are we using 8 bit colors?

    Bangle.js isn't. It uses 16 bit colour - for both the normal 240x240 mode and the 240x160 mode.

    However both of those are stored on the LCD so you can't read back colour.

    If you're planning to do anything in an offscreen buffer there's only 64kB of RAM on the chip in total, so to get more pixels we tend to use 8 bit or lower.

    You could use 16 bit for an offscreen buffer, but you'd only be able to store a very small proportion of the screen

    If we are using 8 bits only per pixel then shouldn't we have double the space on the frame buffer, meaning we could have more than 240x160 pixels in doublebuffer mode?

    Sadly no, the LCD doesn't support re-ordering the memory like that. It has 18 bits per pixel - it doesn't matter if you use that or not.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

g.getPixel

Posted by Avatar for d3nd3-o0 @d3nd3-o0

Actions