Re: [AD] bitmap helper methods

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


On Sun, 2004-11-07 at 23:04 -0500, Jon Rafkind wrote:
> 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!

Heh, good luck with SDL. Look at some function in the SDL docs:

SDL_Surface *SDL_GetVideoSurface(void);
SDL_VideoInfo *SDL_GetVideoInfo(void);
SDL_Rect **SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);

And it goes like that throughout the lib. About every second function
will return a struct, and you have to access its members. Including
getting with and height of a bitmap :)

Anyway, I don't really see a problem adding them, but OTOH, should we
really clutter up the API with useless accessor functions? This is C,
not C++, after all.

And, as Grzegorz said, there's no problem writing the functions
yourself. (And you have to do the same with SDL.)

-- 
Elias Pschernig





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