Imagick.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <?php
  2. namespace Gregwar\Image\Adapter;
  3. use Gregwar\Image\Image;
  4. class Imagick extends Common
  5. {
  6. public function __construct()
  7. {
  8. throw new \Exception('Imagick is not supported right now');
  9. }
  10. /**
  11. * Gets the name of the adapter.
  12. *
  13. * @return string
  14. */
  15. public function getName()
  16. {
  17. return 'ImageMagick';
  18. }
  19. /**
  20. * Image width.
  21. *
  22. * @return int
  23. */
  24. public function width()
  25. {
  26. // TODO: Implement width() method.
  27. }
  28. /**
  29. * Image height.
  30. *
  31. * @return int
  32. */
  33. public function height()
  34. {
  35. // TODO: Implement height() method.
  36. }
  37. /**
  38. * Save the image as a gif.
  39. *
  40. * @return $this
  41. */
  42. public function saveGif($file)
  43. {
  44. // TODO: Implement saveGif() method.
  45. }
  46. /**
  47. * Save the image as a png.
  48. *
  49. * @return $this
  50. */
  51. public function savePng($file)
  52. {
  53. // TODO: Implement savePng() method.
  54. }
  55. /**
  56. * Save the image as a jpeg.
  57. *
  58. * @return $this
  59. */
  60. public function saveJpeg($file, $quality)
  61. {
  62. // TODO: Implement saveJpeg() method.
  63. }
  64. /**
  65. * Crops the image.
  66. *
  67. * @param int $x the top-left x position of the crop box
  68. * @param int $y the top-left y position of the crop box
  69. * @param int $width the width of the crop box
  70. * @param int $height the height of the crop box
  71. *
  72. * @return $this
  73. */
  74. public function crop($x, $y, $width, $height)
  75. {
  76. // TODO: Implement crop() method.
  77. }
  78. /**
  79. * Fills the image background to $bg if the image is transparent.
  80. *
  81. * @param int $background background color
  82. *
  83. * @return $this
  84. */
  85. public function fillBackground($background = 0xffffff)
  86. {
  87. // TODO: Implement fillBackground() method.
  88. }
  89. /**
  90. * Negates the image.
  91. *
  92. * @return $this
  93. */
  94. public function negate()
  95. {
  96. // TODO: Implement negate() method.
  97. }
  98. /**
  99. * Changes the brightness of the image.
  100. *
  101. * @param int $brightness the brightness
  102. *
  103. * @return $this
  104. */
  105. public function brightness($brightness)
  106. {
  107. // TODO: Implement brightness() method.
  108. }
  109. /**
  110. * Contrasts the image.
  111. *
  112. * @param int $contrast the contrast [-100, 100]
  113. *
  114. * @return $this
  115. */
  116. public function contrast($contrast)
  117. {
  118. // TODO: Implement contrast() method.
  119. }
  120. /**
  121. * Apply a grayscale level effect on the image.
  122. *
  123. * @return $this
  124. */
  125. public function grayscale()
  126. {
  127. // TODO: Implement grayscale() method.
  128. }
  129. /**
  130. * Emboss the image.
  131. *
  132. * @return $this
  133. */
  134. public function emboss()
  135. {
  136. // TODO: Implement emboss() method.
  137. }
  138. /**
  139. * Smooth the image.
  140. *
  141. * @param int $p value between [-10,10]
  142. *
  143. * @return $this
  144. */
  145. public function smooth($p)
  146. {
  147. // TODO: Implement smooth() method.
  148. }
  149. /**
  150. * Sharps the image.
  151. *
  152. * @return $this
  153. */
  154. public function sharp()
  155. {
  156. // TODO: Implement sharp() method.
  157. }
  158. /**
  159. * Edges the image.
  160. *
  161. * @return $this
  162. */
  163. public function edge()
  164. {
  165. // TODO: Implement edge() method.
  166. }
  167. /**
  168. * Colorize the image.
  169. *
  170. * @param int $red value in range [-255, 255]
  171. * @param int $green value in range [-255, 255]
  172. * @param int $blue value in range [-255, 255]
  173. *
  174. * @return $this
  175. */
  176. public function colorize($red, $green, $blue)
  177. {
  178. // TODO: Implement colorize() method.
  179. }
  180. /**
  181. * apply sepia to the image.
  182. *
  183. * @return $this
  184. */
  185. public function sepia()
  186. {
  187. // TODO: Implement sepia() method.
  188. }
  189. /**
  190. * Merge with another image.
  191. *
  192. * @param Image $other
  193. * @param int $x
  194. * @param int $y
  195. * @param int $width
  196. * @param int $height
  197. *
  198. * @return $this
  199. */
  200. public function merge(Image $other, $x = 0, $y = 0, $width = null, $height = null)
  201. {
  202. // TODO: Implement merge() method.
  203. }
  204. /**
  205. * Rotate the image.
  206. *
  207. * @param float $angle
  208. * @param int $background
  209. *
  210. * @return $this
  211. */
  212. public function rotate($angle, $background = 0xffffff)
  213. {
  214. // TODO: Implement rotate() method.
  215. }
  216. /**
  217. * Fills the image.
  218. *
  219. * @param int $color
  220. * @param int $x
  221. * @param int $y
  222. *
  223. * @return $this
  224. */
  225. public function fill($color = 0xffffff, $x = 0, $y = 0)
  226. {
  227. // TODO: Implement fill() method.
  228. }
  229. /**
  230. * write text to the image.
  231. *
  232. * @param string $font
  233. * @param string $text
  234. * @param int $x
  235. * @param int $y
  236. * @param int $size
  237. * @param int $angle
  238. * @param int $color
  239. * @param string $align
  240. */
  241. public function write($font, $text, $x = 0, $y = 0, $size = 12, $angle = 0, $color = 0x000000, $align = 'left')
  242. {
  243. // TODO: Implement write() method.
  244. }
  245. /**
  246. * Draws a rectangle.
  247. *
  248. * @param int $x1
  249. * @param int $y1
  250. * @param int $x2
  251. * @param int $y2
  252. * @param int $color
  253. * @param bool $filled
  254. *
  255. * @return $this
  256. */
  257. public function rectangle($x1, $y1, $x2, $y2, $color, $filled = false)
  258. {
  259. // TODO: Implement rectangle() method.
  260. }
  261. /**
  262. * Draws a rounded rectangle.
  263. *
  264. * @param int $x1
  265. * @param int $y1
  266. * @param int $x2
  267. * @param int $y2
  268. * @param int $radius
  269. * @param int $color
  270. * @param bool $filled
  271. *
  272. * @return $this
  273. */
  274. public function roundedRectangle($x1, $y1, $x2, $y2, $radius, $color, $filled = false)
  275. {
  276. // TODO: Implement roundedRectangle() method.
  277. }
  278. /**
  279. * Draws a line.
  280. *
  281. * @param int $x1
  282. * @param int $y1
  283. * @param int $x2
  284. * @param int $y2
  285. * @param int $color
  286. *
  287. * @return $this
  288. */
  289. public function line($x1, $y1, $x2, $y2, $color = 0x000000)
  290. {
  291. // TODO: Implement line() method.
  292. }
  293. /**
  294. * Draws an ellipse.
  295. *
  296. * @param int $cx
  297. * @param int $cy
  298. * @param int $width
  299. * @param int $height
  300. * @param int $color
  301. * @param bool $filled
  302. *
  303. * @return $this
  304. */
  305. public function ellipse($cx, $cy, $width, $height, $color = 0x000000, $filled = false)
  306. {
  307. // TODO: Implement ellipse() method.
  308. }
  309. /**
  310. * Draws a circle.
  311. *
  312. * @param int $cx
  313. * @param int $cy
  314. * @param int $r
  315. * @param int $color
  316. * @param bool $filled
  317. *
  318. * @return $this
  319. */
  320. public function circle($cx, $cy, $r, $color = 0x000000, $filled = false)
  321. {
  322. // TODO: Implement circle() method.
  323. }
  324. /**
  325. * Draws a polygon.
  326. *
  327. * @param array $points
  328. * @param int $color
  329. * @param bool $filled
  330. *
  331. * @return $this
  332. */
  333. public function polygon(array $points, $color, $filled = false)
  334. {
  335. // TODO: Implement polygon() method.
  336. }
  337. /**
  338. * {@inheritdoc}
  339. */
  340. public function flip($flipVertical, $flipHorizontal)
  341. {
  342. // TODO: Implement flip method
  343. }
  344. /**
  345. * Opens the image.
  346. */
  347. protected function openGif($file)
  348. {
  349. // TODO: Implement openGif() method.
  350. }
  351. protected function openJpeg($file)
  352. {
  353. // TODO: Implement openJpeg() method.
  354. }
  355. protected function openPng($file)
  356. {
  357. // TODO: Implement openPng() method.
  358. }
  359. protected function openWebp($file)
  360. {
  361. // TODO: Implement openWebp() method.
  362. }
  363. /**
  364. * Creates an image.
  365. */
  366. protected function createImage($width, $height)
  367. {
  368. // TODO: Implement createImage() method.
  369. }
  370. /**
  371. * Creating an image using $data.
  372. */
  373. protected function createImageFromData($data)
  374. {
  375. // TODO: Implement createImageFromData() method.
  376. }
  377. /**
  378. * Resizes the image to an image having size of $target_width, $target_height, using
  379. * $new_width and $new_height and padding with $bg color.
  380. */
  381. protected function doResize($bg, $target_width, $target_height, $new_width, $new_height)
  382. {
  383. // TODO: Implement doResize() method.
  384. }
  385. /**
  386. * Gets the color of the $x, $y pixel.
  387. */
  388. protected function getColor($x, $y)
  389. {
  390. // TODO: Implement getColor() method.
  391. }
  392. }