ImageInterface.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace Grafika;
  3. /**
  4. * Interface ImageInterface
  5. * @package Grafika
  6. */
  7. interface ImageInterface
  8. {
  9. /**
  10. * Output a binary raw dump of an image in a specified format.
  11. *
  12. * @param string|ImageType $type Image format of the dump. See Grafika\ImageType for supported formats.
  13. */
  14. public function blob($type);
  15. /**
  16. * Create a blank image.
  17. *
  18. * @param int $width Width of image in pixels.
  19. * @param int $height Height of image in pixels.
  20. *
  21. * @return ImageInterface Instance of image.
  22. */
  23. public static function createBlank($width = 1, $height = 1);
  24. /**
  25. * Create Image from core.
  26. *
  27. * @param resource|\Imagick $core GD resource for GD editor or Imagick instance for Imagick editor
  28. *
  29. * @return ImageInterface Instance of image.
  30. */
  31. public static function createFromCore($core);
  32. /**
  33. * Create Image from image file.
  34. *
  35. * @param string $imageFile Path to image file.
  36. *
  37. * @return ImageInterface Instance of image.
  38. */
  39. public static function createFromFile($imageFile);
  40. /**
  41. * Get Image core.
  42. *
  43. * @return resource|\Imagick GD resource or Imagick instance
  44. */
  45. public function getCore();
  46. /**
  47. * @return int Height in pixels.
  48. */
  49. public function getHeight();
  50. /**
  51. * @return string File path to image if Image was created from an image file.
  52. */
  53. public function getImageFile();
  54. /**
  55. * @return string Type of image. See ImageType.
  56. */
  57. public function getType();
  58. /**
  59. * @return int Width in pixels.
  60. */
  61. public function getWidth();
  62. /**
  63. * Returns animated flag.
  64. *
  65. * @return bool True if animated GIF or false otherwise.
  66. */
  67. public function isAnimated();
  68. }