Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Updated nuget.
Browse files Browse the repository at this point in the history
Fixed some formatting bugs.
  • Loading branch information
KFreon committed Jun 16, 2017
1 parent e0dfb72 commit 22439e6
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CSharpImageLibrary/Build Nuget.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
cd /d %CD%

nuget pack CSharpImageLibrary.csproj -symbols -prop Configuration=Release
"D:\Stuff\Other\Useful things\Code Repository\C#\nuget.exe" pack CSharpImageLibrary.csproj -symbols -prop Configuration=Release
5 changes: 2 additions & 3 deletions CSharpImageLibrary/CSharpImageLibrary.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UsefulThings, Version=1.7.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\UsefulThings\UsefulThings\bin\Debug\UsefulThings.dll</HintPath>
<Reference Include="UsefulThings, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.3\lib\net462\UsefulThings.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
2 changes: 1 addition & 1 deletion CSharpImageLibrary/CSharpImageLibrary.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<projectUrl>https://github.com/KFreon/CSharpImageLibrary</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Loads and saves standard images including DDS (all sorts and weird ones like V8U8, G8, etc. See full list on github.)</description>
<releaseNotes>Fixes for UI</releaseNotes>
<releaseNotes>DX10 Support, improved some areas of UI.</releaseNotes>
<copyright>Copyright KFreon 2015</copyright>
<tags>Image DDS Texture ImageEngine CSharp</tags>
</metadata>
Expand Down
13 changes: 11 additions & 2 deletions CSharpImageLibrary/Headers/DDS_Header.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -980,15 +980,24 @@ 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)) ||
ddspf.dwABitMask != 0 &&
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)
Expand Down
17 changes: 15 additions & 2 deletions CSharpImageLibrary/ImageEngineFormatDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,18 @@ public class ImageEngineFormatDetails
/// <summary>
/// Number of bytes in colour.
/// </summary>
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;
}
}

/// <summary>
/// Number of bits in colour.
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion CSharpImageLibrary/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.2" targetFramework="net462" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.3.0" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.2.1" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.3" targetFramework="net462" />
</packages>
2 changes: 1 addition & 1 deletion UI_Project/App.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="UI_Project.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
Expand Down
13 changes: 8 additions & 5 deletions UI_Project/UI_Project.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Expression.Interactions, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.2\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll</HintPath>
Expand All @@ -62,6 +62,10 @@
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.3.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
Expand All @@ -73,9 +77,8 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UsefulThings, Version=1.7.2.1, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\UsefulThings\UsefulThings\bin\Debug\UsefulThings.dll</HintPath>
<Reference Include="UsefulThings, Version=1.7.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UsefulCSharpThings.1.7.3\lib\net462\UsefulThings.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
5 changes: 3 additions & 2 deletions UI_Project/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net462" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.2" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net462" />
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.2.1" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.3.0" targetFramework="net462" />
<package id="UsefulCSharpThings" version="1.7.3" targetFramework="net462" />
</packages>

0 comments on commit 22439e6

Please sign in to comment.