Re: [AD] rgb_to_color

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


On Tue,  2 Nov 2004 11:31:34 +0100, Evert Glebbeek <eglebbk@xxxxxxxxxx> wrote:
> Wouldn't this just be a one-line wrapper around makecol? Not that I'm
> opposed to the idea, but is it really that important to have a seperate
> function for it?

Besides having to deal with 6-bit to 8-bit issues, it could also be
useful to specify a depth. like so:

static inline int rgb_to_color(RGB *rgb, int depth)
{
   return makecol_depth(depth, rgb->r*255/63, rgb->g*255/63, rgb->b*255/63);
}

Simple, yet not quite as simple as it would initially seem. Most would
only use <<2 and be stuck with improper scaling.

- Kitty Cat




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