A DDS reader in C#, extracted and refactored from igaeditor. With updates found in this gist, to cater for more formats.
The main function of the library is to read a DDS image and convert it to a System.Drawing.Bitmap
object,
using the LoadImage
method of the DDS
class.
It can be used by simply supplying the file path as a string argument.
Bitmap bmp = DDS.LoadImage(@".\textures\sample.dds");
Overloaded versions of LoadImage
exist to load from a byte
array as well as from a Stream
.
Supports DXTn formats only (DXT1, DXT2, DXT3, DXT4, DXT5).
There are no plans to add support for any other formats at this time, but pull requests are always welcome.
au.id.micolous.libs.DDSReader
This library is a DDS image file reader for .NET. It is based on DevIL, ported to native C# code.
Portions of this code are based on il_dds.c from DevIL. il_dds.c is Copyright 2000-2002 Denton Woods, and licensed under the same terms as this library.
This library (DDSReader) is licensed under these terms:
DDSReader
Copyright (c) 2006 - 2007 Michael Farrell (micolous)
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
A full copy of license is included in the file 'LICENSE'.
To speed things up, there is some unsafe code in this program.
If you don't want the unsafe routines, compile with the /define:SAFE_MODE
option, and safe routines will be used instead.
The "safe" routines are very very slow on Microsoft's .NET CLR on Win32,but are still pretty fast on Mono. You have been warned.