diff --git a/CSharpImageLibrary/CSharpImageLibrary.csproj b/CSharpImageLibrary/CSharpImageLibrary.csproj index d685208..26b40a6 100644 --- a/CSharpImageLibrary/CSharpImageLibrary.csproj +++ b/CSharpImageLibrary/CSharpImageLibrary.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {10E9F41A-45D2-4CC4-B625-76C295FFDF67} - WinExe + Library Properties CSharpImageLibrary CSharpImageLibrary @@ -59,6 +59,9 @@ ImageEngine.ico + + + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.1.0.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll @@ -76,19 +79,19 @@ 4.0 - - False - ..\..\UsefulThings\UsefulThings\bin\Debug\UsefulThings.dll + + ..\packages\UsefulCSharpThings.1.6.0.0\lib\net462\UsefulThings.dll + True - + MSBuild:Compile Designer - + diff --git a/CSharpImageLibrary/DDSGeneral.cs b/CSharpImageLibrary/DDSGeneral.cs index b4c4410..5cf26ec 100644 --- a/CSharpImageLibrary/DDSGeneral.cs +++ b/CSharpImageLibrary/DDSGeneral.cs @@ -17,6 +17,10 @@ namespace CSharpImageLibrary public static class DDSGeneral { static byte V8U8Adjust = 128; // KFreon: This is for adjusting out of signed land. This gets removed on load and re-added on save. + + /// + /// Value at which alpha is included in DXT1 conversions. i.e. pixels lower than this threshold are made 100% transparent, and pixels higher are made 100% opaque. + /// public static float DXT1AlphaThreshold = 0.2f; #region Header Stuff diff --git a/CSharpImageLibrary/ImageEngineImage.cs b/CSharpImageLibrary/ImageEngineImage.cs index 73ac801..8efa437 100644 --- a/CSharpImageLibrary/ImageEngineImage.cs +++ b/CSharpImageLibrary/ImageEngineImage.cs @@ -61,6 +61,9 @@ string EnumFlagStringify(Type enumType) return flags; } + /// + /// DDS header if existing. + /// public DDSGeneral.DDS_HEADER header { get; set; } public string HeaderdwFlags @@ -179,6 +182,7 @@ public ImageEngineImage(Stream stream, string extension = null) /// /// Path to image file. /// Max dimension to save. + /// True = forcibly resizes image. False = attempts to find a suitably sized mipmap, but doesn't resize if none found. public ImageEngineImage(string imagePath, int desiredMaxDimension, bool enforceResize) { LoadFromFile(imagePath, desiredMaxDimension, enforceResize); @@ -191,6 +195,7 @@ public ImageEngineImage(string imagePath, int desiredMaxDimension, bool enforceR /// Full image stream. /// File extension of original image. /// Maximum dimension. + /// True = forcibly resizes image. False = attempts to find a suitably sized mipmap, but doesn't resize if none found. public ImageEngineImage(Stream stream, string extension, int desiredMaxDimension, bool enforceResize) { LoadFromStream(stream, extension, desiredMaxDimension, enforceResize); @@ -214,7 +219,7 @@ public ImageEngineImage(byte[] imageFileData) /// /// Full image file data. /// Maximum dimension. - /// True = resizes to desiredMaxDimension if no suitable mipmap. + /// True = forcibly resizes image. False = attempts to find a suitably sized mipmap, but doesn't resize if none found. /// ONLY valid when enforeResize = true. True = flattens alpha, directly affecting RGB. public ImageEngineImage(byte[] imageFileData, int desiredMaxDimension, bool enforceResize, bool mergeAlpha = false) { @@ -284,8 +289,8 @@ private void LoadFromStream(Stream stream, string extension = null, int desiredM /// /// File to save to. /// Desired image format. - /// True = Generates all mipmaps. False = Uses largest available Mipmap. - /// Maximum value of either image dimension. + /// Determines how mipmaps are handled during saving. + /// Maximum size for saved image. Resizes if required, but uses mipmaps if available. /// DXT1 only. True = Uses threshold value and alpha values to mask RGB. /// Index of mipmap to save as single image. /// True if success. @@ -301,8 +306,8 @@ public bool Save(string destination, ImageEngineFormat format, MipHandling Gener /// /// Stream to save to. /// Format to save as. - /// True = Generates all mipmaps. False = Uses largest available Mipmap. - /// Maximum value of either image dimension. + /// Determines how mipmaps are handled during saving. + /// Maximum size for saved image. Resizes if required, but uses mipmaps if available. /// ONLY valid when desiredMaxDimension != 0. True = alpha flattened, directly affecting RGB. /// Selects a certain mip to save. 0 based. /// True if success @@ -312,6 +317,15 @@ public bool Save(Stream destination, ImageEngineFormat format, MipHandling Gener } + /// + /// Saves fully formatted image in specified format to byte array. + /// + /// Format to save as. + /// Determines how mipmaps are handled during saving. + /// Maximum size for saved image. Resizes if required, but uses mipmaps if available. + /// Index of mipmap to save directly. + /// ONLY valid when desiredMaxDimension != 0. True = alpha flattened, directly affecting RGB. + /// public byte[] Save(ImageEngineFormat format, MipHandling GenerateMips, int desiredMaxDimension = 0, int mipToSave = 0, bool mergeAlpha = false) { return ImageEngine.Save(MipMaps, format, GenerateMips, desiredMaxDimension, mipToSave, mergeAlpha); diff --git a/CSharpImageLibrary/packages.config b/CSharpImageLibrary/packages.config index 54200ba..7d44987 100644 --- a/CSharpImageLibrary/packages.config +++ b/CSharpImageLibrary/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file