Skip to content

Commit

Permalink
Remove Imazen.WebP and copy bindings to common project
Browse files Browse the repository at this point in the history
  • Loading branch information
ImoutoChan committed Oct 23, 2023
1 parent 5962c9c commit df634ef
Show file tree
Hide file tree
Showing 18 changed files with 1,933 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class StringToInlineCollectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var str = value as string + "<";
var str = (value as string) + "<";
str = str.Replace("&lt;", "<");
str = str.Replace("&gt;", ">");
str = str.Replace("\n", "");
Expand Down Expand Up @@ -131,4 +131,4 @@ private enum Modifier
Big = 16,
ExtraBig = 32
}
}
}
2 changes: 1 addition & 1 deletion Source/Imouto.Viewer/ImoutoViewer/ImoutoViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
<ItemGroup>
<PackageReference Include="AutoMapper" Version="12.0.1"/>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1"/>
<PackageReference Include="Imazen.WebP" Version="10.0.1" />
<PackageReference Include="MahApps.Metro" Version="2.4.10" />
<PackageReference Include="MahApps.Metro.IconPacks" Version="4.11.0"/>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0"/>
Expand Down Expand Up @@ -73,6 +72,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\ImoutoRebirth.Common\ImoutoRebirth.Common.WebP\ImoutoRebirth.Common.WebP.csproj" />
<ProjectReference Include="..\..\ImoutoRebirth.Common\ImoutoRebirth.Common\ImoutoRebirth.Common.csproj"/>
<ProjectReference Include="..\..\ImoutoRebirth.Lilin\ImoutoRebirth.Lilin.WebApi.Client\ImoutoRebirth.Lilin.WebApi.Client.csproj"/>
<ProjectReference Include="..\..\ImoutoRebirth.Room\ImoutoRebirth.Room.WebApi.Client\ImoutoRebirth.Room.WebApi.Client.csproj"/>
Expand Down
3 changes: 2 additions & 1 deletion Source/Imouto.Viewer/ImoutoViewer/Model/LocalImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using ImoutoRebirth.Common.WebP;
using ImoutoViewer.ViewModel.SettingsModels;
using Size = System.Windows.Size;

Expand Down Expand Up @@ -382,7 +383,7 @@ private static BitmapSource GetBitmap(BitmapCreateOptions options, string filePa
}

using var stream = new MemoryStream();
var decoder = new Imazen.WebP.SimpleDecoder();
var decoder = new SimpleDecoder();
var bytes = File.ReadAllBytes(filePath);
var bitmap = decoder.DecodeFromBytes(bytes, bytes.Length);
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// ReSharper disable InconsistentNaming
namespace ImoutoRebirth.Common.WebP.Extern;

public partial class NativeMethods
{
/// WEBP_DECODER_ABI_VERSION 0x0208 // MAJOR(8b) + MINOR(8b)
public const int WEBP_DECODER_ABI_VERSION = 520;

/// WEBP_ENCODER_ABI_VERSION 0x0209 // MAJOR(8b) + MINOR(8b)
public const int WEBP_ENCODER_ABI_VERSION = 521;

/// <summary>
/// The maximum length of any dimension of a WebP image is 16383
/// </summary>
public const int WEBP_MAX_DIMENSION = 16383;
}
Loading

0 comments on commit df634ef

Please sign in to comment.