2023-01-21 19:36:12 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Shipwreck.Phash;
|
|
|
|
|
using Wabbajack.DTOs.Texture;
|
|
|
|
|
using Wabbajack.Paths;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Hashing.PHash;
|
|
|
|
|
|
|
|
|
|
public interface IImageLoader
|
|
|
|
|
{
|
|
|
|
|
public ValueTask<ImageState> Load(AbsolutePath path);
|
|
|
|
|
public ValueTask<ImageState> Load(Stream stream);
|
|
|
|
|
public static float ComputeDifference(DTOs.Texture.PHash a, DTOs.Texture.PHash b)
|
|
|
|
|
{
|
|
|
|
|
return ImagePhash.GetCrossCorrelation(
|
|
|
|
|
new Digest {Coefficients = a.Data},
|
|
|
|
|
new Digest {Coefficients = b.Data});
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-28 21:42:23 +00:00
|
|
|
|
public Task Recompress(AbsolutePath input, int width, int height, int mipMaps, DXGI_FORMAT format,
|
2023-01-21 19:36:12 +00:00
|
|
|
|
AbsolutePath output,
|
|
|
|
|
CancellationToken token);
|
|
|
|
|
|
2023-01-28 21:42:23 +00:00
|
|
|
|
public Task Recompress(Stream input, int width, int height, int mipMaps, DXGI_FORMAT format, Stream output,
|
2023-01-21 19:36:12 +00:00
|
|
|
|
CancellationToken token, bool leaveOpen = false);
|
|
|
|
|
}
|