From: Sven S. <sv...@it...> - 2003-07-22 19:16:47
|
MC Gnoyek wrote: > Is there any better way to resolve width and height of rotated > bitmap? It's probably safer to use the exact same function as Allegro: since your code uses another algorithm (e.g., the inaccurate fixsin/fixcos rather than math.h's sin/cos), it is likely that it differs by a pixel or so from what is actually being drawn. The function you are looking for is called _rotate_scale_flip_coordinates() and is defined in allegro/src/rotate.c. It computes the coordinates in the destination bitmap of the sprite's corners as fixed point values, so to get the bounding box you should take the min and max x and y coordinates among these, and round them towards the closest integer (eg., using fixtoi()). This does not take clipping in the destination bitmap into account. It's considered an internal function, so you need to #include <allegro/aintern.h>. -- Sven |