D3DX supports a wide range of file types for textures. Instead of
rewriting everything from scratch, the best would certainly be to use
some image processing library to handle them. As a bonus, this would
allow lighter code.
Some of those library are :
SDL_Image : easy to use, but loading an image using a SDL_Surface is
quite heavy. Moreover, the files supported are not enough for d3dx.
MagickWand/MagickCore, the libraries on which imagemagick is based :
Hard to use, and very heavy. Supports every format thet d3dx supports.
FreeImage : Quite easy to use, the only files not supported are DIB and
PFM... Not so widely represented. I had to recompile it, as packages for
it are not available for 32 bits. (I use a 64 bits ubuntu system).
Here is an implementation of D3DXGetImageInfoFromFileInMemory using
FreeImage.
Suggestions and comments are welcomed.
PS : Please CC me your potential answers, as I'm not a subscriber of
this list.