DefaultImageTools.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Drawing;
  2. using Avalonia.Controls;
  3. using InABox.Core;
  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<ImageFile?> CapturePhotoAsync(TopLevel window, int? compression, Size? constraints)
  19. {
  20. Logger?.Error("CapturePhotoAsync() is not implemented on this platform");
  21. return Task.FromResult<ImageFile?>(null);
  22. }
  23. public Task<ImageFile?> PickPhotoAsync(TopLevel window, int? compression, Size? constraints)
  24. {
  25. Logger?.Error("PickPhotoAsync() is not implemented on this platform");
  26. return Task.FromResult<ImageFile?>(null);
  27. }
  28. public Task<ImageFile?> CaptureVideoAsync(TopLevel window)
  29. {
  30. Logger?.Error("CapturePhotoAsync() is not implemented on this platform");
  31. return Task.FromResult<ImageFile?>(null);
  32. }
  33. public Task<ImageFile?> PickVideoAsync(TopLevel window)
  34. {
  35. Logger?.Error("PickPhotoAsync() is not implemented on this platform");
  36. return Task.FromResult<ImageFile?>(null);
  37. }
  38. public byte[] RotateImage(byte[] image, float angle, int quality = 100)
  39. {
  40. Logger?.Error("RotateImage() is not implemented on this platform");
  41. return image;
  42. }
  43. public byte[] ScaleImage(byte[] image, Size? constraints, int quality = 100)
  44. {
  45. Logger?.Error("ScaleImage() is not implemented on this platform");
  46. return image;
  47. }
  48. }