1 /* compat with the vips7 API
2  *
3  * 4/3/11
4  * 	- hacked up
5  */
6 
7 /*
8 
9     This file is part of VIPS.
10 
11     VIPS is free software; you can redistribute it and/or modify
12     it under the terms of the GNU Lesser General Public License as published by
13     the Free Software Foundation; either version 2 of the License, or
14     (at your option) any later version.
15 
16     This program is distributed in the hope that it will be useful,
17     but WITHOUT ANY WARRANTY; without even the implied warranty of
18     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     GNU Lesser General Public License for more details.
20 
21     You should have received a copy of the GNU Lesser General Public License
22     along with this program; if not, write to the Free Software
23     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24     02110-1301  USA
25 
26  */
27 
28 /*
29 
30     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
31 
32  */
33 
34 #ifndef VIPS_VIPS7COMPAT_H
35 #define VIPS_VIPS7COMPAT_H
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /*__cplusplus*/
40 
41 /* Renamed types.
42  */
43 
44 /* We have this misspelt in earlier versions :(
45  */
46 #define VIPS_META_IPCT_NAME VIPS_META_IPTC_NAME
47 
48 #define IM_D93_X0 VIPS_D93_X0
49 #define IM_D93_Y0 VIPS_D93_Y0
50 #define IM_D93_Z0 VIPS_D93_Z0
51 
52 #define IM_D75_X0 VIPS_D75_X0
53 #define IM_D75_Y0 VIPS_D75_Y0
54 #define IM_D75_Z0 VIPS_D75_Z0
55 
56 #define IM_D65_X0 VIPS_D65_X0
57 #define IM_D65_Y0 VIPS_D65_Y0
58 #define IM_D65_Z0 VIPS_D65_Z0
59 
60 #define IM_D55_X0 VIPS_D55_X0
61 #define IM_D55_Y0 VIPS_D55_Y0
62 #define IM_D55_Z0 VIPS_D55_Z0
63 
64 #define IM_D50_X0 VIPS_D50_X0
65 #define IM_D50_Y0 VIPS_D50_Y0
66 #define IM_D50_Z0 VIPS_D50_Z0
67 
68 #define IM_A_X0 VIPS_A_X0
69 #define IM_A_Y0 VIPS_A_Y0
70 #define IM_A_Z0 VIPS_A_Z0
71 
72 #define IM_B_X0 VIPS_B_X0
73 #define IM_B_Y0 VIPS_B_Y0
74 #define IM_B_Z0 VIPS_B_Z0
75 
76 #define IM_C_X0 VIPS_C_X0
77 #define IM_C_Y0 VIPS_C_Y0
78 #define IM_C_Z0 VIPS_C_Z0
79 
80 #define IM_E_X0 VIPS_E_X0
81 #define IM_E_Y0 VIPS_E_Y0
82 #define IM_E_Z0 VIPS_E_Z0
83 
84 #define IM_D3250_X0 VIPS_D3250_X0
85 #define IM_D3250_Y0 VIPS_D3250_Y0
86 #define IM_D3250_Z0 VIPS_D3250_Z0
87 
88 #define im_col_Lab2XYZ vips_col_Lab2XYZ
89 #define im_col_XYZ2Lab vips_col_XYZ2Lab
90 #define im_col_ab2h vips_col_ab2h
91 #define im_col_ab2Ch vips_col_ab2Ch
92 #define im_col_Ch2ab vips_col_Ch2ab
93 
94 #define im_col_L2Lucs vips_col_L2Lcmc
95 #define im_col_C2Cucs vips_col_C2Ccmc
96 #define im_col_Ch2hucs vips_col_Ch2hcmc
97 #define im_col_pythagoras vips_pythagoras
98 
99 #define im_col_make_tables_UCS vips_col_make_tables_CMC
100 #define im_col_Lucs2L vips_col_Lcmc2L
101 #define im_col_Cucs2C vips_col_Ccmc2C
102 #define im_col_Chucs2h vips_col_Chcmc2h
103 
104 #define PEL VipsPel
105 
106 #define IM_BANDFMT_NOTSET VIPS_FORMAT_NOTSET
107 #define IM_BANDFMT_UCHAR VIPS_FORMAT_UCHAR
108 #define IM_BANDFMT_CHAR VIPS_FORMAT_CHAR
109 #define IM_BANDFMT_USHORT VIPS_FORMAT_USHORT
110 #define IM_BANDFMT_SHORT VIPS_FORMAT_SHORT
111 #define IM_BANDFMT_UINT VIPS_FORMAT_UINT
112 #define IM_BANDFMT_INT VIPS_FORMAT_INT
113 #define IM_BANDFMT_FLOAT VIPS_FORMAT_FLOAT
114 #define IM_BANDFMT_COMPLEX VIPS_FORMAT_COMPLEX
115 #define IM_BANDFMT_DOUBLE VIPS_FORMAT_DOUBLE
116 #define IM_BANDFMT_DPCOMPLEX VIPS_FORMAT_DPCOMPLEX
117 #define IM_BANDFMT_LAST VIPS_FORMAT_LAST
118 #define VipsBandFmt VipsBandFormat
119 
120 #define IM_SMALLTILE VIPS_DEMAND_STYLE_SMALLTILE
121 #define IM_FATSTRIP VIPS_DEMAND_STYLE_FATSTRIP
122 #define IM_THINSTRIP VIPS_DEMAND_STYLE_THINSTRIP
123 #define IM_ANY VIPS_DEMAND_STYLE_ANY
124 
125 #define IM_CODING_NONE VIPS_CODING_NONE
126 #define IM_CODING_LABQ VIPS_CODING_LABQ
127 #define IM_CODING_RAD VIPS_CODING_RAD
128 
129 #define IM_TYPE_MULTIBAND VIPS_INTERPRETATION_MULTIBAND
130 #define IM_TYPE_B_W VIPS_INTERPRETATION_B_W
131 #define IM_TYPE_HISTOGRAM VIPS_INTERPRETATION_HISTOGRAM
132 #define IM_TYPE_FOURIER VIPS_INTERPRETATION_FOURIER
133 #define IM_TYPE_XYZ VIPS_INTERPRETATION_XYZ
134 #define IM_TYPE_LAB VIPS_INTERPRETATION_LAB
135 #define IM_TYPE_CMYK VIPS_INTERPRETATION_CMYK
136 #define IM_TYPE_LABQ VIPS_INTERPRETATION_LABQ
137 #define IM_TYPE_RGB VIPS_INTERPRETATION_RGB
138 #define IM_TYPE_UCS VIPS_INTERPRETATION_CMC
139 #define IM_TYPE_LCH VIPS_INTERPRETATION_LCH
140 #define IM_TYPE_LABS VIPS_INTERPRETATION_LABS
141 #define IM_TYPE_sRGB VIPS_INTERPRETATION_sRGB
142 #define IM_TYPE_YXY VIPS_INTERPRETATION_YXY
143 #define IM_TYPE_RGB16 VIPS_INTERPRETATION_RGB16
144 #define IM_TYPE_GREY16 VIPS_INTERPRETATION_GREY16
145 #define VipsType VipsInterpretation
146 
147 #define IMAGE VipsImage
148 #define REGION VipsRegion
149 
150 #define IM_INTENT_PERCEPTUAL VIPS_INTENT_PERCEPTUAL
151 #define IM_INTENT_RELATIVE_COLORIMETRIC VIPS_INTENT_RELATIVE
152 #define IM_INTENT_SATURATION VIPS_INTENT_SATURATION
153 #define IM_INTENT_ABSOLUTE_COLORIMETRIC VIPS_INTENT_ABSOLUTE
154 
155 /* Renamed macros.
156  */
157 
158 #define IM_MAX VIPS_MAX
159 #define IM_MIN VIPS_MIN
160 #define IM_RAD VIPS_RAD
161 #define IM_DEG VIPS_DEG
162 #define IM_PI VIPS_PI
163 #define IM_RINT VIPS_RINT
164 #define IM_ABS VIPS_ABS
165 #define IM_NUMBER VIPS_NUMBER
166 #define IM_CLIP VIPS_CLIP
167 #define IM_CLIP_UCHAR VIPS_CLIP_UCHAR
168 #define IM_CLIP_CHAR VIPS_CLIP_CHAR
169 #define IM_CLIP_USHORT VIPS_CLIP_USHORT
170 #define IM_CLIP_SHORT VIPS_CLIP_SHORT
171 #define IM_CLIP_NONE VIPS_CLIP_NONE
172 #define IM_SWAP VIPS_SWAP
173 
174 #define IM_IMAGE_ADDR VIPS_IMAGE_ADDR
175 #define IM_IMAGE_N_ELEMENTS VIPS_IMAGE_N_ELEMENTS
176 #define IM_IMAGE_SIZEOF_ELEMENT VIPS_IMAGE_SIZEOF_ELEMENT
177 #define IM_IMAGE_SIZEOF_PEL VIPS_IMAGE_SIZEOF_PEL
178 #define IM_IMAGE_SIZEOF_LINE VIPS_IMAGE_SIZEOF_LINE
179 
180 #define IM_REGION_LSKIP VIPS_REGION_LSKIP
181 #define IM_REGION_ADDR VIPS_REGION_ADDR
182 #define IM_REGION_ADDR_TOPLEFT VIPS_REGION_ADDR_TOPLEFT
183 #define IM_REGION_N_ELEMENTS VIPS_REGION_N_ELEMENTS
184 #define IM_REGION_SIZEOF_LINE VIPS_REGION_SIZEOF_LINE
185 
186 /* Renamed externs.
187  */
188 extern const guint64 vips__image_sizeof_bandformat[];
189 #define im__sizeof_bandfmt vips__image_sizeof_bandformat
190 
191 /* Renamed functions.
192  */
193 
194 #define im_error vips_error
195 #define im_verror vips_verror
196 #define im_verror_system vips_verror_system
197 #define im_error_system vips_error_system
198 #define im_error_buffer vips_error_buffer
199 #define im_error_clear vips_error_clear
200 #define im_warn vips_warn
201 #define im_vwarn vips_vwarn
202 #define im_diag vips_info
203 #define im_vdiag vips_vinfo
204 #define error_exit vips_error_exit
205 
206 #define im_get_argv0 vips_get_argv0
207 #define im_version_string vips_version_string
208 #define im_version vips_version
209 #define im_get_option_group vips_get_option_group
210 #define im_guess_prefix vips_guess_prefix
211 #define im_guess_libdir vips_guess_libdir
212 #define im__global_lock vips__global_lock
213 
214 int im_cp_desc(IMAGE *out, IMAGE *in );
215 int im_cp_descv (IMAGE * im, ...);
216 #define im_cp_desc_array(I, A) vips__image_copy_fields_array(I, A)
217 int im_demand_hint (IMAGE * im, VipsDemandStyle hint, ...);
218 #define im_demand_hint_array( A, B, C ) (vips__demand_hint_array( A, B, C ), 0)
219 
220 #define im_image(P, W, H, B, F) \
221 	vips_image_new_from_memory((P), 0, (W), (H), (B), (F))
222 
223 #define im_binfile vips_image_new_from_file_raw
224 #define im__open_temp vips_image_new_temp_file
225 #define im__test_kill( I ) (vips_image_get_kill( I ))
226 #define im__start_eval( I ) (vips_image_preeval( I ), vips_image_get_kill( I ))
227 #define im__handle_eval( I, W, H ) \
228 	(vips_image_eval( I, W, H ), vips_image_get_kill( I ))
229 #define im__end_eval vips_image_posteval
230 #define im_invalidate vips_image_invalidate_all
231 #define im_isfile vips_image_isfile
232 #define im_printdesc( I ) vips_object_print_dump( VIPS_OBJECT( I ) )
233 
234 /* im_openout() needs to have this visible.
235  */
236 VipsImage *
237 vips_image_new_mode( const char *filename, const char *mode );
238 
239 #define im_openout( F ) vips_image_new_mode( F, "w" )
240 #define im_setbuf( F ) vips_image_new( "t" )
241 
242 #define im_initdesc( image, \
243 	xsize, ysize, bands, bandbits, bandfmt, coding, \
244 	type, xres, yres, xo, yo ) \
245 	vips_image_init_fields( image, \
246 		xsize, ysize, bands, bandfmt, coding, \
247 		type, xres, yres )
248 
249 #define im__open_image_file vips__open_image_read
250 #define im_setupout vips_image_write_prepare
251 #define im_writeline( Y, IM, P ) vips_image_write_line( IM, Y, P )
252 
253 #define im_prepare vips_region_prepare
254 #define im_prepare_to vips_region_prepare_to
255 #define im_region_create vips_region_new
256 #define im_region_free g_object_unref
257 #define im_region_region vips_region_region
258 #define im_region_buffer vips_region_buffer
259 #define im_region_black vips_region_black
260 #define im_region_paint vips_region_paint
261 #define im_prepare_many vips_region_prepare_many
262 
263 #define im__region_no_ownership vips__region_no_ownership
264 
265 #define im_image_sanity( I ) (!vips_object_sanity( VIPS_OBJECT( I ) ))
266 #define im_image_sanity_all vips_object_sanity_all
267 #define im__print_all vips_object_print_all
268 
269 /* Compat functions.
270  */
271 
272 int im_init_world( const char *argv0 );
273 
274 VipsImage *im_open( const char *filename, const char *mode );
275 
276 VipsImage *im_open_local( VipsImage *parent,
277 	const char *filename, const char *mode );
278 int im_open_local_array( VipsImage *parent,
279 	VipsImage **images, int n, const char *filename, const char *mode );
280 
281 #define im_callback_fn VipsCallbackFn
282 
283 int im_add_callback( VipsImage *im,
284 	const char *callback, im_callback_fn fn, void *a, void *b );
285 int im_add_callback1( VipsImage *im,
286 	const char *callback, im_callback_fn fn, void *a, void *b );
287 #define im_add_close_callback( IM, FN, A, B ) \
288 	im_add_callback( IM, "close", FN, A, B )
289 #define im_add_postclose_callback( IM, FN, A, B ) \
290 	im_add_callback( IM, "postclose", FN, A, B )
291 #define im_add_preclose_callback( IM, FN, A, B ) \
292 	im_add_callback( IM, "preclose", FN, A, B )
293 #define im_add_evalstart_callback( IM, FN, A, B ) \
294 	im_add_callback1( IM, "preeval", FN, A, B )
295 #define im_add_evalend_callback( IM, FN, A, B ) \
296 	im_add_callback1( IM, "posteval", FN, A, B )
297 #define im_add_eval_callback( IM, FN, A, B ) \
298 	(vips_image_set_progress( IM, TRUE ), \
299 	im_add_callback1( IM, "eval", FN, A, B ))
300 #define im_add_invalidate_callback( IM, FN, A, B ) \
301 	im_add_callback( IM, "invalidate", FN, A, B )
302 
303 #define im_bits_of_fmt( fmt ) (vips_format_sizeof( fmt ) << 3)
304 
305 typedef void *(*im_construct_fn)( void *, void *, void * );
306 void *im_local( VipsImage *im,
307 	im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
308 int im_local_array( VipsImage *im, void **out, int n,
309 	im_construct_fn cons, im_callback_fn dest, void *a, void *b, void *c );
310 
311 int im_close( VipsImage *im );
312 VipsImage *im_init( const char *filename );
313 
314 const char *im_Type2char( VipsInterpretation type );
315 const char *im_BandFmt2char( VipsBandFormat fmt );
316 const char *im_Coding2char( VipsCoding coding );
317 const char *im_Compression2char( int n );
318 const char *im_dtype2char( VipsImageType n );
319 const char *im_dhint2char( VipsDemandStyle style );
320 
321 VipsInterpretation im_char2Type( const char *str );
322 VipsBandFormat im_char2BandFmt( const char *str );
323 VipsCoding im_char2Coding( const char *str );
324 VipsImageType im_char2dtype( const char *str );
325 VipsDemandStyle im_char2dhint( const char *str );
326 
327 #define Rect VipsRect
328 #define IM_RECT_RIGHT VIPS_RECT_RIGHT
329 #define IM_RECT_BOTTOM VIPS_RECT_BOTTOM
330 #define IM_RECT_HCENTRE VIPS_RECT_HCENTRE
331 #define IM_RECT_VCENTRE VIPS_RECT_VCENTRE
332 
333 #define im_rect_marginadjust vips_rect_marginadjust
334 #define im_rect_includespoint vips_rect_includespoint
335 #define im_rect_includesrect vips_rect_includesrect
336 #define im_rect_intersectrect vips_rect_intersectrect
337 #define im_rect_isempty vips_rect_isempty
338 #define im_rect_unionrect vips_rect_unionrect
339 #define im_rect_equalsrect vips_rect_equalsrect
340 #define im_rect_dup vips_rect_dup
341 #define im_rect_normalise vips_rect_normalise
342 
343 #define im_start_one vips_start_one
344 #define im_stop_one vips_stop_one
345 #define im_start_many vips_start_many
346 #define im_stop_many vips_stop_many
347 #define im_allocate_input_array vips_allocate_input_array
348 #define im_start_fn VipsStartFn
349 typedef int (*im_generate_fn)( VipsRegion *out, void *seq, void *a, void *b );
350 #define im_stop_fn VipsStopFn
351 int im_generate( VipsImage *im,
352 	im_start_fn start, im_generate_fn generate, im_stop_fn stop,
353 	void *a, void *b );
354 
355 #define im__mmap vips__mmap
356 #define im__munmap vips__munmap
357 #define im_mapfile vips_mapfile
358 #define im_mapfilerw vips_mapfilerw
359 #define im_remapfilerw vips_remapfilerw
360 
361 #define im__print_renders vips__print_renders
362 
363 int im_cache( IMAGE *in, IMAGE *out, int width, int height, int max );
364 
365 #define IM_FREEF( F, S ) \
366 G_STMT_START { \
367         if( S ) { \
368                 (void) F( (S) ); \
369                 (S) = 0; \
370         } \
371 } G_STMT_END
372 
373 /* Can't just use VIPS_FREEF(), we want the extra cast to void on the argument
374  * to vips_free() to make sure we can work for "const char *" variables.
375  */
376 #define IM_FREE( S ) \
377 G_STMT_START { \
378         if( S ) { \
379                 (void) im_free( (void *) (S) ); \
380                 (S) = 0; \
381         } \
382 } G_STMT_END
383 
384 #define IM_SETSTR( S, V ) \
385 G_STMT_START { \
386         const char *sst = (V); \
387 	\
388         if( (S) != sst ) { \
389                 if( !(S) || !sst || strcmp( (S), sst ) != 0 ) { \
390                         IM_FREE( S ); \
391                         if( sst ) \
392                                 (S) = im_strdup( NULL, sst ); \
393                 } \
394         } \
395 } G_STMT_END
396 
397 #define im_malloc( IM, SZ ) \
398 	(vips_malloc( VIPS_OBJECT( IM ), (SZ) ))
399 #define im_free vips_free
400 #define im_strdup( IM, STR ) \
401 	(vips_strdup( VIPS_OBJECT( IM ), (STR) ))
402 #define IM_NEW( IM, T ) ((T *) im_malloc( (IM), sizeof( T )))
403 #define IM_ARRAY( IM, N, T ) ((T *) im_malloc( (IM), (N) * sizeof( T )))
404 
405 #define im_incheck vips_image_wio_input
406 #define im_outcheck( I ) (0)
407 #define im_rwcheck vips_image_inplace
408 #define im_pincheck vips_image_pio_input
409 #define im_poutcheck( I ) (0)
410 
411 #define im_iocheck( I, O ) im_incheck( I )
412 #define im_piocheck( I, O ) im_pincheck( I )
413 
414 #define im_check_uncoded vips_check_uncoded
415 #define im_check_coding_known vips_check_coding_known
416 #define im_check_coding_labq vips_check_coding_labq
417 #define im_check_coding_rad vips_check_coding_rad
418 #define im_check_coding_noneorlabq vips_check_coding_noneorlabq
419 #define im_check_coding_same vips_check_coding_same
420 #define im_check_mono vips_check_mono
421 #define im_check_bands_1or3 vips_check_bands_1or3
422 #define im_check_bands vips_check_bands
423 #define im_check_bands_1orn vips_check_bands_1orn
424 #define im_check_bands_1orn_unary vips_check_bands_1orn_unary
425 #define im_check_bands_same vips_check_bands_same
426 #define im_check_bandno vips_check_bandno
427 #define im_check_int vips_check_int
428 #define im_check_uint vips_check_uint
429 #define im_check_uintorf vips_check_uintorf
430 #define im_check_noncomplex vips_check_noncomplex
431 #define im_check_complex vips_check_complex
432 #define im_check_format vips_check_format
433 #define im_check_u8or16 vips_check_u8or16
434 #define im_check_8or16 vips_check_8or16
435 #define im_check_u8or16orf vips_check_u8or16orf
436 #define im_check_format_same vips_check_format_same
437 #define im_check_size_same vips_check_size_same
438 #define im_check_vector vips_check_vector
439 #define im_check_hist vips_check_hist
440 #define im_check_imask vips_check_imask
441 #define im_check_dmask vips_check_dmask
442 
443 #define vips_bandfmt_isint vips_band_format_isint
444 #define vips_bandfmt_isuint vips_band_format_isuint
445 #define vips_bandfmt_isfloat vips_band_format_isfloat
446 #define vips_bandfmt_iscomplex vips_band_format_iscomplex
447 
448 #define im__change_suffix vips__change_suffix
449 
450 /* Buffer processing.
451  */
452 typedef void (*im_wrapone_fn)( void *in, void *out, int width,
453 	void *a, void *b );
454 int im_wrapone( VipsImage *in, VipsImage *out,
455 	im_wrapone_fn fn, void *a, void *b );
456 
457 typedef void (*im_wraptwo_fn)( void *in1, void *in2, void *out,
458         int width, void *a, void *b );
459 int im_wraptwo( VipsImage *in1, VipsImage *in2, VipsImage *out,
460 	im_wraptwo_fn fn, void *a, void *b );
461 
462 typedef void (*im_wrapmany_fn)( void **in, void *out, int width,
463 	void *a, void *b );
464 int im_wrapmany( VipsImage **in, VipsImage *out,
465 	im_wrapmany_fn fn, void *a, void *b );
466 
467 #define IM_META_EXIF_NAME VIPS_META_EXIF_NAME
468 #define IM_META_ICC_NAME VIPS_META_ICC_NAME
469 #define IM_META_RESOLUTION_UNIT VIPS_META_RESOLUTION_UNIT
470 #define IM_TYPE_SAVE_STRING VIPS_TYPE_SAVE_STRING
471 #define IM_TYPE_BLOB VIPS_TYPE_BLOB
472 #define IM_TYPE_AREA VIPS_TYPE_AREA
473 #define IM_TYPE_REF_STRING VIPS_TYPE_REF_STRING
474 
475 #define im_header_map_fn VipsImageMapFn
476 #define im_header_map vips_image_map
477 
478 #define im_header_int vips_image_get_int
479 #define im_header_double vips_image_get_double
480 #define im_header_string( IMAGE, FIELD, STRING ) \
481 	vips_image_get_string( IMAGE, FIELD, (const char **) STRING )
482 #define im_header_as_string vips_image_get_as_string
483 #define im_header_get_typeof vips_image_get_typeof
484 #define im_header_get vips_image_get
485 
486 #define im_histlin vips_image_history_printf
487 #define im_updatehist vips_image_history_args
488 #define im_history_get vips_image_get_history
489 
490 #define im_save_string_get vips_value_get_save_string
491 #define im_save_string_set vips_value_set_save_string
492 #define im_save_string_setf vips_value_set_save_stringf
493 
494 #define im_ref_string_set vips_value_set_ref_string
495 #define im_ref_string_get( V ) vips_value_get_ref_string( V, NULL )
496 size_t im_ref_string_get_length( const GValue *value );
497 
498 #define im_blob_get vips_value_get_blob
499 #define im_blob_set vips_value_set_blob
500 
501 #define im_meta_set( A, B, C ) (vips_image_set( A, B, C ), 0)
502 #define im_meta_remove vips_image_remove
503 #define im_meta_get vips_image_get
504 #define im_meta_get_typeof vips_image_get_typeof
505 
506 #define im_meta_set_int( A, B, C ) (vips_image_set_int( A, B, C ), 0)
507 #define im_meta_get_int vips_image_get_int
508 #define im_meta_set_double( A, B, C ) (vips_image_set_double( A, B, C ), 0)
509 #define im_meta_get_double vips_image_get_double
510 #define im_meta_set_area( A, B, C, D ) (vips_image_set_area( A, B, C, D ), 0)
511 #define im_meta_get_area vips_image_get_area
512 #define im_meta_set_string( A, B, C ) (vips_image_set_string( A, B, C ), 0)
513 #define im_meta_get_string vips_image_get_string
514 #define im_meta_set_blob( A, B, C, D, E ) \
515 	(vips_image_set_blob( A, B, C, D, E ), 0)
516 #define im_meta_get_blob vips_image_get_blob
517 
518 #define im_semaphore_t VipsSemaphore
519 
520 #define im_semaphore_up vips_semaphore_up
521 #define im_semaphore_down vips_semaphore_down
522 #define im_semaphore_upn vips_semaphore_upn
523 #define im_semaphore_downn vips_semaphore_downn
524 #define im_semaphore_destroy vips_semaphore_destroy
525 #define im_semaphore_init vips_semaphore_init
526 
527 #define im__open_image_read vips__open_image_read
528 #define im_image_open_input vips_image_open_input
529 #define im_image_open_output vips_image_open_output
530 #define im__has_extension_block vips__has_extension_block
531 #define im__read_extension_block vips__read_extension_block
532 #define im__write_extension_block vips__write_extension_block
533 #define im__writehist vips__writehist
534 #define im__read_header_bytes vips__read_header_bytes
535 #define im__write_header_bytes vips__write_header_bytes
536 
537 #define VSListMap2Fn VipsSListMap2Fn
538 #define VSListMap4Fn VipsSListMap4Fn
539 #define VSListFold2Fn VipsSListFold2Fn
540 
541 #define im_slist_equal vips_slist_equal
542 #define im_slist_map2 vips_slist_map2
543 #define im_slist_map2_rev vips_slist_map2_rev
544 #define im_slist_map4 vips_slist_map4
545 #define im_slist_fold2 vips_slist_fold2
546 #define im_slist_filter vips_slist_filter
547 #define im_slist_free_all vips_slist_free_all
548 #define im_map_equal vips_map_equal
549 #define im_hash_table_map vips_hash_table_map
550 #define im_strncpy vips_strncpy
551 #define im_strrstr vips_strrstr
552 #define im_ispostfix vips_ispostfix
553 #define im_isprefix vips_isprefix
554 #define im_break_token vips_break_token
555 #define im_vsnprintf vips_vsnprintf
556 #define im_snprintf vips_snprintf
557 #define im_file_length vips_file_length
558 #define im__write vips__write
559 #define im__file_open_read vips__file_open_read
560 #define im__file_open_write vips__file_open_write
561 #define im__file_read vips__file_read
562 #define im__file_read_name vips__file_read_name
563 #define im__file_write vips__file_write
564 #define im__get_bytes vips__get_bytes
565 #define im__gvalue_ref_string_new vips__gvalue_ref_string_new
566 #define im__gslist_gvalue_free vips__gslist_gvalue_free
567 #define im__gslist_gvalue_copy vips__gslist_gvalue_copy
568 #define im__gslist_gvalue_merge vips__gslist_gvalue_merge
569 #define im__gslist_gvalue_get vips__gslist_gvalue_get
570 #define im__seek vips__seek
571 #define im__ftruncate vips__ftruncate
572 #define im_existsf vips_existsf
573 #define im_popenf vips_popenf
574 #define im_ispoweroftwo vips_ispoweroftwo
575 #define im_amiMSBfirst vips_amiMSBfirst
576 #define im__temp_name vips__temp_name
577 
578 #define IM_VERSION_STRING VIPS_VERSION_STRING
579 #define IM_MAJOR_VERSION VIPS_MAJOR_VERSION
580 #define IM_MINOR_VERSION VIPS_MINOR_VERSION
581 #define IM_MICRO_VERSION VIPS_MICRO_VERSION
582 
583 #define IM_EXEEXT VIPS_EXEEXT
584 
585 #define IM_SIZEOF_HEADER VIPS_SIZEOF_HEADER
586 
587 #define im_concurrency_set vips_concurrency_set
588 #define im_concurrency_get vips_concurrency_get
589 
590 int im_init_world( const char *argv0 );
591 
592 int im_add( VipsImage *in1, VipsImage *in2, VipsImage *out );
593 int im_subtract( VipsImage *in1, VipsImage *in2, VipsImage *out );
594 int im_multiply( VipsImage *in1, VipsImage *in2, VipsImage *out );
595 int im_divide( VipsImage *in1, VipsImage *in2, VipsImage *out );
596 int im_min( VipsImage *in, double *out );
597 int im_minpos( VipsImage *in, int *xpos, int *ypos, double *out );
598 int im_max( VipsImage *in, double *out );
599 int im_maxpos( VipsImage *in, int *xpos, int *ypos, double *out );
600 int im_avg( VipsImage *in, double *out );
601 int im_deviate( VipsImage *in, double *out );
602 int im_invert( VipsImage *in, VipsImage *out );
603 int im_lintra( double a, VipsImage *in, double b, VipsImage *out );
604 int im_lintra_vec( int n, double *a, VipsImage *in, double *b, VipsImage *out );
605 int im_abs( VipsImage *in, VipsImage *out );
606 int im_sign( VipsImage *in, VipsImage *out );
607 DOUBLEMASK *im_stats( VipsImage *in );
608 DOUBLEMASK *im_measure_area( VipsImage *im,
609 	int left, int top, int width, int height,
610 	int h, int v,
611 	int *sel, int nsel, const char *name );
612 
613 int im_sintra( VipsImage *in, VipsImage *out );
614 int im_costra( VipsImage *in, VipsImage *out );
615 int im_tantra( VipsImage *in, VipsImage *out );
616 int im_asintra( VipsImage *in, VipsImage *out );
617 int im_acostra( VipsImage *in, VipsImage *out );
618 int im_atantra( VipsImage *in, VipsImage *out );
619 int im_logtra( VipsImage *in, VipsImage *out );
620 int im_log10tra( VipsImage *in, VipsImage *out );
621 int im_exptra( VipsImage *in, VipsImage *out );
622 int im_exp10tra( VipsImage *in, VipsImage *out );
623 
624 int im_floor( VipsImage *in, VipsImage *out );
625 int im_rint( VipsImage *in, VipsImage *out );
626 int im_ceil( VipsImage *in, VipsImage *out );
627 
628 int im_equal( VipsImage *in1, VipsImage *in2, VipsImage *out );
629 int im_notequal( VipsImage *in1, VipsImage *in2, VipsImage *out );
630 int im_less( VipsImage *in1, VipsImage *in2, VipsImage *out );
631 int im_lesseq( VipsImage *in1, VipsImage *in2, VipsImage *out );
632 int im_more( VipsImage *in1, VipsImage *in2, VipsImage *out );
633 int im_moreeq( VipsImage *in1, VipsImage *in2, VipsImage *out );
634 
635 int im_andimage( VipsImage *in1, VipsImage *in2, VipsImage *out );
636 int im_orimage( VipsImage *in1, VipsImage *in2, VipsImage *out );
637 int im_eorimage( VipsImage *in1, VipsImage *in2, VipsImage *out );
638 int im_andimage_vec( VipsImage *in, VipsImage *out, int n, double *c );
639 int im_orimage_vec( VipsImage *in, VipsImage *out, int n, double *c );
640 int im_eorimage_vec( VipsImage *in, VipsImage *out, int n, double *c );
641 int im_andimageconst( VipsImage *in, VipsImage *out, double c );
642 int im_orimageconst( VipsImage *in, VipsImage *out, double c );
643 int im_eorimageconst( VipsImage *in, VipsImage *out, double c );
644 
645 int im_shiftleft_vec( VipsImage *in, VipsImage *out, int n, double *c );
646 int im_shiftleft( VipsImage *in, VipsImage *out, int n );
647 int im_shiftright_vec( VipsImage *in, VipsImage *out, int n, double *c );
648 int im_shiftright( VipsImage *in, VipsImage *out, int n );
649 
650 int im_remainder( VipsImage *in1, VipsImage *in2, VipsImage *out );
651 int im_remainder_vec( VipsImage *in, VipsImage *out, int n, double *c );
652 int im_remainderconst( VipsImage *in, VipsImage *out, double c );
653 
654 int im_powtra( VipsImage *in, VipsImage *out, double e );
655 int im_powtra_vec( VipsImage *in, VipsImage *out, int n, double *e );
656 int im_expntra( VipsImage *in, VipsImage *out, double e );
657 int im_expntra_vec( VipsImage *in, VipsImage *out, int n, double *e );
658 
659 int im_equal_vec( VipsImage *in, VipsImage *out, int n, double *c );
660 int im_notequal_vec( VipsImage *in, VipsImage *out, int n, double *c );
661 int im_less_vec( VipsImage *in, VipsImage *out, int n, double *c );
662 int im_lesseq_vec( VipsImage *in, VipsImage *out, int n, double *c );
663 int im_more_vec( VipsImage *in, VipsImage *out, int n, double *c );
664 int im_moreeq_vec( VipsImage *in, VipsImage *out, int n, double *c );
665 int im_equalconst( VipsImage *in, VipsImage *out, double c );
666 int im_notequalconst( VipsImage *in, VipsImage *out, double c );
667 int im_lessconst( VipsImage *in, VipsImage *out, double c );
668 int im_lesseqconst( VipsImage *in, VipsImage *out, double c );
669 int im_moreconst( VipsImage *in, VipsImage *out, double c );
670 int im_moreeqconst( VipsImage *in, VipsImage *out, double c );
671 
672 int im_maxpos_vec( VipsImage *im, int *xpos, int *ypos, double *maxima, int n );
673 int im_minpos_vec( VipsImage *im, int *xpos, int *ypos, double *minima, int n );
674 
675 int im_maxpos_avg( VipsImage *im, double *xpos, double *ypos, double *out );
676 
677 int im_linreg( VipsImage **ins, VipsImage *out, double *xs );
678 
679 int im_cross_phase( VipsImage *a, VipsImage *b, VipsImage *out );
680 
681 int im_point( VipsImage *im, VipsInterpolate *interpolate,
682 	double x, double y, int band, double *out );
683 int im_point_bilinear( VipsImage *im,
684 	double x, double y, int band, double *out );
685 
686 int im_copy( VipsImage *in, VipsImage *out );
687 int im_copy_set( VipsImage *in, VipsImage *out,
688 	VipsInterpretation interpretation,
689 	float xres, float yres, int xoffset, int yoffset );
690 int im_copy_set_meta( VipsImage *in, VipsImage *out,
691 	const char *field, GValue *value );
692 int im_copy_morph( VipsImage *in, VipsImage *out,
693 	int bands, VipsBandFormat format, VipsCoding coding );
694 int im_copy_swap( VipsImage *in, VipsImage *out );
695 int im_copy_file( VipsImage *in, VipsImage *out );
696 int im_copy_native( VipsImage *in, VipsImage *out, gboolean is_msb_first );
697 int im_embed( VipsImage *in, VipsImage *out,
698 	int type, int x, int y, int width, int height );
699 int im_fliphor( VipsImage *in, VipsImage *out );
700 int im_flipver( VipsImage *in, VipsImage *out );
701 int im_insert( VipsImage *main, VipsImage *sub, VipsImage *out, int x, int y );
702 int im_insert_noexpand( VipsImage *main, VipsImage *sub, VipsImage *out, int x, int y );
703 int im_lrjoin( VipsImage *left, VipsImage *right, VipsImage *out );
704 int im_tbjoin( VipsImage *top, VipsImage *bottom, VipsImage *out );
705 int im_extract_area( VipsImage *in, VipsImage *out,
706 	int left, int top, int width, int height );
707 int im_extract_band( VipsImage *in, VipsImage *out, int band );
708 int im_extract_bands( VipsImage *in, VipsImage *out, int band, int nbands );
709 int im_extract_areabands( VipsImage *in, VipsImage *out,
710 	int left, int top, int width, int height, int band, int nbands );
711 int im_replicate( VipsImage *in, VipsImage *out, int across, int down );
712 int im_wrap( VipsImage *in, VipsImage *out, int x, int y );
713 int im_rotquad( VipsImage *in, VipsImage *out );
714 int im_clip2fmt( VipsImage *in, VipsImage *out, VipsBandFormat fmt );
715 int im_bandjoin( VipsImage *in1, VipsImage *in2, VipsImage *out );
716 int im_gbandjoin( VipsImage **in, VipsImage *out, int n );
717 int im_rank_image( VipsImage **in, VipsImage *out, int n, int index );
718 int im_maxvalue( VipsImage **in, VipsImage *out, int n );
719 int im_grid( VipsImage *in, VipsImage *out, int tile_height, int across, int down );
720 int im_scale( VipsImage *in, VipsImage *out );
721 int im_scaleps( VipsImage *in, VipsImage *out );
722 int im_msb( VipsImage *in, VipsImage *out );
723 int im_msb_band( VipsImage *in, VipsImage *out, int band );
724 int im_zoom( VipsImage *in, VipsImage *out, int xfac, int yfac );
725 int im_subsample( VipsImage *in, VipsImage *out, int xshrink, int yshrink );
726 
727 int im_gaussnoise( VipsImage *out, int x, int y, double mean, double sigma );
728 int im_text( VipsImage *out, const char *text, const char *font,
729 	int width, int alignment, int dpi );
730 int im_black( VipsImage *out, int x, int y, int bands );
731 int im_make_xy( VipsImage *out, const int xsize, const int ysize );
732 int im_zone( VipsImage *out, int size );
733 int im_fzone( VipsImage *out, int size );
734 int im_feye( VipsImage *out,
735 	const int xsize, const int ysize, const double factor );
736 int im_eye( VipsImage *out,
737 	const int xsize, const int ysize, const double factor );
738 int im_grey( VipsImage *out, const int xsize, const int ysize );
739 int im_fgrey( VipsImage *out, const int xsize, const int ysize );
740 int im_sines( VipsImage *out,
741 	int xsize, int ysize, double horfreq, double verfreq );
742 int im_buildlut( DOUBLEMASK *input, VipsImage *output );
743 int im_invertlut( DOUBLEMASK *input, VipsImage *output, int lut_size );
744 int im_identity( VipsImage *lut, int bands );
745 int im_identity_ushort( VipsImage *lut, int bands, int sz );
746 
747 int im_tone_build_range( VipsImage *out,
748 	int in_max, int out_max,
749 	double Lb, double Lw, double Ps, double Pm, double Ph,
750 	double S, double M, double H );
751 int im_tone_build( VipsImage *out,
752 	double Lb, double Lw, double Ps, double Pm, double Ph,
753 	double S, double M, double H );
754 
755 int im_system( VipsImage *im, const char *cmd, char **out );
756 VipsImage *im_system_image( VipsImage *im,
757 	const char *in_format, const char *out_format, const char *cmd_format,
758 	char **log );
759 
760 int im_c2amph( VipsImage *in, VipsImage *out );
761 int im_c2rect( VipsImage *in, VipsImage *out );
762 int im_c2imag( VipsImage *in, VipsImage *out );
763 int im_c2real( VipsImage *in, VipsImage *out );
764 int im_ri2c( VipsImage *in1, VipsImage *in2, VipsImage *out );
765 
766 int im_rot90( VipsImage *in, VipsImage *out );
767 int im_rot180( VipsImage *in, VipsImage *out );
768 int im_rot270( VipsImage *in, VipsImage *out );
769 
770 int im_ifthenelse( VipsImage *c, VipsImage *a, VipsImage *b, VipsImage *out );
771 int im_blend( VipsImage *c, VipsImage *a, VipsImage *b, VipsImage *out );
772 
773 DOUBLEMASK *im_vips2mask( VipsImage *in, const char *filename );
774 INTMASK *im_vips2imask( IMAGE *in, const char *filename );
775 int im_mask2vips( DOUBLEMASK *in, VipsImage *out );
776 int im_imask2vips( INTMASK *in, VipsImage *out );
777 
778 int im_bandmean( VipsImage *in, VipsImage *out );
779 int im_recomb( VipsImage *in, VipsImage *out, DOUBLEMASK *recomb );
780 
781 int im_argb2rgba( VipsImage *in, VipsImage *out );
782 
783 int im_falsecolour( VipsImage *in, VipsImage *out );
784 int im_gammacorrect( VipsImage *in, VipsImage *out, double exponent );
785 
786 int im_tile_cache_random( IMAGE *in, IMAGE *out,
787 	int tile_width, int tile_height, int max_tiles );
788 
789 int im_shrink( VipsImage *in, VipsImage *out, double xshrink, double yshrink );
790 int im_affinei( VipsImage *in, VipsImage *out,
791 	VipsInterpolate *interpolate,
792 	double a, double b, double c, double d, double dx, double dy,
793 	int ox, int oy, int ow, int oh );
794 int im_affinei_all( VipsImage *in, VipsImage *out, VipsInterpolate *interpolate,
795 	double a, double b, double c, double d, double dx, double dy ) ;
796 int im_rightshift_size( VipsImage *in, VipsImage *out,
797 	int xshift, int yshift, int band_fmt );
798 
799 int im_Lab2XYZ_temp( IMAGE *in, IMAGE *out, double X0, double Y0, double Z0 );
800 int im_Lab2XYZ( IMAGE *in, IMAGE *out );
801 int im_XYZ2Lab( VipsImage *in, VipsImage *out );
802 int im_XYZ2Lab_temp( VipsImage *in, VipsImage *out,
803 	double X0, double Y0, double Z0 );
804 int im_Lab2LCh( VipsImage *in, VipsImage *out );
805 int im_LCh2Lab( VipsImage *in, VipsImage *out );
806 int im_LCh2UCS( VipsImage *in, VipsImage *out );
807 int im_UCS2LCh( VipsImage *in, VipsImage *out );
808 int im_XYZ2Yxy( VipsImage *in, VipsImage *out );
809 int im_Yxy2XYZ( VipsImage *in, VipsImage *out );
810 int im_float2rad( VipsImage *in, VipsImage *out );
811 int im_rad2float( VipsImage *in, VipsImage *out );
812 int im_Lab2LabQ( VipsImage *in, VipsImage *out );
813 int im_LabQ2Lab( VipsImage *in, VipsImage *out );
814 int im_Lab2LabS( VipsImage *in, VipsImage *out );
815 int im_LabS2Lab( VipsImage *in, VipsImage *out );
816 int im_LabQ2LabS( VipsImage *in, VipsImage *out );
817 int im_LabS2LabQ( VipsImage *in, VipsImage *out );
818 int im_LabQ2sRGB( VipsImage *in, VipsImage *out );
819 
820 int im_XYZ2sRGB( IMAGE *in, IMAGE *out );
821 int im_sRGB2XYZ( IMAGE *in, IMAGE *out );
822 
823 struct im_col_display;
824 #define im_col_displays(S) (NULL)
825 #define im_LabQ2disp_build_table(A, B) (NULL)
826 #define im_LabQ2disp_table(A, B, C) (im_LabQ2disp(A, B, C))
827 
828 int im_Lab2disp( IMAGE *in, IMAGE *out, struct im_col_display *disp );
829 int im_disp2Lab( IMAGE *in, IMAGE *out, struct im_col_display *disp );
830 
831 int im_dE_fromdisp( IMAGE *, IMAGE *, IMAGE *, struct im_col_display * );
832 int im_dECMC_fromdisp( IMAGE *, IMAGE *, IMAGE *, struct im_col_display * );
833 
834 #define im_disp2XYZ(A, B, C) (im_sRGB2XYZ(A, B))
835 #define im_XYZ2disp(A, B, C) (im_XYZ2sRGB(A, B))
836 #define im_LabQ2disp(A, B, C) (im_LabQ2sRGB(A, B))
837 
838 int im_icc_transform( VipsImage *in, VipsImage *out,
839 	const char *input_profile_filename,
840 	const char *output_profile_filename,
841 	VipsIntent intent );
842 
843 #define im_icc_present vips_icc_present
844 
845 int im_icc_import( VipsImage *in, VipsImage *out,
846 	const char *input_profile_filename, VipsIntent intent );
847 int im_icc_import_embedded( VipsImage *in, VipsImage *out, VipsIntent intent );
848 int im_icc_export_depth( VipsImage *in, VipsImage *out, int depth,
849 	const char *output_profile_filename, VipsIntent intent );
850 int im_icc_ac2rc( VipsImage *in, VipsImage *out, const char *profile_filename );
851 
852 int im_LabQ2XYZ( VipsImage *in, VipsImage *out );
853 int im_UCS2XYZ( VipsImage *in, VipsImage *out );
854 int im_UCS2Lab( VipsImage *in, VipsImage *out );
855 int im_Lab2UCS( VipsImage *in, VipsImage *out );
856 int im_XYZ2UCS( VipsImage *in, VipsImage *out );
857 
858 int im_dE_fromLab( VipsImage *in1, VipsImage *in2, VipsImage *out );
859 int im_dECMC_fromLab( VipsImage *in1, VipsImage *in2, VipsImage *out );
860 int im_dE_fromXYZ( VipsImage *in1, VipsImage *in2, VipsImage *out );
861 int im_dE00_fromLab( VipsImage *in1, VipsImage *in2, VipsImage *out );
862 
863 int im_lab_morph( VipsImage *in, VipsImage *out,
864 	DOUBLEMASK *mask,
865 	double L_offset, double L_scale,
866 	double a_scale, double b_scale );
867 
868 #define im_col_dE00 vips_col_dE00
869 
870 int im_quadratic( IMAGE *in, IMAGE *out, IMAGE *coeff );
871 
872 int im_maplut( VipsImage *in, VipsImage *out, VipsImage *lut );
873 int im_hist( VipsImage *in, VipsImage *out, int bandno );
874 int im_histgr( VipsImage *in, VipsImage *out, int bandno );
875 int im_histcum( VipsImage *in, VipsImage *out );
876 int im_histnorm( VipsImage *in, VipsImage *out );
877 int im_histeq( VipsImage *in, VipsImage *out );
878 int im_heq( VipsImage *in, VipsImage *out, int bandno );
879 int im_histnD( VipsImage *in, VipsImage *out, int bins );
880 int im_hist_indexed( VipsImage *index, VipsImage *value, VipsImage *out );
881 int im_histplot( VipsImage *in, VipsImage *out );
882 int im_project( VipsImage *in, VipsImage *hout, VipsImage *vout );
883 int im_profile( IMAGE *in, IMAGE *out, int dir );
884 int im_hsp( VipsImage *in, VipsImage *ref, VipsImage *out );
885 int im_histspec( VipsImage *in, VipsImage *ref, VipsImage *out );
886 int im_lhisteq( VipsImage *in, VipsImage *out, int xwin, int ywin );
887 int im_stdif( VipsImage *in, VipsImage *out,
888 	double a, double m0, double b, double s0, int xwin, int ywin );
889 int im_mpercent( VipsImage *in, double percent, int *out );
890 int im_mpercent_hist( VipsImage *hist, double percent, int *out );
891 int im_ismonotonic( VipsImage *lut, int *out );
892 
893 int im_tone_analyse( VipsImage *in, VipsImage *out,
894 	double Ps, double Pm, double Ph, double S, double M, double H );
895 int im_tone_map( VipsImage *in, VipsImage *out, VipsImage *lut );
896 
897 /* Not really correct, but who uses these.
898  */
899 #define im_lhisteq_raw im_lhisteq
900 #define im_stdif_raw im_stdif
901 
902 /* ruby-vips uses this
903  */
904 #define vips_class_map_concrete_all vips_class_map_all
905 
906 int im_dilate( VipsImage *in, VipsImage *out, INTMASK *mask );
907 int im_erode( VipsImage *in, VipsImage *out, INTMASK *mask );
908 
909 int im_aconv( VipsImage *in, VipsImage *out,
910 	DOUBLEMASK *mask, int n_layers, int cluster );
911 int im_conv( VipsImage *in, VipsImage *out, INTMASK *mask );
912 int im_conv_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
913 
914 int im_aconvsep( VipsImage *in, VipsImage *out,
915 	DOUBLEMASK *mask, int n_layers );
916 
917 int im_convsep( VipsImage *in, VipsImage *out, INTMASK *mask );
918 int im_convsep_f( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
919 
920 int im_compass( VipsImage *in, VipsImage *out, INTMASK *mask );
921 int im_gradient( VipsImage *in, VipsImage *out, INTMASK *mask );
922 int im_lindetect( VipsImage *in, VipsImage *out, INTMASK *mask );
923 
924 int im_addgnoise( VipsImage *in, VipsImage *out, double sigma );
925 
926 int im_contrast_surface_raw( IMAGE *in, IMAGE *out,
927 	int half_win_size, int spacing );
928 int im_contrast_surface( VipsImage *in, VipsImage *out,
929 	int half_win_size, int spacing );
930 
931 int im_grad_x( VipsImage *in, VipsImage *out );
932 int im_grad_y( VipsImage *in, VipsImage *out );
933 
934 int im_fastcor( VipsImage *in, VipsImage *ref, VipsImage *out );
935 int im_spcor( VipsImage *in, VipsImage *ref, VipsImage *out );
936 int im_gradcor( VipsImage *in, VipsImage *ref, VipsImage *out );
937 
938 int im_sharpen( VipsImage *in, VipsImage *out,
939 	int mask_size,
940 	double x1, double y2, double y3,
941 	double m1, double m2 );
942 
943 typedef enum {
944         IM_MASK_IDEAL_HIGHPASS = 0,
945         IM_MASK_IDEAL_LOWPASS = 1,
946         IM_MASK_BUTTERWORTH_HIGHPASS = 2,
947         IM_MASK_BUTTERWORTH_LOWPASS = 3,
948         IM_MASK_GAUSS_HIGHPASS = 4,
949         IM_MASK_GAUSS_LOWPASS = 5,
950 
951         IM_MASK_IDEAL_RINGPASS = 6,
952         IM_MASK_IDEAL_RINGREJECT = 7,
953         IM_MASK_BUTTERWORTH_RINGPASS = 8,
954         IM_MASK_BUTTERWORTH_RINGREJECT = 9,
955         IM_MASK_GAUSS_RINGPASS = 10,
956         IM_MASK_GAUSS_RINGREJECT = 11,
957 
958         IM_MASK_IDEAL_BANDPASS = 12,
959         IM_MASK_IDEAL_BANDREJECT = 13,
960         IM_MASK_BUTTERWORTH_BANDPASS = 14,
961         IM_MASK_BUTTERWORTH_BANDREJECT = 15,
962         IM_MASK_GAUSS_BANDPASS = 16,
963         IM_MASK_GAUSS_BANDREJECT = 17,
964 
965         IM_MASK_FRACTAL_FLT = 18
966 } ImMaskType;
967 
968 /* We had them in the VIPS namespace for a while before deprecating them.
969  */
970 #define VIPS_MASK_IDEAL_HIGHPASS IM_MASK_IDEAL_HIGHPASS
971 #define VIPS_MASK_IDEAL_LOWPASS IM_MASK_IDEAL_LOWPASS
972 #define VIPS_MASK_BUTTERWORTH_HIGHPASS IM_MASK_BUTTERWORTH_HIGHPASS
973 #define VIPS_MASK_BUTTERWORTH_LOWPASS IM_MASK_BUTTERWORTH_LOWPASS
974 #define VIPS_MASK_GAUSS_HIGHPASS IM_MASK_GAUSS_HIGHPASS
975 #define VIPS_MASK_GAUSS_LOWPASS IM_MASK_GAUSS_LOWPASS
976 #define VIPS_MASK_IDEAL_RINGPASS IM_MASK_IDEAL_RINGPASS
977 #define VIPS_MASK_IDEAL_RINGREJECT IM_MASK_IDEAL_RINGREJECT
978 #define VIPS_MASK_BUTTERWORTH_RINGPASS IM_MASK_BUTTERWORTH_RINGPASS
979 #define VIPS_MASK_BUTTERWORTH_RINGREJECT IM_MASK_BUTTERWORTH_RINGREJECT
980 #define VIPS_MASK_GAUSS_RINGPASS IM_MASK_GAUSS_RINGPASS
981 #define VIPS_MASK_GAUSS_RINGREJECT IM_MASK_GAUSS_RINGREJECT
982 #define VIPS_MASK_IDEAL_BANDPASS IM_MASK_IDEAL_BANDPASS
983 #define VIPS_MASK_IDEAL_BANDREJECT IM_MASK_IDEAL_BANDREJECT
984 #define VIPS_MASK_BUTTERWORTH_BANDPASS IM_MASK_BUTTERWORTH_BANDPASS
985 #define VIPS_MASK_BUTTERWORTH_BANDREJECT IM_MASK_BUTTERWORTH_BANDREJECT
986 #define VIPS_MASK_GAUSS_BANDPASS IM_MASK_GAUSS_BANDPASS
987 #define VIPS_MASK_GAUSS_BANDREJECT IM_MASK_GAUSS_BANDREJECT
988 #define VIPS_MASK_FRACTAL_FLT IM_MASK_FRACTAL_FLT
989 
990 #define VIPS_MASK IM_MASK
991 
992 int im_flt_image_freq( VipsImage *in, VipsImage *out, ImMaskType flag, ... );
993 int im_create_fmask( VipsImage *out,
994 	int xsize, int ysize, ImMaskType flag, ... );
995 
996 int im_fwfft( VipsImage *in, VipsImage *out );
997 int im_invfft( VipsImage *in, VipsImage *out );
998 int im_invfftr( VipsImage *in, VipsImage *out );
999 
1000 int im_freqflt( VipsImage *in, VipsImage *mask, VipsImage *out );
1001 int im_disp_ps( VipsImage *in, VipsImage *out );
1002 int im_fractsurf( VipsImage *out, int size, double frd );
1003 int im_phasecor_fft( VipsImage *in1, VipsImage *in2, VipsImage *out );
1004 
1005 int im_cntlines( VipsImage *im, double *nolines, int flag );
1006 int im_label_regions( VipsImage *test, VipsImage *mask, int *segments );
1007 int im_rank( VipsImage *in, VipsImage *out, int width, int height, int index );
1008 int im_zerox( VipsImage *in, VipsImage *out, int sign );
1009 
1010 int im_benchmarkn( VipsImage *in, VipsImage *out, int n );
1011 int im_benchmark2( VipsImage *in, double *out );
1012 
1013 int im_draw_circle( VipsImage *image,
1014 	int x, int y, int radius, gboolean fill, VipsPel *ink );
1015 
1016 int im_draw_mask( VipsImage *image,
1017 	VipsImage *mask_im, int x, int y, VipsPel *ink );
1018 int im_draw_image( VipsImage *image, VipsImage *sub, int x, int y );
1019 int im_draw_rect( VipsImage *image,
1020 	int left, int top, int width, int height, int fill, VipsPel *ink );
1021 
1022 typedef int (*VipsPlotFn)( VipsImage *image, int x, int y,
1023 	void *a, void *b, void *c );
1024 
1025 int im_draw_line_user( VipsImage *image,
1026 	int x1, int y1, int x2, int y2,
1027 	VipsPlotFn plot, void *a, void *b, void *c );
1028 int im_draw_line( VipsImage *image,
1029 	int x1, int y1, int x2, int y2, VipsPel *ink );
1030 int im_lineset( VipsImage *in, VipsImage *out, VipsImage *mask, VipsImage *ink,
1031 	int n, int *x1v, int *y1v, int *x2v, int *y2v );
1032 
1033 int im_insertset( VipsImage *main, VipsImage *sub, VipsImage *out, int n, int *x, int *y );
1034 
1035 int im_draw_flood( VipsImage *image, int x, int y, VipsPel *ink, VipsRect *dout );
1036 int im_draw_flood_blob( VipsImage *image,
1037 	int x, int y, VipsPel *ink, VipsRect *dout );
1038 int im_draw_flood_other( VipsImage *image, VipsImage *test,
1039 	int x, int y, int serial, VipsRect *dout );
1040 
1041 int im_draw_point( VipsImage *image, int x, int y, VipsPel *ink );
1042 int im_read_point( VipsImage *image, int x, int y, VipsPel *ink );
1043 
1044 int im_draw_smudge( VipsImage *image,
1045 	int left, int top, int width, int height );
1046 
1047 void im_filename_split( const char *path, char *name, char *mode );
1048 const char *im_skip_dir( const char *filename );
1049 void im_filename_suffix( const char *path, char *suffix );
1050 int im_filename_suffix_match( const char *path, const char *suffixes[] );
1051 char *im_getnextoption( char **in );
1052 char *im_getsuboption( const char *buf );
1053 
1054 int im_match_linear( VipsImage *ref, VipsImage *sec, VipsImage *out,
1055 	int xr1, int yr1, int xs1, int ys1,
1056 	int xr2, int yr2, int xs2, int ys2 );
1057 int im_match_linear_search( VipsImage *ref, VipsImage *sec, VipsImage *out,
1058 	int xr1, int yr1, int xs1, int ys1,
1059 	int xr2, int yr2, int xs2, int ys2,
1060 	int hwindowsize, int hsearchsize );
1061 
1062 int im_global_balance( VipsImage *in, VipsImage *out, double gamma );
1063 int im_global_balancef( VipsImage *in, VipsImage *out, double gamma );
1064 
1065 int im_remosaic( VipsImage *in, VipsImage *out,
1066 	const char *old_str, const char *new_str );
1067 
1068 int im_lrmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
1069 	int dx, int dy, int mwidth );
1070 int im_lrmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out,
1071 	int xr1, int yr1, int xs1, int ys1,
1072 	int xr2, int yr2, int xs2, int ys2,
1073 	int mwidth );
1074 int im_tbmerge( VipsImage *ref, VipsImage *sec, VipsImage *out,
1075 	int dx, int dy, int mwidth );
1076 int im_tbmerge1( VipsImage *ref, VipsImage *sec, VipsImage *out,
1077 	int xr1, int yr1, int xs1, int ys1,
1078 	int xr2, int yr2, int xs2, int ys2,
1079 	int mwidth );
1080 
1081 int im_lrmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
1082 	int bandno,
1083 	int xref, int yref, int xsec, int ysec,
1084 	int hwindowsize, int hsearchsize,
1085 	int balancetype,
1086 	int mwidth );
1087 int im_lrmosaic1( VipsImage *ref, VipsImage *sec, VipsImage *out,
1088 	int bandno,
1089 	int xr1, int yr1, int xs1, int ys1,
1090 	int xr2, int yr2, int xs2, int ys2,
1091 	int hwindowsize, int hsearchsize,
1092 	int balancetype,
1093 	int mwidth );
1094 int im_tbmosaic( VipsImage *ref, VipsImage *sec, VipsImage *out,
1095 	int bandno,
1096 	int xref, int yref, int xsec, int ysec,
1097 	int hwindowsize, int hsearchsize,
1098 	int balancetype,
1099 	int mwidth );
1100 int im_tbmosaic1( VipsImage *ref, VipsImage *sec, VipsImage *out,
1101 	int bandno,
1102 	int xr1, int yr1, int xs1, int ys1,
1103 	int xr2, int yr2, int xs2, int ys2,
1104 	int hwindowsize, int hsearchsize,
1105 	int balancetype,
1106 	int mwidth );
1107 
1108 int im_correl( VipsImage *ref, VipsImage *sec,
1109 	int xref, int yref, int xsec, int ysec,
1110 	int hwindowsize, int hsearchsize,
1111 	double *correlation, int *x, int *y );
1112 
1113 int im_align_bands( VipsImage *in, VipsImage *out );
1114 int im_maxpos_subpel( VipsImage *in, double *x, double *y );
1115 
1116 VipsImage *vips__deprecated_open_read( const char *filename, gboolean sequential );
1117 VipsImage *vips__deprecated_open_write( const char *filename );
1118 
1119 void im__format_init( void );
1120 
1121 void im__tiff_register( void );
1122 void im__jpeg_register( void );
1123 void im__png_register( void );
1124 void im__csv_register( void );
1125 void im__ppm_register( void );
1126 void im__analyze_register( void );
1127 void im__exr_register( void );
1128 void im__magick_register( void );
1129 
1130 int im__bandup( const char *domain, VipsImage *in, VipsImage *out, int n );
1131 int im__bandalike_vec( const char *domain, VipsImage **in, VipsImage **out, int n );
1132 int im__bandalike( const char *domain,
1133 	VipsImage *in1, VipsImage *in2, VipsImage *out1, VipsImage *out2 );
1134 int im__formatalike_vec( VipsImage **in, VipsImage **out, int n );
1135 int im__formatalike( VipsImage *in1, VipsImage *in2, VipsImage *out1, VipsImage *out2 );
1136 
1137 typedef int (*im__wrapscan_fn)( void *p, int n, void *seq, void *a, void *b );
1138 int im__wrapscan( VipsImage *in,
1139 	VipsStartFn start, im__wrapscan_fn scan, VipsStopFn stop,
1140 	void *a, void *b );
1141 int im__colour_difference( const char *domain,
1142 	VipsImage *in1, VipsImage *in2, VipsImage *out,
1143 	im_wrapmany_fn buffer_fn, void *a, void *b );
1144 int im__colour_unary( const char *domain,
1145 	VipsImage *in, VipsImage *out, VipsInterpretation interpretation,
1146 	im_wrapone_fn buffer_fn, void *a, void *b );
1147 VipsImage **im__insert_base( const char *domain,
1148 	VipsImage *in1, VipsImage *in2, VipsImage *out );
1149 
1150 /* TODO(kleisauke): These are also defined in pmosaicing.h */
1151 int vips__find_lroverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out,
1152         int bandno_in,
1153         int xref, int yref, int xsec, int ysec,
1154         int halfcorrelation, int halfarea,
1155         int *dx0, int *dy0,
1156         double *scale1, double *angle1, double *dx1, double *dy1 );
1157 int vips__find_tboverlap( VipsImage *ref_in, VipsImage *sec_in, VipsImage *out,
1158         int bandno_in,
1159         int xref, int yref, int xsec, int ysec,
1160         int halfcorrelation, int halfarea,
1161         int *dx0, int *dy0,
1162         double *scale1, double *angle1, double *dx1, double *dy1 );
1163 int im__find_best_contrast( VipsImage *image,
1164 	int xpos, int ypos, int xsize, int ysize,
1165 	int xarray[], int yarray[], int cont[],
1166 	int nbest, int hcorsize );
1167 int im__balance( VipsImage *ref, VipsImage *sec, VipsImage *out,
1168 	VipsImage **ref_out, VipsImage **sec_out, int dx, int dy, int balancetype );
1169 
1170 void imb_LCh2Lab( float *, float *, int );
1171 
1172 /* A colour temperature.
1173  */
1174 typedef struct {
1175 	double X0, Y0, Z0;
1176 } im_colour_temperature;
1177 
1178 void imb_XYZ2Lab( float *, float *, int, im_colour_temperature * );
1179 void imb_LabS2Lab( signed short *, float *, int );
1180 void imb_Lab2LabS( float *, signed short *, int n );
1181 
1182 
1183 void im_copy_dmask_matrix( DOUBLEMASK *mask, double **matrix );
1184 void im_copy_matrix_dmask( double **matrix, DOUBLEMASK *mask );
1185 
1186 
1187 
1188 int *im_ivector(int nl, int nh);
1189 float *im_fvector(int nl, int nh);
1190 double *im_dvector(int nl, int nh);
1191 void im_free_ivector(int *v, int nl, int nh);
1192 void im_free_fvector(float *v, int nl, int nh);
1193 void im_free_dvector(double *v, int nl, int nh);
1194 
1195 int **im_imat_alloc(int nrl, int nrh, int ncl, int nch);
1196 void im_free_imat(int **m, int nrl, int nrh, int ncl, int nch);
1197 float **im_fmat_alloc(int nrl, int nrh, int ncl, int nch);
1198 void im_free_fmat(float **m, int nrl, int nrh, int ncl, int nch);
1199 double **im_dmat_alloc(int nrl, int nrh, int ncl, int nch);
1200 void im_free_dmat(double **m, int nrl, int nrh, int ncl, int nch);
1201 
1202 int im_invmat( double **, int );
1203 
1204 int *im_offsets45( int size );
1205 
1206 int im_conv_f_raw( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
1207 int im_convsep_f_raw( VipsImage *in, VipsImage *out, DOUBLEMASK *mask );
1208 
1209 int im_greyc_mask( VipsImage *in, VipsImage *out, VipsImage *mask,
1210 	int iterations, float amplitude, float sharpness, float anisotropy,
1211 	float alpha, float sigma, float dl, float da, float gauss_prec,
1212 	int interpolation, int fast_approx );
1213 
1214 int vips_check_imask( const char *domain, INTMASK *mask );
1215 int vips_check_dmask( const char *domain, DOUBLEMASK *mask );
1216 int vips_check_dmask_1d( const char *domain, DOUBLEMASK *mask );
1217 
1218 GOptionGroup *vips_get_option_group( void );
1219 
1220 /* old window manager API
1221  */
1222 VipsWindow *vips_window_ref( VipsImage *im, int top, int height );
1223 
1224 FILE *vips_popenf( const char *fmt, const char *mode, ... )
1225 	__attribute__((format(printf, 1, 3)));
1226 
1227 double *vips__ink_to_vector( const char *domain,
1228 	VipsImage *im, VipsPel *ink, int *n );
1229 
1230 VipsPel *im__vector_to_ink( const char *domain,
1231 	VipsImage *im, int n, double *vec );
1232 
1233 /* This stuff is very, very old and should not be used by anyone now.
1234  */
1235 #ifdef VIPS_ENABLE_ANCIENT
1236 #include <vips/deprecated.h>
1237 #endif /*VIPS_ENABLE_ANCIENT*/
1238 
1239 #include <vips/dispatch.h>
1240 #include <vips/almostdeprecated.h>
1241 
1242 #ifdef __cplusplus
1243 }
1244 #endif /*__cplusplus*/
1245 
1246 #endif /*VIPS_VIPS7COMPAT_H*/
1247 
1248 
1249