As far as I can see, possible bpp values are 1,2,4,8,16,24,32
In set Color bpp of 16,24,32 are handled seperately
All others result in 0 or 0xFFFFFFFF only
Is there a technical reason for that ?
Are you sure about that? Maybe I'm misunderstanding the question.
In 16/24/32 you get R,G and B channels handled separately (if you specify them), but in anything else it's considered that the image is a single channel, so setColor(123) for a BPP of 4 would write the value 123.
Hmmm, may be I'm misunderstanding the answer.
First, setColor(123) sets color correctly to 123.
Why is setColor(0.5.0.5.0.5) not supported for bpp = 8 ?
If this is on purpose a short hint in description would help.
Ahh, ok - yes, It's not supported because there's no standard way of mapping R,G and B to a single 8 bit value (same with 1, 2 and 4 bits). About the only thing you could reliably assume is white being all 1 and black being all 0 (or vice versa) which is what it does.
I've updated the docs here: https://github.com/espruino/Espruino/commit/8ef686d5f405abd5ed76e80dbaa8930c49b94f69
If you have some specific display that works another way, nothing stops you from just overriding setColor with your own implementation though...
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem