Re: [AD] interpolating rotation routines |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
David Kühling <dvdkhlng@xxxxxxxxxx> wrote:
>
> During development I noticed that `makecol' sometimes returns strange
> colors in 8bit mode. Try the program `maybebug.c', included in the
> attached archive and you'll see what I mean. That program tries to
> generate gradients from red, green and blue to white. For some reason the
> blue->white gradient contains some very dark colors. This occured with
> version 3.9.30 and 3.9.31.
I investigated this a little, and here are some of the (incorrect) results
I got with your program.
127 -> ( 0, 28, 113), ( 28, 28, 255)
128 -> ( 56, 56, 113), ( 44, 44, 255)
7 -> (170, 170, 170), (164, 164, 255)
The left number is the colour index returned by makecol(), followed by its
RGB values, then the RGB values that were requested.
As you can see, the results are heavily skewed in favour of the green
component. From src/color.c:
static void bestfit_init()
{
int i;
for (i=1; i<64; i++) {
int k = i * i;
col_diff[0 +i] = col_diff[0 +128-i] = k * (59 * 59); /* g */
col_diff[128+i] = col_diff[128+128-i] = k * (30 * 30); /* r */
col_diff[256+i] = col_diff[256+128-i] = k * (11 * 11); /* b */
}
}
I don't know where Shawn got 59, 30 and 11 from, but they seem just a
little *too* biased towards green and red.
Anyway, that's just my understanding of it.
Peter
--
tjaden@xxxxxxxxxx - http://www.psynet.net/tjaden/
~/.signature: No such pretence