Re: [AD] image loading flags

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


On Thu, Jun 16, 2011 at 4:00 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> Why does the distinction matter?

Ultimately we can live with it so it doesn't matter, but it's ugly and a
source of confusion.  I remember having to clarify on a.cc that
NO_PREMULTIPLIED_ALPHA actually only affects loading, that there no
special type of bitmap with that flag set.  It's easy to build up the
wrong model in your head.  That should at least be solved by distinctly
separating the different kinds of flags in the documentation.

Since I wrote the original message, I remembered that the font addons do
check the NO_PREMULTIPLIED_ALPHA flag to infer what kind of blending you
expect to use.  I haven't thought of a solution for that.


al_load_font, al_load_ttf_font and al_load_ttf_font_f already have a flags parameter (do we not have an al_load_font_f function btw.?). We likely could replace the above mechanism with a new font loading flag there.

Reminds me, I might want another flag there to provide a way to have 8-bit textures for fonts, reduces memory used up by fonts by 75%. Likely just al_set_new_bitmap_format(AL_P_F_LUMINANCE_8) before loading the font and then later al_set_blender(ADD, ONE, ONE_MINUS_SRC_COLOR) should do the trick - needs yet another blending mode similar to the one Jon recently added... but I digress...

Anyway, I think instead of adding these 13 (14?) new functions:

al_load_bitmap_flags
al_load_bitmap_flags_f
al_load_bitmap_font_flags
(al_load_bitmap_font_flags_f) why do we not have al_load_bitmap_font_f?
al_load_bmp/jpg/pcx/png/tga_flags
al_load_bmp/jpg/pcx/png/tga_flags_f
 
We should either add a new

void al_set_new_bitmap_loading_flags(int flags)

or simply live with having mixed up two different kinds of flags in al_set_new_bitmap_flags and as you said, distinguish them in the documentation into permanent flags and load-time flags.

I'd probably just add a flags parameter to all the existing bitmap load functions (and yes, it would mean when upgrading your sources from 5.0 to 5.2 you'd have to spend 10 minutes going through all the missing parameter errors and add the flag).


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