[AD] bitmap helper methods

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


Ive been thinking about adding this for a while and dont really know they dont exist already. Ive attached two methods, get_width and get_height, that simply return bmp->x and bmp->h. I think these methods( and more in the future if you accept these two ) are useful for two reasons: 1. I dont think its obvoius enough to the newbie programmer what bmp->x and bmp->y are. Many other graphics libraries have a get_width() type method and dont require the programmer to access the data directly. 2. There is talk around my university about writing an interface from plt scheme to Allegro. It can only really work with methods to access data. I imagine other languages need to write small interfaces for extracting this information as well. If these methods dont exist in Allegro, we'll probably just use SDL, and I cant have that!

If you guys agree with me I will write the rest of the methods for accessing the internals of the bitmap object and possibly other structures.
--- gfx.inl.old	2004-11-07 22:54:08.000000000 -0500
+++ gfx.inl	2004-11-07 22:56:13.000000000 -0500
@@ -214,6 +214,15 @@
    acquire_bitmap(screen);
 })
 
+AL_INLINE(int, get_width, (BITMAP * bmp),
+{
+	return bmp->x;
+}
+
+AL_INLINE(int, get_height, (BITMAP * bmp),
+{
+	return bmp->h;
+}
 
 AL_INLINE(void, release_screen, (void),
 {


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