libvips/
ops.rs

1// (c) Copyright 2019-2025 OLX
2use crate::bindings;
3use crate::error::*;
4use crate::utils;
5use crate::Result;
6use crate::VipsBlob;
7use crate::VipsImage;
8use crate::VipsInterpolate;
9use crate::VipsSource;
10use crate::VipsTarget;
11use std::convert::TryInto;
12use std::ffi::*;
13use std::ptr::null_mut;
14
15const NULL: *const c_void = null_mut();
16
17include!("manual.rs");
18
19#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
20pub enum Access {
21    ///  `Random` -> VIPS_ACCESS_RANDOM = 0
22    Random = 0,
23    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
24    Sequential = 1,
25    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
26    SequentialUnbuffered = 2,
27    ///  `Last` -> VIPS_ACCESS_LAST = 3
28    Last = 3,
29}
30
31#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
32pub enum Align {
33    ///  `Low` -> VIPS_ALIGN_LOW = 0
34    Low = 0,
35    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
36    Centre = 1,
37    ///  `High` -> VIPS_ALIGN_HIGH = 2
38    High = 2,
39    ///  `Last` -> VIPS_ALIGN_LAST = 3
40    Last = 3,
41}
42
43#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
44pub enum Angle {
45    ///  `D0` -> VIPS_ANGLE_D0 = 0
46    D0 = 0,
47    ///  `D90` -> VIPS_ANGLE_D90 = 1
48    D90 = 1,
49    ///  `D180` -> VIPS_ANGLE_D180 = 2
50    D180 = 2,
51    ///  `D270` -> VIPS_ANGLE_D270 = 3
52    D270 = 3,
53    ///  `Last` -> VIPS_ANGLE_LAST = 4
54    Last = 4,
55}
56
57#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
58pub enum Angle45 {
59    ///  `D0` -> VIPS_ANGLE45_D0 = 0
60    D0 = 0,
61    ///  `D45` -> VIPS_ANGLE45_D45 = 1
62    D45 = 1,
63    ///  `D90` -> VIPS_ANGLE45_D90 = 2
64    D90 = 2,
65    ///  `D135` -> VIPS_ANGLE45_D135 = 3
66    D135 = 3,
67    ///  `D180` -> VIPS_ANGLE45_D180 = 4
68    D180 = 4,
69    ///  `D225` -> VIPS_ANGLE45_D225 = 5
70    D225 = 5,
71    ///  `D270` -> VIPS_ANGLE45_D270 = 6
72    D270 = 6,
73    ///  `D315` -> VIPS_ANGLE45_D315 = 7
74    D315 = 7,
75    ///  `Last` -> VIPS_ANGLE45_LAST = 8
76    Last = 8,
77}
78
79#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
80pub enum BandFormat {
81    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
82    Notset = -1,
83    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0
84    Uchar = 0,
85    ///  `Char` -> VIPS_FORMAT_CHAR = 1
86    Char = 1,
87    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
88    Ushort = 2,
89    ///  `Short` -> VIPS_FORMAT_SHORT = 3
90    Short = 3,
91    ///  `Uint` -> VIPS_FORMAT_UINT = 4
92    Uint = 4,
93    ///  `Int` -> VIPS_FORMAT_INT = 5
94    Int = 5,
95    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
96    Float = 6,
97    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
98    Complex = 7,
99    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
100    Double = 8,
101    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
102    Dpcomplex = 9,
103    ///  `Last` -> VIPS_FORMAT_LAST = 10
104    Last = 10,
105}
106
107#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
108pub enum BlendMode {
109    ///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
110    Clear = 0,
111    ///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
112    Source = 1,
113    ///  `Over` -> VIPS_BLEND_MODE_OVER = 2
114    Over = 2,
115    ///  `In` -> VIPS_BLEND_MODE_IN = 3
116    In = 3,
117    ///  `Out` -> VIPS_BLEND_MODE_OUT = 4
118    Out = 4,
119    ///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
120    Atop = 5,
121    ///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
122    Dest = 6,
123    ///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
124    DestOver = 7,
125    ///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
126    DestIn = 8,
127    ///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
128    DestOut = 9,
129    ///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
130    DestAtop = 10,
131    ///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
132    Xor = 11,
133    ///  `Add` -> VIPS_BLEND_MODE_ADD = 12
134    Add = 12,
135    ///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
136    Saturate = 13,
137    ///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
138    Multiply = 14,
139    ///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
140    Screen = 15,
141    ///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
142    Overlay = 16,
143    ///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
144    Darken = 17,
145    ///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
146    Lighten = 18,
147    ///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
148    ColourDodge = 19,
149    ///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
150    ColourBurn = 20,
151    ///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
152    HardLight = 21,
153    ///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
154    SoftLight = 22,
155    ///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
156    Difference = 23,
157    ///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
158    Exclusion = 24,
159    ///  `Last` -> VIPS_BLEND_MODE_LAST = 25
160    Last = 25,
161}
162
163#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
164pub enum Coding {
165    ///  `Error` -> VIPS_CODING_ERROR = -1
166    Error = -1,
167    ///  `None` -> VIPS_CODING_NONE = 0
168    None = 0,
169    ///  `Labq` -> VIPS_CODING_LABQ = 2
170    Labq = 2,
171    ///  `Rad` -> VIPS_CODING_RAD = 6
172    Rad = 6,
173    ///  `Last` -> VIPS_CODING_LAST = 7
174    Last = 7,
175}
176
177#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
178pub enum Combine {
179    ///  `Max` -> VIPS_COMBINE_MAX = 0
180    Max = 0,
181    ///  `Sum` -> VIPS_COMBINE_SUM = 1
182    Sum = 1,
183    ///  `Min` -> VIPS_COMBINE_MIN = 2
184    Min = 2,
185    ///  `Last` -> VIPS_COMBINE_LAST = 3
186    Last = 3,
187}
188
189#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
190pub enum CombineMode {
191    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0
192    Set = 0,
193    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
194    Add = 1,
195    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
196    Last = 2,
197}
198
199#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
200pub enum CompassDirection {
201    ///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0
202    Centre = 0,
203    ///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
204    North = 1,
205    ///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
206    East = 2,
207    ///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
208    South = 3,
209    ///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
210    West = 4,
211    ///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
212    NorthEast = 5,
213    ///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
214    SouthEast = 6,
215    ///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
216    SouthWest = 7,
217    ///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
218    NorthWest = 8,
219    ///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
220    Last = 9,
221}
222
223#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
224pub enum Direction {
225    ///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0
226    Horizontal = 0,
227    ///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
228    Vertical = 1,
229    ///  `Last` -> VIPS_DIRECTION_LAST = 2
230    Last = 2,
231}
232
233#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
234pub enum Extend {
235    ///  `Black` -> VIPS_EXTEND_BLACK = 0
236    Black = 0,
237    ///  `Copy` -> VIPS_EXTEND_COPY = 1
238    Copy = 1,
239    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
240    Repeat = 2,
241    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
242    Mirror = 3,
243    ///  `White` -> VIPS_EXTEND_WHITE = 4
244    White = 4,
245    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
246    Background = 5,
247    ///  `Last` -> VIPS_EXTEND_LAST = 6
248    Last = 6,
249}
250
251#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
252pub enum FailOn {
253    ///  `None` -> VIPS_FAIL_ON_NONE = 0
254    None = 0,
255    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
256    Truncated = 1,
257    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
258    Error = 2,
259    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
260    Warning = 3,
261    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
262    Last = 4,
263}
264
265#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
266pub enum ForeignDzDepth {
267    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
268    Onepixel = 0,
269    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
270    Onetile = 1,
271    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
272    One = 2,
273    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
274    Last = 3,
275}
276
277#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
278pub enum ForeignFlags {
279    ///  `None` -> VIPS_FOREIGN_NONE = 0
280    None = 0,
281    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
282    Partial = 1,
283    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
284    Bigendian = 2,
285    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
286    Sequential = 4,
287    ///  `All` -> VIPS_FOREIGN_ALL = 7
288    All = 7,
289}
290
291#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
292pub enum ForeignHeifCompression {
293    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1
294    Hevc = 1,
295    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
296    Avc = 2,
297    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
298    Jpeg = 3,
299    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
300    Av1 = 4,
301    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
302    Last = 5,
303}
304
305#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
306pub enum ForeignHeifEncoder {
307    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0
308    Auto = 0,
309    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
310    Aom = 1,
311    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
312    Rav1E = 2,
313    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
314    Svt = 3,
315    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
316    X265 = 4,
317    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
318    Last = 5,
319}
320
321#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
322pub enum ForeignKeep {
323    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
324    None = 0,
325    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
326    Exif = 1,
327    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
328    Xmp = 2,
329    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
330    Iptc = 4,
331    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
332    Icc = 8,
333    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
334    Other = 16,
335    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31
336    All = 31,
337}
338
339#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
340pub enum ForeignPngFilter {
341    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8
342    None = 8,
343    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
344    Sub = 16,
345    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
346    Up = 32,
347    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
348    Avg = 64,
349    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
350    Paeth = 128,
351    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
352    All = 248,
353}
354
355#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
356pub enum ForeignPpmFormat {
357    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
358    Pbm = 0,
359    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
360    Pgm = 1,
361    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2
362    Ppm = 2,
363    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
364    Pfm = 3,
365    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
366    Pnm = 4,
367    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
368    Last = 5,
369}
370
371#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
372pub enum ForeignSubsample {
373    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
374    Auto = 0,
375    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
376    On = 1,
377    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
378    Off = 2,
379    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
380    Last = 3,
381}
382
383#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
384pub enum ForeignTiffCompression {
385    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0
386    None = 0,
387    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
388    Jpeg = 1,
389    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
390    Deflate = 2,
391    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
392    Packbit = 3,
393    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
394    Ccittfax4 = 4,
395    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
396    Lzw = 5,
397    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
398    Webp = 6,
399    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
400    Zstd = 7,
401    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
402    Jp2K = 8,
403    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
404    Last = 9,
405}
406
407#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
408pub enum ForeignTiffPredictor {
409    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
410    None = 1,
411    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2
412    Horizontal = 2,
413    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
414    Float = 3,
415    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
416    Last = 4,
417}
418
419#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
420pub enum ForeignTiffResunit {
421    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0
422    Cm = 0,
423    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
424    Inch = 1,
425    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
426    Last = 2,
427}
428
429#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
430pub enum ForeignWebpPreset {
431    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0
432    Default = 0,
433    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
434    Picture = 1,
435    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
436    Photo = 2,
437    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
438    Drawing = 3,
439    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
440    Icon = 4,
441    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
442    Text = 5,
443    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
444    Last = 6,
445}
446
447#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
448pub enum Intent {
449    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
450    Perceptual = 0,
451    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1
452    Relative = 1,
453    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
454    Saturation = 2,
455    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
456    Absolute = 3,
457    ///  `Last` -> VIPS_INTENT_LAST = 4
458    Last = 4,
459}
460
461#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
462pub enum Interesting {
463    ///  `None` -> VIPS_INTERESTING_NONE = 0
464    None = 0,
465    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
466    Centre = 1,
467    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
468    Entropy = 2,
469    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
470    Attention = 3,
471    ///  `Low` -> VIPS_INTERESTING_LOW = 4
472    Low = 4,
473    ///  `High` -> VIPS_INTERESTING_HIGH = 5
474    High = 5,
475    ///  `All` -> VIPS_INTERESTING_ALL = 6
476    All = 6,
477    ///  `Last` -> VIPS_INTERESTING_LAST = 7
478    Last = 7,
479}
480
481#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
482pub enum Interpretation {
483    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
484    Error = -1,
485    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
486    Multiband = 0,
487    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
488    BW = 1,
489    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
490    Histogram = 10,
491    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
492    Xyz = 12,
493    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
494    Lab = 13,
495    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
496    Cmyk = 15,
497    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
498    Labq = 16,
499    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
500    Rgb = 17,
501    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
502    Cmc = 18,
503    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
504    Lch = 19,
505    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
506    Labs = 21,
507    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
508    Srgb = 22,
509    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
510    Yxy = 23,
511    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
512    Fourier = 24,
513    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
514    Rgb16 = 25,
515    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
516    Grey16 = 26,
517    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
518    Matrix = 27,
519    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
520    Scrgb = 28,
521    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
522    Hsv = 29,
523    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
524    Last = 30,
525}
526
527#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
528pub enum Kernel {
529    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
530    Nearest = 0,
531    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
532    Linear = 1,
533    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
534    Cubic = 2,
535    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
536    Mitchell = 3,
537    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
538    Lanczos2 = 4,
539    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5
540    Lanczos3 = 5,
541    ///  `Last` -> VIPS_KERNEL_LAST = 6
542    Last = 6,
543}
544
545#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
546pub enum OperationBoolean {
547    ///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0
548    And = 0,
549    ///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
550    Or = 1,
551    ///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
552    Eor = 2,
553    ///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
554    Lshift = 3,
555    ///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
556    Rshift = 4,
557    ///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
558    Last = 5,
559}
560
561#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
562pub enum OperationComplex {
563    ///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0
564    Polar = 0,
565    ///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
566    Rect = 1,
567    ///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
568    Conj = 2,
569    ///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
570    Last = 3,
571}
572
573#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
574pub enum OperationComplex2 {
575    ///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0
576    CrossPhase = 0,
577    ///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
578    Last = 1,
579}
580
581#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
582pub enum OperationComplexget {
583    ///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0
584    Real = 0,
585    ///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
586    Imag = 1,
587    ///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
588    Last = 2,
589}
590
591#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
592pub enum OperationMath {
593    ///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0
594    Sin = 0,
595    ///  `Co` -> VIPS_OPERATION_MATH_COS = 1
596    Co = 1,
597    ///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
598    Tan = 2,
599    ///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
600    Asin = 3,
601    ///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
602    Aco = 4,
603    ///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
604    Atan = 5,
605    ///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
606    Log = 6,
607    ///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
608    Log10 = 7,
609    ///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
610    Exp = 8,
611    ///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
612    Exp10 = 9,
613    ///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
614    Sinh = 10,
615    ///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
616    Cosh = 11,
617    ///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
618    Tanh = 12,
619    ///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
620    Asinh = 13,
621    ///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
622    Acosh = 14,
623    ///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
624    Atanh = 15,
625    ///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
626    Last = 16,
627}
628
629#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
630pub enum OperationMath2 {
631    ///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0
632    Pow = 0,
633    ///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
634    Wop = 1,
635    ///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
636    Atan2 = 2,
637    ///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
638    Last = 3,
639}
640
641#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
642pub enum OperationMorphology {
643    ///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0
644    Erode = 0,
645    ///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
646    Dilate = 1,
647    ///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
648    Last = 2,
649}
650
651#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
652pub enum OperationRelational {
653    ///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0
654    Equal = 0,
655    ///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
656    Noteq = 1,
657    ///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
658    Less = 2,
659    ///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
660    Lesseq = 3,
661    ///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
662    More = 4,
663    ///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
664    Moreeq = 5,
665    ///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
666    Last = 6,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum OperationRound {
671    ///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0
672    Rint = 0,
673    ///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
674    Ceil = 1,
675    ///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
676    Floor = 2,
677    ///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
678    Last = 3,
679}
680
681#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
682pub enum PCS {
683    ///  `Lab` -> VIPS_PCS_LAB = 0
684    Lab = 0,
685    ///  `Xyz` -> VIPS_PCS_XYZ = 1
686    Xyz = 1,
687    ///  `Last` -> VIPS_PCS_LAST = 2
688    Last = 2,
689}
690
691#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
692pub enum Precision {
693    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
694    Integer = 0,
695    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
696    Float = 1,
697    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
698    Approximate = 2,
699    ///  `Last` -> VIPS_PRECISION_LAST = 3
700    Last = 3,
701}
702
703#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
704pub enum RegionShrink {
705    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0
706    Mean = 0,
707    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
708    Median = 1,
709    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
710    Mode = 2,
711    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
712    Max = 3,
713    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
714    Min = 4,
715    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
716    Nearest = 5,
717    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
718    Last = 6,
719}
720
721#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
722pub enum SdfShape {
723    ///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0
724    Circle = 0,
725    ///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
726    Box = 1,
727    ///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
728    RoundedBox = 2,
729    ///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
730    Line = 3,
731    ///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
732    Last = 4,
733}
734
735#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
736pub enum Size {
737    ///  `Both` -> VIPS_SIZE_BOTH = 0
738    Both = 0,
739    ///  `Up` -> VIPS_SIZE_UP = 1
740    Up = 1,
741    ///  `Down` -> VIPS_SIZE_DOWN = 2
742    Down = 2,
743    ///  `Force` -> VIPS_SIZE_FORCE = 3
744    Force = 3,
745    ///  `Last` -> VIPS_SIZE_LAST = 4
746    Last = 4,
747}
748
749#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
750pub enum TextWrap {
751    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0
752    Word = 0,
753    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
754    Char = 1,
755    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
756    WordChar = 2,
757    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
758    None = 3,
759    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
760    Last = 4,
761}
762
763/// VipsSystem (system), run an external command
764/// cmd_format: `&str` -> Command to run
765
766pub fn system(cmd_format: &str) -> Result<()> {
767    unsafe {
768        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
769
770        let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
771        utils::result(vips_op_response, (), Error::SystemError)
772    }
773}
774
775/// Options for system operation
776#[derive(Clone, Debug)]
777pub struct SystemOptions {
778    /// inp: `Vec<VipsImage>` -> Array of input images
779    pub inp: Vec<VipsImage>,
780    /// out: `VipsImage` -> Output image
781    pub out: VipsImage,
782    /// log: `String` -> Command log
783    pub log: String,
784    /// out_format: `String` -> Format for output filename
785    pub out_format: String,
786    /// in_format: `String` -> Format for input filename
787    pub in_format: String,
788}
789
790impl std::default::Default for SystemOptions {
791    fn default() -> Self {
792        SystemOptions {
793            inp: Vec::new(),
794            out: VipsImage::new(),
795            log: String::new(),
796            out_format: String::new(),
797            in_format: String::new(),
798        }
799    }
800}
801
802/// VipsSystem (system), run an external command
803/// cmd_format: `&str` -> Command to run
804/// system_options: `&SystemOptions` -> optional arguments
805
806pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
807    unsafe {
808        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
809
810        let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
811        let inp_in = inp_wrapper.ctx;
812        let inp_in_name = utils::new_c_string("inp")?;
813
814        let out_in: *mut bindings::VipsImage = system_options.out.ctx;
815        let out_in_name = utils::new_c_string("out")?;
816
817        let log_in: CString = utils::new_c_string(&system_options.log)?;
818        let log_in_name = utils::new_c_string("log")?;
819
820        let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
821        let out_format_in_name = utils::new_c_string("out-format")?;
822
823        let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
824        let in_format_in_name = utils::new_c_string("in-format")?;
825
826        let vips_op_response = bindings::vips_system(
827            cmd_format_in.as_ptr(),
828            inp_in_name.as_ptr(),
829            inp_in,
830            out_in_name.as_ptr(),
831            out_in,
832            log_in_name.as_ptr(),
833            log_in.as_ptr(),
834            out_format_in_name.as_ptr(),
835            out_format_in.as_ptr(),
836            in_format_in_name.as_ptr(),
837            in_format_in.as_ptr(),
838            NULL,
839        );
840        utils::result(vips_op_response, (), Error::SystemError)
841    }
842}
843
844/// VipsAdd (add), add two images
845/// left: `&VipsImage` -> Left-hand image argument
846/// right: `&VipsImage` -> Right-hand image argument
847/// returns `VipsImage` - Output image
848pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
849    unsafe {
850        let left_in: *mut bindings::VipsImage = left.ctx;
851        let right_in: *mut bindings::VipsImage = right.ctx;
852        let mut out_out: *mut bindings::VipsImage = null_mut();
853
854        let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
855        utils::result(
856            vips_op_response,
857            VipsImage { ctx: out_out },
858            Error::AddError,
859        )
860    }
861}
862
863/// VipsMinpair (minpair), minimum of a pair of images
864/// left: `&VipsImage` -> Left-hand image argument
865/// right: `&VipsImage` -> Right-hand image argument
866/// returns `VipsImage` - Output image
867pub fn minpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
868    unsafe {
869        let left_in: *mut bindings::VipsImage = left.ctx;
870        let right_in: *mut bindings::VipsImage = right.ctx;
871        let mut out_out: *mut bindings::VipsImage = null_mut();
872
873        let vips_op_response = bindings::vips_minpair(left_in, right_in, &mut out_out, NULL);
874        utils::result(
875            vips_op_response,
876            VipsImage { ctx: out_out },
877            Error::MinpairError,
878        )
879    }
880}
881
882/// VipsMaxpair (maxpair), maximum of a pair of images
883/// left: `&VipsImage` -> Left-hand image argument
884/// right: `&VipsImage` -> Right-hand image argument
885/// returns `VipsImage` - Output image
886pub fn maxpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
887    unsafe {
888        let left_in: *mut bindings::VipsImage = left.ctx;
889        let right_in: *mut bindings::VipsImage = right.ctx;
890        let mut out_out: *mut bindings::VipsImage = null_mut();
891
892        let vips_op_response = bindings::vips_maxpair(left_in, right_in, &mut out_out, NULL);
893        utils::result(
894            vips_op_response,
895            VipsImage { ctx: out_out },
896            Error::MaxpairError,
897        )
898    }
899}
900
901/// VipsSubtract (subtract), subtract two images
902/// left: `&VipsImage` -> Left-hand image argument
903/// right: `&VipsImage` -> Right-hand image argument
904/// returns `VipsImage` - Output image
905pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
906    unsafe {
907        let left_in: *mut bindings::VipsImage = left.ctx;
908        let right_in: *mut bindings::VipsImage = right.ctx;
909        let mut out_out: *mut bindings::VipsImage = null_mut();
910
911        let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
912        utils::result(
913            vips_op_response,
914            VipsImage { ctx: out_out },
915            Error::SubtractError,
916        )
917    }
918}
919
920/// VipsMultiply (multiply), multiply two images
921/// left: `&VipsImage` -> Left-hand image argument
922/// right: `&VipsImage` -> Right-hand image argument
923/// returns `VipsImage` - Output image
924pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
925    unsafe {
926        let left_in: *mut bindings::VipsImage = left.ctx;
927        let right_in: *mut bindings::VipsImage = right.ctx;
928        let mut out_out: *mut bindings::VipsImage = null_mut();
929
930        let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
931        utils::result(
932            vips_op_response,
933            VipsImage { ctx: out_out },
934            Error::MultiplyError,
935        )
936    }
937}
938
939/// VipsDivide (divide), divide two images
940/// left: `&VipsImage` -> Left-hand image argument
941/// right: `&VipsImage` -> Right-hand image argument
942/// returns `VipsImage` - Output image
943pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
944    unsafe {
945        let left_in: *mut bindings::VipsImage = left.ctx;
946        let right_in: *mut bindings::VipsImage = right.ctx;
947        let mut out_out: *mut bindings::VipsImage = null_mut();
948
949        let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
950        utils::result(
951            vips_op_response,
952            VipsImage { ctx: out_out },
953            Error::DivideError,
954        )
955    }
956}
957
958/// VipsRelational (relational), relational operation on two images
959/// left: `&VipsImage` -> Left-hand image argument
960/// right: `&VipsImage` -> Right-hand image argument
961/// relational: `OperationRelational` -> Relational to perform
962///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
963///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
964///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
965///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
966///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
967///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
968///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
969/// returns `VipsImage` - Output image
970pub fn relational(
971    left: &VipsImage,
972    right: &VipsImage,
973    relational: OperationRelational,
974) -> Result<VipsImage> {
975    unsafe {
976        let left_in: *mut bindings::VipsImage = left.ctx;
977        let right_in: *mut bindings::VipsImage = right.ctx;
978        let relational_in: i32 = relational as i32;
979        let mut out_out: *mut bindings::VipsImage = null_mut();
980
981        let vips_op_response = bindings::vips_relational(
982            left_in,
983            right_in,
984            &mut out_out,
985            relational_in.try_into().unwrap(),
986            NULL,
987        );
988        utils::result(
989            vips_op_response,
990            VipsImage { ctx: out_out },
991            Error::RelationalError,
992        )
993    }
994}
995
996/// VipsRemainder (remainder), remainder after integer division of two images
997/// left: `&VipsImage` -> Left-hand image argument
998/// right: `&VipsImage` -> Right-hand image argument
999/// returns `VipsImage` - Output image
1000pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1001    unsafe {
1002        let left_in: *mut bindings::VipsImage = left.ctx;
1003        let right_in: *mut bindings::VipsImage = right.ctx;
1004        let mut out_out: *mut bindings::VipsImage = null_mut();
1005
1006        let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
1007        utils::result(
1008            vips_op_response,
1009            VipsImage { ctx: out_out },
1010            Error::RemainderError,
1011        )
1012    }
1013}
1014
1015/// VipsBoolean (boolean), boolean operation on two images
1016/// left: `&VipsImage` -> Left-hand image argument
1017/// right: `&VipsImage` -> Right-hand image argument
1018/// boolean: `OperationBoolean` -> Boolean to perform
1019///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1020///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1021///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1022///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1023///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1024///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1025/// returns `VipsImage` - Output image
1026pub fn boolean(
1027    left: &VipsImage,
1028    right: &VipsImage,
1029    boolean: OperationBoolean,
1030) -> Result<VipsImage> {
1031    unsafe {
1032        let left_in: *mut bindings::VipsImage = left.ctx;
1033        let right_in: *mut bindings::VipsImage = right.ctx;
1034        let boolean_in: i32 = boolean as i32;
1035        let mut out_out: *mut bindings::VipsImage = null_mut();
1036
1037        let vips_op_response = bindings::vips_boolean(
1038            left_in,
1039            right_in,
1040            &mut out_out,
1041            boolean_in.try_into().unwrap(),
1042            NULL,
1043        );
1044        utils::result(
1045            vips_op_response,
1046            VipsImage { ctx: out_out },
1047            Error::BooleanError,
1048        )
1049    }
1050}
1051
1052/// VipsMath2 (math2), binary math operations
1053/// left: `&VipsImage` -> Left-hand image argument
1054/// right: `&VipsImage` -> Right-hand image argument
1055/// math_2: `OperationMath2` -> Math to perform
1056///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1057///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1058///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1059///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1060/// returns `VipsImage` - Output image
1061pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1062    unsafe {
1063        let left_in: *mut bindings::VipsImage = left.ctx;
1064        let right_in: *mut bindings::VipsImage = right.ctx;
1065        let math_2_in: i32 = math_2 as i32;
1066        let mut out_out: *mut bindings::VipsImage = null_mut();
1067
1068        let vips_op_response = bindings::vips_math2(
1069            left_in,
1070            right_in,
1071            &mut out_out,
1072            math_2_in.try_into().unwrap(),
1073            NULL,
1074        );
1075        utils::result(
1076            vips_op_response,
1077            VipsImage { ctx: out_out },
1078            Error::Math2Error,
1079        )
1080    }
1081}
1082
1083/// VipsComplex2 (complex2), complex binary operations on two images
1084/// left: `&VipsImage` -> Left-hand image argument
1085/// right: `&VipsImage` -> Right-hand image argument
1086/// cmplx: `OperationComplex2` -> Binary complex operation to perform
1087///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0 [DEFAULT]
1088///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
1089/// returns `VipsImage` - Output image
1090pub fn complex_2(
1091    left: &VipsImage,
1092    right: &VipsImage,
1093    cmplx: OperationComplex2,
1094) -> Result<VipsImage> {
1095    unsafe {
1096        let left_in: *mut bindings::VipsImage = left.ctx;
1097        let right_in: *mut bindings::VipsImage = right.ctx;
1098        let cmplx_in: i32 = cmplx as i32;
1099        let mut out_out: *mut bindings::VipsImage = null_mut();
1100
1101        let vips_op_response = bindings::vips_complex2(
1102            left_in,
1103            right_in,
1104            &mut out_out,
1105            cmplx_in.try_into().unwrap(),
1106            NULL,
1107        );
1108        utils::result(
1109            vips_op_response,
1110            VipsImage { ctx: out_out },
1111            Error::Complex2Error,
1112        )
1113    }
1114}
1115
1116/// VipsComplexform (complexform), form a complex image from two real images
1117/// left: `&VipsImage` -> Left-hand image argument
1118/// right: `&VipsImage` -> Right-hand image argument
1119/// returns `VipsImage` - Output image
1120pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1121    unsafe {
1122        let left_in: *mut bindings::VipsImage = left.ctx;
1123        let right_in: *mut bindings::VipsImage = right.ctx;
1124        let mut out_out: *mut bindings::VipsImage = null_mut();
1125
1126        let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1127        utils::result(
1128            vips_op_response,
1129            VipsImage { ctx: out_out },
1130            Error::ComplexformError,
1131        )
1132    }
1133}
1134
1135/// VipsClamp (clamp), clamp values of an image
1136/// inp: `&VipsImage` -> Input image
1137/// returns `VipsImage` - Output image
1138pub fn clamp(inp: &VipsImage) -> Result<VipsImage> {
1139    unsafe {
1140        let inp_in: *mut bindings::VipsImage = inp.ctx;
1141        let mut out_out: *mut bindings::VipsImage = null_mut();
1142
1143        let vips_op_response = bindings::vips_clamp(inp_in, &mut out_out, NULL);
1144        utils::result(
1145            vips_op_response,
1146            VipsImage { ctx: out_out },
1147            Error::ClampError,
1148        )
1149    }
1150}
1151
1152/// Options for clamp operation
1153#[derive(Clone, Debug)]
1154pub struct ClampOptions {
1155    /// min: `f64` -> Minimum value
1156    /// min: -inf, max: inf, default: 0
1157    pub min: f64,
1158    /// max: `f64` -> Maximum value
1159    /// min: -inf, max: inf, default: 0
1160    pub max: f64,
1161}
1162
1163impl std::default::Default for ClampOptions {
1164    fn default() -> Self {
1165        ClampOptions {
1166            min: f64::from(0),
1167            max: f64::from(0),
1168        }
1169    }
1170}
1171
1172/// VipsClamp (clamp), clamp values of an image
1173/// inp: `&VipsImage` -> Input image
1174/// clamp_options: `&ClampOptions` -> optional arguments
1175/// returns `VipsImage` - Output image
1176pub fn clamp_with_opts(inp: &VipsImage, clamp_options: &ClampOptions) -> Result<VipsImage> {
1177    unsafe {
1178        let inp_in: *mut bindings::VipsImage = inp.ctx;
1179        let mut out_out: *mut bindings::VipsImage = null_mut();
1180
1181        let min_in: f64 = clamp_options.min;
1182        let min_in_name = utils::new_c_string("min")?;
1183
1184        let max_in: f64 = clamp_options.max;
1185        let max_in_name = utils::new_c_string("max")?;
1186
1187        let vips_op_response = bindings::vips_clamp(
1188            inp_in,
1189            &mut out_out,
1190            min_in_name.as_ptr(),
1191            min_in,
1192            max_in_name.as_ptr(),
1193            max_in,
1194            NULL,
1195        );
1196        utils::result(
1197            vips_op_response,
1198            VipsImage { ctx: out_out },
1199            Error::ClampError,
1200        )
1201    }
1202}
1203
1204/// VipsInvert (invert), invert an image
1205/// inp: `&VipsImage` -> Input image
1206/// returns `VipsImage` - Output image
1207pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1208    unsafe {
1209        let inp_in: *mut bindings::VipsImage = inp.ctx;
1210        let mut out_out: *mut bindings::VipsImage = null_mut();
1211
1212        let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1213        utils::result(
1214            vips_op_response,
1215            VipsImage { ctx: out_out },
1216            Error::InvertError,
1217        )
1218    }
1219}
1220
1221/// VipsMath (math), apply a math operation to an image
1222/// inp: `&VipsImage` -> Input image
1223/// math: `OperationMath` -> Math to perform
1224///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0 [DEFAULT]
1225///  `Co` -> VIPS_OPERATION_MATH_COS = 1
1226///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
1227///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
1228///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
1229///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
1230///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
1231///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
1232///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
1233///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
1234///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
1235///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
1236///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
1237///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
1238///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
1239///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
1240///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
1241/// returns `VipsImage` - Output image
1242pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1243    unsafe {
1244        let inp_in: *mut bindings::VipsImage = inp.ctx;
1245        let math_in: i32 = math as i32;
1246        let mut out_out: *mut bindings::VipsImage = null_mut();
1247
1248        let vips_op_response =
1249            bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1250        utils::result(
1251            vips_op_response,
1252            VipsImage { ctx: out_out },
1253            Error::MathError,
1254        )
1255    }
1256}
1257
1258/// VipsAbs (abs), absolute value of an image
1259/// inp: `&VipsImage` -> Input image
1260/// returns `VipsImage` - Output image
1261pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1262    unsafe {
1263        let inp_in: *mut bindings::VipsImage = inp.ctx;
1264        let mut out_out: *mut bindings::VipsImage = null_mut();
1265
1266        let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1267        utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1268    }
1269}
1270
1271/// VipsSign (sign), unit vector of pixel
1272/// inp: `&VipsImage` -> Input image
1273/// returns `VipsImage` - Output image
1274pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1275    unsafe {
1276        let inp_in: *mut bindings::VipsImage = inp.ctx;
1277        let mut out_out: *mut bindings::VipsImage = null_mut();
1278
1279        let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1280        utils::result(
1281            vips_op_response,
1282            VipsImage { ctx: out_out },
1283            Error::SignError,
1284        )
1285    }
1286}
1287
1288/// VipsRound (round), perform a round function on an image
1289/// inp: `&VipsImage` -> Input image
1290/// round: `OperationRound` -> Rounding operation to perform
1291///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0 [DEFAULT]
1292///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
1293///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
1294///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
1295/// returns `VipsImage` - Output image
1296pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1297    unsafe {
1298        let inp_in: *mut bindings::VipsImage = inp.ctx;
1299        let round_in: i32 = round as i32;
1300        let mut out_out: *mut bindings::VipsImage = null_mut();
1301
1302        let vips_op_response =
1303            bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1304        utils::result(
1305            vips_op_response,
1306            VipsImage { ctx: out_out },
1307            Error::RoundError,
1308        )
1309    }
1310}
1311
1312/// VipsRelationalConst (relational_const), relational operations against a constant
1313/// inp: `&VipsImage` -> Input image
1314/// relational: `OperationRelational` -> Relational to perform
1315///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
1316///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
1317///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
1318///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
1319///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
1320///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
1321///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
1322/// c: `&mut [f64]` -> Array of constants
1323/// returns `VipsImage` - Output image
1324pub fn relational_const(
1325    inp: &VipsImage,
1326    relational: OperationRelational,
1327    c: &mut [f64],
1328) -> Result<VipsImage> {
1329    unsafe {
1330        let inp_in: *mut bindings::VipsImage = inp.ctx;
1331        let relational_in: i32 = relational as i32;
1332        let c_in: *mut f64 = c.as_mut_ptr();
1333        let mut out_out: *mut bindings::VipsImage = null_mut();
1334
1335        let vips_op_response = bindings::vips_relational_const(
1336            inp_in,
1337            &mut out_out,
1338            relational_in.try_into().unwrap(),
1339            c_in,
1340            c.len() as i32,
1341            NULL,
1342        );
1343        utils::result(
1344            vips_op_response,
1345            VipsImage { ctx: out_out },
1346            Error::RelationalConstError,
1347        )
1348    }
1349}
1350
1351/// VipsRemainderConst (remainder_const), remainder after integer division of an image and a constant
1352/// inp: `&VipsImage` -> Input image
1353/// c: `&mut [f64]` -> Array of constants
1354/// returns `VipsImage` - Output image
1355pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1356    unsafe {
1357        let inp_in: *mut bindings::VipsImage = inp.ctx;
1358        let c_in: *mut f64 = c.as_mut_ptr();
1359        let mut out_out: *mut bindings::VipsImage = null_mut();
1360
1361        let vips_op_response =
1362            bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1363        utils::result(
1364            vips_op_response,
1365            VipsImage { ctx: out_out },
1366            Error::RemainderConstError,
1367        )
1368    }
1369}
1370
1371/// VipsBooleanConst (boolean_const), boolean operations against a constant
1372/// inp: `&VipsImage` -> Input image
1373/// boolean: `OperationBoolean` -> Boolean to perform
1374///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1375///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1376///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1377///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1378///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1379///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1380/// c: `&mut [f64]` -> Array of constants
1381/// returns `VipsImage` - Output image
1382pub fn boolean_const(
1383    inp: &VipsImage,
1384    boolean: OperationBoolean,
1385    c: &mut [f64],
1386) -> Result<VipsImage> {
1387    unsafe {
1388        let inp_in: *mut bindings::VipsImage = inp.ctx;
1389        let boolean_in: i32 = boolean as i32;
1390        let c_in: *mut f64 = c.as_mut_ptr();
1391        let mut out_out: *mut bindings::VipsImage = null_mut();
1392
1393        let vips_op_response = bindings::vips_boolean_const(
1394            inp_in,
1395            &mut out_out,
1396            boolean_in.try_into().unwrap(),
1397            c_in,
1398            c.len() as i32,
1399            NULL,
1400        );
1401        utils::result(
1402            vips_op_response,
1403            VipsImage { ctx: out_out },
1404            Error::BooleanConstError,
1405        )
1406    }
1407}
1408
1409/// VipsMath2Const (math2_const), binary math operations with a constant
1410/// inp: `&VipsImage` -> Input image
1411/// math_2: `OperationMath2` -> Math to perform
1412///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1413///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1414///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1415///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1416/// c: `&mut [f64]` -> Array of constants
1417/// returns `VipsImage` - Output image
1418pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1419    unsafe {
1420        let inp_in: *mut bindings::VipsImage = inp.ctx;
1421        let math_2_in: i32 = math_2 as i32;
1422        let c_in: *mut f64 = c.as_mut_ptr();
1423        let mut out_out: *mut bindings::VipsImage = null_mut();
1424
1425        let vips_op_response = bindings::vips_math2_const(
1426            inp_in,
1427            &mut out_out,
1428            math_2_in.try_into().unwrap(),
1429            c_in,
1430            c.len() as i32,
1431            NULL,
1432        );
1433        utils::result(
1434            vips_op_response,
1435            VipsImage { ctx: out_out },
1436            Error::Math2ConstError,
1437        )
1438    }
1439}
1440
1441/// VipsComplex (complex), perform a complex operation on an image
1442/// inp: `&VipsImage` -> Input image
1443/// cmplx: `OperationComplex` -> Complex to perform
1444///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0 [DEFAULT]
1445///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
1446///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
1447///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
1448/// returns `VipsImage` - Output image
1449pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1450    unsafe {
1451        let inp_in: *mut bindings::VipsImage = inp.ctx;
1452        let cmplx_in: i32 = cmplx as i32;
1453        let mut out_out: *mut bindings::VipsImage = null_mut();
1454
1455        let vips_op_response =
1456            bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1457        utils::result(
1458            vips_op_response,
1459            VipsImage { ctx: out_out },
1460            Error::ComplexError,
1461        )
1462    }
1463}
1464
1465/// VipsComplexget (complexget), get a component from a complex image
1466/// inp: `&VipsImage` -> Input image
1467/// get: `OperationComplexget` -> Complex to perform
1468///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0 [DEFAULT]
1469///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
1470///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
1471/// returns `VipsImage` - Output image
1472pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1473    unsafe {
1474        let inp_in: *mut bindings::VipsImage = inp.ctx;
1475        let get_in: i32 = get as i32;
1476        let mut out_out: *mut bindings::VipsImage = null_mut();
1477
1478        let vips_op_response =
1479            bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1480        utils::result(
1481            vips_op_response,
1482            VipsImage { ctx: out_out },
1483            Error::ComplexgetError,
1484        )
1485    }
1486}
1487
1488/// VipsSum (sum), sum an array of images
1489/// inp: `&mut [VipsImage]` -> Array of input images
1490/// returns `VipsImage` - Output image
1491pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1492    unsafe {
1493        let (inp_len, mut inp_in) = {
1494            let len = inp.len();
1495            let mut input = Vec::new();
1496            for img in inp {
1497                input.push(img.ctx)
1498            }
1499            (len as i32, input)
1500        };
1501        let mut out_out: *mut bindings::VipsImage = null_mut();
1502
1503        let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1504        utils::result(
1505            vips_op_response,
1506            VipsImage { ctx: out_out },
1507            Error::SumError,
1508        )
1509    }
1510}
1511
1512/// VipsAvg (avg), find image average
1513/// inp: `&VipsImage` -> Input image
1514/// returns `f64` - Output value
1515pub fn avg(inp: &VipsImage) -> Result<f64> {
1516    unsafe {
1517        let inp_in: *mut bindings::VipsImage = inp.ctx;
1518        let mut out_out: f64 = f64::from(0);
1519
1520        let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1521        utils::result(vips_op_response, out_out, Error::AvgError)
1522    }
1523}
1524
1525/// VipsMin (min), find image minimum
1526/// inp: `&VipsImage` -> Input image
1527/// returns `f64` - Output value
1528pub fn min(inp: &VipsImage) -> Result<f64> {
1529    unsafe {
1530        let inp_in: *mut bindings::VipsImage = inp.ctx;
1531        let mut out_out: f64 = f64::from(0);
1532
1533        let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1534        utils::result(vips_op_response, out_out, Error::MinError)
1535    }
1536}
1537
1538/// Options for min operation
1539#[derive(Clone, Debug)]
1540pub struct MinOptions {
1541    /// x: `i32` -> Horizontal position of minimum
1542    /// min: 0, max: 100000000, default: 0
1543    pub x: i32,
1544    /// y: `i32` -> Vertical position of minimum
1545    /// min: 0, max: 100000000, default: 0
1546    pub y: i32,
1547    /// size: `i32` -> Number of minimum values to find
1548    /// min: 1, max: 1000000, default: 10
1549    pub size: i32,
1550    /// out_array: `Vec<f64>` -> Array of output values
1551    pub out_array: Vec<f64>,
1552    /// x_array: `Vec<i32>` -> Array of horizontal positions
1553    pub x_array: Vec<i32>,
1554    /// y_array: `Vec<i32>` -> Array of vertical positions
1555    pub y_array: Vec<i32>,
1556}
1557
1558impl std::default::Default for MinOptions {
1559    fn default() -> Self {
1560        MinOptions {
1561            x: i32::from(0),
1562            y: i32::from(0),
1563            size: i32::from(10),
1564            out_array: Vec::new(),
1565            x_array: Vec::new(),
1566            y_array: Vec::new(),
1567        }
1568    }
1569}
1570
1571/// VipsMin (min), find image minimum
1572/// inp: `&VipsImage` -> Input image
1573/// min_options: `&MinOptions` -> optional arguments
1574/// returns `f64` - Output value
1575pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1576    unsafe {
1577        let inp_in: *mut bindings::VipsImage = inp.ctx;
1578        let mut out_out: f64 = f64::from(0);
1579
1580        let x_in: i32 = min_options.x;
1581        let x_in_name = utils::new_c_string("x")?;
1582
1583        let y_in: i32 = min_options.y;
1584        let y_in_name = utils::new_c_string("y")?;
1585
1586        let size_in: i32 = min_options.size;
1587        let size_in_name = utils::new_c_string("size")?;
1588
1589        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1590        let out_array_in = out_array_wrapper.ctx;
1591        let out_array_in_name = utils::new_c_string("out-array")?;
1592
1593        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1594        let x_array_in = x_array_wrapper.ctx;
1595        let x_array_in_name = utils::new_c_string("x-array")?;
1596
1597        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1598        let y_array_in = y_array_wrapper.ctx;
1599        let y_array_in_name = utils::new_c_string("y-array")?;
1600
1601        let vips_op_response = bindings::vips_min(
1602            inp_in,
1603            &mut out_out,
1604            x_in_name.as_ptr(),
1605            x_in,
1606            y_in_name.as_ptr(),
1607            y_in,
1608            size_in_name.as_ptr(),
1609            size_in,
1610            out_array_in_name.as_ptr(),
1611            out_array_in,
1612            x_array_in_name.as_ptr(),
1613            x_array_in,
1614            y_array_in_name.as_ptr(),
1615            y_array_in,
1616            NULL,
1617        );
1618        utils::result(vips_op_response, out_out, Error::MinError)
1619    }
1620}
1621
1622/// VipsMax (max), find image maximum
1623/// inp: `&VipsImage` -> Input image
1624/// returns `f64` - Output value
1625pub fn max(inp: &VipsImage) -> Result<f64> {
1626    unsafe {
1627        let inp_in: *mut bindings::VipsImage = inp.ctx;
1628        let mut out_out: f64 = f64::from(0);
1629
1630        let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1631        utils::result(vips_op_response, out_out, Error::MaxError)
1632    }
1633}
1634
1635/// Options for max operation
1636#[derive(Clone, Debug)]
1637pub struct MaxOptions {
1638    /// x: `i32` -> Horizontal position of maximum
1639    /// min: 0, max: 100000000, default: 0
1640    pub x: i32,
1641    /// y: `i32` -> Vertical position of maximum
1642    /// min: 0, max: 100000000, default: 0
1643    pub y: i32,
1644    /// size: `i32` -> Number of maximum values to find
1645    /// min: 1, max: 1000000, default: 10
1646    pub size: i32,
1647    /// out_array: `Vec<f64>` -> Array of output values
1648    pub out_array: Vec<f64>,
1649    /// x_array: `Vec<i32>` -> Array of horizontal positions
1650    pub x_array: Vec<i32>,
1651    /// y_array: `Vec<i32>` -> Array of vertical positions
1652    pub y_array: Vec<i32>,
1653}
1654
1655impl std::default::Default for MaxOptions {
1656    fn default() -> Self {
1657        MaxOptions {
1658            x: i32::from(0),
1659            y: i32::from(0),
1660            size: i32::from(10),
1661            out_array: Vec::new(),
1662            x_array: Vec::new(),
1663            y_array: Vec::new(),
1664        }
1665    }
1666}
1667
1668/// VipsMax (max), find image maximum
1669/// inp: `&VipsImage` -> Input image
1670/// max_options: `&MaxOptions` -> optional arguments
1671/// returns `f64` - Output value
1672pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1673    unsafe {
1674        let inp_in: *mut bindings::VipsImage = inp.ctx;
1675        let mut out_out: f64 = f64::from(0);
1676
1677        let x_in: i32 = max_options.x;
1678        let x_in_name = utils::new_c_string("x")?;
1679
1680        let y_in: i32 = max_options.y;
1681        let y_in_name = utils::new_c_string("y")?;
1682
1683        let size_in: i32 = max_options.size;
1684        let size_in_name = utils::new_c_string("size")?;
1685
1686        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1687        let out_array_in = out_array_wrapper.ctx;
1688        let out_array_in_name = utils::new_c_string("out-array")?;
1689
1690        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1691        let x_array_in = x_array_wrapper.ctx;
1692        let x_array_in_name = utils::new_c_string("x-array")?;
1693
1694        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1695        let y_array_in = y_array_wrapper.ctx;
1696        let y_array_in_name = utils::new_c_string("y-array")?;
1697
1698        let vips_op_response = bindings::vips_max(
1699            inp_in,
1700            &mut out_out,
1701            x_in_name.as_ptr(),
1702            x_in,
1703            y_in_name.as_ptr(),
1704            y_in,
1705            size_in_name.as_ptr(),
1706            size_in,
1707            out_array_in_name.as_ptr(),
1708            out_array_in,
1709            x_array_in_name.as_ptr(),
1710            x_array_in,
1711            y_array_in_name.as_ptr(),
1712            y_array_in,
1713            NULL,
1714        );
1715        utils::result(vips_op_response, out_out, Error::MaxError)
1716    }
1717}
1718
1719/// VipsDeviate (deviate), find image standard deviation
1720/// inp: `&VipsImage` -> Input image
1721/// returns `f64` - Output value
1722pub fn deviate(inp: &VipsImage) -> Result<f64> {
1723    unsafe {
1724        let inp_in: *mut bindings::VipsImage = inp.ctx;
1725        let mut out_out: f64 = f64::from(0);
1726
1727        let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1728        utils::result(vips_op_response, out_out, Error::DeviateError)
1729    }
1730}
1731
1732/// VipsStats (stats), find many image stats
1733/// inp: `&VipsImage` -> Input image
1734/// returns `VipsImage` - Output array of statistics
1735pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1736    unsafe {
1737        let inp_in: *mut bindings::VipsImage = inp.ctx;
1738        let mut out_out: *mut bindings::VipsImage = null_mut();
1739
1740        let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1741        utils::result(
1742            vips_op_response,
1743            VipsImage { ctx: out_out },
1744            Error::StatError,
1745        )
1746    }
1747}
1748
1749/// VipsHistFind (hist_find), find image histogram
1750/// inp: `&VipsImage` -> Input image
1751/// returns `VipsImage` - Output histogram
1752pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1753    unsafe {
1754        let inp_in: *mut bindings::VipsImage = inp.ctx;
1755        let mut out_out: *mut bindings::VipsImage = null_mut();
1756
1757        let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1758        utils::result(
1759            vips_op_response,
1760            VipsImage { ctx: out_out },
1761            Error::HistFindError,
1762        )
1763    }
1764}
1765
1766/// Options for hist_find operation
1767#[derive(Clone, Debug)]
1768pub struct HistFindOptions {
1769    /// band: `i32` -> Find histogram of band
1770    /// min: -1, max: 100000, default: -1
1771    pub band: i32,
1772}
1773
1774impl std::default::Default for HistFindOptions {
1775    fn default() -> Self {
1776        HistFindOptions {
1777            band: i32::from(-1),
1778        }
1779    }
1780}
1781
1782/// VipsHistFind (hist_find), find image histogram
1783/// inp: `&VipsImage` -> Input image
1784/// hist_find_options: `&HistFindOptions` -> optional arguments
1785/// returns `VipsImage` - Output histogram
1786pub fn hist_find_with_opts(
1787    inp: &VipsImage,
1788    hist_find_options: &HistFindOptions,
1789) -> Result<VipsImage> {
1790    unsafe {
1791        let inp_in: *mut bindings::VipsImage = inp.ctx;
1792        let mut out_out: *mut bindings::VipsImage = null_mut();
1793
1794        let band_in: i32 = hist_find_options.band;
1795        let band_in_name = utils::new_c_string("band")?;
1796
1797        let vips_op_response =
1798            bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1799        utils::result(
1800            vips_op_response,
1801            VipsImage { ctx: out_out },
1802            Error::HistFindError,
1803        )
1804    }
1805}
1806
1807/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1808/// inp: `&VipsImage` -> Input image
1809/// returns `VipsImage` - Output histogram
1810pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1811    unsafe {
1812        let inp_in: *mut bindings::VipsImage = inp.ctx;
1813        let mut out_out: *mut bindings::VipsImage = null_mut();
1814
1815        let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1816        utils::result(
1817            vips_op_response,
1818            VipsImage { ctx: out_out },
1819            Error::HistFindNdimError,
1820        )
1821    }
1822}
1823
1824/// Options for hist_find_ndim operation
1825#[derive(Clone, Debug)]
1826pub struct HistFindNdimOptions {
1827    /// bins: `i32` -> Number of bins in each dimension
1828    /// min: 1, max: 65536, default: 10
1829    pub bins: i32,
1830}
1831
1832impl std::default::Default for HistFindNdimOptions {
1833    fn default() -> Self {
1834        HistFindNdimOptions {
1835            bins: i32::from(10),
1836        }
1837    }
1838}
1839
1840/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1841/// inp: `&VipsImage` -> Input image
1842/// hist_find_ndim_options: `&HistFindNdimOptions` -> optional arguments
1843/// returns `VipsImage` - Output histogram
1844pub fn hist_find_ndim_with_opts(
1845    inp: &VipsImage,
1846    hist_find_ndim_options: &HistFindNdimOptions,
1847) -> Result<VipsImage> {
1848    unsafe {
1849        let inp_in: *mut bindings::VipsImage = inp.ctx;
1850        let mut out_out: *mut bindings::VipsImage = null_mut();
1851
1852        let bins_in: i32 = hist_find_ndim_options.bins;
1853        let bins_in_name = utils::new_c_string("bins")?;
1854
1855        let vips_op_response = bindings::vips_hist_find_ndim(
1856            inp_in,
1857            &mut out_out,
1858            bins_in_name.as_ptr(),
1859            bins_in,
1860            NULL,
1861        );
1862        utils::result(
1863            vips_op_response,
1864            VipsImage { ctx: out_out },
1865            Error::HistFindNdimError,
1866        )
1867    }
1868}
1869
1870/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1871/// inp: `&VipsImage` -> Input image
1872/// index: `&VipsImage` -> Index image
1873/// returns `VipsImage` - Output histogram
1874pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1875    unsafe {
1876        let inp_in: *mut bindings::VipsImage = inp.ctx;
1877        let index_in: *mut bindings::VipsImage = index.ctx;
1878        let mut out_out: *mut bindings::VipsImage = null_mut();
1879
1880        let vips_op_response =
1881            bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1882        utils::result(
1883            vips_op_response,
1884            VipsImage { ctx: out_out },
1885            Error::HistFindIndexedError,
1886        )
1887    }
1888}
1889
1890/// Options for hist_find_indexed operation
1891#[derive(Clone, Debug)]
1892pub struct HistFindIndexedOptions {
1893    /// combine: `Combine` -> Combine bins like this
1894    ///  `Max` -> VIPS_COMBINE_MAX = 0
1895    ///  `Sum` -> VIPS_COMBINE_SUM = 1 [DEFAULT]
1896    ///  `Min` -> VIPS_COMBINE_MIN = 2
1897    ///  `Last` -> VIPS_COMBINE_LAST = 3
1898    pub combine: Combine,
1899}
1900
1901impl std::default::Default for HistFindIndexedOptions {
1902    fn default() -> Self {
1903        HistFindIndexedOptions {
1904            combine: Combine::Sum,
1905        }
1906    }
1907}
1908
1909/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1910/// inp: `&VipsImage` -> Input image
1911/// index: `&VipsImage` -> Index image
1912/// hist_find_indexed_options: `&HistFindIndexedOptions` -> optional arguments
1913/// returns `VipsImage` - Output histogram
1914pub fn hist_find_indexed_with_opts(
1915    inp: &VipsImage,
1916    index: &VipsImage,
1917    hist_find_indexed_options: &HistFindIndexedOptions,
1918) -> Result<VipsImage> {
1919    unsafe {
1920        let inp_in: *mut bindings::VipsImage = inp.ctx;
1921        let index_in: *mut bindings::VipsImage = index.ctx;
1922        let mut out_out: *mut bindings::VipsImage = null_mut();
1923
1924        let combine_in: i32 = hist_find_indexed_options.combine as i32;
1925        let combine_in_name = utils::new_c_string("combine")?;
1926
1927        let vips_op_response = bindings::vips_hist_find_indexed(
1928            inp_in,
1929            index_in,
1930            &mut out_out,
1931            combine_in_name.as_ptr(),
1932            combine_in,
1933            NULL,
1934        );
1935        utils::result(
1936            vips_op_response,
1937            VipsImage { ctx: out_out },
1938            Error::HistFindIndexedError,
1939        )
1940    }
1941}
1942
1943/// VipsHoughLine (hough_line), find hough line transform
1944/// inp: `&VipsImage` -> Input image
1945/// returns `VipsImage` - Output image
1946pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1947    unsafe {
1948        let inp_in: *mut bindings::VipsImage = inp.ctx;
1949        let mut out_out: *mut bindings::VipsImage = null_mut();
1950
1951        let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1952        utils::result(
1953            vips_op_response,
1954            VipsImage { ctx: out_out },
1955            Error::HoughLineError,
1956        )
1957    }
1958}
1959
1960/// Options for hough_line operation
1961#[derive(Clone, Debug)]
1962pub struct HoughLineOptions {
1963    /// width: `i32` -> Horizontal size of parameter space
1964    /// min: 1, max: 100000, default: 256
1965    pub width: i32,
1966    /// height: `i32` -> Vertical size of parameter space
1967    /// min: 1, max: 100000, default: 256
1968    pub height: i32,
1969}
1970
1971impl std::default::Default for HoughLineOptions {
1972    fn default() -> Self {
1973        HoughLineOptions {
1974            width: i32::from(256),
1975            height: i32::from(256),
1976        }
1977    }
1978}
1979
1980/// VipsHoughLine (hough_line), find hough line transform
1981/// inp: `&VipsImage` -> Input image
1982/// hough_line_options: `&HoughLineOptions` -> optional arguments
1983/// returns `VipsImage` - Output image
1984pub fn hough_line_with_opts(
1985    inp: &VipsImage,
1986    hough_line_options: &HoughLineOptions,
1987) -> Result<VipsImage> {
1988    unsafe {
1989        let inp_in: *mut bindings::VipsImage = inp.ctx;
1990        let mut out_out: *mut bindings::VipsImage = null_mut();
1991
1992        let width_in: i32 = hough_line_options.width;
1993        let width_in_name = utils::new_c_string("width")?;
1994
1995        let height_in: i32 = hough_line_options.height;
1996        let height_in_name = utils::new_c_string("height")?;
1997
1998        let vips_op_response = bindings::vips_hough_line(
1999            inp_in,
2000            &mut out_out,
2001            width_in_name.as_ptr(),
2002            width_in,
2003            height_in_name.as_ptr(),
2004            height_in,
2005            NULL,
2006        );
2007        utils::result(
2008            vips_op_response,
2009            VipsImage { ctx: out_out },
2010            Error::HoughLineError,
2011        )
2012    }
2013}
2014
2015/// VipsHoughCircle (hough_circle), find hough circle transform
2016/// inp: `&VipsImage` -> Input image
2017/// returns `VipsImage` - Output image
2018pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
2019    unsafe {
2020        let inp_in: *mut bindings::VipsImage = inp.ctx;
2021        let mut out_out: *mut bindings::VipsImage = null_mut();
2022
2023        let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
2024        utils::result(
2025            vips_op_response,
2026            VipsImage { ctx: out_out },
2027            Error::HoughCircleError,
2028        )
2029    }
2030}
2031
2032/// Options for hough_circle operation
2033#[derive(Clone, Debug)]
2034pub struct HoughCircleOptions {
2035    /// scale: `i32` -> Scale down dimensions by this factor
2036    /// min: 1, max: 100000, default: 3
2037    pub scale: i32,
2038    /// min_radius: `i32` -> Smallest radius to search for
2039    /// min: 1, max: 100000, default: 10
2040    pub min_radius: i32,
2041    /// max_radius: `i32` -> Largest radius to search for
2042    /// min: 1, max: 100000, default: 20
2043    pub max_radius: i32,
2044}
2045
2046impl std::default::Default for HoughCircleOptions {
2047    fn default() -> Self {
2048        HoughCircleOptions {
2049            scale: i32::from(3),
2050            min_radius: i32::from(10),
2051            max_radius: i32::from(20),
2052        }
2053    }
2054}
2055
2056/// VipsHoughCircle (hough_circle), find hough circle transform
2057/// inp: `&VipsImage` -> Input image
2058/// hough_circle_options: `&HoughCircleOptions` -> optional arguments
2059/// returns `VipsImage` - Output image
2060pub fn hough_circle_with_opts(
2061    inp: &VipsImage,
2062    hough_circle_options: &HoughCircleOptions,
2063) -> Result<VipsImage> {
2064    unsafe {
2065        let inp_in: *mut bindings::VipsImage = inp.ctx;
2066        let mut out_out: *mut bindings::VipsImage = null_mut();
2067
2068        let scale_in: i32 = hough_circle_options.scale;
2069        let scale_in_name = utils::new_c_string("scale")?;
2070
2071        let min_radius_in: i32 = hough_circle_options.min_radius;
2072        let min_radius_in_name = utils::new_c_string("min-radius")?;
2073
2074        let max_radius_in: i32 = hough_circle_options.max_radius;
2075        let max_radius_in_name = utils::new_c_string("max-radius")?;
2076
2077        let vips_op_response = bindings::vips_hough_circle(
2078            inp_in,
2079            &mut out_out,
2080            scale_in_name.as_ptr(),
2081            scale_in,
2082            min_radius_in_name.as_ptr(),
2083            min_radius_in,
2084            max_radius_in_name.as_ptr(),
2085            max_radius_in,
2086            NULL,
2087        );
2088        utils::result(
2089            vips_op_response,
2090            VipsImage { ctx: out_out },
2091            Error::HoughCircleError,
2092        )
2093    }
2094}
2095
2096/// VipsProject (project), find image projections
2097/// inp: `&VipsImage` -> Input image
2098/// Tuple (
2099/// VipsImage - Sums of columns
2100/// VipsImage - Sums of rows
2101///)
2102pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2103    unsafe {
2104        let inp_in: *mut bindings::VipsImage = inp.ctx;
2105        let mut columns_out: *mut bindings::VipsImage = null_mut();
2106        let mut rows_out: *mut bindings::VipsImage = null_mut();
2107
2108        let vips_op_response =
2109            bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2110        utils::result(
2111            vips_op_response,
2112            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2113            Error::ProjectError,
2114        )
2115    }
2116}
2117
2118/// VipsProfile (profile), find image profiles
2119/// inp: `&VipsImage` -> Input image
2120/// Tuple (
2121/// VipsImage - First non-zero pixel in column
2122/// VipsImage - First non-zero pixel in row
2123///)
2124pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2125    unsafe {
2126        let inp_in: *mut bindings::VipsImage = inp.ctx;
2127        let mut columns_out: *mut bindings::VipsImage = null_mut();
2128        let mut rows_out: *mut bindings::VipsImage = null_mut();
2129
2130        let vips_op_response =
2131            bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2132        utils::result(
2133            vips_op_response,
2134            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2135            Error::ProfileError,
2136        )
2137    }
2138}
2139
2140/// VipsMeasure (measure), measure a set of patches on a color chart
2141/// inp: `&VipsImage` -> Image to measure
2142/// h: `i32` -> Number of patches across chart
2143/// min: 1, max: 100000000, default: 1
2144/// v: `i32` -> Number of patches down chart
2145/// min: 1, max: 100000000, default: 1
2146/// returns `VipsImage` - Output array of statistics
2147pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2148    unsafe {
2149        let inp_in: *mut bindings::VipsImage = inp.ctx;
2150        let h_in: i32 = h;
2151        let v_in: i32 = v;
2152        let mut out_out: *mut bindings::VipsImage = null_mut();
2153
2154        let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2155        utils::result(
2156            vips_op_response,
2157            VipsImage { ctx: out_out },
2158            Error::MeasureError,
2159        )
2160    }
2161}
2162
2163/// Options for measure operation
2164#[derive(Clone, Debug)]
2165pub struct MeasureOptions {
2166    /// left: `i32` -> Left edge of extract area
2167    /// min: 0, max: 100000000, default: 0
2168    pub left: i32,
2169    /// top: `i32` -> Top edge of extract area
2170    /// min: 0, max: 100000000, default: 0
2171    pub top: i32,
2172    /// width: `i32` -> Width of extract area
2173    /// min: 1, max: 100000000, default: 1
2174    pub width: i32,
2175    /// height: `i32` -> Height of extract area
2176    /// min: 1, max: 100000000, default: 1
2177    pub height: i32,
2178}
2179
2180impl std::default::Default for MeasureOptions {
2181    fn default() -> Self {
2182        MeasureOptions {
2183            left: i32::from(0),
2184            top: i32::from(0),
2185            width: i32::from(1),
2186            height: i32::from(1),
2187        }
2188    }
2189}
2190
2191/// VipsMeasure (measure), measure a set of patches on a color chart
2192/// inp: `&VipsImage` -> Image to measure
2193/// h: `i32` -> Number of patches across chart
2194/// min: 1, max: 100000000, default: 1
2195/// v: `i32` -> Number of patches down chart
2196/// min: 1, max: 100000000, default: 1
2197/// measure_options: `&MeasureOptions` -> optional arguments
2198/// returns `VipsImage` - Output array of statistics
2199pub fn measure_with_opts(
2200    inp: &VipsImage,
2201    h: i32,
2202    v: i32,
2203    measure_options: &MeasureOptions,
2204) -> Result<VipsImage> {
2205    unsafe {
2206        let inp_in: *mut bindings::VipsImage = inp.ctx;
2207        let h_in: i32 = h;
2208        let v_in: i32 = v;
2209        let mut out_out: *mut bindings::VipsImage = null_mut();
2210
2211        let left_in: i32 = measure_options.left;
2212        let left_in_name = utils::new_c_string("left")?;
2213
2214        let top_in: i32 = measure_options.top;
2215        let top_in_name = utils::new_c_string("top")?;
2216
2217        let width_in: i32 = measure_options.width;
2218        let width_in_name = utils::new_c_string("width")?;
2219
2220        let height_in: i32 = measure_options.height;
2221        let height_in_name = utils::new_c_string("height")?;
2222
2223        let vips_op_response = bindings::vips_measure(
2224            inp_in,
2225            &mut out_out,
2226            h_in,
2227            v_in,
2228            left_in_name.as_ptr(),
2229            left_in,
2230            top_in_name.as_ptr(),
2231            top_in,
2232            width_in_name.as_ptr(),
2233            width_in,
2234            height_in_name.as_ptr(),
2235            height_in,
2236            NULL,
2237        );
2238        utils::result(
2239            vips_op_response,
2240            VipsImage { ctx: out_out },
2241            Error::MeasureError,
2242        )
2243    }
2244}
2245
2246/// VipsFindTrim (find_trim), search an image for non-edge areas
2247/// inp: `&VipsImage` -> Image to find_trim
2248/// Tuple (
2249/// i32 - Left edge of image
2250/// i32 - Top edge of extract area
2251/// i32 - Width of extract area
2252/// i32 - Height of extract area
2253///)
2254pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2255    unsafe {
2256        let inp_in: *mut bindings::VipsImage = inp.ctx;
2257        let mut left_out: i32 = i32::from(1);
2258        let mut top_out: i32 = i32::from(0);
2259        let mut width_out: i32 = i32::from(1);
2260        let mut height_out: i32 = i32::from(1);
2261
2262        let vips_op_response = bindings::vips_find_trim(
2263            inp_in,
2264            &mut left_out,
2265            &mut top_out,
2266            &mut width_out,
2267            &mut height_out,
2268            NULL,
2269        );
2270        utils::result(
2271            vips_op_response,
2272            (left_out, top_out, width_out, height_out),
2273            Error::FindTrimError,
2274        )
2275    }
2276}
2277
2278/// Options for find_trim operation
2279#[derive(Clone, Debug)]
2280pub struct FindTrimOptions {
2281    /// threshold: `f64` -> Object threshold
2282    /// min: 0, max: inf, default: 10
2283    pub threshold: f64,
2284    /// background: `Vec<f64>` -> Color for background pixels
2285    pub background: Vec<f64>,
2286    /// line_art: `bool` -> Enable line art mode
2287    /// default: false
2288    pub line_art: bool,
2289}
2290
2291impl std::default::Default for FindTrimOptions {
2292    fn default() -> Self {
2293        FindTrimOptions {
2294            threshold: f64::from(10),
2295            background: Vec::new(),
2296            line_art: false,
2297        }
2298    }
2299}
2300
2301/// VipsFindTrim (find_trim), search an image for non-edge areas
2302/// inp: `&VipsImage` -> Image to find_trim
2303/// find_trim_options: `&FindTrimOptions` -> optional arguments
2304/// Tuple (
2305/// i32 - Left edge of image
2306/// i32 - Top edge of extract area
2307/// i32 - Width of extract area
2308/// i32 - Height of extract area
2309///)
2310pub fn find_trim_with_opts(
2311    inp: &VipsImage,
2312    find_trim_options: &FindTrimOptions,
2313) -> Result<(i32, i32, i32, i32)> {
2314    unsafe {
2315        let inp_in: *mut bindings::VipsImage = inp.ctx;
2316        let mut left_out: i32 = i32::from(1);
2317        let mut top_out: i32 = i32::from(0);
2318        let mut width_out: i32 = i32::from(1);
2319        let mut height_out: i32 = i32::from(1);
2320
2321        let threshold_in: f64 = find_trim_options.threshold;
2322        let threshold_in_name = utils::new_c_string("threshold")?;
2323
2324        let background_wrapper =
2325            utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2326        let background_in = background_wrapper.ctx;
2327        let background_in_name = utils::new_c_string("background")?;
2328
2329        let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2330        let line_art_in_name = utils::new_c_string("line-art")?;
2331
2332        let vips_op_response = bindings::vips_find_trim(
2333            inp_in,
2334            &mut left_out,
2335            &mut top_out,
2336            &mut width_out,
2337            &mut height_out,
2338            threshold_in_name.as_ptr(),
2339            threshold_in,
2340            background_in_name.as_ptr(),
2341            background_in,
2342            line_art_in_name.as_ptr(),
2343            line_art_in,
2344            NULL,
2345        );
2346        utils::result(
2347            vips_op_response,
2348            (left_out, top_out, width_out, height_out),
2349            Error::FindTrimError,
2350        )
2351    }
2352}
2353
2354/// VipsCopy (copy), copy an image
2355/// inp: `&VipsImage` -> Input image
2356/// returns `VipsImage` - Output image
2357pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2358    unsafe {
2359        let inp_in: *mut bindings::VipsImage = inp.ctx;
2360        let mut out_out: *mut bindings::VipsImage = null_mut();
2361
2362        let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2363        utils::result(
2364            vips_op_response,
2365            VipsImage { ctx: out_out },
2366            Error::CopyError,
2367        )
2368    }
2369}
2370
2371/// Options for copy operation
2372#[derive(Clone, Debug)]
2373pub struct CopyOptions {
2374    /// width: `i32` -> Image width in pixels
2375    /// min: 0, max: 100000000, default: 0
2376    pub width: i32,
2377    /// height: `i32` -> Image height in pixels
2378    /// min: 0, max: 100000000, default: 0
2379    pub height: i32,
2380    /// bands: `i32` -> Number of bands in image
2381    /// min: 0, max: 100000000, default: 0
2382    pub bands: i32,
2383    /// format: `BandFormat` -> Pixel format in image
2384    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
2385    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
2386    ///  `Char` -> VIPS_FORMAT_CHAR = 1
2387    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
2388    ///  `Short` -> VIPS_FORMAT_SHORT = 3
2389    ///  `Uint` -> VIPS_FORMAT_UINT = 4
2390    ///  `Int` -> VIPS_FORMAT_INT = 5
2391    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
2392    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
2393    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
2394    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
2395    ///  `Last` -> VIPS_FORMAT_LAST = 10
2396    pub format: BandFormat,
2397    /// coding: `Coding` -> Pixel coding
2398    ///  `Error` -> VIPS_CODING_ERROR = -1
2399    ///  `None` -> VIPS_CODING_NONE = 0 [DEFAULT]
2400    ///  `Labq` -> VIPS_CODING_LABQ = 2
2401    ///  `Rad` -> VIPS_CODING_RAD = 6
2402    ///  `Last` -> VIPS_CODING_LAST = 7
2403    pub coding: Coding,
2404    /// interpretation: `Interpretation` -> Pixel interpretation
2405    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
2406    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
2407    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
2408    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
2409    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
2410    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
2411    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
2412    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
2413    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
2414    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
2415    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
2416    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
2417    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
2418    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
2419    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
2420    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
2421    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
2422    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
2423    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
2424    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
2425    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
2426    pub interpretation: Interpretation,
2427    /// xres: `f64` -> Horizontal resolution in pixels/mm
2428    /// min: -0, max: 1000000, default: 0
2429    pub xres: f64,
2430    /// yres: `f64` -> Vertical resolution in pixels/mm
2431    /// min: -0, max: 1000000, default: 0
2432    pub yres: f64,
2433    /// xoffset: `i32` -> Horizontal offset of origin
2434    /// min: -100000000, max: 100000000, default: 0
2435    pub xoffset: i32,
2436    /// yoffset: `i32` -> Vertical offset of origin
2437    /// min: -100000000, max: 100000000, default: 0
2438    pub yoffset: i32,
2439}
2440
2441impl std::default::Default for CopyOptions {
2442    fn default() -> Self {
2443        CopyOptions {
2444            width: i32::from(0),
2445            height: i32::from(0),
2446            bands: i32::from(0),
2447            format: BandFormat::Uchar,
2448            coding: Coding::None,
2449            interpretation: Interpretation::Multiband,
2450            xres: f64::from(0),
2451            yres: f64::from(0),
2452            xoffset: i32::from(0),
2453            yoffset: i32::from(0),
2454        }
2455    }
2456}
2457
2458/// VipsCopy (copy), copy an image
2459/// inp: `&VipsImage` -> Input image
2460/// copy_options: `&CopyOptions` -> optional arguments
2461/// returns `VipsImage` - Output image
2462pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2463    unsafe {
2464        let inp_in: *mut bindings::VipsImage = inp.ctx;
2465        let mut out_out: *mut bindings::VipsImage = null_mut();
2466
2467        let width_in: i32 = copy_options.width;
2468        let width_in_name = utils::new_c_string("width")?;
2469
2470        let height_in: i32 = copy_options.height;
2471        let height_in_name = utils::new_c_string("height")?;
2472
2473        let bands_in: i32 = copy_options.bands;
2474        let bands_in_name = utils::new_c_string("bands")?;
2475
2476        let format_in: i32 = copy_options.format as i32;
2477        let format_in_name = utils::new_c_string("format")?;
2478
2479        let coding_in: i32 = copy_options.coding as i32;
2480        let coding_in_name = utils::new_c_string("coding")?;
2481
2482        let interpretation_in: i32 = copy_options.interpretation as i32;
2483        let interpretation_in_name = utils::new_c_string("interpretation")?;
2484
2485        let xres_in: f64 = copy_options.xres;
2486        let xres_in_name = utils::new_c_string("xres")?;
2487
2488        let yres_in: f64 = copy_options.yres;
2489        let yres_in_name = utils::new_c_string("yres")?;
2490
2491        let xoffset_in: i32 = copy_options.xoffset;
2492        let xoffset_in_name = utils::new_c_string("xoffset")?;
2493
2494        let yoffset_in: i32 = copy_options.yoffset;
2495        let yoffset_in_name = utils::new_c_string("yoffset")?;
2496
2497        let vips_op_response = bindings::vips_copy(
2498            inp_in,
2499            &mut out_out,
2500            width_in_name.as_ptr(),
2501            width_in,
2502            height_in_name.as_ptr(),
2503            height_in,
2504            bands_in_name.as_ptr(),
2505            bands_in,
2506            format_in_name.as_ptr(),
2507            format_in,
2508            coding_in_name.as_ptr(),
2509            coding_in,
2510            interpretation_in_name.as_ptr(),
2511            interpretation_in,
2512            xres_in_name.as_ptr(),
2513            xres_in,
2514            yres_in_name.as_ptr(),
2515            yres_in,
2516            xoffset_in_name.as_ptr(),
2517            xoffset_in,
2518            yoffset_in_name.as_ptr(),
2519            yoffset_in,
2520            NULL,
2521        );
2522        utils::result(
2523            vips_op_response,
2524            VipsImage { ctx: out_out },
2525            Error::CopyError,
2526        )
2527    }
2528}
2529
2530/// VipsTileCache (tilecache), cache an image as a set of tiles
2531/// inp: `&VipsImage` -> Input image
2532/// returns `VipsImage` - Output image
2533pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2534    unsafe {
2535        let inp_in: *mut bindings::VipsImage = inp.ctx;
2536        let mut out_out: *mut bindings::VipsImage = null_mut();
2537
2538        let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2539        utils::result(
2540            vips_op_response,
2541            VipsImage { ctx: out_out },
2542            Error::TilecacheError,
2543        )
2544    }
2545}
2546
2547/// Options for tilecache operation
2548#[derive(Clone, Debug)]
2549pub struct TilecacheOptions {
2550    /// tile_width: `i32` -> Tile width in pixels
2551    /// min: 1, max: 1000000, default: 128
2552    pub tile_width: i32,
2553    /// tile_height: `i32` -> Tile height in pixels
2554    /// min: 1, max: 1000000, default: 128
2555    pub tile_height: i32,
2556    /// max_tiles: `i32` -> Maximum number of tiles to cache
2557    /// min: -1, max: 1000000, default: 1000
2558    pub max_tiles: i32,
2559    /// access: `Access` -> Expected access pattern
2560    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2561    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2562    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2563    ///  `Last` -> VIPS_ACCESS_LAST = 3
2564    pub access: Access,
2565    /// threaded: `bool` -> Allow threaded access
2566    /// default: false
2567    pub threaded: bool,
2568    /// persistent: `bool` -> Keep cache between evaluations
2569    /// default: false
2570    pub persistent: bool,
2571}
2572
2573impl std::default::Default for TilecacheOptions {
2574    fn default() -> Self {
2575        TilecacheOptions {
2576            tile_width: i32::from(128),
2577            tile_height: i32::from(128),
2578            max_tiles: i32::from(1000),
2579            access: Access::Random,
2580            threaded: false,
2581            persistent: false,
2582        }
2583    }
2584}
2585
2586/// VipsTileCache (tilecache), cache an image as a set of tiles
2587/// inp: `&VipsImage` -> Input image
2588/// tilecache_options: `&TilecacheOptions` -> optional arguments
2589/// returns `VipsImage` - Output image
2590pub fn tilecache_with_opts(
2591    inp: &VipsImage,
2592    tilecache_options: &TilecacheOptions,
2593) -> Result<VipsImage> {
2594    unsafe {
2595        let inp_in: *mut bindings::VipsImage = inp.ctx;
2596        let mut out_out: *mut bindings::VipsImage = null_mut();
2597
2598        let tile_width_in: i32 = tilecache_options.tile_width;
2599        let tile_width_in_name = utils::new_c_string("tile-width")?;
2600
2601        let tile_height_in: i32 = tilecache_options.tile_height;
2602        let tile_height_in_name = utils::new_c_string("tile-height")?;
2603
2604        let max_tiles_in: i32 = tilecache_options.max_tiles;
2605        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2606
2607        let access_in: i32 = tilecache_options.access as i32;
2608        let access_in_name = utils::new_c_string("access")?;
2609
2610        let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2611        let threaded_in_name = utils::new_c_string("threaded")?;
2612
2613        let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2614        let persistent_in_name = utils::new_c_string("persistent")?;
2615
2616        let vips_op_response = bindings::vips_tilecache(
2617            inp_in,
2618            &mut out_out,
2619            tile_width_in_name.as_ptr(),
2620            tile_width_in,
2621            tile_height_in_name.as_ptr(),
2622            tile_height_in,
2623            max_tiles_in_name.as_ptr(),
2624            max_tiles_in,
2625            access_in_name.as_ptr(),
2626            access_in,
2627            threaded_in_name.as_ptr(),
2628            threaded_in,
2629            persistent_in_name.as_ptr(),
2630            persistent_in,
2631            NULL,
2632        );
2633        utils::result(
2634            vips_op_response,
2635            VipsImage { ctx: out_out },
2636            Error::TilecacheError,
2637        )
2638    }
2639}
2640
2641/// VipsLineCache (linecache), cache an image as a set of lines
2642/// inp: `&VipsImage` -> Input image
2643/// returns `VipsImage` - Output image
2644pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2645    unsafe {
2646        let inp_in: *mut bindings::VipsImage = inp.ctx;
2647        let mut out_out: *mut bindings::VipsImage = null_mut();
2648
2649        let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2650        utils::result(
2651            vips_op_response,
2652            VipsImage { ctx: out_out },
2653            Error::LinecacheError,
2654        )
2655    }
2656}
2657
2658/// Options for linecache operation
2659#[derive(Clone, Debug)]
2660pub struct LinecacheOptions {
2661    /// tile_height: `i32` -> Tile height in pixels
2662    /// min: 1, max: 1000000, default: 128
2663    pub tile_height: i32,
2664    /// access: `Access` -> Expected access pattern
2665    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2666    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2667    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2668    ///  `Last` -> VIPS_ACCESS_LAST = 3
2669    pub access: Access,
2670    /// threaded: `bool` -> Allow threaded access
2671    /// default: false
2672    pub threaded: bool,
2673    /// persistent: `bool` -> Keep cache between evaluations
2674    /// default: false
2675    pub persistent: bool,
2676}
2677
2678impl std::default::Default for LinecacheOptions {
2679    fn default() -> Self {
2680        LinecacheOptions {
2681            tile_height: i32::from(128),
2682            access: Access::Random,
2683            threaded: false,
2684            persistent: false,
2685        }
2686    }
2687}
2688
2689/// VipsLineCache (linecache), cache an image as a set of lines
2690/// inp: `&VipsImage` -> Input image
2691/// linecache_options: `&LinecacheOptions` -> optional arguments
2692/// returns `VipsImage` - Output image
2693pub fn linecache_with_opts(
2694    inp: &VipsImage,
2695    linecache_options: &LinecacheOptions,
2696) -> Result<VipsImage> {
2697    unsafe {
2698        let inp_in: *mut bindings::VipsImage = inp.ctx;
2699        let mut out_out: *mut bindings::VipsImage = null_mut();
2700
2701        let tile_height_in: i32 = linecache_options.tile_height;
2702        let tile_height_in_name = utils::new_c_string("tile-height")?;
2703
2704        let access_in: i32 = linecache_options.access as i32;
2705        let access_in_name = utils::new_c_string("access")?;
2706
2707        let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2708        let threaded_in_name = utils::new_c_string("threaded")?;
2709
2710        let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2711        let persistent_in_name = utils::new_c_string("persistent")?;
2712
2713        let vips_op_response = bindings::vips_linecache(
2714            inp_in,
2715            &mut out_out,
2716            tile_height_in_name.as_ptr(),
2717            tile_height_in,
2718            access_in_name.as_ptr(),
2719            access_in,
2720            threaded_in_name.as_ptr(),
2721            threaded_in,
2722            persistent_in_name.as_ptr(),
2723            persistent_in,
2724            NULL,
2725        );
2726        utils::result(
2727            vips_op_response,
2728            VipsImage { ctx: out_out },
2729            Error::LinecacheError,
2730        )
2731    }
2732}
2733
2734/// VipsSequential (sequential), check sequential access
2735/// inp: `&VipsImage` -> Input image
2736/// returns `VipsImage` - Output image
2737pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2738    unsafe {
2739        let inp_in: *mut bindings::VipsImage = inp.ctx;
2740        let mut out_out: *mut bindings::VipsImage = null_mut();
2741
2742        let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2743        utils::result(
2744            vips_op_response,
2745            VipsImage { ctx: out_out },
2746            Error::SequentialError,
2747        )
2748    }
2749}
2750
2751/// Options for sequential operation
2752#[derive(Clone, Debug)]
2753pub struct SequentialOptions {
2754    /// tile_height: `i32` -> Tile height in pixels
2755    /// min: 1, max: 1000000, default: 1
2756    pub tile_height: i32,
2757}
2758
2759impl std::default::Default for SequentialOptions {
2760    fn default() -> Self {
2761        SequentialOptions {
2762            tile_height: i32::from(1),
2763        }
2764    }
2765}
2766
2767/// VipsSequential (sequential), check sequential access
2768/// inp: `&VipsImage` -> Input image
2769/// sequential_options: `&SequentialOptions` -> optional arguments
2770/// returns `VipsImage` - Output image
2771pub fn sequential_with_opts(
2772    inp: &VipsImage,
2773    sequential_options: &SequentialOptions,
2774) -> Result<VipsImage> {
2775    unsafe {
2776        let inp_in: *mut bindings::VipsImage = inp.ctx;
2777        let mut out_out: *mut bindings::VipsImage = null_mut();
2778
2779        let tile_height_in: i32 = sequential_options.tile_height;
2780        let tile_height_in_name = utils::new_c_string("tile-height")?;
2781
2782        let vips_op_response = bindings::vips_sequential(
2783            inp_in,
2784            &mut out_out,
2785            tile_height_in_name.as_ptr(),
2786            tile_height_in,
2787            NULL,
2788        );
2789        utils::result(
2790            vips_op_response,
2791            VipsImage { ctx: out_out },
2792            Error::SequentialError,
2793        )
2794    }
2795}
2796
2797/// VipsEmbed (embed), embed an image in a larger image
2798/// inp: `&VipsImage` -> Input image
2799/// x: `i32` -> Left edge of input in output
2800/// min: -1000000000, max: 1000000000, default: 0
2801/// y: `i32` -> Top edge of input in output
2802/// min: -1000000000, max: 1000000000, default: 0
2803/// width: `i32` -> Image width in pixels
2804/// min: 1, max: 1000000000, default: 1
2805/// height: `i32` -> Image height in pixels
2806/// min: 1, max: 1000000000, default: 1
2807/// returns `VipsImage` - Output image
2808pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2809    unsafe {
2810        let inp_in: *mut bindings::VipsImage = inp.ctx;
2811        let x_in: i32 = x;
2812        let y_in: i32 = y;
2813        let width_in: i32 = width;
2814        let height_in: i32 = height;
2815        let mut out_out: *mut bindings::VipsImage = null_mut();
2816
2817        let vips_op_response =
2818            bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2819        utils::result(
2820            vips_op_response,
2821            VipsImage { ctx: out_out },
2822            Error::EmbedError,
2823        )
2824    }
2825}
2826
2827/// Options for embed operation
2828#[derive(Clone, Debug)]
2829pub struct EmbedOptions {
2830    /// extend: `Extend` -> How to generate the extra pixels
2831    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2832    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2833    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2834    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2835    ///  `White` -> VIPS_EXTEND_WHITE = 4
2836    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2837    ///  `Last` -> VIPS_EXTEND_LAST = 6
2838    pub extend: Extend,
2839    /// background: `Vec<f64>` -> Color for background pixels
2840    pub background: Vec<f64>,
2841}
2842
2843impl std::default::Default for EmbedOptions {
2844    fn default() -> Self {
2845        EmbedOptions {
2846            extend: Extend::Black,
2847            background: Vec::new(),
2848        }
2849    }
2850}
2851
2852/// VipsEmbed (embed), embed an image in a larger image
2853/// inp: `&VipsImage` -> Input image
2854/// x: `i32` -> Left edge of input in output
2855/// min: -1000000000, max: 1000000000, default: 0
2856/// y: `i32` -> Top edge of input in output
2857/// min: -1000000000, max: 1000000000, default: 0
2858/// width: `i32` -> Image width in pixels
2859/// min: 1, max: 1000000000, default: 1
2860/// height: `i32` -> Image height in pixels
2861/// min: 1, max: 1000000000, default: 1
2862/// embed_options: `&EmbedOptions` -> optional arguments
2863/// returns `VipsImage` - Output image
2864pub fn embed_with_opts(
2865    inp: &VipsImage,
2866    x: i32,
2867    y: i32,
2868    width: i32,
2869    height: i32,
2870    embed_options: &EmbedOptions,
2871) -> Result<VipsImage> {
2872    unsafe {
2873        let inp_in: *mut bindings::VipsImage = inp.ctx;
2874        let x_in: i32 = x;
2875        let y_in: i32 = y;
2876        let width_in: i32 = width;
2877        let height_in: i32 = height;
2878        let mut out_out: *mut bindings::VipsImage = null_mut();
2879
2880        let extend_in: i32 = embed_options.extend as i32;
2881        let extend_in_name = utils::new_c_string("extend")?;
2882
2883        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2884        let background_in = background_wrapper.ctx;
2885        let background_in_name = utils::new_c_string("background")?;
2886
2887        let vips_op_response = bindings::vips_embed(
2888            inp_in,
2889            &mut out_out,
2890            x_in,
2891            y_in,
2892            width_in,
2893            height_in,
2894            extend_in_name.as_ptr(),
2895            extend_in,
2896            background_in_name.as_ptr(),
2897            background_in,
2898            NULL,
2899        );
2900        utils::result(
2901            vips_op_response,
2902            VipsImage { ctx: out_out },
2903            Error::EmbedError,
2904        )
2905    }
2906}
2907
2908/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2909/// inp: `&VipsImage` -> Input image
2910/// direction: `CompassDirection` -> Direction to place image within width/height
2911///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2912///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2913///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2914///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2915///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2916///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2917///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2918///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2919///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2920///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2921/// width: `i32` -> Image width in pixels
2922/// min: 1, max: 1000000000, default: 1
2923/// height: `i32` -> Image height in pixels
2924/// min: 1, max: 1000000000, default: 1
2925/// returns `VipsImage` - Output image
2926pub fn gravity(
2927    inp: &VipsImage,
2928    direction: CompassDirection,
2929    width: i32,
2930    height: i32,
2931) -> Result<VipsImage> {
2932    unsafe {
2933        let inp_in: *mut bindings::VipsImage = inp.ctx;
2934        let direction_in: i32 = direction as i32;
2935        let width_in: i32 = width;
2936        let height_in: i32 = height;
2937        let mut out_out: *mut bindings::VipsImage = null_mut();
2938
2939        let vips_op_response = bindings::vips_gravity(
2940            inp_in,
2941            &mut out_out,
2942            direction_in.try_into().unwrap(),
2943            width_in,
2944            height_in,
2945            NULL,
2946        );
2947        utils::result(
2948            vips_op_response,
2949            VipsImage { ctx: out_out },
2950            Error::GravityError,
2951        )
2952    }
2953}
2954
2955/// Options for gravity operation
2956#[derive(Clone, Debug)]
2957pub struct GravityOptions {
2958    /// extend: `Extend` -> How to generate the extra pixels
2959    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2960    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2961    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2962    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2963    ///  `White` -> VIPS_EXTEND_WHITE = 4
2964    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2965    ///  `Last` -> VIPS_EXTEND_LAST = 6
2966    pub extend: Extend,
2967    /// background: `Vec<f64>` -> Color for background pixels
2968    pub background: Vec<f64>,
2969}
2970
2971impl std::default::Default for GravityOptions {
2972    fn default() -> Self {
2973        GravityOptions {
2974            extend: Extend::Black,
2975            background: Vec::new(),
2976        }
2977    }
2978}
2979
2980/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2981/// inp: `&VipsImage` -> Input image
2982/// direction: `CompassDirection` -> Direction to place image within width/height
2983///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2984///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2985///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2986///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2987///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2988///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2989///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2990///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2991///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2992///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2993/// width: `i32` -> Image width in pixels
2994/// min: 1, max: 1000000000, default: 1
2995/// height: `i32` -> Image height in pixels
2996/// min: 1, max: 1000000000, default: 1
2997/// gravity_options: `&GravityOptions` -> optional arguments
2998/// returns `VipsImage` - Output image
2999pub fn gravity_with_opts(
3000    inp: &VipsImage,
3001    direction: CompassDirection,
3002    width: i32,
3003    height: i32,
3004    gravity_options: &GravityOptions,
3005) -> Result<VipsImage> {
3006    unsafe {
3007        let inp_in: *mut bindings::VipsImage = inp.ctx;
3008        let direction_in: i32 = direction as i32;
3009        let width_in: i32 = width;
3010        let height_in: i32 = height;
3011        let mut out_out: *mut bindings::VipsImage = null_mut();
3012
3013        let extend_in: i32 = gravity_options.extend as i32;
3014        let extend_in_name = utils::new_c_string("extend")?;
3015
3016        let background_wrapper =
3017            utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
3018        let background_in = background_wrapper.ctx;
3019        let background_in_name = utils::new_c_string("background")?;
3020
3021        let vips_op_response = bindings::vips_gravity(
3022            inp_in,
3023            &mut out_out,
3024            direction_in.try_into().unwrap(),
3025            width_in,
3026            height_in,
3027            extend_in_name.as_ptr(),
3028            extend_in,
3029            background_in_name.as_ptr(),
3030            background_in,
3031            NULL,
3032        );
3033        utils::result(
3034            vips_op_response,
3035            VipsImage { ctx: out_out },
3036            Error::GravityError,
3037        )
3038    }
3039}
3040
3041/// VipsFlip (flip), flip an image
3042/// inp: `&VipsImage` -> Input image
3043/// direction: `Direction` -> Direction to flip image
3044///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3045///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3046///  `Last` -> VIPS_DIRECTION_LAST = 2
3047/// returns `VipsImage` - Output image
3048pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3049    unsafe {
3050        let inp_in: *mut bindings::VipsImage = inp.ctx;
3051        let direction_in: i32 = direction as i32;
3052        let mut out_out: *mut bindings::VipsImage = null_mut();
3053
3054        let vips_op_response =
3055            bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3056        utils::result(
3057            vips_op_response,
3058            VipsImage { ctx: out_out },
3059            Error::FlipError,
3060        )
3061    }
3062}
3063
3064/// VipsInsert (insert), insert image @sub into @main at @x, @y
3065/// main: `&VipsImage` -> Main input image
3066/// sub: `&VipsImage` -> Sub-image to insert into main image
3067/// x: `i32` -> Left edge of sub in main
3068/// min: -100000000, max: 100000000, default: 0
3069/// y: `i32` -> Top edge of sub in main
3070/// min: -100000000, max: 100000000, default: 0
3071/// returns `VipsImage` - Output image
3072pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3073    unsafe {
3074        let main_in: *mut bindings::VipsImage = main.ctx;
3075        let sub_in: *mut bindings::VipsImage = sub.ctx;
3076        let x_in: i32 = x;
3077        let y_in: i32 = y;
3078        let mut out_out: *mut bindings::VipsImage = null_mut();
3079
3080        let vips_op_response =
3081            bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3082        utils::result(
3083            vips_op_response,
3084            VipsImage { ctx: out_out },
3085            Error::InsertError,
3086        )
3087    }
3088}
3089
3090/// Options for insert operation
3091#[derive(Clone, Debug)]
3092pub struct InsertOptions {
3093    /// expand: `bool` -> Expand output to hold all of both inputs
3094    /// default: false
3095    pub expand: bool,
3096    /// background: `Vec<f64>` -> Color for new pixels
3097    pub background: Vec<f64>,
3098}
3099
3100impl std::default::Default for InsertOptions {
3101    fn default() -> Self {
3102        InsertOptions {
3103            expand: false,
3104            background: Vec::new(),
3105        }
3106    }
3107}
3108
3109/// VipsInsert (insert), insert image @sub into @main at @x, @y
3110/// main: `&VipsImage` -> Main input image
3111/// sub: `&VipsImage` -> Sub-image to insert into main image
3112/// x: `i32` -> Left edge of sub in main
3113/// min: -100000000, max: 100000000, default: 0
3114/// y: `i32` -> Top edge of sub in main
3115/// min: -100000000, max: 100000000, default: 0
3116/// insert_options: `&InsertOptions` -> optional arguments
3117/// returns `VipsImage` - Output image
3118pub fn insert_with_opts(
3119    main: &VipsImage,
3120    sub: &VipsImage,
3121    x: i32,
3122    y: i32,
3123    insert_options: &InsertOptions,
3124) -> Result<VipsImage> {
3125    unsafe {
3126        let main_in: *mut bindings::VipsImage = main.ctx;
3127        let sub_in: *mut bindings::VipsImage = sub.ctx;
3128        let x_in: i32 = x;
3129        let y_in: i32 = y;
3130        let mut out_out: *mut bindings::VipsImage = null_mut();
3131
3132        let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3133        let expand_in_name = utils::new_c_string("expand")?;
3134
3135        let background_wrapper =
3136            utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3137        let background_in = background_wrapper.ctx;
3138        let background_in_name = utils::new_c_string("background")?;
3139
3140        let vips_op_response = bindings::vips_insert(
3141            main_in,
3142            sub_in,
3143            &mut out_out,
3144            x_in,
3145            y_in,
3146            expand_in_name.as_ptr(),
3147            expand_in,
3148            background_in_name.as_ptr(),
3149            background_in,
3150            NULL,
3151        );
3152        utils::result(
3153            vips_op_response,
3154            VipsImage { ctx: out_out },
3155            Error::InsertError,
3156        )
3157    }
3158}
3159
3160/// VipsJoin (join), join a pair of images
3161/// in_1: `&VipsImage` -> First input image
3162/// in_2: `&VipsImage` -> Second input image
3163/// direction: `Direction` -> Join left-right or up-down
3164///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3165///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3166///  `Last` -> VIPS_DIRECTION_LAST = 2
3167/// returns `VipsImage` - Output image
3168pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3169    unsafe {
3170        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3171        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3172        let direction_in: i32 = direction as i32;
3173        let mut out_out: *mut bindings::VipsImage = null_mut();
3174
3175        let vips_op_response = bindings::vips_join(
3176            in_1_in,
3177            in_2_in,
3178            &mut out_out,
3179            direction_in.try_into().unwrap(),
3180            NULL,
3181        );
3182        utils::result(
3183            vips_op_response,
3184            VipsImage { ctx: out_out },
3185            Error::JoinError,
3186        )
3187    }
3188}
3189
3190/// Options for join operation
3191#[derive(Clone, Debug)]
3192pub struct JoinOptions {
3193    /// expand: `bool` -> Expand output to hold all of both inputs
3194    /// default: false
3195    pub expand: bool,
3196    /// shim: `i32` -> Pixels between images
3197    /// min: 0, max: 1000000, default: 0
3198    pub shim: i32,
3199    /// background: `Vec<f64>` -> Colour for new pixels
3200    pub background: Vec<f64>,
3201    /// align: `Align` -> Align on the low, centre or high coordinate edge
3202    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3203    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3204    ///  `High` -> VIPS_ALIGN_HIGH = 2
3205    ///  `Last` -> VIPS_ALIGN_LAST = 3
3206    pub align: Align,
3207}
3208
3209impl std::default::Default for JoinOptions {
3210    fn default() -> Self {
3211        JoinOptions {
3212            expand: false,
3213            shim: i32::from(0),
3214            background: Vec::new(),
3215            align: Align::Low,
3216        }
3217    }
3218}
3219
3220/// VipsJoin (join), join a pair of images
3221/// in_1: `&VipsImage` -> First input image
3222/// in_2: `&VipsImage` -> Second input image
3223/// direction: `Direction` -> Join left-right or up-down
3224///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3225///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3226///  `Last` -> VIPS_DIRECTION_LAST = 2
3227/// join_options: `&JoinOptions` -> optional arguments
3228/// returns `VipsImage` - Output image
3229pub fn join_with_opts(
3230    in_1: &VipsImage,
3231    in_2: &VipsImage,
3232    direction: Direction,
3233    join_options: &JoinOptions,
3234) -> Result<VipsImage> {
3235    unsafe {
3236        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3237        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3238        let direction_in: i32 = direction as i32;
3239        let mut out_out: *mut bindings::VipsImage = null_mut();
3240
3241        let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3242        let expand_in_name = utils::new_c_string("expand")?;
3243
3244        let shim_in: i32 = join_options.shim;
3245        let shim_in_name = utils::new_c_string("shim")?;
3246
3247        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3248        let background_in = background_wrapper.ctx;
3249        let background_in_name = utils::new_c_string("background")?;
3250
3251        let align_in: i32 = join_options.align as i32;
3252        let align_in_name = utils::new_c_string("align")?;
3253
3254        let vips_op_response = bindings::vips_join(
3255            in_1_in,
3256            in_2_in,
3257            &mut out_out,
3258            direction_in.try_into().unwrap(),
3259            expand_in_name.as_ptr(),
3260            expand_in,
3261            shim_in_name.as_ptr(),
3262            shim_in,
3263            background_in_name.as_ptr(),
3264            background_in,
3265            align_in_name.as_ptr(),
3266            align_in,
3267            NULL,
3268        );
3269        utils::result(
3270            vips_op_response,
3271            VipsImage { ctx: out_out },
3272            Error::JoinError,
3273        )
3274    }
3275}
3276
3277/// VipsArrayjoin (arrayjoin), join an array of images
3278/// inp: `&mut [VipsImage]` -> Array of input images
3279/// returns `VipsImage` - Output image
3280pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3281    unsafe {
3282        let (inp_len, mut inp_in) = {
3283            let len = inp.len();
3284            let mut input = Vec::new();
3285            for img in inp {
3286                input.push(img.ctx)
3287            }
3288            (len as i32, input)
3289        };
3290        let mut out_out: *mut bindings::VipsImage = null_mut();
3291
3292        let vips_op_response =
3293            bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3294        utils::result(
3295            vips_op_response,
3296            VipsImage { ctx: out_out },
3297            Error::ArrayjoinError,
3298        )
3299    }
3300}
3301
3302/// Options for arrayjoin operation
3303#[derive(Clone, Debug)]
3304pub struct ArrayjoinOptions {
3305    /// across: `i32` -> Number of images across grid
3306    /// min: 1, max: 1000000, default: 1
3307    pub across: i32,
3308    /// shim: `i32` -> Pixels between images
3309    /// min: 0, max: 1000000, default: 0
3310    pub shim: i32,
3311    /// background: `Vec<f64>` -> Colour for new pixels
3312    pub background: Vec<f64>,
3313    /// halign: `Align` -> Align on the left, centre or right
3314    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3315    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3316    ///  `High` -> VIPS_ALIGN_HIGH = 2
3317    ///  `Last` -> VIPS_ALIGN_LAST = 3
3318    pub halign: Align,
3319    /// valign: `Align` -> Align on the top, centre or bottom
3320    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3321    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3322    ///  `High` -> VIPS_ALIGN_HIGH = 2
3323    ///  `Last` -> VIPS_ALIGN_LAST = 3
3324    pub valign: Align,
3325    /// hspacing: `i32` -> Horizontal spacing between images
3326    /// min: 1, max: 1000000, default: 1
3327    pub hspacing: i32,
3328    /// vspacing: `i32` -> Vertical spacing between images
3329    /// min: 1, max: 1000000, default: 1
3330    pub vspacing: i32,
3331}
3332
3333impl std::default::Default for ArrayjoinOptions {
3334    fn default() -> Self {
3335        ArrayjoinOptions {
3336            across: i32::from(1),
3337            shim: i32::from(0),
3338            background: Vec::new(),
3339            halign: Align::Low,
3340            valign: Align::Low,
3341            hspacing: i32::from(1),
3342            vspacing: i32::from(1),
3343        }
3344    }
3345}
3346
3347/// VipsArrayjoin (arrayjoin), join an array of images
3348/// inp: `&mut [VipsImage]` -> Array of input images
3349/// arrayjoin_options: `&ArrayjoinOptions` -> optional arguments
3350/// returns `VipsImage` - Output image
3351pub fn arrayjoin_with_opts(
3352    inp: &mut [VipsImage],
3353    arrayjoin_options: &ArrayjoinOptions,
3354) -> Result<VipsImage> {
3355    unsafe {
3356        let (inp_len, mut inp_in) = {
3357            let len = inp.len();
3358            let mut input = Vec::new();
3359            for img in inp {
3360                input.push(img.ctx)
3361            }
3362            (len as i32, input)
3363        };
3364        let mut out_out: *mut bindings::VipsImage = null_mut();
3365
3366        let across_in: i32 = arrayjoin_options.across;
3367        let across_in_name = utils::new_c_string("across")?;
3368
3369        let shim_in: i32 = arrayjoin_options.shim;
3370        let shim_in_name = utils::new_c_string("shim")?;
3371
3372        let background_wrapper =
3373            utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3374        let background_in = background_wrapper.ctx;
3375        let background_in_name = utils::new_c_string("background")?;
3376
3377        let halign_in: i32 = arrayjoin_options.halign as i32;
3378        let halign_in_name = utils::new_c_string("halign")?;
3379
3380        let valign_in: i32 = arrayjoin_options.valign as i32;
3381        let valign_in_name = utils::new_c_string("valign")?;
3382
3383        let hspacing_in: i32 = arrayjoin_options.hspacing;
3384        let hspacing_in_name = utils::new_c_string("hspacing")?;
3385
3386        let vspacing_in: i32 = arrayjoin_options.vspacing;
3387        let vspacing_in_name = utils::new_c_string("vspacing")?;
3388
3389        let vips_op_response = bindings::vips_arrayjoin(
3390            inp_in.as_mut_ptr(),
3391            &mut out_out,
3392            inp_len,
3393            across_in_name.as_ptr(),
3394            across_in,
3395            shim_in_name.as_ptr(),
3396            shim_in,
3397            background_in_name.as_ptr(),
3398            background_in,
3399            halign_in_name.as_ptr(),
3400            halign_in,
3401            valign_in_name.as_ptr(),
3402            valign_in,
3403            hspacing_in_name.as_ptr(),
3404            hspacing_in,
3405            vspacing_in_name.as_ptr(),
3406            vspacing_in,
3407            NULL,
3408        );
3409        utils::result(
3410            vips_op_response,
3411            VipsImage { ctx: out_out },
3412            Error::ArrayjoinError,
3413        )
3414    }
3415}
3416
3417/// VipsExtractArea (extract_area), extract an area from an image
3418/// input: `&VipsImage` -> Input image
3419/// left: `i32` -> Left edge of extract area
3420/// min: -100000000, max: 100000000, default: 0
3421/// top: `i32` -> Top edge of extract area
3422/// min: -100000000, max: 100000000, default: 0
3423/// width: `i32` -> Width of extract area
3424/// min: 1, max: 100000000, default: 1
3425/// height: `i32` -> Height of extract area
3426/// min: 1, max: 100000000, default: 1
3427/// returns `VipsImage` - Output image
3428pub fn extract_area(
3429    input: &VipsImage,
3430    left: i32,
3431    top: i32,
3432    width: i32,
3433    height: i32,
3434) -> Result<VipsImage> {
3435    unsafe {
3436        let input_in: *mut bindings::VipsImage = input.ctx;
3437        let left_in: i32 = left;
3438        let top_in: i32 = top;
3439        let width_in: i32 = width;
3440        let height_in: i32 = height;
3441        let mut out_out: *mut bindings::VipsImage = null_mut();
3442
3443        let vips_op_response = bindings::vips_extract_area(
3444            input_in,
3445            &mut out_out,
3446            left_in,
3447            top_in,
3448            width_in,
3449            height_in,
3450            NULL,
3451        );
3452        utils::result(
3453            vips_op_response,
3454            VipsImage { ctx: out_out },
3455            Error::ExtractAreaError,
3456        )
3457    }
3458}
3459
3460/// VipsSmartcrop (smartcrop), extract an area from an image
3461/// input: `&VipsImage` -> Input image
3462/// width: `i32` -> Width of extract area
3463/// min: 1, max: 100000000, default: 1
3464/// height: `i32` -> Height of extract area
3465/// min: 1, max: 100000000, default: 1
3466/// returns `VipsImage` - Output image
3467pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3468    unsafe {
3469        let input_in: *mut bindings::VipsImage = input.ctx;
3470        let width_in: i32 = width;
3471        let height_in: i32 = height;
3472        let mut out_out: *mut bindings::VipsImage = null_mut();
3473
3474        let vips_op_response =
3475            bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3476        utils::result(
3477            vips_op_response,
3478            VipsImage { ctx: out_out },
3479            Error::SmartcropError,
3480        )
3481    }
3482}
3483
3484/// Options for smartcrop operation
3485#[derive(Clone, Debug)]
3486pub struct SmartcropOptions {
3487    /// attention_x: `i32` -> Horizontal position of attention centre
3488    /// min: 0, max: 100000000, default: 0
3489    pub attention_x: i32,
3490    /// attention_y: `i32` -> Vertical position of attention centre
3491    /// min: 0, max: 100000000, default: 0
3492    pub attention_y: i32,
3493    /// interesting: `Interesting` -> How to measure interestingness
3494    ///  `None` -> VIPS_INTERESTING_NONE = 0
3495    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
3496    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
3497    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3 [DEFAULT]
3498    ///  `Low` -> VIPS_INTERESTING_LOW = 4
3499    ///  `High` -> VIPS_INTERESTING_HIGH = 5
3500    ///  `All` -> VIPS_INTERESTING_ALL = 6
3501    ///  `Last` -> VIPS_INTERESTING_LAST = 7
3502    pub interesting: Interesting,
3503    /// premultiplied: `bool` -> Input image already has premultiplied alpha
3504    /// default: false
3505    pub premultiplied: bool,
3506}
3507
3508impl std::default::Default for SmartcropOptions {
3509    fn default() -> Self {
3510        SmartcropOptions {
3511            attention_x: i32::from(0),
3512            attention_y: i32::from(0),
3513            interesting: Interesting::Attention,
3514            premultiplied: false,
3515        }
3516    }
3517}
3518
3519/// VipsSmartcrop (smartcrop), extract an area from an image
3520/// input: `&VipsImage` -> Input image
3521/// width: `i32` -> Width of extract area
3522/// min: 1, max: 100000000, default: 1
3523/// height: `i32` -> Height of extract area
3524/// min: 1, max: 100000000, default: 1
3525/// smartcrop_options: `&SmartcropOptions` -> optional arguments
3526/// returns `VipsImage` - Output image
3527pub fn smartcrop_with_opts(
3528    input: &VipsImage,
3529    width: i32,
3530    height: i32,
3531    smartcrop_options: &SmartcropOptions,
3532) -> Result<VipsImage> {
3533    unsafe {
3534        let input_in: *mut bindings::VipsImage = input.ctx;
3535        let width_in: i32 = width;
3536        let height_in: i32 = height;
3537        let mut out_out: *mut bindings::VipsImage = null_mut();
3538
3539        let attention_x_in: i32 = smartcrop_options.attention_x;
3540        let attention_x_in_name = utils::new_c_string("attention-x")?;
3541
3542        let attention_y_in: i32 = smartcrop_options.attention_y;
3543        let attention_y_in_name = utils::new_c_string("attention-y")?;
3544
3545        let interesting_in: i32 = smartcrop_options.interesting as i32;
3546        let interesting_in_name = utils::new_c_string("interesting")?;
3547
3548        let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3549            1
3550        } else {
3551            0
3552        };
3553        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3554
3555        let vips_op_response = bindings::vips_smartcrop(
3556            input_in,
3557            &mut out_out,
3558            width_in,
3559            height_in,
3560            attention_x_in_name.as_ptr(),
3561            attention_x_in,
3562            attention_y_in_name.as_ptr(),
3563            attention_y_in,
3564            interesting_in_name.as_ptr(),
3565            interesting_in,
3566            premultiplied_in_name.as_ptr(),
3567            premultiplied_in,
3568            NULL,
3569        );
3570        utils::result(
3571            vips_op_response,
3572            VipsImage { ctx: out_out },
3573            Error::SmartcropError,
3574        )
3575    }
3576}
3577
3578/// VipsExtractBand (extract_band), extract band from an image
3579/// inp: `&VipsImage` -> Input image
3580/// band: `i32` -> Band to extract
3581/// min: 0, max: 100000000, default: 0
3582/// returns `VipsImage` - Output image
3583pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3584    unsafe {
3585        let inp_in: *mut bindings::VipsImage = inp.ctx;
3586        let band_in: i32 = band;
3587        let mut out_out: *mut bindings::VipsImage = null_mut();
3588
3589        let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3590        utils::result(
3591            vips_op_response,
3592            VipsImage { ctx: out_out },
3593            Error::ExtractBandError,
3594        )
3595    }
3596}
3597
3598/// Options for extract_band operation
3599#[derive(Clone, Debug)]
3600pub struct ExtractBandOptions {
3601    /// n: `i32` -> Number of bands to extract
3602    /// min: 1, max: 100000000, default: 1
3603    pub n: i32,
3604}
3605
3606impl std::default::Default for ExtractBandOptions {
3607    fn default() -> Self {
3608        ExtractBandOptions { n: i32::from(1) }
3609    }
3610}
3611
3612/// VipsExtractBand (extract_band), extract band from an image
3613/// inp: `&VipsImage` -> Input image
3614/// band: `i32` -> Band to extract
3615/// min: 0, max: 100000000, default: 0
3616/// extract_band_options: `&ExtractBandOptions` -> optional arguments
3617/// returns `VipsImage` - Output image
3618pub fn extract_band_with_opts(
3619    inp: &VipsImage,
3620    band: i32,
3621    extract_band_options: &ExtractBandOptions,
3622) -> Result<VipsImage> {
3623    unsafe {
3624        let inp_in: *mut bindings::VipsImage = inp.ctx;
3625        let band_in: i32 = band;
3626        let mut out_out: *mut bindings::VipsImage = null_mut();
3627
3628        let n_in: i32 = extract_band_options.n;
3629        let n_in_name = utils::new_c_string("n")?;
3630
3631        let vips_op_response = bindings::vips_extract_band(
3632            inp_in,
3633            &mut out_out,
3634            band_in,
3635            n_in_name.as_ptr(),
3636            n_in,
3637            NULL,
3638        );
3639        utils::result(
3640            vips_op_response,
3641            VipsImage { ctx: out_out },
3642            Error::ExtractBandError,
3643        )
3644    }
3645}
3646
3647/// VipsBandjoin (bandjoin), bandwise join a set of images
3648/// inp: `&mut [VipsImage]` -> Array of input images
3649/// returns `VipsImage` - Output image
3650pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3651    unsafe {
3652        let (inp_len, mut inp_in) = {
3653            let len = inp.len();
3654            let mut input = Vec::new();
3655            for img in inp {
3656                input.push(img.ctx)
3657            }
3658            (len as i32, input)
3659        };
3660        let mut out_out: *mut bindings::VipsImage = null_mut();
3661
3662        let vips_op_response =
3663            bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3664        utils::result(
3665            vips_op_response,
3666            VipsImage { ctx: out_out },
3667            Error::BandjoinError,
3668        )
3669    }
3670}
3671
3672/// VipsBandjoinConst (bandjoin_const), append a constant band to an image
3673/// inp: `&VipsImage` -> Input image
3674/// c: `&mut [f64]` -> Array of constants to add
3675/// returns `VipsImage` - Output image
3676pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3677    unsafe {
3678        let inp_in: *mut bindings::VipsImage = inp.ctx;
3679        let c_in: *mut f64 = c.as_mut_ptr();
3680        let mut out_out: *mut bindings::VipsImage = null_mut();
3681
3682        let vips_op_response =
3683            bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3684        utils::result(
3685            vips_op_response,
3686            VipsImage { ctx: out_out },
3687            Error::BandjoinConstError,
3688        )
3689    }
3690}
3691
3692/// VipsBandrank (bandrank), band-wise rank of a set of images
3693/// inp: `&mut [VipsImage]` -> Array of input images
3694/// returns `VipsImage` - Output image
3695pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3696    unsafe {
3697        let (inp_len, mut inp_in) = {
3698            let len = inp.len();
3699            let mut input = Vec::new();
3700            for img in inp {
3701                input.push(img.ctx)
3702            }
3703            (len as i32, input)
3704        };
3705        let mut out_out: *mut bindings::VipsImage = null_mut();
3706
3707        let vips_op_response =
3708            bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3709        utils::result(
3710            vips_op_response,
3711            VipsImage { ctx: out_out },
3712            Error::BandrankError,
3713        )
3714    }
3715}
3716
3717/// Options for bandrank operation
3718#[derive(Clone, Debug)]
3719pub struct BandrankOptions {
3720    /// index: `i32` -> Select this band element from sorted list
3721    /// min: -1, max: 1000000, default: -1
3722    pub index: i32,
3723}
3724
3725impl std::default::Default for BandrankOptions {
3726    fn default() -> Self {
3727        BandrankOptions {
3728            index: i32::from(-1),
3729        }
3730    }
3731}
3732
3733/// VipsBandrank (bandrank), band-wise rank of a set of images
3734/// inp: `&mut [VipsImage]` -> Array of input images
3735/// bandrank_options: `&BandrankOptions` -> optional arguments
3736/// returns `VipsImage` - Output image
3737pub fn bandrank_with_opts(
3738    inp: &mut [VipsImage],
3739    bandrank_options: &BandrankOptions,
3740) -> Result<VipsImage> {
3741    unsafe {
3742        let (inp_len, mut inp_in) = {
3743            let len = inp.len();
3744            let mut input = Vec::new();
3745            for img in inp {
3746                input.push(img.ctx)
3747            }
3748            (len as i32, input)
3749        };
3750        let mut out_out: *mut bindings::VipsImage = null_mut();
3751
3752        let index_in: i32 = bandrank_options.index;
3753        let index_in_name = utils::new_c_string("index")?;
3754
3755        let vips_op_response = bindings::vips_bandrank(
3756            inp_in.as_mut_ptr(),
3757            &mut out_out,
3758            inp_len,
3759            index_in_name.as_ptr(),
3760            index_in,
3761            NULL,
3762        );
3763        utils::result(
3764            vips_op_response,
3765            VipsImage { ctx: out_out },
3766            Error::BandrankError,
3767        )
3768    }
3769}
3770
3771/// VipsBandmean (bandmean), band-wise average
3772/// inp: `&VipsImage` -> Input image argument
3773/// returns `VipsImage` - Output image
3774pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3775    unsafe {
3776        let inp_in: *mut bindings::VipsImage = inp.ctx;
3777        let mut out_out: *mut bindings::VipsImage = null_mut();
3778
3779        let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3780        utils::result(
3781            vips_op_response,
3782            VipsImage { ctx: out_out },
3783            Error::BandmeanError,
3784        )
3785    }
3786}
3787
3788/// VipsBandbool (bandbool), boolean operation across image bands
3789/// inp: `&VipsImage` -> Input image argument
3790/// boolean: `OperationBoolean` -> Boolean to perform
3791///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
3792///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
3793///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
3794///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
3795///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
3796///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
3797/// returns `VipsImage` - Output image
3798pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3799    unsafe {
3800        let inp_in: *mut bindings::VipsImage = inp.ctx;
3801        let boolean_in: i32 = boolean as i32;
3802        let mut out_out: *mut bindings::VipsImage = null_mut();
3803
3804        let vips_op_response =
3805            bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3806        utils::result(
3807            vips_op_response,
3808            VipsImage { ctx: out_out },
3809            Error::BandboolError,
3810        )
3811    }
3812}
3813
3814/// VipsReplicate (replicate), replicate an image
3815/// inp: `&VipsImage` -> Input image
3816/// across: `i32` -> Repeat this many times horizontally
3817/// min: 1, max: 1000000, default: 1
3818/// down: `i32` -> Repeat this many times vertically
3819/// min: 1, max: 1000000, default: 1
3820/// returns `VipsImage` - Output image
3821pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3822    unsafe {
3823        let inp_in: *mut bindings::VipsImage = inp.ctx;
3824        let across_in: i32 = across;
3825        let down_in: i32 = down;
3826        let mut out_out: *mut bindings::VipsImage = null_mut();
3827
3828        let vips_op_response =
3829            bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3830        utils::result(
3831            vips_op_response,
3832            VipsImage { ctx: out_out },
3833            Error::ReplicateError,
3834        )
3835    }
3836}
3837
3838/// VipsCast (cast), cast an image
3839/// inp: `&VipsImage` -> Input image
3840/// format: `BandFormat` -> Format to cast to
3841///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3842///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3843///  `Char` -> VIPS_FORMAT_CHAR = 1
3844///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3845///  `Short` -> VIPS_FORMAT_SHORT = 3
3846///  `Uint` -> VIPS_FORMAT_UINT = 4
3847///  `Int` -> VIPS_FORMAT_INT = 5
3848///  `Float` -> VIPS_FORMAT_FLOAT = 6
3849///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3850///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3851///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3852///  `Last` -> VIPS_FORMAT_LAST = 10
3853/// returns `VipsImage` - Output image
3854pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3855    unsafe {
3856        let inp_in: *mut bindings::VipsImage = inp.ctx;
3857        let format_in: i32 = format as i32;
3858        let mut out_out: *mut bindings::VipsImage = null_mut();
3859
3860        let vips_op_response =
3861            bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3862        utils::result(
3863            vips_op_response,
3864            VipsImage { ctx: out_out },
3865            Error::CastError,
3866        )
3867    }
3868}
3869
3870/// Options for cast operation
3871#[derive(Clone, Debug)]
3872pub struct CastOptions {
3873    /// shift: `bool` -> Shift integer values up and down
3874    /// default: false
3875    pub shift: bool,
3876}
3877
3878impl std::default::Default for CastOptions {
3879    fn default() -> Self {
3880        CastOptions { shift: false }
3881    }
3882}
3883
3884/// VipsCast (cast), cast an image
3885/// inp: `&VipsImage` -> Input image
3886/// format: `BandFormat` -> Format to cast to
3887///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3888///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3889///  `Char` -> VIPS_FORMAT_CHAR = 1
3890///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3891///  `Short` -> VIPS_FORMAT_SHORT = 3
3892///  `Uint` -> VIPS_FORMAT_UINT = 4
3893///  `Int` -> VIPS_FORMAT_INT = 5
3894///  `Float` -> VIPS_FORMAT_FLOAT = 6
3895///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3896///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3897///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3898///  `Last` -> VIPS_FORMAT_LAST = 10
3899/// cast_options: `&CastOptions` -> optional arguments
3900/// returns `VipsImage` - Output image
3901pub fn cast_with_opts(
3902    inp: &VipsImage,
3903    format: BandFormat,
3904    cast_options: &CastOptions,
3905) -> Result<VipsImage> {
3906    unsafe {
3907        let inp_in: *mut bindings::VipsImage = inp.ctx;
3908        let format_in: i32 = format as i32;
3909        let mut out_out: *mut bindings::VipsImage = null_mut();
3910
3911        let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3912        let shift_in_name = utils::new_c_string("shift")?;
3913
3914        let vips_op_response = bindings::vips_cast(
3915            inp_in,
3916            &mut out_out,
3917            format_in.try_into().unwrap(),
3918            shift_in_name.as_ptr(),
3919            shift_in,
3920            NULL,
3921        );
3922        utils::result(
3923            vips_op_response,
3924            VipsImage { ctx: out_out },
3925            Error::CastError,
3926        )
3927    }
3928}
3929
3930/// VipsRot (rot), rotate an image
3931/// inp: `&VipsImage` -> Input image
3932/// angle: `Angle` -> Angle to rotate image
3933///  `D0` -> VIPS_ANGLE_D0 = 0
3934///  `D90` -> VIPS_ANGLE_D90 = 1 [DEFAULT]
3935///  `D180` -> VIPS_ANGLE_D180 = 2
3936///  `D270` -> VIPS_ANGLE_D270 = 3
3937///  `Last` -> VIPS_ANGLE_LAST = 4
3938/// returns `VipsImage` - Output image
3939pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3940    unsafe {
3941        let inp_in: *mut bindings::VipsImage = inp.ctx;
3942        let angle_in: i32 = angle as i32;
3943        let mut out_out: *mut bindings::VipsImage = null_mut();
3944
3945        let vips_op_response =
3946            bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3947        utils::result(
3948            vips_op_response,
3949            VipsImage { ctx: out_out },
3950            Error::RotError,
3951        )
3952    }
3953}
3954
3955/// VipsRot45 (rot45), rotate an image
3956/// inp: `&VipsImage` -> Input image
3957/// returns `VipsImage` - Output image
3958pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3959    unsafe {
3960        let inp_in: *mut bindings::VipsImage = inp.ctx;
3961        let mut out_out: *mut bindings::VipsImage = null_mut();
3962
3963        let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3964        utils::result(
3965            vips_op_response,
3966            VipsImage { ctx: out_out },
3967            Error::Rot45Error,
3968        )
3969    }
3970}
3971
3972/// Options for rot_45 operation
3973#[derive(Clone, Debug)]
3974pub struct Rot45Options {
3975    /// angle: `Angle45` -> Angle to rotate image
3976    ///  `D0` -> VIPS_ANGLE45_D0 = 0
3977    ///  `D45` -> VIPS_ANGLE45_D45 = 1 [DEFAULT]
3978    ///  `D90` -> VIPS_ANGLE45_D90 = 2
3979    ///  `D135` -> VIPS_ANGLE45_D135 = 3
3980    ///  `D180` -> VIPS_ANGLE45_D180 = 4
3981    ///  `D225` -> VIPS_ANGLE45_D225 = 5
3982    ///  `D270` -> VIPS_ANGLE45_D270 = 6
3983    ///  `D315` -> VIPS_ANGLE45_D315 = 7
3984    ///  `Last` -> VIPS_ANGLE45_LAST = 8
3985    pub angle: Angle45,
3986}
3987
3988impl std::default::Default for Rot45Options {
3989    fn default() -> Self {
3990        Rot45Options {
3991            angle: Angle45::D45,
3992        }
3993    }
3994}
3995
3996/// VipsRot45 (rot45), rotate an image
3997/// inp: `&VipsImage` -> Input image
3998/// rot_45_options: `&Rot45Options` -> optional arguments
3999/// returns `VipsImage` - Output image
4000pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
4001    unsafe {
4002        let inp_in: *mut bindings::VipsImage = inp.ctx;
4003        let mut out_out: *mut bindings::VipsImage = null_mut();
4004
4005        let angle_in: i32 = rot_45_options.angle as i32;
4006        let angle_in_name = utils::new_c_string("angle")?;
4007
4008        let vips_op_response =
4009            bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
4010        utils::result(
4011            vips_op_response,
4012            VipsImage { ctx: out_out },
4013            Error::Rot45Error,
4014        )
4015    }
4016}
4017
4018/// VipsAutorot (autorot), autorotate image by exif tag
4019/// inp: `&VipsImage` -> Input image
4020/// returns `VipsImage` - Output image
4021pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
4022    unsafe {
4023        let inp_in: *mut bindings::VipsImage = inp.ctx;
4024        let mut out_out: *mut bindings::VipsImage = null_mut();
4025
4026        let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
4027        utils::result(
4028            vips_op_response,
4029            VipsImage { ctx: out_out },
4030            Error::AutorotError,
4031        )
4032    }
4033}
4034
4035/// Options for autorot operation
4036#[derive(Clone, Debug)]
4037pub struct AutorotOptions {
4038    /// angle: `Angle` -> Angle image was rotated by
4039    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
4040    ///  `D90` -> VIPS_ANGLE_D90 = 1
4041    ///  `D180` -> VIPS_ANGLE_D180 = 2
4042    ///  `D270` -> VIPS_ANGLE_D270 = 3
4043    ///  `Last` -> VIPS_ANGLE_LAST = 4
4044    pub angle: Angle,
4045    /// flip: `bool` -> Whether the image was flipped or not
4046    /// default: false
4047    pub flip: bool,
4048}
4049
4050impl std::default::Default for AutorotOptions {
4051    fn default() -> Self {
4052        AutorotOptions {
4053            angle: Angle::D0,
4054            flip: false,
4055        }
4056    }
4057}
4058
4059/// VipsAutorot (autorot), autorotate image by exif tag
4060/// inp: `&VipsImage` -> Input image
4061/// autorot_options: `&AutorotOptions` -> optional arguments
4062/// returns `VipsImage` - Output image
4063pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4064    unsafe {
4065        let inp_in: *mut bindings::VipsImage = inp.ctx;
4066        let mut out_out: *mut bindings::VipsImage = null_mut();
4067
4068        let angle_in: i32 = autorot_options.angle as i32;
4069        let angle_in_name = utils::new_c_string("angle")?;
4070
4071        let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4072        let flip_in_name = utils::new_c_string("flip")?;
4073
4074        let vips_op_response = bindings::vips_autorot(
4075            inp_in,
4076            &mut out_out,
4077            angle_in_name.as_ptr(),
4078            angle_in,
4079            flip_in_name.as_ptr(),
4080            flip_in,
4081            NULL,
4082        );
4083        utils::result(
4084            vips_op_response,
4085            VipsImage { ctx: out_out },
4086            Error::AutorotError,
4087        )
4088    }
4089}
4090
4091/// VipsIfthenelse (ifthenelse), ifthenelse an image
4092/// cond: `&VipsImage` -> Condition input image
4093/// in_1: `&VipsImage` -> Source for TRUE pixels
4094/// in_2: `&VipsImage` -> Source for FALSE pixels
4095/// returns `VipsImage` - Output image
4096pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4097    unsafe {
4098        let cond_in: *mut bindings::VipsImage = cond.ctx;
4099        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4100        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4101        let mut out_out: *mut bindings::VipsImage = null_mut();
4102
4103        let vips_op_response =
4104            bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4105        utils::result(
4106            vips_op_response,
4107            VipsImage { ctx: out_out },
4108            Error::IfthenelseError,
4109        )
4110    }
4111}
4112
4113/// Options for ifthenelse operation
4114#[derive(Clone, Debug)]
4115pub struct IfthenelseOptions {
4116    /// blend: `bool` -> Blend smoothly between then and else parts
4117    /// default: false
4118    pub blend: bool,
4119}
4120
4121impl std::default::Default for IfthenelseOptions {
4122    fn default() -> Self {
4123        IfthenelseOptions { blend: false }
4124    }
4125}
4126
4127/// VipsIfthenelse (ifthenelse), ifthenelse an image
4128/// cond: `&VipsImage` -> Condition input image
4129/// in_1: `&VipsImage` -> Source for TRUE pixels
4130/// in_2: `&VipsImage` -> Source for FALSE pixels
4131/// ifthenelse_options: `&IfthenelseOptions` -> optional arguments
4132/// returns `VipsImage` - Output image
4133pub fn ifthenelse_with_opts(
4134    cond: &VipsImage,
4135    in_1: &VipsImage,
4136    in_2: &VipsImage,
4137    ifthenelse_options: &IfthenelseOptions,
4138) -> Result<VipsImage> {
4139    unsafe {
4140        let cond_in: *mut bindings::VipsImage = cond.ctx;
4141        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4142        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4143        let mut out_out: *mut bindings::VipsImage = null_mut();
4144
4145        let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4146        let blend_in_name = utils::new_c_string("blend")?;
4147
4148        let vips_op_response = bindings::vips_ifthenelse(
4149            cond_in,
4150            in_1_in,
4151            in_2_in,
4152            &mut out_out,
4153            blend_in_name.as_ptr(),
4154            blend_in,
4155            NULL,
4156        );
4157        utils::result(
4158            vips_op_response,
4159            VipsImage { ctx: out_out },
4160            Error::IfthenelseError,
4161        )
4162    }
4163}
4164
4165/// VipsRecomb (recomb), linear recombination with matrix
4166/// inp: `&VipsImage` -> Input image argument
4167/// m: `&VipsImage` -> Matrix of coefficients
4168/// returns `VipsImage` - Output image
4169pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4170    unsafe {
4171        let inp_in: *mut bindings::VipsImage = inp.ctx;
4172        let m_in: *mut bindings::VipsImage = m.ctx;
4173        let mut out_out: *mut bindings::VipsImage = null_mut();
4174
4175        let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4176        utils::result(
4177            vips_op_response,
4178            VipsImage { ctx: out_out },
4179            Error::RecombError,
4180        )
4181    }
4182}
4183
4184/// VipsBandfold (bandfold), fold up x axis into bands
4185/// inp: `&VipsImage` -> Input image
4186/// returns `VipsImage` - Output image
4187pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4188    unsafe {
4189        let inp_in: *mut bindings::VipsImage = inp.ctx;
4190        let mut out_out: *mut bindings::VipsImage = null_mut();
4191
4192        let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4193        utils::result(
4194            vips_op_response,
4195            VipsImage { ctx: out_out },
4196            Error::BandfoldError,
4197        )
4198    }
4199}
4200
4201/// Options for bandfold operation
4202#[derive(Clone, Debug)]
4203pub struct BandfoldOptions {
4204    /// factor: `i32` -> Fold by this factor
4205    /// min: 0, max: 10000000, default: 0
4206    pub factor: i32,
4207}
4208
4209impl std::default::Default for BandfoldOptions {
4210    fn default() -> Self {
4211        BandfoldOptions {
4212            factor: i32::from(0),
4213        }
4214    }
4215}
4216
4217/// VipsBandfold (bandfold), fold up x axis into bands
4218/// inp: `&VipsImage` -> Input image
4219/// bandfold_options: `&BandfoldOptions` -> optional arguments
4220/// returns `VipsImage` - Output image
4221pub fn bandfold_with_opts(
4222    inp: &VipsImage,
4223    bandfold_options: &BandfoldOptions,
4224) -> Result<VipsImage> {
4225    unsafe {
4226        let inp_in: *mut bindings::VipsImage = inp.ctx;
4227        let mut out_out: *mut bindings::VipsImage = null_mut();
4228
4229        let factor_in: i32 = bandfold_options.factor;
4230        let factor_in_name = utils::new_c_string("factor")?;
4231
4232        let vips_op_response = bindings::vips_bandfold(
4233            inp_in,
4234            &mut out_out,
4235            factor_in_name.as_ptr(),
4236            factor_in,
4237            NULL,
4238        );
4239        utils::result(
4240            vips_op_response,
4241            VipsImage { ctx: out_out },
4242            Error::BandfoldError,
4243        )
4244    }
4245}
4246
4247/// VipsBandunfold (bandunfold), unfold image bands into x axis
4248/// inp: `&VipsImage` -> Input image
4249/// returns `VipsImage` - Output image
4250pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4251    unsafe {
4252        let inp_in: *mut bindings::VipsImage = inp.ctx;
4253        let mut out_out: *mut bindings::VipsImage = null_mut();
4254
4255        let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4256        utils::result(
4257            vips_op_response,
4258            VipsImage { ctx: out_out },
4259            Error::BandunfoldError,
4260        )
4261    }
4262}
4263
4264/// Options for bandunfold operation
4265#[derive(Clone, Debug)]
4266pub struct BandunfoldOptions {
4267    /// factor: `i32` -> Unfold by this factor
4268    /// min: 0, max: 10000000, default: 0
4269    pub factor: i32,
4270}
4271
4272impl std::default::Default for BandunfoldOptions {
4273    fn default() -> Self {
4274        BandunfoldOptions {
4275            factor: i32::from(0),
4276        }
4277    }
4278}
4279
4280/// VipsBandunfold (bandunfold), unfold image bands into x axis
4281/// inp: `&VipsImage` -> Input image
4282/// bandunfold_options: `&BandunfoldOptions` -> optional arguments
4283/// returns `VipsImage` - Output image
4284pub fn bandunfold_with_opts(
4285    inp: &VipsImage,
4286    bandunfold_options: &BandunfoldOptions,
4287) -> Result<VipsImage> {
4288    unsafe {
4289        let inp_in: *mut bindings::VipsImage = inp.ctx;
4290        let mut out_out: *mut bindings::VipsImage = null_mut();
4291
4292        let factor_in: i32 = bandunfold_options.factor;
4293        let factor_in_name = utils::new_c_string("factor")?;
4294
4295        let vips_op_response = bindings::vips_bandunfold(
4296            inp_in,
4297            &mut out_out,
4298            factor_in_name.as_ptr(),
4299            factor_in,
4300            NULL,
4301        );
4302        utils::result(
4303            vips_op_response,
4304            VipsImage { ctx: out_out },
4305            Error::BandunfoldError,
4306        )
4307    }
4308}
4309
4310/// VipsFlatten (flatten), flatten alpha out of an image
4311/// inp: `&VipsImage` -> Input image
4312/// returns `VipsImage` - Output image
4313pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4314    unsafe {
4315        let inp_in: *mut bindings::VipsImage = inp.ctx;
4316        let mut out_out: *mut bindings::VipsImage = null_mut();
4317
4318        let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4319        utils::result(
4320            vips_op_response,
4321            VipsImage { ctx: out_out },
4322            Error::FlattenError,
4323        )
4324    }
4325}
4326
4327/// Options for flatten operation
4328#[derive(Clone, Debug)]
4329pub struct FlattenOptions {
4330    /// background: `Vec<f64>` -> Background value
4331    pub background: Vec<f64>,
4332    /// max_alpha: `f64` -> Maximum value of alpha channel
4333    /// min: 0, max: 100000000, default: 255
4334    pub max_alpha: f64,
4335}
4336
4337impl std::default::Default for FlattenOptions {
4338    fn default() -> Self {
4339        FlattenOptions {
4340            background: Vec::new(),
4341            max_alpha: f64::from(255),
4342        }
4343    }
4344}
4345
4346/// VipsFlatten (flatten), flatten alpha out of an image
4347/// inp: `&VipsImage` -> Input image
4348/// flatten_options: `&FlattenOptions` -> optional arguments
4349/// returns `VipsImage` - Output image
4350pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4351    unsafe {
4352        let inp_in: *mut bindings::VipsImage = inp.ctx;
4353        let mut out_out: *mut bindings::VipsImage = null_mut();
4354
4355        let background_wrapper =
4356            utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4357        let background_in = background_wrapper.ctx;
4358        let background_in_name = utils::new_c_string("background")?;
4359
4360        let max_alpha_in: f64 = flatten_options.max_alpha;
4361        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4362
4363        let vips_op_response = bindings::vips_flatten(
4364            inp_in,
4365            &mut out_out,
4366            background_in_name.as_ptr(),
4367            background_in,
4368            max_alpha_in_name.as_ptr(),
4369            max_alpha_in,
4370            NULL,
4371        );
4372        utils::result(
4373            vips_op_response,
4374            VipsImage { ctx: out_out },
4375            Error::FlattenError,
4376        )
4377    }
4378}
4379
4380/// VipsPremultiply (premultiply), premultiply image alpha
4381/// inp: `&VipsImage` -> Input image
4382/// returns `VipsImage` - Output image
4383pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4384    unsafe {
4385        let inp_in: *mut bindings::VipsImage = inp.ctx;
4386        let mut out_out: *mut bindings::VipsImage = null_mut();
4387
4388        let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4389        utils::result(
4390            vips_op_response,
4391            VipsImage { ctx: out_out },
4392            Error::PremultiplyError,
4393        )
4394    }
4395}
4396
4397/// Options for premultiply operation
4398#[derive(Clone, Debug)]
4399pub struct PremultiplyOptions {
4400    /// max_alpha: `f64` -> Maximum value of alpha channel
4401    /// min: 0, max: 100000000, default: 255
4402    pub max_alpha: f64,
4403}
4404
4405impl std::default::Default for PremultiplyOptions {
4406    fn default() -> Self {
4407        PremultiplyOptions {
4408            max_alpha: f64::from(255),
4409        }
4410    }
4411}
4412
4413/// VipsPremultiply (premultiply), premultiply image alpha
4414/// inp: `&VipsImage` -> Input image
4415/// premultiply_options: `&PremultiplyOptions` -> optional arguments
4416/// returns `VipsImage` - Output image
4417pub fn premultiply_with_opts(
4418    inp: &VipsImage,
4419    premultiply_options: &PremultiplyOptions,
4420) -> Result<VipsImage> {
4421    unsafe {
4422        let inp_in: *mut bindings::VipsImage = inp.ctx;
4423        let mut out_out: *mut bindings::VipsImage = null_mut();
4424
4425        let max_alpha_in: f64 = premultiply_options.max_alpha;
4426        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4427
4428        let vips_op_response = bindings::vips_premultiply(
4429            inp_in,
4430            &mut out_out,
4431            max_alpha_in_name.as_ptr(),
4432            max_alpha_in,
4433            NULL,
4434        );
4435        utils::result(
4436            vips_op_response,
4437            VipsImage { ctx: out_out },
4438            Error::PremultiplyError,
4439        )
4440    }
4441}
4442
4443/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4444/// inp: `&VipsImage` -> Input image
4445/// returns `VipsImage` - Output image
4446pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4447    unsafe {
4448        let inp_in: *mut bindings::VipsImage = inp.ctx;
4449        let mut out_out: *mut bindings::VipsImage = null_mut();
4450
4451        let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4452        utils::result(
4453            vips_op_response,
4454            VipsImage { ctx: out_out },
4455            Error::UnpremultiplyError,
4456        )
4457    }
4458}
4459
4460/// Options for unpremultiply operation
4461#[derive(Clone, Debug)]
4462pub struct UnpremultiplyOptions {
4463    /// max_alpha: `f64` -> Maximum value of alpha channel
4464    /// min: 0, max: 100000000, default: 255
4465    pub max_alpha: f64,
4466    /// alpha_band: `i32` -> Unpremultiply with this alpha
4467    /// min: 0, max: 100000000, default: 3
4468    pub alpha_band: i32,
4469}
4470
4471impl std::default::Default for UnpremultiplyOptions {
4472    fn default() -> Self {
4473        UnpremultiplyOptions {
4474            max_alpha: f64::from(255),
4475            alpha_band: i32::from(3),
4476        }
4477    }
4478}
4479
4480/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4481/// inp: `&VipsImage` -> Input image
4482/// unpremultiply_options: `&UnpremultiplyOptions` -> optional arguments
4483/// returns `VipsImage` - Output image
4484pub fn unpremultiply_with_opts(
4485    inp: &VipsImage,
4486    unpremultiply_options: &UnpremultiplyOptions,
4487) -> Result<VipsImage> {
4488    unsafe {
4489        let inp_in: *mut bindings::VipsImage = inp.ctx;
4490        let mut out_out: *mut bindings::VipsImage = null_mut();
4491
4492        let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4493        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4494
4495        let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4496        let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4497
4498        let vips_op_response = bindings::vips_unpremultiply(
4499            inp_in,
4500            &mut out_out,
4501            max_alpha_in_name.as_ptr(),
4502            max_alpha_in,
4503            alpha_band_in_name.as_ptr(),
4504            alpha_band_in,
4505            NULL,
4506        );
4507        utils::result(
4508            vips_op_response,
4509            VipsImage { ctx: out_out },
4510            Error::UnpremultiplyError,
4511        )
4512    }
4513}
4514
4515/// VipsGrid (grid), grid an image
4516/// inp: `&VipsImage` -> Input image
4517/// tile_height: `i32` -> Chop into tiles this high
4518/// min: 1, max: 10000000, default: 128
4519/// across: `i32` -> Number of tiles across
4520/// min: 1, max: 10000000, default: 1
4521/// down: `i32` -> Number of tiles down
4522/// min: 1, max: 10000000, default: 1
4523/// returns `VipsImage` - Output image
4524pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4525    unsafe {
4526        let inp_in: *mut bindings::VipsImage = inp.ctx;
4527        let tile_height_in: i32 = tile_height;
4528        let across_in: i32 = across;
4529        let down_in: i32 = down;
4530        let mut out_out: *mut bindings::VipsImage = null_mut();
4531
4532        let vips_op_response = bindings::vips_grid(
4533            inp_in,
4534            &mut out_out,
4535            tile_height_in,
4536            across_in,
4537            down_in,
4538            NULL,
4539        );
4540        utils::result(
4541            vips_op_response,
4542            VipsImage { ctx: out_out },
4543            Error::GridError,
4544        )
4545    }
4546}
4547
4548/// VipsTranspose3d (transpose3d), transpose3d an image
4549/// inp: `&VipsImage` -> Input image
4550/// returns `VipsImage` - Output image
4551pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4552    unsafe {
4553        let inp_in: *mut bindings::VipsImage = inp.ctx;
4554        let mut out_out: *mut bindings::VipsImage = null_mut();
4555
4556        let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4557        utils::result(
4558            vips_op_response,
4559            VipsImage { ctx: out_out },
4560            Error::Transpose3DError,
4561        )
4562    }
4563}
4564
4565/// Options for transpose_3d operation
4566#[derive(Clone, Debug)]
4567pub struct Transpose3DOptions {
4568    /// page_height: `i32` -> Height of each input page
4569    /// min: 0, max: 10000000, default: 0
4570    pub page_height: i32,
4571}
4572
4573impl std::default::Default for Transpose3DOptions {
4574    fn default() -> Self {
4575        Transpose3DOptions {
4576            page_height: i32::from(0),
4577        }
4578    }
4579}
4580
4581/// VipsTranspose3d (transpose3d), transpose3d an image
4582/// inp: `&VipsImage` -> Input image
4583/// transpose_3d_options: `&Transpose3DOptions` -> optional arguments
4584/// returns `VipsImage` - Output image
4585pub fn transpose_3d_with_opts(
4586    inp: &VipsImage,
4587    transpose_3d_options: &Transpose3DOptions,
4588) -> Result<VipsImage> {
4589    unsafe {
4590        let inp_in: *mut bindings::VipsImage = inp.ctx;
4591        let mut out_out: *mut bindings::VipsImage = null_mut();
4592
4593        let page_height_in: i32 = transpose_3d_options.page_height;
4594        let page_height_in_name = utils::new_c_string("page-height")?;
4595
4596        let vips_op_response = bindings::vips_transpose3d(
4597            inp_in,
4598            &mut out_out,
4599            page_height_in_name.as_ptr(),
4600            page_height_in,
4601            NULL,
4602        );
4603        utils::result(
4604            vips_op_response,
4605            VipsImage { ctx: out_out },
4606            Error::Transpose3DError,
4607        )
4608    }
4609}
4610
4611/// VipsScale (scale), scale an image to uchar
4612/// inp: `&VipsImage` -> Input image
4613/// returns `VipsImage` - Output image
4614pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4615    unsafe {
4616        let inp_in: *mut bindings::VipsImage = inp.ctx;
4617        let mut out_out: *mut bindings::VipsImage = null_mut();
4618
4619        let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4620        utils::result(
4621            vips_op_response,
4622            VipsImage { ctx: out_out },
4623            Error::ScaleError,
4624        )
4625    }
4626}
4627
4628/// Options for scale operation
4629#[derive(Clone, Debug)]
4630pub struct ScaleOptions {
4631    /// exp: `f64` -> Exponent for log scale
4632    /// min: 0.00001, max: 10000, default: 0.25
4633    pub exp: f64,
4634    /// log: `bool` -> Log scale
4635    /// default: false
4636    pub log: bool,
4637}
4638
4639impl std::default::Default for ScaleOptions {
4640    fn default() -> Self {
4641        ScaleOptions {
4642            exp: f64::from(0.25),
4643            log: false,
4644        }
4645    }
4646}
4647
4648/// VipsScale (scale), scale an image to uchar
4649/// inp: `&VipsImage` -> Input image
4650/// scale_options: `&ScaleOptions` -> optional arguments
4651/// returns `VipsImage` - Output image
4652pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4653    unsafe {
4654        let inp_in: *mut bindings::VipsImage = inp.ctx;
4655        let mut out_out: *mut bindings::VipsImage = null_mut();
4656
4657        let exp_in: f64 = scale_options.exp;
4658        let exp_in_name = utils::new_c_string("exp")?;
4659
4660        let log_in: i32 = if scale_options.log { 1 } else { 0 };
4661        let log_in_name = utils::new_c_string("log")?;
4662
4663        let vips_op_response = bindings::vips_scale(
4664            inp_in,
4665            &mut out_out,
4666            exp_in_name.as_ptr(),
4667            exp_in,
4668            log_in_name.as_ptr(),
4669            log_in,
4670            NULL,
4671        );
4672        utils::result(
4673            vips_op_response,
4674            VipsImage { ctx: out_out },
4675            Error::ScaleError,
4676        )
4677    }
4678}
4679
4680/// VipsWrap (wrap), wrap image origin
4681/// inp: `&VipsImage` -> Input image
4682/// returns `VipsImage` - Output image
4683pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4684    unsafe {
4685        let inp_in: *mut bindings::VipsImage = inp.ctx;
4686        let mut out_out: *mut bindings::VipsImage = null_mut();
4687
4688        let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4689        utils::result(
4690            vips_op_response,
4691            VipsImage { ctx: out_out },
4692            Error::WrapError,
4693        )
4694    }
4695}
4696
4697/// Options for wrap operation
4698#[derive(Clone, Debug)]
4699pub struct WrapOptions {
4700    /// x: `i32` -> Left edge of input in output
4701    /// min: -100000000, max: 100000000, default: 0
4702    pub x: i32,
4703    /// y: `i32` -> Top edge of input in output
4704    /// min: -100000000, max: 100000000, default: 0
4705    pub y: i32,
4706}
4707
4708impl std::default::Default for WrapOptions {
4709    fn default() -> Self {
4710        WrapOptions {
4711            x: i32::from(0),
4712            y: i32::from(0),
4713        }
4714    }
4715}
4716
4717/// VipsWrap (wrap), wrap image origin
4718/// inp: `&VipsImage` -> Input image
4719/// wrap_options: `&WrapOptions` -> optional arguments
4720/// returns `VipsImage` - Output image
4721pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4722    unsafe {
4723        let inp_in: *mut bindings::VipsImage = inp.ctx;
4724        let mut out_out: *mut bindings::VipsImage = null_mut();
4725
4726        let x_in: i32 = wrap_options.x;
4727        let x_in_name = utils::new_c_string("x")?;
4728
4729        let y_in: i32 = wrap_options.y;
4730        let y_in_name = utils::new_c_string("y")?;
4731
4732        let vips_op_response = bindings::vips_wrap(
4733            inp_in,
4734            &mut out_out,
4735            x_in_name.as_ptr(),
4736            x_in,
4737            y_in_name.as_ptr(),
4738            y_in,
4739            NULL,
4740        );
4741        utils::result(
4742            vips_op_response,
4743            VipsImage { ctx: out_out },
4744            Error::WrapError,
4745        )
4746    }
4747}
4748
4749/// VipsZoom (zoom), zoom an image
4750/// input: `&VipsImage` -> Input image
4751/// xfac: `i32` -> Horizontal zoom factor
4752/// min: 1, max: 100000000, default: 1
4753/// yfac: `i32` -> Vertical zoom factor
4754/// min: 1, max: 100000000, default: 1
4755/// returns `VipsImage` - Output image
4756pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4757    unsafe {
4758        let input_in: *mut bindings::VipsImage = input.ctx;
4759        let xfac_in: i32 = xfac;
4760        let yfac_in: i32 = yfac;
4761        let mut out_out: *mut bindings::VipsImage = null_mut();
4762
4763        let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4764        utils::result(
4765            vips_op_response,
4766            VipsImage { ctx: out_out },
4767            Error::ZoomError,
4768        )
4769    }
4770}
4771
4772/// VipsSubsample (subsample), subsample an image
4773/// input: `&VipsImage` -> Input image
4774/// xfac: `i32` -> Horizontal subsample factor
4775/// min: 1, max: 100000000, default: 1
4776/// yfac: `i32` -> Vertical subsample factor
4777/// min: 1, max: 100000000, default: 1
4778/// returns `VipsImage` - Output image
4779pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4780    unsafe {
4781        let input_in: *mut bindings::VipsImage = input.ctx;
4782        let xfac_in: i32 = xfac;
4783        let yfac_in: i32 = yfac;
4784        let mut out_out: *mut bindings::VipsImage = null_mut();
4785
4786        let vips_op_response =
4787            bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4788        utils::result(
4789            vips_op_response,
4790            VipsImage { ctx: out_out },
4791            Error::SubsampleError,
4792        )
4793    }
4794}
4795
4796/// Options for subsample operation
4797#[derive(Clone, Debug)]
4798pub struct SubsampleOptions {
4799    /// point: `bool` -> Point sample
4800    /// default: false
4801    pub point: bool,
4802}
4803
4804impl std::default::Default for SubsampleOptions {
4805    fn default() -> Self {
4806        SubsampleOptions { point: false }
4807    }
4808}
4809
4810/// VipsSubsample (subsample), subsample an image
4811/// input: `&VipsImage` -> Input image
4812/// xfac: `i32` -> Horizontal subsample factor
4813/// min: 1, max: 100000000, default: 1
4814/// yfac: `i32` -> Vertical subsample factor
4815/// min: 1, max: 100000000, default: 1
4816/// subsample_options: `&SubsampleOptions` -> optional arguments
4817/// returns `VipsImage` - Output image
4818pub fn subsample_with_opts(
4819    input: &VipsImage,
4820    xfac: i32,
4821    yfac: i32,
4822    subsample_options: &SubsampleOptions,
4823) -> Result<VipsImage> {
4824    unsafe {
4825        let input_in: *mut bindings::VipsImage = input.ctx;
4826        let xfac_in: i32 = xfac;
4827        let yfac_in: i32 = yfac;
4828        let mut out_out: *mut bindings::VipsImage = null_mut();
4829
4830        let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4831        let point_in_name = utils::new_c_string("point")?;
4832
4833        let vips_op_response = bindings::vips_subsample(
4834            input_in,
4835            &mut out_out,
4836            xfac_in,
4837            yfac_in,
4838            point_in_name.as_ptr(),
4839            point_in,
4840            NULL,
4841        );
4842        utils::result(
4843            vips_op_response,
4844            VipsImage { ctx: out_out },
4845            Error::SubsampleError,
4846        )
4847    }
4848}
4849
4850/// VipsMsb (msb), pick most-significant byte from an image
4851/// inp: `&VipsImage` -> Input image
4852/// returns `VipsImage` - Output image
4853pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4854    unsafe {
4855        let inp_in: *mut bindings::VipsImage = inp.ctx;
4856        let mut out_out: *mut bindings::VipsImage = null_mut();
4857
4858        let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4859        utils::result(
4860            vips_op_response,
4861            VipsImage { ctx: out_out },
4862            Error::MsbError,
4863        )
4864    }
4865}
4866
4867/// Options for msb operation
4868#[derive(Clone, Debug)]
4869pub struct MsbOptions {
4870    /// band: `i32` -> Band to msb
4871    /// min: 0, max: 100000000, default: 0
4872    pub band: i32,
4873}
4874
4875impl std::default::Default for MsbOptions {
4876    fn default() -> Self {
4877        MsbOptions { band: i32::from(0) }
4878    }
4879}
4880
4881/// VipsMsb (msb), pick most-significant byte from an image
4882/// inp: `&VipsImage` -> Input image
4883/// msb_options: `&MsbOptions` -> optional arguments
4884/// returns `VipsImage` - Output image
4885pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4886    unsafe {
4887        let inp_in: *mut bindings::VipsImage = inp.ctx;
4888        let mut out_out: *mut bindings::VipsImage = null_mut();
4889
4890        let band_in: i32 = msb_options.band;
4891        let band_in_name = utils::new_c_string("band")?;
4892
4893        let vips_op_response =
4894            bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4895        utils::result(
4896            vips_op_response,
4897            VipsImage { ctx: out_out },
4898            Error::MsbError,
4899        )
4900    }
4901}
4902
4903/// VipsByteswap (byteswap), byteswap an image
4904/// inp: `&VipsImage` -> Input image
4905/// returns `VipsImage` - Output image
4906pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4907    unsafe {
4908        let inp_in: *mut bindings::VipsImage = inp.ctx;
4909        let mut out_out: *mut bindings::VipsImage = null_mut();
4910
4911        let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4912        utils::result(
4913            vips_op_response,
4914            VipsImage { ctx: out_out },
4915            Error::ByteswapError,
4916        )
4917    }
4918}
4919
4920/// VipsFalsecolour (falsecolour), false-color an image
4921/// inp: `&VipsImage` -> Input image
4922/// returns `VipsImage` - Output image
4923pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4924    unsafe {
4925        let inp_in: *mut bindings::VipsImage = inp.ctx;
4926        let mut out_out: *mut bindings::VipsImage = null_mut();
4927
4928        let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4929        utils::result(
4930            vips_op_response,
4931            VipsImage { ctx: out_out },
4932            Error::FalsecolourError,
4933        )
4934    }
4935}
4936
4937/// VipsGamma (gamma), gamma an image
4938/// inp: `&VipsImage` -> Input image
4939/// returns `VipsImage` - Output image
4940pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4941    unsafe {
4942        let inp_in: *mut bindings::VipsImage = inp.ctx;
4943        let mut out_out: *mut bindings::VipsImage = null_mut();
4944
4945        let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4946        utils::result(
4947            vips_op_response,
4948            VipsImage { ctx: out_out },
4949            Error::GammaError,
4950        )
4951    }
4952}
4953
4954/// Options for gamma operation
4955#[derive(Clone, Debug)]
4956pub struct GammaOptions {
4957    /// exponent: `f64` -> Gamma factor
4958    /// min: 0.000001, max: 1000, default: 2.4
4959    pub exponent: f64,
4960}
4961
4962impl std::default::Default for GammaOptions {
4963    fn default() -> Self {
4964        GammaOptions {
4965            exponent: f64::from(2.4),
4966        }
4967    }
4968}
4969
4970/// VipsGamma (gamma), gamma an image
4971/// inp: `&VipsImage` -> Input image
4972/// gamma_options: `&GammaOptions` -> optional arguments
4973/// returns `VipsImage` - Output image
4974pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4975    unsafe {
4976        let inp_in: *mut bindings::VipsImage = inp.ctx;
4977        let mut out_out: *mut bindings::VipsImage = null_mut();
4978
4979        let exponent_in: f64 = gamma_options.exponent;
4980        let exponent_in_name = utils::new_c_string("exponent")?;
4981
4982        let vips_op_response = bindings::vips_gamma(
4983            inp_in,
4984            &mut out_out,
4985            exponent_in_name.as_ptr(),
4986            exponent_in,
4987            NULL,
4988        );
4989        utils::result(
4990            vips_op_response,
4991            VipsImage { ctx: out_out },
4992            Error::GammaError,
4993        )
4994    }
4995}
4996
4997/// VipsComposite (composite), blend an array of images with an array of blend modes
4998/// inp: `&mut [VipsImage]` -> Array of input images
4999/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5000/// returns `VipsImage` - Output image
5001pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
5002    unsafe {
5003        let (inp_len, mut inp_in) = {
5004            let len = inp.len();
5005            let mut input = Vec::new();
5006            for img in inp {
5007                input.push(img.ctx)
5008            }
5009            (len as i32, input)
5010        };
5011        let mode_in: *mut i32 = mode.as_mut_ptr();
5012        let mut out_out: *mut bindings::VipsImage = null_mut();
5013
5014        let vips_op_response = bindings::vips_composite(
5015            inp_in.as_mut_ptr(),
5016            &mut out_out,
5017            inp_len,
5018            mode_in,
5019            mode.len() as i32,
5020            NULL,
5021        );
5022        utils::result(
5023            vips_op_response,
5024            VipsImage { ctx: out_out },
5025            Error::CompositeError,
5026        )
5027    }
5028}
5029
5030/// Options for composite operation
5031#[derive(Clone, Debug)]
5032pub struct CompositeOptions {
5033    /// x: `Vec<i32>` -> Array of x coordinates to join at
5034    pub x: Vec<i32>,
5035    /// y: `Vec<i32>` -> Array of y coordinates to join at
5036    pub y: Vec<i32>,
5037    /// compositing_space: `Interpretation` -> Composite images in this colour space
5038    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5039    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5040    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5041    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5042    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5043    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5044    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5045    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5046    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5047    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5048    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5049    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5050    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5051    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5052    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5053    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5054    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5055    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5056    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5057    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5058    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5059    pub compositing_space: Interpretation,
5060    /// premultiplied: `bool` -> Images have premultiplied alpha
5061    /// default: false
5062    pub premultiplied: bool,
5063}
5064
5065impl std::default::Default for CompositeOptions {
5066    fn default() -> Self {
5067        CompositeOptions {
5068            x: Vec::new(),
5069            y: Vec::new(),
5070            compositing_space: Interpretation::Srgb,
5071            premultiplied: false,
5072        }
5073    }
5074}
5075
5076/// VipsComposite (composite), blend an array of images with an array of blend modes
5077/// inp: `&mut [VipsImage]` -> Array of input images
5078/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5079/// composite_options: `&CompositeOptions` -> optional arguments
5080/// returns `VipsImage` - Output image
5081pub fn composite_with_opts(
5082    inp: &mut [VipsImage],
5083    mode: &mut [i32],
5084    composite_options: &CompositeOptions,
5085) -> Result<VipsImage> {
5086    unsafe {
5087        let (inp_len, mut inp_in) = {
5088            let len = inp.len();
5089            let mut input = Vec::new();
5090            for img in inp {
5091                input.push(img.ctx)
5092            }
5093            (len as i32, input)
5094        };
5095        let mode_in: *mut i32 = mode.as_mut_ptr();
5096        let mut out_out: *mut bindings::VipsImage = null_mut();
5097
5098        let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5099        let x_in = x_wrapper.ctx;
5100        let x_in_name = utils::new_c_string("x")?;
5101
5102        let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5103        let y_in = y_wrapper.ctx;
5104        let y_in_name = utils::new_c_string("y")?;
5105
5106        let compositing_space_in: i32 = composite_options.compositing_space as i32;
5107        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5108
5109        let premultiplied_in: i32 = if composite_options.premultiplied {
5110            1
5111        } else {
5112            0
5113        };
5114        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5115
5116        let vips_op_response = bindings::vips_composite(
5117            inp_in.as_mut_ptr(),
5118            &mut out_out,
5119            inp_len,
5120            mode_in,
5121            mode.len() as i32,
5122            x_in_name.as_ptr(),
5123            x_in,
5124            y_in_name.as_ptr(),
5125            y_in,
5126            compositing_space_in_name.as_ptr(),
5127            compositing_space_in,
5128            premultiplied_in_name.as_ptr(),
5129            premultiplied_in,
5130            NULL,
5131        );
5132        utils::result(
5133            vips_op_response,
5134            VipsImage { ctx: out_out },
5135            Error::CompositeError,
5136        )
5137    }
5138}
5139
5140/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5141/// base: `&VipsImage` -> Base image
5142/// overlay: `&VipsImage` -> Overlay image
5143/// mode: `BlendMode` -> VipsBlendMode to join with
5144///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5145///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5146///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5147///  `In` -> VIPS_BLEND_MODE_IN = 3
5148///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5149///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5150///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5151///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5152///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5153///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5154///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5155///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5156///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5157///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5158///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5159///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5160///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5161///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5162///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5163///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5164///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5165///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5166///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5167///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5168///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5169///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5170/// returns `VipsImage` - Output image
5171pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5172    unsafe {
5173        let base_in: *mut bindings::VipsImage = base.ctx;
5174        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5175        let mode_in: i32 = mode as i32;
5176        let mut out_out: *mut bindings::VipsImage = null_mut();
5177
5178        let vips_op_response = bindings::vips_composite2(
5179            base_in,
5180            overlay_in,
5181            &mut out_out,
5182            mode_in.try_into().unwrap(),
5183            NULL,
5184        );
5185        utils::result(
5186            vips_op_response,
5187            VipsImage { ctx: out_out },
5188            Error::Composite2Error,
5189        )
5190    }
5191}
5192
5193/// Options for composite_2 operation
5194#[derive(Clone, Debug)]
5195pub struct Composite2Options {
5196    /// x: `i32` -> x position of overlay
5197    /// min: -100000000, max: 100000000, default: 0
5198    pub x: i32,
5199    /// y: `i32` -> y position of overlay
5200    /// min: -100000000, max: 100000000, default: 0
5201    pub y: i32,
5202    /// compositing_space: `Interpretation` -> Composite images in this colour space
5203    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5204    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5205    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5206    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5207    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5208    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5209    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5210    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5211    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5212    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5213    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5214    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5215    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5216    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5217    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5218    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5219    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5220    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5221    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5222    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5223    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5224    pub compositing_space: Interpretation,
5225    /// premultiplied: `bool` -> Images have premultiplied alpha
5226    /// default: false
5227    pub premultiplied: bool,
5228}
5229
5230impl std::default::Default for Composite2Options {
5231    fn default() -> Self {
5232        Composite2Options {
5233            x: i32::from(0),
5234            y: i32::from(0),
5235            compositing_space: Interpretation::Srgb,
5236            premultiplied: false,
5237        }
5238    }
5239}
5240
5241/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5242/// base: `&VipsImage` -> Base image
5243/// overlay: `&VipsImage` -> Overlay image
5244/// mode: `BlendMode` -> VipsBlendMode to join with
5245///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5246///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5247///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5248///  `In` -> VIPS_BLEND_MODE_IN = 3
5249///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5250///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5251///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5252///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5253///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5254///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5255///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5256///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5257///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5258///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5259///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5260///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5261///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5262///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5263///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5264///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5265///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5266///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5267///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5268///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5269///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5270///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5271/// composite_2_options: `&Composite2Options` -> optional arguments
5272/// returns `VipsImage` - Output image
5273pub fn composite_2_with_opts(
5274    base: &VipsImage,
5275    overlay: &VipsImage,
5276    mode: BlendMode,
5277    composite_2_options: &Composite2Options,
5278) -> Result<VipsImage> {
5279    unsafe {
5280        let base_in: *mut bindings::VipsImage = base.ctx;
5281        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5282        let mode_in: i32 = mode as i32;
5283        let mut out_out: *mut bindings::VipsImage = null_mut();
5284
5285        let x_in: i32 = composite_2_options.x;
5286        let x_in_name = utils::new_c_string("x")?;
5287
5288        let y_in: i32 = composite_2_options.y;
5289        let y_in_name = utils::new_c_string("y")?;
5290
5291        let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5292        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5293
5294        let premultiplied_in: i32 = if composite_2_options.premultiplied {
5295            1
5296        } else {
5297            0
5298        };
5299        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5300
5301        let vips_op_response = bindings::vips_composite2(
5302            base_in,
5303            overlay_in,
5304            &mut out_out,
5305            mode_in.try_into().unwrap(),
5306            x_in_name.as_ptr(),
5307            x_in,
5308            y_in_name.as_ptr(),
5309            y_in,
5310            compositing_space_in_name.as_ptr(),
5311            compositing_space_in,
5312            premultiplied_in_name.as_ptr(),
5313            premultiplied_in,
5314            NULL,
5315        );
5316        utils::result(
5317            vips_op_response,
5318            VipsImage { ctx: out_out },
5319            Error::Composite2Error,
5320        )
5321    }
5322}
5323
5324/// VipsAddAlpha (addalpha), append an alpha channel
5325/// inp: `&VipsImage` -> Input image
5326/// returns `VipsImage` - Output image
5327pub fn addalpha(inp: &VipsImage) -> Result<VipsImage> {
5328    unsafe {
5329        let inp_in: *mut bindings::VipsImage = inp.ctx;
5330        let mut out_out: *mut bindings::VipsImage = null_mut();
5331
5332        let vips_op_response = bindings::vips_addalpha(inp_in, &mut out_out, NULL);
5333        utils::result(
5334            vips_op_response,
5335            VipsImage { ctx: out_out },
5336            Error::AddalphaError,
5337        )
5338    }
5339}
5340
5341/// VipsBlack (black), make a black image
5342/// width: `i32` -> Image width in pixels
5343/// min: 1, max: 100000000, default: 1
5344/// height: `i32` -> Image height in pixels
5345/// min: 1, max: 100000000, default: 1
5346/// returns `VipsImage` - Output image
5347pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5348    unsafe {
5349        let width_in: i32 = width;
5350        let height_in: i32 = height;
5351        let mut out_out: *mut bindings::VipsImage = null_mut();
5352
5353        let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5354        utils::result(
5355            vips_op_response,
5356            VipsImage { ctx: out_out },
5357            Error::BlackError,
5358        )
5359    }
5360}
5361
5362/// Options for black operation
5363#[derive(Clone, Debug)]
5364pub struct BlackOptions {
5365    /// bands: `i32` -> Number of bands in image
5366    /// min: 1, max: 100000000, default: 1
5367    pub bands: i32,
5368}
5369
5370impl std::default::Default for BlackOptions {
5371    fn default() -> Self {
5372        BlackOptions {
5373            bands: i32::from(1),
5374        }
5375    }
5376}
5377
5378/// VipsBlack (black), make a black image
5379/// width: `i32` -> Image width in pixels
5380/// min: 1, max: 100000000, default: 1
5381/// height: `i32` -> Image height in pixels
5382/// min: 1, max: 100000000, default: 1
5383/// black_options: `&BlackOptions` -> optional arguments
5384/// returns `VipsImage` - Output image
5385pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5386    unsafe {
5387        let width_in: i32 = width;
5388        let height_in: i32 = height;
5389        let mut out_out: *mut bindings::VipsImage = null_mut();
5390
5391        let bands_in: i32 = black_options.bands;
5392        let bands_in_name = utils::new_c_string("bands")?;
5393
5394        let vips_op_response = bindings::vips_black(
5395            &mut out_out,
5396            width_in,
5397            height_in,
5398            bands_in_name.as_ptr(),
5399            bands_in,
5400            NULL,
5401        );
5402        utils::result(
5403            vips_op_response,
5404            VipsImage { ctx: out_out },
5405            Error::BlackError,
5406        )
5407    }
5408}
5409
5410/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5411/// width: `i32` -> Image width in pixels
5412/// min: 1, max: 100000000, default: 1
5413/// height: `i32` -> Image height in pixels
5414/// min: 1, max: 100000000, default: 1
5415/// returns `VipsImage` - Output image
5416pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5417    unsafe {
5418        let width_in: i32 = width;
5419        let height_in: i32 = height;
5420        let mut out_out: *mut bindings::VipsImage = null_mut();
5421
5422        let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5423        utils::result(
5424            vips_op_response,
5425            VipsImage { ctx: out_out },
5426            Error::GaussnoiseError,
5427        )
5428    }
5429}
5430
5431/// Options for gaussnoise operation
5432#[derive(Clone, Debug)]
5433pub struct GaussnoiseOptions {
5434    /// sigma: `f64` -> Standard deviation of pixels in generated image
5435    /// min: 0, max: 100000, default: 30
5436    pub sigma: f64,
5437    /// mean: `f64` -> Mean of pixels in generated image
5438    /// min: -10000000, max: 1000000, default: 128
5439    pub mean: f64,
5440    /// seed: `i32` -> Random number seed
5441    /// min: -2147483648, max: 2147483647, default: 0
5442    pub seed: i32,
5443}
5444
5445impl std::default::Default for GaussnoiseOptions {
5446    fn default() -> Self {
5447        GaussnoiseOptions {
5448            sigma: f64::from(30),
5449            mean: f64::from(128),
5450            seed: i32::from(0),
5451        }
5452    }
5453}
5454
5455/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5456/// width: `i32` -> Image width in pixels
5457/// min: 1, max: 100000000, default: 1
5458/// height: `i32` -> Image height in pixels
5459/// min: 1, max: 100000000, default: 1
5460/// gaussnoise_options: `&GaussnoiseOptions` -> optional arguments
5461/// returns `VipsImage` - Output image
5462pub fn gaussnoise_with_opts(
5463    width: i32,
5464    height: i32,
5465    gaussnoise_options: &GaussnoiseOptions,
5466) -> Result<VipsImage> {
5467    unsafe {
5468        let width_in: i32 = width;
5469        let height_in: i32 = height;
5470        let mut out_out: *mut bindings::VipsImage = null_mut();
5471
5472        let sigma_in: f64 = gaussnoise_options.sigma;
5473        let sigma_in_name = utils::new_c_string("sigma")?;
5474
5475        let mean_in: f64 = gaussnoise_options.mean;
5476        let mean_in_name = utils::new_c_string("mean")?;
5477
5478        let seed_in: i32 = gaussnoise_options.seed;
5479        let seed_in_name = utils::new_c_string("seed")?;
5480
5481        let vips_op_response = bindings::vips_gaussnoise(
5482            &mut out_out,
5483            width_in,
5484            height_in,
5485            sigma_in_name.as_ptr(),
5486            sigma_in,
5487            mean_in_name.as_ptr(),
5488            mean_in,
5489            seed_in_name.as_ptr(),
5490            seed_in,
5491            NULL,
5492        );
5493        utils::result(
5494            vips_op_response,
5495            VipsImage { ctx: out_out },
5496            Error::GaussnoiseError,
5497        )
5498    }
5499}
5500
5501/// VipsXyz (xyz), make an image where pixel values are coordinates
5502/// width: `i32` -> Image width in pixels
5503/// min: 1, max: 100000000, default: 64
5504/// height: `i32` -> Image height in pixels
5505/// min: 1, max: 100000000, default: 64
5506/// returns `VipsImage` - Output image
5507pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5508    unsafe {
5509        let width_in: i32 = width;
5510        let height_in: i32 = height;
5511        let mut out_out: *mut bindings::VipsImage = null_mut();
5512
5513        let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5514        utils::result(
5515            vips_op_response,
5516            VipsImage { ctx: out_out },
5517            Error::XyzError,
5518        )
5519    }
5520}
5521
5522/// Options for xyz operation
5523#[derive(Clone, Debug)]
5524pub struct XyzOptions {
5525    /// csize: `i32` -> Size of third dimension
5526    /// min: 1, max: 100000000, default: 1
5527    pub csize: i32,
5528    /// dsize: `i32` -> Size of fourth dimension
5529    /// min: 1, max: 100000000, default: 1
5530    pub dsize: i32,
5531    /// esize: `i32` -> Size of fifth dimension
5532    /// min: 1, max: 100000000, default: 1
5533    pub esize: i32,
5534}
5535
5536impl std::default::Default for XyzOptions {
5537    fn default() -> Self {
5538        XyzOptions {
5539            csize: i32::from(1),
5540            dsize: i32::from(1),
5541            esize: i32::from(1),
5542        }
5543    }
5544}
5545
5546/// VipsXyz (xyz), make an image where pixel values are coordinates
5547/// width: `i32` -> Image width in pixels
5548/// min: 1, max: 100000000, default: 64
5549/// height: `i32` -> Image height in pixels
5550/// min: 1, max: 100000000, default: 64
5551/// xyz_options: `&XyzOptions` -> optional arguments
5552/// returns `VipsImage` - Output image
5553pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5554    unsafe {
5555        let width_in: i32 = width;
5556        let height_in: i32 = height;
5557        let mut out_out: *mut bindings::VipsImage = null_mut();
5558
5559        let csize_in: i32 = xyz_options.csize;
5560        let csize_in_name = utils::new_c_string("csize")?;
5561
5562        let dsize_in: i32 = xyz_options.dsize;
5563        let dsize_in_name = utils::new_c_string("dsize")?;
5564
5565        let esize_in: i32 = xyz_options.esize;
5566        let esize_in_name = utils::new_c_string("esize")?;
5567
5568        let vips_op_response = bindings::vips_xyz(
5569            &mut out_out,
5570            width_in,
5571            height_in,
5572            csize_in_name.as_ptr(),
5573            csize_in,
5574            dsize_in_name.as_ptr(),
5575            dsize_in,
5576            esize_in_name.as_ptr(),
5577            esize_in,
5578            NULL,
5579        );
5580        utils::result(
5581            vips_op_response,
5582            VipsImage { ctx: out_out },
5583            Error::XyzError,
5584        )
5585    }
5586}
5587
5588/// VipsGaussmat (gaussmat), make a gaussian image
5589/// sigma: `f64` -> Sigma of Gaussian
5590/// min: 0.000001, max: 10000, default: 1
5591/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5592/// min: 0.000001, max: 10000, default: 0.1
5593/// returns `VipsImage` - Output image
5594pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5595    unsafe {
5596        let sigma_in: f64 = sigma;
5597        let min_ampl_in: f64 = min_ampl;
5598        let mut out_out: *mut bindings::VipsImage = null_mut();
5599
5600        let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5601        utils::result(
5602            vips_op_response,
5603            VipsImage { ctx: out_out },
5604            Error::GaussmatError,
5605        )
5606    }
5607}
5608
5609/// Options for gaussmat operation
5610#[derive(Clone, Debug)]
5611pub struct GaussmatOptions {
5612    /// separable: `bool` -> Generate separable Gaussian
5613    /// default: false
5614    pub separable: bool,
5615    /// precision: `Precision` -> Generate with this precision
5616    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5617    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5618    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5619    ///  `Last` -> VIPS_PRECISION_LAST = 3
5620    pub precision: Precision,
5621}
5622
5623impl std::default::Default for GaussmatOptions {
5624    fn default() -> Self {
5625        GaussmatOptions {
5626            separable: false,
5627            precision: Precision::Integer,
5628        }
5629    }
5630}
5631
5632/// VipsGaussmat (gaussmat), make a gaussian image
5633/// sigma: `f64` -> Sigma of Gaussian
5634/// min: 0.000001, max: 10000, default: 1
5635/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5636/// min: 0.000001, max: 10000, default: 0.1
5637/// gaussmat_options: `&GaussmatOptions` -> optional arguments
5638/// returns `VipsImage` - Output image
5639pub fn gaussmat_with_opts(
5640    sigma: f64,
5641    min_ampl: f64,
5642    gaussmat_options: &GaussmatOptions,
5643) -> Result<VipsImage> {
5644    unsafe {
5645        let sigma_in: f64 = sigma;
5646        let min_ampl_in: f64 = min_ampl;
5647        let mut out_out: *mut bindings::VipsImage = null_mut();
5648
5649        let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5650        let separable_in_name = utils::new_c_string("separable")?;
5651
5652        let precision_in: i32 = gaussmat_options.precision as i32;
5653        let precision_in_name = utils::new_c_string("precision")?;
5654
5655        let vips_op_response = bindings::vips_gaussmat(
5656            &mut out_out,
5657            sigma_in,
5658            min_ampl_in,
5659            separable_in_name.as_ptr(),
5660            separable_in,
5661            precision_in_name.as_ptr(),
5662            precision_in,
5663            NULL,
5664        );
5665        utils::result(
5666            vips_op_response,
5667            VipsImage { ctx: out_out },
5668            Error::GaussmatError,
5669        )
5670    }
5671}
5672
5673/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5674/// sigma: `f64` -> Radius of Gaussian
5675/// min: 0.000001, max: 10000, default: 1
5676/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5677/// min: 0.000001, max: 10000, default: 0.1
5678/// returns `VipsImage` - Output image
5679pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5680    unsafe {
5681        let sigma_in: f64 = sigma;
5682        let min_ampl_in: f64 = min_ampl;
5683        let mut out_out: *mut bindings::VipsImage = null_mut();
5684
5685        let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5686        utils::result(
5687            vips_op_response,
5688            VipsImage { ctx: out_out },
5689            Error::LogmatError,
5690        )
5691    }
5692}
5693
5694/// Options for logmat operation
5695#[derive(Clone, Debug)]
5696pub struct LogmatOptions {
5697    /// separable: `bool` -> Generate separable Gaussian
5698    /// default: false
5699    pub separable: bool,
5700    /// precision: `Precision` -> Generate with this precision
5701    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5702    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5703    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5704    ///  `Last` -> VIPS_PRECISION_LAST = 3
5705    pub precision: Precision,
5706}
5707
5708impl std::default::Default for LogmatOptions {
5709    fn default() -> Self {
5710        LogmatOptions {
5711            separable: false,
5712            precision: Precision::Integer,
5713        }
5714    }
5715}
5716
5717/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5718/// sigma: `f64` -> Radius of Gaussian
5719/// min: 0.000001, max: 10000, default: 1
5720/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5721/// min: 0.000001, max: 10000, default: 0.1
5722/// logmat_options: `&LogmatOptions` -> optional arguments
5723/// returns `VipsImage` - Output image
5724pub fn logmat_with_opts(
5725    sigma: f64,
5726    min_ampl: f64,
5727    logmat_options: &LogmatOptions,
5728) -> Result<VipsImage> {
5729    unsafe {
5730        let sigma_in: f64 = sigma;
5731        let min_ampl_in: f64 = min_ampl;
5732        let mut out_out: *mut bindings::VipsImage = null_mut();
5733
5734        let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5735        let separable_in_name = utils::new_c_string("separable")?;
5736
5737        let precision_in: i32 = logmat_options.precision as i32;
5738        let precision_in_name = utils::new_c_string("precision")?;
5739
5740        let vips_op_response = bindings::vips_logmat(
5741            &mut out_out,
5742            sigma_in,
5743            min_ampl_in,
5744            separable_in_name.as_ptr(),
5745            separable_in,
5746            precision_in_name.as_ptr(),
5747            precision_in,
5748            NULL,
5749        );
5750        utils::result(
5751            vips_op_response,
5752            VipsImage { ctx: out_out },
5753            Error::LogmatError,
5754        )
5755    }
5756}
5757
5758/// VipsText (text), make a text image
5759/// text: `&str` -> Text to render
5760/// returns `VipsImage` - Output image
5761pub fn text(text: &str) -> Result<VipsImage> {
5762    unsafe {
5763        let text_in: CString = utils::new_c_string(text)?;
5764        let mut out_out: *mut bindings::VipsImage = null_mut();
5765
5766        let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5767        utils::result(
5768            vips_op_response,
5769            VipsImage { ctx: out_out },
5770            Error::TextError,
5771        )
5772    }
5773}
5774
5775/// Options for text operation
5776#[derive(Clone, Debug)]
5777pub struct TextOptions {
5778    /// font: `String` -> Font to render with
5779    pub font: String,
5780    /// width: `i32` -> Maximum image width in pixels
5781    /// min: 0, max: 100000000, default: 0
5782    pub width: i32,
5783    /// height: `i32` -> Maximum image height in pixels
5784    /// min: 0, max: 100000000, default: 0
5785    pub height: i32,
5786    /// align: `Align` -> Align on the low, centre or high edge
5787    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
5788    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
5789    ///  `High` -> VIPS_ALIGN_HIGH = 2
5790    ///  `Last` -> VIPS_ALIGN_LAST = 3
5791    pub align: Align,
5792    /// justify: `bool` -> Justify lines
5793    /// default: false
5794    pub justify: bool,
5795    /// dpi: `i32` -> DPI to render at
5796    /// min: 1, max: 1000000, default: 72
5797    pub dpi: i32,
5798    /// autofit_dpi: `i32` -> DPI selected by autofit
5799    /// min: 1, max: 1000000, default: 72
5800    pub autofit_dpi: i32,
5801    /// spacing: `i32` -> Line spacing
5802    /// min: -1000000, max: 1000000, default: 0
5803    pub spacing: i32,
5804    /// fontfile: `String` -> Load this font file
5805    pub fontfile: String,
5806    /// rgba: `bool` -> Enable RGBA output
5807    /// default: false
5808    pub rgba: bool,
5809    /// wrap: `TextWrap` -> Wrap lines on word or character boundaries
5810    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0 [DEFAULT]
5811    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
5812    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
5813    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
5814    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
5815    pub wrap: TextWrap,
5816}
5817
5818impl std::default::Default for TextOptions {
5819    fn default() -> Self {
5820        TextOptions {
5821            font: String::new(),
5822            width: i32::from(0),
5823            height: i32::from(0),
5824            align: Align::Low,
5825            justify: false,
5826            dpi: i32::from(72),
5827            autofit_dpi: i32::from(72),
5828            spacing: i32::from(0),
5829            fontfile: String::new(),
5830            rgba: false,
5831            wrap: TextWrap::Word,
5832        }
5833    }
5834}
5835
5836/// VipsText (text), make a text image
5837/// text: `&str` -> Text to render
5838/// text_options: `&TextOptions` -> optional arguments
5839/// returns `VipsImage` - Output image
5840pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5841    unsafe {
5842        let text_in: CString = utils::new_c_string(text)?;
5843        let mut out_out: *mut bindings::VipsImage = null_mut();
5844
5845        let font_in: CString = utils::new_c_string(&text_options.font)?;
5846        let font_in_name = utils::new_c_string("font")?;
5847
5848        let width_in: i32 = text_options.width;
5849        let width_in_name = utils::new_c_string("width")?;
5850
5851        let height_in: i32 = text_options.height;
5852        let height_in_name = utils::new_c_string("height")?;
5853
5854        let align_in: i32 = text_options.align as i32;
5855        let align_in_name = utils::new_c_string("align")?;
5856
5857        let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5858        let justify_in_name = utils::new_c_string("justify")?;
5859
5860        let dpi_in: i32 = text_options.dpi;
5861        let dpi_in_name = utils::new_c_string("dpi")?;
5862
5863        let autofit_dpi_in: i32 = text_options.autofit_dpi;
5864        let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5865
5866        let spacing_in: i32 = text_options.spacing;
5867        let spacing_in_name = utils::new_c_string("spacing")?;
5868
5869        let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5870        let fontfile_in_name = utils::new_c_string("fontfile")?;
5871
5872        let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5873        let rgba_in_name = utils::new_c_string("rgba")?;
5874
5875        let wrap_in: i32 = text_options.wrap as i32;
5876        let wrap_in_name = utils::new_c_string("wrap")?;
5877
5878        let vips_op_response = bindings::vips_text(
5879            &mut out_out,
5880            text_in.as_ptr(),
5881            font_in_name.as_ptr(),
5882            font_in.as_ptr(),
5883            width_in_name.as_ptr(),
5884            width_in,
5885            height_in_name.as_ptr(),
5886            height_in,
5887            align_in_name.as_ptr(),
5888            align_in,
5889            justify_in_name.as_ptr(),
5890            justify_in,
5891            dpi_in_name.as_ptr(),
5892            dpi_in,
5893            autofit_dpi_in_name.as_ptr(),
5894            autofit_dpi_in,
5895            spacing_in_name.as_ptr(),
5896            spacing_in,
5897            fontfile_in_name.as_ptr(),
5898            fontfile_in.as_ptr(),
5899            rgba_in_name.as_ptr(),
5900            rgba_in,
5901            wrap_in_name.as_ptr(),
5902            wrap_in,
5903            NULL,
5904        );
5905        utils::result(
5906            vips_op_response,
5907            VipsImage { ctx: out_out },
5908            Error::TextError,
5909        )
5910    }
5911}
5912
5913/// VipsSdf (sdf), create an SDF image
5914/// width: `i32` -> Image width in pixels
5915/// min: 1, max: 100000000, default: 1
5916/// height: `i32` -> Image height in pixels
5917/// min: 1, max: 100000000, default: 1
5918/// shape: `SdfShape` -> SDF shape to create
5919///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5920///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5921///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5922///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5923///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
5924/// returns `VipsImage` - Output image
5925pub fn sdf(width: i32, height: i32, shape: SdfShape) -> Result<VipsImage> {
5926    unsafe {
5927        let width_in: i32 = width;
5928        let height_in: i32 = height;
5929        let shape_in: i32 = shape as i32;
5930        let mut out_out: *mut bindings::VipsImage = null_mut();
5931
5932        let vips_op_response = bindings::vips_sdf(
5933            &mut out_out,
5934            width_in,
5935            height_in,
5936            shape_in.try_into().unwrap(),
5937            NULL,
5938        );
5939        utils::result(
5940            vips_op_response,
5941            VipsImage { ctx: out_out },
5942            Error::SdfError,
5943        )
5944    }
5945}
5946
5947/// Options for sdf operation
5948#[derive(Clone, Debug)]
5949pub struct SdfOptions {
5950    /// r: `f64` -> Radius
5951    /// min: 0, max: 100000000, default: 50
5952    pub r: f64,
5953    /// a: `Vec<f64>` -> Point a
5954    pub a: Vec<f64>,
5955    /// b: `Vec<f64>` -> Point b
5956    pub b: Vec<f64>,
5957    /// corners: `Vec<f64>` -> Corner radii
5958    pub corners: Vec<f64>,
5959}
5960
5961impl std::default::Default for SdfOptions {
5962    fn default() -> Self {
5963        SdfOptions {
5964            r: f64::from(50),
5965            a: Vec::new(),
5966            b: Vec::new(),
5967            corners: Vec::new(),
5968        }
5969    }
5970}
5971
5972/// VipsSdf (sdf), create an SDF image
5973/// width: `i32` -> Image width in pixels
5974/// min: 1, max: 100000000, default: 1
5975/// height: `i32` -> Image height in pixels
5976/// min: 1, max: 100000000, default: 1
5977/// shape: `SdfShape` -> SDF shape to create
5978///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5979///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5980///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5981///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5982///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
5983/// sdf_options: `&SdfOptions` -> optional arguments
5984/// returns `VipsImage` - Output image
5985pub fn sdf_with_opts(
5986    width: i32,
5987    height: i32,
5988    shape: SdfShape,
5989    sdf_options: &SdfOptions,
5990) -> Result<VipsImage> {
5991    unsafe {
5992        let width_in: i32 = width;
5993        let height_in: i32 = height;
5994        let shape_in: i32 = shape as i32;
5995        let mut out_out: *mut bindings::VipsImage = null_mut();
5996
5997        let r_in: f64 = sdf_options.r;
5998        let r_in_name = utils::new_c_string("r")?;
5999
6000        let a_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.a[..]);
6001        let a_in = a_wrapper.ctx;
6002        let a_in_name = utils::new_c_string("a")?;
6003
6004        let b_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.b[..]);
6005        let b_in = b_wrapper.ctx;
6006        let b_in_name = utils::new_c_string("b")?;
6007
6008        let corners_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.corners[..]);
6009        let corners_in = corners_wrapper.ctx;
6010        let corners_in_name = utils::new_c_string("corners")?;
6011
6012        let vips_op_response = bindings::vips_sdf(
6013            &mut out_out,
6014            width_in,
6015            height_in,
6016            shape_in.try_into().unwrap(),
6017            r_in_name.as_ptr(),
6018            r_in,
6019            a_in_name.as_ptr(),
6020            a_in,
6021            b_in_name.as_ptr(),
6022            b_in,
6023            corners_in_name.as_ptr(),
6024            corners_in,
6025            NULL,
6026        );
6027        utils::result(
6028            vips_op_response,
6029            VipsImage { ctx: out_out },
6030            Error::SdfError,
6031        )
6032    }
6033}
6034
6035/// VipsEye (eye), make an image showing the eye's spatial response
6036/// width: `i32` -> Image width in pixels
6037/// min: 1, max: 100000000, default: 1
6038/// height: `i32` -> Image height in pixels
6039/// min: 1, max: 100000000, default: 1
6040/// returns `VipsImage` - Output image
6041pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
6042    unsafe {
6043        let width_in: i32 = width;
6044        let height_in: i32 = height;
6045        let mut out_out: *mut bindings::VipsImage = null_mut();
6046
6047        let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
6048        utils::result(
6049            vips_op_response,
6050            VipsImage { ctx: out_out },
6051            Error::EyeError,
6052        )
6053    }
6054}
6055
6056/// Options for eye operation
6057#[derive(Clone, Debug)]
6058pub struct EyeOptions {
6059    /// uchar: `bool` -> Output an unsigned char image
6060    /// default: false
6061    pub uchar: bool,
6062    /// factor: `f64` -> Maximum spatial frequency
6063    /// min: 0, max: 1, default: 0.5
6064    pub factor: f64,
6065}
6066
6067impl std::default::Default for EyeOptions {
6068    fn default() -> Self {
6069        EyeOptions {
6070            uchar: false,
6071            factor: f64::from(0.5),
6072        }
6073    }
6074}
6075
6076/// VipsEye (eye), make an image showing the eye's spatial response
6077/// width: `i32` -> Image width in pixels
6078/// min: 1, max: 100000000, default: 1
6079/// height: `i32` -> Image height in pixels
6080/// min: 1, max: 100000000, default: 1
6081/// eye_options: `&EyeOptions` -> optional arguments
6082/// returns `VipsImage` - Output image
6083pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
6084    unsafe {
6085        let width_in: i32 = width;
6086        let height_in: i32 = height;
6087        let mut out_out: *mut bindings::VipsImage = null_mut();
6088
6089        let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
6090        let uchar_in_name = utils::new_c_string("uchar")?;
6091
6092        let factor_in: f64 = eye_options.factor;
6093        let factor_in_name = utils::new_c_string("factor")?;
6094
6095        let vips_op_response = bindings::vips_eye(
6096            &mut out_out,
6097            width_in,
6098            height_in,
6099            uchar_in_name.as_ptr(),
6100            uchar_in,
6101            factor_in_name.as_ptr(),
6102            factor_in,
6103            NULL,
6104        );
6105        utils::result(
6106            vips_op_response,
6107            VipsImage { ctx: out_out },
6108            Error::EyeError,
6109        )
6110    }
6111}
6112
6113/// VipsGrey (grey), make a grey ramp image
6114/// width: `i32` -> Image width in pixels
6115/// min: 1, max: 100000000, default: 1
6116/// height: `i32` -> Image height in pixels
6117/// min: 1, max: 100000000, default: 1
6118/// returns `VipsImage` - Output image
6119pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
6120    unsafe {
6121        let width_in: i32 = width;
6122        let height_in: i32 = height;
6123        let mut out_out: *mut bindings::VipsImage = null_mut();
6124
6125        let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
6126        utils::result(
6127            vips_op_response,
6128            VipsImage { ctx: out_out },
6129            Error::GreyError,
6130        )
6131    }
6132}
6133
6134/// Options for grey operation
6135#[derive(Clone, Debug)]
6136pub struct GreyOptions {
6137    /// uchar: `bool` -> Output an unsigned char image
6138    /// default: false
6139    pub uchar: bool,
6140}
6141
6142impl std::default::Default for GreyOptions {
6143    fn default() -> Self {
6144        GreyOptions { uchar: false }
6145    }
6146}
6147
6148/// VipsGrey (grey), make a grey ramp image
6149/// width: `i32` -> Image width in pixels
6150/// min: 1, max: 100000000, default: 1
6151/// height: `i32` -> Image height in pixels
6152/// min: 1, max: 100000000, default: 1
6153/// grey_options: `&GreyOptions` -> optional arguments
6154/// returns `VipsImage` - Output image
6155pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6156    unsafe {
6157        let width_in: i32 = width;
6158        let height_in: i32 = height;
6159        let mut out_out: *mut bindings::VipsImage = null_mut();
6160
6161        let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6162        let uchar_in_name = utils::new_c_string("uchar")?;
6163
6164        let vips_op_response = bindings::vips_grey(
6165            &mut out_out,
6166            width_in,
6167            height_in,
6168            uchar_in_name.as_ptr(),
6169            uchar_in,
6170            NULL,
6171        );
6172        utils::result(
6173            vips_op_response,
6174            VipsImage { ctx: out_out },
6175            Error::GreyError,
6176        )
6177    }
6178}
6179
6180/// VipsZone (zone), make a zone plate
6181/// width: `i32` -> Image width in pixels
6182/// min: 1, max: 100000000, default: 1
6183/// height: `i32` -> Image height in pixels
6184/// min: 1, max: 100000000, default: 1
6185/// returns `VipsImage` - Output image
6186pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6187    unsafe {
6188        let width_in: i32 = width;
6189        let height_in: i32 = height;
6190        let mut out_out: *mut bindings::VipsImage = null_mut();
6191
6192        let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6193        utils::result(
6194            vips_op_response,
6195            VipsImage { ctx: out_out },
6196            Error::ZoneError,
6197        )
6198    }
6199}
6200
6201/// Options for zone operation
6202#[derive(Clone, Debug)]
6203pub struct ZoneOptions {
6204    /// uchar: `bool` -> Output an unsigned char image
6205    /// default: false
6206    pub uchar: bool,
6207}
6208
6209impl std::default::Default for ZoneOptions {
6210    fn default() -> Self {
6211        ZoneOptions { uchar: false }
6212    }
6213}
6214
6215/// VipsZone (zone), make a zone plate
6216/// width: `i32` -> Image width in pixels
6217/// min: 1, max: 100000000, default: 1
6218/// height: `i32` -> Image height in pixels
6219/// min: 1, max: 100000000, default: 1
6220/// zone_options: `&ZoneOptions` -> optional arguments
6221/// returns `VipsImage` - Output image
6222pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6223    unsafe {
6224        let width_in: i32 = width;
6225        let height_in: i32 = height;
6226        let mut out_out: *mut bindings::VipsImage = null_mut();
6227
6228        let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6229        let uchar_in_name = utils::new_c_string("uchar")?;
6230
6231        let vips_op_response = bindings::vips_zone(
6232            &mut out_out,
6233            width_in,
6234            height_in,
6235            uchar_in_name.as_ptr(),
6236            uchar_in,
6237            NULL,
6238        );
6239        utils::result(
6240            vips_op_response,
6241            VipsImage { ctx: out_out },
6242            Error::ZoneError,
6243        )
6244    }
6245}
6246
6247/// VipsSines (sines), make a 2D sine wave
6248/// width: `i32` -> Image width in pixels
6249/// min: 1, max: 100000000, default: 1
6250/// height: `i32` -> Image height in pixels
6251/// min: 1, max: 100000000, default: 1
6252/// returns `VipsImage` - Output image
6253pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6254    unsafe {
6255        let width_in: i32 = width;
6256        let height_in: i32 = height;
6257        let mut out_out: *mut bindings::VipsImage = null_mut();
6258
6259        let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6260        utils::result(
6261            vips_op_response,
6262            VipsImage { ctx: out_out },
6263            Error::SineError,
6264        )
6265    }
6266}
6267
6268/// Options for sines operation
6269#[derive(Clone, Debug)]
6270pub struct SineOptions {
6271    /// uchar: `bool` -> Output an unsigned char image
6272    /// default: false
6273    pub uchar: bool,
6274    /// hfreq: `f64` -> Horizontal spatial frequency
6275    /// min: 0, max: 10000, default: 0.5
6276    pub hfreq: f64,
6277    /// vfreq: `f64` -> Vertical spatial frequency
6278    /// min: 0, max: 10000, default: 0.5
6279    pub vfreq: f64,
6280}
6281
6282impl std::default::Default for SineOptions {
6283    fn default() -> Self {
6284        SineOptions {
6285            uchar: false,
6286            hfreq: f64::from(0.5),
6287            vfreq: f64::from(0.5),
6288        }
6289    }
6290}
6291
6292/// VipsSines (sines), make a 2D sine wave
6293/// width: `i32` -> Image width in pixels
6294/// min: 1, max: 100000000, default: 1
6295/// height: `i32` -> Image height in pixels
6296/// min: 1, max: 100000000, default: 1
6297/// sines_options: `&SineOptions` -> optional arguments
6298/// returns `VipsImage` - Output image
6299pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6300    unsafe {
6301        let width_in: i32 = width;
6302        let height_in: i32 = height;
6303        let mut out_out: *mut bindings::VipsImage = null_mut();
6304
6305        let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6306        let uchar_in_name = utils::new_c_string("uchar")?;
6307
6308        let hfreq_in: f64 = sines_options.hfreq;
6309        let hfreq_in_name = utils::new_c_string("hfreq")?;
6310
6311        let vfreq_in: f64 = sines_options.vfreq;
6312        let vfreq_in_name = utils::new_c_string("vfreq")?;
6313
6314        let vips_op_response = bindings::vips_sines(
6315            &mut out_out,
6316            width_in,
6317            height_in,
6318            uchar_in_name.as_ptr(),
6319            uchar_in,
6320            hfreq_in_name.as_ptr(),
6321            hfreq_in,
6322            vfreq_in_name.as_ptr(),
6323            vfreq_in,
6324            NULL,
6325        );
6326        utils::result(
6327            vips_op_response,
6328            VipsImage { ctx: out_out },
6329            Error::SineError,
6330        )
6331    }
6332}
6333
6334/// VipsMaskIdeal (mask_ideal), make an ideal filter
6335/// width: `i32` -> Image width in pixels
6336/// min: 1, max: 100000000, default: 1
6337/// height: `i32` -> Image height in pixels
6338/// min: 1, max: 100000000, default: 1
6339/// frequency_cutoff: `f64` -> Frequency cutoff
6340/// min: 0, max: 1000000, default: 0.5
6341/// returns `VipsImage` - Output image
6342pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6343    unsafe {
6344        let width_in: i32 = width;
6345        let height_in: i32 = height;
6346        let frequency_cutoff_in: f64 = frequency_cutoff;
6347        let mut out_out: *mut bindings::VipsImage = null_mut();
6348
6349        let vips_op_response =
6350            bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6351        utils::result(
6352            vips_op_response,
6353            VipsImage { ctx: out_out },
6354            Error::MaskIdealError,
6355        )
6356    }
6357}
6358
6359/// Options for mask_ideal operation
6360#[derive(Clone, Debug)]
6361pub struct MaskIdealOptions {
6362    /// uchar: `bool` -> Output an unsigned char image
6363    /// default: false
6364    pub uchar: bool,
6365    /// nodc: `bool` -> Remove DC component
6366    /// default: false
6367    pub nodc: bool,
6368    /// reject: `bool` -> Invert the sense of the filter
6369    /// default: false
6370    pub reject: bool,
6371    /// optical: `bool` -> Rotate quadrants to optical space
6372    /// default: false
6373    pub optical: bool,
6374}
6375
6376impl std::default::Default for MaskIdealOptions {
6377    fn default() -> Self {
6378        MaskIdealOptions {
6379            uchar: false,
6380            nodc: false,
6381            reject: false,
6382            optical: false,
6383        }
6384    }
6385}
6386
6387/// VipsMaskIdeal (mask_ideal), make an ideal filter
6388/// width: `i32` -> Image width in pixels
6389/// min: 1, max: 100000000, default: 1
6390/// height: `i32` -> Image height in pixels
6391/// min: 1, max: 100000000, default: 1
6392/// frequency_cutoff: `f64` -> Frequency cutoff
6393/// min: 0, max: 1000000, default: 0.5
6394/// mask_ideal_options: `&MaskIdealOptions` -> optional arguments
6395/// returns `VipsImage` - Output image
6396pub fn mask_ideal_with_opts(
6397    width: i32,
6398    height: i32,
6399    frequency_cutoff: f64,
6400    mask_ideal_options: &MaskIdealOptions,
6401) -> Result<VipsImage> {
6402    unsafe {
6403        let width_in: i32 = width;
6404        let height_in: i32 = height;
6405        let frequency_cutoff_in: f64 = frequency_cutoff;
6406        let mut out_out: *mut bindings::VipsImage = null_mut();
6407
6408        let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6409        let uchar_in_name = utils::new_c_string("uchar")?;
6410
6411        let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6412        let nodc_in_name = utils::new_c_string("nodc")?;
6413
6414        let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6415        let reject_in_name = utils::new_c_string("reject")?;
6416
6417        let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6418        let optical_in_name = utils::new_c_string("optical")?;
6419
6420        let vips_op_response = bindings::vips_mask_ideal(
6421            &mut out_out,
6422            width_in,
6423            height_in,
6424            frequency_cutoff_in,
6425            uchar_in_name.as_ptr(),
6426            uchar_in,
6427            nodc_in_name.as_ptr(),
6428            nodc_in,
6429            reject_in_name.as_ptr(),
6430            reject_in,
6431            optical_in_name.as_ptr(),
6432            optical_in,
6433            NULL,
6434        );
6435        utils::result(
6436            vips_op_response,
6437            VipsImage { ctx: out_out },
6438            Error::MaskIdealError,
6439        )
6440    }
6441}
6442
6443/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6444/// width: `i32` -> Image width in pixels
6445/// min: 1, max: 100000000, default: 1
6446/// height: `i32` -> Image height in pixels
6447/// min: 1, max: 100000000, default: 1
6448/// frequency_cutoff: `f64` -> Frequency cutoff
6449/// min: 0, max: 1000000, default: 0.5
6450/// ringwidth: `f64` -> Ringwidth
6451/// min: 0, max: 1000000, default: 0.5
6452/// returns `VipsImage` - Output image
6453pub fn mask_ideal_ring(
6454    width: i32,
6455    height: i32,
6456    frequency_cutoff: f64,
6457    ringwidth: f64,
6458) -> Result<VipsImage> {
6459    unsafe {
6460        let width_in: i32 = width;
6461        let height_in: i32 = height;
6462        let frequency_cutoff_in: f64 = frequency_cutoff;
6463        let ringwidth_in: f64 = ringwidth;
6464        let mut out_out: *mut bindings::VipsImage = null_mut();
6465
6466        let vips_op_response = bindings::vips_mask_ideal_ring(
6467            &mut out_out,
6468            width_in,
6469            height_in,
6470            frequency_cutoff_in,
6471            ringwidth_in,
6472            NULL,
6473        );
6474        utils::result(
6475            vips_op_response,
6476            VipsImage { ctx: out_out },
6477            Error::MaskIdealRingError,
6478        )
6479    }
6480}
6481
6482/// Options for mask_ideal_ring operation
6483#[derive(Clone, Debug)]
6484pub struct MaskIdealRingOptions {
6485    /// uchar: `bool` -> Output an unsigned char image
6486    /// default: false
6487    pub uchar: bool,
6488    /// nodc: `bool` -> Remove DC component
6489    /// default: false
6490    pub nodc: bool,
6491    /// reject: `bool` -> Invert the sense of the filter
6492    /// default: false
6493    pub reject: bool,
6494    /// optical: `bool` -> Rotate quadrants to optical space
6495    /// default: false
6496    pub optical: bool,
6497}
6498
6499impl std::default::Default for MaskIdealRingOptions {
6500    fn default() -> Self {
6501        MaskIdealRingOptions {
6502            uchar: false,
6503            nodc: false,
6504            reject: false,
6505            optical: false,
6506        }
6507    }
6508}
6509
6510/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6511/// width: `i32` -> Image width in pixels
6512/// min: 1, max: 100000000, default: 1
6513/// height: `i32` -> Image height in pixels
6514/// min: 1, max: 100000000, default: 1
6515/// frequency_cutoff: `f64` -> Frequency cutoff
6516/// min: 0, max: 1000000, default: 0.5
6517/// ringwidth: `f64` -> Ringwidth
6518/// min: 0, max: 1000000, default: 0.5
6519/// mask_ideal_ring_options: `&MaskIdealRingOptions` -> optional arguments
6520/// returns `VipsImage` - Output image
6521pub fn mask_ideal_ring_with_opts(
6522    width: i32,
6523    height: i32,
6524    frequency_cutoff: f64,
6525    ringwidth: f64,
6526    mask_ideal_ring_options: &MaskIdealRingOptions,
6527) -> Result<VipsImage> {
6528    unsafe {
6529        let width_in: i32 = width;
6530        let height_in: i32 = height;
6531        let frequency_cutoff_in: f64 = frequency_cutoff;
6532        let ringwidth_in: f64 = ringwidth;
6533        let mut out_out: *mut bindings::VipsImage = null_mut();
6534
6535        let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6536        let uchar_in_name = utils::new_c_string("uchar")?;
6537
6538        let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6539        let nodc_in_name = utils::new_c_string("nodc")?;
6540
6541        let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6542        let reject_in_name = utils::new_c_string("reject")?;
6543
6544        let optical_in: i32 = if mask_ideal_ring_options.optical {
6545            1
6546        } else {
6547            0
6548        };
6549        let optical_in_name = utils::new_c_string("optical")?;
6550
6551        let vips_op_response = bindings::vips_mask_ideal_ring(
6552            &mut out_out,
6553            width_in,
6554            height_in,
6555            frequency_cutoff_in,
6556            ringwidth_in,
6557            uchar_in_name.as_ptr(),
6558            uchar_in,
6559            nodc_in_name.as_ptr(),
6560            nodc_in,
6561            reject_in_name.as_ptr(),
6562            reject_in,
6563            optical_in_name.as_ptr(),
6564            optical_in,
6565            NULL,
6566        );
6567        utils::result(
6568            vips_op_response,
6569            VipsImage { ctx: out_out },
6570            Error::MaskIdealRingError,
6571        )
6572    }
6573}
6574
6575/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6576/// width: `i32` -> Image width in pixels
6577/// min: 1, max: 100000000, default: 1
6578/// height: `i32` -> Image height in pixels
6579/// min: 1, max: 100000000, default: 1
6580/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6581/// min: 0, max: 1000000, default: 0.5
6582/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6583/// min: 0, max: 1000000, default: 0.5
6584/// radius: `f64` -> Radius of circle
6585/// min: 0, max: 1000000, default: 0.1
6586/// returns `VipsImage` - Output image
6587pub fn mask_ideal_band(
6588    width: i32,
6589    height: i32,
6590    frequency_cutoff_x: f64,
6591    frequency_cutoff_y: f64,
6592    radius: f64,
6593) -> Result<VipsImage> {
6594    unsafe {
6595        let width_in: i32 = width;
6596        let height_in: i32 = height;
6597        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6598        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6599        let radius_in: f64 = radius;
6600        let mut out_out: *mut bindings::VipsImage = null_mut();
6601
6602        let vips_op_response = bindings::vips_mask_ideal_band(
6603            &mut out_out,
6604            width_in,
6605            height_in,
6606            frequency_cutoff_x_in,
6607            frequency_cutoff_y_in,
6608            radius_in,
6609            NULL,
6610        );
6611        utils::result(
6612            vips_op_response,
6613            VipsImage { ctx: out_out },
6614            Error::MaskIdealBandError,
6615        )
6616    }
6617}
6618
6619/// Options for mask_ideal_band operation
6620#[derive(Clone, Debug)]
6621pub struct MaskIdealBandOptions {
6622    /// uchar: `bool` -> Output an unsigned char image
6623    /// default: false
6624    pub uchar: bool,
6625    /// nodc: `bool` -> Remove DC component
6626    /// default: false
6627    pub nodc: bool,
6628    /// reject: `bool` -> Invert the sense of the filter
6629    /// default: false
6630    pub reject: bool,
6631    /// optical: `bool` -> Rotate quadrants to optical space
6632    /// default: false
6633    pub optical: bool,
6634}
6635
6636impl std::default::Default for MaskIdealBandOptions {
6637    fn default() -> Self {
6638        MaskIdealBandOptions {
6639            uchar: false,
6640            nodc: false,
6641            reject: false,
6642            optical: false,
6643        }
6644    }
6645}
6646
6647/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6648/// width: `i32` -> Image width in pixels
6649/// min: 1, max: 100000000, default: 1
6650/// height: `i32` -> Image height in pixels
6651/// min: 1, max: 100000000, default: 1
6652/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6653/// min: 0, max: 1000000, default: 0.5
6654/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6655/// min: 0, max: 1000000, default: 0.5
6656/// radius: `f64` -> Radius of circle
6657/// min: 0, max: 1000000, default: 0.1
6658/// mask_ideal_band_options: `&MaskIdealBandOptions` -> optional arguments
6659/// returns `VipsImage` - Output image
6660pub fn mask_ideal_band_with_opts(
6661    width: i32,
6662    height: i32,
6663    frequency_cutoff_x: f64,
6664    frequency_cutoff_y: f64,
6665    radius: f64,
6666    mask_ideal_band_options: &MaskIdealBandOptions,
6667) -> Result<VipsImage> {
6668    unsafe {
6669        let width_in: i32 = width;
6670        let height_in: i32 = height;
6671        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6672        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6673        let radius_in: f64 = radius;
6674        let mut out_out: *mut bindings::VipsImage = null_mut();
6675
6676        let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6677        let uchar_in_name = utils::new_c_string("uchar")?;
6678
6679        let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6680        let nodc_in_name = utils::new_c_string("nodc")?;
6681
6682        let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6683        let reject_in_name = utils::new_c_string("reject")?;
6684
6685        let optical_in: i32 = if mask_ideal_band_options.optical {
6686            1
6687        } else {
6688            0
6689        };
6690        let optical_in_name = utils::new_c_string("optical")?;
6691
6692        let vips_op_response = bindings::vips_mask_ideal_band(
6693            &mut out_out,
6694            width_in,
6695            height_in,
6696            frequency_cutoff_x_in,
6697            frequency_cutoff_y_in,
6698            radius_in,
6699            uchar_in_name.as_ptr(),
6700            uchar_in,
6701            nodc_in_name.as_ptr(),
6702            nodc_in,
6703            reject_in_name.as_ptr(),
6704            reject_in,
6705            optical_in_name.as_ptr(),
6706            optical_in,
6707            NULL,
6708        );
6709        utils::result(
6710            vips_op_response,
6711            VipsImage { ctx: out_out },
6712            Error::MaskIdealBandError,
6713        )
6714    }
6715}
6716
6717/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6718/// width: `i32` -> Image width in pixels
6719/// min: 1, max: 100000000, default: 1
6720/// height: `i32` -> Image height in pixels
6721/// min: 1, max: 100000000, default: 1
6722/// order: `f64` -> Filter order
6723/// min: 1, max: 1000000, default: 1
6724/// frequency_cutoff: `f64` -> Frequency cutoff
6725/// min: 0, max: 1000000, default: 0.5
6726/// amplitude_cutoff: `f64` -> Amplitude cutoff
6727/// min: 0, max: 1, default: 0.5
6728/// returns `VipsImage` - Output image
6729pub fn mask_butterworth(
6730    width: i32,
6731    height: i32,
6732    order: f64,
6733    frequency_cutoff: f64,
6734    amplitude_cutoff: f64,
6735) -> Result<VipsImage> {
6736    unsafe {
6737        let width_in: i32 = width;
6738        let height_in: i32 = height;
6739        let order_in: f64 = order;
6740        let frequency_cutoff_in: f64 = frequency_cutoff;
6741        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6742        let mut out_out: *mut bindings::VipsImage = null_mut();
6743
6744        let vips_op_response = bindings::vips_mask_butterworth(
6745            &mut out_out,
6746            width_in,
6747            height_in,
6748            order_in,
6749            frequency_cutoff_in,
6750            amplitude_cutoff_in,
6751            NULL,
6752        );
6753        utils::result(
6754            vips_op_response,
6755            VipsImage { ctx: out_out },
6756            Error::MaskButterworthError,
6757        )
6758    }
6759}
6760
6761/// Options for mask_butterworth operation
6762#[derive(Clone, Debug)]
6763pub struct MaskButterworthOptions {
6764    /// uchar: `bool` -> Output an unsigned char image
6765    /// default: false
6766    pub uchar: bool,
6767    /// nodc: `bool` -> Remove DC component
6768    /// default: false
6769    pub nodc: bool,
6770    /// reject: `bool` -> Invert the sense of the filter
6771    /// default: false
6772    pub reject: bool,
6773    /// optical: `bool` -> Rotate quadrants to optical space
6774    /// default: false
6775    pub optical: bool,
6776}
6777
6778impl std::default::Default for MaskButterworthOptions {
6779    fn default() -> Self {
6780        MaskButterworthOptions {
6781            uchar: false,
6782            nodc: false,
6783            reject: false,
6784            optical: false,
6785        }
6786    }
6787}
6788
6789/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6790/// width: `i32` -> Image width in pixels
6791/// min: 1, max: 100000000, default: 1
6792/// height: `i32` -> Image height in pixels
6793/// min: 1, max: 100000000, default: 1
6794/// order: `f64` -> Filter order
6795/// min: 1, max: 1000000, default: 1
6796/// frequency_cutoff: `f64` -> Frequency cutoff
6797/// min: 0, max: 1000000, default: 0.5
6798/// amplitude_cutoff: `f64` -> Amplitude cutoff
6799/// min: 0, max: 1, default: 0.5
6800/// mask_butterworth_options: `&MaskButterworthOptions` -> optional arguments
6801/// returns `VipsImage` - Output image
6802pub fn mask_butterworth_with_opts(
6803    width: i32,
6804    height: i32,
6805    order: f64,
6806    frequency_cutoff: f64,
6807    amplitude_cutoff: f64,
6808    mask_butterworth_options: &MaskButterworthOptions,
6809) -> Result<VipsImage> {
6810    unsafe {
6811        let width_in: i32 = width;
6812        let height_in: i32 = height;
6813        let order_in: f64 = order;
6814        let frequency_cutoff_in: f64 = frequency_cutoff;
6815        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6816        let mut out_out: *mut bindings::VipsImage = null_mut();
6817
6818        let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6819        let uchar_in_name = utils::new_c_string("uchar")?;
6820
6821        let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6822        let nodc_in_name = utils::new_c_string("nodc")?;
6823
6824        let reject_in: i32 = if mask_butterworth_options.reject {
6825            1
6826        } else {
6827            0
6828        };
6829        let reject_in_name = utils::new_c_string("reject")?;
6830
6831        let optical_in: i32 = if mask_butterworth_options.optical {
6832            1
6833        } else {
6834            0
6835        };
6836        let optical_in_name = utils::new_c_string("optical")?;
6837
6838        let vips_op_response = bindings::vips_mask_butterworth(
6839            &mut out_out,
6840            width_in,
6841            height_in,
6842            order_in,
6843            frequency_cutoff_in,
6844            amplitude_cutoff_in,
6845            uchar_in_name.as_ptr(),
6846            uchar_in,
6847            nodc_in_name.as_ptr(),
6848            nodc_in,
6849            reject_in_name.as_ptr(),
6850            reject_in,
6851            optical_in_name.as_ptr(),
6852            optical_in,
6853            NULL,
6854        );
6855        utils::result(
6856            vips_op_response,
6857            VipsImage { ctx: out_out },
6858            Error::MaskButterworthError,
6859        )
6860    }
6861}
6862
6863/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6864/// width: `i32` -> Image width in pixels
6865/// min: 1, max: 100000000, default: 1
6866/// height: `i32` -> Image height in pixels
6867/// min: 1, max: 100000000, default: 1
6868/// order: `f64` -> Filter order
6869/// min: 1, max: 1000000, default: 1
6870/// frequency_cutoff: `f64` -> Frequency cutoff
6871/// min: 0, max: 1000000, default: 0.5
6872/// amplitude_cutoff: `f64` -> Amplitude cutoff
6873/// min: 0, max: 1, default: 0.5
6874/// ringwidth: `f64` -> Ringwidth
6875/// min: 0, max: 1000000, default: 0.1
6876/// returns `VipsImage` - Output image
6877pub fn mask_butterworth_ring(
6878    width: i32,
6879    height: i32,
6880    order: f64,
6881    frequency_cutoff: f64,
6882    amplitude_cutoff: f64,
6883    ringwidth: f64,
6884) -> Result<VipsImage> {
6885    unsafe {
6886        let width_in: i32 = width;
6887        let height_in: i32 = height;
6888        let order_in: f64 = order;
6889        let frequency_cutoff_in: f64 = frequency_cutoff;
6890        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6891        let ringwidth_in: f64 = ringwidth;
6892        let mut out_out: *mut bindings::VipsImage = null_mut();
6893
6894        let vips_op_response = bindings::vips_mask_butterworth_ring(
6895            &mut out_out,
6896            width_in,
6897            height_in,
6898            order_in,
6899            frequency_cutoff_in,
6900            amplitude_cutoff_in,
6901            ringwidth_in,
6902            NULL,
6903        );
6904        utils::result(
6905            vips_op_response,
6906            VipsImage { ctx: out_out },
6907            Error::MaskButterworthRingError,
6908        )
6909    }
6910}
6911
6912/// Options for mask_butterworth_ring operation
6913#[derive(Clone, Debug)]
6914pub struct MaskButterworthRingOptions {
6915    /// uchar: `bool` -> Output an unsigned char image
6916    /// default: false
6917    pub uchar: bool,
6918    /// nodc: `bool` -> Remove DC component
6919    /// default: false
6920    pub nodc: bool,
6921    /// reject: `bool` -> Invert the sense of the filter
6922    /// default: false
6923    pub reject: bool,
6924    /// optical: `bool` -> Rotate quadrants to optical space
6925    /// default: false
6926    pub optical: bool,
6927}
6928
6929impl std::default::Default for MaskButterworthRingOptions {
6930    fn default() -> Self {
6931        MaskButterworthRingOptions {
6932            uchar: false,
6933            nodc: false,
6934            reject: false,
6935            optical: false,
6936        }
6937    }
6938}
6939
6940/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6941/// width: `i32` -> Image width in pixels
6942/// min: 1, max: 100000000, default: 1
6943/// height: `i32` -> Image height in pixels
6944/// min: 1, max: 100000000, default: 1
6945/// order: `f64` -> Filter order
6946/// min: 1, max: 1000000, default: 1
6947/// frequency_cutoff: `f64` -> Frequency cutoff
6948/// min: 0, max: 1000000, default: 0.5
6949/// amplitude_cutoff: `f64` -> Amplitude cutoff
6950/// min: 0, max: 1, default: 0.5
6951/// ringwidth: `f64` -> Ringwidth
6952/// min: 0, max: 1000000, default: 0.1
6953/// mask_butterworth_ring_options: `&MaskButterworthRingOptions` -> optional arguments
6954/// returns `VipsImage` - Output image
6955pub fn mask_butterworth_ring_with_opts(
6956    width: i32,
6957    height: i32,
6958    order: f64,
6959    frequency_cutoff: f64,
6960    amplitude_cutoff: f64,
6961    ringwidth: f64,
6962    mask_butterworth_ring_options: &MaskButterworthRingOptions,
6963) -> Result<VipsImage> {
6964    unsafe {
6965        let width_in: i32 = width;
6966        let height_in: i32 = height;
6967        let order_in: f64 = order;
6968        let frequency_cutoff_in: f64 = frequency_cutoff;
6969        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6970        let ringwidth_in: f64 = ringwidth;
6971        let mut out_out: *mut bindings::VipsImage = null_mut();
6972
6973        let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6974            1
6975        } else {
6976            0
6977        };
6978        let uchar_in_name = utils::new_c_string("uchar")?;
6979
6980        let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6981            1
6982        } else {
6983            0
6984        };
6985        let nodc_in_name = utils::new_c_string("nodc")?;
6986
6987        let reject_in: i32 = if mask_butterworth_ring_options.reject {
6988            1
6989        } else {
6990            0
6991        };
6992        let reject_in_name = utils::new_c_string("reject")?;
6993
6994        let optical_in: i32 = if mask_butterworth_ring_options.optical {
6995            1
6996        } else {
6997            0
6998        };
6999        let optical_in_name = utils::new_c_string("optical")?;
7000
7001        let vips_op_response = bindings::vips_mask_butterworth_ring(
7002            &mut out_out,
7003            width_in,
7004            height_in,
7005            order_in,
7006            frequency_cutoff_in,
7007            amplitude_cutoff_in,
7008            ringwidth_in,
7009            uchar_in_name.as_ptr(),
7010            uchar_in,
7011            nodc_in_name.as_ptr(),
7012            nodc_in,
7013            reject_in_name.as_ptr(),
7014            reject_in,
7015            optical_in_name.as_ptr(),
7016            optical_in,
7017            NULL,
7018        );
7019        utils::result(
7020            vips_op_response,
7021            VipsImage { ctx: out_out },
7022            Error::MaskButterworthRingError,
7023        )
7024    }
7025}
7026
7027/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
7028/// width: `i32` -> Image width in pixels
7029/// min: 1, max: 100000000, default: 1
7030/// height: `i32` -> Image height in pixels
7031/// min: 1, max: 100000000, default: 1
7032/// order: `f64` -> Filter order
7033/// min: 1, max: 1000000, default: 1
7034/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7035/// min: 0, max: 1000000, default: 0.5
7036/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7037/// min: 0, max: 1000000, default: 0.5
7038/// radius: `f64` -> Radius of circle
7039/// min: 0, max: 1000000, default: 0.1
7040/// amplitude_cutoff: `f64` -> Amplitude cutoff
7041/// min: 0, max: 1, default: 0.5
7042/// returns `VipsImage` - Output image
7043pub fn mask_butterworth_band(
7044    width: i32,
7045    height: i32,
7046    order: f64,
7047    frequency_cutoff_x: f64,
7048    frequency_cutoff_y: f64,
7049    radius: f64,
7050    amplitude_cutoff: f64,
7051) -> Result<VipsImage> {
7052    unsafe {
7053        let width_in: i32 = width;
7054        let height_in: i32 = height;
7055        let order_in: f64 = order;
7056        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7057        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7058        let radius_in: f64 = radius;
7059        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7060        let mut out_out: *mut bindings::VipsImage = null_mut();
7061
7062        let vips_op_response = bindings::vips_mask_butterworth_band(
7063            &mut out_out,
7064            width_in,
7065            height_in,
7066            order_in,
7067            frequency_cutoff_x_in,
7068            frequency_cutoff_y_in,
7069            radius_in,
7070            amplitude_cutoff_in,
7071            NULL,
7072        );
7073        utils::result(
7074            vips_op_response,
7075            VipsImage { ctx: out_out },
7076            Error::MaskButterworthBandError,
7077        )
7078    }
7079}
7080
7081/// Options for mask_butterworth_band operation
7082#[derive(Clone, Debug)]
7083pub struct MaskButterworthBandOptions {
7084    /// uchar: `bool` -> Output an unsigned char image
7085    /// default: false
7086    pub uchar: bool,
7087    /// nodc: `bool` -> Remove DC component
7088    /// default: false
7089    pub nodc: bool,
7090    /// reject: `bool` -> Invert the sense of the filter
7091    /// default: false
7092    pub reject: bool,
7093    /// optical: `bool` -> Rotate quadrants to optical space
7094    /// default: false
7095    pub optical: bool,
7096}
7097
7098impl std::default::Default for MaskButterworthBandOptions {
7099    fn default() -> Self {
7100        MaskButterworthBandOptions {
7101            uchar: false,
7102            nodc: false,
7103            reject: false,
7104            optical: false,
7105        }
7106    }
7107}
7108
7109/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
7110/// width: `i32` -> Image width in pixels
7111/// min: 1, max: 100000000, default: 1
7112/// height: `i32` -> Image height in pixels
7113/// min: 1, max: 100000000, default: 1
7114/// order: `f64` -> Filter order
7115/// min: 1, max: 1000000, default: 1
7116/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7117/// min: 0, max: 1000000, default: 0.5
7118/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7119/// min: 0, max: 1000000, default: 0.5
7120/// radius: `f64` -> Radius of circle
7121/// min: 0, max: 1000000, default: 0.1
7122/// amplitude_cutoff: `f64` -> Amplitude cutoff
7123/// min: 0, max: 1, default: 0.5
7124/// mask_butterworth_band_options: `&MaskButterworthBandOptions` -> optional arguments
7125/// returns `VipsImage` - Output image
7126pub fn mask_butterworth_band_with_opts(
7127    width: i32,
7128    height: i32,
7129    order: f64,
7130    frequency_cutoff_x: f64,
7131    frequency_cutoff_y: f64,
7132    radius: f64,
7133    amplitude_cutoff: f64,
7134    mask_butterworth_band_options: &MaskButterworthBandOptions,
7135) -> Result<VipsImage> {
7136    unsafe {
7137        let width_in: i32 = width;
7138        let height_in: i32 = height;
7139        let order_in: f64 = order;
7140        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7141        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7142        let radius_in: f64 = radius;
7143        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7144        let mut out_out: *mut bindings::VipsImage = null_mut();
7145
7146        let uchar_in: i32 = if mask_butterworth_band_options.uchar {
7147            1
7148        } else {
7149            0
7150        };
7151        let uchar_in_name = utils::new_c_string("uchar")?;
7152
7153        let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7154            1
7155        } else {
7156            0
7157        };
7158        let nodc_in_name = utils::new_c_string("nodc")?;
7159
7160        let reject_in: i32 = if mask_butterworth_band_options.reject {
7161            1
7162        } else {
7163            0
7164        };
7165        let reject_in_name = utils::new_c_string("reject")?;
7166
7167        let optical_in: i32 = if mask_butterworth_band_options.optical {
7168            1
7169        } else {
7170            0
7171        };
7172        let optical_in_name = utils::new_c_string("optical")?;
7173
7174        let vips_op_response = bindings::vips_mask_butterworth_band(
7175            &mut out_out,
7176            width_in,
7177            height_in,
7178            order_in,
7179            frequency_cutoff_x_in,
7180            frequency_cutoff_y_in,
7181            radius_in,
7182            amplitude_cutoff_in,
7183            uchar_in_name.as_ptr(),
7184            uchar_in,
7185            nodc_in_name.as_ptr(),
7186            nodc_in,
7187            reject_in_name.as_ptr(),
7188            reject_in,
7189            optical_in_name.as_ptr(),
7190            optical_in,
7191            NULL,
7192        );
7193        utils::result(
7194            vips_op_response,
7195            VipsImage { ctx: out_out },
7196            Error::MaskButterworthBandError,
7197        )
7198    }
7199}
7200
7201/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7202/// width: `i32` -> Image width in pixels
7203/// min: 1, max: 100000000, default: 1
7204/// height: `i32` -> Image height in pixels
7205/// min: 1, max: 100000000, default: 1
7206/// frequency_cutoff: `f64` -> Frequency cutoff
7207/// min: 0, max: 1000000, default: 0.5
7208/// amplitude_cutoff: `f64` -> Amplitude cutoff
7209/// min: 0, max: 1, default: 0.5
7210/// returns `VipsImage` - Output image
7211pub fn mask_gaussian(
7212    width: i32,
7213    height: i32,
7214    frequency_cutoff: f64,
7215    amplitude_cutoff: f64,
7216) -> Result<VipsImage> {
7217    unsafe {
7218        let width_in: i32 = width;
7219        let height_in: i32 = height;
7220        let frequency_cutoff_in: f64 = frequency_cutoff;
7221        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7222        let mut out_out: *mut bindings::VipsImage = null_mut();
7223
7224        let vips_op_response = bindings::vips_mask_gaussian(
7225            &mut out_out,
7226            width_in,
7227            height_in,
7228            frequency_cutoff_in,
7229            amplitude_cutoff_in,
7230            NULL,
7231        );
7232        utils::result(
7233            vips_op_response,
7234            VipsImage { ctx: out_out },
7235            Error::MaskGaussianError,
7236        )
7237    }
7238}
7239
7240/// Options for mask_gaussian operation
7241#[derive(Clone, Debug)]
7242pub struct MaskGaussianOptions {
7243    /// uchar: `bool` -> Output an unsigned char image
7244    /// default: false
7245    pub uchar: bool,
7246    /// nodc: `bool` -> Remove DC component
7247    /// default: false
7248    pub nodc: bool,
7249    /// reject: `bool` -> Invert the sense of the filter
7250    /// default: false
7251    pub reject: bool,
7252    /// optical: `bool` -> Rotate quadrants to optical space
7253    /// default: false
7254    pub optical: bool,
7255}
7256
7257impl std::default::Default for MaskGaussianOptions {
7258    fn default() -> Self {
7259        MaskGaussianOptions {
7260            uchar: false,
7261            nodc: false,
7262            reject: false,
7263            optical: false,
7264        }
7265    }
7266}
7267
7268/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7269/// width: `i32` -> Image width in pixels
7270/// min: 1, max: 100000000, default: 1
7271/// height: `i32` -> Image height in pixels
7272/// min: 1, max: 100000000, default: 1
7273/// frequency_cutoff: `f64` -> Frequency cutoff
7274/// min: 0, max: 1000000, default: 0.5
7275/// amplitude_cutoff: `f64` -> Amplitude cutoff
7276/// min: 0, max: 1, default: 0.5
7277/// mask_gaussian_options: `&MaskGaussianOptions` -> optional arguments
7278/// returns `VipsImage` - Output image
7279pub fn mask_gaussian_with_opts(
7280    width: i32,
7281    height: i32,
7282    frequency_cutoff: f64,
7283    amplitude_cutoff: f64,
7284    mask_gaussian_options: &MaskGaussianOptions,
7285) -> Result<VipsImage> {
7286    unsafe {
7287        let width_in: i32 = width;
7288        let height_in: i32 = height;
7289        let frequency_cutoff_in: f64 = frequency_cutoff;
7290        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7291        let mut out_out: *mut bindings::VipsImage = null_mut();
7292
7293        let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7294        let uchar_in_name = utils::new_c_string("uchar")?;
7295
7296        let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7297        let nodc_in_name = utils::new_c_string("nodc")?;
7298
7299        let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7300        let reject_in_name = utils::new_c_string("reject")?;
7301
7302        let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7303        let optical_in_name = utils::new_c_string("optical")?;
7304
7305        let vips_op_response = bindings::vips_mask_gaussian(
7306            &mut out_out,
7307            width_in,
7308            height_in,
7309            frequency_cutoff_in,
7310            amplitude_cutoff_in,
7311            uchar_in_name.as_ptr(),
7312            uchar_in,
7313            nodc_in_name.as_ptr(),
7314            nodc_in,
7315            reject_in_name.as_ptr(),
7316            reject_in,
7317            optical_in_name.as_ptr(),
7318            optical_in,
7319            NULL,
7320        );
7321        utils::result(
7322            vips_op_response,
7323            VipsImage { ctx: out_out },
7324            Error::MaskGaussianError,
7325        )
7326    }
7327}
7328
7329/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7330/// width: `i32` -> Image width in pixels
7331/// min: 1, max: 100000000, default: 1
7332/// height: `i32` -> Image height in pixels
7333/// min: 1, max: 100000000, default: 1
7334/// frequency_cutoff: `f64` -> Frequency cutoff
7335/// min: 0, max: 1000000, default: 0.5
7336/// amplitude_cutoff: `f64` -> Amplitude cutoff
7337/// min: 0, max: 1, default: 0.5
7338/// ringwidth: `f64` -> Ringwidth
7339/// min: 0, max: 1000000, default: 0.5
7340/// returns `VipsImage` - Output image
7341pub fn mask_gaussian_ring(
7342    width: i32,
7343    height: i32,
7344    frequency_cutoff: f64,
7345    amplitude_cutoff: f64,
7346    ringwidth: f64,
7347) -> Result<VipsImage> {
7348    unsafe {
7349        let width_in: i32 = width;
7350        let height_in: i32 = height;
7351        let frequency_cutoff_in: f64 = frequency_cutoff;
7352        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7353        let ringwidth_in: f64 = ringwidth;
7354        let mut out_out: *mut bindings::VipsImage = null_mut();
7355
7356        let vips_op_response = bindings::vips_mask_gaussian_ring(
7357            &mut out_out,
7358            width_in,
7359            height_in,
7360            frequency_cutoff_in,
7361            amplitude_cutoff_in,
7362            ringwidth_in,
7363            NULL,
7364        );
7365        utils::result(
7366            vips_op_response,
7367            VipsImage { ctx: out_out },
7368            Error::MaskGaussianRingError,
7369        )
7370    }
7371}
7372
7373/// Options for mask_gaussian_ring operation
7374#[derive(Clone, Debug)]
7375pub struct MaskGaussianRingOptions {
7376    /// uchar: `bool` -> Output an unsigned char image
7377    /// default: false
7378    pub uchar: bool,
7379    /// nodc: `bool` -> Remove DC component
7380    /// default: false
7381    pub nodc: bool,
7382    /// reject: `bool` -> Invert the sense of the filter
7383    /// default: false
7384    pub reject: bool,
7385    /// optical: `bool` -> Rotate quadrants to optical space
7386    /// default: false
7387    pub optical: bool,
7388}
7389
7390impl std::default::Default for MaskGaussianRingOptions {
7391    fn default() -> Self {
7392        MaskGaussianRingOptions {
7393            uchar: false,
7394            nodc: false,
7395            reject: false,
7396            optical: false,
7397        }
7398    }
7399}
7400
7401/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7402/// width: `i32` -> Image width in pixels
7403/// min: 1, max: 100000000, default: 1
7404/// height: `i32` -> Image height in pixels
7405/// min: 1, max: 100000000, default: 1
7406/// frequency_cutoff: `f64` -> Frequency cutoff
7407/// min: 0, max: 1000000, default: 0.5
7408/// amplitude_cutoff: `f64` -> Amplitude cutoff
7409/// min: 0, max: 1, default: 0.5
7410/// ringwidth: `f64` -> Ringwidth
7411/// min: 0, max: 1000000, default: 0.5
7412/// mask_gaussian_ring_options: `&MaskGaussianRingOptions` -> optional arguments
7413/// returns `VipsImage` - Output image
7414pub fn mask_gaussian_ring_with_opts(
7415    width: i32,
7416    height: i32,
7417    frequency_cutoff: f64,
7418    amplitude_cutoff: f64,
7419    ringwidth: f64,
7420    mask_gaussian_ring_options: &MaskGaussianRingOptions,
7421) -> Result<VipsImage> {
7422    unsafe {
7423        let width_in: i32 = width;
7424        let height_in: i32 = height;
7425        let frequency_cutoff_in: f64 = frequency_cutoff;
7426        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7427        let ringwidth_in: f64 = ringwidth;
7428        let mut out_out: *mut bindings::VipsImage = null_mut();
7429
7430        let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7431            1
7432        } else {
7433            0
7434        };
7435        let uchar_in_name = utils::new_c_string("uchar")?;
7436
7437        let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7438            1
7439        } else {
7440            0
7441        };
7442        let nodc_in_name = utils::new_c_string("nodc")?;
7443
7444        let reject_in: i32 = if mask_gaussian_ring_options.reject {
7445            1
7446        } else {
7447            0
7448        };
7449        let reject_in_name = utils::new_c_string("reject")?;
7450
7451        let optical_in: i32 = if mask_gaussian_ring_options.optical {
7452            1
7453        } else {
7454            0
7455        };
7456        let optical_in_name = utils::new_c_string("optical")?;
7457
7458        let vips_op_response = bindings::vips_mask_gaussian_ring(
7459            &mut out_out,
7460            width_in,
7461            height_in,
7462            frequency_cutoff_in,
7463            amplitude_cutoff_in,
7464            ringwidth_in,
7465            uchar_in_name.as_ptr(),
7466            uchar_in,
7467            nodc_in_name.as_ptr(),
7468            nodc_in,
7469            reject_in_name.as_ptr(),
7470            reject_in,
7471            optical_in_name.as_ptr(),
7472            optical_in,
7473            NULL,
7474        );
7475        utils::result(
7476            vips_op_response,
7477            VipsImage { ctx: out_out },
7478            Error::MaskGaussianRingError,
7479        )
7480    }
7481}
7482
7483/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7484/// width: `i32` -> Image width in pixels
7485/// min: 1, max: 100000000, default: 1
7486/// height: `i32` -> Image height in pixels
7487/// min: 1, max: 100000000, default: 1
7488/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7489/// min: 0, max: 1000000, default: 0.5
7490/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7491/// min: 0, max: 1000000, default: 0.5
7492/// radius: `f64` -> Radius of circle
7493/// min: 0, max: 1000000, default: 0.1
7494/// amplitude_cutoff: `f64` -> Amplitude cutoff
7495/// min: 0, max: 1, default: 0.5
7496/// returns `VipsImage` - Output image
7497pub fn mask_gaussian_band(
7498    width: i32,
7499    height: i32,
7500    frequency_cutoff_x: f64,
7501    frequency_cutoff_y: f64,
7502    radius: f64,
7503    amplitude_cutoff: f64,
7504) -> Result<VipsImage> {
7505    unsafe {
7506        let width_in: i32 = width;
7507        let height_in: i32 = height;
7508        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7509        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7510        let radius_in: f64 = radius;
7511        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7512        let mut out_out: *mut bindings::VipsImage = null_mut();
7513
7514        let vips_op_response = bindings::vips_mask_gaussian_band(
7515            &mut out_out,
7516            width_in,
7517            height_in,
7518            frequency_cutoff_x_in,
7519            frequency_cutoff_y_in,
7520            radius_in,
7521            amplitude_cutoff_in,
7522            NULL,
7523        );
7524        utils::result(
7525            vips_op_response,
7526            VipsImage { ctx: out_out },
7527            Error::MaskGaussianBandError,
7528        )
7529    }
7530}
7531
7532/// Options for mask_gaussian_band operation
7533#[derive(Clone, Debug)]
7534pub struct MaskGaussianBandOptions {
7535    /// uchar: `bool` -> Output an unsigned char image
7536    /// default: false
7537    pub uchar: bool,
7538    /// nodc: `bool` -> Remove DC component
7539    /// default: false
7540    pub nodc: bool,
7541    /// reject: `bool` -> Invert the sense of the filter
7542    /// default: false
7543    pub reject: bool,
7544    /// optical: `bool` -> Rotate quadrants to optical space
7545    /// default: false
7546    pub optical: bool,
7547}
7548
7549impl std::default::Default for MaskGaussianBandOptions {
7550    fn default() -> Self {
7551        MaskGaussianBandOptions {
7552            uchar: false,
7553            nodc: false,
7554            reject: false,
7555            optical: false,
7556        }
7557    }
7558}
7559
7560/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7561/// width: `i32` -> Image width in pixels
7562/// min: 1, max: 100000000, default: 1
7563/// height: `i32` -> Image height in pixels
7564/// min: 1, max: 100000000, default: 1
7565/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7566/// min: 0, max: 1000000, default: 0.5
7567/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7568/// min: 0, max: 1000000, default: 0.5
7569/// radius: `f64` -> Radius of circle
7570/// min: 0, max: 1000000, default: 0.1
7571/// amplitude_cutoff: `f64` -> Amplitude cutoff
7572/// min: 0, max: 1, default: 0.5
7573/// mask_gaussian_band_options: `&MaskGaussianBandOptions` -> optional arguments
7574/// returns `VipsImage` - Output image
7575pub fn mask_gaussian_band_with_opts(
7576    width: i32,
7577    height: i32,
7578    frequency_cutoff_x: f64,
7579    frequency_cutoff_y: f64,
7580    radius: f64,
7581    amplitude_cutoff: f64,
7582    mask_gaussian_band_options: &MaskGaussianBandOptions,
7583) -> Result<VipsImage> {
7584    unsafe {
7585        let width_in: i32 = width;
7586        let height_in: i32 = height;
7587        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7588        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7589        let radius_in: f64 = radius;
7590        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7591        let mut out_out: *mut bindings::VipsImage = null_mut();
7592
7593        let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7594            1
7595        } else {
7596            0
7597        };
7598        let uchar_in_name = utils::new_c_string("uchar")?;
7599
7600        let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7601            1
7602        } else {
7603            0
7604        };
7605        let nodc_in_name = utils::new_c_string("nodc")?;
7606
7607        let reject_in: i32 = if mask_gaussian_band_options.reject {
7608            1
7609        } else {
7610            0
7611        };
7612        let reject_in_name = utils::new_c_string("reject")?;
7613
7614        let optical_in: i32 = if mask_gaussian_band_options.optical {
7615            1
7616        } else {
7617            0
7618        };
7619        let optical_in_name = utils::new_c_string("optical")?;
7620
7621        let vips_op_response = bindings::vips_mask_gaussian_band(
7622            &mut out_out,
7623            width_in,
7624            height_in,
7625            frequency_cutoff_x_in,
7626            frequency_cutoff_y_in,
7627            radius_in,
7628            amplitude_cutoff_in,
7629            uchar_in_name.as_ptr(),
7630            uchar_in,
7631            nodc_in_name.as_ptr(),
7632            nodc_in,
7633            reject_in_name.as_ptr(),
7634            reject_in,
7635            optical_in_name.as_ptr(),
7636            optical_in,
7637            NULL,
7638        );
7639        utils::result(
7640            vips_op_response,
7641            VipsImage { ctx: out_out },
7642            Error::MaskGaussianBandError,
7643        )
7644    }
7645}
7646
7647/// VipsMaskFractal (mask_fractal), make fractal filter
7648/// width: `i32` -> Image width in pixels
7649/// min: 1, max: 100000000, default: 1
7650/// height: `i32` -> Image height in pixels
7651/// min: 1, max: 100000000, default: 1
7652/// fractal_dimension: `f64` -> Fractal dimension
7653/// min: 2, max: 3, default: 2.5
7654/// returns `VipsImage` - Output image
7655pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7656    unsafe {
7657        let width_in: i32 = width;
7658        let height_in: i32 = height;
7659        let fractal_dimension_in: f64 = fractal_dimension;
7660        let mut out_out: *mut bindings::VipsImage = null_mut();
7661
7662        let vips_op_response = bindings::vips_mask_fractal(
7663            &mut out_out,
7664            width_in,
7665            height_in,
7666            fractal_dimension_in,
7667            NULL,
7668        );
7669        utils::result(
7670            vips_op_response,
7671            VipsImage { ctx: out_out },
7672            Error::MaskFractalError,
7673        )
7674    }
7675}
7676
7677/// Options for mask_fractal operation
7678#[derive(Clone, Debug)]
7679pub struct MaskFractalOptions {
7680    /// uchar: `bool` -> Output an unsigned char image
7681    /// default: false
7682    pub uchar: bool,
7683    /// nodc: `bool` -> Remove DC component
7684    /// default: false
7685    pub nodc: bool,
7686    /// reject: `bool` -> Invert the sense of the filter
7687    /// default: false
7688    pub reject: bool,
7689    /// optical: `bool` -> Rotate quadrants to optical space
7690    /// default: false
7691    pub optical: bool,
7692}
7693
7694impl std::default::Default for MaskFractalOptions {
7695    fn default() -> Self {
7696        MaskFractalOptions {
7697            uchar: false,
7698            nodc: false,
7699            reject: false,
7700            optical: false,
7701        }
7702    }
7703}
7704
7705/// VipsMaskFractal (mask_fractal), make fractal filter
7706/// width: `i32` -> Image width in pixels
7707/// min: 1, max: 100000000, default: 1
7708/// height: `i32` -> Image height in pixels
7709/// min: 1, max: 100000000, default: 1
7710/// fractal_dimension: `f64` -> Fractal dimension
7711/// min: 2, max: 3, default: 2.5
7712/// mask_fractal_options: `&MaskFractalOptions` -> optional arguments
7713/// returns `VipsImage` - Output image
7714pub fn mask_fractal_with_opts(
7715    width: i32,
7716    height: i32,
7717    fractal_dimension: f64,
7718    mask_fractal_options: &MaskFractalOptions,
7719) -> Result<VipsImage> {
7720    unsafe {
7721        let width_in: i32 = width;
7722        let height_in: i32 = height;
7723        let fractal_dimension_in: f64 = fractal_dimension;
7724        let mut out_out: *mut bindings::VipsImage = null_mut();
7725
7726        let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7727        let uchar_in_name = utils::new_c_string("uchar")?;
7728
7729        let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7730        let nodc_in_name = utils::new_c_string("nodc")?;
7731
7732        let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7733        let reject_in_name = utils::new_c_string("reject")?;
7734
7735        let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7736        let optical_in_name = utils::new_c_string("optical")?;
7737
7738        let vips_op_response = bindings::vips_mask_fractal(
7739            &mut out_out,
7740            width_in,
7741            height_in,
7742            fractal_dimension_in,
7743            uchar_in_name.as_ptr(),
7744            uchar_in,
7745            nodc_in_name.as_ptr(),
7746            nodc_in,
7747            reject_in_name.as_ptr(),
7748            reject_in,
7749            optical_in_name.as_ptr(),
7750            optical_in,
7751            NULL,
7752        );
7753        utils::result(
7754            vips_op_response,
7755            VipsImage { ctx: out_out },
7756            Error::MaskFractalError,
7757        )
7758    }
7759}
7760
7761/// VipsBuildlut (buildlut), build a look-up table
7762/// inp: `&VipsImage` -> Matrix of XY coordinates
7763/// returns `VipsImage` - Output image
7764pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7765    unsafe {
7766        let inp_in: *mut bindings::VipsImage = inp.ctx;
7767        let mut out_out: *mut bindings::VipsImage = null_mut();
7768
7769        let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7770        utils::result(
7771            vips_op_response,
7772            VipsImage { ctx: out_out },
7773            Error::BuildlutError,
7774        )
7775    }
7776}
7777
7778/// VipsInvertlut (invertlut), build an inverted look-up table
7779/// inp: `&VipsImage` -> Matrix of XY coordinates
7780/// returns `VipsImage` - Output image
7781pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7782    unsafe {
7783        let inp_in: *mut bindings::VipsImage = inp.ctx;
7784        let mut out_out: *mut bindings::VipsImage = null_mut();
7785
7786        let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7787        utils::result(
7788            vips_op_response,
7789            VipsImage { ctx: out_out },
7790            Error::InvertlutError,
7791        )
7792    }
7793}
7794
7795/// Options for invertlut operation
7796#[derive(Clone, Debug)]
7797pub struct InvertlutOptions {
7798    /// size: `i32` -> LUT size to generate
7799    /// min: 1, max: 1000000, default: 256
7800    pub size: i32,
7801}
7802
7803impl std::default::Default for InvertlutOptions {
7804    fn default() -> Self {
7805        InvertlutOptions {
7806            size: i32::from(256),
7807        }
7808    }
7809}
7810
7811/// VipsInvertlut (invertlut), build an inverted look-up table
7812/// inp: `&VipsImage` -> Matrix of XY coordinates
7813/// invertlut_options: `&InvertlutOptions` -> optional arguments
7814/// returns `VipsImage` - Output image
7815pub fn invertlut_with_opts(
7816    inp: &VipsImage,
7817    invertlut_options: &InvertlutOptions,
7818) -> Result<VipsImage> {
7819    unsafe {
7820        let inp_in: *mut bindings::VipsImage = inp.ctx;
7821        let mut out_out: *mut bindings::VipsImage = null_mut();
7822
7823        let size_in: i32 = invertlut_options.size;
7824        let size_in_name = utils::new_c_string("size")?;
7825
7826        let vips_op_response =
7827            bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7828        utils::result(
7829            vips_op_response,
7830            VipsImage { ctx: out_out },
7831            Error::InvertlutError,
7832        )
7833    }
7834}
7835
7836/// VipsTonelut (tonelut), build a look-up table
7837
7838/// returns `VipsImage` - Output image
7839pub fn tonelut() -> Result<VipsImage> {
7840    unsafe {
7841        let mut out_out: *mut bindings::VipsImage = null_mut();
7842
7843        let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7844        utils::result(
7845            vips_op_response,
7846            VipsImage { ctx: out_out },
7847            Error::TonelutError,
7848        )
7849    }
7850}
7851
7852/// Options for tonelut operation
7853#[derive(Clone, Debug)]
7854pub struct TonelutOptions {
7855    /// in_max: `i32` -> Size of LUT to build
7856    /// min: 1, max: 65535, default: 32767
7857    pub in_max: i32,
7858    /// out_max: `i32` -> Maximum value in output LUT
7859    /// min: 1, max: 65535, default: 32767
7860    pub out_max: i32,
7861    /// lb: `f64` -> Lowest value in output
7862    /// min: 0, max: 100, default: 0
7863    pub lb: f64,
7864    /// lw: `f64` -> Highest value in output
7865    /// min: 0, max: 100, default: 100
7866    pub lw: f64,
7867    /// ps: `f64` -> Position of shadow
7868    /// min: 0, max: 1, default: 0.2
7869    pub ps: f64,
7870    /// pm: `f64` -> Position of mid-tones
7871    /// min: 0, max: 1, default: 0.5
7872    pub pm: f64,
7873    /// ph: `f64` -> Position of highlights
7874    /// min: 0, max: 1, default: 0.8
7875    pub ph: f64,
7876    /// s: `f64` -> Adjust shadows by this much
7877    /// min: -30, max: 30, default: 0
7878    pub s: f64,
7879    /// m: `f64` -> Adjust mid-tones by this much
7880    /// min: -30, max: 30, default: 0
7881    pub m: f64,
7882    /// h: `f64` -> Adjust highlights by this much
7883    /// min: -30, max: 30, default: 0
7884    pub h: f64,
7885}
7886
7887impl std::default::Default for TonelutOptions {
7888    fn default() -> Self {
7889        TonelutOptions {
7890            in_max: i32::from(32767),
7891            out_max: i32::from(32767),
7892            lb: f64::from(0),
7893            lw: f64::from(100),
7894            ps: f64::from(0.2),
7895            pm: f64::from(0.5),
7896            ph: f64::from(0.8),
7897            s: f64::from(0),
7898            m: f64::from(0),
7899            h: f64::from(0),
7900        }
7901    }
7902}
7903
7904/// VipsTonelut (tonelut), build a look-up table
7905
7906/// tonelut_options: `&TonelutOptions` -> optional arguments
7907/// returns `VipsImage` - Output image
7908pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7909    unsafe {
7910        let mut out_out: *mut bindings::VipsImage = null_mut();
7911
7912        let in_max_in: i32 = tonelut_options.in_max;
7913        let in_max_in_name = utils::new_c_string("in-max")?;
7914
7915        let out_max_in: i32 = tonelut_options.out_max;
7916        let out_max_in_name = utils::new_c_string("out-max")?;
7917
7918        let lb_in: f64 = tonelut_options.lb;
7919        let lb_in_name = utils::new_c_string("Lb")?;
7920
7921        let lw_in: f64 = tonelut_options.lw;
7922        let lw_in_name = utils::new_c_string("Lw")?;
7923
7924        let ps_in: f64 = tonelut_options.ps;
7925        let ps_in_name = utils::new_c_string("Ps")?;
7926
7927        let pm_in: f64 = tonelut_options.pm;
7928        let pm_in_name = utils::new_c_string("Pm")?;
7929
7930        let ph_in: f64 = tonelut_options.ph;
7931        let ph_in_name = utils::new_c_string("Ph")?;
7932
7933        let s_in: f64 = tonelut_options.s;
7934        let s_in_name = utils::new_c_string("S")?;
7935
7936        let m_in: f64 = tonelut_options.m;
7937        let m_in_name = utils::new_c_string("M")?;
7938
7939        let h_in: f64 = tonelut_options.h;
7940        let h_in_name = utils::new_c_string("H")?;
7941
7942        let vips_op_response = bindings::vips_tonelut(
7943            &mut out_out,
7944            in_max_in_name.as_ptr(),
7945            in_max_in,
7946            out_max_in_name.as_ptr(),
7947            out_max_in,
7948            lb_in_name.as_ptr(),
7949            lb_in,
7950            lw_in_name.as_ptr(),
7951            lw_in,
7952            ps_in_name.as_ptr(),
7953            ps_in,
7954            pm_in_name.as_ptr(),
7955            pm_in,
7956            ph_in_name.as_ptr(),
7957            ph_in,
7958            s_in_name.as_ptr(),
7959            s_in,
7960            m_in_name.as_ptr(),
7961            m_in,
7962            h_in_name.as_ptr(),
7963            h_in,
7964            NULL,
7965        );
7966        utils::result(
7967            vips_op_response,
7968            VipsImage { ctx: out_out },
7969            Error::TonelutError,
7970        )
7971    }
7972}
7973
7974/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7975
7976/// returns `VipsImage` - Output image
7977pub fn identity() -> Result<VipsImage> {
7978    unsafe {
7979        let mut out_out: *mut bindings::VipsImage = null_mut();
7980
7981        let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7982        utils::result(
7983            vips_op_response,
7984            VipsImage { ctx: out_out },
7985            Error::IdentityError,
7986        )
7987    }
7988}
7989
7990/// Options for identity operation
7991#[derive(Clone, Debug)]
7992pub struct IdentityOptions {
7993    /// bands: `i32` -> Number of bands in LUT
7994    /// min: 1, max: 100000, default: 1
7995    pub bands: i32,
7996    /// ushort: `bool` -> Create a 16-bit LUT
7997    /// default: false
7998    pub ushort: bool,
7999    /// size: `i32` -> Size of 16-bit LUT
8000    /// min: 1, max: 65536, default: 65536
8001    pub size: i32,
8002}
8003
8004impl std::default::Default for IdentityOptions {
8005    fn default() -> Self {
8006        IdentityOptions {
8007            bands: i32::from(1),
8008            ushort: false,
8009            size: i32::from(65536),
8010        }
8011    }
8012}
8013
8014/// VipsIdentity (identity), make a 1D image where pixel values are indexes
8015
8016/// identity_options: `&IdentityOptions` -> optional arguments
8017/// returns `VipsImage` - Output image
8018pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
8019    unsafe {
8020        let mut out_out: *mut bindings::VipsImage = null_mut();
8021
8022        let bands_in: i32 = identity_options.bands;
8023        let bands_in_name = utils::new_c_string("bands")?;
8024
8025        let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
8026        let ushort_in_name = utils::new_c_string("ushort")?;
8027
8028        let size_in: i32 = identity_options.size;
8029        let size_in_name = utils::new_c_string("size")?;
8030
8031        let vips_op_response = bindings::vips_identity(
8032            &mut out_out,
8033            bands_in_name.as_ptr(),
8034            bands_in,
8035            ushort_in_name.as_ptr(),
8036            ushort_in,
8037            size_in_name.as_ptr(),
8038            size_in,
8039            NULL,
8040        );
8041        utils::result(
8042            vips_op_response,
8043            VipsImage { ctx: out_out },
8044            Error::IdentityError,
8045        )
8046    }
8047}
8048
8049/// VipsFractsurf (fractsurf), make a fractal surface
8050/// width: `i32` -> Image width in pixels
8051/// min: 1, max: 100000000, default: 64
8052/// height: `i32` -> Image height in pixels
8053/// min: 1, max: 100000000, default: 64
8054/// fractal_dimension: `f64` -> Fractal dimension
8055/// min: 2, max: 3, default: 2.5
8056/// returns `VipsImage` - Output image
8057pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
8058    unsafe {
8059        let width_in: i32 = width;
8060        let height_in: i32 = height;
8061        let fractal_dimension_in: f64 = fractal_dimension;
8062        let mut out_out: *mut bindings::VipsImage = null_mut();
8063
8064        let vips_op_response = bindings::vips_fractsurf(
8065            &mut out_out,
8066            width_in,
8067            height_in,
8068            fractal_dimension_in,
8069            NULL,
8070        );
8071        utils::result(
8072            vips_op_response,
8073            VipsImage { ctx: out_out },
8074            Error::FractsurfError,
8075        )
8076    }
8077}
8078
8079/// VipsWorley (worley), make a worley noise image
8080/// width: `i32` -> Image width in pixels
8081/// min: 1, max: 100000000, default: 1
8082/// height: `i32` -> Image height in pixels
8083/// min: 1, max: 100000000, default: 1
8084/// returns `VipsImage` - Output image
8085pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
8086    unsafe {
8087        let width_in: i32 = width;
8088        let height_in: i32 = height;
8089        let mut out_out: *mut bindings::VipsImage = null_mut();
8090
8091        let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
8092        utils::result(
8093            vips_op_response,
8094            VipsImage { ctx: out_out },
8095            Error::WorleyError,
8096        )
8097    }
8098}
8099
8100/// Options for worley operation
8101#[derive(Clone, Debug)]
8102pub struct WorleyOptions {
8103    /// cell_size: `i32` -> Size of Worley cells
8104    /// min: 1, max: 100000000, default: 256
8105    pub cell_size: i32,
8106    /// seed: `i32` -> Random number seed
8107    /// min: -2147483648, max: 2147483647, default: 0
8108    pub seed: i32,
8109}
8110
8111impl std::default::Default for WorleyOptions {
8112    fn default() -> Self {
8113        WorleyOptions {
8114            cell_size: i32::from(256),
8115            seed: i32::from(0),
8116        }
8117    }
8118}
8119
8120/// VipsWorley (worley), make a worley noise image
8121/// width: `i32` -> Image width in pixels
8122/// min: 1, max: 100000000, default: 1
8123/// height: `i32` -> Image height in pixels
8124/// min: 1, max: 100000000, default: 1
8125/// worley_options: `&WorleyOptions` -> optional arguments
8126/// returns `VipsImage` - Output image
8127pub fn worley_with_opts(
8128    width: i32,
8129    height: i32,
8130    worley_options: &WorleyOptions,
8131) -> Result<VipsImage> {
8132    unsafe {
8133        let width_in: i32 = width;
8134        let height_in: i32 = height;
8135        let mut out_out: *mut bindings::VipsImage = null_mut();
8136
8137        let cell_size_in: i32 = worley_options.cell_size;
8138        let cell_size_in_name = utils::new_c_string("cell-size")?;
8139
8140        let seed_in: i32 = worley_options.seed;
8141        let seed_in_name = utils::new_c_string("seed")?;
8142
8143        let vips_op_response = bindings::vips_worley(
8144            &mut out_out,
8145            width_in,
8146            height_in,
8147            cell_size_in_name.as_ptr(),
8148            cell_size_in,
8149            seed_in_name.as_ptr(),
8150            seed_in,
8151            NULL,
8152        );
8153        utils::result(
8154            vips_op_response,
8155            VipsImage { ctx: out_out },
8156            Error::WorleyError,
8157        )
8158    }
8159}
8160
8161/// VipsPerlin (perlin), make a perlin noise image
8162/// width: `i32` -> Image width in pixels
8163/// min: 1, max: 100000000, default: 1
8164/// height: `i32` -> Image height in pixels
8165/// min: 1, max: 100000000, default: 1
8166/// returns `VipsImage` - Output image
8167pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8168    unsafe {
8169        let width_in: i32 = width;
8170        let height_in: i32 = height;
8171        let mut out_out: *mut bindings::VipsImage = null_mut();
8172
8173        let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8174        utils::result(
8175            vips_op_response,
8176            VipsImage { ctx: out_out },
8177            Error::PerlinError,
8178        )
8179    }
8180}
8181
8182/// Options for perlin operation
8183#[derive(Clone, Debug)]
8184pub struct PerlinOptions {
8185    /// cell_size: `i32` -> Size of Perlin cells
8186    /// min: 1, max: 100000000, default: 256
8187    pub cell_size: i32,
8188    /// uchar: `bool` -> Output an unsigned char image
8189    /// default: false
8190    pub uchar: bool,
8191    /// seed: `i32` -> Random number seed
8192    /// min: -2147483648, max: 2147483647, default: 0
8193    pub seed: i32,
8194}
8195
8196impl std::default::Default for PerlinOptions {
8197    fn default() -> Self {
8198        PerlinOptions {
8199            cell_size: i32::from(256),
8200            uchar: false,
8201            seed: i32::from(0),
8202        }
8203    }
8204}
8205
8206/// VipsPerlin (perlin), make a perlin noise image
8207/// width: `i32` -> Image width in pixels
8208/// min: 1, max: 100000000, default: 1
8209/// height: `i32` -> Image height in pixels
8210/// min: 1, max: 100000000, default: 1
8211/// perlin_options: `&PerlinOptions` -> optional arguments
8212/// returns `VipsImage` - Output image
8213pub fn perlin_with_opts(
8214    width: i32,
8215    height: i32,
8216    perlin_options: &PerlinOptions,
8217) -> Result<VipsImage> {
8218    unsafe {
8219        let width_in: i32 = width;
8220        let height_in: i32 = height;
8221        let mut out_out: *mut bindings::VipsImage = null_mut();
8222
8223        let cell_size_in: i32 = perlin_options.cell_size;
8224        let cell_size_in_name = utils::new_c_string("cell-size")?;
8225
8226        let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8227        let uchar_in_name = utils::new_c_string("uchar")?;
8228
8229        let seed_in: i32 = perlin_options.seed;
8230        let seed_in_name = utils::new_c_string("seed")?;
8231
8232        let vips_op_response = bindings::vips_perlin(
8233            &mut out_out,
8234            width_in,
8235            height_in,
8236            cell_size_in_name.as_ptr(),
8237            cell_size_in,
8238            uchar_in_name.as_ptr(),
8239            uchar_in,
8240            seed_in_name.as_ptr(),
8241            seed_in,
8242            NULL,
8243        );
8244        utils::result(
8245            vips_op_response,
8246            VipsImage { ctx: out_out },
8247            Error::PerlinError,
8248        )
8249    }
8250}
8251
8252/// VipsSwitch (switch), find the index of the first non-zero pixel in tests
8253/// tests: `&mut [VipsImage]` -> Table of images to test
8254/// returns `VipsImage` - Output image
8255pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8256    unsafe {
8257        let (tests_len, mut tests_in) = {
8258            let len = tests.len();
8259            let mut input = Vec::new();
8260            for img in tests {
8261                input.push(img.ctx)
8262            }
8263            (len as i32, input)
8264        };
8265        let mut out_out: *mut bindings::VipsImage = null_mut();
8266
8267        let vips_op_response =
8268            bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8269        utils::result(
8270            vips_op_response,
8271            VipsImage { ctx: out_out },
8272            Error::SwitchError,
8273        )
8274    }
8275}
8276
8277/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8278/// filename: `&str` -> Filename to load from
8279/// returns `VipsImage` - Output image
8280pub fn csvload(filename: &str) -> Result<VipsImage> {
8281    unsafe {
8282        let filename_in: CString = utils::new_c_string(filename)?;
8283        let mut out_out: *mut bindings::VipsImage = null_mut();
8284
8285        let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8286        utils::result(
8287            vips_op_response,
8288            VipsImage { ctx: out_out },
8289            Error::CsvloadError,
8290        )
8291    }
8292}
8293
8294/// Options for csvload operation
8295#[derive(Clone, Debug)]
8296pub struct CsvloadOptions {
8297    /// skip: `i32` -> Skip this many lines at the start of the file
8298    /// min: 0, max: 10000000, default: 0
8299    pub skip: i32,
8300    /// lines: `i32` -> Read this many lines from the file
8301    /// min: -1, max: 10000000, default: 0
8302    pub lines: i32,
8303    /// whitespace: `String` -> Set of whitespace characters
8304    pub whitespace: String,
8305    /// separator: `String` -> Set of separator characters
8306    pub separator: String,
8307    /// flags: `ForeignFlags` -> Flags for this file
8308    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8309    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8310    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8311    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8312    ///  `All` -> VIPS_FOREIGN_ALL = 7
8313    pub flags: ForeignFlags,
8314    /// memory: `bool` -> Force open via memory
8315    /// default: false
8316    pub memory: bool,
8317    /// access: `Access` -> Required access pattern for this file
8318    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8319    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8320    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8321    ///  `Last` -> VIPS_ACCESS_LAST = 3
8322    pub access: Access,
8323    /// fail_on: `FailOn` -> Error level to fail on
8324    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8325    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8326    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8327    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8328    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8329    pub fail_on: FailOn,
8330    /// revalidate: `bool` -> Don't use a cached result for this operation
8331    /// default: false
8332    pub revalidate: bool,
8333}
8334
8335impl std::default::Default for CsvloadOptions {
8336    fn default() -> Self {
8337        CsvloadOptions {
8338            skip: i32::from(0),
8339            lines: i32::from(0),
8340            whitespace: String::new(),
8341            separator: String::new(),
8342            flags: ForeignFlags::None,
8343            memory: false,
8344            access: Access::Random,
8345            fail_on: FailOn::None,
8346            revalidate: false,
8347        }
8348    }
8349}
8350
8351/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8352/// filename: `&str` -> Filename to load from
8353/// csvload_options: `&CsvloadOptions` -> optional arguments
8354/// returns `VipsImage` - Output image
8355pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8356    unsafe {
8357        let filename_in: CString = utils::new_c_string(filename)?;
8358        let mut out_out: *mut bindings::VipsImage = null_mut();
8359
8360        let skip_in: i32 = csvload_options.skip;
8361        let skip_in_name = utils::new_c_string("skip")?;
8362
8363        let lines_in: i32 = csvload_options.lines;
8364        let lines_in_name = utils::new_c_string("lines")?;
8365
8366        let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8367        let whitespace_in_name = utils::new_c_string("whitespace")?;
8368
8369        let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8370        let separator_in_name = utils::new_c_string("separator")?;
8371
8372        let flags_in: i32 = csvload_options.flags as i32;
8373        let flags_in_name = utils::new_c_string("flags")?;
8374
8375        let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8376        let memory_in_name = utils::new_c_string("memory")?;
8377
8378        let access_in: i32 = csvload_options.access as i32;
8379        let access_in_name = utils::new_c_string("access")?;
8380
8381        let fail_on_in: i32 = csvload_options.fail_on as i32;
8382        let fail_on_in_name = utils::new_c_string("fail-on")?;
8383
8384        let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8385        let revalidate_in_name = utils::new_c_string("revalidate")?;
8386
8387        let vips_op_response = bindings::vips_csvload(
8388            filename_in.as_ptr(),
8389            &mut out_out,
8390            skip_in_name.as_ptr(),
8391            skip_in,
8392            lines_in_name.as_ptr(),
8393            lines_in,
8394            whitespace_in_name.as_ptr(),
8395            whitespace_in.as_ptr(),
8396            separator_in_name.as_ptr(),
8397            separator_in.as_ptr(),
8398            flags_in_name.as_ptr(),
8399            flags_in,
8400            memory_in_name.as_ptr(),
8401            memory_in,
8402            access_in_name.as_ptr(),
8403            access_in,
8404            fail_on_in_name.as_ptr(),
8405            fail_on_in,
8406            revalidate_in_name.as_ptr(),
8407            revalidate_in,
8408            NULL,
8409        );
8410        utils::result(
8411            vips_op_response,
8412            VipsImage { ctx: out_out },
8413            Error::CsvloadError,
8414        )
8415    }
8416}
8417
8418/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8419/// source: `&VipsSource` -> Source to load from
8420/// returns `VipsImage` - Output image
8421pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8422    unsafe {
8423        let source_in: *mut bindings::VipsSource = source.ctx;
8424        let mut out_out: *mut bindings::VipsImage = null_mut();
8425
8426        let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8427        utils::result(
8428            vips_op_response,
8429            VipsImage { ctx: out_out },
8430            Error::CsvloadSourceError,
8431        )
8432    }
8433}
8434
8435/// Options for csvload_source operation
8436#[derive(Clone, Debug)]
8437pub struct CsvloadSourceOptions {
8438    /// skip: `i32` -> Skip this many lines at the start of the file
8439    /// min: 0, max: 10000000, default: 0
8440    pub skip: i32,
8441    /// lines: `i32` -> Read this many lines from the file
8442    /// min: -1, max: 10000000, default: 0
8443    pub lines: i32,
8444    /// whitespace: `String` -> Set of whitespace characters
8445    pub whitespace: String,
8446    /// separator: `String` -> Set of separator characters
8447    pub separator: String,
8448    /// flags: `ForeignFlags` -> Flags for this file
8449    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8450    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8451    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8452    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8453    ///  `All` -> VIPS_FOREIGN_ALL = 7
8454    pub flags: ForeignFlags,
8455    /// memory: `bool` -> Force open via memory
8456    /// default: false
8457    pub memory: bool,
8458    /// access: `Access` -> Required access pattern for this file
8459    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8460    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8461    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8462    ///  `Last` -> VIPS_ACCESS_LAST = 3
8463    pub access: Access,
8464    /// fail_on: `FailOn` -> Error level to fail on
8465    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8466    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8467    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8468    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8469    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8470    pub fail_on: FailOn,
8471    /// revalidate: `bool` -> Don't use a cached result for this operation
8472    /// default: false
8473    pub revalidate: bool,
8474}
8475
8476impl std::default::Default for CsvloadSourceOptions {
8477    fn default() -> Self {
8478        CsvloadSourceOptions {
8479            skip: i32::from(0),
8480            lines: i32::from(0),
8481            whitespace: String::new(),
8482            separator: String::new(),
8483            flags: ForeignFlags::None,
8484            memory: false,
8485            access: Access::Random,
8486            fail_on: FailOn::None,
8487            revalidate: false,
8488        }
8489    }
8490}
8491
8492/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8493/// source: `&VipsSource` -> Source to load from
8494/// csvload_source_options: `&CsvloadSourceOptions` -> optional arguments
8495/// returns `VipsImage` - Output image
8496pub fn csvload_source_with_opts(
8497    source: &VipsSource,
8498    csvload_source_options: &CsvloadSourceOptions,
8499) -> Result<VipsImage> {
8500    unsafe {
8501        let source_in: *mut bindings::VipsSource = source.ctx;
8502        let mut out_out: *mut bindings::VipsImage = null_mut();
8503
8504        let skip_in: i32 = csvload_source_options.skip;
8505        let skip_in_name = utils::new_c_string("skip")?;
8506
8507        let lines_in: i32 = csvload_source_options.lines;
8508        let lines_in_name = utils::new_c_string("lines")?;
8509
8510        let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8511        let whitespace_in_name = utils::new_c_string("whitespace")?;
8512
8513        let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8514        let separator_in_name = utils::new_c_string("separator")?;
8515
8516        let flags_in: i32 = csvload_source_options.flags as i32;
8517        let flags_in_name = utils::new_c_string("flags")?;
8518
8519        let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8520        let memory_in_name = utils::new_c_string("memory")?;
8521
8522        let access_in: i32 = csvload_source_options.access as i32;
8523        let access_in_name = utils::new_c_string("access")?;
8524
8525        let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8526        let fail_on_in_name = utils::new_c_string("fail-on")?;
8527
8528        let revalidate_in: i32 = if csvload_source_options.revalidate {
8529            1
8530        } else {
8531            0
8532        };
8533        let revalidate_in_name = utils::new_c_string("revalidate")?;
8534
8535        let vips_op_response = bindings::vips_csvload_source(
8536            source_in,
8537            &mut out_out,
8538            skip_in_name.as_ptr(),
8539            skip_in,
8540            lines_in_name.as_ptr(),
8541            lines_in,
8542            whitespace_in_name.as_ptr(),
8543            whitespace_in.as_ptr(),
8544            separator_in_name.as_ptr(),
8545            separator_in.as_ptr(),
8546            flags_in_name.as_ptr(),
8547            flags_in,
8548            memory_in_name.as_ptr(),
8549            memory_in,
8550            access_in_name.as_ptr(),
8551            access_in,
8552            fail_on_in_name.as_ptr(),
8553            fail_on_in,
8554            revalidate_in_name.as_ptr(),
8555            revalidate_in,
8556            NULL,
8557        );
8558        utils::result(
8559            vips_op_response,
8560            VipsImage { ctx: out_out },
8561            Error::CsvloadSourceError,
8562        )
8563    }
8564}
8565
8566/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8567/// filename: `&str` -> Filename to load from
8568/// returns `VipsImage` - Output image
8569pub fn matrixload(filename: &str) -> Result<VipsImage> {
8570    unsafe {
8571        let filename_in: CString = utils::new_c_string(filename)?;
8572        let mut out_out: *mut bindings::VipsImage = null_mut();
8573
8574        let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8575        utils::result(
8576            vips_op_response,
8577            VipsImage { ctx: out_out },
8578            Error::MatrixloadError,
8579        )
8580    }
8581}
8582
8583/// Options for matrixload operation
8584#[derive(Clone, Debug)]
8585pub struct MatrixloadOptions {
8586    /// flags: `ForeignFlags` -> Flags for this file
8587    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8588    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8589    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8590    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8591    ///  `All` -> VIPS_FOREIGN_ALL = 7
8592    pub flags: ForeignFlags,
8593    /// memory: `bool` -> Force open via memory
8594    /// default: false
8595    pub memory: bool,
8596    /// access: `Access` -> Required access pattern for this file
8597    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8598    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8599    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8600    ///  `Last` -> VIPS_ACCESS_LAST = 3
8601    pub access: Access,
8602    /// fail_on: `FailOn` -> Error level to fail on
8603    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8604    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8605    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8606    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8607    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8608    pub fail_on: FailOn,
8609    /// revalidate: `bool` -> Don't use a cached result for this operation
8610    /// default: false
8611    pub revalidate: bool,
8612}
8613
8614impl std::default::Default for MatrixloadOptions {
8615    fn default() -> Self {
8616        MatrixloadOptions {
8617            flags: ForeignFlags::None,
8618            memory: false,
8619            access: Access::Random,
8620            fail_on: FailOn::None,
8621            revalidate: false,
8622        }
8623    }
8624}
8625
8626/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8627/// filename: `&str` -> Filename to load from
8628/// matrixload_options: `&MatrixloadOptions` -> optional arguments
8629/// returns `VipsImage` - Output image
8630pub fn matrixload_with_opts(
8631    filename: &str,
8632    matrixload_options: &MatrixloadOptions,
8633) -> Result<VipsImage> {
8634    unsafe {
8635        let filename_in: CString = utils::new_c_string(filename)?;
8636        let mut out_out: *mut bindings::VipsImage = null_mut();
8637
8638        let flags_in: i32 = matrixload_options.flags as i32;
8639        let flags_in_name = utils::new_c_string("flags")?;
8640
8641        let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8642        let memory_in_name = utils::new_c_string("memory")?;
8643
8644        let access_in: i32 = matrixload_options.access as i32;
8645        let access_in_name = utils::new_c_string("access")?;
8646
8647        let fail_on_in: i32 = matrixload_options.fail_on as i32;
8648        let fail_on_in_name = utils::new_c_string("fail-on")?;
8649
8650        let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8651        let revalidate_in_name = utils::new_c_string("revalidate")?;
8652
8653        let vips_op_response = bindings::vips_matrixload(
8654            filename_in.as_ptr(),
8655            &mut out_out,
8656            flags_in_name.as_ptr(),
8657            flags_in,
8658            memory_in_name.as_ptr(),
8659            memory_in,
8660            access_in_name.as_ptr(),
8661            access_in,
8662            fail_on_in_name.as_ptr(),
8663            fail_on_in,
8664            revalidate_in_name.as_ptr(),
8665            revalidate_in,
8666            NULL,
8667        );
8668        utils::result(
8669            vips_op_response,
8670            VipsImage { ctx: out_out },
8671            Error::MatrixloadError,
8672        )
8673    }
8674}
8675
8676/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8677/// source: `&VipsSource` -> Source to load from
8678/// returns `VipsImage` - Output image
8679pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8680    unsafe {
8681        let source_in: *mut bindings::VipsSource = source.ctx;
8682        let mut out_out: *mut bindings::VipsImage = null_mut();
8683
8684        let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8685        utils::result(
8686            vips_op_response,
8687            VipsImage { ctx: out_out },
8688            Error::MatrixloadSourceError,
8689        )
8690    }
8691}
8692
8693/// Options for matrixload_source operation
8694#[derive(Clone, Debug)]
8695pub struct MatrixloadSourceOptions {
8696    /// flags: `ForeignFlags` -> Flags for this file
8697    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8698    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8699    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8700    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8701    ///  `All` -> VIPS_FOREIGN_ALL = 7
8702    pub flags: ForeignFlags,
8703    /// memory: `bool` -> Force open via memory
8704    /// default: false
8705    pub memory: bool,
8706    /// access: `Access` -> Required access pattern for this file
8707    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8708    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8709    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8710    ///  `Last` -> VIPS_ACCESS_LAST = 3
8711    pub access: Access,
8712    /// fail_on: `FailOn` -> Error level to fail on
8713    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8714    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8715    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8716    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8717    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8718    pub fail_on: FailOn,
8719    /// revalidate: `bool` -> Don't use a cached result for this operation
8720    /// default: false
8721    pub revalidate: bool,
8722}
8723
8724impl std::default::Default for MatrixloadSourceOptions {
8725    fn default() -> Self {
8726        MatrixloadSourceOptions {
8727            flags: ForeignFlags::None,
8728            memory: false,
8729            access: Access::Random,
8730            fail_on: FailOn::None,
8731            revalidate: false,
8732        }
8733    }
8734}
8735
8736/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8737/// source: `&VipsSource` -> Source to load from
8738/// matrixload_source_options: `&MatrixloadSourceOptions` -> optional arguments
8739/// returns `VipsImage` - Output image
8740pub fn matrixload_source_with_opts(
8741    source: &VipsSource,
8742    matrixload_source_options: &MatrixloadSourceOptions,
8743) -> Result<VipsImage> {
8744    unsafe {
8745        let source_in: *mut bindings::VipsSource = source.ctx;
8746        let mut out_out: *mut bindings::VipsImage = null_mut();
8747
8748        let flags_in: i32 = matrixload_source_options.flags as i32;
8749        let flags_in_name = utils::new_c_string("flags")?;
8750
8751        let memory_in: i32 = if matrixload_source_options.memory {
8752            1
8753        } else {
8754            0
8755        };
8756        let memory_in_name = utils::new_c_string("memory")?;
8757
8758        let access_in: i32 = matrixload_source_options.access as i32;
8759        let access_in_name = utils::new_c_string("access")?;
8760
8761        let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8762        let fail_on_in_name = utils::new_c_string("fail-on")?;
8763
8764        let revalidate_in: i32 = if matrixload_source_options.revalidate {
8765            1
8766        } else {
8767            0
8768        };
8769        let revalidate_in_name = utils::new_c_string("revalidate")?;
8770
8771        let vips_op_response = bindings::vips_matrixload_source(
8772            source_in,
8773            &mut out_out,
8774            flags_in_name.as_ptr(),
8775            flags_in,
8776            memory_in_name.as_ptr(),
8777            memory_in,
8778            access_in_name.as_ptr(),
8779            access_in,
8780            fail_on_in_name.as_ptr(),
8781            fail_on_in,
8782            revalidate_in_name.as_ptr(),
8783            revalidate_in,
8784            NULL,
8785        );
8786        utils::result(
8787            vips_op_response,
8788            VipsImage { ctx: out_out },
8789            Error::MatrixloadSourceError,
8790        )
8791    }
8792}
8793
8794/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8795/// filename: `&str` -> Filename to load from
8796/// width: `i32` -> Image width in pixels
8797/// min: 0, max: 100000000, default: 0
8798/// height: `i32` -> Image height in pixels
8799/// min: 0, max: 100000000, default: 0
8800/// bands: `i32` -> Number of bands in image
8801/// min: 0, max: 100000000, default: 0
8802/// returns `VipsImage` - Output image
8803pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8804    unsafe {
8805        let filename_in: CString = utils::new_c_string(filename)?;
8806        let width_in: i32 = width;
8807        let height_in: i32 = height;
8808        let bands_in: i32 = bands;
8809        let mut out_out: *mut bindings::VipsImage = null_mut();
8810
8811        let vips_op_response = bindings::vips_rawload(
8812            filename_in.as_ptr(),
8813            &mut out_out,
8814            width_in,
8815            height_in,
8816            bands_in,
8817            NULL,
8818        );
8819        utils::result(
8820            vips_op_response,
8821            VipsImage { ctx: out_out },
8822            Error::RawloadError,
8823        )
8824    }
8825}
8826
8827/// Options for rawload operation
8828#[derive(Clone, Debug)]
8829pub struct RawloadOptions {
8830    /// offset: `u64` -> Offset in bytes from start of file
8831    /// min: 0, max: 100000000000, default: 0
8832    pub offset: u64,
8833    /// format: `BandFormat` -> Pixel format in image
8834    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
8835    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
8836    ///  `Char` -> VIPS_FORMAT_CHAR = 1
8837    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
8838    ///  `Short` -> VIPS_FORMAT_SHORT = 3
8839    ///  `Uint` -> VIPS_FORMAT_UINT = 4
8840    ///  `Int` -> VIPS_FORMAT_INT = 5
8841    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
8842    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
8843    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
8844    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
8845    ///  `Last` -> VIPS_FORMAT_LAST = 10
8846    pub format: BandFormat,
8847    /// interpretation: `Interpretation` -> Pixel interpretation
8848    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
8849    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
8850    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
8851    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
8852    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
8853    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
8854    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
8855    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
8856    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
8857    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
8858    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
8859    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
8860    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
8861    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
8862    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
8863    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
8864    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
8865    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
8866    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
8867    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
8868    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
8869    pub interpretation: Interpretation,
8870    /// flags: `ForeignFlags` -> Flags for this file
8871    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8872    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8873    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8874    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8875    ///  `All` -> VIPS_FOREIGN_ALL = 7
8876    pub flags: ForeignFlags,
8877    /// memory: `bool` -> Force open via memory
8878    /// default: false
8879    pub memory: bool,
8880    /// access: `Access` -> Required access pattern for this file
8881    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8882    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8883    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8884    ///  `Last` -> VIPS_ACCESS_LAST = 3
8885    pub access: Access,
8886    /// fail_on: `FailOn` -> Error level to fail on
8887    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8888    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8889    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8890    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8891    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8892    pub fail_on: FailOn,
8893    /// revalidate: `bool` -> Don't use a cached result for this operation
8894    /// default: false
8895    pub revalidate: bool,
8896}
8897
8898impl std::default::Default for RawloadOptions {
8899    fn default() -> Self {
8900        RawloadOptions {
8901            offset: 0,
8902            format: BandFormat::Uchar,
8903            interpretation: Interpretation::Multiband,
8904            flags: ForeignFlags::None,
8905            memory: false,
8906            access: Access::Random,
8907            fail_on: FailOn::None,
8908            revalidate: false,
8909        }
8910    }
8911}
8912
8913/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8914/// filename: `&str` -> Filename to load from
8915/// width: `i32` -> Image width in pixels
8916/// min: 0, max: 100000000, default: 0
8917/// height: `i32` -> Image height in pixels
8918/// min: 0, max: 100000000, default: 0
8919/// bands: `i32` -> Number of bands in image
8920/// min: 0, max: 100000000, default: 0
8921/// rawload_options: `&RawloadOptions` -> optional arguments
8922/// returns `VipsImage` - Output image
8923pub fn rawload_with_opts(
8924    filename: &str,
8925    width: i32,
8926    height: i32,
8927    bands: i32,
8928    rawload_options: &RawloadOptions,
8929) -> Result<VipsImage> {
8930    unsafe {
8931        let filename_in: CString = utils::new_c_string(filename)?;
8932        let width_in: i32 = width;
8933        let height_in: i32 = height;
8934        let bands_in: i32 = bands;
8935        let mut out_out: *mut bindings::VipsImage = null_mut();
8936
8937        let offset_in: u64 = rawload_options.offset;
8938        let offset_in_name = utils::new_c_string("offset")?;
8939
8940        let format_in: i32 = rawload_options.format as i32;
8941        let format_in_name = utils::new_c_string("format")?;
8942
8943        let interpretation_in: i32 = rawload_options.interpretation as i32;
8944        let interpretation_in_name = utils::new_c_string("interpretation")?;
8945
8946        let flags_in: i32 = rawload_options.flags as i32;
8947        let flags_in_name = utils::new_c_string("flags")?;
8948
8949        let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8950        let memory_in_name = utils::new_c_string("memory")?;
8951
8952        let access_in: i32 = rawload_options.access as i32;
8953        let access_in_name = utils::new_c_string("access")?;
8954
8955        let fail_on_in: i32 = rawload_options.fail_on as i32;
8956        let fail_on_in_name = utils::new_c_string("fail-on")?;
8957
8958        let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8959        let revalidate_in_name = utils::new_c_string("revalidate")?;
8960
8961        let vips_op_response = bindings::vips_rawload(
8962            filename_in.as_ptr(),
8963            &mut out_out,
8964            width_in,
8965            height_in,
8966            bands_in,
8967            offset_in_name.as_ptr(),
8968            offset_in,
8969            format_in_name.as_ptr(),
8970            format_in,
8971            interpretation_in_name.as_ptr(),
8972            interpretation_in,
8973            flags_in_name.as_ptr(),
8974            flags_in,
8975            memory_in_name.as_ptr(),
8976            memory_in,
8977            access_in_name.as_ptr(),
8978            access_in,
8979            fail_on_in_name.as_ptr(),
8980            fail_on_in,
8981            revalidate_in_name.as_ptr(),
8982            revalidate_in,
8983            NULL,
8984        );
8985        utils::result(
8986            vips_op_response,
8987            VipsImage { ctx: out_out },
8988            Error::RawloadError,
8989        )
8990    }
8991}
8992
8993/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8994/// filename: `&str` -> Filename to load from
8995/// returns `VipsImage` - Output image
8996pub fn vipsload(filename: &str) -> Result<VipsImage> {
8997    unsafe {
8998        let filename_in: CString = utils::new_c_string(filename)?;
8999        let mut out_out: *mut bindings::VipsImage = null_mut();
9000
9001        let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
9002        utils::result(
9003            vips_op_response,
9004            VipsImage { ctx: out_out },
9005            Error::VipsloadError,
9006        )
9007    }
9008}
9009
9010/// Options for vipsload operation
9011#[derive(Clone, Debug)]
9012pub struct VipsloadOptions {
9013    /// flags: `ForeignFlags` -> Flags for this file
9014    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9015    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9016    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9017    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9018    ///  `All` -> VIPS_FOREIGN_ALL = 7
9019    pub flags: ForeignFlags,
9020    /// memory: `bool` -> Force open via memory
9021    /// default: false
9022    pub memory: bool,
9023    /// access: `Access` -> Required access pattern for this file
9024    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9025    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9026    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9027    ///  `Last` -> VIPS_ACCESS_LAST = 3
9028    pub access: Access,
9029    /// fail_on: `FailOn` -> Error level to fail on
9030    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9031    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9032    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9033    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9034    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9035    pub fail_on: FailOn,
9036    /// revalidate: `bool` -> Don't use a cached result for this operation
9037    /// default: false
9038    pub revalidate: bool,
9039}
9040
9041impl std::default::Default for VipsloadOptions {
9042    fn default() -> Self {
9043        VipsloadOptions {
9044            flags: ForeignFlags::None,
9045            memory: false,
9046            access: Access::Random,
9047            fail_on: FailOn::None,
9048            revalidate: false,
9049        }
9050    }
9051}
9052
9053/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
9054/// filename: `&str` -> Filename to load from
9055/// vipsload_options: `&VipsloadOptions` -> optional arguments
9056/// returns `VipsImage` - Output image
9057pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
9058    unsafe {
9059        let filename_in: CString = utils::new_c_string(filename)?;
9060        let mut out_out: *mut bindings::VipsImage = null_mut();
9061
9062        let flags_in: i32 = vipsload_options.flags as i32;
9063        let flags_in_name = utils::new_c_string("flags")?;
9064
9065        let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
9066        let memory_in_name = utils::new_c_string("memory")?;
9067
9068        let access_in: i32 = vipsload_options.access as i32;
9069        let access_in_name = utils::new_c_string("access")?;
9070
9071        let fail_on_in: i32 = vipsload_options.fail_on as i32;
9072        let fail_on_in_name = utils::new_c_string("fail-on")?;
9073
9074        let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
9075        let revalidate_in_name = utils::new_c_string("revalidate")?;
9076
9077        let vips_op_response = bindings::vips_vipsload(
9078            filename_in.as_ptr(),
9079            &mut out_out,
9080            flags_in_name.as_ptr(),
9081            flags_in,
9082            memory_in_name.as_ptr(),
9083            memory_in,
9084            access_in_name.as_ptr(),
9085            access_in,
9086            fail_on_in_name.as_ptr(),
9087            fail_on_in,
9088            revalidate_in_name.as_ptr(),
9089            revalidate_in,
9090            NULL,
9091        );
9092        utils::result(
9093            vips_op_response,
9094            VipsImage { ctx: out_out },
9095            Error::VipsloadError,
9096        )
9097    }
9098}
9099
9100/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9101/// source: `&VipsSource` -> Source to load from
9102/// returns `VipsImage` - Output image
9103pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
9104    unsafe {
9105        let source_in: *mut bindings::VipsSource = source.ctx;
9106        let mut out_out: *mut bindings::VipsImage = null_mut();
9107
9108        let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
9109        utils::result(
9110            vips_op_response,
9111            VipsImage { ctx: out_out },
9112            Error::VipsloadSourceError,
9113        )
9114    }
9115}
9116
9117/// Options for vipsload_source operation
9118#[derive(Clone, Debug)]
9119pub struct VipsloadSourceOptions {
9120    /// flags: `ForeignFlags` -> Flags for this file
9121    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9122    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9123    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9124    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9125    ///  `All` -> VIPS_FOREIGN_ALL = 7
9126    pub flags: ForeignFlags,
9127    /// memory: `bool` -> Force open via memory
9128    /// default: false
9129    pub memory: bool,
9130    /// access: `Access` -> Required access pattern for this file
9131    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9132    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9133    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9134    ///  `Last` -> VIPS_ACCESS_LAST = 3
9135    pub access: Access,
9136    /// fail_on: `FailOn` -> Error level to fail on
9137    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9138    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9139    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9140    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9141    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9142    pub fail_on: FailOn,
9143    /// revalidate: `bool` -> Don't use a cached result for this operation
9144    /// default: false
9145    pub revalidate: bool,
9146}
9147
9148impl std::default::Default for VipsloadSourceOptions {
9149    fn default() -> Self {
9150        VipsloadSourceOptions {
9151            flags: ForeignFlags::None,
9152            memory: false,
9153            access: Access::Random,
9154            fail_on: FailOn::None,
9155            revalidate: false,
9156        }
9157    }
9158}
9159
9160/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9161/// source: `&VipsSource` -> Source to load from
9162/// vipsload_source_options: `&VipsloadSourceOptions` -> optional arguments
9163/// returns `VipsImage` - Output image
9164pub fn vipsload_source_with_opts(
9165    source: &VipsSource,
9166    vipsload_source_options: &VipsloadSourceOptions,
9167) -> Result<VipsImage> {
9168    unsafe {
9169        let source_in: *mut bindings::VipsSource = source.ctx;
9170        let mut out_out: *mut bindings::VipsImage = null_mut();
9171
9172        let flags_in: i32 = vipsload_source_options.flags as i32;
9173        let flags_in_name = utils::new_c_string("flags")?;
9174
9175        let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9176        let memory_in_name = utils::new_c_string("memory")?;
9177
9178        let access_in: i32 = vipsload_source_options.access as i32;
9179        let access_in_name = utils::new_c_string("access")?;
9180
9181        let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9182        let fail_on_in_name = utils::new_c_string("fail-on")?;
9183
9184        let revalidate_in: i32 = if vipsload_source_options.revalidate {
9185            1
9186        } else {
9187            0
9188        };
9189        let revalidate_in_name = utils::new_c_string("revalidate")?;
9190
9191        let vips_op_response = bindings::vips_vipsload_source(
9192            source_in,
9193            &mut out_out,
9194            flags_in_name.as_ptr(),
9195            flags_in,
9196            memory_in_name.as_ptr(),
9197            memory_in,
9198            access_in_name.as_ptr(),
9199            access_in,
9200            fail_on_in_name.as_ptr(),
9201            fail_on_in,
9202            revalidate_in_name.as_ptr(),
9203            revalidate_in,
9204            NULL,
9205        );
9206        utils::result(
9207            vips_op_response,
9208            VipsImage { ctx: out_out },
9209            Error::VipsloadSourceError,
9210        )
9211    }
9212}
9213
9214/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9215/// filename: `&str` -> Filename to load from
9216/// returns `VipsImage` - Output image
9217pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9218    unsafe {
9219        let filename_in: CString = utils::new_c_string(filename)?;
9220        let mut out_out: *mut bindings::VipsImage = null_mut();
9221
9222        let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9223        utils::result(
9224            vips_op_response,
9225            VipsImage { ctx: out_out },
9226            Error::AnalyzeloadError,
9227        )
9228    }
9229}
9230
9231/// Options for analyzeload operation
9232#[derive(Clone, Debug)]
9233pub struct AnalyzeloadOptions {
9234    /// flags: `ForeignFlags` -> Flags for this file
9235    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9236    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9237    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9238    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9239    ///  `All` -> VIPS_FOREIGN_ALL = 7
9240    pub flags: ForeignFlags,
9241    /// memory: `bool` -> Force open via memory
9242    /// default: false
9243    pub memory: bool,
9244    /// access: `Access` -> Required access pattern for this file
9245    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9246    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9247    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9248    ///  `Last` -> VIPS_ACCESS_LAST = 3
9249    pub access: Access,
9250    /// fail_on: `FailOn` -> Error level to fail on
9251    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9252    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9253    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9254    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9255    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9256    pub fail_on: FailOn,
9257    /// revalidate: `bool` -> Don't use a cached result for this operation
9258    /// default: false
9259    pub revalidate: bool,
9260}
9261
9262impl std::default::Default for AnalyzeloadOptions {
9263    fn default() -> Self {
9264        AnalyzeloadOptions {
9265            flags: ForeignFlags::None,
9266            memory: false,
9267            access: Access::Random,
9268            fail_on: FailOn::None,
9269            revalidate: false,
9270        }
9271    }
9272}
9273
9274/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9275/// filename: `&str` -> Filename to load from
9276/// analyzeload_options: `&AnalyzeloadOptions` -> optional arguments
9277/// returns `VipsImage` - Output image
9278pub fn analyzeload_with_opts(
9279    filename: &str,
9280    analyzeload_options: &AnalyzeloadOptions,
9281) -> Result<VipsImage> {
9282    unsafe {
9283        let filename_in: CString = utils::new_c_string(filename)?;
9284        let mut out_out: *mut bindings::VipsImage = null_mut();
9285
9286        let flags_in: i32 = analyzeload_options.flags as i32;
9287        let flags_in_name = utils::new_c_string("flags")?;
9288
9289        let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9290        let memory_in_name = utils::new_c_string("memory")?;
9291
9292        let access_in: i32 = analyzeload_options.access as i32;
9293        let access_in_name = utils::new_c_string("access")?;
9294
9295        let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9296        let fail_on_in_name = utils::new_c_string("fail-on")?;
9297
9298        let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9299        let revalidate_in_name = utils::new_c_string("revalidate")?;
9300
9301        let vips_op_response = bindings::vips_analyzeload(
9302            filename_in.as_ptr(),
9303            &mut out_out,
9304            flags_in_name.as_ptr(),
9305            flags_in,
9306            memory_in_name.as_ptr(),
9307            memory_in,
9308            access_in_name.as_ptr(),
9309            access_in,
9310            fail_on_in_name.as_ptr(),
9311            fail_on_in,
9312            revalidate_in_name.as_ptr(),
9313            revalidate_in,
9314            NULL,
9315        );
9316        utils::result(
9317            vips_op_response,
9318            VipsImage { ctx: out_out },
9319            Error::AnalyzeloadError,
9320        )
9321    }
9322}
9323
9324/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9325/// filename: `&str` -> Filename to load from
9326/// returns `VipsImage` - Output image
9327pub fn ppmload(filename: &str) -> Result<VipsImage> {
9328    unsafe {
9329        let filename_in: CString = utils::new_c_string(filename)?;
9330        let mut out_out: *mut bindings::VipsImage = null_mut();
9331
9332        let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9333        utils::result(
9334            vips_op_response,
9335            VipsImage { ctx: out_out },
9336            Error::PpmloadError,
9337        )
9338    }
9339}
9340
9341/// Options for ppmload operation
9342#[derive(Clone, Debug)]
9343pub struct PpmloadOptions {
9344    /// flags: `ForeignFlags` -> Flags for this file
9345    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9346    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9347    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9348    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9349    ///  `All` -> VIPS_FOREIGN_ALL = 7
9350    pub flags: ForeignFlags,
9351    /// memory: `bool` -> Force open via memory
9352    /// default: false
9353    pub memory: bool,
9354    /// access: `Access` -> Required access pattern for this file
9355    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9356    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9357    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9358    ///  `Last` -> VIPS_ACCESS_LAST = 3
9359    pub access: Access,
9360    /// fail_on: `FailOn` -> Error level to fail on
9361    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9362    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9363    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9364    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9365    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9366    pub fail_on: FailOn,
9367    /// revalidate: `bool` -> Don't use a cached result for this operation
9368    /// default: false
9369    pub revalidate: bool,
9370}
9371
9372impl std::default::Default for PpmloadOptions {
9373    fn default() -> Self {
9374        PpmloadOptions {
9375            flags: ForeignFlags::None,
9376            memory: false,
9377            access: Access::Random,
9378            fail_on: FailOn::None,
9379            revalidate: false,
9380        }
9381    }
9382}
9383
9384/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9385/// filename: `&str` -> Filename to load from
9386/// ppmload_options: `&PpmloadOptions` -> optional arguments
9387/// returns `VipsImage` - Output image
9388pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9389    unsafe {
9390        let filename_in: CString = utils::new_c_string(filename)?;
9391        let mut out_out: *mut bindings::VipsImage = null_mut();
9392
9393        let flags_in: i32 = ppmload_options.flags as i32;
9394        let flags_in_name = utils::new_c_string("flags")?;
9395
9396        let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9397        let memory_in_name = utils::new_c_string("memory")?;
9398
9399        let access_in: i32 = ppmload_options.access as i32;
9400        let access_in_name = utils::new_c_string("access")?;
9401
9402        let fail_on_in: i32 = ppmload_options.fail_on as i32;
9403        let fail_on_in_name = utils::new_c_string("fail-on")?;
9404
9405        let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9406        let revalidate_in_name = utils::new_c_string("revalidate")?;
9407
9408        let vips_op_response = bindings::vips_ppmload(
9409            filename_in.as_ptr(),
9410            &mut out_out,
9411            flags_in_name.as_ptr(),
9412            flags_in,
9413            memory_in_name.as_ptr(),
9414            memory_in,
9415            access_in_name.as_ptr(),
9416            access_in,
9417            fail_on_in_name.as_ptr(),
9418            fail_on_in,
9419            revalidate_in_name.as_ptr(),
9420            revalidate_in,
9421            NULL,
9422        );
9423        utils::result(
9424            vips_op_response,
9425            VipsImage { ctx: out_out },
9426            Error::PpmloadError,
9427        )
9428    }
9429}
9430
9431/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9432/// source: `&VipsSource` -> Source to load from
9433/// returns `VipsImage` - Output image
9434pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9435    unsafe {
9436        let source_in: *mut bindings::VipsSource = source.ctx;
9437        let mut out_out: *mut bindings::VipsImage = null_mut();
9438
9439        let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9440        utils::result(
9441            vips_op_response,
9442            VipsImage { ctx: out_out },
9443            Error::PpmloadSourceError,
9444        )
9445    }
9446}
9447
9448/// Options for ppmload_source operation
9449#[derive(Clone, Debug)]
9450pub struct PpmloadSourceOptions {
9451    /// flags: `ForeignFlags` -> Flags for this file
9452    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9453    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9454    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9455    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9456    ///  `All` -> VIPS_FOREIGN_ALL = 7
9457    pub flags: ForeignFlags,
9458    /// memory: `bool` -> Force open via memory
9459    /// default: false
9460    pub memory: bool,
9461    /// access: `Access` -> Required access pattern for this file
9462    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9463    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9464    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9465    ///  `Last` -> VIPS_ACCESS_LAST = 3
9466    pub access: Access,
9467    /// fail_on: `FailOn` -> Error level to fail on
9468    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9469    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9470    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9471    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9472    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9473    pub fail_on: FailOn,
9474    /// revalidate: `bool` -> Don't use a cached result for this operation
9475    /// default: false
9476    pub revalidate: bool,
9477}
9478
9479impl std::default::Default for PpmloadSourceOptions {
9480    fn default() -> Self {
9481        PpmloadSourceOptions {
9482            flags: ForeignFlags::None,
9483            memory: false,
9484            access: Access::Random,
9485            fail_on: FailOn::None,
9486            revalidate: false,
9487        }
9488    }
9489}
9490
9491/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9492/// source: `&VipsSource` -> Source to load from
9493/// ppmload_source_options: `&PpmloadSourceOptions` -> optional arguments
9494/// returns `VipsImage` - Output image
9495pub fn ppmload_source_with_opts(
9496    source: &VipsSource,
9497    ppmload_source_options: &PpmloadSourceOptions,
9498) -> Result<VipsImage> {
9499    unsafe {
9500        let source_in: *mut bindings::VipsSource = source.ctx;
9501        let mut out_out: *mut bindings::VipsImage = null_mut();
9502
9503        let flags_in: i32 = ppmload_source_options.flags as i32;
9504        let flags_in_name = utils::new_c_string("flags")?;
9505
9506        let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9507        let memory_in_name = utils::new_c_string("memory")?;
9508
9509        let access_in: i32 = ppmload_source_options.access as i32;
9510        let access_in_name = utils::new_c_string("access")?;
9511
9512        let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9513        let fail_on_in_name = utils::new_c_string("fail-on")?;
9514
9515        let revalidate_in: i32 = if ppmload_source_options.revalidate {
9516            1
9517        } else {
9518            0
9519        };
9520        let revalidate_in_name = utils::new_c_string("revalidate")?;
9521
9522        let vips_op_response = bindings::vips_ppmload_source(
9523            source_in,
9524            &mut out_out,
9525            flags_in_name.as_ptr(),
9526            flags_in,
9527            memory_in_name.as_ptr(),
9528            memory_in,
9529            access_in_name.as_ptr(),
9530            access_in,
9531            fail_on_in_name.as_ptr(),
9532            fail_on_in,
9533            revalidate_in_name.as_ptr(),
9534            revalidate_in,
9535            NULL,
9536        );
9537        utils::result(
9538            vips_op_response,
9539            VipsImage { ctx: out_out },
9540            Error::PpmloadSourceError,
9541        )
9542    }
9543}
9544
9545/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9546/// filename: `&str` -> Filename to load from
9547/// returns `VipsImage` - Output image
9548pub fn radload(filename: &str) -> Result<VipsImage> {
9549    unsafe {
9550        let filename_in: CString = utils::new_c_string(filename)?;
9551        let mut out_out: *mut bindings::VipsImage = null_mut();
9552
9553        let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9554        utils::result(
9555            vips_op_response,
9556            VipsImage { ctx: out_out },
9557            Error::RadloadError,
9558        )
9559    }
9560}
9561
9562/// Options for radload operation
9563#[derive(Clone, Debug)]
9564pub struct RadloadOptions {
9565    /// flags: `ForeignFlags` -> Flags for this file
9566    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9567    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9568    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9569    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9570    ///  `All` -> VIPS_FOREIGN_ALL = 7
9571    pub flags: ForeignFlags,
9572    /// memory: `bool` -> Force open via memory
9573    /// default: false
9574    pub memory: bool,
9575    /// access: `Access` -> Required access pattern for this file
9576    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9577    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9578    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9579    ///  `Last` -> VIPS_ACCESS_LAST = 3
9580    pub access: Access,
9581    /// fail_on: `FailOn` -> Error level to fail on
9582    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9583    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9584    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9585    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9586    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9587    pub fail_on: FailOn,
9588    /// revalidate: `bool` -> Don't use a cached result for this operation
9589    /// default: false
9590    pub revalidate: bool,
9591}
9592
9593impl std::default::Default for RadloadOptions {
9594    fn default() -> Self {
9595        RadloadOptions {
9596            flags: ForeignFlags::None,
9597            memory: false,
9598            access: Access::Random,
9599            fail_on: FailOn::None,
9600            revalidate: false,
9601        }
9602    }
9603}
9604
9605/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9606/// filename: `&str` -> Filename to load from
9607/// radload_options: `&RadloadOptions` -> optional arguments
9608/// returns `VipsImage` - Output image
9609pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9610    unsafe {
9611        let filename_in: CString = utils::new_c_string(filename)?;
9612        let mut out_out: *mut bindings::VipsImage = null_mut();
9613
9614        let flags_in: i32 = radload_options.flags as i32;
9615        let flags_in_name = utils::new_c_string("flags")?;
9616
9617        let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9618        let memory_in_name = utils::new_c_string("memory")?;
9619
9620        let access_in: i32 = radload_options.access as i32;
9621        let access_in_name = utils::new_c_string("access")?;
9622
9623        let fail_on_in: i32 = radload_options.fail_on as i32;
9624        let fail_on_in_name = utils::new_c_string("fail-on")?;
9625
9626        let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9627        let revalidate_in_name = utils::new_c_string("revalidate")?;
9628
9629        let vips_op_response = bindings::vips_radload(
9630            filename_in.as_ptr(),
9631            &mut out_out,
9632            flags_in_name.as_ptr(),
9633            flags_in,
9634            memory_in_name.as_ptr(),
9635            memory_in,
9636            access_in_name.as_ptr(),
9637            access_in,
9638            fail_on_in_name.as_ptr(),
9639            fail_on_in,
9640            revalidate_in_name.as_ptr(),
9641            revalidate_in,
9642            NULL,
9643        );
9644        utils::result(
9645            vips_op_response,
9646            VipsImage { ctx: out_out },
9647            Error::RadloadError,
9648        )
9649    }
9650}
9651
9652/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9653/// buffer: `&[u8]` -> Buffer to load from
9654/// returns `VipsImage` - Output image
9655pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9656    unsafe {
9657        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9658        let mut out_out: *mut bindings::VipsImage = null_mut();
9659
9660        let vips_op_response =
9661            bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9662        utils::result(
9663            vips_op_response,
9664            VipsImage { ctx: out_out },
9665            Error::RadloadBufferError,
9666        )
9667    }
9668}
9669
9670/// Options for radload_buffer operation
9671#[derive(Clone, Debug)]
9672pub struct RadloadBufferOptions {
9673    /// flags: `ForeignFlags` -> Flags for this file
9674    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9675    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9676    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9677    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9678    ///  `All` -> VIPS_FOREIGN_ALL = 7
9679    pub flags: ForeignFlags,
9680    /// memory: `bool` -> Force open via memory
9681    /// default: false
9682    pub memory: bool,
9683    /// access: `Access` -> Required access pattern for this file
9684    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9685    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9686    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9687    ///  `Last` -> VIPS_ACCESS_LAST = 3
9688    pub access: Access,
9689    /// fail_on: `FailOn` -> Error level to fail on
9690    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9691    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9692    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9693    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9694    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9695    pub fail_on: FailOn,
9696    /// revalidate: `bool` -> Don't use a cached result for this operation
9697    /// default: false
9698    pub revalidate: bool,
9699}
9700
9701impl std::default::Default for RadloadBufferOptions {
9702    fn default() -> Self {
9703        RadloadBufferOptions {
9704            flags: ForeignFlags::None,
9705            memory: false,
9706            access: Access::Random,
9707            fail_on: FailOn::None,
9708            revalidate: false,
9709        }
9710    }
9711}
9712
9713/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9714/// buffer: `&[u8]` -> Buffer to load from
9715/// radload_buffer_options: `&RadloadBufferOptions` -> optional arguments
9716/// returns `VipsImage` - Output image
9717pub fn radload_buffer_with_opts(
9718    buffer: &[u8],
9719    radload_buffer_options: &RadloadBufferOptions,
9720) -> Result<VipsImage> {
9721    unsafe {
9722        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9723        let mut out_out: *mut bindings::VipsImage = null_mut();
9724
9725        let flags_in: i32 = radload_buffer_options.flags as i32;
9726        let flags_in_name = utils::new_c_string("flags")?;
9727
9728        let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9729        let memory_in_name = utils::new_c_string("memory")?;
9730
9731        let access_in: i32 = radload_buffer_options.access as i32;
9732        let access_in_name = utils::new_c_string("access")?;
9733
9734        let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9735        let fail_on_in_name = utils::new_c_string("fail-on")?;
9736
9737        let revalidate_in: i32 = if radload_buffer_options.revalidate {
9738            1
9739        } else {
9740            0
9741        };
9742        let revalidate_in_name = utils::new_c_string("revalidate")?;
9743
9744        let vips_op_response = bindings::vips_radload_buffer(
9745            buffer_in,
9746            buffer.len() as u64,
9747            &mut out_out,
9748            flags_in_name.as_ptr(),
9749            flags_in,
9750            memory_in_name.as_ptr(),
9751            memory_in,
9752            access_in_name.as_ptr(),
9753            access_in,
9754            fail_on_in_name.as_ptr(),
9755            fail_on_in,
9756            revalidate_in_name.as_ptr(),
9757            revalidate_in,
9758            NULL,
9759        );
9760        utils::result(
9761            vips_op_response,
9762            VipsImage { ctx: out_out },
9763            Error::RadloadBufferError,
9764        )
9765    }
9766}
9767
9768/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9769/// source: `&VipsSource` -> Source to load from
9770/// returns `VipsImage` - Output image
9771pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9772    unsafe {
9773        let source_in: *mut bindings::VipsSource = source.ctx;
9774        let mut out_out: *mut bindings::VipsImage = null_mut();
9775
9776        let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9777        utils::result(
9778            vips_op_response,
9779            VipsImage { ctx: out_out },
9780            Error::RadloadSourceError,
9781        )
9782    }
9783}
9784
9785/// Options for radload_source operation
9786#[derive(Clone, Debug)]
9787pub struct RadloadSourceOptions {
9788    /// flags: `ForeignFlags` -> Flags for this file
9789    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9790    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9791    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9792    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9793    ///  `All` -> VIPS_FOREIGN_ALL = 7
9794    pub flags: ForeignFlags,
9795    /// memory: `bool` -> Force open via memory
9796    /// default: false
9797    pub memory: bool,
9798    /// access: `Access` -> Required access pattern for this file
9799    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9800    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9801    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9802    ///  `Last` -> VIPS_ACCESS_LAST = 3
9803    pub access: Access,
9804    /// fail_on: `FailOn` -> Error level to fail on
9805    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9806    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9807    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9808    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9809    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9810    pub fail_on: FailOn,
9811    /// revalidate: `bool` -> Don't use a cached result for this operation
9812    /// default: false
9813    pub revalidate: bool,
9814}
9815
9816impl std::default::Default for RadloadSourceOptions {
9817    fn default() -> Self {
9818        RadloadSourceOptions {
9819            flags: ForeignFlags::None,
9820            memory: false,
9821            access: Access::Random,
9822            fail_on: FailOn::None,
9823            revalidate: false,
9824        }
9825    }
9826}
9827
9828/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9829/// source: `&VipsSource` -> Source to load from
9830/// radload_source_options: `&RadloadSourceOptions` -> optional arguments
9831/// returns `VipsImage` - Output image
9832pub fn radload_source_with_opts(
9833    source: &VipsSource,
9834    radload_source_options: &RadloadSourceOptions,
9835) -> Result<VipsImage> {
9836    unsafe {
9837        let source_in: *mut bindings::VipsSource = source.ctx;
9838        let mut out_out: *mut bindings::VipsImage = null_mut();
9839
9840        let flags_in: i32 = radload_source_options.flags as i32;
9841        let flags_in_name = utils::new_c_string("flags")?;
9842
9843        let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9844        let memory_in_name = utils::new_c_string("memory")?;
9845
9846        let access_in: i32 = radload_source_options.access as i32;
9847        let access_in_name = utils::new_c_string("access")?;
9848
9849        let fail_on_in: i32 = radload_source_options.fail_on as i32;
9850        let fail_on_in_name = utils::new_c_string("fail-on")?;
9851
9852        let revalidate_in: i32 = if radload_source_options.revalidate {
9853            1
9854        } else {
9855            0
9856        };
9857        let revalidate_in_name = utils::new_c_string("revalidate")?;
9858
9859        let vips_op_response = bindings::vips_radload_source(
9860            source_in,
9861            &mut out_out,
9862            flags_in_name.as_ptr(),
9863            flags_in,
9864            memory_in_name.as_ptr(),
9865            memory_in,
9866            access_in_name.as_ptr(),
9867            access_in,
9868            fail_on_in_name.as_ptr(),
9869            fail_on_in,
9870            revalidate_in_name.as_ptr(),
9871            revalidate_in,
9872            NULL,
9873        );
9874        utils::result(
9875            vips_op_response,
9876            VipsImage { ctx: out_out },
9877            Error::RadloadSourceError,
9878        )
9879    }
9880}
9881
9882/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9883/// filename: `&str` -> Filename to load from
9884/// returns `VipsImage` - Output image
9885pub fn svgload(filename: &str) -> Result<VipsImage> {
9886    unsafe {
9887        let filename_in: CString = utils::new_c_string(filename)?;
9888        let mut out_out: *mut bindings::VipsImage = null_mut();
9889
9890        let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9891        utils::result(
9892            vips_op_response,
9893            VipsImage { ctx: out_out },
9894            Error::SvgloadError,
9895        )
9896    }
9897}
9898
9899/// Options for svgload operation
9900#[derive(Clone, Debug)]
9901pub struct SvgloadOptions {
9902    /// dpi: `f64` -> Render at this DPI
9903    /// min: 0.001, max: 100000, default: 72
9904    pub dpi: f64,
9905    /// scale: `f64` -> Scale output by this factor
9906    /// min: 0, max: 100000, default: 1
9907    pub scale: f64,
9908    /// unlimited: `bool` -> Allow SVG of any size
9909    /// default: false
9910    pub unlimited: bool,
9911    /// flags: `ForeignFlags` -> Flags for this file
9912    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9913    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9914    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9915    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9916    ///  `All` -> VIPS_FOREIGN_ALL = 7
9917    pub flags: ForeignFlags,
9918    /// memory: `bool` -> Force open via memory
9919    /// default: false
9920    pub memory: bool,
9921    /// access: `Access` -> Required access pattern for this file
9922    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9923    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9924    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9925    ///  `Last` -> VIPS_ACCESS_LAST = 3
9926    pub access: Access,
9927    /// fail_on: `FailOn` -> Error level to fail on
9928    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9929    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9930    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9931    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9932    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9933    pub fail_on: FailOn,
9934    /// revalidate: `bool` -> Don't use a cached result for this operation
9935    /// default: false
9936    pub revalidate: bool,
9937}
9938
9939impl std::default::Default for SvgloadOptions {
9940    fn default() -> Self {
9941        SvgloadOptions {
9942            dpi: f64::from(72),
9943            scale: f64::from(1),
9944            unlimited: false,
9945            flags: ForeignFlags::None,
9946            memory: false,
9947            access: Access::Random,
9948            fail_on: FailOn::None,
9949            revalidate: false,
9950        }
9951    }
9952}
9953
9954/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9955/// filename: `&str` -> Filename to load from
9956/// svgload_options: `&SvgloadOptions` -> optional arguments
9957/// returns `VipsImage` - Output image
9958pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9959    unsafe {
9960        let filename_in: CString = utils::new_c_string(filename)?;
9961        let mut out_out: *mut bindings::VipsImage = null_mut();
9962
9963        let dpi_in: f64 = svgload_options.dpi;
9964        let dpi_in_name = utils::new_c_string("dpi")?;
9965
9966        let scale_in: f64 = svgload_options.scale;
9967        let scale_in_name = utils::new_c_string("scale")?;
9968
9969        let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9970        let unlimited_in_name = utils::new_c_string("unlimited")?;
9971
9972        let flags_in: i32 = svgload_options.flags as i32;
9973        let flags_in_name = utils::new_c_string("flags")?;
9974
9975        let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9976        let memory_in_name = utils::new_c_string("memory")?;
9977
9978        let access_in: i32 = svgload_options.access as i32;
9979        let access_in_name = utils::new_c_string("access")?;
9980
9981        let fail_on_in: i32 = svgload_options.fail_on as i32;
9982        let fail_on_in_name = utils::new_c_string("fail-on")?;
9983
9984        let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9985        let revalidate_in_name = utils::new_c_string("revalidate")?;
9986
9987        let vips_op_response = bindings::vips_svgload(
9988            filename_in.as_ptr(),
9989            &mut out_out,
9990            dpi_in_name.as_ptr(),
9991            dpi_in,
9992            scale_in_name.as_ptr(),
9993            scale_in,
9994            unlimited_in_name.as_ptr(),
9995            unlimited_in,
9996            flags_in_name.as_ptr(),
9997            flags_in,
9998            memory_in_name.as_ptr(),
9999            memory_in,
10000            access_in_name.as_ptr(),
10001            access_in,
10002            fail_on_in_name.as_ptr(),
10003            fail_on_in,
10004            revalidate_in_name.as_ptr(),
10005            revalidate_in,
10006            NULL,
10007        );
10008        utils::result(
10009            vips_op_response,
10010            VipsImage { ctx: out_out },
10011            Error::SvgloadError,
10012        )
10013    }
10014}
10015
10016/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10017/// buffer: `&[u8]` -> Buffer to load from
10018/// returns `VipsImage` - Output image
10019pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10020    unsafe {
10021        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10022        let mut out_out: *mut bindings::VipsImage = null_mut();
10023
10024        let vips_op_response =
10025            bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10026        utils::result(
10027            vips_op_response,
10028            VipsImage { ctx: out_out },
10029            Error::SvgloadBufferError,
10030        )
10031    }
10032}
10033
10034/// Options for svgload_buffer operation
10035#[derive(Clone, Debug)]
10036pub struct SvgloadBufferOptions {
10037    /// dpi: `f64` -> Render at this DPI
10038    /// min: 0.001, max: 100000, default: 72
10039    pub dpi: f64,
10040    /// scale: `f64` -> Scale output by this factor
10041    /// min: 0, max: 100000, default: 1
10042    pub scale: f64,
10043    /// unlimited: `bool` -> Allow SVG of any size
10044    /// default: false
10045    pub unlimited: bool,
10046    /// flags: `ForeignFlags` -> Flags for this file
10047    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10048    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10049    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10050    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10051    ///  `All` -> VIPS_FOREIGN_ALL = 7
10052    pub flags: ForeignFlags,
10053    /// memory: `bool` -> Force open via memory
10054    /// default: false
10055    pub memory: bool,
10056    /// access: `Access` -> Required access pattern for this file
10057    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10058    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10059    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10060    ///  `Last` -> VIPS_ACCESS_LAST = 3
10061    pub access: Access,
10062    /// fail_on: `FailOn` -> Error level to fail on
10063    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10064    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10065    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10066    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10067    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10068    pub fail_on: FailOn,
10069    /// revalidate: `bool` -> Don't use a cached result for this operation
10070    /// default: false
10071    pub revalidate: bool,
10072}
10073
10074impl std::default::Default for SvgloadBufferOptions {
10075    fn default() -> Self {
10076        SvgloadBufferOptions {
10077            dpi: f64::from(72),
10078            scale: f64::from(1),
10079            unlimited: false,
10080            flags: ForeignFlags::None,
10081            memory: false,
10082            access: Access::Random,
10083            fail_on: FailOn::None,
10084            revalidate: false,
10085        }
10086    }
10087}
10088
10089/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10090/// buffer: `&[u8]` -> Buffer to load from
10091/// svgload_buffer_options: `&SvgloadBufferOptions` -> optional arguments
10092/// returns `VipsImage` - Output image
10093pub fn svgload_buffer_with_opts(
10094    buffer: &[u8],
10095    svgload_buffer_options: &SvgloadBufferOptions,
10096) -> Result<VipsImage> {
10097    unsafe {
10098        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10099        let mut out_out: *mut bindings::VipsImage = null_mut();
10100
10101        let dpi_in: f64 = svgload_buffer_options.dpi;
10102        let dpi_in_name = utils::new_c_string("dpi")?;
10103
10104        let scale_in: f64 = svgload_buffer_options.scale;
10105        let scale_in_name = utils::new_c_string("scale")?;
10106
10107        let unlimited_in: i32 = if svgload_buffer_options.unlimited {
10108            1
10109        } else {
10110            0
10111        };
10112        let unlimited_in_name = utils::new_c_string("unlimited")?;
10113
10114        let flags_in: i32 = svgload_buffer_options.flags as i32;
10115        let flags_in_name = utils::new_c_string("flags")?;
10116
10117        let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
10118        let memory_in_name = utils::new_c_string("memory")?;
10119
10120        let access_in: i32 = svgload_buffer_options.access as i32;
10121        let access_in_name = utils::new_c_string("access")?;
10122
10123        let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
10124        let fail_on_in_name = utils::new_c_string("fail-on")?;
10125
10126        let revalidate_in: i32 = if svgload_buffer_options.revalidate {
10127            1
10128        } else {
10129            0
10130        };
10131        let revalidate_in_name = utils::new_c_string("revalidate")?;
10132
10133        let vips_op_response = bindings::vips_svgload_buffer(
10134            buffer_in,
10135            buffer.len() as u64,
10136            &mut out_out,
10137            dpi_in_name.as_ptr(),
10138            dpi_in,
10139            scale_in_name.as_ptr(),
10140            scale_in,
10141            unlimited_in_name.as_ptr(),
10142            unlimited_in,
10143            flags_in_name.as_ptr(),
10144            flags_in,
10145            memory_in_name.as_ptr(),
10146            memory_in,
10147            access_in_name.as_ptr(),
10148            access_in,
10149            fail_on_in_name.as_ptr(),
10150            fail_on_in,
10151            revalidate_in_name.as_ptr(),
10152            revalidate_in,
10153            NULL,
10154        );
10155        utils::result(
10156            vips_op_response,
10157            VipsImage { ctx: out_out },
10158            Error::SvgloadBufferError,
10159        )
10160    }
10161}
10162
10163/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10164/// filename: `&str` -> Filename to load from
10165/// returns `VipsImage` - Output image
10166pub fn gifload(filename: &str) -> Result<VipsImage> {
10167    unsafe {
10168        let filename_in: CString = utils::new_c_string(filename)?;
10169        let mut out_out: *mut bindings::VipsImage = null_mut();
10170
10171        let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10172        utils::result(
10173            vips_op_response,
10174            VipsImage { ctx: out_out },
10175            Error::GifloadError,
10176        )
10177    }
10178}
10179
10180/// Options for gifload operation
10181#[derive(Clone, Debug)]
10182pub struct GifloadOptions {
10183    /// n: `i32` -> Number of pages to load, -1 for all
10184    /// min: -1, max: 100000, default: 1
10185    pub n: i32,
10186    /// page: `i32` -> First page to load
10187    /// min: 0, max: 100000, default: 0
10188    pub page: i32,
10189    /// flags: `ForeignFlags` -> Flags for this file
10190    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10191    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10192    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10193    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10194    ///  `All` -> VIPS_FOREIGN_ALL = 7
10195    pub flags: ForeignFlags,
10196    /// memory: `bool` -> Force open via memory
10197    /// default: false
10198    pub memory: bool,
10199    /// access: `Access` -> Required access pattern for this file
10200    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10201    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10202    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10203    ///  `Last` -> VIPS_ACCESS_LAST = 3
10204    pub access: Access,
10205    /// fail_on: `FailOn` -> Error level to fail on
10206    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10207    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10208    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10209    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10210    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10211    pub fail_on: FailOn,
10212    /// revalidate: `bool` -> Don't use a cached result for this operation
10213    /// default: false
10214    pub revalidate: bool,
10215}
10216
10217impl std::default::Default for GifloadOptions {
10218    fn default() -> Self {
10219        GifloadOptions {
10220            n: i32::from(1),
10221            page: i32::from(0),
10222            flags: ForeignFlags::None,
10223            memory: false,
10224            access: Access::Random,
10225            fail_on: FailOn::None,
10226            revalidate: false,
10227        }
10228    }
10229}
10230
10231/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10232/// filename: `&str` -> Filename to load from
10233/// gifload_options: `&GifloadOptions` -> optional arguments
10234/// returns `VipsImage` - Output image
10235pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10236    unsafe {
10237        let filename_in: CString = utils::new_c_string(filename)?;
10238        let mut out_out: *mut bindings::VipsImage = null_mut();
10239
10240        let n_in: i32 = gifload_options.n;
10241        let n_in_name = utils::new_c_string("n")?;
10242
10243        let page_in: i32 = gifload_options.page;
10244        let page_in_name = utils::new_c_string("page")?;
10245
10246        let flags_in: i32 = gifload_options.flags as i32;
10247        let flags_in_name = utils::new_c_string("flags")?;
10248
10249        let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10250        let memory_in_name = utils::new_c_string("memory")?;
10251
10252        let access_in: i32 = gifload_options.access as i32;
10253        let access_in_name = utils::new_c_string("access")?;
10254
10255        let fail_on_in: i32 = gifload_options.fail_on as i32;
10256        let fail_on_in_name = utils::new_c_string("fail-on")?;
10257
10258        let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10259        let revalidate_in_name = utils::new_c_string("revalidate")?;
10260
10261        let vips_op_response = bindings::vips_gifload(
10262            filename_in.as_ptr(),
10263            &mut out_out,
10264            n_in_name.as_ptr(),
10265            n_in,
10266            page_in_name.as_ptr(),
10267            page_in,
10268            flags_in_name.as_ptr(),
10269            flags_in,
10270            memory_in_name.as_ptr(),
10271            memory_in,
10272            access_in_name.as_ptr(),
10273            access_in,
10274            fail_on_in_name.as_ptr(),
10275            fail_on_in,
10276            revalidate_in_name.as_ptr(),
10277            revalidate_in,
10278            NULL,
10279        );
10280        utils::result(
10281            vips_op_response,
10282            VipsImage { ctx: out_out },
10283            Error::GifloadError,
10284        )
10285    }
10286}
10287
10288/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10289/// buffer: `&[u8]` -> Buffer to load from
10290/// returns `VipsImage` - Output image
10291pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10292    unsafe {
10293        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10294        let mut out_out: *mut bindings::VipsImage = null_mut();
10295
10296        let vips_op_response =
10297            bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10298        utils::result(
10299            vips_op_response,
10300            VipsImage { ctx: out_out },
10301            Error::GifloadBufferError,
10302        )
10303    }
10304}
10305
10306/// Options for gifload_buffer operation
10307#[derive(Clone, Debug)]
10308pub struct GifloadBufferOptions {
10309    /// n: `i32` -> Number of pages to load, -1 for all
10310    /// min: -1, max: 100000, default: 1
10311    pub n: i32,
10312    /// page: `i32` -> First page to load
10313    /// min: 0, max: 100000, default: 0
10314    pub page: i32,
10315    /// flags: `ForeignFlags` -> Flags for this file
10316    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10317    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10318    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10319    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10320    ///  `All` -> VIPS_FOREIGN_ALL = 7
10321    pub flags: ForeignFlags,
10322    /// memory: `bool` -> Force open via memory
10323    /// default: false
10324    pub memory: bool,
10325    /// access: `Access` -> Required access pattern for this file
10326    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10327    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10328    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10329    ///  `Last` -> VIPS_ACCESS_LAST = 3
10330    pub access: Access,
10331    /// fail_on: `FailOn` -> Error level to fail on
10332    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10333    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10334    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10335    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10336    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10337    pub fail_on: FailOn,
10338    /// revalidate: `bool` -> Don't use a cached result for this operation
10339    /// default: false
10340    pub revalidate: bool,
10341}
10342
10343impl std::default::Default for GifloadBufferOptions {
10344    fn default() -> Self {
10345        GifloadBufferOptions {
10346            n: i32::from(1),
10347            page: i32::from(0),
10348            flags: ForeignFlags::None,
10349            memory: false,
10350            access: Access::Random,
10351            fail_on: FailOn::None,
10352            revalidate: false,
10353        }
10354    }
10355}
10356
10357/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10358/// buffer: `&[u8]` -> Buffer to load from
10359/// gifload_buffer_options: `&GifloadBufferOptions` -> optional arguments
10360/// returns `VipsImage` - Output image
10361pub fn gifload_buffer_with_opts(
10362    buffer: &[u8],
10363    gifload_buffer_options: &GifloadBufferOptions,
10364) -> Result<VipsImage> {
10365    unsafe {
10366        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10367        let mut out_out: *mut bindings::VipsImage = null_mut();
10368
10369        let n_in: i32 = gifload_buffer_options.n;
10370        let n_in_name = utils::new_c_string("n")?;
10371
10372        let page_in: i32 = gifload_buffer_options.page;
10373        let page_in_name = utils::new_c_string("page")?;
10374
10375        let flags_in: i32 = gifload_buffer_options.flags as i32;
10376        let flags_in_name = utils::new_c_string("flags")?;
10377
10378        let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10379        let memory_in_name = utils::new_c_string("memory")?;
10380
10381        let access_in: i32 = gifload_buffer_options.access as i32;
10382        let access_in_name = utils::new_c_string("access")?;
10383
10384        let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10385        let fail_on_in_name = utils::new_c_string("fail-on")?;
10386
10387        let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10388            1
10389        } else {
10390            0
10391        };
10392        let revalidate_in_name = utils::new_c_string("revalidate")?;
10393
10394        let vips_op_response = bindings::vips_gifload_buffer(
10395            buffer_in,
10396            buffer.len() as u64,
10397            &mut out_out,
10398            n_in_name.as_ptr(),
10399            n_in,
10400            page_in_name.as_ptr(),
10401            page_in,
10402            flags_in_name.as_ptr(),
10403            flags_in,
10404            memory_in_name.as_ptr(),
10405            memory_in,
10406            access_in_name.as_ptr(),
10407            access_in,
10408            fail_on_in_name.as_ptr(),
10409            fail_on_in,
10410            revalidate_in_name.as_ptr(),
10411            revalidate_in,
10412            NULL,
10413        );
10414        utils::result(
10415            vips_op_response,
10416            VipsImage { ctx: out_out },
10417            Error::GifloadBufferError,
10418        )
10419    }
10420}
10421
10422/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10423/// source: `&VipsSource` -> Source to load from
10424/// returns `VipsImage` - Output image
10425pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10426    unsafe {
10427        let source_in: *mut bindings::VipsSource = source.ctx;
10428        let mut out_out: *mut bindings::VipsImage = null_mut();
10429
10430        let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10431        utils::result(
10432            vips_op_response,
10433            VipsImage { ctx: out_out },
10434            Error::GifloadSourceError,
10435        )
10436    }
10437}
10438
10439/// Options for gifload_source operation
10440#[derive(Clone, Debug)]
10441pub struct GifloadSourceOptions {
10442    /// n: `i32` -> Number of pages to load, -1 for all
10443    /// min: -1, max: 100000, default: 1
10444    pub n: i32,
10445    /// page: `i32` -> First page to load
10446    /// min: 0, max: 100000, default: 0
10447    pub page: i32,
10448    /// flags: `ForeignFlags` -> Flags for this file
10449    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10450    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10451    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10452    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10453    ///  `All` -> VIPS_FOREIGN_ALL = 7
10454    pub flags: ForeignFlags,
10455    /// memory: `bool` -> Force open via memory
10456    /// default: false
10457    pub memory: bool,
10458    /// access: `Access` -> Required access pattern for this file
10459    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10460    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10461    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10462    ///  `Last` -> VIPS_ACCESS_LAST = 3
10463    pub access: Access,
10464    /// fail_on: `FailOn` -> Error level to fail on
10465    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10466    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10467    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10468    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10469    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10470    pub fail_on: FailOn,
10471    /// revalidate: `bool` -> Don't use a cached result for this operation
10472    /// default: false
10473    pub revalidate: bool,
10474}
10475
10476impl std::default::Default for GifloadSourceOptions {
10477    fn default() -> Self {
10478        GifloadSourceOptions {
10479            n: i32::from(1),
10480            page: i32::from(0),
10481            flags: ForeignFlags::None,
10482            memory: false,
10483            access: Access::Random,
10484            fail_on: FailOn::None,
10485            revalidate: false,
10486        }
10487    }
10488}
10489
10490/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10491/// source: `&VipsSource` -> Source to load from
10492/// gifload_source_options: `&GifloadSourceOptions` -> optional arguments
10493/// returns `VipsImage` - Output image
10494pub fn gifload_source_with_opts(
10495    source: &VipsSource,
10496    gifload_source_options: &GifloadSourceOptions,
10497) -> Result<VipsImage> {
10498    unsafe {
10499        let source_in: *mut bindings::VipsSource = source.ctx;
10500        let mut out_out: *mut bindings::VipsImage = null_mut();
10501
10502        let n_in: i32 = gifload_source_options.n;
10503        let n_in_name = utils::new_c_string("n")?;
10504
10505        let page_in: i32 = gifload_source_options.page;
10506        let page_in_name = utils::new_c_string("page")?;
10507
10508        let flags_in: i32 = gifload_source_options.flags as i32;
10509        let flags_in_name = utils::new_c_string("flags")?;
10510
10511        let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10512        let memory_in_name = utils::new_c_string("memory")?;
10513
10514        let access_in: i32 = gifload_source_options.access as i32;
10515        let access_in_name = utils::new_c_string("access")?;
10516
10517        let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10518        let fail_on_in_name = utils::new_c_string("fail-on")?;
10519
10520        let revalidate_in: i32 = if gifload_source_options.revalidate {
10521            1
10522        } else {
10523            0
10524        };
10525        let revalidate_in_name = utils::new_c_string("revalidate")?;
10526
10527        let vips_op_response = bindings::vips_gifload_source(
10528            source_in,
10529            &mut out_out,
10530            n_in_name.as_ptr(),
10531            n_in,
10532            page_in_name.as_ptr(),
10533            page_in,
10534            flags_in_name.as_ptr(),
10535            flags_in,
10536            memory_in_name.as_ptr(),
10537            memory_in,
10538            access_in_name.as_ptr(),
10539            access_in,
10540            fail_on_in_name.as_ptr(),
10541            fail_on_in,
10542            revalidate_in_name.as_ptr(),
10543            revalidate_in,
10544            NULL,
10545        );
10546        utils::result(
10547            vips_op_response,
10548            VipsImage { ctx: out_out },
10549            Error::GifloadSourceError,
10550        )
10551    }
10552}
10553
10554/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10555/// filename: `&str` -> Filename to load from
10556/// returns `VipsImage` - Output image
10557pub fn pngload(filename: &str) -> Result<VipsImage> {
10558    unsafe {
10559        let filename_in: CString = utils::new_c_string(filename)?;
10560        let mut out_out: *mut bindings::VipsImage = null_mut();
10561
10562        let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10563        utils::result(
10564            vips_op_response,
10565            VipsImage { ctx: out_out },
10566            Error::PngloadError,
10567        )
10568    }
10569}
10570
10571/// Options for pngload operation
10572#[derive(Clone, Debug)]
10573pub struct PngloadOptions {
10574    /// unlimited: `bool` -> Remove all denial of service limits
10575    /// default: false
10576    pub unlimited: bool,
10577    /// flags: `ForeignFlags` -> Flags for this file
10578    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10579    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10580    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10581    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10582    ///  `All` -> VIPS_FOREIGN_ALL = 7
10583    pub flags: ForeignFlags,
10584    /// memory: `bool` -> Force open via memory
10585    /// default: false
10586    pub memory: bool,
10587    /// access: `Access` -> Required access pattern for this file
10588    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10589    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10590    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10591    ///  `Last` -> VIPS_ACCESS_LAST = 3
10592    pub access: Access,
10593    /// fail_on: `FailOn` -> Error level to fail on
10594    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10595    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10596    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10597    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10598    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10599    pub fail_on: FailOn,
10600    /// revalidate: `bool` -> Don't use a cached result for this operation
10601    /// default: false
10602    pub revalidate: bool,
10603}
10604
10605impl std::default::Default for PngloadOptions {
10606    fn default() -> Self {
10607        PngloadOptions {
10608            unlimited: false,
10609            flags: ForeignFlags::None,
10610            memory: false,
10611            access: Access::Random,
10612            fail_on: FailOn::None,
10613            revalidate: false,
10614        }
10615    }
10616}
10617
10618/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10619/// filename: `&str` -> Filename to load from
10620/// pngload_options: `&PngloadOptions` -> optional arguments
10621/// returns `VipsImage` - Output image
10622pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10623    unsafe {
10624        let filename_in: CString = utils::new_c_string(filename)?;
10625        let mut out_out: *mut bindings::VipsImage = null_mut();
10626
10627        let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10628        let unlimited_in_name = utils::new_c_string("unlimited")?;
10629
10630        let flags_in: i32 = pngload_options.flags as i32;
10631        let flags_in_name = utils::new_c_string("flags")?;
10632
10633        let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10634        let memory_in_name = utils::new_c_string("memory")?;
10635
10636        let access_in: i32 = pngload_options.access as i32;
10637        let access_in_name = utils::new_c_string("access")?;
10638
10639        let fail_on_in: i32 = pngload_options.fail_on as i32;
10640        let fail_on_in_name = utils::new_c_string("fail-on")?;
10641
10642        let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10643        let revalidate_in_name = utils::new_c_string("revalidate")?;
10644
10645        let vips_op_response = bindings::vips_pngload(
10646            filename_in.as_ptr(),
10647            &mut out_out,
10648            unlimited_in_name.as_ptr(),
10649            unlimited_in,
10650            flags_in_name.as_ptr(),
10651            flags_in,
10652            memory_in_name.as_ptr(),
10653            memory_in,
10654            access_in_name.as_ptr(),
10655            access_in,
10656            fail_on_in_name.as_ptr(),
10657            fail_on_in,
10658            revalidate_in_name.as_ptr(),
10659            revalidate_in,
10660            NULL,
10661        );
10662        utils::result(
10663            vips_op_response,
10664            VipsImage { ctx: out_out },
10665            Error::PngloadError,
10666        )
10667    }
10668}
10669
10670/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10671/// buffer: `&[u8]` -> Buffer to load from
10672/// returns `VipsImage` - Output image
10673pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10674    unsafe {
10675        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10676        let mut out_out: *mut bindings::VipsImage = null_mut();
10677
10678        let vips_op_response =
10679            bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10680        utils::result(
10681            vips_op_response,
10682            VipsImage { ctx: out_out },
10683            Error::PngloadBufferError,
10684        )
10685    }
10686}
10687
10688/// Options for pngload_buffer operation
10689#[derive(Clone, Debug)]
10690pub struct PngloadBufferOptions {
10691    /// unlimited: `bool` -> Remove all denial of service limits
10692    /// default: false
10693    pub unlimited: bool,
10694    /// flags: `ForeignFlags` -> Flags for this file
10695    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10696    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10697    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10698    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10699    ///  `All` -> VIPS_FOREIGN_ALL = 7
10700    pub flags: ForeignFlags,
10701    /// memory: `bool` -> Force open via memory
10702    /// default: false
10703    pub memory: bool,
10704    /// access: `Access` -> Required access pattern for this file
10705    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10706    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10707    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10708    ///  `Last` -> VIPS_ACCESS_LAST = 3
10709    pub access: Access,
10710    /// fail_on: `FailOn` -> Error level to fail on
10711    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10712    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10713    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10714    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10715    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10716    pub fail_on: FailOn,
10717    /// revalidate: `bool` -> Don't use a cached result for this operation
10718    /// default: false
10719    pub revalidate: bool,
10720}
10721
10722impl std::default::Default for PngloadBufferOptions {
10723    fn default() -> Self {
10724        PngloadBufferOptions {
10725            unlimited: false,
10726            flags: ForeignFlags::None,
10727            memory: false,
10728            access: Access::Random,
10729            fail_on: FailOn::None,
10730            revalidate: false,
10731        }
10732    }
10733}
10734
10735/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10736/// buffer: `&[u8]` -> Buffer to load from
10737/// pngload_buffer_options: `&PngloadBufferOptions` -> optional arguments
10738/// returns `VipsImage` - Output image
10739pub fn pngload_buffer_with_opts(
10740    buffer: &[u8],
10741    pngload_buffer_options: &PngloadBufferOptions,
10742) -> Result<VipsImage> {
10743    unsafe {
10744        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10745        let mut out_out: *mut bindings::VipsImage = null_mut();
10746
10747        let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10748            1
10749        } else {
10750            0
10751        };
10752        let unlimited_in_name = utils::new_c_string("unlimited")?;
10753
10754        let flags_in: i32 = pngload_buffer_options.flags as i32;
10755        let flags_in_name = utils::new_c_string("flags")?;
10756
10757        let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10758        let memory_in_name = utils::new_c_string("memory")?;
10759
10760        let access_in: i32 = pngload_buffer_options.access as i32;
10761        let access_in_name = utils::new_c_string("access")?;
10762
10763        let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10764        let fail_on_in_name = utils::new_c_string("fail-on")?;
10765
10766        let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10767            1
10768        } else {
10769            0
10770        };
10771        let revalidate_in_name = utils::new_c_string("revalidate")?;
10772
10773        let vips_op_response = bindings::vips_pngload_buffer(
10774            buffer_in,
10775            buffer.len() as u64,
10776            &mut out_out,
10777            unlimited_in_name.as_ptr(),
10778            unlimited_in,
10779            flags_in_name.as_ptr(),
10780            flags_in,
10781            memory_in_name.as_ptr(),
10782            memory_in,
10783            access_in_name.as_ptr(),
10784            access_in,
10785            fail_on_in_name.as_ptr(),
10786            fail_on_in,
10787            revalidate_in_name.as_ptr(),
10788            revalidate_in,
10789            NULL,
10790        );
10791        utils::result(
10792            vips_op_response,
10793            VipsImage { ctx: out_out },
10794            Error::PngloadBufferError,
10795        )
10796    }
10797}
10798
10799/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10800/// source: `&VipsSource` -> Source to load from
10801/// returns `VipsImage` - Output image
10802pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10803    unsafe {
10804        let source_in: *mut bindings::VipsSource = source.ctx;
10805        let mut out_out: *mut bindings::VipsImage = null_mut();
10806
10807        let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10808        utils::result(
10809            vips_op_response,
10810            VipsImage { ctx: out_out },
10811            Error::PngloadSourceError,
10812        )
10813    }
10814}
10815
10816/// Options for pngload_source operation
10817#[derive(Clone, Debug)]
10818pub struct PngloadSourceOptions {
10819    /// unlimited: `bool` -> Remove all denial of service limits
10820    /// default: false
10821    pub unlimited: bool,
10822    /// flags: `ForeignFlags` -> Flags for this file
10823    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10824    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10825    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10826    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10827    ///  `All` -> VIPS_FOREIGN_ALL = 7
10828    pub flags: ForeignFlags,
10829    /// memory: `bool` -> Force open via memory
10830    /// default: false
10831    pub memory: bool,
10832    /// access: `Access` -> Required access pattern for this file
10833    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10834    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10835    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10836    ///  `Last` -> VIPS_ACCESS_LAST = 3
10837    pub access: Access,
10838    /// fail_on: `FailOn` -> Error level to fail on
10839    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10840    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10841    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10842    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10843    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10844    pub fail_on: FailOn,
10845    /// revalidate: `bool` -> Don't use a cached result for this operation
10846    /// default: false
10847    pub revalidate: bool,
10848}
10849
10850impl std::default::Default for PngloadSourceOptions {
10851    fn default() -> Self {
10852        PngloadSourceOptions {
10853            unlimited: false,
10854            flags: ForeignFlags::None,
10855            memory: false,
10856            access: Access::Random,
10857            fail_on: FailOn::None,
10858            revalidate: false,
10859        }
10860    }
10861}
10862
10863/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10864/// source: `&VipsSource` -> Source to load from
10865/// pngload_source_options: `&PngloadSourceOptions` -> optional arguments
10866/// returns `VipsImage` - Output image
10867pub fn pngload_source_with_opts(
10868    source: &VipsSource,
10869    pngload_source_options: &PngloadSourceOptions,
10870) -> Result<VipsImage> {
10871    unsafe {
10872        let source_in: *mut bindings::VipsSource = source.ctx;
10873        let mut out_out: *mut bindings::VipsImage = null_mut();
10874
10875        let unlimited_in: i32 = if pngload_source_options.unlimited {
10876            1
10877        } else {
10878            0
10879        };
10880        let unlimited_in_name = utils::new_c_string("unlimited")?;
10881
10882        let flags_in: i32 = pngload_source_options.flags as i32;
10883        let flags_in_name = utils::new_c_string("flags")?;
10884
10885        let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
10886        let memory_in_name = utils::new_c_string("memory")?;
10887
10888        let access_in: i32 = pngload_source_options.access as i32;
10889        let access_in_name = utils::new_c_string("access")?;
10890
10891        let fail_on_in: i32 = pngload_source_options.fail_on as i32;
10892        let fail_on_in_name = utils::new_c_string("fail-on")?;
10893
10894        let revalidate_in: i32 = if pngload_source_options.revalidate {
10895            1
10896        } else {
10897            0
10898        };
10899        let revalidate_in_name = utils::new_c_string("revalidate")?;
10900
10901        let vips_op_response = bindings::vips_pngload_source(
10902            source_in,
10903            &mut out_out,
10904            unlimited_in_name.as_ptr(),
10905            unlimited_in,
10906            flags_in_name.as_ptr(),
10907            flags_in,
10908            memory_in_name.as_ptr(),
10909            memory_in,
10910            access_in_name.as_ptr(),
10911            access_in,
10912            fail_on_in_name.as_ptr(),
10913            fail_on_in,
10914            revalidate_in_name.as_ptr(),
10915            revalidate_in,
10916            NULL,
10917        );
10918        utils::result(
10919            vips_op_response,
10920            VipsImage { ctx: out_out },
10921            Error::PngloadSourceError,
10922        )
10923    }
10924}
10925
10926/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
10927/// filename: `&str` -> Filename to load from
10928/// returns `VipsImage` - Output image
10929pub fn jpegload(filename: &str) -> Result<VipsImage> {
10930    unsafe {
10931        let filename_in: CString = utils::new_c_string(filename)?;
10932        let mut out_out: *mut bindings::VipsImage = null_mut();
10933
10934        let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
10935        utils::result(
10936            vips_op_response,
10937            VipsImage { ctx: out_out },
10938            Error::JpegloadError,
10939        )
10940    }
10941}
10942
10943/// Options for jpegload operation
10944#[derive(Clone, Debug)]
10945pub struct JpegloadOptions {
10946    /// shrink: `i32` -> Shrink factor on load
10947    /// min: 1, max: 8, default: 1
10948    pub shrink: i32,
10949    /// autorotate: `bool` -> Rotate image using exif orientation
10950    /// default: false
10951    pub autorotate: bool,
10952    /// unlimited: `bool` -> Remove all denial of service limits
10953    /// default: false
10954    pub unlimited: bool,
10955    /// flags: `ForeignFlags` -> Flags for this file
10956    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10957    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10958    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10959    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10960    ///  `All` -> VIPS_FOREIGN_ALL = 7
10961    pub flags: ForeignFlags,
10962    /// memory: `bool` -> Force open via memory
10963    /// default: false
10964    pub memory: bool,
10965    /// access: `Access` -> Required access pattern for this file
10966    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10967    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10968    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10969    ///  `Last` -> VIPS_ACCESS_LAST = 3
10970    pub access: Access,
10971    /// fail_on: `FailOn` -> Error level to fail on
10972    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10973    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10974    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10975    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10976    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10977    pub fail_on: FailOn,
10978    /// revalidate: `bool` -> Don't use a cached result for this operation
10979    /// default: false
10980    pub revalidate: bool,
10981}
10982
10983impl std::default::Default for JpegloadOptions {
10984    fn default() -> Self {
10985        JpegloadOptions {
10986            shrink: i32::from(1),
10987            autorotate: false,
10988            unlimited: false,
10989            flags: ForeignFlags::None,
10990            memory: false,
10991            access: Access::Random,
10992            fail_on: FailOn::None,
10993            revalidate: false,
10994        }
10995    }
10996}
10997
10998/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
10999/// filename: `&str` -> Filename to load from
11000/// jpegload_options: `&JpegloadOptions` -> optional arguments
11001/// returns `VipsImage` - Output image
11002pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11003    unsafe {
11004        let filename_in: CString = utils::new_c_string(filename)?;
11005        let mut out_out: *mut bindings::VipsImage = null_mut();
11006
11007        let shrink_in: i32 = jpegload_options.shrink;
11008        let shrink_in_name = utils::new_c_string("shrink")?;
11009
11010        let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11011        let autorotate_in_name = utils::new_c_string("autorotate")?;
11012
11013        let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11014        let unlimited_in_name = utils::new_c_string("unlimited")?;
11015
11016        let flags_in: i32 = jpegload_options.flags as i32;
11017        let flags_in_name = utils::new_c_string("flags")?;
11018
11019        let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11020        let memory_in_name = utils::new_c_string("memory")?;
11021
11022        let access_in: i32 = jpegload_options.access as i32;
11023        let access_in_name = utils::new_c_string("access")?;
11024
11025        let fail_on_in: i32 = jpegload_options.fail_on as i32;
11026        let fail_on_in_name = utils::new_c_string("fail-on")?;
11027
11028        let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11029        let revalidate_in_name = utils::new_c_string("revalidate")?;
11030
11031        let vips_op_response = bindings::vips_jpegload(
11032            filename_in.as_ptr(),
11033            &mut out_out,
11034            shrink_in_name.as_ptr(),
11035            shrink_in,
11036            autorotate_in_name.as_ptr(),
11037            autorotate_in,
11038            unlimited_in_name.as_ptr(),
11039            unlimited_in,
11040            flags_in_name.as_ptr(),
11041            flags_in,
11042            memory_in_name.as_ptr(),
11043            memory_in,
11044            access_in_name.as_ptr(),
11045            access_in,
11046            fail_on_in_name.as_ptr(),
11047            fail_on_in,
11048            revalidate_in_name.as_ptr(),
11049            revalidate_in,
11050            NULL,
11051        );
11052        utils::result(
11053            vips_op_response,
11054            VipsImage { ctx: out_out },
11055            Error::JpegloadError,
11056        )
11057    }
11058}
11059
11060/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11061/// buffer: `&[u8]` -> Buffer to load from
11062/// returns `VipsImage` - Output image
11063pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11064    unsafe {
11065        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11066        let mut out_out: *mut bindings::VipsImage = null_mut();
11067
11068        let vips_op_response =
11069            bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11070        utils::result(
11071            vips_op_response,
11072            VipsImage { ctx: out_out },
11073            Error::JpegloadBufferError,
11074        )
11075    }
11076}
11077
11078/// Options for jpegload_buffer operation
11079#[derive(Clone, Debug)]
11080pub struct JpegloadBufferOptions {
11081    /// shrink: `i32` -> Shrink factor on load
11082    /// min: 1, max: 8, default: 1
11083    pub shrink: i32,
11084    /// autorotate: `bool` -> Rotate image using exif orientation
11085    /// default: false
11086    pub autorotate: bool,
11087    /// unlimited: `bool` -> Remove all denial of service limits
11088    /// default: false
11089    pub unlimited: bool,
11090    /// flags: `ForeignFlags` -> Flags for this file
11091    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11092    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11093    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11094    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11095    ///  `All` -> VIPS_FOREIGN_ALL = 7
11096    pub flags: ForeignFlags,
11097    /// memory: `bool` -> Force open via memory
11098    /// default: false
11099    pub memory: bool,
11100    /// access: `Access` -> Required access pattern for this file
11101    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11102    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11103    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11104    ///  `Last` -> VIPS_ACCESS_LAST = 3
11105    pub access: Access,
11106    /// fail_on: `FailOn` -> Error level to fail on
11107    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11108    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11109    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11110    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11111    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11112    pub fail_on: FailOn,
11113    /// revalidate: `bool` -> Don't use a cached result for this operation
11114    /// default: false
11115    pub revalidate: bool,
11116}
11117
11118impl std::default::Default for JpegloadBufferOptions {
11119    fn default() -> Self {
11120        JpegloadBufferOptions {
11121            shrink: i32::from(1),
11122            autorotate: false,
11123            unlimited: false,
11124            flags: ForeignFlags::None,
11125            memory: false,
11126            access: Access::Random,
11127            fail_on: FailOn::None,
11128            revalidate: false,
11129        }
11130    }
11131}
11132
11133/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11134/// buffer: `&[u8]` -> Buffer to load from
11135/// jpegload_buffer_options: `&JpegloadBufferOptions` -> optional arguments
11136/// returns `VipsImage` - Output image
11137pub fn jpegload_buffer_with_opts(
11138    buffer: &[u8],
11139    jpegload_buffer_options: &JpegloadBufferOptions,
11140) -> Result<VipsImage> {
11141    unsafe {
11142        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11143        let mut out_out: *mut bindings::VipsImage = null_mut();
11144
11145        let shrink_in: i32 = jpegload_buffer_options.shrink;
11146        let shrink_in_name = utils::new_c_string("shrink")?;
11147
11148        let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11149            1
11150        } else {
11151            0
11152        };
11153        let autorotate_in_name = utils::new_c_string("autorotate")?;
11154
11155        let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11156            1
11157        } else {
11158            0
11159        };
11160        let unlimited_in_name = utils::new_c_string("unlimited")?;
11161
11162        let flags_in: i32 = jpegload_buffer_options.flags as i32;
11163        let flags_in_name = utils::new_c_string("flags")?;
11164
11165        let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11166        let memory_in_name = utils::new_c_string("memory")?;
11167
11168        let access_in: i32 = jpegload_buffer_options.access as i32;
11169        let access_in_name = utils::new_c_string("access")?;
11170
11171        let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11172        let fail_on_in_name = utils::new_c_string("fail-on")?;
11173
11174        let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11175            1
11176        } else {
11177            0
11178        };
11179        let revalidate_in_name = utils::new_c_string("revalidate")?;
11180
11181        let vips_op_response = bindings::vips_jpegload_buffer(
11182            buffer_in,
11183            buffer.len() as u64,
11184            &mut out_out,
11185            shrink_in_name.as_ptr(),
11186            shrink_in,
11187            autorotate_in_name.as_ptr(),
11188            autorotate_in,
11189            unlimited_in_name.as_ptr(),
11190            unlimited_in,
11191            flags_in_name.as_ptr(),
11192            flags_in,
11193            memory_in_name.as_ptr(),
11194            memory_in,
11195            access_in_name.as_ptr(),
11196            access_in,
11197            fail_on_in_name.as_ptr(),
11198            fail_on_in,
11199            revalidate_in_name.as_ptr(),
11200            revalidate_in,
11201            NULL,
11202        );
11203        utils::result(
11204            vips_op_response,
11205            VipsImage { ctx: out_out },
11206            Error::JpegloadBufferError,
11207        )
11208    }
11209}
11210
11211/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11212/// filename: `&str` -> Filename to load from
11213/// returns `VipsImage` - Output image
11214pub fn webpload(filename: &str) -> Result<VipsImage> {
11215    unsafe {
11216        let filename_in: CString = utils::new_c_string(filename)?;
11217        let mut out_out: *mut bindings::VipsImage = null_mut();
11218
11219        let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11220        utils::result(
11221            vips_op_response,
11222            VipsImage { ctx: out_out },
11223            Error::WebploadError,
11224        )
11225    }
11226}
11227
11228/// Options for webpload operation
11229#[derive(Clone, Debug)]
11230pub struct WebploadOptions {
11231    /// page: `i32` -> First page to load
11232    /// min: 0, max: 100000, default: 0
11233    pub page: i32,
11234    /// n: `i32` -> Number of pages to load, -1 for all
11235    /// min: -1, max: 100000, default: 1
11236    pub n: i32,
11237    /// scale: `f64` -> Factor to scale by
11238    /// min: 0, max: 1024, default: 1
11239    pub scale: f64,
11240    /// flags: `ForeignFlags` -> Flags for this file
11241    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11242    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11243    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11244    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11245    ///  `All` -> VIPS_FOREIGN_ALL = 7
11246    pub flags: ForeignFlags,
11247    /// memory: `bool` -> Force open via memory
11248    /// default: false
11249    pub memory: bool,
11250    /// access: `Access` -> Required access pattern for this file
11251    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11252    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11253    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11254    ///  `Last` -> VIPS_ACCESS_LAST = 3
11255    pub access: Access,
11256    /// fail_on: `FailOn` -> Error level to fail on
11257    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11258    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11259    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11260    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11261    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11262    pub fail_on: FailOn,
11263    /// revalidate: `bool` -> Don't use a cached result for this operation
11264    /// default: false
11265    pub revalidate: bool,
11266}
11267
11268impl std::default::Default for WebploadOptions {
11269    fn default() -> Self {
11270        WebploadOptions {
11271            page: i32::from(0),
11272            n: i32::from(1),
11273            scale: f64::from(1),
11274            flags: ForeignFlags::None,
11275            memory: false,
11276            access: Access::Random,
11277            fail_on: FailOn::None,
11278            revalidate: false,
11279        }
11280    }
11281}
11282
11283/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11284/// filename: `&str` -> Filename to load from
11285/// webpload_options: `&WebploadOptions` -> optional arguments
11286/// returns `VipsImage` - Output image
11287pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11288    unsafe {
11289        let filename_in: CString = utils::new_c_string(filename)?;
11290        let mut out_out: *mut bindings::VipsImage = null_mut();
11291
11292        let page_in: i32 = webpload_options.page;
11293        let page_in_name = utils::new_c_string("page")?;
11294
11295        let n_in: i32 = webpload_options.n;
11296        let n_in_name = utils::new_c_string("n")?;
11297
11298        let scale_in: f64 = webpload_options.scale;
11299        let scale_in_name = utils::new_c_string("scale")?;
11300
11301        let flags_in: i32 = webpload_options.flags as i32;
11302        let flags_in_name = utils::new_c_string("flags")?;
11303
11304        let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11305        let memory_in_name = utils::new_c_string("memory")?;
11306
11307        let access_in: i32 = webpload_options.access as i32;
11308        let access_in_name = utils::new_c_string("access")?;
11309
11310        let fail_on_in: i32 = webpload_options.fail_on as i32;
11311        let fail_on_in_name = utils::new_c_string("fail-on")?;
11312
11313        let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11314        let revalidate_in_name = utils::new_c_string("revalidate")?;
11315
11316        let vips_op_response = bindings::vips_webpload(
11317            filename_in.as_ptr(),
11318            &mut out_out,
11319            page_in_name.as_ptr(),
11320            page_in,
11321            n_in_name.as_ptr(),
11322            n_in,
11323            scale_in_name.as_ptr(),
11324            scale_in,
11325            flags_in_name.as_ptr(),
11326            flags_in,
11327            memory_in_name.as_ptr(),
11328            memory_in,
11329            access_in_name.as_ptr(),
11330            access_in,
11331            fail_on_in_name.as_ptr(),
11332            fail_on_in,
11333            revalidate_in_name.as_ptr(),
11334            revalidate_in,
11335            NULL,
11336        );
11337        utils::result(
11338            vips_op_response,
11339            VipsImage { ctx: out_out },
11340            Error::WebploadError,
11341        )
11342    }
11343}
11344
11345/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11346/// buffer: `&[u8]` -> Buffer to load from
11347/// returns `VipsImage` - Output image
11348pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11349    unsafe {
11350        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11351        let mut out_out: *mut bindings::VipsImage = null_mut();
11352
11353        let vips_op_response =
11354            bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11355        utils::result(
11356            vips_op_response,
11357            VipsImage { ctx: out_out },
11358            Error::WebploadBufferError,
11359        )
11360    }
11361}
11362
11363/// Options for webpload_buffer operation
11364#[derive(Clone, Debug)]
11365pub struct WebploadBufferOptions {
11366    /// page: `i32` -> First page to load
11367    /// min: 0, max: 100000, default: 0
11368    pub page: i32,
11369    /// n: `i32` -> Number of pages to load, -1 for all
11370    /// min: -1, max: 100000, default: 1
11371    pub n: i32,
11372    /// scale: `f64` -> Factor to scale by
11373    /// min: 0, max: 1024, default: 1
11374    pub scale: f64,
11375    /// flags: `ForeignFlags` -> Flags for this file
11376    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11377    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11378    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11379    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11380    ///  `All` -> VIPS_FOREIGN_ALL = 7
11381    pub flags: ForeignFlags,
11382    /// memory: `bool` -> Force open via memory
11383    /// default: false
11384    pub memory: bool,
11385    /// access: `Access` -> Required access pattern for this file
11386    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11387    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11388    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11389    ///  `Last` -> VIPS_ACCESS_LAST = 3
11390    pub access: Access,
11391    /// fail_on: `FailOn` -> Error level to fail on
11392    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11393    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11394    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11395    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11396    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11397    pub fail_on: FailOn,
11398    /// revalidate: `bool` -> Don't use a cached result for this operation
11399    /// default: false
11400    pub revalidate: bool,
11401}
11402
11403impl std::default::Default for WebploadBufferOptions {
11404    fn default() -> Self {
11405        WebploadBufferOptions {
11406            page: i32::from(0),
11407            n: i32::from(1),
11408            scale: f64::from(1),
11409            flags: ForeignFlags::None,
11410            memory: false,
11411            access: Access::Random,
11412            fail_on: FailOn::None,
11413            revalidate: false,
11414        }
11415    }
11416}
11417
11418/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11419/// buffer: `&[u8]` -> Buffer to load from
11420/// webpload_buffer_options: `&WebploadBufferOptions` -> optional arguments
11421/// returns `VipsImage` - Output image
11422pub fn webpload_buffer_with_opts(
11423    buffer: &[u8],
11424    webpload_buffer_options: &WebploadBufferOptions,
11425) -> Result<VipsImage> {
11426    unsafe {
11427        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11428        let mut out_out: *mut bindings::VipsImage = null_mut();
11429
11430        let page_in: i32 = webpload_buffer_options.page;
11431        let page_in_name = utils::new_c_string("page")?;
11432
11433        let n_in: i32 = webpload_buffer_options.n;
11434        let n_in_name = utils::new_c_string("n")?;
11435
11436        let scale_in: f64 = webpload_buffer_options.scale;
11437        let scale_in_name = utils::new_c_string("scale")?;
11438
11439        let flags_in: i32 = webpload_buffer_options.flags as i32;
11440        let flags_in_name = utils::new_c_string("flags")?;
11441
11442        let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11443        let memory_in_name = utils::new_c_string("memory")?;
11444
11445        let access_in: i32 = webpload_buffer_options.access as i32;
11446        let access_in_name = utils::new_c_string("access")?;
11447
11448        let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11449        let fail_on_in_name = utils::new_c_string("fail-on")?;
11450
11451        let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11452            1
11453        } else {
11454            0
11455        };
11456        let revalidate_in_name = utils::new_c_string("revalidate")?;
11457
11458        let vips_op_response = bindings::vips_webpload_buffer(
11459            buffer_in,
11460            buffer.len() as u64,
11461            &mut out_out,
11462            page_in_name.as_ptr(),
11463            page_in,
11464            n_in_name.as_ptr(),
11465            n_in,
11466            scale_in_name.as_ptr(),
11467            scale_in,
11468            flags_in_name.as_ptr(),
11469            flags_in,
11470            memory_in_name.as_ptr(),
11471            memory_in,
11472            access_in_name.as_ptr(),
11473            access_in,
11474            fail_on_in_name.as_ptr(),
11475            fail_on_in,
11476            revalidate_in_name.as_ptr(),
11477            revalidate_in,
11478            NULL,
11479        );
11480        utils::result(
11481            vips_op_response,
11482            VipsImage { ctx: out_out },
11483            Error::WebploadBufferError,
11484        )
11485    }
11486}
11487
11488/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11489/// source: `&VipsSource` -> Source to load from
11490/// returns `VipsImage` - Output image
11491pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11492    unsafe {
11493        let source_in: *mut bindings::VipsSource = source.ctx;
11494        let mut out_out: *mut bindings::VipsImage = null_mut();
11495
11496        let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11497        utils::result(
11498            vips_op_response,
11499            VipsImage { ctx: out_out },
11500            Error::WebploadSourceError,
11501        )
11502    }
11503}
11504
11505/// Options for webpload_source operation
11506#[derive(Clone, Debug)]
11507pub struct WebploadSourceOptions {
11508    /// page: `i32` -> First page to load
11509    /// min: 0, max: 100000, default: 0
11510    pub page: i32,
11511    /// n: `i32` -> Number of pages to load, -1 for all
11512    /// min: -1, max: 100000, default: 1
11513    pub n: i32,
11514    /// scale: `f64` -> Factor to scale by
11515    /// min: 0, max: 1024, default: 1
11516    pub scale: f64,
11517    /// flags: `ForeignFlags` -> Flags for this file
11518    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11519    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11520    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11521    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11522    ///  `All` -> VIPS_FOREIGN_ALL = 7
11523    pub flags: ForeignFlags,
11524    /// memory: `bool` -> Force open via memory
11525    /// default: false
11526    pub memory: bool,
11527    /// access: `Access` -> Required access pattern for this file
11528    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11529    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11530    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11531    ///  `Last` -> VIPS_ACCESS_LAST = 3
11532    pub access: Access,
11533    /// fail_on: `FailOn` -> Error level to fail on
11534    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11535    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11536    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11537    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11538    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11539    pub fail_on: FailOn,
11540    /// revalidate: `bool` -> Don't use a cached result for this operation
11541    /// default: false
11542    pub revalidate: bool,
11543}
11544
11545impl std::default::Default for WebploadSourceOptions {
11546    fn default() -> Self {
11547        WebploadSourceOptions {
11548            page: i32::from(0),
11549            n: i32::from(1),
11550            scale: f64::from(1),
11551            flags: ForeignFlags::None,
11552            memory: false,
11553            access: Access::Random,
11554            fail_on: FailOn::None,
11555            revalidate: false,
11556        }
11557    }
11558}
11559
11560/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11561/// source: `&VipsSource` -> Source to load from
11562/// webpload_source_options: `&WebploadSourceOptions` -> optional arguments
11563/// returns `VipsImage` - Output image
11564pub fn webpload_source_with_opts(
11565    source: &VipsSource,
11566    webpload_source_options: &WebploadSourceOptions,
11567) -> Result<VipsImage> {
11568    unsafe {
11569        let source_in: *mut bindings::VipsSource = source.ctx;
11570        let mut out_out: *mut bindings::VipsImage = null_mut();
11571
11572        let page_in: i32 = webpload_source_options.page;
11573        let page_in_name = utils::new_c_string("page")?;
11574
11575        let n_in: i32 = webpload_source_options.n;
11576        let n_in_name = utils::new_c_string("n")?;
11577
11578        let scale_in: f64 = webpload_source_options.scale;
11579        let scale_in_name = utils::new_c_string("scale")?;
11580
11581        let flags_in: i32 = webpload_source_options.flags as i32;
11582        let flags_in_name = utils::new_c_string("flags")?;
11583
11584        let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11585        let memory_in_name = utils::new_c_string("memory")?;
11586
11587        let access_in: i32 = webpload_source_options.access as i32;
11588        let access_in_name = utils::new_c_string("access")?;
11589
11590        let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11591        let fail_on_in_name = utils::new_c_string("fail-on")?;
11592
11593        let revalidate_in: i32 = if webpload_source_options.revalidate {
11594            1
11595        } else {
11596            0
11597        };
11598        let revalidate_in_name = utils::new_c_string("revalidate")?;
11599
11600        let vips_op_response = bindings::vips_webpload_source(
11601            source_in,
11602            &mut out_out,
11603            page_in_name.as_ptr(),
11604            page_in,
11605            n_in_name.as_ptr(),
11606            n_in,
11607            scale_in_name.as_ptr(),
11608            scale_in,
11609            flags_in_name.as_ptr(),
11610            flags_in,
11611            memory_in_name.as_ptr(),
11612            memory_in,
11613            access_in_name.as_ptr(),
11614            access_in,
11615            fail_on_in_name.as_ptr(),
11616            fail_on_in,
11617            revalidate_in_name.as_ptr(),
11618            revalidate_in,
11619            NULL,
11620        );
11621        utils::result(
11622            vips_op_response,
11623            VipsImage { ctx: out_out },
11624            Error::WebploadSourceError,
11625        )
11626    }
11627}
11628
11629/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11630/// filename: `&str` -> Filename to load from
11631/// returns `VipsImage` - Output image
11632pub fn tiffload(filename: &str) -> Result<VipsImage> {
11633    unsafe {
11634        let filename_in: CString = utils::new_c_string(filename)?;
11635        let mut out_out: *mut bindings::VipsImage = null_mut();
11636
11637        let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11638        utils::result(
11639            vips_op_response,
11640            VipsImage { ctx: out_out },
11641            Error::TiffloadError,
11642        )
11643    }
11644}
11645
11646/// Options for tiffload operation
11647#[derive(Clone, Debug)]
11648pub struct TiffloadOptions {
11649    /// page: `i32` -> First page to load
11650    /// min: 0, max: 100000, default: 0
11651    pub page: i32,
11652    /// subifd: `i32` -> Subifd index
11653    /// min: -1, max: 100000, default: -1
11654    pub subifd: i32,
11655    /// n: `i32` -> Number of pages to load, -1 for all
11656    /// min: -1, max: 100000, default: 1
11657    pub n: i32,
11658    /// autorotate: `bool` -> Rotate image using orientation tag
11659    /// default: false
11660    pub autorotate: bool,
11661    /// flags: `ForeignFlags` -> Flags for this file
11662    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11663    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11664    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11665    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11666    ///  `All` -> VIPS_FOREIGN_ALL = 7
11667    pub flags: ForeignFlags,
11668    /// memory: `bool` -> Force open via memory
11669    /// default: false
11670    pub memory: bool,
11671    /// access: `Access` -> Required access pattern for this file
11672    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11673    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11674    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11675    ///  `Last` -> VIPS_ACCESS_LAST = 3
11676    pub access: Access,
11677    /// fail_on: `FailOn` -> Error level to fail on
11678    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11679    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11680    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11681    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11682    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11683    pub fail_on: FailOn,
11684    /// revalidate: `bool` -> Don't use a cached result for this operation
11685    /// default: false
11686    pub revalidate: bool,
11687}
11688
11689impl std::default::Default for TiffloadOptions {
11690    fn default() -> Self {
11691        TiffloadOptions {
11692            page: i32::from(0),
11693            subifd: i32::from(-1),
11694            n: i32::from(1),
11695            autorotate: false,
11696            flags: ForeignFlags::None,
11697            memory: false,
11698            access: Access::Random,
11699            fail_on: FailOn::None,
11700            revalidate: false,
11701        }
11702    }
11703}
11704
11705/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11706/// filename: `&str` -> Filename to load from
11707/// tiffload_options: `&TiffloadOptions` -> optional arguments
11708/// returns `VipsImage` - Output image
11709pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11710    unsafe {
11711        let filename_in: CString = utils::new_c_string(filename)?;
11712        let mut out_out: *mut bindings::VipsImage = null_mut();
11713
11714        let page_in: i32 = tiffload_options.page;
11715        let page_in_name = utils::new_c_string("page")?;
11716
11717        let subifd_in: i32 = tiffload_options.subifd;
11718        let subifd_in_name = utils::new_c_string("subifd")?;
11719
11720        let n_in: i32 = tiffload_options.n;
11721        let n_in_name = utils::new_c_string("n")?;
11722
11723        let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11724        let autorotate_in_name = utils::new_c_string("autorotate")?;
11725
11726        let flags_in: i32 = tiffload_options.flags as i32;
11727        let flags_in_name = utils::new_c_string("flags")?;
11728
11729        let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11730        let memory_in_name = utils::new_c_string("memory")?;
11731
11732        let access_in: i32 = tiffload_options.access as i32;
11733        let access_in_name = utils::new_c_string("access")?;
11734
11735        let fail_on_in: i32 = tiffload_options.fail_on as i32;
11736        let fail_on_in_name = utils::new_c_string("fail-on")?;
11737
11738        let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11739        let revalidate_in_name = utils::new_c_string("revalidate")?;
11740
11741        let vips_op_response = bindings::vips_tiffload(
11742            filename_in.as_ptr(),
11743            &mut out_out,
11744            page_in_name.as_ptr(),
11745            page_in,
11746            subifd_in_name.as_ptr(),
11747            subifd_in,
11748            n_in_name.as_ptr(),
11749            n_in,
11750            autorotate_in_name.as_ptr(),
11751            autorotate_in,
11752            flags_in_name.as_ptr(),
11753            flags_in,
11754            memory_in_name.as_ptr(),
11755            memory_in,
11756            access_in_name.as_ptr(),
11757            access_in,
11758            fail_on_in_name.as_ptr(),
11759            fail_on_in,
11760            revalidate_in_name.as_ptr(),
11761            revalidate_in,
11762            NULL,
11763        );
11764        utils::result(
11765            vips_op_response,
11766            VipsImage { ctx: out_out },
11767            Error::TiffloadError,
11768        )
11769    }
11770}
11771
11772/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11773/// buffer: `&[u8]` -> Buffer to load from
11774/// returns `VipsImage` - Output image
11775pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11776    unsafe {
11777        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11778        let mut out_out: *mut bindings::VipsImage = null_mut();
11779
11780        let vips_op_response =
11781            bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11782        utils::result(
11783            vips_op_response,
11784            VipsImage { ctx: out_out },
11785            Error::TiffloadBufferError,
11786        )
11787    }
11788}
11789
11790/// Options for tiffload_buffer operation
11791#[derive(Clone, Debug)]
11792pub struct TiffloadBufferOptions {
11793    /// page: `i32` -> First page to load
11794    /// min: 0, max: 100000, default: 0
11795    pub page: i32,
11796    /// subifd: `i32` -> Subifd index
11797    /// min: -1, max: 100000, default: -1
11798    pub subifd: i32,
11799    /// n: `i32` -> Number of pages to load, -1 for all
11800    /// min: -1, max: 100000, default: 1
11801    pub n: i32,
11802    /// autorotate: `bool` -> Rotate image using orientation tag
11803    /// default: false
11804    pub autorotate: bool,
11805    /// flags: `ForeignFlags` -> Flags for this file
11806    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11807    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11808    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11809    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11810    ///  `All` -> VIPS_FOREIGN_ALL = 7
11811    pub flags: ForeignFlags,
11812    /// memory: `bool` -> Force open via memory
11813    /// default: false
11814    pub memory: bool,
11815    /// access: `Access` -> Required access pattern for this file
11816    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11817    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11818    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11819    ///  `Last` -> VIPS_ACCESS_LAST = 3
11820    pub access: Access,
11821    /// fail_on: `FailOn` -> Error level to fail on
11822    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11823    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11824    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11825    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11826    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11827    pub fail_on: FailOn,
11828    /// revalidate: `bool` -> Don't use a cached result for this operation
11829    /// default: false
11830    pub revalidate: bool,
11831}
11832
11833impl std::default::Default for TiffloadBufferOptions {
11834    fn default() -> Self {
11835        TiffloadBufferOptions {
11836            page: i32::from(0),
11837            subifd: i32::from(-1),
11838            n: i32::from(1),
11839            autorotate: false,
11840            flags: ForeignFlags::None,
11841            memory: false,
11842            access: Access::Random,
11843            fail_on: FailOn::None,
11844            revalidate: false,
11845        }
11846    }
11847}
11848
11849/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11850/// buffer: `&[u8]` -> Buffer to load from
11851/// tiffload_buffer_options: `&TiffloadBufferOptions` -> optional arguments
11852/// returns `VipsImage` - Output image
11853pub fn tiffload_buffer_with_opts(
11854    buffer: &[u8],
11855    tiffload_buffer_options: &TiffloadBufferOptions,
11856) -> Result<VipsImage> {
11857    unsafe {
11858        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11859        let mut out_out: *mut bindings::VipsImage = null_mut();
11860
11861        let page_in: i32 = tiffload_buffer_options.page;
11862        let page_in_name = utils::new_c_string("page")?;
11863
11864        let subifd_in: i32 = tiffload_buffer_options.subifd;
11865        let subifd_in_name = utils::new_c_string("subifd")?;
11866
11867        let n_in: i32 = tiffload_buffer_options.n;
11868        let n_in_name = utils::new_c_string("n")?;
11869
11870        let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
11871            1
11872        } else {
11873            0
11874        };
11875        let autorotate_in_name = utils::new_c_string("autorotate")?;
11876
11877        let flags_in: i32 = tiffload_buffer_options.flags as i32;
11878        let flags_in_name = utils::new_c_string("flags")?;
11879
11880        let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
11881        let memory_in_name = utils::new_c_string("memory")?;
11882
11883        let access_in: i32 = tiffload_buffer_options.access as i32;
11884        let access_in_name = utils::new_c_string("access")?;
11885
11886        let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
11887        let fail_on_in_name = utils::new_c_string("fail-on")?;
11888
11889        let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
11890            1
11891        } else {
11892            0
11893        };
11894        let revalidate_in_name = utils::new_c_string("revalidate")?;
11895
11896        let vips_op_response = bindings::vips_tiffload_buffer(
11897            buffer_in,
11898            buffer.len() as u64,
11899            &mut out_out,
11900            page_in_name.as_ptr(),
11901            page_in,
11902            subifd_in_name.as_ptr(),
11903            subifd_in,
11904            n_in_name.as_ptr(),
11905            n_in,
11906            autorotate_in_name.as_ptr(),
11907            autorotate_in,
11908            flags_in_name.as_ptr(),
11909            flags_in,
11910            memory_in_name.as_ptr(),
11911            memory_in,
11912            access_in_name.as_ptr(),
11913            access_in,
11914            fail_on_in_name.as_ptr(),
11915            fail_on_in,
11916            revalidate_in_name.as_ptr(),
11917            revalidate_in,
11918            NULL,
11919        );
11920        utils::result(
11921            vips_op_response,
11922            VipsImage { ctx: out_out },
11923            Error::TiffloadBufferError,
11924        )
11925    }
11926}
11927
11928/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11929/// source: `&VipsSource` -> Source to load from
11930/// returns `VipsImage` - Output image
11931pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
11932    unsafe {
11933        let source_in: *mut bindings::VipsSource = source.ctx;
11934        let mut out_out: *mut bindings::VipsImage = null_mut();
11935
11936        let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
11937        utils::result(
11938            vips_op_response,
11939            VipsImage { ctx: out_out },
11940            Error::TiffloadSourceError,
11941        )
11942    }
11943}
11944
11945/// Options for tiffload_source operation
11946#[derive(Clone, Debug)]
11947pub struct TiffloadSourceOptions {
11948    /// page: `i32` -> First page to load
11949    /// min: 0, max: 100000, default: 0
11950    pub page: i32,
11951    /// subifd: `i32` -> Subifd index
11952    /// min: -1, max: 100000, default: -1
11953    pub subifd: i32,
11954    /// n: `i32` -> Number of pages to load, -1 for all
11955    /// min: -1, max: 100000, default: 1
11956    pub n: i32,
11957    /// autorotate: `bool` -> Rotate image using orientation tag
11958    /// default: false
11959    pub autorotate: bool,
11960    /// flags: `ForeignFlags` -> Flags for this file
11961    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11962    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11963    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11964    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11965    ///  `All` -> VIPS_FOREIGN_ALL = 7
11966    pub flags: ForeignFlags,
11967    /// memory: `bool` -> Force open via memory
11968    /// default: false
11969    pub memory: bool,
11970    /// access: `Access` -> Required access pattern for this file
11971    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11972    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11973    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11974    ///  `Last` -> VIPS_ACCESS_LAST = 3
11975    pub access: Access,
11976    /// fail_on: `FailOn` -> Error level to fail on
11977    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11978    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11979    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11980    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11981    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11982    pub fail_on: FailOn,
11983    /// revalidate: `bool` -> Don't use a cached result for this operation
11984    /// default: false
11985    pub revalidate: bool,
11986}
11987
11988impl std::default::Default for TiffloadSourceOptions {
11989    fn default() -> Self {
11990        TiffloadSourceOptions {
11991            page: i32::from(0),
11992            subifd: i32::from(-1),
11993            n: i32::from(1),
11994            autorotate: false,
11995            flags: ForeignFlags::None,
11996            memory: false,
11997            access: Access::Random,
11998            fail_on: FailOn::None,
11999            revalidate: false,
12000        }
12001    }
12002}
12003
12004/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12005/// source: `&VipsSource` -> Source to load from
12006/// tiffload_source_options: `&TiffloadSourceOptions` -> optional arguments
12007/// returns `VipsImage` - Output image
12008pub fn tiffload_source_with_opts(
12009    source: &VipsSource,
12010    tiffload_source_options: &TiffloadSourceOptions,
12011) -> Result<VipsImage> {
12012    unsafe {
12013        let source_in: *mut bindings::VipsSource = source.ctx;
12014        let mut out_out: *mut bindings::VipsImage = null_mut();
12015
12016        let page_in: i32 = tiffload_source_options.page;
12017        let page_in_name = utils::new_c_string("page")?;
12018
12019        let subifd_in: i32 = tiffload_source_options.subifd;
12020        let subifd_in_name = utils::new_c_string("subifd")?;
12021
12022        let n_in: i32 = tiffload_source_options.n;
12023        let n_in_name = utils::new_c_string("n")?;
12024
12025        let autorotate_in: i32 = if tiffload_source_options.autorotate {
12026            1
12027        } else {
12028            0
12029        };
12030        let autorotate_in_name = utils::new_c_string("autorotate")?;
12031
12032        let flags_in: i32 = tiffload_source_options.flags as i32;
12033        let flags_in_name = utils::new_c_string("flags")?;
12034
12035        let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12036        let memory_in_name = utils::new_c_string("memory")?;
12037
12038        let access_in: i32 = tiffload_source_options.access as i32;
12039        let access_in_name = utils::new_c_string("access")?;
12040
12041        let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12042        let fail_on_in_name = utils::new_c_string("fail-on")?;
12043
12044        let revalidate_in: i32 = if tiffload_source_options.revalidate {
12045            1
12046        } else {
12047            0
12048        };
12049        let revalidate_in_name = utils::new_c_string("revalidate")?;
12050
12051        let vips_op_response = bindings::vips_tiffload_source(
12052            source_in,
12053            &mut out_out,
12054            page_in_name.as_ptr(),
12055            page_in,
12056            subifd_in_name.as_ptr(),
12057            subifd_in,
12058            n_in_name.as_ptr(),
12059            n_in,
12060            autorotate_in_name.as_ptr(),
12061            autorotate_in,
12062            flags_in_name.as_ptr(),
12063            flags_in,
12064            memory_in_name.as_ptr(),
12065            memory_in,
12066            access_in_name.as_ptr(),
12067            access_in,
12068            fail_on_in_name.as_ptr(),
12069            fail_on_in,
12070            revalidate_in_name.as_ptr(),
12071            revalidate_in,
12072            NULL,
12073        );
12074        utils::result(
12075            vips_op_response,
12076            VipsImage { ctx: out_out },
12077            Error::TiffloadSourceError,
12078        )
12079    }
12080}
12081
12082/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12083/// filename: `&str` -> Filename to load from
12084/// returns `VipsImage` - Output image
12085pub fn heifload(filename: &str) -> Result<VipsImage> {
12086    unsafe {
12087        let filename_in: CString = utils::new_c_string(filename)?;
12088        let mut out_out: *mut bindings::VipsImage = null_mut();
12089
12090        let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12091        utils::result(
12092            vips_op_response,
12093            VipsImage { ctx: out_out },
12094            Error::HeifloadError,
12095        )
12096    }
12097}
12098
12099/// Options for heifload operation
12100#[derive(Clone, Debug)]
12101pub struct HeifloadOptions {
12102    /// page: `i32` -> First page to load
12103    /// min: 0, max: 100000, default: 0
12104    pub page: i32,
12105    /// n: `i32` -> Number of pages to load, -1 for all
12106    /// min: -1, max: 100000, default: 1
12107    pub n: i32,
12108    /// thumbnail: `bool` -> Fetch thumbnail image
12109    /// default: false
12110    pub thumbnail: bool,
12111    /// unlimited: `bool` -> Remove all denial of service limits
12112    /// default: false
12113    pub unlimited: bool,
12114    /// flags: `ForeignFlags` -> Flags for this file
12115    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12116    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12117    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12118    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12119    ///  `All` -> VIPS_FOREIGN_ALL = 7
12120    pub flags: ForeignFlags,
12121    /// memory: `bool` -> Force open via memory
12122    /// default: false
12123    pub memory: bool,
12124    /// access: `Access` -> Required access pattern for this file
12125    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12126    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12127    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12128    ///  `Last` -> VIPS_ACCESS_LAST = 3
12129    pub access: Access,
12130    /// fail_on: `FailOn` -> Error level to fail on
12131    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12132    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12133    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12134    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12135    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12136    pub fail_on: FailOn,
12137    /// revalidate: `bool` -> Don't use a cached result for this operation
12138    /// default: false
12139    pub revalidate: bool,
12140}
12141
12142impl std::default::Default for HeifloadOptions {
12143    fn default() -> Self {
12144        HeifloadOptions {
12145            page: i32::from(0),
12146            n: i32::from(1),
12147            thumbnail: false,
12148            unlimited: false,
12149            flags: ForeignFlags::None,
12150            memory: false,
12151            access: Access::Random,
12152            fail_on: FailOn::None,
12153            revalidate: false,
12154        }
12155    }
12156}
12157
12158/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12159/// filename: `&str` -> Filename to load from
12160/// heifload_options: `&HeifloadOptions` -> optional arguments
12161/// returns `VipsImage` - Output image
12162pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
12163    unsafe {
12164        let filename_in: CString = utils::new_c_string(filename)?;
12165        let mut out_out: *mut bindings::VipsImage = null_mut();
12166
12167        let page_in: i32 = heifload_options.page;
12168        let page_in_name = utils::new_c_string("page")?;
12169
12170        let n_in: i32 = heifload_options.n;
12171        let n_in_name = utils::new_c_string("n")?;
12172
12173        let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
12174        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12175
12176        let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
12177        let unlimited_in_name = utils::new_c_string("unlimited")?;
12178
12179        let flags_in: i32 = heifload_options.flags as i32;
12180        let flags_in_name = utils::new_c_string("flags")?;
12181
12182        let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12183        let memory_in_name = utils::new_c_string("memory")?;
12184
12185        let access_in: i32 = heifload_options.access as i32;
12186        let access_in_name = utils::new_c_string("access")?;
12187
12188        let fail_on_in: i32 = heifload_options.fail_on as i32;
12189        let fail_on_in_name = utils::new_c_string("fail-on")?;
12190
12191        let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12192        let revalidate_in_name = utils::new_c_string("revalidate")?;
12193
12194        let vips_op_response = bindings::vips_heifload(
12195            filename_in.as_ptr(),
12196            &mut out_out,
12197            page_in_name.as_ptr(),
12198            page_in,
12199            n_in_name.as_ptr(),
12200            n_in,
12201            thumbnail_in_name.as_ptr(),
12202            thumbnail_in,
12203            unlimited_in_name.as_ptr(),
12204            unlimited_in,
12205            flags_in_name.as_ptr(),
12206            flags_in,
12207            memory_in_name.as_ptr(),
12208            memory_in,
12209            access_in_name.as_ptr(),
12210            access_in,
12211            fail_on_in_name.as_ptr(),
12212            fail_on_in,
12213            revalidate_in_name.as_ptr(),
12214            revalidate_in,
12215            NULL,
12216        );
12217        utils::result(
12218            vips_op_response,
12219            VipsImage { ctx: out_out },
12220            Error::HeifloadError,
12221        )
12222    }
12223}
12224
12225/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12226/// buffer: `&[u8]` -> Buffer to load from
12227/// returns `VipsImage` - Output image
12228pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12229    unsafe {
12230        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12231        let mut out_out: *mut bindings::VipsImage = null_mut();
12232
12233        let vips_op_response =
12234            bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12235        utils::result(
12236            vips_op_response,
12237            VipsImage { ctx: out_out },
12238            Error::HeifloadBufferError,
12239        )
12240    }
12241}
12242
12243/// Options for heifload_buffer operation
12244#[derive(Clone, Debug)]
12245pub struct HeifloadBufferOptions {
12246    /// page: `i32` -> First page to load
12247    /// min: 0, max: 100000, default: 0
12248    pub page: i32,
12249    /// n: `i32` -> Number of pages to load, -1 for all
12250    /// min: -1, max: 100000, default: 1
12251    pub n: i32,
12252    /// thumbnail: `bool` -> Fetch thumbnail image
12253    /// default: false
12254    pub thumbnail: bool,
12255    /// unlimited: `bool` -> Remove all denial of service limits
12256    /// default: false
12257    pub unlimited: bool,
12258    /// flags: `ForeignFlags` -> Flags for this file
12259    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12260    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12261    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12262    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12263    ///  `All` -> VIPS_FOREIGN_ALL = 7
12264    pub flags: ForeignFlags,
12265    /// memory: `bool` -> Force open via memory
12266    /// default: false
12267    pub memory: bool,
12268    /// access: `Access` -> Required access pattern for this file
12269    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12270    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12271    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12272    ///  `Last` -> VIPS_ACCESS_LAST = 3
12273    pub access: Access,
12274    /// fail_on: `FailOn` -> Error level to fail on
12275    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12276    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12277    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12278    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12279    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12280    pub fail_on: FailOn,
12281    /// revalidate: `bool` -> Don't use a cached result for this operation
12282    /// default: false
12283    pub revalidate: bool,
12284}
12285
12286impl std::default::Default for HeifloadBufferOptions {
12287    fn default() -> Self {
12288        HeifloadBufferOptions {
12289            page: i32::from(0),
12290            n: i32::from(1),
12291            thumbnail: false,
12292            unlimited: false,
12293            flags: ForeignFlags::None,
12294            memory: false,
12295            access: Access::Random,
12296            fail_on: FailOn::None,
12297            revalidate: false,
12298        }
12299    }
12300}
12301
12302/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12303/// buffer: `&[u8]` -> Buffer to load from
12304/// heifload_buffer_options: `&HeifloadBufferOptions` -> optional arguments
12305/// returns `VipsImage` - Output image
12306pub fn heifload_buffer_with_opts(
12307    buffer: &[u8],
12308    heifload_buffer_options: &HeifloadBufferOptions,
12309) -> Result<VipsImage> {
12310    unsafe {
12311        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12312        let mut out_out: *mut bindings::VipsImage = null_mut();
12313
12314        let page_in: i32 = heifload_buffer_options.page;
12315        let page_in_name = utils::new_c_string("page")?;
12316
12317        let n_in: i32 = heifload_buffer_options.n;
12318        let n_in_name = utils::new_c_string("n")?;
12319
12320        let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12321            1
12322        } else {
12323            0
12324        };
12325        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12326
12327        let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12328            1
12329        } else {
12330            0
12331        };
12332        let unlimited_in_name = utils::new_c_string("unlimited")?;
12333
12334        let flags_in: i32 = heifload_buffer_options.flags as i32;
12335        let flags_in_name = utils::new_c_string("flags")?;
12336
12337        let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12338        let memory_in_name = utils::new_c_string("memory")?;
12339
12340        let access_in: i32 = heifload_buffer_options.access as i32;
12341        let access_in_name = utils::new_c_string("access")?;
12342
12343        let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12344        let fail_on_in_name = utils::new_c_string("fail-on")?;
12345
12346        let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12347            1
12348        } else {
12349            0
12350        };
12351        let revalidate_in_name = utils::new_c_string("revalidate")?;
12352
12353        let vips_op_response = bindings::vips_heifload_buffer(
12354            buffer_in,
12355            buffer.len() as u64,
12356            &mut out_out,
12357            page_in_name.as_ptr(),
12358            page_in,
12359            n_in_name.as_ptr(),
12360            n_in,
12361            thumbnail_in_name.as_ptr(),
12362            thumbnail_in,
12363            unlimited_in_name.as_ptr(),
12364            unlimited_in,
12365            flags_in_name.as_ptr(),
12366            flags_in,
12367            memory_in_name.as_ptr(),
12368            memory_in,
12369            access_in_name.as_ptr(),
12370            access_in,
12371            fail_on_in_name.as_ptr(),
12372            fail_on_in,
12373            revalidate_in_name.as_ptr(),
12374            revalidate_in,
12375            NULL,
12376        );
12377        utils::result(
12378            vips_op_response,
12379            VipsImage { ctx: out_out },
12380            Error::HeifloadBufferError,
12381        )
12382    }
12383}
12384
12385/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12386/// source: `&VipsSource` -> Source to load from
12387/// returns `VipsImage` - Output image
12388pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12389    unsafe {
12390        let source_in: *mut bindings::VipsSource = source.ctx;
12391        let mut out_out: *mut bindings::VipsImage = null_mut();
12392
12393        let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12394        utils::result(
12395            vips_op_response,
12396            VipsImage { ctx: out_out },
12397            Error::HeifloadSourceError,
12398        )
12399    }
12400}
12401
12402/// Options for heifload_source operation
12403#[derive(Clone, Debug)]
12404pub struct HeifloadSourceOptions {
12405    /// page: `i32` -> First page to load
12406    /// min: 0, max: 100000, default: 0
12407    pub page: i32,
12408    /// n: `i32` -> Number of pages to load, -1 for all
12409    /// min: -1, max: 100000, default: 1
12410    pub n: i32,
12411    /// thumbnail: `bool` -> Fetch thumbnail image
12412    /// default: false
12413    pub thumbnail: bool,
12414    /// unlimited: `bool` -> Remove all denial of service limits
12415    /// default: false
12416    pub unlimited: bool,
12417    /// flags: `ForeignFlags` -> Flags for this file
12418    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12419    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12420    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12421    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12422    ///  `All` -> VIPS_FOREIGN_ALL = 7
12423    pub flags: ForeignFlags,
12424    /// memory: `bool` -> Force open via memory
12425    /// default: false
12426    pub memory: bool,
12427    /// access: `Access` -> Required access pattern for this file
12428    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12429    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12430    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12431    ///  `Last` -> VIPS_ACCESS_LAST = 3
12432    pub access: Access,
12433    /// fail_on: `FailOn` -> Error level to fail on
12434    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12435    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12436    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12437    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12438    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12439    pub fail_on: FailOn,
12440    /// revalidate: `bool` -> Don't use a cached result for this operation
12441    /// default: false
12442    pub revalidate: bool,
12443}
12444
12445impl std::default::Default for HeifloadSourceOptions {
12446    fn default() -> Self {
12447        HeifloadSourceOptions {
12448            page: i32::from(0),
12449            n: i32::from(1),
12450            thumbnail: false,
12451            unlimited: false,
12452            flags: ForeignFlags::None,
12453            memory: false,
12454            access: Access::Random,
12455            fail_on: FailOn::None,
12456            revalidate: false,
12457        }
12458    }
12459}
12460
12461/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12462/// source: `&VipsSource` -> Source to load from
12463/// heifload_source_options: `&HeifloadSourceOptions` -> optional arguments
12464/// returns `VipsImage` - Output image
12465pub fn heifload_source_with_opts(
12466    source: &VipsSource,
12467    heifload_source_options: &HeifloadSourceOptions,
12468) -> Result<VipsImage> {
12469    unsafe {
12470        let source_in: *mut bindings::VipsSource = source.ctx;
12471        let mut out_out: *mut bindings::VipsImage = null_mut();
12472
12473        let page_in: i32 = heifload_source_options.page;
12474        let page_in_name = utils::new_c_string("page")?;
12475
12476        let n_in: i32 = heifload_source_options.n;
12477        let n_in_name = utils::new_c_string("n")?;
12478
12479        let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12480            1
12481        } else {
12482            0
12483        };
12484        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12485
12486        let unlimited_in: i32 = if heifload_source_options.unlimited {
12487            1
12488        } else {
12489            0
12490        };
12491        let unlimited_in_name = utils::new_c_string("unlimited")?;
12492
12493        let flags_in: i32 = heifload_source_options.flags as i32;
12494        let flags_in_name = utils::new_c_string("flags")?;
12495
12496        let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12497        let memory_in_name = utils::new_c_string("memory")?;
12498
12499        let access_in: i32 = heifload_source_options.access as i32;
12500        let access_in_name = utils::new_c_string("access")?;
12501
12502        let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12503        let fail_on_in_name = utils::new_c_string("fail-on")?;
12504
12505        let revalidate_in: i32 = if heifload_source_options.revalidate {
12506            1
12507        } else {
12508            0
12509        };
12510        let revalidate_in_name = utils::new_c_string("revalidate")?;
12511
12512        let vips_op_response = bindings::vips_heifload_source(
12513            source_in,
12514            &mut out_out,
12515            page_in_name.as_ptr(),
12516            page_in,
12517            n_in_name.as_ptr(),
12518            n_in,
12519            thumbnail_in_name.as_ptr(),
12520            thumbnail_in,
12521            unlimited_in_name.as_ptr(),
12522            unlimited_in,
12523            flags_in_name.as_ptr(),
12524            flags_in,
12525            memory_in_name.as_ptr(),
12526            memory_in,
12527            access_in_name.as_ptr(),
12528            access_in,
12529            fail_on_in_name.as_ptr(),
12530            fail_on_in,
12531            revalidate_in_name.as_ptr(),
12532            revalidate_in,
12533            NULL,
12534        );
12535        utils::result(
12536            vips_op_response,
12537            VipsImage { ctx: out_out },
12538            Error::HeifloadSourceError,
12539        )
12540    }
12541}
12542
12543/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12544/// inp: `&VipsImage` -> Image to save
12545/// filename: `&str` -> Filename to save to
12546
12547pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12548    unsafe {
12549        let inp_in: *mut bindings::VipsImage = inp.ctx;
12550        let filename_in: CString = utils::new_c_string(filename)?;
12551
12552        let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12553        utils::result(vips_op_response, (), Error::CsvsaveError)
12554    }
12555}
12556
12557/// Options for csvsave operation
12558#[derive(Clone, Debug)]
12559pub struct CsvsaveOptions {
12560    /// separator: `String` -> Separator characters
12561    pub separator: String,
12562    /// keep: `ForeignKeep` -> Which metadata to retain
12563    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12564    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12565    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12566    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12567    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12568    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12569    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12570    pub keep: ForeignKeep,
12571    /// background: `Vec<f64>` -> Background value
12572    pub background: Vec<f64>,
12573    /// page_height: `i32` -> Set page height for multipage save
12574    /// min: 0, max: 100000000, default: 0
12575    pub page_height: i32,
12576    /// profile: `String` -> Filename of ICC profile to embed
12577    pub profile: String,
12578}
12579
12580impl std::default::Default for CsvsaveOptions {
12581    fn default() -> Self {
12582        CsvsaveOptions {
12583            separator: String::new(),
12584            keep: ForeignKeep::All,
12585            background: Vec::new(),
12586            page_height: i32::from(0),
12587            profile: String::from("sRGB"),
12588        }
12589    }
12590}
12591
12592/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12593/// inp: `&VipsImage` -> Image to save
12594/// filename: `&str` -> Filename to save to
12595/// csvsave_options: `&CsvsaveOptions` -> optional arguments
12596
12597pub fn csvsave_with_opts(
12598    inp: &VipsImage,
12599    filename: &str,
12600    csvsave_options: &CsvsaveOptions,
12601) -> Result<()> {
12602    unsafe {
12603        let inp_in: *mut bindings::VipsImage = inp.ctx;
12604        let filename_in: CString = utils::new_c_string(filename)?;
12605
12606        let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12607        let separator_in_name = utils::new_c_string("separator")?;
12608
12609        let keep_in: i32 = csvsave_options.keep as i32;
12610        let keep_in_name = utils::new_c_string("keep")?;
12611
12612        let background_wrapper =
12613            utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12614        let background_in = background_wrapper.ctx;
12615        let background_in_name = utils::new_c_string("background")?;
12616
12617        let page_height_in: i32 = csvsave_options.page_height;
12618        let page_height_in_name = utils::new_c_string("page-height")?;
12619
12620        let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12621        let profile_in_name = utils::new_c_string("profile")?;
12622
12623        let vips_op_response = bindings::vips_csvsave(
12624            inp_in,
12625            filename_in.as_ptr(),
12626            separator_in_name.as_ptr(),
12627            separator_in.as_ptr(),
12628            keep_in_name.as_ptr(),
12629            keep_in,
12630            background_in_name.as_ptr(),
12631            background_in,
12632            page_height_in_name.as_ptr(),
12633            page_height_in,
12634            profile_in_name.as_ptr(),
12635            profile_in.as_ptr(),
12636            NULL,
12637        );
12638        utils::result(vips_op_response, (), Error::CsvsaveError)
12639    }
12640}
12641
12642/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12643/// inp: `&VipsImage` -> Image to save
12644/// target: `&VipsTarget` -> Target to save to
12645
12646pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12647    unsafe {
12648        let inp_in: *mut bindings::VipsImage = inp.ctx;
12649        let target_in: *mut bindings::VipsTarget = target.ctx;
12650
12651        let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12652        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12653    }
12654}
12655
12656/// Options for csvsave_target operation
12657#[derive(Clone, Debug)]
12658pub struct CsvsaveTargetOptions {
12659    /// separator: `String` -> Separator characters
12660    pub separator: String,
12661    /// keep: `ForeignKeep` -> Which metadata to retain
12662    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12663    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12664    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12665    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12666    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12667    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12668    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12669    pub keep: ForeignKeep,
12670    /// background: `Vec<f64>` -> Background value
12671    pub background: Vec<f64>,
12672    /// page_height: `i32` -> Set page height for multipage save
12673    /// min: 0, max: 100000000, default: 0
12674    pub page_height: i32,
12675    /// profile: `String` -> Filename of ICC profile to embed
12676    pub profile: String,
12677}
12678
12679impl std::default::Default for CsvsaveTargetOptions {
12680    fn default() -> Self {
12681        CsvsaveTargetOptions {
12682            separator: String::new(),
12683            keep: ForeignKeep::All,
12684            background: Vec::new(),
12685            page_height: i32::from(0),
12686            profile: String::from("sRGB"),
12687        }
12688    }
12689}
12690
12691/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12692/// inp: `&VipsImage` -> Image to save
12693/// target: `&VipsTarget` -> Target to save to
12694/// csvsave_target_options: `&CsvsaveTargetOptions` -> optional arguments
12695
12696pub fn csvsave_target_with_opts(
12697    inp: &VipsImage,
12698    target: &VipsTarget,
12699    csvsave_target_options: &CsvsaveTargetOptions,
12700) -> Result<()> {
12701    unsafe {
12702        let inp_in: *mut bindings::VipsImage = inp.ctx;
12703        let target_in: *mut bindings::VipsTarget = target.ctx;
12704
12705        let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12706        let separator_in_name = utils::new_c_string("separator")?;
12707
12708        let keep_in: i32 = csvsave_target_options.keep as i32;
12709        let keep_in_name = utils::new_c_string("keep")?;
12710
12711        let background_wrapper =
12712            utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12713        let background_in = background_wrapper.ctx;
12714        let background_in_name = utils::new_c_string("background")?;
12715
12716        let page_height_in: i32 = csvsave_target_options.page_height;
12717        let page_height_in_name = utils::new_c_string("page-height")?;
12718
12719        let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12720        let profile_in_name = utils::new_c_string("profile")?;
12721
12722        let vips_op_response = bindings::vips_csvsave_target(
12723            inp_in,
12724            target_in,
12725            separator_in_name.as_ptr(),
12726            separator_in.as_ptr(),
12727            keep_in_name.as_ptr(),
12728            keep_in,
12729            background_in_name.as_ptr(),
12730            background_in,
12731            page_height_in_name.as_ptr(),
12732            page_height_in,
12733            profile_in_name.as_ptr(),
12734            profile_in.as_ptr(),
12735            NULL,
12736        );
12737        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12738    }
12739}
12740
12741/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12742/// inp: `&VipsImage` -> Image to save
12743/// filename: `&str` -> Filename to save to
12744
12745pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12746    unsafe {
12747        let inp_in: *mut bindings::VipsImage = inp.ctx;
12748        let filename_in: CString = utils::new_c_string(filename)?;
12749
12750        let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12751        utils::result(vips_op_response, (), Error::MatrixsaveError)
12752    }
12753}
12754
12755/// Options for matrixsave operation
12756#[derive(Clone, Debug)]
12757pub struct MatrixsaveOptions {
12758    /// keep: `ForeignKeep` -> Which metadata to retain
12759    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12760    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12761    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12762    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12763    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12764    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12765    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12766    pub keep: ForeignKeep,
12767    /// background: `Vec<f64>` -> Background value
12768    pub background: Vec<f64>,
12769    /// page_height: `i32` -> Set page height for multipage save
12770    /// min: 0, max: 100000000, default: 0
12771    pub page_height: i32,
12772    /// profile: `String` -> Filename of ICC profile to embed
12773    pub profile: String,
12774}
12775
12776impl std::default::Default for MatrixsaveOptions {
12777    fn default() -> Self {
12778        MatrixsaveOptions {
12779            keep: ForeignKeep::All,
12780            background: Vec::new(),
12781            page_height: i32::from(0),
12782            profile: String::from("sRGB"),
12783        }
12784    }
12785}
12786
12787/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12788/// inp: `&VipsImage` -> Image to save
12789/// filename: `&str` -> Filename to save to
12790/// matrixsave_options: `&MatrixsaveOptions` -> optional arguments
12791
12792pub fn matrixsave_with_opts(
12793    inp: &VipsImage,
12794    filename: &str,
12795    matrixsave_options: &MatrixsaveOptions,
12796) -> Result<()> {
12797    unsafe {
12798        let inp_in: *mut bindings::VipsImage = inp.ctx;
12799        let filename_in: CString = utils::new_c_string(filename)?;
12800
12801        let keep_in: i32 = matrixsave_options.keep as i32;
12802        let keep_in_name = utils::new_c_string("keep")?;
12803
12804        let background_wrapper =
12805            utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
12806        let background_in = background_wrapper.ctx;
12807        let background_in_name = utils::new_c_string("background")?;
12808
12809        let page_height_in: i32 = matrixsave_options.page_height;
12810        let page_height_in_name = utils::new_c_string("page-height")?;
12811
12812        let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
12813        let profile_in_name = utils::new_c_string("profile")?;
12814
12815        let vips_op_response = bindings::vips_matrixsave(
12816            inp_in,
12817            filename_in.as_ptr(),
12818            keep_in_name.as_ptr(),
12819            keep_in,
12820            background_in_name.as_ptr(),
12821            background_in,
12822            page_height_in_name.as_ptr(),
12823            page_height_in,
12824            profile_in_name.as_ptr(),
12825            profile_in.as_ptr(),
12826            NULL,
12827        );
12828        utils::result(vips_op_response, (), Error::MatrixsaveError)
12829    }
12830}
12831
12832/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
12833/// inp: `&VipsImage` -> Image to save
12834/// target: `&VipsTarget` -> Target to save to
12835
12836pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12837    unsafe {
12838        let inp_in: *mut bindings::VipsImage = inp.ctx;
12839        let target_in: *mut bindings::VipsTarget = target.ctx;
12840
12841        let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
12842        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12843    }
12844}
12845
12846/// Options for matrixsave_target operation
12847#[derive(Clone, Debug)]
12848pub struct MatrixsaveTargetOptions {
12849    /// keep: `ForeignKeep` -> Which metadata to retain
12850    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12851    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12852    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12853    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12854    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12855    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12856    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12857    pub keep: ForeignKeep,
12858    /// background: `Vec<f64>` -> Background value
12859    pub background: Vec<f64>,
12860    /// page_height: `i32` -> Set page height for multipage save
12861    /// min: 0, max: 100000000, default: 0
12862    pub page_height: i32,
12863    /// profile: `String` -> Filename of ICC profile to embed
12864    pub profile: String,
12865}
12866
12867impl std::default::Default for MatrixsaveTargetOptions {
12868    fn default() -> Self {
12869        MatrixsaveTargetOptions {
12870            keep: ForeignKeep::All,
12871            background: Vec::new(),
12872            page_height: i32::from(0),
12873            profile: String::from("sRGB"),
12874        }
12875    }
12876}
12877
12878/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
12879/// inp: `&VipsImage` -> Image to save
12880/// target: `&VipsTarget` -> Target to save to
12881/// matrixsave_target_options: `&MatrixsaveTargetOptions` -> optional arguments
12882
12883pub fn matrixsave_target_with_opts(
12884    inp: &VipsImage,
12885    target: &VipsTarget,
12886    matrixsave_target_options: &MatrixsaveTargetOptions,
12887) -> Result<()> {
12888    unsafe {
12889        let inp_in: *mut bindings::VipsImage = inp.ctx;
12890        let target_in: *mut bindings::VipsTarget = target.ctx;
12891
12892        let keep_in: i32 = matrixsave_target_options.keep as i32;
12893        let keep_in_name = utils::new_c_string("keep")?;
12894
12895        let background_wrapper =
12896            utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
12897        let background_in = background_wrapper.ctx;
12898        let background_in_name = utils::new_c_string("background")?;
12899
12900        let page_height_in: i32 = matrixsave_target_options.page_height;
12901        let page_height_in_name = utils::new_c_string("page-height")?;
12902
12903        let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
12904        let profile_in_name = utils::new_c_string("profile")?;
12905
12906        let vips_op_response = bindings::vips_matrixsave_target(
12907            inp_in,
12908            target_in,
12909            keep_in_name.as_ptr(),
12910            keep_in,
12911            background_in_name.as_ptr(),
12912            background_in,
12913            page_height_in_name.as_ptr(),
12914            page_height_in,
12915            profile_in_name.as_ptr(),
12916            profile_in.as_ptr(),
12917            NULL,
12918        );
12919        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12920    }
12921}
12922
12923/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
12924/// inp: `&VipsImage` -> Image to save
12925
12926pub fn matrixprint(inp: &VipsImage) -> Result<()> {
12927    unsafe {
12928        let inp_in: *mut bindings::VipsImage = inp.ctx;
12929
12930        let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
12931        utils::result(vips_op_response, (), Error::MatrixprintError)
12932    }
12933}
12934
12935/// Options for matrixprint operation
12936#[derive(Clone, Debug)]
12937pub struct MatrixprintOptions {
12938    /// keep: `ForeignKeep` -> Which metadata to retain
12939    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12940    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12941    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12942    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12943    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12944    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12945    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12946    pub keep: ForeignKeep,
12947    /// background: `Vec<f64>` -> Background value
12948    pub background: Vec<f64>,
12949    /// page_height: `i32` -> Set page height for multipage save
12950    /// min: 0, max: 100000000, default: 0
12951    pub page_height: i32,
12952    /// profile: `String` -> Filename of ICC profile to embed
12953    pub profile: String,
12954}
12955
12956impl std::default::Default for MatrixprintOptions {
12957    fn default() -> Self {
12958        MatrixprintOptions {
12959            keep: ForeignKeep::All,
12960            background: Vec::new(),
12961            page_height: i32::from(0),
12962            profile: String::from("sRGB"),
12963        }
12964    }
12965}
12966
12967/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
12968/// inp: `&VipsImage` -> Image to save
12969/// matrixprint_options: `&MatrixprintOptions` -> optional arguments
12970
12971pub fn matrixprint_with_opts(
12972    inp: &VipsImage,
12973    matrixprint_options: &MatrixprintOptions,
12974) -> Result<()> {
12975    unsafe {
12976        let inp_in: *mut bindings::VipsImage = inp.ctx;
12977
12978        let keep_in: i32 = matrixprint_options.keep as i32;
12979        let keep_in_name = utils::new_c_string("keep")?;
12980
12981        let background_wrapper =
12982            utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
12983        let background_in = background_wrapper.ctx;
12984        let background_in_name = utils::new_c_string("background")?;
12985
12986        let page_height_in: i32 = matrixprint_options.page_height;
12987        let page_height_in_name = utils::new_c_string("page-height")?;
12988
12989        let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
12990        let profile_in_name = utils::new_c_string("profile")?;
12991
12992        let vips_op_response = bindings::vips_matrixprint(
12993            inp_in,
12994            keep_in_name.as_ptr(),
12995            keep_in,
12996            background_in_name.as_ptr(),
12997            background_in,
12998            page_height_in_name.as_ptr(),
12999            page_height_in,
13000            profile_in_name.as_ptr(),
13001            profile_in.as_ptr(),
13002            NULL,
13003        );
13004        utils::result(vips_op_response, (), Error::MatrixprintError)
13005    }
13006}
13007
13008/// VipsForeignSaveRawFile (rawsave), save image to raw file (.raw), priority=0, any
13009/// inp: `&VipsImage` -> Image to save
13010/// filename: `&str` -> Filename to save to
13011
13012pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
13013    unsafe {
13014        let inp_in: *mut bindings::VipsImage = inp.ctx;
13015        let filename_in: CString = utils::new_c_string(filename)?;
13016
13017        let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
13018        utils::result(vips_op_response, (), Error::RawsaveError)
13019    }
13020}
13021
13022/// Options for rawsave operation
13023#[derive(Clone, Debug)]
13024pub struct RawsaveOptions {
13025    /// keep: `ForeignKeep` -> Which metadata to retain
13026    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13027    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13028    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13029    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13030    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13031    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13032    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13033    pub keep: ForeignKeep,
13034    /// background: `Vec<f64>` -> Background value
13035    pub background: Vec<f64>,
13036    /// page_height: `i32` -> Set page height for multipage save
13037    /// min: 0, max: 100000000, default: 0
13038    pub page_height: i32,
13039    /// profile: `String` -> Filename of ICC profile to embed
13040    pub profile: String,
13041}
13042
13043impl std::default::Default for RawsaveOptions {
13044    fn default() -> Self {
13045        RawsaveOptions {
13046            keep: ForeignKeep::All,
13047            background: Vec::new(),
13048            page_height: i32::from(0),
13049            profile: String::from("sRGB"),
13050        }
13051    }
13052}
13053
13054/// VipsForeignSaveRawFile (rawsave), save image to raw file (.raw), priority=0, any
13055/// inp: `&VipsImage` -> Image to save
13056/// filename: `&str` -> Filename to save to
13057/// rawsave_options: `&RawsaveOptions` -> optional arguments
13058
13059pub fn rawsave_with_opts(
13060    inp: &VipsImage,
13061    filename: &str,
13062    rawsave_options: &RawsaveOptions,
13063) -> Result<()> {
13064    unsafe {
13065        let inp_in: *mut bindings::VipsImage = inp.ctx;
13066        let filename_in: CString = utils::new_c_string(filename)?;
13067
13068        let keep_in: i32 = rawsave_options.keep as i32;
13069        let keep_in_name = utils::new_c_string("keep")?;
13070
13071        let background_wrapper =
13072            utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
13073        let background_in = background_wrapper.ctx;
13074        let background_in_name = utils::new_c_string("background")?;
13075
13076        let page_height_in: i32 = rawsave_options.page_height;
13077        let page_height_in_name = utils::new_c_string("page-height")?;
13078
13079        let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
13080        let profile_in_name = utils::new_c_string("profile")?;
13081
13082        let vips_op_response = bindings::vips_rawsave(
13083            inp_in,
13084            filename_in.as_ptr(),
13085            keep_in_name.as_ptr(),
13086            keep_in,
13087            background_in_name.as_ptr(),
13088            background_in,
13089            page_height_in_name.as_ptr(),
13090            page_height_in,
13091            profile_in_name.as_ptr(),
13092            profile_in.as_ptr(),
13093            NULL,
13094        );
13095        utils::result(vips_op_response, (), Error::RawsaveError)
13096    }
13097}
13098
13099/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer (.raw), priority=0, any
13100/// inp: `&VipsImage` -> Image to save
13101/// returns `Vec<u8>` - Buffer to save to
13102pub fn rawsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13103    unsafe {
13104        let inp_in: *mut bindings::VipsImage = inp.ctx;
13105        let mut buffer_buf_size: u64 = 0;
13106        let mut buffer_out: *mut c_void = null_mut();
13107
13108        let vips_op_response =
13109            bindings::vips_rawsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13110        utils::result(
13111            vips_op_response,
13112            utils::new_byte_array(buffer_out, buffer_buf_size),
13113            Error::RawsaveBufferError,
13114        )
13115    }
13116}
13117
13118/// Options for rawsave_buffer operation
13119#[derive(Clone, Debug)]
13120pub struct RawsaveBufferOptions {
13121    /// keep: `ForeignKeep` -> Which metadata to retain
13122    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13123    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13124    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13125    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13126    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13127    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13128    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13129    pub keep: ForeignKeep,
13130    /// background: `Vec<f64>` -> Background value
13131    pub background: Vec<f64>,
13132    /// page_height: `i32` -> Set page height for multipage save
13133    /// min: 0, max: 100000000, default: 0
13134    pub page_height: i32,
13135    /// profile: `String` -> Filename of ICC profile to embed
13136    pub profile: String,
13137}
13138
13139impl std::default::Default for RawsaveBufferOptions {
13140    fn default() -> Self {
13141        RawsaveBufferOptions {
13142            keep: ForeignKeep::All,
13143            background: Vec::new(),
13144            page_height: i32::from(0),
13145            profile: String::from("sRGB"),
13146        }
13147    }
13148}
13149
13150/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer (.raw), priority=0, any
13151/// inp: `&VipsImage` -> Image to save
13152/// rawsave_buffer_options: `&RawsaveBufferOptions` -> optional arguments
13153/// returns `Vec<u8>` - Buffer to save to
13154pub fn rawsave_buffer_with_opts(
13155    inp: &VipsImage,
13156    rawsave_buffer_options: &RawsaveBufferOptions,
13157) -> Result<Vec<u8>> {
13158    unsafe {
13159        let inp_in: *mut bindings::VipsImage = inp.ctx;
13160        let mut buffer_buf_size: u64 = 0;
13161        let mut buffer_out: *mut c_void = null_mut();
13162
13163        let keep_in: i32 = rawsave_buffer_options.keep as i32;
13164        let keep_in_name = utils::new_c_string("keep")?;
13165
13166        let background_wrapper =
13167            utils::VipsArrayDoubleWrapper::from(&rawsave_buffer_options.background[..]);
13168        let background_in = background_wrapper.ctx;
13169        let background_in_name = utils::new_c_string("background")?;
13170
13171        let page_height_in: i32 = rawsave_buffer_options.page_height;
13172        let page_height_in_name = utils::new_c_string("page-height")?;
13173
13174        let profile_in: CString = utils::new_c_string(&rawsave_buffer_options.profile)?;
13175        let profile_in_name = utils::new_c_string("profile")?;
13176
13177        let vips_op_response = bindings::vips_rawsave_buffer(
13178            inp_in,
13179            &mut buffer_out,
13180            &mut buffer_buf_size,
13181            keep_in_name.as_ptr(),
13182            keep_in,
13183            background_in_name.as_ptr(),
13184            background_in,
13185            page_height_in_name.as_ptr(),
13186            page_height_in,
13187            profile_in_name.as_ptr(),
13188            profile_in.as_ptr(),
13189            NULL,
13190        );
13191        utils::result(
13192            vips_op_response,
13193            utils::new_byte_array(buffer_out, buffer_buf_size),
13194            Error::RawsaveBufferError,
13195        )
13196    }
13197}
13198
13199/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target (.raw), priority=0, any
13200/// inp: `&VipsImage` -> Image to save
13201/// target: `&VipsTarget` -> Target to save to
13202
13203pub fn rawsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13204    unsafe {
13205        let inp_in: *mut bindings::VipsImage = inp.ctx;
13206        let target_in: *mut bindings::VipsTarget = target.ctx;
13207
13208        let vips_op_response = bindings::vips_rawsave_target(inp_in, target_in, NULL);
13209        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13210    }
13211}
13212
13213/// Options for rawsave_target operation
13214#[derive(Clone, Debug)]
13215pub struct RawsaveTargetOptions {
13216    /// keep: `ForeignKeep` -> Which metadata to retain
13217    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13218    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13219    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13220    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13221    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13222    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13223    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13224    pub keep: ForeignKeep,
13225    /// background: `Vec<f64>` -> Background value
13226    pub background: Vec<f64>,
13227    /// page_height: `i32` -> Set page height for multipage save
13228    /// min: 0, max: 100000000, default: 0
13229    pub page_height: i32,
13230    /// profile: `String` -> Filename of ICC profile to embed
13231    pub profile: String,
13232}
13233
13234impl std::default::Default for RawsaveTargetOptions {
13235    fn default() -> Self {
13236        RawsaveTargetOptions {
13237            keep: ForeignKeep::All,
13238            background: Vec::new(),
13239            page_height: i32::from(0),
13240            profile: String::from("sRGB"),
13241        }
13242    }
13243}
13244
13245/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target (.raw), priority=0, any
13246/// inp: `&VipsImage` -> Image to save
13247/// target: `&VipsTarget` -> Target to save to
13248/// rawsave_target_options: `&RawsaveTargetOptions` -> optional arguments
13249
13250pub fn rawsave_target_with_opts(
13251    inp: &VipsImage,
13252    target: &VipsTarget,
13253    rawsave_target_options: &RawsaveTargetOptions,
13254) -> Result<()> {
13255    unsafe {
13256        let inp_in: *mut bindings::VipsImage = inp.ctx;
13257        let target_in: *mut bindings::VipsTarget = target.ctx;
13258
13259        let keep_in: i32 = rawsave_target_options.keep as i32;
13260        let keep_in_name = utils::new_c_string("keep")?;
13261
13262        let background_wrapper =
13263            utils::VipsArrayDoubleWrapper::from(&rawsave_target_options.background[..]);
13264        let background_in = background_wrapper.ctx;
13265        let background_in_name = utils::new_c_string("background")?;
13266
13267        let page_height_in: i32 = rawsave_target_options.page_height;
13268        let page_height_in_name = utils::new_c_string("page-height")?;
13269
13270        let profile_in: CString = utils::new_c_string(&rawsave_target_options.profile)?;
13271        let profile_in_name = utils::new_c_string("profile")?;
13272
13273        let vips_op_response = bindings::vips_rawsave_target(
13274            inp_in,
13275            target_in,
13276            keep_in_name.as_ptr(),
13277            keep_in,
13278            background_in_name.as_ptr(),
13279            background_in,
13280            page_height_in_name.as_ptr(),
13281            page_height_in,
13282            profile_in_name.as_ptr(),
13283            profile_in.as_ptr(),
13284            NULL,
13285        );
13286        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13287    }
13288}
13289
13290/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
13291/// inp: `&VipsImage` -> Image to save
13292/// filename: `&str` -> Filename to save to
13293
13294pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13295    unsafe {
13296        let inp_in: *mut bindings::VipsImage = inp.ctx;
13297        let filename_in: CString = utils::new_c_string(filename)?;
13298
13299        let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13300        utils::result(vips_op_response, (), Error::VipssaveError)
13301    }
13302}
13303
13304/// Options for vipssave operation
13305#[derive(Clone, Debug)]
13306pub struct VipssaveOptions {
13307    /// keep: `ForeignKeep` -> Which metadata to retain
13308    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13309    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13310    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13311    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13312    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13313    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13314    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13315    pub keep: ForeignKeep,
13316    /// background: `Vec<f64>` -> Background value
13317    pub background: Vec<f64>,
13318    /// page_height: `i32` -> Set page height for multipage save
13319    /// min: 0, max: 100000000, default: 0
13320    pub page_height: i32,
13321    /// profile: `String` -> Filename of ICC profile to embed
13322    pub profile: String,
13323}
13324
13325impl std::default::Default for VipssaveOptions {
13326    fn default() -> Self {
13327        VipssaveOptions {
13328            keep: ForeignKeep::All,
13329            background: Vec::new(),
13330            page_height: i32::from(0),
13331            profile: String::from("sRGB"),
13332        }
13333    }
13334}
13335
13336/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
13337/// inp: `&VipsImage` -> Image to save
13338/// filename: `&str` -> Filename to save to
13339/// vipssave_options: `&VipssaveOptions` -> optional arguments
13340
13341pub fn vipssave_with_opts(
13342    inp: &VipsImage,
13343    filename: &str,
13344    vipssave_options: &VipssaveOptions,
13345) -> Result<()> {
13346    unsafe {
13347        let inp_in: *mut bindings::VipsImage = inp.ctx;
13348        let filename_in: CString = utils::new_c_string(filename)?;
13349
13350        let keep_in: i32 = vipssave_options.keep as i32;
13351        let keep_in_name = utils::new_c_string("keep")?;
13352
13353        let background_wrapper =
13354            utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13355        let background_in = background_wrapper.ctx;
13356        let background_in_name = utils::new_c_string("background")?;
13357
13358        let page_height_in: i32 = vipssave_options.page_height;
13359        let page_height_in_name = utils::new_c_string("page-height")?;
13360
13361        let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13362        let profile_in_name = utils::new_c_string("profile")?;
13363
13364        let vips_op_response = bindings::vips_vipssave(
13365            inp_in,
13366            filename_in.as_ptr(),
13367            keep_in_name.as_ptr(),
13368            keep_in,
13369            background_in_name.as_ptr(),
13370            background_in,
13371            page_height_in_name.as_ptr(),
13372            page_height_in,
13373            profile_in_name.as_ptr(),
13374            profile_in.as_ptr(),
13375            NULL,
13376        );
13377        utils::result(vips_op_response, (), Error::VipssaveError)
13378    }
13379}
13380
13381/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
13382/// inp: `&VipsImage` -> Image to save
13383/// target: `&VipsTarget` -> Target to save to
13384
13385pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13386    unsafe {
13387        let inp_in: *mut bindings::VipsImage = inp.ctx;
13388        let target_in: *mut bindings::VipsTarget = target.ctx;
13389
13390        let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13391        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13392    }
13393}
13394
13395/// Options for vipssave_target operation
13396#[derive(Clone, Debug)]
13397pub struct VipssaveTargetOptions {
13398    /// keep: `ForeignKeep` -> Which metadata to retain
13399    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13400    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13401    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13402    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13403    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13404    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13405    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13406    pub keep: ForeignKeep,
13407    /// background: `Vec<f64>` -> Background value
13408    pub background: Vec<f64>,
13409    /// page_height: `i32` -> Set page height for multipage save
13410    /// min: 0, max: 100000000, default: 0
13411    pub page_height: i32,
13412    /// profile: `String` -> Filename of ICC profile to embed
13413    pub profile: String,
13414}
13415
13416impl std::default::Default for VipssaveTargetOptions {
13417    fn default() -> Self {
13418        VipssaveTargetOptions {
13419            keep: ForeignKeep::All,
13420            background: Vec::new(),
13421            page_height: i32::from(0),
13422            profile: String::from("sRGB"),
13423        }
13424    }
13425}
13426
13427/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
13428/// inp: `&VipsImage` -> Image to save
13429/// target: `&VipsTarget` -> Target to save to
13430/// vipssave_target_options: `&VipssaveTargetOptions` -> optional arguments
13431
13432pub fn vipssave_target_with_opts(
13433    inp: &VipsImage,
13434    target: &VipsTarget,
13435    vipssave_target_options: &VipssaveTargetOptions,
13436) -> Result<()> {
13437    unsafe {
13438        let inp_in: *mut bindings::VipsImage = inp.ctx;
13439        let target_in: *mut bindings::VipsTarget = target.ctx;
13440
13441        let keep_in: i32 = vipssave_target_options.keep as i32;
13442        let keep_in_name = utils::new_c_string("keep")?;
13443
13444        let background_wrapper =
13445            utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13446        let background_in = background_wrapper.ctx;
13447        let background_in_name = utils::new_c_string("background")?;
13448
13449        let page_height_in: i32 = vipssave_target_options.page_height;
13450        let page_height_in_name = utils::new_c_string("page-height")?;
13451
13452        let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13453        let profile_in_name = utils::new_c_string("profile")?;
13454
13455        let vips_op_response = bindings::vips_vipssave_target(
13456            inp_in,
13457            target_in,
13458            keep_in_name.as_ptr(),
13459            keep_in,
13460            background_in_name.as_ptr(),
13461            background_in,
13462            page_height_in_name.as_ptr(),
13463            page_height_in,
13464            profile_in_name.as_ptr(),
13465            profile_in.as_ptr(),
13466            NULL,
13467        );
13468        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13469    }
13470}
13471
13472/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, any
13473/// inp: `&VipsImage` -> Image to save
13474/// filename: `&str` -> Filename to save to
13475
13476pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13477    unsafe {
13478        let inp_in: *mut bindings::VipsImage = inp.ctx;
13479        let filename_in: CString = utils::new_c_string(filename)?;
13480
13481        let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13482        utils::result(vips_op_response, (), Error::PpmsaveError)
13483    }
13484}
13485
13486/// Options for ppmsave operation
13487#[derive(Clone, Debug)]
13488pub struct PpmsaveOptions {
13489    /// format: `ForeignPpmFormat` -> Format to save in
13490    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13491    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13492    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13493    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13494    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13495    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13496    pub format: ForeignPpmFormat,
13497    /// ascii: `bool` -> Save as ascii
13498    /// default: false
13499    pub ascii: bool,
13500    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13501    /// min: 0, max: 1, default: 0
13502    pub bitdepth: i32,
13503    /// keep: `ForeignKeep` -> Which metadata to retain
13504    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13505    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13506    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13507    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13508    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13509    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13510    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13511    pub keep: ForeignKeep,
13512    /// background: `Vec<f64>` -> Background value
13513    pub background: Vec<f64>,
13514    /// page_height: `i32` -> Set page height for multipage save
13515    /// min: 0, max: 100000000, default: 0
13516    pub page_height: i32,
13517    /// profile: `String` -> Filename of ICC profile to embed
13518    pub profile: String,
13519}
13520
13521impl std::default::Default for PpmsaveOptions {
13522    fn default() -> Self {
13523        PpmsaveOptions {
13524            format: ForeignPpmFormat::Ppm,
13525            ascii: false,
13526            bitdepth: i32::from(0),
13527            keep: ForeignKeep::All,
13528            background: Vec::new(),
13529            page_height: i32::from(0),
13530            profile: String::from("sRGB"),
13531        }
13532    }
13533}
13534
13535/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, any
13536/// inp: `&VipsImage` -> Image to save
13537/// filename: `&str` -> Filename to save to
13538/// ppmsave_options: `&PpmsaveOptions` -> optional arguments
13539
13540pub fn ppmsave_with_opts(
13541    inp: &VipsImage,
13542    filename: &str,
13543    ppmsave_options: &PpmsaveOptions,
13544) -> Result<()> {
13545    unsafe {
13546        let inp_in: *mut bindings::VipsImage = inp.ctx;
13547        let filename_in: CString = utils::new_c_string(filename)?;
13548
13549        let format_in: i32 = ppmsave_options.format as i32;
13550        let format_in_name = utils::new_c_string("format")?;
13551
13552        let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13553        let ascii_in_name = utils::new_c_string("ascii")?;
13554
13555        let bitdepth_in: i32 = ppmsave_options.bitdepth;
13556        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13557
13558        let keep_in: i32 = ppmsave_options.keep as i32;
13559        let keep_in_name = utils::new_c_string("keep")?;
13560
13561        let background_wrapper =
13562            utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13563        let background_in = background_wrapper.ctx;
13564        let background_in_name = utils::new_c_string("background")?;
13565
13566        let page_height_in: i32 = ppmsave_options.page_height;
13567        let page_height_in_name = utils::new_c_string("page-height")?;
13568
13569        let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13570        let profile_in_name = utils::new_c_string("profile")?;
13571
13572        let vips_op_response = bindings::vips_ppmsave(
13573            inp_in,
13574            filename_in.as_ptr(),
13575            format_in_name.as_ptr(),
13576            format_in,
13577            ascii_in_name.as_ptr(),
13578            ascii_in,
13579            bitdepth_in_name.as_ptr(),
13580            bitdepth_in,
13581            keep_in_name.as_ptr(),
13582            keep_in,
13583            background_in_name.as_ptr(),
13584            background_in,
13585            page_height_in_name.as_ptr(),
13586            page_height_in,
13587            profile_in_name.as_ptr(),
13588            profile_in.as_ptr(),
13589            NULL,
13590        );
13591        utils::result(vips_op_response, (), Error::PpmsaveError)
13592    }
13593}
13594
13595/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, any
13596/// inp: `&VipsImage` -> Image to save
13597/// target: `&VipsTarget` -> Target to save to
13598
13599pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13600    unsafe {
13601        let inp_in: *mut bindings::VipsImage = inp.ctx;
13602        let target_in: *mut bindings::VipsTarget = target.ctx;
13603
13604        let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13605        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13606    }
13607}
13608
13609/// Options for ppmsave_target operation
13610#[derive(Clone, Debug)]
13611pub struct PpmsaveTargetOptions {
13612    /// format: `ForeignPpmFormat` -> Format to save in
13613    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13614    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13615    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13616    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13617    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13618    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13619    pub format: ForeignPpmFormat,
13620    /// ascii: `bool` -> Save as ascii
13621    /// default: false
13622    pub ascii: bool,
13623    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13624    /// min: 0, max: 1, default: 0
13625    pub bitdepth: i32,
13626    /// keep: `ForeignKeep` -> Which metadata to retain
13627    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13628    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13629    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13630    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13631    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13632    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13633    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13634    pub keep: ForeignKeep,
13635    /// background: `Vec<f64>` -> Background value
13636    pub background: Vec<f64>,
13637    /// page_height: `i32` -> Set page height for multipage save
13638    /// min: 0, max: 100000000, default: 0
13639    pub page_height: i32,
13640    /// profile: `String` -> Filename of ICC profile to embed
13641    pub profile: String,
13642}
13643
13644impl std::default::Default for PpmsaveTargetOptions {
13645    fn default() -> Self {
13646        PpmsaveTargetOptions {
13647            format: ForeignPpmFormat::Ppm,
13648            ascii: false,
13649            bitdepth: i32::from(0),
13650            keep: ForeignKeep::All,
13651            background: Vec::new(),
13652            page_height: i32::from(0),
13653            profile: String::from("sRGB"),
13654        }
13655    }
13656}
13657
13658/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, any
13659/// inp: `&VipsImage` -> Image to save
13660/// target: `&VipsTarget` -> Target to save to
13661/// ppmsave_target_options: `&PpmsaveTargetOptions` -> optional arguments
13662
13663pub fn ppmsave_target_with_opts(
13664    inp: &VipsImage,
13665    target: &VipsTarget,
13666    ppmsave_target_options: &PpmsaveTargetOptions,
13667) -> Result<()> {
13668    unsafe {
13669        let inp_in: *mut bindings::VipsImage = inp.ctx;
13670        let target_in: *mut bindings::VipsTarget = target.ctx;
13671
13672        let format_in: i32 = ppmsave_target_options.format as i32;
13673        let format_in_name = utils::new_c_string("format")?;
13674
13675        let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13676        let ascii_in_name = utils::new_c_string("ascii")?;
13677
13678        let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13679        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13680
13681        let keep_in: i32 = ppmsave_target_options.keep as i32;
13682        let keep_in_name = utils::new_c_string("keep")?;
13683
13684        let background_wrapper =
13685            utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13686        let background_in = background_wrapper.ctx;
13687        let background_in_name = utils::new_c_string("background")?;
13688
13689        let page_height_in: i32 = ppmsave_target_options.page_height;
13690        let page_height_in_name = utils::new_c_string("page-height")?;
13691
13692        let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13693        let profile_in_name = utils::new_c_string("profile")?;
13694
13695        let vips_op_response = bindings::vips_ppmsave_target(
13696            inp_in,
13697            target_in,
13698            format_in_name.as_ptr(),
13699            format_in,
13700            ascii_in_name.as_ptr(),
13701            ascii_in,
13702            bitdepth_in_name.as_ptr(),
13703            bitdepth_in,
13704            keep_in_name.as_ptr(),
13705            keep_in,
13706            background_in_name.as_ptr(),
13707            background_in,
13708            page_height_in_name.as_ptr(),
13709            page_height_in,
13710            profile_in_name.as_ptr(),
13711            profile_in.as_ptr(),
13712            NULL,
13713        );
13714        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13715    }
13716}
13717
13718/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
13719/// inp: `&VipsImage` -> Image to save
13720/// filename: `&str` -> Filename to save to
13721
13722pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13723    unsafe {
13724        let inp_in: *mut bindings::VipsImage = inp.ctx;
13725        let filename_in: CString = utils::new_c_string(filename)?;
13726
13727        let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13728        utils::result(vips_op_response, (), Error::RadsaveError)
13729    }
13730}
13731
13732/// Options for radsave operation
13733#[derive(Clone, Debug)]
13734pub struct RadsaveOptions {
13735    /// keep: `ForeignKeep` -> Which metadata to retain
13736    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13737    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13738    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13739    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13740    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13741    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13742    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13743    pub keep: ForeignKeep,
13744    /// background: `Vec<f64>` -> Background value
13745    pub background: Vec<f64>,
13746    /// page_height: `i32` -> Set page height for multipage save
13747    /// min: 0, max: 100000000, default: 0
13748    pub page_height: i32,
13749    /// profile: `String` -> Filename of ICC profile to embed
13750    pub profile: String,
13751}
13752
13753impl std::default::Default for RadsaveOptions {
13754    fn default() -> Self {
13755        RadsaveOptions {
13756            keep: ForeignKeep::All,
13757            background: Vec::new(),
13758            page_height: i32::from(0),
13759            profile: String::from("sRGB"),
13760        }
13761    }
13762}
13763
13764/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
13765/// inp: `&VipsImage` -> Image to save
13766/// filename: `&str` -> Filename to save to
13767/// radsave_options: `&RadsaveOptions` -> optional arguments
13768
13769pub fn radsave_with_opts(
13770    inp: &VipsImage,
13771    filename: &str,
13772    radsave_options: &RadsaveOptions,
13773) -> Result<()> {
13774    unsafe {
13775        let inp_in: *mut bindings::VipsImage = inp.ctx;
13776        let filename_in: CString = utils::new_c_string(filename)?;
13777
13778        let keep_in: i32 = radsave_options.keep as i32;
13779        let keep_in_name = utils::new_c_string("keep")?;
13780
13781        let background_wrapper =
13782            utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13783        let background_in = background_wrapper.ctx;
13784        let background_in_name = utils::new_c_string("background")?;
13785
13786        let page_height_in: i32 = radsave_options.page_height;
13787        let page_height_in_name = utils::new_c_string("page-height")?;
13788
13789        let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13790        let profile_in_name = utils::new_c_string("profile")?;
13791
13792        let vips_op_response = bindings::vips_radsave(
13793            inp_in,
13794            filename_in.as_ptr(),
13795            keep_in_name.as_ptr(),
13796            keep_in,
13797            background_in_name.as_ptr(),
13798            background_in,
13799            page_height_in_name.as_ptr(),
13800            page_height_in,
13801            profile_in_name.as_ptr(),
13802            profile_in.as_ptr(),
13803            NULL,
13804        );
13805        utils::result(vips_op_response, (), Error::RadsaveError)
13806    }
13807}
13808
13809/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
13810/// inp: `&VipsImage` -> Image to save
13811/// returns `Vec<u8>` - Buffer to save to
13812pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13813    unsafe {
13814        let inp_in: *mut bindings::VipsImage = inp.ctx;
13815        let mut buffer_buf_size: u64 = 0;
13816        let mut buffer_out: *mut c_void = null_mut();
13817
13818        let vips_op_response =
13819            bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13820        utils::result(
13821            vips_op_response,
13822            utils::new_byte_array(buffer_out, buffer_buf_size),
13823            Error::RadsaveBufferError,
13824        )
13825    }
13826}
13827
13828/// Options for radsave_buffer operation
13829#[derive(Clone, Debug)]
13830pub struct RadsaveBufferOptions {
13831    /// keep: `ForeignKeep` -> Which metadata to retain
13832    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13833    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13834    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13835    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13836    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13837    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13838    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13839    pub keep: ForeignKeep,
13840    /// background: `Vec<f64>` -> Background value
13841    pub background: Vec<f64>,
13842    /// page_height: `i32` -> Set page height for multipage save
13843    /// min: 0, max: 100000000, default: 0
13844    pub page_height: i32,
13845    /// profile: `String` -> Filename of ICC profile to embed
13846    pub profile: String,
13847}
13848
13849impl std::default::Default for RadsaveBufferOptions {
13850    fn default() -> Self {
13851        RadsaveBufferOptions {
13852            keep: ForeignKeep::All,
13853            background: Vec::new(),
13854            page_height: i32::from(0),
13855            profile: String::from("sRGB"),
13856        }
13857    }
13858}
13859
13860/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
13861/// inp: `&VipsImage` -> Image to save
13862/// radsave_buffer_options: `&RadsaveBufferOptions` -> optional arguments
13863/// returns `Vec<u8>` - Buffer to save to
13864pub fn radsave_buffer_with_opts(
13865    inp: &VipsImage,
13866    radsave_buffer_options: &RadsaveBufferOptions,
13867) -> Result<Vec<u8>> {
13868    unsafe {
13869        let inp_in: *mut bindings::VipsImage = inp.ctx;
13870        let mut buffer_buf_size: u64 = 0;
13871        let mut buffer_out: *mut c_void = null_mut();
13872
13873        let keep_in: i32 = radsave_buffer_options.keep as i32;
13874        let keep_in_name = utils::new_c_string("keep")?;
13875
13876        let background_wrapper =
13877            utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
13878        let background_in = background_wrapper.ctx;
13879        let background_in_name = utils::new_c_string("background")?;
13880
13881        let page_height_in: i32 = radsave_buffer_options.page_height;
13882        let page_height_in_name = utils::new_c_string("page-height")?;
13883
13884        let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
13885        let profile_in_name = utils::new_c_string("profile")?;
13886
13887        let vips_op_response = bindings::vips_radsave_buffer(
13888            inp_in,
13889            &mut buffer_out,
13890            &mut buffer_buf_size,
13891            keep_in_name.as_ptr(),
13892            keep_in,
13893            background_in_name.as_ptr(),
13894            background_in,
13895            page_height_in_name.as_ptr(),
13896            page_height_in,
13897            profile_in_name.as_ptr(),
13898            profile_in.as_ptr(),
13899            NULL,
13900        );
13901        utils::result(
13902            vips_op_response,
13903            utils::new_byte_array(buffer_out, buffer_buf_size),
13904            Error::RadsaveBufferError,
13905        )
13906    }
13907}
13908
13909/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
13910/// inp: `&VipsImage` -> Image to save
13911/// target: `&VipsTarget` -> Target to save to
13912
13913pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13914    unsafe {
13915        let inp_in: *mut bindings::VipsImage = inp.ctx;
13916        let target_in: *mut bindings::VipsTarget = target.ctx;
13917
13918        let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
13919        utils::result(vips_op_response, (), Error::RadsaveTargetError)
13920    }
13921}
13922
13923/// Options for radsave_target operation
13924#[derive(Clone, Debug)]
13925pub struct RadsaveTargetOptions {
13926    /// keep: `ForeignKeep` -> Which metadata to retain
13927    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13928    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13929    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13930    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13931    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13932    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13933    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13934    pub keep: ForeignKeep,
13935    /// background: `Vec<f64>` -> Background value
13936    pub background: Vec<f64>,
13937    /// page_height: `i32` -> Set page height for multipage save
13938    /// min: 0, max: 100000000, default: 0
13939    pub page_height: i32,
13940    /// profile: `String` -> Filename of ICC profile to embed
13941    pub profile: String,
13942}
13943
13944impl std::default::Default for RadsaveTargetOptions {
13945    fn default() -> Self {
13946        RadsaveTargetOptions {
13947            keep: ForeignKeep::All,
13948            background: Vec::new(),
13949            page_height: i32::from(0),
13950            profile: String::from("sRGB"),
13951        }
13952    }
13953}
13954
13955/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
13956/// inp: `&VipsImage` -> Image to save
13957/// target: `&VipsTarget` -> Target to save to
13958/// radsave_target_options: `&RadsaveTargetOptions` -> optional arguments
13959
13960pub fn radsave_target_with_opts(
13961    inp: &VipsImage,
13962    target: &VipsTarget,
13963    radsave_target_options: &RadsaveTargetOptions,
13964) -> Result<()> {
13965    unsafe {
13966        let inp_in: *mut bindings::VipsImage = inp.ctx;
13967        let target_in: *mut bindings::VipsTarget = target.ctx;
13968
13969        let keep_in: i32 = radsave_target_options.keep as i32;
13970        let keep_in_name = utils::new_c_string("keep")?;
13971
13972        let background_wrapper =
13973            utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
13974        let background_in = background_wrapper.ctx;
13975        let background_in_name = utils::new_c_string("background")?;
13976
13977        let page_height_in: i32 = radsave_target_options.page_height;
13978        let page_height_in_name = utils::new_c_string("page-height")?;
13979
13980        let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
13981        let profile_in_name = utils::new_c_string("profile")?;
13982
13983        let vips_op_response = bindings::vips_radsave_target(
13984            inp_in,
13985            target_in,
13986            keep_in_name.as_ptr(),
13987            keep_in,
13988            background_in_name.as_ptr(),
13989            background_in,
13990            page_height_in_name.as_ptr(),
13991            page_height_in,
13992            profile_in_name.as_ptr(),
13993            profile_in.as_ptr(),
13994            NULL,
13995        );
13996        utils::result(vips_op_response, (), Error::RadsaveTargetError)
13997    }
13998}
13999
14000/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
14001/// inp: `&VipsImage` -> Image to save
14002/// filename: `&str` -> Filename to save to
14003
14004pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
14005    unsafe {
14006        let inp_in: *mut bindings::VipsImage = inp.ctx;
14007        let filename_in: CString = utils::new_c_string(filename)?;
14008
14009        let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
14010        utils::result(vips_op_response, (), Error::GifsaveError)
14011    }
14012}
14013
14014/// Options for gifsave operation
14015#[derive(Clone, Debug)]
14016pub struct GifsaveOptions {
14017    /// dither: `f64` -> Amount of dithering
14018    /// min: 0, max: 1, default: 1
14019    pub dither: f64,
14020    /// effort: `i32` -> Quantisation effort
14021    /// min: 1, max: 10, default: 7
14022    pub effort: i32,
14023    /// bitdepth: `i32` -> Number of bits per pixel
14024    /// min: 1, max: 8, default: 8
14025    pub bitdepth: i32,
14026    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14027    /// min: 0, max: 32, default: 0
14028    pub interframe_maxerror: f64,
14029    /// reuse: `bool` -> Reuse palette from input
14030    /// default: false
14031    pub reuse: bool,
14032    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14033    /// min: 0, max: 256, default: 3
14034    pub interpalette_maxerror: f64,
14035    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14036    /// default: false
14037    pub interlace: bool,
14038    /// keep: `ForeignKeep` -> Which metadata to retain
14039    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14040    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14041    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14042    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14043    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14044    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14045    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14046    pub keep: ForeignKeep,
14047    /// background: `Vec<f64>` -> Background value
14048    pub background: Vec<f64>,
14049    /// page_height: `i32` -> Set page height for multipage save
14050    /// min: 0, max: 100000000, default: 0
14051    pub page_height: i32,
14052    /// profile: `String` -> Filename of ICC profile to embed
14053    pub profile: String,
14054}
14055
14056impl std::default::Default for GifsaveOptions {
14057    fn default() -> Self {
14058        GifsaveOptions {
14059            dither: f64::from(1),
14060            effort: i32::from(7),
14061            bitdepth: i32::from(8),
14062            interframe_maxerror: f64::from(0),
14063            reuse: false,
14064            interpalette_maxerror: f64::from(3),
14065            interlace: false,
14066            keep: ForeignKeep::All,
14067            background: Vec::new(),
14068            page_height: i32::from(0),
14069            profile: String::from("sRGB"),
14070        }
14071    }
14072}
14073
14074/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
14075/// inp: `&VipsImage` -> Image to save
14076/// filename: `&str` -> Filename to save to
14077/// gifsave_options: `&GifsaveOptions` -> optional arguments
14078
14079pub fn gifsave_with_opts(
14080    inp: &VipsImage,
14081    filename: &str,
14082    gifsave_options: &GifsaveOptions,
14083) -> Result<()> {
14084    unsafe {
14085        let inp_in: *mut bindings::VipsImage = inp.ctx;
14086        let filename_in: CString = utils::new_c_string(filename)?;
14087
14088        let dither_in: f64 = gifsave_options.dither;
14089        let dither_in_name = utils::new_c_string("dither")?;
14090
14091        let effort_in: i32 = gifsave_options.effort;
14092        let effort_in_name = utils::new_c_string("effort")?;
14093
14094        let bitdepth_in: i32 = gifsave_options.bitdepth;
14095        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14096
14097        let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
14098        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14099
14100        let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
14101        let reuse_in_name = utils::new_c_string("reuse")?;
14102
14103        let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
14104        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14105
14106        let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
14107        let interlace_in_name = utils::new_c_string("interlace")?;
14108
14109        let keep_in: i32 = gifsave_options.keep as i32;
14110        let keep_in_name = utils::new_c_string("keep")?;
14111
14112        let background_wrapper =
14113            utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
14114        let background_in = background_wrapper.ctx;
14115        let background_in_name = utils::new_c_string("background")?;
14116
14117        let page_height_in: i32 = gifsave_options.page_height;
14118        let page_height_in_name = utils::new_c_string("page-height")?;
14119
14120        let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
14121        let profile_in_name = utils::new_c_string("profile")?;
14122
14123        let vips_op_response = bindings::vips_gifsave(
14124            inp_in,
14125            filename_in.as_ptr(),
14126            dither_in_name.as_ptr(),
14127            dither_in,
14128            effort_in_name.as_ptr(),
14129            effort_in,
14130            bitdepth_in_name.as_ptr(),
14131            bitdepth_in,
14132            interframe_maxerror_in_name.as_ptr(),
14133            interframe_maxerror_in,
14134            reuse_in_name.as_ptr(),
14135            reuse_in,
14136            interpalette_maxerror_in_name.as_ptr(),
14137            interpalette_maxerror_in,
14138            interlace_in_name.as_ptr(),
14139            interlace_in,
14140            keep_in_name.as_ptr(),
14141            keep_in,
14142            background_in_name.as_ptr(),
14143            background_in,
14144            page_height_in_name.as_ptr(),
14145            page_height_in,
14146            profile_in_name.as_ptr(),
14147            profile_in.as_ptr(),
14148            NULL,
14149        );
14150        utils::result(vips_op_response, (), Error::GifsaveError)
14151    }
14152}
14153
14154/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
14155/// inp: `&VipsImage` -> Image to save
14156/// returns `Vec<u8>` - Buffer to save to
14157pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14158    unsafe {
14159        let inp_in: *mut bindings::VipsImage = inp.ctx;
14160        let mut buffer_buf_size: u64 = 0;
14161        let mut buffer_out: *mut c_void = null_mut();
14162
14163        let vips_op_response =
14164            bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14165        utils::result(
14166            vips_op_response,
14167            utils::new_byte_array(buffer_out, buffer_buf_size),
14168            Error::GifsaveBufferError,
14169        )
14170    }
14171}
14172
14173/// Options for gifsave_buffer operation
14174#[derive(Clone, Debug)]
14175pub struct GifsaveBufferOptions {
14176    /// dither: `f64` -> Amount of dithering
14177    /// min: 0, max: 1, default: 1
14178    pub dither: f64,
14179    /// effort: `i32` -> Quantisation effort
14180    /// min: 1, max: 10, default: 7
14181    pub effort: i32,
14182    /// bitdepth: `i32` -> Number of bits per pixel
14183    /// min: 1, max: 8, default: 8
14184    pub bitdepth: i32,
14185    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14186    /// min: 0, max: 32, default: 0
14187    pub interframe_maxerror: f64,
14188    /// reuse: `bool` -> Reuse palette from input
14189    /// default: false
14190    pub reuse: bool,
14191    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14192    /// min: 0, max: 256, default: 3
14193    pub interpalette_maxerror: f64,
14194    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14195    /// default: false
14196    pub interlace: bool,
14197    /// keep: `ForeignKeep` -> Which metadata to retain
14198    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14199    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14200    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14201    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14202    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14203    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14204    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14205    pub keep: ForeignKeep,
14206    /// background: `Vec<f64>` -> Background value
14207    pub background: Vec<f64>,
14208    /// page_height: `i32` -> Set page height for multipage save
14209    /// min: 0, max: 100000000, default: 0
14210    pub page_height: i32,
14211    /// profile: `String` -> Filename of ICC profile to embed
14212    pub profile: String,
14213}
14214
14215impl std::default::Default for GifsaveBufferOptions {
14216    fn default() -> Self {
14217        GifsaveBufferOptions {
14218            dither: f64::from(1),
14219            effort: i32::from(7),
14220            bitdepth: i32::from(8),
14221            interframe_maxerror: f64::from(0),
14222            reuse: false,
14223            interpalette_maxerror: f64::from(3),
14224            interlace: false,
14225            keep: ForeignKeep::All,
14226            background: Vec::new(),
14227            page_height: i32::from(0),
14228            profile: String::from("sRGB"),
14229        }
14230    }
14231}
14232
14233/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
14234/// inp: `&VipsImage` -> Image to save
14235/// gifsave_buffer_options: `&GifsaveBufferOptions` -> optional arguments
14236/// returns `Vec<u8>` - Buffer to save to
14237pub fn gifsave_buffer_with_opts(
14238    inp: &VipsImage,
14239    gifsave_buffer_options: &GifsaveBufferOptions,
14240) -> Result<Vec<u8>> {
14241    unsafe {
14242        let inp_in: *mut bindings::VipsImage = inp.ctx;
14243        let mut buffer_buf_size: u64 = 0;
14244        let mut buffer_out: *mut c_void = null_mut();
14245
14246        let dither_in: f64 = gifsave_buffer_options.dither;
14247        let dither_in_name = utils::new_c_string("dither")?;
14248
14249        let effort_in: i32 = gifsave_buffer_options.effort;
14250        let effort_in_name = utils::new_c_string("effort")?;
14251
14252        let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
14253        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14254
14255        let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
14256        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14257
14258        let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
14259        let reuse_in_name = utils::new_c_string("reuse")?;
14260
14261        let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
14262        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14263
14264        let interlace_in: i32 = if gifsave_buffer_options.interlace {
14265            1
14266        } else {
14267            0
14268        };
14269        let interlace_in_name = utils::new_c_string("interlace")?;
14270
14271        let keep_in: i32 = gifsave_buffer_options.keep as i32;
14272        let keep_in_name = utils::new_c_string("keep")?;
14273
14274        let background_wrapper =
14275            utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
14276        let background_in = background_wrapper.ctx;
14277        let background_in_name = utils::new_c_string("background")?;
14278
14279        let page_height_in: i32 = gifsave_buffer_options.page_height;
14280        let page_height_in_name = utils::new_c_string("page-height")?;
14281
14282        let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14283        let profile_in_name = utils::new_c_string("profile")?;
14284
14285        let vips_op_response = bindings::vips_gifsave_buffer(
14286            inp_in,
14287            &mut buffer_out,
14288            &mut buffer_buf_size,
14289            dither_in_name.as_ptr(),
14290            dither_in,
14291            effort_in_name.as_ptr(),
14292            effort_in,
14293            bitdepth_in_name.as_ptr(),
14294            bitdepth_in,
14295            interframe_maxerror_in_name.as_ptr(),
14296            interframe_maxerror_in,
14297            reuse_in_name.as_ptr(),
14298            reuse_in,
14299            interpalette_maxerror_in_name.as_ptr(),
14300            interpalette_maxerror_in,
14301            interlace_in_name.as_ptr(),
14302            interlace_in,
14303            keep_in_name.as_ptr(),
14304            keep_in,
14305            background_in_name.as_ptr(),
14306            background_in,
14307            page_height_in_name.as_ptr(),
14308            page_height_in,
14309            profile_in_name.as_ptr(),
14310            profile_in.as_ptr(),
14311            NULL,
14312        );
14313        utils::result(
14314            vips_op_response,
14315            utils::new_byte_array(buffer_out, buffer_buf_size),
14316            Error::GifsaveBufferError,
14317        )
14318    }
14319}
14320
14321/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
14322/// inp: `&VipsImage` -> Image to save
14323/// target: `&VipsTarget` -> Target to save to
14324
14325pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14326    unsafe {
14327        let inp_in: *mut bindings::VipsImage = inp.ctx;
14328        let target_in: *mut bindings::VipsTarget = target.ctx;
14329
14330        let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14331        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14332    }
14333}
14334
14335/// Options for gifsave_target operation
14336#[derive(Clone, Debug)]
14337pub struct GifsaveTargetOptions {
14338    /// dither: `f64` -> Amount of dithering
14339    /// min: 0, max: 1, default: 1
14340    pub dither: f64,
14341    /// effort: `i32` -> Quantisation effort
14342    /// min: 1, max: 10, default: 7
14343    pub effort: i32,
14344    /// bitdepth: `i32` -> Number of bits per pixel
14345    /// min: 1, max: 8, default: 8
14346    pub bitdepth: i32,
14347    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14348    /// min: 0, max: 32, default: 0
14349    pub interframe_maxerror: f64,
14350    /// reuse: `bool` -> Reuse palette from input
14351    /// default: false
14352    pub reuse: bool,
14353    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14354    /// min: 0, max: 256, default: 3
14355    pub interpalette_maxerror: f64,
14356    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14357    /// default: false
14358    pub interlace: bool,
14359    /// keep: `ForeignKeep` -> Which metadata to retain
14360    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14361    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14362    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14363    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14364    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14365    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14366    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14367    pub keep: ForeignKeep,
14368    /// background: `Vec<f64>` -> Background value
14369    pub background: Vec<f64>,
14370    /// page_height: `i32` -> Set page height for multipage save
14371    /// min: 0, max: 100000000, default: 0
14372    pub page_height: i32,
14373    /// profile: `String` -> Filename of ICC profile to embed
14374    pub profile: String,
14375}
14376
14377impl std::default::Default for GifsaveTargetOptions {
14378    fn default() -> Self {
14379        GifsaveTargetOptions {
14380            dither: f64::from(1),
14381            effort: i32::from(7),
14382            bitdepth: i32::from(8),
14383            interframe_maxerror: f64::from(0),
14384            reuse: false,
14385            interpalette_maxerror: f64::from(3),
14386            interlace: false,
14387            keep: ForeignKeep::All,
14388            background: Vec::new(),
14389            page_height: i32::from(0),
14390            profile: String::from("sRGB"),
14391        }
14392    }
14393}
14394
14395/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
14396/// inp: `&VipsImage` -> Image to save
14397/// target: `&VipsTarget` -> Target to save to
14398/// gifsave_target_options: `&GifsaveTargetOptions` -> optional arguments
14399
14400pub fn gifsave_target_with_opts(
14401    inp: &VipsImage,
14402    target: &VipsTarget,
14403    gifsave_target_options: &GifsaveTargetOptions,
14404) -> Result<()> {
14405    unsafe {
14406        let inp_in: *mut bindings::VipsImage = inp.ctx;
14407        let target_in: *mut bindings::VipsTarget = target.ctx;
14408
14409        let dither_in: f64 = gifsave_target_options.dither;
14410        let dither_in_name = utils::new_c_string("dither")?;
14411
14412        let effort_in: i32 = gifsave_target_options.effort;
14413        let effort_in_name = utils::new_c_string("effort")?;
14414
14415        let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14416        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14417
14418        let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14419        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14420
14421        let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14422        let reuse_in_name = utils::new_c_string("reuse")?;
14423
14424        let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14425        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14426
14427        let interlace_in: i32 = if gifsave_target_options.interlace {
14428            1
14429        } else {
14430            0
14431        };
14432        let interlace_in_name = utils::new_c_string("interlace")?;
14433
14434        let keep_in: i32 = gifsave_target_options.keep as i32;
14435        let keep_in_name = utils::new_c_string("keep")?;
14436
14437        let background_wrapper =
14438            utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14439        let background_in = background_wrapper.ctx;
14440        let background_in_name = utils::new_c_string("background")?;
14441
14442        let page_height_in: i32 = gifsave_target_options.page_height;
14443        let page_height_in_name = utils::new_c_string("page-height")?;
14444
14445        let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14446        let profile_in_name = utils::new_c_string("profile")?;
14447
14448        let vips_op_response = bindings::vips_gifsave_target(
14449            inp_in,
14450            target_in,
14451            dither_in_name.as_ptr(),
14452            dither_in,
14453            effort_in_name.as_ptr(),
14454            effort_in,
14455            bitdepth_in_name.as_ptr(),
14456            bitdepth_in,
14457            interframe_maxerror_in_name.as_ptr(),
14458            interframe_maxerror_in,
14459            reuse_in_name.as_ptr(),
14460            reuse_in,
14461            interpalette_maxerror_in_name.as_ptr(),
14462            interpalette_maxerror_in,
14463            interlace_in_name.as_ptr(),
14464            interlace_in,
14465            keep_in_name.as_ptr(),
14466            keep_in,
14467            background_in_name.as_ptr(),
14468            background_in,
14469            page_height_in_name.as_ptr(),
14470            page_height_in,
14471            profile_in_name.as_ptr(),
14472            profile_in.as_ptr(),
14473            NULL,
14474        );
14475        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14476    }
14477}
14478
14479/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, rgba
14480/// inp: `&VipsImage` -> Image to save
14481/// filename: `&str` -> Filename to save to
14482
14483pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14484    unsafe {
14485        let inp_in: *mut bindings::VipsImage = inp.ctx;
14486        let filename_in: CString = utils::new_c_string(filename)?;
14487
14488        let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14489        utils::result(vips_op_response, (), Error::PngsaveError)
14490    }
14491}
14492
14493/// Options for pngsave operation
14494#[derive(Clone, Debug)]
14495pub struct PngsaveOptions {
14496    /// compression: `i32` -> Compression factor
14497    /// min: 0, max: 9, default: 6
14498    pub compression: i32,
14499    /// interlace: `bool` -> Interlace image
14500    /// default: false
14501    pub interlace: bool,
14502    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14503    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14504    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14505    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14506    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14507    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14508    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14509    pub filter: ForeignPngFilter,
14510    /// palette: `bool` -> Quantise to 8bpp palette
14511    /// default: false
14512    pub palette: bool,
14513    /// q: `i32` -> Quantisation quality
14514    /// min: 0, max: 100, default: 100
14515    pub q: i32,
14516    /// dither: `f64` -> Amount of dithering
14517    /// min: 0, max: 1, default: 1
14518    pub dither: f64,
14519    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14520    /// min: 1, max: 16, default: 8
14521    pub bitdepth: i32,
14522    /// effort: `i32` -> Quantisation CPU effort
14523    /// min: 1, max: 10, default: 7
14524    pub effort: i32,
14525    /// keep: `ForeignKeep` -> Which metadata to retain
14526    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14527    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14528    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14529    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14530    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14531    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14532    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14533    pub keep: ForeignKeep,
14534    /// background: `Vec<f64>` -> Background value
14535    pub background: Vec<f64>,
14536    /// page_height: `i32` -> Set page height for multipage save
14537    /// min: 0, max: 100000000, default: 0
14538    pub page_height: i32,
14539    /// profile: `String` -> Filename of ICC profile to embed
14540    pub profile: String,
14541}
14542
14543impl std::default::Default for PngsaveOptions {
14544    fn default() -> Self {
14545        PngsaveOptions {
14546            compression: i32::from(6),
14547            interlace: false,
14548            filter: ForeignPngFilter::None,
14549            palette: false,
14550            q: i32::from(100),
14551            dither: f64::from(1),
14552            bitdepth: i32::from(8),
14553            effort: i32::from(7),
14554            keep: ForeignKeep::All,
14555            background: Vec::new(),
14556            page_height: i32::from(0),
14557            profile: String::from("sRGB"),
14558        }
14559    }
14560}
14561
14562/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, rgba
14563/// inp: `&VipsImage` -> Image to save
14564/// filename: `&str` -> Filename to save to
14565/// pngsave_options: `&PngsaveOptions` -> optional arguments
14566
14567pub fn pngsave_with_opts(
14568    inp: &VipsImage,
14569    filename: &str,
14570    pngsave_options: &PngsaveOptions,
14571) -> Result<()> {
14572    unsafe {
14573        let inp_in: *mut bindings::VipsImage = inp.ctx;
14574        let filename_in: CString = utils::new_c_string(filename)?;
14575
14576        let compression_in: i32 = pngsave_options.compression;
14577        let compression_in_name = utils::new_c_string("compression")?;
14578
14579        let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14580        let interlace_in_name = utils::new_c_string("interlace")?;
14581
14582        let filter_in: i32 = pngsave_options.filter as i32;
14583        let filter_in_name = utils::new_c_string("filter")?;
14584
14585        let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14586        let palette_in_name = utils::new_c_string("palette")?;
14587
14588        let q_in: i32 = pngsave_options.q;
14589        let q_in_name = utils::new_c_string("Q")?;
14590
14591        let dither_in: f64 = pngsave_options.dither;
14592        let dither_in_name = utils::new_c_string("dither")?;
14593
14594        let bitdepth_in: i32 = pngsave_options.bitdepth;
14595        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14596
14597        let effort_in: i32 = pngsave_options.effort;
14598        let effort_in_name = utils::new_c_string("effort")?;
14599
14600        let keep_in: i32 = pngsave_options.keep as i32;
14601        let keep_in_name = utils::new_c_string("keep")?;
14602
14603        let background_wrapper =
14604            utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14605        let background_in = background_wrapper.ctx;
14606        let background_in_name = utils::new_c_string("background")?;
14607
14608        let page_height_in: i32 = pngsave_options.page_height;
14609        let page_height_in_name = utils::new_c_string("page-height")?;
14610
14611        let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14612        let profile_in_name = utils::new_c_string("profile")?;
14613
14614        let vips_op_response = bindings::vips_pngsave(
14615            inp_in,
14616            filename_in.as_ptr(),
14617            compression_in_name.as_ptr(),
14618            compression_in,
14619            interlace_in_name.as_ptr(),
14620            interlace_in,
14621            filter_in_name.as_ptr(),
14622            filter_in,
14623            palette_in_name.as_ptr(),
14624            palette_in,
14625            q_in_name.as_ptr(),
14626            q_in,
14627            dither_in_name.as_ptr(),
14628            dither_in,
14629            bitdepth_in_name.as_ptr(),
14630            bitdepth_in,
14631            effort_in_name.as_ptr(),
14632            effort_in,
14633            keep_in_name.as_ptr(),
14634            keep_in,
14635            background_in_name.as_ptr(),
14636            background_in,
14637            page_height_in_name.as_ptr(),
14638            page_height_in,
14639            profile_in_name.as_ptr(),
14640            profile_in.as_ptr(),
14641            NULL,
14642        );
14643        utils::result(vips_op_response, (), Error::PngsaveError)
14644    }
14645}
14646
14647/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, rgba
14648/// inp: `&VipsImage` -> Image to save
14649/// returns `Vec<u8>` - Buffer to save to
14650pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14651    unsafe {
14652        let inp_in: *mut bindings::VipsImage = inp.ctx;
14653        let mut buffer_buf_size: u64 = 0;
14654        let mut buffer_out: *mut c_void = null_mut();
14655
14656        let vips_op_response =
14657            bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14658        utils::result(
14659            vips_op_response,
14660            utils::new_byte_array(buffer_out, buffer_buf_size),
14661            Error::PngsaveBufferError,
14662        )
14663    }
14664}
14665
14666/// Options for pngsave_buffer operation
14667#[derive(Clone, Debug)]
14668pub struct PngsaveBufferOptions {
14669    /// compression: `i32` -> Compression factor
14670    /// min: 0, max: 9, default: 6
14671    pub compression: i32,
14672    /// interlace: `bool` -> Interlace image
14673    /// default: false
14674    pub interlace: bool,
14675    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14676    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14677    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14678    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14679    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14680    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14681    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14682    pub filter: ForeignPngFilter,
14683    /// palette: `bool` -> Quantise to 8bpp palette
14684    /// default: false
14685    pub palette: bool,
14686    /// q: `i32` -> Quantisation quality
14687    /// min: 0, max: 100, default: 100
14688    pub q: i32,
14689    /// dither: `f64` -> Amount of dithering
14690    /// min: 0, max: 1, default: 1
14691    pub dither: f64,
14692    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14693    /// min: 1, max: 16, default: 8
14694    pub bitdepth: i32,
14695    /// effort: `i32` -> Quantisation CPU effort
14696    /// min: 1, max: 10, default: 7
14697    pub effort: i32,
14698    /// keep: `ForeignKeep` -> Which metadata to retain
14699    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14700    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14701    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14702    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14703    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14704    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14705    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14706    pub keep: ForeignKeep,
14707    /// background: `Vec<f64>` -> Background value
14708    pub background: Vec<f64>,
14709    /// page_height: `i32` -> Set page height for multipage save
14710    /// min: 0, max: 100000000, default: 0
14711    pub page_height: i32,
14712    /// profile: `String` -> Filename of ICC profile to embed
14713    pub profile: String,
14714}
14715
14716impl std::default::Default for PngsaveBufferOptions {
14717    fn default() -> Self {
14718        PngsaveBufferOptions {
14719            compression: i32::from(6),
14720            interlace: false,
14721            filter: ForeignPngFilter::None,
14722            palette: false,
14723            q: i32::from(100),
14724            dither: f64::from(1),
14725            bitdepth: i32::from(8),
14726            effort: i32::from(7),
14727            keep: ForeignKeep::All,
14728            background: Vec::new(),
14729            page_height: i32::from(0),
14730            profile: String::from("sRGB"),
14731        }
14732    }
14733}
14734
14735/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, rgba
14736/// inp: `&VipsImage` -> Image to save
14737/// pngsave_buffer_options: `&PngsaveBufferOptions` -> optional arguments
14738/// returns `Vec<u8>` - Buffer to save to
14739pub fn pngsave_buffer_with_opts(
14740    inp: &VipsImage,
14741    pngsave_buffer_options: &PngsaveBufferOptions,
14742) -> Result<Vec<u8>> {
14743    unsafe {
14744        let inp_in: *mut bindings::VipsImage = inp.ctx;
14745        let mut buffer_buf_size: u64 = 0;
14746        let mut buffer_out: *mut c_void = null_mut();
14747
14748        let compression_in: i32 = pngsave_buffer_options.compression;
14749        let compression_in_name = utils::new_c_string("compression")?;
14750
14751        let interlace_in: i32 = if pngsave_buffer_options.interlace {
14752            1
14753        } else {
14754            0
14755        };
14756        let interlace_in_name = utils::new_c_string("interlace")?;
14757
14758        let filter_in: i32 = pngsave_buffer_options.filter as i32;
14759        let filter_in_name = utils::new_c_string("filter")?;
14760
14761        let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14762        let palette_in_name = utils::new_c_string("palette")?;
14763
14764        let q_in: i32 = pngsave_buffer_options.q;
14765        let q_in_name = utils::new_c_string("Q")?;
14766
14767        let dither_in: f64 = pngsave_buffer_options.dither;
14768        let dither_in_name = utils::new_c_string("dither")?;
14769
14770        let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
14771        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14772
14773        let effort_in: i32 = pngsave_buffer_options.effort;
14774        let effort_in_name = utils::new_c_string("effort")?;
14775
14776        let keep_in: i32 = pngsave_buffer_options.keep as i32;
14777        let keep_in_name = utils::new_c_string("keep")?;
14778
14779        let background_wrapper =
14780            utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
14781        let background_in = background_wrapper.ctx;
14782        let background_in_name = utils::new_c_string("background")?;
14783
14784        let page_height_in: i32 = pngsave_buffer_options.page_height;
14785        let page_height_in_name = utils::new_c_string("page-height")?;
14786
14787        let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
14788        let profile_in_name = utils::new_c_string("profile")?;
14789
14790        let vips_op_response = bindings::vips_pngsave_buffer(
14791            inp_in,
14792            &mut buffer_out,
14793            &mut buffer_buf_size,
14794            compression_in_name.as_ptr(),
14795            compression_in,
14796            interlace_in_name.as_ptr(),
14797            interlace_in,
14798            filter_in_name.as_ptr(),
14799            filter_in,
14800            palette_in_name.as_ptr(),
14801            palette_in,
14802            q_in_name.as_ptr(),
14803            q_in,
14804            dither_in_name.as_ptr(),
14805            dither_in,
14806            bitdepth_in_name.as_ptr(),
14807            bitdepth_in,
14808            effort_in_name.as_ptr(),
14809            effort_in,
14810            keep_in_name.as_ptr(),
14811            keep_in,
14812            background_in_name.as_ptr(),
14813            background_in,
14814            page_height_in_name.as_ptr(),
14815            page_height_in,
14816            profile_in_name.as_ptr(),
14817            profile_in.as_ptr(),
14818            NULL,
14819        );
14820        utils::result(
14821            vips_op_response,
14822            utils::new_byte_array(buffer_out, buffer_buf_size),
14823            Error::PngsaveBufferError,
14824        )
14825    }
14826}
14827
14828/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
14829/// inp: `&VipsImage` -> Image to save
14830/// target: `&VipsTarget` -> Target to save to
14831
14832pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14833    unsafe {
14834        let inp_in: *mut bindings::VipsImage = inp.ctx;
14835        let target_in: *mut bindings::VipsTarget = target.ctx;
14836
14837        let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
14838        utils::result(vips_op_response, (), Error::PngsaveTargetError)
14839    }
14840}
14841
14842/// Options for pngsave_target operation
14843#[derive(Clone, Debug)]
14844pub struct PngsaveTargetOptions {
14845    /// compression: `i32` -> Compression factor
14846    /// min: 0, max: 9, default: 6
14847    pub compression: i32,
14848    /// interlace: `bool` -> Interlace image
14849    /// default: false
14850    pub interlace: bool,
14851    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14852    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14853    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14854    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14855    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14856    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14857    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14858    pub filter: ForeignPngFilter,
14859    /// palette: `bool` -> Quantise to 8bpp palette
14860    /// default: false
14861    pub palette: bool,
14862    /// q: `i32` -> Quantisation quality
14863    /// min: 0, max: 100, default: 100
14864    pub q: i32,
14865    /// dither: `f64` -> Amount of dithering
14866    /// min: 0, max: 1, default: 1
14867    pub dither: f64,
14868    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14869    /// min: 1, max: 16, default: 8
14870    pub bitdepth: i32,
14871    /// effort: `i32` -> Quantisation CPU effort
14872    /// min: 1, max: 10, default: 7
14873    pub effort: i32,
14874    /// keep: `ForeignKeep` -> Which metadata to retain
14875    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14876    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14877    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14878    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14879    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14880    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14881    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14882    pub keep: ForeignKeep,
14883    /// background: `Vec<f64>` -> Background value
14884    pub background: Vec<f64>,
14885    /// page_height: `i32` -> Set page height for multipage save
14886    /// min: 0, max: 100000000, default: 0
14887    pub page_height: i32,
14888    /// profile: `String` -> Filename of ICC profile to embed
14889    pub profile: String,
14890}
14891
14892impl std::default::Default for PngsaveTargetOptions {
14893    fn default() -> Self {
14894        PngsaveTargetOptions {
14895            compression: i32::from(6),
14896            interlace: false,
14897            filter: ForeignPngFilter::None,
14898            palette: false,
14899            q: i32::from(100),
14900            dither: f64::from(1),
14901            bitdepth: i32::from(8),
14902            effort: i32::from(7),
14903            keep: ForeignKeep::All,
14904            background: Vec::new(),
14905            page_height: i32::from(0),
14906            profile: String::from("sRGB"),
14907        }
14908    }
14909}
14910
14911/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
14912/// inp: `&VipsImage` -> Image to save
14913/// target: `&VipsTarget` -> Target to save to
14914/// pngsave_target_options: `&PngsaveTargetOptions` -> optional arguments
14915
14916pub fn pngsave_target_with_opts(
14917    inp: &VipsImage,
14918    target: &VipsTarget,
14919    pngsave_target_options: &PngsaveTargetOptions,
14920) -> Result<()> {
14921    unsafe {
14922        let inp_in: *mut bindings::VipsImage = inp.ctx;
14923        let target_in: *mut bindings::VipsTarget = target.ctx;
14924
14925        let compression_in: i32 = pngsave_target_options.compression;
14926        let compression_in_name = utils::new_c_string("compression")?;
14927
14928        let interlace_in: i32 = if pngsave_target_options.interlace {
14929            1
14930        } else {
14931            0
14932        };
14933        let interlace_in_name = utils::new_c_string("interlace")?;
14934
14935        let filter_in: i32 = pngsave_target_options.filter as i32;
14936        let filter_in_name = utils::new_c_string("filter")?;
14937
14938        let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
14939        let palette_in_name = utils::new_c_string("palette")?;
14940
14941        let q_in: i32 = pngsave_target_options.q;
14942        let q_in_name = utils::new_c_string("Q")?;
14943
14944        let dither_in: f64 = pngsave_target_options.dither;
14945        let dither_in_name = utils::new_c_string("dither")?;
14946
14947        let bitdepth_in: i32 = pngsave_target_options.bitdepth;
14948        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14949
14950        let effort_in: i32 = pngsave_target_options.effort;
14951        let effort_in_name = utils::new_c_string("effort")?;
14952
14953        let keep_in: i32 = pngsave_target_options.keep as i32;
14954        let keep_in_name = utils::new_c_string("keep")?;
14955
14956        let background_wrapper =
14957            utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
14958        let background_in = background_wrapper.ctx;
14959        let background_in_name = utils::new_c_string("background")?;
14960
14961        let page_height_in: i32 = pngsave_target_options.page_height;
14962        let page_height_in_name = utils::new_c_string("page-height")?;
14963
14964        let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
14965        let profile_in_name = utils::new_c_string("profile")?;
14966
14967        let vips_op_response = bindings::vips_pngsave_target(
14968            inp_in,
14969            target_in,
14970            compression_in_name.as_ptr(),
14971            compression_in,
14972            interlace_in_name.as_ptr(),
14973            interlace_in,
14974            filter_in_name.as_ptr(),
14975            filter_in,
14976            palette_in_name.as_ptr(),
14977            palette_in,
14978            q_in_name.as_ptr(),
14979            q_in,
14980            dither_in_name.as_ptr(),
14981            dither_in,
14982            bitdepth_in_name.as_ptr(),
14983            bitdepth_in,
14984            effort_in_name.as_ptr(),
14985            effort_in,
14986            keep_in_name.as_ptr(),
14987            keep_in,
14988            background_in_name.as_ptr(),
14989            background_in,
14990            page_height_in_name.as_ptr(),
14991            page_height_in,
14992            profile_in_name.as_ptr(),
14993            profile_in.as_ptr(),
14994            NULL,
14995        );
14996        utils::result(vips_op_response, (), Error::PngsaveTargetError)
14997    }
14998}
14999
15000/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15001/// inp: `&VipsImage` -> Image to save
15002/// filename: `&str` -> Filename to save to
15003
15004pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
15005    unsafe {
15006        let inp_in: *mut bindings::VipsImage = inp.ctx;
15007        let filename_in: CString = utils::new_c_string(filename)?;
15008
15009        let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
15010        utils::result(vips_op_response, (), Error::JpegsaveError)
15011    }
15012}
15013
15014/// Options for jpegsave operation
15015#[derive(Clone, Debug)]
15016pub struct JpegsaveOptions {
15017    /// q: `i32` -> Q factor
15018    /// min: 1, max: 100, default: 75
15019    pub q: i32,
15020    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15021    /// default: false
15022    pub optimize_coding: bool,
15023    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15024    /// default: false
15025    pub interlace: bool,
15026    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15027    /// default: false
15028    pub trellis_quant: bool,
15029    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15030    /// default: false
15031    pub overshoot_deringing: bool,
15032    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15033    /// default: false
15034    pub optimize_scans: bool,
15035    /// quant_table: `i32` -> Use predefined quantization table with given index
15036    /// min: 0, max: 8, default: 0
15037    pub quant_table: i32,
15038    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15039    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15040    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15041    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15042    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15043    pub subsample_mode: ForeignSubsample,
15044    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15045    /// min: 0, max: 2147483647, default: 0
15046    pub restart_interval: i32,
15047    /// keep: `ForeignKeep` -> Which metadata to retain
15048    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15049    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15050    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15051    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15052    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15053    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15054    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15055    pub keep: ForeignKeep,
15056    /// background: `Vec<f64>` -> Background value
15057    pub background: Vec<f64>,
15058    /// page_height: `i32` -> Set page height for multipage save
15059    /// min: 0, max: 100000000, default: 0
15060    pub page_height: i32,
15061    /// profile: `String` -> Filename of ICC profile to embed
15062    pub profile: String,
15063}
15064
15065impl std::default::Default for JpegsaveOptions {
15066    fn default() -> Self {
15067        JpegsaveOptions {
15068            q: i32::from(75),
15069            optimize_coding: false,
15070            interlace: false,
15071            trellis_quant: false,
15072            overshoot_deringing: false,
15073            optimize_scans: false,
15074            quant_table: i32::from(0),
15075            subsample_mode: ForeignSubsample::Auto,
15076            restart_interval: i32::from(0),
15077            keep: ForeignKeep::All,
15078            background: Vec::new(),
15079            page_height: i32::from(0),
15080            profile: String::from("sRGB"),
15081        }
15082    }
15083}
15084
15085/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15086/// inp: `&VipsImage` -> Image to save
15087/// filename: `&str` -> Filename to save to
15088/// jpegsave_options: `&JpegsaveOptions` -> optional arguments
15089
15090pub fn jpegsave_with_opts(
15091    inp: &VipsImage,
15092    filename: &str,
15093    jpegsave_options: &JpegsaveOptions,
15094) -> Result<()> {
15095    unsafe {
15096        let inp_in: *mut bindings::VipsImage = inp.ctx;
15097        let filename_in: CString = utils::new_c_string(filename)?;
15098
15099        let q_in: i32 = jpegsave_options.q;
15100        let q_in_name = utils::new_c_string("Q")?;
15101
15102        let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
15103            1
15104        } else {
15105            0
15106        };
15107        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15108
15109        let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
15110        let interlace_in_name = utils::new_c_string("interlace")?;
15111
15112        let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
15113        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15114
15115        let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
15116            1
15117        } else {
15118            0
15119        };
15120        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15121
15122        let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
15123            1
15124        } else {
15125            0
15126        };
15127        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15128
15129        let quant_table_in: i32 = jpegsave_options.quant_table;
15130        let quant_table_in_name = utils::new_c_string("quant-table")?;
15131
15132        let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
15133        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15134
15135        let restart_interval_in: i32 = jpegsave_options.restart_interval;
15136        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15137
15138        let keep_in: i32 = jpegsave_options.keep as i32;
15139        let keep_in_name = utils::new_c_string("keep")?;
15140
15141        let background_wrapper =
15142            utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
15143        let background_in = background_wrapper.ctx;
15144        let background_in_name = utils::new_c_string("background")?;
15145
15146        let page_height_in: i32 = jpegsave_options.page_height;
15147        let page_height_in_name = utils::new_c_string("page-height")?;
15148
15149        let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
15150        let profile_in_name = utils::new_c_string("profile")?;
15151
15152        let vips_op_response = bindings::vips_jpegsave(
15153            inp_in,
15154            filename_in.as_ptr(),
15155            q_in_name.as_ptr(),
15156            q_in,
15157            optimize_coding_in_name.as_ptr(),
15158            optimize_coding_in,
15159            interlace_in_name.as_ptr(),
15160            interlace_in,
15161            trellis_quant_in_name.as_ptr(),
15162            trellis_quant_in,
15163            overshoot_deringing_in_name.as_ptr(),
15164            overshoot_deringing_in,
15165            optimize_scans_in_name.as_ptr(),
15166            optimize_scans_in,
15167            quant_table_in_name.as_ptr(),
15168            quant_table_in,
15169            subsample_mode_in_name.as_ptr(),
15170            subsample_mode_in,
15171            restart_interval_in_name.as_ptr(),
15172            restart_interval_in,
15173            keep_in_name.as_ptr(),
15174            keep_in,
15175            background_in_name.as_ptr(),
15176            background_in,
15177            page_height_in_name.as_ptr(),
15178            page_height_in,
15179            profile_in_name.as_ptr(),
15180            profile_in.as_ptr(),
15181            NULL,
15182        );
15183        utils::result(vips_op_response, (), Error::JpegsaveError)
15184    }
15185}
15186
15187/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15188/// inp: `&VipsImage` -> Image to save
15189/// returns `Vec<u8>` - Buffer to save to
15190pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15191    unsafe {
15192        let inp_in: *mut bindings::VipsImage = inp.ctx;
15193        let mut buffer_buf_size: u64 = 0;
15194        let mut buffer_out: *mut c_void = null_mut();
15195
15196        let vips_op_response =
15197            bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15198        utils::result(
15199            vips_op_response,
15200            utils::new_byte_array(buffer_out, buffer_buf_size),
15201            Error::JpegsaveBufferError,
15202        )
15203    }
15204}
15205
15206/// Options for jpegsave_buffer operation
15207#[derive(Clone, Debug)]
15208pub struct JpegsaveBufferOptions {
15209    /// q: `i32` -> Q factor
15210    /// min: 1, max: 100, default: 75
15211    pub q: i32,
15212    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15213    /// default: false
15214    pub optimize_coding: bool,
15215    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15216    /// default: false
15217    pub interlace: bool,
15218    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15219    /// default: false
15220    pub trellis_quant: bool,
15221    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15222    /// default: false
15223    pub overshoot_deringing: bool,
15224    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15225    /// default: false
15226    pub optimize_scans: bool,
15227    /// quant_table: `i32` -> Use predefined quantization table with given index
15228    /// min: 0, max: 8, default: 0
15229    pub quant_table: i32,
15230    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15231    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15232    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15233    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15234    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15235    pub subsample_mode: ForeignSubsample,
15236    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15237    /// min: 0, max: 2147483647, default: 0
15238    pub restart_interval: i32,
15239    /// keep: `ForeignKeep` -> Which metadata to retain
15240    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15241    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15242    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15243    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15244    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15245    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15246    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15247    pub keep: ForeignKeep,
15248    /// background: `Vec<f64>` -> Background value
15249    pub background: Vec<f64>,
15250    /// page_height: `i32` -> Set page height for multipage save
15251    /// min: 0, max: 100000000, default: 0
15252    pub page_height: i32,
15253    /// profile: `String` -> Filename of ICC profile to embed
15254    pub profile: String,
15255}
15256
15257impl std::default::Default for JpegsaveBufferOptions {
15258    fn default() -> Self {
15259        JpegsaveBufferOptions {
15260            q: i32::from(75),
15261            optimize_coding: false,
15262            interlace: false,
15263            trellis_quant: false,
15264            overshoot_deringing: false,
15265            optimize_scans: false,
15266            quant_table: i32::from(0),
15267            subsample_mode: ForeignSubsample::Auto,
15268            restart_interval: i32::from(0),
15269            keep: ForeignKeep::All,
15270            background: Vec::new(),
15271            page_height: i32::from(0),
15272            profile: String::from("sRGB"),
15273        }
15274    }
15275}
15276
15277/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15278/// inp: `&VipsImage` -> Image to save
15279/// jpegsave_buffer_options: `&JpegsaveBufferOptions` -> optional arguments
15280/// returns `Vec<u8>` - Buffer to save to
15281pub fn jpegsave_buffer_with_opts(
15282    inp: &VipsImage,
15283    jpegsave_buffer_options: &JpegsaveBufferOptions,
15284) -> Result<Vec<u8>> {
15285    unsafe {
15286        let inp_in: *mut bindings::VipsImage = inp.ctx;
15287        let mut buffer_buf_size: u64 = 0;
15288        let mut buffer_out: *mut c_void = null_mut();
15289
15290        let q_in: i32 = jpegsave_buffer_options.q;
15291        let q_in_name = utils::new_c_string("Q")?;
15292
15293        let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15294            1
15295        } else {
15296            0
15297        };
15298        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15299
15300        let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15301            1
15302        } else {
15303            0
15304        };
15305        let interlace_in_name = utils::new_c_string("interlace")?;
15306
15307        let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15308            1
15309        } else {
15310            0
15311        };
15312        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15313
15314        let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15315            1
15316        } else {
15317            0
15318        };
15319        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15320
15321        let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15322            1
15323        } else {
15324            0
15325        };
15326        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15327
15328        let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15329        let quant_table_in_name = utils::new_c_string("quant-table")?;
15330
15331        let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15332        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15333
15334        let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15335        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15336
15337        let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15338        let keep_in_name = utils::new_c_string("keep")?;
15339
15340        let background_wrapper =
15341            utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15342        let background_in = background_wrapper.ctx;
15343        let background_in_name = utils::new_c_string("background")?;
15344
15345        let page_height_in: i32 = jpegsave_buffer_options.page_height;
15346        let page_height_in_name = utils::new_c_string("page-height")?;
15347
15348        let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15349        let profile_in_name = utils::new_c_string("profile")?;
15350
15351        let vips_op_response = bindings::vips_jpegsave_buffer(
15352            inp_in,
15353            &mut buffer_out,
15354            &mut buffer_buf_size,
15355            q_in_name.as_ptr(),
15356            q_in,
15357            optimize_coding_in_name.as_ptr(),
15358            optimize_coding_in,
15359            interlace_in_name.as_ptr(),
15360            interlace_in,
15361            trellis_quant_in_name.as_ptr(),
15362            trellis_quant_in,
15363            overshoot_deringing_in_name.as_ptr(),
15364            overshoot_deringing_in,
15365            optimize_scans_in_name.as_ptr(),
15366            optimize_scans_in,
15367            quant_table_in_name.as_ptr(),
15368            quant_table_in,
15369            subsample_mode_in_name.as_ptr(),
15370            subsample_mode_in,
15371            restart_interval_in_name.as_ptr(),
15372            restart_interval_in,
15373            keep_in_name.as_ptr(),
15374            keep_in,
15375            background_in_name.as_ptr(),
15376            background_in,
15377            page_height_in_name.as_ptr(),
15378            page_height_in,
15379            profile_in_name.as_ptr(),
15380            profile_in.as_ptr(),
15381            NULL,
15382        );
15383        utils::result(
15384            vips_op_response,
15385            utils::new_byte_array(buffer_out, buffer_buf_size),
15386            Error::JpegsaveBufferError,
15387        )
15388    }
15389}
15390
15391/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15392/// inp: `&VipsImage` -> Image to save
15393/// target: `&VipsTarget` -> Target to save to
15394
15395pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15396    unsafe {
15397        let inp_in: *mut bindings::VipsImage = inp.ctx;
15398        let target_in: *mut bindings::VipsTarget = target.ctx;
15399
15400        let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15401        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15402    }
15403}
15404
15405/// Options for jpegsave_target operation
15406#[derive(Clone, Debug)]
15407pub struct JpegsaveTargetOptions {
15408    /// q: `i32` -> Q factor
15409    /// min: 1, max: 100, default: 75
15410    pub q: i32,
15411    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15412    /// default: false
15413    pub optimize_coding: bool,
15414    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15415    /// default: false
15416    pub interlace: bool,
15417    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15418    /// default: false
15419    pub trellis_quant: bool,
15420    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15421    /// default: false
15422    pub overshoot_deringing: bool,
15423    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15424    /// default: false
15425    pub optimize_scans: bool,
15426    /// quant_table: `i32` -> Use predefined quantization table with given index
15427    /// min: 0, max: 8, default: 0
15428    pub quant_table: i32,
15429    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15430    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15431    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15432    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15433    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15434    pub subsample_mode: ForeignSubsample,
15435    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15436    /// min: 0, max: 2147483647, default: 0
15437    pub restart_interval: i32,
15438    /// keep: `ForeignKeep` -> Which metadata to retain
15439    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15440    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15441    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15442    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15443    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15444    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15445    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15446    pub keep: ForeignKeep,
15447    /// background: `Vec<f64>` -> Background value
15448    pub background: Vec<f64>,
15449    /// page_height: `i32` -> Set page height for multipage save
15450    /// min: 0, max: 100000000, default: 0
15451    pub page_height: i32,
15452    /// profile: `String` -> Filename of ICC profile to embed
15453    pub profile: String,
15454}
15455
15456impl std::default::Default for JpegsaveTargetOptions {
15457    fn default() -> Self {
15458        JpegsaveTargetOptions {
15459            q: i32::from(75),
15460            optimize_coding: false,
15461            interlace: false,
15462            trellis_quant: false,
15463            overshoot_deringing: false,
15464            optimize_scans: false,
15465            quant_table: i32::from(0),
15466            subsample_mode: ForeignSubsample::Auto,
15467            restart_interval: i32::from(0),
15468            keep: ForeignKeep::All,
15469            background: Vec::new(),
15470            page_height: i32::from(0),
15471            profile: String::from("sRGB"),
15472        }
15473    }
15474}
15475
15476/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15477/// inp: `&VipsImage` -> Image to save
15478/// target: `&VipsTarget` -> Target to save to
15479/// jpegsave_target_options: `&JpegsaveTargetOptions` -> optional arguments
15480
15481pub fn jpegsave_target_with_opts(
15482    inp: &VipsImage,
15483    target: &VipsTarget,
15484    jpegsave_target_options: &JpegsaveTargetOptions,
15485) -> Result<()> {
15486    unsafe {
15487        let inp_in: *mut bindings::VipsImage = inp.ctx;
15488        let target_in: *mut bindings::VipsTarget = target.ctx;
15489
15490        let q_in: i32 = jpegsave_target_options.q;
15491        let q_in_name = utils::new_c_string("Q")?;
15492
15493        let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15494            1
15495        } else {
15496            0
15497        };
15498        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15499
15500        let interlace_in: i32 = if jpegsave_target_options.interlace {
15501            1
15502        } else {
15503            0
15504        };
15505        let interlace_in_name = utils::new_c_string("interlace")?;
15506
15507        let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15508            1
15509        } else {
15510            0
15511        };
15512        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15513
15514        let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15515            1
15516        } else {
15517            0
15518        };
15519        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15520
15521        let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15522            1
15523        } else {
15524            0
15525        };
15526        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15527
15528        let quant_table_in: i32 = jpegsave_target_options.quant_table;
15529        let quant_table_in_name = utils::new_c_string("quant-table")?;
15530
15531        let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15532        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15533
15534        let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15535        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15536
15537        let keep_in: i32 = jpegsave_target_options.keep as i32;
15538        let keep_in_name = utils::new_c_string("keep")?;
15539
15540        let background_wrapper =
15541            utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15542        let background_in = background_wrapper.ctx;
15543        let background_in_name = utils::new_c_string("background")?;
15544
15545        let page_height_in: i32 = jpegsave_target_options.page_height;
15546        let page_height_in_name = utils::new_c_string("page-height")?;
15547
15548        let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15549        let profile_in_name = utils::new_c_string("profile")?;
15550
15551        let vips_op_response = bindings::vips_jpegsave_target(
15552            inp_in,
15553            target_in,
15554            q_in_name.as_ptr(),
15555            q_in,
15556            optimize_coding_in_name.as_ptr(),
15557            optimize_coding_in,
15558            interlace_in_name.as_ptr(),
15559            interlace_in,
15560            trellis_quant_in_name.as_ptr(),
15561            trellis_quant_in,
15562            overshoot_deringing_in_name.as_ptr(),
15563            overshoot_deringing_in,
15564            optimize_scans_in_name.as_ptr(),
15565            optimize_scans_in,
15566            quant_table_in_name.as_ptr(),
15567            quant_table_in,
15568            subsample_mode_in_name.as_ptr(),
15569            subsample_mode_in,
15570            restart_interval_in_name.as_ptr(),
15571            restart_interval_in,
15572            keep_in_name.as_ptr(),
15573            keep_in,
15574            background_in_name.as_ptr(),
15575            background_in,
15576            page_height_in_name.as_ptr(),
15577            page_height_in,
15578            profile_in_name.as_ptr(),
15579            profile_in.as_ptr(),
15580            NULL,
15581        );
15582        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15583    }
15584}
15585
15586/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15587/// inp: `&VipsImage` -> Image to save
15588
15589pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15590    unsafe {
15591        let inp_in: *mut bindings::VipsImage = inp.ctx;
15592
15593        let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15594        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15595    }
15596}
15597
15598/// Options for jpegsave_mime operation
15599#[derive(Clone, Debug)]
15600pub struct JpegsaveMimeOptions {
15601    /// q: `i32` -> Q factor
15602    /// min: 1, max: 100, default: 75
15603    pub q: i32,
15604    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15605    /// default: false
15606    pub optimize_coding: bool,
15607    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15608    /// default: false
15609    pub interlace: bool,
15610    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15611    /// default: false
15612    pub trellis_quant: bool,
15613    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15614    /// default: false
15615    pub overshoot_deringing: bool,
15616    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15617    /// default: false
15618    pub optimize_scans: bool,
15619    /// quant_table: `i32` -> Use predefined quantization table with given index
15620    /// min: 0, max: 8, default: 0
15621    pub quant_table: i32,
15622    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15623    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15624    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15625    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15626    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15627    pub subsample_mode: ForeignSubsample,
15628    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15629    /// min: 0, max: 2147483647, default: 0
15630    pub restart_interval: i32,
15631    /// keep: `ForeignKeep` -> Which metadata to retain
15632    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15633    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15634    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15635    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15636    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15637    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15638    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15639    pub keep: ForeignKeep,
15640    /// background: `Vec<f64>` -> Background value
15641    pub background: Vec<f64>,
15642    /// page_height: `i32` -> Set page height for multipage save
15643    /// min: 0, max: 100000000, default: 0
15644    pub page_height: i32,
15645    /// profile: `String` -> Filename of ICC profile to embed
15646    pub profile: String,
15647}
15648
15649impl std::default::Default for JpegsaveMimeOptions {
15650    fn default() -> Self {
15651        JpegsaveMimeOptions {
15652            q: i32::from(75),
15653            optimize_coding: false,
15654            interlace: false,
15655            trellis_quant: false,
15656            overshoot_deringing: false,
15657            optimize_scans: false,
15658            quant_table: i32::from(0),
15659            subsample_mode: ForeignSubsample::Auto,
15660            restart_interval: i32::from(0),
15661            keep: ForeignKeep::All,
15662            background: Vec::new(),
15663            page_height: i32::from(0),
15664            profile: String::from("sRGB"),
15665        }
15666    }
15667}
15668
15669/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
15670/// inp: `&VipsImage` -> Image to save
15671/// jpegsave_mime_options: `&JpegsaveMimeOptions` -> optional arguments
15672
15673pub fn jpegsave_mime_with_opts(
15674    inp: &VipsImage,
15675    jpegsave_mime_options: &JpegsaveMimeOptions,
15676) -> Result<()> {
15677    unsafe {
15678        let inp_in: *mut bindings::VipsImage = inp.ctx;
15679
15680        let q_in: i32 = jpegsave_mime_options.q;
15681        let q_in_name = utils::new_c_string("Q")?;
15682
15683        let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15684            1
15685        } else {
15686            0
15687        };
15688        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15689
15690        let interlace_in: i32 = if jpegsave_mime_options.interlace {
15691            1
15692        } else {
15693            0
15694        };
15695        let interlace_in_name = utils::new_c_string("interlace")?;
15696
15697        let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15698            1
15699        } else {
15700            0
15701        };
15702        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15703
15704        let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15705            1
15706        } else {
15707            0
15708        };
15709        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15710
15711        let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15712            1
15713        } else {
15714            0
15715        };
15716        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15717
15718        let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15719        let quant_table_in_name = utils::new_c_string("quant-table")?;
15720
15721        let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15722        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15723
15724        let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15725        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15726
15727        let keep_in: i32 = jpegsave_mime_options.keep as i32;
15728        let keep_in_name = utils::new_c_string("keep")?;
15729
15730        let background_wrapper =
15731            utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15732        let background_in = background_wrapper.ctx;
15733        let background_in_name = utils::new_c_string("background")?;
15734
15735        let page_height_in: i32 = jpegsave_mime_options.page_height;
15736        let page_height_in_name = utils::new_c_string("page-height")?;
15737
15738        let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15739        let profile_in_name = utils::new_c_string("profile")?;
15740
15741        let vips_op_response = bindings::vips_jpegsave_mime(
15742            inp_in,
15743            q_in_name.as_ptr(),
15744            q_in,
15745            optimize_coding_in_name.as_ptr(),
15746            optimize_coding_in,
15747            interlace_in_name.as_ptr(),
15748            interlace_in,
15749            trellis_quant_in_name.as_ptr(),
15750            trellis_quant_in,
15751            overshoot_deringing_in_name.as_ptr(),
15752            overshoot_deringing_in,
15753            optimize_scans_in_name.as_ptr(),
15754            optimize_scans_in,
15755            quant_table_in_name.as_ptr(),
15756            quant_table_in,
15757            subsample_mode_in_name.as_ptr(),
15758            subsample_mode_in,
15759            restart_interval_in_name.as_ptr(),
15760            restart_interval_in,
15761            keep_in_name.as_ptr(),
15762            keep_in,
15763            background_in_name.as_ptr(),
15764            background_in,
15765            page_height_in_name.as_ptr(),
15766            page_height_in,
15767            profile_in_name.as_ptr(),
15768            profile_in.as_ptr(),
15769            NULL,
15770        );
15771        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15772    }
15773}
15774
15775/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
15776/// inp: `&VipsImage` -> Image to save
15777/// filename: `&str` -> Filename to save to
15778
15779pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
15780    unsafe {
15781        let inp_in: *mut bindings::VipsImage = inp.ctx;
15782        let filename_in: CString = utils::new_c_string(filename)?;
15783
15784        let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
15785        utils::result(vips_op_response, (), Error::WebpsaveError)
15786    }
15787}
15788
15789/// Options for webpsave operation
15790#[derive(Clone, Debug)]
15791pub struct WebpsaveOptions {
15792    /// q: `i32` -> Q factor
15793    /// min: 0, max: 100, default: 75
15794    pub q: i32,
15795    /// lossless: `bool` -> Enable lossless compression
15796    /// default: false
15797    pub lossless: bool,
15798    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
15799    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
15800    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
15801    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
15802    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
15803    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
15804    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
15805    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
15806    pub preset: ForeignWebpPreset,
15807    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
15808    /// default: false
15809    pub smart_subsample: bool,
15810    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
15811    /// default: false
15812    pub near_lossless: bool,
15813    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
15814    /// min: 0, max: 100, default: 100
15815    pub alpha_q: i32,
15816    /// min_size: `bool` -> Optimise for minimum size
15817    /// default: false
15818    pub min_size: bool,
15819    /// kmin: `i32` -> Minimum number of frames between key frames
15820    /// min: 0, max: 2147483647, default: 2147483646
15821    pub kmin: i32,
15822    /// kmax: `i32` -> Maximum number of frames between key frames
15823    /// min: 0, max: 2147483647, default: 2147483647
15824    pub kmax: i32,
15825    /// effort: `i32` -> Level of CPU effort to reduce file size
15826    /// min: 0, max: 6, default: 4
15827    pub effort: i32,
15828    /// target_size: `i32` -> Desired target size in bytes
15829    /// min: 0, max: 2147483647, default: 0
15830    pub target_size: i32,
15831    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
15832    /// default: false
15833    pub mixed: bool,
15834    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
15835    /// default: false
15836    pub smart_deblock: bool,
15837    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
15838    /// min: 1, max: 10, default: 1
15839    pub passes: i32,
15840    /// keep: `ForeignKeep` -> Which metadata to retain
15841    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15842    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15843    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15844    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15845    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15846    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15847    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15848    pub keep: ForeignKeep,
15849    /// background: `Vec<f64>` -> Background value
15850    pub background: Vec<f64>,
15851    /// page_height: `i32` -> Set page height for multipage save
15852    /// min: 0, max: 100000000, default: 0
15853    pub page_height: i32,
15854    /// profile: `String` -> Filename of ICC profile to embed
15855    pub profile: String,
15856}
15857
15858impl std::default::Default for WebpsaveOptions {
15859    fn default() -> Self {
15860        WebpsaveOptions {
15861            q: i32::from(75),
15862            lossless: false,
15863            preset: ForeignWebpPreset::Default,
15864            smart_subsample: false,
15865            near_lossless: false,
15866            alpha_q: i32::from(100),
15867            min_size: false,
15868            kmin: i32::from(2147483646),
15869            kmax: i32::from(2147483647),
15870            effort: i32::from(4),
15871            target_size: i32::from(0),
15872            mixed: false,
15873            smart_deblock: false,
15874            passes: i32::from(1),
15875            keep: ForeignKeep::All,
15876            background: Vec::new(),
15877            page_height: i32::from(0),
15878            profile: String::from("sRGB"),
15879        }
15880    }
15881}
15882
15883/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
15884/// inp: `&VipsImage` -> Image to save
15885/// filename: `&str` -> Filename to save to
15886/// webpsave_options: `&WebpsaveOptions` -> optional arguments
15887
15888pub fn webpsave_with_opts(
15889    inp: &VipsImage,
15890    filename: &str,
15891    webpsave_options: &WebpsaveOptions,
15892) -> Result<()> {
15893    unsafe {
15894        let inp_in: *mut bindings::VipsImage = inp.ctx;
15895        let filename_in: CString = utils::new_c_string(filename)?;
15896
15897        let q_in: i32 = webpsave_options.q;
15898        let q_in_name = utils::new_c_string("Q")?;
15899
15900        let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
15901        let lossless_in_name = utils::new_c_string("lossless")?;
15902
15903        let preset_in: i32 = webpsave_options.preset as i32;
15904        let preset_in_name = utils::new_c_string("preset")?;
15905
15906        let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
15907            1
15908        } else {
15909            0
15910        };
15911        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
15912
15913        let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
15914        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
15915
15916        let alpha_q_in: i32 = webpsave_options.alpha_q;
15917        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
15918
15919        let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
15920        let min_size_in_name = utils::new_c_string("min-size")?;
15921
15922        let kmin_in: i32 = webpsave_options.kmin;
15923        let kmin_in_name = utils::new_c_string("kmin")?;
15924
15925        let kmax_in: i32 = webpsave_options.kmax;
15926        let kmax_in_name = utils::new_c_string("kmax")?;
15927
15928        let effort_in: i32 = webpsave_options.effort;
15929        let effort_in_name = utils::new_c_string("effort")?;
15930
15931        let target_size_in: i32 = webpsave_options.target_size;
15932        let target_size_in_name = utils::new_c_string("target-size")?;
15933
15934        let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
15935        let mixed_in_name = utils::new_c_string("mixed")?;
15936
15937        let smart_deblock_in: i32 = if webpsave_options.smart_deblock { 1 } else { 0 };
15938        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
15939
15940        let passes_in: i32 = webpsave_options.passes;
15941        let passes_in_name = utils::new_c_string("passes")?;
15942
15943        let keep_in: i32 = webpsave_options.keep as i32;
15944        let keep_in_name = utils::new_c_string("keep")?;
15945
15946        let background_wrapper =
15947            utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
15948        let background_in = background_wrapper.ctx;
15949        let background_in_name = utils::new_c_string("background")?;
15950
15951        let page_height_in: i32 = webpsave_options.page_height;
15952        let page_height_in_name = utils::new_c_string("page-height")?;
15953
15954        let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
15955        let profile_in_name = utils::new_c_string("profile")?;
15956
15957        let vips_op_response = bindings::vips_webpsave(
15958            inp_in,
15959            filename_in.as_ptr(),
15960            q_in_name.as_ptr(),
15961            q_in,
15962            lossless_in_name.as_ptr(),
15963            lossless_in,
15964            preset_in_name.as_ptr(),
15965            preset_in,
15966            smart_subsample_in_name.as_ptr(),
15967            smart_subsample_in,
15968            near_lossless_in_name.as_ptr(),
15969            near_lossless_in,
15970            alpha_q_in_name.as_ptr(),
15971            alpha_q_in,
15972            min_size_in_name.as_ptr(),
15973            min_size_in,
15974            kmin_in_name.as_ptr(),
15975            kmin_in,
15976            kmax_in_name.as_ptr(),
15977            kmax_in,
15978            effort_in_name.as_ptr(),
15979            effort_in,
15980            target_size_in_name.as_ptr(),
15981            target_size_in,
15982            mixed_in_name.as_ptr(),
15983            mixed_in,
15984            smart_deblock_in_name.as_ptr(),
15985            smart_deblock_in,
15986            passes_in_name.as_ptr(),
15987            passes_in,
15988            keep_in_name.as_ptr(),
15989            keep_in,
15990            background_in_name.as_ptr(),
15991            background_in,
15992            page_height_in_name.as_ptr(),
15993            page_height_in,
15994            profile_in_name.as_ptr(),
15995            profile_in.as_ptr(),
15996            NULL,
15997        );
15998        utils::result(vips_op_response, (), Error::WebpsaveError)
15999    }
16000}
16001
16002/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
16003/// inp: `&VipsImage` -> Image to save
16004/// returns `Vec<u8>` - Buffer to save to
16005pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16006    unsafe {
16007        let inp_in: *mut bindings::VipsImage = inp.ctx;
16008        let mut buffer_buf_size: u64 = 0;
16009        let mut buffer_out: *mut c_void = null_mut();
16010
16011        let vips_op_response =
16012            bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16013        utils::result(
16014            vips_op_response,
16015            utils::new_byte_array(buffer_out, buffer_buf_size),
16016            Error::WebpsaveBufferError,
16017        )
16018    }
16019}
16020
16021/// Options for webpsave_buffer operation
16022#[derive(Clone, Debug)]
16023pub struct WebpsaveBufferOptions {
16024    /// q: `i32` -> Q factor
16025    /// min: 0, max: 100, default: 75
16026    pub q: i32,
16027    /// lossless: `bool` -> Enable lossless compression
16028    /// default: false
16029    pub lossless: bool,
16030    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16031    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16032    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16033    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16034    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16035    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16036    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16037    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16038    pub preset: ForeignWebpPreset,
16039    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16040    /// default: false
16041    pub smart_subsample: bool,
16042    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16043    /// default: false
16044    pub near_lossless: bool,
16045    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16046    /// min: 0, max: 100, default: 100
16047    pub alpha_q: i32,
16048    /// min_size: `bool` -> Optimise for minimum size
16049    /// default: false
16050    pub min_size: bool,
16051    /// kmin: `i32` -> Minimum number of frames between key frames
16052    /// min: 0, max: 2147483647, default: 2147483646
16053    pub kmin: i32,
16054    /// kmax: `i32` -> Maximum number of frames between key frames
16055    /// min: 0, max: 2147483647, default: 2147483647
16056    pub kmax: i32,
16057    /// effort: `i32` -> Level of CPU effort to reduce file size
16058    /// min: 0, max: 6, default: 4
16059    pub effort: i32,
16060    /// target_size: `i32` -> Desired target size in bytes
16061    /// min: 0, max: 2147483647, default: 0
16062    pub target_size: i32,
16063    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16064    /// default: false
16065    pub mixed: bool,
16066    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16067    /// default: false
16068    pub smart_deblock: bool,
16069    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16070    /// min: 1, max: 10, default: 1
16071    pub passes: i32,
16072    /// keep: `ForeignKeep` -> Which metadata to retain
16073    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16074    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16075    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16076    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16077    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16078    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16079    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16080    pub keep: ForeignKeep,
16081    /// background: `Vec<f64>` -> Background value
16082    pub background: Vec<f64>,
16083    /// page_height: `i32` -> Set page height for multipage save
16084    /// min: 0, max: 100000000, default: 0
16085    pub page_height: i32,
16086    /// profile: `String` -> Filename of ICC profile to embed
16087    pub profile: String,
16088}
16089
16090impl std::default::Default for WebpsaveBufferOptions {
16091    fn default() -> Self {
16092        WebpsaveBufferOptions {
16093            q: i32::from(75),
16094            lossless: false,
16095            preset: ForeignWebpPreset::Default,
16096            smart_subsample: false,
16097            near_lossless: false,
16098            alpha_q: i32::from(100),
16099            min_size: false,
16100            kmin: i32::from(2147483646),
16101            kmax: i32::from(2147483647),
16102            effort: i32::from(4),
16103            target_size: i32::from(0),
16104            mixed: false,
16105            smart_deblock: false,
16106            passes: i32::from(1),
16107            keep: ForeignKeep::All,
16108            background: Vec::new(),
16109            page_height: i32::from(0),
16110            profile: String::from("sRGB"),
16111        }
16112    }
16113}
16114
16115/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
16116/// inp: `&VipsImage` -> Image to save
16117/// webpsave_buffer_options: `&WebpsaveBufferOptions` -> optional arguments
16118/// returns `Vec<u8>` - Buffer to save to
16119pub fn webpsave_buffer_with_opts(
16120    inp: &VipsImage,
16121    webpsave_buffer_options: &WebpsaveBufferOptions,
16122) -> Result<Vec<u8>> {
16123    unsafe {
16124        let inp_in: *mut bindings::VipsImage = inp.ctx;
16125        let mut buffer_buf_size: u64 = 0;
16126        let mut buffer_out: *mut c_void = null_mut();
16127
16128        let q_in: i32 = webpsave_buffer_options.q;
16129        let q_in_name = utils::new_c_string("Q")?;
16130
16131        let lossless_in: i32 = if webpsave_buffer_options.lossless {
16132            1
16133        } else {
16134            0
16135        };
16136        let lossless_in_name = utils::new_c_string("lossless")?;
16137
16138        let preset_in: i32 = webpsave_buffer_options.preset as i32;
16139        let preset_in_name = utils::new_c_string("preset")?;
16140
16141        let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
16142            1
16143        } else {
16144            0
16145        };
16146        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16147
16148        let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
16149            1
16150        } else {
16151            0
16152        };
16153        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16154
16155        let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
16156        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16157
16158        let min_size_in: i32 = if webpsave_buffer_options.min_size {
16159            1
16160        } else {
16161            0
16162        };
16163        let min_size_in_name = utils::new_c_string("min-size")?;
16164
16165        let kmin_in: i32 = webpsave_buffer_options.kmin;
16166        let kmin_in_name = utils::new_c_string("kmin")?;
16167
16168        let kmax_in: i32 = webpsave_buffer_options.kmax;
16169        let kmax_in_name = utils::new_c_string("kmax")?;
16170
16171        let effort_in: i32 = webpsave_buffer_options.effort;
16172        let effort_in_name = utils::new_c_string("effort")?;
16173
16174        let target_size_in: i32 = webpsave_buffer_options.target_size;
16175        let target_size_in_name = utils::new_c_string("target-size")?;
16176
16177        let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
16178        let mixed_in_name = utils::new_c_string("mixed")?;
16179
16180        let smart_deblock_in: i32 = if webpsave_buffer_options.smart_deblock {
16181            1
16182        } else {
16183            0
16184        };
16185        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16186
16187        let passes_in: i32 = webpsave_buffer_options.passes;
16188        let passes_in_name = utils::new_c_string("passes")?;
16189
16190        let keep_in: i32 = webpsave_buffer_options.keep as i32;
16191        let keep_in_name = utils::new_c_string("keep")?;
16192
16193        let background_wrapper =
16194            utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
16195        let background_in = background_wrapper.ctx;
16196        let background_in_name = utils::new_c_string("background")?;
16197
16198        let page_height_in: i32 = webpsave_buffer_options.page_height;
16199        let page_height_in_name = utils::new_c_string("page-height")?;
16200
16201        let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
16202        let profile_in_name = utils::new_c_string("profile")?;
16203
16204        let vips_op_response = bindings::vips_webpsave_buffer(
16205            inp_in,
16206            &mut buffer_out,
16207            &mut buffer_buf_size,
16208            q_in_name.as_ptr(),
16209            q_in,
16210            lossless_in_name.as_ptr(),
16211            lossless_in,
16212            preset_in_name.as_ptr(),
16213            preset_in,
16214            smart_subsample_in_name.as_ptr(),
16215            smart_subsample_in,
16216            near_lossless_in_name.as_ptr(),
16217            near_lossless_in,
16218            alpha_q_in_name.as_ptr(),
16219            alpha_q_in,
16220            min_size_in_name.as_ptr(),
16221            min_size_in,
16222            kmin_in_name.as_ptr(),
16223            kmin_in,
16224            kmax_in_name.as_ptr(),
16225            kmax_in,
16226            effort_in_name.as_ptr(),
16227            effort_in,
16228            target_size_in_name.as_ptr(),
16229            target_size_in,
16230            mixed_in_name.as_ptr(),
16231            mixed_in,
16232            smart_deblock_in_name.as_ptr(),
16233            smart_deblock_in,
16234            passes_in_name.as_ptr(),
16235            passes_in,
16236            keep_in_name.as_ptr(),
16237            keep_in,
16238            background_in_name.as_ptr(),
16239            background_in,
16240            page_height_in_name.as_ptr(),
16241            page_height_in,
16242            profile_in_name.as_ptr(),
16243            profile_in.as_ptr(),
16244            NULL,
16245        );
16246        utils::result(
16247            vips_op_response,
16248            utils::new_byte_array(buffer_out, buffer_buf_size),
16249            Error::WebpsaveBufferError,
16250        )
16251    }
16252}
16253
16254/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
16255/// inp: `&VipsImage` -> Image to save
16256/// target: `&VipsTarget` -> Target to save to
16257
16258pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16259    unsafe {
16260        let inp_in: *mut bindings::VipsImage = inp.ctx;
16261        let target_in: *mut bindings::VipsTarget = target.ctx;
16262
16263        let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
16264        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16265    }
16266}
16267
16268/// Options for webpsave_target operation
16269#[derive(Clone, Debug)]
16270pub struct WebpsaveTargetOptions {
16271    /// q: `i32` -> Q factor
16272    /// min: 0, max: 100, default: 75
16273    pub q: i32,
16274    /// lossless: `bool` -> Enable lossless compression
16275    /// default: false
16276    pub lossless: bool,
16277    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16278    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16279    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16280    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16281    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16282    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16283    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16284    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16285    pub preset: ForeignWebpPreset,
16286    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16287    /// default: false
16288    pub smart_subsample: bool,
16289    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16290    /// default: false
16291    pub near_lossless: bool,
16292    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16293    /// min: 0, max: 100, default: 100
16294    pub alpha_q: i32,
16295    /// min_size: `bool` -> Optimise for minimum size
16296    /// default: false
16297    pub min_size: bool,
16298    /// kmin: `i32` -> Minimum number of frames between key frames
16299    /// min: 0, max: 2147483647, default: 2147483646
16300    pub kmin: i32,
16301    /// kmax: `i32` -> Maximum number of frames between key frames
16302    /// min: 0, max: 2147483647, default: 2147483647
16303    pub kmax: i32,
16304    /// effort: `i32` -> Level of CPU effort to reduce file size
16305    /// min: 0, max: 6, default: 4
16306    pub effort: i32,
16307    /// target_size: `i32` -> Desired target size in bytes
16308    /// min: 0, max: 2147483647, default: 0
16309    pub target_size: i32,
16310    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16311    /// default: false
16312    pub mixed: bool,
16313    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16314    /// default: false
16315    pub smart_deblock: bool,
16316    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16317    /// min: 1, max: 10, default: 1
16318    pub passes: i32,
16319    /// keep: `ForeignKeep` -> Which metadata to retain
16320    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16321    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16322    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16323    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16324    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16325    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16326    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16327    pub keep: ForeignKeep,
16328    /// background: `Vec<f64>` -> Background value
16329    pub background: Vec<f64>,
16330    /// page_height: `i32` -> Set page height for multipage save
16331    /// min: 0, max: 100000000, default: 0
16332    pub page_height: i32,
16333    /// profile: `String` -> Filename of ICC profile to embed
16334    pub profile: String,
16335}
16336
16337impl std::default::Default for WebpsaveTargetOptions {
16338    fn default() -> Self {
16339        WebpsaveTargetOptions {
16340            q: i32::from(75),
16341            lossless: false,
16342            preset: ForeignWebpPreset::Default,
16343            smart_subsample: false,
16344            near_lossless: false,
16345            alpha_q: i32::from(100),
16346            min_size: false,
16347            kmin: i32::from(2147483646),
16348            kmax: i32::from(2147483647),
16349            effort: i32::from(4),
16350            target_size: i32::from(0),
16351            mixed: false,
16352            smart_deblock: false,
16353            passes: i32::from(1),
16354            keep: ForeignKeep::All,
16355            background: Vec::new(),
16356            page_height: i32::from(0),
16357            profile: String::from("sRGB"),
16358        }
16359    }
16360}
16361
16362/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
16363/// inp: `&VipsImage` -> Image to save
16364/// target: `&VipsTarget` -> Target to save to
16365/// webpsave_target_options: `&WebpsaveTargetOptions` -> optional arguments
16366
16367pub fn webpsave_target_with_opts(
16368    inp: &VipsImage,
16369    target: &VipsTarget,
16370    webpsave_target_options: &WebpsaveTargetOptions,
16371) -> Result<()> {
16372    unsafe {
16373        let inp_in: *mut bindings::VipsImage = inp.ctx;
16374        let target_in: *mut bindings::VipsTarget = target.ctx;
16375
16376        let q_in: i32 = webpsave_target_options.q;
16377        let q_in_name = utils::new_c_string("Q")?;
16378
16379        let lossless_in: i32 = if webpsave_target_options.lossless {
16380            1
16381        } else {
16382            0
16383        };
16384        let lossless_in_name = utils::new_c_string("lossless")?;
16385
16386        let preset_in: i32 = webpsave_target_options.preset as i32;
16387        let preset_in_name = utils::new_c_string("preset")?;
16388
16389        let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16390            1
16391        } else {
16392            0
16393        };
16394        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16395
16396        let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16397            1
16398        } else {
16399            0
16400        };
16401        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16402
16403        let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16404        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16405
16406        let min_size_in: i32 = if webpsave_target_options.min_size {
16407            1
16408        } else {
16409            0
16410        };
16411        let min_size_in_name = utils::new_c_string("min-size")?;
16412
16413        let kmin_in: i32 = webpsave_target_options.kmin;
16414        let kmin_in_name = utils::new_c_string("kmin")?;
16415
16416        let kmax_in: i32 = webpsave_target_options.kmax;
16417        let kmax_in_name = utils::new_c_string("kmax")?;
16418
16419        let effort_in: i32 = webpsave_target_options.effort;
16420        let effort_in_name = utils::new_c_string("effort")?;
16421
16422        let target_size_in: i32 = webpsave_target_options.target_size;
16423        let target_size_in_name = utils::new_c_string("target-size")?;
16424
16425        let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16426        let mixed_in_name = utils::new_c_string("mixed")?;
16427
16428        let smart_deblock_in: i32 = if webpsave_target_options.smart_deblock {
16429            1
16430        } else {
16431            0
16432        };
16433        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16434
16435        let passes_in: i32 = webpsave_target_options.passes;
16436        let passes_in_name = utils::new_c_string("passes")?;
16437
16438        let keep_in: i32 = webpsave_target_options.keep as i32;
16439        let keep_in_name = utils::new_c_string("keep")?;
16440
16441        let background_wrapper =
16442            utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16443        let background_in = background_wrapper.ctx;
16444        let background_in_name = utils::new_c_string("background")?;
16445
16446        let page_height_in: i32 = webpsave_target_options.page_height;
16447        let page_height_in_name = utils::new_c_string("page-height")?;
16448
16449        let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16450        let profile_in_name = utils::new_c_string("profile")?;
16451
16452        let vips_op_response = bindings::vips_webpsave_target(
16453            inp_in,
16454            target_in,
16455            q_in_name.as_ptr(),
16456            q_in,
16457            lossless_in_name.as_ptr(),
16458            lossless_in,
16459            preset_in_name.as_ptr(),
16460            preset_in,
16461            smart_subsample_in_name.as_ptr(),
16462            smart_subsample_in,
16463            near_lossless_in_name.as_ptr(),
16464            near_lossless_in,
16465            alpha_q_in_name.as_ptr(),
16466            alpha_q_in,
16467            min_size_in_name.as_ptr(),
16468            min_size_in,
16469            kmin_in_name.as_ptr(),
16470            kmin_in,
16471            kmax_in_name.as_ptr(),
16472            kmax_in,
16473            effort_in_name.as_ptr(),
16474            effort_in,
16475            target_size_in_name.as_ptr(),
16476            target_size_in,
16477            mixed_in_name.as_ptr(),
16478            mixed_in,
16479            smart_deblock_in_name.as_ptr(),
16480            smart_deblock_in,
16481            passes_in_name.as_ptr(),
16482            passes_in,
16483            keep_in_name.as_ptr(),
16484            keep_in,
16485            background_in_name.as_ptr(),
16486            background_in,
16487            page_height_in_name.as_ptr(),
16488            page_height_in,
16489            profile_in_name.as_ptr(),
16490            profile_in.as_ptr(),
16491            NULL,
16492        );
16493        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16494    }
16495}
16496
16497/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
16498/// inp: `&VipsImage` -> Image to save
16499
16500pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16501    unsafe {
16502        let inp_in: *mut bindings::VipsImage = inp.ctx;
16503
16504        let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16505        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16506    }
16507}
16508
16509/// Options for webpsave_mime operation
16510#[derive(Clone, Debug)]
16511pub struct WebpsaveMimeOptions {
16512    /// q: `i32` -> Q factor
16513    /// min: 0, max: 100, default: 75
16514    pub q: i32,
16515    /// lossless: `bool` -> Enable lossless compression
16516    /// default: false
16517    pub lossless: bool,
16518    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16519    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16520    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16521    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16522    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16523    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16524    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16525    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16526    pub preset: ForeignWebpPreset,
16527    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16528    /// default: false
16529    pub smart_subsample: bool,
16530    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16531    /// default: false
16532    pub near_lossless: bool,
16533    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16534    /// min: 0, max: 100, default: 100
16535    pub alpha_q: i32,
16536    /// min_size: `bool` -> Optimise for minimum size
16537    /// default: false
16538    pub min_size: bool,
16539    /// kmin: `i32` -> Minimum number of frames between key frames
16540    /// min: 0, max: 2147483647, default: 2147483646
16541    pub kmin: i32,
16542    /// kmax: `i32` -> Maximum number of frames between key frames
16543    /// min: 0, max: 2147483647, default: 2147483647
16544    pub kmax: i32,
16545    /// effort: `i32` -> Level of CPU effort to reduce file size
16546    /// min: 0, max: 6, default: 4
16547    pub effort: i32,
16548    /// target_size: `i32` -> Desired target size in bytes
16549    /// min: 0, max: 2147483647, default: 0
16550    pub target_size: i32,
16551    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16552    /// default: false
16553    pub mixed: bool,
16554    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16555    /// default: false
16556    pub smart_deblock: bool,
16557    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16558    /// min: 1, max: 10, default: 1
16559    pub passes: i32,
16560    /// keep: `ForeignKeep` -> Which metadata to retain
16561    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16562    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16563    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16564    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16565    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16566    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16567    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16568    pub keep: ForeignKeep,
16569    /// background: `Vec<f64>` -> Background value
16570    pub background: Vec<f64>,
16571    /// page_height: `i32` -> Set page height for multipage save
16572    /// min: 0, max: 100000000, default: 0
16573    pub page_height: i32,
16574    /// profile: `String` -> Filename of ICC profile to embed
16575    pub profile: String,
16576}
16577
16578impl std::default::Default for WebpsaveMimeOptions {
16579    fn default() -> Self {
16580        WebpsaveMimeOptions {
16581            q: i32::from(75),
16582            lossless: false,
16583            preset: ForeignWebpPreset::Default,
16584            smart_subsample: false,
16585            near_lossless: false,
16586            alpha_q: i32::from(100),
16587            min_size: false,
16588            kmin: i32::from(2147483646),
16589            kmax: i32::from(2147483647),
16590            effort: i32::from(4),
16591            target_size: i32::from(0),
16592            mixed: false,
16593            smart_deblock: false,
16594            passes: i32::from(1),
16595            keep: ForeignKeep::All,
16596            background: Vec::new(),
16597            page_height: i32::from(0),
16598            profile: String::from("sRGB"),
16599        }
16600    }
16601}
16602
16603/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
16604/// inp: `&VipsImage` -> Image to save
16605/// webpsave_mime_options: `&WebpsaveMimeOptions` -> optional arguments
16606
16607pub fn webpsave_mime_with_opts(
16608    inp: &VipsImage,
16609    webpsave_mime_options: &WebpsaveMimeOptions,
16610) -> Result<()> {
16611    unsafe {
16612        let inp_in: *mut bindings::VipsImage = inp.ctx;
16613
16614        let q_in: i32 = webpsave_mime_options.q;
16615        let q_in_name = utils::new_c_string("Q")?;
16616
16617        let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16618        let lossless_in_name = utils::new_c_string("lossless")?;
16619
16620        let preset_in: i32 = webpsave_mime_options.preset as i32;
16621        let preset_in_name = utils::new_c_string("preset")?;
16622
16623        let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16624            1
16625        } else {
16626            0
16627        };
16628        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16629
16630        let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16631            1
16632        } else {
16633            0
16634        };
16635        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16636
16637        let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16638        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16639
16640        let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16641        let min_size_in_name = utils::new_c_string("min-size")?;
16642
16643        let kmin_in: i32 = webpsave_mime_options.kmin;
16644        let kmin_in_name = utils::new_c_string("kmin")?;
16645
16646        let kmax_in: i32 = webpsave_mime_options.kmax;
16647        let kmax_in_name = utils::new_c_string("kmax")?;
16648
16649        let effort_in: i32 = webpsave_mime_options.effort;
16650        let effort_in_name = utils::new_c_string("effort")?;
16651
16652        let target_size_in: i32 = webpsave_mime_options.target_size;
16653        let target_size_in_name = utils::new_c_string("target-size")?;
16654
16655        let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16656        let mixed_in_name = utils::new_c_string("mixed")?;
16657
16658        let smart_deblock_in: i32 = if webpsave_mime_options.smart_deblock {
16659            1
16660        } else {
16661            0
16662        };
16663        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16664
16665        let passes_in: i32 = webpsave_mime_options.passes;
16666        let passes_in_name = utils::new_c_string("passes")?;
16667
16668        let keep_in: i32 = webpsave_mime_options.keep as i32;
16669        let keep_in_name = utils::new_c_string("keep")?;
16670
16671        let background_wrapper =
16672            utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16673        let background_in = background_wrapper.ctx;
16674        let background_in_name = utils::new_c_string("background")?;
16675
16676        let page_height_in: i32 = webpsave_mime_options.page_height;
16677        let page_height_in_name = utils::new_c_string("page-height")?;
16678
16679        let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16680        let profile_in_name = utils::new_c_string("profile")?;
16681
16682        let vips_op_response = bindings::vips_webpsave_mime(
16683            inp_in,
16684            q_in_name.as_ptr(),
16685            q_in,
16686            lossless_in_name.as_ptr(),
16687            lossless_in,
16688            preset_in_name.as_ptr(),
16689            preset_in,
16690            smart_subsample_in_name.as_ptr(),
16691            smart_subsample_in,
16692            near_lossless_in_name.as_ptr(),
16693            near_lossless_in,
16694            alpha_q_in_name.as_ptr(),
16695            alpha_q_in,
16696            min_size_in_name.as_ptr(),
16697            min_size_in,
16698            kmin_in_name.as_ptr(),
16699            kmin_in,
16700            kmax_in_name.as_ptr(),
16701            kmax_in,
16702            effort_in_name.as_ptr(),
16703            effort_in,
16704            target_size_in_name.as_ptr(),
16705            target_size_in,
16706            mixed_in_name.as_ptr(),
16707            mixed_in,
16708            smart_deblock_in_name.as_ptr(),
16709            smart_deblock_in,
16710            passes_in_name.as_ptr(),
16711            passes_in,
16712            keep_in_name.as_ptr(),
16713            keep_in,
16714            background_in_name.as_ptr(),
16715            background_in,
16716            page_height_in_name.as_ptr(),
16717            page_height_in,
16718            profile_in_name.as_ptr(),
16719            profile_in.as_ptr(),
16720            NULL,
16721        );
16722        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16723    }
16724}
16725
16726/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
16727/// inp: `&VipsImage` -> Image to save
16728/// filename: `&str` -> Filename to save to
16729
16730pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16731    unsafe {
16732        let inp_in: *mut bindings::VipsImage = inp.ctx;
16733        let filename_in: CString = utils::new_c_string(filename)?;
16734
16735        let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16736        utils::result(vips_op_response, (), Error::TiffsaveError)
16737    }
16738}
16739
16740/// Options for tiffsave operation
16741#[derive(Clone, Debug)]
16742pub struct TiffsaveOptions {
16743    /// compression: `ForeignTiffCompression` -> Compression for this file
16744    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16745    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16746    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16747    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16748    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16749    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16750    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16751    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16752    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16753    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
16754    pub compression: ForeignTiffCompression,
16755    /// q: `i32` -> Q factor
16756    /// min: 1, max: 100, default: 75
16757    pub q: i32,
16758    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16759    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16760    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16761    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16762    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
16763    pub predictor: ForeignTiffPredictor,
16764    /// tile: `bool` -> Write a tiled tiff
16765    /// default: false
16766    pub tile: bool,
16767    /// tile_width: `i32` -> Tile width in pixels
16768    /// min: 1, max: 32768, default: 128
16769    pub tile_width: i32,
16770    /// tile_height: `i32` -> Tile height in pixels
16771    /// min: 1, max: 32768, default: 128
16772    pub tile_height: i32,
16773    /// pyramid: `bool` -> Write a pyramidal tiff
16774    /// default: false
16775    pub pyramid: bool,
16776    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
16777    /// default: false
16778    pub miniswhite: bool,
16779    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
16780    /// min: 0, max: 8, default: 0
16781    pub bitdepth: i32,
16782    /// resunit: `ForeignTiffResunit` -> Resolution unit
16783    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
16784    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
16785    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
16786    pub resunit: ForeignTiffResunit,
16787    /// xres: `f64` -> Horizontal resolution in pixels/mm
16788    /// min: 0.001, max: 1000000, default: 1
16789    pub xres: f64,
16790    /// yres: `f64` -> Vertical resolution in pixels/mm
16791    /// min: 0.001, max: 1000000, default: 1
16792    pub yres: f64,
16793    /// bigtiff: `bool` -> Write a bigtiff image
16794    /// default: false
16795    pub bigtiff: bool,
16796    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
16797    /// default: false
16798    pub properties: bool,
16799    /// region_shrink: `RegionShrink` -> Method to shrink regions
16800    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
16801    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
16802    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
16803    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
16804    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
16805    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
16806    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
16807    pub region_shrink: RegionShrink,
16808    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
16809    /// min: 1, max: 22, default: 6
16810    pub level: i32,
16811    /// lossless: `bool` -> Enable WEBP lossless mode
16812    /// default: false
16813    pub lossless: bool,
16814    /// depth: `ForeignDzDepth` -> Pyramid depth
16815    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
16816    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
16817    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
16818    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
16819    pub depth: ForeignDzDepth,
16820    /// subifd: `bool` -> Save pyr layers as sub-IFDs
16821    /// default: false
16822    pub subifd: bool,
16823    /// premultiply: `bool` -> Save with premultiplied alpha
16824    /// default: false
16825    pub premultiply: bool,
16826    /// keep: `ForeignKeep` -> Which metadata to retain
16827    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16828    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16829    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16830    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16831    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16832    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16833    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16834    pub keep: ForeignKeep,
16835    /// background: `Vec<f64>` -> Background value
16836    pub background: Vec<f64>,
16837    /// page_height: `i32` -> Set page height for multipage save
16838    /// min: 0, max: 100000000, default: 0
16839    pub page_height: i32,
16840    /// profile: `String` -> Filename of ICC profile to embed
16841    pub profile: String,
16842}
16843
16844impl std::default::Default for TiffsaveOptions {
16845    fn default() -> Self {
16846        TiffsaveOptions {
16847            compression: ForeignTiffCompression::None,
16848            q: i32::from(75),
16849            predictor: ForeignTiffPredictor::Horizontal,
16850            tile: false,
16851            tile_width: i32::from(128),
16852            tile_height: i32::from(128),
16853            pyramid: false,
16854            miniswhite: false,
16855            bitdepth: i32::from(0),
16856            resunit: ForeignTiffResunit::Cm,
16857            xres: f64::from(1),
16858            yres: f64::from(1),
16859            bigtiff: false,
16860            properties: false,
16861            region_shrink: RegionShrink::Mean,
16862            level: i32::from(6),
16863            lossless: false,
16864            depth: ForeignDzDepth::Onetile,
16865            subifd: false,
16866            premultiply: false,
16867            keep: ForeignKeep::All,
16868            background: Vec::new(),
16869            page_height: i32::from(0),
16870            profile: String::from("sRGB"),
16871        }
16872    }
16873}
16874
16875/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
16876/// inp: `&VipsImage` -> Image to save
16877/// filename: `&str` -> Filename to save to
16878/// tiffsave_options: `&TiffsaveOptions` -> optional arguments
16879
16880pub fn tiffsave_with_opts(
16881    inp: &VipsImage,
16882    filename: &str,
16883    tiffsave_options: &TiffsaveOptions,
16884) -> Result<()> {
16885    unsafe {
16886        let inp_in: *mut bindings::VipsImage = inp.ctx;
16887        let filename_in: CString = utils::new_c_string(filename)?;
16888
16889        let compression_in: i32 = tiffsave_options.compression as i32;
16890        let compression_in_name = utils::new_c_string("compression")?;
16891
16892        let q_in: i32 = tiffsave_options.q;
16893        let q_in_name = utils::new_c_string("Q")?;
16894
16895        let predictor_in: i32 = tiffsave_options.predictor as i32;
16896        let predictor_in_name = utils::new_c_string("predictor")?;
16897
16898        let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
16899        let tile_in_name = utils::new_c_string("tile")?;
16900
16901        let tile_width_in: i32 = tiffsave_options.tile_width;
16902        let tile_width_in_name = utils::new_c_string("tile-width")?;
16903
16904        let tile_height_in: i32 = tiffsave_options.tile_height;
16905        let tile_height_in_name = utils::new_c_string("tile-height")?;
16906
16907        let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
16908        let pyramid_in_name = utils::new_c_string("pyramid")?;
16909
16910        let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
16911        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
16912
16913        let bitdepth_in: i32 = tiffsave_options.bitdepth;
16914        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16915
16916        let resunit_in: i32 = tiffsave_options.resunit as i32;
16917        let resunit_in_name = utils::new_c_string("resunit")?;
16918
16919        let xres_in: f64 = tiffsave_options.xres;
16920        let xres_in_name = utils::new_c_string("xres")?;
16921
16922        let yres_in: f64 = tiffsave_options.yres;
16923        let yres_in_name = utils::new_c_string("yres")?;
16924
16925        let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
16926        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
16927
16928        let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
16929        let properties_in_name = utils::new_c_string("properties")?;
16930
16931        let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
16932        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
16933
16934        let level_in: i32 = tiffsave_options.level;
16935        let level_in_name = utils::new_c_string("level")?;
16936
16937        let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
16938        let lossless_in_name = utils::new_c_string("lossless")?;
16939
16940        let depth_in: i32 = tiffsave_options.depth as i32;
16941        let depth_in_name = utils::new_c_string("depth")?;
16942
16943        let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
16944        let subifd_in_name = utils::new_c_string("subifd")?;
16945
16946        let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
16947        let premultiply_in_name = utils::new_c_string("premultiply")?;
16948
16949        let keep_in: i32 = tiffsave_options.keep as i32;
16950        let keep_in_name = utils::new_c_string("keep")?;
16951
16952        let background_wrapper =
16953            utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
16954        let background_in = background_wrapper.ctx;
16955        let background_in_name = utils::new_c_string("background")?;
16956
16957        let page_height_in: i32 = tiffsave_options.page_height;
16958        let page_height_in_name = utils::new_c_string("page-height")?;
16959
16960        let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
16961        let profile_in_name = utils::new_c_string("profile")?;
16962
16963        let vips_op_response = bindings::vips_tiffsave(
16964            inp_in,
16965            filename_in.as_ptr(),
16966            compression_in_name.as_ptr(),
16967            compression_in,
16968            q_in_name.as_ptr(),
16969            q_in,
16970            predictor_in_name.as_ptr(),
16971            predictor_in,
16972            tile_in_name.as_ptr(),
16973            tile_in,
16974            tile_width_in_name.as_ptr(),
16975            tile_width_in,
16976            tile_height_in_name.as_ptr(),
16977            tile_height_in,
16978            pyramid_in_name.as_ptr(),
16979            pyramid_in,
16980            miniswhite_in_name.as_ptr(),
16981            miniswhite_in,
16982            bitdepth_in_name.as_ptr(),
16983            bitdepth_in,
16984            resunit_in_name.as_ptr(),
16985            resunit_in,
16986            xres_in_name.as_ptr(),
16987            xres_in,
16988            yres_in_name.as_ptr(),
16989            yres_in,
16990            bigtiff_in_name.as_ptr(),
16991            bigtiff_in,
16992            properties_in_name.as_ptr(),
16993            properties_in,
16994            region_shrink_in_name.as_ptr(),
16995            region_shrink_in,
16996            level_in_name.as_ptr(),
16997            level_in,
16998            lossless_in_name.as_ptr(),
16999            lossless_in,
17000            depth_in_name.as_ptr(),
17001            depth_in,
17002            subifd_in_name.as_ptr(),
17003            subifd_in,
17004            premultiply_in_name.as_ptr(),
17005            premultiply_in,
17006            keep_in_name.as_ptr(),
17007            keep_in,
17008            background_in_name.as_ptr(),
17009            background_in,
17010            page_height_in_name.as_ptr(),
17011            page_height_in,
17012            profile_in_name.as_ptr(),
17013            profile_in.as_ptr(),
17014            NULL,
17015        );
17016        utils::result(vips_op_response, (), Error::TiffsaveError)
17017    }
17018}
17019
17020/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
17021/// inp: `&VipsImage` -> Image to save
17022/// returns `Vec<u8>` - Buffer to save to
17023pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17024    unsafe {
17025        let inp_in: *mut bindings::VipsImage = inp.ctx;
17026        let mut buffer_buf_size: u64 = 0;
17027        let mut buffer_out: *mut c_void = null_mut();
17028
17029        let vips_op_response =
17030            bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17031        utils::result(
17032            vips_op_response,
17033            utils::new_byte_array(buffer_out, buffer_buf_size),
17034            Error::TiffsaveBufferError,
17035        )
17036    }
17037}
17038
17039/// Options for tiffsave_buffer operation
17040#[derive(Clone, Debug)]
17041pub struct TiffsaveBufferOptions {
17042    /// compression: `ForeignTiffCompression` -> Compression for this file
17043    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17044    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17045    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17046    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17047    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17048    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17049    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17050    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17051    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17052    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
17053    pub compression: ForeignTiffCompression,
17054    /// q: `i32` -> Q factor
17055    /// min: 1, max: 100, default: 75
17056    pub q: i32,
17057    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17058    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17059    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17060    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17061    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
17062    pub predictor: ForeignTiffPredictor,
17063    /// tile: `bool` -> Write a tiled tiff
17064    /// default: false
17065    pub tile: bool,
17066    /// tile_width: `i32` -> Tile width in pixels
17067    /// min: 1, max: 32768, default: 128
17068    pub tile_width: i32,
17069    /// tile_height: `i32` -> Tile height in pixels
17070    /// min: 1, max: 32768, default: 128
17071    pub tile_height: i32,
17072    /// pyramid: `bool` -> Write a pyramidal tiff
17073    /// default: false
17074    pub pyramid: bool,
17075    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17076    /// default: false
17077    pub miniswhite: bool,
17078    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17079    /// min: 0, max: 8, default: 0
17080    pub bitdepth: i32,
17081    /// resunit: `ForeignTiffResunit` -> Resolution unit
17082    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17083    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17084    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17085    pub resunit: ForeignTiffResunit,
17086    /// xres: `f64` -> Horizontal resolution in pixels/mm
17087    /// min: 0.001, max: 1000000, default: 1
17088    pub xres: f64,
17089    /// yres: `f64` -> Vertical resolution in pixels/mm
17090    /// min: 0.001, max: 1000000, default: 1
17091    pub yres: f64,
17092    /// bigtiff: `bool` -> Write a bigtiff image
17093    /// default: false
17094    pub bigtiff: bool,
17095    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17096    /// default: false
17097    pub properties: bool,
17098    /// region_shrink: `RegionShrink` -> Method to shrink regions
17099    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17100    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17101    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17102    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17103    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17104    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17105    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17106    pub region_shrink: RegionShrink,
17107    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17108    /// min: 1, max: 22, default: 6
17109    pub level: i32,
17110    /// lossless: `bool` -> Enable WEBP lossless mode
17111    /// default: false
17112    pub lossless: bool,
17113    /// depth: `ForeignDzDepth` -> Pyramid depth
17114    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17115    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17116    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17117    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17118    pub depth: ForeignDzDepth,
17119    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17120    /// default: false
17121    pub subifd: bool,
17122    /// premultiply: `bool` -> Save with premultiplied alpha
17123    /// default: false
17124    pub premultiply: bool,
17125    /// keep: `ForeignKeep` -> Which metadata to retain
17126    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17127    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17128    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17129    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17130    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17131    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17132    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17133    pub keep: ForeignKeep,
17134    /// background: `Vec<f64>` -> Background value
17135    pub background: Vec<f64>,
17136    /// page_height: `i32` -> Set page height for multipage save
17137    /// min: 0, max: 100000000, default: 0
17138    pub page_height: i32,
17139    /// profile: `String` -> Filename of ICC profile to embed
17140    pub profile: String,
17141}
17142
17143impl std::default::Default for TiffsaveBufferOptions {
17144    fn default() -> Self {
17145        TiffsaveBufferOptions {
17146            compression: ForeignTiffCompression::None,
17147            q: i32::from(75),
17148            predictor: ForeignTiffPredictor::Horizontal,
17149            tile: false,
17150            tile_width: i32::from(128),
17151            tile_height: i32::from(128),
17152            pyramid: false,
17153            miniswhite: false,
17154            bitdepth: i32::from(0),
17155            resunit: ForeignTiffResunit::Cm,
17156            xres: f64::from(1),
17157            yres: f64::from(1),
17158            bigtiff: false,
17159            properties: false,
17160            region_shrink: RegionShrink::Mean,
17161            level: i32::from(6),
17162            lossless: false,
17163            depth: ForeignDzDepth::Onetile,
17164            subifd: false,
17165            premultiply: false,
17166            keep: ForeignKeep::All,
17167            background: Vec::new(),
17168            page_height: i32::from(0),
17169            profile: String::from("sRGB"),
17170        }
17171    }
17172}
17173
17174/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
17175/// inp: `&VipsImage` -> Image to save
17176/// tiffsave_buffer_options: `&TiffsaveBufferOptions` -> optional arguments
17177/// returns `Vec<u8>` - Buffer to save to
17178pub fn tiffsave_buffer_with_opts(
17179    inp: &VipsImage,
17180    tiffsave_buffer_options: &TiffsaveBufferOptions,
17181) -> Result<Vec<u8>> {
17182    unsafe {
17183        let inp_in: *mut bindings::VipsImage = inp.ctx;
17184        let mut buffer_buf_size: u64 = 0;
17185        let mut buffer_out: *mut c_void = null_mut();
17186
17187        let compression_in: i32 = tiffsave_buffer_options.compression as i32;
17188        let compression_in_name = utils::new_c_string("compression")?;
17189
17190        let q_in: i32 = tiffsave_buffer_options.q;
17191        let q_in_name = utils::new_c_string("Q")?;
17192
17193        let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
17194        let predictor_in_name = utils::new_c_string("predictor")?;
17195
17196        let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
17197        let tile_in_name = utils::new_c_string("tile")?;
17198
17199        let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
17200        let tile_width_in_name = utils::new_c_string("tile-width")?;
17201
17202        let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
17203        let tile_height_in_name = utils::new_c_string("tile-height")?;
17204
17205        let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
17206            1
17207        } else {
17208            0
17209        };
17210        let pyramid_in_name = utils::new_c_string("pyramid")?;
17211
17212        let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
17213            1
17214        } else {
17215            0
17216        };
17217        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17218
17219        let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
17220        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17221
17222        let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
17223        let resunit_in_name = utils::new_c_string("resunit")?;
17224
17225        let xres_in: f64 = tiffsave_buffer_options.xres;
17226        let xres_in_name = utils::new_c_string("xres")?;
17227
17228        let yres_in: f64 = tiffsave_buffer_options.yres;
17229        let yres_in_name = utils::new_c_string("yres")?;
17230
17231        let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
17232            1
17233        } else {
17234            0
17235        };
17236        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17237
17238        let properties_in: i32 = if tiffsave_buffer_options.properties {
17239            1
17240        } else {
17241            0
17242        };
17243        let properties_in_name = utils::new_c_string("properties")?;
17244
17245        let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
17246        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17247
17248        let level_in: i32 = tiffsave_buffer_options.level;
17249        let level_in_name = utils::new_c_string("level")?;
17250
17251        let lossless_in: i32 = if tiffsave_buffer_options.lossless {
17252            1
17253        } else {
17254            0
17255        };
17256        let lossless_in_name = utils::new_c_string("lossless")?;
17257
17258        let depth_in: i32 = tiffsave_buffer_options.depth as i32;
17259        let depth_in_name = utils::new_c_string("depth")?;
17260
17261        let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
17262        let subifd_in_name = utils::new_c_string("subifd")?;
17263
17264        let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
17265            1
17266        } else {
17267            0
17268        };
17269        let premultiply_in_name = utils::new_c_string("premultiply")?;
17270
17271        let keep_in: i32 = tiffsave_buffer_options.keep as i32;
17272        let keep_in_name = utils::new_c_string("keep")?;
17273
17274        let background_wrapper =
17275            utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
17276        let background_in = background_wrapper.ctx;
17277        let background_in_name = utils::new_c_string("background")?;
17278
17279        let page_height_in: i32 = tiffsave_buffer_options.page_height;
17280        let page_height_in_name = utils::new_c_string("page-height")?;
17281
17282        let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
17283        let profile_in_name = utils::new_c_string("profile")?;
17284
17285        let vips_op_response = bindings::vips_tiffsave_buffer(
17286            inp_in,
17287            &mut buffer_out,
17288            &mut buffer_buf_size,
17289            compression_in_name.as_ptr(),
17290            compression_in,
17291            q_in_name.as_ptr(),
17292            q_in,
17293            predictor_in_name.as_ptr(),
17294            predictor_in,
17295            tile_in_name.as_ptr(),
17296            tile_in,
17297            tile_width_in_name.as_ptr(),
17298            tile_width_in,
17299            tile_height_in_name.as_ptr(),
17300            tile_height_in,
17301            pyramid_in_name.as_ptr(),
17302            pyramid_in,
17303            miniswhite_in_name.as_ptr(),
17304            miniswhite_in,
17305            bitdepth_in_name.as_ptr(),
17306            bitdepth_in,
17307            resunit_in_name.as_ptr(),
17308            resunit_in,
17309            xres_in_name.as_ptr(),
17310            xres_in,
17311            yres_in_name.as_ptr(),
17312            yres_in,
17313            bigtiff_in_name.as_ptr(),
17314            bigtiff_in,
17315            properties_in_name.as_ptr(),
17316            properties_in,
17317            region_shrink_in_name.as_ptr(),
17318            region_shrink_in,
17319            level_in_name.as_ptr(),
17320            level_in,
17321            lossless_in_name.as_ptr(),
17322            lossless_in,
17323            depth_in_name.as_ptr(),
17324            depth_in,
17325            subifd_in_name.as_ptr(),
17326            subifd_in,
17327            premultiply_in_name.as_ptr(),
17328            premultiply_in,
17329            keep_in_name.as_ptr(),
17330            keep_in,
17331            background_in_name.as_ptr(),
17332            background_in,
17333            page_height_in_name.as_ptr(),
17334            page_height_in,
17335            profile_in_name.as_ptr(),
17336            profile_in.as_ptr(),
17337            NULL,
17338        );
17339        utils::result(
17340            vips_op_response,
17341            utils::new_byte_array(buffer_out, buffer_buf_size),
17342            Error::TiffsaveBufferError,
17343        )
17344    }
17345}
17346
17347/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
17348/// inp: `&VipsImage` -> Image to save
17349/// target: `&VipsTarget` -> Target to save to
17350
17351pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17352    unsafe {
17353        let inp_in: *mut bindings::VipsImage = inp.ctx;
17354        let target_in: *mut bindings::VipsTarget = target.ctx;
17355
17356        let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
17357        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17358    }
17359}
17360
17361/// Options for tiffsave_target operation
17362#[derive(Clone, Debug)]
17363pub struct TiffsaveTargetOptions {
17364    /// compression: `ForeignTiffCompression` -> Compression for this file
17365    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17366    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17367    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17368    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17369    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17370    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17371    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17372    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17373    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17374    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
17375    pub compression: ForeignTiffCompression,
17376    /// q: `i32` -> Q factor
17377    /// min: 1, max: 100, default: 75
17378    pub q: i32,
17379    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17380    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17381    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17382    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17383    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
17384    pub predictor: ForeignTiffPredictor,
17385    /// tile: `bool` -> Write a tiled tiff
17386    /// default: false
17387    pub tile: bool,
17388    /// tile_width: `i32` -> Tile width in pixels
17389    /// min: 1, max: 32768, default: 128
17390    pub tile_width: i32,
17391    /// tile_height: `i32` -> Tile height in pixels
17392    /// min: 1, max: 32768, default: 128
17393    pub tile_height: i32,
17394    /// pyramid: `bool` -> Write a pyramidal tiff
17395    /// default: false
17396    pub pyramid: bool,
17397    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17398    /// default: false
17399    pub miniswhite: bool,
17400    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17401    /// min: 0, max: 8, default: 0
17402    pub bitdepth: i32,
17403    /// resunit: `ForeignTiffResunit` -> Resolution unit
17404    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17405    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17406    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17407    pub resunit: ForeignTiffResunit,
17408    /// xres: `f64` -> Horizontal resolution in pixels/mm
17409    /// min: 0.001, max: 1000000, default: 1
17410    pub xres: f64,
17411    /// yres: `f64` -> Vertical resolution in pixels/mm
17412    /// min: 0.001, max: 1000000, default: 1
17413    pub yres: f64,
17414    /// bigtiff: `bool` -> Write a bigtiff image
17415    /// default: false
17416    pub bigtiff: bool,
17417    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17418    /// default: false
17419    pub properties: bool,
17420    /// region_shrink: `RegionShrink` -> Method to shrink regions
17421    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17422    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17423    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17424    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17425    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17426    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17427    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17428    pub region_shrink: RegionShrink,
17429    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17430    /// min: 1, max: 22, default: 6
17431    pub level: i32,
17432    /// lossless: `bool` -> Enable WEBP lossless mode
17433    /// default: false
17434    pub lossless: bool,
17435    /// depth: `ForeignDzDepth` -> Pyramid depth
17436    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17437    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17438    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17439    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17440    pub depth: ForeignDzDepth,
17441    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17442    /// default: false
17443    pub subifd: bool,
17444    /// premultiply: `bool` -> Save with premultiplied alpha
17445    /// default: false
17446    pub premultiply: bool,
17447    /// keep: `ForeignKeep` -> Which metadata to retain
17448    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17449    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17450    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17451    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17452    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17453    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17454    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17455    pub keep: ForeignKeep,
17456    /// background: `Vec<f64>` -> Background value
17457    pub background: Vec<f64>,
17458    /// page_height: `i32` -> Set page height for multipage save
17459    /// min: 0, max: 100000000, default: 0
17460    pub page_height: i32,
17461    /// profile: `String` -> Filename of ICC profile to embed
17462    pub profile: String,
17463}
17464
17465impl std::default::Default for TiffsaveTargetOptions {
17466    fn default() -> Self {
17467        TiffsaveTargetOptions {
17468            compression: ForeignTiffCompression::None,
17469            q: i32::from(75),
17470            predictor: ForeignTiffPredictor::Horizontal,
17471            tile: false,
17472            tile_width: i32::from(128),
17473            tile_height: i32::from(128),
17474            pyramid: false,
17475            miniswhite: false,
17476            bitdepth: i32::from(0),
17477            resunit: ForeignTiffResunit::Cm,
17478            xres: f64::from(1),
17479            yres: f64::from(1),
17480            bigtiff: false,
17481            properties: false,
17482            region_shrink: RegionShrink::Mean,
17483            level: i32::from(6),
17484            lossless: false,
17485            depth: ForeignDzDepth::Onetile,
17486            subifd: false,
17487            premultiply: false,
17488            keep: ForeignKeep::All,
17489            background: Vec::new(),
17490            page_height: i32::from(0),
17491            profile: String::from("sRGB"),
17492        }
17493    }
17494}
17495
17496/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
17497/// inp: `&VipsImage` -> Image to save
17498/// target: `&VipsTarget` -> Target to save to
17499/// tiffsave_target_options: `&TiffsaveTargetOptions` -> optional arguments
17500
17501pub fn tiffsave_target_with_opts(
17502    inp: &VipsImage,
17503    target: &VipsTarget,
17504    tiffsave_target_options: &TiffsaveTargetOptions,
17505) -> Result<()> {
17506    unsafe {
17507        let inp_in: *mut bindings::VipsImage = inp.ctx;
17508        let target_in: *mut bindings::VipsTarget = target.ctx;
17509
17510        let compression_in: i32 = tiffsave_target_options.compression as i32;
17511        let compression_in_name = utils::new_c_string("compression")?;
17512
17513        let q_in: i32 = tiffsave_target_options.q;
17514        let q_in_name = utils::new_c_string("Q")?;
17515
17516        let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17517        let predictor_in_name = utils::new_c_string("predictor")?;
17518
17519        let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17520        let tile_in_name = utils::new_c_string("tile")?;
17521
17522        let tile_width_in: i32 = tiffsave_target_options.tile_width;
17523        let tile_width_in_name = utils::new_c_string("tile-width")?;
17524
17525        let tile_height_in: i32 = tiffsave_target_options.tile_height;
17526        let tile_height_in_name = utils::new_c_string("tile-height")?;
17527
17528        let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17529            1
17530        } else {
17531            0
17532        };
17533        let pyramid_in_name = utils::new_c_string("pyramid")?;
17534
17535        let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17536            1
17537        } else {
17538            0
17539        };
17540        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17541
17542        let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17543        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17544
17545        let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17546        let resunit_in_name = utils::new_c_string("resunit")?;
17547
17548        let xres_in: f64 = tiffsave_target_options.xres;
17549        let xres_in_name = utils::new_c_string("xres")?;
17550
17551        let yres_in: f64 = tiffsave_target_options.yres;
17552        let yres_in_name = utils::new_c_string("yres")?;
17553
17554        let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17555            1
17556        } else {
17557            0
17558        };
17559        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17560
17561        let properties_in: i32 = if tiffsave_target_options.properties {
17562            1
17563        } else {
17564            0
17565        };
17566        let properties_in_name = utils::new_c_string("properties")?;
17567
17568        let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17569        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17570
17571        let level_in: i32 = tiffsave_target_options.level;
17572        let level_in_name = utils::new_c_string("level")?;
17573
17574        let lossless_in: i32 = if tiffsave_target_options.lossless {
17575            1
17576        } else {
17577            0
17578        };
17579        let lossless_in_name = utils::new_c_string("lossless")?;
17580
17581        let depth_in: i32 = tiffsave_target_options.depth as i32;
17582        let depth_in_name = utils::new_c_string("depth")?;
17583
17584        let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17585        let subifd_in_name = utils::new_c_string("subifd")?;
17586
17587        let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17588            1
17589        } else {
17590            0
17591        };
17592        let premultiply_in_name = utils::new_c_string("premultiply")?;
17593
17594        let keep_in: i32 = tiffsave_target_options.keep as i32;
17595        let keep_in_name = utils::new_c_string("keep")?;
17596
17597        let background_wrapper =
17598            utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17599        let background_in = background_wrapper.ctx;
17600        let background_in_name = utils::new_c_string("background")?;
17601
17602        let page_height_in: i32 = tiffsave_target_options.page_height;
17603        let page_height_in_name = utils::new_c_string("page-height")?;
17604
17605        let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17606        let profile_in_name = utils::new_c_string("profile")?;
17607
17608        let vips_op_response = bindings::vips_tiffsave_target(
17609            inp_in,
17610            target_in,
17611            compression_in_name.as_ptr(),
17612            compression_in,
17613            q_in_name.as_ptr(),
17614            q_in,
17615            predictor_in_name.as_ptr(),
17616            predictor_in,
17617            tile_in_name.as_ptr(),
17618            tile_in,
17619            tile_width_in_name.as_ptr(),
17620            tile_width_in,
17621            tile_height_in_name.as_ptr(),
17622            tile_height_in,
17623            pyramid_in_name.as_ptr(),
17624            pyramid_in,
17625            miniswhite_in_name.as_ptr(),
17626            miniswhite_in,
17627            bitdepth_in_name.as_ptr(),
17628            bitdepth_in,
17629            resunit_in_name.as_ptr(),
17630            resunit_in,
17631            xres_in_name.as_ptr(),
17632            xres_in,
17633            yres_in_name.as_ptr(),
17634            yres_in,
17635            bigtiff_in_name.as_ptr(),
17636            bigtiff_in,
17637            properties_in_name.as_ptr(),
17638            properties_in,
17639            region_shrink_in_name.as_ptr(),
17640            region_shrink_in,
17641            level_in_name.as_ptr(),
17642            level_in,
17643            lossless_in_name.as_ptr(),
17644            lossless_in,
17645            depth_in_name.as_ptr(),
17646            depth_in,
17647            subifd_in_name.as_ptr(),
17648            subifd_in,
17649            premultiply_in_name.as_ptr(),
17650            premultiply_in,
17651            keep_in_name.as_ptr(),
17652            keep_in,
17653            background_in_name.as_ptr(),
17654            background_in,
17655            page_height_in_name.as_ptr(),
17656            page_height_in,
17657            profile_in_name.as_ptr(),
17658            profile_in.as_ptr(),
17659            NULL,
17660        );
17661        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17662    }
17663}
17664
17665/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
17666/// inp: `&VipsImage` -> Image to save
17667/// filename: `&str` -> Filename to save to
17668
17669pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17670    unsafe {
17671        let inp_in: *mut bindings::VipsImage = inp.ctx;
17672        let filename_in: CString = utils::new_c_string(filename)?;
17673
17674        let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17675        utils::result(vips_op_response, (), Error::HeifsaveError)
17676    }
17677}
17678
17679/// Options for heifsave operation
17680#[derive(Clone, Debug)]
17681pub struct HeifsaveOptions {
17682    /// q: `i32` -> Q factor
17683    /// min: 1, max: 100, default: 50
17684    pub q: i32,
17685    /// bitdepth: `i32` -> Number of bits per pixel
17686    /// min: 8, max: 12, default: 12
17687    pub bitdepth: i32,
17688    /// lossless: `bool` -> Enable lossless compression
17689    /// default: false
17690    pub lossless: bool,
17691    /// compression: `ForeignHeifCompression` -> Compression format
17692    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17693    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17694    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17695    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17696    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17697    pub compression: ForeignHeifCompression,
17698    /// effort: `i32` -> CPU effort
17699    /// min: 0, max: 9, default: 4
17700    pub effort: i32,
17701    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17702    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17703    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17704    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17705    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17706    pub subsample_mode: ForeignSubsample,
17707    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17708    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17709    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17710    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17711    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17712    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17713    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17714    pub encoder: ForeignHeifEncoder,
17715    /// keep: `ForeignKeep` -> Which metadata to retain
17716    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17717    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17718    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17719    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17720    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17721    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17722    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17723    pub keep: ForeignKeep,
17724    /// background: `Vec<f64>` -> Background value
17725    pub background: Vec<f64>,
17726    /// page_height: `i32` -> Set page height for multipage save
17727    /// min: 0, max: 100000000, default: 0
17728    pub page_height: i32,
17729    /// profile: `String` -> Filename of ICC profile to embed
17730    pub profile: String,
17731}
17732
17733impl std::default::Default for HeifsaveOptions {
17734    fn default() -> Self {
17735        HeifsaveOptions {
17736            q: i32::from(50),
17737            bitdepth: i32::from(12),
17738            lossless: false,
17739            compression: ForeignHeifCompression::Hevc,
17740            effort: i32::from(4),
17741            subsample_mode: ForeignSubsample::Auto,
17742            encoder: ForeignHeifEncoder::Auto,
17743            keep: ForeignKeep::All,
17744            background: Vec::new(),
17745            page_height: i32::from(0),
17746            profile: String::from("sRGB"),
17747        }
17748    }
17749}
17750
17751/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
17752/// inp: `&VipsImage` -> Image to save
17753/// filename: `&str` -> Filename to save to
17754/// heifsave_options: `&HeifsaveOptions` -> optional arguments
17755
17756pub fn heifsave_with_opts(
17757    inp: &VipsImage,
17758    filename: &str,
17759    heifsave_options: &HeifsaveOptions,
17760) -> Result<()> {
17761    unsafe {
17762        let inp_in: *mut bindings::VipsImage = inp.ctx;
17763        let filename_in: CString = utils::new_c_string(filename)?;
17764
17765        let q_in: i32 = heifsave_options.q;
17766        let q_in_name = utils::new_c_string("Q")?;
17767
17768        let bitdepth_in: i32 = heifsave_options.bitdepth;
17769        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17770
17771        let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
17772        let lossless_in_name = utils::new_c_string("lossless")?;
17773
17774        let compression_in: i32 = heifsave_options.compression as i32;
17775        let compression_in_name = utils::new_c_string("compression")?;
17776
17777        let effort_in: i32 = heifsave_options.effort;
17778        let effort_in_name = utils::new_c_string("effort")?;
17779
17780        let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
17781        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17782
17783        let encoder_in: i32 = heifsave_options.encoder as i32;
17784        let encoder_in_name = utils::new_c_string("encoder")?;
17785
17786        let keep_in: i32 = heifsave_options.keep as i32;
17787        let keep_in_name = utils::new_c_string("keep")?;
17788
17789        let background_wrapper =
17790            utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
17791        let background_in = background_wrapper.ctx;
17792        let background_in_name = utils::new_c_string("background")?;
17793
17794        let page_height_in: i32 = heifsave_options.page_height;
17795        let page_height_in_name = utils::new_c_string("page-height")?;
17796
17797        let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
17798        let profile_in_name = utils::new_c_string("profile")?;
17799
17800        let vips_op_response = bindings::vips_heifsave(
17801            inp_in,
17802            filename_in.as_ptr(),
17803            q_in_name.as_ptr(),
17804            q_in,
17805            bitdepth_in_name.as_ptr(),
17806            bitdepth_in,
17807            lossless_in_name.as_ptr(),
17808            lossless_in,
17809            compression_in_name.as_ptr(),
17810            compression_in,
17811            effort_in_name.as_ptr(),
17812            effort_in,
17813            subsample_mode_in_name.as_ptr(),
17814            subsample_mode_in,
17815            encoder_in_name.as_ptr(),
17816            encoder_in,
17817            keep_in_name.as_ptr(),
17818            keep_in,
17819            background_in_name.as_ptr(),
17820            background_in,
17821            page_height_in_name.as_ptr(),
17822            page_height_in,
17823            profile_in_name.as_ptr(),
17824            profile_in.as_ptr(),
17825            NULL,
17826        );
17827        utils::result(vips_op_response, (), Error::HeifsaveError)
17828    }
17829}
17830
17831/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17832/// inp: `&VipsImage` -> Image to save
17833/// returns `Vec<u8>` - Buffer to save to
17834pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17835    unsafe {
17836        let inp_in: *mut bindings::VipsImage = inp.ctx;
17837        let mut buffer_buf_size: u64 = 0;
17838        let mut buffer_out: *mut c_void = null_mut();
17839
17840        let vips_op_response =
17841            bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17842        utils::result(
17843            vips_op_response,
17844            utils::new_byte_array(buffer_out, buffer_buf_size),
17845            Error::HeifsaveBufferError,
17846        )
17847    }
17848}
17849
17850/// Options for heifsave_buffer operation
17851#[derive(Clone, Debug)]
17852pub struct HeifsaveBufferOptions {
17853    /// q: `i32` -> Q factor
17854    /// min: 1, max: 100, default: 50
17855    pub q: i32,
17856    /// bitdepth: `i32` -> Number of bits per pixel
17857    /// min: 8, max: 12, default: 12
17858    pub bitdepth: i32,
17859    /// lossless: `bool` -> Enable lossless compression
17860    /// default: false
17861    pub lossless: bool,
17862    /// compression: `ForeignHeifCompression` -> Compression format
17863    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17864    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17865    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17866    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17867    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17868    pub compression: ForeignHeifCompression,
17869    /// effort: `i32` -> CPU effort
17870    /// min: 0, max: 9, default: 4
17871    pub effort: i32,
17872    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17873    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17874    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17875    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17876    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17877    pub subsample_mode: ForeignSubsample,
17878    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17879    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17880    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17881    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17882    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17883    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17884    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17885    pub encoder: ForeignHeifEncoder,
17886    /// keep: `ForeignKeep` -> Which metadata to retain
17887    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17888    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17889    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17890    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17891    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17892    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17893    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17894    pub keep: ForeignKeep,
17895    /// background: `Vec<f64>` -> Background value
17896    pub background: Vec<f64>,
17897    /// page_height: `i32` -> Set page height for multipage save
17898    /// min: 0, max: 100000000, default: 0
17899    pub page_height: i32,
17900    /// profile: `String` -> Filename of ICC profile to embed
17901    pub profile: String,
17902}
17903
17904impl std::default::Default for HeifsaveBufferOptions {
17905    fn default() -> Self {
17906        HeifsaveBufferOptions {
17907            q: i32::from(50),
17908            bitdepth: i32::from(12),
17909            lossless: false,
17910            compression: ForeignHeifCompression::Hevc,
17911            effort: i32::from(4),
17912            subsample_mode: ForeignSubsample::Auto,
17913            encoder: ForeignHeifEncoder::Auto,
17914            keep: ForeignKeep::All,
17915            background: Vec::new(),
17916            page_height: i32::from(0),
17917            profile: String::from("sRGB"),
17918        }
17919    }
17920}
17921
17922/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17923/// inp: `&VipsImage` -> Image to save
17924/// heifsave_buffer_options: `&HeifsaveBufferOptions` -> optional arguments
17925/// returns `Vec<u8>` - Buffer to save to
17926pub fn heifsave_buffer_with_opts(
17927    inp: &VipsImage,
17928    heifsave_buffer_options: &HeifsaveBufferOptions,
17929) -> Result<Vec<u8>> {
17930    unsafe {
17931        let inp_in: *mut bindings::VipsImage = inp.ctx;
17932        let mut buffer_buf_size: u64 = 0;
17933        let mut buffer_out: *mut c_void = null_mut();
17934
17935        let q_in: i32 = heifsave_buffer_options.q;
17936        let q_in_name = utils::new_c_string("Q")?;
17937
17938        let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
17939        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17940
17941        let lossless_in: i32 = if heifsave_buffer_options.lossless {
17942            1
17943        } else {
17944            0
17945        };
17946        let lossless_in_name = utils::new_c_string("lossless")?;
17947
17948        let compression_in: i32 = heifsave_buffer_options.compression as i32;
17949        let compression_in_name = utils::new_c_string("compression")?;
17950
17951        let effort_in: i32 = heifsave_buffer_options.effort;
17952        let effort_in_name = utils::new_c_string("effort")?;
17953
17954        let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
17955        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17956
17957        let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
17958        let encoder_in_name = utils::new_c_string("encoder")?;
17959
17960        let keep_in: i32 = heifsave_buffer_options.keep as i32;
17961        let keep_in_name = utils::new_c_string("keep")?;
17962
17963        let background_wrapper =
17964            utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
17965        let background_in = background_wrapper.ctx;
17966        let background_in_name = utils::new_c_string("background")?;
17967
17968        let page_height_in: i32 = heifsave_buffer_options.page_height;
17969        let page_height_in_name = utils::new_c_string("page-height")?;
17970
17971        let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
17972        let profile_in_name = utils::new_c_string("profile")?;
17973
17974        let vips_op_response = bindings::vips_heifsave_buffer(
17975            inp_in,
17976            &mut buffer_out,
17977            &mut buffer_buf_size,
17978            q_in_name.as_ptr(),
17979            q_in,
17980            bitdepth_in_name.as_ptr(),
17981            bitdepth_in,
17982            lossless_in_name.as_ptr(),
17983            lossless_in,
17984            compression_in_name.as_ptr(),
17985            compression_in,
17986            effort_in_name.as_ptr(),
17987            effort_in,
17988            subsample_mode_in_name.as_ptr(),
17989            subsample_mode_in,
17990            encoder_in_name.as_ptr(),
17991            encoder_in,
17992            keep_in_name.as_ptr(),
17993            keep_in,
17994            background_in_name.as_ptr(),
17995            background_in,
17996            page_height_in_name.as_ptr(),
17997            page_height_in,
17998            profile_in_name.as_ptr(),
17999            profile_in.as_ptr(),
18000            NULL,
18001        );
18002        utils::result(
18003            vips_op_response,
18004            utils::new_byte_array(buffer_out, buffer_buf_size),
18005            Error::HeifsaveBufferError,
18006        )
18007    }
18008}
18009
18010/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
18011/// inp: `&VipsImage` -> Image to save
18012/// target: `&VipsTarget` -> Target to save to
18013
18014pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18015    unsafe {
18016        let inp_in: *mut bindings::VipsImage = inp.ctx;
18017        let target_in: *mut bindings::VipsTarget = target.ctx;
18018
18019        let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
18020        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18021    }
18022}
18023
18024/// Options for heifsave_target operation
18025#[derive(Clone, Debug)]
18026pub struct HeifsaveTargetOptions {
18027    /// q: `i32` -> Q factor
18028    /// min: 1, max: 100, default: 50
18029    pub q: i32,
18030    /// bitdepth: `i32` -> Number of bits per pixel
18031    /// min: 8, max: 12, default: 12
18032    pub bitdepth: i32,
18033    /// lossless: `bool` -> Enable lossless compression
18034    /// default: false
18035    pub lossless: bool,
18036    /// compression: `ForeignHeifCompression` -> Compression format
18037    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
18038    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
18039    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
18040    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
18041    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
18042    pub compression: ForeignHeifCompression,
18043    /// effort: `i32` -> CPU effort
18044    /// min: 0, max: 9, default: 4
18045    pub effort: i32,
18046    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18047    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18048    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18049    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18050    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18051    pub subsample_mode: ForeignSubsample,
18052    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
18053    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
18054    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
18055    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
18056    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
18057    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
18058    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
18059    pub encoder: ForeignHeifEncoder,
18060    /// keep: `ForeignKeep` -> Which metadata to retain
18061    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18062    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18063    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18064    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18065    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18066    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18067    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18068    pub keep: ForeignKeep,
18069    /// background: `Vec<f64>` -> Background value
18070    pub background: Vec<f64>,
18071    /// page_height: `i32` -> Set page height for multipage save
18072    /// min: 0, max: 100000000, default: 0
18073    pub page_height: i32,
18074    /// profile: `String` -> Filename of ICC profile to embed
18075    pub profile: String,
18076}
18077
18078impl std::default::Default for HeifsaveTargetOptions {
18079    fn default() -> Self {
18080        HeifsaveTargetOptions {
18081            q: i32::from(50),
18082            bitdepth: i32::from(12),
18083            lossless: false,
18084            compression: ForeignHeifCompression::Hevc,
18085            effort: i32::from(4),
18086            subsample_mode: ForeignSubsample::Auto,
18087            encoder: ForeignHeifEncoder::Auto,
18088            keep: ForeignKeep::All,
18089            background: Vec::new(),
18090            page_height: i32::from(0),
18091            profile: String::from("sRGB"),
18092        }
18093    }
18094}
18095
18096/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
18097/// inp: `&VipsImage` -> Image to save
18098/// target: `&VipsTarget` -> Target to save to
18099/// heifsave_target_options: `&HeifsaveTargetOptions` -> optional arguments
18100
18101pub fn heifsave_target_with_opts(
18102    inp: &VipsImage,
18103    target: &VipsTarget,
18104    heifsave_target_options: &HeifsaveTargetOptions,
18105) -> Result<()> {
18106    unsafe {
18107        let inp_in: *mut bindings::VipsImage = inp.ctx;
18108        let target_in: *mut bindings::VipsTarget = target.ctx;
18109
18110        let q_in: i32 = heifsave_target_options.q;
18111        let q_in_name = utils::new_c_string("Q")?;
18112
18113        let bitdepth_in: i32 = heifsave_target_options.bitdepth;
18114        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18115
18116        let lossless_in: i32 = if heifsave_target_options.lossless {
18117            1
18118        } else {
18119            0
18120        };
18121        let lossless_in_name = utils::new_c_string("lossless")?;
18122
18123        let compression_in: i32 = heifsave_target_options.compression as i32;
18124        let compression_in_name = utils::new_c_string("compression")?;
18125
18126        let effort_in: i32 = heifsave_target_options.effort;
18127        let effort_in_name = utils::new_c_string("effort")?;
18128
18129        let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
18130        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18131
18132        let encoder_in: i32 = heifsave_target_options.encoder as i32;
18133        let encoder_in_name = utils::new_c_string("encoder")?;
18134
18135        let keep_in: i32 = heifsave_target_options.keep as i32;
18136        let keep_in_name = utils::new_c_string("keep")?;
18137
18138        let background_wrapper =
18139            utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
18140        let background_in = background_wrapper.ctx;
18141        let background_in_name = utils::new_c_string("background")?;
18142
18143        let page_height_in: i32 = heifsave_target_options.page_height;
18144        let page_height_in_name = utils::new_c_string("page-height")?;
18145
18146        let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
18147        let profile_in_name = utils::new_c_string("profile")?;
18148
18149        let vips_op_response = bindings::vips_heifsave_target(
18150            inp_in,
18151            target_in,
18152            q_in_name.as_ptr(),
18153            q_in,
18154            bitdepth_in_name.as_ptr(),
18155            bitdepth_in,
18156            lossless_in_name.as_ptr(),
18157            lossless_in,
18158            compression_in_name.as_ptr(),
18159            compression_in,
18160            effort_in_name.as_ptr(),
18161            effort_in,
18162            subsample_mode_in_name.as_ptr(),
18163            subsample_mode_in,
18164            encoder_in_name.as_ptr(),
18165            encoder_in,
18166            keep_in_name.as_ptr(),
18167            keep_in,
18168            background_in_name.as_ptr(),
18169            background_in,
18170            page_height_in_name.as_ptr(),
18171            page_height_in,
18172            profile_in_name.as_ptr(),
18173            profile_in.as_ptr(),
18174            NULL,
18175        );
18176        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18177    }
18178}
18179
18180/// VipsThumbnailFile (thumbnail), generate thumbnail from file
18181/// filename: `&str` -> Filename to read from
18182/// width: `i32` -> Size to this width
18183/// min: 1, max: 100000000, default: 1
18184/// returns `VipsImage` - Output image
18185pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
18186    unsafe {
18187        let filename_in: CString = utils::new_c_string(filename)?;
18188        let width_in: i32 = width;
18189        let mut out_out: *mut bindings::VipsImage = null_mut();
18190
18191        let vips_op_response =
18192            bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
18193        utils::result(
18194            vips_op_response,
18195            VipsImage { ctx: out_out },
18196            Error::ThumbnailError,
18197        )
18198    }
18199}
18200
18201/// Options for thumbnail operation
18202#[derive(Clone, Debug)]
18203pub struct ThumbnailOptions {
18204    /// height: `i32` -> Size to this height
18205    /// min: 1, max: 100000000, default: 1
18206    pub height: i32,
18207    /// size: `Size` -> Only upsize, only downsize, or both
18208    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18209    ///  `Up` -> VIPS_SIZE_UP = 1
18210    ///  `Down` -> VIPS_SIZE_DOWN = 2
18211    ///  `Force` -> VIPS_SIZE_FORCE = 3
18212    ///  `Last` -> VIPS_SIZE_LAST = 4
18213    pub size: Size,
18214    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18215    /// default: false
18216    pub no_rotate: bool,
18217    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18218    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18219    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18220    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18221    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18222    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18223    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18224    ///  `All` -> VIPS_INTERESTING_ALL = 6
18225    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18226    pub crop: Interesting,
18227    /// linear: `bool` -> Reduce in linear light
18228    /// default: false
18229    pub linear: bool,
18230    /// import_profile: `String` -> Fallback import profile
18231    pub import_profile: String,
18232    /// export_profile: `String` -> Fallback export profile
18233    pub export_profile: String,
18234    /// intent: `Intent` -> Rendering intent
18235    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18236    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18237    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18238    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18239    ///  `Last` -> VIPS_INTENT_LAST = 4
18240    pub intent: Intent,
18241    /// fail_on: `FailOn` -> Error level to fail on
18242    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18243    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18244    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18245    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18246    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18247    pub fail_on: FailOn,
18248}
18249
18250impl std::default::Default for ThumbnailOptions {
18251    fn default() -> Self {
18252        ThumbnailOptions {
18253            height: i32::from(1),
18254            size: Size::Both,
18255            no_rotate: false,
18256            crop: Interesting::None,
18257            linear: false,
18258            import_profile: String::new(),
18259            export_profile: String::new(),
18260            intent: Intent::Relative,
18261            fail_on: FailOn::None,
18262        }
18263    }
18264}
18265
18266/// VipsThumbnailFile (thumbnail), generate thumbnail from file
18267/// filename: `&str` -> Filename to read from
18268/// width: `i32` -> Size to this width
18269/// min: 1, max: 100000000, default: 1
18270/// thumbnail_options: `&ThumbnailOptions` -> optional arguments
18271/// returns `VipsImage` - Output image
18272pub fn thumbnail_with_opts(
18273    filename: &str,
18274    width: i32,
18275    thumbnail_options: &ThumbnailOptions,
18276) -> Result<VipsImage> {
18277    unsafe {
18278        let filename_in: CString = utils::new_c_string(filename)?;
18279        let width_in: i32 = width;
18280        let mut out_out: *mut bindings::VipsImage = null_mut();
18281
18282        let height_in: i32 = thumbnail_options.height;
18283        let height_in_name = utils::new_c_string("height")?;
18284
18285        let size_in: i32 = thumbnail_options.size as i32;
18286        let size_in_name = utils::new_c_string("size")?;
18287
18288        let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
18289        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18290
18291        let crop_in: i32 = thumbnail_options.crop as i32;
18292        let crop_in_name = utils::new_c_string("crop")?;
18293
18294        let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
18295        let linear_in_name = utils::new_c_string("linear")?;
18296
18297        let import_profile_in: CString = utils::new_c_string(&thumbnail_options.import_profile)?;
18298        let import_profile_in_name = utils::new_c_string("import-profile")?;
18299
18300        let export_profile_in: CString = utils::new_c_string(&thumbnail_options.export_profile)?;
18301        let export_profile_in_name = utils::new_c_string("export-profile")?;
18302
18303        let intent_in: i32 = thumbnail_options.intent as i32;
18304        let intent_in_name = utils::new_c_string("intent")?;
18305
18306        let fail_on_in: i32 = thumbnail_options.fail_on as i32;
18307        let fail_on_in_name = utils::new_c_string("fail-on")?;
18308
18309        let vips_op_response = bindings::vips_thumbnail(
18310            filename_in.as_ptr(),
18311            &mut out_out,
18312            width_in,
18313            height_in_name.as_ptr(),
18314            height_in,
18315            size_in_name.as_ptr(),
18316            size_in,
18317            no_rotate_in_name.as_ptr(),
18318            no_rotate_in,
18319            crop_in_name.as_ptr(),
18320            crop_in,
18321            linear_in_name.as_ptr(),
18322            linear_in,
18323            import_profile_in_name.as_ptr(),
18324            import_profile_in.as_ptr(),
18325            export_profile_in_name.as_ptr(),
18326            export_profile_in.as_ptr(),
18327            intent_in_name.as_ptr(),
18328            intent_in,
18329            fail_on_in_name.as_ptr(),
18330            fail_on_in,
18331            NULL,
18332        );
18333        utils::result(
18334            vips_op_response,
18335            VipsImage { ctx: out_out },
18336            Error::ThumbnailError,
18337        )
18338    }
18339}
18340
18341/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
18342/// buffer: `&[u8]` -> Buffer to load from
18343/// width: `i32` -> Size to this width
18344/// min: 1, max: 100000000, default: 1
18345/// returns `VipsImage` - Output image
18346pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
18347    unsafe {
18348        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18349        let width_in: i32 = width;
18350        let mut out_out: *mut bindings::VipsImage = null_mut();
18351
18352        let vips_op_response = bindings::vips_thumbnail_buffer(
18353            buffer_in,
18354            buffer.len() as u64,
18355            &mut out_out,
18356            width_in,
18357            NULL,
18358        );
18359        utils::result(
18360            vips_op_response,
18361            VipsImage { ctx: out_out },
18362            Error::ThumbnailBufferError,
18363        )
18364    }
18365}
18366
18367/// Options for thumbnail_buffer operation
18368#[derive(Clone, Debug)]
18369pub struct ThumbnailBufferOptions {
18370    /// option_string: `String` -> Options that are passed on to the underlying loader
18371    pub option_string: String,
18372    /// height: `i32` -> Size to this height
18373    /// min: 1, max: 100000000, default: 1
18374    pub height: i32,
18375    /// size: `Size` -> Only upsize, only downsize, or both
18376    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18377    ///  `Up` -> VIPS_SIZE_UP = 1
18378    ///  `Down` -> VIPS_SIZE_DOWN = 2
18379    ///  `Force` -> VIPS_SIZE_FORCE = 3
18380    ///  `Last` -> VIPS_SIZE_LAST = 4
18381    pub size: Size,
18382    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18383    /// default: false
18384    pub no_rotate: bool,
18385    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18386    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18387    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18388    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18389    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18390    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18391    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18392    ///  `All` -> VIPS_INTERESTING_ALL = 6
18393    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18394    pub crop: Interesting,
18395    /// linear: `bool` -> Reduce in linear light
18396    /// default: false
18397    pub linear: bool,
18398    /// import_profile: `String` -> Fallback import profile
18399    pub import_profile: String,
18400    /// export_profile: `String` -> Fallback export profile
18401    pub export_profile: String,
18402    /// intent: `Intent` -> Rendering intent
18403    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18404    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18405    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18406    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18407    ///  `Last` -> VIPS_INTENT_LAST = 4
18408    pub intent: Intent,
18409    /// fail_on: `FailOn` -> Error level to fail on
18410    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18411    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18412    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18413    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18414    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18415    pub fail_on: FailOn,
18416}
18417
18418impl std::default::Default for ThumbnailBufferOptions {
18419    fn default() -> Self {
18420        ThumbnailBufferOptions {
18421            option_string: String::new(),
18422            height: i32::from(1),
18423            size: Size::Both,
18424            no_rotate: false,
18425            crop: Interesting::None,
18426            linear: false,
18427            import_profile: String::new(),
18428            export_profile: String::new(),
18429            intent: Intent::Relative,
18430            fail_on: FailOn::None,
18431        }
18432    }
18433}
18434
18435/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
18436/// buffer: `&[u8]` -> Buffer to load from
18437/// width: `i32` -> Size to this width
18438/// min: 1, max: 100000000, default: 1
18439/// thumbnail_buffer_options: `&ThumbnailBufferOptions` -> optional arguments
18440/// returns `VipsImage` - Output image
18441pub fn thumbnail_buffer_with_opts(
18442    buffer: &[u8],
18443    width: i32,
18444    thumbnail_buffer_options: &ThumbnailBufferOptions,
18445) -> Result<VipsImage> {
18446    unsafe {
18447        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18448        let width_in: i32 = width;
18449        let mut out_out: *mut bindings::VipsImage = null_mut();
18450
18451        let option_string_in: CString =
18452            utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18453        let option_string_in_name = utils::new_c_string("option-string")?;
18454
18455        let height_in: i32 = thumbnail_buffer_options.height;
18456        let height_in_name = utils::new_c_string("height")?;
18457
18458        let size_in: i32 = thumbnail_buffer_options.size as i32;
18459        let size_in_name = utils::new_c_string("size")?;
18460
18461        let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18462            1
18463        } else {
18464            0
18465        };
18466        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18467
18468        let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18469        let crop_in_name = utils::new_c_string("crop")?;
18470
18471        let linear_in: i32 = if thumbnail_buffer_options.linear {
18472            1
18473        } else {
18474            0
18475        };
18476        let linear_in_name = utils::new_c_string("linear")?;
18477
18478        let import_profile_in: CString =
18479            utils::new_c_string(&thumbnail_buffer_options.import_profile)?;
18480        let import_profile_in_name = utils::new_c_string("import-profile")?;
18481
18482        let export_profile_in: CString =
18483            utils::new_c_string(&thumbnail_buffer_options.export_profile)?;
18484        let export_profile_in_name = utils::new_c_string("export-profile")?;
18485
18486        let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18487        let intent_in_name = utils::new_c_string("intent")?;
18488
18489        let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18490        let fail_on_in_name = utils::new_c_string("fail-on")?;
18491
18492        let vips_op_response = bindings::vips_thumbnail_buffer(
18493            buffer_in,
18494            buffer.len() as u64,
18495            &mut out_out,
18496            width_in,
18497            option_string_in_name.as_ptr(),
18498            option_string_in.as_ptr(),
18499            height_in_name.as_ptr(),
18500            height_in,
18501            size_in_name.as_ptr(),
18502            size_in,
18503            no_rotate_in_name.as_ptr(),
18504            no_rotate_in,
18505            crop_in_name.as_ptr(),
18506            crop_in,
18507            linear_in_name.as_ptr(),
18508            linear_in,
18509            import_profile_in_name.as_ptr(),
18510            import_profile_in.as_ptr(),
18511            export_profile_in_name.as_ptr(),
18512            export_profile_in.as_ptr(),
18513            intent_in_name.as_ptr(),
18514            intent_in,
18515            fail_on_in_name.as_ptr(),
18516            fail_on_in,
18517            NULL,
18518        );
18519        utils::result(
18520            vips_op_response,
18521            VipsImage { ctx: out_out },
18522            Error::ThumbnailBufferError,
18523        )
18524    }
18525}
18526
18527/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18528/// inp: `&VipsImage` -> Input image argument
18529/// width: `i32` -> Size to this width
18530/// min: 1, max: 100000000, default: 1
18531/// returns `VipsImage` - Output image
18532pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18533    unsafe {
18534        let inp_in: *mut bindings::VipsImage = inp.ctx;
18535        let width_in: i32 = width;
18536        let mut out_out: *mut bindings::VipsImage = null_mut();
18537
18538        let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18539        utils::result(
18540            vips_op_response,
18541            VipsImage { ctx: out_out },
18542            Error::ThumbnailImageError,
18543        )
18544    }
18545}
18546
18547/// Options for thumbnail_image operation
18548#[derive(Clone, Debug)]
18549pub struct ThumbnailImageOptions {
18550    /// height: `i32` -> Size to this height
18551    /// min: 1, max: 100000000, default: 1
18552    pub height: i32,
18553    /// size: `Size` -> Only upsize, only downsize, or both
18554    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18555    ///  `Up` -> VIPS_SIZE_UP = 1
18556    ///  `Down` -> VIPS_SIZE_DOWN = 2
18557    ///  `Force` -> VIPS_SIZE_FORCE = 3
18558    ///  `Last` -> VIPS_SIZE_LAST = 4
18559    pub size: Size,
18560    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18561    /// default: false
18562    pub no_rotate: bool,
18563    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18564    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18565    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18566    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18567    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18568    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18569    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18570    ///  `All` -> VIPS_INTERESTING_ALL = 6
18571    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18572    pub crop: Interesting,
18573    /// linear: `bool` -> Reduce in linear light
18574    /// default: false
18575    pub linear: bool,
18576    /// import_profile: `String` -> Fallback import profile
18577    pub import_profile: String,
18578    /// export_profile: `String` -> Fallback export profile
18579    pub export_profile: String,
18580    /// intent: `Intent` -> Rendering intent
18581    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18582    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18583    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18584    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18585    ///  `Last` -> VIPS_INTENT_LAST = 4
18586    pub intent: Intent,
18587    /// fail_on: `FailOn` -> Error level to fail on
18588    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18589    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18590    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18591    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18592    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18593    pub fail_on: FailOn,
18594}
18595
18596impl std::default::Default for ThumbnailImageOptions {
18597    fn default() -> Self {
18598        ThumbnailImageOptions {
18599            height: i32::from(1),
18600            size: Size::Both,
18601            no_rotate: false,
18602            crop: Interesting::None,
18603            linear: false,
18604            import_profile: String::new(),
18605            export_profile: String::new(),
18606            intent: Intent::Relative,
18607            fail_on: FailOn::None,
18608        }
18609    }
18610}
18611
18612/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18613/// inp: `&VipsImage` -> Input image argument
18614/// width: `i32` -> Size to this width
18615/// min: 1, max: 100000000, default: 1
18616/// thumbnail_image_options: `&ThumbnailImageOptions` -> optional arguments
18617/// returns `VipsImage` - Output image
18618pub fn thumbnail_image_with_opts(
18619    inp: &VipsImage,
18620    width: i32,
18621    thumbnail_image_options: &ThumbnailImageOptions,
18622) -> Result<VipsImage> {
18623    unsafe {
18624        let inp_in: *mut bindings::VipsImage = inp.ctx;
18625        let width_in: i32 = width;
18626        let mut out_out: *mut bindings::VipsImage = null_mut();
18627
18628        let height_in: i32 = thumbnail_image_options.height;
18629        let height_in_name = utils::new_c_string("height")?;
18630
18631        let size_in: i32 = thumbnail_image_options.size as i32;
18632        let size_in_name = utils::new_c_string("size")?;
18633
18634        let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18635            1
18636        } else {
18637            0
18638        };
18639        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18640
18641        let crop_in: i32 = thumbnail_image_options.crop as i32;
18642        let crop_in_name = utils::new_c_string("crop")?;
18643
18644        let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18645        let linear_in_name = utils::new_c_string("linear")?;
18646
18647        let import_profile_in: CString =
18648            utils::new_c_string(&thumbnail_image_options.import_profile)?;
18649        let import_profile_in_name = utils::new_c_string("import-profile")?;
18650
18651        let export_profile_in: CString =
18652            utils::new_c_string(&thumbnail_image_options.export_profile)?;
18653        let export_profile_in_name = utils::new_c_string("export-profile")?;
18654
18655        let intent_in: i32 = thumbnail_image_options.intent as i32;
18656        let intent_in_name = utils::new_c_string("intent")?;
18657
18658        let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18659        let fail_on_in_name = utils::new_c_string("fail-on")?;
18660
18661        let vips_op_response = bindings::vips_thumbnail_image(
18662            inp_in,
18663            &mut out_out,
18664            width_in,
18665            height_in_name.as_ptr(),
18666            height_in,
18667            size_in_name.as_ptr(),
18668            size_in,
18669            no_rotate_in_name.as_ptr(),
18670            no_rotate_in,
18671            crop_in_name.as_ptr(),
18672            crop_in,
18673            linear_in_name.as_ptr(),
18674            linear_in,
18675            import_profile_in_name.as_ptr(),
18676            import_profile_in.as_ptr(),
18677            export_profile_in_name.as_ptr(),
18678            export_profile_in.as_ptr(),
18679            intent_in_name.as_ptr(),
18680            intent_in,
18681            fail_on_in_name.as_ptr(),
18682            fail_on_in,
18683            NULL,
18684        );
18685        utils::result(
18686            vips_op_response,
18687            VipsImage { ctx: out_out },
18688            Error::ThumbnailImageError,
18689        )
18690    }
18691}
18692
18693/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
18694/// source: `&VipsSource` -> Source to load from
18695/// width: `i32` -> Size to this width
18696/// min: 1, max: 100000000, default: 1
18697/// returns `VipsImage` - Output image
18698pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18699    unsafe {
18700        let source_in: *mut bindings::VipsSource = source.ctx;
18701        let width_in: i32 = width;
18702        let mut out_out: *mut bindings::VipsImage = null_mut();
18703
18704        let vips_op_response =
18705            bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18706        utils::result(
18707            vips_op_response,
18708            VipsImage { ctx: out_out },
18709            Error::ThumbnailSourceError,
18710        )
18711    }
18712}
18713
18714/// Options for thumbnail_source operation
18715#[derive(Clone, Debug)]
18716pub struct ThumbnailSourceOptions {
18717    /// option_string: `String` -> Options that are passed on to the underlying loader
18718    pub option_string: String,
18719    /// height: `i32` -> Size to this height
18720    /// min: 1, max: 100000000, default: 1
18721    pub height: i32,
18722    /// size: `Size` -> Only upsize, only downsize, or both
18723    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18724    ///  `Up` -> VIPS_SIZE_UP = 1
18725    ///  `Down` -> VIPS_SIZE_DOWN = 2
18726    ///  `Force` -> VIPS_SIZE_FORCE = 3
18727    ///  `Last` -> VIPS_SIZE_LAST = 4
18728    pub size: Size,
18729    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18730    /// default: false
18731    pub no_rotate: bool,
18732    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18733    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18734    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18735    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18736    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18737    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18738    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18739    ///  `All` -> VIPS_INTERESTING_ALL = 6
18740    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18741    pub crop: Interesting,
18742    /// linear: `bool` -> Reduce in linear light
18743    /// default: false
18744    pub linear: bool,
18745    /// import_profile: `String` -> Fallback import profile
18746    pub import_profile: String,
18747    /// export_profile: `String` -> Fallback export profile
18748    pub export_profile: String,
18749    /// intent: `Intent` -> Rendering intent
18750    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18751    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18752    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18753    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18754    ///  `Last` -> VIPS_INTENT_LAST = 4
18755    pub intent: Intent,
18756    /// fail_on: `FailOn` -> Error level to fail on
18757    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18758    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18759    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18760    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18761    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18762    pub fail_on: FailOn,
18763}
18764
18765impl std::default::Default for ThumbnailSourceOptions {
18766    fn default() -> Self {
18767        ThumbnailSourceOptions {
18768            option_string: String::new(),
18769            height: i32::from(1),
18770            size: Size::Both,
18771            no_rotate: false,
18772            crop: Interesting::None,
18773            linear: false,
18774            import_profile: String::new(),
18775            export_profile: String::new(),
18776            intent: Intent::Relative,
18777            fail_on: FailOn::None,
18778        }
18779    }
18780}
18781
18782/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
18783/// source: `&VipsSource` -> Source to load from
18784/// width: `i32` -> Size to this width
18785/// min: 1, max: 100000000, default: 1
18786/// thumbnail_source_options: `&ThumbnailSourceOptions` -> optional arguments
18787/// returns `VipsImage` - Output image
18788pub fn thumbnail_source_with_opts(
18789    source: &VipsSource,
18790    width: i32,
18791    thumbnail_source_options: &ThumbnailSourceOptions,
18792) -> Result<VipsImage> {
18793    unsafe {
18794        let source_in: *mut bindings::VipsSource = source.ctx;
18795        let width_in: i32 = width;
18796        let mut out_out: *mut bindings::VipsImage = null_mut();
18797
18798        let option_string_in: CString =
18799            utils::new_c_string(&thumbnail_source_options.option_string)?;
18800        let option_string_in_name = utils::new_c_string("option-string")?;
18801
18802        let height_in: i32 = thumbnail_source_options.height;
18803        let height_in_name = utils::new_c_string("height")?;
18804
18805        let size_in: i32 = thumbnail_source_options.size as i32;
18806        let size_in_name = utils::new_c_string("size")?;
18807
18808        let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
18809            1
18810        } else {
18811            0
18812        };
18813        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18814
18815        let crop_in: i32 = thumbnail_source_options.crop as i32;
18816        let crop_in_name = utils::new_c_string("crop")?;
18817
18818        let linear_in: i32 = if thumbnail_source_options.linear {
18819            1
18820        } else {
18821            0
18822        };
18823        let linear_in_name = utils::new_c_string("linear")?;
18824
18825        let import_profile_in: CString =
18826            utils::new_c_string(&thumbnail_source_options.import_profile)?;
18827        let import_profile_in_name = utils::new_c_string("import-profile")?;
18828
18829        let export_profile_in: CString =
18830            utils::new_c_string(&thumbnail_source_options.export_profile)?;
18831        let export_profile_in_name = utils::new_c_string("export-profile")?;
18832
18833        let intent_in: i32 = thumbnail_source_options.intent as i32;
18834        let intent_in_name = utils::new_c_string("intent")?;
18835
18836        let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
18837        let fail_on_in_name = utils::new_c_string("fail-on")?;
18838
18839        let vips_op_response = bindings::vips_thumbnail_source(
18840            source_in,
18841            &mut out_out,
18842            width_in,
18843            option_string_in_name.as_ptr(),
18844            option_string_in.as_ptr(),
18845            height_in_name.as_ptr(),
18846            height_in,
18847            size_in_name.as_ptr(),
18848            size_in,
18849            no_rotate_in_name.as_ptr(),
18850            no_rotate_in,
18851            crop_in_name.as_ptr(),
18852            crop_in,
18853            linear_in_name.as_ptr(),
18854            linear_in,
18855            import_profile_in_name.as_ptr(),
18856            import_profile_in.as_ptr(),
18857            export_profile_in_name.as_ptr(),
18858            export_profile_in.as_ptr(),
18859            intent_in_name.as_ptr(),
18860            intent_in,
18861            fail_on_in_name.as_ptr(),
18862            fail_on_in,
18863            NULL,
18864        );
18865        utils::result(
18866            vips_op_response,
18867            VipsImage { ctx: out_out },
18868            Error::ThumbnailSourceError,
18869        )
18870    }
18871}
18872
18873/// VipsMapim (mapim), resample with a map image
18874/// inp: `&VipsImage` -> Input image argument
18875/// index: `&VipsImage` -> Index pixels with this
18876/// returns `VipsImage` - Output image
18877pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
18878    unsafe {
18879        let inp_in: *mut bindings::VipsImage = inp.ctx;
18880        let index_in: *mut bindings::VipsImage = index.ctx;
18881        let mut out_out: *mut bindings::VipsImage = null_mut();
18882
18883        let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
18884        utils::result(
18885            vips_op_response,
18886            VipsImage { ctx: out_out },
18887            Error::MapimError,
18888        )
18889    }
18890}
18891
18892/// Options for mapim operation
18893#[derive(Clone, Debug)]
18894pub struct MapimOptions {
18895    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
18896    pub interpolate: VipsInterpolate,
18897    /// background: `Vec<f64>` -> Background value
18898    pub background: Vec<f64>,
18899    /// premultiplied: `bool` -> Images have premultiplied alpha
18900    /// default: false
18901    pub premultiplied: bool,
18902    /// extend: `Extend` -> How to generate the extra pixels
18903    ///  `Black` -> VIPS_EXTEND_BLACK = 0
18904    ///  `Copy` -> VIPS_EXTEND_COPY = 1
18905    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
18906    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
18907    ///  `White` -> VIPS_EXTEND_WHITE = 4
18908    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
18909    ///  `Last` -> VIPS_EXTEND_LAST = 6
18910    pub extend: Extend,
18911}
18912
18913impl std::default::Default for MapimOptions {
18914    fn default() -> Self {
18915        MapimOptions {
18916            interpolate: VipsInterpolate::new(),
18917            background: Vec::new(),
18918            premultiplied: false,
18919            extend: Extend::Background,
18920        }
18921    }
18922}
18923
18924/// VipsMapim (mapim), resample with a map image
18925/// inp: `&VipsImage` -> Input image argument
18926/// index: `&VipsImage` -> Index pixels with this
18927/// mapim_options: `&MapimOptions` -> optional arguments
18928/// returns `VipsImage` - Output image
18929pub fn mapim_with_opts(
18930    inp: &VipsImage,
18931    index: &VipsImage,
18932    mapim_options: &MapimOptions,
18933) -> Result<VipsImage> {
18934    unsafe {
18935        let inp_in: *mut bindings::VipsImage = inp.ctx;
18936        let index_in: *mut bindings::VipsImage = index.ctx;
18937        let mut out_out: *mut bindings::VipsImage = null_mut();
18938
18939        let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
18940        let interpolate_in_name = utils::new_c_string("interpolate")?;
18941
18942        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
18943        let background_in = background_wrapper.ctx;
18944        let background_in_name = utils::new_c_string("background")?;
18945
18946        let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
18947        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
18948
18949        let extend_in: i32 = mapim_options.extend as i32;
18950        let extend_in_name = utils::new_c_string("extend")?;
18951
18952        let vips_op_response = bindings::vips_mapim(
18953            inp_in,
18954            &mut out_out,
18955            index_in,
18956            interpolate_in_name.as_ptr(),
18957            interpolate_in,
18958            background_in_name.as_ptr(),
18959            background_in,
18960            premultiplied_in_name.as_ptr(),
18961            premultiplied_in,
18962            extend_in_name.as_ptr(),
18963            extend_in,
18964            NULL,
18965        );
18966        utils::result(
18967            vips_op_response,
18968            VipsImage { ctx: out_out },
18969            Error::MapimError,
18970        )
18971    }
18972}
18973
18974/// VipsShrink (shrink), shrink an image
18975/// inp: `&VipsImage` -> Input image argument
18976/// hshrink: `f64` -> Horizontal shrink factor
18977/// min: 1, max: 1000000, default: 1
18978/// vshrink: `f64` -> Vertical shrink factor
18979/// min: 1, max: 1000000, default: 1
18980/// returns `VipsImage` - Output image
18981pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
18982    unsafe {
18983        let inp_in: *mut bindings::VipsImage = inp.ctx;
18984        let hshrink_in: f64 = hshrink;
18985        let vshrink_in: f64 = vshrink;
18986        let mut out_out: *mut bindings::VipsImage = null_mut();
18987
18988        let vips_op_response =
18989            bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
18990        utils::result(
18991            vips_op_response,
18992            VipsImage { ctx: out_out },
18993            Error::ShrinkError,
18994        )
18995    }
18996}
18997
18998/// Options for shrink operation
18999#[derive(Clone, Debug)]
19000pub struct ShrinkOptions {
19001    /// ceil: `bool` -> Round-up output dimensions
19002    /// default: false
19003    pub ceil: bool,
19004}
19005
19006impl std::default::Default for ShrinkOptions {
19007    fn default() -> Self {
19008        ShrinkOptions { ceil: false }
19009    }
19010}
19011
19012/// VipsShrink (shrink), shrink an image
19013/// inp: `&VipsImage` -> Input image argument
19014/// hshrink: `f64` -> Horizontal shrink factor
19015/// min: 1, max: 1000000, default: 1
19016/// vshrink: `f64` -> Vertical shrink factor
19017/// min: 1, max: 1000000, default: 1
19018/// shrink_options: `&ShrinkOptions` -> optional arguments
19019/// returns `VipsImage` - Output image
19020pub fn shrink_with_opts(
19021    inp: &VipsImage,
19022    hshrink: f64,
19023    vshrink: f64,
19024    shrink_options: &ShrinkOptions,
19025) -> Result<VipsImage> {
19026    unsafe {
19027        let inp_in: *mut bindings::VipsImage = inp.ctx;
19028        let hshrink_in: f64 = hshrink;
19029        let vshrink_in: f64 = vshrink;
19030        let mut out_out: *mut bindings::VipsImage = null_mut();
19031
19032        let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
19033        let ceil_in_name = utils::new_c_string("ceil")?;
19034
19035        let vips_op_response = bindings::vips_shrink(
19036            inp_in,
19037            &mut out_out,
19038            hshrink_in,
19039            vshrink_in,
19040            ceil_in_name.as_ptr(),
19041            ceil_in,
19042            NULL,
19043        );
19044        utils::result(
19045            vips_op_response,
19046            VipsImage { ctx: out_out },
19047            Error::ShrinkError,
19048        )
19049    }
19050}
19051
19052/// VipsShrinkh (shrinkh), shrink an image horizontally
19053/// inp: `&VipsImage` -> Input image argument
19054/// hshrink: `i32` -> Horizontal shrink factor
19055/// min: 1, max: 1000000, default: 1
19056/// returns `VipsImage` - Output image
19057pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
19058    unsafe {
19059        let inp_in: *mut bindings::VipsImage = inp.ctx;
19060        let hshrink_in: i32 = hshrink;
19061        let mut out_out: *mut bindings::VipsImage = null_mut();
19062
19063        let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
19064        utils::result(
19065            vips_op_response,
19066            VipsImage { ctx: out_out },
19067            Error::ShrinkhError,
19068        )
19069    }
19070}
19071
19072/// Options for shrinkh operation
19073#[derive(Clone, Debug)]
19074pub struct ShrinkhOptions {
19075    /// ceil: `bool` -> Round-up output dimensions
19076    /// default: false
19077    pub ceil: bool,
19078}
19079
19080impl std::default::Default for ShrinkhOptions {
19081    fn default() -> Self {
19082        ShrinkhOptions { ceil: false }
19083    }
19084}
19085
19086/// VipsShrinkh (shrinkh), shrink an image horizontally
19087/// inp: `&VipsImage` -> Input image argument
19088/// hshrink: `i32` -> Horizontal shrink factor
19089/// min: 1, max: 1000000, default: 1
19090/// shrinkh_options: `&ShrinkhOptions` -> optional arguments
19091/// returns `VipsImage` - Output image
19092pub fn shrinkh_with_opts(
19093    inp: &VipsImage,
19094    hshrink: i32,
19095    shrinkh_options: &ShrinkhOptions,
19096) -> Result<VipsImage> {
19097    unsafe {
19098        let inp_in: *mut bindings::VipsImage = inp.ctx;
19099        let hshrink_in: i32 = hshrink;
19100        let mut out_out: *mut bindings::VipsImage = null_mut();
19101
19102        let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
19103        let ceil_in_name = utils::new_c_string("ceil")?;
19104
19105        let vips_op_response = bindings::vips_shrinkh(
19106            inp_in,
19107            &mut out_out,
19108            hshrink_in,
19109            ceil_in_name.as_ptr(),
19110            ceil_in,
19111            NULL,
19112        );
19113        utils::result(
19114            vips_op_response,
19115            VipsImage { ctx: out_out },
19116            Error::ShrinkhError,
19117        )
19118    }
19119}
19120
19121/// VipsShrinkv (shrinkv), shrink an image vertically
19122/// inp: `&VipsImage` -> Input image argument
19123/// vshrink: `i32` -> Vertical shrink factor
19124/// min: 1, max: 1000000, default: 1
19125/// returns `VipsImage` - Output image
19126pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
19127    unsafe {
19128        let inp_in: *mut bindings::VipsImage = inp.ctx;
19129        let vshrink_in: i32 = vshrink;
19130        let mut out_out: *mut bindings::VipsImage = null_mut();
19131
19132        let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
19133        utils::result(
19134            vips_op_response,
19135            VipsImage { ctx: out_out },
19136            Error::ShrinkvError,
19137        )
19138    }
19139}
19140
19141/// Options for shrinkv operation
19142#[derive(Clone, Debug)]
19143pub struct ShrinkvOptions {
19144    /// ceil: `bool` -> Round-up output dimensions
19145    /// default: false
19146    pub ceil: bool,
19147}
19148
19149impl std::default::Default for ShrinkvOptions {
19150    fn default() -> Self {
19151        ShrinkvOptions { ceil: false }
19152    }
19153}
19154
19155/// VipsShrinkv (shrinkv), shrink an image vertically
19156/// inp: `&VipsImage` -> Input image argument
19157/// vshrink: `i32` -> Vertical shrink factor
19158/// min: 1, max: 1000000, default: 1
19159/// shrinkv_options: `&ShrinkvOptions` -> optional arguments
19160/// returns `VipsImage` - Output image
19161pub fn shrinkv_with_opts(
19162    inp: &VipsImage,
19163    vshrink: i32,
19164    shrinkv_options: &ShrinkvOptions,
19165) -> Result<VipsImage> {
19166    unsafe {
19167        let inp_in: *mut bindings::VipsImage = inp.ctx;
19168        let vshrink_in: i32 = vshrink;
19169        let mut out_out: *mut bindings::VipsImage = null_mut();
19170
19171        let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
19172        let ceil_in_name = utils::new_c_string("ceil")?;
19173
19174        let vips_op_response = bindings::vips_shrinkv(
19175            inp_in,
19176            &mut out_out,
19177            vshrink_in,
19178            ceil_in_name.as_ptr(),
19179            ceil_in,
19180            NULL,
19181        );
19182        utils::result(
19183            vips_op_response,
19184            VipsImage { ctx: out_out },
19185            Error::ShrinkvError,
19186        )
19187    }
19188}
19189
19190/// VipsReduceh (reduceh), shrink an image horizontally
19191/// inp: `&VipsImage` -> Input image argument
19192/// hshrink: `f64` -> Horizontal shrink factor
19193/// min: 1, max: 1000000, default: 1
19194/// returns `VipsImage` - Output image
19195pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
19196    unsafe {
19197        let inp_in: *mut bindings::VipsImage = inp.ctx;
19198        let hshrink_in: f64 = hshrink;
19199        let mut out_out: *mut bindings::VipsImage = null_mut();
19200
19201        let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
19202        utils::result(
19203            vips_op_response,
19204            VipsImage { ctx: out_out },
19205            Error::ReducehError,
19206        )
19207    }
19208}
19209
19210/// Options for reduceh operation
19211#[derive(Clone, Debug)]
19212pub struct ReducehOptions {
19213    /// kernel: `Kernel` -> Resampling kernel
19214    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19215    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19216    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19217    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19218    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19219    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19220    ///  `Last` -> VIPS_KERNEL_LAST = 6
19221    pub kernel: Kernel,
19222    /// gap: `f64` -> Reducing gap
19223    /// min: 0, max: 1000000, default: 0
19224    pub gap: f64,
19225}
19226
19227impl std::default::Default for ReducehOptions {
19228    fn default() -> Self {
19229        ReducehOptions {
19230            kernel: Kernel::Lanczos3,
19231            gap: f64::from(0),
19232        }
19233    }
19234}
19235
19236/// VipsReduceh (reduceh), shrink an image horizontally
19237/// inp: `&VipsImage` -> Input image argument
19238/// hshrink: `f64` -> Horizontal shrink factor
19239/// min: 1, max: 1000000, default: 1
19240/// reduceh_options: `&ReducehOptions` -> optional arguments
19241/// returns `VipsImage` - Output image
19242pub fn reduceh_with_opts(
19243    inp: &VipsImage,
19244    hshrink: f64,
19245    reduceh_options: &ReducehOptions,
19246) -> Result<VipsImage> {
19247    unsafe {
19248        let inp_in: *mut bindings::VipsImage = inp.ctx;
19249        let hshrink_in: f64 = hshrink;
19250        let mut out_out: *mut bindings::VipsImage = null_mut();
19251
19252        let kernel_in: i32 = reduceh_options.kernel as i32;
19253        let kernel_in_name = utils::new_c_string("kernel")?;
19254
19255        let gap_in: f64 = reduceh_options.gap;
19256        let gap_in_name = utils::new_c_string("gap")?;
19257
19258        let vips_op_response = bindings::vips_reduceh(
19259            inp_in,
19260            &mut out_out,
19261            hshrink_in,
19262            kernel_in_name.as_ptr(),
19263            kernel_in,
19264            gap_in_name.as_ptr(),
19265            gap_in,
19266            NULL,
19267        );
19268        utils::result(
19269            vips_op_response,
19270            VipsImage { ctx: out_out },
19271            Error::ReducehError,
19272        )
19273    }
19274}
19275
19276/// VipsReducev (reducev), shrink an image vertically
19277/// inp: `&VipsImage` -> Input image argument
19278/// vshrink: `f64` -> Vertical shrink factor
19279/// min: 1, max: 1000000, default: 1
19280/// returns `VipsImage` - Output image
19281pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
19282    unsafe {
19283        let inp_in: *mut bindings::VipsImage = inp.ctx;
19284        let vshrink_in: f64 = vshrink;
19285        let mut out_out: *mut bindings::VipsImage = null_mut();
19286
19287        let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
19288        utils::result(
19289            vips_op_response,
19290            VipsImage { ctx: out_out },
19291            Error::ReducevError,
19292        )
19293    }
19294}
19295
19296/// Options for reducev operation
19297#[derive(Clone, Debug)]
19298pub struct ReducevOptions {
19299    /// kernel: `Kernel` -> Resampling kernel
19300    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19301    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19302    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19303    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19304    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19305    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19306    ///  `Last` -> VIPS_KERNEL_LAST = 6
19307    pub kernel: Kernel,
19308    /// gap: `f64` -> Reducing gap
19309    /// min: 0, max: 1000000, default: 0
19310    pub gap: f64,
19311}
19312
19313impl std::default::Default for ReducevOptions {
19314    fn default() -> Self {
19315        ReducevOptions {
19316            kernel: Kernel::Lanczos3,
19317            gap: f64::from(0),
19318        }
19319    }
19320}
19321
19322/// VipsReducev (reducev), shrink an image vertically
19323/// inp: `&VipsImage` -> Input image argument
19324/// vshrink: `f64` -> Vertical shrink factor
19325/// min: 1, max: 1000000, default: 1
19326/// reducev_options: `&ReducevOptions` -> optional arguments
19327/// returns `VipsImage` - Output image
19328pub fn reducev_with_opts(
19329    inp: &VipsImage,
19330    vshrink: f64,
19331    reducev_options: &ReducevOptions,
19332) -> Result<VipsImage> {
19333    unsafe {
19334        let inp_in: *mut bindings::VipsImage = inp.ctx;
19335        let vshrink_in: f64 = vshrink;
19336        let mut out_out: *mut bindings::VipsImage = null_mut();
19337
19338        let kernel_in: i32 = reducev_options.kernel as i32;
19339        let kernel_in_name = utils::new_c_string("kernel")?;
19340
19341        let gap_in: f64 = reducev_options.gap;
19342        let gap_in_name = utils::new_c_string("gap")?;
19343
19344        let vips_op_response = bindings::vips_reducev(
19345            inp_in,
19346            &mut out_out,
19347            vshrink_in,
19348            kernel_in_name.as_ptr(),
19349            kernel_in,
19350            gap_in_name.as_ptr(),
19351            gap_in,
19352            NULL,
19353        );
19354        utils::result(
19355            vips_op_response,
19356            VipsImage { ctx: out_out },
19357            Error::ReducevError,
19358        )
19359    }
19360}
19361
19362/// VipsReduce (reduce), reduce an image
19363/// inp: `&VipsImage` -> Input image argument
19364/// hshrink: `f64` -> Horizontal shrink factor
19365/// min: 1, max: 1000000, default: 1
19366/// vshrink: `f64` -> Vertical shrink factor
19367/// min: 1, max: 1000000, default: 1
19368/// returns `VipsImage` - Output image
19369pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19370    unsafe {
19371        let inp_in: *mut bindings::VipsImage = inp.ctx;
19372        let hshrink_in: f64 = hshrink;
19373        let vshrink_in: f64 = vshrink;
19374        let mut out_out: *mut bindings::VipsImage = null_mut();
19375
19376        let vips_op_response =
19377            bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19378        utils::result(
19379            vips_op_response,
19380            VipsImage { ctx: out_out },
19381            Error::ReduceError,
19382        )
19383    }
19384}
19385
19386/// Options for reduce operation
19387#[derive(Clone, Debug)]
19388pub struct ReduceOptions {
19389    /// kernel: `Kernel` -> Resampling kernel
19390    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19391    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19392    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19393    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19394    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19395    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19396    ///  `Last` -> VIPS_KERNEL_LAST = 6
19397    pub kernel: Kernel,
19398    /// gap: `f64` -> Reducing gap
19399    /// min: 0, max: 1000000, default: 0
19400    pub gap: f64,
19401}
19402
19403impl std::default::Default for ReduceOptions {
19404    fn default() -> Self {
19405        ReduceOptions {
19406            kernel: Kernel::Lanczos3,
19407            gap: f64::from(0),
19408        }
19409    }
19410}
19411
19412/// VipsReduce (reduce), reduce an image
19413/// inp: `&VipsImage` -> Input image argument
19414/// hshrink: `f64` -> Horizontal shrink factor
19415/// min: 1, max: 1000000, default: 1
19416/// vshrink: `f64` -> Vertical shrink factor
19417/// min: 1, max: 1000000, default: 1
19418/// reduce_options: `&ReduceOptions` -> optional arguments
19419/// returns `VipsImage` - Output image
19420pub fn reduce_with_opts(
19421    inp: &VipsImage,
19422    hshrink: f64,
19423    vshrink: f64,
19424    reduce_options: &ReduceOptions,
19425) -> Result<VipsImage> {
19426    unsafe {
19427        let inp_in: *mut bindings::VipsImage = inp.ctx;
19428        let hshrink_in: f64 = hshrink;
19429        let vshrink_in: f64 = vshrink;
19430        let mut out_out: *mut bindings::VipsImage = null_mut();
19431
19432        let kernel_in: i32 = reduce_options.kernel as i32;
19433        let kernel_in_name = utils::new_c_string("kernel")?;
19434
19435        let gap_in: f64 = reduce_options.gap;
19436        let gap_in_name = utils::new_c_string("gap")?;
19437
19438        let vips_op_response = bindings::vips_reduce(
19439            inp_in,
19440            &mut out_out,
19441            hshrink_in,
19442            vshrink_in,
19443            kernel_in_name.as_ptr(),
19444            kernel_in,
19445            gap_in_name.as_ptr(),
19446            gap_in,
19447            NULL,
19448        );
19449        utils::result(
19450            vips_op_response,
19451            VipsImage { ctx: out_out },
19452            Error::ReduceError,
19453        )
19454    }
19455}
19456
19457/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19458/// inp: `&VipsImage` -> Input image argument
19459/// coeff: `&VipsImage` -> Coefficient matrix
19460/// returns `VipsImage` - Output image
19461pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19462    unsafe {
19463        let inp_in: *mut bindings::VipsImage = inp.ctx;
19464        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19465        let mut out_out: *mut bindings::VipsImage = null_mut();
19466
19467        let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19468        utils::result(
19469            vips_op_response,
19470            VipsImage { ctx: out_out },
19471            Error::QuadraticError,
19472        )
19473    }
19474}
19475
19476/// Options for quadratic operation
19477#[derive(Clone, Debug)]
19478pub struct QuadraticOptions {
19479    /// interpolate: `VipsInterpolate` -> Interpolate values with this
19480    pub interpolate: VipsInterpolate,
19481}
19482
19483impl std::default::Default for QuadraticOptions {
19484    fn default() -> Self {
19485        QuadraticOptions {
19486            interpolate: VipsInterpolate::new(),
19487        }
19488    }
19489}
19490
19491/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19492/// inp: `&VipsImage` -> Input image argument
19493/// coeff: `&VipsImage` -> Coefficient matrix
19494/// quadratic_options: `&QuadraticOptions` -> optional arguments
19495/// returns `VipsImage` - Output image
19496pub fn quadratic_with_opts(
19497    inp: &VipsImage,
19498    coeff: &VipsImage,
19499    quadratic_options: &QuadraticOptions,
19500) -> Result<VipsImage> {
19501    unsafe {
19502        let inp_in: *mut bindings::VipsImage = inp.ctx;
19503        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19504        let mut out_out: *mut bindings::VipsImage = null_mut();
19505
19506        let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19507        let interpolate_in_name = utils::new_c_string("interpolate")?;
19508
19509        let vips_op_response = bindings::vips_quadratic(
19510            inp_in,
19511            &mut out_out,
19512            coeff_in,
19513            interpolate_in_name.as_ptr(),
19514            interpolate_in,
19515            NULL,
19516        );
19517        utils::result(
19518            vips_op_response,
19519            VipsImage { ctx: out_out },
19520            Error::QuadraticError,
19521        )
19522    }
19523}
19524
19525/// VipsAffine (affine), affine transform of an image
19526/// inp: `&VipsImage` -> Input image argument
19527/// a: `f64` -> Transformation Matrix coefficient
19528/// min: -inf, max: inf, default: 0
19529/// b: `f64` -> Transformation Matrix coefficient
19530/// min: -inf, max: inf, default: 0
19531/// c: `f64` -> Transformation Matrix coefficient
19532/// min: -inf, max: inf, default: 0
19533/// d: `f64` -> Transformation Matrix coefficient
19534/// min: -inf, max: inf, default: 0
19535/// returns `VipsImage` - Output image
19536pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19537    unsafe {
19538        let inp_in: *mut bindings::VipsImage = inp.ctx;
19539        let a_in: f64 = a;
19540        let b_in: f64 = b;
19541        let c_in: f64 = c;
19542        let d_in: f64 = d;
19543        let mut out_out: *mut bindings::VipsImage = null_mut();
19544
19545        let vips_op_response =
19546            bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19547        utils::result(
19548            vips_op_response,
19549            VipsImage { ctx: out_out },
19550            Error::AffineError,
19551        )
19552    }
19553}
19554
19555/// Options for affine operation
19556#[derive(Clone, Debug)]
19557pub struct AffineOptions {
19558    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19559    pub interpolate: VipsInterpolate,
19560    /// oarea: `Vec<i32>` -> Area of output to generate
19561    pub oarea: Vec<i32>,
19562    /// odx: `f64` -> Horizontal output displacement
19563    /// min: -10000000, max: 10000000, default: 0
19564    pub odx: f64,
19565    /// ody: `f64` -> Vertical output displacement
19566    /// min: -10000000, max: 10000000, default: 0
19567    pub ody: f64,
19568    /// idx: `f64` -> Horizontal input displacement
19569    /// min: -10000000, max: 10000000, default: 0
19570    pub idx: f64,
19571    /// idy: `f64` -> Vertical input displacement
19572    /// min: -10000000, max: 10000000, default: 0
19573    pub idy: f64,
19574    /// background: `Vec<f64>` -> Background value
19575    pub background: Vec<f64>,
19576    /// premultiplied: `bool` -> Images have premultiplied alpha
19577    /// default: false
19578    pub premultiplied: bool,
19579    /// extend: `Extend` -> How to generate the extra pixels
19580    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19581    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19582    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19583    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19584    ///  `White` -> VIPS_EXTEND_WHITE = 4
19585    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19586    ///  `Last` -> VIPS_EXTEND_LAST = 6
19587    pub extend: Extend,
19588}
19589
19590impl std::default::Default for AffineOptions {
19591    fn default() -> Self {
19592        AffineOptions {
19593            interpolate: VipsInterpolate::new(),
19594            oarea: Vec::new(),
19595            odx: f64::from(0),
19596            ody: f64::from(0),
19597            idx: f64::from(0),
19598            idy: f64::from(0),
19599            background: Vec::new(),
19600            premultiplied: false,
19601            extend: Extend::Background,
19602        }
19603    }
19604}
19605
19606/// VipsAffine (affine), affine transform of an image
19607/// inp: `&VipsImage` -> Input image argument
19608/// a: `f64` -> Transformation Matrix coefficient
19609/// min: -inf, max: inf, default: 0
19610/// b: `f64` -> Transformation Matrix coefficient
19611/// min: -inf, max: inf, default: 0
19612/// c: `f64` -> Transformation Matrix coefficient
19613/// min: -inf, max: inf, default: 0
19614/// d: `f64` -> Transformation Matrix coefficient
19615/// min: -inf, max: inf, default: 0
19616/// affine_options: `&AffineOptions` -> optional arguments
19617/// returns `VipsImage` - Output image
19618pub fn affine_with_opts(
19619    inp: &VipsImage,
19620    a: f64,
19621    b: f64,
19622    c: f64,
19623    d: f64,
19624    affine_options: &AffineOptions,
19625) -> Result<VipsImage> {
19626    unsafe {
19627        let inp_in: *mut bindings::VipsImage = inp.ctx;
19628        let a_in: f64 = a;
19629        let b_in: f64 = b;
19630        let c_in: f64 = c;
19631        let d_in: f64 = d;
19632        let mut out_out: *mut bindings::VipsImage = null_mut();
19633
19634        let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19635        let interpolate_in_name = utils::new_c_string("interpolate")?;
19636
19637        let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19638        let oarea_in = oarea_wrapper.ctx;
19639        let oarea_in_name = utils::new_c_string("oarea")?;
19640
19641        let odx_in: f64 = affine_options.odx;
19642        let odx_in_name = utils::new_c_string("odx")?;
19643
19644        let ody_in: f64 = affine_options.ody;
19645        let ody_in_name = utils::new_c_string("ody")?;
19646
19647        let idx_in: f64 = affine_options.idx;
19648        let idx_in_name = utils::new_c_string("idx")?;
19649
19650        let idy_in: f64 = affine_options.idy;
19651        let idy_in_name = utils::new_c_string("idy")?;
19652
19653        let background_wrapper =
19654            utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19655        let background_in = background_wrapper.ctx;
19656        let background_in_name = utils::new_c_string("background")?;
19657
19658        let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19659        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19660
19661        let extend_in: i32 = affine_options.extend as i32;
19662        let extend_in_name = utils::new_c_string("extend")?;
19663
19664        let vips_op_response = bindings::vips_affine(
19665            inp_in,
19666            &mut out_out,
19667            a_in,
19668            b_in,
19669            c_in,
19670            d_in,
19671            interpolate_in_name.as_ptr(),
19672            interpolate_in,
19673            oarea_in_name.as_ptr(),
19674            oarea_in,
19675            odx_in_name.as_ptr(),
19676            odx_in,
19677            ody_in_name.as_ptr(),
19678            ody_in,
19679            idx_in_name.as_ptr(),
19680            idx_in,
19681            idy_in_name.as_ptr(),
19682            idy_in,
19683            background_in_name.as_ptr(),
19684            background_in,
19685            premultiplied_in_name.as_ptr(),
19686            premultiplied_in,
19687            extend_in_name.as_ptr(),
19688            extend_in,
19689            NULL,
19690        );
19691        utils::result(
19692            vips_op_response,
19693            VipsImage { ctx: out_out },
19694            Error::AffineError,
19695        )
19696    }
19697}
19698
19699/// VipsSimilarity (similarity), similarity transform of an image
19700/// inp: `&VipsImage` -> Input image argument
19701/// returns `VipsImage` - Output image
19702pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19703    unsafe {
19704        let inp_in: *mut bindings::VipsImage = inp.ctx;
19705        let mut out_out: *mut bindings::VipsImage = null_mut();
19706
19707        let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19708        utils::result(
19709            vips_op_response,
19710            VipsImage { ctx: out_out },
19711            Error::SimilarityError,
19712        )
19713    }
19714}
19715
19716/// Options for similarity operation
19717#[derive(Clone, Debug)]
19718pub struct SimilarityOptions {
19719    /// scale: `f64` -> Scale by this factor
19720    /// min: 0, max: 10000000, default: 1
19721    pub scale: f64,
19722    /// angle: `f64` -> Rotate clockwise by this many degrees
19723    /// min: -10000000, max: 10000000, default: 0
19724    pub angle: f64,
19725    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19726    pub interpolate: VipsInterpolate,
19727    /// background: `Vec<f64>` -> Background value
19728    pub background: Vec<f64>,
19729    /// odx: `f64` -> Horizontal output displacement
19730    /// min: -10000000, max: 10000000, default: 0
19731    pub odx: f64,
19732    /// ody: `f64` -> Vertical output displacement
19733    /// min: -10000000, max: 10000000, default: 0
19734    pub ody: f64,
19735    /// idx: `f64` -> Horizontal input displacement
19736    /// min: -10000000, max: 10000000, default: 0
19737    pub idx: f64,
19738    /// idy: `f64` -> Vertical input displacement
19739    /// min: -10000000, max: 10000000, default: 0
19740    pub idy: f64,
19741}
19742
19743impl std::default::Default for SimilarityOptions {
19744    fn default() -> Self {
19745        SimilarityOptions {
19746            scale: f64::from(1),
19747            angle: f64::from(0),
19748            interpolate: VipsInterpolate::new(),
19749            background: Vec::new(),
19750            odx: f64::from(0),
19751            ody: f64::from(0),
19752            idx: f64::from(0),
19753            idy: f64::from(0),
19754        }
19755    }
19756}
19757
19758/// VipsSimilarity (similarity), similarity transform of an image
19759/// inp: `&VipsImage` -> Input image argument
19760/// similarity_options: `&SimilarityOptions` -> optional arguments
19761/// returns `VipsImage` - Output image
19762pub fn similarity_with_opts(
19763    inp: &VipsImage,
19764    similarity_options: &SimilarityOptions,
19765) -> Result<VipsImage> {
19766    unsafe {
19767        let inp_in: *mut bindings::VipsImage = inp.ctx;
19768        let mut out_out: *mut bindings::VipsImage = null_mut();
19769
19770        let scale_in: f64 = similarity_options.scale;
19771        let scale_in_name = utils::new_c_string("scale")?;
19772
19773        let angle_in: f64 = similarity_options.angle;
19774        let angle_in_name = utils::new_c_string("angle")?;
19775
19776        let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
19777        let interpolate_in_name = utils::new_c_string("interpolate")?;
19778
19779        let background_wrapper =
19780            utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
19781        let background_in = background_wrapper.ctx;
19782        let background_in_name = utils::new_c_string("background")?;
19783
19784        let odx_in: f64 = similarity_options.odx;
19785        let odx_in_name = utils::new_c_string("odx")?;
19786
19787        let ody_in: f64 = similarity_options.ody;
19788        let ody_in_name = utils::new_c_string("ody")?;
19789
19790        let idx_in: f64 = similarity_options.idx;
19791        let idx_in_name = utils::new_c_string("idx")?;
19792
19793        let idy_in: f64 = similarity_options.idy;
19794        let idy_in_name = utils::new_c_string("idy")?;
19795
19796        let vips_op_response = bindings::vips_similarity(
19797            inp_in,
19798            &mut out_out,
19799            scale_in_name.as_ptr(),
19800            scale_in,
19801            angle_in_name.as_ptr(),
19802            angle_in,
19803            interpolate_in_name.as_ptr(),
19804            interpolate_in,
19805            background_in_name.as_ptr(),
19806            background_in,
19807            odx_in_name.as_ptr(),
19808            odx_in,
19809            ody_in_name.as_ptr(),
19810            ody_in,
19811            idx_in_name.as_ptr(),
19812            idx_in,
19813            idy_in_name.as_ptr(),
19814            idy_in,
19815            NULL,
19816        );
19817        utils::result(
19818            vips_op_response,
19819            VipsImage { ctx: out_out },
19820            Error::SimilarityError,
19821        )
19822    }
19823}
19824
19825/// VipsRotate (rotate), rotate an image by a number of degrees
19826/// inp: `&VipsImage` -> Input image argument
19827/// angle: `f64` -> Rotate clockwise by this many degrees
19828/// min: -10000000, max: 10000000, default: 0
19829/// returns `VipsImage` - Output image
19830pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
19831    unsafe {
19832        let inp_in: *mut bindings::VipsImage = inp.ctx;
19833        let angle_in: f64 = angle;
19834        let mut out_out: *mut bindings::VipsImage = null_mut();
19835
19836        let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
19837        utils::result(
19838            vips_op_response,
19839            VipsImage { ctx: out_out },
19840            Error::RotateError,
19841        )
19842    }
19843}
19844
19845/// Options for rotate operation
19846#[derive(Clone, Debug)]
19847pub struct RotateOptions {
19848    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19849    pub interpolate: VipsInterpolate,
19850    /// background: `Vec<f64>` -> Background value
19851    pub background: Vec<f64>,
19852    /// odx: `f64` -> Horizontal output displacement
19853    /// min: -10000000, max: 10000000, default: 0
19854    pub odx: f64,
19855    /// ody: `f64` -> Vertical output displacement
19856    /// min: -10000000, max: 10000000, default: 0
19857    pub ody: f64,
19858    /// idx: `f64` -> Horizontal input displacement
19859    /// min: -10000000, max: 10000000, default: 0
19860    pub idx: f64,
19861    /// idy: `f64` -> Vertical input displacement
19862    /// min: -10000000, max: 10000000, default: 0
19863    pub idy: f64,
19864}
19865
19866impl std::default::Default for RotateOptions {
19867    fn default() -> Self {
19868        RotateOptions {
19869            interpolate: VipsInterpolate::new(),
19870            background: Vec::new(),
19871            odx: f64::from(0),
19872            ody: f64::from(0),
19873            idx: f64::from(0),
19874            idy: f64::from(0),
19875        }
19876    }
19877}
19878
19879/// VipsRotate (rotate), rotate an image by a number of degrees
19880/// inp: `&VipsImage` -> Input image argument
19881/// angle: `f64` -> Rotate clockwise by this many degrees
19882/// min: -10000000, max: 10000000, default: 0
19883/// rotate_options: `&RotateOptions` -> optional arguments
19884/// returns `VipsImage` - Output image
19885pub fn rotate_with_opts(
19886    inp: &VipsImage,
19887    angle: f64,
19888    rotate_options: &RotateOptions,
19889) -> Result<VipsImage> {
19890    unsafe {
19891        let inp_in: *mut bindings::VipsImage = inp.ctx;
19892        let angle_in: f64 = angle;
19893        let mut out_out: *mut bindings::VipsImage = null_mut();
19894
19895        let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
19896        let interpolate_in_name = utils::new_c_string("interpolate")?;
19897
19898        let background_wrapper =
19899            utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
19900        let background_in = background_wrapper.ctx;
19901        let background_in_name = utils::new_c_string("background")?;
19902
19903        let odx_in: f64 = rotate_options.odx;
19904        let odx_in_name = utils::new_c_string("odx")?;
19905
19906        let ody_in: f64 = rotate_options.ody;
19907        let ody_in_name = utils::new_c_string("ody")?;
19908
19909        let idx_in: f64 = rotate_options.idx;
19910        let idx_in_name = utils::new_c_string("idx")?;
19911
19912        let idy_in: f64 = rotate_options.idy;
19913        let idy_in_name = utils::new_c_string("idy")?;
19914
19915        let vips_op_response = bindings::vips_rotate(
19916            inp_in,
19917            &mut out_out,
19918            angle_in,
19919            interpolate_in_name.as_ptr(),
19920            interpolate_in,
19921            background_in_name.as_ptr(),
19922            background_in,
19923            odx_in_name.as_ptr(),
19924            odx_in,
19925            ody_in_name.as_ptr(),
19926            ody_in,
19927            idx_in_name.as_ptr(),
19928            idx_in,
19929            idy_in_name.as_ptr(),
19930            idy_in,
19931            NULL,
19932        );
19933        utils::result(
19934            vips_op_response,
19935            VipsImage { ctx: out_out },
19936            Error::RotateError,
19937        )
19938    }
19939}
19940
19941/// VipsResize (resize), resize an image
19942/// inp: `&VipsImage` -> Input image argument
19943/// scale: `f64` -> Scale image by this factor
19944/// min: 0, max: 10000000, default: 0
19945/// returns `VipsImage` - Output image
19946pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
19947    unsafe {
19948        let inp_in: *mut bindings::VipsImage = inp.ctx;
19949        let scale_in: f64 = scale;
19950        let mut out_out: *mut bindings::VipsImage = null_mut();
19951
19952        let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
19953        utils::result(
19954            vips_op_response,
19955            VipsImage { ctx: out_out },
19956            Error::ResizeError,
19957        )
19958    }
19959}
19960
19961/// Options for resize operation
19962#[derive(Clone, Debug)]
19963pub struct ResizeOptions {
19964    /// kernel: `Kernel` -> Resampling kernel
19965    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19966    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19967    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19968    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19969    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19970    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19971    ///  `Last` -> VIPS_KERNEL_LAST = 6
19972    pub kernel: Kernel,
19973    /// gap: `f64` -> Reducing gap
19974    /// min: 0, max: 1000000, default: 2
19975    pub gap: f64,
19976    /// vscale: `f64` -> Vertical scale image by this factor
19977    /// min: 0, max: 10000000, default: 0
19978    pub vscale: f64,
19979}
19980
19981impl std::default::Default for ResizeOptions {
19982    fn default() -> Self {
19983        ResizeOptions {
19984            kernel: Kernel::Lanczos3,
19985            gap: f64::from(2),
19986            vscale: f64::from(0),
19987        }
19988    }
19989}
19990
19991/// VipsResize (resize), resize an image
19992/// inp: `&VipsImage` -> Input image argument
19993/// scale: `f64` -> Scale image by this factor
19994/// min: 0, max: 10000000, default: 0
19995/// resize_options: `&ResizeOptions` -> optional arguments
19996/// returns `VipsImage` - Output image
19997pub fn resize_with_opts(
19998    inp: &VipsImage,
19999    scale: f64,
20000    resize_options: &ResizeOptions,
20001) -> Result<VipsImage> {
20002    unsafe {
20003        let inp_in: *mut bindings::VipsImage = inp.ctx;
20004        let scale_in: f64 = scale;
20005        let mut out_out: *mut bindings::VipsImage = null_mut();
20006
20007        let kernel_in: i32 = resize_options.kernel as i32;
20008        let kernel_in_name = utils::new_c_string("kernel")?;
20009
20010        let gap_in: f64 = resize_options.gap;
20011        let gap_in_name = utils::new_c_string("gap")?;
20012
20013        let vscale_in: f64 = resize_options.vscale;
20014        let vscale_in_name = utils::new_c_string("vscale")?;
20015
20016        let vips_op_response = bindings::vips_resize(
20017            inp_in,
20018            &mut out_out,
20019            scale_in,
20020            kernel_in_name.as_ptr(),
20021            kernel_in,
20022            gap_in_name.as_ptr(),
20023            gap_in,
20024            vscale_in_name.as_ptr(),
20025            vscale_in,
20026            NULL,
20027        );
20028        utils::result(
20029            vips_op_response,
20030            VipsImage { ctx: out_out },
20031            Error::ResizeError,
20032        )
20033    }
20034}
20035
20036/// VipsColourspace (colourspace), convert to a new colorspace
20037/// inp: `&VipsImage` -> Input image
20038/// space: `Interpretation` -> Destination color space
20039///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20040///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20041///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20042///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20043///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20044///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20045///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20046///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20047///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20048///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20049///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20050///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20051///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20052///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20053///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20054///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20055///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20056///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20057///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20058///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20059///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20060/// returns `VipsImage` - Output image
20061pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
20062    unsafe {
20063        let inp_in: *mut bindings::VipsImage = inp.ctx;
20064        let space_in: i32 = space as i32;
20065        let mut out_out: *mut bindings::VipsImage = null_mut();
20066
20067        let vips_op_response =
20068            bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
20069        utils::result(
20070            vips_op_response,
20071            VipsImage { ctx: out_out },
20072            Error::ColourspaceError,
20073        )
20074    }
20075}
20076
20077/// Options for colourspace operation
20078#[derive(Clone, Debug)]
20079pub struct ColourspaceOptions {
20080    /// source_space: `Interpretation` -> Source color space
20081    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20082    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20083    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20084    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20085    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20086    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20087    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20088    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20089    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20090    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20091    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20092    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20093    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20094    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20095    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20096    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20097    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20098    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20099    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20100    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20101    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20102    pub source_space: Interpretation,
20103}
20104
20105impl std::default::Default for ColourspaceOptions {
20106    fn default() -> Self {
20107        ColourspaceOptions {
20108            source_space: Interpretation::Srgb,
20109        }
20110    }
20111}
20112
20113/// VipsColourspace (colourspace), convert to a new colorspace
20114/// inp: `&VipsImage` -> Input image
20115/// space: `Interpretation` -> Destination color space
20116///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20117///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20118///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20119///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20120///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20121///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20122///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20123///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20124///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20125///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20126///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20127///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20128///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20129///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20130///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20131///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20132///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20133///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20134///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20135///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20136///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20137/// colourspace_options: `&ColourspaceOptions` -> optional arguments
20138/// returns `VipsImage` - Output image
20139pub fn colourspace_with_opts(
20140    inp: &VipsImage,
20141    space: Interpretation,
20142    colourspace_options: &ColourspaceOptions,
20143) -> Result<VipsImage> {
20144    unsafe {
20145        let inp_in: *mut bindings::VipsImage = inp.ctx;
20146        let space_in: i32 = space as i32;
20147        let mut out_out: *mut bindings::VipsImage = null_mut();
20148
20149        let source_space_in: i32 = colourspace_options.source_space as i32;
20150        let source_space_in_name = utils::new_c_string("source-space")?;
20151
20152        let vips_op_response = bindings::vips_colourspace(
20153            inp_in,
20154            &mut out_out,
20155            space_in.try_into().unwrap(),
20156            source_space_in_name.as_ptr(),
20157            source_space_in,
20158            NULL,
20159        );
20160        utils::result(
20161            vips_op_response,
20162            VipsImage { ctx: out_out },
20163            Error::ColourspaceError,
20164        )
20165    }
20166}
20167
20168/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20169/// inp: `&VipsImage` -> Input image
20170/// returns `VipsImage` - Output image
20171pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20172    unsafe {
20173        let inp_in: *mut bindings::VipsImage = inp.ctx;
20174        let mut out_out: *mut bindings::VipsImage = null_mut();
20175
20176        let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
20177        utils::result(
20178            vips_op_response,
20179            VipsImage { ctx: out_out },
20180            Error::Lab2XyzError,
20181        )
20182    }
20183}
20184
20185/// Options for lab_2xyz operation
20186#[derive(Clone, Debug)]
20187pub struct Lab2XyzOptions {
20188    /// temp: `Vec<f64>` -> Color temperature
20189    pub temp: Vec<f64>,
20190}
20191
20192impl std::default::Default for Lab2XyzOptions {
20193    fn default() -> Self {
20194        Lab2XyzOptions { temp: Vec::new() }
20195    }
20196}
20197
20198/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20199/// inp: `&VipsImage` -> Input image
20200/// lab_2xyz_options: `&Lab2XyzOptions` -> optional arguments
20201/// returns `VipsImage` - Output image
20202pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
20203    unsafe {
20204        let inp_in: *mut bindings::VipsImage = inp.ctx;
20205        let mut out_out: *mut bindings::VipsImage = null_mut();
20206
20207        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
20208        let temp_in = temp_wrapper.ctx;
20209        let temp_in_name = utils::new_c_string("temp")?;
20210
20211        let vips_op_response =
20212            bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20213        utils::result(
20214            vips_op_response,
20215            VipsImage { ctx: out_out },
20216            Error::Lab2XyzError,
20217        )
20218    }
20219}
20220
20221/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20222/// inp: `&VipsImage` -> Input image
20223/// returns `VipsImage` - Output image
20224pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
20225    unsafe {
20226        let inp_in: *mut bindings::VipsImage = inp.ctx;
20227        let mut out_out: *mut bindings::VipsImage = null_mut();
20228
20229        let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
20230        utils::result(
20231            vips_op_response,
20232            VipsImage { ctx: out_out },
20233            Error::Xyz2LabError,
20234        )
20235    }
20236}
20237
20238/// Options for xyz2_lab operation
20239#[derive(Clone, Debug)]
20240pub struct Xyz2LabOptions {
20241    /// temp: `Vec<f64>` -> Colour temperature
20242    pub temp: Vec<f64>,
20243}
20244
20245impl std::default::Default for Xyz2LabOptions {
20246    fn default() -> Self {
20247        Xyz2LabOptions { temp: Vec::new() }
20248    }
20249}
20250
20251/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20252/// inp: `&VipsImage` -> Input image
20253/// xyz2_lab_options: `&Xyz2LabOptions` -> optional arguments
20254/// returns `VipsImage` - Output image
20255pub fn xyz2_lab_with_opts(
20256    inp: &VipsImage,
20257    xyz_2_lab_options: &Xyz2LabOptions,
20258) -> Result<VipsImage> {
20259    unsafe {
20260        let inp_in: *mut bindings::VipsImage = inp.ctx;
20261        let mut out_out: *mut bindings::VipsImage = null_mut();
20262
20263        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
20264        let temp_in = temp_wrapper.ctx;
20265        let temp_in_name = utils::new_c_string("temp")?;
20266
20267        let vips_op_response =
20268            bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20269        utils::result(
20270            vips_op_response,
20271            VipsImage { ctx: out_out },
20272            Error::Xyz2LabError,
20273        )
20274    }
20275}
20276
20277/// VipsLab2LCh (Lab2LCh), transform Lab to LCh
20278/// inp: `&VipsImage` -> Input image
20279/// returns `VipsImage` - Output image
20280pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20281    unsafe {
20282        let inp_in: *mut bindings::VipsImage = inp.ctx;
20283        let mut out_out: *mut bindings::VipsImage = null_mut();
20284
20285        let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
20286        utils::result(
20287            vips_op_response,
20288            VipsImage { ctx: out_out },
20289            Error::Lab2LChError,
20290        )
20291    }
20292}
20293
20294/// VipsLCh2Lab (LCh2Lab), transform LCh to Lab
20295/// inp: `&VipsImage` -> Input image
20296/// returns `VipsImage` - Output image
20297pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
20298    unsafe {
20299        let inp_in: *mut bindings::VipsImage = inp.ctx;
20300        let mut out_out: *mut bindings::VipsImage = null_mut();
20301
20302        let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
20303        utils::result(
20304            vips_op_response,
20305            VipsImage { ctx: out_out },
20306            Error::LCh2LabError,
20307        )
20308    }
20309}
20310
20311/// VipsLCh2CMC (LCh2CMC), transform LCh to CMC
20312/// inp: `&VipsImage` -> Input image
20313/// returns `VipsImage` - Output image
20314pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
20315    unsafe {
20316        let inp_in: *mut bindings::VipsImage = inp.ctx;
20317        let mut out_out: *mut bindings::VipsImage = null_mut();
20318
20319        let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
20320        utils::result(
20321            vips_op_response,
20322            VipsImage { ctx: out_out },
20323            Error::LCh2CmcError,
20324        )
20325    }
20326}
20327
20328/// VipsCMC2LCh (CMC2LCh), transform LCh to CMC
20329/// inp: `&VipsImage` -> Input image
20330/// returns `VipsImage` - Output image
20331pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20332    unsafe {
20333        let inp_in: *mut bindings::VipsImage = inp.ctx;
20334        let mut out_out: *mut bindings::VipsImage = null_mut();
20335
20336        let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
20337        utils::result(
20338            vips_op_response,
20339            VipsImage { ctx: out_out },
20340            Error::Cmc2LChError,
20341        )
20342    }
20343}
20344
20345/// VipsXYZ2Yxy (XYZ2Yxy), transform XYZ to Yxy
20346/// inp: `&VipsImage` -> Input image
20347/// returns `VipsImage` - Output image
20348pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
20349    unsafe {
20350        let inp_in: *mut bindings::VipsImage = inp.ctx;
20351        let mut out_out: *mut bindings::VipsImage = null_mut();
20352
20353        let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
20354        utils::result(
20355            vips_op_response,
20356            VipsImage { ctx: out_out },
20357            Error::Xyz2YxyError,
20358        )
20359    }
20360}
20361
20362/// VipsYxy2XYZ (Yxy2XYZ), transform Yxy to XYZ
20363/// inp: `&VipsImage` -> Input image
20364/// returns `VipsImage` - Output image
20365pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20366    unsafe {
20367        let inp_in: *mut bindings::VipsImage = inp.ctx;
20368        let mut out_out: *mut bindings::VipsImage = null_mut();
20369
20370        let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
20371        utils::result(
20372            vips_op_response,
20373            VipsImage { ctx: out_out },
20374            Error::Yxy2XyzError,
20375        )
20376    }
20377}
20378
20379/// VipsLabQ2Lab (LabQ2Lab), unpack a LabQ image to float Lab
20380/// inp: `&VipsImage` -> Input image
20381/// returns `VipsImage` - Output image
20382pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
20383    unsafe {
20384        let inp_in: *mut bindings::VipsImage = inp.ctx;
20385        let mut out_out: *mut bindings::VipsImage = null_mut();
20386
20387        let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
20388        utils::result(
20389            vips_op_response,
20390            VipsImage { ctx: out_out },
20391            Error::LabQ2LabError,
20392        )
20393    }
20394}
20395
20396/// VipsLab2LabQ (Lab2LabQ), transform float Lab to LabQ coding
20397/// inp: `&VipsImage` -> Input image
20398/// returns `VipsImage` - Output image
20399pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20400    unsafe {
20401        let inp_in: *mut bindings::VipsImage = inp.ctx;
20402        let mut out_out: *mut bindings::VipsImage = null_mut();
20403
20404        let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20405        utils::result(
20406            vips_op_response,
20407            VipsImage { ctx: out_out },
20408            Error::Lab2LabQError,
20409        )
20410    }
20411}
20412
20413/// VipsLabQ2LabS (LabQ2LabS), unpack a LabQ image to short Lab
20414/// inp: `&VipsImage` -> Input image
20415/// returns `VipsImage` - Output image
20416pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20417    unsafe {
20418        let inp_in: *mut bindings::VipsImage = inp.ctx;
20419        let mut out_out: *mut bindings::VipsImage = null_mut();
20420
20421        let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20422        utils::result(
20423            vips_op_response,
20424            VipsImage { ctx: out_out },
20425            Error::LabQ2LabSError,
20426        )
20427    }
20428}
20429
20430/// VipsLabS2LabQ (LabS2LabQ), transform short Lab to LabQ coding
20431/// inp: `&VipsImage` -> Input image
20432/// returns `VipsImage` - Output image
20433pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20434    unsafe {
20435        let inp_in: *mut bindings::VipsImage = inp.ctx;
20436        let mut out_out: *mut bindings::VipsImage = null_mut();
20437
20438        let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20439        utils::result(
20440            vips_op_response,
20441            VipsImage { ctx: out_out },
20442            Error::LabS2LabQError,
20443        )
20444    }
20445}
20446
20447/// VipsLabS2Lab (LabS2Lab), transform signed short Lab to float
20448/// inp: `&VipsImage` -> Input image
20449/// returns `VipsImage` - Output image
20450pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20451    unsafe {
20452        let inp_in: *mut bindings::VipsImage = inp.ctx;
20453        let mut out_out: *mut bindings::VipsImage = null_mut();
20454
20455        let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20456        utils::result(
20457            vips_op_response,
20458            VipsImage { ctx: out_out },
20459            Error::LabS2LabError,
20460        )
20461    }
20462}
20463
20464/// VipsLab2LabS (Lab2LabS), transform float Lab to signed short
20465/// inp: `&VipsImage` -> Input image
20466/// returns `VipsImage` - Output image
20467pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20468    unsafe {
20469        let inp_in: *mut bindings::VipsImage = inp.ctx;
20470        let mut out_out: *mut bindings::VipsImage = null_mut();
20471
20472        let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20473        utils::result(
20474            vips_op_response,
20475            VipsImage { ctx: out_out },
20476            Error::Lab2LabSError,
20477        )
20478    }
20479}
20480
20481/// VipsRad2float (rad2float), unpack Radiance coding to float RGB
20482/// inp: `&VipsImage` -> Input image
20483/// returns `VipsImage` - Output image
20484pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20485    unsafe {
20486        let inp_in: *mut bindings::VipsImage = inp.ctx;
20487        let mut out_out: *mut bindings::VipsImage = null_mut();
20488
20489        let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20490        utils::result(
20491            vips_op_response,
20492            VipsImage { ctx: out_out },
20493            Error::Rad2FloatError,
20494        )
20495    }
20496}
20497
20498/// VipsFloat2rad (float2rad), transform float RGB to Radiance coding
20499/// inp: `&VipsImage` -> Input image
20500/// returns `VipsImage` - Output image
20501pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20502    unsafe {
20503        let inp_in: *mut bindings::VipsImage = inp.ctx;
20504        let mut out_out: *mut bindings::VipsImage = null_mut();
20505
20506        let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20507        utils::result(
20508            vips_op_response,
20509            VipsImage { ctx: out_out },
20510            Error::Float2RadError,
20511        )
20512    }
20513}
20514
20515/// VipsLabQ2sRGB (LabQ2sRGB), convert a LabQ image to sRGB
20516/// inp: `&VipsImage` -> Input image
20517/// returns `VipsImage` - Output image
20518pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20519    unsafe {
20520        let inp_in: *mut bindings::VipsImage = inp.ctx;
20521        let mut out_out: *mut bindings::VipsImage = null_mut();
20522
20523        let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20524        utils::result(
20525            vips_op_response,
20526            VipsImage { ctx: out_out },
20527            Error::LabQ2SRgbError,
20528        )
20529    }
20530}
20531
20532/// VipssRGB2HSV (sRGB2HSV), transform sRGB to HSV
20533/// inp: `&VipsImage` -> Input image
20534/// returns `VipsImage` - Output image
20535pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20536    unsafe {
20537        let inp_in: *mut bindings::VipsImage = inp.ctx;
20538        let mut out_out: *mut bindings::VipsImage = null_mut();
20539
20540        let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20541        utils::result(
20542            vips_op_response,
20543            VipsImage { ctx: out_out },
20544            Error::SRgb2HsvError,
20545        )
20546    }
20547}
20548
20549/// VipsHSV2sRGB (HSV2sRGB), transform HSV to sRGB
20550/// inp: `&VipsImage` -> Input image
20551/// returns `VipsImage` - Output image
20552pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20553    unsafe {
20554        let inp_in: *mut bindings::VipsImage = inp.ctx;
20555        let mut out_out: *mut bindings::VipsImage = null_mut();
20556
20557        let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20558        utils::result(
20559            vips_op_response,
20560            VipsImage { ctx: out_out },
20561            Error::Hsv2SRgbError,
20562        )
20563    }
20564}
20565
20566/// VipsIccImport (icc_import), import from device with ICC profile
20567/// inp: `&VipsImage` -> Input image
20568/// returns `VipsImage` - Output image
20569pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20570    unsafe {
20571        let inp_in: *mut bindings::VipsImage = inp.ctx;
20572        let mut out_out: *mut bindings::VipsImage = null_mut();
20573
20574        let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20575        utils::result(
20576            vips_op_response,
20577            VipsImage { ctx: out_out },
20578            Error::IccImportError,
20579        )
20580    }
20581}
20582
20583/// Options for icc_import operation
20584#[derive(Clone, Debug)]
20585pub struct IccImportOptions {
20586    /// pcs: `PCS` -> Set Profile Connection Space
20587    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20588    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20589    ///  `Last` -> VIPS_PCS_LAST = 2
20590    pub pcs: PCS,
20591    /// intent: `Intent` -> Rendering intent
20592    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20593    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20594    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20595    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20596    ///  `Last` -> VIPS_INTENT_LAST = 4
20597    pub intent: Intent,
20598    /// black_point_compensation: `bool` -> Enable black point compensation
20599    /// default: false
20600    pub black_point_compensation: bool,
20601    /// embedded: `bool` -> Use embedded input profile, if available
20602    /// default: false
20603    pub embedded: bool,
20604    /// input_profile: `String` -> Filename to load input profile from
20605    pub input_profile: String,
20606}
20607
20608impl std::default::Default for IccImportOptions {
20609    fn default() -> Self {
20610        IccImportOptions {
20611            pcs: PCS::Lab,
20612            intent: Intent::Relative,
20613            black_point_compensation: false,
20614            embedded: false,
20615            input_profile: String::new(),
20616        }
20617    }
20618}
20619
20620/// VipsIccImport (icc_import), import from device with ICC profile
20621/// inp: `&VipsImage` -> Input image
20622/// icc_import_options: `&IccImportOptions` -> optional arguments
20623/// returns `VipsImage` - Output image
20624pub fn icc_import_with_opts(
20625    inp: &VipsImage,
20626    icc_import_options: &IccImportOptions,
20627) -> Result<VipsImage> {
20628    unsafe {
20629        let inp_in: *mut bindings::VipsImage = inp.ctx;
20630        let mut out_out: *mut bindings::VipsImage = null_mut();
20631
20632        let pcs_in: i32 = icc_import_options.pcs as i32;
20633        let pcs_in_name = utils::new_c_string("pcs")?;
20634
20635        let intent_in: i32 = icc_import_options.intent as i32;
20636        let intent_in_name = utils::new_c_string("intent")?;
20637
20638        let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
20639            1
20640        } else {
20641            0
20642        };
20643        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20644
20645        let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
20646        let embedded_in_name = utils::new_c_string("embedded")?;
20647
20648        let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
20649        let input_profile_in_name = utils::new_c_string("input-profile")?;
20650
20651        let vips_op_response = bindings::vips_icc_import(
20652            inp_in,
20653            &mut out_out,
20654            pcs_in_name.as_ptr(),
20655            pcs_in,
20656            intent_in_name.as_ptr(),
20657            intent_in,
20658            black_point_compensation_in_name.as_ptr(),
20659            black_point_compensation_in,
20660            embedded_in_name.as_ptr(),
20661            embedded_in,
20662            input_profile_in_name.as_ptr(),
20663            input_profile_in.as_ptr(),
20664            NULL,
20665        );
20666        utils::result(
20667            vips_op_response,
20668            VipsImage { ctx: out_out },
20669            Error::IccImportError,
20670        )
20671    }
20672}
20673
20674/// VipsIccExport (icc_export), output to device with ICC profile
20675/// inp: `&VipsImage` -> Input image
20676/// returns `VipsImage` - Output image
20677pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
20678    unsafe {
20679        let inp_in: *mut bindings::VipsImage = inp.ctx;
20680        let mut out_out: *mut bindings::VipsImage = null_mut();
20681
20682        let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
20683        utils::result(
20684            vips_op_response,
20685            VipsImage { ctx: out_out },
20686            Error::IccExportError,
20687        )
20688    }
20689}
20690
20691/// Options for icc_export operation
20692#[derive(Clone, Debug)]
20693pub struct IccExportOptions {
20694    /// pcs: `PCS` -> Set Profile Connection Space
20695    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20696    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20697    ///  `Last` -> VIPS_PCS_LAST = 2
20698    pub pcs: PCS,
20699    /// intent: `Intent` -> Rendering intent
20700    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20701    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20702    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20703    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20704    ///  `Last` -> VIPS_INTENT_LAST = 4
20705    pub intent: Intent,
20706    /// black_point_compensation: `bool` -> Enable black point compensation
20707    /// default: false
20708    pub black_point_compensation: bool,
20709    /// output_profile: `String` -> Filename to load output profile from
20710    pub output_profile: String,
20711    /// depth: `i32` -> Output device space depth in bits
20712    /// min: 8, max: 16, default: 8
20713    pub depth: i32,
20714}
20715
20716impl std::default::Default for IccExportOptions {
20717    fn default() -> Self {
20718        IccExportOptions {
20719            pcs: PCS::Lab,
20720            intent: Intent::Relative,
20721            black_point_compensation: false,
20722            output_profile: String::new(),
20723            depth: i32::from(8),
20724        }
20725    }
20726}
20727
20728/// VipsIccExport (icc_export), output to device with ICC profile
20729/// inp: `&VipsImage` -> Input image
20730/// icc_export_options: `&IccExportOptions` -> optional arguments
20731/// returns `VipsImage` - Output image
20732pub fn icc_export_with_opts(
20733    inp: &VipsImage,
20734    icc_export_options: &IccExportOptions,
20735) -> Result<VipsImage> {
20736    unsafe {
20737        let inp_in: *mut bindings::VipsImage = inp.ctx;
20738        let mut out_out: *mut bindings::VipsImage = null_mut();
20739
20740        let pcs_in: i32 = icc_export_options.pcs as i32;
20741        let pcs_in_name = utils::new_c_string("pcs")?;
20742
20743        let intent_in: i32 = icc_export_options.intent as i32;
20744        let intent_in_name = utils::new_c_string("intent")?;
20745
20746        let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
20747            1
20748        } else {
20749            0
20750        };
20751        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20752
20753        let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
20754        let output_profile_in_name = utils::new_c_string("output-profile")?;
20755
20756        let depth_in: i32 = icc_export_options.depth;
20757        let depth_in_name = utils::new_c_string("depth")?;
20758
20759        let vips_op_response = bindings::vips_icc_export(
20760            inp_in,
20761            &mut out_out,
20762            pcs_in_name.as_ptr(),
20763            pcs_in,
20764            intent_in_name.as_ptr(),
20765            intent_in,
20766            black_point_compensation_in_name.as_ptr(),
20767            black_point_compensation_in,
20768            output_profile_in_name.as_ptr(),
20769            output_profile_in.as_ptr(),
20770            depth_in_name.as_ptr(),
20771            depth_in,
20772            NULL,
20773        );
20774        utils::result(
20775            vips_op_response,
20776            VipsImage { ctx: out_out },
20777            Error::IccExportError,
20778        )
20779    }
20780}
20781
20782/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
20783/// inp: `&VipsImage` -> Input image
20784/// output_profile: `&str` -> Filename to load output profile from
20785/// returns `VipsImage` - Output image
20786pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
20787    unsafe {
20788        let inp_in: *mut bindings::VipsImage = inp.ctx;
20789        let output_profile_in: CString = utils::new_c_string(output_profile)?;
20790        let mut out_out: *mut bindings::VipsImage = null_mut();
20791
20792        let vips_op_response =
20793            bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
20794        utils::result(
20795            vips_op_response,
20796            VipsImage { ctx: out_out },
20797            Error::IccTransformError,
20798        )
20799    }
20800}
20801
20802/// Options for icc_transform operation
20803#[derive(Clone, Debug)]
20804pub struct IccTransformOptions {
20805    /// pcs: `PCS` -> Set Profile Connection Space
20806    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20807    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20808    ///  `Last` -> VIPS_PCS_LAST = 2
20809    pub pcs: PCS,
20810    /// intent: `Intent` -> Rendering intent
20811    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20812    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20813    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20814    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20815    ///  `Last` -> VIPS_INTENT_LAST = 4
20816    pub intent: Intent,
20817    /// black_point_compensation: `bool` -> Enable black point compensation
20818    /// default: false
20819    pub black_point_compensation: bool,
20820    /// embedded: `bool` -> Use embedded input profile, if available
20821    /// default: false
20822    pub embedded: bool,
20823    /// input_profile: `String` -> Filename to load input profile from
20824    pub input_profile: String,
20825    /// depth: `i32` -> Output device space depth in bits
20826    /// min: 8, max: 16, default: 8
20827    pub depth: i32,
20828}
20829
20830impl std::default::Default for IccTransformOptions {
20831    fn default() -> Self {
20832        IccTransformOptions {
20833            pcs: PCS::Lab,
20834            intent: Intent::Relative,
20835            black_point_compensation: false,
20836            embedded: false,
20837            input_profile: String::new(),
20838            depth: i32::from(8),
20839        }
20840    }
20841}
20842
20843/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
20844/// inp: `&VipsImage` -> Input image
20845/// output_profile: `&str` -> Filename to load output profile from
20846/// icc_transform_options: `&IccTransformOptions` -> optional arguments
20847/// returns `VipsImage` - Output image
20848pub fn icc_transform_with_opts(
20849    inp: &VipsImage,
20850    output_profile: &str,
20851    icc_transform_options: &IccTransformOptions,
20852) -> Result<VipsImage> {
20853    unsafe {
20854        let inp_in: *mut bindings::VipsImage = inp.ctx;
20855        let output_profile_in: CString = utils::new_c_string(output_profile)?;
20856        let mut out_out: *mut bindings::VipsImage = null_mut();
20857
20858        let pcs_in: i32 = icc_transform_options.pcs as i32;
20859        let pcs_in_name = utils::new_c_string("pcs")?;
20860
20861        let intent_in: i32 = icc_transform_options.intent as i32;
20862        let intent_in_name = utils::new_c_string("intent")?;
20863
20864        let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
20865            1
20866        } else {
20867            0
20868        };
20869        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20870
20871        let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
20872        let embedded_in_name = utils::new_c_string("embedded")?;
20873
20874        let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
20875        let input_profile_in_name = utils::new_c_string("input-profile")?;
20876
20877        let depth_in: i32 = icc_transform_options.depth;
20878        let depth_in_name = utils::new_c_string("depth")?;
20879
20880        let vips_op_response = bindings::vips_icc_transform(
20881            inp_in,
20882            &mut out_out,
20883            output_profile_in.as_ptr(),
20884            pcs_in_name.as_ptr(),
20885            pcs_in,
20886            intent_in_name.as_ptr(),
20887            intent_in,
20888            black_point_compensation_in_name.as_ptr(),
20889            black_point_compensation_in,
20890            embedded_in_name.as_ptr(),
20891            embedded_in,
20892            input_profile_in_name.as_ptr(),
20893            input_profile_in.as_ptr(),
20894            depth_in_name.as_ptr(),
20895            depth_in,
20896            NULL,
20897        );
20898        utils::result(
20899            vips_op_response,
20900            VipsImage { ctx: out_out },
20901            Error::IccTransformError,
20902        )
20903    }
20904}
20905
20906/// VipsdE76 (dE76), calculate dE76
20907/// left: `&VipsImage` -> Left-hand input image
20908/// right: `&VipsImage` -> Right-hand input image
20909/// returns `VipsImage` - Output image
20910pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20911    unsafe {
20912        let left_in: *mut bindings::VipsImage = left.ctx;
20913        let right_in: *mut bindings::VipsImage = right.ctx;
20914        let mut out_out: *mut bindings::VipsImage = null_mut();
20915
20916        let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
20917        utils::result(
20918            vips_op_response,
20919            VipsImage { ctx: out_out },
20920            Error::DE76Error,
20921        )
20922    }
20923}
20924
20925/// VipsdE00 (dE00), calculate dE00
20926/// left: `&VipsImage` -> Left-hand input image
20927/// right: `&VipsImage` -> Right-hand input image
20928/// returns `VipsImage` - Output image
20929pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20930    unsafe {
20931        let left_in: *mut bindings::VipsImage = left.ctx;
20932        let right_in: *mut bindings::VipsImage = right.ctx;
20933        let mut out_out: *mut bindings::VipsImage = null_mut();
20934
20935        let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
20936        utils::result(
20937            vips_op_response,
20938            VipsImage { ctx: out_out },
20939            Error::DE00Error,
20940        )
20941    }
20942}
20943
20944/// VipsdECMC (dECMC), calculate dECMC
20945/// left: `&VipsImage` -> Left-hand input image
20946/// right: `&VipsImage` -> Right-hand input image
20947/// returns `VipsImage` - Output image
20948pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20949    unsafe {
20950        let left_in: *mut bindings::VipsImage = left.ctx;
20951        let right_in: *mut bindings::VipsImage = right.ctx;
20952        let mut out_out: *mut bindings::VipsImage = null_mut();
20953
20954        let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
20955        utils::result(
20956            vips_op_response,
20957            VipsImage { ctx: out_out },
20958            Error::DEcmcError,
20959        )
20960    }
20961}
20962
20963/// VipssRGB2scRGB (sRGB2scRGB), convert an sRGB image to scRGB
20964/// inp: `&VipsImage` -> Input image
20965/// returns `VipsImage` - Output image
20966pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20967    unsafe {
20968        let inp_in: *mut bindings::VipsImage = inp.ctx;
20969        let mut out_out: *mut bindings::VipsImage = null_mut();
20970
20971        let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20972        utils::result(
20973            vips_op_response,
20974            VipsImage { ctx: out_out },
20975            Error::SRgb2ScRgbError,
20976        )
20977    }
20978}
20979
20980/// VipsscRGB2XYZ (scRGB2XYZ), transform scRGB to XYZ
20981/// inp: `&VipsImage` -> Input image
20982/// returns `VipsImage` - Output image
20983pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20984    unsafe {
20985        let inp_in: *mut bindings::VipsImage = inp.ctx;
20986        let mut out_out: *mut bindings::VipsImage = null_mut();
20987
20988        let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20989        utils::result(
20990            vips_op_response,
20991            VipsImage { ctx: out_out },
20992            Error::ScRgb2XyzError,
20993        )
20994    }
20995}
20996
20997/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20998/// inp: `&VipsImage` -> Input image
20999/// returns `VipsImage` - Output image
21000pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
21001    unsafe {
21002        let inp_in: *mut bindings::VipsImage = inp.ctx;
21003        let mut out_out: *mut bindings::VipsImage = null_mut();
21004
21005        let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
21006        utils::result(
21007            vips_op_response,
21008            VipsImage { ctx: out_out },
21009            Error::ScRgb2BwError,
21010        )
21011    }
21012}
21013
21014/// Options for sc_rgb2bw operation
21015#[derive(Clone, Debug)]
21016pub struct ScRgb2BwOptions {
21017    /// depth: `i32` -> Output device space depth in bits
21018    /// min: 8, max: 16, default: 8
21019    pub depth: i32,
21020}
21021
21022impl std::default::Default for ScRgb2BwOptions {
21023    fn default() -> Self {
21024        ScRgb2BwOptions {
21025            depth: i32::from(8),
21026        }
21027    }
21028}
21029
21030/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
21031/// inp: `&VipsImage` -> Input image
21032/// sc_rgb2bw_options: `&ScRgb2BwOptions` -> optional arguments
21033/// returns `VipsImage` - Output image
21034pub fn sc_rgb2bw_with_opts(
21035    inp: &VipsImage,
21036    sc_rgb_2bw_options: &ScRgb2BwOptions,
21037) -> Result<VipsImage> {
21038    unsafe {
21039        let inp_in: *mut bindings::VipsImage = inp.ctx;
21040        let mut out_out: *mut bindings::VipsImage = null_mut();
21041
21042        let depth_in: i32 = sc_rgb_2bw_options.depth;
21043        let depth_in_name = utils::new_c_string("depth")?;
21044
21045        let vips_op_response =
21046            bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
21047        utils::result(
21048            vips_op_response,
21049            VipsImage { ctx: out_out },
21050            Error::ScRgb2BwError,
21051        )
21052    }
21053}
21054
21055/// VipsXYZ2scRGB (XYZ2scRGB), transform XYZ to scRGB
21056/// inp: `&VipsImage` -> Input image
21057/// returns `VipsImage` - Output image
21058pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
21059    unsafe {
21060        let inp_in: *mut bindings::VipsImage = inp.ctx;
21061        let mut out_out: *mut bindings::VipsImage = null_mut();
21062
21063        let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
21064        utils::result(
21065            vips_op_response,
21066            VipsImage { ctx: out_out },
21067            Error::Xyz2ScRgbError,
21068        )
21069    }
21070}
21071
21072/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
21073/// inp: `&VipsImage` -> Input image
21074/// returns `VipsImage` - Output image
21075pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
21076    unsafe {
21077        let inp_in: *mut bindings::VipsImage = inp.ctx;
21078        let mut out_out: *mut bindings::VipsImage = null_mut();
21079
21080        let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
21081        utils::result(
21082            vips_op_response,
21083            VipsImage { ctx: out_out },
21084            Error::ScRgb2SRgbError,
21085        )
21086    }
21087}
21088
21089/// Options for sc_rgb_2s_rgb operation
21090#[derive(Clone, Debug)]
21091pub struct ScRgb2SRgbOptions {
21092    /// depth: `i32` -> Output device space depth in bits
21093    /// min: 8, max: 16, default: 8
21094    pub depth: i32,
21095}
21096
21097impl std::default::Default for ScRgb2SRgbOptions {
21098    fn default() -> Self {
21099        ScRgb2SRgbOptions {
21100            depth: i32::from(8),
21101        }
21102    }
21103}
21104
21105/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
21106/// inp: `&VipsImage` -> Input image
21107/// sc_rgb_2s_rgb_options: `&ScRgb2SRgbOptions` -> optional arguments
21108/// returns `VipsImage` - Output image
21109pub fn sc_rgb_2s_rgb_with_opts(
21110    inp: &VipsImage,
21111    sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
21112) -> Result<VipsImage> {
21113    unsafe {
21114        let inp_in: *mut bindings::VipsImage = inp.ctx;
21115        let mut out_out: *mut bindings::VipsImage = null_mut();
21116
21117        let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
21118        let depth_in_name = utils::new_c_string("depth")?;
21119
21120        let vips_op_response =
21121            bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
21122        utils::result(
21123            vips_op_response,
21124            VipsImage { ctx: out_out },
21125            Error::ScRgb2SRgbError,
21126        )
21127    }
21128}
21129
21130/// VipsCMYK2XYZ (CMYK2XYZ), transform CMYK to XYZ
21131/// inp: `&VipsImage` -> Input image
21132/// returns `VipsImage` - Output image
21133pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
21134    unsafe {
21135        let inp_in: *mut bindings::VipsImage = inp.ctx;
21136        let mut out_out: *mut bindings::VipsImage = null_mut();
21137
21138        let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
21139        utils::result(
21140            vips_op_response,
21141            VipsImage { ctx: out_out },
21142            Error::Cmyk2XyzError,
21143        )
21144    }
21145}
21146
21147/// VipsXYZ2CMYK (XYZ2CMYK), transform XYZ to CMYK
21148/// inp: `&VipsImage` -> Input image
21149/// returns `VipsImage` - Output image
21150pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
21151    unsafe {
21152        let inp_in: *mut bindings::VipsImage = inp.ctx;
21153        let mut out_out: *mut bindings::VipsImage = null_mut();
21154
21155        let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
21156        utils::result(
21157            vips_op_response,
21158            VipsImage { ctx: out_out },
21159            Error::Xyz2CmykError,
21160        )
21161    }
21162}
21163
21164/// VipsProfileLoad (profile_load), load named ICC profile
21165/// name: `&str` -> Profile name
21166/// returns `Vec<u8>` - Loaded profile
21167pub fn profile_load(name: &str) -> Result<Vec<u8>> {
21168    unsafe {
21169        let name_in: CString = utils::new_c_string(name)?;
21170        let mut profile_out: *mut bindings::VipsBlob = null_mut();
21171
21172        let vips_op_response =
21173            bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
21174        utils::result(
21175            vips_op_response,
21176            VipsBlob { ctx: profile_out }.into(),
21177            Error::ProfileLoadError,
21178        )
21179    }
21180}
21181
21182/// VipsMaplut (maplut), map an image though a lut
21183/// inp: `&VipsImage` -> Input image
21184/// lut: `&VipsImage` -> Look-up table image
21185/// returns `VipsImage` - Output image
21186pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
21187    unsafe {
21188        let inp_in: *mut bindings::VipsImage = inp.ctx;
21189        let lut_in: *mut bindings::VipsImage = lut.ctx;
21190        let mut out_out: *mut bindings::VipsImage = null_mut();
21191
21192        let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
21193        utils::result(
21194            vips_op_response,
21195            VipsImage { ctx: out_out },
21196            Error::MaplutError,
21197        )
21198    }
21199}
21200
21201/// Options for maplut operation
21202#[derive(Clone, Debug)]
21203pub struct MaplutOptions {
21204    /// band: `i32` -> Apply one-band lut to this band of in
21205    /// min: -1, max: 10000, default: -1
21206    pub band: i32,
21207}
21208
21209impl std::default::Default for MaplutOptions {
21210    fn default() -> Self {
21211        MaplutOptions {
21212            band: i32::from(-1),
21213        }
21214    }
21215}
21216
21217/// VipsMaplut (maplut), map an image though a lut
21218/// inp: `&VipsImage` -> Input image
21219/// lut: `&VipsImage` -> Look-up table image
21220/// maplut_options: `&MaplutOptions` -> optional arguments
21221/// returns `VipsImage` - Output image
21222pub fn maplut_with_opts(
21223    inp: &VipsImage,
21224    lut: &VipsImage,
21225    maplut_options: &MaplutOptions,
21226) -> Result<VipsImage> {
21227    unsafe {
21228        let inp_in: *mut bindings::VipsImage = inp.ctx;
21229        let lut_in: *mut bindings::VipsImage = lut.ctx;
21230        let mut out_out: *mut bindings::VipsImage = null_mut();
21231
21232        let band_in: i32 = maplut_options.band;
21233        let band_in_name = utils::new_c_string("band")?;
21234
21235        let vips_op_response = bindings::vips_maplut(
21236            inp_in,
21237            &mut out_out,
21238            lut_in,
21239            band_in_name.as_ptr(),
21240            band_in,
21241            NULL,
21242        );
21243        utils::result(
21244            vips_op_response,
21245            VipsImage { ctx: out_out },
21246            Error::MaplutError,
21247        )
21248    }
21249}
21250
21251/// VipsPercent (percent), find threshold for percent of pixels
21252/// inp: `&VipsImage` -> Input image
21253/// percent: `f64` -> Percent of pixels
21254/// min: 0, max: 100, default: 50
21255/// returns `i32` - Threshold above which lie percent of pixels
21256pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
21257    unsafe {
21258        let inp_in: *mut bindings::VipsImage = inp.ctx;
21259        let percent_in: f64 = percent;
21260        let mut threshold_out: i32 = i32::from(0);
21261
21262        let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
21263        utils::result(vips_op_response, threshold_out, Error::PercentError)
21264    }
21265}
21266
21267/// VipsStdif (stdif), statistical difference
21268/// inp: `&VipsImage` -> Input image
21269/// width: `i32` -> Window width in pixels
21270/// min: 1, max: 256, default: 11
21271/// height: `i32` -> Window height in pixels
21272/// min: 1, max: 256, default: 11
21273/// returns `VipsImage` - Output image
21274pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21275    unsafe {
21276        let inp_in: *mut bindings::VipsImage = inp.ctx;
21277        let width_in: i32 = width;
21278        let height_in: i32 = height;
21279        let mut out_out: *mut bindings::VipsImage = null_mut();
21280
21281        let vips_op_response =
21282            bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
21283        utils::result(
21284            vips_op_response,
21285            VipsImage { ctx: out_out },
21286            Error::StdifError,
21287        )
21288    }
21289}
21290
21291/// Options for stdif operation
21292#[derive(Clone, Debug)]
21293pub struct StdifOptions {
21294    /// s_0: `f64` -> New deviation
21295    /// min: -inf, max: inf, default: 50
21296    pub s_0: f64,
21297    /// b: `f64` -> Weight of new deviation
21298    /// min: 0, max: 2, default: 0.5
21299    pub b: f64,
21300    /// m_0: `f64` -> New mean
21301    /// min: -inf, max: inf, default: 128
21302    pub m_0: f64,
21303    /// a: `f64` -> Weight of new mean
21304    /// min: 0, max: 1, default: 0.5
21305    pub a: f64,
21306}
21307
21308impl std::default::Default for StdifOptions {
21309    fn default() -> Self {
21310        StdifOptions {
21311            s_0: f64::from(50),
21312            b: f64::from(0.5),
21313            m_0: f64::from(128),
21314            a: f64::from(0.5),
21315        }
21316    }
21317}
21318
21319/// VipsStdif (stdif), statistical difference
21320/// inp: `&VipsImage` -> Input image
21321/// width: `i32` -> Window width in pixels
21322/// min: 1, max: 256, default: 11
21323/// height: `i32` -> Window height in pixels
21324/// min: 1, max: 256, default: 11
21325/// stdif_options: `&StdifOptions` -> optional arguments
21326/// returns `VipsImage` - Output image
21327pub fn stdif_with_opts(
21328    inp: &VipsImage,
21329    width: i32,
21330    height: i32,
21331    stdif_options: &StdifOptions,
21332) -> Result<VipsImage> {
21333    unsafe {
21334        let inp_in: *mut bindings::VipsImage = inp.ctx;
21335        let width_in: i32 = width;
21336        let height_in: i32 = height;
21337        let mut out_out: *mut bindings::VipsImage = null_mut();
21338
21339        let s_0_in: f64 = stdif_options.s_0;
21340        let s_0_in_name = utils::new_c_string("s0")?;
21341
21342        let b_in: f64 = stdif_options.b;
21343        let b_in_name = utils::new_c_string("b")?;
21344
21345        let m_0_in: f64 = stdif_options.m_0;
21346        let m_0_in_name = utils::new_c_string("m0")?;
21347
21348        let a_in: f64 = stdif_options.a;
21349        let a_in_name = utils::new_c_string("a")?;
21350
21351        let vips_op_response = bindings::vips_stdif(
21352            inp_in,
21353            &mut out_out,
21354            width_in,
21355            height_in,
21356            s_0_in_name.as_ptr(),
21357            s_0_in,
21358            b_in_name.as_ptr(),
21359            b_in,
21360            m_0_in_name.as_ptr(),
21361            m_0_in,
21362            a_in_name.as_ptr(),
21363            a_in,
21364            NULL,
21365        );
21366        utils::result(
21367            vips_op_response,
21368            VipsImage { ctx: out_out },
21369            Error::StdifError,
21370        )
21371    }
21372}
21373
21374/// VipsHistCum (hist_cum), form cumulative histogram
21375/// inp: `&VipsImage` -> Input image
21376/// returns `VipsImage` - Output image
21377pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
21378    unsafe {
21379        let inp_in: *mut bindings::VipsImage = inp.ctx;
21380        let mut out_out: *mut bindings::VipsImage = null_mut();
21381
21382        let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
21383        utils::result(
21384            vips_op_response,
21385            VipsImage { ctx: out_out },
21386            Error::HistCumError,
21387        )
21388    }
21389}
21390
21391/// VipsHistMatch (hist_match), match two histograms
21392/// inp: `&VipsImage` -> Input histogram
21393/// refp: `&VipsImage` -> Reference histogram
21394/// returns `VipsImage` - Output image
21395pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21396    unsafe {
21397        let inp_in: *mut bindings::VipsImage = inp.ctx;
21398        let refp_in: *mut bindings::VipsImage = refp.ctx;
21399        let mut out_out: *mut bindings::VipsImage = null_mut();
21400
21401        let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21402        utils::result(
21403            vips_op_response,
21404            VipsImage { ctx: out_out },
21405            Error::HistMatchError,
21406        )
21407    }
21408}
21409
21410/// VipsHistNorm (hist_norm), normalise histogram
21411/// inp: `&VipsImage` -> Input image
21412/// returns `VipsImage` - Output image
21413pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21414    unsafe {
21415        let inp_in: *mut bindings::VipsImage = inp.ctx;
21416        let mut out_out: *mut bindings::VipsImage = null_mut();
21417
21418        let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21419        utils::result(
21420            vips_op_response,
21421            VipsImage { ctx: out_out },
21422            Error::HistNormError,
21423        )
21424    }
21425}
21426
21427/// VipsHistEqual (hist_equal), histogram equalisation
21428/// inp: `&VipsImage` -> Input image
21429/// returns `VipsImage` - Output image
21430pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21431    unsafe {
21432        let inp_in: *mut bindings::VipsImage = inp.ctx;
21433        let mut out_out: *mut bindings::VipsImage = null_mut();
21434
21435        let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21436        utils::result(
21437            vips_op_response,
21438            VipsImage { ctx: out_out },
21439            Error::HistEqualError,
21440        )
21441    }
21442}
21443
21444/// Options for hist_equal operation
21445#[derive(Clone, Debug)]
21446pub struct HistEqualOptions {
21447    /// band: `i32` -> Equalise with this band
21448    /// min: -1, max: 100000, default: -1
21449    pub band: i32,
21450}
21451
21452impl std::default::Default for HistEqualOptions {
21453    fn default() -> Self {
21454        HistEqualOptions {
21455            band: i32::from(-1),
21456        }
21457    }
21458}
21459
21460/// VipsHistEqual (hist_equal), histogram equalisation
21461/// inp: `&VipsImage` -> Input image
21462/// hist_equal_options: `&HistEqualOptions` -> optional arguments
21463/// returns `VipsImage` - Output image
21464pub fn hist_equal_with_opts(
21465    inp: &VipsImage,
21466    hist_equal_options: &HistEqualOptions,
21467) -> Result<VipsImage> {
21468    unsafe {
21469        let inp_in: *mut bindings::VipsImage = inp.ctx;
21470        let mut out_out: *mut bindings::VipsImage = null_mut();
21471
21472        let band_in: i32 = hist_equal_options.band;
21473        let band_in_name = utils::new_c_string("band")?;
21474
21475        let vips_op_response =
21476            bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21477        utils::result(
21478            vips_op_response,
21479            VipsImage { ctx: out_out },
21480            Error::HistEqualError,
21481        )
21482    }
21483}
21484
21485/// VipsHistPlot (hist_plot), plot histogram
21486/// inp: `&VipsImage` -> Input image
21487/// returns `VipsImage` - Output image
21488pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21489    unsafe {
21490        let inp_in: *mut bindings::VipsImage = inp.ctx;
21491        let mut out_out: *mut bindings::VipsImage = null_mut();
21492
21493        let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21494        utils::result(
21495            vips_op_response,
21496            VipsImage { ctx: out_out },
21497            Error::HistPlotError,
21498        )
21499    }
21500}
21501
21502/// VipsHistLocal (hist_local), local histogram equalisation
21503/// inp: `&VipsImage` -> Input image
21504/// width: `i32` -> Window width in pixels
21505/// min: 1, max: 100000000, default: 1
21506/// height: `i32` -> Window height in pixels
21507/// min: 1, max: 100000000, default: 1
21508/// returns `VipsImage` - Output image
21509pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21510    unsafe {
21511        let inp_in: *mut bindings::VipsImage = inp.ctx;
21512        let width_in: i32 = width;
21513        let height_in: i32 = height;
21514        let mut out_out: *mut bindings::VipsImage = null_mut();
21515
21516        let vips_op_response =
21517            bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21518        utils::result(
21519            vips_op_response,
21520            VipsImage { ctx: out_out },
21521            Error::HistLocalError,
21522        )
21523    }
21524}
21525
21526/// Options for hist_local operation
21527#[derive(Clone, Debug)]
21528pub struct HistLocalOptions {
21529    /// max_slope: `i32` -> Maximum slope (CLAHE)
21530    /// min: 0, max: 100, default: 0
21531    pub max_slope: i32,
21532}
21533
21534impl std::default::Default for HistLocalOptions {
21535    fn default() -> Self {
21536        HistLocalOptions {
21537            max_slope: i32::from(0),
21538        }
21539    }
21540}
21541
21542/// VipsHistLocal (hist_local), local histogram equalisation
21543/// inp: `&VipsImage` -> Input image
21544/// width: `i32` -> Window width in pixels
21545/// min: 1, max: 100000000, default: 1
21546/// height: `i32` -> Window height in pixels
21547/// min: 1, max: 100000000, default: 1
21548/// hist_local_options: `&HistLocalOptions` -> optional arguments
21549/// returns `VipsImage` - Output image
21550pub fn hist_local_with_opts(
21551    inp: &VipsImage,
21552    width: i32,
21553    height: i32,
21554    hist_local_options: &HistLocalOptions,
21555) -> Result<VipsImage> {
21556    unsafe {
21557        let inp_in: *mut bindings::VipsImage = inp.ctx;
21558        let width_in: i32 = width;
21559        let height_in: i32 = height;
21560        let mut out_out: *mut bindings::VipsImage = null_mut();
21561
21562        let max_slope_in: i32 = hist_local_options.max_slope;
21563        let max_slope_in_name = utils::new_c_string("max-slope")?;
21564
21565        let vips_op_response = bindings::vips_hist_local(
21566            inp_in,
21567            &mut out_out,
21568            width_in,
21569            height_in,
21570            max_slope_in_name.as_ptr(),
21571            max_slope_in,
21572            NULL,
21573        );
21574        utils::result(
21575            vips_op_response,
21576            VipsImage { ctx: out_out },
21577            Error::HistLocalError,
21578        )
21579    }
21580}
21581
21582/// VipsHistIsmonotonic (hist_ismonotonic), test for monotonicity
21583/// inp: `&VipsImage` -> Input histogram image
21584/// returns `bool` - true if in is monotonic
21585pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21586    unsafe {
21587        let inp_in: *mut bindings::VipsImage = inp.ctx;
21588        let mut monotonic_out: i32 = 0;
21589
21590        let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21591        utils::result(
21592            vips_op_response,
21593            monotonic_out != 0,
21594            Error::HistIsmonotonicError,
21595        )
21596    }
21597}
21598
21599/// VipsHistEntropy (hist_entropy), estimate image entropy
21600/// inp: `&VipsImage` -> Input histogram image
21601/// returns `f64` - Output value
21602pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21603    unsafe {
21604        let inp_in: *mut bindings::VipsImage = inp.ctx;
21605        let mut out_out: f64 = f64::from(0);
21606
21607        let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21608        utils::result(vips_op_response, out_out, Error::HistEntropyError)
21609    }
21610}
21611
21612/// VipsConv (conv), convolution operation
21613/// inp: `&VipsImage` -> Input image argument
21614/// mask: `&VipsImage` -> Input matrix image
21615/// returns `VipsImage` - Output image
21616pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21617    unsafe {
21618        let inp_in: *mut bindings::VipsImage = inp.ctx;
21619        let mask_in: *mut bindings::VipsImage = mask.ctx;
21620        let mut out_out: *mut bindings::VipsImage = null_mut();
21621
21622        let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21623        utils::result(
21624            vips_op_response,
21625            VipsImage { ctx: out_out },
21626            Error::ConvError,
21627        )
21628    }
21629}
21630
21631/// Options for conv operation
21632#[derive(Clone, Debug)]
21633pub struct ConvOptions {
21634    /// precision: `Precision` -> Convolve with this precision
21635    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21636    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21637    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21638    ///  `Last` -> VIPS_PRECISION_LAST = 3
21639    pub precision: Precision,
21640    /// layers: `i32` -> Use this many layers in approximation
21641    /// min: 1, max: 1000, default: 5
21642    pub layers: i32,
21643    /// cluster: `i32` -> Cluster lines closer than this in approximation
21644    /// min: 1, max: 100, default: 1
21645    pub cluster: i32,
21646}
21647
21648impl std::default::Default for ConvOptions {
21649    fn default() -> Self {
21650        ConvOptions {
21651            precision: Precision::Float,
21652            layers: i32::from(5),
21653            cluster: i32::from(1),
21654        }
21655    }
21656}
21657
21658/// VipsConv (conv), convolution operation
21659/// inp: `&VipsImage` -> Input image argument
21660/// mask: `&VipsImage` -> Input matrix image
21661/// conv_options: `&ConvOptions` -> optional arguments
21662/// returns `VipsImage` - Output image
21663pub fn conv_with_opts(
21664    inp: &VipsImage,
21665    mask: &VipsImage,
21666    conv_options: &ConvOptions,
21667) -> Result<VipsImage> {
21668    unsafe {
21669        let inp_in: *mut bindings::VipsImage = inp.ctx;
21670        let mask_in: *mut bindings::VipsImage = mask.ctx;
21671        let mut out_out: *mut bindings::VipsImage = null_mut();
21672
21673        let precision_in: i32 = conv_options.precision as i32;
21674        let precision_in_name = utils::new_c_string("precision")?;
21675
21676        let layers_in: i32 = conv_options.layers;
21677        let layers_in_name = utils::new_c_string("layers")?;
21678
21679        let cluster_in: i32 = conv_options.cluster;
21680        let cluster_in_name = utils::new_c_string("cluster")?;
21681
21682        let vips_op_response = bindings::vips_conv(
21683            inp_in,
21684            &mut out_out,
21685            mask_in,
21686            precision_in_name.as_ptr(),
21687            precision_in,
21688            layers_in_name.as_ptr(),
21689            layers_in,
21690            cluster_in_name.as_ptr(),
21691            cluster_in,
21692            NULL,
21693        );
21694        utils::result(
21695            vips_op_response,
21696            VipsImage { ctx: out_out },
21697            Error::ConvError,
21698        )
21699    }
21700}
21701
21702/// VipsConva (conva), approximate integer convolution
21703/// inp: `&VipsImage` -> Input image argument
21704/// mask: `&VipsImage` -> Input matrix image
21705/// returns `VipsImage` - Output image
21706pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21707    unsafe {
21708        let inp_in: *mut bindings::VipsImage = inp.ctx;
21709        let mask_in: *mut bindings::VipsImage = mask.ctx;
21710        let mut out_out: *mut bindings::VipsImage = null_mut();
21711
21712        let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21713        utils::result(
21714            vips_op_response,
21715            VipsImage { ctx: out_out },
21716            Error::ConvaError,
21717        )
21718    }
21719}
21720
21721/// Options for conva operation
21722#[derive(Clone, Debug)]
21723pub struct ConvaOptions {
21724    /// layers: `i32` -> Use this many layers in approximation
21725    /// min: 1, max: 1000, default: 5
21726    pub layers: i32,
21727    /// cluster: `i32` -> Cluster lines closer than this in approximation
21728    /// min: 1, max: 100, default: 1
21729    pub cluster: i32,
21730}
21731
21732impl std::default::Default for ConvaOptions {
21733    fn default() -> Self {
21734        ConvaOptions {
21735            layers: i32::from(5),
21736            cluster: i32::from(1),
21737        }
21738    }
21739}
21740
21741/// VipsConva (conva), approximate integer convolution
21742/// inp: `&VipsImage` -> Input image argument
21743/// mask: `&VipsImage` -> Input matrix image
21744/// conva_options: `&ConvaOptions` -> optional arguments
21745/// returns `VipsImage` - Output image
21746pub fn conva_with_opts(
21747    inp: &VipsImage,
21748    mask: &VipsImage,
21749    conva_options: &ConvaOptions,
21750) -> Result<VipsImage> {
21751    unsafe {
21752        let inp_in: *mut bindings::VipsImage = inp.ctx;
21753        let mask_in: *mut bindings::VipsImage = mask.ctx;
21754        let mut out_out: *mut bindings::VipsImage = null_mut();
21755
21756        let layers_in: i32 = conva_options.layers;
21757        let layers_in_name = utils::new_c_string("layers")?;
21758
21759        let cluster_in: i32 = conva_options.cluster;
21760        let cluster_in_name = utils::new_c_string("cluster")?;
21761
21762        let vips_op_response = bindings::vips_conva(
21763            inp_in,
21764            &mut out_out,
21765            mask_in,
21766            layers_in_name.as_ptr(),
21767            layers_in,
21768            cluster_in_name.as_ptr(),
21769            cluster_in,
21770            NULL,
21771        );
21772        utils::result(
21773            vips_op_response,
21774            VipsImage { ctx: out_out },
21775            Error::ConvaError,
21776        )
21777    }
21778}
21779
21780/// VipsConvf (convf), float convolution operation
21781/// inp: `&VipsImage` -> Input image argument
21782/// mask: `&VipsImage` -> Input matrix image
21783/// returns `VipsImage` - Output image
21784pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21785    unsafe {
21786        let inp_in: *mut bindings::VipsImage = inp.ctx;
21787        let mask_in: *mut bindings::VipsImage = mask.ctx;
21788        let mut out_out: *mut bindings::VipsImage = null_mut();
21789
21790        let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
21791        utils::result(
21792            vips_op_response,
21793            VipsImage { ctx: out_out },
21794            Error::ConvfError,
21795        )
21796    }
21797}
21798
21799/// VipsConvi (convi), int convolution operation
21800/// inp: `&VipsImage` -> Input image argument
21801/// mask: `&VipsImage` -> Input matrix image
21802/// returns `VipsImage` - Output image
21803pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21804    unsafe {
21805        let inp_in: *mut bindings::VipsImage = inp.ctx;
21806        let mask_in: *mut bindings::VipsImage = mask.ctx;
21807        let mut out_out: *mut bindings::VipsImage = null_mut();
21808
21809        let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
21810        utils::result(
21811            vips_op_response,
21812            VipsImage { ctx: out_out },
21813            Error::ConviError,
21814        )
21815    }
21816}
21817
21818/// VipsCompass (compass), convolve with rotating mask
21819/// inp: `&VipsImage` -> Input image argument
21820/// mask: `&VipsImage` -> Input matrix image
21821/// returns `VipsImage` - Output image
21822pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21823    unsafe {
21824        let inp_in: *mut bindings::VipsImage = inp.ctx;
21825        let mask_in: *mut bindings::VipsImage = mask.ctx;
21826        let mut out_out: *mut bindings::VipsImage = null_mut();
21827
21828        let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
21829        utils::result(
21830            vips_op_response,
21831            VipsImage { ctx: out_out },
21832            Error::CompassError,
21833        )
21834    }
21835}
21836
21837/// Options for compass operation
21838#[derive(Clone, Debug)]
21839pub struct CompassOptions {
21840    /// times: `i32` -> Rotate and convolve this many times
21841    /// min: 1, max: 1000, default: 2
21842    pub times: i32,
21843    /// angle: `Angle45` -> Rotate mask by this much between convolutions
21844    ///  `D0` -> VIPS_ANGLE45_D0 = 0
21845    ///  `D45` -> VIPS_ANGLE45_D45 = 1
21846    ///  `D90` -> VIPS_ANGLE45_D90 = 2 [DEFAULT]
21847    ///  `D135` -> VIPS_ANGLE45_D135 = 3
21848    ///  `D180` -> VIPS_ANGLE45_D180 = 4
21849    ///  `D225` -> VIPS_ANGLE45_D225 = 5
21850    ///  `D270` -> VIPS_ANGLE45_D270 = 6
21851    ///  `D315` -> VIPS_ANGLE45_D315 = 7
21852    ///  `Last` -> VIPS_ANGLE45_LAST = 8
21853    pub angle: Angle45,
21854    /// combine: `Combine` -> Combine convolution results like this
21855    ///  `Max` -> VIPS_COMBINE_MAX = 0 [DEFAULT]
21856    ///  `Sum` -> VIPS_COMBINE_SUM = 1
21857    ///  `Min` -> VIPS_COMBINE_MIN = 2
21858    ///  `Last` -> VIPS_COMBINE_LAST = 3
21859    pub combine: Combine,
21860    /// precision: `Precision` -> Convolve with this precision
21861    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21862    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21863    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21864    ///  `Last` -> VIPS_PRECISION_LAST = 3
21865    pub precision: Precision,
21866    /// layers: `i32` -> Use this many layers in approximation
21867    /// min: 1, max: 1000, default: 5
21868    pub layers: i32,
21869    /// cluster: `i32` -> Cluster lines closer than this in approximation
21870    /// min: 1, max: 100, default: 1
21871    pub cluster: i32,
21872}
21873
21874impl std::default::Default for CompassOptions {
21875    fn default() -> Self {
21876        CompassOptions {
21877            times: i32::from(2),
21878            angle: Angle45::D90,
21879            combine: Combine::Max,
21880            precision: Precision::Float,
21881            layers: i32::from(5),
21882            cluster: i32::from(1),
21883        }
21884    }
21885}
21886
21887/// VipsCompass (compass), convolve with rotating mask
21888/// inp: `&VipsImage` -> Input image argument
21889/// mask: `&VipsImage` -> Input matrix image
21890/// compass_options: `&CompassOptions` -> optional arguments
21891/// returns `VipsImage` - Output image
21892pub fn compass_with_opts(
21893    inp: &VipsImage,
21894    mask: &VipsImage,
21895    compass_options: &CompassOptions,
21896) -> Result<VipsImage> {
21897    unsafe {
21898        let inp_in: *mut bindings::VipsImage = inp.ctx;
21899        let mask_in: *mut bindings::VipsImage = mask.ctx;
21900        let mut out_out: *mut bindings::VipsImage = null_mut();
21901
21902        let times_in: i32 = compass_options.times;
21903        let times_in_name = utils::new_c_string("times")?;
21904
21905        let angle_in: i32 = compass_options.angle as i32;
21906        let angle_in_name = utils::new_c_string("angle")?;
21907
21908        let combine_in: i32 = compass_options.combine as i32;
21909        let combine_in_name = utils::new_c_string("combine")?;
21910
21911        let precision_in: i32 = compass_options.precision as i32;
21912        let precision_in_name = utils::new_c_string("precision")?;
21913
21914        let layers_in: i32 = compass_options.layers;
21915        let layers_in_name = utils::new_c_string("layers")?;
21916
21917        let cluster_in: i32 = compass_options.cluster;
21918        let cluster_in_name = utils::new_c_string("cluster")?;
21919
21920        let vips_op_response = bindings::vips_compass(
21921            inp_in,
21922            &mut out_out,
21923            mask_in,
21924            times_in_name.as_ptr(),
21925            times_in,
21926            angle_in_name.as_ptr(),
21927            angle_in,
21928            combine_in_name.as_ptr(),
21929            combine_in,
21930            precision_in_name.as_ptr(),
21931            precision_in,
21932            layers_in_name.as_ptr(),
21933            layers_in,
21934            cluster_in_name.as_ptr(),
21935            cluster_in,
21936            NULL,
21937        );
21938        utils::result(
21939            vips_op_response,
21940            VipsImage { ctx: out_out },
21941            Error::CompassError,
21942        )
21943    }
21944}
21945
21946/// VipsConvsep (convsep), separable convolution operation
21947/// inp: `&VipsImage` -> Input image argument
21948/// mask: `&VipsImage` -> Input matrix image
21949/// returns `VipsImage` - Output image
21950pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21951    unsafe {
21952        let inp_in: *mut bindings::VipsImage = inp.ctx;
21953        let mask_in: *mut bindings::VipsImage = mask.ctx;
21954        let mut out_out: *mut bindings::VipsImage = null_mut();
21955
21956        let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
21957        utils::result(
21958            vips_op_response,
21959            VipsImage { ctx: out_out },
21960            Error::ConvsepError,
21961        )
21962    }
21963}
21964
21965/// Options for convsep operation
21966#[derive(Clone, Debug)]
21967pub struct ConvsepOptions {
21968    /// precision: `Precision` -> Convolve with this precision
21969    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21970    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21971    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21972    ///  `Last` -> VIPS_PRECISION_LAST = 3
21973    pub precision: Precision,
21974    /// layers: `i32` -> Use this many layers in approximation
21975    /// min: 1, max: 1000, default: 5
21976    pub layers: i32,
21977    /// cluster: `i32` -> Cluster lines closer than this in approximation
21978    /// min: 1, max: 100, default: 1
21979    pub cluster: i32,
21980}
21981
21982impl std::default::Default for ConvsepOptions {
21983    fn default() -> Self {
21984        ConvsepOptions {
21985            precision: Precision::Float,
21986            layers: i32::from(5),
21987            cluster: i32::from(1),
21988        }
21989    }
21990}
21991
21992/// VipsConvsep (convsep), separable convolution operation
21993/// inp: `&VipsImage` -> Input image argument
21994/// mask: `&VipsImage` -> Input matrix image
21995/// convsep_options: `&ConvsepOptions` -> optional arguments
21996/// returns `VipsImage` - Output image
21997pub fn convsep_with_opts(
21998    inp: &VipsImage,
21999    mask: &VipsImage,
22000    convsep_options: &ConvsepOptions,
22001) -> Result<VipsImage> {
22002    unsafe {
22003        let inp_in: *mut bindings::VipsImage = inp.ctx;
22004        let mask_in: *mut bindings::VipsImage = mask.ctx;
22005        let mut out_out: *mut bindings::VipsImage = null_mut();
22006
22007        let precision_in: i32 = convsep_options.precision as i32;
22008        let precision_in_name = utils::new_c_string("precision")?;
22009
22010        let layers_in: i32 = convsep_options.layers;
22011        let layers_in_name = utils::new_c_string("layers")?;
22012
22013        let cluster_in: i32 = convsep_options.cluster;
22014        let cluster_in_name = utils::new_c_string("cluster")?;
22015
22016        let vips_op_response = bindings::vips_convsep(
22017            inp_in,
22018            &mut out_out,
22019            mask_in,
22020            precision_in_name.as_ptr(),
22021            precision_in,
22022            layers_in_name.as_ptr(),
22023            layers_in,
22024            cluster_in_name.as_ptr(),
22025            cluster_in,
22026            NULL,
22027        );
22028        utils::result(
22029            vips_op_response,
22030            VipsImage { ctx: out_out },
22031            Error::ConvsepError,
22032        )
22033    }
22034}
22035
22036/// VipsConvasep (convasep), approximate separable integer convolution
22037/// inp: `&VipsImage` -> Input image argument
22038/// mask: `&VipsImage` -> Input matrix image
22039/// returns `VipsImage` - Output image
22040pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22041    unsafe {
22042        let inp_in: *mut bindings::VipsImage = inp.ctx;
22043        let mask_in: *mut bindings::VipsImage = mask.ctx;
22044        let mut out_out: *mut bindings::VipsImage = null_mut();
22045
22046        let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
22047        utils::result(
22048            vips_op_response,
22049            VipsImage { ctx: out_out },
22050            Error::ConvasepError,
22051        )
22052    }
22053}
22054
22055/// Options for convasep operation
22056#[derive(Clone, Debug)]
22057pub struct ConvasepOptions {
22058    /// layers: `i32` -> Use this many layers in approximation
22059    /// min: 1, max: 1000, default: 5
22060    pub layers: i32,
22061}
22062
22063impl std::default::Default for ConvasepOptions {
22064    fn default() -> Self {
22065        ConvasepOptions {
22066            layers: i32::from(5),
22067        }
22068    }
22069}
22070
22071/// VipsConvasep (convasep), approximate separable integer convolution
22072/// inp: `&VipsImage` -> Input image argument
22073/// mask: `&VipsImage` -> Input matrix image
22074/// convasep_options: `&ConvasepOptions` -> optional arguments
22075/// returns `VipsImage` - Output image
22076pub fn convasep_with_opts(
22077    inp: &VipsImage,
22078    mask: &VipsImage,
22079    convasep_options: &ConvasepOptions,
22080) -> Result<VipsImage> {
22081    unsafe {
22082        let inp_in: *mut bindings::VipsImage = inp.ctx;
22083        let mask_in: *mut bindings::VipsImage = mask.ctx;
22084        let mut out_out: *mut bindings::VipsImage = null_mut();
22085
22086        let layers_in: i32 = convasep_options.layers;
22087        let layers_in_name = utils::new_c_string("layers")?;
22088
22089        let vips_op_response = bindings::vips_convasep(
22090            inp_in,
22091            &mut out_out,
22092            mask_in,
22093            layers_in_name.as_ptr(),
22094            layers_in,
22095            NULL,
22096        );
22097        utils::result(
22098            vips_op_response,
22099            VipsImage { ctx: out_out },
22100            Error::ConvasepError,
22101        )
22102    }
22103}
22104
22105/// VipsFastcor (fastcor), fast correlation
22106/// inp: `&VipsImage` -> Input image argument
22107/// refp: `&VipsImage` -> Input reference image
22108/// returns `VipsImage` - Output image
22109pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22110    unsafe {
22111        let inp_in: *mut bindings::VipsImage = inp.ctx;
22112        let refp_in: *mut bindings::VipsImage = refp.ctx;
22113        let mut out_out: *mut bindings::VipsImage = null_mut();
22114
22115        let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
22116        utils::result(
22117            vips_op_response,
22118            VipsImage { ctx: out_out },
22119            Error::FastcorError,
22120        )
22121    }
22122}
22123
22124/// VipsSpcor (spcor), spatial correlation
22125/// inp: `&VipsImage` -> Input image argument
22126/// refp: `&VipsImage` -> Input reference image
22127/// returns `VipsImage` - Output image
22128pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22129    unsafe {
22130        let inp_in: *mut bindings::VipsImage = inp.ctx;
22131        let refp_in: *mut bindings::VipsImage = refp.ctx;
22132        let mut out_out: *mut bindings::VipsImage = null_mut();
22133
22134        let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
22135        utils::result(
22136            vips_op_response,
22137            VipsImage { ctx: out_out },
22138            Error::SpcorError,
22139        )
22140    }
22141}
22142
22143/// VipsSharpen (sharpen), unsharp masking for print
22144/// inp: `&VipsImage` -> Input image
22145/// returns `VipsImage` - Output image
22146pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
22147    unsafe {
22148        let inp_in: *mut bindings::VipsImage = inp.ctx;
22149        let mut out_out: *mut bindings::VipsImage = null_mut();
22150
22151        let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
22152        utils::result(
22153            vips_op_response,
22154            VipsImage { ctx: out_out },
22155            Error::SharpenError,
22156        )
22157    }
22158}
22159
22160/// Options for sharpen operation
22161#[derive(Clone, Debug)]
22162pub struct SharpenOptions {
22163    /// sigma: `f64` -> Sigma of Gaussian
22164    /// min: 0.000001, max: 10, default: 0.5
22165    pub sigma: f64,
22166    /// x_1: `f64` -> Flat/jaggy threshold
22167    /// min: 0, max: 1000000, default: 2
22168    pub x_1: f64,
22169    /// y_2: `f64` -> Maximum brightening
22170    /// min: 0, max: 1000000, default: 10
22171    pub y_2: f64,
22172    /// y_3: `f64` -> Maximum darkening
22173    /// min: 0, max: 1000000, default: 20
22174    pub y_3: f64,
22175    /// m_1: `f64` -> Slope for flat areas
22176    /// min: 0, max: 1000000, default: 0
22177    pub m_1: f64,
22178    /// m_2: `f64` -> Slope for jaggy areas
22179    /// min: 0, max: 1000000, default: 3
22180    pub m_2: f64,
22181}
22182
22183impl std::default::Default for SharpenOptions {
22184    fn default() -> Self {
22185        SharpenOptions {
22186            sigma: f64::from(0.5),
22187            x_1: f64::from(2),
22188            y_2: f64::from(10),
22189            y_3: f64::from(20),
22190            m_1: f64::from(0),
22191            m_2: f64::from(3),
22192        }
22193    }
22194}
22195
22196/// VipsSharpen (sharpen), unsharp masking for print
22197/// inp: `&VipsImage` -> Input image
22198/// sharpen_options: `&SharpenOptions` -> optional arguments
22199/// returns `VipsImage` - Output image
22200pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
22201    unsafe {
22202        let inp_in: *mut bindings::VipsImage = inp.ctx;
22203        let mut out_out: *mut bindings::VipsImage = null_mut();
22204
22205        let sigma_in: f64 = sharpen_options.sigma;
22206        let sigma_in_name = utils::new_c_string("sigma")?;
22207
22208        let x_1_in: f64 = sharpen_options.x_1;
22209        let x_1_in_name = utils::new_c_string("x1")?;
22210
22211        let y_2_in: f64 = sharpen_options.y_2;
22212        let y_2_in_name = utils::new_c_string("y2")?;
22213
22214        let y_3_in: f64 = sharpen_options.y_3;
22215        let y_3_in_name = utils::new_c_string("y3")?;
22216
22217        let m_1_in: f64 = sharpen_options.m_1;
22218        let m_1_in_name = utils::new_c_string("m1")?;
22219
22220        let m_2_in: f64 = sharpen_options.m_2;
22221        let m_2_in_name = utils::new_c_string("m2")?;
22222
22223        let vips_op_response = bindings::vips_sharpen(
22224            inp_in,
22225            &mut out_out,
22226            sigma_in_name.as_ptr(),
22227            sigma_in,
22228            x_1_in_name.as_ptr(),
22229            x_1_in,
22230            y_2_in_name.as_ptr(),
22231            y_2_in,
22232            y_3_in_name.as_ptr(),
22233            y_3_in,
22234            m_1_in_name.as_ptr(),
22235            m_1_in,
22236            m_2_in_name.as_ptr(),
22237            m_2_in,
22238            NULL,
22239        );
22240        utils::result(
22241            vips_op_response,
22242            VipsImage { ctx: out_out },
22243            Error::SharpenError,
22244        )
22245    }
22246}
22247
22248/// VipsGaussblur (gaussblur), gaussian blur
22249/// inp: `&VipsImage` -> Input image
22250/// sigma: `f64` -> Sigma of Gaussian
22251/// min: 0, max: 1000, default: 1.5
22252/// returns `VipsImage` - Output image
22253pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
22254    unsafe {
22255        let inp_in: *mut bindings::VipsImage = inp.ctx;
22256        let sigma_in: f64 = sigma;
22257        let mut out_out: *mut bindings::VipsImage = null_mut();
22258
22259        let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
22260        utils::result(
22261            vips_op_response,
22262            VipsImage { ctx: out_out },
22263            Error::GaussblurError,
22264        )
22265    }
22266}
22267
22268/// Options for gaussblur operation
22269#[derive(Clone, Debug)]
22270pub struct GaussblurOptions {
22271    /// min_ampl: `f64` -> Minimum amplitude of Gaussian
22272    /// min: 0.001, max: 1, default: 0.2
22273    pub min_ampl: f64,
22274    /// precision: `Precision` -> Convolve with this precision
22275    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
22276    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
22277    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22278    ///  `Last` -> VIPS_PRECISION_LAST = 3
22279    pub precision: Precision,
22280}
22281
22282impl std::default::Default for GaussblurOptions {
22283    fn default() -> Self {
22284        GaussblurOptions {
22285            min_ampl: f64::from(0.2),
22286            precision: Precision::Integer,
22287        }
22288    }
22289}
22290
22291/// VipsGaussblur (gaussblur), gaussian blur
22292/// inp: `&VipsImage` -> Input image
22293/// sigma: `f64` -> Sigma of Gaussian
22294/// min: 0, max: 1000, default: 1.5
22295/// gaussblur_options: `&GaussblurOptions` -> optional arguments
22296/// returns `VipsImage` - Output image
22297pub fn gaussblur_with_opts(
22298    inp: &VipsImage,
22299    sigma: f64,
22300    gaussblur_options: &GaussblurOptions,
22301) -> Result<VipsImage> {
22302    unsafe {
22303        let inp_in: *mut bindings::VipsImage = inp.ctx;
22304        let sigma_in: f64 = sigma;
22305        let mut out_out: *mut bindings::VipsImage = null_mut();
22306
22307        let min_ampl_in: f64 = gaussblur_options.min_ampl;
22308        let min_ampl_in_name = utils::new_c_string("min-ampl")?;
22309
22310        let precision_in: i32 = gaussblur_options.precision as i32;
22311        let precision_in_name = utils::new_c_string("precision")?;
22312
22313        let vips_op_response = bindings::vips_gaussblur(
22314            inp_in,
22315            &mut out_out,
22316            sigma_in,
22317            min_ampl_in_name.as_ptr(),
22318            min_ampl_in,
22319            precision_in_name.as_ptr(),
22320            precision_in,
22321            NULL,
22322        );
22323        utils::result(
22324            vips_op_response,
22325            VipsImage { ctx: out_out },
22326            Error::GaussblurError,
22327        )
22328    }
22329}
22330
22331/// VipsSobel (sobel), Sobel edge detector
22332/// inp: `&VipsImage` -> Input image
22333/// returns `VipsImage` - Output image
22334pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
22335    unsafe {
22336        let inp_in: *mut bindings::VipsImage = inp.ctx;
22337        let mut out_out: *mut bindings::VipsImage = null_mut();
22338
22339        let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
22340        utils::result(
22341            vips_op_response,
22342            VipsImage { ctx: out_out },
22343            Error::SobelError,
22344        )
22345    }
22346}
22347
22348/// VipsScharr (scharr), Scharr edge detector
22349/// inp: `&VipsImage` -> Input image
22350/// returns `VipsImage` - Output image
22351pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
22352    unsafe {
22353        let inp_in: *mut bindings::VipsImage = inp.ctx;
22354        let mut out_out: *mut bindings::VipsImage = null_mut();
22355
22356        let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
22357        utils::result(
22358            vips_op_response,
22359            VipsImage { ctx: out_out },
22360            Error::ScharrError,
22361        )
22362    }
22363}
22364
22365/// VipsPrewitt (prewitt), Prewitt edge detector
22366/// inp: `&VipsImage` -> Input image
22367/// returns `VipsImage` - Output image
22368pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
22369    unsafe {
22370        let inp_in: *mut bindings::VipsImage = inp.ctx;
22371        let mut out_out: *mut bindings::VipsImage = null_mut();
22372
22373        let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
22374        utils::result(
22375            vips_op_response,
22376            VipsImage { ctx: out_out },
22377            Error::PrewittError,
22378        )
22379    }
22380}
22381
22382/// VipsCanny (canny), Canny edge detector
22383/// inp: `&VipsImage` -> Input image
22384/// returns `VipsImage` - Output image
22385pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
22386    unsafe {
22387        let inp_in: *mut bindings::VipsImage = inp.ctx;
22388        let mut out_out: *mut bindings::VipsImage = null_mut();
22389
22390        let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
22391        utils::result(
22392            vips_op_response,
22393            VipsImage { ctx: out_out },
22394            Error::CannyError,
22395        )
22396    }
22397}
22398
22399/// Options for canny operation
22400#[derive(Clone, Debug)]
22401pub struct CannyOptions {
22402    /// sigma: `f64` -> Sigma of Gaussian
22403    /// min: 0.01, max: 1000, default: 1.4
22404    pub sigma: f64,
22405    /// precision: `Precision` -> Convolve with this precision
22406    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22407    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22408    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22409    ///  `Last` -> VIPS_PRECISION_LAST = 3
22410    pub precision: Precision,
22411}
22412
22413impl std::default::Default for CannyOptions {
22414    fn default() -> Self {
22415        CannyOptions {
22416            sigma: f64::from(1.4),
22417            precision: Precision::Float,
22418        }
22419    }
22420}
22421
22422/// VipsCanny (canny), Canny edge detector
22423/// inp: `&VipsImage` -> Input image
22424/// canny_options: `&CannyOptions` -> optional arguments
22425/// returns `VipsImage` - Output image
22426pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22427    unsafe {
22428        let inp_in: *mut bindings::VipsImage = inp.ctx;
22429        let mut out_out: *mut bindings::VipsImage = null_mut();
22430
22431        let sigma_in: f64 = canny_options.sigma;
22432        let sigma_in_name = utils::new_c_string("sigma")?;
22433
22434        let precision_in: i32 = canny_options.precision as i32;
22435        let precision_in_name = utils::new_c_string("precision")?;
22436
22437        let vips_op_response = bindings::vips_canny(
22438            inp_in,
22439            &mut out_out,
22440            sigma_in_name.as_ptr(),
22441            sigma_in,
22442            precision_in_name.as_ptr(),
22443            precision_in,
22444            NULL,
22445        );
22446        utils::result(
22447            vips_op_response,
22448            VipsImage { ctx: out_out },
22449            Error::CannyError,
22450        )
22451    }
22452}
22453
22454/// VipsFwfft (fwfft), forward FFT
22455/// inp: `&VipsImage` -> Input image
22456/// returns `VipsImage` - Output image
22457pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22458    unsafe {
22459        let inp_in: *mut bindings::VipsImage = inp.ctx;
22460        let mut out_out: *mut bindings::VipsImage = null_mut();
22461
22462        let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22463        utils::result(
22464            vips_op_response,
22465            VipsImage { ctx: out_out },
22466            Error::FwfftError,
22467        )
22468    }
22469}
22470
22471/// VipsInvfft (invfft), inverse FFT
22472/// inp: `&VipsImage` -> Input image
22473/// returns `VipsImage` - Output image
22474pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
22475    unsafe {
22476        let inp_in: *mut bindings::VipsImage = inp.ctx;
22477        let mut out_out: *mut bindings::VipsImage = null_mut();
22478
22479        let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
22480        utils::result(
22481            vips_op_response,
22482            VipsImage { ctx: out_out },
22483            Error::InvfftError,
22484        )
22485    }
22486}
22487
22488/// Options for invfft operation
22489#[derive(Clone, Debug)]
22490pub struct InvfftOptions {
22491    /// real: `bool` -> Output only the real part of the transform
22492    /// default: false
22493    pub real: bool,
22494}
22495
22496impl std::default::Default for InvfftOptions {
22497    fn default() -> Self {
22498        InvfftOptions { real: false }
22499    }
22500}
22501
22502/// VipsInvfft (invfft), inverse FFT
22503/// inp: `&VipsImage` -> Input image
22504/// invfft_options: `&InvfftOptions` -> optional arguments
22505/// returns `VipsImage` - Output image
22506pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22507    unsafe {
22508        let inp_in: *mut bindings::VipsImage = inp.ctx;
22509        let mut out_out: *mut bindings::VipsImage = null_mut();
22510
22511        let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22512        let real_in_name = utils::new_c_string("real")?;
22513
22514        let vips_op_response =
22515            bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22516        utils::result(
22517            vips_op_response,
22518            VipsImage { ctx: out_out },
22519            Error::InvfftError,
22520        )
22521    }
22522}
22523
22524/// VipsFreqmult (freqmult), frequency-domain filtering
22525/// inp: `&VipsImage` -> Input image
22526/// mask: `&VipsImage` -> Input mask image
22527/// returns `VipsImage` - Output image
22528pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22529    unsafe {
22530        let inp_in: *mut bindings::VipsImage = inp.ctx;
22531        let mask_in: *mut bindings::VipsImage = mask.ctx;
22532        let mut out_out: *mut bindings::VipsImage = null_mut();
22533
22534        let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22535        utils::result(
22536            vips_op_response,
22537            VipsImage { ctx: out_out },
22538            Error::FreqmultError,
22539        )
22540    }
22541}
22542
22543/// VipsSpectrum (spectrum), make displayable power spectrum
22544/// inp: `&VipsImage` -> Input image
22545/// returns `VipsImage` - Output image
22546pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22547    unsafe {
22548        let inp_in: *mut bindings::VipsImage = inp.ctx;
22549        let mut out_out: *mut bindings::VipsImage = null_mut();
22550
22551        let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22552        utils::result(
22553            vips_op_response,
22554            VipsImage { ctx: out_out },
22555            Error::SpectrumError,
22556        )
22557    }
22558}
22559
22560/// VipsPhasecor (phasecor), calculate phase correlation
22561/// inp: `&VipsImage` -> Input image
22562/// in_2: `&VipsImage` -> Second input image
22563/// returns `VipsImage` - Output image
22564pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22565    unsafe {
22566        let inp_in: *mut bindings::VipsImage = inp.ctx;
22567        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22568        let mut out_out: *mut bindings::VipsImage = null_mut();
22569
22570        let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22571        utils::result(
22572            vips_op_response,
22573            VipsImage { ctx: out_out },
22574            Error::PhasecorError,
22575        )
22576    }
22577}
22578
22579/// VipsMorph (morph), morphology operation
22580/// inp: `&VipsImage` -> Input image argument
22581/// mask: `&VipsImage` -> Input matrix image
22582/// morph: `OperationMorphology` -> Morphological operation to perform
22583///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0 [DEFAULT]
22584///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
22585///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
22586/// returns `VipsImage` - Output image
22587pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22588    unsafe {
22589        let inp_in: *mut bindings::VipsImage = inp.ctx;
22590        let mask_in: *mut bindings::VipsImage = mask.ctx;
22591        let morph_in: i32 = morph as i32;
22592        let mut out_out: *mut bindings::VipsImage = null_mut();
22593
22594        let vips_op_response = bindings::vips_morph(
22595            inp_in,
22596            &mut out_out,
22597            mask_in,
22598            morph_in.try_into().unwrap(),
22599            NULL,
22600        );
22601        utils::result(
22602            vips_op_response,
22603            VipsImage { ctx: out_out },
22604            Error::MorphError,
22605        )
22606    }
22607}
22608
22609/// VipsRank (rank), rank filter
22610/// inp: `&VipsImage` -> Input image argument
22611/// width: `i32` -> Window width in pixels
22612/// min: 1, max: 100000, default: 11
22613/// height: `i32` -> Window height in pixels
22614/// min: 1, max: 100000, default: 11
22615/// index: `i32` -> Select pixel at index
22616/// min: 0, max: 100000000, default: 50
22617/// returns `VipsImage` - Output image
22618pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22619    unsafe {
22620        let inp_in: *mut bindings::VipsImage = inp.ctx;
22621        let width_in: i32 = width;
22622        let height_in: i32 = height;
22623        let index_in: i32 = index;
22624        let mut out_out: *mut bindings::VipsImage = null_mut();
22625
22626        let vips_op_response =
22627            bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22628        utils::result(
22629            vips_op_response,
22630            VipsImage { ctx: out_out },
22631            Error::RankError,
22632        )
22633    }
22634}
22635
22636/// VipsCountlines (countlines), count lines in an image
22637/// inp: `&VipsImage` -> Input image argument
22638/// direction: `Direction` -> Countlines left-right or up-down
22639///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22640///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22641///  `Last` -> VIPS_DIRECTION_LAST = 2
22642/// returns `f64` - Number of lines
22643pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22644    unsafe {
22645        let inp_in: *mut bindings::VipsImage = inp.ctx;
22646        let direction_in: i32 = direction as i32;
22647        let mut nolines_out: f64 = f64::from(0);
22648
22649        let vips_op_response = bindings::vips_countlines(
22650            inp_in,
22651            &mut nolines_out,
22652            direction_in.try_into().unwrap(),
22653            NULL,
22654        );
22655        utils::result(vips_op_response, nolines_out, Error::CountlineError)
22656    }
22657}
22658
22659/// VipsLabelregions (labelregions), label regions in an image
22660/// inp: `&VipsImage` -> Input image argument
22661/// returns `VipsImage` - Mask of region labels
22662pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22663    unsafe {
22664        let inp_in: *mut bindings::VipsImage = inp.ctx;
22665        let mut mask_out: *mut bindings::VipsImage = null_mut();
22666
22667        let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22668        utils::result(
22669            vips_op_response,
22670            VipsImage { ctx: mask_out },
22671            Error::LabelregionError,
22672        )
22673    }
22674}
22675
22676/// Options for labelregions operation
22677#[derive(Clone, Debug)]
22678pub struct LabelregionOptions {
22679    /// segments: `i32` -> Number of discrete contiguous regions
22680    /// min: 0, max: 1000000000, default: 0
22681    pub segments: i32,
22682}
22683
22684impl std::default::Default for LabelregionOptions {
22685    fn default() -> Self {
22686        LabelregionOptions {
22687            segments: i32::from(0),
22688        }
22689    }
22690}
22691
22692/// VipsLabelregions (labelregions), label regions in an image
22693/// inp: `&VipsImage` -> Input image argument
22694/// labelregions_options: `&LabelregionOptions` -> optional arguments
22695/// returns `VipsImage` - Mask of region labels
22696pub fn labelregions_with_opts(
22697    inp: &VipsImage,
22698    labelregions_options: &LabelregionOptions,
22699) -> Result<VipsImage> {
22700    unsafe {
22701        let inp_in: *mut bindings::VipsImage = inp.ctx;
22702        let mut mask_out: *mut bindings::VipsImage = null_mut();
22703
22704        let segments_in: i32 = labelregions_options.segments;
22705        let segments_in_name = utils::new_c_string("segments")?;
22706
22707        let vips_op_response = bindings::vips_labelregions(
22708            inp_in,
22709            &mut mask_out,
22710            segments_in_name.as_ptr(),
22711            segments_in,
22712            NULL,
22713        );
22714        utils::result(
22715            vips_op_response,
22716            VipsImage { ctx: mask_out },
22717            Error::LabelregionError,
22718        )
22719    }
22720}
22721
22722/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22723/// inp: `&VipsImage` -> Input image argument
22724/// returns `VipsImage` - Value of nearest non-zero pixel
22725pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22726    unsafe {
22727        let inp_in: *mut bindings::VipsImage = inp.ctx;
22728        let mut out_out: *mut bindings::VipsImage = null_mut();
22729
22730        let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22731        utils::result(
22732            vips_op_response,
22733            VipsImage { ctx: out_out },
22734            Error::FillNearestError,
22735        )
22736    }
22737}
22738
22739/// Options for fill_nearest operation
22740#[derive(Clone, Debug)]
22741pub struct FillNearestOptions {
22742    /// distance: `VipsImage` -> Distance to nearest non-zero pixel
22743    pub distance: VipsImage,
22744}
22745
22746impl std::default::Default for FillNearestOptions {
22747    fn default() -> Self {
22748        FillNearestOptions {
22749            distance: VipsImage::new(),
22750        }
22751    }
22752}
22753
22754/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22755/// inp: `&VipsImage` -> Input image argument
22756/// fill_nearest_options: `&FillNearestOptions` -> optional arguments
22757/// returns `VipsImage` - Value of nearest non-zero pixel
22758pub fn fill_nearest_with_opts(
22759    inp: &VipsImage,
22760    fill_nearest_options: &FillNearestOptions,
22761) -> Result<VipsImage> {
22762    unsafe {
22763        let inp_in: *mut bindings::VipsImage = inp.ctx;
22764        let mut out_out: *mut bindings::VipsImage = null_mut();
22765
22766        let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
22767        let distance_in_name = utils::new_c_string("distance")?;
22768
22769        let vips_op_response = bindings::vips_fill_nearest(
22770            inp_in,
22771            &mut out_out,
22772            distance_in_name.as_ptr(),
22773            distance_in,
22774            NULL,
22775        );
22776        utils::result(
22777            vips_op_response,
22778            VipsImage { ctx: out_out },
22779            Error::FillNearestError,
22780        )
22781    }
22782}
22783
22784/// VipsDrawRect (draw_rect), paint a rectangle on an image
22785/// image: `&VipsImage` -> Image to draw on
22786/// ink: `&mut [f64]` -> Color for pixels
22787/// left: `i32` -> Rect to fill
22788/// min: -1000000000, max: 1000000000, default: 0
22789/// top: `i32` -> Rect to fill
22790/// min: -1000000000, max: 1000000000, default: 0
22791/// width: `i32` -> Rect to fill
22792/// min: -1000000000, max: 1000000000, default: 0
22793/// height: `i32` -> Rect to fill
22794/// min: -1000000000, max: 1000000000, default: 0
22795
22796pub fn draw_rect(
22797    image: &VipsImage,
22798    ink: &mut [f64],
22799    left: i32,
22800    top: i32,
22801    width: i32,
22802    height: i32,
22803) -> Result<()> {
22804    unsafe {
22805        let image_in: *mut bindings::VipsImage = image.ctx;
22806        let ink_in: *mut f64 = ink.as_mut_ptr();
22807        let left_in: i32 = left;
22808        let top_in: i32 = top;
22809        let width_in: i32 = width;
22810        let height_in: i32 = height;
22811
22812        let vips_op_response = bindings::vips_draw_rect(
22813            image_in,
22814            ink_in,
22815            ink.len() as i32,
22816            left_in,
22817            top_in,
22818            width_in,
22819            height_in,
22820            NULL,
22821        );
22822        utils::result(vips_op_response, (), Error::DrawRectError)
22823    }
22824}
22825
22826/// Options for draw_rect operation
22827#[derive(Clone, Debug)]
22828pub struct DrawRectOptions {
22829    /// fill: `bool` -> Draw a solid object
22830    /// default: false
22831    pub fill: bool,
22832}
22833
22834impl std::default::Default for DrawRectOptions {
22835    fn default() -> Self {
22836        DrawRectOptions { fill: false }
22837    }
22838}
22839
22840/// VipsDrawRect (draw_rect), paint a rectangle on an image
22841/// image: `&VipsImage` -> Image to draw on
22842/// ink: `&mut [f64]` -> Color for pixels
22843/// left: `i32` -> Rect to fill
22844/// min: -1000000000, max: 1000000000, default: 0
22845/// top: `i32` -> Rect to fill
22846/// min: -1000000000, max: 1000000000, default: 0
22847/// width: `i32` -> Rect to fill
22848/// min: -1000000000, max: 1000000000, default: 0
22849/// height: `i32` -> Rect to fill
22850/// min: -1000000000, max: 1000000000, default: 0
22851/// draw_rect_options: `&DrawRectOptions` -> optional arguments
22852
22853pub fn draw_rect_with_opts(
22854    image: &VipsImage,
22855    ink: &mut [f64],
22856    left: i32,
22857    top: i32,
22858    width: i32,
22859    height: i32,
22860    draw_rect_options: &DrawRectOptions,
22861) -> Result<()> {
22862    unsafe {
22863        let image_in: *mut bindings::VipsImage = image.ctx;
22864        let ink_in: *mut f64 = ink.as_mut_ptr();
22865        let left_in: i32 = left;
22866        let top_in: i32 = top;
22867        let width_in: i32 = width;
22868        let height_in: i32 = height;
22869
22870        let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
22871        let fill_in_name = utils::new_c_string("fill")?;
22872
22873        let vips_op_response = bindings::vips_draw_rect(
22874            image_in,
22875            ink_in,
22876            ink.len() as i32,
22877            left_in,
22878            top_in,
22879            width_in,
22880            height_in,
22881            fill_in_name.as_ptr(),
22882            fill_in,
22883            NULL,
22884        );
22885        utils::result(vips_op_response, (), Error::DrawRectError)
22886    }
22887}
22888
22889/// VipsDrawMask (draw_mask), draw a mask on an image
22890/// image: `&VipsImage` -> Image to draw on
22891/// ink: `&mut [f64]` -> Color for pixels
22892/// mask: `&VipsImage` -> Mask of pixels to draw
22893/// x: `i32` -> Draw mask here
22894/// min: -1000000000, max: 1000000000, default: 0
22895/// y: `i32` -> Draw mask here
22896/// min: -1000000000, max: 1000000000, default: 0
22897
22898pub fn draw_mask(
22899    image: &VipsImage,
22900    ink: &mut [f64],
22901    mask: &VipsImage,
22902    x: i32,
22903    y: i32,
22904) -> Result<()> {
22905    unsafe {
22906        let image_in: *mut bindings::VipsImage = image.ctx;
22907        let ink_in: *mut f64 = ink.as_mut_ptr();
22908        let mask_in: *mut bindings::VipsImage = mask.ctx;
22909        let x_in: i32 = x;
22910        let y_in: i32 = y;
22911
22912        let vips_op_response = bindings::vips_draw_mask(
22913            image_in,
22914            ink_in,
22915            ink.len() as i32,
22916            mask_in,
22917            x_in,
22918            y_in,
22919            NULL,
22920        );
22921        utils::result(vips_op_response, (), Error::DrawMaskError)
22922    }
22923}
22924
22925/// VipsDrawLine (draw_line), draw a line on an image
22926/// image: `&VipsImage` -> Image to draw on
22927/// ink: `&mut [f64]` -> Color for pixels
22928/// x_1: `i32` -> Start of draw_line
22929/// min: -1000000000, max: 1000000000, default: 0
22930/// y_1: `i32` -> Start of draw_line
22931/// min: -1000000000, max: 1000000000, default: 0
22932/// x_2: `i32` -> End of draw_line
22933/// min: -1000000000, max: 1000000000, default: 0
22934/// y_2: `i32` -> End of draw_line
22935/// min: -1000000000, max: 1000000000, default: 0
22936
22937pub fn draw_line(
22938    image: &VipsImage,
22939    ink: &mut [f64],
22940    x_1: i32,
22941    y_1: i32,
22942    x_2: i32,
22943    y_2: i32,
22944) -> Result<()> {
22945    unsafe {
22946        let image_in: *mut bindings::VipsImage = image.ctx;
22947        let ink_in: *mut f64 = ink.as_mut_ptr();
22948        let x_1_in: i32 = x_1;
22949        let y_1_in: i32 = y_1;
22950        let x_2_in: i32 = x_2;
22951        let y_2_in: i32 = y_2;
22952
22953        let vips_op_response = bindings::vips_draw_line(
22954            image_in,
22955            ink_in,
22956            ink.len() as i32,
22957            x_1_in,
22958            y_1_in,
22959            x_2_in,
22960            y_2_in,
22961            NULL,
22962        );
22963        utils::result(vips_op_response, (), Error::DrawLineError)
22964    }
22965}
22966
22967/// VipsDrawCircle (draw_circle), draw a circle on an image
22968/// image: `&VipsImage` -> Image to draw on
22969/// ink: `&mut [f64]` -> Color for pixels
22970/// cx: `i32` -> Centre of draw_circle
22971/// min: -1000000000, max: 1000000000, default: 0
22972/// cy: `i32` -> Centre of draw_circle
22973/// min: -1000000000, max: 1000000000, default: 0
22974/// radius: `i32` -> Radius in pixels
22975/// min: 0, max: 1000000000, default: 0
22976
22977pub fn draw_circle(
22978    image: &VipsImage,
22979    ink: &mut [f64],
22980    cx: i32,
22981    cy: i32,
22982    radius: i32,
22983) -> Result<()> {
22984    unsafe {
22985        let image_in: *mut bindings::VipsImage = image.ctx;
22986        let ink_in: *mut f64 = ink.as_mut_ptr();
22987        let cx_in: i32 = cx;
22988        let cy_in: i32 = cy;
22989        let radius_in: i32 = radius;
22990
22991        let vips_op_response = bindings::vips_draw_circle(
22992            image_in,
22993            ink_in,
22994            ink.len() as i32,
22995            cx_in,
22996            cy_in,
22997            radius_in,
22998            NULL,
22999        );
23000        utils::result(vips_op_response, (), Error::DrawCircleError)
23001    }
23002}
23003
23004/// Options for draw_circle operation
23005#[derive(Clone, Debug)]
23006pub struct DrawCircleOptions {
23007    /// fill: `bool` -> Draw a solid object
23008    /// default: false
23009    pub fill: bool,
23010}
23011
23012impl std::default::Default for DrawCircleOptions {
23013    fn default() -> Self {
23014        DrawCircleOptions { fill: false }
23015    }
23016}
23017
23018/// VipsDrawCircle (draw_circle), draw a circle on an image
23019/// image: `&VipsImage` -> Image to draw on
23020/// ink: `&mut [f64]` -> Color for pixels
23021/// cx: `i32` -> Centre of draw_circle
23022/// min: -1000000000, max: 1000000000, default: 0
23023/// cy: `i32` -> Centre of draw_circle
23024/// min: -1000000000, max: 1000000000, default: 0
23025/// radius: `i32` -> Radius in pixels
23026/// min: 0, max: 1000000000, default: 0
23027/// draw_circle_options: `&DrawCircleOptions` -> optional arguments
23028
23029pub fn draw_circle_with_opts(
23030    image: &VipsImage,
23031    ink: &mut [f64],
23032    cx: i32,
23033    cy: i32,
23034    radius: i32,
23035    draw_circle_options: &DrawCircleOptions,
23036) -> Result<()> {
23037    unsafe {
23038        let image_in: *mut bindings::VipsImage = image.ctx;
23039        let ink_in: *mut f64 = ink.as_mut_ptr();
23040        let cx_in: i32 = cx;
23041        let cy_in: i32 = cy;
23042        let radius_in: i32 = radius;
23043
23044        let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
23045        let fill_in_name = utils::new_c_string("fill")?;
23046
23047        let vips_op_response = bindings::vips_draw_circle(
23048            image_in,
23049            ink_in,
23050            ink.len() as i32,
23051            cx_in,
23052            cy_in,
23053            radius_in,
23054            fill_in_name.as_ptr(),
23055            fill_in,
23056            NULL,
23057        );
23058        utils::result(vips_op_response, (), Error::DrawCircleError)
23059    }
23060}
23061
23062/// VipsDrawFlood (draw_flood), flood-fill an area
23063/// image: `&VipsImage` -> Image to draw on
23064/// ink: `&mut [f64]` -> Color for pixels
23065/// x: `i32` -> DrawFlood start point
23066/// min: 0, max: 1000000000, default: 0
23067/// y: `i32` -> DrawFlood start point
23068/// min: 0, max: 1000000000, default: 0
23069
23070pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
23071    unsafe {
23072        let image_in: *mut bindings::VipsImage = image.ctx;
23073        let ink_in: *mut f64 = ink.as_mut_ptr();
23074        let x_in: i32 = x;
23075        let y_in: i32 = y;
23076
23077        let vips_op_response =
23078            bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
23079        utils::result(vips_op_response, (), Error::DrawFloodError)
23080    }
23081}
23082
23083/// Options for draw_flood operation
23084#[derive(Clone, Debug)]
23085pub struct DrawFloodOptions {
23086    /// test: `VipsImage` -> Test pixels in this image
23087    pub test: VipsImage,
23088    /// equal: `bool` -> DrawFlood while equal to edge
23089    /// default: false
23090    pub equal: bool,
23091    /// left: `i32` -> Left edge of modified area
23092    /// min: 0, max: 1000000000, default: 0
23093    pub left: i32,
23094    /// top: `i32` -> Top edge of modified area
23095    /// min: 0, max: 1000000000, default: 0
23096    pub top: i32,
23097    /// width: `i32` -> Width of modified area
23098    /// min: 0, max: 1000000000, default: 0
23099    pub width: i32,
23100    /// height: `i32` -> Height of modified area
23101    /// min: 0, max: 1000000000, default: 0
23102    pub height: i32,
23103}
23104
23105impl std::default::Default for DrawFloodOptions {
23106    fn default() -> Self {
23107        DrawFloodOptions {
23108            test: VipsImage::new(),
23109            equal: false,
23110            left: i32::from(0),
23111            top: i32::from(0),
23112            width: i32::from(0),
23113            height: i32::from(0),
23114        }
23115    }
23116}
23117
23118/// VipsDrawFlood (draw_flood), flood-fill an area
23119/// image: `&VipsImage` -> Image to draw on
23120/// ink: `&mut [f64]` -> Color for pixels
23121/// x: `i32` -> DrawFlood start point
23122/// min: 0, max: 1000000000, default: 0
23123/// y: `i32` -> DrawFlood start point
23124/// min: 0, max: 1000000000, default: 0
23125/// draw_flood_options: `&DrawFloodOptions` -> optional arguments
23126
23127pub fn draw_flood_with_opts(
23128    image: &VipsImage,
23129    ink: &mut [f64],
23130    x: i32,
23131    y: i32,
23132    draw_flood_options: &DrawFloodOptions,
23133) -> Result<()> {
23134    unsafe {
23135        let image_in: *mut bindings::VipsImage = image.ctx;
23136        let ink_in: *mut f64 = ink.as_mut_ptr();
23137        let x_in: i32 = x;
23138        let y_in: i32 = y;
23139
23140        let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
23141        let test_in_name = utils::new_c_string("test")?;
23142
23143        let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
23144        let equal_in_name = utils::new_c_string("equal")?;
23145
23146        let left_in: i32 = draw_flood_options.left;
23147        let left_in_name = utils::new_c_string("left")?;
23148
23149        let top_in: i32 = draw_flood_options.top;
23150        let top_in_name = utils::new_c_string("top")?;
23151
23152        let width_in: i32 = draw_flood_options.width;
23153        let width_in_name = utils::new_c_string("width")?;
23154
23155        let height_in: i32 = draw_flood_options.height;
23156        let height_in_name = utils::new_c_string("height")?;
23157
23158        let vips_op_response = bindings::vips_draw_flood(
23159            image_in,
23160            ink_in,
23161            ink.len() as i32,
23162            x_in,
23163            y_in,
23164            test_in_name.as_ptr(),
23165            test_in,
23166            equal_in_name.as_ptr(),
23167            equal_in,
23168            left_in_name.as_ptr(),
23169            left_in,
23170            top_in_name.as_ptr(),
23171            top_in,
23172            width_in_name.as_ptr(),
23173            width_in,
23174            height_in_name.as_ptr(),
23175            height_in,
23176            NULL,
23177        );
23178        utils::result(vips_op_response, (), Error::DrawFloodError)
23179    }
23180}
23181
23182/// VipsDrawImage (draw_image), paint an image into another image
23183/// image: `&VipsImage` -> Image to draw on
23184/// sub: `&VipsImage` -> Sub-image to insert into main image
23185/// x: `i32` -> Draw image here
23186/// min: -1000000000, max: 1000000000, default: 0
23187/// y: `i32` -> Draw image here
23188/// min: -1000000000, max: 1000000000, default: 0
23189
23190pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
23191    unsafe {
23192        let image_in: *mut bindings::VipsImage = image.ctx;
23193        let sub_in: *mut bindings::VipsImage = sub.ctx;
23194        let x_in: i32 = x;
23195        let y_in: i32 = y;
23196
23197        let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
23198        utils::result(vips_op_response, (), Error::DrawImageError)
23199    }
23200}
23201
23202/// Options for draw_image operation
23203#[derive(Clone, Debug)]
23204pub struct DrawImageOptions {
23205    /// mode: `CombineMode` -> Combining mode
23206    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0 [DEFAULT]
23207    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
23208    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
23209    pub mode: CombineMode,
23210}
23211
23212impl std::default::Default for DrawImageOptions {
23213    fn default() -> Self {
23214        DrawImageOptions {
23215            mode: CombineMode::Set,
23216        }
23217    }
23218}
23219
23220/// VipsDrawImage (draw_image), paint an image into another image
23221/// image: `&VipsImage` -> Image to draw on
23222/// sub: `&VipsImage` -> Sub-image to insert into main image
23223/// x: `i32` -> Draw image here
23224/// min: -1000000000, max: 1000000000, default: 0
23225/// y: `i32` -> Draw image here
23226/// min: -1000000000, max: 1000000000, default: 0
23227/// draw_image_options: `&DrawImageOptions` -> optional arguments
23228
23229pub fn draw_image_with_opts(
23230    image: &VipsImage,
23231    sub: &VipsImage,
23232    x: i32,
23233    y: i32,
23234    draw_image_options: &DrawImageOptions,
23235) -> Result<()> {
23236    unsafe {
23237        let image_in: *mut bindings::VipsImage = image.ctx;
23238        let sub_in: *mut bindings::VipsImage = sub.ctx;
23239        let x_in: i32 = x;
23240        let y_in: i32 = y;
23241
23242        let mode_in: i32 = draw_image_options.mode as i32;
23243        let mode_in_name = utils::new_c_string("mode")?;
23244
23245        let vips_op_response = bindings::vips_draw_image(
23246            image_in,
23247            sub_in,
23248            x_in,
23249            y_in,
23250            mode_in_name.as_ptr(),
23251            mode_in,
23252            NULL,
23253        );
23254        utils::result(vips_op_response, (), Error::DrawImageError)
23255    }
23256}
23257
23258/// VipsDrawSmudge (draw_smudge), blur a rectangle on an image
23259/// image: `&VipsImage` -> Image to draw on
23260/// left: `i32` -> Rect to fill
23261/// min: -1000000000, max: 1000000000, default: 0
23262/// top: `i32` -> Rect to fill
23263/// min: -1000000000, max: 1000000000, default: 0
23264/// width: `i32` -> Rect to fill
23265/// min: -1000000000, max: 1000000000, default: 0
23266/// height: `i32` -> Rect to fill
23267/// min: -1000000000, max: 1000000000, default: 0
23268
23269pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
23270    unsafe {
23271        let image_in: *mut bindings::VipsImage = image.ctx;
23272        let left_in: i32 = left;
23273        let top_in: i32 = top;
23274        let width_in: i32 = width;
23275        let height_in: i32 = height;
23276
23277        let vips_op_response =
23278            bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
23279        utils::result(vips_op_response, (), Error::DrawSmudgeError)
23280    }
23281}
23282
23283/// VipsMerge (merge), merge two images
23284/// refp: `&VipsImage` -> Reference image
23285/// sec: `&VipsImage` -> Secondary image
23286/// direction: `Direction` -> Horizontal or vertical merge
23287///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23288///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23289///  `Last` -> VIPS_DIRECTION_LAST = 2
23290/// dx: `i32` -> Horizontal displacement from sec to ref
23291/// min: -100000000, max: 1000000000, default: 1
23292/// dy: `i32` -> Vertical displacement from sec to ref
23293/// min: -100000000, max: 1000000000, default: 1
23294/// returns `VipsImage` - Output image
23295pub fn merge(
23296    refp: &VipsImage,
23297    sec: &VipsImage,
23298    direction: Direction,
23299    dx: i32,
23300    dy: i32,
23301) -> Result<VipsImage> {
23302    unsafe {
23303        let refp_in: *mut bindings::VipsImage = refp.ctx;
23304        let sec_in: *mut bindings::VipsImage = sec.ctx;
23305        let direction_in: i32 = direction as i32;
23306        let dx_in: i32 = dx;
23307        let dy_in: i32 = dy;
23308        let mut out_out: *mut bindings::VipsImage = null_mut();
23309
23310        let vips_op_response = bindings::vips_merge(
23311            refp_in,
23312            sec_in,
23313            &mut out_out,
23314            direction_in.try_into().unwrap(),
23315            dx_in,
23316            dy_in,
23317            NULL,
23318        );
23319        utils::result(
23320            vips_op_response,
23321            VipsImage { ctx: out_out },
23322            Error::MergeError,
23323        )
23324    }
23325}
23326
23327/// Options for merge operation
23328#[derive(Clone, Debug)]
23329pub struct MergeOptions {
23330    /// mblend: `i32` -> Maximum blend size
23331    /// min: 0, max: 10000, default: 10
23332    pub mblend: i32,
23333}
23334
23335impl std::default::Default for MergeOptions {
23336    fn default() -> Self {
23337        MergeOptions {
23338            mblend: i32::from(10),
23339        }
23340    }
23341}
23342
23343/// VipsMerge (merge), merge two images
23344/// refp: `&VipsImage` -> Reference image
23345/// sec: `&VipsImage` -> Secondary image
23346/// direction: `Direction` -> Horizontal or vertical merge
23347///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23348///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23349///  `Last` -> VIPS_DIRECTION_LAST = 2
23350/// dx: `i32` -> Horizontal displacement from sec to ref
23351/// min: -100000000, max: 1000000000, default: 1
23352/// dy: `i32` -> Vertical displacement from sec to ref
23353/// min: -100000000, max: 1000000000, default: 1
23354/// merge_options: `&MergeOptions` -> optional arguments
23355/// returns `VipsImage` - Output image
23356pub fn merge_with_opts(
23357    refp: &VipsImage,
23358    sec: &VipsImage,
23359    direction: Direction,
23360    dx: i32,
23361    dy: i32,
23362    merge_options: &MergeOptions,
23363) -> Result<VipsImage> {
23364    unsafe {
23365        let refp_in: *mut bindings::VipsImage = refp.ctx;
23366        let sec_in: *mut bindings::VipsImage = sec.ctx;
23367        let direction_in: i32 = direction as i32;
23368        let dx_in: i32 = dx;
23369        let dy_in: i32 = dy;
23370        let mut out_out: *mut bindings::VipsImage = null_mut();
23371
23372        let mblend_in: i32 = merge_options.mblend;
23373        let mblend_in_name = utils::new_c_string("mblend")?;
23374
23375        let vips_op_response = bindings::vips_merge(
23376            refp_in,
23377            sec_in,
23378            &mut out_out,
23379            direction_in.try_into().unwrap(),
23380            dx_in,
23381            dy_in,
23382            mblend_in_name.as_ptr(),
23383            mblend_in,
23384            NULL,
23385        );
23386        utils::result(
23387            vips_op_response,
23388            VipsImage { ctx: out_out },
23389            Error::MergeError,
23390        )
23391    }
23392}
23393
23394/// VipsMosaic (mosaic), mosaic two images
23395/// refp: `&VipsImage` -> Reference image
23396/// sec: `&VipsImage` -> Secondary image
23397/// direction: `Direction` -> Horizontal or vertical mosaic
23398///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23399///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23400///  `Last` -> VIPS_DIRECTION_LAST = 2
23401/// xref: `i32` -> Position of reference tie-point
23402/// min: 0, max: 1000000000, default: 1
23403/// yref: `i32` -> Position of reference tie-point
23404/// min: 0, max: 1000000000, default: 1
23405/// xsec: `i32` -> Position of secondary tie-point
23406/// min: 0, max: 1000000000, default: 1
23407/// ysec: `i32` -> Position of secondary tie-point
23408/// min: 0, max: 1000000000, default: 1
23409/// returns `VipsImage` - Output image
23410pub fn mosaic(
23411    refp: &VipsImage,
23412    sec: &VipsImage,
23413    direction: Direction,
23414    xref: i32,
23415    yref: i32,
23416    xsec: i32,
23417    ysec: i32,
23418) -> Result<VipsImage> {
23419    unsafe {
23420        let refp_in: *mut bindings::VipsImage = refp.ctx;
23421        let sec_in: *mut bindings::VipsImage = sec.ctx;
23422        let direction_in: i32 = direction as i32;
23423        let xref_in: i32 = xref;
23424        let yref_in: i32 = yref;
23425        let xsec_in: i32 = xsec;
23426        let ysec_in: i32 = ysec;
23427        let mut out_out: *mut bindings::VipsImage = null_mut();
23428
23429        let vips_op_response = bindings::vips_mosaic(
23430            refp_in,
23431            sec_in,
23432            &mut out_out,
23433            direction_in.try_into().unwrap(),
23434            xref_in,
23435            yref_in,
23436            xsec_in,
23437            ysec_in,
23438            NULL,
23439        );
23440        utils::result(
23441            vips_op_response,
23442            VipsImage { ctx: out_out },
23443            Error::MosaicError,
23444        )
23445    }
23446}
23447
23448/// Options for mosaic operation
23449#[derive(Clone, Debug)]
23450pub struct MosaicOptions {
23451    /// hwindow: `i32` -> Half window size
23452    /// min: 0, max: 1000000000, default: 5
23453    pub hwindow: i32,
23454    /// harea: `i32` -> Half area size
23455    /// min: 0, max: 1000000000, default: 15
23456    pub harea: i32,
23457    /// mblend: `i32` -> Maximum blend size
23458    /// min: 0, max: 10000, default: 10
23459    pub mblend: i32,
23460    /// bandno: `i32` -> Band to search for features on
23461    /// min: 0, max: 10000, default: 0
23462    pub bandno: i32,
23463    /// dx_0: `i32` -> Detected integer offset
23464    /// min: -10000000, max: 10000000, default: 0
23465    pub dx_0: i32,
23466    /// dy_0: `i32` -> Detected integer offset
23467    /// min: -10000000, max: 10000000, default: 0
23468    pub dy_0: i32,
23469    /// scale_1: `f64` -> Detected scale
23470    /// min: -10000000, max: 10000000, default: 1
23471    pub scale_1: f64,
23472    /// angle_1: `f64` -> Detected rotation
23473    /// min: -10000000, max: 10000000, default: 0
23474    pub angle_1: f64,
23475    /// dy_1: `f64` -> Detected first-order displacement
23476    /// min: -10000000, max: 10000000, default: 0
23477    pub dy_1: f64,
23478    /// dx_1: `f64` -> Detected first-order displacement
23479    /// min: -10000000, max: 10000000, default: 0
23480    pub dx_1: f64,
23481}
23482
23483impl std::default::Default for MosaicOptions {
23484    fn default() -> Self {
23485        MosaicOptions {
23486            hwindow: i32::from(5),
23487            harea: i32::from(15),
23488            mblend: i32::from(10),
23489            bandno: i32::from(0),
23490            dx_0: i32::from(0),
23491            dy_0: i32::from(0),
23492            scale_1: f64::from(1),
23493            angle_1: f64::from(0),
23494            dy_1: f64::from(0),
23495            dx_1: f64::from(0),
23496        }
23497    }
23498}
23499
23500/// VipsMosaic (mosaic), mosaic two images
23501/// refp: `&VipsImage` -> Reference image
23502/// sec: `&VipsImage` -> Secondary image
23503/// direction: `Direction` -> Horizontal or vertical mosaic
23504///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23505///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23506///  `Last` -> VIPS_DIRECTION_LAST = 2
23507/// xref: `i32` -> Position of reference tie-point
23508/// min: 0, max: 1000000000, default: 1
23509/// yref: `i32` -> Position of reference tie-point
23510/// min: 0, max: 1000000000, default: 1
23511/// xsec: `i32` -> Position of secondary tie-point
23512/// min: 0, max: 1000000000, default: 1
23513/// ysec: `i32` -> Position of secondary tie-point
23514/// min: 0, max: 1000000000, default: 1
23515/// mosaic_options: `&MosaicOptions` -> optional arguments
23516/// returns `VipsImage` - Output image
23517pub fn mosaic_with_opts(
23518    refp: &VipsImage,
23519    sec: &VipsImage,
23520    direction: Direction,
23521    xref: i32,
23522    yref: i32,
23523    xsec: i32,
23524    ysec: i32,
23525    mosaic_options: &MosaicOptions,
23526) -> Result<VipsImage> {
23527    unsafe {
23528        let refp_in: *mut bindings::VipsImage = refp.ctx;
23529        let sec_in: *mut bindings::VipsImage = sec.ctx;
23530        let direction_in: i32 = direction as i32;
23531        let xref_in: i32 = xref;
23532        let yref_in: i32 = yref;
23533        let xsec_in: i32 = xsec;
23534        let ysec_in: i32 = ysec;
23535        let mut out_out: *mut bindings::VipsImage = null_mut();
23536
23537        let hwindow_in: i32 = mosaic_options.hwindow;
23538        let hwindow_in_name = utils::new_c_string("hwindow")?;
23539
23540        let harea_in: i32 = mosaic_options.harea;
23541        let harea_in_name = utils::new_c_string("harea")?;
23542
23543        let mblend_in: i32 = mosaic_options.mblend;
23544        let mblend_in_name = utils::new_c_string("mblend")?;
23545
23546        let bandno_in: i32 = mosaic_options.bandno;
23547        let bandno_in_name = utils::new_c_string("bandno")?;
23548
23549        let dx_0_in: i32 = mosaic_options.dx_0;
23550        let dx_0_in_name = utils::new_c_string("dx0")?;
23551
23552        let dy_0_in: i32 = mosaic_options.dy_0;
23553        let dy_0_in_name = utils::new_c_string("dy0")?;
23554
23555        let scale_1_in: f64 = mosaic_options.scale_1;
23556        let scale_1_in_name = utils::new_c_string("scale1")?;
23557
23558        let angle_1_in: f64 = mosaic_options.angle_1;
23559        let angle_1_in_name = utils::new_c_string("angle1")?;
23560
23561        let dy_1_in: f64 = mosaic_options.dy_1;
23562        let dy_1_in_name = utils::new_c_string("dy1")?;
23563
23564        let dx_1_in: f64 = mosaic_options.dx_1;
23565        let dx_1_in_name = utils::new_c_string("dx1")?;
23566
23567        let vips_op_response = bindings::vips_mosaic(
23568            refp_in,
23569            sec_in,
23570            &mut out_out,
23571            direction_in.try_into().unwrap(),
23572            xref_in,
23573            yref_in,
23574            xsec_in,
23575            ysec_in,
23576            hwindow_in_name.as_ptr(),
23577            hwindow_in,
23578            harea_in_name.as_ptr(),
23579            harea_in,
23580            mblend_in_name.as_ptr(),
23581            mblend_in,
23582            bandno_in_name.as_ptr(),
23583            bandno_in,
23584            dx_0_in_name.as_ptr(),
23585            dx_0_in,
23586            dy_0_in_name.as_ptr(),
23587            dy_0_in,
23588            scale_1_in_name.as_ptr(),
23589            scale_1_in,
23590            angle_1_in_name.as_ptr(),
23591            angle_1_in,
23592            dy_1_in_name.as_ptr(),
23593            dy_1_in,
23594            dx_1_in_name.as_ptr(),
23595            dx_1_in,
23596            NULL,
23597        );
23598        utils::result(
23599            vips_op_response,
23600            VipsImage { ctx: out_out },
23601            Error::MosaicError,
23602        )
23603    }
23604}
23605
23606/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23607/// refp: `&VipsImage` -> Reference image
23608/// sec: `&VipsImage` -> Secondary image
23609/// direction: `Direction` -> Horizontal or vertical mosaic
23610///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23611///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23612///  `Last` -> VIPS_DIRECTION_LAST = 2
23613/// xr_1: `i32` -> Position of first reference tie-point
23614/// min: -1000000000, max: 1000000000, default: 1
23615/// yr_1: `i32` -> Position of first reference tie-point
23616/// min: -1000000000, max: 1000000000, default: 1
23617/// xs_1: `i32` -> Position of first secondary tie-point
23618/// min: -1000000000, max: 1000000000, default: 1
23619/// ys_1: `i32` -> Position of first secondary tie-point
23620/// min: -1000000000, max: 1000000000, default: 1
23621/// xr_2: `i32` -> Position of second reference tie-point
23622/// min: -1000000000, max: 1000000000, default: 1
23623/// yr_2: `i32` -> Position of second reference tie-point
23624/// min: -1000000000, max: 1000000000, default: 1
23625/// xs_2: `i32` -> Position of second secondary tie-point
23626/// min: -1000000000, max: 1000000000, default: 1
23627/// ys_2: `i32` -> Position of second secondary tie-point
23628/// min: -1000000000, max: 1000000000, default: 1
23629/// returns `VipsImage` - Output image
23630pub fn mosaic_1(
23631    refp: &VipsImage,
23632    sec: &VipsImage,
23633    direction: Direction,
23634    xr_1: i32,
23635    yr_1: i32,
23636    xs_1: i32,
23637    ys_1: i32,
23638    xr_2: i32,
23639    yr_2: i32,
23640    xs_2: i32,
23641    ys_2: i32,
23642) -> Result<VipsImage> {
23643    unsafe {
23644        let refp_in: *mut bindings::VipsImage = refp.ctx;
23645        let sec_in: *mut bindings::VipsImage = sec.ctx;
23646        let direction_in: i32 = direction as i32;
23647        let xr_1_in: i32 = xr_1;
23648        let yr_1_in: i32 = yr_1;
23649        let xs_1_in: i32 = xs_1;
23650        let ys_1_in: i32 = ys_1;
23651        let xr_2_in: i32 = xr_2;
23652        let yr_2_in: i32 = yr_2;
23653        let xs_2_in: i32 = xs_2;
23654        let ys_2_in: i32 = ys_2;
23655        let mut out_out: *mut bindings::VipsImage = null_mut();
23656
23657        let vips_op_response = bindings::vips_mosaic1(
23658            refp_in,
23659            sec_in,
23660            &mut out_out,
23661            direction_in.try_into().unwrap(),
23662            xr_1_in,
23663            yr_1_in,
23664            xs_1_in,
23665            ys_1_in,
23666            xr_2_in,
23667            yr_2_in,
23668            xs_2_in,
23669            ys_2_in,
23670            NULL,
23671        );
23672        utils::result(
23673            vips_op_response,
23674            VipsImage { ctx: out_out },
23675            Error::Mosaic1Error,
23676        )
23677    }
23678}
23679
23680/// Options for mosaic_1 operation
23681#[derive(Clone, Debug)]
23682pub struct Mosaic1Options {
23683    /// hwindow: `i32` -> Half window size
23684    /// min: 0, max: 1000000000, default: 5
23685    pub hwindow: i32,
23686    /// harea: `i32` -> Half area size
23687    /// min: 0, max: 1000000000, default: 15
23688    pub harea: i32,
23689    /// search: `bool` -> Search to improve tie-points
23690    /// default: false
23691    pub search: bool,
23692    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23693    pub interpolate: VipsInterpolate,
23694    /// mblend: `i32` -> Maximum blend size
23695    /// min: 0, max: 10000, default: 10
23696    pub mblend: i32,
23697}
23698
23699impl std::default::Default for Mosaic1Options {
23700    fn default() -> Self {
23701        Mosaic1Options {
23702            hwindow: i32::from(5),
23703            harea: i32::from(15),
23704            search: false,
23705            interpolate: VipsInterpolate::new(),
23706            mblend: i32::from(10),
23707        }
23708    }
23709}
23710
23711/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23712/// refp: `&VipsImage` -> Reference image
23713/// sec: `&VipsImage` -> Secondary image
23714/// direction: `Direction` -> Horizontal or vertical mosaic
23715///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23716///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23717///  `Last` -> VIPS_DIRECTION_LAST = 2
23718/// xr_1: `i32` -> Position of first reference tie-point
23719/// min: -1000000000, max: 1000000000, default: 1
23720/// yr_1: `i32` -> Position of first reference tie-point
23721/// min: -1000000000, max: 1000000000, default: 1
23722/// xs_1: `i32` -> Position of first secondary tie-point
23723/// min: -1000000000, max: 1000000000, default: 1
23724/// ys_1: `i32` -> Position of first secondary tie-point
23725/// min: -1000000000, max: 1000000000, default: 1
23726/// xr_2: `i32` -> Position of second reference tie-point
23727/// min: -1000000000, max: 1000000000, default: 1
23728/// yr_2: `i32` -> Position of second reference tie-point
23729/// min: -1000000000, max: 1000000000, default: 1
23730/// xs_2: `i32` -> Position of second secondary tie-point
23731/// min: -1000000000, max: 1000000000, default: 1
23732/// ys_2: `i32` -> Position of second secondary tie-point
23733/// min: -1000000000, max: 1000000000, default: 1
23734/// mosaic_1_options: `&Mosaic1Options` -> optional arguments
23735/// returns `VipsImage` - Output image
23736pub fn mosaic_1_with_opts(
23737    refp: &VipsImage,
23738    sec: &VipsImage,
23739    direction: Direction,
23740    xr_1: i32,
23741    yr_1: i32,
23742    xs_1: i32,
23743    ys_1: i32,
23744    xr_2: i32,
23745    yr_2: i32,
23746    xs_2: i32,
23747    ys_2: i32,
23748    mosaic_1_options: &Mosaic1Options,
23749) -> Result<VipsImage> {
23750    unsafe {
23751        let refp_in: *mut bindings::VipsImage = refp.ctx;
23752        let sec_in: *mut bindings::VipsImage = sec.ctx;
23753        let direction_in: i32 = direction as i32;
23754        let xr_1_in: i32 = xr_1;
23755        let yr_1_in: i32 = yr_1;
23756        let xs_1_in: i32 = xs_1;
23757        let ys_1_in: i32 = ys_1;
23758        let xr_2_in: i32 = xr_2;
23759        let yr_2_in: i32 = yr_2;
23760        let xs_2_in: i32 = xs_2;
23761        let ys_2_in: i32 = ys_2;
23762        let mut out_out: *mut bindings::VipsImage = null_mut();
23763
23764        let hwindow_in: i32 = mosaic_1_options.hwindow;
23765        let hwindow_in_name = utils::new_c_string("hwindow")?;
23766
23767        let harea_in: i32 = mosaic_1_options.harea;
23768        let harea_in_name = utils::new_c_string("harea")?;
23769
23770        let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
23771        let search_in_name = utils::new_c_string("search")?;
23772
23773        let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
23774        let interpolate_in_name = utils::new_c_string("interpolate")?;
23775
23776        let mblend_in: i32 = mosaic_1_options.mblend;
23777        let mblend_in_name = utils::new_c_string("mblend")?;
23778
23779        let vips_op_response = bindings::vips_mosaic1(
23780            refp_in,
23781            sec_in,
23782            &mut out_out,
23783            direction_in.try_into().unwrap(),
23784            xr_1_in,
23785            yr_1_in,
23786            xs_1_in,
23787            ys_1_in,
23788            xr_2_in,
23789            yr_2_in,
23790            xs_2_in,
23791            ys_2_in,
23792            hwindow_in_name.as_ptr(),
23793            hwindow_in,
23794            harea_in_name.as_ptr(),
23795            harea_in,
23796            search_in_name.as_ptr(),
23797            search_in,
23798            interpolate_in_name.as_ptr(),
23799            interpolate_in,
23800            mblend_in_name.as_ptr(),
23801            mblend_in,
23802            NULL,
23803        );
23804        utils::result(
23805            vips_op_response,
23806            VipsImage { ctx: out_out },
23807            Error::Mosaic1Error,
23808        )
23809    }
23810}
23811
23812/// VipsMatrixinvert (matrixinvert), invert an matrix
23813/// inp: `&VipsImage` -> An square matrix
23814/// returns `VipsImage` - Output matrix
23815pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
23816    unsafe {
23817        let inp_in: *mut bindings::VipsImage = inp.ctx;
23818        let mut out_out: *mut bindings::VipsImage = null_mut();
23819
23820        let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
23821        utils::result(
23822            vips_op_response,
23823            VipsImage { ctx: out_out },
23824            Error::MatrixinvertError,
23825        )
23826    }
23827}
23828
23829/// VipsMatch (match), first-order match of two images
23830/// refp: `&VipsImage` -> Reference image
23831/// sec: `&VipsImage` -> Secondary image
23832/// xr_1: `i32` -> Position of first reference tie-point
23833/// min: -1000000000, max: 1000000000, default: 1
23834/// yr_1: `i32` -> Position of first reference tie-point
23835/// min: -1000000000, max: 1000000000, default: 1
23836/// xs_1: `i32` -> Position of first secondary tie-point
23837/// min: -1000000000, max: 1000000000, default: 1
23838/// ys_1: `i32` -> Position of first secondary tie-point
23839/// min: -1000000000, max: 1000000000, default: 1
23840/// xr_2: `i32` -> Position of second reference tie-point
23841/// min: -1000000000, max: 1000000000, default: 1
23842/// yr_2: `i32` -> Position of second reference tie-point
23843/// min: -1000000000, max: 1000000000, default: 1
23844/// xs_2: `i32` -> Position of second secondary tie-point
23845/// min: -1000000000, max: 1000000000, default: 1
23846/// ys_2: `i32` -> Position of second secondary tie-point
23847/// min: -1000000000, max: 1000000000, default: 1
23848/// returns `VipsImage` - Output image
23849pub fn matches(
23850    refp: &VipsImage,
23851    sec: &VipsImage,
23852    xr_1: i32,
23853    yr_1: i32,
23854    xs_1: i32,
23855    ys_1: i32,
23856    xr_2: i32,
23857    yr_2: i32,
23858    xs_2: i32,
23859    ys_2: i32,
23860) -> Result<VipsImage> {
23861    unsafe {
23862        let refp_in: *mut bindings::VipsImage = refp.ctx;
23863        let sec_in: *mut bindings::VipsImage = sec.ctx;
23864        let xr_1_in: i32 = xr_1;
23865        let yr_1_in: i32 = yr_1;
23866        let xs_1_in: i32 = xs_1;
23867        let ys_1_in: i32 = ys_1;
23868        let xr_2_in: i32 = xr_2;
23869        let yr_2_in: i32 = yr_2;
23870        let xs_2_in: i32 = xs_2;
23871        let ys_2_in: i32 = ys_2;
23872        let mut out_out: *mut bindings::VipsImage = null_mut();
23873
23874        let vips_op_response = bindings::vips_match(
23875            refp_in,
23876            sec_in,
23877            &mut out_out,
23878            xr_1_in,
23879            yr_1_in,
23880            xs_1_in,
23881            ys_1_in,
23882            xr_2_in,
23883            yr_2_in,
23884            xs_2_in,
23885            ys_2_in,
23886            NULL,
23887        );
23888        utils::result(
23889            vips_op_response,
23890            VipsImage { ctx: out_out },
23891            Error::MatchError,
23892        )
23893    }
23894}
23895
23896/// Options for matches operation
23897#[derive(Clone, Debug)]
23898pub struct MatchOptions {
23899    /// hwindow: `i32` -> Half window size
23900    /// min: 0, max: 1000000000, default: 1
23901    pub hwindow: i32,
23902    /// harea: `i32` -> Half area size
23903    /// min: 0, max: 1000000000, default: 1
23904    pub harea: i32,
23905    /// search: `bool` -> Search to improve tie-points
23906    /// default: false
23907    pub search: bool,
23908    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23909    pub interpolate: VipsInterpolate,
23910}
23911
23912impl std::default::Default for MatchOptions {
23913    fn default() -> Self {
23914        MatchOptions {
23915            hwindow: i32::from(1),
23916            harea: i32::from(1),
23917            search: false,
23918            interpolate: VipsInterpolate::new(),
23919        }
23920    }
23921}
23922
23923/// VipsMatch (match), first-order match of two images
23924/// refp: `&VipsImage` -> Reference image
23925/// sec: `&VipsImage` -> Secondary image
23926/// xr_1: `i32` -> Position of first reference tie-point
23927/// min: -1000000000, max: 1000000000, default: 1
23928/// yr_1: `i32` -> Position of first reference tie-point
23929/// min: -1000000000, max: 1000000000, default: 1
23930/// xs_1: `i32` -> Position of first secondary tie-point
23931/// min: -1000000000, max: 1000000000, default: 1
23932/// ys_1: `i32` -> Position of first secondary tie-point
23933/// min: -1000000000, max: 1000000000, default: 1
23934/// xr_2: `i32` -> Position of second reference tie-point
23935/// min: -1000000000, max: 1000000000, default: 1
23936/// yr_2: `i32` -> Position of second reference tie-point
23937/// min: -1000000000, max: 1000000000, default: 1
23938/// xs_2: `i32` -> Position of second secondary tie-point
23939/// min: -1000000000, max: 1000000000, default: 1
23940/// ys_2: `i32` -> Position of second secondary tie-point
23941/// min: -1000000000, max: 1000000000, default: 1
23942/// matches_options: `&MatchOptions` -> optional arguments
23943/// returns `VipsImage` - Output image
23944pub fn matches_with_opts(
23945    refp: &VipsImage,
23946    sec: &VipsImage,
23947    xr_1: i32,
23948    yr_1: i32,
23949    xs_1: i32,
23950    ys_1: i32,
23951    xr_2: i32,
23952    yr_2: i32,
23953    xs_2: i32,
23954    ys_2: i32,
23955    matches_options: &MatchOptions,
23956) -> Result<VipsImage> {
23957    unsafe {
23958        let refp_in: *mut bindings::VipsImage = refp.ctx;
23959        let sec_in: *mut bindings::VipsImage = sec.ctx;
23960        let xr_1_in: i32 = xr_1;
23961        let yr_1_in: i32 = yr_1;
23962        let xs_1_in: i32 = xs_1;
23963        let ys_1_in: i32 = ys_1;
23964        let xr_2_in: i32 = xr_2;
23965        let yr_2_in: i32 = yr_2;
23966        let xs_2_in: i32 = xs_2;
23967        let ys_2_in: i32 = ys_2;
23968        let mut out_out: *mut bindings::VipsImage = null_mut();
23969
23970        let hwindow_in: i32 = matches_options.hwindow;
23971        let hwindow_in_name = utils::new_c_string("hwindow")?;
23972
23973        let harea_in: i32 = matches_options.harea;
23974        let harea_in_name = utils::new_c_string("harea")?;
23975
23976        let search_in: i32 = if matches_options.search { 1 } else { 0 };
23977        let search_in_name = utils::new_c_string("search")?;
23978
23979        let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
23980        let interpolate_in_name = utils::new_c_string("interpolate")?;
23981
23982        let vips_op_response = bindings::vips_match(
23983            refp_in,
23984            sec_in,
23985            &mut out_out,
23986            xr_1_in,
23987            yr_1_in,
23988            xs_1_in,
23989            ys_1_in,
23990            xr_2_in,
23991            yr_2_in,
23992            xs_2_in,
23993            ys_2_in,
23994            hwindow_in_name.as_ptr(),
23995            hwindow_in,
23996            harea_in_name.as_ptr(),
23997            harea_in,
23998            search_in_name.as_ptr(),
23999            search_in,
24000            interpolate_in_name.as_ptr(),
24001            interpolate_in,
24002            NULL,
24003        );
24004        utils::result(
24005            vips_op_response,
24006            VipsImage { ctx: out_out },
24007            Error::MatchError,
24008        )
24009    }
24010}
24011
24012/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24013/// inp: `&VipsImage` -> Input image
24014/// returns `VipsImage` - Output image
24015pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
24016    unsafe {
24017        let inp_in: *mut bindings::VipsImage = inp.ctx;
24018        let mut out_out: *mut bindings::VipsImage = null_mut();
24019
24020        let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
24021        utils::result(
24022            vips_op_response,
24023            VipsImage { ctx: out_out },
24024            Error::GlobalbalanceError,
24025        )
24026    }
24027}
24028
24029/// Options for globalbalance operation
24030#[derive(Clone, Debug)]
24031pub struct GlobalbalanceOptions {
24032    /// gamma: `f64` -> Image gamma
24033    /// min: 0.00001, max: 10, default: 1.6
24034    pub gamma: f64,
24035    /// int_output: `bool` -> Integer output
24036    /// default: false
24037    pub int_output: bool,
24038}
24039
24040impl std::default::Default for GlobalbalanceOptions {
24041    fn default() -> Self {
24042        GlobalbalanceOptions {
24043            gamma: f64::from(1.6),
24044            int_output: false,
24045        }
24046    }
24047}
24048
24049/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24050/// inp: `&VipsImage` -> Input image
24051/// globalbalance_options: `&GlobalbalanceOptions` -> optional arguments
24052/// returns `VipsImage` - Output image
24053pub fn globalbalance_with_opts(
24054    inp: &VipsImage,
24055    globalbalance_options: &GlobalbalanceOptions,
24056) -> Result<VipsImage> {
24057    unsafe {
24058        let inp_in: *mut bindings::VipsImage = inp.ctx;
24059        let mut out_out: *mut bindings::VipsImage = null_mut();
24060
24061        let gamma_in: f64 = globalbalance_options.gamma;
24062        let gamma_in_name = utils::new_c_string("gamma")?;
24063
24064        let int_output_in: i32 = if globalbalance_options.int_output {
24065            1
24066        } else {
24067            0
24068        };
24069        let int_output_in_name = utils::new_c_string("int-output")?;
24070
24071        let vips_op_response = bindings::vips_globalbalance(
24072            inp_in,
24073            &mut out_out,
24074            gamma_in_name.as_ptr(),
24075            gamma_in,
24076            int_output_in_name.as_ptr(),
24077            int_output_in,
24078            NULL,
24079        );
24080        utils::result(
24081            vips_op_response,
24082            VipsImage { ctx: out_out },
24083            Error::GlobalbalanceError,
24084        )
24085    }
24086}