/usr/share/gtk-doc/html/libvips/VipsOperation.html is in libvips-doc 8.4.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VipsOperation: VIPS Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="VIPS Reference Manual">
<link rel="up" href="ch02.html" title="Core VIPS API">
<link rel="prev" href="libvips-generate.html" title="generate">
<link rel="next" href="libvips-error.html" title="error">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
<a href="#VipsOperation.description" class="shortcut">Description</a></span><span id="nav_hierarchy"> <span class="dim">|</span>
<a href="#VipsOperation.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_signals"> <span class="dim">|</span>
<a href="#VipsOperation.signals" class="shortcut">Signals</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="libvips-generate.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="libvips-error.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="VipsOperation"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="VipsOperation.top_of_page"></a>VipsOperation</span></h2>
<p>VipsOperation — the VIPS operation base object class</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="VipsOperation.stability-level"></a><h2>Stability Level</h2>
<acronym title="The intention of a Stable interface is to enable arbitrary third parties to
develop applications to these interfaces, release them, and have confidence that
they will run on all minor releases of the product (after the one in which the
interface was introduced, and within the same major release). Even at a major
release, incompatible changes are expected to be rare, and to have strong
justifications.
"><span class="acronym">Stable</span></acronym>, unless otherwise indicated
</div>
<div class="refsect1">
<a name="VipsOperation.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">gboolean</span>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="VipsOperation.html#VipsOperationBuildFn" title="VipsOperationBuildFn ()">*VipsOperationBuildFn</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="VipsOperation.html#VipsOperationFlags" title="enum VipsOperationFlags"><span class="returnvalue">VipsOperationFlags</span></a>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-operation-get-flags" title="vips_operation_get_flags ()">vips_operation_get_flags</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-operation-class-print-usage" title="vips_operation_class_print_usage ()">vips_operation_class_print_usage</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-operation-invalidate" title="vips_operation_invalidate ()">vips_operation_invalidate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-operation-call-valist" title="vips_operation_call_valist ()">vips_operation_call_valist</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-operation-new" title="vips_operation_new ()">vips_operation_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call-required-optional" title="vips_call_required_optional ()">vips_call_required_optional</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call" title="vips_call ()">vips_call</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call-split" title="vips_call_split ()">vips_call_split</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call-split-option-string" title="vips_call_split_option_string ()">vips_call_split_option_string</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call-options" title="vips_call_options ()">vips_call_options</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-call-argv" title="vips_call_argv ()">vips_call_argv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-drop-all" title="vips_cache_drop_all ()">vips_cache_drop_all</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-operation-lookup" title="vips_cache_operation_lookup ()">vips_cache_operation_lookup</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-operation-add" title="vips_cache_operation_add ()">vips_cache_operation_add</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-operation-buildp" title="vips_cache_operation_buildp ()">vips_cache_operation_buildp</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-operation-build" title="vips_cache_operation_build ()">vips_cache_operation_build</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-print" title="vips_cache_print ()">vips_cache_print</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-set-max" title="vips_cache_set_max ()">vips_cache_set_max</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-set-max-mem" title="vips_cache_set_max_mem ()">vips_cache_set_max_mem</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-get-max" title="vips_cache_get_max ()">vips_cache_get_max</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-get-size" title="vips_cache_get_size ()">vips_cache_get_size</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">size_t</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-get-max-mem" title="vips_cache_get_max_mem ()">vips_cache_get_max_mem</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-get-max-files" title="vips_cache_get_max_files ()">vips_cache_get_max_files</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-set-max-files" title="vips_cache_set_max_files ()">vips_cache_set_max_files</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-set-dump" title="vips_cache_set_dump ()">vips_cache_set_dump</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-cache-set-trace" title="vips_cache_set_trace ()">vips_cache_set_trace</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-concurrency-set" title="vips_concurrency_set ()">vips_concurrency_set</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">int</span>
</td>
<td class="function_name">
<a class="link" href="VipsOperation.html#vips-concurrency-get" title="vips_concurrency_get ()">vips_concurrency_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="VipsOperation.signals"></a><h2>Signals</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="signals_return">
<col width="300px" class="signals_name">
<col width="200px" class="signals_flags">
</colgroup>
<tbody><tr>
<td class="signal_type"><span class="returnvalue">void</span></td>
<td class="signal_name"><a class="link" href="VipsOperation.html#VipsOperation-invalidate" title="The “invalidate” signal">invalidate</a></td>
<td class="signal_flags">Run Last</td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="VipsOperation.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="VipsOperation.html#VipsOperationFlags" title="enum VipsOperationFlags">VipsOperationFlags</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="VipsOperation.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen"> GObject
<span class="lineart">╰──</span> <a class="link" href="VipsObject.html" title="VipsObject">VipsObject</a>
<span class="lineart">╰──</span> VipsOperation
<span class="lineart">╰──</span> <a class="link" href="VipsForeignSave.html#VipsForeign">VipsForeign</a>
</pre>
</div>
<div class="refsect1">
<a name="VipsOperation.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include <vips/vips.h>
</pre>
</div>
<div class="refsect1">
<a name="VipsOperation.description"></a><h2>Description</h2>
<p>The <a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> class and associated types and macros.</p>
<p><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> is the base class for all operations in libvips. It builds
on <a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> to provide the introspection and command-line interface to
libvips. </p>
<p>It also maintains a cache of recent operations. See below. </p>
<p>vips_call(), <a class="link" href="VipsOperation.html#vips-call-split" title="vips_call_split ()"><code class="function">vips_call_split()</code></a> and <a class="link" href="VipsOperation.html#vips-call-split-option-string" title="vips_call_split_option_string ()"><code class="function">vips_call_split_option_string()</code></a> are used
by vips to implement the C API. They can execute any <a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a>,
passing in a set of required and optional arguments. Normally you would not
use these functions directly: every operation has a tiny wrapper function
which provides type-safety for the required arguments. For example,
<a class="link" href="libvips-conversion.html#vips-embed" title="vips_embed ()"><code class="function">vips_embed()</code></a> is defined as:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
<td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span>
<span class="function"><a href="libvips-conversion.html#vips-embed">vips_embed</a></span><span class="gtkdoc opt">(</span> VipsImage <span class="gtkdoc opt">*</span>in<span class="gtkdoc opt">,</span> VipsImage <span class="gtkdoc opt">**</span>out<span class="gtkdoc opt">,</span>
<span class="gtkdoc kwb">int</span> x<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">int</span> y<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">int</span> width<span class="gtkdoc opt">,</span> <span class="gtkdoc kwb">int</span> height<span class="gtkdoc opt">, ... )</span>
<span class="gtkdoc opt">{</span>
<span class="gtkdoc kwb">va_list</span> ap<span class="gtkdoc opt">;</span>
<span class="gtkdoc kwb">int</span> result<span class="gtkdoc opt">;</span>
<span class="function">va_start</span><span class="gtkdoc opt">(</span> ap<span class="gtkdoc opt">,</span> height <span class="gtkdoc opt">);</span>
result <span class="gtkdoc opt">=</span> <span class="function"><a href="VipsOperation.html#vips-call-split">vips_call_split</a></span><span class="gtkdoc opt">(</span> <span class="string">"embed"</span><span class="gtkdoc opt">,</span> ap<span class="gtkdoc opt">,</span> in<span class="gtkdoc opt">,</span> out<span class="gtkdoc opt">,</span> x<span class="gtkdoc opt">,</span> y<span class="gtkdoc opt">,</span> width<span class="gtkdoc opt">,</span> height <span class="gtkdoc opt">);</span>
<span class="function">va_end</span><span class="gtkdoc opt">(</span> ap <span class="gtkdoc opt">);</span>
<span class="keyword">return</span><span class="gtkdoc opt">(</span> result <span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>Use <a class="link" href="VipsOperation.html#vips-call-argv" title="vips_call_argv ()"><code class="function">vips_call_argv()</code></a> to run any vips operation from a command-line style
argc/argv array. This is the thing used by the vips main program to
implement the vips command-line interface. </p>
<div class="refsect3">
<a name="id-1.3.6.9.9"></a><h4>
<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> and reference counting</h4>
<p>After calling a <a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> you are responsible for unreffing any output
objects. For example, consider:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
<td class="listing_code"><pre class="programlisting">VipsImage <span class="gtkdoc opt">*</span>im <span class="gtkdoc opt">= ...;</span>
VipsImage <span class="gtkdoc opt">*</span>t1<span class="gtkdoc opt">;</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="libvips-arithmetic.html#vips-invert">vips_invert</a></span> <span class="gtkdoc opt">(</span>im<span class="gtkdoc opt">, &</span>t1<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">))</span>
error <span class="gtkdoc opt">..</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>This will invert <em class="parameter"><code>im</code></em>
and return a new <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>, <em class="parameter"><code>t1</code></em>
. As the caller
of <a class="link" href="libvips-arithmetic.html#vips-invert" title="vips_invert ()"><code class="function">vips_invert()</code></a>, you are responsible for <em class="parameter"><code>t1</code></em>
and must unref it when you no
longer need it. If <a class="link" href="libvips-arithmetic.html#vips-invert" title="vips_invert ()"><code class="function">vips_invert()</code></a> fails, no <em class="parameter"><code>t1</code></em>
is returned and you don't
need to do anything. </p>
<p>If you don't need to use <em class="parameter"><code>im</code></em>
for another operation,
you can unref <em class="parameter"><code>im</code></em>
immediately after the call. If <em class="parameter"><code>im</code></em>
is needed to calculate
<em class="parameter"><code>t1</code></em>
, <a class="link" href="libvips-arithmetic.html#vips-invert" title="vips_invert ()"><code class="function">vips_invert()</code></a> will add a ref to <em class="parameter"><code>im</code></em>
and automatically drop it when <em class="parameter"><code>t1</code></em>
is unreffed.</p>
<p>Consider running two operations, one after the other. You could write:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14</pre></td>
<td class="listing_code"><pre class="programlisting">VipsImage <span class="gtkdoc opt">*</span>im <span class="gtkdoc opt">= ...;</span>
VipsImage <span class="gtkdoc opt">*</span>t1<span class="gtkdoc opt">, *</span>t2<span class="gtkdoc opt">;</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="libvips-arithmetic.html#vips-invert">vips_invert</a></span> <span class="gtkdoc opt">(</span>im<span class="gtkdoc opt">, &</span>t1<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">)) {</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>im<span class="gtkdoc opt">);</span>
<span class="keyword">return</span> <span class="gtkdoc opt">-</span><span class="number">1</span><span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>im<span class="gtkdoc opt">);</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="libvips-conversion.html#vips-flip">vips_flip</a></span> <span class="gtkdoc opt">(</span>t1<span class="gtkdoc opt">, &</span>t2<span class="gtkdoc opt">,</span> VIPS_DIRECTION_HORIZONTAL<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">)) {</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>t1<span class="gtkdoc opt">);</span>
<span class="keyword">return</span> <span class="gtkdoc opt">-</span><span class="number">1</span><span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>
<span class="function">g_object_unref</span> <span class="gtkdoc opt">(</span>t1<span class="gtkdoc opt">);</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>This is correct, but rather long-winded. libvips provides a handy thing to
make a vector of auto-freeing object references. You can write this as:</p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7</pre></td>
<td class="listing_code"><pre class="programlisting">VipsObject <span class="gtkdoc opt">*</span>parent <span class="gtkdoc opt">= ...;</span>
VipsImage <span class="gtkdoc opt">*</span>im <span class="gtkdoc opt">= ...;</span>
VipsImage <span class="gtkdoc opt">*</span>t <span class="gtkdoc opt">= (</span>VipsImage <span class="gtkdoc opt">**)</span> <span class="function"><a href="VipsObject.html#vips-object-local-array">vips_object_local_array</a></span> <span class="gtkdoc opt">(</span>parent<span class="gtkdoc opt">,</span> <span class="number">2</span><span class="gtkdoc opt">);</span>
<span class="keyword">if</span> <span class="gtkdoc opt">(</span><span class="function"><a href="libvips-arithmetic.html#vips-invert">vips_invert</a></span> <span class="gtkdoc opt">(</span>im<span class="gtkdoc opt">, &</span>t<span class="gtkdoc opt">[</span><span class="number">0</span><span class="gtkdoc opt">],</span> NULL<span class="gtkdoc opt">) ||</span>
<span class="function"><a href="libvips-conversion.html#vips-flip">vips_flip</a></span> <span class="gtkdoc opt">(</span>t<span class="gtkdoc opt">[</span><span class="number">0</span><span class="gtkdoc opt">], &</span>t<span class="gtkdoc opt">[</span><span class="number">1</span><span class="gtkdoc opt">],</span> VIPS_DIRECTION_HORIZONTAL<span class="gtkdoc opt">,</span> NULL<span class="gtkdoc opt">))</span>
<span class="keyword">return</span> <span class="gtkdoc opt">-</span><span class="number">1</span><span class="gtkdoc opt">;</span></pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>where <em class="parameter"><code>parent</code></em>
is some enclosing object which will be unreffed when this
task is complete. <a class="link" href="VipsObject.html#vips-object-local-array" title="vips_object_local_array ()"><code class="function">vips_object_local_array()</code></a> makes an array of <a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a>
(or <a class="link" href="VipsImage.html" title="VipsImage"><span class="type">VipsImage</span></a>, in this case) where when <em class="parameter"><code>parent</code></em>
is freed, all non-NULL
<a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> in the array are also unreffed.</p>
</div>
<div class="refsect3">
<a name="id-1.3.6.9.10"></a><h4>The <a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> cache</h4>
<p>Because all <a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> are immutable, they can be cached. The cache is
very simple to use: instead of calling <a class="link" href="VipsObject.html#vips-object-build" title="vips_object_build ()"><code class="function">vips_object_build()</code></a>, call
<a class="link" href="VipsOperation.html#vips-cache-operation-build" title="vips_cache_operation_build ()"><code class="function">vips_cache_operation_build()</code></a>. This function calculates a hash from the
operations's input arguments and looks it up in table of all recent
operations. If there's a hit, the new operation is unreffed, the old
operation reffed, and the old operation returned in place of the new one.</p>
<p>The cache size is controlled with <a class="link" href="VipsOperation.html#vips-cache-set-max" title="vips_cache_set_max ()"><code class="function">vips_cache_set_max()</code></a> and friends.</p>
</div>
</div>
<div class="refsect1">
<a name="VipsOperation.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="VipsOperationBuildFn"></a><h3>VipsOperationBuildFn ()</h3>
<pre class="programlisting"><span class="returnvalue">gboolean</span>
<span class="c_punctuation">(</span>*VipsOperationBuildFn<span class="c_punctuation">)</span> (<em class="parameter"><code><a class="link" href="VipsObject.html" title="VipsObject"><span class="type">VipsObject</span></a> *object</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-operation-get-flags"></a><h3>vips_operation_get_flags ()</h3>
<pre class="programlisting"><a class="link" href="VipsOperation.html#VipsOperationFlags" title="enum VipsOperationFlags"><span class="returnvalue">VipsOperationFlags</span></a>
vips_operation_get_flags (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
<p>Returns the set of flags for this operation.</p>
<div class="refsect3">
<a name="vips-operation-get-flags.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p>operation to fetch flags from</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-operation-get-flags.returns"></a><h4>Returns</h4>
<p> 0 on success, or -1 on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-operation-class-print-usage"></a><h3>vips_operation_class_print_usage ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_operation_class_print_usage (<em class="parameter"><code><span class="type">VipsOperationClass</span> *operation_class</code></em>);</pre>
<p>Print a usage message for the operation to stdout.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="vips-operation-class-print-usage.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation_class</p></td>
<td class="parameter_description"><p>class to print usage for</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-operation-invalidate"></a><h3>vips_operation_invalidate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_operation_invalidate (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-operation-call-valist"></a><h3>vips_operation_call_valist ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_operation_call_valist (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>,
<em class="parameter"><code><span class="type">va_list</span> ap</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-operation-new"></a><h3>vips_operation_new ()</h3>
<pre class="programlisting"><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
vips_operation_new (<em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre>
<p>Return a new <a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> with the specified nickname. Useful for
language bindings. </p>
<p>You'll need to set
any arguments and build the operation before you can use it. See
<a class="link" href="VipsOperation.html#vips-call" title="vips_call ()"><code class="function">vips_call()</code></a> for a higher-level way to make new operations.</p>
<div class="refsect3">
<a name="vips-operation-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>nickname of operation to create</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-operation-new.returns"></a><h4>Returns</h4>
<p> the new operation. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-call-required-optional"></a><h3>vips_call_required_optional ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_call_required_optional (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> **operation</code></em>,
<em class="parameter"><code><span class="type">va_list</span> required</code></em>,
<em class="parameter"><code><span class="type">va_list</span> optional</code></em>);</pre>
<p>This is the main entry point for the C and C++ varargs APIs. <em class="parameter"><code>operation</code></em>
is executed, supplying <em class="parameter"><code>required</code></em>
and <em class="parameter"><code>optional</code></em>
arguments. </p>
<p>Beware, this can change <em class="parameter"><code>operation</code></em>
to point at an old, cached one.</p>
<div class="refsect3">
<a name="vips-call-required-optional.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p>the operation to execute</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>required</p></td>
<td class="parameter_description"><p><code class="literal">va_list</code> of required arguments</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>optional</p></td>
<td class="parameter_description"><p>NULL-terminated <code class="literal">va_list</code> of name / value pairs </p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-call-required-optional.returns"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-call"></a><h3>vips_call ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_call (<em class="parameter"><code>const <span class="type">char</span> *operation_name</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
<p>vips_call() calls the named operation, passing in required arguments and
then setting any optional ones from the remainder of the arguments as a set
of name/value pairs. </p>
<p>For example, <a class="link" href="libvips-conversion.html#vips-embed" title="vips_embed ()"><code class="function">vips_embed()</code></a> takes six required arguments, <em class="parameter"><code>in</code></em>
, <em class="parameter"><code>out</code></em>
, <em class="parameter"><code>x</code></em>
, <em class="parameter"><code>y</code></em>
,
<em class="parameter"><code>width</code></em>
, <em class="parameter"><code>height</code></em>
, and has two optional arguments, <em class="parameter"><code>extend</code></em>
and <em class="parameter"><code>background</code></em>
.
You can run it with <a class="link" href="VipsOperation.html#vips-call" title="vips_call ()"><code class="function">vips_call()</code></a> like this: </p>
<div class="informalexample">
<table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7</pre></td>
<td class="listing_code"><pre class="programlisting">VipsImage <span class="gtkdoc opt">*</span>in <span class="gtkdoc opt">= ...</span>
VipsImage <span class="gtkdoc opt">*</span>out<span class="gtkdoc opt">;</span>
<span class="keyword">if</span><span class="gtkdoc opt">(</span> <span class="function"><a href="VipsOperation.html#vips-call">vips_call</a></span><span class="gtkdoc opt">(</span> <span class="string">"embed"</span><span class="gtkdoc opt">,</span> in<span class="gtkdoc opt">, &</span>out<span class="gtkdoc opt">,</span> <span class="number">10</span><span class="gtkdoc opt">,</span> <span class="number">10</span><span class="gtkdoc opt">,</span> <span class="number">100</span><span class="gtkdoc opt">,</span> <span class="number">100</span><span class="gtkdoc opt">,</span>
<span class="string">"extend"</span><span class="gtkdoc opt">,</span> VIPS_EXTEND_COPY<span class="gtkdoc opt">,</span>
NULL <span class="gtkdoc opt">) )</span>
<span class="gtkdoc opt">...</span> error</pre></td>
</tr>
</tbody>
</table>
</div>
<p></p>
<p>Normally of course you'd just use the <a class="link" href="libvips-conversion.html#vips-embed" title="vips_embed ()"><code class="function">vips_embed()</code></a> wrapper function and get
type-safety for the required arguments. </p>
<p>See also: <a class="link" href="VipsOperation.html#vips-call-split" title="vips_call_split ()"><code class="function">vips_call_split()</code></a>, <a class="link" href="VipsOperation.html#vips-call-options" title="vips_call_options ()"><code class="function">vips_call_options()</code></a>.</p>
<div class="refsect3">
<a name="vips-call.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>operation_name</p></td>
<td class="parameter_description"><p>name of operation to call</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>required args, then a <code class="literal">NULL</code>-terminated list of argument/value pairs</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-call.returns"></a><h4>Returns</h4>
<p> 0 on success, -1 on error</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-call-split"></a><h3>vips_call_split ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_call_split (<em class="parameter"><code>const <span class="type">char</span> *operation_name</code></em>,
<em class="parameter"><code><span class="type">va_list</span> optional</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-call-split-option-string"></a><h3>vips_call_split_option_string ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_call_split_option_string (<em class="parameter"><code>const <span class="type">char</span> *operation_name</code></em>,
<em class="parameter"><code>const <span class="type">char</span> *option_string</code></em>,
<em class="parameter"><code><span class="type">va_list</span> optional</code></em>,
<em class="parameter"><code>...</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-call-options"></a><h3>vips_call_options ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_call_options (<em class="parameter"><code><span class="type">GOptionGroup</span> *group</code></em>,
<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-call-argv"></a><h3>vips_call_argv ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_call_argv (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>,
<em class="parameter"><code><span class="type">int</span> argc</code></em>,
<em class="parameter"><code><span class="type">char</span> **argv</code></em>);</pre>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-drop-all"></a><h3>vips_cache_drop_all ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_drop_all (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Drop the whole operation cache, handy for leak tracking. Also called
automatically on <a class="link" href="libvips-vips.html#vips-shutdown" title="vips_shutdown ()"><code class="function">vips_shutdown()</code></a>.</p>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-operation-lookup"></a><h3>vips_cache_operation_lookup ()</h3>
<pre class="programlisting"><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
vips_cache_operation_lookup (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
<p>Look up an unbuilt <em class="parameter"><code>operation</code></em>
in the cache. If we get a hit, ref and
return the old operation. If there's no hit, return NULL.</p>
<div class="refsect3">
<a name="vips-cache-operation-lookup.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p> pointer to operation to lookup. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-cache-operation-lookup.returns"></a><h4>Returns</h4>
<p> the cache hit, if any. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-operation-add"></a><h3>vips_cache_operation_add ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_operation_add (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
<p>Add a built operation to the cache. The cache will ref the operation.</p>
<div class="refsect3">
<a name="vips-cache-operation-add.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p> pointer to operation to add. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-operation-buildp"></a><h3>vips_cache_operation_buildp ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_cache_operation_buildp (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> **operation</code></em>);</pre>
<p>Look up <em class="parameter"><code>operation</code></em>
in the cache. If we get a hit, unref <em class="parameter"><code>operation</code></em>
, ref the
old one and return that through the argument pointer. </p>
<p>If we miss, build and add <em class="parameter"><code>operation</code></em>
.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="vips-cache-operation-buildp.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p>pointer to operation to lookup</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-cache-operation-buildp.returns"></a><h4>Returns</h4>
<p> 0 on success, or -1 on error.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-operation-build"></a><h3>vips_cache_operation_build ()</h3>
<pre class="programlisting"><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="returnvalue">VipsOperation</span></a> *
vips_cache_operation_build (<em class="parameter"><code><a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *operation</code></em>);</pre>
<p>A binding-friendly version of <a class="link" href="VipsOperation.html#vips-cache-operation-buildp" title="vips_cache_operation_buildp ()"><code class="function">vips_cache_operation_buildp()</code></a>.</p>
<p>After calling this, <em class="parameter"><code>operation</code></em>
has the same ref count as when it went in,
and the result must be freed with <a class="link" href="VipsObject.html#vips-object-unref-outputs" title="vips_object_unref_outputs ()"><code class="function">vips_object_unref_outputs()</code></a> and
<code class="function">g_object_unref()</code>.</p>
<div class="refsect3">
<a name="vips-cache-operation-build.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>operation</p></td>
<td class="parameter_description"><p> operation to lookup. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="vips-cache-operation-build.returns"></a><h4>Returns</h4>
<p> The built operation. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-print"></a><h3>vips_cache_print ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_print (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Print the whole operation cache to stdout. Handy for debugging.</p>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-set-max"></a><h3>vips_cache_set_max ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_set_max (<em class="parameter"><code><span class="type">int</span> max</code></em>);</pre>
<p>Set the maximum number of operations we keep in cache.</p>
<div class="refsect3">
<a name="vips-cache-set-max.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>max</p></td>
<td class="parameter_description"><p>maximum number of operation to cache</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-set-max-mem"></a><h3>vips_cache_set_max_mem ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_set_max_mem (<em class="parameter"><code><span class="type">size_t</span> max_mem</code></em>);</pre>
<p>Set the maximum amount of tracked memory we allow before we start dropping
cached operations. See <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>.</p>
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-set-max-mem.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>max_mem</p></td>
<td class="parameter_description"><p>maximum amount of tracked memory we use </p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-get-max"></a><h3>vips_cache_get_max ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_cache_get_max (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Get the maximum number of operations we keep in cache.</p>
<div class="refsect3">
<a name="vips-cache-get-max.returns"></a><h4>Returns</h4>
<p> the maximum number of operations we keep in cache</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-get-size"></a><h3>vips_cache_get_size ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_cache_get_size (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Get the current number of operations in cache.</p>
<div class="refsect3">
<a name="vips-cache-get-size.returns"></a><h4>Returns</h4>
<p> get the current number of operations in cache.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-get-max-mem"></a><h3>vips_cache_get_max_mem ()</h3>
<pre class="programlisting"><span class="returnvalue">size_t</span>
vips_cache_get_max_mem (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Get the maximum amount of tracked memory we allow before we start dropping
cached operations. See <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>.</p>
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-get-mem" title="vips_tracked_get_mem ()"><code class="function">vips_tracked_get_mem()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-get-max-mem.returns"></a><h4>Returns</h4>
<p> the maximum amount of tracked memory we allow</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-get-max-files"></a><h3>vips_cache_get_max_files ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_cache_get_max_files (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Get the maximum number of tracked files we allow before we start dropping
cached operations. See <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-get-max-files.returns"></a><h4>Returns</h4>
<p> the maximum number of tracked files we allow</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-set-max-files"></a><h3>vips_cache_set_max_files ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_set_max_files (<em class="parameter"><code><span class="type">int</span> max_files</code></em>);</pre>
<p>Set the maximum number of tracked files we allow before we start dropping
cached operations. See <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
<p>See also: <a class="link" href="libvips-memory.html#vips-tracked-get-files" title="vips_tracked_get_files ()"><code class="function">vips_tracked_get_files()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-set-max-files.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>max_files</p></td>
<td class="parameter_description"><p>max open files we allow</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-set-dump"></a><h3>vips_cache_set_dump ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_set_dump (<em class="parameter"><code><span class="type">gboolean</span> dump</code></em>);</pre>
<p>Handy for debugging. Print the operation cache to stdout just before exit.</p>
<p>See also: <a class="link" href="VipsOperation.html#vips-cache-set-trace" title="vips_cache_set_trace ()"><code class="function">vips_cache_set_trace()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-set-dump.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>dump</p></td>
<td class="parameter_description"><p>if <code class="literal">TRUE</code>, dump the operation cache on exit</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-cache-set-trace"></a><h3>vips_cache_set_trace ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_cache_set_trace (<em class="parameter"><code><span class="type">gboolean</span> trace</code></em>);</pre>
<p>Handy for debugging. Print operation cache actions to stdout as we run.</p>
<p>You can set the environment variable <code class="literal">VIPS_TRACE</code> to turn this option on, or
use the command-line flag <code class="literal">--vips-cache-trace</code>.</p>
<p>See also: <a class="link" href="VipsOperation.html#vips-cache-set-dump" title="vips_cache_set_dump ()"><code class="function">vips_cache_set_dump()</code></a>.</p>
<div class="refsect3">
<a name="vips-cache-set-trace.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>trace</p></td>
<td class="parameter_description"><p>if <code class="literal">TRUE</code>, trace the operation cache </p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-concurrency-set"></a><h3>vips_concurrency_set ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
vips_concurrency_set (<em class="parameter"><code><span class="type">int</span> concurrency</code></em>);</pre>
<p>Sets the number of worker threads that vips should use when running a
<span class="type">VipsThreadPool</span>. </p>
<p>The special value 0 means "default". In this case, the number of threads is
set by the environment variable VIPS_CONCURRENCY, or if that is not set, the
number of threads availble on the host machine. </p>
<p>See also: <a class="link" href="VipsOperation.html#vips-concurrency-get" title="vips_concurrency_get ()"><code class="function">vips_concurrency_get()</code></a>.</p>
<div class="refsect3">
<a name="vips-concurrency-set.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>concurrency</p></td>
<td class="parameter_description"><p>number of threads to run</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="vips-concurrency-get"></a><h3>vips_concurrency_get ()</h3>
<pre class="programlisting"><span class="returnvalue">int</span>
vips_concurrency_get (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>Returns the number of worker threads that vips should use when running a
<span class="type">VipsThreadPool</span>. </p>
<p>vips gets this values from these sources in turn:</p>
<p>If <a class="link" href="VipsOperation.html#vips-concurrency-set" title="vips_concurrency_set ()"><code class="function">vips_concurrency_set()</code></a> has been called, this value is used. The special
value 0 means "default". You can also use the command-line argument
"--vips-concurrency" to set this value.</p>
<p>If <a class="link" href="VipsOperation.html#vips-concurrency-set" title="vips_concurrency_set ()"><code class="function">vips_concurrency_set()</code></a> has not been called and no command-line argument
was used, vips uses the value of the environment variable VIPS_CONCURRENCY,</p>
<p>If VIPS_CONCURRENCY has not been set, vips find the number of hardware
threads that the host machine can run in parallel and uses that value. </p>
<p>The final value is clipped to the range 1 - 1024.</p>
<p>See also: <a class="link" href="VipsOperation.html#vips-concurrency-get" title="vips_concurrency_get ()"><code class="function">vips_concurrency_get()</code></a>.</p>
<div class="refsect3">
<a name="vips-concurrency-get.returns"></a><h4>Returns</h4>
<p> number of worker threads to use.</p>
</div>
</div>
</div>
<div class="refsect1">
<a name="VipsOperation.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="VipsOperationFlags"></a><h3>enum VipsOperationFlags</h3>
<p>Flags we associate with an operation.</p>
<p><em class="parameter"><code>VIPS_OPERATION_SEQUENTIAL</code></em>
means that the operation works like <a class="link" href="libvips-convolution.html#vips-conv" title="vips_conv ()"><code class="function">vips_conv()</code></a>:
it can process images top-to-bottom with only small non-local
references. </p>
<p>Every scan-line must be requested, you are not allowed to skip
ahead, but as a special case, the very first request can be for a region
not at the top of the image. In this case, the first part of the image will
be read and discarded</p>
<p><em class="parameter"><code>VIPS_OPERATION_SEQUENTIAL_UNBUFFERED</code></em>
means that the operation works like
<a class="link" href="libvips-conversion.html#vips-copy" title="vips_copy ()"><code class="function">vips_copy()</code></a>: it can process images top-to-bottom and makes no
non-local references. </p>
<p>Every scan-line must be requested, you are not allowed to skip
ahead, but as a special case, the very first request can be for a region
not at the top of the image. In this case, the first part of the image will
be read and discarded</p>
<p><em class="parameter"><code>VIPS_OPERATION_NOCACHE</code></em>
means that the operation must not be cached by
vips. </p>
<p><em class="parameter"><code>VIPS_OPERATION_DEPRECATED</code></em>
means this is an old operation kept in vips for
compatibility only and should be hidden from users.</p>
<div class="refsect3">
<a name="VipsOperationFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="VIPS-OPERATION-NONE:CAPS"></a>VIPS_OPERATION_NONE</p></td>
<td class="enum_member_description">
<p>no flags</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-OPERATION-SEQUENTIAL:CAPS"></a>VIPS_OPERATION_SEQUENTIAL</p></td>
<td class="enum_member_description">
<p>can work sequentially with a small buffer</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-OPERATION-SEQUENTIAL-UNBUFFERED:CAPS"></a>VIPS_OPERATION_SEQUENTIAL_UNBUFFERED</p></td>
<td class="enum_member_description">
<p>can work sequentially with no buffer</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-OPERATION-NOCACHE:CAPS"></a>VIPS_OPERATION_NOCACHE</p></td>
<td class="enum_member_description">
<p>must not be cached</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="VIPS-OPERATION-DEPRECATED:CAPS"></a>VIPS_OPERATION_DEPRECATED</p></td>
<td class="enum_member_description">
<p>a compatibility thing</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="VipsOperation.signal-details"></a><h2>Signal Details</h2>
<div class="refsect2">
<a name="VipsOperation-invalidate"></a><h3>The <code class="literal">“invalidate”</code> signal</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
user_function (<a class="link" href="VipsOperation.html" title="VipsOperation"><span class="type">VipsOperation</span></a> *vipsoperation,
<span class="type">gpointer</span> user_data)</pre>
<p>Flags: Run Last</p>
</div>
</div>
<div class="refsect1">
<a name="VipsOperation.see-also"></a><h2>See Also</h2>
<a class="link" href="VipsObject.html" title="VipsObject">object</a>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>
|