Re: [AD] v/h flip for draw_lit/trans

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




Elias Pschernig wrote:
On Mon, 2007-03-05 at 19:47 -0500, Jon Rafkind wrote:
I wanted to use draw_lit_h_flip_sprite today but realized it doesn't exist. I suppose in the mean time I can make a new bitmap, draw_sprite_h_flip and draw_lit that but I would rather have a native draw_lit_h_flip_sprite or something similar.

I believe that's the usual answer we had when someone wanted to do this,
in the past.

Actually its probably not worth adding *_h/f/rotate_sprite for lit and trans routines but rather make draw_sprite respect drawing_mode. I wondered why this is not the case anyway, anyone know why?

Well, the documentation of drawing_mode says: "Sets the graphics drawing
mode. This only affects the geometric routines like putpixel, lines,
rectangles, circles, polygons, floodfill, etc, not the text output,
blitting, or sprite drawing functions."

So, it simply never was meant to do anything to blitting/sprite
functions.. which doesn't mean we can't change the docs. (And deprecate
draw_trans_sprite and draw_lit_sprite then? I always found them
confusing anyway.. but would need to think more if this really would
work out.)

Looking through cspr.c it might be tricky to make fast, non-sucky code that can do normal/lit/trans mode's for all the drawing routines but I'm sure something can be arranged. Perhaps the code could be auto-generated or something. Just wanted to bring it up before I submit a patch of sorts.


Not sure if it's better to fill in extra functions, use drawing_mode, or
do something else. If your patch fits properly into the API (not hard
with 4.2 :P), I don't see why it shouldn't be applied.

Actually I had a different idea last night that I have been hacking on and will send in a patch shortly. Basically there is a new function, draw_sprite_ex, which accepts a mode parameter( SPRITE_NORMAL, SPRITE_LIT, SPRITE_TRANS ) which will either draw normally or user DLS_BLENDER/DTS_BLENDER. SPRITE_LIT will respect _blender_alpha like draw_trans does which means that 8-bit compatibility is out, but for 8-bit people can just use draw_lit_sprite.

This will work for all the draw_sprite_* routines, draw_sprite_h_flip_ex, draw_sprite_v_flip_ex, etc. So far I have changed draw_sprite_ex and it works fine. Its a bit of a pain to add all these routines due to all the levels of indirection but I'll do them all today at some point.

This is all based on the fact that its ok to add entries to the end of the vtable. Is this ok to do?




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