IImageProcessor.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Threading.Tasks;
  5. using Jellyfin.Data.Entities;
  6. using MediaBrowser.Controller.Entities;
  7. using MediaBrowser.Model.Drawing;
  8. using MediaBrowser.Model.Entities;
  9. namespace MediaBrowser.Controller.Drawing
  10. {
  11. /// <summary>
  12. /// Interface IImageProcessor
  13. /// </summary>
  14. public interface IImageProcessor
  15. {
  16. /// <summary>
  17. /// Gets the supported input formats.
  18. /// </summary>
  19. /// <value>The supported input formats.</value>
  20. IReadOnlyCollection<string> SupportedInputFormats { get; }
  21. /// <summary>
  22. /// Gets a value indicating whether [supports image collage creation].
  23. /// </summary>
  24. /// <value><c>true</c> if [supports image collage creation]; otherwise, <c>false</c>.</value>
  25. bool SupportsImageCollageCreation { get; }
  26. /// <summary>
  27. /// Gets the dimensions of the image.
  28. /// </summary>
  29. /// <param name="path">Path to the image file.</param>
  30. /// <returns>ImageDimensions</returns>
  31. ImageDimensions GetImageDimensions(string path);
  32. /// <summary>
  33. /// Gets the dimensions of the image.
  34. /// </summary>
  35. /// <param name="item">The base item.</param>
  36. /// <param name="info">The information.</param>
  37. /// <returns>ImageDimensions</returns>
  38. ImageDimensions GetImageDimensions(BaseItem item, ItemImageInfo info);
  39. /// <summary>
  40. /// Gets the image cache tag.
  41. /// </summary>
  42. /// <param name="item">The item.</param>
  43. /// <param name="image">The image.</param>
  44. /// <returns>Guid.</returns>
  45. string GetImageCacheTag(BaseItem item, ItemImageInfo image);
  46. string GetImageCacheTag(BaseItem item, ChapterInfo info);
  47. string GetImageCacheTag(User user);
  48. /// <summary>
  49. /// Processes the image.
  50. /// </summary>
  51. /// <param name="options">The options.</param>
  52. /// <param name="toStream">To stream.</param>
  53. /// <returns>Task.</returns>
  54. Task ProcessImage(ImageProcessingOptions options, Stream toStream);
  55. /// <summary>
  56. /// Processes the image.
  57. /// </summary>
  58. /// <param name="options">The options.</param>
  59. /// <returns>Task.</returns>
  60. Task<(string path, string mimeType, DateTime dateModified)> ProcessImage(ImageProcessingOptions options);
  61. /// <summary>
  62. /// Gets the supported image output formats.
  63. /// </summary>
  64. /// <returns><see cref="IReadOnlyCollection{ImageOutput}" />.</returns>
  65. IReadOnlyCollection<ImageFormat> GetSupportedImageOutputFormats();
  66. /// <summary>
  67. /// Creates the image collage.
  68. /// </summary>
  69. /// <param name="options">The options.</param>
  70. void CreateImageCollage(ImageCollageOptions options);
  71. bool SupportsTransparency(string path);
  72. }
  73. }