Imagick.php 6.9 KB

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