xref: /imagick/php_imagick_helpers.h (revision 9b76d74e)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 5 / Imagick	                                          |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2006-2013 Mikko Koppanen, Scott MacVicar               |
6    | ImageMagick (c) ImageMagick Studio LLC                               |
7    +----------------------------------------------------------------------+
8    | This source file is subject to version 3.01 of the PHP license,      |
9    | that is bundled with this package in the file LICENSE, and is        |
10    | available through the world-wide-web at the following url:           |
11    | http://www.php.net/license/3_01.txt                                  |
12    | If you did not receive a copy of the PHP license and are unable to   |
13    | obtain it through the world-wide-web, please send a note to          |
14    | license@php.net so we can mail you a copy immediately.               |
15    +----------------------------------------------------------------------+
16    | Author: Mikko Kopppanen <mkoppanen@php.net>                          |
17    |         Scott MacVicar <scottmac@php.net>                            |
18    +----------------------------------------------------------------------+
19 */
20 #ifndef PHP_IMAGICK_HELPERS_H
21 # define PHP_IMAGICK_HELPERS_H
22 
23 void php_imagick_initialize_constants(TSRMLS_D);
24 
25 zend_bool php_imagick_check_font(char *font, int font_len TSRMLS_DC);
26 
27 zend_bool php_imagick_thumbnail_dimensions(MagickWand *magick_wand, zend_bool bestfit, im_long desired_width, im_long desired_height, im_long *new_width, im_long *new_height, zend_bool legacy);
28 
29 PointInfo *php_imagick_zval_to_pointinfo_array(zval *coordinate_array, int *num_elements TSRMLS_DC);
30 
31 double *php_imagick_zval_to_double_array(zval *param_array, im_long *num_elements TSRMLS_DC);
32 
33 im_long *php_imagick_zval_to_long_array(zval *param_array, im_long *num_elements TSRMLS_DC);
34 
35 unsigned char *php_imagick_zval_to_char_array(zval *param_array, im_long *num_elements TSRMLS_DC);
36 
37 MagickBooleanType php_imagick_progress_monitor(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data);
38 
39 void php_imagick_cleanup_progress_callback(php_imagick_callback* progress_callback TSRMLS_DC);
40 
41 MagickBooleanType php_imagick_progress_monitor_callable(const char *text, const MagickOffsetType offset, const MagickSizeType span, void *client_data);
42 
43 zend_bool php_imagick_validate_map(const char *map TSRMLS_DC);
44 
45 php_imagick_rw_result_t php_imagick_file_access_check (const char *filename TSRMLS_DC);
46 
47 
48 PixelWand *php_imagick_zval_to_pixelwand (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC);
49 PixelWand *php_imagick_zval_to_opacity (zval *param, php_imagick_class_type_t caller, zend_bool *allocated TSRMLS_DC);
50 
51 
52 char *php_imagick_set_locale (TSRMLS_D);
53 void php_imagick_restore_locale (const char *old_locale);
54 
55 PixelWand *php_imagick_clone_pixelwand (PixelWand *source);
56 
57 void php_imagick_replace_magickwand (php_imagick_object *obj, MagickWand *new_wand);
58 
59 void php_imagick_replace_drawingwand (php_imagickdraw_object *obj, DrawingWand *new_wand);
60 
61 void php_imagick_replace_pixelwand (php_imagickpixel_object *obj, PixelWand *new_wand);
62 
63 zend_bool php_imagick_ensure_not_empty (MagickWand *magick_wand);
64 zend_bool php_imagickpixel_ensure_not_null(PixelWand *pixel_wand);
65 
66 /* Defined in imagickpixeliterator_class.c */
67 void php_imagick_pixel_iterator_new (PixelIterator *pixel_it, zval *return_value TSRMLS_DC);
68 
69 /*
70   Convert ImageMagick exception types to PHP exceptions
71 */
72 void php_imagick_convert_imagick_exception (MagickWand *magick_wand, const char *default_message TSRMLS_DC);
73 void php_imagick_convert_imagickdraw_exception (DrawingWand *drawing_wand, const char *default_message TSRMLS_DC);
74 void php_imagick_convert_imagickpixeliterator_exception (PixelIterator *pixel_iterator, const char *default_message TSRMLS_DC);
75 void php_imagick_convert_imagickpixel_exception (PixelWand *pixel_wand, const char *default_message TSRMLS_DC);
76 
77 /*
78   Convert read or write failure to PHP exception
79 */
80 void php_imagick_rw_fail_to_exception (MagickWand *magick_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC);
81 void php_imagick_imagickdraw_rw_fail_to_exception (DrawingWand *drawing_wand, php_imagick_rw_result_t rc, const char *filename TSRMLS_DC);
82 
83 /*
84   Throw an exception with message
85 */
86 void php_imagick_throw_exception (php_imagick_class_type_t type, const char *description TSRMLS_DC);
87 
88 #endif /* PHP_IMAGICK_HELPERS_H */
89