DefaultImageTools.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Drawing;
  2. using InABox.Core;
  3. using Microsoft.Maui.Storage;
  4. namespace InABox.Avalonia.Platform;
  5. public class DefaultImageTools : IImageTools
  6. {
  7. public Logger? Logger { get; set; }
  8. public byte[] CreateVideoThumbnail(byte[] video, int maxwidth, int maxheight)
  9. {
  10. Logger?.Error("CreateVideoThumbnail() is not implemented on this platform");
  11. return video;
  12. }
  13. public byte[] CreateThumbnail(byte[] image, int maxwidth, int maxheight)
  14. {
  15. Logger?.Error("CreateThumbnail() is not implemented on this platform");
  16. return image;
  17. }
  18. public Task<FileResult> CapturePhotoAsync(int? compression, Size? constraints)
  19. {
  20. Logger?.Error("CapturePhotoAsync() is not implemented on this platform");
  21. return Task.Run(() => new FileResult($"{Guid.NewGuid().ToString()}.tmp"));
  22. }
  23. public Task<FileResult> PickPhotoAsync(int? compression, Size? constraints)
  24. {
  25. Logger?.Error("PickPhotoAsync() is not implemented on this platform");
  26. return Task.Run(() => new FileResult($"{Guid.NewGuid().ToString()}.tmp"));
  27. }
  28. public byte[] RotateImage(byte[] image, float angle, int quality = 100)
  29. {
  30. Logger?.Error("RotateImage() is not implemented on this platform");
  31. return image;
  32. }
  33. public byte[] ScaleImage(byte[] image, Size? constraints, int quality = 100)
  34. {
  35. Logger?.Error("ScaleImage() is not implemented on this platform");
  36. return image;
  37. }
  38. }