Re: [AD] clipping, sub bitmaps |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
- To: "Coordination of admins/developers of the game programming library Allegro" <alleg-developers@xxxxxxxxxx>
- Subject: Re: [AD] clipping, sub bitmaps
- From: "Trent Gamblin" <trent@xxxxxxxxxx>
- Date: Sat, 15 Aug 2009 17:51:55 -0600 (MDT)
On Sat, August 15, 2009 5:27 pm, Matthew Leverton said:
> Any comments? It would be very useful if supported. I removed clipping
> from the sub bitmap code and tested out:
Let me see if I follow.
> ~~
> 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));
We now have
RR
RW
> 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);
We now have
WR
RW
>
> // 2) should effectively draw only a red square on TL quadrant of screen
> // al_draw_bitmap(src, 320,240, 0);
Now if I'm reading this right we should still have
WR
RW
With only the top quadrant actually redrawn (with the same color).
Might be wrong... the direct3d driver appears to do just that anyway.
Trent :-)