Re: [AD] Proposal for first step towards new api

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


Peter Wang <tjaden@xxxxxxxxxx> writes:

> On 2001-12-18, Sven Sandberg <svsa1977@xxxxxxxxxx> wrote:
> 
> > Is `xor_mode()' still useful? I don't mean we should remove the ability
> > to draw xor'ed, I mean we should force people who draw xor'ed to use
> > `drawing_mode()', because I think it is a too uncommon thing to do to
> > have a shortcut for it.
> 
> I hope it gets removed.
> 
> I'd also like to remove `drawing_mode' completely, and only support
> what are currently DRAW_MODE_SOLID and DRAW_MODE_TRANS.  But I'm
> biased because I never used the XOR or pattern drawing modes.

Maybe we can use something like GC, DC, ROP etc.  I.e. drawing mode is
described by some parameter passed to the function.  Or we can
'select' drawing mode into AL_BITMAP, and all drawing primitives will
use drawing mode defined in bitmap.  We can simply change VTABLE in
AL_BITMAP.

Advantages

1. easy to extend drawing modes;
2. no conditional execution in drawing primitives, just make a call
   through vtable;
3. drawing modes do not add globals.

Disadvantages

1. it is harder to switch drawing modes for several bitmaps, but I
   don't think it is very useful anyway (drawing to several bitmaps at
   once);
2. AL_VTABLE should be fixed to allow addons.  Or we can provide
   function which will build AL_VTABLE, by calling function supplied
   by addon with identifier of drawing primitive and it will return
   pointer to new drawing function or 0 for unsupported/unrecognized
   primitive.

typedef void* AL_DRAWING_MODE; /* Maybe AL_VTABLE* or ...?  */

AL_DRAWING_MODE al_set_xor_mode (AL_BITMAP *bmp);
AL_DRAWING_MODE al_set_drawing_mode (AL_BITMAP *bmp, AL_DRAWING_MODE mode);
...
AL_DRAWING_MODE al_create_drawing_mode (void *(*fun) (int id));
void al_destroy_drawing_mode (AL_DRAWING_MODE mode);

#define AL_DRAW_HLINE           1
#define AL_DRAW_SOMETHING_ELSE  2
...

-- 
Michael Bukin



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