01-17-2023, 10:40 AM
(01-17-2023, 09:41 AM)mnrvovrfc Wrote: Otherwise it would be easy to remap a register from 0-255 for "_RGB32" to 0-63 for "PALETTE", just divide by four.
Divide by 4 doesn't quite do it.
0 * 4 = 0
63 * 4 = 252
A change by 4 only gives you a color range from 0 to 252, making color values with 253, 254, 255, impossible to account for properly.
What you'd have to do is multiply by 63/255 (or 255/63 to go in the other direction).
0 * (255 / 63) = 0
63 * (255 /63) = 255
Full range of 0 to 255 RGB colors.
And going in reverse:
0 * (63/255) = 0
255 * (63/255) = 63
Full range of 0 to 63 DAC color values.