1 /* Function dispatch tables for arithmetic.
2 *
3 * J. Cupitt, 8/4/93.
4 */
5
6 /*
7
8 This file is part of VIPS.
9
10 VIPS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 02110-1301 USA
24
25 */
26
27 /*
28
29 These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
30
31 */
32
33 #ifdef HAVE_CONFIG_H
34 #include <config.h>
35 #endif /*HAVE_CONFIG_H*/
36 #include <vips/intl.h>
37
38 #include <stdio.h>
39
40 #include <vips/vips.h>
41 #include <vips/vips7compat.h>
42
43 /* One image in, one out.
44 */
45 static im_arg_desc one_in_one_out[] = {
46 IM_INPUT_IMAGE( "in" ),
47 IM_OUTPUT_IMAGE( "out" )
48 };
49
50 /* Two images in, one out.
51 */
52 static im_arg_desc two_in_one_out[] = {
53 IM_INPUT_IMAGE( "in1" ),
54 IM_INPUT_IMAGE( "in2" ),
55 IM_OUTPUT_IMAGE( "out" )
56 };
57
58 /* Call im_sRGB2XYZ via arg vector.
59 */
60 static int
sRGB2XYZ_vec(im_object * argv)61 sRGB2XYZ_vec( im_object *argv )
62 {
63 return( im_sRGB2XYZ( argv[0], argv[1] ) );
64 }
65
66 /* Description of im_sRGB2XYZ.
67 */
68 static im_function sRGB2XYZ_desc = {
69 "im_sRGB2XYZ", /* Name */
70 "convert sRGB to XYZ", /* Description */
71 IM_FN_PIO, /* Flags */
72 sRGB2XYZ_vec, /* Dispatch function */
73 IM_NUMBER( one_in_one_out ), /* Size of arg list */
74 one_in_one_out /* Arg list */
75 };
76
77 /* Call im_XYZ2sRGB via arg vector.
78 */
79 static int
XYZ2sRGB_vec(im_object * argv)80 XYZ2sRGB_vec( im_object *argv )
81 {
82 return( im_XYZ2sRGB( argv[0], argv[1] ) );
83 }
84
85 /* Description of im_XYZ2sRGB.
86 */
87 static im_function XYZ2sRGB_desc = {
88 "im_XYZ2sRGB", /* Name */
89 "convert XYZ to sRGB", /* Description */
90 IM_FN_PIO, /* Flags */
91 XYZ2sRGB_vec, /* Dispatch function */
92 IM_NUMBER( one_in_one_out ), /* Size of arg list */
93 one_in_one_out /* Arg list */
94 };
95
96 /* Call im_LCh2Lab via arg vector.
97 */
98 static int
LCh2Lab_vec(im_object * argv)99 LCh2Lab_vec( im_object *argv )
100 {
101 return( im_LCh2Lab( argv[0], argv[1] ) );
102 }
103
104 /* Description of im_LCh2Lab.
105 */
106 static im_function LCh2Lab_desc = {
107 "im_LCh2Lab", /* Name */
108 "convert LCh to Lab", /* Description */
109 IM_FN_PIO, /* Flags */
110 LCh2Lab_vec, /* Dispatch function */
111 IM_NUMBER( one_in_one_out ), /* Size of arg list */
112 one_in_one_out /* Arg list */
113 };
114
115 /* Call im_LabQ2XYZ via arg vector.
116 */
117 static int
LabQ2XYZ_vec(im_object * argv)118 LabQ2XYZ_vec( im_object *argv )
119 {
120 return( im_LabQ2XYZ( argv[0], argv[1] ) );
121 }
122
123 /* Description of im_LabQ2XYZ.
124 */
125 static im_function LabQ2XYZ_desc = {
126 "im_LabQ2XYZ", /* Name */
127 "convert LabQ to XYZ", /* Description */
128 IM_FN_PIO, /* Flags */
129 LabQ2XYZ_vec, /* Dispatch function */
130 IM_NUMBER( one_in_one_out ), /* Size of arg list */
131 one_in_one_out /* Arg list */
132 };
133
134 /* Call im_LCh2UCS via arg vector.
135 */
136 static int
LCh2UCS_vec(im_object * argv)137 LCh2UCS_vec( im_object *argv )
138 {
139 return( im_LCh2UCS( argv[0], argv[1] ) );
140 }
141
142 /* Description of im_LCh2UCS.
143 */
144 static im_function LCh2UCS_desc = {
145 "im_LCh2UCS", /* Name */
146 "convert LCh to UCS", /* Description */
147 IM_FN_PIO, /* Flags */
148 LCh2UCS_vec, /* Dispatch function */
149 IM_NUMBER( one_in_one_out ), /* Size of arg list */
150 one_in_one_out /* Arg list */
151 };
152
153 /* Call im_Lab2LCh via arg vector.
154 */
155 static int
Lab2LCh_vec(im_object * argv)156 Lab2LCh_vec( im_object *argv )
157 {
158 return( im_Lab2LCh( argv[0], argv[1] ) );
159 }
160
161 /* Description of im_Lab2LCh.
162 */
163 static im_function Lab2LCh_desc = {
164 "im_Lab2LCh", /* Name */
165 "convert Lab to LCh", /* Description */
166 IM_FN_PIO, /* Flags */
167 Lab2LCh_vec, /* Dispatch function */
168 IM_NUMBER( one_in_one_out ), /* Size of arg list */
169 one_in_one_out /* Arg list */
170 };
171
172 /* Call im_Lab2LabQ() via arg vector.
173 */
174 static int
Lab2LabQ_vec(im_object * argv)175 Lab2LabQ_vec( im_object *argv )
176 {
177 return( im_Lab2LabQ( argv[0], argv[1] ) );
178 }
179
180 /* Description of im_Lab2LabQ.
181 */
182 static im_function Lab2LabQ_desc = {
183 "im_Lab2LabQ", /* Name */
184 "convert Lab to LabQ", /* Description */
185 IM_FN_PIO, /* Flags */
186 Lab2LabQ_vec, /* Dispatch function */
187 IM_NUMBER( one_in_one_out ), /* Size of arg list */
188 one_in_one_out /* Arg list */
189 };
190
191 /* Call im_Lab2XYZ() via arg vector.
192 */
193 static int
Lab2XYZ_vec(im_object * argv)194 Lab2XYZ_vec( im_object *argv )
195 {
196 return( im_Lab2XYZ( argv[0], argv[1] ) );
197 }
198
199 /* Description of im_Lab2XYZ.
200 */
201 static im_function Lab2XYZ_desc = {
202 "im_Lab2XYZ", /* Name */
203 "convert D65 Lab to XYZ", /* Description */
204 IM_FN_PIO, /* Flags */
205 Lab2XYZ_vec, /* Dispatch function */
206 IM_NUMBER( one_in_one_out ), /* Size of arg list */
207 one_in_one_out /* Arg list */
208 };
209
210 static int
icc_present_vec(im_object * argv)211 icc_present_vec( im_object *argv )
212 {
213 int *present = ((int *) argv[0]);
214
215 *present = im_icc_present();
216
217 return( 0 );
218 }
219
220 static im_arg_desc icc_present_args[] = {
221 IM_OUTPUT_INT( "present" )
222 };
223
224 /* Description of im_icc_present.
225 */
226 static im_function icc_present_desc = {
227 "im_icc_present", /* Name */
228 "test for presence of ICC library", /* Description */
229 0, /* Flags */
230 icc_present_vec, /* Dispatch function */
231 IM_NUMBER( icc_present_args ), /* Size of arg list */
232 icc_present_args /* Arg list */
233 };
234
235 static int
icc_transform_vec(im_object * argv)236 icc_transform_vec( im_object *argv )
237 {
238 int intent = *((int *) argv[4]);
239
240 return( im_icc_transform( argv[0], argv[1],
241 argv[2], argv[3], intent ) );
242 }
243
244 static im_arg_desc icc_transform_args[] = {
245 IM_INPUT_IMAGE( "in" ),
246 IM_OUTPUT_IMAGE( "out" ),
247 IM_INPUT_STRING( "input_profile" ),
248 IM_INPUT_STRING( "output_profile" ),
249 IM_INPUT_INT( "intent" )
250 };
251
252 /* Description of im_icc_transform.
253 */
254 static im_function icc_transform_desc = {
255 "im_icc_transform", /* Name */
256 "convert between two device images with a pair of ICC profiles",
257 /* Description */
258 IM_FN_PIO, /* Flags */
259 icc_transform_vec, /* Dispatch function */
260 IM_NUMBER( icc_transform_args ), /* Size of arg list */
261 icc_transform_args /* Arg list */
262 };
263
264 static int
icc_import_embedded_vec(im_object * argv)265 icc_import_embedded_vec( im_object *argv )
266 {
267 int intent = *((int *) argv[2]);
268
269 return( im_icc_import_embedded( argv[0], argv[1], intent ) );
270 }
271
272 static im_arg_desc icc_import_embedded_args[] = {
273 IM_INPUT_IMAGE( "in" ),
274 IM_OUTPUT_IMAGE( "out" ),
275 IM_INPUT_INT( "intent" )
276 };
277
278 /* Description of im_icc_import_embedded.
279 */
280 static im_function icc_import_embedded_desc = {
281 "im_icc_import_embedded", /* Name */
282 "convert a device image to float LAB using the embedded profile",
283 /* Description */
284 IM_FN_PIO, /* Flags */
285 icc_import_embedded_vec, /* Dispatch function */
286 IM_NUMBER( icc_import_embedded_args ), /* Size of arg list */
287 icc_import_embedded_args /* Arg list */
288 };
289
290 static int
icc_import_vec(im_object * argv)291 icc_import_vec( im_object *argv )
292 {
293 int intent = *((int *) argv[3]);
294
295 return( im_icc_import( argv[0], argv[1],
296 argv[2], intent ) );
297 }
298
299 static im_arg_desc icc_import_args[] = {
300 IM_INPUT_IMAGE( "in" ),
301 IM_OUTPUT_IMAGE( "out" ),
302 IM_INPUT_STRING( "input_profile" ),
303 IM_INPUT_INT( "intent" )
304 };
305
306 /* Description of im_icc_import.
307 */
308 static im_function icc_import_desc = {
309 "im_icc_import", /* Name */
310 "convert a device image to float LAB with an ICC profile",
311 /* Description */
312 IM_FN_PIO, /* Flags */
313 icc_import_vec, /* Dispatch function */
314 IM_NUMBER( icc_import_args ), /* Size of arg list */
315 icc_import_args /* Arg list */
316 };
317
318 static int
icc_export_depth_vec(im_object * argv)319 icc_export_depth_vec( im_object *argv )
320 {
321 int intent = *((int *) argv[4]);
322 int depth = *((int *) argv[2]);
323
324 return( im_icc_export_depth( argv[0], argv[1],
325 depth, argv[3], intent ) );
326 }
327
328 static im_arg_desc icc_export_depth_args[] = {
329 IM_INPUT_IMAGE( "in" ),
330 IM_OUTPUT_IMAGE( "out" ),
331 IM_INPUT_INT( "depth" ),
332 IM_INPUT_STRING( "output_profile" ),
333 IM_INPUT_INT( "intent" )
334 };
335
336 /* Description of im_icc_export_depth.
337 */
338 static im_function icc_export_depth_desc = {
339 "im_icc_export_depth", /* Name */
340 "convert a float LAB to device space with an ICC profile",
341 /* Description */
342 IM_FN_PIO, /* Flags */
343 icc_export_depth_vec, /* Dispatch function */
344 IM_NUMBER( icc_export_depth_args ), /* Size of arg list */
345 icc_export_depth_args /* Arg list */
346 };
347
348 static int
icc_ac2rc_vec(im_object * argv)349 icc_ac2rc_vec( im_object *argv )
350 {
351 return( im_icc_ac2rc( argv[0], argv[1], argv[2] ) );
352 }
353
354 static im_arg_desc icc_ac2rc_args[] = {
355 IM_INPUT_IMAGE( "in" ),
356 IM_OUTPUT_IMAGE( "out" ),
357 IM_INPUT_STRING( "profile" )
358 };
359
360 /* Description of im_icc_ac2rc.
361 */
362 static im_function icc_ac2rc_desc = {
363 "im_icc_ac2rc", /* Name */
364 "convert LAB from AC to RC using an ICC profile",
365 /* Description */
366 IM_FN_PIO, /* Flags */
367 icc_ac2rc_vec, /* Dispatch function */
368 IM_NUMBER( icc_ac2rc_args ), /* Size of arg list */
369 icc_ac2rc_args /* Arg list */
370 };
371
372 static int
Lab2XYZ_temp_vec(im_object * argv)373 Lab2XYZ_temp_vec( im_object *argv )
374 {
375 double X0 = *((double *) argv[2]);
376 double Y0 = *((double *) argv[3]);
377 double Z0 = *((double *) argv[4]);
378
379 return( im_Lab2XYZ_temp( argv[0], argv[1], X0, Y0, Z0 ) );
380 }
381
382 static im_arg_desc temp_args[] = {
383 IM_INPUT_IMAGE( "in" ),
384 IM_OUTPUT_IMAGE( "out" ),
385 IM_INPUT_DOUBLE( "X0" ),
386 IM_INPUT_DOUBLE( "Y0" ),
387 IM_INPUT_DOUBLE( "Z0" )
388 };
389
390 /* Description of im_Lab2XYZ_temp.
391 */
392 static im_function Lab2XYZ_temp_desc = {
393 "im_Lab2XYZ_temp", /* Name */
394 "convert Lab to XYZ, with a specified colour temperature",
395 /* Description */
396 IM_FN_PIO, /* Flags */
397 Lab2XYZ_temp_vec, /* Dispatch function */
398 IM_NUMBER( temp_args ), /* Size of arg list */
399 temp_args /* Arg list */
400 };
401
402 /* Call im_Lab2UCS() via arg vector.
403 */
404 static int
Lab2UCS_vec(im_object * argv)405 Lab2UCS_vec( im_object *argv )
406 {
407 return( im_Lab2UCS( argv[0], argv[1] ) );
408 }
409
410 /* Description of im_Lab2UCS.
411 */
412 static im_function Lab2UCS_desc = {
413 "im_Lab2UCS", /* Name */
414 "convert Lab to UCS", /* Description */
415 IM_FN_PIO, /* Flags */
416 Lab2UCS_vec, /* Dispatch function */
417 IM_NUMBER( one_in_one_out ), /* Size of arg list */
418 one_in_one_out /* Arg list */
419 };
420
421 /* Call im_LabQ2Lab() via arg vector.
422 */
423 static int
LabQ2Lab_vec(im_object * argv)424 LabQ2Lab_vec( im_object *argv )
425 {
426 return( im_LabQ2Lab( argv[0], argv[1] ) );
427 }
428
429 /* Description of im_LabQ2Lab.
430 */
431 static im_function LabQ2Lab_desc = {
432 "im_LabQ2Lab", /* Name */
433 "convert LabQ to Lab", /* Description */
434 IM_FN_PIO, /* Flags */
435 LabQ2Lab_vec, /* Dispatch function */
436 IM_NUMBER( one_in_one_out ), /* Size of arg list */
437 one_in_one_out /* Arg list */
438 };
439
440 /* Call im_rad2float() via arg vector.
441 */
442 static int
rad2float_vec(im_object * argv)443 rad2float_vec( im_object *argv )
444 {
445 return( im_rad2float( argv[0], argv[1] ) );
446 }
447
448 /* Description of im_rad2float.
449 */
450 static im_function rad2float_desc = {
451 "im_rad2float", /* Name */
452 "convert Radiance packed to float", /* Description */
453 IM_FN_PIO, /* Flags */
454 rad2float_vec, /* Dispatch function */
455 IM_NUMBER( one_in_one_out ), /* Size of arg list */
456 one_in_one_out /* Arg list */
457 };
458
459 /* Call im_float2rad() via arg vector.
460 */
461 static int
float2rad_vec(im_object * argv)462 float2rad_vec( im_object *argv )
463 {
464 return( im_float2rad( argv[0], argv[1] ) );
465 }
466
467 /* Description of im_float2rad
468 */
469 static im_function float2rad_desc = {
470 "im_float2rad", /* Name */
471 "convert float to Radiance packed", /* Description */
472 IM_FN_PIO, /* Flags */
473 float2rad_vec, /* Dispatch function */
474 IM_NUMBER( one_in_one_out ), /* Size of arg list */
475 one_in_one_out /* Arg list */
476 };
477
478 /* Call im_LabQ2LabS() via arg vector.
479 */
480 static int
LabQ2LabS_vec(im_object * argv)481 LabQ2LabS_vec( im_object *argv )
482 {
483 return( im_LabQ2LabS( argv[0], argv[1] ) );
484 }
485
486 /* Description of im_LabQ2LabS.
487 */
488 static im_function LabQ2LabS_desc = {
489 "im_LabQ2LabS", /* Name */
490 "convert LabQ to LabS", /* Description */
491 IM_FN_PIO, /* Flags */
492 LabQ2LabS_vec, /* Dispatch function */
493 IM_NUMBER( one_in_one_out ), /* Size of arg list */
494 one_in_one_out /* Arg list */
495 };
496
497 /* Call im_Lab2LabS() via arg vector.
498 */
499 static int
Lab2LabS_vec(im_object * argv)500 Lab2LabS_vec( im_object *argv )
501 {
502 return( im_Lab2LabS( argv[0], argv[1] ) );
503 }
504
505 /* Description of im_Lab2LabS.
506 */
507 static im_function Lab2LabS_desc = {
508 "im_Lab2LabS", /* Name */
509 "convert Lab to LabS", /* Description */
510 IM_FN_PIO, /* Flags */
511 Lab2LabS_vec, /* Dispatch function */
512 IM_NUMBER( one_in_one_out ), /* Size of arg list */
513 one_in_one_out /* Arg list */
514 };
515
516 /* Call im_LabS2Lab() via arg vector.
517 */
518 static int
LabS2Lab_vec(im_object * argv)519 LabS2Lab_vec( im_object *argv )
520 {
521 return( im_LabS2Lab( argv[0], argv[1] ) );
522 }
523
524 /* Description of im_LabS2Lab.
525 */
526 static im_function LabS2Lab_desc = {
527 "im_LabS2Lab", /* Name */
528 "convert LabS to Lab", /* Description */
529 IM_FN_PIO, /* Flags */
530 LabS2Lab_vec, /* Dispatch function */
531 IM_NUMBER( one_in_one_out ), /* Size of arg list */
532 one_in_one_out /* Arg list */
533 };
534
535 /* Call im_LabS2LabQ() via arg vector.
536 */
537 static int
LabS2LabQ_vec(im_object * argv)538 LabS2LabQ_vec( im_object *argv )
539 {
540 return( im_LabS2LabQ( argv[0], argv[1] ) );
541 }
542
543 /* Description of im_LabS2LabQ.
544 */
545 static im_function LabS2LabQ_desc = {
546 "im_LabS2LabQ", /* Name */
547 "convert LabS to LabQ", /* Description */
548 IM_FN_PIO, /* Flags */
549 LabS2LabQ_vec, /* Dispatch function */
550 IM_NUMBER( one_in_one_out ), /* Size of arg list */
551 one_in_one_out /* Arg list */
552 };
553
554 /* Call im_UCS2XYZ() via arg vector.
555 */
556 static int
UCS2XYZ_vec(im_object * argv)557 UCS2XYZ_vec( im_object *argv )
558 {
559 return( im_UCS2XYZ( argv[0], argv[1] ) );
560 }
561
562 /* Description of im_UCS2XYZ.
563 */
564 static im_function UCS2XYZ_desc = {
565 "im_UCS2XYZ", /* Name */
566 "convert UCS to XYZ", /* Description */
567 IM_FN_PIO, /* Flags */
568 UCS2XYZ_vec, /* Dispatch function */
569 IM_NUMBER( one_in_one_out ), /* Size of arg list */
570 one_in_one_out /* Arg list */
571 };
572
573 /* Call im_UCS2LCh() via arg vector.
574 */
575 static int
UCS2LCh_vec(im_object * argv)576 UCS2LCh_vec( im_object *argv )
577 {
578 return( im_UCS2LCh( argv[0], argv[1] ) );
579 }
580
581 /* Description of im_UCS2LCh.
582 */
583 static im_function UCS2LCh_desc = {
584 "im_UCS2LCh", /* Name */
585 "convert UCS to LCh", /* Description */
586 IM_FN_PIO, /* Flags */
587 UCS2LCh_vec, /* Dispatch function */
588 IM_NUMBER( one_in_one_out ), /* Size of arg list */
589 one_in_one_out /* Arg list */
590 };
591
592 /* Call im_UCS2Lab() via arg vector.
593 */
594 static int
UCS2Lab_vec(im_object * argv)595 UCS2Lab_vec( im_object *argv )
596 {
597 return( im_UCS2Lab( argv[0], argv[1] ) );
598 }
599
600 /* Description of im_UCS2Lab.
601 */
602 static im_function UCS2Lab_desc = {
603 "im_UCS2Lab", /* Name */
604 "convert UCS to Lab", /* Description */
605 IM_FN_PIO, /* Flags */
606 UCS2Lab_vec, /* Dispatch function */
607 IM_NUMBER( one_in_one_out ), /* Size of arg list */
608 one_in_one_out /* Arg list */
609 };
610
611 /* Call im_Yxy2XYZ via arg vector.
612 */
613 static int
Yxy2XYZ_vec(im_object * argv)614 Yxy2XYZ_vec( im_object *argv )
615 {
616 return( im_Yxy2XYZ( argv[0], argv[1] ) );
617 }
618
619 /* Description of im_Yxy2XYZ.
620 */
621 static im_function Yxy2XYZ_desc = {
622 "im_Yxy2XYZ", /* Name */
623 "convert Yxy to XYZ", /* Description */
624 IM_FN_PIO, /* Flags */
625 Yxy2XYZ_vec, /* Dispatch function */
626 IM_NUMBER( one_in_one_out ), /* Size of arg list */
627 one_in_one_out /* Arg list */
628 };
629
630 /* Call im_XYZ2Yxy via arg vector.
631 */
632 static int
XYZ2Yxy_vec(im_object * argv)633 XYZ2Yxy_vec( im_object *argv )
634 {
635 return( im_XYZ2Yxy( argv[0], argv[1] ) );
636 }
637
638 /* Description of im_XYZ2Yxy.
639 */
640 static im_function XYZ2Yxy_desc = {
641 "im_XYZ2Yxy", /* Name */
642 "convert XYZ to Yxy", /* Description */
643 IM_FN_PIO, /* Flags */
644 XYZ2Yxy_vec, /* Dispatch function */
645 IM_NUMBER( one_in_one_out ), /* Size of arg list */
646 one_in_one_out /* Arg list */
647 };
648
649 /* Call im_XYZ2Lab via arg vector.
650 */
651 static int
XYZ2Lab_vec(im_object * argv)652 XYZ2Lab_vec( im_object *argv )
653 {
654 return( im_XYZ2Lab( argv[0], argv[1] ) );
655 }
656
657 /* Description of im_XYZ2Lab.
658 */
659 static im_function XYZ2Lab_desc = {
660 "im_XYZ2Lab", /* Name */
661 "convert D65 XYZ to Lab", /* Description */
662 IM_FN_PIO, /* Flags */
663 XYZ2Lab_vec, /* Dispatch function */
664 IM_NUMBER( one_in_one_out ), /* Size of arg list */
665 one_in_one_out /* Arg list */
666 };
667
668 static int
XYZ2Lab_temp_vec(im_object * argv)669 XYZ2Lab_temp_vec( im_object *argv )
670 {
671 double X0 = *((double *) argv[2]);
672 double Y0 = *((double *) argv[3]);
673 double Z0 = *((double *) argv[4]);
674
675 return( im_XYZ2Lab_temp( argv[0], argv[1], X0, Y0, Z0 ) );
676 }
677
678 /* Description of im_XYZ2Lab_temp.
679 */
680 static im_function XYZ2Lab_temp_desc = {
681 "im_XYZ2Lab_temp", /* Name */
682 "convert XYZ to Lab, with a specified colour temperature",
683 /* Description */
684 IM_FN_PIO, /* Flags */
685 XYZ2Lab_temp_vec, /* Dispatch function */
686 IM_NUMBER( temp_args ), /* Size of arg list */
687 temp_args /* Arg list */
688 };
689
690 /* Call im_XYZ2UCS() via arg vector.
691 */
692 static int
XYZ2UCS_vec(im_object * argv)693 XYZ2UCS_vec( im_object *argv )
694 {
695 return( im_XYZ2UCS( argv[0], argv[1] ) );
696 }
697
698 /* Description of im_XYZ2UCS.
699 */
700 static im_function XYZ2UCS_desc = {
701 "im_XYZ2UCS", /* Name */
702 "convert XYZ to UCS", /* Description */
703 IM_FN_PIO, /* Flags */
704 XYZ2UCS_vec, /* Dispatch function */
705 IM_NUMBER( one_in_one_out ), /* Size of arg list */
706 one_in_one_out /* Arg list */
707 };
708
709 /* Args to XYZ2disp and disp2XYZ.
710 */
711 static im_arg_desc XYZ2disp_args[] = {
712 IM_INPUT_IMAGE( "in" ),
713 IM_OUTPUT_IMAGE( "out" ),
714 IM_INPUT_DISPLAY( "disp" )
715 };
716
717 /* Call im_XYZ2disp() via arg vector.
718 */
719 static int
XYZ2disp_vec(im_object * argv)720 XYZ2disp_vec( im_object *argv )
721 {
722 return( im_XYZ2disp( argv[0], argv[1], argv[2] ) );
723 }
724
725 /* Description of im_XYZ2disp.
726 */
727 static im_function XYZ2disp_desc = {
728 "im_XYZ2disp", /* Name */
729 "convert XYZ to displayble", /* Description */
730 IM_FN_PIO, /* Flags */
731 XYZ2disp_vec, /* Dispatch function */
732 IM_NUMBER( XYZ2disp_args ), /* Size of arg list */
733 XYZ2disp_args /* Arg list */
734 };
735
736 /* Call im_Lab2disp() via arg vector.
737 */
738 static int
Lab2disp_vec(im_object * argv)739 Lab2disp_vec( im_object *argv )
740 {
741 return( im_Lab2disp( argv[0], argv[1], argv[2] ) );
742 }
743
744 /* Description of im_Lab2disp.
745 */
746 static im_function Lab2disp_desc = {
747 "im_Lab2disp", /* Name */
748 "convert Lab to displayable", /* Description */
749 IM_FN_PIO, /* Flags */
750 Lab2disp_vec, /* Dispatch function */
751 IM_NUMBER( XYZ2disp_args ), /* Size of arg list */
752 XYZ2disp_args /* Arg list */
753 };
754
755 /* Call im_LabQ2disp() via arg vector.
756 */
757 static int
LabQ2disp_vec(im_object * argv)758 LabQ2disp_vec( im_object *argv )
759 {
760 return( im_LabQ2disp( argv[0], argv[1], argv[2] ) );
761 }
762
763 /* Description of im_LabQ2disp.
764 */
765 static im_function LabQ2disp_desc = {
766 "im_LabQ2disp", /* Name */
767 "convert LabQ to displayable", /* Description */
768 IM_FN_PIO, /* Flags */
769 LabQ2disp_vec, /* Dispatch function */
770 IM_NUMBER( XYZ2disp_args ), /* Size of arg list */
771 XYZ2disp_args /* Arg list */
772 };
773
774 /* Call im_dE00_fromLab() via arg vector.
775 */
776 static int
dE00_fromLab_vec(im_object * argv)777 dE00_fromLab_vec( im_object *argv )
778 {
779 return( im_dE00_fromLab( argv[0], argv[1], argv[2] ) );
780 }
781
782 /* Description of im_dE00_fromLab.
783 */
784 static im_function dE00_fromLab_desc = {
785 "im_dE00_fromLab", /* Name */
786 "calculate delta-E CIE2000 for two Lab images",
787 IM_FN_PIO, /* Flags */
788 dE00_fromLab_vec, /* Dispatch function */
789 IM_NUMBER( two_in_one_out ), /* Size of arg list */
790 two_in_one_out /* Arg list */
791 };
792
793 /* Call im_dECMC_fromLab() via arg vector.
794 */
795 static int
dECMC_fromLab_vec(im_object * argv)796 dECMC_fromLab_vec( im_object *argv )
797 {
798 return( im_dECMC_fromLab( argv[0], argv[1], argv[2] ) );
799 }
800
801 /* Description of im_dECMC_fromLab.
802 */
803 static im_function dECMC_fromLab_desc = {
804 "im_dECMC_fromLab", /* Name */
805 "calculate delta-E CMC(1:1) for two Lab images",
806 IM_FN_PIO, /* Flags */
807 dECMC_fromLab_vec, /* Dispatch function */
808 IM_NUMBER( two_in_one_out ), /* Size of arg list */
809 two_in_one_out /* Arg list */
810 };
811
812 /* Call im_dE_fromXYZ() via arg vector.
813 */
814 static int
dE_fromXYZ_vec(im_object * argv)815 dE_fromXYZ_vec( im_object *argv )
816 {
817 return( im_dE_fromXYZ( argv[0], argv[1], argv[2] ) );
818 }
819
820 /* Description of im_dE_fromXYZ.
821 */
822 static im_function dE_fromXYZ_desc = {
823 "im_dE_fromXYZ", /* Name */
824 "calculate delta-E for two XYZ images",
825 IM_FN_PIO, /* Flags */
826 dE_fromXYZ_vec, /* Dispatch function */
827 IM_NUMBER( two_in_one_out ), /* Size of arg list */
828 two_in_one_out /* Arg list */
829 };
830
831 /* Call im_dE_fromLab() via arg vector.
832 */
833 static int
dE_fromLab_vec(im_object * argv)834 dE_fromLab_vec( im_object *argv )
835 {
836 return( im_dE_fromLab( argv[0], argv[1], argv[2] ) );
837 }
838
839 /* Description of im_dE_fromLab.
840 */
841 static im_function dE_fromLab_desc = {
842 "im_dE_fromLab", /* Name */
843 "calculate delta-E for two Lab images",
844 IM_FN_PIO, /* Flags */
845 dE_fromLab_vec, /* Dispatch function */
846 IM_NUMBER( two_in_one_out ), /* Size of arg list */
847 two_in_one_out /* Arg list */
848 };
849
850 /* Two images in, one out.
851 */
852 static im_arg_desc dE_fromdisp_args[] = {
853 IM_INPUT_IMAGE( "in1" ),
854 IM_INPUT_IMAGE( "in2" ),
855 IM_OUTPUT_IMAGE( "out" ),
856 IM_INPUT_DISPLAY( "disp" )
857 };
858
859 /* Call im_dE_fromdisp() via arg vector.
860 */
861 static int
dE_fromdisp_vec(im_object * argv)862 dE_fromdisp_vec( im_object *argv )
863 {
864 return( im_dE_fromdisp( argv[0], argv[1], argv[2], argv[3] ) );
865 }
866
867 /* Description of im_dE_fromdisp.
868 */
869 static im_function dE_fromdisp_desc = {
870 "im_dE_fromdisp", /* Name */
871 "calculate delta-E for two displayable images",
872 IM_FN_PIO, /* Flags */
873 dE_fromdisp_vec, /* Dispatch function */
874 IM_NUMBER( dE_fromdisp_args ), /* Size of arg list */
875 dE_fromdisp_args /* Arg list */
876 };
877
878 /* Call im_dECMC_fromdisp() via arg vector.
879 */
880 static int
dECMC_fromdisp_vec(im_object * argv)881 dECMC_fromdisp_vec( im_object *argv )
882 {
883 return( im_dECMC_fromdisp( argv[0], argv[1], argv[2], argv[3] ) );
884 }
885
886 /* Description of im_dECMC_fromdisp.
887 */
888 static im_function dECMC_fromdisp_desc = {
889 "im_dECMC_fromdisp", /* Name */
890 "calculate delta-E CMC(1:1) for two displayable images",
891 IM_FN_PIO, /* Flags */
892 dECMC_fromdisp_vec, /* Dispatch function */
893 IM_NUMBER( dE_fromdisp_args ), /* Size of arg list */
894 dE_fromdisp_args /* Arg list */
895 };
896
897 /* Call im_disp2XYZ() via arg vector.
898 */
899 static int
disp2XYZ_vec(im_object * argv)900 disp2XYZ_vec( im_object *argv )
901 {
902 return( im_disp2XYZ( argv[0], argv[1], argv[2] ) );
903 }
904
905 /* Description of im_disp2XYZ.
906 */
907 static im_function disp2XYZ_desc = {
908 "im_disp2XYZ", /* Name */
909 "convert displayable to XYZ", /* Description */
910 IM_FN_PIO, /* Flags */
911 disp2XYZ_vec, /* Dispatch function */
912 IM_NUMBER( XYZ2disp_args ), /* Size of arg list */
913 XYZ2disp_args /* Arg list */
914 };
915
916 /* Call im_disp2Lab() via arg vector.
917 */
918 static int
disp2Lab_vec(im_object * argv)919 disp2Lab_vec( im_object *argv )
920 {
921 return( im_disp2Lab( argv[0], argv[1], argv[2] ) );
922 }
923
924 /* Description of im_disp2Lab.
925 */
926 static im_function disp2Lab_desc = {
927 "im_disp2Lab", /* Name */
928 "convert displayable to Lab", /* Description */
929 IM_FN_PIO, /* Flags */
930 disp2Lab_vec, /* Dispatch function */
931 IM_NUMBER( XYZ2disp_args ), /* Size of arg list */
932 XYZ2disp_args /* Arg list */
933 };
934
935 static im_arg_desc morph_args[] = {
936 IM_INPUT_IMAGE( "in" ),
937 IM_OUTPUT_IMAGE( "out" ),
938 IM_INPUT_DMASK( "greyscale" ),
939 IM_INPUT_DOUBLE( "L_offset" ),
940 IM_INPUT_DOUBLE( "L_scale" ),
941 IM_INPUT_DOUBLE( "a_scale" ),
942 IM_INPUT_DOUBLE( "b_scale" )
943 };
944
945 static int
morph_vec(im_object * argv)946 morph_vec( im_object *argv )
947 {
948 im_mask_object *mo = argv[2];
949 double L_offset = *((double *) argv[3]);
950 double L_scale = *((double *) argv[4]);
951 double a_scale = *((double *) argv[5]);
952 double b_scale = *((double *) argv[6]);
953
954 return( im_lab_morph( argv[0], argv[1],
955 mo->mask, L_offset, L_scale, a_scale, b_scale ) );
956 }
957
958 static im_function morph_desc = {
959 "im_lab_morph", /* Name */
960 "morph colourspace of a LAB image",
961 IM_FN_PIO | IM_FN_PTOP, /* Flags */
962 morph_vec, /* Dispatch function */
963 IM_NUMBER( morph_args ), /* Size of arg list */
964 morph_args /* Arg list */
965 };
966
967 /* Package up all these functions.
968 */
969 static im_function *colour_list[] = {
970 &LCh2Lab_desc,
971 &LCh2UCS_desc,
972 &Lab2LCh_desc,
973 &Lab2LabQ_desc,
974 &Lab2LabS_desc,
975 &Lab2UCS_desc,
976 &Lab2XYZ_desc,
977 &Lab2XYZ_temp_desc,
978 &Lab2disp_desc,
979 &LabQ2LabS_desc,
980 &LabQ2Lab_desc,
981 &LabQ2XYZ_desc,
982 &LabQ2disp_desc,
983 &LabS2LabQ_desc,
984 &LabS2Lab_desc,
985 &UCS2LCh_desc,
986 &UCS2Lab_desc,
987 &UCS2XYZ_desc,
988 &XYZ2Lab_desc,
989 &XYZ2Lab_temp_desc,
990 &XYZ2UCS_desc,
991 &XYZ2Yxy_desc,
992 &XYZ2disp_desc,
993 &XYZ2sRGB_desc,
994 &Yxy2XYZ_desc,
995 &dE00_fromLab_desc,
996 &dECMC_fromLab_desc,
997 &dECMC_fromdisp_desc,
998 &dE_fromLab_desc,
999 &dE_fromXYZ_desc,
1000 &dE_fromdisp_desc,
1001 &disp2Lab_desc,
1002 &disp2XYZ_desc,
1003 &float2rad_desc,
1004 &icc_ac2rc_desc,
1005 &icc_export_depth_desc,
1006 &icc_import_desc,
1007 &icc_import_embedded_desc,
1008 &icc_present_desc,
1009 &icc_transform_desc,
1010 &morph_desc,
1011 &rad2float_desc,
1012 &sRGB2XYZ_desc
1013 };
1014
1015 /* Package of functions.
1016 */
1017 im_package im__colour = {
1018 "colour",
1019 IM_NUMBER( colour_list ),
1020 colour_list
1021 };
1022