From 7a54c3fea708f25303c27630ae2bc8101b9390c3 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 27 Apr 2021 18:52:57 +0800 Subject: refactor: ... --- BackEnd/Timeline/Services/Imaging/IImageService.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 BackEnd/Timeline/Services/Imaging/IImageService.cs (limited to 'BackEnd/Timeline/Services/Imaging/IImageService.cs') diff --git a/BackEnd/Timeline/Services/Imaging/IImageService.cs b/BackEnd/Timeline/Services/Imaging/IImageService.cs new file mode 100644 index 00000000..9e595ff8 --- /dev/null +++ b/BackEnd/Timeline/Services/Imaging/IImageService.cs @@ -0,0 +1,32 @@ +using SixLabors.ImageSharp.Formats; +using System; +using System.Threading; +using System.Threading.Tasks; + +namespace Timeline.Services.Imaging +{ + public interface IImageService + { + /// + /// Detect the format of a image. + /// + /// + /// + /// The image format. + /// Thrown when is null. + /// Thrown when image data can't be detected. + Task DetectFormatAsync(byte[] data, CancellationToken cancellationToken = default); + + /// + /// Validate a image data. + /// + /// The data of the image. Can't be null. + /// If not null, the real image format will be check against the requested format and throw if not match. If null, then do not check. + /// If true, image must be square. + /// Cancellation token. + /// The format. + /// Thrown when is null. + /// Thrown when image data can't be decoded or real type does not match request type or image is not square when required. + Task ValidateAsync(byte[] data, string? requestType = null, bool square = false, CancellationToken cancellationToken = default); + } +} -- cgit v1.2.3