IImageTools.cs 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. using System.Drawing;
  2. using Avalonia.Controls;
  3. namespace InABox.Avalonia.Platform
  4. {
  5. public class ImageFile(string filename, byte[]? data = null)
  6. {
  7. public string FileName { get; private set; } = filename;
  8. public byte[]? Data { get; set; } = data;
  9. }
  10. public interface IImageTools : ILoggable
  11. {
  12. byte[] CreateVideoThumbnail(byte[] video, int maxwidth, int maxheight);
  13. byte[] CreateThumbnail(byte[] image, int maxwidth, int maxheight);
  14. // Goal - to return a properly rotated, scaled and compressed JPEG Image
  15. Task<ImageFile?> CapturePhotoAsync(TopLevel window, int? compression, Size? constraints);
  16. Task<ImageFile?> PickPhotoAsync(TopLevel window, int? compression, Size? constraints);
  17. Task<ImageFile?> CaptureVideoAsync(TopLevel window);
  18. Task<ImageFile?> PickVideoAsync(TopLevel window);
  19. byte[] RotateImage(byte[] image, float angle, int quality = 100);
  20. byte[] ScaleImage(byte[] image, Size? constraints, int quality = 100);
  21. }
  22. }