diff --git a/CSharpImageLibrary/Build Nuget.bat b/CSharpImageLibrary/Build Nuget.bat index 5d39775..79a3a4b 100644 --- a/CSharpImageLibrary/Build Nuget.bat +++ b/CSharpImageLibrary/Build Nuget.bat @@ -1,3 +1,3 @@ cd /d %CD% -nuget pack CSharpImageLibrary.csproj -symbols -prop Configuration=Release \ No newline at end of file +"D:\Stuff\Other\Useful things\Code Repository\C#\nuget.exe" pack CSharpImageLibrary.csproj -symbols -prop Configuration=Release \ No newline at end of file diff --git a/CSharpImageLibrary/CSharpImageLibrary.csproj b/CSharpImageLibrary/CSharpImageLibrary.csproj index 4de8cdd..fa9d4b2 100644 --- a/CSharpImageLibrary/CSharpImageLibrary.csproj +++ b/CSharpImageLibrary/CSharpImageLibrary.csproj @@ -86,9 +86,8 @@ 4.0 - - False - ..\..\UsefulThings\UsefulThings\bin\Debug\UsefulThings.dll + + ..\packages\UsefulCSharpThings.1.7.3\lib\net462\UsefulThings.dll diff --git a/CSharpImageLibrary/CSharpImageLibrary.nuspec b/CSharpImageLibrary/CSharpImageLibrary.nuspec index ee90b03..103d9b2 100644 --- a/CSharpImageLibrary/CSharpImageLibrary.nuspec +++ b/CSharpImageLibrary/CSharpImageLibrary.nuspec @@ -9,7 +9,7 @@ https://github.com/KFreon/CSharpImageLibrary false Loads and saves standard images including DDS (all sorts and weird ones like V8U8, G8, etc. See full list on github.) - Fixes for UI + DX10 Support, improved some areas of UI. Copyright KFreon 2015 Image DDS Texture ImageEngine CSharp diff --git a/CSharpImageLibrary/Headers/DDS_Header.cs b/CSharpImageLibrary/Headers/DDS_Header.cs index e905c67..af6e7e5 100644 --- a/CSharpImageLibrary/Headers/DDS_Header.cs +++ b/CSharpImageLibrary/Headers/DDS_Header.cs @@ -800,8 +800,8 @@ public override ImageEngineFormat Format if (format == ImageEngineFormat.Unknown) if (ddspf.dwFourCC == FourCC.DX10) format = ImageEngineFormat.DDS_DX10; - format = DetermineDDSSurfaceFormat(ddspf); + format = DetermineDDSSurfaceFormat(ddspf); return format; } } @@ -980,7 +980,13 @@ public static ImageEngineFormat DetermineDDSSurfaceFormat(DDS_Header.DDS_PIXELFO ddspf.dwBBitMask != 0 && ddspf.dwGBitMask != 0 && ddspf.dwRBitMask != 0) - format = ImageEngineFormat.DDS_RGB_8; + { + // TODO more formats? + if (ddspf.dwBBitMask == 31) + format = ImageEngineFormat.DDS_R5G6B5; + else + format = ImageEngineFormat.DDS_RGB_8; + } // KFreon: RGB and A channels are present. else if (((ddspf.dwFlags & (DDS_PFdwFlags.DDPF_RGB | DDS_PFdwFlags.DDPF_ALPHAPIXELS)) == (DDS_PFdwFlags.DDPF_RGB | DDS_PFdwFlags.DDPF_ALPHAPIXELS)) || @@ -988,7 +994,10 @@ public static ImageEngineFormat DetermineDDSSurfaceFormat(DDS_Header.DDS_PIXELFO ddspf.dwBBitMask != 0 && ddspf.dwGBitMask != 0 && ddspf.dwRBitMask != 0) + { + // TODO: Some more formats here? format = ImageEngineFormat.DDS_ARGB_8; + } // KFreon: If nothing else fits, but there's data in one of the bitmasks, assume it can be read. else if (ddspf.dwABitMask != 0 || ddspf.dwRBitMask != 0 || ddspf.dwGBitMask != 0 || ddspf.dwBBitMask != 0) diff --git a/CSharpImageLibrary/ImageEngineFormatDetails.cs b/CSharpImageLibrary/ImageEngineFormatDetails.cs index a1990ca..8aa1faf 100644 --- a/CSharpImageLibrary/ImageEngineFormatDetails.cs +++ b/CSharpImageLibrary/ImageEngineFormatDetails.cs @@ -53,7 +53,18 @@ public class ImageEngineFormatDetails /// /// Number of bytes in colour. /// - public int ComponentSize => (BitCount / 8) / MaxNumberOfChannels; + public int ComponentSize + { + get + { + var aveChannelWidth = BitCount / 8; + var remainder = aveChannelWidth % MaxNumberOfChannels; + if (remainder != 0) + return 1; // TODO: More component sizes? + + return aveChannelWidth / MaxNumberOfChannels; + } + } /// /// Number of bits in colour. @@ -181,8 +192,10 @@ public class ImageEngineFormatDetails case ImageEngineFormat.DDS_ARGB_32F: BitCount = 128; break; - case ImageEngineFormat.DDS_ARGB_4: case ImageEngineFormat.DDS_R5G6B5: + BitCount = 16; + break; + case ImageEngineFormat.DDS_ARGB_4: case ImageEngineFormat.DDS_CUSTOM: case ImageEngineFormat.DDS_DX10: BitCount = GetDX10BitCount(DX10Format); diff --git a/CSharpImageLibrary/packages.config b/CSharpImageLibrary/packages.config index 530dded..0436805 100644 --- a/CSharpImageLibrary/packages.config +++ b/CSharpImageLibrary/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/UI_Project/App.config b/UI_Project/App.config index af3c546..1108b23 100644 --- a/UI_Project/App.config +++ b/UI_Project/App.config @@ -1,7 +1,7 @@  - +
diff --git a/UI_Project/UI_Project.csproj b/UI_Project/UI_Project.csproj index 1969cad..bee0549 100644 --- a/UI_Project/UI_Project.csproj +++ b/UI_Project/UI_Project.csproj @@ -43,8 +43,8 @@ - - ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll + + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.2\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll ..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll @@ -62,6 +62,10 @@ + + + ..\packages\System.Numerics.Vectors.4.3.0\lib\net46\System.Numerics.Vectors.dll + @@ -73,9 +77,8 @@ 4.0 - - False - ..\..\UsefulThings\UsefulThings\bin\Debug\UsefulThings.dll + + ..\packages\UsefulCSharpThings.1.7.3\lib\net462\UsefulThings.dll diff --git a/UI_Project/packages.config b/UI_Project/packages.config index 5d51b1a..4fd03d3 100644 --- a/UI_Project/packages.config +++ b/UI_Project/packages.config @@ -1,7 +1,8 @@  - + - + + \ No newline at end of file