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.
Here is an implementation of D3DXGetImageInfoFromFileInMemory using FreeImage.
Is the license compatible? FreeImage is dual-licensed with the GPL (which Wine cannot use) and their own license. I'd be surprised if their license were LGPL compatible. --Juan
Juan Lang a écrit :
Here is an implementation of D3DXGetImageInfoFromFileInMemory using FreeImage.
Is the license compatible? FreeImage is dual-licensed with the GPL (which Wine cannot use) and their own license. I'd be surprised if their license were LGPL compatible. --Juan
There is no need to include it in wine's git. Using it as an external library is sufficient. wine uses other libraries which are GPL-ed.
BTW, their home-made license looks quite permissive.
2008/8/28 Jérôme Gardou jerome.gardou@gmail.com:
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.
I'm not sure it would be worth it. The only non-trivial formats I see in D3DXIMAGE_FILEFORMAT are JPEG and PNG, and we already link to libjpeg and libpng in other parts of Wine.
Henri Verbeet a écrit :
2008/8/28 Jérôme Gardou jerome.gardou@gmail.com:
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.
I'm not sure it would be worth it. The only non-trivial formats I see in D3DXIMAGE_FILEFORMAT are JPEG and PNG, and we already link to libjpeg and libpng in other parts of Wine.
If you want, I have an implementation of this same function for png... This one is not commented at all, and need some rework. Get it for comparison.
Jérôme Gardou a écrit :
Henri Verbeet a écrit :
2008/8/28 Jérôme Gardou jerome.gardou@gmail.com:
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.
I'm not sure it would be worth it. The only non-trivial formats I see in D3DXIMAGE_FILEFORMAT are JPEG and PNG, and we already link to libjpeg and libpng in other parts of Wine.
If you want, I have an implementation of this same function for png... This one is not commented at all, and need some rework. Get it for comparison.
With the patch...
2008/8/29 Jérôme Gardou jerome.gardou@gmail.com:
If you want, I have an implementation of this same function for png... This one is not commented at all, and need some rework. Get it for comparison.
As you said, it needs some cleanup etc, but at least it doesn't look fundamentally broken to me. I'm not quite sure what the decompression stuff in D3DXGetImageInfoFromFileW() is supposed to do though.
Henri Verbeet a écrit :
2008/8/29 Jérôme Gardou jerome.gardou@gmail.com:
If you want, I have an implementation of this same function for png... This one is not commented at all, and need some rework. Get it for comparison.
As you said, it needs some cleanup etc, but at least it doesn't look fundamentally broken to me. I'm not quite sure what the decompression stuff in D3DXGetImageInfoFromFileW() is supposed to do though.
Me neither... I should use CreateFile instead... I will clean it up. I guess I will have to write a test case for this...
Henri Verbeet a écrit :
2008/8/29 Jérôme Gardou jerome.gardou@gmail.com:
If you want, I have an implementation of this same function for png... This one is not commented at all, and need some rework. Get it for comparison.
As you said, it needs some cleanup etc, but at least it doesn't look fundamentally broken to me. I'm not quite sure what the decompression stuff in D3DXGetImageInfoFromFileW() is supposed to do though.
Here is a new one, slightly cleaned up and without this crappy decompression stuff.