DefaultImageTools.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Drawing;
  2. using Avalonia.Controls;
  3. using InABox.Core;
  4. using Microsoft.Maui.Storage;
  5. namespace InABox.Avalonia.Platform;
  6. public class DefaultImageTools : IImageTools
  7. {
  8. public Logger? Logger { get; set; }
  9. public byte[] CreateVideoThumbnail(byte[] video, int maxwidth, int maxheight)
  10. {
  11. Logger?.Error("CreateVideoThumbnail() is not implemented on this platform");
  12. return video;
  13. }
  14. public byte[] CreateThumbnail(byte[] image, int maxwidth, int maxheight)
  15. {
  16. Logger?.Error("CreateThumbnail() is not implemented on this platform");
  17. return image;
  18. }
  19. public Task<ImageFile?> CapturePhotoAsync(TopLevel window, int? compression, Size? constraints)
  20. {
  21. Logger?.Error("CapturePhotoAsync() is not implemented on this platform");
  22. return Task.FromResult<ImageFile?>(null);
  23. }
  24. public Task<ImageFile?> PickPhotoAsync(TopLevel window, int? compression, Size? constraints)
  25. {
  26. Logger?.Error("PickPhotoAsync() is not implemented on this platform");
  27. return Task.FromResult<ImageFile?>(null);
  28. }
  29. public Task<ImageFile?> CaptureVideoAsync(TopLevel window)
  30. {
  31. Logger?.Error("CapturePhotoAsync() is not implemented on this platform");
  32. return Task.FromResult<ImageFile?>(null);
  33. }
  34. public Task<ImageFile?> PickVideoAsync(TopLevel window)
  35. {
  36. Logger?.Error("PickPhotoAsync() is not implemented on this platform");
  37. return Task.FromResult<ImageFile?>(null);
  38. }
  39. public byte[] RotateImage(byte[] image, float angle, int quality = 100)
  40. {
  41. Logger?.Error("RotateImage() is not implemented on this platform");
  42. return image;
  43. }
  44. public byte[] ScaleImage(byte[] image, Size? constraints, int quality = 100)
  45. {
  46. Logger?.Error("ScaleImage() is not implemented on this platform");
  47. return image;
  48. }
  49. }