Re: [AD] clipping, sub bitmaps

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


On Fri, Aug 7, 2009 at 11:35 PM, Matthew Leverton<meffer@xxxxxxxxxx> wrote:
> Is it feasible to add support to 4.9 that would allow transformations
> to affect all drawing operations? I'm only interested in translations.
>
> Allowing sub-bitmaps to have an origin that is negative would also
> give me what I'm looking for. (Although I think moving the origin via
> a translation would be nicer.)
>

Any comments? It would be very useful if supported. I removed clipping
from the sub bitmap code and tested out:

~~
BITMAP *src = al_create_bitmap(640, 480);
BITMAP *sub = al_create_sub_bitmap(al_get_backbuffer(), -320, -240, 640, 480);

// clear backbuffer
al_set_target_bitmap(al_get_backbuffer());
al_clear_to_color(al_map_rgb(0,0,0));
	
// set src bitmap to white the bottom-right quadrant,
// and red everywhere else
al_set_target_bitmap(src);
al_clear_to_color(al_map_rgb(255,0,0));
al_draw_filled_rectangle(319,239,641,481,al_map_rgb(255,255,255));

al_set_target_bitmap(sub);

// 1) should effectively draw only a white square on TL quadrant of screen
// al_draw_bitmap(src, 0, 0, 0);

// 2) should effectively draw only a red square on TL quadrant of screen
// al_draw_bitmap(src, 320,240, 0);

al_flip_display();
~~

Both tests work in OpenGL (maybe with a slight glitch, but the driver
barely works on my laptop anyway).

The second test fails in D3D, as it draws the entire source bitmap to
the screen, maybe as if the width and height are 640+320 and 480+240
respectively.

Anyway, I'd rather al_create_sub_bitmap() were to fail if the clipping
wasn't supported, rather than silently do strange things.

And in addition to this, I'd like to be able to move transform the
(0,0) origin around.

--
Matthew Leverton




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