Re: [AD] A silly question

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> the following property: white, i.e RGB(0x1f, 0x1f, 0x1f) is mapped to
index
> 246.


>
> Now index 246 is RGB(0x3f, 0x3f, 0x3c), that is roughly but not white
> (moreover, 0x3c >>1 is not equal to 0x1f). It's not very nice to have such
a

The 15-bit white (1f,1f,1f)  is equivalent to RGB(3e,3e,3e) if the low bit
is cleared.
3f,3f,3c is the closest to this in your palette.

The create_rgb_table should be modified to assume the low bit is set when
making the comparison.

color.c
---
   #define pos(r, g, b) \
       (((r) / 2) * 32 * 32 + ((g) / 2) * 32 + ((b) / 2))
+++
   #define pos(r, g, b) \
         (  (((r)==0x3f) ? 0x1f : ((r)+1) / 2) ) * 32 *32 + \
            (((g)==0x3f) ? 0x1f : ((g)+1) / 2) * 32 + \
            (((b)==0x3f) ? 0x1f : ((b)+1) / 2) )

that's what i'd try to fix it first, but i'll look for solutions which don't
slow it down

Matt



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/