SDL_image, which formats?

the SDL_image library is pretty encapsulated. i’ve been
wanting a way to get a list of formats that are compiled
into SDL_image. i’ve just gone poking at the code to see
if i could get something useful out of it, but no luck.

either a function that returns a list of strings with
the supported extensions, or maybe a function that takes
an extension and returns if it ‘could’ be loaded or not.
one or both of those would really. either of these would
be pretty easy to do if “#ifdefs” were added into the
"supported" array, so that only compiled in formats were
in the list.

the main reason for this would be so i could do some
better error reporting. “Your compiled version of SDL_image
does not support XXX”, instead of “unsupported image format”

oh, and a quick note about the errors…
i noticed that if there is any sort of error, the SDL error
will always be “Unsupported image format”. The file loaders
do set reasonable errors, but they are later overwritten by
the IMG_LoadTyped_RW function, which always sets its own
error if there was any trouble.

either a function that returns a list of strings with
the supported extensions, or maybe a function that takes
an extension and returns if it ‘could’ be loaded or not.

good idea, I’ll think of something

i noticed that if there is any sort of error, the SDL error
will always be “Unsupported image format”. The file loaders
do set reasonable errors, but they are later overwritten by
the IMG_LoadTyped_RW function, which always sets its own
error if there was any trouble.

I think that has been fixed. Have you tried a recent SDL_image?

“Mattias Engdeg?rd” wrote

i noticed that if there is any sort of error, the SDL error
will always be “Unsupported image format”.

I think that has been fixed. Have you tried a recent SDL_image?

ahyes, i was foolishly looking into SDL_image-1.1, this looks
cleaned up in 1.2