Re: [AD] rgb_to_color

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


Chris wrote:

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.

I don't think it's all that useful, but if you were to add such a function, you could use the _rgb_scale_6[] table instead of 255/63.

Peter




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