sumotoy / RA8875

A library for RAiO RA8875 display driver for Teensy3.x or LC/Arduino's/Energia/Spark
GNU General Public License v3.0
79 stars 55 forks source link

Update RA8875.h #103

Closed M-rTom closed 8 years ago

M-rTom commented 8 years ago

Convert 16 bit color to 8 bit color while not discarding any bits. Keeps the ratios of brightness for each color and translates them into 8 bit.

sumotoy commented 8 years ago

Did you tried at 8bit, with layers on/off? The RA8875 has internal hardware color conversion enabled when it's set at 8bpp mode, to be honest, I don't tried yet your solution.

M-rTom commented 8 years ago

Yes, I've tried it with 8bit color and layers on. Works like a champ now. I tried to use the drawPixel with layers and noticed most of the colors were off. I noticed the bit shifting was removing some of the high bits for each color. So I tried this idea and it works good.

The theory is to keep the levels of each R G B and scale it down to a smaller scale. So if you have 16% red, 20% green, and 50% blue, it keeps that ratio and translates it to the smaller 8 bit. Should be a good solution, but I was on my 10th Heineken by the time I was done with it. :)