Re: [AD] native image loaders

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


On Fri, 2010-04-09 at 17:33 -0500, Matthew Leverton wrote:
> I'm ready to integrate the GDI+ image loading and saving routines.
> However, first I think we need to come to a final determination on how
> images should be handled. The main question is whether or not the
> image addon should be modular like the audio codec one. e.g., should
> there be:
> 
> allegro_image (any native format that requires no external dependencies)
> allegro_jpeg => libjpeg or apple loader or GDI+
> allegro_png => libpng or apple loader or GDI+
> allegro_gif => GDI+
> allegro_tiff => GDI+
> ...

I wouldn't see it as a big problem... and it would be consistent with
how our audio addons work. But then again I don't think it's necessary.

> That could get ugly, especially as there is overlap between back-end
> libraries. And if you had allegro_gdi, that would duplicate
> functionality of allegro_jpeg. (I think there are fewer commonly used
> audio codecs... or at least, their differences are more well defined.)
> 
> Right now, it's less than ideal because (e.g.) al_load_jpg is always
> present in the header, even if it's not compiled in. But that can be
> fixed regardless.
> 
> What about just getting rid of the functions like al_load_png,
> al_load_jpg, etc in favor of simply:
> 
> al_load_bitmap(filename, const char *type)
> 
> * if type is null, auto detect based on extension
> 
> al_load_bitmap_f(filename, const char *type)
> 
> * type is required

al_load_bitmap_f already works exactly like that.

> Or even:
> 
> al_load_bitmap_type(filename, const char *type)
> 
> and keep al_load_bitmap() as is.

I think I prefer that.

> GDI+ supports PNG, JPEG, TIFF, GIF, and BMP.
> 

UIImage (what we use on IPhone OS) supports all of those as well and
likely same is true for the OSX version.

> Personally, I never use the direct functions and find the myriad of
> function names to be rather ugly.

What about the save functions? I guess we could just have the same three
functions you suggested for loading:

al_save_bitmap(bitmap, name)
al_save_bitmap_type(bitmap, name, type)
al_save_bitmap_f(bitmap, name, type, file)

(Also, why do our current al_save_bitmap functions have the parameters
swapped?)

> ---
> 
> Would it be possible to give people the choice of a) including
> JPEG/PNG as part of the core image or b) as a separate addon? e.g.,
> allegro_image would always have the same, well-defined external
> symbols: al_init_image_addon, al_load/save_bitmap, and
> al_load/save_bitmap_f. Support for JPEG may or may not be included.
> Same could go for audio. But you could always create allegro_jpeg,
> allegro_modaudio, etc if you wanted those features to be optional.
> 
> Just throwing out ideas...
> 

At the time A5 is compiled this already is possible (e.g. on IPhone you
get to choose if you load .png with libpng or the Apple loader). Seems
to be enough to me.

-- 
Elias Pschernig <elias.pschernig@xxxxxxxxxx>





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