RE: [AD] Allegro5 and colors

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


Title: RE: [AD] Allegro5 and colors

AL_COLOR can be a union of all possible "formats" a color can have,
eg:

typedef struct {
  int contents_type;
  union {
    int color;
    struct {
      /* whatever */
    } yuv;
    /* others */
  }
} AL_COLOR;


Then we still have:
void al_putpixel(BITMAP*,int,int,int);

But we add (yeah, more API "bloat" ;)):
void al_putpixel_color(BITMAP*,int,int,AL_CONST AL_COLOR*);

The user is now free, if he knows an AL_COLOR contains a 32 bit
RGB color, to call the former (the existing one), while the
second one will investigate the type of the AL_COLOR struct and
branch to the relevant code (which will be al_putpixel if the
contents are a 32 bit RGB color).

No states for color, please.

--
Vincent Penquerc'h



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