libvips_rs/
ops.rs

1// (c) Copyright 2019-2025 MIT
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    ///  `Auto` -> VIPS_INTENT_AUTO = 32
458    Auto = 32,
459    ///  `Last` -> VIPS_INTENT_LAST = 33
460    Last = 33,
461}
462
463#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
464pub enum Interesting {
465    ///  `None` -> VIPS_INTERESTING_NONE = 0
466    None = 0,
467    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
468    Centre = 1,
469    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
470    Entropy = 2,
471    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
472    Attention = 3,
473    ///  `Low` -> VIPS_INTERESTING_LOW = 4
474    Low = 4,
475    ///  `High` -> VIPS_INTERESTING_HIGH = 5
476    High = 5,
477    ///  `All` -> VIPS_INTERESTING_ALL = 6
478    All = 6,
479    ///  `Last` -> VIPS_INTERESTING_LAST = 7
480    Last = 7,
481}
482
483#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
484pub enum Interpretation {
485    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
486    Error = -1,
487    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
488    Multiband = 0,
489    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
490    BW = 1,
491    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
492    Histogram = 10,
493    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
494    Xyz = 12,
495    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
496    Lab = 13,
497    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
498    Cmyk = 15,
499    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
500    Labq = 16,
501    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
502    Rgb = 17,
503    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
504    Cmc = 18,
505    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
506    Lch = 19,
507    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
508    Labs = 21,
509    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
510    Srgb = 22,
511    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
512    Yxy = 23,
513    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
514    Fourier = 24,
515    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
516    Rgb16 = 25,
517    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
518    Grey16 = 26,
519    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
520    Matrix = 27,
521    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
522    Scrgb = 28,
523    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
524    Hsv = 29,
525    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
526    Last = 30,
527}
528
529#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
530pub enum Kernel {
531    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
532    Nearest = 0,
533    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
534    Linear = 1,
535    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
536    Cubic = 2,
537    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
538    Mitchell = 3,
539    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
540    Lanczos2 = 4,
541    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5
542    Lanczos3 = 5,
543    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
544    Mks2013 = 6,
545    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
546    Mks2021 = 7,
547    ///  `Last` -> VIPS_KERNEL_LAST = 8
548    Last = 8,
549}
550
551#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
552pub enum OperationBoolean {
553    ///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0
554    And = 0,
555    ///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
556    Or = 1,
557    ///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
558    Eor = 2,
559    ///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
560    Lshift = 3,
561    ///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
562    Rshift = 4,
563    ///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
564    Last = 5,
565}
566
567#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
568pub enum OperationComplex {
569    ///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0
570    Polar = 0,
571    ///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
572    Rect = 1,
573    ///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
574    Conj = 2,
575    ///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
576    Last = 3,
577}
578
579#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
580pub enum OperationComplex2 {
581    ///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0
582    CrossPhase = 0,
583    ///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
584    Last = 1,
585}
586
587#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
588pub enum OperationComplexget {
589    ///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0
590    Real = 0,
591    ///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
592    Imag = 1,
593    ///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
594    Last = 2,
595}
596
597#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
598pub enum OperationMath {
599    ///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0
600    Sin = 0,
601    ///  `Co` -> VIPS_OPERATION_MATH_COS = 1
602    Co = 1,
603    ///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
604    Tan = 2,
605    ///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
606    Asin = 3,
607    ///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
608    Aco = 4,
609    ///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
610    Atan = 5,
611    ///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
612    Log = 6,
613    ///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
614    Log10 = 7,
615    ///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
616    Exp = 8,
617    ///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
618    Exp10 = 9,
619    ///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
620    Sinh = 10,
621    ///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
622    Cosh = 11,
623    ///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
624    Tanh = 12,
625    ///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
626    Asinh = 13,
627    ///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
628    Acosh = 14,
629    ///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
630    Atanh = 15,
631    ///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
632    Last = 16,
633}
634
635#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
636pub enum OperationMath2 {
637    ///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0
638    Pow = 0,
639    ///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
640    Wop = 1,
641    ///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
642    Atan2 = 2,
643    ///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
644    Last = 3,
645}
646
647#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
648pub enum OperationMorphology {
649    ///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0
650    Erode = 0,
651    ///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
652    Dilate = 1,
653    ///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
654    Last = 2,
655}
656
657#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
658pub enum OperationRelational {
659    ///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0
660    Equal = 0,
661    ///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
662    Noteq = 1,
663    ///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
664    Less = 2,
665    ///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
666    Lesseq = 3,
667    ///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
668    More = 4,
669    ///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
670    Moreeq = 5,
671    ///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
672    Last = 6,
673}
674
675#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
676pub enum OperationRound {
677    ///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0
678    Rint = 0,
679    ///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
680    Ceil = 1,
681    ///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
682    Floor = 2,
683    ///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
684    Last = 3,
685}
686
687#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
688pub enum PCS {
689    ///  `Lab` -> VIPS_PCS_LAB = 0
690    Lab = 0,
691    ///  `Xyz` -> VIPS_PCS_XYZ = 1
692    Xyz = 1,
693    ///  `Last` -> VIPS_PCS_LAST = 2
694    Last = 2,
695}
696
697#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
698pub enum Precision {
699    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
700    Integer = 0,
701    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
702    Float = 1,
703    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
704    Approximate = 2,
705    ///  `Last` -> VIPS_PRECISION_LAST = 3
706    Last = 3,
707}
708
709#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
710pub enum RegionShrink {
711    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0
712    Mean = 0,
713    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
714    Median = 1,
715    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
716    Mode = 2,
717    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
718    Max = 3,
719    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
720    Min = 4,
721    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
722    Nearest = 5,
723    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
724    Last = 6,
725}
726
727#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
728pub enum SdfShape {
729    ///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0
730    Circle = 0,
731    ///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
732    Box = 1,
733    ///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
734    RoundedBox = 2,
735    ///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
736    Line = 3,
737    ///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
738    Last = 4,
739}
740
741#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
742pub enum Size {
743    ///  `Both` -> VIPS_SIZE_BOTH = 0
744    Both = 0,
745    ///  `Up` -> VIPS_SIZE_UP = 1
746    Up = 1,
747    ///  `Down` -> VIPS_SIZE_DOWN = 2
748    Down = 2,
749    ///  `Force` -> VIPS_SIZE_FORCE = 3
750    Force = 3,
751    ///  `Last` -> VIPS_SIZE_LAST = 4
752    Last = 4,
753}
754
755#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
756pub enum TextWrap {
757    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0
758    Word = 0,
759    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
760    Char = 1,
761    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
762    WordChar = 2,
763    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
764    None = 3,
765    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
766    Last = 4,
767}
768
769/// VipsSystem (system), run an external command
770/// cmd_format: `&str` -> Command to run
771
772pub fn system(cmd_format: &str) -> Result<()> {
773    unsafe {
774        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
775
776        let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
777        utils::result(vips_op_response, (), Error::SystemError)
778    }
779}
780
781/// Options for system operation
782#[derive(Clone, Debug)]
783pub struct SystemOptions {
784    /// inp: `Vec<VipsImage>` -> Array of input images
785    pub inp: Vec<VipsImage>,
786    /// out: `VipsImage` -> Output image
787    pub out: VipsImage,
788    /// log: `String` -> Command log
789    pub log: String,
790    /// out_format: `String` -> Format for output filename
791    pub out_format: String,
792    /// in_format: `String` -> Format for input filename
793    pub in_format: String,
794}
795
796impl std::default::Default for SystemOptions {
797    fn default() -> Self {
798        SystemOptions {
799            inp: Vec::new(),
800            out: VipsImage::new(),
801            log: String::new(),
802            out_format: String::new(),
803            in_format: String::new(),
804        }
805    }
806}
807
808/// VipsSystem (system), run an external command
809/// cmd_format: `&str` -> Command to run
810/// system_options: `&SystemOptions` -> optional arguments
811
812pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
813    unsafe {
814        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
815
816        let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
817        let inp_in = inp_wrapper.ctx;
818        let inp_in_name = utils::new_c_string("inp")?;
819
820        let out_in: *mut bindings::VipsImage = system_options.out.ctx;
821        let out_in_name = utils::new_c_string("out")?;
822
823        let log_in: CString = utils::new_c_string(&system_options.log)?;
824        let log_in_name = utils::new_c_string("log")?;
825
826        let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
827        let out_format_in_name = utils::new_c_string("out-format")?;
828
829        let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
830        let in_format_in_name = utils::new_c_string("in-format")?;
831
832        let vips_op_response = bindings::vips_system(
833            cmd_format_in.as_ptr(),
834            inp_in_name.as_ptr(),
835            inp_in,
836            out_in_name.as_ptr(),
837            out_in,
838            log_in_name.as_ptr(),
839            log_in.as_ptr(),
840            out_format_in_name.as_ptr(),
841            out_format_in.as_ptr(),
842            in_format_in_name.as_ptr(),
843            in_format_in.as_ptr(),
844            NULL,
845        );
846        utils::result(vips_op_response, (), Error::SystemError)
847    }
848}
849
850/// VipsAdd (add), add two images
851/// left: `&VipsImage` -> Left-hand image argument
852/// right: `&VipsImage` -> Right-hand image argument
853/// returns `VipsImage` - Output image
854pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
855    unsafe {
856        let left_in: *mut bindings::VipsImage = left.ctx;
857        let right_in: *mut bindings::VipsImage = right.ctx;
858        let mut out_out: *mut bindings::VipsImage = null_mut();
859
860        let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
861        utils::result(
862            vips_op_response,
863            VipsImage { ctx: out_out },
864            Error::AddError,
865        )
866    }
867}
868
869/// VipsMinpair (minpair), minimum of a pair of images
870/// left: `&VipsImage` -> Left-hand image argument
871/// right: `&VipsImage` -> Right-hand image argument
872/// returns `VipsImage` - Output image
873pub fn minpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
874    unsafe {
875        let left_in: *mut bindings::VipsImage = left.ctx;
876        let right_in: *mut bindings::VipsImage = right.ctx;
877        let mut out_out: *mut bindings::VipsImage = null_mut();
878
879        let vips_op_response = bindings::vips_minpair(left_in, right_in, &mut out_out, NULL);
880        utils::result(
881            vips_op_response,
882            VipsImage { ctx: out_out },
883            Error::MinpairError,
884        )
885    }
886}
887
888/// VipsMaxpair (maxpair), maximum of a pair of images
889/// left: `&VipsImage` -> Left-hand image argument
890/// right: `&VipsImage` -> Right-hand image argument
891/// returns `VipsImage` - Output image
892pub fn maxpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
893    unsafe {
894        let left_in: *mut bindings::VipsImage = left.ctx;
895        let right_in: *mut bindings::VipsImage = right.ctx;
896        let mut out_out: *mut bindings::VipsImage = null_mut();
897
898        let vips_op_response = bindings::vips_maxpair(left_in, right_in, &mut out_out, NULL);
899        utils::result(
900            vips_op_response,
901            VipsImage { ctx: out_out },
902            Error::MaxpairError,
903        )
904    }
905}
906
907/// VipsSubtract (subtract), subtract two images
908/// left: `&VipsImage` -> Left-hand image argument
909/// right: `&VipsImage` -> Right-hand image argument
910/// returns `VipsImage` - Output image
911pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
912    unsafe {
913        let left_in: *mut bindings::VipsImage = left.ctx;
914        let right_in: *mut bindings::VipsImage = right.ctx;
915        let mut out_out: *mut bindings::VipsImage = null_mut();
916
917        let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
918        utils::result(
919            vips_op_response,
920            VipsImage { ctx: out_out },
921            Error::SubtractError,
922        )
923    }
924}
925
926/// VipsMultiply (multiply), multiply two images
927/// left: `&VipsImage` -> Left-hand image argument
928/// right: `&VipsImage` -> Right-hand image argument
929/// returns `VipsImage` - Output image
930pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
931    unsafe {
932        let left_in: *mut bindings::VipsImage = left.ctx;
933        let right_in: *mut bindings::VipsImage = right.ctx;
934        let mut out_out: *mut bindings::VipsImage = null_mut();
935
936        let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
937        utils::result(
938            vips_op_response,
939            VipsImage { ctx: out_out },
940            Error::MultiplyError,
941        )
942    }
943}
944
945/// VipsDivide (divide), divide two images
946/// left: `&VipsImage` -> Left-hand image argument
947/// right: `&VipsImage` -> Right-hand image argument
948/// returns `VipsImage` - Output image
949pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
950    unsafe {
951        let left_in: *mut bindings::VipsImage = left.ctx;
952        let right_in: *mut bindings::VipsImage = right.ctx;
953        let mut out_out: *mut bindings::VipsImage = null_mut();
954
955        let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
956        utils::result(
957            vips_op_response,
958            VipsImage { ctx: out_out },
959            Error::DivideError,
960        )
961    }
962}
963
964/// VipsRelational (relational), relational operation on two images
965/// left: `&VipsImage` -> Left-hand image argument
966/// right: `&VipsImage` -> Right-hand image argument
967/// relational: `OperationRelational` -> Relational to perform
968///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
969///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
970///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
971///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
972///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
973///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
974///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
975/// returns `VipsImage` - Output image
976pub fn relational(
977    left: &VipsImage,
978    right: &VipsImage,
979    relational: OperationRelational,
980) -> Result<VipsImage> {
981    unsafe {
982        let left_in: *mut bindings::VipsImage = left.ctx;
983        let right_in: *mut bindings::VipsImage = right.ctx;
984        let relational_in: i32 = relational as i32;
985        let mut out_out: *mut bindings::VipsImage = null_mut();
986
987        let vips_op_response = bindings::vips_relational(
988            left_in,
989            right_in,
990            &mut out_out,
991            relational_in.try_into().unwrap(),
992            NULL,
993        );
994        utils::result(
995            vips_op_response,
996            VipsImage { ctx: out_out },
997            Error::RelationalError,
998        )
999    }
1000}
1001
1002/// VipsRemainder (remainder), remainder after integer division of two images
1003/// left: `&VipsImage` -> Left-hand image argument
1004/// right: `&VipsImage` -> Right-hand image argument
1005/// returns `VipsImage` - Output image
1006pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1007    unsafe {
1008        let left_in: *mut bindings::VipsImage = left.ctx;
1009        let right_in: *mut bindings::VipsImage = right.ctx;
1010        let mut out_out: *mut bindings::VipsImage = null_mut();
1011
1012        let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
1013        utils::result(
1014            vips_op_response,
1015            VipsImage { ctx: out_out },
1016            Error::RemainderError,
1017        )
1018    }
1019}
1020
1021/// VipsBoolean (boolean), boolean operation on two images
1022/// left: `&VipsImage` -> Left-hand image argument
1023/// right: `&VipsImage` -> Right-hand image argument
1024/// boolean: `OperationBoolean` -> Boolean to perform
1025///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1026///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1027///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1028///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1029///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1030///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1031/// returns `VipsImage` - Output image
1032pub fn boolean(
1033    left: &VipsImage,
1034    right: &VipsImage,
1035    boolean: OperationBoolean,
1036) -> Result<VipsImage> {
1037    unsafe {
1038        let left_in: *mut bindings::VipsImage = left.ctx;
1039        let right_in: *mut bindings::VipsImage = right.ctx;
1040        let boolean_in: i32 = boolean as i32;
1041        let mut out_out: *mut bindings::VipsImage = null_mut();
1042
1043        let vips_op_response = bindings::vips_boolean(
1044            left_in,
1045            right_in,
1046            &mut out_out,
1047            boolean_in.try_into().unwrap(),
1048            NULL,
1049        );
1050        utils::result(
1051            vips_op_response,
1052            VipsImage { ctx: out_out },
1053            Error::BooleanError,
1054        )
1055    }
1056}
1057
1058/// VipsMath2 (math2), binary math operations
1059/// left: `&VipsImage` -> Left-hand image argument
1060/// right: `&VipsImage` -> Right-hand image argument
1061/// math_2: `OperationMath2` -> Math to perform
1062///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1063///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1064///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1065///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1066/// returns `VipsImage` - Output image
1067pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1068    unsafe {
1069        let left_in: *mut bindings::VipsImage = left.ctx;
1070        let right_in: *mut bindings::VipsImage = right.ctx;
1071        let math_2_in: i32 = math_2 as i32;
1072        let mut out_out: *mut bindings::VipsImage = null_mut();
1073
1074        let vips_op_response = bindings::vips_math2(
1075            left_in,
1076            right_in,
1077            &mut out_out,
1078            math_2_in.try_into().unwrap(),
1079            NULL,
1080        );
1081        utils::result(
1082            vips_op_response,
1083            VipsImage { ctx: out_out },
1084            Error::Math2Error,
1085        )
1086    }
1087}
1088
1089/// VipsComplex2 (complex2), complex binary operations on two images
1090/// left: `&VipsImage` -> Left-hand image argument
1091/// right: `&VipsImage` -> Right-hand image argument
1092/// cmplx: `OperationComplex2` -> Binary complex operation to perform
1093///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0 [DEFAULT]
1094///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
1095/// returns `VipsImage` - Output image
1096pub fn complex_2(
1097    left: &VipsImage,
1098    right: &VipsImage,
1099    cmplx: OperationComplex2,
1100) -> Result<VipsImage> {
1101    unsafe {
1102        let left_in: *mut bindings::VipsImage = left.ctx;
1103        let right_in: *mut bindings::VipsImage = right.ctx;
1104        let cmplx_in: i32 = cmplx as i32;
1105        let mut out_out: *mut bindings::VipsImage = null_mut();
1106
1107        let vips_op_response = bindings::vips_complex2(
1108            left_in,
1109            right_in,
1110            &mut out_out,
1111            cmplx_in.try_into().unwrap(),
1112            NULL,
1113        );
1114        utils::result(
1115            vips_op_response,
1116            VipsImage { ctx: out_out },
1117            Error::Complex2Error,
1118        )
1119    }
1120}
1121
1122/// VipsComplexform (complexform), form a complex image from two real images
1123/// left: `&VipsImage` -> Left-hand image argument
1124/// right: `&VipsImage` -> Right-hand image argument
1125/// returns `VipsImage` - Output image
1126pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1127    unsafe {
1128        let left_in: *mut bindings::VipsImage = left.ctx;
1129        let right_in: *mut bindings::VipsImage = right.ctx;
1130        let mut out_out: *mut bindings::VipsImage = null_mut();
1131
1132        let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1133        utils::result(
1134            vips_op_response,
1135            VipsImage { ctx: out_out },
1136            Error::ComplexformError,
1137        )
1138    }
1139}
1140
1141/// VipsClamp (clamp), clamp values of an image
1142/// inp: `&VipsImage` -> Input image
1143/// returns `VipsImage` - Output image
1144pub fn clamp(inp: &VipsImage) -> Result<VipsImage> {
1145    unsafe {
1146        let inp_in: *mut bindings::VipsImage = inp.ctx;
1147        let mut out_out: *mut bindings::VipsImage = null_mut();
1148
1149        let vips_op_response = bindings::vips_clamp(inp_in, &mut out_out, NULL);
1150        utils::result(
1151            vips_op_response,
1152            VipsImage { ctx: out_out },
1153            Error::ClampError,
1154        )
1155    }
1156}
1157
1158/// Options for clamp operation
1159#[derive(Clone, Debug)]
1160pub struct ClampOptions {
1161    /// min: `f64` -> Minimum value
1162    /// min: -inf, max: inf, default: 0
1163    pub min: f64,
1164    /// max: `f64` -> Maximum value
1165    /// min: -inf, max: inf, default: 1
1166    pub max: f64,
1167}
1168
1169impl std::default::Default for ClampOptions {
1170    fn default() -> Self {
1171        ClampOptions {
1172            min: f64::from(0),
1173            max: f64::from(1),
1174        }
1175    }
1176}
1177
1178/// VipsClamp (clamp), clamp values of an image
1179/// inp: `&VipsImage` -> Input image
1180/// clamp_options: `&ClampOptions` -> optional arguments
1181/// returns `VipsImage` - Output image
1182pub fn clamp_with_opts(inp: &VipsImage, clamp_options: &ClampOptions) -> Result<VipsImage> {
1183    unsafe {
1184        let inp_in: *mut bindings::VipsImage = inp.ctx;
1185        let mut out_out: *mut bindings::VipsImage = null_mut();
1186
1187        let min_in: f64 = clamp_options.min;
1188        let min_in_name = utils::new_c_string("min")?;
1189
1190        let max_in: f64 = clamp_options.max;
1191        let max_in_name = utils::new_c_string("max")?;
1192
1193        let vips_op_response = bindings::vips_clamp(
1194            inp_in,
1195            &mut out_out,
1196            min_in_name.as_ptr(),
1197            min_in,
1198            max_in_name.as_ptr(),
1199            max_in,
1200            NULL,
1201        );
1202        utils::result(
1203            vips_op_response,
1204            VipsImage { ctx: out_out },
1205            Error::ClampError,
1206        )
1207    }
1208}
1209
1210/// VipsInvert (invert), invert an image
1211/// inp: `&VipsImage` -> Input image
1212/// returns `VipsImage` - Output image
1213pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1214    unsafe {
1215        let inp_in: *mut bindings::VipsImage = inp.ctx;
1216        let mut out_out: *mut bindings::VipsImage = null_mut();
1217
1218        let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1219        utils::result(
1220            vips_op_response,
1221            VipsImage { ctx: out_out },
1222            Error::InvertError,
1223        )
1224    }
1225}
1226
1227/// VipsMath (math), apply a math operation to an image
1228/// inp: `&VipsImage` -> Input image
1229/// math: `OperationMath` -> Math to perform
1230///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0 [DEFAULT]
1231///  `Co` -> VIPS_OPERATION_MATH_COS = 1
1232///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
1233///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
1234///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
1235///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
1236///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
1237///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
1238///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
1239///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
1240///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
1241///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
1242///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
1243///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
1244///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
1245///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
1246///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
1247/// returns `VipsImage` - Output image
1248pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1249    unsafe {
1250        let inp_in: *mut bindings::VipsImage = inp.ctx;
1251        let math_in: i32 = math as i32;
1252        let mut out_out: *mut bindings::VipsImage = null_mut();
1253
1254        let vips_op_response =
1255            bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1256        utils::result(
1257            vips_op_response,
1258            VipsImage { ctx: out_out },
1259            Error::MathError,
1260        )
1261    }
1262}
1263
1264/// VipsAbs (abs), absolute value of an image
1265/// inp: `&VipsImage` -> Input image
1266/// returns `VipsImage` - Output image
1267pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1268    unsafe {
1269        let inp_in: *mut bindings::VipsImage = inp.ctx;
1270        let mut out_out: *mut bindings::VipsImage = null_mut();
1271
1272        let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1273        utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1274    }
1275}
1276
1277/// VipsSign (sign), unit vector of pixel
1278/// inp: `&VipsImage` -> Input image
1279/// returns `VipsImage` - Output image
1280pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1281    unsafe {
1282        let inp_in: *mut bindings::VipsImage = inp.ctx;
1283        let mut out_out: *mut bindings::VipsImage = null_mut();
1284
1285        let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1286        utils::result(
1287            vips_op_response,
1288            VipsImage { ctx: out_out },
1289            Error::SignError,
1290        )
1291    }
1292}
1293
1294/// VipsRound (round), perform a round function on an image
1295/// inp: `&VipsImage` -> Input image
1296/// round: `OperationRound` -> Rounding operation to perform
1297///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0 [DEFAULT]
1298///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
1299///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
1300///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
1301/// returns `VipsImage` - Output image
1302pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1303    unsafe {
1304        let inp_in: *mut bindings::VipsImage = inp.ctx;
1305        let round_in: i32 = round as i32;
1306        let mut out_out: *mut bindings::VipsImage = null_mut();
1307
1308        let vips_op_response =
1309            bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1310        utils::result(
1311            vips_op_response,
1312            VipsImage { ctx: out_out },
1313            Error::RoundError,
1314        )
1315    }
1316}
1317
1318/// VipsRelationalConst (relational_const), relational operations against a constant
1319/// inp: `&VipsImage` -> Input image
1320/// relational: `OperationRelational` -> Relational to perform
1321///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
1322///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
1323///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
1324///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
1325///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
1326///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
1327///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
1328/// c: `&mut [f64]` -> Array of constants
1329/// returns `VipsImage` - Output image
1330pub fn relational_const(
1331    inp: &VipsImage,
1332    relational: OperationRelational,
1333    c: &mut [f64],
1334) -> Result<VipsImage> {
1335    unsafe {
1336        let inp_in: *mut bindings::VipsImage = inp.ctx;
1337        let relational_in: i32 = relational as i32;
1338        let c_in: *mut f64 = c.as_mut_ptr();
1339        let mut out_out: *mut bindings::VipsImage = null_mut();
1340
1341        let vips_op_response = bindings::vips_relational_const(
1342            inp_in,
1343            &mut out_out,
1344            relational_in.try_into().unwrap(),
1345            c_in,
1346            c.len() as i32,
1347            NULL,
1348        );
1349        utils::result(
1350            vips_op_response,
1351            VipsImage { ctx: out_out },
1352            Error::RelationalConstError,
1353        )
1354    }
1355}
1356
1357/// VipsRemainderConst (remainder_const), remainder after integer division of an image and a constant
1358/// inp: `&VipsImage` -> Input image
1359/// c: `&mut [f64]` -> Array of constants
1360/// returns `VipsImage` - Output image
1361pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1362    unsafe {
1363        let inp_in: *mut bindings::VipsImage = inp.ctx;
1364        let c_in: *mut f64 = c.as_mut_ptr();
1365        let mut out_out: *mut bindings::VipsImage = null_mut();
1366
1367        let vips_op_response =
1368            bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1369        utils::result(
1370            vips_op_response,
1371            VipsImage { ctx: out_out },
1372            Error::RemainderConstError,
1373        )
1374    }
1375}
1376
1377/// VipsBooleanConst (boolean_const), boolean operations against a constant
1378/// inp: `&VipsImage` -> Input image
1379/// boolean: `OperationBoolean` -> Boolean to perform
1380///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1381///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1382///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1383///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1384///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1385///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1386/// c: `&mut [f64]` -> Array of constants
1387/// returns `VipsImage` - Output image
1388pub fn boolean_const(
1389    inp: &VipsImage,
1390    boolean: OperationBoolean,
1391    c: &mut [f64],
1392) -> Result<VipsImage> {
1393    unsafe {
1394        let inp_in: *mut bindings::VipsImage = inp.ctx;
1395        let boolean_in: i32 = boolean as i32;
1396        let c_in: *mut f64 = c.as_mut_ptr();
1397        let mut out_out: *mut bindings::VipsImage = null_mut();
1398
1399        let vips_op_response = bindings::vips_boolean_const(
1400            inp_in,
1401            &mut out_out,
1402            boolean_in.try_into().unwrap(),
1403            c_in,
1404            c.len() as i32,
1405            NULL,
1406        );
1407        utils::result(
1408            vips_op_response,
1409            VipsImage { ctx: out_out },
1410            Error::BooleanConstError,
1411        )
1412    }
1413}
1414
1415/// VipsMath2Const (math2_const), binary math operations with a constant
1416/// inp: `&VipsImage` -> Input image
1417/// math_2: `OperationMath2` -> Math to perform
1418///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1419///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1420///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1421///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1422/// c: `&mut [f64]` -> Array of constants
1423/// returns `VipsImage` - Output image
1424pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1425    unsafe {
1426        let inp_in: *mut bindings::VipsImage = inp.ctx;
1427        let math_2_in: i32 = math_2 as i32;
1428        let c_in: *mut f64 = c.as_mut_ptr();
1429        let mut out_out: *mut bindings::VipsImage = null_mut();
1430
1431        let vips_op_response = bindings::vips_math2_const(
1432            inp_in,
1433            &mut out_out,
1434            math_2_in.try_into().unwrap(),
1435            c_in,
1436            c.len() as i32,
1437            NULL,
1438        );
1439        utils::result(
1440            vips_op_response,
1441            VipsImage { ctx: out_out },
1442            Error::Math2ConstError,
1443        )
1444    }
1445}
1446
1447/// VipsComplex (complex), perform a complex operation on an image
1448/// inp: `&VipsImage` -> Input image
1449/// cmplx: `OperationComplex` -> Complex to perform
1450///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0 [DEFAULT]
1451///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
1452///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
1453///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
1454/// returns `VipsImage` - Output image
1455pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1456    unsafe {
1457        let inp_in: *mut bindings::VipsImage = inp.ctx;
1458        let cmplx_in: i32 = cmplx as i32;
1459        let mut out_out: *mut bindings::VipsImage = null_mut();
1460
1461        let vips_op_response =
1462            bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1463        utils::result(
1464            vips_op_response,
1465            VipsImage { ctx: out_out },
1466            Error::ComplexError,
1467        )
1468    }
1469}
1470
1471/// VipsComplexget (complexget), get a component from a complex image
1472/// inp: `&VipsImage` -> Input image
1473/// get: `OperationComplexget` -> Complex to perform
1474///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0 [DEFAULT]
1475///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
1476///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
1477/// returns `VipsImage` - Output image
1478pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1479    unsafe {
1480        let inp_in: *mut bindings::VipsImage = inp.ctx;
1481        let get_in: i32 = get as i32;
1482        let mut out_out: *mut bindings::VipsImage = null_mut();
1483
1484        let vips_op_response =
1485            bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1486        utils::result(
1487            vips_op_response,
1488            VipsImage { ctx: out_out },
1489            Error::ComplexgetError,
1490        )
1491    }
1492}
1493
1494/// VipsSum (sum), sum an array of images
1495/// inp: `&mut [VipsImage]` -> Array of input images
1496/// returns `VipsImage` - Output image
1497pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1498    unsafe {
1499        let (inp_len, mut inp_in) = {
1500            let len = inp.len();
1501            let mut input = Vec::new();
1502            for img in inp {
1503                input.push(img.ctx)
1504            }
1505            (len as i32, input)
1506        };
1507        let mut out_out: *mut bindings::VipsImage = null_mut();
1508
1509        let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1510        utils::result(
1511            vips_op_response,
1512            VipsImage { ctx: out_out },
1513            Error::SumError,
1514        )
1515    }
1516}
1517
1518/// VipsAvg (avg), find image average
1519/// inp: `&VipsImage` -> Input image
1520/// returns `f64` - Output value
1521pub fn avg(inp: &VipsImage) -> Result<f64> {
1522    unsafe {
1523        let inp_in: *mut bindings::VipsImage = inp.ctx;
1524        let mut out_out: f64 = f64::from(0);
1525
1526        let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1527        utils::result(vips_op_response, out_out, Error::AvgError)
1528    }
1529}
1530
1531/// VipsMin (min), find image minimum
1532/// inp: `&VipsImage` -> Input image
1533/// returns `f64` - Output value
1534pub fn min(inp: &VipsImage) -> Result<f64> {
1535    unsafe {
1536        let inp_in: *mut bindings::VipsImage = inp.ctx;
1537        let mut out_out: f64 = f64::from(0);
1538
1539        let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1540        utils::result(vips_op_response, out_out, Error::MinError)
1541    }
1542}
1543
1544/// Options for min operation
1545#[derive(Clone, Debug)]
1546pub struct MinOptions {
1547    /// x: `i32` -> Horizontal position of minimum
1548    /// min: 0, max: 100000000, default: 0
1549    pub x: i32,
1550    /// y: `i32` -> Vertical position of minimum
1551    /// min: 0, max: 100000000, default: 0
1552    pub y: i32,
1553    /// size: `i32` -> Number of minimum values to find
1554    /// min: 1, max: 1000000, default: 1
1555    pub size: i32,
1556    /// out_array: `Vec<f64>` -> Array of output values
1557    pub out_array: Vec<f64>,
1558    /// x_array: `Vec<i32>` -> Array of horizontal positions
1559    pub x_array: Vec<i32>,
1560    /// y_array: `Vec<i32>` -> Array of vertical positions
1561    pub y_array: Vec<i32>,
1562}
1563
1564impl std::default::Default for MinOptions {
1565    fn default() -> Self {
1566        MinOptions {
1567            x: i32::from(0),
1568            y: i32::from(0),
1569            size: i32::from(1),
1570            out_array: Vec::new(),
1571            x_array: Vec::new(),
1572            y_array: Vec::new(),
1573        }
1574    }
1575}
1576
1577/// VipsMin (min), find image minimum
1578/// inp: `&VipsImage` -> Input image
1579/// min_options: `&MinOptions` -> optional arguments
1580/// returns `f64` - Output value
1581pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1582    unsafe {
1583        let inp_in: *mut bindings::VipsImage = inp.ctx;
1584        let mut out_out: f64 = f64::from(0);
1585
1586        let x_in: i32 = min_options.x;
1587        let x_in_name = utils::new_c_string("x")?;
1588
1589        let y_in: i32 = min_options.y;
1590        let y_in_name = utils::new_c_string("y")?;
1591
1592        let size_in: i32 = min_options.size;
1593        let size_in_name = utils::new_c_string("size")?;
1594
1595        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1596        let out_array_in = out_array_wrapper.ctx;
1597        let out_array_in_name = utils::new_c_string("out-array")?;
1598
1599        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1600        let x_array_in = x_array_wrapper.ctx;
1601        let x_array_in_name = utils::new_c_string("x-array")?;
1602
1603        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1604        let y_array_in = y_array_wrapper.ctx;
1605        let y_array_in_name = utils::new_c_string("y-array")?;
1606
1607        let vips_op_response = bindings::vips_min(
1608            inp_in,
1609            &mut out_out,
1610            x_in_name.as_ptr(),
1611            x_in,
1612            y_in_name.as_ptr(),
1613            y_in,
1614            size_in_name.as_ptr(),
1615            size_in,
1616            out_array_in_name.as_ptr(),
1617            out_array_in,
1618            x_array_in_name.as_ptr(),
1619            x_array_in,
1620            y_array_in_name.as_ptr(),
1621            y_array_in,
1622            NULL,
1623        );
1624        utils::result(vips_op_response, out_out, Error::MinError)
1625    }
1626}
1627
1628/// VipsMax (max), find image maximum
1629/// inp: `&VipsImage` -> Input image
1630/// returns `f64` - Output value
1631pub fn max(inp: &VipsImage) -> Result<f64> {
1632    unsafe {
1633        let inp_in: *mut bindings::VipsImage = inp.ctx;
1634        let mut out_out: f64 = f64::from(0);
1635
1636        let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1637        utils::result(vips_op_response, out_out, Error::MaxError)
1638    }
1639}
1640
1641/// Options for max operation
1642#[derive(Clone, Debug)]
1643pub struct MaxOptions {
1644    /// x: `i32` -> Horizontal position of maximum
1645    /// min: 0, max: 100000000, default: 0
1646    pub x: i32,
1647    /// y: `i32` -> Vertical position of maximum
1648    /// min: 0, max: 100000000, default: 0
1649    pub y: i32,
1650    /// size: `i32` -> Number of maximum values to find
1651    /// min: 1, max: 1000000, default: 1
1652    pub size: i32,
1653    /// out_array: `Vec<f64>` -> Array of output values
1654    pub out_array: Vec<f64>,
1655    /// x_array: `Vec<i32>` -> Array of horizontal positions
1656    pub x_array: Vec<i32>,
1657    /// y_array: `Vec<i32>` -> Array of vertical positions
1658    pub y_array: Vec<i32>,
1659}
1660
1661impl std::default::Default for MaxOptions {
1662    fn default() -> Self {
1663        MaxOptions {
1664            x: i32::from(0),
1665            y: i32::from(0),
1666            size: i32::from(1),
1667            out_array: Vec::new(),
1668            x_array: Vec::new(),
1669            y_array: Vec::new(),
1670        }
1671    }
1672}
1673
1674/// VipsMax (max), find image maximum
1675/// inp: `&VipsImage` -> Input image
1676/// max_options: `&MaxOptions` -> optional arguments
1677/// returns `f64` - Output value
1678pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1679    unsafe {
1680        let inp_in: *mut bindings::VipsImage = inp.ctx;
1681        let mut out_out: f64 = f64::from(0);
1682
1683        let x_in: i32 = max_options.x;
1684        let x_in_name = utils::new_c_string("x")?;
1685
1686        let y_in: i32 = max_options.y;
1687        let y_in_name = utils::new_c_string("y")?;
1688
1689        let size_in: i32 = max_options.size;
1690        let size_in_name = utils::new_c_string("size")?;
1691
1692        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1693        let out_array_in = out_array_wrapper.ctx;
1694        let out_array_in_name = utils::new_c_string("out-array")?;
1695
1696        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1697        let x_array_in = x_array_wrapper.ctx;
1698        let x_array_in_name = utils::new_c_string("x-array")?;
1699
1700        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1701        let y_array_in = y_array_wrapper.ctx;
1702        let y_array_in_name = utils::new_c_string("y-array")?;
1703
1704        let vips_op_response = bindings::vips_max(
1705            inp_in,
1706            &mut out_out,
1707            x_in_name.as_ptr(),
1708            x_in,
1709            y_in_name.as_ptr(),
1710            y_in,
1711            size_in_name.as_ptr(),
1712            size_in,
1713            out_array_in_name.as_ptr(),
1714            out_array_in,
1715            x_array_in_name.as_ptr(),
1716            x_array_in,
1717            y_array_in_name.as_ptr(),
1718            y_array_in,
1719            NULL,
1720        );
1721        utils::result(vips_op_response, out_out, Error::MaxError)
1722    }
1723}
1724
1725/// VipsDeviate (deviate), find image standard deviation
1726/// inp: `&VipsImage` -> Input image
1727/// returns `f64` - Output value
1728pub fn deviate(inp: &VipsImage) -> Result<f64> {
1729    unsafe {
1730        let inp_in: *mut bindings::VipsImage = inp.ctx;
1731        let mut out_out: f64 = f64::from(0);
1732
1733        let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1734        utils::result(vips_op_response, out_out, Error::DeviateError)
1735    }
1736}
1737
1738/// VipsStats (stats), find many image stats
1739/// inp: `&VipsImage` -> Input image
1740/// returns `VipsImage` - Output array of statistics
1741pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1742    unsafe {
1743        let inp_in: *mut bindings::VipsImage = inp.ctx;
1744        let mut out_out: *mut bindings::VipsImage = null_mut();
1745
1746        let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1747        utils::result(
1748            vips_op_response,
1749            VipsImage { ctx: out_out },
1750            Error::StatError,
1751        )
1752    }
1753}
1754
1755/// VipsHistFind (hist_find), find image histogram
1756/// inp: `&VipsImage` -> Input image
1757/// returns `VipsImage` - Output histogram
1758pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1759    unsafe {
1760        let inp_in: *mut bindings::VipsImage = inp.ctx;
1761        let mut out_out: *mut bindings::VipsImage = null_mut();
1762
1763        let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1764        utils::result(
1765            vips_op_response,
1766            VipsImage { ctx: out_out },
1767            Error::HistFindError,
1768        )
1769    }
1770}
1771
1772/// Options for hist_find operation
1773#[derive(Clone, Debug)]
1774pub struct HistFindOptions {
1775    /// band: `i32` -> Find histogram of band
1776    /// min: -1, max: 100000, default: -1
1777    pub band: i32,
1778}
1779
1780impl std::default::Default for HistFindOptions {
1781    fn default() -> Self {
1782        HistFindOptions {
1783            band: i32::from(-1),
1784        }
1785    }
1786}
1787
1788/// VipsHistFind (hist_find), find image histogram
1789/// inp: `&VipsImage` -> Input image
1790/// hist_find_options: `&HistFindOptions` -> optional arguments
1791/// returns `VipsImage` - Output histogram
1792pub fn hist_find_with_opts(
1793    inp: &VipsImage,
1794    hist_find_options: &HistFindOptions,
1795) -> Result<VipsImage> {
1796    unsafe {
1797        let inp_in: *mut bindings::VipsImage = inp.ctx;
1798        let mut out_out: *mut bindings::VipsImage = null_mut();
1799
1800        let band_in: i32 = hist_find_options.band;
1801        let band_in_name = utils::new_c_string("band")?;
1802
1803        let vips_op_response =
1804            bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1805        utils::result(
1806            vips_op_response,
1807            VipsImage { ctx: out_out },
1808            Error::HistFindError,
1809        )
1810    }
1811}
1812
1813/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1814/// inp: `&VipsImage` -> Input image
1815/// returns `VipsImage` - Output histogram
1816pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1817    unsafe {
1818        let inp_in: *mut bindings::VipsImage = inp.ctx;
1819        let mut out_out: *mut bindings::VipsImage = null_mut();
1820
1821        let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1822        utils::result(
1823            vips_op_response,
1824            VipsImage { ctx: out_out },
1825            Error::HistFindNdimError,
1826        )
1827    }
1828}
1829
1830/// Options for hist_find_ndim operation
1831#[derive(Clone, Debug)]
1832pub struct HistFindNdimOptions {
1833    /// bins: `i32` -> Number of bins in each dimension
1834    /// min: 1, max: 65536, default: 10
1835    pub bins: i32,
1836}
1837
1838impl std::default::Default for HistFindNdimOptions {
1839    fn default() -> Self {
1840        HistFindNdimOptions {
1841            bins: i32::from(10),
1842        }
1843    }
1844}
1845
1846/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1847/// inp: `&VipsImage` -> Input image
1848/// hist_find_ndim_options: `&HistFindNdimOptions` -> optional arguments
1849/// returns `VipsImage` - Output histogram
1850pub fn hist_find_ndim_with_opts(
1851    inp: &VipsImage,
1852    hist_find_ndim_options: &HistFindNdimOptions,
1853) -> Result<VipsImage> {
1854    unsafe {
1855        let inp_in: *mut bindings::VipsImage = inp.ctx;
1856        let mut out_out: *mut bindings::VipsImage = null_mut();
1857
1858        let bins_in: i32 = hist_find_ndim_options.bins;
1859        let bins_in_name = utils::new_c_string("bins")?;
1860
1861        let vips_op_response = bindings::vips_hist_find_ndim(
1862            inp_in,
1863            &mut out_out,
1864            bins_in_name.as_ptr(),
1865            bins_in,
1866            NULL,
1867        );
1868        utils::result(
1869            vips_op_response,
1870            VipsImage { ctx: out_out },
1871            Error::HistFindNdimError,
1872        )
1873    }
1874}
1875
1876/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1877/// inp: `&VipsImage` -> Input image
1878/// index: `&VipsImage` -> Index image
1879/// returns `VipsImage` - Output histogram
1880pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1881    unsafe {
1882        let inp_in: *mut bindings::VipsImage = inp.ctx;
1883        let index_in: *mut bindings::VipsImage = index.ctx;
1884        let mut out_out: *mut bindings::VipsImage = null_mut();
1885
1886        let vips_op_response =
1887            bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1888        utils::result(
1889            vips_op_response,
1890            VipsImage { ctx: out_out },
1891            Error::HistFindIndexedError,
1892        )
1893    }
1894}
1895
1896/// Options for hist_find_indexed operation
1897#[derive(Clone, Debug)]
1898pub struct HistFindIndexedOptions {
1899    /// combine: `Combine` -> Combine bins like this
1900    ///  `Max` -> VIPS_COMBINE_MAX = 0
1901    ///  `Sum` -> VIPS_COMBINE_SUM = 1 [DEFAULT]
1902    ///  `Min` -> VIPS_COMBINE_MIN = 2
1903    ///  `Last` -> VIPS_COMBINE_LAST = 3
1904    pub combine: Combine,
1905}
1906
1907impl std::default::Default for HistFindIndexedOptions {
1908    fn default() -> Self {
1909        HistFindIndexedOptions {
1910            combine: Combine::Sum,
1911        }
1912    }
1913}
1914
1915/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1916/// inp: `&VipsImage` -> Input image
1917/// index: `&VipsImage` -> Index image
1918/// hist_find_indexed_options: `&HistFindIndexedOptions` -> optional arguments
1919/// returns `VipsImage` - Output histogram
1920pub fn hist_find_indexed_with_opts(
1921    inp: &VipsImage,
1922    index: &VipsImage,
1923    hist_find_indexed_options: &HistFindIndexedOptions,
1924) -> Result<VipsImage> {
1925    unsafe {
1926        let inp_in: *mut bindings::VipsImage = inp.ctx;
1927        let index_in: *mut bindings::VipsImage = index.ctx;
1928        let mut out_out: *mut bindings::VipsImage = null_mut();
1929
1930        let combine_in: i32 = hist_find_indexed_options.combine as i32;
1931        let combine_in_name = utils::new_c_string("combine")?;
1932
1933        let vips_op_response = bindings::vips_hist_find_indexed(
1934            inp_in,
1935            index_in,
1936            &mut out_out,
1937            combine_in_name.as_ptr(),
1938            combine_in,
1939            NULL,
1940        );
1941        utils::result(
1942            vips_op_response,
1943            VipsImage { ctx: out_out },
1944            Error::HistFindIndexedError,
1945        )
1946    }
1947}
1948
1949/// VipsHoughLine (hough_line), find hough line transform
1950/// inp: `&VipsImage` -> Input image
1951/// returns `VipsImage` - Output image
1952pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1953    unsafe {
1954        let inp_in: *mut bindings::VipsImage = inp.ctx;
1955        let mut out_out: *mut bindings::VipsImage = null_mut();
1956
1957        let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1958        utils::result(
1959            vips_op_response,
1960            VipsImage { ctx: out_out },
1961            Error::HoughLineError,
1962        )
1963    }
1964}
1965
1966/// Options for hough_line operation
1967#[derive(Clone, Debug)]
1968pub struct HoughLineOptions {
1969    /// width: `i32` -> Horizontal size of parameter space
1970    /// min: 1, max: 100000, default: 256
1971    pub width: i32,
1972    /// height: `i32` -> Vertical size of parameter space
1973    /// min: 1, max: 100000, default: 256
1974    pub height: i32,
1975}
1976
1977impl std::default::Default for HoughLineOptions {
1978    fn default() -> Self {
1979        HoughLineOptions {
1980            width: i32::from(256),
1981            height: i32::from(256),
1982        }
1983    }
1984}
1985
1986/// VipsHoughLine (hough_line), find hough line transform
1987/// inp: `&VipsImage` -> Input image
1988/// hough_line_options: `&HoughLineOptions` -> optional arguments
1989/// returns `VipsImage` - Output image
1990pub fn hough_line_with_opts(
1991    inp: &VipsImage,
1992    hough_line_options: &HoughLineOptions,
1993) -> Result<VipsImage> {
1994    unsafe {
1995        let inp_in: *mut bindings::VipsImage = inp.ctx;
1996        let mut out_out: *mut bindings::VipsImage = null_mut();
1997
1998        let width_in: i32 = hough_line_options.width;
1999        let width_in_name = utils::new_c_string("width")?;
2000
2001        let height_in: i32 = hough_line_options.height;
2002        let height_in_name = utils::new_c_string("height")?;
2003
2004        let vips_op_response = bindings::vips_hough_line(
2005            inp_in,
2006            &mut out_out,
2007            width_in_name.as_ptr(),
2008            width_in,
2009            height_in_name.as_ptr(),
2010            height_in,
2011            NULL,
2012        );
2013        utils::result(
2014            vips_op_response,
2015            VipsImage { ctx: out_out },
2016            Error::HoughLineError,
2017        )
2018    }
2019}
2020
2021/// VipsHoughCircle (hough_circle), find hough circle transform
2022/// inp: `&VipsImage` -> Input image
2023/// returns `VipsImage` - Output image
2024pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
2025    unsafe {
2026        let inp_in: *mut bindings::VipsImage = inp.ctx;
2027        let mut out_out: *mut bindings::VipsImage = null_mut();
2028
2029        let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
2030        utils::result(
2031            vips_op_response,
2032            VipsImage { ctx: out_out },
2033            Error::HoughCircleError,
2034        )
2035    }
2036}
2037
2038/// Options for hough_circle operation
2039#[derive(Clone, Debug)]
2040pub struct HoughCircleOptions {
2041    /// scale: `i32` -> Scale down dimensions by this factor
2042    /// min: 1, max: 100000, default: 1
2043    pub scale: i32,
2044    /// min_radius: `i32` -> Smallest radius to search for
2045    /// min: 1, max: 100000, default: 10
2046    pub min_radius: i32,
2047    /// max_radius: `i32` -> Largest radius to search for
2048    /// min: 1, max: 100000, default: 20
2049    pub max_radius: i32,
2050}
2051
2052impl std::default::Default for HoughCircleOptions {
2053    fn default() -> Self {
2054        HoughCircleOptions {
2055            scale: i32::from(1),
2056            min_radius: i32::from(10),
2057            max_radius: i32::from(20),
2058        }
2059    }
2060}
2061
2062/// VipsHoughCircle (hough_circle), find hough circle transform
2063/// inp: `&VipsImage` -> Input image
2064/// hough_circle_options: `&HoughCircleOptions` -> optional arguments
2065/// returns `VipsImage` - Output image
2066pub fn hough_circle_with_opts(
2067    inp: &VipsImage,
2068    hough_circle_options: &HoughCircleOptions,
2069) -> Result<VipsImage> {
2070    unsafe {
2071        let inp_in: *mut bindings::VipsImage = inp.ctx;
2072        let mut out_out: *mut bindings::VipsImage = null_mut();
2073
2074        let scale_in: i32 = hough_circle_options.scale;
2075        let scale_in_name = utils::new_c_string("scale")?;
2076
2077        let min_radius_in: i32 = hough_circle_options.min_radius;
2078        let min_radius_in_name = utils::new_c_string("min-radius")?;
2079
2080        let max_radius_in: i32 = hough_circle_options.max_radius;
2081        let max_radius_in_name = utils::new_c_string("max-radius")?;
2082
2083        let vips_op_response = bindings::vips_hough_circle(
2084            inp_in,
2085            &mut out_out,
2086            scale_in_name.as_ptr(),
2087            scale_in,
2088            min_radius_in_name.as_ptr(),
2089            min_radius_in,
2090            max_radius_in_name.as_ptr(),
2091            max_radius_in,
2092            NULL,
2093        );
2094        utils::result(
2095            vips_op_response,
2096            VipsImage { ctx: out_out },
2097            Error::HoughCircleError,
2098        )
2099    }
2100}
2101
2102/// VipsProject (project), find image projections
2103/// inp: `&VipsImage` -> Input image
2104/// Tuple (
2105/// VipsImage - Sums of columns
2106/// VipsImage - Sums of rows
2107///)
2108pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2109    unsafe {
2110        let inp_in: *mut bindings::VipsImage = inp.ctx;
2111        let mut columns_out: *mut bindings::VipsImage = null_mut();
2112        let mut rows_out: *mut bindings::VipsImage = null_mut();
2113
2114        let vips_op_response =
2115            bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2116        utils::result(
2117            vips_op_response,
2118            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2119            Error::ProjectError,
2120        )
2121    }
2122}
2123
2124/// VipsProfile (profile), find image profiles
2125/// inp: `&VipsImage` -> Input image
2126/// Tuple (
2127/// VipsImage - First non-zero pixel in column
2128/// VipsImage - First non-zero pixel in row
2129///)
2130pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2131    unsafe {
2132        let inp_in: *mut bindings::VipsImage = inp.ctx;
2133        let mut columns_out: *mut bindings::VipsImage = null_mut();
2134        let mut rows_out: *mut bindings::VipsImage = null_mut();
2135
2136        let vips_op_response =
2137            bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2138        utils::result(
2139            vips_op_response,
2140            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2141            Error::ProfileError,
2142        )
2143    }
2144}
2145
2146/// VipsMeasure (measure), measure a set of patches on a color chart
2147/// inp: `&VipsImage` -> Image to measure
2148/// h: `i32` -> Number of patches across chart
2149/// min: 1, max: 100000000, default: 1
2150/// v: `i32` -> Number of patches down chart
2151/// min: 1, max: 100000000, default: 1
2152/// returns `VipsImage` - Output array of statistics
2153pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2154    unsafe {
2155        let inp_in: *mut bindings::VipsImage = inp.ctx;
2156        let h_in: i32 = h;
2157        let v_in: i32 = v;
2158        let mut out_out: *mut bindings::VipsImage = null_mut();
2159
2160        let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2161        utils::result(
2162            vips_op_response,
2163            VipsImage { ctx: out_out },
2164            Error::MeasureError,
2165        )
2166    }
2167}
2168
2169/// Options for measure operation
2170#[derive(Clone, Debug)]
2171pub struct MeasureOptions {
2172    /// left: `i32` -> Left edge of extract area
2173    /// min: 0, max: 100000000, default: 0
2174    pub left: i32,
2175    /// top: `i32` -> Top edge of extract area
2176    /// min: 0, max: 100000000, default: 0
2177    pub top: i32,
2178    /// width: `i32` -> Width of extract area
2179    /// min: 1, max: 100000000, default: 1
2180    pub width: i32,
2181    /// height: `i32` -> Height of extract area
2182    /// min: 1, max: 100000000, default: 1
2183    pub height: i32,
2184}
2185
2186impl std::default::Default for MeasureOptions {
2187    fn default() -> Self {
2188        MeasureOptions {
2189            left: i32::from(0),
2190            top: i32::from(0),
2191            width: i32::from(1),
2192            height: i32::from(1),
2193        }
2194    }
2195}
2196
2197/// VipsMeasure (measure), measure a set of patches on a color chart
2198/// inp: `&VipsImage` -> Image to measure
2199/// h: `i32` -> Number of patches across chart
2200/// min: 1, max: 100000000, default: 1
2201/// v: `i32` -> Number of patches down chart
2202/// min: 1, max: 100000000, default: 1
2203/// measure_options: `&MeasureOptions` -> optional arguments
2204/// returns `VipsImage` - Output array of statistics
2205pub fn measure_with_opts(
2206    inp: &VipsImage,
2207    h: i32,
2208    v: i32,
2209    measure_options: &MeasureOptions,
2210) -> Result<VipsImage> {
2211    unsafe {
2212        let inp_in: *mut bindings::VipsImage = inp.ctx;
2213        let h_in: i32 = h;
2214        let v_in: i32 = v;
2215        let mut out_out: *mut bindings::VipsImage = null_mut();
2216
2217        let left_in: i32 = measure_options.left;
2218        let left_in_name = utils::new_c_string("left")?;
2219
2220        let top_in: i32 = measure_options.top;
2221        let top_in_name = utils::new_c_string("top")?;
2222
2223        let width_in: i32 = measure_options.width;
2224        let width_in_name = utils::new_c_string("width")?;
2225
2226        let height_in: i32 = measure_options.height;
2227        let height_in_name = utils::new_c_string("height")?;
2228
2229        let vips_op_response = bindings::vips_measure(
2230            inp_in,
2231            &mut out_out,
2232            h_in,
2233            v_in,
2234            left_in_name.as_ptr(),
2235            left_in,
2236            top_in_name.as_ptr(),
2237            top_in,
2238            width_in_name.as_ptr(),
2239            width_in,
2240            height_in_name.as_ptr(),
2241            height_in,
2242            NULL,
2243        );
2244        utils::result(
2245            vips_op_response,
2246            VipsImage { ctx: out_out },
2247            Error::MeasureError,
2248        )
2249    }
2250}
2251
2252/// VipsFindTrim (find_trim), search an image for non-edge areas
2253/// inp: `&VipsImage` -> Image to find_trim
2254/// Tuple (
2255/// i32 - Left edge of image
2256/// i32 - Top edge of extract area
2257/// i32 - Width of extract area
2258/// i32 - Height of extract area
2259///)
2260pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2261    unsafe {
2262        let inp_in: *mut bindings::VipsImage = inp.ctx;
2263        let mut left_out: i32 = i32::from(1);
2264        let mut top_out: i32 = i32::from(0);
2265        let mut width_out: i32 = i32::from(1);
2266        let mut height_out: i32 = i32::from(1);
2267
2268        let vips_op_response = bindings::vips_find_trim(
2269            inp_in,
2270            &mut left_out,
2271            &mut top_out,
2272            &mut width_out,
2273            &mut height_out,
2274            NULL,
2275        );
2276        utils::result(
2277            vips_op_response,
2278            (left_out, top_out, width_out, height_out),
2279            Error::FindTrimError,
2280        )
2281    }
2282}
2283
2284/// Options for find_trim operation
2285#[derive(Clone, Debug)]
2286pub struct FindTrimOptions {
2287    /// threshold: `f64` -> Object threshold
2288    /// min: 0, max: inf, default: 10
2289    pub threshold: f64,
2290    /// background: `Vec<f64>` -> Color for background pixels
2291    pub background: Vec<f64>,
2292    /// line_art: `bool` -> Enable line art mode
2293    /// default: false
2294    pub line_art: bool,
2295}
2296
2297impl std::default::Default for FindTrimOptions {
2298    fn default() -> Self {
2299        FindTrimOptions {
2300            threshold: f64::from(10),
2301            background: Vec::new(),
2302            line_art: false,
2303        }
2304    }
2305}
2306
2307/// VipsFindTrim (find_trim), search an image for non-edge areas
2308/// inp: `&VipsImage` -> Image to find_trim
2309/// find_trim_options: `&FindTrimOptions` -> optional arguments
2310/// Tuple (
2311/// i32 - Left edge of image
2312/// i32 - Top edge of extract area
2313/// i32 - Width of extract area
2314/// i32 - Height of extract area
2315///)
2316pub fn find_trim_with_opts(
2317    inp: &VipsImage,
2318    find_trim_options: &FindTrimOptions,
2319) -> Result<(i32, i32, i32, i32)> {
2320    unsafe {
2321        let inp_in: *mut bindings::VipsImage = inp.ctx;
2322        let mut left_out: i32 = i32::from(1);
2323        let mut top_out: i32 = i32::from(0);
2324        let mut width_out: i32 = i32::from(1);
2325        let mut height_out: i32 = i32::from(1);
2326
2327        let threshold_in: f64 = find_trim_options.threshold;
2328        let threshold_in_name = utils::new_c_string("threshold")?;
2329
2330        let background_wrapper =
2331            utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2332        let background_in = background_wrapper.ctx;
2333        let background_in_name = utils::new_c_string("background")?;
2334
2335        let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2336        let line_art_in_name = utils::new_c_string("line-art")?;
2337
2338        let vips_op_response = bindings::vips_find_trim(
2339            inp_in,
2340            &mut left_out,
2341            &mut top_out,
2342            &mut width_out,
2343            &mut height_out,
2344            threshold_in_name.as_ptr(),
2345            threshold_in,
2346            background_in_name.as_ptr(),
2347            background_in,
2348            line_art_in_name.as_ptr(),
2349            line_art_in,
2350            NULL,
2351        );
2352        utils::result(
2353            vips_op_response,
2354            (left_out, top_out, width_out, height_out),
2355            Error::FindTrimError,
2356        )
2357    }
2358}
2359
2360/// VipsCopy (copy), copy an image
2361/// inp: `&VipsImage` -> Input image
2362/// returns `VipsImage` - Output image
2363pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2364    unsafe {
2365        let inp_in: *mut bindings::VipsImage = inp.ctx;
2366        let mut out_out: *mut bindings::VipsImage = null_mut();
2367
2368        let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2369        utils::result(
2370            vips_op_response,
2371            VipsImage { ctx: out_out },
2372            Error::CopyError,
2373        )
2374    }
2375}
2376
2377/// Options for copy operation
2378#[derive(Clone, Debug)]
2379pub struct CopyOptions {
2380    /// width: `i32` -> Image width in pixels
2381    /// min: 0, max: 100000000, default: 0
2382    pub width: i32,
2383    /// height: `i32` -> Image height in pixels
2384    /// min: 0, max: 100000000, default: 0
2385    pub height: i32,
2386    /// bands: `i32` -> Number of bands in image
2387    /// min: 0, max: 100000000, default: 0
2388    pub bands: i32,
2389    /// format: `BandFormat` -> Pixel format in image
2390    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
2391    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
2392    ///  `Char` -> VIPS_FORMAT_CHAR = 1
2393    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
2394    ///  `Short` -> VIPS_FORMAT_SHORT = 3
2395    ///  `Uint` -> VIPS_FORMAT_UINT = 4
2396    ///  `Int` -> VIPS_FORMAT_INT = 5
2397    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
2398    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
2399    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
2400    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
2401    ///  `Last` -> VIPS_FORMAT_LAST = 10
2402    pub format: BandFormat,
2403    /// coding: `Coding` -> Pixel coding
2404    ///  `Error` -> VIPS_CODING_ERROR = -1
2405    ///  `None` -> VIPS_CODING_NONE = 0 [DEFAULT]
2406    ///  `Labq` -> VIPS_CODING_LABQ = 2
2407    ///  `Rad` -> VIPS_CODING_RAD = 6
2408    ///  `Last` -> VIPS_CODING_LAST = 7
2409    pub coding: Coding,
2410    /// interpretation: `Interpretation` -> Pixel interpretation
2411    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
2412    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
2413    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
2414    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
2415    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
2416    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
2417    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
2418    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
2419    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
2420    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
2421    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
2422    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
2423    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
2424    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
2425    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
2426    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
2427    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
2428    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
2429    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
2430    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
2431    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
2432    pub interpretation: Interpretation,
2433    /// xres: `f64` -> Horizontal resolution in pixels/mm
2434    /// min: -0, max: 1000000, default: 0
2435    pub xres: f64,
2436    /// yres: `f64` -> Vertical resolution in pixels/mm
2437    /// min: -0, max: 1000000, default: 0
2438    pub yres: f64,
2439    /// xoffset: `i32` -> Horizontal offset of origin
2440    /// min: -100000000, max: 100000000, default: 0
2441    pub xoffset: i32,
2442    /// yoffset: `i32` -> Vertical offset of origin
2443    /// min: -100000000, max: 100000000, default: 0
2444    pub yoffset: i32,
2445}
2446
2447impl std::default::Default for CopyOptions {
2448    fn default() -> Self {
2449        CopyOptions {
2450            width: i32::from(0),
2451            height: i32::from(0),
2452            bands: i32::from(0),
2453            format: BandFormat::Uchar,
2454            coding: Coding::None,
2455            interpretation: Interpretation::Multiband,
2456            xres: f64::from(0),
2457            yres: f64::from(0),
2458            xoffset: i32::from(0),
2459            yoffset: i32::from(0),
2460        }
2461    }
2462}
2463
2464/// VipsCopy (copy), copy an image
2465/// inp: `&VipsImage` -> Input image
2466/// copy_options: `&CopyOptions` -> optional arguments
2467/// returns `VipsImage` - Output image
2468pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2469    unsafe {
2470        let inp_in: *mut bindings::VipsImage = inp.ctx;
2471        let mut out_out: *mut bindings::VipsImage = null_mut();
2472
2473        let width_in: i32 = copy_options.width;
2474        let width_in_name = utils::new_c_string("width")?;
2475
2476        let height_in: i32 = copy_options.height;
2477        let height_in_name = utils::new_c_string("height")?;
2478
2479        let bands_in: i32 = copy_options.bands;
2480        let bands_in_name = utils::new_c_string("bands")?;
2481
2482        let format_in: i32 = copy_options.format as i32;
2483        let format_in_name = utils::new_c_string("format")?;
2484
2485        let coding_in: i32 = copy_options.coding as i32;
2486        let coding_in_name = utils::new_c_string("coding")?;
2487
2488        let interpretation_in: i32 = copy_options.interpretation as i32;
2489        let interpretation_in_name = utils::new_c_string("interpretation")?;
2490
2491        let xres_in: f64 = copy_options.xres;
2492        let xres_in_name = utils::new_c_string("xres")?;
2493
2494        let yres_in: f64 = copy_options.yres;
2495        let yres_in_name = utils::new_c_string("yres")?;
2496
2497        let xoffset_in: i32 = copy_options.xoffset;
2498        let xoffset_in_name = utils::new_c_string("xoffset")?;
2499
2500        let yoffset_in: i32 = copy_options.yoffset;
2501        let yoffset_in_name = utils::new_c_string("yoffset")?;
2502
2503        let vips_op_response = bindings::vips_copy(
2504            inp_in,
2505            &mut out_out,
2506            width_in_name.as_ptr(),
2507            width_in,
2508            height_in_name.as_ptr(),
2509            height_in,
2510            bands_in_name.as_ptr(),
2511            bands_in,
2512            format_in_name.as_ptr(),
2513            format_in,
2514            coding_in_name.as_ptr(),
2515            coding_in,
2516            interpretation_in_name.as_ptr(),
2517            interpretation_in,
2518            xres_in_name.as_ptr(),
2519            xres_in,
2520            yres_in_name.as_ptr(),
2521            yres_in,
2522            xoffset_in_name.as_ptr(),
2523            xoffset_in,
2524            yoffset_in_name.as_ptr(),
2525            yoffset_in,
2526            NULL,
2527        );
2528        utils::result(
2529            vips_op_response,
2530            VipsImage { ctx: out_out },
2531            Error::CopyError,
2532        )
2533    }
2534}
2535
2536/// VipsTileCache (tilecache), cache an image as a set of tiles
2537/// inp: `&VipsImage` -> Input image
2538/// returns `VipsImage` - Output image
2539pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2540    unsafe {
2541        let inp_in: *mut bindings::VipsImage = inp.ctx;
2542        let mut out_out: *mut bindings::VipsImage = null_mut();
2543
2544        let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2545        utils::result(
2546            vips_op_response,
2547            VipsImage { ctx: out_out },
2548            Error::TilecacheError,
2549        )
2550    }
2551}
2552
2553/// Options for tilecache operation
2554#[derive(Clone, Debug)]
2555pub struct TilecacheOptions {
2556    /// tile_width: `i32` -> Tile width in pixels
2557    /// min: 1, max: 1000000, default: 128
2558    pub tile_width: i32,
2559    /// tile_height: `i32` -> Tile height in pixels
2560    /// min: 1, max: 1000000, default: 128
2561    pub tile_height: i32,
2562    /// max_tiles: `i32` -> Maximum number of tiles to cache
2563    /// min: -1, max: 1000000, default: 1000
2564    pub max_tiles: i32,
2565    /// access: `Access` -> Expected access pattern
2566    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2567    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2568    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2569    ///  `Last` -> VIPS_ACCESS_LAST = 3
2570    pub access: Access,
2571    /// threaded: `bool` -> Allow threaded access
2572    /// default: false
2573    pub threaded: bool,
2574    /// persistent: `bool` -> Keep cache between evaluations
2575    /// default: false
2576    pub persistent: bool,
2577}
2578
2579impl std::default::Default for TilecacheOptions {
2580    fn default() -> Self {
2581        TilecacheOptions {
2582            tile_width: i32::from(128),
2583            tile_height: i32::from(128),
2584            max_tiles: i32::from(1000),
2585            access: Access::Random,
2586            threaded: false,
2587            persistent: false,
2588        }
2589    }
2590}
2591
2592/// VipsTileCache (tilecache), cache an image as a set of tiles
2593/// inp: `&VipsImage` -> Input image
2594/// tilecache_options: `&TilecacheOptions` -> optional arguments
2595/// returns `VipsImage` - Output image
2596pub fn tilecache_with_opts(
2597    inp: &VipsImage,
2598    tilecache_options: &TilecacheOptions,
2599) -> Result<VipsImage> {
2600    unsafe {
2601        let inp_in: *mut bindings::VipsImage = inp.ctx;
2602        let mut out_out: *mut bindings::VipsImage = null_mut();
2603
2604        let tile_width_in: i32 = tilecache_options.tile_width;
2605        let tile_width_in_name = utils::new_c_string("tile-width")?;
2606
2607        let tile_height_in: i32 = tilecache_options.tile_height;
2608        let tile_height_in_name = utils::new_c_string("tile-height")?;
2609
2610        let max_tiles_in: i32 = tilecache_options.max_tiles;
2611        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2612
2613        let access_in: i32 = tilecache_options.access as i32;
2614        let access_in_name = utils::new_c_string("access")?;
2615
2616        let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2617        let threaded_in_name = utils::new_c_string("threaded")?;
2618
2619        let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2620        let persistent_in_name = utils::new_c_string("persistent")?;
2621
2622        let vips_op_response = bindings::vips_tilecache(
2623            inp_in,
2624            &mut out_out,
2625            tile_width_in_name.as_ptr(),
2626            tile_width_in,
2627            tile_height_in_name.as_ptr(),
2628            tile_height_in,
2629            max_tiles_in_name.as_ptr(),
2630            max_tiles_in,
2631            access_in_name.as_ptr(),
2632            access_in,
2633            threaded_in_name.as_ptr(),
2634            threaded_in,
2635            persistent_in_name.as_ptr(),
2636            persistent_in,
2637            NULL,
2638        );
2639        utils::result(
2640            vips_op_response,
2641            VipsImage { ctx: out_out },
2642            Error::TilecacheError,
2643        )
2644    }
2645}
2646
2647/// VipsLineCache (linecache), cache an image as a set of lines
2648/// inp: `&VipsImage` -> Input image
2649/// returns `VipsImage` - Output image
2650pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2651    unsafe {
2652        let inp_in: *mut bindings::VipsImage = inp.ctx;
2653        let mut out_out: *mut bindings::VipsImage = null_mut();
2654
2655        let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2656        utils::result(
2657            vips_op_response,
2658            VipsImage { ctx: out_out },
2659            Error::LinecacheError,
2660        )
2661    }
2662}
2663
2664/// Options for linecache operation
2665#[derive(Clone, Debug)]
2666pub struct LinecacheOptions {
2667    /// tile_height: `i32` -> Tile height in pixels
2668    /// min: 1, max: 1000000, default: 128
2669    pub tile_height: i32,
2670    /// access: `Access` -> Expected access pattern
2671    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2672    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2673    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2674    ///  `Last` -> VIPS_ACCESS_LAST = 3
2675    pub access: Access,
2676    /// threaded: `bool` -> Allow threaded access
2677    /// default: false
2678    pub threaded: bool,
2679    /// persistent: `bool` -> Keep cache between evaluations
2680    /// default: false
2681    pub persistent: bool,
2682}
2683
2684impl std::default::Default for LinecacheOptions {
2685    fn default() -> Self {
2686        LinecacheOptions {
2687            tile_height: i32::from(128),
2688            access: Access::Random,
2689            threaded: false,
2690            persistent: false,
2691        }
2692    }
2693}
2694
2695/// VipsLineCache (linecache), cache an image as a set of lines
2696/// inp: `&VipsImage` -> Input image
2697/// linecache_options: `&LinecacheOptions` -> optional arguments
2698/// returns `VipsImage` - Output image
2699pub fn linecache_with_opts(
2700    inp: &VipsImage,
2701    linecache_options: &LinecacheOptions,
2702) -> Result<VipsImage> {
2703    unsafe {
2704        let inp_in: *mut bindings::VipsImage = inp.ctx;
2705        let mut out_out: *mut bindings::VipsImage = null_mut();
2706
2707        let tile_height_in: i32 = linecache_options.tile_height;
2708        let tile_height_in_name = utils::new_c_string("tile-height")?;
2709
2710        let access_in: i32 = linecache_options.access as i32;
2711        let access_in_name = utils::new_c_string("access")?;
2712
2713        let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2714        let threaded_in_name = utils::new_c_string("threaded")?;
2715
2716        let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2717        let persistent_in_name = utils::new_c_string("persistent")?;
2718
2719        let vips_op_response = bindings::vips_linecache(
2720            inp_in,
2721            &mut out_out,
2722            tile_height_in_name.as_ptr(),
2723            tile_height_in,
2724            access_in_name.as_ptr(),
2725            access_in,
2726            threaded_in_name.as_ptr(),
2727            threaded_in,
2728            persistent_in_name.as_ptr(),
2729            persistent_in,
2730            NULL,
2731        );
2732        utils::result(
2733            vips_op_response,
2734            VipsImage { ctx: out_out },
2735            Error::LinecacheError,
2736        )
2737    }
2738}
2739
2740/// VipsSequential (sequential), check sequential access
2741/// inp: `&VipsImage` -> Input image
2742/// returns `VipsImage` - Output image
2743pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2744    unsafe {
2745        let inp_in: *mut bindings::VipsImage = inp.ctx;
2746        let mut out_out: *mut bindings::VipsImage = null_mut();
2747
2748        let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2749        utils::result(
2750            vips_op_response,
2751            VipsImage { ctx: out_out },
2752            Error::SequentialError,
2753        )
2754    }
2755}
2756
2757/// Options for sequential operation
2758#[derive(Clone, Debug)]
2759pub struct SequentialOptions {
2760    /// tile_height: `i32` -> Tile height in pixels
2761    /// min: 1, max: 1000000, default: 1
2762    pub tile_height: i32,
2763}
2764
2765impl std::default::Default for SequentialOptions {
2766    fn default() -> Self {
2767        SequentialOptions {
2768            tile_height: i32::from(1),
2769        }
2770    }
2771}
2772
2773/// VipsSequential (sequential), check sequential access
2774/// inp: `&VipsImage` -> Input image
2775/// sequential_options: `&SequentialOptions` -> optional arguments
2776/// returns `VipsImage` - Output image
2777pub fn sequential_with_opts(
2778    inp: &VipsImage,
2779    sequential_options: &SequentialOptions,
2780) -> Result<VipsImage> {
2781    unsafe {
2782        let inp_in: *mut bindings::VipsImage = inp.ctx;
2783        let mut out_out: *mut bindings::VipsImage = null_mut();
2784
2785        let tile_height_in: i32 = sequential_options.tile_height;
2786        let tile_height_in_name = utils::new_c_string("tile-height")?;
2787
2788        let vips_op_response = bindings::vips_sequential(
2789            inp_in,
2790            &mut out_out,
2791            tile_height_in_name.as_ptr(),
2792            tile_height_in,
2793            NULL,
2794        );
2795        utils::result(
2796            vips_op_response,
2797            VipsImage { ctx: out_out },
2798            Error::SequentialError,
2799        )
2800    }
2801}
2802
2803/// VipsEmbed (embed), embed an image in a larger image
2804/// inp: `&VipsImage` -> Input image
2805/// x: `i32` -> Left edge of input in output
2806/// min: -1000000000, max: 1000000000, default: 0
2807/// y: `i32` -> Top edge of input in output
2808/// min: -1000000000, max: 1000000000, default: 0
2809/// width: `i32` -> Image width in pixels
2810/// min: 1, max: 1000000000, default: 1
2811/// height: `i32` -> Image height in pixels
2812/// min: 1, max: 1000000000, default: 1
2813/// returns `VipsImage` - Output image
2814pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2815    unsafe {
2816        let inp_in: *mut bindings::VipsImage = inp.ctx;
2817        let x_in: i32 = x;
2818        let y_in: i32 = y;
2819        let width_in: i32 = width;
2820        let height_in: i32 = height;
2821        let mut out_out: *mut bindings::VipsImage = null_mut();
2822
2823        let vips_op_response =
2824            bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2825        utils::result(
2826            vips_op_response,
2827            VipsImage { ctx: out_out },
2828            Error::EmbedError,
2829        )
2830    }
2831}
2832
2833/// Options for embed operation
2834#[derive(Clone, Debug)]
2835pub struct EmbedOptions {
2836    /// extend: `Extend` -> How to generate the extra pixels
2837    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2838    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2839    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2840    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2841    ///  `White` -> VIPS_EXTEND_WHITE = 4
2842    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2843    ///  `Last` -> VIPS_EXTEND_LAST = 6
2844    pub extend: Extend,
2845    /// background: `Vec<f64>` -> Color for background pixels
2846    pub background: Vec<f64>,
2847}
2848
2849impl std::default::Default for EmbedOptions {
2850    fn default() -> Self {
2851        EmbedOptions {
2852            extend: Extend::Black,
2853            background: Vec::new(),
2854        }
2855    }
2856}
2857
2858/// VipsEmbed (embed), embed an image in a larger image
2859/// inp: `&VipsImage` -> Input image
2860/// x: `i32` -> Left edge of input in output
2861/// min: -1000000000, max: 1000000000, default: 0
2862/// y: `i32` -> Top edge of input in output
2863/// min: -1000000000, max: 1000000000, default: 0
2864/// width: `i32` -> Image width in pixels
2865/// min: 1, max: 1000000000, default: 1
2866/// height: `i32` -> Image height in pixels
2867/// min: 1, max: 1000000000, default: 1
2868/// embed_options: `&EmbedOptions` -> optional arguments
2869/// returns `VipsImage` - Output image
2870pub fn embed_with_opts(
2871    inp: &VipsImage,
2872    x: i32,
2873    y: i32,
2874    width: i32,
2875    height: i32,
2876    embed_options: &EmbedOptions,
2877) -> Result<VipsImage> {
2878    unsafe {
2879        let inp_in: *mut bindings::VipsImage = inp.ctx;
2880        let x_in: i32 = x;
2881        let y_in: i32 = y;
2882        let width_in: i32 = width;
2883        let height_in: i32 = height;
2884        let mut out_out: *mut bindings::VipsImage = null_mut();
2885
2886        let extend_in: i32 = embed_options.extend as i32;
2887        let extend_in_name = utils::new_c_string("extend")?;
2888
2889        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2890        let background_in = background_wrapper.ctx;
2891        let background_in_name = utils::new_c_string("background")?;
2892
2893        let vips_op_response = bindings::vips_embed(
2894            inp_in,
2895            &mut out_out,
2896            x_in,
2897            y_in,
2898            width_in,
2899            height_in,
2900            extend_in_name.as_ptr(),
2901            extend_in,
2902            background_in_name.as_ptr(),
2903            background_in,
2904            NULL,
2905        );
2906        utils::result(
2907            vips_op_response,
2908            VipsImage { ctx: out_out },
2909            Error::EmbedError,
2910        )
2911    }
2912}
2913
2914/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2915/// inp: `&VipsImage` -> Input image
2916/// direction: `CompassDirection` -> Direction to place image within width/height
2917///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2918///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2919///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2920///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2921///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2922///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2923///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2924///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2925///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2926///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2927/// width: `i32` -> Image width in pixels
2928/// min: 1, max: 1000000000, default: 1
2929/// height: `i32` -> Image height in pixels
2930/// min: 1, max: 1000000000, default: 1
2931/// returns `VipsImage` - Output image
2932pub fn gravity(
2933    inp: &VipsImage,
2934    direction: CompassDirection,
2935    width: i32,
2936    height: i32,
2937) -> Result<VipsImage> {
2938    unsafe {
2939        let inp_in: *mut bindings::VipsImage = inp.ctx;
2940        let direction_in: i32 = direction as i32;
2941        let width_in: i32 = width;
2942        let height_in: i32 = height;
2943        let mut out_out: *mut bindings::VipsImage = null_mut();
2944
2945        let vips_op_response = bindings::vips_gravity(
2946            inp_in,
2947            &mut out_out,
2948            direction_in.try_into().unwrap(),
2949            width_in,
2950            height_in,
2951            NULL,
2952        );
2953        utils::result(
2954            vips_op_response,
2955            VipsImage { ctx: out_out },
2956            Error::GravityError,
2957        )
2958    }
2959}
2960
2961/// Options for gravity operation
2962#[derive(Clone, Debug)]
2963pub struct GravityOptions {
2964    /// extend: `Extend` -> How to generate the extra pixels
2965    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2966    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2967    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2968    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2969    ///  `White` -> VIPS_EXTEND_WHITE = 4
2970    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2971    ///  `Last` -> VIPS_EXTEND_LAST = 6
2972    pub extend: Extend,
2973    /// background: `Vec<f64>` -> Color for background pixels
2974    pub background: Vec<f64>,
2975}
2976
2977impl std::default::Default for GravityOptions {
2978    fn default() -> Self {
2979        GravityOptions {
2980            extend: Extend::Black,
2981            background: Vec::new(),
2982        }
2983    }
2984}
2985
2986/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2987/// inp: `&VipsImage` -> Input image
2988/// direction: `CompassDirection` -> Direction to place image within width/height
2989///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2990///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2991///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2992///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2993///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2994///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2995///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2996///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2997///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2998///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2999/// width: `i32` -> Image width in pixels
3000/// min: 1, max: 1000000000, default: 1
3001/// height: `i32` -> Image height in pixels
3002/// min: 1, max: 1000000000, default: 1
3003/// gravity_options: `&GravityOptions` -> optional arguments
3004/// returns `VipsImage` - Output image
3005pub fn gravity_with_opts(
3006    inp: &VipsImage,
3007    direction: CompassDirection,
3008    width: i32,
3009    height: i32,
3010    gravity_options: &GravityOptions,
3011) -> Result<VipsImage> {
3012    unsafe {
3013        let inp_in: *mut bindings::VipsImage = inp.ctx;
3014        let direction_in: i32 = direction as i32;
3015        let width_in: i32 = width;
3016        let height_in: i32 = height;
3017        let mut out_out: *mut bindings::VipsImage = null_mut();
3018
3019        let extend_in: i32 = gravity_options.extend as i32;
3020        let extend_in_name = utils::new_c_string("extend")?;
3021
3022        let background_wrapper =
3023            utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
3024        let background_in = background_wrapper.ctx;
3025        let background_in_name = utils::new_c_string("background")?;
3026
3027        let vips_op_response = bindings::vips_gravity(
3028            inp_in,
3029            &mut out_out,
3030            direction_in.try_into().unwrap(),
3031            width_in,
3032            height_in,
3033            extend_in_name.as_ptr(),
3034            extend_in,
3035            background_in_name.as_ptr(),
3036            background_in,
3037            NULL,
3038        );
3039        utils::result(
3040            vips_op_response,
3041            VipsImage { ctx: out_out },
3042            Error::GravityError,
3043        )
3044    }
3045}
3046
3047/// VipsFlip (flip), flip an image
3048/// inp: `&VipsImage` -> Input image
3049/// direction: `Direction` -> Direction to flip image
3050///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3051///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3052///  `Last` -> VIPS_DIRECTION_LAST = 2
3053/// returns `VipsImage` - Output image
3054pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3055    unsafe {
3056        let inp_in: *mut bindings::VipsImage = inp.ctx;
3057        let direction_in: i32 = direction as i32;
3058        let mut out_out: *mut bindings::VipsImage = null_mut();
3059
3060        let vips_op_response =
3061            bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3062        utils::result(
3063            vips_op_response,
3064            VipsImage { ctx: out_out },
3065            Error::FlipError,
3066        )
3067    }
3068}
3069
3070/// VipsInsert (insert), insert image @sub into @main at @x, @y
3071/// main: `&VipsImage` -> Main input image
3072/// sub: `&VipsImage` -> Sub-image to insert into main image
3073/// x: `i32` -> Left edge of sub in main
3074/// min: -100000000, max: 100000000, default: 0
3075/// y: `i32` -> Top edge of sub in main
3076/// min: -100000000, max: 100000000, default: 0
3077/// returns `VipsImage` - Output image
3078pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3079    unsafe {
3080        let main_in: *mut bindings::VipsImage = main.ctx;
3081        let sub_in: *mut bindings::VipsImage = sub.ctx;
3082        let x_in: i32 = x;
3083        let y_in: i32 = y;
3084        let mut out_out: *mut bindings::VipsImage = null_mut();
3085
3086        let vips_op_response =
3087            bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3088        utils::result(
3089            vips_op_response,
3090            VipsImage { ctx: out_out },
3091            Error::InsertError,
3092        )
3093    }
3094}
3095
3096/// Options for insert operation
3097#[derive(Clone, Debug)]
3098pub struct InsertOptions {
3099    /// expand: `bool` -> Expand output to hold all of both inputs
3100    /// default: false
3101    pub expand: bool,
3102    /// background: `Vec<f64>` -> Color for new pixels
3103    pub background: Vec<f64>,
3104}
3105
3106impl std::default::Default for InsertOptions {
3107    fn default() -> Self {
3108        InsertOptions {
3109            expand: false,
3110            background: Vec::new(),
3111        }
3112    }
3113}
3114
3115/// VipsInsert (insert), insert image @sub into @main at @x, @y
3116/// main: `&VipsImage` -> Main input image
3117/// sub: `&VipsImage` -> Sub-image to insert into main image
3118/// x: `i32` -> Left edge of sub in main
3119/// min: -100000000, max: 100000000, default: 0
3120/// y: `i32` -> Top edge of sub in main
3121/// min: -100000000, max: 100000000, default: 0
3122/// insert_options: `&InsertOptions` -> optional arguments
3123/// returns `VipsImage` - Output image
3124pub fn insert_with_opts(
3125    main: &VipsImage,
3126    sub: &VipsImage,
3127    x: i32,
3128    y: i32,
3129    insert_options: &InsertOptions,
3130) -> Result<VipsImage> {
3131    unsafe {
3132        let main_in: *mut bindings::VipsImage = main.ctx;
3133        let sub_in: *mut bindings::VipsImage = sub.ctx;
3134        let x_in: i32 = x;
3135        let y_in: i32 = y;
3136        let mut out_out: *mut bindings::VipsImage = null_mut();
3137
3138        let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3139        let expand_in_name = utils::new_c_string("expand")?;
3140
3141        let background_wrapper =
3142            utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3143        let background_in = background_wrapper.ctx;
3144        let background_in_name = utils::new_c_string("background")?;
3145
3146        let vips_op_response = bindings::vips_insert(
3147            main_in,
3148            sub_in,
3149            &mut out_out,
3150            x_in,
3151            y_in,
3152            expand_in_name.as_ptr(),
3153            expand_in,
3154            background_in_name.as_ptr(),
3155            background_in,
3156            NULL,
3157        );
3158        utils::result(
3159            vips_op_response,
3160            VipsImage { ctx: out_out },
3161            Error::InsertError,
3162        )
3163    }
3164}
3165
3166/// VipsJoin (join), join a pair of images
3167/// in_1: `&VipsImage` -> First input image
3168/// in_2: `&VipsImage` -> Second input image
3169/// direction: `Direction` -> Join left-right or up-down
3170///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3171///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3172///  `Last` -> VIPS_DIRECTION_LAST = 2
3173/// returns `VipsImage` - Output image
3174pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3175    unsafe {
3176        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3177        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3178        let direction_in: i32 = direction as i32;
3179        let mut out_out: *mut bindings::VipsImage = null_mut();
3180
3181        let vips_op_response = bindings::vips_join(
3182            in_1_in,
3183            in_2_in,
3184            &mut out_out,
3185            direction_in.try_into().unwrap(),
3186            NULL,
3187        );
3188        utils::result(
3189            vips_op_response,
3190            VipsImage { ctx: out_out },
3191            Error::JoinError,
3192        )
3193    }
3194}
3195
3196/// Options for join operation
3197#[derive(Clone, Debug)]
3198pub struct JoinOptions {
3199    /// expand: `bool` -> Expand output to hold all of both inputs
3200    /// default: false
3201    pub expand: bool,
3202    /// shim: `i32` -> Pixels between images
3203    /// min: 0, max: 1000000, default: 0
3204    pub shim: i32,
3205    /// background: `Vec<f64>` -> Colour for new pixels
3206    pub background: Vec<f64>,
3207    /// align: `Align` -> Align on the low, centre or high coordinate edge
3208    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3209    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3210    ///  `High` -> VIPS_ALIGN_HIGH = 2
3211    ///  `Last` -> VIPS_ALIGN_LAST = 3
3212    pub align: Align,
3213}
3214
3215impl std::default::Default for JoinOptions {
3216    fn default() -> Self {
3217        JoinOptions {
3218            expand: false,
3219            shim: i32::from(0),
3220            background: Vec::new(),
3221            align: Align::Low,
3222        }
3223    }
3224}
3225
3226/// VipsJoin (join), join a pair of images
3227/// in_1: `&VipsImage` -> First input image
3228/// in_2: `&VipsImage` -> Second input image
3229/// direction: `Direction` -> Join left-right or up-down
3230///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3231///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3232///  `Last` -> VIPS_DIRECTION_LAST = 2
3233/// join_options: `&JoinOptions` -> optional arguments
3234/// returns `VipsImage` - Output image
3235pub fn join_with_opts(
3236    in_1: &VipsImage,
3237    in_2: &VipsImage,
3238    direction: Direction,
3239    join_options: &JoinOptions,
3240) -> Result<VipsImage> {
3241    unsafe {
3242        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3243        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3244        let direction_in: i32 = direction as i32;
3245        let mut out_out: *mut bindings::VipsImage = null_mut();
3246
3247        let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3248        let expand_in_name = utils::new_c_string("expand")?;
3249
3250        let shim_in: i32 = join_options.shim;
3251        let shim_in_name = utils::new_c_string("shim")?;
3252
3253        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3254        let background_in = background_wrapper.ctx;
3255        let background_in_name = utils::new_c_string("background")?;
3256
3257        let align_in: i32 = join_options.align as i32;
3258        let align_in_name = utils::new_c_string("align")?;
3259
3260        let vips_op_response = bindings::vips_join(
3261            in_1_in,
3262            in_2_in,
3263            &mut out_out,
3264            direction_in.try_into().unwrap(),
3265            expand_in_name.as_ptr(),
3266            expand_in,
3267            shim_in_name.as_ptr(),
3268            shim_in,
3269            background_in_name.as_ptr(),
3270            background_in,
3271            align_in_name.as_ptr(),
3272            align_in,
3273            NULL,
3274        );
3275        utils::result(
3276            vips_op_response,
3277            VipsImage { ctx: out_out },
3278            Error::JoinError,
3279        )
3280    }
3281}
3282
3283/// VipsArrayjoin (arrayjoin), join an array of images
3284/// inp: `&mut [VipsImage]` -> Array of input images
3285/// returns `VipsImage` - Output image
3286pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3287    unsafe {
3288        let (inp_len, mut inp_in) = {
3289            let len = inp.len();
3290            let mut input = Vec::new();
3291            for img in inp {
3292                input.push(img.ctx)
3293            }
3294            (len as i32, input)
3295        };
3296        let mut out_out: *mut bindings::VipsImage = null_mut();
3297
3298        let vips_op_response =
3299            bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3300        utils::result(
3301            vips_op_response,
3302            VipsImage { ctx: out_out },
3303            Error::ArrayjoinError,
3304        )
3305    }
3306}
3307
3308/// Options for arrayjoin operation
3309#[derive(Clone, Debug)]
3310pub struct ArrayjoinOptions {
3311    /// across: `i32` -> Number of images across grid
3312    /// min: 1, max: 1000000, default: 1
3313    pub across: i32,
3314    /// shim: `i32` -> Pixels between images
3315    /// min: 0, max: 1000000, default: 0
3316    pub shim: i32,
3317    /// background: `Vec<f64>` -> Colour for new pixels
3318    pub background: Vec<f64>,
3319    /// halign: `Align` -> Align on the left, centre or right
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 halign: Align,
3325    /// valign: `Align` -> Align on the top, centre or bottom
3326    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3327    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3328    ///  `High` -> VIPS_ALIGN_HIGH = 2
3329    ///  `Last` -> VIPS_ALIGN_LAST = 3
3330    pub valign: Align,
3331    /// hspacing: `i32` -> Horizontal spacing between images
3332    /// min: 1, max: 1000000, default: 1
3333    pub hspacing: i32,
3334    /// vspacing: `i32` -> Vertical spacing between images
3335    /// min: 1, max: 1000000, default: 1
3336    pub vspacing: i32,
3337}
3338
3339impl std::default::Default for ArrayjoinOptions {
3340    fn default() -> Self {
3341        ArrayjoinOptions {
3342            across: i32::from(1),
3343            shim: i32::from(0),
3344            background: Vec::new(),
3345            halign: Align::Low,
3346            valign: Align::Low,
3347            hspacing: i32::from(1),
3348            vspacing: i32::from(1),
3349        }
3350    }
3351}
3352
3353/// VipsArrayjoin (arrayjoin), join an array of images
3354/// inp: `&mut [VipsImage]` -> Array of input images
3355/// arrayjoin_options: `&ArrayjoinOptions` -> optional arguments
3356/// returns `VipsImage` - Output image
3357pub fn arrayjoin_with_opts(
3358    inp: &mut [VipsImage],
3359    arrayjoin_options: &ArrayjoinOptions,
3360) -> Result<VipsImage> {
3361    unsafe {
3362        let (inp_len, mut inp_in) = {
3363            let len = inp.len();
3364            let mut input = Vec::new();
3365            for img in inp {
3366                input.push(img.ctx)
3367            }
3368            (len as i32, input)
3369        };
3370        let mut out_out: *mut bindings::VipsImage = null_mut();
3371
3372        let across_in: i32 = arrayjoin_options.across;
3373        let across_in_name = utils::new_c_string("across")?;
3374
3375        let shim_in: i32 = arrayjoin_options.shim;
3376        let shim_in_name = utils::new_c_string("shim")?;
3377
3378        let background_wrapper =
3379            utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3380        let background_in = background_wrapper.ctx;
3381        let background_in_name = utils::new_c_string("background")?;
3382
3383        let halign_in: i32 = arrayjoin_options.halign as i32;
3384        let halign_in_name = utils::new_c_string("halign")?;
3385
3386        let valign_in: i32 = arrayjoin_options.valign as i32;
3387        let valign_in_name = utils::new_c_string("valign")?;
3388
3389        let hspacing_in: i32 = arrayjoin_options.hspacing;
3390        let hspacing_in_name = utils::new_c_string("hspacing")?;
3391
3392        let vspacing_in: i32 = arrayjoin_options.vspacing;
3393        let vspacing_in_name = utils::new_c_string("vspacing")?;
3394
3395        let vips_op_response = bindings::vips_arrayjoin(
3396            inp_in.as_mut_ptr(),
3397            &mut out_out,
3398            inp_len,
3399            across_in_name.as_ptr(),
3400            across_in,
3401            shim_in_name.as_ptr(),
3402            shim_in,
3403            background_in_name.as_ptr(),
3404            background_in,
3405            halign_in_name.as_ptr(),
3406            halign_in,
3407            valign_in_name.as_ptr(),
3408            valign_in,
3409            hspacing_in_name.as_ptr(),
3410            hspacing_in,
3411            vspacing_in_name.as_ptr(),
3412            vspacing_in,
3413            NULL,
3414        );
3415        utils::result(
3416            vips_op_response,
3417            VipsImage { ctx: out_out },
3418            Error::ArrayjoinError,
3419        )
3420    }
3421}
3422
3423/// VipsExtractArea (extract_area), extract an area from an image
3424/// input: `&VipsImage` -> Input image
3425/// left: `i32` -> Left edge of extract area
3426/// min: -100000000, max: 100000000, default: 0
3427/// top: `i32` -> Top edge of extract area
3428/// min: -100000000, max: 100000000, default: 0
3429/// width: `i32` -> Width of extract area
3430/// min: 1, max: 100000000, default: 1
3431/// height: `i32` -> Height of extract area
3432/// min: 1, max: 100000000, default: 1
3433/// returns `VipsImage` - Output image
3434pub fn extract_area(
3435    input: &VipsImage,
3436    left: i32,
3437    top: i32,
3438    width: i32,
3439    height: i32,
3440) -> Result<VipsImage> {
3441    unsafe {
3442        let input_in: *mut bindings::VipsImage = input.ctx;
3443        let left_in: i32 = left;
3444        let top_in: i32 = top;
3445        let width_in: i32 = width;
3446        let height_in: i32 = height;
3447        let mut out_out: *mut bindings::VipsImage = null_mut();
3448
3449        let vips_op_response = bindings::vips_extract_area(
3450            input_in,
3451            &mut out_out,
3452            left_in,
3453            top_in,
3454            width_in,
3455            height_in,
3456            NULL,
3457        );
3458        utils::result(
3459            vips_op_response,
3460            VipsImage { ctx: out_out },
3461            Error::ExtractAreaError,
3462        )
3463    }
3464}
3465
3466/// VipsSmartcrop (smartcrop), extract an area from an image
3467/// input: `&VipsImage` -> Input image
3468/// width: `i32` -> Width of extract area
3469/// min: 1, max: 100000000, default: 1
3470/// height: `i32` -> Height of extract area
3471/// min: 1, max: 100000000, default: 1
3472/// returns `VipsImage` - Output image
3473pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3474    unsafe {
3475        let input_in: *mut bindings::VipsImage = input.ctx;
3476        let width_in: i32 = width;
3477        let height_in: i32 = height;
3478        let mut out_out: *mut bindings::VipsImage = null_mut();
3479
3480        let vips_op_response =
3481            bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3482        utils::result(
3483            vips_op_response,
3484            VipsImage { ctx: out_out },
3485            Error::SmartcropError,
3486        )
3487    }
3488}
3489
3490/// Options for smartcrop operation
3491#[derive(Clone, Debug)]
3492pub struct SmartcropOptions {
3493    /// attention_x: `i32` -> Horizontal position of attention centre
3494    /// min: 0, max: 100000000, default: 0
3495    pub attention_x: i32,
3496    /// attention_y: `i32` -> Vertical position of attention centre
3497    /// min: 0, max: 100000000, default: 0
3498    pub attention_y: i32,
3499    /// interesting: `Interesting` -> How to measure interestingness
3500    ///  `None` -> VIPS_INTERESTING_NONE = 0
3501    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
3502    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
3503    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3 [DEFAULT]
3504    ///  `Low` -> VIPS_INTERESTING_LOW = 4
3505    ///  `High` -> VIPS_INTERESTING_HIGH = 5
3506    ///  `All` -> VIPS_INTERESTING_ALL = 6
3507    ///  `Last` -> VIPS_INTERESTING_LAST = 7
3508    pub interesting: Interesting,
3509    /// premultiplied: `bool` -> Input image already has premultiplied alpha
3510    /// default: false
3511    pub premultiplied: bool,
3512}
3513
3514impl std::default::Default for SmartcropOptions {
3515    fn default() -> Self {
3516        SmartcropOptions {
3517            attention_x: i32::from(0),
3518            attention_y: i32::from(0),
3519            interesting: Interesting::Attention,
3520            premultiplied: false,
3521        }
3522    }
3523}
3524
3525/// VipsSmartcrop (smartcrop), extract an area from an image
3526/// input: `&VipsImage` -> Input image
3527/// width: `i32` -> Width of extract area
3528/// min: 1, max: 100000000, default: 1
3529/// height: `i32` -> Height of extract area
3530/// min: 1, max: 100000000, default: 1
3531/// smartcrop_options: `&SmartcropOptions` -> optional arguments
3532/// returns `VipsImage` - Output image
3533pub fn smartcrop_with_opts(
3534    input: &VipsImage,
3535    width: i32,
3536    height: i32,
3537    smartcrop_options: &SmartcropOptions,
3538) -> Result<VipsImage> {
3539    unsafe {
3540        let input_in: *mut bindings::VipsImage = input.ctx;
3541        let width_in: i32 = width;
3542        let height_in: i32 = height;
3543        let mut out_out: *mut bindings::VipsImage = null_mut();
3544
3545        let attention_x_in: i32 = smartcrop_options.attention_x;
3546        let attention_x_in_name = utils::new_c_string("attention-x")?;
3547
3548        let attention_y_in: i32 = smartcrop_options.attention_y;
3549        let attention_y_in_name = utils::new_c_string("attention-y")?;
3550
3551        let interesting_in: i32 = smartcrop_options.interesting as i32;
3552        let interesting_in_name = utils::new_c_string("interesting")?;
3553
3554        let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3555            1
3556        } else {
3557            0
3558        };
3559        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3560
3561        let vips_op_response = bindings::vips_smartcrop(
3562            input_in,
3563            &mut out_out,
3564            width_in,
3565            height_in,
3566            attention_x_in_name.as_ptr(),
3567            attention_x_in,
3568            attention_y_in_name.as_ptr(),
3569            attention_y_in,
3570            interesting_in_name.as_ptr(),
3571            interesting_in,
3572            premultiplied_in_name.as_ptr(),
3573            premultiplied_in,
3574            NULL,
3575        );
3576        utils::result(
3577            vips_op_response,
3578            VipsImage { ctx: out_out },
3579            Error::SmartcropError,
3580        )
3581    }
3582}
3583
3584/// VipsExtractBand (extract_band), extract band from an image
3585/// inp: `&VipsImage` -> Input image
3586/// band: `i32` -> Band to extract
3587/// min: 0, max: 100000000, default: 0
3588/// returns `VipsImage` - Output image
3589pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3590    unsafe {
3591        let inp_in: *mut bindings::VipsImage = inp.ctx;
3592        let band_in: i32 = band;
3593        let mut out_out: *mut bindings::VipsImage = null_mut();
3594
3595        let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3596        utils::result(
3597            vips_op_response,
3598            VipsImage { ctx: out_out },
3599            Error::ExtractBandError,
3600        )
3601    }
3602}
3603
3604/// Options for extract_band operation
3605#[derive(Clone, Debug)]
3606pub struct ExtractBandOptions {
3607    /// n: `i32` -> Number of bands to extract
3608    /// min: 1, max: 100000000, default: 1
3609    pub n: i32,
3610}
3611
3612impl std::default::Default for ExtractBandOptions {
3613    fn default() -> Self {
3614        ExtractBandOptions { n: i32::from(1) }
3615    }
3616}
3617
3618/// VipsExtractBand (extract_band), extract band from an image
3619/// inp: `&VipsImage` -> Input image
3620/// band: `i32` -> Band to extract
3621/// min: 0, max: 100000000, default: 0
3622/// extract_band_options: `&ExtractBandOptions` -> optional arguments
3623/// returns `VipsImage` - Output image
3624pub fn extract_band_with_opts(
3625    inp: &VipsImage,
3626    band: i32,
3627    extract_band_options: &ExtractBandOptions,
3628) -> Result<VipsImage> {
3629    unsafe {
3630        let inp_in: *mut bindings::VipsImage = inp.ctx;
3631        let band_in: i32 = band;
3632        let mut out_out: *mut bindings::VipsImage = null_mut();
3633
3634        let n_in: i32 = extract_band_options.n;
3635        let n_in_name = utils::new_c_string("n")?;
3636
3637        let vips_op_response = bindings::vips_extract_band(
3638            inp_in,
3639            &mut out_out,
3640            band_in,
3641            n_in_name.as_ptr(),
3642            n_in,
3643            NULL,
3644        );
3645        utils::result(
3646            vips_op_response,
3647            VipsImage { ctx: out_out },
3648            Error::ExtractBandError,
3649        )
3650    }
3651}
3652
3653/// VipsBandjoin (bandjoin), bandwise join a set of images
3654/// inp: `&mut [VipsImage]` -> Array of input images
3655/// returns `VipsImage` - Output image
3656pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3657    unsafe {
3658        let (inp_len, mut inp_in) = {
3659            let len = inp.len();
3660            let mut input = Vec::new();
3661            for img in inp {
3662                input.push(img.ctx)
3663            }
3664            (len as i32, input)
3665        };
3666        let mut out_out: *mut bindings::VipsImage = null_mut();
3667
3668        let vips_op_response =
3669            bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3670        utils::result(
3671            vips_op_response,
3672            VipsImage { ctx: out_out },
3673            Error::BandjoinError,
3674        )
3675    }
3676}
3677
3678/// VipsBandjoinConst (bandjoin_const), append a constant band to an image
3679/// inp: `&VipsImage` -> Input image
3680/// c: `&mut [f64]` -> Array of constants to add
3681/// returns `VipsImage` - Output image
3682pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3683    unsafe {
3684        let inp_in: *mut bindings::VipsImage = inp.ctx;
3685        let c_in: *mut f64 = c.as_mut_ptr();
3686        let mut out_out: *mut bindings::VipsImage = null_mut();
3687
3688        let vips_op_response =
3689            bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3690        utils::result(
3691            vips_op_response,
3692            VipsImage { ctx: out_out },
3693            Error::BandjoinConstError,
3694        )
3695    }
3696}
3697
3698/// VipsBandrank (bandrank), band-wise rank of a set of images
3699/// inp: `&mut [VipsImage]` -> Array of input images
3700/// returns `VipsImage` - Output image
3701pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3702    unsafe {
3703        let (inp_len, mut inp_in) = {
3704            let len = inp.len();
3705            let mut input = Vec::new();
3706            for img in inp {
3707                input.push(img.ctx)
3708            }
3709            (len as i32, input)
3710        };
3711        let mut out_out: *mut bindings::VipsImage = null_mut();
3712
3713        let vips_op_response =
3714            bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3715        utils::result(
3716            vips_op_response,
3717            VipsImage { ctx: out_out },
3718            Error::BandrankError,
3719        )
3720    }
3721}
3722
3723/// Options for bandrank operation
3724#[derive(Clone, Debug)]
3725pub struct BandrankOptions {
3726    /// index: `i32` -> Select this band element from sorted list
3727    /// min: -1, max: 1000000, default: -1
3728    pub index: i32,
3729}
3730
3731impl std::default::Default for BandrankOptions {
3732    fn default() -> Self {
3733        BandrankOptions {
3734            index: i32::from(-1),
3735        }
3736    }
3737}
3738
3739/// VipsBandrank (bandrank), band-wise rank of a set of images
3740/// inp: `&mut [VipsImage]` -> Array of input images
3741/// bandrank_options: `&BandrankOptions` -> optional arguments
3742/// returns `VipsImage` - Output image
3743pub fn bandrank_with_opts(
3744    inp: &mut [VipsImage],
3745    bandrank_options: &BandrankOptions,
3746) -> Result<VipsImage> {
3747    unsafe {
3748        let (inp_len, mut inp_in) = {
3749            let len = inp.len();
3750            let mut input = Vec::new();
3751            for img in inp {
3752                input.push(img.ctx)
3753            }
3754            (len as i32, input)
3755        };
3756        let mut out_out: *mut bindings::VipsImage = null_mut();
3757
3758        let index_in: i32 = bandrank_options.index;
3759        let index_in_name = utils::new_c_string("index")?;
3760
3761        let vips_op_response = bindings::vips_bandrank(
3762            inp_in.as_mut_ptr(),
3763            &mut out_out,
3764            inp_len,
3765            index_in_name.as_ptr(),
3766            index_in,
3767            NULL,
3768        );
3769        utils::result(
3770            vips_op_response,
3771            VipsImage { ctx: out_out },
3772            Error::BandrankError,
3773        )
3774    }
3775}
3776
3777/// VipsBandmean (bandmean), band-wise average
3778/// inp: `&VipsImage` -> Input image argument
3779/// returns `VipsImage` - Output image
3780pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3781    unsafe {
3782        let inp_in: *mut bindings::VipsImage = inp.ctx;
3783        let mut out_out: *mut bindings::VipsImage = null_mut();
3784
3785        let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3786        utils::result(
3787            vips_op_response,
3788            VipsImage { ctx: out_out },
3789            Error::BandmeanError,
3790        )
3791    }
3792}
3793
3794/// VipsBandbool (bandbool), boolean operation across image bands
3795/// inp: `&VipsImage` -> Input image argument
3796/// boolean: `OperationBoolean` -> Boolean to perform
3797///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
3798///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
3799///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
3800///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
3801///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
3802///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
3803/// returns `VipsImage` - Output image
3804pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3805    unsafe {
3806        let inp_in: *mut bindings::VipsImage = inp.ctx;
3807        let boolean_in: i32 = boolean as i32;
3808        let mut out_out: *mut bindings::VipsImage = null_mut();
3809
3810        let vips_op_response =
3811            bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3812        utils::result(
3813            vips_op_response,
3814            VipsImage { ctx: out_out },
3815            Error::BandboolError,
3816        )
3817    }
3818}
3819
3820/// VipsReplicate (replicate), replicate an image
3821/// inp: `&VipsImage` -> Input image
3822/// across: `i32` -> Repeat this many times horizontally
3823/// min: 1, max: 1000000, default: 1
3824/// down: `i32` -> Repeat this many times vertically
3825/// min: 1, max: 1000000, default: 1
3826/// returns `VipsImage` - Output image
3827pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3828    unsafe {
3829        let inp_in: *mut bindings::VipsImage = inp.ctx;
3830        let across_in: i32 = across;
3831        let down_in: i32 = down;
3832        let mut out_out: *mut bindings::VipsImage = null_mut();
3833
3834        let vips_op_response =
3835            bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3836        utils::result(
3837            vips_op_response,
3838            VipsImage { ctx: out_out },
3839            Error::ReplicateError,
3840        )
3841    }
3842}
3843
3844/// VipsCast (cast), cast an image
3845/// inp: `&VipsImage` -> Input image
3846/// format: `BandFormat` -> Format to cast to
3847///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3848///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3849///  `Char` -> VIPS_FORMAT_CHAR = 1
3850///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3851///  `Short` -> VIPS_FORMAT_SHORT = 3
3852///  `Uint` -> VIPS_FORMAT_UINT = 4
3853///  `Int` -> VIPS_FORMAT_INT = 5
3854///  `Float` -> VIPS_FORMAT_FLOAT = 6
3855///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3856///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3857///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3858///  `Last` -> VIPS_FORMAT_LAST = 10
3859/// returns `VipsImage` - Output image
3860pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3861    unsafe {
3862        let inp_in: *mut bindings::VipsImage = inp.ctx;
3863        let format_in: i32 = format as i32;
3864        let mut out_out: *mut bindings::VipsImage = null_mut();
3865
3866        let vips_op_response =
3867            bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3868        utils::result(
3869            vips_op_response,
3870            VipsImage { ctx: out_out },
3871            Error::CastError,
3872        )
3873    }
3874}
3875
3876/// Options for cast operation
3877#[derive(Clone, Debug)]
3878pub struct CastOptions {
3879    /// shift: `bool` -> Shift integer values up and down
3880    /// default: false
3881    pub shift: bool,
3882}
3883
3884impl std::default::Default for CastOptions {
3885    fn default() -> Self {
3886        CastOptions { shift: false }
3887    }
3888}
3889
3890/// VipsCast (cast), cast an image
3891/// inp: `&VipsImage` -> Input image
3892/// format: `BandFormat` -> Format to cast to
3893///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3894///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3895///  `Char` -> VIPS_FORMAT_CHAR = 1
3896///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3897///  `Short` -> VIPS_FORMAT_SHORT = 3
3898///  `Uint` -> VIPS_FORMAT_UINT = 4
3899///  `Int` -> VIPS_FORMAT_INT = 5
3900///  `Float` -> VIPS_FORMAT_FLOAT = 6
3901///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3902///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3903///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3904///  `Last` -> VIPS_FORMAT_LAST = 10
3905/// cast_options: `&CastOptions` -> optional arguments
3906/// returns `VipsImage` - Output image
3907pub fn cast_with_opts(
3908    inp: &VipsImage,
3909    format: BandFormat,
3910    cast_options: &CastOptions,
3911) -> Result<VipsImage> {
3912    unsafe {
3913        let inp_in: *mut bindings::VipsImage = inp.ctx;
3914        let format_in: i32 = format as i32;
3915        let mut out_out: *mut bindings::VipsImage = null_mut();
3916
3917        let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3918        let shift_in_name = utils::new_c_string("shift")?;
3919
3920        let vips_op_response = bindings::vips_cast(
3921            inp_in,
3922            &mut out_out,
3923            format_in.try_into().unwrap(),
3924            shift_in_name.as_ptr(),
3925            shift_in,
3926            NULL,
3927        );
3928        utils::result(
3929            vips_op_response,
3930            VipsImage { ctx: out_out },
3931            Error::CastError,
3932        )
3933    }
3934}
3935
3936/// VipsRot (rot), rotate an image
3937/// inp: `&VipsImage` -> Input image
3938/// angle: `Angle` -> Angle to rotate image
3939///  `D0` -> VIPS_ANGLE_D0 = 0
3940///  `D90` -> VIPS_ANGLE_D90 = 1 [DEFAULT]
3941///  `D180` -> VIPS_ANGLE_D180 = 2
3942///  `D270` -> VIPS_ANGLE_D270 = 3
3943///  `Last` -> VIPS_ANGLE_LAST = 4
3944/// returns `VipsImage` - Output image
3945pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3946    unsafe {
3947        let inp_in: *mut bindings::VipsImage = inp.ctx;
3948        let angle_in: i32 = angle as i32;
3949        let mut out_out: *mut bindings::VipsImage = null_mut();
3950
3951        let vips_op_response =
3952            bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3953        utils::result(
3954            vips_op_response,
3955            VipsImage { ctx: out_out },
3956            Error::RotError,
3957        )
3958    }
3959}
3960
3961/// VipsRot45 (rot45), rotate an image
3962/// inp: `&VipsImage` -> Input image
3963/// returns `VipsImage` - Output image
3964pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3965    unsafe {
3966        let inp_in: *mut bindings::VipsImage = inp.ctx;
3967        let mut out_out: *mut bindings::VipsImage = null_mut();
3968
3969        let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3970        utils::result(
3971            vips_op_response,
3972            VipsImage { ctx: out_out },
3973            Error::Rot45Error,
3974        )
3975    }
3976}
3977
3978/// Options for rot_45 operation
3979#[derive(Clone, Debug)]
3980pub struct Rot45Options {
3981    /// angle: `Angle45` -> Angle to rotate image
3982    ///  `D0` -> VIPS_ANGLE45_D0 = 0
3983    ///  `D45` -> VIPS_ANGLE45_D45 = 1 [DEFAULT]
3984    ///  `D90` -> VIPS_ANGLE45_D90 = 2
3985    ///  `D135` -> VIPS_ANGLE45_D135 = 3
3986    ///  `D180` -> VIPS_ANGLE45_D180 = 4
3987    ///  `D225` -> VIPS_ANGLE45_D225 = 5
3988    ///  `D270` -> VIPS_ANGLE45_D270 = 6
3989    ///  `D315` -> VIPS_ANGLE45_D315 = 7
3990    ///  `Last` -> VIPS_ANGLE45_LAST = 8
3991    pub angle: Angle45,
3992}
3993
3994impl std::default::Default for Rot45Options {
3995    fn default() -> Self {
3996        Rot45Options {
3997            angle: Angle45::D45,
3998        }
3999    }
4000}
4001
4002/// VipsRot45 (rot45), rotate an image
4003/// inp: `&VipsImage` -> Input image
4004/// rot_45_options: `&Rot45Options` -> optional arguments
4005/// returns `VipsImage` - Output image
4006pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
4007    unsafe {
4008        let inp_in: *mut bindings::VipsImage = inp.ctx;
4009        let mut out_out: *mut bindings::VipsImage = null_mut();
4010
4011        let angle_in: i32 = rot_45_options.angle as i32;
4012        let angle_in_name = utils::new_c_string("angle")?;
4013
4014        let vips_op_response =
4015            bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
4016        utils::result(
4017            vips_op_response,
4018            VipsImage { ctx: out_out },
4019            Error::Rot45Error,
4020        )
4021    }
4022}
4023
4024/// VipsAutorot (autorot), autorotate image by exif tag
4025/// inp: `&VipsImage` -> Input image
4026/// returns `VipsImage` - Output image
4027pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
4028    unsafe {
4029        let inp_in: *mut bindings::VipsImage = inp.ctx;
4030        let mut out_out: *mut bindings::VipsImage = null_mut();
4031
4032        let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
4033        utils::result(
4034            vips_op_response,
4035            VipsImage { ctx: out_out },
4036            Error::AutorotError,
4037        )
4038    }
4039}
4040
4041/// Options for autorot operation
4042#[derive(Clone, Debug)]
4043pub struct AutorotOptions {
4044    /// angle: `Angle` -> Angle image was rotated by
4045    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
4046    ///  `D90` -> VIPS_ANGLE_D90 = 1
4047    ///  `D180` -> VIPS_ANGLE_D180 = 2
4048    ///  `D270` -> VIPS_ANGLE_D270 = 3
4049    ///  `Last` -> VIPS_ANGLE_LAST = 4
4050    pub angle: Angle,
4051    /// flip: `bool` -> Whether the image was flipped or not
4052    /// default: false
4053    pub flip: bool,
4054}
4055
4056impl std::default::Default for AutorotOptions {
4057    fn default() -> Self {
4058        AutorotOptions {
4059            angle: Angle::D0,
4060            flip: false,
4061        }
4062    }
4063}
4064
4065/// VipsAutorot (autorot), autorotate image by exif tag
4066/// inp: `&VipsImage` -> Input image
4067/// autorot_options: `&AutorotOptions` -> optional arguments
4068/// returns `VipsImage` - Output image
4069pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4070    unsafe {
4071        let inp_in: *mut bindings::VipsImage = inp.ctx;
4072        let mut out_out: *mut bindings::VipsImage = null_mut();
4073
4074        let angle_in: i32 = autorot_options.angle as i32;
4075        let angle_in_name = utils::new_c_string("angle")?;
4076
4077        let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4078        let flip_in_name = utils::new_c_string("flip")?;
4079
4080        let vips_op_response = bindings::vips_autorot(
4081            inp_in,
4082            &mut out_out,
4083            angle_in_name.as_ptr(),
4084            angle_in,
4085            flip_in_name.as_ptr(),
4086            flip_in,
4087            NULL,
4088        );
4089        utils::result(
4090            vips_op_response,
4091            VipsImage { ctx: out_out },
4092            Error::AutorotError,
4093        )
4094    }
4095}
4096
4097/// VipsIfthenelse (ifthenelse), ifthenelse an image
4098/// cond: `&VipsImage` -> Condition input image
4099/// in_1: `&VipsImage` -> Source for TRUE pixels
4100/// in_2: `&VipsImage` -> Source for FALSE pixels
4101/// returns `VipsImage` - Output image
4102pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4103    unsafe {
4104        let cond_in: *mut bindings::VipsImage = cond.ctx;
4105        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4106        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4107        let mut out_out: *mut bindings::VipsImage = null_mut();
4108
4109        let vips_op_response =
4110            bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4111        utils::result(
4112            vips_op_response,
4113            VipsImage { ctx: out_out },
4114            Error::IfthenelseError,
4115        )
4116    }
4117}
4118
4119/// Options for ifthenelse operation
4120#[derive(Clone, Debug)]
4121pub struct IfthenelseOptions {
4122    /// blend: `bool` -> Blend smoothly between then and else parts
4123    /// default: false
4124    pub blend: bool,
4125}
4126
4127impl std::default::Default for IfthenelseOptions {
4128    fn default() -> Self {
4129        IfthenelseOptions { blend: false }
4130    }
4131}
4132
4133/// VipsIfthenelse (ifthenelse), ifthenelse an image
4134/// cond: `&VipsImage` -> Condition input image
4135/// in_1: `&VipsImage` -> Source for TRUE pixels
4136/// in_2: `&VipsImage` -> Source for FALSE pixels
4137/// ifthenelse_options: `&IfthenelseOptions` -> optional arguments
4138/// returns `VipsImage` - Output image
4139pub fn ifthenelse_with_opts(
4140    cond: &VipsImage,
4141    in_1: &VipsImage,
4142    in_2: &VipsImage,
4143    ifthenelse_options: &IfthenelseOptions,
4144) -> Result<VipsImage> {
4145    unsafe {
4146        let cond_in: *mut bindings::VipsImage = cond.ctx;
4147        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4148        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4149        let mut out_out: *mut bindings::VipsImage = null_mut();
4150
4151        let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4152        let blend_in_name = utils::new_c_string("blend")?;
4153
4154        let vips_op_response = bindings::vips_ifthenelse(
4155            cond_in,
4156            in_1_in,
4157            in_2_in,
4158            &mut out_out,
4159            blend_in_name.as_ptr(),
4160            blend_in,
4161            NULL,
4162        );
4163        utils::result(
4164            vips_op_response,
4165            VipsImage { ctx: out_out },
4166            Error::IfthenelseError,
4167        )
4168    }
4169}
4170
4171/// VipsRecomb (recomb), linear recombination with matrix
4172/// inp: `&VipsImage` -> Input image argument
4173/// m: `&VipsImage` -> Matrix of coefficients
4174/// returns `VipsImage` - Output image
4175pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4176    unsafe {
4177        let inp_in: *mut bindings::VipsImage = inp.ctx;
4178        let m_in: *mut bindings::VipsImage = m.ctx;
4179        let mut out_out: *mut bindings::VipsImage = null_mut();
4180
4181        let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4182        utils::result(
4183            vips_op_response,
4184            VipsImage { ctx: out_out },
4185            Error::RecombError,
4186        )
4187    }
4188}
4189
4190/// VipsBandfold (bandfold), fold up x axis into bands
4191/// inp: `&VipsImage` -> Input image
4192/// returns `VipsImage` - Output image
4193pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4194    unsafe {
4195        let inp_in: *mut bindings::VipsImage = inp.ctx;
4196        let mut out_out: *mut bindings::VipsImage = null_mut();
4197
4198        let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4199        utils::result(
4200            vips_op_response,
4201            VipsImage { ctx: out_out },
4202            Error::BandfoldError,
4203        )
4204    }
4205}
4206
4207/// Options for bandfold operation
4208#[derive(Clone, Debug)]
4209pub struct BandfoldOptions {
4210    /// factor: `i32` -> Fold by this factor
4211    /// min: 0, max: 10000000, default: 0
4212    pub factor: i32,
4213}
4214
4215impl std::default::Default for BandfoldOptions {
4216    fn default() -> Self {
4217        BandfoldOptions {
4218            factor: i32::from(0),
4219        }
4220    }
4221}
4222
4223/// VipsBandfold (bandfold), fold up x axis into bands
4224/// inp: `&VipsImage` -> Input image
4225/// bandfold_options: `&BandfoldOptions` -> optional arguments
4226/// returns `VipsImage` - Output image
4227pub fn bandfold_with_opts(
4228    inp: &VipsImage,
4229    bandfold_options: &BandfoldOptions,
4230) -> Result<VipsImage> {
4231    unsafe {
4232        let inp_in: *mut bindings::VipsImage = inp.ctx;
4233        let mut out_out: *mut bindings::VipsImage = null_mut();
4234
4235        let factor_in: i32 = bandfold_options.factor;
4236        let factor_in_name = utils::new_c_string("factor")?;
4237
4238        let vips_op_response = bindings::vips_bandfold(
4239            inp_in,
4240            &mut out_out,
4241            factor_in_name.as_ptr(),
4242            factor_in,
4243            NULL,
4244        );
4245        utils::result(
4246            vips_op_response,
4247            VipsImage { ctx: out_out },
4248            Error::BandfoldError,
4249        )
4250    }
4251}
4252
4253/// VipsBandunfold (bandunfold), unfold image bands into x axis
4254/// inp: `&VipsImage` -> Input image
4255/// returns `VipsImage` - Output image
4256pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4257    unsafe {
4258        let inp_in: *mut bindings::VipsImage = inp.ctx;
4259        let mut out_out: *mut bindings::VipsImage = null_mut();
4260
4261        let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4262        utils::result(
4263            vips_op_response,
4264            VipsImage { ctx: out_out },
4265            Error::BandunfoldError,
4266        )
4267    }
4268}
4269
4270/// Options for bandunfold operation
4271#[derive(Clone, Debug)]
4272pub struct BandunfoldOptions {
4273    /// factor: `i32` -> Unfold by this factor
4274    /// min: 0, max: 10000000, default: 0
4275    pub factor: i32,
4276}
4277
4278impl std::default::Default for BandunfoldOptions {
4279    fn default() -> Self {
4280        BandunfoldOptions {
4281            factor: i32::from(0),
4282        }
4283    }
4284}
4285
4286/// VipsBandunfold (bandunfold), unfold image bands into x axis
4287/// inp: `&VipsImage` -> Input image
4288/// bandunfold_options: `&BandunfoldOptions` -> optional arguments
4289/// returns `VipsImage` - Output image
4290pub fn bandunfold_with_opts(
4291    inp: &VipsImage,
4292    bandunfold_options: &BandunfoldOptions,
4293) -> Result<VipsImage> {
4294    unsafe {
4295        let inp_in: *mut bindings::VipsImage = inp.ctx;
4296        let mut out_out: *mut bindings::VipsImage = null_mut();
4297
4298        let factor_in: i32 = bandunfold_options.factor;
4299        let factor_in_name = utils::new_c_string("factor")?;
4300
4301        let vips_op_response = bindings::vips_bandunfold(
4302            inp_in,
4303            &mut out_out,
4304            factor_in_name.as_ptr(),
4305            factor_in,
4306            NULL,
4307        );
4308        utils::result(
4309            vips_op_response,
4310            VipsImage { ctx: out_out },
4311            Error::BandunfoldError,
4312        )
4313    }
4314}
4315
4316/// VipsFlatten (flatten), flatten alpha out of an image
4317/// inp: `&VipsImage` -> Input image
4318/// returns `VipsImage` - Output image
4319pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4320    unsafe {
4321        let inp_in: *mut bindings::VipsImage = inp.ctx;
4322        let mut out_out: *mut bindings::VipsImage = null_mut();
4323
4324        let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4325        utils::result(
4326            vips_op_response,
4327            VipsImage { ctx: out_out },
4328            Error::FlattenError,
4329        )
4330    }
4331}
4332
4333/// Options for flatten operation
4334#[derive(Clone, Debug)]
4335pub struct FlattenOptions {
4336    /// background: `Vec<f64>` -> Background value
4337    pub background: Vec<f64>,
4338    /// max_alpha: `f64` -> Maximum value of alpha channel
4339    /// min: 0, max: 100000000, default: 255
4340    pub max_alpha: f64,
4341}
4342
4343impl std::default::Default for FlattenOptions {
4344    fn default() -> Self {
4345        FlattenOptions {
4346            background: Vec::new(),
4347            max_alpha: f64::from(255),
4348        }
4349    }
4350}
4351
4352/// VipsFlatten (flatten), flatten alpha out of an image
4353/// inp: `&VipsImage` -> Input image
4354/// flatten_options: `&FlattenOptions` -> optional arguments
4355/// returns `VipsImage` - Output image
4356pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4357    unsafe {
4358        let inp_in: *mut bindings::VipsImage = inp.ctx;
4359        let mut out_out: *mut bindings::VipsImage = null_mut();
4360
4361        let background_wrapper =
4362            utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4363        let background_in = background_wrapper.ctx;
4364        let background_in_name = utils::new_c_string("background")?;
4365
4366        let max_alpha_in: f64 = flatten_options.max_alpha;
4367        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4368
4369        let vips_op_response = bindings::vips_flatten(
4370            inp_in,
4371            &mut out_out,
4372            background_in_name.as_ptr(),
4373            background_in,
4374            max_alpha_in_name.as_ptr(),
4375            max_alpha_in,
4376            NULL,
4377        );
4378        utils::result(
4379            vips_op_response,
4380            VipsImage { ctx: out_out },
4381            Error::FlattenError,
4382        )
4383    }
4384}
4385
4386/// VipsPremultiply (premultiply), premultiply image alpha
4387/// inp: `&VipsImage` -> Input image
4388/// returns `VipsImage` - Output image
4389pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4390    unsafe {
4391        let inp_in: *mut bindings::VipsImage = inp.ctx;
4392        let mut out_out: *mut bindings::VipsImage = null_mut();
4393
4394        let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4395        utils::result(
4396            vips_op_response,
4397            VipsImage { ctx: out_out },
4398            Error::PremultiplyError,
4399        )
4400    }
4401}
4402
4403/// Options for premultiply operation
4404#[derive(Clone, Debug)]
4405pub struct PremultiplyOptions {
4406    /// max_alpha: `f64` -> Maximum value of alpha channel
4407    /// min: 0, max: 100000000, default: 255
4408    pub max_alpha: f64,
4409}
4410
4411impl std::default::Default for PremultiplyOptions {
4412    fn default() -> Self {
4413        PremultiplyOptions {
4414            max_alpha: f64::from(255),
4415        }
4416    }
4417}
4418
4419/// VipsPremultiply (premultiply), premultiply image alpha
4420/// inp: `&VipsImage` -> Input image
4421/// premultiply_options: `&PremultiplyOptions` -> optional arguments
4422/// returns `VipsImage` - Output image
4423pub fn premultiply_with_opts(
4424    inp: &VipsImage,
4425    premultiply_options: &PremultiplyOptions,
4426) -> Result<VipsImage> {
4427    unsafe {
4428        let inp_in: *mut bindings::VipsImage = inp.ctx;
4429        let mut out_out: *mut bindings::VipsImage = null_mut();
4430
4431        let max_alpha_in: f64 = premultiply_options.max_alpha;
4432        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4433
4434        let vips_op_response = bindings::vips_premultiply(
4435            inp_in,
4436            &mut out_out,
4437            max_alpha_in_name.as_ptr(),
4438            max_alpha_in,
4439            NULL,
4440        );
4441        utils::result(
4442            vips_op_response,
4443            VipsImage { ctx: out_out },
4444            Error::PremultiplyError,
4445        )
4446    }
4447}
4448
4449/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4450/// inp: `&VipsImage` -> Input image
4451/// returns `VipsImage` - Output image
4452pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4453    unsafe {
4454        let inp_in: *mut bindings::VipsImage = inp.ctx;
4455        let mut out_out: *mut bindings::VipsImage = null_mut();
4456
4457        let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4458        utils::result(
4459            vips_op_response,
4460            VipsImage { ctx: out_out },
4461            Error::UnpremultiplyError,
4462        )
4463    }
4464}
4465
4466/// Options for unpremultiply operation
4467#[derive(Clone, Debug)]
4468pub struct UnpremultiplyOptions {
4469    /// max_alpha: `f64` -> Maximum value of alpha channel
4470    /// min: 0, max: 100000000, default: 255
4471    pub max_alpha: f64,
4472    /// alpha_band: `i32` -> Unpremultiply with this alpha
4473    /// min: 0, max: 100000000, default: 3
4474    pub alpha_band: i32,
4475}
4476
4477impl std::default::Default for UnpremultiplyOptions {
4478    fn default() -> Self {
4479        UnpremultiplyOptions {
4480            max_alpha: f64::from(255),
4481            alpha_band: i32::from(3),
4482        }
4483    }
4484}
4485
4486/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4487/// inp: `&VipsImage` -> Input image
4488/// unpremultiply_options: `&UnpremultiplyOptions` -> optional arguments
4489/// returns `VipsImage` - Output image
4490pub fn unpremultiply_with_opts(
4491    inp: &VipsImage,
4492    unpremultiply_options: &UnpremultiplyOptions,
4493) -> Result<VipsImage> {
4494    unsafe {
4495        let inp_in: *mut bindings::VipsImage = inp.ctx;
4496        let mut out_out: *mut bindings::VipsImage = null_mut();
4497
4498        let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4499        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4500
4501        let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4502        let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4503
4504        let vips_op_response = bindings::vips_unpremultiply(
4505            inp_in,
4506            &mut out_out,
4507            max_alpha_in_name.as_ptr(),
4508            max_alpha_in,
4509            alpha_band_in_name.as_ptr(),
4510            alpha_band_in,
4511            NULL,
4512        );
4513        utils::result(
4514            vips_op_response,
4515            VipsImage { ctx: out_out },
4516            Error::UnpremultiplyError,
4517        )
4518    }
4519}
4520
4521/// VipsGrid (grid), grid an image
4522/// inp: `&VipsImage` -> Input image
4523/// tile_height: `i32` -> Chop into tiles this high
4524/// min: 1, max: 10000000, default: 128
4525/// across: `i32` -> Number of tiles across
4526/// min: 1, max: 10000000, default: 1
4527/// down: `i32` -> Number of tiles down
4528/// min: 1, max: 10000000, default: 1
4529/// returns `VipsImage` - Output image
4530pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4531    unsafe {
4532        let inp_in: *mut bindings::VipsImage = inp.ctx;
4533        let tile_height_in: i32 = tile_height;
4534        let across_in: i32 = across;
4535        let down_in: i32 = down;
4536        let mut out_out: *mut bindings::VipsImage = null_mut();
4537
4538        let vips_op_response = bindings::vips_grid(
4539            inp_in,
4540            &mut out_out,
4541            tile_height_in,
4542            across_in,
4543            down_in,
4544            NULL,
4545        );
4546        utils::result(
4547            vips_op_response,
4548            VipsImage { ctx: out_out },
4549            Error::GridError,
4550        )
4551    }
4552}
4553
4554/// VipsTranspose3d (transpose3d), transpose3d an image
4555/// inp: `&VipsImage` -> Input image
4556/// returns `VipsImage` - Output image
4557pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4558    unsafe {
4559        let inp_in: *mut bindings::VipsImage = inp.ctx;
4560        let mut out_out: *mut bindings::VipsImage = null_mut();
4561
4562        let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4563        utils::result(
4564            vips_op_response,
4565            VipsImage { ctx: out_out },
4566            Error::Transpose3DError,
4567        )
4568    }
4569}
4570
4571/// Options for transpose_3d operation
4572#[derive(Clone, Debug)]
4573pub struct Transpose3DOptions {
4574    /// page_height: `i32` -> Height of each input page
4575    /// min: 0, max: 10000000, default: 0
4576    pub page_height: i32,
4577}
4578
4579impl std::default::Default for Transpose3DOptions {
4580    fn default() -> Self {
4581        Transpose3DOptions {
4582            page_height: i32::from(0),
4583        }
4584    }
4585}
4586
4587/// VipsTranspose3d (transpose3d), transpose3d an image
4588/// inp: `&VipsImage` -> Input image
4589/// transpose_3d_options: `&Transpose3DOptions` -> optional arguments
4590/// returns `VipsImage` - Output image
4591pub fn transpose_3d_with_opts(
4592    inp: &VipsImage,
4593    transpose_3d_options: &Transpose3DOptions,
4594) -> Result<VipsImage> {
4595    unsafe {
4596        let inp_in: *mut bindings::VipsImage = inp.ctx;
4597        let mut out_out: *mut bindings::VipsImage = null_mut();
4598
4599        let page_height_in: i32 = transpose_3d_options.page_height;
4600        let page_height_in_name = utils::new_c_string("page-height")?;
4601
4602        let vips_op_response = bindings::vips_transpose3d(
4603            inp_in,
4604            &mut out_out,
4605            page_height_in_name.as_ptr(),
4606            page_height_in,
4607            NULL,
4608        );
4609        utils::result(
4610            vips_op_response,
4611            VipsImage { ctx: out_out },
4612            Error::Transpose3DError,
4613        )
4614    }
4615}
4616
4617/// VipsScale (scale), scale an image to uchar
4618/// inp: `&VipsImage` -> Input image
4619/// returns `VipsImage` - Output image
4620pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4621    unsafe {
4622        let inp_in: *mut bindings::VipsImage = inp.ctx;
4623        let mut out_out: *mut bindings::VipsImage = null_mut();
4624
4625        let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4626        utils::result(
4627            vips_op_response,
4628            VipsImage { ctx: out_out },
4629            Error::ScaleError,
4630        )
4631    }
4632}
4633
4634/// Options for scale operation
4635#[derive(Clone, Debug)]
4636pub struct ScaleOptions {
4637    /// exp: `f64` -> Exponent for log scale
4638    /// min: 0.00001, max: 10000, default: 0.25
4639    pub exp: f64,
4640    /// log: `bool` -> Log scale
4641    /// default: false
4642    pub log: bool,
4643}
4644
4645impl std::default::Default for ScaleOptions {
4646    fn default() -> Self {
4647        ScaleOptions {
4648            exp: f64::from(0.25),
4649            log: false,
4650        }
4651    }
4652}
4653
4654/// VipsScale (scale), scale an image to uchar
4655/// inp: `&VipsImage` -> Input image
4656/// scale_options: `&ScaleOptions` -> optional arguments
4657/// returns `VipsImage` - Output image
4658pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4659    unsafe {
4660        let inp_in: *mut bindings::VipsImage = inp.ctx;
4661        let mut out_out: *mut bindings::VipsImage = null_mut();
4662
4663        let exp_in: f64 = scale_options.exp;
4664        let exp_in_name = utils::new_c_string("exp")?;
4665
4666        let log_in: i32 = if scale_options.log { 1 } else { 0 };
4667        let log_in_name = utils::new_c_string("log")?;
4668
4669        let vips_op_response = bindings::vips_scale(
4670            inp_in,
4671            &mut out_out,
4672            exp_in_name.as_ptr(),
4673            exp_in,
4674            log_in_name.as_ptr(),
4675            log_in,
4676            NULL,
4677        );
4678        utils::result(
4679            vips_op_response,
4680            VipsImage { ctx: out_out },
4681            Error::ScaleError,
4682        )
4683    }
4684}
4685
4686/// VipsWrap (wrap), wrap image origin
4687/// inp: `&VipsImage` -> Input image
4688/// returns `VipsImage` - Output image
4689pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4690    unsafe {
4691        let inp_in: *mut bindings::VipsImage = inp.ctx;
4692        let mut out_out: *mut bindings::VipsImage = null_mut();
4693
4694        let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4695        utils::result(
4696            vips_op_response,
4697            VipsImage { ctx: out_out },
4698            Error::WrapError,
4699        )
4700    }
4701}
4702
4703/// Options for wrap operation
4704#[derive(Clone, Debug)]
4705pub struct WrapOptions {
4706    /// x: `i32` -> Left edge of input in output
4707    /// min: -100000000, max: 100000000, default: 0
4708    pub x: i32,
4709    /// y: `i32` -> Top edge of input in output
4710    /// min: -100000000, max: 100000000, default: 0
4711    pub y: i32,
4712}
4713
4714impl std::default::Default for WrapOptions {
4715    fn default() -> Self {
4716        WrapOptions {
4717            x: i32::from(0),
4718            y: i32::from(0),
4719        }
4720    }
4721}
4722
4723/// VipsWrap (wrap), wrap image origin
4724/// inp: `&VipsImage` -> Input image
4725/// wrap_options: `&WrapOptions` -> optional arguments
4726/// returns `VipsImage` - Output image
4727pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4728    unsafe {
4729        let inp_in: *mut bindings::VipsImage = inp.ctx;
4730        let mut out_out: *mut bindings::VipsImage = null_mut();
4731
4732        let x_in: i32 = wrap_options.x;
4733        let x_in_name = utils::new_c_string("x")?;
4734
4735        let y_in: i32 = wrap_options.y;
4736        let y_in_name = utils::new_c_string("y")?;
4737
4738        let vips_op_response = bindings::vips_wrap(
4739            inp_in,
4740            &mut out_out,
4741            x_in_name.as_ptr(),
4742            x_in,
4743            y_in_name.as_ptr(),
4744            y_in,
4745            NULL,
4746        );
4747        utils::result(
4748            vips_op_response,
4749            VipsImage { ctx: out_out },
4750            Error::WrapError,
4751        )
4752    }
4753}
4754
4755/// VipsZoom (zoom), zoom an image
4756/// input: `&VipsImage` -> Input image
4757/// xfac: `i32` -> Horizontal zoom factor
4758/// min: 1, max: 100000000, default: 1
4759/// yfac: `i32` -> Vertical zoom factor
4760/// min: 1, max: 100000000, default: 1
4761/// returns `VipsImage` - Output image
4762pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4763    unsafe {
4764        let input_in: *mut bindings::VipsImage = input.ctx;
4765        let xfac_in: i32 = xfac;
4766        let yfac_in: i32 = yfac;
4767        let mut out_out: *mut bindings::VipsImage = null_mut();
4768
4769        let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4770        utils::result(
4771            vips_op_response,
4772            VipsImage { ctx: out_out },
4773            Error::ZoomError,
4774        )
4775    }
4776}
4777
4778/// VipsSubsample (subsample), subsample an image
4779/// input: `&VipsImage` -> Input image
4780/// xfac: `i32` -> Horizontal subsample factor
4781/// min: 1, max: 100000000, default: 1
4782/// yfac: `i32` -> Vertical subsample factor
4783/// min: 1, max: 100000000, default: 1
4784/// returns `VipsImage` - Output image
4785pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4786    unsafe {
4787        let input_in: *mut bindings::VipsImage = input.ctx;
4788        let xfac_in: i32 = xfac;
4789        let yfac_in: i32 = yfac;
4790        let mut out_out: *mut bindings::VipsImage = null_mut();
4791
4792        let vips_op_response =
4793            bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4794        utils::result(
4795            vips_op_response,
4796            VipsImage { ctx: out_out },
4797            Error::SubsampleError,
4798        )
4799    }
4800}
4801
4802/// Options for subsample operation
4803#[derive(Clone, Debug)]
4804pub struct SubsampleOptions {
4805    /// point: `bool` -> Point sample
4806    /// default: false
4807    pub point: bool,
4808}
4809
4810impl std::default::Default for SubsampleOptions {
4811    fn default() -> Self {
4812        SubsampleOptions { point: false }
4813    }
4814}
4815
4816/// VipsSubsample (subsample), subsample an image
4817/// input: `&VipsImage` -> Input image
4818/// xfac: `i32` -> Horizontal subsample factor
4819/// min: 1, max: 100000000, default: 1
4820/// yfac: `i32` -> Vertical subsample factor
4821/// min: 1, max: 100000000, default: 1
4822/// subsample_options: `&SubsampleOptions` -> optional arguments
4823/// returns `VipsImage` - Output image
4824pub fn subsample_with_opts(
4825    input: &VipsImage,
4826    xfac: i32,
4827    yfac: i32,
4828    subsample_options: &SubsampleOptions,
4829) -> Result<VipsImage> {
4830    unsafe {
4831        let input_in: *mut bindings::VipsImage = input.ctx;
4832        let xfac_in: i32 = xfac;
4833        let yfac_in: i32 = yfac;
4834        let mut out_out: *mut bindings::VipsImage = null_mut();
4835
4836        let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4837        let point_in_name = utils::new_c_string("point")?;
4838
4839        let vips_op_response = bindings::vips_subsample(
4840            input_in,
4841            &mut out_out,
4842            xfac_in,
4843            yfac_in,
4844            point_in_name.as_ptr(),
4845            point_in,
4846            NULL,
4847        );
4848        utils::result(
4849            vips_op_response,
4850            VipsImage { ctx: out_out },
4851            Error::SubsampleError,
4852        )
4853    }
4854}
4855
4856/// VipsMsb (msb), pick most-significant byte from an image
4857/// inp: `&VipsImage` -> Input image
4858/// returns `VipsImage` - Output image
4859pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4860    unsafe {
4861        let inp_in: *mut bindings::VipsImage = inp.ctx;
4862        let mut out_out: *mut bindings::VipsImage = null_mut();
4863
4864        let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4865        utils::result(
4866            vips_op_response,
4867            VipsImage { ctx: out_out },
4868            Error::MsbError,
4869        )
4870    }
4871}
4872
4873/// Options for msb operation
4874#[derive(Clone, Debug)]
4875pub struct MsbOptions {
4876    /// band: `i32` -> Band to msb
4877    /// min: -1, max: 100000000, default: -1
4878    pub band: i32,
4879}
4880
4881impl std::default::Default for MsbOptions {
4882    fn default() -> Self {
4883        MsbOptions {
4884            band: i32::from(-1),
4885        }
4886    }
4887}
4888
4889/// VipsMsb (msb), pick most-significant byte from an image
4890/// inp: `&VipsImage` -> Input image
4891/// msb_options: `&MsbOptions` -> optional arguments
4892/// returns `VipsImage` - Output image
4893pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4894    unsafe {
4895        let inp_in: *mut bindings::VipsImage = inp.ctx;
4896        let mut out_out: *mut bindings::VipsImage = null_mut();
4897
4898        let band_in: i32 = msb_options.band;
4899        let band_in_name = utils::new_c_string("band")?;
4900
4901        let vips_op_response =
4902            bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4903        utils::result(
4904            vips_op_response,
4905            VipsImage { ctx: out_out },
4906            Error::MsbError,
4907        )
4908    }
4909}
4910
4911/// VipsByteswap (byteswap), byteswap an image
4912/// inp: `&VipsImage` -> Input image
4913/// returns `VipsImage` - Output image
4914pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4915    unsafe {
4916        let inp_in: *mut bindings::VipsImage = inp.ctx;
4917        let mut out_out: *mut bindings::VipsImage = null_mut();
4918
4919        let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4920        utils::result(
4921            vips_op_response,
4922            VipsImage { ctx: out_out },
4923            Error::ByteswapError,
4924        )
4925    }
4926}
4927
4928/// VipsFalsecolour (falsecolour), false-color an image
4929/// inp: `&VipsImage` -> Input image
4930/// returns `VipsImage` - Output image
4931pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4932    unsafe {
4933        let inp_in: *mut bindings::VipsImage = inp.ctx;
4934        let mut out_out: *mut bindings::VipsImage = null_mut();
4935
4936        let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4937        utils::result(
4938            vips_op_response,
4939            VipsImage { ctx: out_out },
4940            Error::FalsecolourError,
4941        )
4942    }
4943}
4944
4945/// VipsGamma (gamma), gamma an image
4946/// inp: `&VipsImage` -> Input image
4947/// returns `VipsImage` - Output image
4948pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4949    unsafe {
4950        let inp_in: *mut bindings::VipsImage = inp.ctx;
4951        let mut out_out: *mut bindings::VipsImage = null_mut();
4952
4953        let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4954        utils::result(
4955            vips_op_response,
4956            VipsImage { ctx: out_out },
4957            Error::GammaError,
4958        )
4959    }
4960}
4961
4962/// Options for gamma operation
4963#[derive(Clone, Debug)]
4964pub struct GammaOptions {
4965    /// exponent: `f64` -> Gamma factor
4966    /// min: 0.000001, max: 1000, default: 0.416667
4967    pub exponent: f64,
4968}
4969
4970impl std::default::Default for GammaOptions {
4971    fn default() -> Self {
4972        GammaOptions {
4973            exponent: f64::from(0.416667),
4974        }
4975    }
4976}
4977
4978/// VipsGamma (gamma), gamma an image
4979/// inp: `&VipsImage` -> Input image
4980/// gamma_options: `&GammaOptions` -> optional arguments
4981/// returns `VipsImage` - Output image
4982pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4983    unsafe {
4984        let inp_in: *mut bindings::VipsImage = inp.ctx;
4985        let mut out_out: *mut bindings::VipsImage = null_mut();
4986
4987        let exponent_in: f64 = gamma_options.exponent;
4988        let exponent_in_name = utils::new_c_string("exponent")?;
4989
4990        let vips_op_response = bindings::vips_gamma(
4991            inp_in,
4992            &mut out_out,
4993            exponent_in_name.as_ptr(),
4994            exponent_in,
4995            NULL,
4996        );
4997        utils::result(
4998            vips_op_response,
4999            VipsImage { ctx: out_out },
5000            Error::GammaError,
5001        )
5002    }
5003}
5004
5005/// VipsComposite (composite), blend an array of images with an array of blend modes
5006/// inp: `&mut [VipsImage]` -> Array of input images
5007/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5008/// returns `VipsImage` - Output image
5009pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
5010    unsafe {
5011        let (inp_len, mut inp_in) = {
5012            let len = inp.len();
5013            let mut input = Vec::new();
5014            for img in inp {
5015                input.push(img.ctx)
5016            }
5017            (len as i32, input)
5018        };
5019        let mode_in: *mut i32 = mode.as_mut_ptr();
5020        let mut out_out: *mut bindings::VipsImage = null_mut();
5021
5022        let vips_op_response = bindings::vips_composite(
5023            inp_in.as_mut_ptr(),
5024            &mut out_out,
5025            inp_len,
5026            mode_in,
5027            mode.len() as i32,
5028            NULL,
5029        );
5030        utils::result(
5031            vips_op_response,
5032            VipsImage { ctx: out_out },
5033            Error::CompositeError,
5034        )
5035    }
5036}
5037
5038/// Options for composite operation
5039#[derive(Clone, Debug)]
5040pub struct CompositeOptions {
5041    /// x: `Vec<i32>` -> Array of x coordinates to join at
5042    pub x: Vec<i32>,
5043    /// y: `Vec<i32>` -> Array of y coordinates to join at
5044    pub y: Vec<i32>,
5045    /// compositing_space: `Interpretation` -> Composite images in this colour space
5046    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5047    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5048    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5049    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5050    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5051    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5052    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5053    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5054    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5055    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5056    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5057    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5058    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5059    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5060    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5061    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5062    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5063    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5064    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5065    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5066    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5067    pub compositing_space: Interpretation,
5068    /// premultiplied: `bool` -> Images have premultiplied alpha
5069    /// default: false
5070    pub premultiplied: bool,
5071}
5072
5073impl std::default::Default for CompositeOptions {
5074    fn default() -> Self {
5075        CompositeOptions {
5076            x: Vec::new(),
5077            y: Vec::new(),
5078            compositing_space: Interpretation::Srgb,
5079            premultiplied: false,
5080        }
5081    }
5082}
5083
5084/// VipsComposite (composite), blend an array of images with an array of blend modes
5085/// inp: `&mut [VipsImage]` -> Array of input images
5086/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5087/// composite_options: `&CompositeOptions` -> optional arguments
5088/// returns `VipsImage` - Output image
5089pub fn composite_with_opts(
5090    inp: &mut [VipsImage],
5091    mode: &mut [i32],
5092    composite_options: &CompositeOptions,
5093) -> Result<VipsImage> {
5094    unsafe {
5095        let (inp_len, mut inp_in) = {
5096            let len = inp.len();
5097            let mut input = Vec::new();
5098            for img in inp {
5099                input.push(img.ctx)
5100            }
5101            (len as i32, input)
5102        };
5103        let mode_in: *mut i32 = mode.as_mut_ptr();
5104        let mut out_out: *mut bindings::VipsImage = null_mut();
5105
5106        let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5107        let x_in = x_wrapper.ctx;
5108        let x_in_name = utils::new_c_string("x")?;
5109
5110        let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5111        let y_in = y_wrapper.ctx;
5112        let y_in_name = utils::new_c_string("y")?;
5113
5114        let compositing_space_in: i32 = composite_options.compositing_space as i32;
5115        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5116
5117        let premultiplied_in: i32 = if composite_options.premultiplied {
5118            1
5119        } else {
5120            0
5121        };
5122        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5123
5124        let vips_op_response = bindings::vips_composite(
5125            inp_in.as_mut_ptr(),
5126            &mut out_out,
5127            inp_len,
5128            mode_in,
5129            mode.len() as i32,
5130            x_in_name.as_ptr(),
5131            x_in,
5132            y_in_name.as_ptr(),
5133            y_in,
5134            compositing_space_in_name.as_ptr(),
5135            compositing_space_in,
5136            premultiplied_in_name.as_ptr(),
5137            premultiplied_in,
5138            NULL,
5139        );
5140        utils::result(
5141            vips_op_response,
5142            VipsImage { ctx: out_out },
5143            Error::CompositeError,
5144        )
5145    }
5146}
5147
5148/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5149/// base: `&VipsImage` -> Base image
5150/// overlay: `&VipsImage` -> Overlay image
5151/// mode: `BlendMode` -> VipsBlendMode to join with
5152///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5153///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5154///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5155///  `In` -> VIPS_BLEND_MODE_IN = 3
5156///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5157///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5158///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5159///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5160///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5161///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5162///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5163///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5164///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5165///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5166///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5167///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5168///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5169///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5170///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5171///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5172///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5173///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5174///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5175///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5176///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5177///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5178/// returns `VipsImage` - Output image
5179pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5180    unsafe {
5181        let base_in: *mut bindings::VipsImage = base.ctx;
5182        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5183        let mode_in: i32 = mode as i32;
5184        let mut out_out: *mut bindings::VipsImage = null_mut();
5185
5186        let vips_op_response = bindings::vips_composite2(
5187            base_in,
5188            overlay_in,
5189            &mut out_out,
5190            mode_in.try_into().unwrap(),
5191            NULL,
5192        );
5193        utils::result(
5194            vips_op_response,
5195            VipsImage { ctx: out_out },
5196            Error::Composite2Error,
5197        )
5198    }
5199}
5200
5201/// Options for composite_2 operation
5202#[derive(Clone, Debug)]
5203pub struct Composite2Options {
5204    /// x: `i32` -> x position of overlay
5205    /// min: -100000000, max: 100000000, default: 0
5206    pub x: i32,
5207    /// y: `i32` -> y position of overlay
5208    /// min: -100000000, max: 100000000, default: 0
5209    pub y: i32,
5210    /// compositing_space: `Interpretation` -> Composite images in this colour space
5211    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5212    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5213    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5214    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5215    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5216    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5217    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5218    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5219    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5220    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5221    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5222    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5223    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5224    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5225    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5226    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5227    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5228    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5229    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5230    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5231    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5232    pub compositing_space: Interpretation,
5233    /// premultiplied: `bool` -> Images have premultiplied alpha
5234    /// default: false
5235    pub premultiplied: bool,
5236}
5237
5238impl std::default::Default for Composite2Options {
5239    fn default() -> Self {
5240        Composite2Options {
5241            x: i32::from(0),
5242            y: i32::from(0),
5243            compositing_space: Interpretation::Srgb,
5244            premultiplied: false,
5245        }
5246    }
5247}
5248
5249/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5250/// base: `&VipsImage` -> Base image
5251/// overlay: `&VipsImage` -> Overlay image
5252/// mode: `BlendMode` -> VipsBlendMode to join with
5253///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5254///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5255///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5256///  `In` -> VIPS_BLEND_MODE_IN = 3
5257///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5258///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5259///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5260///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5261///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5262///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5263///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5264///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5265///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5266///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5267///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5268///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5269///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5270///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5271///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5272///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5273///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5274///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5275///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5276///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5277///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5278///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5279/// composite_2_options: `&Composite2Options` -> optional arguments
5280/// returns `VipsImage` - Output image
5281pub fn composite_2_with_opts(
5282    base: &VipsImage,
5283    overlay: &VipsImage,
5284    mode: BlendMode,
5285    composite_2_options: &Composite2Options,
5286) -> Result<VipsImage> {
5287    unsafe {
5288        let base_in: *mut bindings::VipsImage = base.ctx;
5289        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5290        let mode_in: i32 = mode as i32;
5291        let mut out_out: *mut bindings::VipsImage = null_mut();
5292
5293        let x_in: i32 = composite_2_options.x;
5294        let x_in_name = utils::new_c_string("x")?;
5295
5296        let y_in: i32 = composite_2_options.y;
5297        let y_in_name = utils::new_c_string("y")?;
5298
5299        let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5300        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5301
5302        let premultiplied_in: i32 = if composite_2_options.premultiplied {
5303            1
5304        } else {
5305            0
5306        };
5307        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5308
5309        let vips_op_response = bindings::vips_composite2(
5310            base_in,
5311            overlay_in,
5312            &mut out_out,
5313            mode_in.try_into().unwrap(),
5314            x_in_name.as_ptr(),
5315            x_in,
5316            y_in_name.as_ptr(),
5317            y_in,
5318            compositing_space_in_name.as_ptr(),
5319            compositing_space_in,
5320            premultiplied_in_name.as_ptr(),
5321            premultiplied_in,
5322            NULL,
5323        );
5324        utils::result(
5325            vips_op_response,
5326            VipsImage { ctx: out_out },
5327            Error::Composite2Error,
5328        )
5329    }
5330}
5331
5332/// VipsAddAlpha (addalpha), append an alpha channel
5333/// inp: `&VipsImage` -> Input image
5334/// returns `VipsImage` - Output image
5335pub fn addalpha(inp: &VipsImage) -> Result<VipsImage> {
5336    unsafe {
5337        let inp_in: *mut bindings::VipsImage = inp.ctx;
5338        let mut out_out: *mut bindings::VipsImage = null_mut();
5339
5340        let vips_op_response = bindings::vips_addalpha(inp_in, &mut out_out, NULL);
5341        utils::result(
5342            vips_op_response,
5343            VipsImage { ctx: out_out },
5344            Error::AddalphaError,
5345        )
5346    }
5347}
5348
5349/// VipsBlack (black), make a black image
5350/// width: `i32` -> Image width in pixels
5351/// min: 1, max: 100000000, default: 1
5352/// height: `i32` -> Image height in pixels
5353/// min: 1, max: 100000000, default: 1
5354/// returns `VipsImage` - Output image
5355pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5356    unsafe {
5357        let width_in: i32 = width;
5358        let height_in: i32 = height;
5359        let mut out_out: *mut bindings::VipsImage = null_mut();
5360
5361        let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5362        utils::result(
5363            vips_op_response,
5364            VipsImage { ctx: out_out },
5365            Error::BlackError,
5366        )
5367    }
5368}
5369
5370/// Options for black operation
5371#[derive(Clone, Debug)]
5372pub struct BlackOptions {
5373    /// bands: `i32` -> Number of bands in image
5374    /// min: 1, max: 100000000, default: 1
5375    pub bands: i32,
5376}
5377
5378impl std::default::Default for BlackOptions {
5379    fn default() -> Self {
5380        BlackOptions {
5381            bands: i32::from(1),
5382        }
5383    }
5384}
5385
5386/// VipsBlack (black), make a black image
5387/// width: `i32` -> Image width in pixels
5388/// min: 1, max: 100000000, default: 1
5389/// height: `i32` -> Image height in pixels
5390/// min: 1, max: 100000000, default: 1
5391/// black_options: `&BlackOptions` -> optional arguments
5392/// returns `VipsImage` - Output image
5393pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5394    unsafe {
5395        let width_in: i32 = width;
5396        let height_in: i32 = height;
5397        let mut out_out: *mut bindings::VipsImage = null_mut();
5398
5399        let bands_in: i32 = black_options.bands;
5400        let bands_in_name = utils::new_c_string("bands")?;
5401
5402        let vips_op_response = bindings::vips_black(
5403            &mut out_out,
5404            width_in,
5405            height_in,
5406            bands_in_name.as_ptr(),
5407            bands_in,
5408            NULL,
5409        );
5410        utils::result(
5411            vips_op_response,
5412            VipsImage { ctx: out_out },
5413            Error::BlackError,
5414        )
5415    }
5416}
5417
5418/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5419/// width: `i32` -> Image width in pixels
5420/// min: 1, max: 100000000, default: 1
5421/// height: `i32` -> Image height in pixels
5422/// min: 1, max: 100000000, default: 1
5423/// returns `VipsImage` - Output image
5424pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5425    unsafe {
5426        let width_in: i32 = width;
5427        let height_in: i32 = height;
5428        let mut out_out: *mut bindings::VipsImage = null_mut();
5429
5430        let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5431        utils::result(
5432            vips_op_response,
5433            VipsImage { ctx: out_out },
5434            Error::GaussnoiseError,
5435        )
5436    }
5437}
5438
5439/// Options for gaussnoise operation
5440#[derive(Clone, Debug)]
5441pub struct GaussnoiseOptions {
5442    /// sigma: `f64` -> Standard deviation of pixels in generated image
5443    /// min: 0, max: 100000, default: 30
5444    pub sigma: f64,
5445    /// mean: `f64` -> Mean of pixels in generated image
5446    /// min: -10000000, max: 1000000, default: 128
5447    pub mean: f64,
5448    /// seed: `i32` -> Random number seed
5449    /// min: -2147483648, max: 2147483647, default: 0
5450    pub seed: i32,
5451}
5452
5453impl std::default::Default for GaussnoiseOptions {
5454    fn default() -> Self {
5455        GaussnoiseOptions {
5456            sigma: f64::from(30),
5457            mean: f64::from(128),
5458            seed: i32::from(0),
5459        }
5460    }
5461}
5462
5463/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5464/// width: `i32` -> Image width in pixels
5465/// min: 1, max: 100000000, default: 1
5466/// height: `i32` -> Image height in pixels
5467/// min: 1, max: 100000000, default: 1
5468/// gaussnoise_options: `&GaussnoiseOptions` -> optional arguments
5469/// returns `VipsImage` - Output image
5470pub fn gaussnoise_with_opts(
5471    width: i32,
5472    height: i32,
5473    gaussnoise_options: &GaussnoiseOptions,
5474) -> Result<VipsImage> {
5475    unsafe {
5476        let width_in: i32 = width;
5477        let height_in: i32 = height;
5478        let mut out_out: *mut bindings::VipsImage = null_mut();
5479
5480        let sigma_in: f64 = gaussnoise_options.sigma;
5481        let sigma_in_name = utils::new_c_string("sigma")?;
5482
5483        let mean_in: f64 = gaussnoise_options.mean;
5484        let mean_in_name = utils::new_c_string("mean")?;
5485
5486        let seed_in: i32 = gaussnoise_options.seed;
5487        let seed_in_name = utils::new_c_string("seed")?;
5488
5489        let vips_op_response = bindings::vips_gaussnoise(
5490            &mut out_out,
5491            width_in,
5492            height_in,
5493            sigma_in_name.as_ptr(),
5494            sigma_in,
5495            mean_in_name.as_ptr(),
5496            mean_in,
5497            seed_in_name.as_ptr(),
5498            seed_in,
5499            NULL,
5500        );
5501        utils::result(
5502            vips_op_response,
5503            VipsImage { ctx: out_out },
5504            Error::GaussnoiseError,
5505        )
5506    }
5507}
5508
5509/// VipsXyz (xyz), make an image where pixel values are coordinates
5510/// width: `i32` -> Image width in pixels
5511/// min: 1, max: 100000000, default: 64
5512/// height: `i32` -> Image height in pixels
5513/// min: 1, max: 100000000, default: 64
5514/// returns `VipsImage` - Output image
5515pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5516    unsafe {
5517        let width_in: i32 = width;
5518        let height_in: i32 = height;
5519        let mut out_out: *mut bindings::VipsImage = null_mut();
5520
5521        let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5522        utils::result(
5523            vips_op_response,
5524            VipsImage { ctx: out_out },
5525            Error::XyzError,
5526        )
5527    }
5528}
5529
5530/// Options for xyz operation
5531#[derive(Clone, Debug)]
5532pub struct XyzOptions {
5533    /// csize: `i32` -> Size of third dimension
5534    /// min: 1, max: 100000000, default: 1
5535    pub csize: i32,
5536    /// dsize: `i32` -> Size of fourth dimension
5537    /// min: 1, max: 100000000, default: 1
5538    pub dsize: i32,
5539    /// esize: `i32` -> Size of fifth dimension
5540    /// min: 1, max: 100000000, default: 1
5541    pub esize: i32,
5542}
5543
5544impl std::default::Default for XyzOptions {
5545    fn default() -> Self {
5546        XyzOptions {
5547            csize: i32::from(1),
5548            dsize: i32::from(1),
5549            esize: i32::from(1),
5550        }
5551    }
5552}
5553
5554/// VipsXyz (xyz), make an image where pixel values are coordinates
5555/// width: `i32` -> Image width in pixels
5556/// min: 1, max: 100000000, default: 64
5557/// height: `i32` -> Image height in pixels
5558/// min: 1, max: 100000000, default: 64
5559/// xyz_options: `&XyzOptions` -> optional arguments
5560/// returns `VipsImage` - Output image
5561pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5562    unsafe {
5563        let width_in: i32 = width;
5564        let height_in: i32 = height;
5565        let mut out_out: *mut bindings::VipsImage = null_mut();
5566
5567        let csize_in: i32 = xyz_options.csize;
5568        let csize_in_name = utils::new_c_string("csize")?;
5569
5570        let dsize_in: i32 = xyz_options.dsize;
5571        let dsize_in_name = utils::new_c_string("dsize")?;
5572
5573        let esize_in: i32 = xyz_options.esize;
5574        let esize_in_name = utils::new_c_string("esize")?;
5575
5576        let vips_op_response = bindings::vips_xyz(
5577            &mut out_out,
5578            width_in,
5579            height_in,
5580            csize_in_name.as_ptr(),
5581            csize_in,
5582            dsize_in_name.as_ptr(),
5583            dsize_in,
5584            esize_in_name.as_ptr(),
5585            esize_in,
5586            NULL,
5587        );
5588        utils::result(
5589            vips_op_response,
5590            VipsImage { ctx: out_out },
5591            Error::XyzError,
5592        )
5593    }
5594}
5595
5596/// VipsGaussmat (gaussmat), make a gaussian image
5597/// sigma: `f64` -> Sigma of Gaussian
5598/// min: 0.000001, max: 10000, default: 1
5599/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5600/// min: 0.000001, max: 10000, default: 0.1
5601/// returns `VipsImage` - Output image
5602pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5603    unsafe {
5604        let sigma_in: f64 = sigma;
5605        let min_ampl_in: f64 = min_ampl;
5606        let mut out_out: *mut bindings::VipsImage = null_mut();
5607
5608        let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5609        utils::result(
5610            vips_op_response,
5611            VipsImage { ctx: out_out },
5612            Error::GaussmatError,
5613        )
5614    }
5615}
5616
5617/// Options for gaussmat operation
5618#[derive(Clone, Debug)]
5619pub struct GaussmatOptions {
5620    /// separable: `bool` -> Generate separable Gaussian
5621    /// default: false
5622    pub separable: bool,
5623    /// precision: `Precision` -> Generate with this precision
5624    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5625    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5626    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5627    ///  `Last` -> VIPS_PRECISION_LAST = 3
5628    pub precision: Precision,
5629}
5630
5631impl std::default::Default for GaussmatOptions {
5632    fn default() -> Self {
5633        GaussmatOptions {
5634            separable: false,
5635            precision: Precision::Integer,
5636        }
5637    }
5638}
5639
5640/// VipsGaussmat (gaussmat), make a gaussian image
5641/// sigma: `f64` -> Sigma of Gaussian
5642/// min: 0.000001, max: 10000, default: 1
5643/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5644/// min: 0.000001, max: 10000, default: 0.1
5645/// gaussmat_options: `&GaussmatOptions` -> optional arguments
5646/// returns `VipsImage` - Output image
5647pub fn gaussmat_with_opts(
5648    sigma: f64,
5649    min_ampl: f64,
5650    gaussmat_options: &GaussmatOptions,
5651) -> Result<VipsImage> {
5652    unsafe {
5653        let sigma_in: f64 = sigma;
5654        let min_ampl_in: f64 = min_ampl;
5655        let mut out_out: *mut bindings::VipsImage = null_mut();
5656
5657        let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5658        let separable_in_name = utils::new_c_string("separable")?;
5659
5660        let precision_in: i32 = gaussmat_options.precision as i32;
5661        let precision_in_name = utils::new_c_string("precision")?;
5662
5663        let vips_op_response = bindings::vips_gaussmat(
5664            &mut out_out,
5665            sigma_in,
5666            min_ampl_in,
5667            separable_in_name.as_ptr(),
5668            separable_in,
5669            precision_in_name.as_ptr(),
5670            precision_in,
5671            NULL,
5672        );
5673        utils::result(
5674            vips_op_response,
5675            VipsImage { ctx: out_out },
5676            Error::GaussmatError,
5677        )
5678    }
5679}
5680
5681/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5682/// sigma: `f64` -> Radius of Gaussian
5683/// min: 0.000001, max: 10000, default: 1
5684/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5685/// min: 0.000001, max: 10000, default: 0.1
5686/// returns `VipsImage` - Output image
5687pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5688    unsafe {
5689        let sigma_in: f64 = sigma;
5690        let min_ampl_in: f64 = min_ampl;
5691        let mut out_out: *mut bindings::VipsImage = null_mut();
5692
5693        let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5694        utils::result(
5695            vips_op_response,
5696            VipsImage { ctx: out_out },
5697            Error::LogmatError,
5698        )
5699    }
5700}
5701
5702/// Options for logmat operation
5703#[derive(Clone, Debug)]
5704pub struct LogmatOptions {
5705    /// separable: `bool` -> Generate separable Gaussian
5706    /// default: false
5707    pub separable: bool,
5708    /// precision: `Precision` -> Generate with this precision
5709    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5710    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5711    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5712    ///  `Last` -> VIPS_PRECISION_LAST = 3
5713    pub precision: Precision,
5714}
5715
5716impl std::default::Default for LogmatOptions {
5717    fn default() -> Self {
5718        LogmatOptions {
5719            separable: false,
5720            precision: Precision::Integer,
5721        }
5722    }
5723}
5724
5725/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5726/// sigma: `f64` -> Radius of Gaussian
5727/// min: 0.000001, max: 10000, default: 1
5728/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5729/// min: 0.000001, max: 10000, default: 0.1
5730/// logmat_options: `&LogmatOptions` -> optional arguments
5731/// returns `VipsImage` - Output image
5732pub fn logmat_with_opts(
5733    sigma: f64,
5734    min_ampl: f64,
5735    logmat_options: &LogmatOptions,
5736) -> Result<VipsImage> {
5737    unsafe {
5738        let sigma_in: f64 = sigma;
5739        let min_ampl_in: f64 = min_ampl;
5740        let mut out_out: *mut bindings::VipsImage = null_mut();
5741
5742        let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5743        let separable_in_name = utils::new_c_string("separable")?;
5744
5745        let precision_in: i32 = logmat_options.precision as i32;
5746        let precision_in_name = utils::new_c_string("precision")?;
5747
5748        let vips_op_response = bindings::vips_logmat(
5749            &mut out_out,
5750            sigma_in,
5751            min_ampl_in,
5752            separable_in_name.as_ptr(),
5753            separable_in,
5754            precision_in_name.as_ptr(),
5755            precision_in,
5756            NULL,
5757        );
5758        utils::result(
5759            vips_op_response,
5760            VipsImage { ctx: out_out },
5761            Error::LogmatError,
5762        )
5763    }
5764}
5765
5766/// VipsText (text), make a text image
5767/// text: `&str` -> Text to render
5768/// returns `VipsImage` - Output image
5769pub fn text(text: &str) -> Result<VipsImage> {
5770    unsafe {
5771        let text_in: CString = utils::new_c_string(text)?;
5772        let mut out_out: *mut bindings::VipsImage = null_mut();
5773
5774        let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5775        utils::result(
5776            vips_op_response,
5777            VipsImage { ctx: out_out },
5778            Error::TextError,
5779        )
5780    }
5781}
5782
5783/// Options for text operation
5784#[derive(Clone, Debug)]
5785pub struct TextOptions {
5786    /// font: `String` -> Font to render with
5787    pub font: String,
5788    /// width: `i32` -> Maximum image width in pixels
5789    /// min: 0, max: 100000000, default: 0
5790    pub width: i32,
5791    /// height: `i32` -> Maximum image height in pixels
5792    /// min: 0, max: 100000000, default: 0
5793    pub height: i32,
5794    /// align: `Align` -> Align on the low, centre or high edge
5795    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
5796    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
5797    ///  `High` -> VIPS_ALIGN_HIGH = 2
5798    ///  `Last` -> VIPS_ALIGN_LAST = 3
5799    pub align: Align,
5800    /// justify: `bool` -> Justify lines
5801    /// default: false
5802    pub justify: bool,
5803    /// dpi: `i32` -> DPI to render at
5804    /// min: 1, max: 1000000, default: 72
5805    pub dpi: i32,
5806    /// autofit_dpi: `i32` -> DPI selected by autofit
5807    /// min: 1, max: 1000000, default: 72
5808    pub autofit_dpi: i32,
5809    /// spacing: `i32` -> Line spacing
5810    /// min: -1000000, max: 1000000, default: 0
5811    pub spacing: i32,
5812    /// fontfile: `String` -> Load this font file
5813    pub fontfile: String,
5814    /// rgba: `bool` -> Enable RGBA output
5815    /// default: false
5816    pub rgba: bool,
5817    /// wrap: `TextWrap` -> Wrap lines on word or character boundaries
5818    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0 [DEFAULT]
5819    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
5820    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
5821    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
5822    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
5823    pub wrap: TextWrap,
5824}
5825
5826impl std::default::Default for TextOptions {
5827    fn default() -> Self {
5828        TextOptions {
5829            font: String::new(),
5830            width: i32::from(0),
5831            height: i32::from(0),
5832            align: Align::Low,
5833            justify: false,
5834            dpi: i32::from(72),
5835            autofit_dpi: i32::from(72),
5836            spacing: i32::from(0),
5837            fontfile: String::new(),
5838            rgba: false,
5839            wrap: TextWrap::Word,
5840        }
5841    }
5842}
5843
5844/// VipsText (text), make a text image
5845/// text: `&str` -> Text to render
5846/// text_options: `&TextOptions` -> optional arguments
5847/// returns `VipsImage` - Output image
5848pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5849    unsafe {
5850        let text_in: CString = utils::new_c_string(text)?;
5851        let mut out_out: *mut bindings::VipsImage = null_mut();
5852
5853        let font_in: CString = utils::new_c_string(&text_options.font)?;
5854        let font_in_name = utils::new_c_string("font")?;
5855
5856        let width_in: i32 = text_options.width;
5857        let width_in_name = utils::new_c_string("width")?;
5858
5859        let height_in: i32 = text_options.height;
5860        let height_in_name = utils::new_c_string("height")?;
5861
5862        let align_in: i32 = text_options.align as i32;
5863        let align_in_name = utils::new_c_string("align")?;
5864
5865        let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5866        let justify_in_name = utils::new_c_string("justify")?;
5867
5868        let dpi_in: i32 = text_options.dpi;
5869        let dpi_in_name = utils::new_c_string("dpi")?;
5870
5871        let autofit_dpi_in: i32 = text_options.autofit_dpi;
5872        let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5873
5874        let spacing_in: i32 = text_options.spacing;
5875        let spacing_in_name = utils::new_c_string("spacing")?;
5876
5877        let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5878        let fontfile_in_name = utils::new_c_string("fontfile")?;
5879
5880        let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5881        let rgba_in_name = utils::new_c_string("rgba")?;
5882
5883        let wrap_in: i32 = text_options.wrap as i32;
5884        let wrap_in_name = utils::new_c_string("wrap")?;
5885
5886        let vips_op_response = bindings::vips_text(
5887            &mut out_out,
5888            text_in.as_ptr(),
5889            font_in_name.as_ptr(),
5890            font_in.as_ptr(),
5891            width_in_name.as_ptr(),
5892            width_in,
5893            height_in_name.as_ptr(),
5894            height_in,
5895            align_in_name.as_ptr(),
5896            align_in,
5897            justify_in_name.as_ptr(),
5898            justify_in,
5899            dpi_in_name.as_ptr(),
5900            dpi_in,
5901            autofit_dpi_in_name.as_ptr(),
5902            autofit_dpi_in,
5903            spacing_in_name.as_ptr(),
5904            spacing_in,
5905            fontfile_in_name.as_ptr(),
5906            fontfile_in.as_ptr(),
5907            rgba_in_name.as_ptr(),
5908            rgba_in,
5909            wrap_in_name.as_ptr(),
5910            wrap_in,
5911            NULL,
5912        );
5913        utils::result(
5914            vips_op_response,
5915            VipsImage { ctx: out_out },
5916            Error::TextError,
5917        )
5918    }
5919}
5920
5921/// VipsSdf (sdf), create an SDF image
5922/// width: `i32` -> Image width in pixels
5923/// min: 1, max: 100000000, default: 1
5924/// height: `i32` -> Image height in pixels
5925/// min: 1, max: 100000000, default: 1
5926/// shape: `SdfShape` -> SDF shape to create
5927///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5928///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5929///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5930///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5931///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
5932/// returns `VipsImage` - Output image
5933pub fn sdf(width: i32, height: i32, shape: SdfShape) -> Result<VipsImage> {
5934    unsafe {
5935        let width_in: i32 = width;
5936        let height_in: i32 = height;
5937        let shape_in: i32 = shape as i32;
5938        let mut out_out: *mut bindings::VipsImage = null_mut();
5939
5940        let vips_op_response = bindings::vips_sdf(
5941            &mut out_out,
5942            width_in,
5943            height_in,
5944            shape_in.try_into().unwrap(),
5945            NULL,
5946        );
5947        utils::result(
5948            vips_op_response,
5949            VipsImage { ctx: out_out },
5950            Error::SdfError,
5951        )
5952    }
5953}
5954
5955/// Options for sdf operation
5956#[derive(Clone, Debug)]
5957pub struct SdfOptions {
5958    /// r: `f64` -> Radius
5959    /// min: 0, max: 100000000, default: 50
5960    pub r: f64,
5961    /// a: `Vec<f64>` -> Point a
5962    pub a: Vec<f64>,
5963    /// b: `Vec<f64>` -> Point b
5964    pub b: Vec<f64>,
5965    /// corners: `Vec<f64>` -> Corner radii
5966    pub corners: Vec<f64>,
5967}
5968
5969impl std::default::Default for SdfOptions {
5970    fn default() -> Self {
5971        SdfOptions {
5972            r: f64::from(50),
5973            a: Vec::new(),
5974            b: Vec::new(),
5975            corners: Vec::new(),
5976        }
5977    }
5978}
5979
5980/// VipsSdf (sdf), create an SDF image
5981/// width: `i32` -> Image width in pixels
5982/// min: 1, max: 100000000, default: 1
5983/// height: `i32` -> Image height in pixels
5984/// min: 1, max: 100000000, default: 1
5985/// shape: `SdfShape` -> SDF shape to create
5986///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5987///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5988///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5989///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5990///  `Last` -> VIPS_SDF_SHAPE_LAST = 4
5991/// sdf_options: `&SdfOptions` -> optional arguments
5992/// returns `VipsImage` - Output image
5993pub fn sdf_with_opts(
5994    width: i32,
5995    height: i32,
5996    shape: SdfShape,
5997    sdf_options: &SdfOptions,
5998) -> Result<VipsImage> {
5999    unsafe {
6000        let width_in: i32 = width;
6001        let height_in: i32 = height;
6002        let shape_in: i32 = shape as i32;
6003        let mut out_out: *mut bindings::VipsImage = null_mut();
6004
6005        let r_in: f64 = sdf_options.r;
6006        let r_in_name = utils::new_c_string("r")?;
6007
6008        let a_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.a[..]);
6009        let a_in = a_wrapper.ctx;
6010        let a_in_name = utils::new_c_string("a")?;
6011
6012        let b_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.b[..]);
6013        let b_in = b_wrapper.ctx;
6014        let b_in_name = utils::new_c_string("b")?;
6015
6016        let corners_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.corners[..]);
6017        let corners_in = corners_wrapper.ctx;
6018        let corners_in_name = utils::new_c_string("corners")?;
6019
6020        let vips_op_response = bindings::vips_sdf(
6021            &mut out_out,
6022            width_in,
6023            height_in,
6024            shape_in.try_into().unwrap(),
6025            r_in_name.as_ptr(),
6026            r_in,
6027            a_in_name.as_ptr(),
6028            a_in,
6029            b_in_name.as_ptr(),
6030            b_in,
6031            corners_in_name.as_ptr(),
6032            corners_in,
6033            NULL,
6034        );
6035        utils::result(
6036            vips_op_response,
6037            VipsImage { ctx: out_out },
6038            Error::SdfError,
6039        )
6040    }
6041}
6042
6043/// VipsEye (eye), make an image showing the eye's spatial response
6044/// width: `i32` -> Image width in pixels
6045/// min: 1, max: 100000000, default: 1
6046/// height: `i32` -> Image height in pixels
6047/// min: 1, max: 100000000, default: 1
6048/// returns `VipsImage` - Output image
6049pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
6050    unsafe {
6051        let width_in: i32 = width;
6052        let height_in: i32 = height;
6053        let mut out_out: *mut bindings::VipsImage = null_mut();
6054
6055        let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
6056        utils::result(
6057            vips_op_response,
6058            VipsImage { ctx: out_out },
6059            Error::EyeError,
6060        )
6061    }
6062}
6063
6064/// Options for eye operation
6065#[derive(Clone, Debug)]
6066pub struct EyeOptions {
6067    /// uchar: `bool` -> Output an unsigned char image
6068    /// default: false
6069    pub uchar: bool,
6070    /// factor: `f64` -> Maximum spatial frequency
6071    /// min: 0, max: 1, default: 0.5
6072    pub factor: f64,
6073}
6074
6075impl std::default::Default for EyeOptions {
6076    fn default() -> Self {
6077        EyeOptions {
6078            uchar: false,
6079            factor: f64::from(0.5),
6080        }
6081    }
6082}
6083
6084/// VipsEye (eye), make an image showing the eye's spatial response
6085/// width: `i32` -> Image width in pixels
6086/// min: 1, max: 100000000, default: 1
6087/// height: `i32` -> Image height in pixels
6088/// min: 1, max: 100000000, default: 1
6089/// eye_options: `&EyeOptions` -> optional arguments
6090/// returns `VipsImage` - Output image
6091pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
6092    unsafe {
6093        let width_in: i32 = width;
6094        let height_in: i32 = height;
6095        let mut out_out: *mut bindings::VipsImage = null_mut();
6096
6097        let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
6098        let uchar_in_name = utils::new_c_string("uchar")?;
6099
6100        let factor_in: f64 = eye_options.factor;
6101        let factor_in_name = utils::new_c_string("factor")?;
6102
6103        let vips_op_response = bindings::vips_eye(
6104            &mut out_out,
6105            width_in,
6106            height_in,
6107            uchar_in_name.as_ptr(),
6108            uchar_in,
6109            factor_in_name.as_ptr(),
6110            factor_in,
6111            NULL,
6112        );
6113        utils::result(
6114            vips_op_response,
6115            VipsImage { ctx: out_out },
6116            Error::EyeError,
6117        )
6118    }
6119}
6120
6121/// VipsGrey (grey), make a grey ramp image
6122/// width: `i32` -> Image width in pixels
6123/// min: 1, max: 100000000, default: 1
6124/// height: `i32` -> Image height in pixels
6125/// min: 1, max: 100000000, default: 1
6126/// returns `VipsImage` - Output image
6127pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
6128    unsafe {
6129        let width_in: i32 = width;
6130        let height_in: i32 = height;
6131        let mut out_out: *mut bindings::VipsImage = null_mut();
6132
6133        let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
6134        utils::result(
6135            vips_op_response,
6136            VipsImage { ctx: out_out },
6137            Error::GreyError,
6138        )
6139    }
6140}
6141
6142/// Options for grey operation
6143#[derive(Clone, Debug)]
6144pub struct GreyOptions {
6145    /// uchar: `bool` -> Output an unsigned char image
6146    /// default: false
6147    pub uchar: bool,
6148}
6149
6150impl std::default::Default for GreyOptions {
6151    fn default() -> Self {
6152        GreyOptions { uchar: false }
6153    }
6154}
6155
6156/// VipsGrey (grey), make a grey ramp image
6157/// width: `i32` -> Image width in pixels
6158/// min: 1, max: 100000000, default: 1
6159/// height: `i32` -> Image height in pixels
6160/// min: 1, max: 100000000, default: 1
6161/// grey_options: `&GreyOptions` -> optional arguments
6162/// returns `VipsImage` - Output image
6163pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6164    unsafe {
6165        let width_in: i32 = width;
6166        let height_in: i32 = height;
6167        let mut out_out: *mut bindings::VipsImage = null_mut();
6168
6169        let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6170        let uchar_in_name = utils::new_c_string("uchar")?;
6171
6172        let vips_op_response = bindings::vips_grey(
6173            &mut out_out,
6174            width_in,
6175            height_in,
6176            uchar_in_name.as_ptr(),
6177            uchar_in,
6178            NULL,
6179        );
6180        utils::result(
6181            vips_op_response,
6182            VipsImage { ctx: out_out },
6183            Error::GreyError,
6184        )
6185    }
6186}
6187
6188/// VipsZone (zone), make a zone plate
6189/// width: `i32` -> Image width in pixels
6190/// min: 1, max: 100000000, default: 1
6191/// height: `i32` -> Image height in pixels
6192/// min: 1, max: 100000000, default: 1
6193/// returns `VipsImage` - Output image
6194pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6195    unsafe {
6196        let width_in: i32 = width;
6197        let height_in: i32 = height;
6198        let mut out_out: *mut bindings::VipsImage = null_mut();
6199
6200        let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6201        utils::result(
6202            vips_op_response,
6203            VipsImage { ctx: out_out },
6204            Error::ZoneError,
6205        )
6206    }
6207}
6208
6209/// Options for zone operation
6210#[derive(Clone, Debug)]
6211pub struct ZoneOptions {
6212    /// uchar: `bool` -> Output an unsigned char image
6213    /// default: false
6214    pub uchar: bool,
6215}
6216
6217impl std::default::Default for ZoneOptions {
6218    fn default() -> Self {
6219        ZoneOptions { uchar: false }
6220    }
6221}
6222
6223/// VipsZone (zone), make a zone plate
6224/// width: `i32` -> Image width in pixels
6225/// min: 1, max: 100000000, default: 1
6226/// height: `i32` -> Image height in pixels
6227/// min: 1, max: 100000000, default: 1
6228/// zone_options: `&ZoneOptions` -> optional arguments
6229/// returns `VipsImage` - Output image
6230pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6231    unsafe {
6232        let width_in: i32 = width;
6233        let height_in: i32 = height;
6234        let mut out_out: *mut bindings::VipsImage = null_mut();
6235
6236        let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6237        let uchar_in_name = utils::new_c_string("uchar")?;
6238
6239        let vips_op_response = bindings::vips_zone(
6240            &mut out_out,
6241            width_in,
6242            height_in,
6243            uchar_in_name.as_ptr(),
6244            uchar_in,
6245            NULL,
6246        );
6247        utils::result(
6248            vips_op_response,
6249            VipsImage { ctx: out_out },
6250            Error::ZoneError,
6251        )
6252    }
6253}
6254
6255/// VipsSines (sines), make a 2D sine wave
6256/// width: `i32` -> Image width in pixels
6257/// min: 1, max: 100000000, default: 1
6258/// height: `i32` -> Image height in pixels
6259/// min: 1, max: 100000000, default: 1
6260/// returns `VipsImage` - Output image
6261pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6262    unsafe {
6263        let width_in: i32 = width;
6264        let height_in: i32 = height;
6265        let mut out_out: *mut bindings::VipsImage = null_mut();
6266
6267        let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6268        utils::result(
6269            vips_op_response,
6270            VipsImage { ctx: out_out },
6271            Error::SineError,
6272        )
6273    }
6274}
6275
6276/// Options for sines operation
6277#[derive(Clone, Debug)]
6278pub struct SineOptions {
6279    /// uchar: `bool` -> Output an unsigned char image
6280    /// default: false
6281    pub uchar: bool,
6282    /// hfreq: `f64` -> Horizontal spatial frequency
6283    /// min: 0, max: 10000, default: 0.5
6284    pub hfreq: f64,
6285    /// vfreq: `f64` -> Vertical spatial frequency
6286    /// min: 0, max: 10000, default: 0.5
6287    pub vfreq: f64,
6288}
6289
6290impl std::default::Default for SineOptions {
6291    fn default() -> Self {
6292        SineOptions {
6293            uchar: false,
6294            hfreq: f64::from(0.5),
6295            vfreq: f64::from(0.5),
6296        }
6297    }
6298}
6299
6300/// VipsSines (sines), make a 2D sine wave
6301/// width: `i32` -> Image width in pixels
6302/// min: 1, max: 100000000, default: 1
6303/// height: `i32` -> Image height in pixels
6304/// min: 1, max: 100000000, default: 1
6305/// sines_options: `&SineOptions` -> optional arguments
6306/// returns `VipsImage` - Output image
6307pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6308    unsafe {
6309        let width_in: i32 = width;
6310        let height_in: i32 = height;
6311        let mut out_out: *mut bindings::VipsImage = null_mut();
6312
6313        let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6314        let uchar_in_name = utils::new_c_string("uchar")?;
6315
6316        let hfreq_in: f64 = sines_options.hfreq;
6317        let hfreq_in_name = utils::new_c_string("hfreq")?;
6318
6319        let vfreq_in: f64 = sines_options.vfreq;
6320        let vfreq_in_name = utils::new_c_string("vfreq")?;
6321
6322        let vips_op_response = bindings::vips_sines(
6323            &mut out_out,
6324            width_in,
6325            height_in,
6326            uchar_in_name.as_ptr(),
6327            uchar_in,
6328            hfreq_in_name.as_ptr(),
6329            hfreq_in,
6330            vfreq_in_name.as_ptr(),
6331            vfreq_in,
6332            NULL,
6333        );
6334        utils::result(
6335            vips_op_response,
6336            VipsImage { ctx: out_out },
6337            Error::SineError,
6338        )
6339    }
6340}
6341
6342/// VipsMaskIdeal (mask_ideal), make an ideal filter
6343/// width: `i32` -> Image width in pixels
6344/// min: 1, max: 100000000, default: 1
6345/// height: `i32` -> Image height in pixels
6346/// min: 1, max: 100000000, default: 1
6347/// frequency_cutoff: `f64` -> Frequency cutoff
6348/// min: 0, max: 1000000, default: 0.5
6349/// returns `VipsImage` - Output image
6350pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6351    unsafe {
6352        let width_in: i32 = width;
6353        let height_in: i32 = height;
6354        let frequency_cutoff_in: f64 = frequency_cutoff;
6355        let mut out_out: *mut bindings::VipsImage = null_mut();
6356
6357        let vips_op_response =
6358            bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6359        utils::result(
6360            vips_op_response,
6361            VipsImage { ctx: out_out },
6362            Error::MaskIdealError,
6363        )
6364    }
6365}
6366
6367/// Options for mask_ideal operation
6368#[derive(Clone, Debug)]
6369pub struct MaskIdealOptions {
6370    /// uchar: `bool` -> Output an unsigned char image
6371    /// default: false
6372    pub uchar: bool,
6373    /// nodc: `bool` -> Remove DC component
6374    /// default: false
6375    pub nodc: bool,
6376    /// reject: `bool` -> Invert the sense of the filter
6377    /// default: false
6378    pub reject: bool,
6379    /// optical: `bool` -> Rotate quadrants to optical space
6380    /// default: false
6381    pub optical: bool,
6382}
6383
6384impl std::default::Default for MaskIdealOptions {
6385    fn default() -> Self {
6386        MaskIdealOptions {
6387            uchar: false,
6388            nodc: false,
6389            reject: false,
6390            optical: false,
6391        }
6392    }
6393}
6394
6395/// VipsMaskIdeal (mask_ideal), make an ideal filter
6396/// width: `i32` -> Image width in pixels
6397/// min: 1, max: 100000000, default: 1
6398/// height: `i32` -> Image height in pixels
6399/// min: 1, max: 100000000, default: 1
6400/// frequency_cutoff: `f64` -> Frequency cutoff
6401/// min: 0, max: 1000000, default: 0.5
6402/// mask_ideal_options: `&MaskIdealOptions` -> optional arguments
6403/// returns `VipsImage` - Output image
6404pub fn mask_ideal_with_opts(
6405    width: i32,
6406    height: i32,
6407    frequency_cutoff: f64,
6408    mask_ideal_options: &MaskIdealOptions,
6409) -> Result<VipsImage> {
6410    unsafe {
6411        let width_in: i32 = width;
6412        let height_in: i32 = height;
6413        let frequency_cutoff_in: f64 = frequency_cutoff;
6414        let mut out_out: *mut bindings::VipsImage = null_mut();
6415
6416        let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6417        let uchar_in_name = utils::new_c_string("uchar")?;
6418
6419        let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6420        let nodc_in_name = utils::new_c_string("nodc")?;
6421
6422        let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6423        let reject_in_name = utils::new_c_string("reject")?;
6424
6425        let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6426        let optical_in_name = utils::new_c_string("optical")?;
6427
6428        let vips_op_response = bindings::vips_mask_ideal(
6429            &mut out_out,
6430            width_in,
6431            height_in,
6432            frequency_cutoff_in,
6433            uchar_in_name.as_ptr(),
6434            uchar_in,
6435            nodc_in_name.as_ptr(),
6436            nodc_in,
6437            reject_in_name.as_ptr(),
6438            reject_in,
6439            optical_in_name.as_ptr(),
6440            optical_in,
6441            NULL,
6442        );
6443        utils::result(
6444            vips_op_response,
6445            VipsImage { ctx: out_out },
6446            Error::MaskIdealError,
6447        )
6448    }
6449}
6450
6451/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6452/// width: `i32` -> Image width in pixels
6453/// min: 1, max: 100000000, default: 1
6454/// height: `i32` -> Image height in pixels
6455/// min: 1, max: 100000000, default: 1
6456/// frequency_cutoff: `f64` -> Frequency cutoff
6457/// min: 0, max: 1000000, default: 0.5
6458/// ringwidth: `f64` -> Ringwidth
6459/// min: 0, max: 1000000, default: 0.5
6460/// returns `VipsImage` - Output image
6461pub fn mask_ideal_ring(
6462    width: i32,
6463    height: i32,
6464    frequency_cutoff: f64,
6465    ringwidth: f64,
6466) -> Result<VipsImage> {
6467    unsafe {
6468        let width_in: i32 = width;
6469        let height_in: i32 = height;
6470        let frequency_cutoff_in: f64 = frequency_cutoff;
6471        let ringwidth_in: f64 = ringwidth;
6472        let mut out_out: *mut bindings::VipsImage = null_mut();
6473
6474        let vips_op_response = bindings::vips_mask_ideal_ring(
6475            &mut out_out,
6476            width_in,
6477            height_in,
6478            frequency_cutoff_in,
6479            ringwidth_in,
6480            NULL,
6481        );
6482        utils::result(
6483            vips_op_response,
6484            VipsImage { ctx: out_out },
6485            Error::MaskIdealRingError,
6486        )
6487    }
6488}
6489
6490/// Options for mask_ideal_ring operation
6491#[derive(Clone, Debug)]
6492pub struct MaskIdealRingOptions {
6493    /// uchar: `bool` -> Output an unsigned char image
6494    /// default: false
6495    pub uchar: bool,
6496    /// nodc: `bool` -> Remove DC component
6497    /// default: false
6498    pub nodc: bool,
6499    /// reject: `bool` -> Invert the sense of the filter
6500    /// default: false
6501    pub reject: bool,
6502    /// optical: `bool` -> Rotate quadrants to optical space
6503    /// default: false
6504    pub optical: bool,
6505}
6506
6507impl std::default::Default for MaskIdealRingOptions {
6508    fn default() -> Self {
6509        MaskIdealRingOptions {
6510            uchar: false,
6511            nodc: false,
6512            reject: false,
6513            optical: false,
6514        }
6515    }
6516}
6517
6518/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6519/// width: `i32` -> Image width in pixels
6520/// min: 1, max: 100000000, default: 1
6521/// height: `i32` -> Image height in pixels
6522/// min: 1, max: 100000000, default: 1
6523/// frequency_cutoff: `f64` -> Frequency cutoff
6524/// min: 0, max: 1000000, default: 0.5
6525/// ringwidth: `f64` -> Ringwidth
6526/// min: 0, max: 1000000, default: 0.5
6527/// mask_ideal_ring_options: `&MaskIdealRingOptions` -> optional arguments
6528/// returns `VipsImage` - Output image
6529pub fn mask_ideal_ring_with_opts(
6530    width: i32,
6531    height: i32,
6532    frequency_cutoff: f64,
6533    ringwidth: f64,
6534    mask_ideal_ring_options: &MaskIdealRingOptions,
6535) -> Result<VipsImage> {
6536    unsafe {
6537        let width_in: i32 = width;
6538        let height_in: i32 = height;
6539        let frequency_cutoff_in: f64 = frequency_cutoff;
6540        let ringwidth_in: f64 = ringwidth;
6541        let mut out_out: *mut bindings::VipsImage = null_mut();
6542
6543        let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6544        let uchar_in_name = utils::new_c_string("uchar")?;
6545
6546        let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6547        let nodc_in_name = utils::new_c_string("nodc")?;
6548
6549        let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6550        let reject_in_name = utils::new_c_string("reject")?;
6551
6552        let optical_in: i32 = if mask_ideal_ring_options.optical {
6553            1
6554        } else {
6555            0
6556        };
6557        let optical_in_name = utils::new_c_string("optical")?;
6558
6559        let vips_op_response = bindings::vips_mask_ideal_ring(
6560            &mut out_out,
6561            width_in,
6562            height_in,
6563            frequency_cutoff_in,
6564            ringwidth_in,
6565            uchar_in_name.as_ptr(),
6566            uchar_in,
6567            nodc_in_name.as_ptr(),
6568            nodc_in,
6569            reject_in_name.as_ptr(),
6570            reject_in,
6571            optical_in_name.as_ptr(),
6572            optical_in,
6573            NULL,
6574        );
6575        utils::result(
6576            vips_op_response,
6577            VipsImage { ctx: out_out },
6578            Error::MaskIdealRingError,
6579        )
6580    }
6581}
6582
6583/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6584/// width: `i32` -> Image width in pixels
6585/// min: 1, max: 100000000, default: 1
6586/// height: `i32` -> Image height in pixels
6587/// min: 1, max: 100000000, default: 1
6588/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6589/// min: 0, max: 1000000, default: 0.5
6590/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6591/// min: 0, max: 1000000, default: 0.5
6592/// radius: `f64` -> Radius of circle
6593/// min: 0, max: 1000000, default: 0.1
6594/// returns `VipsImage` - Output image
6595pub fn mask_ideal_band(
6596    width: i32,
6597    height: i32,
6598    frequency_cutoff_x: f64,
6599    frequency_cutoff_y: f64,
6600    radius: f64,
6601) -> Result<VipsImage> {
6602    unsafe {
6603        let width_in: i32 = width;
6604        let height_in: i32 = height;
6605        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6606        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6607        let radius_in: f64 = radius;
6608        let mut out_out: *mut bindings::VipsImage = null_mut();
6609
6610        let vips_op_response = bindings::vips_mask_ideal_band(
6611            &mut out_out,
6612            width_in,
6613            height_in,
6614            frequency_cutoff_x_in,
6615            frequency_cutoff_y_in,
6616            radius_in,
6617            NULL,
6618        );
6619        utils::result(
6620            vips_op_response,
6621            VipsImage { ctx: out_out },
6622            Error::MaskIdealBandError,
6623        )
6624    }
6625}
6626
6627/// Options for mask_ideal_band operation
6628#[derive(Clone, Debug)]
6629pub struct MaskIdealBandOptions {
6630    /// uchar: `bool` -> Output an unsigned char image
6631    /// default: false
6632    pub uchar: bool,
6633    /// nodc: `bool` -> Remove DC component
6634    /// default: false
6635    pub nodc: bool,
6636    /// reject: `bool` -> Invert the sense of the filter
6637    /// default: false
6638    pub reject: bool,
6639    /// optical: `bool` -> Rotate quadrants to optical space
6640    /// default: false
6641    pub optical: bool,
6642}
6643
6644impl std::default::Default for MaskIdealBandOptions {
6645    fn default() -> Self {
6646        MaskIdealBandOptions {
6647            uchar: false,
6648            nodc: false,
6649            reject: false,
6650            optical: false,
6651        }
6652    }
6653}
6654
6655/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6656/// width: `i32` -> Image width in pixels
6657/// min: 1, max: 100000000, default: 1
6658/// height: `i32` -> Image height in pixels
6659/// min: 1, max: 100000000, default: 1
6660/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6661/// min: 0, max: 1000000, default: 0.5
6662/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6663/// min: 0, max: 1000000, default: 0.5
6664/// radius: `f64` -> Radius of circle
6665/// min: 0, max: 1000000, default: 0.1
6666/// mask_ideal_band_options: `&MaskIdealBandOptions` -> optional arguments
6667/// returns `VipsImage` - Output image
6668pub fn mask_ideal_band_with_opts(
6669    width: i32,
6670    height: i32,
6671    frequency_cutoff_x: f64,
6672    frequency_cutoff_y: f64,
6673    radius: f64,
6674    mask_ideal_band_options: &MaskIdealBandOptions,
6675) -> Result<VipsImage> {
6676    unsafe {
6677        let width_in: i32 = width;
6678        let height_in: i32 = height;
6679        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6680        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6681        let radius_in: f64 = radius;
6682        let mut out_out: *mut bindings::VipsImage = null_mut();
6683
6684        let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6685        let uchar_in_name = utils::new_c_string("uchar")?;
6686
6687        let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6688        let nodc_in_name = utils::new_c_string("nodc")?;
6689
6690        let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6691        let reject_in_name = utils::new_c_string("reject")?;
6692
6693        let optical_in: i32 = if mask_ideal_band_options.optical {
6694            1
6695        } else {
6696            0
6697        };
6698        let optical_in_name = utils::new_c_string("optical")?;
6699
6700        let vips_op_response = bindings::vips_mask_ideal_band(
6701            &mut out_out,
6702            width_in,
6703            height_in,
6704            frequency_cutoff_x_in,
6705            frequency_cutoff_y_in,
6706            radius_in,
6707            uchar_in_name.as_ptr(),
6708            uchar_in,
6709            nodc_in_name.as_ptr(),
6710            nodc_in,
6711            reject_in_name.as_ptr(),
6712            reject_in,
6713            optical_in_name.as_ptr(),
6714            optical_in,
6715            NULL,
6716        );
6717        utils::result(
6718            vips_op_response,
6719            VipsImage { ctx: out_out },
6720            Error::MaskIdealBandError,
6721        )
6722    }
6723}
6724
6725/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6726/// width: `i32` -> Image width in pixels
6727/// min: 1, max: 100000000, default: 1
6728/// height: `i32` -> Image height in pixels
6729/// min: 1, max: 100000000, default: 1
6730/// order: `f64` -> Filter order
6731/// min: 1, max: 1000000, default: 1
6732/// frequency_cutoff: `f64` -> Frequency cutoff
6733/// min: 0, max: 1000000, default: 0.5
6734/// amplitude_cutoff: `f64` -> Amplitude cutoff
6735/// min: 0, max: 1, default: 0.5
6736/// returns `VipsImage` - Output image
6737pub fn mask_butterworth(
6738    width: i32,
6739    height: i32,
6740    order: f64,
6741    frequency_cutoff: f64,
6742    amplitude_cutoff: f64,
6743) -> Result<VipsImage> {
6744    unsafe {
6745        let width_in: i32 = width;
6746        let height_in: i32 = height;
6747        let order_in: f64 = order;
6748        let frequency_cutoff_in: f64 = frequency_cutoff;
6749        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6750        let mut out_out: *mut bindings::VipsImage = null_mut();
6751
6752        let vips_op_response = bindings::vips_mask_butterworth(
6753            &mut out_out,
6754            width_in,
6755            height_in,
6756            order_in,
6757            frequency_cutoff_in,
6758            amplitude_cutoff_in,
6759            NULL,
6760        );
6761        utils::result(
6762            vips_op_response,
6763            VipsImage { ctx: out_out },
6764            Error::MaskButterworthError,
6765        )
6766    }
6767}
6768
6769/// Options for mask_butterworth operation
6770#[derive(Clone, Debug)]
6771pub struct MaskButterworthOptions {
6772    /// uchar: `bool` -> Output an unsigned char image
6773    /// default: false
6774    pub uchar: bool,
6775    /// nodc: `bool` -> Remove DC component
6776    /// default: false
6777    pub nodc: bool,
6778    /// reject: `bool` -> Invert the sense of the filter
6779    /// default: false
6780    pub reject: bool,
6781    /// optical: `bool` -> Rotate quadrants to optical space
6782    /// default: false
6783    pub optical: bool,
6784}
6785
6786impl std::default::Default for MaskButterworthOptions {
6787    fn default() -> Self {
6788        MaskButterworthOptions {
6789            uchar: false,
6790            nodc: false,
6791            reject: false,
6792            optical: false,
6793        }
6794    }
6795}
6796
6797/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6798/// width: `i32` -> Image width in pixels
6799/// min: 1, max: 100000000, default: 1
6800/// height: `i32` -> Image height in pixels
6801/// min: 1, max: 100000000, default: 1
6802/// order: `f64` -> Filter order
6803/// min: 1, max: 1000000, default: 1
6804/// frequency_cutoff: `f64` -> Frequency cutoff
6805/// min: 0, max: 1000000, default: 0.5
6806/// amplitude_cutoff: `f64` -> Amplitude cutoff
6807/// min: 0, max: 1, default: 0.5
6808/// mask_butterworth_options: `&MaskButterworthOptions` -> optional arguments
6809/// returns `VipsImage` - Output image
6810pub fn mask_butterworth_with_opts(
6811    width: i32,
6812    height: i32,
6813    order: f64,
6814    frequency_cutoff: f64,
6815    amplitude_cutoff: f64,
6816    mask_butterworth_options: &MaskButterworthOptions,
6817) -> Result<VipsImage> {
6818    unsafe {
6819        let width_in: i32 = width;
6820        let height_in: i32 = height;
6821        let order_in: f64 = order;
6822        let frequency_cutoff_in: f64 = frequency_cutoff;
6823        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6824        let mut out_out: *mut bindings::VipsImage = null_mut();
6825
6826        let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6827        let uchar_in_name = utils::new_c_string("uchar")?;
6828
6829        let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6830        let nodc_in_name = utils::new_c_string("nodc")?;
6831
6832        let reject_in: i32 = if mask_butterworth_options.reject {
6833            1
6834        } else {
6835            0
6836        };
6837        let reject_in_name = utils::new_c_string("reject")?;
6838
6839        let optical_in: i32 = if mask_butterworth_options.optical {
6840            1
6841        } else {
6842            0
6843        };
6844        let optical_in_name = utils::new_c_string("optical")?;
6845
6846        let vips_op_response = bindings::vips_mask_butterworth(
6847            &mut out_out,
6848            width_in,
6849            height_in,
6850            order_in,
6851            frequency_cutoff_in,
6852            amplitude_cutoff_in,
6853            uchar_in_name.as_ptr(),
6854            uchar_in,
6855            nodc_in_name.as_ptr(),
6856            nodc_in,
6857            reject_in_name.as_ptr(),
6858            reject_in,
6859            optical_in_name.as_ptr(),
6860            optical_in,
6861            NULL,
6862        );
6863        utils::result(
6864            vips_op_response,
6865            VipsImage { ctx: out_out },
6866            Error::MaskButterworthError,
6867        )
6868    }
6869}
6870
6871/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6872/// width: `i32` -> Image width in pixels
6873/// min: 1, max: 100000000, default: 1
6874/// height: `i32` -> Image height in pixels
6875/// min: 1, max: 100000000, default: 1
6876/// order: `f64` -> Filter order
6877/// min: 1, max: 1000000, default: 1
6878/// frequency_cutoff: `f64` -> Frequency cutoff
6879/// min: 0, max: 1000000, default: 0.5
6880/// amplitude_cutoff: `f64` -> Amplitude cutoff
6881/// min: 0, max: 1, default: 0.5
6882/// ringwidth: `f64` -> Ringwidth
6883/// min: 0, max: 1000000, default: 0.1
6884/// returns `VipsImage` - Output image
6885pub fn mask_butterworth_ring(
6886    width: i32,
6887    height: i32,
6888    order: f64,
6889    frequency_cutoff: f64,
6890    amplitude_cutoff: f64,
6891    ringwidth: f64,
6892) -> Result<VipsImage> {
6893    unsafe {
6894        let width_in: i32 = width;
6895        let height_in: i32 = height;
6896        let order_in: f64 = order;
6897        let frequency_cutoff_in: f64 = frequency_cutoff;
6898        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6899        let ringwidth_in: f64 = ringwidth;
6900        let mut out_out: *mut bindings::VipsImage = null_mut();
6901
6902        let vips_op_response = bindings::vips_mask_butterworth_ring(
6903            &mut out_out,
6904            width_in,
6905            height_in,
6906            order_in,
6907            frequency_cutoff_in,
6908            amplitude_cutoff_in,
6909            ringwidth_in,
6910            NULL,
6911        );
6912        utils::result(
6913            vips_op_response,
6914            VipsImage { ctx: out_out },
6915            Error::MaskButterworthRingError,
6916        )
6917    }
6918}
6919
6920/// Options for mask_butterworth_ring operation
6921#[derive(Clone, Debug)]
6922pub struct MaskButterworthRingOptions {
6923    /// uchar: `bool` -> Output an unsigned char image
6924    /// default: false
6925    pub uchar: bool,
6926    /// nodc: `bool` -> Remove DC component
6927    /// default: false
6928    pub nodc: bool,
6929    /// reject: `bool` -> Invert the sense of the filter
6930    /// default: false
6931    pub reject: bool,
6932    /// optical: `bool` -> Rotate quadrants to optical space
6933    /// default: false
6934    pub optical: bool,
6935}
6936
6937impl std::default::Default for MaskButterworthRingOptions {
6938    fn default() -> Self {
6939        MaskButterworthRingOptions {
6940            uchar: false,
6941            nodc: false,
6942            reject: false,
6943            optical: false,
6944        }
6945    }
6946}
6947
6948/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6949/// width: `i32` -> Image width in pixels
6950/// min: 1, max: 100000000, default: 1
6951/// height: `i32` -> Image height in pixels
6952/// min: 1, max: 100000000, default: 1
6953/// order: `f64` -> Filter order
6954/// min: 1, max: 1000000, default: 1
6955/// frequency_cutoff: `f64` -> Frequency cutoff
6956/// min: 0, max: 1000000, default: 0.5
6957/// amplitude_cutoff: `f64` -> Amplitude cutoff
6958/// min: 0, max: 1, default: 0.5
6959/// ringwidth: `f64` -> Ringwidth
6960/// min: 0, max: 1000000, default: 0.1
6961/// mask_butterworth_ring_options: `&MaskButterworthRingOptions` -> optional arguments
6962/// returns `VipsImage` - Output image
6963pub fn mask_butterworth_ring_with_opts(
6964    width: i32,
6965    height: i32,
6966    order: f64,
6967    frequency_cutoff: f64,
6968    amplitude_cutoff: f64,
6969    ringwidth: f64,
6970    mask_butterworth_ring_options: &MaskButterworthRingOptions,
6971) -> Result<VipsImage> {
6972    unsafe {
6973        let width_in: i32 = width;
6974        let height_in: i32 = height;
6975        let order_in: f64 = order;
6976        let frequency_cutoff_in: f64 = frequency_cutoff;
6977        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6978        let ringwidth_in: f64 = ringwidth;
6979        let mut out_out: *mut bindings::VipsImage = null_mut();
6980
6981        let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6982            1
6983        } else {
6984            0
6985        };
6986        let uchar_in_name = utils::new_c_string("uchar")?;
6987
6988        let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6989            1
6990        } else {
6991            0
6992        };
6993        let nodc_in_name = utils::new_c_string("nodc")?;
6994
6995        let reject_in: i32 = if mask_butterworth_ring_options.reject {
6996            1
6997        } else {
6998            0
6999        };
7000        let reject_in_name = utils::new_c_string("reject")?;
7001
7002        let optical_in: i32 = if mask_butterworth_ring_options.optical {
7003            1
7004        } else {
7005            0
7006        };
7007        let optical_in_name = utils::new_c_string("optical")?;
7008
7009        let vips_op_response = bindings::vips_mask_butterworth_ring(
7010            &mut out_out,
7011            width_in,
7012            height_in,
7013            order_in,
7014            frequency_cutoff_in,
7015            amplitude_cutoff_in,
7016            ringwidth_in,
7017            uchar_in_name.as_ptr(),
7018            uchar_in,
7019            nodc_in_name.as_ptr(),
7020            nodc_in,
7021            reject_in_name.as_ptr(),
7022            reject_in,
7023            optical_in_name.as_ptr(),
7024            optical_in,
7025            NULL,
7026        );
7027        utils::result(
7028            vips_op_response,
7029            VipsImage { ctx: out_out },
7030            Error::MaskButterworthRingError,
7031        )
7032    }
7033}
7034
7035/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
7036/// width: `i32` -> Image width in pixels
7037/// min: 1, max: 100000000, default: 1
7038/// height: `i32` -> Image height in pixels
7039/// min: 1, max: 100000000, default: 1
7040/// order: `f64` -> Filter order
7041/// min: 1, max: 1000000, default: 1
7042/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7043/// min: 0, max: 1000000, default: 0.5
7044/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7045/// min: 0, max: 1000000, default: 0.5
7046/// radius: `f64` -> Radius of circle
7047/// min: 0, max: 1000000, default: 0.1
7048/// amplitude_cutoff: `f64` -> Amplitude cutoff
7049/// min: 0, max: 1, default: 0.5
7050/// returns `VipsImage` - Output image
7051pub fn mask_butterworth_band(
7052    width: i32,
7053    height: i32,
7054    order: f64,
7055    frequency_cutoff_x: f64,
7056    frequency_cutoff_y: f64,
7057    radius: f64,
7058    amplitude_cutoff: f64,
7059) -> Result<VipsImage> {
7060    unsafe {
7061        let width_in: i32 = width;
7062        let height_in: i32 = height;
7063        let order_in: f64 = order;
7064        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7065        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7066        let radius_in: f64 = radius;
7067        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7068        let mut out_out: *mut bindings::VipsImage = null_mut();
7069
7070        let vips_op_response = bindings::vips_mask_butterworth_band(
7071            &mut out_out,
7072            width_in,
7073            height_in,
7074            order_in,
7075            frequency_cutoff_x_in,
7076            frequency_cutoff_y_in,
7077            radius_in,
7078            amplitude_cutoff_in,
7079            NULL,
7080        );
7081        utils::result(
7082            vips_op_response,
7083            VipsImage { ctx: out_out },
7084            Error::MaskButterworthBandError,
7085        )
7086    }
7087}
7088
7089/// Options for mask_butterworth_band operation
7090#[derive(Clone, Debug)]
7091pub struct MaskButterworthBandOptions {
7092    /// uchar: `bool` -> Output an unsigned char image
7093    /// default: false
7094    pub uchar: bool,
7095    /// nodc: `bool` -> Remove DC component
7096    /// default: false
7097    pub nodc: bool,
7098    /// reject: `bool` -> Invert the sense of the filter
7099    /// default: false
7100    pub reject: bool,
7101    /// optical: `bool` -> Rotate quadrants to optical space
7102    /// default: false
7103    pub optical: bool,
7104}
7105
7106impl std::default::Default for MaskButterworthBandOptions {
7107    fn default() -> Self {
7108        MaskButterworthBandOptions {
7109            uchar: false,
7110            nodc: false,
7111            reject: false,
7112            optical: false,
7113        }
7114    }
7115}
7116
7117/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
7118/// width: `i32` -> Image width in pixels
7119/// min: 1, max: 100000000, default: 1
7120/// height: `i32` -> Image height in pixels
7121/// min: 1, max: 100000000, default: 1
7122/// order: `f64` -> Filter order
7123/// min: 1, max: 1000000, default: 1
7124/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7125/// min: 0, max: 1000000, default: 0.5
7126/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7127/// min: 0, max: 1000000, default: 0.5
7128/// radius: `f64` -> Radius of circle
7129/// min: 0, max: 1000000, default: 0.1
7130/// amplitude_cutoff: `f64` -> Amplitude cutoff
7131/// min: 0, max: 1, default: 0.5
7132/// mask_butterworth_band_options: `&MaskButterworthBandOptions` -> optional arguments
7133/// returns `VipsImage` - Output image
7134pub fn mask_butterworth_band_with_opts(
7135    width: i32,
7136    height: i32,
7137    order: f64,
7138    frequency_cutoff_x: f64,
7139    frequency_cutoff_y: f64,
7140    radius: f64,
7141    amplitude_cutoff: f64,
7142    mask_butterworth_band_options: &MaskButterworthBandOptions,
7143) -> Result<VipsImage> {
7144    unsafe {
7145        let width_in: i32 = width;
7146        let height_in: i32 = height;
7147        let order_in: f64 = order;
7148        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7149        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7150        let radius_in: f64 = radius;
7151        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7152        let mut out_out: *mut bindings::VipsImage = null_mut();
7153
7154        let uchar_in: i32 = if mask_butterworth_band_options.uchar {
7155            1
7156        } else {
7157            0
7158        };
7159        let uchar_in_name = utils::new_c_string("uchar")?;
7160
7161        let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7162            1
7163        } else {
7164            0
7165        };
7166        let nodc_in_name = utils::new_c_string("nodc")?;
7167
7168        let reject_in: i32 = if mask_butterworth_band_options.reject {
7169            1
7170        } else {
7171            0
7172        };
7173        let reject_in_name = utils::new_c_string("reject")?;
7174
7175        let optical_in: i32 = if mask_butterworth_band_options.optical {
7176            1
7177        } else {
7178            0
7179        };
7180        let optical_in_name = utils::new_c_string("optical")?;
7181
7182        let vips_op_response = bindings::vips_mask_butterworth_band(
7183            &mut out_out,
7184            width_in,
7185            height_in,
7186            order_in,
7187            frequency_cutoff_x_in,
7188            frequency_cutoff_y_in,
7189            radius_in,
7190            amplitude_cutoff_in,
7191            uchar_in_name.as_ptr(),
7192            uchar_in,
7193            nodc_in_name.as_ptr(),
7194            nodc_in,
7195            reject_in_name.as_ptr(),
7196            reject_in,
7197            optical_in_name.as_ptr(),
7198            optical_in,
7199            NULL,
7200        );
7201        utils::result(
7202            vips_op_response,
7203            VipsImage { ctx: out_out },
7204            Error::MaskButterworthBandError,
7205        )
7206    }
7207}
7208
7209/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7210/// width: `i32` -> Image width in pixels
7211/// min: 1, max: 100000000, default: 1
7212/// height: `i32` -> Image height in pixels
7213/// min: 1, max: 100000000, default: 1
7214/// frequency_cutoff: `f64` -> Frequency cutoff
7215/// min: 0, max: 1000000, default: 0.5
7216/// amplitude_cutoff: `f64` -> Amplitude cutoff
7217/// min: 0, max: 1, default: 0.5
7218/// returns `VipsImage` - Output image
7219pub fn mask_gaussian(
7220    width: i32,
7221    height: i32,
7222    frequency_cutoff: f64,
7223    amplitude_cutoff: f64,
7224) -> Result<VipsImage> {
7225    unsafe {
7226        let width_in: i32 = width;
7227        let height_in: i32 = height;
7228        let frequency_cutoff_in: f64 = frequency_cutoff;
7229        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7230        let mut out_out: *mut bindings::VipsImage = null_mut();
7231
7232        let vips_op_response = bindings::vips_mask_gaussian(
7233            &mut out_out,
7234            width_in,
7235            height_in,
7236            frequency_cutoff_in,
7237            amplitude_cutoff_in,
7238            NULL,
7239        );
7240        utils::result(
7241            vips_op_response,
7242            VipsImage { ctx: out_out },
7243            Error::MaskGaussianError,
7244        )
7245    }
7246}
7247
7248/// Options for mask_gaussian operation
7249#[derive(Clone, Debug)]
7250pub struct MaskGaussianOptions {
7251    /// uchar: `bool` -> Output an unsigned char image
7252    /// default: false
7253    pub uchar: bool,
7254    /// nodc: `bool` -> Remove DC component
7255    /// default: false
7256    pub nodc: bool,
7257    /// reject: `bool` -> Invert the sense of the filter
7258    /// default: false
7259    pub reject: bool,
7260    /// optical: `bool` -> Rotate quadrants to optical space
7261    /// default: false
7262    pub optical: bool,
7263}
7264
7265impl std::default::Default for MaskGaussianOptions {
7266    fn default() -> Self {
7267        MaskGaussianOptions {
7268            uchar: false,
7269            nodc: false,
7270            reject: false,
7271            optical: false,
7272        }
7273    }
7274}
7275
7276/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7277/// width: `i32` -> Image width in pixels
7278/// min: 1, max: 100000000, default: 1
7279/// height: `i32` -> Image height in pixels
7280/// min: 1, max: 100000000, default: 1
7281/// frequency_cutoff: `f64` -> Frequency cutoff
7282/// min: 0, max: 1000000, default: 0.5
7283/// amplitude_cutoff: `f64` -> Amplitude cutoff
7284/// min: 0, max: 1, default: 0.5
7285/// mask_gaussian_options: `&MaskGaussianOptions` -> optional arguments
7286/// returns `VipsImage` - Output image
7287pub fn mask_gaussian_with_opts(
7288    width: i32,
7289    height: i32,
7290    frequency_cutoff: f64,
7291    amplitude_cutoff: f64,
7292    mask_gaussian_options: &MaskGaussianOptions,
7293) -> Result<VipsImage> {
7294    unsafe {
7295        let width_in: i32 = width;
7296        let height_in: i32 = height;
7297        let frequency_cutoff_in: f64 = frequency_cutoff;
7298        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7299        let mut out_out: *mut bindings::VipsImage = null_mut();
7300
7301        let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7302        let uchar_in_name = utils::new_c_string("uchar")?;
7303
7304        let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7305        let nodc_in_name = utils::new_c_string("nodc")?;
7306
7307        let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7308        let reject_in_name = utils::new_c_string("reject")?;
7309
7310        let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7311        let optical_in_name = utils::new_c_string("optical")?;
7312
7313        let vips_op_response = bindings::vips_mask_gaussian(
7314            &mut out_out,
7315            width_in,
7316            height_in,
7317            frequency_cutoff_in,
7318            amplitude_cutoff_in,
7319            uchar_in_name.as_ptr(),
7320            uchar_in,
7321            nodc_in_name.as_ptr(),
7322            nodc_in,
7323            reject_in_name.as_ptr(),
7324            reject_in,
7325            optical_in_name.as_ptr(),
7326            optical_in,
7327            NULL,
7328        );
7329        utils::result(
7330            vips_op_response,
7331            VipsImage { ctx: out_out },
7332            Error::MaskGaussianError,
7333        )
7334    }
7335}
7336
7337/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7338/// width: `i32` -> Image width in pixels
7339/// min: 1, max: 100000000, default: 1
7340/// height: `i32` -> Image height in pixels
7341/// min: 1, max: 100000000, default: 1
7342/// frequency_cutoff: `f64` -> Frequency cutoff
7343/// min: 0, max: 1000000, default: 0.5
7344/// amplitude_cutoff: `f64` -> Amplitude cutoff
7345/// min: 0, max: 1, default: 0.5
7346/// ringwidth: `f64` -> Ringwidth
7347/// min: 0, max: 1000000, default: 0.5
7348/// returns `VipsImage` - Output image
7349pub fn mask_gaussian_ring(
7350    width: i32,
7351    height: i32,
7352    frequency_cutoff: f64,
7353    amplitude_cutoff: f64,
7354    ringwidth: f64,
7355) -> Result<VipsImage> {
7356    unsafe {
7357        let width_in: i32 = width;
7358        let height_in: i32 = height;
7359        let frequency_cutoff_in: f64 = frequency_cutoff;
7360        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7361        let ringwidth_in: f64 = ringwidth;
7362        let mut out_out: *mut bindings::VipsImage = null_mut();
7363
7364        let vips_op_response = bindings::vips_mask_gaussian_ring(
7365            &mut out_out,
7366            width_in,
7367            height_in,
7368            frequency_cutoff_in,
7369            amplitude_cutoff_in,
7370            ringwidth_in,
7371            NULL,
7372        );
7373        utils::result(
7374            vips_op_response,
7375            VipsImage { ctx: out_out },
7376            Error::MaskGaussianRingError,
7377        )
7378    }
7379}
7380
7381/// Options for mask_gaussian_ring operation
7382#[derive(Clone, Debug)]
7383pub struct MaskGaussianRingOptions {
7384    /// uchar: `bool` -> Output an unsigned char image
7385    /// default: false
7386    pub uchar: bool,
7387    /// nodc: `bool` -> Remove DC component
7388    /// default: false
7389    pub nodc: bool,
7390    /// reject: `bool` -> Invert the sense of the filter
7391    /// default: false
7392    pub reject: bool,
7393    /// optical: `bool` -> Rotate quadrants to optical space
7394    /// default: false
7395    pub optical: bool,
7396}
7397
7398impl std::default::Default for MaskGaussianRingOptions {
7399    fn default() -> Self {
7400        MaskGaussianRingOptions {
7401            uchar: false,
7402            nodc: false,
7403            reject: false,
7404            optical: false,
7405        }
7406    }
7407}
7408
7409/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7410/// width: `i32` -> Image width in pixels
7411/// min: 1, max: 100000000, default: 1
7412/// height: `i32` -> Image height in pixels
7413/// min: 1, max: 100000000, default: 1
7414/// frequency_cutoff: `f64` -> Frequency cutoff
7415/// min: 0, max: 1000000, default: 0.5
7416/// amplitude_cutoff: `f64` -> Amplitude cutoff
7417/// min: 0, max: 1, default: 0.5
7418/// ringwidth: `f64` -> Ringwidth
7419/// min: 0, max: 1000000, default: 0.5
7420/// mask_gaussian_ring_options: `&MaskGaussianRingOptions` -> optional arguments
7421/// returns `VipsImage` - Output image
7422pub fn mask_gaussian_ring_with_opts(
7423    width: i32,
7424    height: i32,
7425    frequency_cutoff: f64,
7426    amplitude_cutoff: f64,
7427    ringwidth: f64,
7428    mask_gaussian_ring_options: &MaskGaussianRingOptions,
7429) -> Result<VipsImage> {
7430    unsafe {
7431        let width_in: i32 = width;
7432        let height_in: i32 = height;
7433        let frequency_cutoff_in: f64 = frequency_cutoff;
7434        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7435        let ringwidth_in: f64 = ringwidth;
7436        let mut out_out: *mut bindings::VipsImage = null_mut();
7437
7438        let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7439            1
7440        } else {
7441            0
7442        };
7443        let uchar_in_name = utils::new_c_string("uchar")?;
7444
7445        let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7446            1
7447        } else {
7448            0
7449        };
7450        let nodc_in_name = utils::new_c_string("nodc")?;
7451
7452        let reject_in: i32 = if mask_gaussian_ring_options.reject {
7453            1
7454        } else {
7455            0
7456        };
7457        let reject_in_name = utils::new_c_string("reject")?;
7458
7459        let optical_in: i32 = if mask_gaussian_ring_options.optical {
7460            1
7461        } else {
7462            0
7463        };
7464        let optical_in_name = utils::new_c_string("optical")?;
7465
7466        let vips_op_response = bindings::vips_mask_gaussian_ring(
7467            &mut out_out,
7468            width_in,
7469            height_in,
7470            frequency_cutoff_in,
7471            amplitude_cutoff_in,
7472            ringwidth_in,
7473            uchar_in_name.as_ptr(),
7474            uchar_in,
7475            nodc_in_name.as_ptr(),
7476            nodc_in,
7477            reject_in_name.as_ptr(),
7478            reject_in,
7479            optical_in_name.as_ptr(),
7480            optical_in,
7481            NULL,
7482        );
7483        utils::result(
7484            vips_op_response,
7485            VipsImage { ctx: out_out },
7486            Error::MaskGaussianRingError,
7487        )
7488    }
7489}
7490
7491/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7492/// width: `i32` -> Image width in pixels
7493/// min: 1, max: 100000000, default: 1
7494/// height: `i32` -> Image height in pixels
7495/// min: 1, max: 100000000, default: 1
7496/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7497/// min: 0, max: 1000000, default: 0.5
7498/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7499/// min: 0, max: 1000000, default: 0.5
7500/// radius: `f64` -> Radius of circle
7501/// min: 0, max: 1000000, default: 0.1
7502/// amplitude_cutoff: `f64` -> Amplitude cutoff
7503/// min: 0, max: 1, default: 0.5
7504/// returns `VipsImage` - Output image
7505pub fn mask_gaussian_band(
7506    width: i32,
7507    height: i32,
7508    frequency_cutoff_x: f64,
7509    frequency_cutoff_y: f64,
7510    radius: f64,
7511    amplitude_cutoff: f64,
7512) -> Result<VipsImage> {
7513    unsafe {
7514        let width_in: i32 = width;
7515        let height_in: i32 = height;
7516        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7517        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7518        let radius_in: f64 = radius;
7519        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7520        let mut out_out: *mut bindings::VipsImage = null_mut();
7521
7522        let vips_op_response = bindings::vips_mask_gaussian_band(
7523            &mut out_out,
7524            width_in,
7525            height_in,
7526            frequency_cutoff_x_in,
7527            frequency_cutoff_y_in,
7528            radius_in,
7529            amplitude_cutoff_in,
7530            NULL,
7531        );
7532        utils::result(
7533            vips_op_response,
7534            VipsImage { ctx: out_out },
7535            Error::MaskGaussianBandError,
7536        )
7537    }
7538}
7539
7540/// Options for mask_gaussian_band operation
7541#[derive(Clone, Debug)]
7542pub struct MaskGaussianBandOptions {
7543    /// uchar: `bool` -> Output an unsigned char image
7544    /// default: false
7545    pub uchar: bool,
7546    /// nodc: `bool` -> Remove DC component
7547    /// default: false
7548    pub nodc: bool,
7549    /// reject: `bool` -> Invert the sense of the filter
7550    /// default: false
7551    pub reject: bool,
7552    /// optical: `bool` -> Rotate quadrants to optical space
7553    /// default: false
7554    pub optical: bool,
7555}
7556
7557impl std::default::Default for MaskGaussianBandOptions {
7558    fn default() -> Self {
7559        MaskGaussianBandOptions {
7560            uchar: false,
7561            nodc: false,
7562            reject: false,
7563            optical: false,
7564        }
7565    }
7566}
7567
7568/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7569/// width: `i32` -> Image width in pixels
7570/// min: 1, max: 100000000, default: 1
7571/// height: `i32` -> Image height in pixels
7572/// min: 1, max: 100000000, default: 1
7573/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7574/// min: 0, max: 1000000, default: 0.5
7575/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7576/// min: 0, max: 1000000, default: 0.5
7577/// radius: `f64` -> Radius of circle
7578/// min: 0, max: 1000000, default: 0.1
7579/// amplitude_cutoff: `f64` -> Amplitude cutoff
7580/// min: 0, max: 1, default: 0.5
7581/// mask_gaussian_band_options: `&MaskGaussianBandOptions` -> optional arguments
7582/// returns `VipsImage` - Output image
7583pub fn mask_gaussian_band_with_opts(
7584    width: i32,
7585    height: i32,
7586    frequency_cutoff_x: f64,
7587    frequency_cutoff_y: f64,
7588    radius: f64,
7589    amplitude_cutoff: f64,
7590    mask_gaussian_band_options: &MaskGaussianBandOptions,
7591) -> Result<VipsImage> {
7592    unsafe {
7593        let width_in: i32 = width;
7594        let height_in: i32 = height;
7595        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7596        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7597        let radius_in: f64 = radius;
7598        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7599        let mut out_out: *mut bindings::VipsImage = null_mut();
7600
7601        let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7602            1
7603        } else {
7604            0
7605        };
7606        let uchar_in_name = utils::new_c_string("uchar")?;
7607
7608        let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7609            1
7610        } else {
7611            0
7612        };
7613        let nodc_in_name = utils::new_c_string("nodc")?;
7614
7615        let reject_in: i32 = if mask_gaussian_band_options.reject {
7616            1
7617        } else {
7618            0
7619        };
7620        let reject_in_name = utils::new_c_string("reject")?;
7621
7622        let optical_in: i32 = if mask_gaussian_band_options.optical {
7623            1
7624        } else {
7625            0
7626        };
7627        let optical_in_name = utils::new_c_string("optical")?;
7628
7629        let vips_op_response = bindings::vips_mask_gaussian_band(
7630            &mut out_out,
7631            width_in,
7632            height_in,
7633            frequency_cutoff_x_in,
7634            frequency_cutoff_y_in,
7635            radius_in,
7636            amplitude_cutoff_in,
7637            uchar_in_name.as_ptr(),
7638            uchar_in,
7639            nodc_in_name.as_ptr(),
7640            nodc_in,
7641            reject_in_name.as_ptr(),
7642            reject_in,
7643            optical_in_name.as_ptr(),
7644            optical_in,
7645            NULL,
7646        );
7647        utils::result(
7648            vips_op_response,
7649            VipsImage { ctx: out_out },
7650            Error::MaskGaussianBandError,
7651        )
7652    }
7653}
7654
7655/// VipsMaskFractal (mask_fractal), make fractal filter
7656/// width: `i32` -> Image width in pixels
7657/// min: 1, max: 100000000, default: 1
7658/// height: `i32` -> Image height in pixels
7659/// min: 1, max: 100000000, default: 1
7660/// fractal_dimension: `f64` -> Fractal dimension
7661/// min: 2, max: 3, default: 2.5
7662/// returns `VipsImage` - Output image
7663pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7664    unsafe {
7665        let width_in: i32 = width;
7666        let height_in: i32 = height;
7667        let fractal_dimension_in: f64 = fractal_dimension;
7668        let mut out_out: *mut bindings::VipsImage = null_mut();
7669
7670        let vips_op_response = bindings::vips_mask_fractal(
7671            &mut out_out,
7672            width_in,
7673            height_in,
7674            fractal_dimension_in,
7675            NULL,
7676        );
7677        utils::result(
7678            vips_op_response,
7679            VipsImage { ctx: out_out },
7680            Error::MaskFractalError,
7681        )
7682    }
7683}
7684
7685/// Options for mask_fractal operation
7686#[derive(Clone, Debug)]
7687pub struct MaskFractalOptions {
7688    /// uchar: `bool` -> Output an unsigned char image
7689    /// default: false
7690    pub uchar: bool,
7691    /// nodc: `bool` -> Remove DC component
7692    /// default: false
7693    pub nodc: bool,
7694    /// reject: `bool` -> Invert the sense of the filter
7695    /// default: false
7696    pub reject: bool,
7697    /// optical: `bool` -> Rotate quadrants to optical space
7698    /// default: false
7699    pub optical: bool,
7700}
7701
7702impl std::default::Default for MaskFractalOptions {
7703    fn default() -> Self {
7704        MaskFractalOptions {
7705            uchar: false,
7706            nodc: false,
7707            reject: false,
7708            optical: false,
7709        }
7710    }
7711}
7712
7713/// VipsMaskFractal (mask_fractal), make fractal filter
7714/// width: `i32` -> Image width in pixels
7715/// min: 1, max: 100000000, default: 1
7716/// height: `i32` -> Image height in pixels
7717/// min: 1, max: 100000000, default: 1
7718/// fractal_dimension: `f64` -> Fractal dimension
7719/// min: 2, max: 3, default: 2.5
7720/// mask_fractal_options: `&MaskFractalOptions` -> optional arguments
7721/// returns `VipsImage` - Output image
7722pub fn mask_fractal_with_opts(
7723    width: i32,
7724    height: i32,
7725    fractal_dimension: f64,
7726    mask_fractal_options: &MaskFractalOptions,
7727) -> Result<VipsImage> {
7728    unsafe {
7729        let width_in: i32 = width;
7730        let height_in: i32 = height;
7731        let fractal_dimension_in: f64 = fractal_dimension;
7732        let mut out_out: *mut bindings::VipsImage = null_mut();
7733
7734        let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7735        let uchar_in_name = utils::new_c_string("uchar")?;
7736
7737        let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7738        let nodc_in_name = utils::new_c_string("nodc")?;
7739
7740        let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7741        let reject_in_name = utils::new_c_string("reject")?;
7742
7743        let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7744        let optical_in_name = utils::new_c_string("optical")?;
7745
7746        let vips_op_response = bindings::vips_mask_fractal(
7747            &mut out_out,
7748            width_in,
7749            height_in,
7750            fractal_dimension_in,
7751            uchar_in_name.as_ptr(),
7752            uchar_in,
7753            nodc_in_name.as_ptr(),
7754            nodc_in,
7755            reject_in_name.as_ptr(),
7756            reject_in,
7757            optical_in_name.as_ptr(),
7758            optical_in,
7759            NULL,
7760        );
7761        utils::result(
7762            vips_op_response,
7763            VipsImage { ctx: out_out },
7764            Error::MaskFractalError,
7765        )
7766    }
7767}
7768
7769/// VipsBuildlut (buildlut), build a look-up table
7770/// inp: `&VipsImage` -> Matrix of XY coordinates
7771/// returns `VipsImage` - Output image
7772pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7773    unsafe {
7774        let inp_in: *mut bindings::VipsImage = inp.ctx;
7775        let mut out_out: *mut bindings::VipsImage = null_mut();
7776
7777        let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7778        utils::result(
7779            vips_op_response,
7780            VipsImage { ctx: out_out },
7781            Error::BuildlutError,
7782        )
7783    }
7784}
7785
7786/// VipsInvertlut (invertlut), build an inverted look-up table
7787/// inp: `&VipsImage` -> Matrix of XY coordinates
7788/// returns `VipsImage` - Output image
7789pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7790    unsafe {
7791        let inp_in: *mut bindings::VipsImage = inp.ctx;
7792        let mut out_out: *mut bindings::VipsImage = null_mut();
7793
7794        let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7795        utils::result(
7796            vips_op_response,
7797            VipsImage { ctx: out_out },
7798            Error::InvertlutError,
7799        )
7800    }
7801}
7802
7803/// Options for invertlut operation
7804#[derive(Clone, Debug)]
7805pub struct InvertlutOptions {
7806    /// size: `i32` -> LUT size to generate
7807    /// min: 1, max: 1000000, default: 256
7808    pub size: i32,
7809}
7810
7811impl std::default::Default for InvertlutOptions {
7812    fn default() -> Self {
7813        InvertlutOptions {
7814            size: i32::from(256),
7815        }
7816    }
7817}
7818
7819/// VipsInvertlut (invertlut), build an inverted look-up table
7820/// inp: `&VipsImage` -> Matrix of XY coordinates
7821/// invertlut_options: `&InvertlutOptions` -> optional arguments
7822/// returns `VipsImage` - Output image
7823pub fn invertlut_with_opts(
7824    inp: &VipsImage,
7825    invertlut_options: &InvertlutOptions,
7826) -> Result<VipsImage> {
7827    unsafe {
7828        let inp_in: *mut bindings::VipsImage = inp.ctx;
7829        let mut out_out: *mut bindings::VipsImage = null_mut();
7830
7831        let size_in: i32 = invertlut_options.size;
7832        let size_in_name = utils::new_c_string("size")?;
7833
7834        let vips_op_response =
7835            bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7836        utils::result(
7837            vips_op_response,
7838            VipsImage { ctx: out_out },
7839            Error::InvertlutError,
7840        )
7841    }
7842}
7843
7844/// VipsTonelut (tonelut), build a look-up table
7845
7846/// returns `VipsImage` - Output image
7847pub fn tonelut() -> Result<VipsImage> {
7848    unsafe {
7849        let mut out_out: *mut bindings::VipsImage = null_mut();
7850
7851        let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7852        utils::result(
7853            vips_op_response,
7854            VipsImage { ctx: out_out },
7855            Error::TonelutError,
7856        )
7857    }
7858}
7859
7860/// Options for tonelut operation
7861#[derive(Clone, Debug)]
7862pub struct TonelutOptions {
7863    /// in_max: `i32` -> Size of LUT to build
7864    /// min: 1, max: 65535, default: 32767
7865    pub in_max: i32,
7866    /// out_max: `i32` -> Maximum value in output LUT
7867    /// min: 1, max: 65535, default: 32767
7868    pub out_max: i32,
7869    /// lb: `f64` -> Lowest value in output
7870    /// min: 0, max: 100, default: 0
7871    pub lb: f64,
7872    /// lw: `f64` -> Highest value in output
7873    /// min: 0, max: 100, default: 100
7874    pub lw: f64,
7875    /// ps: `f64` -> Position of shadow
7876    /// min: 0, max: 1, default: 0.2
7877    pub ps: f64,
7878    /// pm: `f64` -> Position of mid-tones
7879    /// min: 0, max: 1, default: 0.5
7880    pub pm: f64,
7881    /// ph: `f64` -> Position of highlights
7882    /// min: 0, max: 1, default: 0.8
7883    pub ph: f64,
7884    /// s: `f64` -> Adjust shadows by this much
7885    /// min: -30, max: 30, default: 0
7886    pub s: f64,
7887    /// m: `f64` -> Adjust mid-tones by this much
7888    /// min: -30, max: 30, default: 0
7889    pub m: f64,
7890    /// h: `f64` -> Adjust highlights by this much
7891    /// min: -30, max: 30, default: 0
7892    pub h: f64,
7893}
7894
7895impl std::default::Default for TonelutOptions {
7896    fn default() -> Self {
7897        TonelutOptions {
7898            in_max: i32::from(32767),
7899            out_max: i32::from(32767),
7900            lb: f64::from(0),
7901            lw: f64::from(100),
7902            ps: f64::from(0.2),
7903            pm: f64::from(0.5),
7904            ph: f64::from(0.8),
7905            s: f64::from(0),
7906            m: f64::from(0),
7907            h: f64::from(0),
7908        }
7909    }
7910}
7911
7912/// VipsTonelut (tonelut), build a look-up table
7913
7914/// tonelut_options: `&TonelutOptions` -> optional arguments
7915/// returns `VipsImage` - Output image
7916pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7917    unsafe {
7918        let mut out_out: *mut bindings::VipsImage = null_mut();
7919
7920        let in_max_in: i32 = tonelut_options.in_max;
7921        let in_max_in_name = utils::new_c_string("in-max")?;
7922
7923        let out_max_in: i32 = tonelut_options.out_max;
7924        let out_max_in_name = utils::new_c_string("out-max")?;
7925
7926        let lb_in: f64 = tonelut_options.lb;
7927        let lb_in_name = utils::new_c_string("Lb")?;
7928
7929        let lw_in: f64 = tonelut_options.lw;
7930        let lw_in_name = utils::new_c_string("Lw")?;
7931
7932        let ps_in: f64 = tonelut_options.ps;
7933        let ps_in_name = utils::new_c_string("Ps")?;
7934
7935        let pm_in: f64 = tonelut_options.pm;
7936        let pm_in_name = utils::new_c_string("Pm")?;
7937
7938        let ph_in: f64 = tonelut_options.ph;
7939        let ph_in_name = utils::new_c_string("Ph")?;
7940
7941        let s_in: f64 = tonelut_options.s;
7942        let s_in_name = utils::new_c_string("S")?;
7943
7944        let m_in: f64 = tonelut_options.m;
7945        let m_in_name = utils::new_c_string("M")?;
7946
7947        let h_in: f64 = tonelut_options.h;
7948        let h_in_name = utils::new_c_string("H")?;
7949
7950        let vips_op_response = bindings::vips_tonelut(
7951            &mut out_out,
7952            in_max_in_name.as_ptr(),
7953            in_max_in,
7954            out_max_in_name.as_ptr(),
7955            out_max_in,
7956            lb_in_name.as_ptr(),
7957            lb_in,
7958            lw_in_name.as_ptr(),
7959            lw_in,
7960            ps_in_name.as_ptr(),
7961            ps_in,
7962            pm_in_name.as_ptr(),
7963            pm_in,
7964            ph_in_name.as_ptr(),
7965            ph_in,
7966            s_in_name.as_ptr(),
7967            s_in,
7968            m_in_name.as_ptr(),
7969            m_in,
7970            h_in_name.as_ptr(),
7971            h_in,
7972            NULL,
7973        );
7974        utils::result(
7975            vips_op_response,
7976            VipsImage { ctx: out_out },
7977            Error::TonelutError,
7978        )
7979    }
7980}
7981
7982/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7983
7984/// returns `VipsImage` - Output image
7985pub fn identity() -> Result<VipsImage> {
7986    unsafe {
7987        let mut out_out: *mut bindings::VipsImage = null_mut();
7988
7989        let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7990        utils::result(
7991            vips_op_response,
7992            VipsImage { ctx: out_out },
7993            Error::IdentityError,
7994        )
7995    }
7996}
7997
7998/// Options for identity operation
7999#[derive(Clone, Debug)]
8000pub struct IdentityOptions {
8001    /// bands: `i32` -> Number of bands in LUT
8002    /// min: 1, max: 100000, default: 1
8003    pub bands: i32,
8004    /// ushort: `bool` -> Create a 16-bit LUT
8005    /// default: false
8006    pub ushort: bool,
8007    /// size: `i32` -> Size of 16-bit LUT
8008    /// min: 1, max: 65536, default: 65536
8009    pub size: i32,
8010}
8011
8012impl std::default::Default for IdentityOptions {
8013    fn default() -> Self {
8014        IdentityOptions {
8015            bands: i32::from(1),
8016            ushort: false,
8017            size: i32::from(65536),
8018        }
8019    }
8020}
8021
8022/// VipsIdentity (identity), make a 1D image where pixel values are indexes
8023
8024/// identity_options: `&IdentityOptions` -> optional arguments
8025/// returns `VipsImage` - Output image
8026pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
8027    unsafe {
8028        let mut out_out: *mut bindings::VipsImage = null_mut();
8029
8030        let bands_in: i32 = identity_options.bands;
8031        let bands_in_name = utils::new_c_string("bands")?;
8032
8033        let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
8034        let ushort_in_name = utils::new_c_string("ushort")?;
8035
8036        let size_in: i32 = identity_options.size;
8037        let size_in_name = utils::new_c_string("size")?;
8038
8039        let vips_op_response = bindings::vips_identity(
8040            &mut out_out,
8041            bands_in_name.as_ptr(),
8042            bands_in,
8043            ushort_in_name.as_ptr(),
8044            ushort_in,
8045            size_in_name.as_ptr(),
8046            size_in,
8047            NULL,
8048        );
8049        utils::result(
8050            vips_op_response,
8051            VipsImage { ctx: out_out },
8052            Error::IdentityError,
8053        )
8054    }
8055}
8056
8057/// VipsFractsurf (fractsurf), make a fractal surface
8058/// width: `i32` -> Image width in pixels
8059/// min: 1, max: 100000000, default: 64
8060/// height: `i32` -> Image height in pixels
8061/// min: 1, max: 100000000, default: 64
8062/// fractal_dimension: `f64` -> Fractal dimension
8063/// min: 2, max: 3, default: 2.5
8064/// returns `VipsImage` - Output image
8065pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
8066    unsafe {
8067        let width_in: i32 = width;
8068        let height_in: i32 = height;
8069        let fractal_dimension_in: f64 = fractal_dimension;
8070        let mut out_out: *mut bindings::VipsImage = null_mut();
8071
8072        let vips_op_response = bindings::vips_fractsurf(
8073            &mut out_out,
8074            width_in,
8075            height_in,
8076            fractal_dimension_in,
8077            NULL,
8078        );
8079        utils::result(
8080            vips_op_response,
8081            VipsImage { ctx: out_out },
8082            Error::FractsurfError,
8083        )
8084    }
8085}
8086
8087/// VipsWorley (worley), make a worley noise image
8088/// width: `i32` -> Image width in pixels
8089/// min: 1, max: 100000000, default: 1
8090/// height: `i32` -> Image height in pixels
8091/// min: 1, max: 100000000, default: 1
8092/// returns `VipsImage` - Output image
8093pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
8094    unsafe {
8095        let width_in: i32 = width;
8096        let height_in: i32 = height;
8097        let mut out_out: *mut bindings::VipsImage = null_mut();
8098
8099        let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
8100        utils::result(
8101            vips_op_response,
8102            VipsImage { ctx: out_out },
8103            Error::WorleyError,
8104        )
8105    }
8106}
8107
8108/// Options for worley operation
8109#[derive(Clone, Debug)]
8110pub struct WorleyOptions {
8111    /// cell_size: `i32` -> Size of Worley cells
8112    /// min: 1, max: 100000000, default: 256
8113    pub cell_size: i32,
8114    /// seed: `i32` -> Random number seed
8115    /// min: -2147483648, max: 2147483647, default: 0
8116    pub seed: i32,
8117}
8118
8119impl std::default::Default for WorleyOptions {
8120    fn default() -> Self {
8121        WorleyOptions {
8122            cell_size: i32::from(256),
8123            seed: i32::from(0),
8124        }
8125    }
8126}
8127
8128/// VipsWorley (worley), make a worley noise image
8129/// width: `i32` -> Image width in pixels
8130/// min: 1, max: 100000000, default: 1
8131/// height: `i32` -> Image height in pixels
8132/// min: 1, max: 100000000, default: 1
8133/// worley_options: `&WorleyOptions` -> optional arguments
8134/// returns `VipsImage` - Output image
8135pub fn worley_with_opts(
8136    width: i32,
8137    height: i32,
8138    worley_options: &WorleyOptions,
8139) -> Result<VipsImage> {
8140    unsafe {
8141        let width_in: i32 = width;
8142        let height_in: i32 = height;
8143        let mut out_out: *mut bindings::VipsImage = null_mut();
8144
8145        let cell_size_in: i32 = worley_options.cell_size;
8146        let cell_size_in_name = utils::new_c_string("cell-size")?;
8147
8148        let seed_in: i32 = worley_options.seed;
8149        let seed_in_name = utils::new_c_string("seed")?;
8150
8151        let vips_op_response = bindings::vips_worley(
8152            &mut out_out,
8153            width_in,
8154            height_in,
8155            cell_size_in_name.as_ptr(),
8156            cell_size_in,
8157            seed_in_name.as_ptr(),
8158            seed_in,
8159            NULL,
8160        );
8161        utils::result(
8162            vips_op_response,
8163            VipsImage { ctx: out_out },
8164            Error::WorleyError,
8165        )
8166    }
8167}
8168
8169/// VipsPerlin (perlin), make a perlin noise image
8170/// width: `i32` -> Image width in pixels
8171/// min: 1, max: 100000000, default: 1
8172/// height: `i32` -> Image height in pixels
8173/// min: 1, max: 100000000, default: 1
8174/// returns `VipsImage` - Output image
8175pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8176    unsafe {
8177        let width_in: i32 = width;
8178        let height_in: i32 = height;
8179        let mut out_out: *mut bindings::VipsImage = null_mut();
8180
8181        let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8182        utils::result(
8183            vips_op_response,
8184            VipsImage { ctx: out_out },
8185            Error::PerlinError,
8186        )
8187    }
8188}
8189
8190/// Options for perlin operation
8191#[derive(Clone, Debug)]
8192pub struct PerlinOptions {
8193    /// cell_size: `i32` -> Size of Perlin cells
8194    /// min: 1, max: 100000000, default: 256
8195    pub cell_size: i32,
8196    /// uchar: `bool` -> Output an unsigned char image
8197    /// default: false
8198    pub uchar: bool,
8199    /// seed: `i32` -> Random number seed
8200    /// min: -2147483648, max: 2147483647, default: 0
8201    pub seed: i32,
8202}
8203
8204impl std::default::Default for PerlinOptions {
8205    fn default() -> Self {
8206        PerlinOptions {
8207            cell_size: i32::from(256),
8208            uchar: false,
8209            seed: i32::from(0),
8210        }
8211    }
8212}
8213
8214/// VipsPerlin (perlin), make a perlin noise image
8215/// width: `i32` -> Image width in pixels
8216/// min: 1, max: 100000000, default: 1
8217/// height: `i32` -> Image height in pixels
8218/// min: 1, max: 100000000, default: 1
8219/// perlin_options: `&PerlinOptions` -> optional arguments
8220/// returns `VipsImage` - Output image
8221pub fn perlin_with_opts(
8222    width: i32,
8223    height: i32,
8224    perlin_options: &PerlinOptions,
8225) -> Result<VipsImage> {
8226    unsafe {
8227        let width_in: i32 = width;
8228        let height_in: i32 = height;
8229        let mut out_out: *mut bindings::VipsImage = null_mut();
8230
8231        let cell_size_in: i32 = perlin_options.cell_size;
8232        let cell_size_in_name = utils::new_c_string("cell-size")?;
8233
8234        let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8235        let uchar_in_name = utils::new_c_string("uchar")?;
8236
8237        let seed_in: i32 = perlin_options.seed;
8238        let seed_in_name = utils::new_c_string("seed")?;
8239
8240        let vips_op_response = bindings::vips_perlin(
8241            &mut out_out,
8242            width_in,
8243            height_in,
8244            cell_size_in_name.as_ptr(),
8245            cell_size_in,
8246            uchar_in_name.as_ptr(),
8247            uchar_in,
8248            seed_in_name.as_ptr(),
8249            seed_in,
8250            NULL,
8251        );
8252        utils::result(
8253            vips_op_response,
8254            VipsImage { ctx: out_out },
8255            Error::PerlinError,
8256        )
8257    }
8258}
8259
8260/// VipsSwitch (switch), find the index of the first non-zero pixel in tests
8261/// tests: `&mut [VipsImage]` -> Table of images to test
8262/// returns `VipsImage` - Output image
8263pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8264    unsafe {
8265        let (tests_len, mut tests_in) = {
8266            let len = tests.len();
8267            let mut input = Vec::new();
8268            for img in tests {
8269                input.push(img.ctx)
8270            }
8271            (len as i32, input)
8272        };
8273        let mut out_out: *mut bindings::VipsImage = null_mut();
8274
8275        let vips_op_response =
8276            bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8277        utils::result(
8278            vips_op_response,
8279            VipsImage { ctx: out_out },
8280            Error::SwitchError,
8281        )
8282    }
8283}
8284
8285/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8286/// filename: `&str` -> Filename to load from
8287/// returns `VipsImage` - Output image
8288pub fn csvload(filename: &str) -> Result<VipsImage> {
8289    unsafe {
8290        let filename_in: CString = utils::new_c_string(filename)?;
8291        let mut out_out: *mut bindings::VipsImage = null_mut();
8292
8293        let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8294        utils::result(
8295            vips_op_response,
8296            VipsImage { ctx: out_out },
8297            Error::CsvloadError,
8298        )
8299    }
8300}
8301
8302/// Options for csvload operation
8303#[derive(Clone, Debug)]
8304pub struct CsvloadOptions {
8305    /// skip: `i32` -> Skip this many lines at the start of the file
8306    /// min: 0, max: 10000000, default: 0
8307    pub skip: i32,
8308    /// lines: `i32` -> Read this many lines from the file
8309    /// min: -1, max: 10000000, default: -1
8310    pub lines: i32,
8311    /// whitespace: `String` -> Set of whitespace characters
8312    pub whitespace: String,
8313    /// separator: `String` -> Set of separator characters
8314    pub separator: String,
8315    /// flags: `ForeignFlags` -> Flags for this file
8316    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8317    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8318    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8319    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8320    ///  `All` -> VIPS_FOREIGN_ALL = 7
8321    pub flags: ForeignFlags,
8322    /// memory: `bool` -> Force open via memory
8323    /// default: false
8324    pub memory: bool,
8325    /// access: `Access` -> Required access pattern for this file
8326    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8327    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8328    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8329    ///  `Last` -> VIPS_ACCESS_LAST = 3
8330    pub access: Access,
8331    /// fail_on: `FailOn` -> Error level to fail on
8332    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8333    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8334    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8335    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8336    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8337    pub fail_on: FailOn,
8338    /// revalidate: `bool` -> Don't use a cached result for this operation
8339    /// default: false
8340    pub revalidate: bool,
8341}
8342
8343impl std::default::Default for CsvloadOptions {
8344    fn default() -> Self {
8345        CsvloadOptions {
8346            skip: i32::from(0),
8347            lines: i32::from(-1),
8348            whitespace: String::new(),
8349            separator: String::new(),
8350            flags: ForeignFlags::None,
8351            memory: false,
8352            access: Access::Random,
8353            fail_on: FailOn::None,
8354            revalidate: false,
8355        }
8356    }
8357}
8358
8359/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8360/// filename: `&str` -> Filename to load from
8361/// csvload_options: `&CsvloadOptions` -> optional arguments
8362/// returns `VipsImage` - Output image
8363pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8364    unsafe {
8365        let filename_in: CString = utils::new_c_string(filename)?;
8366        let mut out_out: *mut bindings::VipsImage = null_mut();
8367
8368        let skip_in: i32 = csvload_options.skip;
8369        let skip_in_name = utils::new_c_string("skip")?;
8370
8371        let lines_in: i32 = csvload_options.lines;
8372        let lines_in_name = utils::new_c_string("lines")?;
8373
8374        let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8375        let whitespace_in_name = utils::new_c_string("whitespace")?;
8376
8377        let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8378        let separator_in_name = utils::new_c_string("separator")?;
8379
8380        let flags_in: i32 = csvload_options.flags as i32;
8381        let flags_in_name = utils::new_c_string("flags")?;
8382
8383        let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8384        let memory_in_name = utils::new_c_string("memory")?;
8385
8386        let access_in: i32 = csvload_options.access as i32;
8387        let access_in_name = utils::new_c_string("access")?;
8388
8389        let fail_on_in: i32 = csvload_options.fail_on as i32;
8390        let fail_on_in_name = utils::new_c_string("fail-on")?;
8391
8392        let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8393        let revalidate_in_name = utils::new_c_string("revalidate")?;
8394
8395        let vips_op_response = bindings::vips_csvload(
8396            filename_in.as_ptr(),
8397            &mut out_out,
8398            skip_in_name.as_ptr(),
8399            skip_in,
8400            lines_in_name.as_ptr(),
8401            lines_in,
8402            whitespace_in_name.as_ptr(),
8403            whitespace_in.as_ptr(),
8404            separator_in_name.as_ptr(),
8405            separator_in.as_ptr(),
8406            flags_in_name.as_ptr(),
8407            flags_in,
8408            memory_in_name.as_ptr(),
8409            memory_in,
8410            access_in_name.as_ptr(),
8411            access_in,
8412            fail_on_in_name.as_ptr(),
8413            fail_on_in,
8414            revalidate_in_name.as_ptr(),
8415            revalidate_in,
8416            NULL,
8417        );
8418        utils::result(
8419            vips_op_response,
8420            VipsImage { ctx: out_out },
8421            Error::CsvloadError,
8422        )
8423    }
8424}
8425
8426/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8427/// source: `&VipsSource` -> Source to load from
8428/// returns `VipsImage` - Output image
8429pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8430    unsafe {
8431        let source_in: *mut bindings::VipsSource = source.ctx;
8432        let mut out_out: *mut bindings::VipsImage = null_mut();
8433
8434        let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8435        utils::result(
8436            vips_op_response,
8437            VipsImage { ctx: out_out },
8438            Error::CsvloadSourceError,
8439        )
8440    }
8441}
8442
8443/// Options for csvload_source operation
8444#[derive(Clone, Debug)]
8445pub struct CsvloadSourceOptions {
8446    /// skip: `i32` -> Skip this many lines at the start of the file
8447    /// min: 0, max: 10000000, default: 0
8448    pub skip: i32,
8449    /// lines: `i32` -> Read this many lines from the file
8450    /// min: -1, max: 10000000, default: -1
8451    pub lines: i32,
8452    /// whitespace: `String` -> Set of whitespace characters
8453    pub whitespace: String,
8454    /// separator: `String` -> Set of separator characters
8455    pub separator: String,
8456    /// flags: `ForeignFlags` -> Flags for this file
8457    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8458    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8459    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8460    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8461    ///  `All` -> VIPS_FOREIGN_ALL = 7
8462    pub flags: ForeignFlags,
8463    /// memory: `bool` -> Force open via memory
8464    /// default: false
8465    pub memory: bool,
8466    /// access: `Access` -> Required access pattern for this file
8467    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8468    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8469    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8470    ///  `Last` -> VIPS_ACCESS_LAST = 3
8471    pub access: Access,
8472    /// fail_on: `FailOn` -> Error level to fail on
8473    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8474    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8475    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8476    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8477    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8478    pub fail_on: FailOn,
8479    /// revalidate: `bool` -> Don't use a cached result for this operation
8480    /// default: false
8481    pub revalidate: bool,
8482}
8483
8484impl std::default::Default for CsvloadSourceOptions {
8485    fn default() -> Self {
8486        CsvloadSourceOptions {
8487            skip: i32::from(0),
8488            lines: i32::from(-1),
8489            whitespace: String::new(),
8490            separator: String::new(),
8491            flags: ForeignFlags::None,
8492            memory: false,
8493            access: Access::Random,
8494            fail_on: FailOn::None,
8495            revalidate: false,
8496        }
8497    }
8498}
8499
8500/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8501/// source: `&VipsSource` -> Source to load from
8502/// csvload_source_options: `&CsvloadSourceOptions` -> optional arguments
8503/// returns `VipsImage` - Output image
8504pub fn csvload_source_with_opts(
8505    source: &VipsSource,
8506    csvload_source_options: &CsvloadSourceOptions,
8507) -> Result<VipsImage> {
8508    unsafe {
8509        let source_in: *mut bindings::VipsSource = source.ctx;
8510        let mut out_out: *mut bindings::VipsImage = null_mut();
8511
8512        let skip_in: i32 = csvload_source_options.skip;
8513        let skip_in_name = utils::new_c_string("skip")?;
8514
8515        let lines_in: i32 = csvload_source_options.lines;
8516        let lines_in_name = utils::new_c_string("lines")?;
8517
8518        let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8519        let whitespace_in_name = utils::new_c_string("whitespace")?;
8520
8521        let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8522        let separator_in_name = utils::new_c_string("separator")?;
8523
8524        let flags_in: i32 = csvload_source_options.flags as i32;
8525        let flags_in_name = utils::new_c_string("flags")?;
8526
8527        let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8528        let memory_in_name = utils::new_c_string("memory")?;
8529
8530        let access_in: i32 = csvload_source_options.access as i32;
8531        let access_in_name = utils::new_c_string("access")?;
8532
8533        let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8534        let fail_on_in_name = utils::new_c_string("fail-on")?;
8535
8536        let revalidate_in: i32 = if csvload_source_options.revalidate {
8537            1
8538        } else {
8539            0
8540        };
8541        let revalidate_in_name = utils::new_c_string("revalidate")?;
8542
8543        let vips_op_response = bindings::vips_csvload_source(
8544            source_in,
8545            &mut out_out,
8546            skip_in_name.as_ptr(),
8547            skip_in,
8548            lines_in_name.as_ptr(),
8549            lines_in,
8550            whitespace_in_name.as_ptr(),
8551            whitespace_in.as_ptr(),
8552            separator_in_name.as_ptr(),
8553            separator_in.as_ptr(),
8554            flags_in_name.as_ptr(),
8555            flags_in,
8556            memory_in_name.as_ptr(),
8557            memory_in,
8558            access_in_name.as_ptr(),
8559            access_in,
8560            fail_on_in_name.as_ptr(),
8561            fail_on_in,
8562            revalidate_in_name.as_ptr(),
8563            revalidate_in,
8564            NULL,
8565        );
8566        utils::result(
8567            vips_op_response,
8568            VipsImage { ctx: out_out },
8569            Error::CsvloadSourceError,
8570        )
8571    }
8572}
8573
8574/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8575/// filename: `&str` -> Filename to load from
8576/// returns `VipsImage` - Output image
8577pub fn matrixload(filename: &str) -> Result<VipsImage> {
8578    unsafe {
8579        let filename_in: CString = utils::new_c_string(filename)?;
8580        let mut out_out: *mut bindings::VipsImage = null_mut();
8581
8582        let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8583        utils::result(
8584            vips_op_response,
8585            VipsImage { ctx: out_out },
8586            Error::MatrixloadError,
8587        )
8588    }
8589}
8590
8591/// Options for matrixload operation
8592#[derive(Clone, Debug)]
8593pub struct MatrixloadOptions {
8594    /// flags: `ForeignFlags` -> Flags for this file
8595    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8596    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8597    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8598    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8599    ///  `All` -> VIPS_FOREIGN_ALL = 7
8600    pub flags: ForeignFlags,
8601    /// memory: `bool` -> Force open via memory
8602    /// default: false
8603    pub memory: bool,
8604    /// access: `Access` -> Required access pattern for this file
8605    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8606    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8607    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8608    ///  `Last` -> VIPS_ACCESS_LAST = 3
8609    pub access: Access,
8610    /// fail_on: `FailOn` -> Error level to fail on
8611    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8612    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8613    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8614    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8615    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8616    pub fail_on: FailOn,
8617    /// revalidate: `bool` -> Don't use a cached result for this operation
8618    /// default: false
8619    pub revalidate: bool,
8620}
8621
8622impl std::default::Default for MatrixloadOptions {
8623    fn default() -> Self {
8624        MatrixloadOptions {
8625            flags: ForeignFlags::None,
8626            memory: false,
8627            access: Access::Random,
8628            fail_on: FailOn::None,
8629            revalidate: false,
8630        }
8631    }
8632}
8633
8634/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8635/// filename: `&str` -> Filename to load from
8636/// matrixload_options: `&MatrixloadOptions` -> optional arguments
8637/// returns `VipsImage` - Output image
8638pub fn matrixload_with_opts(
8639    filename: &str,
8640    matrixload_options: &MatrixloadOptions,
8641) -> Result<VipsImage> {
8642    unsafe {
8643        let filename_in: CString = utils::new_c_string(filename)?;
8644        let mut out_out: *mut bindings::VipsImage = null_mut();
8645
8646        let flags_in: i32 = matrixload_options.flags as i32;
8647        let flags_in_name = utils::new_c_string("flags")?;
8648
8649        let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8650        let memory_in_name = utils::new_c_string("memory")?;
8651
8652        let access_in: i32 = matrixload_options.access as i32;
8653        let access_in_name = utils::new_c_string("access")?;
8654
8655        let fail_on_in: i32 = matrixload_options.fail_on as i32;
8656        let fail_on_in_name = utils::new_c_string("fail-on")?;
8657
8658        let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8659        let revalidate_in_name = utils::new_c_string("revalidate")?;
8660
8661        let vips_op_response = bindings::vips_matrixload(
8662            filename_in.as_ptr(),
8663            &mut out_out,
8664            flags_in_name.as_ptr(),
8665            flags_in,
8666            memory_in_name.as_ptr(),
8667            memory_in,
8668            access_in_name.as_ptr(),
8669            access_in,
8670            fail_on_in_name.as_ptr(),
8671            fail_on_in,
8672            revalidate_in_name.as_ptr(),
8673            revalidate_in,
8674            NULL,
8675        );
8676        utils::result(
8677            vips_op_response,
8678            VipsImage { ctx: out_out },
8679            Error::MatrixloadError,
8680        )
8681    }
8682}
8683
8684/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8685/// source: `&VipsSource` -> Source to load from
8686/// returns `VipsImage` - Output image
8687pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8688    unsafe {
8689        let source_in: *mut bindings::VipsSource = source.ctx;
8690        let mut out_out: *mut bindings::VipsImage = null_mut();
8691
8692        let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8693        utils::result(
8694            vips_op_response,
8695            VipsImage { ctx: out_out },
8696            Error::MatrixloadSourceError,
8697        )
8698    }
8699}
8700
8701/// Options for matrixload_source operation
8702#[derive(Clone, Debug)]
8703pub struct MatrixloadSourceOptions {
8704    /// flags: `ForeignFlags` -> Flags for this file
8705    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8706    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8707    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8708    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8709    ///  `All` -> VIPS_FOREIGN_ALL = 7
8710    pub flags: ForeignFlags,
8711    /// memory: `bool` -> Force open via memory
8712    /// default: false
8713    pub memory: bool,
8714    /// access: `Access` -> Required access pattern for this file
8715    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8716    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8717    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8718    ///  `Last` -> VIPS_ACCESS_LAST = 3
8719    pub access: Access,
8720    /// fail_on: `FailOn` -> Error level to fail on
8721    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8722    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8723    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8724    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8725    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8726    pub fail_on: FailOn,
8727    /// revalidate: `bool` -> Don't use a cached result for this operation
8728    /// default: false
8729    pub revalidate: bool,
8730}
8731
8732impl std::default::Default for MatrixloadSourceOptions {
8733    fn default() -> Self {
8734        MatrixloadSourceOptions {
8735            flags: ForeignFlags::None,
8736            memory: false,
8737            access: Access::Random,
8738            fail_on: FailOn::None,
8739            revalidate: false,
8740        }
8741    }
8742}
8743
8744/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8745/// source: `&VipsSource` -> Source to load from
8746/// matrixload_source_options: `&MatrixloadSourceOptions` -> optional arguments
8747/// returns `VipsImage` - Output image
8748pub fn matrixload_source_with_opts(
8749    source: &VipsSource,
8750    matrixload_source_options: &MatrixloadSourceOptions,
8751) -> Result<VipsImage> {
8752    unsafe {
8753        let source_in: *mut bindings::VipsSource = source.ctx;
8754        let mut out_out: *mut bindings::VipsImage = null_mut();
8755
8756        let flags_in: i32 = matrixload_source_options.flags as i32;
8757        let flags_in_name = utils::new_c_string("flags")?;
8758
8759        let memory_in: i32 = if matrixload_source_options.memory {
8760            1
8761        } else {
8762            0
8763        };
8764        let memory_in_name = utils::new_c_string("memory")?;
8765
8766        let access_in: i32 = matrixload_source_options.access as i32;
8767        let access_in_name = utils::new_c_string("access")?;
8768
8769        let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8770        let fail_on_in_name = utils::new_c_string("fail-on")?;
8771
8772        let revalidate_in: i32 = if matrixload_source_options.revalidate {
8773            1
8774        } else {
8775            0
8776        };
8777        let revalidate_in_name = utils::new_c_string("revalidate")?;
8778
8779        let vips_op_response = bindings::vips_matrixload_source(
8780            source_in,
8781            &mut out_out,
8782            flags_in_name.as_ptr(),
8783            flags_in,
8784            memory_in_name.as_ptr(),
8785            memory_in,
8786            access_in_name.as_ptr(),
8787            access_in,
8788            fail_on_in_name.as_ptr(),
8789            fail_on_in,
8790            revalidate_in_name.as_ptr(),
8791            revalidate_in,
8792            NULL,
8793        );
8794        utils::result(
8795            vips_op_response,
8796            VipsImage { ctx: out_out },
8797            Error::MatrixloadSourceError,
8798        )
8799    }
8800}
8801
8802/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8803/// filename: `&str` -> Filename to load from
8804/// width: `i32` -> Image width in pixels
8805/// min: 0, max: 100000000, default: 0
8806/// height: `i32` -> Image height in pixels
8807/// min: 0, max: 100000000, default: 0
8808/// bands: `i32` -> Number of bands in image
8809/// min: 0, max: 100000000, default: 0
8810/// returns `VipsImage` - Output image
8811pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8812    unsafe {
8813        let filename_in: CString = utils::new_c_string(filename)?;
8814        let width_in: i32 = width;
8815        let height_in: i32 = height;
8816        let bands_in: i32 = bands;
8817        let mut out_out: *mut bindings::VipsImage = null_mut();
8818
8819        let vips_op_response = bindings::vips_rawload(
8820            filename_in.as_ptr(),
8821            &mut out_out,
8822            width_in,
8823            height_in,
8824            bands_in,
8825            NULL,
8826        );
8827        utils::result(
8828            vips_op_response,
8829            VipsImage { ctx: out_out },
8830            Error::RawloadError,
8831        )
8832    }
8833}
8834
8835/// Options for rawload operation
8836#[derive(Clone, Debug)]
8837pub struct RawloadOptions {
8838    /// offset: `u64` -> Offset in bytes from start of file
8839    /// min: 0, max: 100000000000, default: 0
8840    pub offset: u64,
8841    /// format: `BandFormat` -> Pixel format in image
8842    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
8843    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
8844    ///  `Char` -> VIPS_FORMAT_CHAR = 1
8845    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
8846    ///  `Short` -> VIPS_FORMAT_SHORT = 3
8847    ///  `Uint` -> VIPS_FORMAT_UINT = 4
8848    ///  `Int` -> VIPS_FORMAT_INT = 5
8849    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
8850    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
8851    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
8852    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
8853    ///  `Last` -> VIPS_FORMAT_LAST = 10
8854    pub format: BandFormat,
8855    /// interpretation: `Interpretation` -> Pixel interpretation
8856    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
8857    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
8858    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
8859    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
8860    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
8861    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
8862    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
8863    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
8864    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
8865    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
8866    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
8867    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
8868    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
8869    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
8870    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
8871    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
8872    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
8873    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
8874    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
8875    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
8876    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
8877    pub interpretation: Interpretation,
8878    /// flags: `ForeignFlags` -> Flags for this file
8879    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8880    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8881    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8882    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8883    ///  `All` -> VIPS_FOREIGN_ALL = 7
8884    pub flags: ForeignFlags,
8885    /// memory: `bool` -> Force open via memory
8886    /// default: false
8887    pub memory: bool,
8888    /// access: `Access` -> Required access pattern for this file
8889    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8890    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8891    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8892    ///  `Last` -> VIPS_ACCESS_LAST = 3
8893    pub access: Access,
8894    /// fail_on: `FailOn` -> Error level to fail on
8895    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8896    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8897    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8898    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8899    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8900    pub fail_on: FailOn,
8901    /// revalidate: `bool` -> Don't use a cached result for this operation
8902    /// default: false
8903    pub revalidate: bool,
8904}
8905
8906impl std::default::Default for RawloadOptions {
8907    fn default() -> Self {
8908        RawloadOptions {
8909            offset: 0,
8910            format: BandFormat::Uchar,
8911            interpretation: Interpretation::Multiband,
8912            flags: ForeignFlags::None,
8913            memory: false,
8914            access: Access::Random,
8915            fail_on: FailOn::None,
8916            revalidate: false,
8917        }
8918    }
8919}
8920
8921/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8922/// filename: `&str` -> Filename to load from
8923/// width: `i32` -> Image width in pixels
8924/// min: 0, max: 100000000, default: 0
8925/// height: `i32` -> Image height in pixels
8926/// min: 0, max: 100000000, default: 0
8927/// bands: `i32` -> Number of bands in image
8928/// min: 0, max: 100000000, default: 0
8929/// rawload_options: `&RawloadOptions` -> optional arguments
8930/// returns `VipsImage` - Output image
8931pub fn rawload_with_opts(
8932    filename: &str,
8933    width: i32,
8934    height: i32,
8935    bands: i32,
8936    rawload_options: &RawloadOptions,
8937) -> Result<VipsImage> {
8938    unsafe {
8939        let filename_in: CString = utils::new_c_string(filename)?;
8940        let width_in: i32 = width;
8941        let height_in: i32 = height;
8942        let bands_in: i32 = bands;
8943        let mut out_out: *mut bindings::VipsImage = null_mut();
8944
8945        let offset_in: u64 = rawload_options.offset;
8946        let offset_in_name = utils::new_c_string("offset")?;
8947
8948        let format_in: i32 = rawload_options.format as i32;
8949        let format_in_name = utils::new_c_string("format")?;
8950
8951        let interpretation_in: i32 = rawload_options.interpretation as i32;
8952        let interpretation_in_name = utils::new_c_string("interpretation")?;
8953
8954        let flags_in: i32 = rawload_options.flags as i32;
8955        let flags_in_name = utils::new_c_string("flags")?;
8956
8957        let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8958        let memory_in_name = utils::new_c_string("memory")?;
8959
8960        let access_in: i32 = rawload_options.access as i32;
8961        let access_in_name = utils::new_c_string("access")?;
8962
8963        let fail_on_in: i32 = rawload_options.fail_on as i32;
8964        let fail_on_in_name = utils::new_c_string("fail-on")?;
8965
8966        let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8967        let revalidate_in_name = utils::new_c_string("revalidate")?;
8968
8969        let vips_op_response = bindings::vips_rawload(
8970            filename_in.as_ptr(),
8971            &mut out_out,
8972            width_in,
8973            height_in,
8974            bands_in,
8975            offset_in_name.as_ptr(),
8976            offset_in,
8977            format_in_name.as_ptr(),
8978            format_in,
8979            interpretation_in_name.as_ptr(),
8980            interpretation_in,
8981            flags_in_name.as_ptr(),
8982            flags_in,
8983            memory_in_name.as_ptr(),
8984            memory_in,
8985            access_in_name.as_ptr(),
8986            access_in,
8987            fail_on_in_name.as_ptr(),
8988            fail_on_in,
8989            revalidate_in_name.as_ptr(),
8990            revalidate_in,
8991            NULL,
8992        );
8993        utils::result(
8994            vips_op_response,
8995            VipsImage { ctx: out_out },
8996            Error::RawloadError,
8997        )
8998    }
8999}
9000
9001/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
9002/// filename: `&str` -> Filename to load from
9003/// returns `VipsImage` - Output image
9004pub fn vipsload(filename: &str) -> Result<VipsImage> {
9005    unsafe {
9006        let filename_in: CString = utils::new_c_string(filename)?;
9007        let mut out_out: *mut bindings::VipsImage = null_mut();
9008
9009        let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
9010        utils::result(
9011            vips_op_response,
9012            VipsImage { ctx: out_out },
9013            Error::VipsloadError,
9014        )
9015    }
9016}
9017
9018/// Options for vipsload operation
9019#[derive(Clone, Debug)]
9020pub struct VipsloadOptions {
9021    /// flags: `ForeignFlags` -> Flags for this file
9022    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9023    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9024    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9025    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9026    ///  `All` -> VIPS_FOREIGN_ALL = 7
9027    pub flags: ForeignFlags,
9028    /// memory: `bool` -> Force open via memory
9029    /// default: false
9030    pub memory: bool,
9031    /// access: `Access` -> Required access pattern for this file
9032    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9033    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9034    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9035    ///  `Last` -> VIPS_ACCESS_LAST = 3
9036    pub access: Access,
9037    /// fail_on: `FailOn` -> Error level to fail on
9038    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9039    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9040    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9041    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9042    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9043    pub fail_on: FailOn,
9044    /// revalidate: `bool` -> Don't use a cached result for this operation
9045    /// default: false
9046    pub revalidate: bool,
9047}
9048
9049impl std::default::Default for VipsloadOptions {
9050    fn default() -> Self {
9051        VipsloadOptions {
9052            flags: ForeignFlags::None,
9053            memory: false,
9054            access: Access::Random,
9055            fail_on: FailOn::None,
9056            revalidate: false,
9057        }
9058    }
9059}
9060
9061/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
9062/// filename: `&str` -> Filename to load from
9063/// vipsload_options: `&VipsloadOptions` -> optional arguments
9064/// returns `VipsImage` - Output image
9065pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
9066    unsafe {
9067        let filename_in: CString = utils::new_c_string(filename)?;
9068        let mut out_out: *mut bindings::VipsImage = null_mut();
9069
9070        let flags_in: i32 = vipsload_options.flags as i32;
9071        let flags_in_name = utils::new_c_string("flags")?;
9072
9073        let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
9074        let memory_in_name = utils::new_c_string("memory")?;
9075
9076        let access_in: i32 = vipsload_options.access as i32;
9077        let access_in_name = utils::new_c_string("access")?;
9078
9079        let fail_on_in: i32 = vipsload_options.fail_on as i32;
9080        let fail_on_in_name = utils::new_c_string("fail-on")?;
9081
9082        let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
9083        let revalidate_in_name = utils::new_c_string("revalidate")?;
9084
9085        let vips_op_response = bindings::vips_vipsload(
9086            filename_in.as_ptr(),
9087            &mut out_out,
9088            flags_in_name.as_ptr(),
9089            flags_in,
9090            memory_in_name.as_ptr(),
9091            memory_in,
9092            access_in_name.as_ptr(),
9093            access_in,
9094            fail_on_in_name.as_ptr(),
9095            fail_on_in,
9096            revalidate_in_name.as_ptr(),
9097            revalidate_in,
9098            NULL,
9099        );
9100        utils::result(
9101            vips_op_response,
9102            VipsImage { ctx: out_out },
9103            Error::VipsloadError,
9104        )
9105    }
9106}
9107
9108/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9109/// source: `&VipsSource` -> Source to load from
9110/// returns `VipsImage` - Output image
9111pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
9112    unsafe {
9113        let source_in: *mut bindings::VipsSource = source.ctx;
9114        let mut out_out: *mut bindings::VipsImage = null_mut();
9115
9116        let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
9117        utils::result(
9118            vips_op_response,
9119            VipsImage { ctx: out_out },
9120            Error::VipsloadSourceError,
9121        )
9122    }
9123}
9124
9125/// Options for vipsload_source operation
9126#[derive(Clone, Debug)]
9127pub struct VipsloadSourceOptions {
9128    /// flags: `ForeignFlags` -> Flags for this file
9129    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9130    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9131    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9132    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9133    ///  `All` -> VIPS_FOREIGN_ALL = 7
9134    pub flags: ForeignFlags,
9135    /// memory: `bool` -> Force open via memory
9136    /// default: false
9137    pub memory: bool,
9138    /// access: `Access` -> Required access pattern for this file
9139    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9140    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9141    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9142    ///  `Last` -> VIPS_ACCESS_LAST = 3
9143    pub access: Access,
9144    /// fail_on: `FailOn` -> Error level to fail on
9145    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9146    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9147    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9148    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9149    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9150    pub fail_on: FailOn,
9151    /// revalidate: `bool` -> Don't use a cached result for this operation
9152    /// default: false
9153    pub revalidate: bool,
9154}
9155
9156impl std::default::Default for VipsloadSourceOptions {
9157    fn default() -> Self {
9158        VipsloadSourceOptions {
9159            flags: ForeignFlags::None,
9160            memory: false,
9161            access: Access::Random,
9162            fail_on: FailOn::None,
9163            revalidate: false,
9164        }
9165    }
9166}
9167
9168/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9169/// source: `&VipsSource` -> Source to load from
9170/// vipsload_source_options: `&VipsloadSourceOptions` -> optional arguments
9171/// returns `VipsImage` - Output image
9172pub fn vipsload_source_with_opts(
9173    source: &VipsSource,
9174    vipsload_source_options: &VipsloadSourceOptions,
9175) -> Result<VipsImage> {
9176    unsafe {
9177        let source_in: *mut bindings::VipsSource = source.ctx;
9178        let mut out_out: *mut bindings::VipsImage = null_mut();
9179
9180        let flags_in: i32 = vipsload_source_options.flags as i32;
9181        let flags_in_name = utils::new_c_string("flags")?;
9182
9183        let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9184        let memory_in_name = utils::new_c_string("memory")?;
9185
9186        let access_in: i32 = vipsload_source_options.access as i32;
9187        let access_in_name = utils::new_c_string("access")?;
9188
9189        let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9190        let fail_on_in_name = utils::new_c_string("fail-on")?;
9191
9192        let revalidate_in: i32 = if vipsload_source_options.revalidate {
9193            1
9194        } else {
9195            0
9196        };
9197        let revalidate_in_name = utils::new_c_string("revalidate")?;
9198
9199        let vips_op_response = bindings::vips_vipsload_source(
9200            source_in,
9201            &mut out_out,
9202            flags_in_name.as_ptr(),
9203            flags_in,
9204            memory_in_name.as_ptr(),
9205            memory_in,
9206            access_in_name.as_ptr(),
9207            access_in,
9208            fail_on_in_name.as_ptr(),
9209            fail_on_in,
9210            revalidate_in_name.as_ptr(),
9211            revalidate_in,
9212            NULL,
9213        );
9214        utils::result(
9215            vips_op_response,
9216            VipsImage { ctx: out_out },
9217            Error::VipsloadSourceError,
9218        )
9219    }
9220}
9221
9222/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9223/// filename: `&str` -> Filename to load from
9224/// returns `VipsImage` - Output image
9225pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9226    unsafe {
9227        let filename_in: CString = utils::new_c_string(filename)?;
9228        let mut out_out: *mut bindings::VipsImage = null_mut();
9229
9230        let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9231        utils::result(
9232            vips_op_response,
9233            VipsImage { ctx: out_out },
9234            Error::AnalyzeloadError,
9235        )
9236    }
9237}
9238
9239/// Options for analyzeload operation
9240#[derive(Clone, Debug)]
9241pub struct AnalyzeloadOptions {
9242    /// flags: `ForeignFlags` -> Flags for this file
9243    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9244    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9245    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9246    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9247    ///  `All` -> VIPS_FOREIGN_ALL = 7
9248    pub flags: ForeignFlags,
9249    /// memory: `bool` -> Force open via memory
9250    /// default: false
9251    pub memory: bool,
9252    /// access: `Access` -> Required access pattern for this file
9253    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9254    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9255    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9256    ///  `Last` -> VIPS_ACCESS_LAST = 3
9257    pub access: Access,
9258    /// fail_on: `FailOn` -> Error level to fail on
9259    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9260    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9261    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9262    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9263    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9264    pub fail_on: FailOn,
9265    /// revalidate: `bool` -> Don't use a cached result for this operation
9266    /// default: false
9267    pub revalidate: bool,
9268}
9269
9270impl std::default::Default for AnalyzeloadOptions {
9271    fn default() -> Self {
9272        AnalyzeloadOptions {
9273            flags: ForeignFlags::None,
9274            memory: false,
9275            access: Access::Random,
9276            fail_on: FailOn::None,
9277            revalidate: false,
9278        }
9279    }
9280}
9281
9282/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9283/// filename: `&str` -> Filename to load from
9284/// analyzeload_options: `&AnalyzeloadOptions` -> optional arguments
9285/// returns `VipsImage` - Output image
9286pub fn analyzeload_with_opts(
9287    filename: &str,
9288    analyzeload_options: &AnalyzeloadOptions,
9289) -> Result<VipsImage> {
9290    unsafe {
9291        let filename_in: CString = utils::new_c_string(filename)?;
9292        let mut out_out: *mut bindings::VipsImage = null_mut();
9293
9294        let flags_in: i32 = analyzeload_options.flags as i32;
9295        let flags_in_name = utils::new_c_string("flags")?;
9296
9297        let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9298        let memory_in_name = utils::new_c_string("memory")?;
9299
9300        let access_in: i32 = analyzeload_options.access as i32;
9301        let access_in_name = utils::new_c_string("access")?;
9302
9303        let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9304        let fail_on_in_name = utils::new_c_string("fail-on")?;
9305
9306        let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9307        let revalidate_in_name = utils::new_c_string("revalidate")?;
9308
9309        let vips_op_response = bindings::vips_analyzeload(
9310            filename_in.as_ptr(),
9311            &mut out_out,
9312            flags_in_name.as_ptr(),
9313            flags_in,
9314            memory_in_name.as_ptr(),
9315            memory_in,
9316            access_in_name.as_ptr(),
9317            access_in,
9318            fail_on_in_name.as_ptr(),
9319            fail_on_in,
9320            revalidate_in_name.as_ptr(),
9321            revalidate_in,
9322            NULL,
9323        );
9324        utils::result(
9325            vips_op_response,
9326            VipsImage { ctx: out_out },
9327            Error::AnalyzeloadError,
9328        )
9329    }
9330}
9331
9332/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9333/// filename: `&str` -> Filename to load from
9334/// returns `VipsImage` - Output image
9335pub fn ppmload(filename: &str) -> Result<VipsImage> {
9336    unsafe {
9337        let filename_in: CString = utils::new_c_string(filename)?;
9338        let mut out_out: *mut bindings::VipsImage = null_mut();
9339
9340        let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9341        utils::result(
9342            vips_op_response,
9343            VipsImage { ctx: out_out },
9344            Error::PpmloadError,
9345        )
9346    }
9347}
9348
9349/// Options for ppmload operation
9350#[derive(Clone, Debug)]
9351pub struct PpmloadOptions {
9352    /// flags: `ForeignFlags` -> Flags for this file
9353    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9354    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9355    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9356    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9357    ///  `All` -> VIPS_FOREIGN_ALL = 7
9358    pub flags: ForeignFlags,
9359    /// memory: `bool` -> Force open via memory
9360    /// default: false
9361    pub memory: bool,
9362    /// access: `Access` -> Required access pattern for this file
9363    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9364    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9365    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9366    ///  `Last` -> VIPS_ACCESS_LAST = 3
9367    pub access: Access,
9368    /// fail_on: `FailOn` -> Error level to fail on
9369    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9370    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9371    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9372    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9373    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9374    pub fail_on: FailOn,
9375    /// revalidate: `bool` -> Don't use a cached result for this operation
9376    /// default: false
9377    pub revalidate: bool,
9378}
9379
9380impl std::default::Default for PpmloadOptions {
9381    fn default() -> Self {
9382        PpmloadOptions {
9383            flags: ForeignFlags::None,
9384            memory: false,
9385            access: Access::Random,
9386            fail_on: FailOn::None,
9387            revalidate: false,
9388        }
9389    }
9390}
9391
9392/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9393/// filename: `&str` -> Filename to load from
9394/// ppmload_options: `&PpmloadOptions` -> optional arguments
9395/// returns `VipsImage` - Output image
9396pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9397    unsafe {
9398        let filename_in: CString = utils::new_c_string(filename)?;
9399        let mut out_out: *mut bindings::VipsImage = null_mut();
9400
9401        let flags_in: i32 = ppmload_options.flags as i32;
9402        let flags_in_name = utils::new_c_string("flags")?;
9403
9404        let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9405        let memory_in_name = utils::new_c_string("memory")?;
9406
9407        let access_in: i32 = ppmload_options.access as i32;
9408        let access_in_name = utils::new_c_string("access")?;
9409
9410        let fail_on_in: i32 = ppmload_options.fail_on as i32;
9411        let fail_on_in_name = utils::new_c_string("fail-on")?;
9412
9413        let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9414        let revalidate_in_name = utils::new_c_string("revalidate")?;
9415
9416        let vips_op_response = bindings::vips_ppmload(
9417            filename_in.as_ptr(),
9418            &mut out_out,
9419            flags_in_name.as_ptr(),
9420            flags_in,
9421            memory_in_name.as_ptr(),
9422            memory_in,
9423            access_in_name.as_ptr(),
9424            access_in,
9425            fail_on_in_name.as_ptr(),
9426            fail_on_in,
9427            revalidate_in_name.as_ptr(),
9428            revalidate_in,
9429            NULL,
9430        );
9431        utils::result(
9432            vips_op_response,
9433            VipsImage { ctx: out_out },
9434            Error::PpmloadError,
9435        )
9436    }
9437}
9438
9439/// VipsForeignLoadPpmBuffer (ppmload_buffer), load ppm from buffer (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_buffer, get_flags, header, load
9440/// buffer: `&[u8]` -> Buffer to load from
9441/// returns `VipsImage` - Output image
9442pub fn ppmload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9443    unsafe {
9444        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9445        let mut out_out: *mut bindings::VipsImage = null_mut();
9446
9447        let vips_op_response =
9448            bindings::vips_ppmload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9449        utils::result(
9450            vips_op_response,
9451            VipsImage { ctx: out_out },
9452            Error::PpmloadBufferError,
9453        )
9454    }
9455}
9456
9457/// Options for ppmload_buffer operation
9458#[derive(Clone, Debug)]
9459pub struct PpmloadBufferOptions {
9460    /// flags: `ForeignFlags` -> Flags for this file
9461    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9462    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9463    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9464    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9465    ///  `All` -> VIPS_FOREIGN_ALL = 7
9466    pub flags: ForeignFlags,
9467    /// memory: `bool` -> Force open via memory
9468    /// default: false
9469    pub memory: bool,
9470    /// access: `Access` -> Required access pattern for this file
9471    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9472    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9473    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9474    ///  `Last` -> VIPS_ACCESS_LAST = 3
9475    pub access: Access,
9476    /// fail_on: `FailOn` -> Error level to fail on
9477    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9478    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9479    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9480    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9481    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9482    pub fail_on: FailOn,
9483    /// revalidate: `bool` -> Don't use a cached result for this operation
9484    /// default: false
9485    pub revalidate: bool,
9486}
9487
9488impl std::default::Default for PpmloadBufferOptions {
9489    fn default() -> Self {
9490        PpmloadBufferOptions {
9491            flags: ForeignFlags::None,
9492            memory: false,
9493            access: Access::Random,
9494            fail_on: FailOn::None,
9495            revalidate: false,
9496        }
9497    }
9498}
9499
9500/// VipsForeignLoadPpmBuffer (ppmload_buffer), load ppm from buffer (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_buffer, get_flags, header, load
9501/// buffer: `&[u8]` -> Buffer to load from
9502/// ppmload_buffer_options: `&PpmloadBufferOptions` -> optional arguments
9503/// returns `VipsImage` - Output image
9504pub fn ppmload_buffer_with_opts(
9505    buffer: &[u8],
9506    ppmload_buffer_options: &PpmloadBufferOptions,
9507) -> Result<VipsImage> {
9508    unsafe {
9509        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9510        let mut out_out: *mut bindings::VipsImage = null_mut();
9511
9512        let flags_in: i32 = ppmload_buffer_options.flags as i32;
9513        let flags_in_name = utils::new_c_string("flags")?;
9514
9515        let memory_in: i32 = if ppmload_buffer_options.memory { 1 } else { 0 };
9516        let memory_in_name = utils::new_c_string("memory")?;
9517
9518        let access_in: i32 = ppmload_buffer_options.access as i32;
9519        let access_in_name = utils::new_c_string("access")?;
9520
9521        let fail_on_in: i32 = ppmload_buffer_options.fail_on as i32;
9522        let fail_on_in_name = utils::new_c_string("fail-on")?;
9523
9524        let revalidate_in: i32 = if ppmload_buffer_options.revalidate {
9525            1
9526        } else {
9527            0
9528        };
9529        let revalidate_in_name = utils::new_c_string("revalidate")?;
9530
9531        let vips_op_response = bindings::vips_ppmload_buffer(
9532            buffer_in,
9533            buffer.len() as u64,
9534            &mut out_out,
9535            flags_in_name.as_ptr(),
9536            flags_in,
9537            memory_in_name.as_ptr(),
9538            memory_in,
9539            access_in_name.as_ptr(),
9540            access_in,
9541            fail_on_in_name.as_ptr(),
9542            fail_on_in,
9543            revalidate_in_name.as_ptr(),
9544            revalidate_in,
9545            NULL,
9546        );
9547        utils::result(
9548            vips_op_response,
9549            VipsImage { ctx: out_out },
9550            Error::PpmloadBufferError,
9551        )
9552    }
9553}
9554
9555/// VipsForeignLoadPpmSource (ppmload_source), load ppm from source (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9556/// source: `&VipsSource` -> Source to load from
9557/// returns `VipsImage` - Output image
9558pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9559    unsafe {
9560        let source_in: *mut bindings::VipsSource = source.ctx;
9561        let mut out_out: *mut bindings::VipsImage = null_mut();
9562
9563        let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9564        utils::result(
9565            vips_op_response,
9566            VipsImage { ctx: out_out },
9567            Error::PpmloadSourceError,
9568        )
9569    }
9570}
9571
9572/// Options for ppmload_source operation
9573#[derive(Clone, Debug)]
9574pub struct PpmloadSourceOptions {
9575    /// flags: `ForeignFlags` -> Flags for this file
9576    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9577    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9578    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9579    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9580    ///  `All` -> VIPS_FOREIGN_ALL = 7
9581    pub flags: ForeignFlags,
9582    /// memory: `bool` -> Force open via memory
9583    /// default: false
9584    pub memory: bool,
9585    /// access: `Access` -> Required access pattern for this file
9586    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9587    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9588    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9589    ///  `Last` -> VIPS_ACCESS_LAST = 3
9590    pub access: Access,
9591    /// fail_on: `FailOn` -> Error level to fail on
9592    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9593    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9594    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9595    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9596    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9597    pub fail_on: FailOn,
9598    /// revalidate: `bool` -> Don't use a cached result for this operation
9599    /// default: false
9600    pub revalidate: bool,
9601}
9602
9603impl std::default::Default for PpmloadSourceOptions {
9604    fn default() -> Self {
9605        PpmloadSourceOptions {
9606            flags: ForeignFlags::None,
9607            memory: false,
9608            access: Access::Random,
9609            fail_on: FailOn::None,
9610            revalidate: false,
9611        }
9612    }
9613}
9614
9615/// VipsForeignLoadPpmSource (ppmload_source), load ppm from source (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9616/// source: `&VipsSource` -> Source to load from
9617/// ppmload_source_options: `&PpmloadSourceOptions` -> optional arguments
9618/// returns `VipsImage` - Output image
9619pub fn ppmload_source_with_opts(
9620    source: &VipsSource,
9621    ppmload_source_options: &PpmloadSourceOptions,
9622) -> Result<VipsImage> {
9623    unsafe {
9624        let source_in: *mut bindings::VipsSource = source.ctx;
9625        let mut out_out: *mut bindings::VipsImage = null_mut();
9626
9627        let flags_in: i32 = ppmload_source_options.flags as i32;
9628        let flags_in_name = utils::new_c_string("flags")?;
9629
9630        let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9631        let memory_in_name = utils::new_c_string("memory")?;
9632
9633        let access_in: i32 = ppmload_source_options.access as i32;
9634        let access_in_name = utils::new_c_string("access")?;
9635
9636        let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9637        let fail_on_in_name = utils::new_c_string("fail-on")?;
9638
9639        let revalidate_in: i32 = if ppmload_source_options.revalidate {
9640            1
9641        } else {
9642            0
9643        };
9644        let revalidate_in_name = utils::new_c_string("revalidate")?;
9645
9646        let vips_op_response = bindings::vips_ppmload_source(
9647            source_in,
9648            &mut out_out,
9649            flags_in_name.as_ptr(),
9650            flags_in,
9651            memory_in_name.as_ptr(),
9652            memory_in,
9653            access_in_name.as_ptr(),
9654            access_in,
9655            fail_on_in_name.as_ptr(),
9656            fail_on_in,
9657            revalidate_in_name.as_ptr(),
9658            revalidate_in,
9659            NULL,
9660        );
9661        utils::result(
9662            vips_op_response,
9663            VipsImage { ctx: out_out },
9664            Error::PpmloadSourceError,
9665        )
9666    }
9667}
9668
9669/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9670/// filename: `&str` -> Filename to load from
9671/// returns `VipsImage` - Output image
9672pub fn radload(filename: &str) -> Result<VipsImage> {
9673    unsafe {
9674        let filename_in: CString = utils::new_c_string(filename)?;
9675        let mut out_out: *mut bindings::VipsImage = null_mut();
9676
9677        let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9678        utils::result(
9679            vips_op_response,
9680            VipsImage { ctx: out_out },
9681            Error::RadloadError,
9682        )
9683    }
9684}
9685
9686/// Options for radload operation
9687#[derive(Clone, Debug)]
9688pub struct RadloadOptions {
9689    /// flags: `ForeignFlags` -> Flags for this file
9690    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9691    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9692    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9693    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9694    ///  `All` -> VIPS_FOREIGN_ALL = 7
9695    pub flags: ForeignFlags,
9696    /// memory: `bool` -> Force open via memory
9697    /// default: false
9698    pub memory: bool,
9699    /// access: `Access` -> Required access pattern for this file
9700    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9701    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9702    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9703    ///  `Last` -> VIPS_ACCESS_LAST = 3
9704    pub access: Access,
9705    /// fail_on: `FailOn` -> Error level to fail on
9706    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9707    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9708    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9709    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9710    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9711    pub fail_on: FailOn,
9712    /// revalidate: `bool` -> Don't use a cached result for this operation
9713    /// default: false
9714    pub revalidate: bool,
9715}
9716
9717impl std::default::Default for RadloadOptions {
9718    fn default() -> Self {
9719        RadloadOptions {
9720            flags: ForeignFlags::None,
9721            memory: false,
9722            access: Access::Random,
9723            fail_on: FailOn::None,
9724            revalidate: false,
9725        }
9726    }
9727}
9728
9729/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9730/// filename: `&str` -> Filename to load from
9731/// radload_options: `&RadloadOptions` -> optional arguments
9732/// returns `VipsImage` - Output image
9733pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9734    unsafe {
9735        let filename_in: CString = utils::new_c_string(filename)?;
9736        let mut out_out: *mut bindings::VipsImage = null_mut();
9737
9738        let flags_in: i32 = radload_options.flags as i32;
9739        let flags_in_name = utils::new_c_string("flags")?;
9740
9741        let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9742        let memory_in_name = utils::new_c_string("memory")?;
9743
9744        let access_in: i32 = radload_options.access as i32;
9745        let access_in_name = utils::new_c_string("access")?;
9746
9747        let fail_on_in: i32 = radload_options.fail_on as i32;
9748        let fail_on_in_name = utils::new_c_string("fail-on")?;
9749
9750        let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9751        let revalidate_in_name = utils::new_c_string("revalidate")?;
9752
9753        let vips_op_response = bindings::vips_radload(
9754            filename_in.as_ptr(),
9755            &mut out_out,
9756            flags_in_name.as_ptr(),
9757            flags_in,
9758            memory_in_name.as_ptr(),
9759            memory_in,
9760            access_in_name.as_ptr(),
9761            access_in,
9762            fail_on_in_name.as_ptr(),
9763            fail_on_in,
9764            revalidate_in_name.as_ptr(),
9765            revalidate_in,
9766            NULL,
9767        );
9768        utils::result(
9769            vips_op_response,
9770            VipsImage { ctx: out_out },
9771            Error::RadloadError,
9772        )
9773    }
9774}
9775
9776/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9777/// buffer: `&[u8]` -> Buffer to load from
9778/// returns `VipsImage` - Output image
9779pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9780    unsafe {
9781        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9782        let mut out_out: *mut bindings::VipsImage = null_mut();
9783
9784        let vips_op_response =
9785            bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9786        utils::result(
9787            vips_op_response,
9788            VipsImage { ctx: out_out },
9789            Error::RadloadBufferError,
9790        )
9791    }
9792}
9793
9794/// Options for radload_buffer operation
9795#[derive(Clone, Debug)]
9796pub struct RadloadBufferOptions {
9797    /// flags: `ForeignFlags` -> Flags for this file
9798    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9799    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9800    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9801    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9802    ///  `All` -> VIPS_FOREIGN_ALL = 7
9803    pub flags: ForeignFlags,
9804    /// memory: `bool` -> Force open via memory
9805    /// default: false
9806    pub memory: bool,
9807    /// access: `Access` -> Required access pattern for this file
9808    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9809    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9810    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9811    ///  `Last` -> VIPS_ACCESS_LAST = 3
9812    pub access: Access,
9813    /// fail_on: `FailOn` -> Error level to fail on
9814    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9815    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9816    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9817    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9818    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9819    pub fail_on: FailOn,
9820    /// revalidate: `bool` -> Don't use a cached result for this operation
9821    /// default: false
9822    pub revalidate: bool,
9823}
9824
9825impl std::default::Default for RadloadBufferOptions {
9826    fn default() -> Self {
9827        RadloadBufferOptions {
9828            flags: ForeignFlags::None,
9829            memory: false,
9830            access: Access::Random,
9831            fail_on: FailOn::None,
9832            revalidate: false,
9833        }
9834    }
9835}
9836
9837/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9838/// buffer: `&[u8]` -> Buffer to load from
9839/// radload_buffer_options: `&RadloadBufferOptions` -> optional arguments
9840/// returns `VipsImage` - Output image
9841pub fn radload_buffer_with_opts(
9842    buffer: &[u8],
9843    radload_buffer_options: &RadloadBufferOptions,
9844) -> Result<VipsImage> {
9845    unsafe {
9846        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9847        let mut out_out: *mut bindings::VipsImage = null_mut();
9848
9849        let flags_in: i32 = radload_buffer_options.flags as i32;
9850        let flags_in_name = utils::new_c_string("flags")?;
9851
9852        let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9853        let memory_in_name = utils::new_c_string("memory")?;
9854
9855        let access_in: i32 = radload_buffer_options.access as i32;
9856        let access_in_name = utils::new_c_string("access")?;
9857
9858        let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9859        let fail_on_in_name = utils::new_c_string("fail-on")?;
9860
9861        let revalidate_in: i32 = if radload_buffer_options.revalidate {
9862            1
9863        } else {
9864            0
9865        };
9866        let revalidate_in_name = utils::new_c_string("revalidate")?;
9867
9868        let vips_op_response = bindings::vips_radload_buffer(
9869            buffer_in,
9870            buffer.len() as u64,
9871            &mut out_out,
9872            flags_in_name.as_ptr(),
9873            flags_in,
9874            memory_in_name.as_ptr(),
9875            memory_in,
9876            access_in_name.as_ptr(),
9877            access_in,
9878            fail_on_in_name.as_ptr(),
9879            fail_on_in,
9880            revalidate_in_name.as_ptr(),
9881            revalidate_in,
9882            NULL,
9883        );
9884        utils::result(
9885            vips_op_response,
9886            VipsImage { ctx: out_out },
9887            Error::RadloadBufferError,
9888        )
9889    }
9890}
9891
9892/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9893/// source: `&VipsSource` -> Source to load from
9894/// returns `VipsImage` - Output image
9895pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9896    unsafe {
9897        let source_in: *mut bindings::VipsSource = source.ctx;
9898        let mut out_out: *mut bindings::VipsImage = null_mut();
9899
9900        let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9901        utils::result(
9902            vips_op_response,
9903            VipsImage { ctx: out_out },
9904            Error::RadloadSourceError,
9905        )
9906    }
9907}
9908
9909/// Options for radload_source operation
9910#[derive(Clone, Debug)]
9911pub struct RadloadSourceOptions {
9912    /// flags: `ForeignFlags` -> Flags for this file
9913    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9914    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9915    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9916    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9917    ///  `All` -> VIPS_FOREIGN_ALL = 7
9918    pub flags: ForeignFlags,
9919    /// memory: `bool` -> Force open via memory
9920    /// default: false
9921    pub memory: bool,
9922    /// access: `Access` -> Required access pattern for this file
9923    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9924    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9925    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9926    ///  `Last` -> VIPS_ACCESS_LAST = 3
9927    pub access: Access,
9928    /// fail_on: `FailOn` -> Error level to fail on
9929    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9930    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9931    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9932    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9933    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9934    pub fail_on: FailOn,
9935    /// revalidate: `bool` -> Don't use a cached result for this operation
9936    /// default: false
9937    pub revalidate: bool,
9938}
9939
9940impl std::default::Default for RadloadSourceOptions {
9941    fn default() -> Self {
9942        RadloadSourceOptions {
9943            flags: ForeignFlags::None,
9944            memory: false,
9945            access: Access::Random,
9946            fail_on: FailOn::None,
9947            revalidate: false,
9948        }
9949    }
9950}
9951
9952/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9953/// source: `&VipsSource` -> Source to load from
9954/// radload_source_options: `&RadloadSourceOptions` -> optional arguments
9955/// returns `VipsImage` - Output image
9956pub fn radload_source_with_opts(
9957    source: &VipsSource,
9958    radload_source_options: &RadloadSourceOptions,
9959) -> Result<VipsImage> {
9960    unsafe {
9961        let source_in: *mut bindings::VipsSource = source.ctx;
9962        let mut out_out: *mut bindings::VipsImage = null_mut();
9963
9964        let flags_in: i32 = radload_source_options.flags as i32;
9965        let flags_in_name = utils::new_c_string("flags")?;
9966
9967        let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9968        let memory_in_name = utils::new_c_string("memory")?;
9969
9970        let access_in: i32 = radload_source_options.access as i32;
9971        let access_in_name = utils::new_c_string("access")?;
9972
9973        let fail_on_in: i32 = radload_source_options.fail_on as i32;
9974        let fail_on_in_name = utils::new_c_string("fail-on")?;
9975
9976        let revalidate_in: i32 = if radload_source_options.revalidate {
9977            1
9978        } else {
9979            0
9980        };
9981        let revalidate_in_name = utils::new_c_string("revalidate")?;
9982
9983        let vips_op_response = bindings::vips_radload_source(
9984            source_in,
9985            &mut out_out,
9986            flags_in_name.as_ptr(),
9987            flags_in,
9988            memory_in_name.as_ptr(),
9989            memory_in,
9990            access_in_name.as_ptr(),
9991            access_in,
9992            fail_on_in_name.as_ptr(),
9993            fail_on_in,
9994            revalidate_in_name.as_ptr(),
9995            revalidate_in,
9996            NULL,
9997        );
9998        utils::result(
9999            vips_op_response,
10000            VipsImage { ctx: out_out },
10001            Error::RadloadSourceError,
10002        )
10003    }
10004}
10005
10006/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
10007/// filename: `&str` -> Filename to load from
10008/// returns `VipsImage` - Output image
10009pub fn svgload(filename: &str) -> Result<VipsImage> {
10010    unsafe {
10011        let filename_in: CString = utils::new_c_string(filename)?;
10012        let mut out_out: *mut bindings::VipsImage = null_mut();
10013
10014        let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
10015        utils::result(
10016            vips_op_response,
10017            VipsImage { ctx: out_out },
10018            Error::SvgloadError,
10019        )
10020    }
10021}
10022
10023/// Options for svgload operation
10024#[derive(Clone, Debug)]
10025pub struct SvgloadOptions {
10026    /// dpi: `f64` -> Render at this DPI
10027    /// min: 0.001, max: 100000, default: 72
10028    pub dpi: f64,
10029    /// scale: `f64` -> Scale output by this factor
10030    /// min: 0, max: 100000, default: 1
10031    pub scale: f64,
10032    /// unlimited: `bool` -> Allow SVG of any size
10033    /// default: false
10034    pub unlimited: bool,
10035    /// stylesheet: `String` -> Custom CSS
10036    pub stylesheet: String,
10037    /// high_bitdepth: `bool` -> Enable scRGB 128-bit output (32-bit per channel)
10038    /// default: false
10039    pub high_bitdepth: bool,
10040    /// flags: `ForeignFlags` -> Flags for this file
10041    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10042    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10043    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10044    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10045    ///  `All` -> VIPS_FOREIGN_ALL = 7
10046    pub flags: ForeignFlags,
10047    /// memory: `bool` -> Force open via memory
10048    /// default: false
10049    pub memory: bool,
10050    /// access: `Access` -> Required access pattern for this file
10051    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10052    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10053    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10054    ///  `Last` -> VIPS_ACCESS_LAST = 3
10055    pub access: Access,
10056    /// fail_on: `FailOn` -> Error level to fail on
10057    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10058    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10059    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10060    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10061    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10062    pub fail_on: FailOn,
10063    /// revalidate: `bool` -> Don't use a cached result for this operation
10064    /// default: false
10065    pub revalidate: bool,
10066}
10067
10068impl std::default::Default for SvgloadOptions {
10069    fn default() -> Self {
10070        SvgloadOptions {
10071            dpi: f64::from(72),
10072            scale: f64::from(1),
10073            unlimited: false,
10074            stylesheet: String::new(),
10075            high_bitdepth: false,
10076            flags: ForeignFlags::None,
10077            memory: false,
10078            access: Access::Random,
10079            fail_on: FailOn::None,
10080            revalidate: false,
10081        }
10082    }
10083}
10084
10085/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
10086/// filename: `&str` -> Filename to load from
10087/// svgload_options: `&SvgloadOptions` -> optional arguments
10088/// returns `VipsImage` - Output image
10089pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
10090    unsafe {
10091        let filename_in: CString = utils::new_c_string(filename)?;
10092        let mut out_out: *mut bindings::VipsImage = null_mut();
10093
10094        let dpi_in: f64 = svgload_options.dpi;
10095        let dpi_in_name = utils::new_c_string("dpi")?;
10096
10097        let scale_in: f64 = svgload_options.scale;
10098        let scale_in_name = utils::new_c_string("scale")?;
10099
10100        let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
10101        let unlimited_in_name = utils::new_c_string("unlimited")?;
10102
10103        let stylesheet_in: CString = utils::new_c_string(&svgload_options.stylesheet)?;
10104        let stylesheet_in_name = utils::new_c_string("stylesheet")?;
10105
10106        let high_bitdepth_in: i32 = if svgload_options.high_bitdepth { 1 } else { 0 };
10107        let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
10108
10109        let flags_in: i32 = svgload_options.flags as i32;
10110        let flags_in_name = utils::new_c_string("flags")?;
10111
10112        let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
10113        let memory_in_name = utils::new_c_string("memory")?;
10114
10115        let access_in: i32 = svgload_options.access as i32;
10116        let access_in_name = utils::new_c_string("access")?;
10117
10118        let fail_on_in: i32 = svgload_options.fail_on as i32;
10119        let fail_on_in_name = utils::new_c_string("fail-on")?;
10120
10121        let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
10122        let revalidate_in_name = utils::new_c_string("revalidate")?;
10123
10124        let vips_op_response = bindings::vips_svgload(
10125            filename_in.as_ptr(),
10126            &mut out_out,
10127            dpi_in_name.as_ptr(),
10128            dpi_in,
10129            scale_in_name.as_ptr(),
10130            scale_in,
10131            unlimited_in_name.as_ptr(),
10132            unlimited_in,
10133            stylesheet_in_name.as_ptr(),
10134            stylesheet_in.as_ptr(),
10135            high_bitdepth_in_name.as_ptr(),
10136            high_bitdepth_in,
10137            flags_in_name.as_ptr(),
10138            flags_in,
10139            memory_in_name.as_ptr(),
10140            memory_in,
10141            access_in_name.as_ptr(),
10142            access_in,
10143            fail_on_in_name.as_ptr(),
10144            fail_on_in,
10145            revalidate_in_name.as_ptr(),
10146            revalidate_in,
10147            NULL,
10148        );
10149        utils::result(
10150            vips_op_response,
10151            VipsImage { ctx: out_out },
10152            Error::SvgloadError,
10153        )
10154    }
10155}
10156
10157/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10158/// buffer: `&[u8]` -> Buffer to load from
10159/// returns `VipsImage` - Output image
10160pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10161    unsafe {
10162        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10163        let mut out_out: *mut bindings::VipsImage = null_mut();
10164
10165        let vips_op_response =
10166            bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10167        utils::result(
10168            vips_op_response,
10169            VipsImage { ctx: out_out },
10170            Error::SvgloadBufferError,
10171        )
10172    }
10173}
10174
10175/// Options for svgload_buffer operation
10176#[derive(Clone, Debug)]
10177pub struct SvgloadBufferOptions {
10178    /// dpi: `f64` -> Render at this DPI
10179    /// min: 0.001, max: 100000, default: 72
10180    pub dpi: f64,
10181    /// scale: `f64` -> Scale output by this factor
10182    /// min: 0, max: 100000, default: 1
10183    pub scale: f64,
10184    /// unlimited: `bool` -> Allow SVG of any size
10185    /// default: false
10186    pub unlimited: bool,
10187    /// stylesheet: `String` -> Custom CSS
10188    pub stylesheet: String,
10189    /// high_bitdepth: `bool` -> Enable scRGB 128-bit output (32-bit per channel)
10190    /// default: false
10191    pub high_bitdepth: bool,
10192    /// flags: `ForeignFlags` -> Flags for this file
10193    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10194    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10195    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10196    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10197    ///  `All` -> VIPS_FOREIGN_ALL = 7
10198    pub flags: ForeignFlags,
10199    /// memory: `bool` -> Force open via memory
10200    /// default: false
10201    pub memory: bool,
10202    /// access: `Access` -> Required access pattern for this file
10203    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10204    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10205    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10206    ///  `Last` -> VIPS_ACCESS_LAST = 3
10207    pub access: Access,
10208    /// fail_on: `FailOn` -> Error level to fail on
10209    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10210    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10211    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10212    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10213    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10214    pub fail_on: FailOn,
10215    /// revalidate: `bool` -> Don't use a cached result for this operation
10216    /// default: false
10217    pub revalidate: bool,
10218}
10219
10220impl std::default::Default for SvgloadBufferOptions {
10221    fn default() -> Self {
10222        SvgloadBufferOptions {
10223            dpi: f64::from(72),
10224            scale: f64::from(1),
10225            unlimited: false,
10226            stylesheet: String::new(),
10227            high_bitdepth: false,
10228            flags: ForeignFlags::None,
10229            memory: false,
10230            access: Access::Random,
10231            fail_on: FailOn::None,
10232            revalidate: false,
10233        }
10234    }
10235}
10236
10237/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10238/// buffer: `&[u8]` -> Buffer to load from
10239/// svgload_buffer_options: `&SvgloadBufferOptions` -> optional arguments
10240/// returns `VipsImage` - Output image
10241pub fn svgload_buffer_with_opts(
10242    buffer: &[u8],
10243    svgload_buffer_options: &SvgloadBufferOptions,
10244) -> Result<VipsImage> {
10245    unsafe {
10246        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10247        let mut out_out: *mut bindings::VipsImage = null_mut();
10248
10249        let dpi_in: f64 = svgload_buffer_options.dpi;
10250        let dpi_in_name = utils::new_c_string("dpi")?;
10251
10252        let scale_in: f64 = svgload_buffer_options.scale;
10253        let scale_in_name = utils::new_c_string("scale")?;
10254
10255        let unlimited_in: i32 = if svgload_buffer_options.unlimited {
10256            1
10257        } else {
10258            0
10259        };
10260        let unlimited_in_name = utils::new_c_string("unlimited")?;
10261
10262        let stylesheet_in: CString = utils::new_c_string(&svgload_buffer_options.stylesheet)?;
10263        let stylesheet_in_name = utils::new_c_string("stylesheet")?;
10264
10265        let high_bitdepth_in: i32 = if svgload_buffer_options.high_bitdepth {
10266            1
10267        } else {
10268            0
10269        };
10270        let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
10271
10272        let flags_in: i32 = svgload_buffer_options.flags as i32;
10273        let flags_in_name = utils::new_c_string("flags")?;
10274
10275        let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
10276        let memory_in_name = utils::new_c_string("memory")?;
10277
10278        let access_in: i32 = svgload_buffer_options.access as i32;
10279        let access_in_name = utils::new_c_string("access")?;
10280
10281        let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
10282        let fail_on_in_name = utils::new_c_string("fail-on")?;
10283
10284        let revalidate_in: i32 = if svgload_buffer_options.revalidate {
10285            1
10286        } else {
10287            0
10288        };
10289        let revalidate_in_name = utils::new_c_string("revalidate")?;
10290
10291        let vips_op_response = bindings::vips_svgload_buffer(
10292            buffer_in,
10293            buffer.len() as u64,
10294            &mut out_out,
10295            dpi_in_name.as_ptr(),
10296            dpi_in,
10297            scale_in_name.as_ptr(),
10298            scale_in,
10299            unlimited_in_name.as_ptr(),
10300            unlimited_in,
10301            stylesheet_in_name.as_ptr(),
10302            stylesheet_in.as_ptr(),
10303            high_bitdepth_in_name.as_ptr(),
10304            high_bitdepth_in,
10305            flags_in_name.as_ptr(),
10306            flags_in,
10307            memory_in_name.as_ptr(),
10308            memory_in,
10309            access_in_name.as_ptr(),
10310            access_in,
10311            fail_on_in_name.as_ptr(),
10312            fail_on_in,
10313            revalidate_in_name.as_ptr(),
10314            revalidate_in,
10315            NULL,
10316        );
10317        utils::result(
10318            vips_op_response,
10319            VipsImage { ctx: out_out },
10320            Error::SvgloadBufferError,
10321        )
10322    }
10323}
10324
10325/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10326/// filename: `&str` -> Filename to load from
10327/// returns `VipsImage` - Output image
10328pub fn gifload(filename: &str) -> Result<VipsImage> {
10329    unsafe {
10330        let filename_in: CString = utils::new_c_string(filename)?;
10331        let mut out_out: *mut bindings::VipsImage = null_mut();
10332
10333        let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10334        utils::result(
10335            vips_op_response,
10336            VipsImage { ctx: out_out },
10337            Error::GifloadError,
10338        )
10339    }
10340}
10341
10342/// Options for gifload operation
10343#[derive(Clone, Debug)]
10344pub struct GifloadOptions {
10345    /// n: `i32` -> Number of pages to load, -1 for all
10346    /// min: -1, max: 100000, default: 1
10347    pub n: i32,
10348    /// page: `i32` -> First page to load
10349    /// min: 0, max: 100000, default: 0
10350    pub page: i32,
10351    /// flags: `ForeignFlags` -> Flags for this file
10352    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10353    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10354    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10355    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10356    ///  `All` -> VIPS_FOREIGN_ALL = 7
10357    pub flags: ForeignFlags,
10358    /// memory: `bool` -> Force open via memory
10359    /// default: false
10360    pub memory: bool,
10361    /// access: `Access` -> Required access pattern for this file
10362    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10363    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10364    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10365    ///  `Last` -> VIPS_ACCESS_LAST = 3
10366    pub access: Access,
10367    /// fail_on: `FailOn` -> Error level to fail on
10368    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10369    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10370    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10371    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10372    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10373    pub fail_on: FailOn,
10374    /// revalidate: `bool` -> Don't use a cached result for this operation
10375    /// default: false
10376    pub revalidate: bool,
10377}
10378
10379impl std::default::Default for GifloadOptions {
10380    fn default() -> Self {
10381        GifloadOptions {
10382            n: i32::from(1),
10383            page: i32::from(0),
10384            flags: ForeignFlags::None,
10385            memory: false,
10386            access: Access::Random,
10387            fail_on: FailOn::None,
10388            revalidate: false,
10389        }
10390    }
10391}
10392
10393/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10394/// filename: `&str` -> Filename to load from
10395/// gifload_options: `&GifloadOptions` -> optional arguments
10396/// returns `VipsImage` - Output image
10397pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10398    unsafe {
10399        let filename_in: CString = utils::new_c_string(filename)?;
10400        let mut out_out: *mut bindings::VipsImage = null_mut();
10401
10402        let n_in: i32 = gifload_options.n;
10403        let n_in_name = utils::new_c_string("n")?;
10404
10405        let page_in: i32 = gifload_options.page;
10406        let page_in_name = utils::new_c_string("page")?;
10407
10408        let flags_in: i32 = gifload_options.flags as i32;
10409        let flags_in_name = utils::new_c_string("flags")?;
10410
10411        let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10412        let memory_in_name = utils::new_c_string("memory")?;
10413
10414        let access_in: i32 = gifload_options.access as i32;
10415        let access_in_name = utils::new_c_string("access")?;
10416
10417        let fail_on_in: i32 = gifload_options.fail_on as i32;
10418        let fail_on_in_name = utils::new_c_string("fail-on")?;
10419
10420        let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10421        let revalidate_in_name = utils::new_c_string("revalidate")?;
10422
10423        let vips_op_response = bindings::vips_gifload(
10424            filename_in.as_ptr(),
10425            &mut out_out,
10426            n_in_name.as_ptr(),
10427            n_in,
10428            page_in_name.as_ptr(),
10429            page_in,
10430            flags_in_name.as_ptr(),
10431            flags_in,
10432            memory_in_name.as_ptr(),
10433            memory_in,
10434            access_in_name.as_ptr(),
10435            access_in,
10436            fail_on_in_name.as_ptr(),
10437            fail_on_in,
10438            revalidate_in_name.as_ptr(),
10439            revalidate_in,
10440            NULL,
10441        );
10442        utils::result(
10443            vips_op_response,
10444            VipsImage { ctx: out_out },
10445            Error::GifloadError,
10446        )
10447    }
10448}
10449
10450/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10451/// buffer: `&[u8]` -> Buffer to load from
10452/// returns `VipsImage` - Output image
10453pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10454    unsafe {
10455        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10456        let mut out_out: *mut bindings::VipsImage = null_mut();
10457
10458        let vips_op_response =
10459            bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10460        utils::result(
10461            vips_op_response,
10462            VipsImage { ctx: out_out },
10463            Error::GifloadBufferError,
10464        )
10465    }
10466}
10467
10468/// Options for gifload_buffer operation
10469#[derive(Clone, Debug)]
10470pub struct GifloadBufferOptions {
10471    /// n: `i32` -> Number of pages to load, -1 for all
10472    /// min: -1, max: 100000, default: 1
10473    pub n: i32,
10474    /// page: `i32` -> First page to load
10475    /// min: 0, max: 100000, default: 0
10476    pub page: i32,
10477    /// flags: `ForeignFlags` -> Flags for this file
10478    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10479    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10480    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10481    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10482    ///  `All` -> VIPS_FOREIGN_ALL = 7
10483    pub flags: ForeignFlags,
10484    /// memory: `bool` -> Force open via memory
10485    /// default: false
10486    pub memory: bool,
10487    /// access: `Access` -> Required access pattern for this file
10488    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10489    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10490    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10491    ///  `Last` -> VIPS_ACCESS_LAST = 3
10492    pub access: Access,
10493    /// fail_on: `FailOn` -> Error level to fail on
10494    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10495    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10496    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10497    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10498    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10499    pub fail_on: FailOn,
10500    /// revalidate: `bool` -> Don't use a cached result for this operation
10501    /// default: false
10502    pub revalidate: bool,
10503}
10504
10505impl std::default::Default for GifloadBufferOptions {
10506    fn default() -> Self {
10507        GifloadBufferOptions {
10508            n: i32::from(1),
10509            page: i32::from(0),
10510            flags: ForeignFlags::None,
10511            memory: false,
10512            access: Access::Random,
10513            fail_on: FailOn::None,
10514            revalidate: false,
10515        }
10516    }
10517}
10518
10519/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10520/// buffer: `&[u8]` -> Buffer to load from
10521/// gifload_buffer_options: `&GifloadBufferOptions` -> optional arguments
10522/// returns `VipsImage` - Output image
10523pub fn gifload_buffer_with_opts(
10524    buffer: &[u8],
10525    gifload_buffer_options: &GifloadBufferOptions,
10526) -> Result<VipsImage> {
10527    unsafe {
10528        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10529        let mut out_out: *mut bindings::VipsImage = null_mut();
10530
10531        let n_in: i32 = gifload_buffer_options.n;
10532        let n_in_name = utils::new_c_string("n")?;
10533
10534        let page_in: i32 = gifload_buffer_options.page;
10535        let page_in_name = utils::new_c_string("page")?;
10536
10537        let flags_in: i32 = gifload_buffer_options.flags as i32;
10538        let flags_in_name = utils::new_c_string("flags")?;
10539
10540        let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10541        let memory_in_name = utils::new_c_string("memory")?;
10542
10543        let access_in: i32 = gifload_buffer_options.access as i32;
10544        let access_in_name = utils::new_c_string("access")?;
10545
10546        let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10547        let fail_on_in_name = utils::new_c_string("fail-on")?;
10548
10549        let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10550            1
10551        } else {
10552            0
10553        };
10554        let revalidate_in_name = utils::new_c_string("revalidate")?;
10555
10556        let vips_op_response = bindings::vips_gifload_buffer(
10557            buffer_in,
10558            buffer.len() as u64,
10559            &mut out_out,
10560            n_in_name.as_ptr(),
10561            n_in,
10562            page_in_name.as_ptr(),
10563            page_in,
10564            flags_in_name.as_ptr(),
10565            flags_in,
10566            memory_in_name.as_ptr(),
10567            memory_in,
10568            access_in_name.as_ptr(),
10569            access_in,
10570            fail_on_in_name.as_ptr(),
10571            fail_on_in,
10572            revalidate_in_name.as_ptr(),
10573            revalidate_in,
10574            NULL,
10575        );
10576        utils::result(
10577            vips_op_response,
10578            VipsImage { ctx: out_out },
10579            Error::GifloadBufferError,
10580        )
10581    }
10582}
10583
10584/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10585/// source: `&VipsSource` -> Source to load from
10586/// returns `VipsImage` - Output image
10587pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10588    unsafe {
10589        let source_in: *mut bindings::VipsSource = source.ctx;
10590        let mut out_out: *mut bindings::VipsImage = null_mut();
10591
10592        let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10593        utils::result(
10594            vips_op_response,
10595            VipsImage { ctx: out_out },
10596            Error::GifloadSourceError,
10597        )
10598    }
10599}
10600
10601/// Options for gifload_source operation
10602#[derive(Clone, Debug)]
10603pub struct GifloadSourceOptions {
10604    /// n: `i32` -> Number of pages to load, -1 for all
10605    /// min: -1, max: 100000, default: 1
10606    pub n: i32,
10607    /// page: `i32` -> First page to load
10608    /// min: 0, max: 100000, default: 0
10609    pub page: i32,
10610    /// flags: `ForeignFlags` -> Flags for this file
10611    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10612    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10613    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10614    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10615    ///  `All` -> VIPS_FOREIGN_ALL = 7
10616    pub flags: ForeignFlags,
10617    /// memory: `bool` -> Force open via memory
10618    /// default: false
10619    pub memory: bool,
10620    /// access: `Access` -> Required access pattern for this file
10621    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10622    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10623    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10624    ///  `Last` -> VIPS_ACCESS_LAST = 3
10625    pub access: Access,
10626    /// fail_on: `FailOn` -> Error level to fail on
10627    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10628    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10629    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10630    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10631    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10632    pub fail_on: FailOn,
10633    /// revalidate: `bool` -> Don't use a cached result for this operation
10634    /// default: false
10635    pub revalidate: bool,
10636}
10637
10638impl std::default::Default for GifloadSourceOptions {
10639    fn default() -> Self {
10640        GifloadSourceOptions {
10641            n: i32::from(1),
10642            page: i32::from(0),
10643            flags: ForeignFlags::None,
10644            memory: false,
10645            access: Access::Random,
10646            fail_on: FailOn::None,
10647            revalidate: false,
10648        }
10649    }
10650}
10651
10652/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10653/// source: `&VipsSource` -> Source to load from
10654/// gifload_source_options: `&GifloadSourceOptions` -> optional arguments
10655/// returns `VipsImage` - Output image
10656pub fn gifload_source_with_opts(
10657    source: &VipsSource,
10658    gifload_source_options: &GifloadSourceOptions,
10659) -> Result<VipsImage> {
10660    unsafe {
10661        let source_in: *mut bindings::VipsSource = source.ctx;
10662        let mut out_out: *mut bindings::VipsImage = null_mut();
10663
10664        let n_in: i32 = gifload_source_options.n;
10665        let n_in_name = utils::new_c_string("n")?;
10666
10667        let page_in: i32 = gifload_source_options.page;
10668        let page_in_name = utils::new_c_string("page")?;
10669
10670        let flags_in: i32 = gifload_source_options.flags as i32;
10671        let flags_in_name = utils::new_c_string("flags")?;
10672
10673        let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10674        let memory_in_name = utils::new_c_string("memory")?;
10675
10676        let access_in: i32 = gifload_source_options.access as i32;
10677        let access_in_name = utils::new_c_string("access")?;
10678
10679        let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10680        let fail_on_in_name = utils::new_c_string("fail-on")?;
10681
10682        let revalidate_in: i32 = if gifload_source_options.revalidate {
10683            1
10684        } else {
10685            0
10686        };
10687        let revalidate_in_name = utils::new_c_string("revalidate")?;
10688
10689        let vips_op_response = bindings::vips_gifload_source(
10690            source_in,
10691            &mut out_out,
10692            n_in_name.as_ptr(),
10693            n_in,
10694            page_in_name.as_ptr(),
10695            page_in,
10696            flags_in_name.as_ptr(),
10697            flags_in,
10698            memory_in_name.as_ptr(),
10699            memory_in,
10700            access_in_name.as_ptr(),
10701            access_in,
10702            fail_on_in_name.as_ptr(),
10703            fail_on_in,
10704            revalidate_in_name.as_ptr(),
10705            revalidate_in,
10706            NULL,
10707        );
10708        utils::result(
10709            vips_op_response,
10710            VipsImage { ctx: out_out },
10711            Error::GifloadSourceError,
10712        )
10713    }
10714}
10715
10716/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10717/// filename: `&str` -> Filename to load from
10718/// returns `VipsImage` - Output image
10719pub fn pngload(filename: &str) -> Result<VipsImage> {
10720    unsafe {
10721        let filename_in: CString = utils::new_c_string(filename)?;
10722        let mut out_out: *mut bindings::VipsImage = null_mut();
10723
10724        let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10725        utils::result(
10726            vips_op_response,
10727            VipsImage { ctx: out_out },
10728            Error::PngloadError,
10729        )
10730    }
10731}
10732
10733/// Options for pngload operation
10734#[derive(Clone, Debug)]
10735pub struct PngloadOptions {
10736    /// unlimited: `bool` -> Remove all denial of service limits
10737    /// default: false
10738    pub unlimited: bool,
10739    /// flags: `ForeignFlags` -> Flags for this file
10740    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10741    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10742    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10743    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10744    ///  `All` -> VIPS_FOREIGN_ALL = 7
10745    pub flags: ForeignFlags,
10746    /// memory: `bool` -> Force open via memory
10747    /// default: false
10748    pub memory: bool,
10749    /// access: `Access` -> Required access pattern for this file
10750    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10751    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10752    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10753    ///  `Last` -> VIPS_ACCESS_LAST = 3
10754    pub access: Access,
10755    /// fail_on: `FailOn` -> Error level to fail on
10756    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10757    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10758    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10759    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10760    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10761    pub fail_on: FailOn,
10762    /// revalidate: `bool` -> Don't use a cached result for this operation
10763    /// default: false
10764    pub revalidate: bool,
10765}
10766
10767impl std::default::Default for PngloadOptions {
10768    fn default() -> Self {
10769        PngloadOptions {
10770            unlimited: false,
10771            flags: ForeignFlags::None,
10772            memory: false,
10773            access: Access::Random,
10774            fail_on: FailOn::None,
10775            revalidate: false,
10776        }
10777    }
10778}
10779
10780/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10781/// filename: `&str` -> Filename to load from
10782/// pngload_options: `&PngloadOptions` -> optional arguments
10783/// returns `VipsImage` - Output image
10784pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10785    unsafe {
10786        let filename_in: CString = utils::new_c_string(filename)?;
10787        let mut out_out: *mut bindings::VipsImage = null_mut();
10788
10789        let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10790        let unlimited_in_name = utils::new_c_string("unlimited")?;
10791
10792        let flags_in: i32 = pngload_options.flags as i32;
10793        let flags_in_name = utils::new_c_string("flags")?;
10794
10795        let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10796        let memory_in_name = utils::new_c_string("memory")?;
10797
10798        let access_in: i32 = pngload_options.access as i32;
10799        let access_in_name = utils::new_c_string("access")?;
10800
10801        let fail_on_in: i32 = pngload_options.fail_on as i32;
10802        let fail_on_in_name = utils::new_c_string("fail-on")?;
10803
10804        let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10805        let revalidate_in_name = utils::new_c_string("revalidate")?;
10806
10807        let vips_op_response = bindings::vips_pngload(
10808            filename_in.as_ptr(),
10809            &mut out_out,
10810            unlimited_in_name.as_ptr(),
10811            unlimited_in,
10812            flags_in_name.as_ptr(),
10813            flags_in,
10814            memory_in_name.as_ptr(),
10815            memory_in,
10816            access_in_name.as_ptr(),
10817            access_in,
10818            fail_on_in_name.as_ptr(),
10819            fail_on_in,
10820            revalidate_in_name.as_ptr(),
10821            revalidate_in,
10822            NULL,
10823        );
10824        utils::result(
10825            vips_op_response,
10826            VipsImage { ctx: out_out },
10827            Error::PngloadError,
10828        )
10829    }
10830}
10831
10832/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10833/// buffer: `&[u8]` -> Buffer to load from
10834/// returns `VipsImage` - Output image
10835pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10836    unsafe {
10837        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10838        let mut out_out: *mut bindings::VipsImage = null_mut();
10839
10840        let vips_op_response =
10841            bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10842        utils::result(
10843            vips_op_response,
10844            VipsImage { ctx: out_out },
10845            Error::PngloadBufferError,
10846        )
10847    }
10848}
10849
10850/// Options for pngload_buffer operation
10851#[derive(Clone, Debug)]
10852pub struct PngloadBufferOptions {
10853    /// unlimited: `bool` -> Remove all denial of service limits
10854    /// default: false
10855    pub unlimited: bool,
10856    /// flags: `ForeignFlags` -> Flags for this file
10857    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10858    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10859    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10860    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10861    ///  `All` -> VIPS_FOREIGN_ALL = 7
10862    pub flags: ForeignFlags,
10863    /// memory: `bool` -> Force open via memory
10864    /// default: false
10865    pub memory: bool,
10866    /// access: `Access` -> Required access pattern for this file
10867    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10868    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10869    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10870    ///  `Last` -> VIPS_ACCESS_LAST = 3
10871    pub access: Access,
10872    /// fail_on: `FailOn` -> Error level to fail on
10873    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10874    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10875    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10876    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10877    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10878    pub fail_on: FailOn,
10879    /// revalidate: `bool` -> Don't use a cached result for this operation
10880    /// default: false
10881    pub revalidate: bool,
10882}
10883
10884impl std::default::Default for PngloadBufferOptions {
10885    fn default() -> Self {
10886        PngloadBufferOptions {
10887            unlimited: false,
10888            flags: ForeignFlags::None,
10889            memory: false,
10890            access: Access::Random,
10891            fail_on: FailOn::None,
10892            revalidate: false,
10893        }
10894    }
10895}
10896
10897/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10898/// buffer: `&[u8]` -> Buffer to load from
10899/// pngload_buffer_options: `&PngloadBufferOptions` -> optional arguments
10900/// returns `VipsImage` - Output image
10901pub fn pngload_buffer_with_opts(
10902    buffer: &[u8],
10903    pngload_buffer_options: &PngloadBufferOptions,
10904) -> Result<VipsImage> {
10905    unsafe {
10906        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10907        let mut out_out: *mut bindings::VipsImage = null_mut();
10908
10909        let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10910            1
10911        } else {
10912            0
10913        };
10914        let unlimited_in_name = utils::new_c_string("unlimited")?;
10915
10916        let flags_in: i32 = pngload_buffer_options.flags as i32;
10917        let flags_in_name = utils::new_c_string("flags")?;
10918
10919        let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10920        let memory_in_name = utils::new_c_string("memory")?;
10921
10922        let access_in: i32 = pngload_buffer_options.access as i32;
10923        let access_in_name = utils::new_c_string("access")?;
10924
10925        let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10926        let fail_on_in_name = utils::new_c_string("fail-on")?;
10927
10928        let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10929            1
10930        } else {
10931            0
10932        };
10933        let revalidate_in_name = utils::new_c_string("revalidate")?;
10934
10935        let vips_op_response = bindings::vips_pngload_buffer(
10936            buffer_in,
10937            buffer.len() as u64,
10938            &mut out_out,
10939            unlimited_in_name.as_ptr(),
10940            unlimited_in,
10941            flags_in_name.as_ptr(),
10942            flags_in,
10943            memory_in_name.as_ptr(),
10944            memory_in,
10945            access_in_name.as_ptr(),
10946            access_in,
10947            fail_on_in_name.as_ptr(),
10948            fail_on_in,
10949            revalidate_in_name.as_ptr(),
10950            revalidate_in,
10951            NULL,
10952        );
10953        utils::result(
10954            vips_op_response,
10955            VipsImage { ctx: out_out },
10956            Error::PngloadBufferError,
10957        )
10958    }
10959}
10960
10961/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10962/// source: `&VipsSource` -> Source to load from
10963/// returns `VipsImage` - Output image
10964pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10965    unsafe {
10966        let source_in: *mut bindings::VipsSource = source.ctx;
10967        let mut out_out: *mut bindings::VipsImage = null_mut();
10968
10969        let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10970        utils::result(
10971            vips_op_response,
10972            VipsImage { ctx: out_out },
10973            Error::PngloadSourceError,
10974        )
10975    }
10976}
10977
10978/// Options for pngload_source operation
10979#[derive(Clone, Debug)]
10980pub struct PngloadSourceOptions {
10981    /// unlimited: `bool` -> Remove all denial of service limits
10982    /// default: false
10983    pub unlimited: bool,
10984    /// flags: `ForeignFlags` -> Flags for this file
10985    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10986    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10987    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10988    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10989    ///  `All` -> VIPS_FOREIGN_ALL = 7
10990    pub flags: ForeignFlags,
10991    /// memory: `bool` -> Force open via memory
10992    /// default: false
10993    pub memory: bool,
10994    /// access: `Access` -> Required access pattern for this file
10995    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10996    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10997    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10998    ///  `Last` -> VIPS_ACCESS_LAST = 3
10999    pub access: Access,
11000    /// fail_on: `FailOn` -> Error level to fail on
11001    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11002    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11003    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11004    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11005    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11006    pub fail_on: FailOn,
11007    /// revalidate: `bool` -> Don't use a cached result for this operation
11008    /// default: false
11009    pub revalidate: bool,
11010}
11011
11012impl std::default::Default for PngloadSourceOptions {
11013    fn default() -> Self {
11014        PngloadSourceOptions {
11015            unlimited: false,
11016            flags: ForeignFlags::None,
11017            memory: false,
11018            access: Access::Random,
11019            fail_on: FailOn::None,
11020            revalidate: false,
11021        }
11022    }
11023}
11024
11025/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11026/// source: `&VipsSource` -> Source to load from
11027/// pngload_source_options: `&PngloadSourceOptions` -> optional arguments
11028/// returns `VipsImage` - Output image
11029pub fn pngload_source_with_opts(
11030    source: &VipsSource,
11031    pngload_source_options: &PngloadSourceOptions,
11032) -> Result<VipsImage> {
11033    unsafe {
11034        let source_in: *mut bindings::VipsSource = source.ctx;
11035        let mut out_out: *mut bindings::VipsImage = null_mut();
11036
11037        let unlimited_in: i32 = if pngload_source_options.unlimited {
11038            1
11039        } else {
11040            0
11041        };
11042        let unlimited_in_name = utils::new_c_string("unlimited")?;
11043
11044        let flags_in: i32 = pngload_source_options.flags as i32;
11045        let flags_in_name = utils::new_c_string("flags")?;
11046
11047        let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
11048        let memory_in_name = utils::new_c_string("memory")?;
11049
11050        let access_in: i32 = pngload_source_options.access as i32;
11051        let access_in_name = utils::new_c_string("access")?;
11052
11053        let fail_on_in: i32 = pngload_source_options.fail_on as i32;
11054        let fail_on_in_name = utils::new_c_string("fail-on")?;
11055
11056        let revalidate_in: i32 = if pngload_source_options.revalidate {
11057            1
11058        } else {
11059            0
11060        };
11061        let revalidate_in_name = utils::new_c_string("revalidate")?;
11062
11063        let vips_op_response = bindings::vips_pngload_source(
11064            source_in,
11065            &mut out_out,
11066            unlimited_in_name.as_ptr(),
11067            unlimited_in,
11068            flags_in_name.as_ptr(),
11069            flags_in,
11070            memory_in_name.as_ptr(),
11071            memory_in,
11072            access_in_name.as_ptr(),
11073            access_in,
11074            fail_on_in_name.as_ptr(),
11075            fail_on_in,
11076            revalidate_in_name.as_ptr(),
11077            revalidate_in,
11078            NULL,
11079        );
11080        utils::result(
11081            vips_op_response,
11082            VipsImage { ctx: out_out },
11083            Error::PngloadSourceError,
11084        )
11085    }
11086}
11087
11088/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
11089/// filename: `&str` -> Filename to load from
11090/// returns `VipsImage` - Output image
11091pub fn jpegload(filename: &str) -> Result<VipsImage> {
11092    unsafe {
11093        let filename_in: CString = utils::new_c_string(filename)?;
11094        let mut out_out: *mut bindings::VipsImage = null_mut();
11095
11096        let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
11097        utils::result(
11098            vips_op_response,
11099            VipsImage { ctx: out_out },
11100            Error::JpegloadError,
11101        )
11102    }
11103}
11104
11105/// Options for jpegload operation
11106#[derive(Clone, Debug)]
11107pub struct JpegloadOptions {
11108    /// shrink: `i32` -> Shrink factor on load
11109    /// min: 1, max: 8, default: 1
11110    pub shrink: i32,
11111    /// autorotate: `bool` -> Rotate image using exif orientation
11112    /// default: false
11113    pub autorotate: bool,
11114    /// unlimited: `bool` -> Remove all denial of service limits
11115    /// default: false
11116    pub unlimited: bool,
11117    /// flags: `ForeignFlags` -> Flags for this file
11118    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11119    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11120    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11121    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11122    ///  `All` -> VIPS_FOREIGN_ALL = 7
11123    pub flags: ForeignFlags,
11124    /// memory: `bool` -> Force open via memory
11125    /// default: false
11126    pub memory: bool,
11127    /// access: `Access` -> Required access pattern for this file
11128    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11129    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11130    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11131    ///  `Last` -> VIPS_ACCESS_LAST = 3
11132    pub access: Access,
11133    /// fail_on: `FailOn` -> Error level to fail on
11134    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11135    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11136    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11137    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11138    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11139    pub fail_on: FailOn,
11140    /// revalidate: `bool` -> Don't use a cached result for this operation
11141    /// default: false
11142    pub revalidate: bool,
11143}
11144
11145impl std::default::Default for JpegloadOptions {
11146    fn default() -> Self {
11147        JpegloadOptions {
11148            shrink: i32::from(1),
11149            autorotate: false,
11150            unlimited: false,
11151            flags: ForeignFlags::None,
11152            memory: false,
11153            access: Access::Random,
11154            fail_on: FailOn::None,
11155            revalidate: false,
11156        }
11157    }
11158}
11159
11160/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
11161/// filename: `&str` -> Filename to load from
11162/// jpegload_options: `&JpegloadOptions` -> optional arguments
11163/// returns `VipsImage` - Output image
11164pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11165    unsafe {
11166        let filename_in: CString = utils::new_c_string(filename)?;
11167        let mut out_out: *mut bindings::VipsImage = null_mut();
11168
11169        let shrink_in: i32 = jpegload_options.shrink;
11170        let shrink_in_name = utils::new_c_string("shrink")?;
11171
11172        let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11173        let autorotate_in_name = utils::new_c_string("autorotate")?;
11174
11175        let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11176        let unlimited_in_name = utils::new_c_string("unlimited")?;
11177
11178        let flags_in: i32 = jpegload_options.flags as i32;
11179        let flags_in_name = utils::new_c_string("flags")?;
11180
11181        let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11182        let memory_in_name = utils::new_c_string("memory")?;
11183
11184        let access_in: i32 = jpegload_options.access as i32;
11185        let access_in_name = utils::new_c_string("access")?;
11186
11187        let fail_on_in: i32 = jpegload_options.fail_on as i32;
11188        let fail_on_in_name = utils::new_c_string("fail-on")?;
11189
11190        let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11191        let revalidate_in_name = utils::new_c_string("revalidate")?;
11192
11193        let vips_op_response = bindings::vips_jpegload(
11194            filename_in.as_ptr(),
11195            &mut out_out,
11196            shrink_in_name.as_ptr(),
11197            shrink_in,
11198            autorotate_in_name.as_ptr(),
11199            autorotate_in,
11200            unlimited_in_name.as_ptr(),
11201            unlimited_in,
11202            flags_in_name.as_ptr(),
11203            flags_in,
11204            memory_in_name.as_ptr(),
11205            memory_in,
11206            access_in_name.as_ptr(),
11207            access_in,
11208            fail_on_in_name.as_ptr(),
11209            fail_on_in,
11210            revalidate_in_name.as_ptr(),
11211            revalidate_in,
11212            NULL,
11213        );
11214        utils::result(
11215            vips_op_response,
11216            VipsImage { ctx: out_out },
11217            Error::JpegloadError,
11218        )
11219    }
11220}
11221
11222/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11223/// buffer: `&[u8]` -> Buffer to load from
11224/// returns `VipsImage` - Output image
11225pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11226    unsafe {
11227        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11228        let mut out_out: *mut bindings::VipsImage = null_mut();
11229
11230        let vips_op_response =
11231            bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11232        utils::result(
11233            vips_op_response,
11234            VipsImage { ctx: out_out },
11235            Error::JpegloadBufferError,
11236        )
11237    }
11238}
11239
11240/// Options for jpegload_buffer operation
11241#[derive(Clone, Debug)]
11242pub struct JpegloadBufferOptions {
11243    /// shrink: `i32` -> Shrink factor on load
11244    /// min: 1, max: 8, default: 1
11245    pub shrink: i32,
11246    /// autorotate: `bool` -> Rotate image using exif orientation
11247    /// default: false
11248    pub autorotate: bool,
11249    /// unlimited: `bool` -> Remove all denial of service limits
11250    /// default: false
11251    pub unlimited: bool,
11252    /// flags: `ForeignFlags` -> Flags for this file
11253    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11254    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11255    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11256    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11257    ///  `All` -> VIPS_FOREIGN_ALL = 7
11258    pub flags: ForeignFlags,
11259    /// memory: `bool` -> Force open via memory
11260    /// default: false
11261    pub memory: bool,
11262    /// access: `Access` -> Required access pattern for this file
11263    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11264    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11265    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11266    ///  `Last` -> VIPS_ACCESS_LAST = 3
11267    pub access: Access,
11268    /// fail_on: `FailOn` -> Error level to fail on
11269    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11270    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11271    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11272    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11273    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11274    pub fail_on: FailOn,
11275    /// revalidate: `bool` -> Don't use a cached result for this operation
11276    /// default: false
11277    pub revalidate: bool,
11278}
11279
11280impl std::default::Default for JpegloadBufferOptions {
11281    fn default() -> Self {
11282        JpegloadBufferOptions {
11283            shrink: i32::from(1),
11284            autorotate: false,
11285            unlimited: false,
11286            flags: ForeignFlags::None,
11287            memory: false,
11288            access: Access::Random,
11289            fail_on: FailOn::None,
11290            revalidate: false,
11291        }
11292    }
11293}
11294
11295/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11296/// buffer: `&[u8]` -> Buffer to load from
11297/// jpegload_buffer_options: `&JpegloadBufferOptions` -> optional arguments
11298/// returns `VipsImage` - Output image
11299pub fn jpegload_buffer_with_opts(
11300    buffer: &[u8],
11301    jpegload_buffer_options: &JpegloadBufferOptions,
11302) -> Result<VipsImage> {
11303    unsafe {
11304        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11305        let mut out_out: *mut bindings::VipsImage = null_mut();
11306
11307        let shrink_in: i32 = jpegload_buffer_options.shrink;
11308        let shrink_in_name = utils::new_c_string("shrink")?;
11309
11310        let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11311            1
11312        } else {
11313            0
11314        };
11315        let autorotate_in_name = utils::new_c_string("autorotate")?;
11316
11317        let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11318            1
11319        } else {
11320            0
11321        };
11322        let unlimited_in_name = utils::new_c_string("unlimited")?;
11323
11324        let flags_in: i32 = jpegload_buffer_options.flags as i32;
11325        let flags_in_name = utils::new_c_string("flags")?;
11326
11327        let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11328        let memory_in_name = utils::new_c_string("memory")?;
11329
11330        let access_in: i32 = jpegload_buffer_options.access as i32;
11331        let access_in_name = utils::new_c_string("access")?;
11332
11333        let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11334        let fail_on_in_name = utils::new_c_string("fail-on")?;
11335
11336        let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11337            1
11338        } else {
11339            0
11340        };
11341        let revalidate_in_name = utils::new_c_string("revalidate")?;
11342
11343        let vips_op_response = bindings::vips_jpegload_buffer(
11344            buffer_in,
11345            buffer.len() as u64,
11346            &mut out_out,
11347            shrink_in_name.as_ptr(),
11348            shrink_in,
11349            autorotate_in_name.as_ptr(),
11350            autorotate_in,
11351            unlimited_in_name.as_ptr(),
11352            unlimited_in,
11353            flags_in_name.as_ptr(),
11354            flags_in,
11355            memory_in_name.as_ptr(),
11356            memory_in,
11357            access_in_name.as_ptr(),
11358            access_in,
11359            fail_on_in_name.as_ptr(),
11360            fail_on_in,
11361            revalidate_in_name.as_ptr(),
11362            revalidate_in,
11363            NULL,
11364        );
11365        utils::result(
11366            vips_op_response,
11367            VipsImage { ctx: out_out },
11368            Error::JpegloadBufferError,
11369        )
11370    }
11371}
11372
11373/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11374/// filename: `&str` -> Filename to load from
11375/// returns `VipsImage` - Output image
11376pub fn webpload(filename: &str) -> Result<VipsImage> {
11377    unsafe {
11378        let filename_in: CString = utils::new_c_string(filename)?;
11379        let mut out_out: *mut bindings::VipsImage = null_mut();
11380
11381        let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11382        utils::result(
11383            vips_op_response,
11384            VipsImage { ctx: out_out },
11385            Error::WebploadError,
11386        )
11387    }
11388}
11389
11390/// Options for webpload operation
11391#[derive(Clone, Debug)]
11392pub struct WebploadOptions {
11393    /// page: `i32` -> First page to load
11394    /// min: 0, max: 100000, default: 0
11395    pub page: i32,
11396    /// n: `i32` -> Number of pages to load, -1 for all
11397    /// min: -1, max: 100000, default: 1
11398    pub n: i32,
11399    /// scale: `f64` -> Factor to scale by
11400    /// min: 0, max: 1024, default: 1
11401    pub scale: f64,
11402    /// flags: `ForeignFlags` -> Flags for this file
11403    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11404    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11405    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11406    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11407    ///  `All` -> VIPS_FOREIGN_ALL = 7
11408    pub flags: ForeignFlags,
11409    /// memory: `bool` -> Force open via memory
11410    /// default: false
11411    pub memory: bool,
11412    /// access: `Access` -> Required access pattern for this file
11413    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11414    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11415    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11416    ///  `Last` -> VIPS_ACCESS_LAST = 3
11417    pub access: Access,
11418    /// fail_on: `FailOn` -> Error level to fail on
11419    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11420    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11421    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11422    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11423    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11424    pub fail_on: FailOn,
11425    /// revalidate: `bool` -> Don't use a cached result for this operation
11426    /// default: false
11427    pub revalidate: bool,
11428}
11429
11430impl std::default::Default for WebploadOptions {
11431    fn default() -> Self {
11432        WebploadOptions {
11433            page: i32::from(0),
11434            n: i32::from(1),
11435            scale: f64::from(1),
11436            flags: ForeignFlags::None,
11437            memory: false,
11438            access: Access::Random,
11439            fail_on: FailOn::None,
11440            revalidate: false,
11441        }
11442    }
11443}
11444
11445/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11446/// filename: `&str` -> Filename to load from
11447/// webpload_options: `&WebploadOptions` -> optional arguments
11448/// returns `VipsImage` - Output image
11449pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11450    unsafe {
11451        let filename_in: CString = utils::new_c_string(filename)?;
11452        let mut out_out: *mut bindings::VipsImage = null_mut();
11453
11454        let page_in: i32 = webpload_options.page;
11455        let page_in_name = utils::new_c_string("page")?;
11456
11457        let n_in: i32 = webpload_options.n;
11458        let n_in_name = utils::new_c_string("n")?;
11459
11460        let scale_in: f64 = webpload_options.scale;
11461        let scale_in_name = utils::new_c_string("scale")?;
11462
11463        let flags_in: i32 = webpload_options.flags as i32;
11464        let flags_in_name = utils::new_c_string("flags")?;
11465
11466        let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11467        let memory_in_name = utils::new_c_string("memory")?;
11468
11469        let access_in: i32 = webpload_options.access as i32;
11470        let access_in_name = utils::new_c_string("access")?;
11471
11472        let fail_on_in: i32 = webpload_options.fail_on as i32;
11473        let fail_on_in_name = utils::new_c_string("fail-on")?;
11474
11475        let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11476        let revalidate_in_name = utils::new_c_string("revalidate")?;
11477
11478        let vips_op_response = bindings::vips_webpload(
11479            filename_in.as_ptr(),
11480            &mut out_out,
11481            page_in_name.as_ptr(),
11482            page_in,
11483            n_in_name.as_ptr(),
11484            n_in,
11485            scale_in_name.as_ptr(),
11486            scale_in,
11487            flags_in_name.as_ptr(),
11488            flags_in,
11489            memory_in_name.as_ptr(),
11490            memory_in,
11491            access_in_name.as_ptr(),
11492            access_in,
11493            fail_on_in_name.as_ptr(),
11494            fail_on_in,
11495            revalidate_in_name.as_ptr(),
11496            revalidate_in,
11497            NULL,
11498        );
11499        utils::result(
11500            vips_op_response,
11501            VipsImage { ctx: out_out },
11502            Error::WebploadError,
11503        )
11504    }
11505}
11506
11507/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11508/// buffer: `&[u8]` -> Buffer to load from
11509/// returns `VipsImage` - Output image
11510pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11511    unsafe {
11512        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11513        let mut out_out: *mut bindings::VipsImage = null_mut();
11514
11515        let vips_op_response =
11516            bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11517        utils::result(
11518            vips_op_response,
11519            VipsImage { ctx: out_out },
11520            Error::WebploadBufferError,
11521        )
11522    }
11523}
11524
11525/// Options for webpload_buffer operation
11526#[derive(Clone, Debug)]
11527pub struct WebploadBufferOptions {
11528    /// page: `i32` -> First page to load
11529    /// min: 0, max: 100000, default: 0
11530    pub page: i32,
11531    /// n: `i32` -> Number of pages to load, -1 for all
11532    /// min: -1, max: 100000, default: 1
11533    pub n: i32,
11534    /// scale: `f64` -> Factor to scale by
11535    /// min: 0, max: 1024, default: 1
11536    pub scale: f64,
11537    /// flags: `ForeignFlags` -> Flags for this file
11538    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11539    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11540    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11541    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11542    ///  `All` -> VIPS_FOREIGN_ALL = 7
11543    pub flags: ForeignFlags,
11544    /// memory: `bool` -> Force open via memory
11545    /// default: false
11546    pub memory: bool,
11547    /// access: `Access` -> Required access pattern for this file
11548    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11549    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11550    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11551    ///  `Last` -> VIPS_ACCESS_LAST = 3
11552    pub access: Access,
11553    /// fail_on: `FailOn` -> Error level to fail on
11554    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11555    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11556    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11557    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11558    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11559    pub fail_on: FailOn,
11560    /// revalidate: `bool` -> Don't use a cached result for this operation
11561    /// default: false
11562    pub revalidate: bool,
11563}
11564
11565impl std::default::Default for WebploadBufferOptions {
11566    fn default() -> Self {
11567        WebploadBufferOptions {
11568            page: i32::from(0),
11569            n: i32::from(1),
11570            scale: f64::from(1),
11571            flags: ForeignFlags::None,
11572            memory: false,
11573            access: Access::Random,
11574            fail_on: FailOn::None,
11575            revalidate: false,
11576        }
11577    }
11578}
11579
11580/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11581/// buffer: `&[u8]` -> Buffer to load from
11582/// webpload_buffer_options: `&WebploadBufferOptions` -> optional arguments
11583/// returns `VipsImage` - Output image
11584pub fn webpload_buffer_with_opts(
11585    buffer: &[u8],
11586    webpload_buffer_options: &WebploadBufferOptions,
11587) -> Result<VipsImage> {
11588    unsafe {
11589        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11590        let mut out_out: *mut bindings::VipsImage = null_mut();
11591
11592        let page_in: i32 = webpload_buffer_options.page;
11593        let page_in_name = utils::new_c_string("page")?;
11594
11595        let n_in: i32 = webpload_buffer_options.n;
11596        let n_in_name = utils::new_c_string("n")?;
11597
11598        let scale_in: f64 = webpload_buffer_options.scale;
11599        let scale_in_name = utils::new_c_string("scale")?;
11600
11601        let flags_in: i32 = webpload_buffer_options.flags as i32;
11602        let flags_in_name = utils::new_c_string("flags")?;
11603
11604        let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11605        let memory_in_name = utils::new_c_string("memory")?;
11606
11607        let access_in: i32 = webpload_buffer_options.access as i32;
11608        let access_in_name = utils::new_c_string("access")?;
11609
11610        let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11611        let fail_on_in_name = utils::new_c_string("fail-on")?;
11612
11613        let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11614            1
11615        } else {
11616            0
11617        };
11618        let revalidate_in_name = utils::new_c_string("revalidate")?;
11619
11620        let vips_op_response = bindings::vips_webpload_buffer(
11621            buffer_in,
11622            buffer.len() as u64,
11623            &mut out_out,
11624            page_in_name.as_ptr(),
11625            page_in,
11626            n_in_name.as_ptr(),
11627            n_in,
11628            scale_in_name.as_ptr(),
11629            scale_in,
11630            flags_in_name.as_ptr(),
11631            flags_in,
11632            memory_in_name.as_ptr(),
11633            memory_in,
11634            access_in_name.as_ptr(),
11635            access_in,
11636            fail_on_in_name.as_ptr(),
11637            fail_on_in,
11638            revalidate_in_name.as_ptr(),
11639            revalidate_in,
11640            NULL,
11641        );
11642        utils::result(
11643            vips_op_response,
11644            VipsImage { ctx: out_out },
11645            Error::WebploadBufferError,
11646        )
11647    }
11648}
11649
11650/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11651/// source: `&VipsSource` -> Source to load from
11652/// returns `VipsImage` - Output image
11653pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11654    unsafe {
11655        let source_in: *mut bindings::VipsSource = source.ctx;
11656        let mut out_out: *mut bindings::VipsImage = null_mut();
11657
11658        let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11659        utils::result(
11660            vips_op_response,
11661            VipsImage { ctx: out_out },
11662            Error::WebploadSourceError,
11663        )
11664    }
11665}
11666
11667/// Options for webpload_source operation
11668#[derive(Clone, Debug)]
11669pub struct WebploadSourceOptions {
11670    /// page: `i32` -> First page to load
11671    /// min: 0, max: 100000, default: 0
11672    pub page: i32,
11673    /// n: `i32` -> Number of pages to load, -1 for all
11674    /// min: -1, max: 100000, default: 1
11675    pub n: i32,
11676    /// scale: `f64` -> Factor to scale by
11677    /// min: 0, max: 1024, default: 1
11678    pub scale: f64,
11679    /// flags: `ForeignFlags` -> Flags for this file
11680    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11681    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11682    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11683    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11684    ///  `All` -> VIPS_FOREIGN_ALL = 7
11685    pub flags: ForeignFlags,
11686    /// memory: `bool` -> Force open via memory
11687    /// default: false
11688    pub memory: bool,
11689    /// access: `Access` -> Required access pattern for this file
11690    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11691    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11692    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11693    ///  `Last` -> VIPS_ACCESS_LAST = 3
11694    pub access: Access,
11695    /// fail_on: `FailOn` -> Error level to fail on
11696    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11697    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11698    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11699    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11700    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11701    pub fail_on: FailOn,
11702    /// revalidate: `bool` -> Don't use a cached result for this operation
11703    /// default: false
11704    pub revalidate: bool,
11705}
11706
11707impl std::default::Default for WebploadSourceOptions {
11708    fn default() -> Self {
11709        WebploadSourceOptions {
11710            page: i32::from(0),
11711            n: i32::from(1),
11712            scale: f64::from(1),
11713            flags: ForeignFlags::None,
11714            memory: false,
11715            access: Access::Random,
11716            fail_on: FailOn::None,
11717            revalidate: false,
11718        }
11719    }
11720}
11721
11722/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11723/// source: `&VipsSource` -> Source to load from
11724/// webpload_source_options: `&WebploadSourceOptions` -> optional arguments
11725/// returns `VipsImage` - Output image
11726pub fn webpload_source_with_opts(
11727    source: &VipsSource,
11728    webpload_source_options: &WebploadSourceOptions,
11729) -> Result<VipsImage> {
11730    unsafe {
11731        let source_in: *mut bindings::VipsSource = source.ctx;
11732        let mut out_out: *mut bindings::VipsImage = null_mut();
11733
11734        let page_in: i32 = webpload_source_options.page;
11735        let page_in_name = utils::new_c_string("page")?;
11736
11737        let n_in: i32 = webpload_source_options.n;
11738        let n_in_name = utils::new_c_string("n")?;
11739
11740        let scale_in: f64 = webpload_source_options.scale;
11741        let scale_in_name = utils::new_c_string("scale")?;
11742
11743        let flags_in: i32 = webpload_source_options.flags as i32;
11744        let flags_in_name = utils::new_c_string("flags")?;
11745
11746        let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11747        let memory_in_name = utils::new_c_string("memory")?;
11748
11749        let access_in: i32 = webpload_source_options.access as i32;
11750        let access_in_name = utils::new_c_string("access")?;
11751
11752        let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11753        let fail_on_in_name = utils::new_c_string("fail-on")?;
11754
11755        let revalidate_in: i32 = if webpload_source_options.revalidate {
11756            1
11757        } else {
11758            0
11759        };
11760        let revalidate_in_name = utils::new_c_string("revalidate")?;
11761
11762        let vips_op_response = bindings::vips_webpload_source(
11763            source_in,
11764            &mut out_out,
11765            page_in_name.as_ptr(),
11766            page_in,
11767            n_in_name.as_ptr(),
11768            n_in,
11769            scale_in_name.as_ptr(),
11770            scale_in,
11771            flags_in_name.as_ptr(),
11772            flags_in,
11773            memory_in_name.as_ptr(),
11774            memory_in,
11775            access_in_name.as_ptr(),
11776            access_in,
11777            fail_on_in_name.as_ptr(),
11778            fail_on_in,
11779            revalidate_in_name.as_ptr(),
11780            revalidate_in,
11781            NULL,
11782        );
11783        utils::result(
11784            vips_op_response,
11785            VipsImage { ctx: out_out },
11786            Error::WebploadSourceError,
11787        )
11788    }
11789}
11790
11791/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11792/// filename: `&str` -> Filename to load from
11793/// returns `VipsImage` - Output image
11794pub fn tiffload(filename: &str) -> Result<VipsImage> {
11795    unsafe {
11796        let filename_in: CString = utils::new_c_string(filename)?;
11797        let mut out_out: *mut bindings::VipsImage = null_mut();
11798
11799        let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11800        utils::result(
11801            vips_op_response,
11802            VipsImage { ctx: out_out },
11803            Error::TiffloadError,
11804        )
11805    }
11806}
11807
11808/// Options for tiffload operation
11809#[derive(Clone, Debug)]
11810pub struct TiffloadOptions {
11811    /// page: `i32` -> First page to load
11812    /// min: 0, max: 100000, default: 0
11813    pub page: i32,
11814    /// n: `i32` -> Number of pages to load, -1 for all
11815    /// min: -1, max: 100000, default: 1
11816    pub n: i32,
11817    /// autorotate: `bool` -> Rotate image using orientation tag
11818    /// default: false
11819    pub autorotate: bool,
11820    /// subifd: `i32` -> Subifd index
11821    /// min: -1, max: 100000, default: -1
11822    pub subifd: i32,
11823    /// unlimited: `bool` -> Remove all denial of service limits
11824    /// default: false
11825    pub unlimited: bool,
11826    /// flags: `ForeignFlags` -> Flags for this file
11827    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11828    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11829    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11830    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11831    ///  `All` -> VIPS_FOREIGN_ALL = 7
11832    pub flags: ForeignFlags,
11833    /// memory: `bool` -> Force open via memory
11834    /// default: false
11835    pub memory: bool,
11836    /// access: `Access` -> Required access pattern for this file
11837    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11838    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11839    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11840    ///  `Last` -> VIPS_ACCESS_LAST = 3
11841    pub access: Access,
11842    /// fail_on: `FailOn` -> Error level to fail on
11843    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11844    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11845    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11846    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11847    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11848    pub fail_on: FailOn,
11849    /// revalidate: `bool` -> Don't use a cached result for this operation
11850    /// default: false
11851    pub revalidate: bool,
11852}
11853
11854impl std::default::Default for TiffloadOptions {
11855    fn default() -> Self {
11856        TiffloadOptions {
11857            page: i32::from(0),
11858            n: i32::from(1),
11859            autorotate: false,
11860            subifd: i32::from(-1),
11861            unlimited: false,
11862            flags: ForeignFlags::None,
11863            memory: false,
11864            access: Access::Random,
11865            fail_on: FailOn::None,
11866            revalidate: false,
11867        }
11868    }
11869}
11870
11871/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11872/// filename: `&str` -> Filename to load from
11873/// tiffload_options: `&TiffloadOptions` -> optional arguments
11874/// returns `VipsImage` - Output image
11875pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11876    unsafe {
11877        let filename_in: CString = utils::new_c_string(filename)?;
11878        let mut out_out: *mut bindings::VipsImage = null_mut();
11879
11880        let page_in: i32 = tiffload_options.page;
11881        let page_in_name = utils::new_c_string("page")?;
11882
11883        let n_in: i32 = tiffload_options.n;
11884        let n_in_name = utils::new_c_string("n")?;
11885
11886        let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11887        let autorotate_in_name = utils::new_c_string("autorotate")?;
11888
11889        let subifd_in: i32 = tiffload_options.subifd;
11890        let subifd_in_name = utils::new_c_string("subifd")?;
11891
11892        let unlimited_in: i32 = if tiffload_options.unlimited { 1 } else { 0 };
11893        let unlimited_in_name = utils::new_c_string("unlimited")?;
11894
11895        let flags_in: i32 = tiffload_options.flags as i32;
11896        let flags_in_name = utils::new_c_string("flags")?;
11897
11898        let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11899        let memory_in_name = utils::new_c_string("memory")?;
11900
11901        let access_in: i32 = tiffload_options.access as i32;
11902        let access_in_name = utils::new_c_string("access")?;
11903
11904        let fail_on_in: i32 = tiffload_options.fail_on as i32;
11905        let fail_on_in_name = utils::new_c_string("fail-on")?;
11906
11907        let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11908        let revalidate_in_name = utils::new_c_string("revalidate")?;
11909
11910        let vips_op_response = bindings::vips_tiffload(
11911            filename_in.as_ptr(),
11912            &mut out_out,
11913            page_in_name.as_ptr(),
11914            page_in,
11915            n_in_name.as_ptr(),
11916            n_in,
11917            autorotate_in_name.as_ptr(),
11918            autorotate_in,
11919            subifd_in_name.as_ptr(),
11920            subifd_in,
11921            unlimited_in_name.as_ptr(),
11922            unlimited_in,
11923            flags_in_name.as_ptr(),
11924            flags_in,
11925            memory_in_name.as_ptr(),
11926            memory_in,
11927            access_in_name.as_ptr(),
11928            access_in,
11929            fail_on_in_name.as_ptr(),
11930            fail_on_in,
11931            revalidate_in_name.as_ptr(),
11932            revalidate_in,
11933            NULL,
11934        );
11935        utils::result(
11936            vips_op_response,
11937            VipsImage { ctx: out_out },
11938            Error::TiffloadError,
11939        )
11940    }
11941}
11942
11943/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11944/// buffer: `&[u8]` -> Buffer to load from
11945/// returns `VipsImage` - Output image
11946pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11947    unsafe {
11948        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11949        let mut out_out: *mut bindings::VipsImage = null_mut();
11950
11951        let vips_op_response =
11952            bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11953        utils::result(
11954            vips_op_response,
11955            VipsImage { ctx: out_out },
11956            Error::TiffloadBufferError,
11957        )
11958    }
11959}
11960
11961/// Options for tiffload_buffer operation
11962#[derive(Clone, Debug)]
11963pub struct TiffloadBufferOptions {
11964    /// page: `i32` -> First page to load
11965    /// min: 0, max: 100000, default: 0
11966    pub page: i32,
11967    /// n: `i32` -> Number of pages to load, -1 for all
11968    /// min: -1, max: 100000, default: 1
11969    pub n: i32,
11970    /// autorotate: `bool` -> Rotate image using orientation tag
11971    /// default: false
11972    pub autorotate: bool,
11973    /// subifd: `i32` -> Subifd index
11974    /// min: -1, max: 100000, default: -1
11975    pub subifd: i32,
11976    /// unlimited: `bool` -> Remove all denial of service limits
11977    /// default: false
11978    pub unlimited: bool,
11979    /// flags: `ForeignFlags` -> Flags for this file
11980    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11981    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11982    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11983    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11984    ///  `All` -> VIPS_FOREIGN_ALL = 7
11985    pub flags: ForeignFlags,
11986    /// memory: `bool` -> Force open via memory
11987    /// default: false
11988    pub memory: bool,
11989    /// access: `Access` -> Required access pattern for this file
11990    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11991    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11992    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11993    ///  `Last` -> VIPS_ACCESS_LAST = 3
11994    pub access: Access,
11995    /// fail_on: `FailOn` -> Error level to fail on
11996    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11997    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11998    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11999    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12000    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12001    pub fail_on: FailOn,
12002    /// revalidate: `bool` -> Don't use a cached result for this operation
12003    /// default: false
12004    pub revalidate: bool,
12005}
12006
12007impl std::default::Default for TiffloadBufferOptions {
12008    fn default() -> Self {
12009        TiffloadBufferOptions {
12010            page: i32::from(0),
12011            n: i32::from(1),
12012            autorotate: false,
12013            subifd: i32::from(-1),
12014            unlimited: false,
12015            flags: ForeignFlags::None,
12016            memory: false,
12017            access: Access::Random,
12018            fail_on: FailOn::None,
12019            revalidate: false,
12020        }
12021    }
12022}
12023
12024/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
12025/// buffer: `&[u8]` -> Buffer to load from
12026/// tiffload_buffer_options: `&TiffloadBufferOptions` -> optional arguments
12027/// returns `VipsImage` - Output image
12028pub fn tiffload_buffer_with_opts(
12029    buffer: &[u8],
12030    tiffload_buffer_options: &TiffloadBufferOptions,
12031) -> Result<VipsImage> {
12032    unsafe {
12033        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12034        let mut out_out: *mut bindings::VipsImage = null_mut();
12035
12036        let page_in: i32 = tiffload_buffer_options.page;
12037        let page_in_name = utils::new_c_string("page")?;
12038
12039        let n_in: i32 = tiffload_buffer_options.n;
12040        let n_in_name = utils::new_c_string("n")?;
12041
12042        let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
12043            1
12044        } else {
12045            0
12046        };
12047        let autorotate_in_name = utils::new_c_string("autorotate")?;
12048
12049        let subifd_in: i32 = tiffload_buffer_options.subifd;
12050        let subifd_in_name = utils::new_c_string("subifd")?;
12051
12052        let unlimited_in: i32 = if tiffload_buffer_options.unlimited {
12053            1
12054        } else {
12055            0
12056        };
12057        let unlimited_in_name = utils::new_c_string("unlimited")?;
12058
12059        let flags_in: i32 = tiffload_buffer_options.flags as i32;
12060        let flags_in_name = utils::new_c_string("flags")?;
12061
12062        let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
12063        let memory_in_name = utils::new_c_string("memory")?;
12064
12065        let access_in: i32 = tiffload_buffer_options.access as i32;
12066        let access_in_name = utils::new_c_string("access")?;
12067
12068        let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
12069        let fail_on_in_name = utils::new_c_string("fail-on")?;
12070
12071        let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
12072            1
12073        } else {
12074            0
12075        };
12076        let revalidate_in_name = utils::new_c_string("revalidate")?;
12077
12078        let vips_op_response = bindings::vips_tiffload_buffer(
12079            buffer_in,
12080            buffer.len() as u64,
12081            &mut out_out,
12082            page_in_name.as_ptr(),
12083            page_in,
12084            n_in_name.as_ptr(),
12085            n_in,
12086            autorotate_in_name.as_ptr(),
12087            autorotate_in,
12088            subifd_in_name.as_ptr(),
12089            subifd_in,
12090            unlimited_in_name.as_ptr(),
12091            unlimited_in,
12092            flags_in_name.as_ptr(),
12093            flags_in,
12094            memory_in_name.as_ptr(),
12095            memory_in,
12096            access_in_name.as_ptr(),
12097            access_in,
12098            fail_on_in_name.as_ptr(),
12099            fail_on_in,
12100            revalidate_in_name.as_ptr(),
12101            revalidate_in,
12102            NULL,
12103        );
12104        utils::result(
12105            vips_op_response,
12106            VipsImage { ctx: out_out },
12107            Error::TiffloadBufferError,
12108        )
12109    }
12110}
12111
12112/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12113/// source: `&VipsSource` -> Source to load from
12114/// returns `VipsImage` - Output image
12115pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
12116    unsafe {
12117        let source_in: *mut bindings::VipsSource = source.ctx;
12118        let mut out_out: *mut bindings::VipsImage = null_mut();
12119
12120        let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
12121        utils::result(
12122            vips_op_response,
12123            VipsImage { ctx: out_out },
12124            Error::TiffloadSourceError,
12125        )
12126    }
12127}
12128
12129/// Options for tiffload_source operation
12130#[derive(Clone, Debug)]
12131pub struct TiffloadSourceOptions {
12132    /// page: `i32` -> First page to load
12133    /// min: 0, max: 100000, default: 0
12134    pub page: i32,
12135    /// n: `i32` -> Number of pages to load, -1 for all
12136    /// min: -1, max: 100000, default: 1
12137    pub n: i32,
12138    /// autorotate: `bool` -> Rotate image using orientation tag
12139    /// default: false
12140    pub autorotate: bool,
12141    /// subifd: `i32` -> Subifd index
12142    /// min: -1, max: 100000, default: -1
12143    pub subifd: i32,
12144    /// unlimited: `bool` -> Remove all denial of service limits
12145    /// default: false
12146    pub unlimited: bool,
12147    /// flags: `ForeignFlags` -> Flags for this file
12148    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12149    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12150    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12151    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12152    ///  `All` -> VIPS_FOREIGN_ALL = 7
12153    pub flags: ForeignFlags,
12154    /// memory: `bool` -> Force open via memory
12155    /// default: false
12156    pub memory: bool,
12157    /// access: `Access` -> Required access pattern for this file
12158    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12159    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12160    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12161    ///  `Last` -> VIPS_ACCESS_LAST = 3
12162    pub access: Access,
12163    /// fail_on: `FailOn` -> Error level to fail on
12164    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12165    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12166    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12167    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12168    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12169    pub fail_on: FailOn,
12170    /// revalidate: `bool` -> Don't use a cached result for this operation
12171    /// default: false
12172    pub revalidate: bool,
12173}
12174
12175impl std::default::Default for TiffloadSourceOptions {
12176    fn default() -> Self {
12177        TiffloadSourceOptions {
12178            page: i32::from(0),
12179            n: i32::from(1),
12180            autorotate: false,
12181            subifd: i32::from(-1),
12182            unlimited: false,
12183            flags: ForeignFlags::None,
12184            memory: false,
12185            access: Access::Random,
12186            fail_on: FailOn::None,
12187            revalidate: false,
12188        }
12189    }
12190}
12191
12192/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12193/// source: `&VipsSource` -> Source to load from
12194/// tiffload_source_options: `&TiffloadSourceOptions` -> optional arguments
12195/// returns `VipsImage` - Output image
12196pub fn tiffload_source_with_opts(
12197    source: &VipsSource,
12198    tiffload_source_options: &TiffloadSourceOptions,
12199) -> Result<VipsImage> {
12200    unsafe {
12201        let source_in: *mut bindings::VipsSource = source.ctx;
12202        let mut out_out: *mut bindings::VipsImage = null_mut();
12203
12204        let page_in: i32 = tiffload_source_options.page;
12205        let page_in_name = utils::new_c_string("page")?;
12206
12207        let n_in: i32 = tiffload_source_options.n;
12208        let n_in_name = utils::new_c_string("n")?;
12209
12210        let autorotate_in: i32 = if tiffload_source_options.autorotate {
12211            1
12212        } else {
12213            0
12214        };
12215        let autorotate_in_name = utils::new_c_string("autorotate")?;
12216
12217        let subifd_in: i32 = tiffload_source_options.subifd;
12218        let subifd_in_name = utils::new_c_string("subifd")?;
12219
12220        let unlimited_in: i32 = if tiffload_source_options.unlimited {
12221            1
12222        } else {
12223            0
12224        };
12225        let unlimited_in_name = utils::new_c_string("unlimited")?;
12226
12227        let flags_in: i32 = tiffload_source_options.flags as i32;
12228        let flags_in_name = utils::new_c_string("flags")?;
12229
12230        let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12231        let memory_in_name = utils::new_c_string("memory")?;
12232
12233        let access_in: i32 = tiffload_source_options.access as i32;
12234        let access_in_name = utils::new_c_string("access")?;
12235
12236        let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12237        let fail_on_in_name = utils::new_c_string("fail-on")?;
12238
12239        let revalidate_in: i32 = if tiffload_source_options.revalidate {
12240            1
12241        } else {
12242            0
12243        };
12244        let revalidate_in_name = utils::new_c_string("revalidate")?;
12245
12246        let vips_op_response = bindings::vips_tiffload_source(
12247            source_in,
12248            &mut out_out,
12249            page_in_name.as_ptr(),
12250            page_in,
12251            n_in_name.as_ptr(),
12252            n_in,
12253            autorotate_in_name.as_ptr(),
12254            autorotate_in,
12255            subifd_in_name.as_ptr(),
12256            subifd_in,
12257            unlimited_in_name.as_ptr(),
12258            unlimited_in,
12259            flags_in_name.as_ptr(),
12260            flags_in,
12261            memory_in_name.as_ptr(),
12262            memory_in,
12263            access_in_name.as_ptr(),
12264            access_in,
12265            fail_on_in_name.as_ptr(),
12266            fail_on_in,
12267            revalidate_in_name.as_ptr(),
12268            revalidate_in,
12269            NULL,
12270        );
12271        utils::result(
12272            vips_op_response,
12273            VipsImage { ctx: out_out },
12274            Error::TiffloadSourceError,
12275        )
12276    }
12277}
12278
12279/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12280/// filename: `&str` -> Filename to load from
12281/// returns `VipsImage` - Output image
12282pub fn heifload(filename: &str) -> Result<VipsImage> {
12283    unsafe {
12284        let filename_in: CString = utils::new_c_string(filename)?;
12285        let mut out_out: *mut bindings::VipsImage = null_mut();
12286
12287        let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12288        utils::result(
12289            vips_op_response,
12290            VipsImage { ctx: out_out },
12291            Error::HeifloadError,
12292        )
12293    }
12294}
12295
12296/// Options for heifload operation
12297#[derive(Clone, Debug)]
12298pub struct HeifloadOptions {
12299    /// page: `i32` -> First page to load
12300    /// min: 0, max: 100000, default: 0
12301    pub page: i32,
12302    /// n: `i32` -> Number of pages to load, -1 for all
12303    /// min: -1, max: 100000, default: 1
12304    pub n: i32,
12305    /// thumbnail: `bool` -> Fetch thumbnail image
12306    /// default: false
12307    pub thumbnail: bool,
12308    /// unlimited: `bool` -> Remove all denial of service limits
12309    /// default: false
12310    pub unlimited: bool,
12311    /// flags: `ForeignFlags` -> Flags for this file
12312    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12313    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12314    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12315    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12316    ///  `All` -> VIPS_FOREIGN_ALL = 7
12317    pub flags: ForeignFlags,
12318    /// memory: `bool` -> Force open via memory
12319    /// default: false
12320    pub memory: bool,
12321    /// access: `Access` -> Required access pattern for this file
12322    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12323    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12324    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12325    ///  `Last` -> VIPS_ACCESS_LAST = 3
12326    pub access: Access,
12327    /// fail_on: `FailOn` -> Error level to fail on
12328    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12329    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12330    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12331    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12332    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12333    pub fail_on: FailOn,
12334    /// revalidate: `bool` -> Don't use a cached result for this operation
12335    /// default: false
12336    pub revalidate: bool,
12337}
12338
12339impl std::default::Default for HeifloadOptions {
12340    fn default() -> Self {
12341        HeifloadOptions {
12342            page: i32::from(0),
12343            n: i32::from(1),
12344            thumbnail: false,
12345            unlimited: false,
12346            flags: ForeignFlags::None,
12347            memory: false,
12348            access: Access::Random,
12349            fail_on: FailOn::None,
12350            revalidate: false,
12351        }
12352    }
12353}
12354
12355/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12356/// filename: `&str` -> Filename to load from
12357/// heifload_options: `&HeifloadOptions` -> optional arguments
12358/// returns `VipsImage` - Output image
12359pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
12360    unsafe {
12361        let filename_in: CString = utils::new_c_string(filename)?;
12362        let mut out_out: *mut bindings::VipsImage = null_mut();
12363
12364        let page_in: i32 = heifload_options.page;
12365        let page_in_name = utils::new_c_string("page")?;
12366
12367        let n_in: i32 = heifload_options.n;
12368        let n_in_name = utils::new_c_string("n")?;
12369
12370        let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
12371        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12372
12373        let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
12374        let unlimited_in_name = utils::new_c_string("unlimited")?;
12375
12376        let flags_in: i32 = heifload_options.flags as i32;
12377        let flags_in_name = utils::new_c_string("flags")?;
12378
12379        let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12380        let memory_in_name = utils::new_c_string("memory")?;
12381
12382        let access_in: i32 = heifload_options.access as i32;
12383        let access_in_name = utils::new_c_string("access")?;
12384
12385        let fail_on_in: i32 = heifload_options.fail_on as i32;
12386        let fail_on_in_name = utils::new_c_string("fail-on")?;
12387
12388        let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12389        let revalidate_in_name = utils::new_c_string("revalidate")?;
12390
12391        let vips_op_response = bindings::vips_heifload(
12392            filename_in.as_ptr(),
12393            &mut out_out,
12394            page_in_name.as_ptr(),
12395            page_in,
12396            n_in_name.as_ptr(),
12397            n_in,
12398            thumbnail_in_name.as_ptr(),
12399            thumbnail_in,
12400            unlimited_in_name.as_ptr(),
12401            unlimited_in,
12402            flags_in_name.as_ptr(),
12403            flags_in,
12404            memory_in_name.as_ptr(),
12405            memory_in,
12406            access_in_name.as_ptr(),
12407            access_in,
12408            fail_on_in_name.as_ptr(),
12409            fail_on_in,
12410            revalidate_in_name.as_ptr(),
12411            revalidate_in,
12412            NULL,
12413        );
12414        utils::result(
12415            vips_op_response,
12416            VipsImage { ctx: out_out },
12417            Error::HeifloadError,
12418        )
12419    }
12420}
12421
12422/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12423/// buffer: `&[u8]` -> Buffer to load from
12424/// returns `VipsImage` - Output image
12425pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12426    unsafe {
12427        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12428        let mut out_out: *mut bindings::VipsImage = null_mut();
12429
12430        let vips_op_response =
12431            bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12432        utils::result(
12433            vips_op_response,
12434            VipsImage { ctx: out_out },
12435            Error::HeifloadBufferError,
12436        )
12437    }
12438}
12439
12440/// Options for heifload_buffer operation
12441#[derive(Clone, Debug)]
12442pub struct HeifloadBufferOptions {
12443    /// page: `i32` -> First page to load
12444    /// min: 0, max: 100000, default: 0
12445    pub page: i32,
12446    /// n: `i32` -> Number of pages to load, -1 for all
12447    /// min: -1, max: 100000, default: 1
12448    pub n: i32,
12449    /// thumbnail: `bool` -> Fetch thumbnail image
12450    /// default: false
12451    pub thumbnail: bool,
12452    /// unlimited: `bool` -> Remove all denial of service limits
12453    /// default: false
12454    pub unlimited: bool,
12455    /// flags: `ForeignFlags` -> Flags for this file
12456    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12457    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12458    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12459    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12460    ///  `All` -> VIPS_FOREIGN_ALL = 7
12461    pub flags: ForeignFlags,
12462    /// memory: `bool` -> Force open via memory
12463    /// default: false
12464    pub memory: bool,
12465    /// access: `Access` -> Required access pattern for this file
12466    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12467    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12468    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12469    ///  `Last` -> VIPS_ACCESS_LAST = 3
12470    pub access: Access,
12471    /// fail_on: `FailOn` -> Error level to fail on
12472    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12473    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12474    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12475    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12476    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12477    pub fail_on: FailOn,
12478    /// revalidate: `bool` -> Don't use a cached result for this operation
12479    /// default: false
12480    pub revalidate: bool,
12481}
12482
12483impl std::default::Default for HeifloadBufferOptions {
12484    fn default() -> Self {
12485        HeifloadBufferOptions {
12486            page: i32::from(0),
12487            n: i32::from(1),
12488            thumbnail: false,
12489            unlimited: false,
12490            flags: ForeignFlags::None,
12491            memory: false,
12492            access: Access::Random,
12493            fail_on: FailOn::None,
12494            revalidate: false,
12495        }
12496    }
12497}
12498
12499/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12500/// buffer: `&[u8]` -> Buffer to load from
12501/// heifload_buffer_options: `&HeifloadBufferOptions` -> optional arguments
12502/// returns `VipsImage` - Output image
12503pub fn heifload_buffer_with_opts(
12504    buffer: &[u8],
12505    heifload_buffer_options: &HeifloadBufferOptions,
12506) -> Result<VipsImage> {
12507    unsafe {
12508        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12509        let mut out_out: *mut bindings::VipsImage = null_mut();
12510
12511        let page_in: i32 = heifload_buffer_options.page;
12512        let page_in_name = utils::new_c_string("page")?;
12513
12514        let n_in: i32 = heifload_buffer_options.n;
12515        let n_in_name = utils::new_c_string("n")?;
12516
12517        let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12518            1
12519        } else {
12520            0
12521        };
12522        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12523
12524        let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12525            1
12526        } else {
12527            0
12528        };
12529        let unlimited_in_name = utils::new_c_string("unlimited")?;
12530
12531        let flags_in: i32 = heifload_buffer_options.flags as i32;
12532        let flags_in_name = utils::new_c_string("flags")?;
12533
12534        let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12535        let memory_in_name = utils::new_c_string("memory")?;
12536
12537        let access_in: i32 = heifload_buffer_options.access as i32;
12538        let access_in_name = utils::new_c_string("access")?;
12539
12540        let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12541        let fail_on_in_name = utils::new_c_string("fail-on")?;
12542
12543        let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12544            1
12545        } else {
12546            0
12547        };
12548        let revalidate_in_name = utils::new_c_string("revalidate")?;
12549
12550        let vips_op_response = bindings::vips_heifload_buffer(
12551            buffer_in,
12552            buffer.len() as u64,
12553            &mut out_out,
12554            page_in_name.as_ptr(),
12555            page_in,
12556            n_in_name.as_ptr(),
12557            n_in,
12558            thumbnail_in_name.as_ptr(),
12559            thumbnail_in,
12560            unlimited_in_name.as_ptr(),
12561            unlimited_in,
12562            flags_in_name.as_ptr(),
12563            flags_in,
12564            memory_in_name.as_ptr(),
12565            memory_in,
12566            access_in_name.as_ptr(),
12567            access_in,
12568            fail_on_in_name.as_ptr(),
12569            fail_on_in,
12570            revalidate_in_name.as_ptr(),
12571            revalidate_in,
12572            NULL,
12573        );
12574        utils::result(
12575            vips_op_response,
12576            VipsImage { ctx: out_out },
12577            Error::HeifloadBufferError,
12578        )
12579    }
12580}
12581
12582/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12583/// source: `&VipsSource` -> Source to load from
12584/// returns `VipsImage` - Output image
12585pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12586    unsafe {
12587        let source_in: *mut bindings::VipsSource = source.ctx;
12588        let mut out_out: *mut bindings::VipsImage = null_mut();
12589
12590        let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12591        utils::result(
12592            vips_op_response,
12593            VipsImage { ctx: out_out },
12594            Error::HeifloadSourceError,
12595        )
12596    }
12597}
12598
12599/// Options for heifload_source operation
12600#[derive(Clone, Debug)]
12601pub struct HeifloadSourceOptions {
12602    /// page: `i32` -> First page to load
12603    /// min: 0, max: 100000, default: 0
12604    pub page: i32,
12605    /// n: `i32` -> Number of pages to load, -1 for all
12606    /// min: -1, max: 100000, default: 1
12607    pub n: i32,
12608    /// thumbnail: `bool` -> Fetch thumbnail image
12609    /// default: false
12610    pub thumbnail: bool,
12611    /// unlimited: `bool` -> Remove all denial of service limits
12612    /// default: false
12613    pub unlimited: bool,
12614    /// flags: `ForeignFlags` -> Flags for this file
12615    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12616    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12617    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12618    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12619    ///  `All` -> VIPS_FOREIGN_ALL = 7
12620    pub flags: ForeignFlags,
12621    /// memory: `bool` -> Force open via memory
12622    /// default: false
12623    pub memory: bool,
12624    /// access: `Access` -> Required access pattern for this file
12625    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12626    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12627    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12628    ///  `Last` -> VIPS_ACCESS_LAST = 3
12629    pub access: Access,
12630    /// fail_on: `FailOn` -> Error level to fail on
12631    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12632    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12633    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12634    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12635    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12636    pub fail_on: FailOn,
12637    /// revalidate: `bool` -> Don't use a cached result for this operation
12638    /// default: false
12639    pub revalidate: bool,
12640}
12641
12642impl std::default::Default for HeifloadSourceOptions {
12643    fn default() -> Self {
12644        HeifloadSourceOptions {
12645            page: i32::from(0),
12646            n: i32::from(1),
12647            thumbnail: false,
12648            unlimited: false,
12649            flags: ForeignFlags::None,
12650            memory: false,
12651            access: Access::Random,
12652            fail_on: FailOn::None,
12653            revalidate: false,
12654        }
12655    }
12656}
12657
12658/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12659/// source: `&VipsSource` -> Source to load from
12660/// heifload_source_options: `&HeifloadSourceOptions` -> optional arguments
12661/// returns `VipsImage` - Output image
12662pub fn heifload_source_with_opts(
12663    source: &VipsSource,
12664    heifload_source_options: &HeifloadSourceOptions,
12665) -> Result<VipsImage> {
12666    unsafe {
12667        let source_in: *mut bindings::VipsSource = source.ctx;
12668        let mut out_out: *mut bindings::VipsImage = null_mut();
12669
12670        let page_in: i32 = heifload_source_options.page;
12671        let page_in_name = utils::new_c_string("page")?;
12672
12673        let n_in: i32 = heifload_source_options.n;
12674        let n_in_name = utils::new_c_string("n")?;
12675
12676        let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12677            1
12678        } else {
12679            0
12680        };
12681        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12682
12683        let unlimited_in: i32 = if heifload_source_options.unlimited {
12684            1
12685        } else {
12686            0
12687        };
12688        let unlimited_in_name = utils::new_c_string("unlimited")?;
12689
12690        let flags_in: i32 = heifload_source_options.flags as i32;
12691        let flags_in_name = utils::new_c_string("flags")?;
12692
12693        let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12694        let memory_in_name = utils::new_c_string("memory")?;
12695
12696        let access_in: i32 = heifload_source_options.access as i32;
12697        let access_in_name = utils::new_c_string("access")?;
12698
12699        let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12700        let fail_on_in_name = utils::new_c_string("fail-on")?;
12701
12702        let revalidate_in: i32 = if heifload_source_options.revalidate {
12703            1
12704        } else {
12705            0
12706        };
12707        let revalidate_in_name = utils::new_c_string("revalidate")?;
12708
12709        let vips_op_response = bindings::vips_heifload_source(
12710            source_in,
12711            &mut out_out,
12712            page_in_name.as_ptr(),
12713            page_in,
12714            n_in_name.as_ptr(),
12715            n_in,
12716            thumbnail_in_name.as_ptr(),
12717            thumbnail_in,
12718            unlimited_in_name.as_ptr(),
12719            unlimited_in,
12720            flags_in_name.as_ptr(),
12721            flags_in,
12722            memory_in_name.as_ptr(),
12723            memory_in,
12724            access_in_name.as_ptr(),
12725            access_in,
12726            fail_on_in_name.as_ptr(),
12727            fail_on_in,
12728            revalidate_in_name.as_ptr(),
12729            revalidate_in,
12730            NULL,
12731        );
12732        utils::result(
12733            vips_op_response,
12734            VipsImage { ctx: out_out },
12735            Error::HeifloadSourceError,
12736        )
12737    }
12738}
12739
12740/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12741/// inp: `&VipsImage` -> Image to save
12742/// filename: `&str` -> Filename to save to
12743
12744pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12745    unsafe {
12746        let inp_in: *mut bindings::VipsImage = inp.ctx;
12747        let filename_in: CString = utils::new_c_string(filename)?;
12748
12749        let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12750        utils::result(vips_op_response, (), Error::CsvsaveError)
12751    }
12752}
12753
12754/// Options for csvsave operation
12755#[derive(Clone, Debug)]
12756pub struct CsvsaveOptions {
12757    /// separator: `String` -> Separator characters
12758    pub separator: String,
12759    /// keep: `ForeignKeep` -> Which metadata to retain
12760    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12761    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12762    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12763    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12764    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12765    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12766    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12767    pub keep: ForeignKeep,
12768    /// background: `Vec<f64>` -> Background value
12769    pub background: Vec<f64>,
12770    /// page_height: `i32` -> Set page height for multipage save
12771    /// min: 0, max: 100000000, default: 0
12772    pub page_height: i32,
12773    /// profile: `String` -> Filename of ICC profile to embed
12774    pub profile: String,
12775}
12776
12777impl std::default::Default for CsvsaveOptions {
12778    fn default() -> Self {
12779        CsvsaveOptions {
12780            separator: String::new(),
12781            keep: ForeignKeep::All,
12782            background: Vec::new(),
12783            page_height: i32::from(0),
12784            profile: String::from("sRGB"),
12785        }
12786    }
12787}
12788
12789/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12790/// inp: `&VipsImage` -> Image to save
12791/// filename: `&str` -> Filename to save to
12792/// csvsave_options: `&CsvsaveOptions` -> optional arguments
12793
12794pub fn csvsave_with_opts(
12795    inp: &VipsImage,
12796    filename: &str,
12797    csvsave_options: &CsvsaveOptions,
12798) -> Result<()> {
12799    unsafe {
12800        let inp_in: *mut bindings::VipsImage = inp.ctx;
12801        let filename_in: CString = utils::new_c_string(filename)?;
12802
12803        let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12804        let separator_in_name = utils::new_c_string("separator")?;
12805
12806        let keep_in: i32 = csvsave_options.keep as i32;
12807        let keep_in_name = utils::new_c_string("keep")?;
12808
12809        let background_wrapper =
12810            utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12811        let background_in = background_wrapper.ctx;
12812        let background_in_name = utils::new_c_string("background")?;
12813
12814        let page_height_in: i32 = csvsave_options.page_height;
12815        let page_height_in_name = utils::new_c_string("page-height")?;
12816
12817        let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12818        let profile_in_name = utils::new_c_string("profile")?;
12819
12820        let vips_op_response = bindings::vips_csvsave(
12821            inp_in,
12822            filename_in.as_ptr(),
12823            separator_in_name.as_ptr(),
12824            separator_in.as_ptr(),
12825            keep_in_name.as_ptr(),
12826            keep_in,
12827            background_in_name.as_ptr(),
12828            background_in,
12829            page_height_in_name.as_ptr(),
12830            page_height_in,
12831            profile_in_name.as_ptr(),
12832            profile_in.as_ptr(),
12833            NULL,
12834        );
12835        utils::result(vips_op_response, (), Error::CsvsaveError)
12836    }
12837}
12838
12839/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12840/// inp: `&VipsImage` -> Image to save
12841/// target: `&VipsTarget` -> Target to save to
12842
12843pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12844    unsafe {
12845        let inp_in: *mut bindings::VipsImage = inp.ctx;
12846        let target_in: *mut bindings::VipsTarget = target.ctx;
12847
12848        let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12849        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12850    }
12851}
12852
12853/// Options for csvsave_target operation
12854#[derive(Clone, Debug)]
12855pub struct CsvsaveTargetOptions {
12856    /// separator: `String` -> Separator characters
12857    pub separator: String,
12858    /// keep: `ForeignKeep` -> Which metadata to retain
12859    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12860    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12861    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12862    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12863    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12864    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12865    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12866    pub keep: ForeignKeep,
12867    /// background: `Vec<f64>` -> Background value
12868    pub background: Vec<f64>,
12869    /// page_height: `i32` -> Set page height for multipage save
12870    /// min: 0, max: 100000000, default: 0
12871    pub page_height: i32,
12872    /// profile: `String` -> Filename of ICC profile to embed
12873    pub profile: String,
12874}
12875
12876impl std::default::Default for CsvsaveTargetOptions {
12877    fn default() -> Self {
12878        CsvsaveTargetOptions {
12879            separator: String::new(),
12880            keep: ForeignKeep::All,
12881            background: Vec::new(),
12882            page_height: i32::from(0),
12883            profile: String::from("sRGB"),
12884        }
12885    }
12886}
12887
12888/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12889/// inp: `&VipsImage` -> Image to save
12890/// target: `&VipsTarget` -> Target to save to
12891/// csvsave_target_options: `&CsvsaveTargetOptions` -> optional arguments
12892
12893pub fn csvsave_target_with_opts(
12894    inp: &VipsImage,
12895    target: &VipsTarget,
12896    csvsave_target_options: &CsvsaveTargetOptions,
12897) -> Result<()> {
12898    unsafe {
12899        let inp_in: *mut bindings::VipsImage = inp.ctx;
12900        let target_in: *mut bindings::VipsTarget = target.ctx;
12901
12902        let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12903        let separator_in_name = utils::new_c_string("separator")?;
12904
12905        let keep_in: i32 = csvsave_target_options.keep as i32;
12906        let keep_in_name = utils::new_c_string("keep")?;
12907
12908        let background_wrapper =
12909            utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12910        let background_in = background_wrapper.ctx;
12911        let background_in_name = utils::new_c_string("background")?;
12912
12913        let page_height_in: i32 = csvsave_target_options.page_height;
12914        let page_height_in_name = utils::new_c_string("page-height")?;
12915
12916        let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12917        let profile_in_name = utils::new_c_string("profile")?;
12918
12919        let vips_op_response = bindings::vips_csvsave_target(
12920            inp_in,
12921            target_in,
12922            separator_in_name.as_ptr(),
12923            separator_in.as_ptr(),
12924            keep_in_name.as_ptr(),
12925            keep_in,
12926            background_in_name.as_ptr(),
12927            background_in,
12928            page_height_in_name.as_ptr(),
12929            page_height_in,
12930            profile_in_name.as_ptr(),
12931            profile_in.as_ptr(),
12932            NULL,
12933        );
12934        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12935    }
12936}
12937
12938/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12939/// inp: `&VipsImage` -> Image to save
12940/// filename: `&str` -> Filename to save to
12941
12942pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12943    unsafe {
12944        let inp_in: *mut bindings::VipsImage = inp.ctx;
12945        let filename_in: CString = utils::new_c_string(filename)?;
12946
12947        let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12948        utils::result(vips_op_response, (), Error::MatrixsaveError)
12949    }
12950}
12951
12952/// Options for matrixsave operation
12953#[derive(Clone, Debug)]
12954pub struct MatrixsaveOptions {
12955    /// keep: `ForeignKeep` -> Which metadata to retain
12956    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12957    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12958    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12959    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12960    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12961    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12962    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12963    pub keep: ForeignKeep,
12964    /// background: `Vec<f64>` -> Background value
12965    pub background: Vec<f64>,
12966    /// page_height: `i32` -> Set page height for multipage save
12967    /// min: 0, max: 100000000, default: 0
12968    pub page_height: i32,
12969    /// profile: `String` -> Filename of ICC profile to embed
12970    pub profile: String,
12971}
12972
12973impl std::default::Default for MatrixsaveOptions {
12974    fn default() -> Self {
12975        MatrixsaveOptions {
12976            keep: ForeignKeep::All,
12977            background: Vec::new(),
12978            page_height: i32::from(0),
12979            profile: String::from("sRGB"),
12980        }
12981    }
12982}
12983
12984/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12985/// inp: `&VipsImage` -> Image to save
12986/// filename: `&str` -> Filename to save to
12987/// matrixsave_options: `&MatrixsaveOptions` -> optional arguments
12988
12989pub fn matrixsave_with_opts(
12990    inp: &VipsImage,
12991    filename: &str,
12992    matrixsave_options: &MatrixsaveOptions,
12993) -> Result<()> {
12994    unsafe {
12995        let inp_in: *mut bindings::VipsImage = inp.ctx;
12996        let filename_in: CString = utils::new_c_string(filename)?;
12997
12998        let keep_in: i32 = matrixsave_options.keep as i32;
12999        let keep_in_name = utils::new_c_string("keep")?;
13000
13001        let background_wrapper =
13002            utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
13003        let background_in = background_wrapper.ctx;
13004        let background_in_name = utils::new_c_string("background")?;
13005
13006        let page_height_in: i32 = matrixsave_options.page_height;
13007        let page_height_in_name = utils::new_c_string("page-height")?;
13008
13009        let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
13010        let profile_in_name = utils::new_c_string("profile")?;
13011
13012        let vips_op_response = bindings::vips_matrixsave(
13013            inp_in,
13014            filename_in.as_ptr(),
13015            keep_in_name.as_ptr(),
13016            keep_in,
13017            background_in_name.as_ptr(),
13018            background_in,
13019            page_height_in_name.as_ptr(),
13020            page_height_in,
13021            profile_in_name.as_ptr(),
13022            profile_in.as_ptr(),
13023            NULL,
13024        );
13025        utils::result(vips_op_response, (), Error::MatrixsaveError)
13026    }
13027}
13028
13029/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
13030/// inp: `&VipsImage` -> Image to save
13031/// target: `&VipsTarget` -> Target to save to
13032
13033pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13034    unsafe {
13035        let inp_in: *mut bindings::VipsImage = inp.ctx;
13036        let target_in: *mut bindings::VipsTarget = target.ctx;
13037
13038        let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
13039        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
13040    }
13041}
13042
13043/// Options for matrixsave_target operation
13044#[derive(Clone, Debug)]
13045pub struct MatrixsaveTargetOptions {
13046    /// keep: `ForeignKeep` -> Which metadata to retain
13047    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13048    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13049    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13050    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13051    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13052    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13053    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13054    pub keep: ForeignKeep,
13055    /// background: `Vec<f64>` -> Background value
13056    pub background: Vec<f64>,
13057    /// page_height: `i32` -> Set page height for multipage save
13058    /// min: 0, max: 100000000, default: 0
13059    pub page_height: i32,
13060    /// profile: `String` -> Filename of ICC profile to embed
13061    pub profile: String,
13062}
13063
13064impl std::default::Default for MatrixsaveTargetOptions {
13065    fn default() -> Self {
13066        MatrixsaveTargetOptions {
13067            keep: ForeignKeep::All,
13068            background: Vec::new(),
13069            page_height: i32::from(0),
13070            profile: String::from("sRGB"),
13071        }
13072    }
13073}
13074
13075/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
13076/// inp: `&VipsImage` -> Image to save
13077/// target: `&VipsTarget` -> Target to save to
13078/// matrixsave_target_options: `&MatrixsaveTargetOptions` -> optional arguments
13079
13080pub fn matrixsave_target_with_opts(
13081    inp: &VipsImage,
13082    target: &VipsTarget,
13083    matrixsave_target_options: &MatrixsaveTargetOptions,
13084) -> Result<()> {
13085    unsafe {
13086        let inp_in: *mut bindings::VipsImage = inp.ctx;
13087        let target_in: *mut bindings::VipsTarget = target.ctx;
13088
13089        let keep_in: i32 = matrixsave_target_options.keep as i32;
13090        let keep_in_name = utils::new_c_string("keep")?;
13091
13092        let background_wrapper =
13093            utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
13094        let background_in = background_wrapper.ctx;
13095        let background_in_name = utils::new_c_string("background")?;
13096
13097        let page_height_in: i32 = matrixsave_target_options.page_height;
13098        let page_height_in_name = utils::new_c_string("page-height")?;
13099
13100        let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
13101        let profile_in_name = utils::new_c_string("profile")?;
13102
13103        let vips_op_response = bindings::vips_matrixsave_target(
13104            inp_in,
13105            target_in,
13106            keep_in_name.as_ptr(),
13107            keep_in,
13108            background_in_name.as_ptr(),
13109            background_in,
13110            page_height_in_name.as_ptr(),
13111            page_height_in,
13112            profile_in_name.as_ptr(),
13113            profile_in.as_ptr(),
13114            NULL,
13115        );
13116        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
13117    }
13118}
13119
13120/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
13121/// inp: `&VipsImage` -> Image to save
13122
13123pub fn matrixprint(inp: &VipsImage) -> Result<()> {
13124    unsafe {
13125        let inp_in: *mut bindings::VipsImage = inp.ctx;
13126
13127        let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
13128        utils::result(vips_op_response, (), Error::MatrixprintError)
13129    }
13130}
13131
13132/// Options for matrixprint operation
13133#[derive(Clone, Debug)]
13134pub struct MatrixprintOptions {
13135    /// keep: `ForeignKeep` -> Which metadata to retain
13136    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13137    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13138    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13139    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13140    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13141    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13142    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13143    pub keep: ForeignKeep,
13144    /// background: `Vec<f64>` -> Background value
13145    pub background: Vec<f64>,
13146    /// page_height: `i32` -> Set page height for multipage save
13147    /// min: 0, max: 100000000, default: 0
13148    pub page_height: i32,
13149    /// profile: `String` -> Filename of ICC profile to embed
13150    pub profile: String,
13151}
13152
13153impl std::default::Default for MatrixprintOptions {
13154    fn default() -> Self {
13155        MatrixprintOptions {
13156            keep: ForeignKeep::All,
13157            background: Vec::new(),
13158            page_height: i32::from(0),
13159            profile: String::from("sRGB"),
13160        }
13161    }
13162}
13163
13164/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
13165/// inp: `&VipsImage` -> Image to save
13166/// matrixprint_options: `&MatrixprintOptions` -> optional arguments
13167
13168pub fn matrixprint_with_opts(
13169    inp: &VipsImage,
13170    matrixprint_options: &MatrixprintOptions,
13171) -> Result<()> {
13172    unsafe {
13173        let inp_in: *mut bindings::VipsImage = inp.ctx;
13174
13175        let keep_in: i32 = matrixprint_options.keep as i32;
13176        let keep_in_name = utils::new_c_string("keep")?;
13177
13178        let background_wrapper =
13179            utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
13180        let background_in = background_wrapper.ctx;
13181        let background_in_name = utils::new_c_string("background")?;
13182
13183        let page_height_in: i32 = matrixprint_options.page_height;
13184        let page_height_in_name = utils::new_c_string("page-height")?;
13185
13186        let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
13187        let profile_in_name = utils::new_c_string("profile")?;
13188
13189        let vips_op_response = bindings::vips_matrixprint(
13190            inp_in,
13191            keep_in_name.as_ptr(),
13192            keep_in,
13193            background_in_name.as_ptr(),
13194            background_in,
13195            page_height_in_name.as_ptr(),
13196            page_height_in,
13197            profile_in_name.as_ptr(),
13198            profile_in.as_ptr(),
13199            NULL,
13200        );
13201        utils::result(vips_op_response, (), Error::MatrixprintError)
13202    }
13203}
13204
13205/// VipsForeignSaveRawFile (rawsave), save image to raw file (.raw), priority=0,
13206/// inp: `&VipsImage` -> Image to save
13207/// filename: `&str` -> Filename to save to
13208
13209pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
13210    unsafe {
13211        let inp_in: *mut bindings::VipsImage = inp.ctx;
13212        let filename_in: CString = utils::new_c_string(filename)?;
13213
13214        let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
13215        utils::result(vips_op_response, (), Error::RawsaveError)
13216    }
13217}
13218
13219/// Options for rawsave operation
13220#[derive(Clone, Debug)]
13221pub struct RawsaveOptions {
13222    /// keep: `ForeignKeep` -> Which metadata to retain
13223    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13224    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13225    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13226    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13227    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13228    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13229    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13230    pub keep: ForeignKeep,
13231    /// background: `Vec<f64>` -> Background value
13232    pub background: Vec<f64>,
13233    /// page_height: `i32` -> Set page height for multipage save
13234    /// min: 0, max: 100000000, default: 0
13235    pub page_height: i32,
13236    /// profile: `String` -> Filename of ICC profile to embed
13237    pub profile: String,
13238}
13239
13240impl std::default::Default for RawsaveOptions {
13241    fn default() -> Self {
13242        RawsaveOptions {
13243            keep: ForeignKeep::All,
13244            background: Vec::new(),
13245            page_height: i32::from(0),
13246            profile: String::from("sRGB"),
13247        }
13248    }
13249}
13250
13251/// VipsForeignSaveRawFile (rawsave), save image to raw file (.raw), priority=0,
13252/// inp: `&VipsImage` -> Image to save
13253/// filename: `&str` -> Filename to save to
13254/// rawsave_options: `&RawsaveOptions` -> optional arguments
13255
13256pub fn rawsave_with_opts(
13257    inp: &VipsImage,
13258    filename: &str,
13259    rawsave_options: &RawsaveOptions,
13260) -> Result<()> {
13261    unsafe {
13262        let inp_in: *mut bindings::VipsImage = inp.ctx;
13263        let filename_in: CString = utils::new_c_string(filename)?;
13264
13265        let keep_in: i32 = rawsave_options.keep as i32;
13266        let keep_in_name = utils::new_c_string("keep")?;
13267
13268        let background_wrapper =
13269            utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
13270        let background_in = background_wrapper.ctx;
13271        let background_in_name = utils::new_c_string("background")?;
13272
13273        let page_height_in: i32 = rawsave_options.page_height;
13274        let page_height_in_name = utils::new_c_string("page-height")?;
13275
13276        let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
13277        let profile_in_name = utils::new_c_string("profile")?;
13278
13279        let vips_op_response = bindings::vips_rawsave(
13280            inp_in,
13281            filename_in.as_ptr(),
13282            keep_in_name.as_ptr(),
13283            keep_in,
13284            background_in_name.as_ptr(),
13285            background_in,
13286            page_height_in_name.as_ptr(),
13287            page_height_in,
13288            profile_in_name.as_ptr(),
13289            profile_in.as_ptr(),
13290            NULL,
13291        );
13292        utils::result(vips_op_response, (), Error::RawsaveError)
13293    }
13294}
13295
13296/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer (.raw), priority=0,
13297/// inp: `&VipsImage` -> Image to save
13298/// returns `Vec<u8>` - Buffer to save to
13299pub fn rawsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13300    unsafe {
13301        let inp_in: *mut bindings::VipsImage = inp.ctx;
13302        let mut buffer_buf_size: u64 = 0;
13303        let mut buffer_out: *mut c_void = null_mut();
13304
13305        let vips_op_response =
13306            bindings::vips_rawsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13307        utils::result(
13308            vips_op_response,
13309            utils::new_byte_array(buffer_out, buffer_buf_size),
13310            Error::RawsaveBufferError,
13311        )
13312    }
13313}
13314
13315/// Options for rawsave_buffer operation
13316#[derive(Clone, Debug)]
13317pub struct RawsaveBufferOptions {
13318    /// keep: `ForeignKeep` -> Which metadata to retain
13319    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13320    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13321    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13322    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13323    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13324    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13325    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13326    pub keep: ForeignKeep,
13327    /// background: `Vec<f64>` -> Background value
13328    pub background: Vec<f64>,
13329    /// page_height: `i32` -> Set page height for multipage save
13330    /// min: 0, max: 100000000, default: 0
13331    pub page_height: i32,
13332    /// profile: `String` -> Filename of ICC profile to embed
13333    pub profile: String,
13334}
13335
13336impl std::default::Default for RawsaveBufferOptions {
13337    fn default() -> Self {
13338        RawsaveBufferOptions {
13339            keep: ForeignKeep::All,
13340            background: Vec::new(),
13341            page_height: i32::from(0),
13342            profile: String::from("sRGB"),
13343        }
13344    }
13345}
13346
13347/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer (.raw), priority=0,
13348/// inp: `&VipsImage` -> Image to save
13349/// rawsave_buffer_options: `&RawsaveBufferOptions` -> optional arguments
13350/// returns `Vec<u8>` - Buffer to save to
13351pub fn rawsave_buffer_with_opts(
13352    inp: &VipsImage,
13353    rawsave_buffer_options: &RawsaveBufferOptions,
13354) -> Result<Vec<u8>> {
13355    unsafe {
13356        let inp_in: *mut bindings::VipsImage = inp.ctx;
13357        let mut buffer_buf_size: u64 = 0;
13358        let mut buffer_out: *mut c_void = null_mut();
13359
13360        let keep_in: i32 = rawsave_buffer_options.keep as i32;
13361        let keep_in_name = utils::new_c_string("keep")?;
13362
13363        let background_wrapper =
13364            utils::VipsArrayDoubleWrapper::from(&rawsave_buffer_options.background[..]);
13365        let background_in = background_wrapper.ctx;
13366        let background_in_name = utils::new_c_string("background")?;
13367
13368        let page_height_in: i32 = rawsave_buffer_options.page_height;
13369        let page_height_in_name = utils::new_c_string("page-height")?;
13370
13371        let profile_in: CString = utils::new_c_string(&rawsave_buffer_options.profile)?;
13372        let profile_in_name = utils::new_c_string("profile")?;
13373
13374        let vips_op_response = bindings::vips_rawsave_buffer(
13375            inp_in,
13376            &mut buffer_out,
13377            &mut buffer_buf_size,
13378            keep_in_name.as_ptr(),
13379            keep_in,
13380            background_in_name.as_ptr(),
13381            background_in,
13382            page_height_in_name.as_ptr(),
13383            page_height_in,
13384            profile_in_name.as_ptr(),
13385            profile_in.as_ptr(),
13386            NULL,
13387        );
13388        utils::result(
13389            vips_op_response,
13390            utils::new_byte_array(buffer_out, buffer_buf_size),
13391            Error::RawsaveBufferError,
13392        )
13393    }
13394}
13395
13396/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target (.raw), priority=0,
13397/// inp: `&VipsImage` -> Image to save
13398/// target: `&VipsTarget` -> Target to save to
13399
13400pub fn rawsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13401    unsafe {
13402        let inp_in: *mut bindings::VipsImage = inp.ctx;
13403        let target_in: *mut bindings::VipsTarget = target.ctx;
13404
13405        let vips_op_response = bindings::vips_rawsave_target(inp_in, target_in, NULL);
13406        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13407    }
13408}
13409
13410/// Options for rawsave_target operation
13411#[derive(Clone, Debug)]
13412pub struct RawsaveTargetOptions {
13413    /// keep: `ForeignKeep` -> Which metadata to retain
13414    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13415    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13416    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13417    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13418    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13419    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13420    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13421    pub keep: ForeignKeep,
13422    /// background: `Vec<f64>` -> Background value
13423    pub background: Vec<f64>,
13424    /// page_height: `i32` -> Set page height for multipage save
13425    /// min: 0, max: 100000000, default: 0
13426    pub page_height: i32,
13427    /// profile: `String` -> Filename of ICC profile to embed
13428    pub profile: String,
13429}
13430
13431impl std::default::Default for RawsaveTargetOptions {
13432    fn default() -> Self {
13433        RawsaveTargetOptions {
13434            keep: ForeignKeep::All,
13435            background: Vec::new(),
13436            page_height: i32::from(0),
13437            profile: String::from("sRGB"),
13438        }
13439    }
13440}
13441
13442/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target (.raw), priority=0,
13443/// inp: `&VipsImage` -> Image to save
13444/// target: `&VipsTarget` -> Target to save to
13445/// rawsave_target_options: `&RawsaveTargetOptions` -> optional arguments
13446
13447pub fn rawsave_target_with_opts(
13448    inp: &VipsImage,
13449    target: &VipsTarget,
13450    rawsave_target_options: &RawsaveTargetOptions,
13451) -> Result<()> {
13452    unsafe {
13453        let inp_in: *mut bindings::VipsImage = inp.ctx;
13454        let target_in: *mut bindings::VipsTarget = target.ctx;
13455
13456        let keep_in: i32 = rawsave_target_options.keep as i32;
13457        let keep_in_name = utils::new_c_string("keep")?;
13458
13459        let background_wrapper =
13460            utils::VipsArrayDoubleWrapper::from(&rawsave_target_options.background[..]);
13461        let background_in = background_wrapper.ctx;
13462        let background_in_name = utils::new_c_string("background")?;
13463
13464        let page_height_in: i32 = rawsave_target_options.page_height;
13465        let page_height_in_name = utils::new_c_string("page-height")?;
13466
13467        let profile_in: CString = utils::new_c_string(&rawsave_target_options.profile)?;
13468        let profile_in_name = utils::new_c_string("profile")?;
13469
13470        let vips_op_response = bindings::vips_rawsave_target(
13471            inp_in,
13472            target_in,
13473            keep_in_name.as_ptr(),
13474            keep_in,
13475            background_in_name.as_ptr(),
13476            background_in,
13477            page_height_in_name.as_ptr(),
13478            page_height_in,
13479            profile_in_name.as_ptr(),
13480            profile_in.as_ptr(),
13481            NULL,
13482        );
13483        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13484    }
13485}
13486
13487/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0,
13488/// inp: `&VipsImage` -> Image to save
13489/// filename: `&str` -> Filename to save to
13490
13491pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13492    unsafe {
13493        let inp_in: *mut bindings::VipsImage = inp.ctx;
13494        let filename_in: CString = utils::new_c_string(filename)?;
13495
13496        let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13497        utils::result(vips_op_response, (), Error::VipssaveError)
13498    }
13499}
13500
13501/// Options for vipssave operation
13502#[derive(Clone, Debug)]
13503pub struct VipssaveOptions {
13504    /// keep: `ForeignKeep` -> Which metadata to retain
13505    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13506    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13507    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13508    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13509    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13510    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13511    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13512    pub keep: ForeignKeep,
13513    /// background: `Vec<f64>` -> Background value
13514    pub background: Vec<f64>,
13515    /// page_height: `i32` -> Set page height for multipage save
13516    /// min: 0, max: 100000000, default: 0
13517    pub page_height: i32,
13518    /// profile: `String` -> Filename of ICC profile to embed
13519    pub profile: String,
13520}
13521
13522impl std::default::Default for VipssaveOptions {
13523    fn default() -> Self {
13524        VipssaveOptions {
13525            keep: ForeignKeep::All,
13526            background: Vec::new(),
13527            page_height: i32::from(0),
13528            profile: String::from("sRGB"),
13529        }
13530    }
13531}
13532
13533/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0,
13534/// inp: `&VipsImage` -> Image to save
13535/// filename: `&str` -> Filename to save to
13536/// vipssave_options: `&VipssaveOptions` -> optional arguments
13537
13538pub fn vipssave_with_opts(
13539    inp: &VipsImage,
13540    filename: &str,
13541    vipssave_options: &VipssaveOptions,
13542) -> Result<()> {
13543    unsafe {
13544        let inp_in: *mut bindings::VipsImage = inp.ctx;
13545        let filename_in: CString = utils::new_c_string(filename)?;
13546
13547        let keep_in: i32 = vipssave_options.keep as i32;
13548        let keep_in_name = utils::new_c_string("keep")?;
13549
13550        let background_wrapper =
13551            utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13552        let background_in = background_wrapper.ctx;
13553        let background_in_name = utils::new_c_string("background")?;
13554
13555        let page_height_in: i32 = vipssave_options.page_height;
13556        let page_height_in_name = utils::new_c_string("page-height")?;
13557
13558        let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13559        let profile_in_name = utils::new_c_string("profile")?;
13560
13561        let vips_op_response = bindings::vips_vipssave(
13562            inp_in,
13563            filename_in.as_ptr(),
13564            keep_in_name.as_ptr(),
13565            keep_in,
13566            background_in_name.as_ptr(),
13567            background_in,
13568            page_height_in_name.as_ptr(),
13569            page_height_in,
13570            profile_in_name.as_ptr(),
13571            profile_in.as_ptr(),
13572            NULL,
13573        );
13574        utils::result(vips_op_response, (), Error::VipssaveError)
13575    }
13576}
13577
13578/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0,
13579/// inp: `&VipsImage` -> Image to save
13580/// target: `&VipsTarget` -> Target to save to
13581
13582pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13583    unsafe {
13584        let inp_in: *mut bindings::VipsImage = inp.ctx;
13585        let target_in: *mut bindings::VipsTarget = target.ctx;
13586
13587        let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13588        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13589    }
13590}
13591
13592/// Options for vipssave_target operation
13593#[derive(Clone, Debug)]
13594pub struct VipssaveTargetOptions {
13595    /// keep: `ForeignKeep` -> Which metadata to retain
13596    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13597    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13598    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13599    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13600    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13601    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13602    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13603    pub keep: ForeignKeep,
13604    /// background: `Vec<f64>` -> Background value
13605    pub background: Vec<f64>,
13606    /// page_height: `i32` -> Set page height for multipage save
13607    /// min: 0, max: 100000000, default: 0
13608    pub page_height: i32,
13609    /// profile: `String` -> Filename of ICC profile to embed
13610    pub profile: String,
13611}
13612
13613impl std::default::Default for VipssaveTargetOptions {
13614    fn default() -> Self {
13615        VipssaveTargetOptions {
13616            keep: ForeignKeep::All,
13617            background: Vec::new(),
13618            page_height: i32::from(0),
13619            profile: String::from("sRGB"),
13620        }
13621    }
13622}
13623
13624/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0,
13625/// inp: `&VipsImage` -> Image to save
13626/// target: `&VipsTarget` -> Target to save to
13627/// vipssave_target_options: `&VipssaveTargetOptions` -> optional arguments
13628
13629pub fn vipssave_target_with_opts(
13630    inp: &VipsImage,
13631    target: &VipsTarget,
13632    vipssave_target_options: &VipssaveTargetOptions,
13633) -> Result<()> {
13634    unsafe {
13635        let inp_in: *mut bindings::VipsImage = inp.ctx;
13636        let target_in: *mut bindings::VipsTarget = target.ctx;
13637
13638        let keep_in: i32 = vipssave_target_options.keep as i32;
13639        let keep_in_name = utils::new_c_string("keep")?;
13640
13641        let background_wrapper =
13642            utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13643        let background_in = background_wrapper.ctx;
13644        let background_in_name = utils::new_c_string("background")?;
13645
13646        let page_height_in: i32 = vipssave_target_options.page_height;
13647        let page_height_in_name = utils::new_c_string("page-height")?;
13648
13649        let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13650        let profile_in_name = utils::new_c_string("profile")?;
13651
13652        let vips_op_response = bindings::vips_vipssave_target(
13653            inp_in,
13654            target_in,
13655            keep_in_name.as_ptr(),
13656            keep_in,
13657            background_in_name.as_ptr(),
13658            background_in,
13659            page_height_in_name.as_ptr(),
13660            page_height_in,
13661            profile_in_name.as_ptr(),
13662            profile_in.as_ptr(),
13663            NULL,
13664        );
13665        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13666    }
13667}
13668
13669/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0,
13670/// inp: `&VipsImage` -> Image to save
13671/// filename: `&str` -> Filename to save to
13672
13673pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13674    unsafe {
13675        let inp_in: *mut bindings::VipsImage = inp.ctx;
13676        let filename_in: CString = utils::new_c_string(filename)?;
13677
13678        let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13679        utils::result(vips_op_response, (), Error::PpmsaveError)
13680    }
13681}
13682
13683/// Options for ppmsave operation
13684#[derive(Clone, Debug)]
13685pub struct PpmsaveOptions {
13686    /// format: `ForeignPpmFormat` -> Format to save in
13687    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13688    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13689    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13690    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13691    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13692    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13693    pub format: ForeignPpmFormat,
13694    /// ascii: `bool` -> Save as ascii
13695    /// default: false
13696    pub ascii: bool,
13697    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13698    /// min: 0, max: 1, default: 0
13699    pub bitdepth: i32,
13700    /// keep: `ForeignKeep` -> Which metadata to retain
13701    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13702    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13703    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13704    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13705    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13706    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13707    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13708    pub keep: ForeignKeep,
13709    /// background: `Vec<f64>` -> Background value
13710    pub background: Vec<f64>,
13711    /// page_height: `i32` -> Set page height for multipage save
13712    /// min: 0, max: 100000000, default: 0
13713    pub page_height: i32,
13714    /// profile: `String` -> Filename of ICC profile to embed
13715    pub profile: String,
13716}
13717
13718impl std::default::Default for PpmsaveOptions {
13719    fn default() -> Self {
13720        PpmsaveOptions {
13721            format: ForeignPpmFormat::Ppm,
13722            ascii: false,
13723            bitdepth: i32::from(0),
13724            keep: ForeignKeep::All,
13725            background: Vec::new(),
13726            page_height: i32::from(0),
13727            profile: String::from("sRGB"),
13728        }
13729    }
13730}
13731
13732/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0,
13733/// inp: `&VipsImage` -> Image to save
13734/// filename: `&str` -> Filename to save to
13735/// ppmsave_options: `&PpmsaveOptions` -> optional arguments
13736
13737pub fn ppmsave_with_opts(
13738    inp: &VipsImage,
13739    filename: &str,
13740    ppmsave_options: &PpmsaveOptions,
13741) -> Result<()> {
13742    unsafe {
13743        let inp_in: *mut bindings::VipsImage = inp.ctx;
13744        let filename_in: CString = utils::new_c_string(filename)?;
13745
13746        let format_in: i32 = ppmsave_options.format as i32;
13747        let format_in_name = utils::new_c_string("format")?;
13748
13749        let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13750        let ascii_in_name = utils::new_c_string("ascii")?;
13751
13752        let bitdepth_in: i32 = ppmsave_options.bitdepth;
13753        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13754
13755        let keep_in: i32 = ppmsave_options.keep as i32;
13756        let keep_in_name = utils::new_c_string("keep")?;
13757
13758        let background_wrapper =
13759            utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13760        let background_in = background_wrapper.ctx;
13761        let background_in_name = utils::new_c_string("background")?;
13762
13763        let page_height_in: i32 = ppmsave_options.page_height;
13764        let page_height_in_name = utils::new_c_string("page-height")?;
13765
13766        let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13767        let profile_in_name = utils::new_c_string("profile")?;
13768
13769        let vips_op_response = bindings::vips_ppmsave(
13770            inp_in,
13771            filename_in.as_ptr(),
13772            format_in_name.as_ptr(),
13773            format_in,
13774            ascii_in_name.as_ptr(),
13775            ascii_in,
13776            bitdepth_in_name.as_ptr(),
13777            bitdepth_in,
13778            keep_in_name.as_ptr(),
13779            keep_in,
13780            background_in_name.as_ptr(),
13781            background_in,
13782            page_height_in_name.as_ptr(),
13783            page_height_in,
13784            profile_in_name.as_ptr(),
13785            profile_in.as_ptr(),
13786            NULL,
13787        );
13788        utils::result(vips_op_response, (), Error::PpmsaveError)
13789    }
13790}
13791
13792/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0,
13793/// inp: `&VipsImage` -> Image to save
13794/// target: `&VipsTarget` -> Target to save to
13795
13796pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13797    unsafe {
13798        let inp_in: *mut bindings::VipsImage = inp.ctx;
13799        let target_in: *mut bindings::VipsTarget = target.ctx;
13800
13801        let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13802        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13803    }
13804}
13805
13806/// Options for ppmsave_target operation
13807#[derive(Clone, Debug)]
13808pub struct PpmsaveTargetOptions {
13809    /// format: `ForeignPpmFormat` -> Format to save in
13810    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13811    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13812    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13813    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13814    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13815    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13816    pub format: ForeignPpmFormat,
13817    /// ascii: `bool` -> Save as ascii
13818    /// default: false
13819    pub ascii: bool,
13820    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13821    /// min: 0, max: 1, default: 0
13822    pub bitdepth: i32,
13823    /// keep: `ForeignKeep` -> Which metadata to retain
13824    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13825    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13826    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13827    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13828    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13829    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13830    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13831    pub keep: ForeignKeep,
13832    /// background: `Vec<f64>` -> Background value
13833    pub background: Vec<f64>,
13834    /// page_height: `i32` -> Set page height for multipage save
13835    /// min: 0, max: 100000000, default: 0
13836    pub page_height: i32,
13837    /// profile: `String` -> Filename of ICC profile to embed
13838    pub profile: String,
13839}
13840
13841impl std::default::Default for PpmsaveTargetOptions {
13842    fn default() -> Self {
13843        PpmsaveTargetOptions {
13844            format: ForeignPpmFormat::Ppm,
13845            ascii: false,
13846            bitdepth: i32::from(0),
13847            keep: ForeignKeep::All,
13848            background: Vec::new(),
13849            page_height: i32::from(0),
13850            profile: String::from("sRGB"),
13851        }
13852    }
13853}
13854
13855/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0,
13856/// inp: `&VipsImage` -> Image to save
13857/// target: `&VipsTarget` -> Target to save to
13858/// ppmsave_target_options: `&PpmsaveTargetOptions` -> optional arguments
13859
13860pub fn ppmsave_target_with_opts(
13861    inp: &VipsImage,
13862    target: &VipsTarget,
13863    ppmsave_target_options: &PpmsaveTargetOptions,
13864) -> Result<()> {
13865    unsafe {
13866        let inp_in: *mut bindings::VipsImage = inp.ctx;
13867        let target_in: *mut bindings::VipsTarget = target.ctx;
13868
13869        let format_in: i32 = ppmsave_target_options.format as i32;
13870        let format_in_name = utils::new_c_string("format")?;
13871
13872        let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13873        let ascii_in_name = utils::new_c_string("ascii")?;
13874
13875        let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13876        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13877
13878        let keep_in: i32 = ppmsave_target_options.keep as i32;
13879        let keep_in_name = utils::new_c_string("keep")?;
13880
13881        let background_wrapper =
13882            utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13883        let background_in = background_wrapper.ctx;
13884        let background_in_name = utils::new_c_string("background")?;
13885
13886        let page_height_in: i32 = ppmsave_target_options.page_height;
13887        let page_height_in_name = utils::new_c_string("page-height")?;
13888
13889        let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13890        let profile_in_name = utils::new_c_string("profile")?;
13891
13892        let vips_op_response = bindings::vips_ppmsave_target(
13893            inp_in,
13894            target_in,
13895            format_in_name.as_ptr(),
13896            format_in,
13897            ascii_in_name.as_ptr(),
13898            ascii_in,
13899            bitdepth_in_name.as_ptr(),
13900            bitdepth_in,
13901            keep_in_name.as_ptr(),
13902            keep_in,
13903            background_in_name.as_ptr(),
13904            background_in,
13905            page_height_in_name.as_ptr(),
13906            page_height_in,
13907            profile_in_name.as_ptr(),
13908            profile_in.as_ptr(),
13909            NULL,
13910        );
13911        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13912    }
13913}
13914
13915/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, mono rgb
13916/// inp: `&VipsImage` -> Image to save
13917/// filename: `&str` -> Filename to save to
13918
13919pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13920    unsafe {
13921        let inp_in: *mut bindings::VipsImage = inp.ctx;
13922        let filename_in: CString = utils::new_c_string(filename)?;
13923
13924        let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13925        utils::result(vips_op_response, (), Error::RadsaveError)
13926    }
13927}
13928
13929/// Options for radsave operation
13930#[derive(Clone, Debug)]
13931pub struct RadsaveOptions {
13932    /// keep: `ForeignKeep` -> Which metadata to retain
13933    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13934    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13935    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13936    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13937    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13938    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13939    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13940    pub keep: ForeignKeep,
13941    /// background: `Vec<f64>` -> Background value
13942    pub background: Vec<f64>,
13943    /// page_height: `i32` -> Set page height for multipage save
13944    /// min: 0, max: 100000000, default: 0
13945    pub page_height: i32,
13946    /// profile: `String` -> Filename of ICC profile to embed
13947    pub profile: String,
13948}
13949
13950impl std::default::Default for RadsaveOptions {
13951    fn default() -> Self {
13952        RadsaveOptions {
13953            keep: ForeignKeep::All,
13954            background: Vec::new(),
13955            page_height: i32::from(0),
13956            profile: String::from("sRGB"),
13957        }
13958    }
13959}
13960
13961/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, mono rgb
13962/// inp: `&VipsImage` -> Image to save
13963/// filename: `&str` -> Filename to save to
13964/// radsave_options: `&RadsaveOptions` -> optional arguments
13965
13966pub fn radsave_with_opts(
13967    inp: &VipsImage,
13968    filename: &str,
13969    radsave_options: &RadsaveOptions,
13970) -> Result<()> {
13971    unsafe {
13972        let inp_in: *mut bindings::VipsImage = inp.ctx;
13973        let filename_in: CString = utils::new_c_string(filename)?;
13974
13975        let keep_in: i32 = radsave_options.keep as i32;
13976        let keep_in_name = utils::new_c_string("keep")?;
13977
13978        let background_wrapper =
13979            utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13980        let background_in = background_wrapper.ctx;
13981        let background_in_name = utils::new_c_string("background")?;
13982
13983        let page_height_in: i32 = radsave_options.page_height;
13984        let page_height_in_name = utils::new_c_string("page-height")?;
13985
13986        let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13987        let profile_in_name = utils::new_c_string("profile")?;
13988
13989        let vips_op_response = bindings::vips_radsave(
13990            inp_in,
13991            filename_in.as_ptr(),
13992            keep_in_name.as_ptr(),
13993            keep_in,
13994            background_in_name.as_ptr(),
13995            background_in,
13996            page_height_in_name.as_ptr(),
13997            page_height_in,
13998            profile_in_name.as_ptr(),
13999            profile_in.as_ptr(),
14000            NULL,
14001        );
14002        utils::result(vips_op_response, (), Error::RadsaveError)
14003    }
14004}
14005
14006/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, mono rgb
14007/// inp: `&VipsImage` -> Image to save
14008/// returns `Vec<u8>` - Buffer to save to
14009pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14010    unsafe {
14011        let inp_in: *mut bindings::VipsImage = inp.ctx;
14012        let mut buffer_buf_size: u64 = 0;
14013        let mut buffer_out: *mut c_void = null_mut();
14014
14015        let vips_op_response =
14016            bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14017        utils::result(
14018            vips_op_response,
14019            utils::new_byte_array(buffer_out, buffer_buf_size),
14020            Error::RadsaveBufferError,
14021        )
14022    }
14023}
14024
14025/// Options for radsave_buffer operation
14026#[derive(Clone, Debug)]
14027pub struct RadsaveBufferOptions {
14028    /// keep: `ForeignKeep` -> Which metadata to retain
14029    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14030    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14031    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14032    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14033    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14034    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14035    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14036    pub keep: ForeignKeep,
14037    /// background: `Vec<f64>` -> Background value
14038    pub background: Vec<f64>,
14039    /// page_height: `i32` -> Set page height for multipage save
14040    /// min: 0, max: 100000000, default: 0
14041    pub page_height: i32,
14042    /// profile: `String` -> Filename of ICC profile to embed
14043    pub profile: String,
14044}
14045
14046impl std::default::Default for RadsaveBufferOptions {
14047    fn default() -> Self {
14048        RadsaveBufferOptions {
14049            keep: ForeignKeep::All,
14050            background: Vec::new(),
14051            page_height: i32::from(0),
14052            profile: String::from("sRGB"),
14053        }
14054    }
14055}
14056
14057/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, mono rgb
14058/// inp: `&VipsImage` -> Image to save
14059/// radsave_buffer_options: `&RadsaveBufferOptions` -> optional arguments
14060/// returns `Vec<u8>` - Buffer to save to
14061pub fn radsave_buffer_with_opts(
14062    inp: &VipsImage,
14063    radsave_buffer_options: &RadsaveBufferOptions,
14064) -> Result<Vec<u8>> {
14065    unsafe {
14066        let inp_in: *mut bindings::VipsImage = inp.ctx;
14067        let mut buffer_buf_size: u64 = 0;
14068        let mut buffer_out: *mut c_void = null_mut();
14069
14070        let keep_in: i32 = radsave_buffer_options.keep as i32;
14071        let keep_in_name = utils::new_c_string("keep")?;
14072
14073        let background_wrapper =
14074            utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
14075        let background_in = background_wrapper.ctx;
14076        let background_in_name = utils::new_c_string("background")?;
14077
14078        let page_height_in: i32 = radsave_buffer_options.page_height;
14079        let page_height_in_name = utils::new_c_string("page-height")?;
14080
14081        let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
14082        let profile_in_name = utils::new_c_string("profile")?;
14083
14084        let vips_op_response = bindings::vips_radsave_buffer(
14085            inp_in,
14086            &mut buffer_out,
14087            &mut buffer_buf_size,
14088            keep_in_name.as_ptr(),
14089            keep_in,
14090            background_in_name.as_ptr(),
14091            background_in,
14092            page_height_in_name.as_ptr(),
14093            page_height_in,
14094            profile_in_name.as_ptr(),
14095            profile_in.as_ptr(),
14096            NULL,
14097        );
14098        utils::result(
14099            vips_op_response,
14100            utils::new_byte_array(buffer_out, buffer_buf_size),
14101            Error::RadsaveBufferError,
14102        )
14103    }
14104}
14105
14106/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, mono rgb
14107/// inp: `&VipsImage` -> Image to save
14108/// target: `&VipsTarget` -> Target to save to
14109
14110pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14111    unsafe {
14112        let inp_in: *mut bindings::VipsImage = inp.ctx;
14113        let target_in: *mut bindings::VipsTarget = target.ctx;
14114
14115        let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
14116        utils::result(vips_op_response, (), Error::RadsaveTargetError)
14117    }
14118}
14119
14120/// Options for radsave_target operation
14121#[derive(Clone, Debug)]
14122pub struct RadsaveTargetOptions {
14123    /// keep: `ForeignKeep` -> Which metadata to retain
14124    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14125    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14126    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14127    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14128    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14129    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14130    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14131    pub keep: ForeignKeep,
14132    /// background: `Vec<f64>` -> Background value
14133    pub background: Vec<f64>,
14134    /// page_height: `i32` -> Set page height for multipage save
14135    /// min: 0, max: 100000000, default: 0
14136    pub page_height: i32,
14137    /// profile: `String` -> Filename of ICC profile to embed
14138    pub profile: String,
14139}
14140
14141impl std::default::Default for RadsaveTargetOptions {
14142    fn default() -> Self {
14143        RadsaveTargetOptions {
14144            keep: ForeignKeep::All,
14145            background: Vec::new(),
14146            page_height: i32::from(0),
14147            profile: String::from("sRGB"),
14148        }
14149    }
14150}
14151
14152/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, mono rgb
14153/// inp: `&VipsImage` -> Image to save
14154/// target: `&VipsTarget` -> Target to save to
14155/// radsave_target_options: `&RadsaveTargetOptions` -> optional arguments
14156
14157pub fn radsave_target_with_opts(
14158    inp: &VipsImage,
14159    target: &VipsTarget,
14160    radsave_target_options: &RadsaveTargetOptions,
14161) -> Result<()> {
14162    unsafe {
14163        let inp_in: *mut bindings::VipsImage = inp.ctx;
14164        let target_in: *mut bindings::VipsTarget = target.ctx;
14165
14166        let keep_in: i32 = radsave_target_options.keep as i32;
14167        let keep_in_name = utils::new_c_string("keep")?;
14168
14169        let background_wrapper =
14170            utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
14171        let background_in = background_wrapper.ctx;
14172        let background_in_name = utils::new_c_string("background")?;
14173
14174        let page_height_in: i32 = radsave_target_options.page_height;
14175        let page_height_in_name = utils::new_c_string("page-height")?;
14176
14177        let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
14178        let profile_in_name = utils::new_c_string("profile")?;
14179
14180        let vips_op_response = bindings::vips_radsave_target(
14181            inp_in,
14182            target_in,
14183            keep_in_name.as_ptr(),
14184            keep_in,
14185            background_in_name.as_ptr(),
14186            background_in,
14187            page_height_in_name.as_ptr(),
14188            page_height_in,
14189            profile_in_name.as_ptr(),
14190            profile_in.as_ptr(),
14191            NULL,
14192        );
14193        utils::result(vips_op_response, (), Error::RadsaveTargetError)
14194    }
14195}
14196
14197/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgb alpha
14198/// inp: `&VipsImage` -> Image to save
14199/// filename: `&str` -> Filename to save to
14200
14201pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
14202    unsafe {
14203        let inp_in: *mut bindings::VipsImage = inp.ctx;
14204        let filename_in: CString = utils::new_c_string(filename)?;
14205
14206        let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
14207        utils::result(vips_op_response, (), Error::GifsaveError)
14208    }
14209}
14210
14211/// Options for gifsave operation
14212#[derive(Clone, Debug)]
14213pub struct GifsaveOptions {
14214    /// dither: `f64` -> Amount of dithering
14215    /// min: 0, max: 1, default: 1
14216    pub dither: f64,
14217    /// effort: `i32` -> Quantisation effort
14218    /// min: 1, max: 10, default: 7
14219    pub effort: i32,
14220    /// bitdepth: `i32` -> Number of bits per pixel
14221    /// min: 1, max: 8, default: 8
14222    pub bitdepth: i32,
14223    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14224    /// min: 0, max: 32, default: 0
14225    pub interframe_maxerror: f64,
14226    /// reuse: `bool` -> Reuse palette from input
14227    /// default: false
14228    pub reuse: bool,
14229    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14230    /// min: 0, max: 256, default: 3
14231    pub interpalette_maxerror: f64,
14232    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14233    /// default: false
14234    pub interlace: bool,
14235    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14236    /// default: false
14237    pub keep_duplicate_frames: bool,
14238    /// keep: `ForeignKeep` -> Which metadata to retain
14239    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14240    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14241    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14242    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14243    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14244    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14245    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14246    pub keep: ForeignKeep,
14247    /// background: `Vec<f64>` -> Background value
14248    pub background: Vec<f64>,
14249    /// page_height: `i32` -> Set page height for multipage save
14250    /// min: 0, max: 100000000, default: 0
14251    pub page_height: i32,
14252    /// profile: `String` -> Filename of ICC profile to embed
14253    pub profile: String,
14254}
14255
14256impl std::default::Default for GifsaveOptions {
14257    fn default() -> Self {
14258        GifsaveOptions {
14259            dither: f64::from(1),
14260            effort: i32::from(7),
14261            bitdepth: i32::from(8),
14262            interframe_maxerror: f64::from(0),
14263            reuse: false,
14264            interpalette_maxerror: f64::from(3),
14265            interlace: false,
14266            keep_duplicate_frames: false,
14267            keep: ForeignKeep::All,
14268            background: Vec::new(),
14269            page_height: i32::from(0),
14270            profile: String::from("sRGB"),
14271        }
14272    }
14273}
14274
14275/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgb alpha
14276/// inp: `&VipsImage` -> Image to save
14277/// filename: `&str` -> Filename to save to
14278/// gifsave_options: `&GifsaveOptions` -> optional arguments
14279
14280pub fn gifsave_with_opts(
14281    inp: &VipsImage,
14282    filename: &str,
14283    gifsave_options: &GifsaveOptions,
14284) -> Result<()> {
14285    unsafe {
14286        let inp_in: *mut bindings::VipsImage = inp.ctx;
14287        let filename_in: CString = utils::new_c_string(filename)?;
14288
14289        let dither_in: f64 = gifsave_options.dither;
14290        let dither_in_name = utils::new_c_string("dither")?;
14291
14292        let effort_in: i32 = gifsave_options.effort;
14293        let effort_in_name = utils::new_c_string("effort")?;
14294
14295        let bitdepth_in: i32 = gifsave_options.bitdepth;
14296        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14297
14298        let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
14299        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14300
14301        let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
14302        let reuse_in_name = utils::new_c_string("reuse")?;
14303
14304        let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
14305        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14306
14307        let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
14308        let interlace_in_name = utils::new_c_string("interlace")?;
14309
14310        let keep_duplicate_frames_in: i32 = if gifsave_options.keep_duplicate_frames {
14311            1
14312        } else {
14313            0
14314        };
14315        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14316
14317        let keep_in: i32 = gifsave_options.keep as i32;
14318        let keep_in_name = utils::new_c_string("keep")?;
14319
14320        let background_wrapper =
14321            utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
14322        let background_in = background_wrapper.ctx;
14323        let background_in_name = utils::new_c_string("background")?;
14324
14325        let page_height_in: i32 = gifsave_options.page_height;
14326        let page_height_in_name = utils::new_c_string("page-height")?;
14327
14328        let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
14329        let profile_in_name = utils::new_c_string("profile")?;
14330
14331        let vips_op_response = bindings::vips_gifsave(
14332            inp_in,
14333            filename_in.as_ptr(),
14334            dither_in_name.as_ptr(),
14335            dither_in,
14336            effort_in_name.as_ptr(),
14337            effort_in,
14338            bitdepth_in_name.as_ptr(),
14339            bitdepth_in,
14340            interframe_maxerror_in_name.as_ptr(),
14341            interframe_maxerror_in,
14342            reuse_in_name.as_ptr(),
14343            reuse_in,
14344            interpalette_maxerror_in_name.as_ptr(),
14345            interpalette_maxerror_in,
14346            interlace_in_name.as_ptr(),
14347            interlace_in,
14348            keep_duplicate_frames_in_name.as_ptr(),
14349            keep_duplicate_frames_in,
14350            keep_in_name.as_ptr(),
14351            keep_in,
14352            background_in_name.as_ptr(),
14353            background_in,
14354            page_height_in_name.as_ptr(),
14355            page_height_in,
14356            profile_in_name.as_ptr(),
14357            profile_in.as_ptr(),
14358            NULL,
14359        );
14360        utils::result(vips_op_response, (), Error::GifsaveError)
14361    }
14362}
14363
14364/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgb alpha
14365/// inp: `&VipsImage` -> Image to save
14366/// returns `Vec<u8>` - Buffer to save to
14367pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14368    unsafe {
14369        let inp_in: *mut bindings::VipsImage = inp.ctx;
14370        let mut buffer_buf_size: u64 = 0;
14371        let mut buffer_out: *mut c_void = null_mut();
14372
14373        let vips_op_response =
14374            bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14375        utils::result(
14376            vips_op_response,
14377            utils::new_byte_array(buffer_out, buffer_buf_size),
14378            Error::GifsaveBufferError,
14379        )
14380    }
14381}
14382
14383/// Options for gifsave_buffer operation
14384#[derive(Clone, Debug)]
14385pub struct GifsaveBufferOptions {
14386    /// dither: `f64` -> Amount of dithering
14387    /// min: 0, max: 1, default: 1
14388    pub dither: f64,
14389    /// effort: `i32` -> Quantisation effort
14390    /// min: 1, max: 10, default: 7
14391    pub effort: i32,
14392    /// bitdepth: `i32` -> Number of bits per pixel
14393    /// min: 1, max: 8, default: 8
14394    pub bitdepth: i32,
14395    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14396    /// min: 0, max: 32, default: 0
14397    pub interframe_maxerror: f64,
14398    /// reuse: `bool` -> Reuse palette from input
14399    /// default: false
14400    pub reuse: bool,
14401    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14402    /// min: 0, max: 256, default: 3
14403    pub interpalette_maxerror: f64,
14404    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14405    /// default: false
14406    pub interlace: bool,
14407    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14408    /// default: false
14409    pub keep_duplicate_frames: bool,
14410    /// keep: `ForeignKeep` -> Which metadata to retain
14411    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14412    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14413    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14414    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14415    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14416    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14417    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14418    pub keep: ForeignKeep,
14419    /// background: `Vec<f64>` -> Background value
14420    pub background: Vec<f64>,
14421    /// page_height: `i32` -> Set page height for multipage save
14422    /// min: 0, max: 100000000, default: 0
14423    pub page_height: i32,
14424    /// profile: `String` -> Filename of ICC profile to embed
14425    pub profile: String,
14426}
14427
14428impl std::default::Default for GifsaveBufferOptions {
14429    fn default() -> Self {
14430        GifsaveBufferOptions {
14431            dither: f64::from(1),
14432            effort: i32::from(7),
14433            bitdepth: i32::from(8),
14434            interframe_maxerror: f64::from(0),
14435            reuse: false,
14436            interpalette_maxerror: f64::from(3),
14437            interlace: false,
14438            keep_duplicate_frames: false,
14439            keep: ForeignKeep::All,
14440            background: Vec::new(),
14441            page_height: i32::from(0),
14442            profile: String::from("sRGB"),
14443        }
14444    }
14445}
14446
14447/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgb alpha
14448/// inp: `&VipsImage` -> Image to save
14449/// gifsave_buffer_options: `&GifsaveBufferOptions` -> optional arguments
14450/// returns `Vec<u8>` - Buffer to save to
14451pub fn gifsave_buffer_with_opts(
14452    inp: &VipsImage,
14453    gifsave_buffer_options: &GifsaveBufferOptions,
14454) -> Result<Vec<u8>> {
14455    unsafe {
14456        let inp_in: *mut bindings::VipsImage = inp.ctx;
14457        let mut buffer_buf_size: u64 = 0;
14458        let mut buffer_out: *mut c_void = null_mut();
14459
14460        let dither_in: f64 = gifsave_buffer_options.dither;
14461        let dither_in_name = utils::new_c_string("dither")?;
14462
14463        let effort_in: i32 = gifsave_buffer_options.effort;
14464        let effort_in_name = utils::new_c_string("effort")?;
14465
14466        let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
14467        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14468
14469        let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
14470        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14471
14472        let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
14473        let reuse_in_name = utils::new_c_string("reuse")?;
14474
14475        let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
14476        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14477
14478        let interlace_in: i32 = if gifsave_buffer_options.interlace {
14479            1
14480        } else {
14481            0
14482        };
14483        let interlace_in_name = utils::new_c_string("interlace")?;
14484
14485        let keep_duplicate_frames_in: i32 = if gifsave_buffer_options.keep_duplicate_frames {
14486            1
14487        } else {
14488            0
14489        };
14490        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14491
14492        let keep_in: i32 = gifsave_buffer_options.keep as i32;
14493        let keep_in_name = utils::new_c_string("keep")?;
14494
14495        let background_wrapper =
14496            utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
14497        let background_in = background_wrapper.ctx;
14498        let background_in_name = utils::new_c_string("background")?;
14499
14500        let page_height_in: i32 = gifsave_buffer_options.page_height;
14501        let page_height_in_name = utils::new_c_string("page-height")?;
14502
14503        let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14504        let profile_in_name = utils::new_c_string("profile")?;
14505
14506        let vips_op_response = bindings::vips_gifsave_buffer(
14507            inp_in,
14508            &mut buffer_out,
14509            &mut buffer_buf_size,
14510            dither_in_name.as_ptr(),
14511            dither_in,
14512            effort_in_name.as_ptr(),
14513            effort_in,
14514            bitdepth_in_name.as_ptr(),
14515            bitdepth_in,
14516            interframe_maxerror_in_name.as_ptr(),
14517            interframe_maxerror_in,
14518            reuse_in_name.as_ptr(),
14519            reuse_in,
14520            interpalette_maxerror_in_name.as_ptr(),
14521            interpalette_maxerror_in,
14522            interlace_in_name.as_ptr(),
14523            interlace_in,
14524            keep_duplicate_frames_in_name.as_ptr(),
14525            keep_duplicate_frames_in,
14526            keep_in_name.as_ptr(),
14527            keep_in,
14528            background_in_name.as_ptr(),
14529            background_in,
14530            page_height_in_name.as_ptr(),
14531            page_height_in,
14532            profile_in_name.as_ptr(),
14533            profile_in.as_ptr(),
14534            NULL,
14535        );
14536        utils::result(
14537            vips_op_response,
14538            utils::new_byte_array(buffer_out, buffer_buf_size),
14539            Error::GifsaveBufferError,
14540        )
14541    }
14542}
14543
14544/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgb alpha
14545/// inp: `&VipsImage` -> Image to save
14546/// target: `&VipsTarget` -> Target to save to
14547
14548pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14549    unsafe {
14550        let inp_in: *mut bindings::VipsImage = inp.ctx;
14551        let target_in: *mut bindings::VipsTarget = target.ctx;
14552
14553        let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14554        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14555    }
14556}
14557
14558/// Options for gifsave_target operation
14559#[derive(Clone, Debug)]
14560pub struct GifsaveTargetOptions {
14561    /// dither: `f64` -> Amount of dithering
14562    /// min: 0, max: 1, default: 1
14563    pub dither: f64,
14564    /// effort: `i32` -> Quantisation effort
14565    /// min: 1, max: 10, default: 7
14566    pub effort: i32,
14567    /// bitdepth: `i32` -> Number of bits per pixel
14568    /// min: 1, max: 8, default: 8
14569    pub bitdepth: i32,
14570    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14571    /// min: 0, max: 32, default: 0
14572    pub interframe_maxerror: f64,
14573    /// reuse: `bool` -> Reuse palette from input
14574    /// default: false
14575    pub reuse: bool,
14576    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14577    /// min: 0, max: 256, default: 3
14578    pub interpalette_maxerror: f64,
14579    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14580    /// default: false
14581    pub interlace: bool,
14582    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14583    /// default: false
14584    pub keep_duplicate_frames: bool,
14585    /// keep: `ForeignKeep` -> Which metadata to retain
14586    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14587    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14588    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14589    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14590    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14591    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14592    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14593    pub keep: ForeignKeep,
14594    /// background: `Vec<f64>` -> Background value
14595    pub background: Vec<f64>,
14596    /// page_height: `i32` -> Set page height for multipage save
14597    /// min: 0, max: 100000000, default: 0
14598    pub page_height: i32,
14599    /// profile: `String` -> Filename of ICC profile to embed
14600    pub profile: String,
14601}
14602
14603impl std::default::Default for GifsaveTargetOptions {
14604    fn default() -> Self {
14605        GifsaveTargetOptions {
14606            dither: f64::from(1),
14607            effort: i32::from(7),
14608            bitdepth: i32::from(8),
14609            interframe_maxerror: f64::from(0),
14610            reuse: false,
14611            interpalette_maxerror: f64::from(3),
14612            interlace: false,
14613            keep_duplicate_frames: false,
14614            keep: ForeignKeep::All,
14615            background: Vec::new(),
14616            page_height: i32::from(0),
14617            profile: String::from("sRGB"),
14618        }
14619    }
14620}
14621
14622/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgb alpha
14623/// inp: `&VipsImage` -> Image to save
14624/// target: `&VipsTarget` -> Target to save to
14625/// gifsave_target_options: `&GifsaveTargetOptions` -> optional arguments
14626
14627pub fn gifsave_target_with_opts(
14628    inp: &VipsImage,
14629    target: &VipsTarget,
14630    gifsave_target_options: &GifsaveTargetOptions,
14631) -> Result<()> {
14632    unsafe {
14633        let inp_in: *mut bindings::VipsImage = inp.ctx;
14634        let target_in: *mut bindings::VipsTarget = target.ctx;
14635
14636        let dither_in: f64 = gifsave_target_options.dither;
14637        let dither_in_name = utils::new_c_string("dither")?;
14638
14639        let effort_in: i32 = gifsave_target_options.effort;
14640        let effort_in_name = utils::new_c_string("effort")?;
14641
14642        let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14643        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14644
14645        let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14646        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14647
14648        let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14649        let reuse_in_name = utils::new_c_string("reuse")?;
14650
14651        let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14652        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14653
14654        let interlace_in: i32 = if gifsave_target_options.interlace {
14655            1
14656        } else {
14657            0
14658        };
14659        let interlace_in_name = utils::new_c_string("interlace")?;
14660
14661        let keep_duplicate_frames_in: i32 = if gifsave_target_options.keep_duplicate_frames {
14662            1
14663        } else {
14664            0
14665        };
14666        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14667
14668        let keep_in: i32 = gifsave_target_options.keep as i32;
14669        let keep_in_name = utils::new_c_string("keep")?;
14670
14671        let background_wrapper =
14672            utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14673        let background_in = background_wrapper.ctx;
14674        let background_in_name = utils::new_c_string("background")?;
14675
14676        let page_height_in: i32 = gifsave_target_options.page_height;
14677        let page_height_in_name = utils::new_c_string("page-height")?;
14678
14679        let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14680        let profile_in_name = utils::new_c_string("profile")?;
14681
14682        let vips_op_response = bindings::vips_gifsave_target(
14683            inp_in,
14684            target_in,
14685            dither_in_name.as_ptr(),
14686            dither_in,
14687            effort_in_name.as_ptr(),
14688            effort_in,
14689            bitdepth_in_name.as_ptr(),
14690            bitdepth_in,
14691            interframe_maxerror_in_name.as_ptr(),
14692            interframe_maxerror_in,
14693            reuse_in_name.as_ptr(),
14694            reuse_in,
14695            interpalette_maxerror_in_name.as_ptr(),
14696            interpalette_maxerror_in,
14697            interlace_in_name.as_ptr(),
14698            interlace_in,
14699            keep_duplicate_frames_in_name.as_ptr(),
14700            keep_duplicate_frames_in,
14701            keep_in_name.as_ptr(),
14702            keep_in,
14703            background_in_name.as_ptr(),
14704            background_in,
14705            page_height_in_name.as_ptr(),
14706            page_height_in,
14707            profile_in_name.as_ptr(),
14708            profile_in.as_ptr(),
14709            NULL,
14710        );
14711        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14712    }
14713}
14714
14715/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, mono rgb alpha
14716/// inp: `&VipsImage` -> Image to save
14717/// filename: `&str` -> Filename to save to
14718
14719pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14720    unsafe {
14721        let inp_in: *mut bindings::VipsImage = inp.ctx;
14722        let filename_in: CString = utils::new_c_string(filename)?;
14723
14724        let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14725        utils::result(vips_op_response, (), Error::PngsaveError)
14726    }
14727}
14728
14729/// Options for pngsave operation
14730#[derive(Clone, Debug)]
14731pub struct PngsaveOptions {
14732    /// compression: `i32` -> Compression factor
14733    /// min: 0, max: 9, default: 6
14734    pub compression: i32,
14735    /// interlace: `bool` -> Interlace image
14736    /// default: false
14737    pub interlace: bool,
14738    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14739    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14740    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14741    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14742    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14743    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14744    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14745    pub filter: ForeignPngFilter,
14746    /// palette: `bool` -> Quantise to 8bpp palette
14747    /// default: false
14748    pub palette: bool,
14749    /// q: `i32` -> Quantisation quality
14750    /// min: 0, max: 100, default: 100
14751    pub q: i32,
14752    /// dither: `f64` -> Amount of dithering
14753    /// min: 0, max: 1, default: 1
14754    pub dither: f64,
14755    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14756    /// min: 1, max: 16, default: 8
14757    pub bitdepth: i32,
14758    /// effort: `i32` -> Quantisation CPU effort
14759    /// min: 1, max: 10, default: 7
14760    pub effort: i32,
14761    /// keep: `ForeignKeep` -> Which metadata to retain
14762    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14763    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14764    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14765    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14766    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14767    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14768    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14769    pub keep: ForeignKeep,
14770    /// background: `Vec<f64>` -> Background value
14771    pub background: Vec<f64>,
14772    /// page_height: `i32` -> Set page height for multipage save
14773    /// min: 0, max: 100000000, default: 0
14774    pub page_height: i32,
14775    /// profile: `String` -> Filename of ICC profile to embed
14776    pub profile: String,
14777}
14778
14779impl std::default::Default for PngsaveOptions {
14780    fn default() -> Self {
14781        PngsaveOptions {
14782            compression: i32::from(6),
14783            interlace: false,
14784            filter: ForeignPngFilter::None,
14785            palette: false,
14786            q: i32::from(100),
14787            dither: f64::from(1),
14788            bitdepth: i32::from(8),
14789            effort: i32::from(7),
14790            keep: ForeignKeep::All,
14791            background: Vec::new(),
14792            page_height: i32::from(0),
14793            profile: String::from("sRGB"),
14794        }
14795    }
14796}
14797
14798/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, mono rgb alpha
14799/// inp: `&VipsImage` -> Image to save
14800/// filename: `&str` -> Filename to save to
14801/// pngsave_options: `&PngsaveOptions` -> optional arguments
14802
14803pub fn pngsave_with_opts(
14804    inp: &VipsImage,
14805    filename: &str,
14806    pngsave_options: &PngsaveOptions,
14807) -> Result<()> {
14808    unsafe {
14809        let inp_in: *mut bindings::VipsImage = inp.ctx;
14810        let filename_in: CString = utils::new_c_string(filename)?;
14811
14812        let compression_in: i32 = pngsave_options.compression;
14813        let compression_in_name = utils::new_c_string("compression")?;
14814
14815        let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14816        let interlace_in_name = utils::new_c_string("interlace")?;
14817
14818        let filter_in: i32 = pngsave_options.filter as i32;
14819        let filter_in_name = utils::new_c_string("filter")?;
14820
14821        let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14822        let palette_in_name = utils::new_c_string("palette")?;
14823
14824        let q_in: i32 = pngsave_options.q;
14825        let q_in_name = utils::new_c_string("Q")?;
14826
14827        let dither_in: f64 = pngsave_options.dither;
14828        let dither_in_name = utils::new_c_string("dither")?;
14829
14830        let bitdepth_in: i32 = pngsave_options.bitdepth;
14831        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14832
14833        let effort_in: i32 = pngsave_options.effort;
14834        let effort_in_name = utils::new_c_string("effort")?;
14835
14836        let keep_in: i32 = pngsave_options.keep as i32;
14837        let keep_in_name = utils::new_c_string("keep")?;
14838
14839        let background_wrapper =
14840            utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14841        let background_in = background_wrapper.ctx;
14842        let background_in_name = utils::new_c_string("background")?;
14843
14844        let page_height_in: i32 = pngsave_options.page_height;
14845        let page_height_in_name = utils::new_c_string("page-height")?;
14846
14847        let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14848        let profile_in_name = utils::new_c_string("profile")?;
14849
14850        let vips_op_response = bindings::vips_pngsave(
14851            inp_in,
14852            filename_in.as_ptr(),
14853            compression_in_name.as_ptr(),
14854            compression_in,
14855            interlace_in_name.as_ptr(),
14856            interlace_in,
14857            filter_in_name.as_ptr(),
14858            filter_in,
14859            palette_in_name.as_ptr(),
14860            palette_in,
14861            q_in_name.as_ptr(),
14862            q_in,
14863            dither_in_name.as_ptr(),
14864            dither_in,
14865            bitdepth_in_name.as_ptr(),
14866            bitdepth_in,
14867            effort_in_name.as_ptr(),
14868            effort_in,
14869            keep_in_name.as_ptr(),
14870            keep_in,
14871            background_in_name.as_ptr(),
14872            background_in,
14873            page_height_in_name.as_ptr(),
14874            page_height_in,
14875            profile_in_name.as_ptr(),
14876            profile_in.as_ptr(),
14877            NULL,
14878        );
14879        utils::result(vips_op_response, (), Error::PngsaveError)
14880    }
14881}
14882
14883/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, mono rgb alpha
14884/// inp: `&VipsImage` -> Image to save
14885/// returns `Vec<u8>` - Buffer to save to
14886pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14887    unsafe {
14888        let inp_in: *mut bindings::VipsImage = inp.ctx;
14889        let mut buffer_buf_size: u64 = 0;
14890        let mut buffer_out: *mut c_void = null_mut();
14891
14892        let vips_op_response =
14893            bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14894        utils::result(
14895            vips_op_response,
14896            utils::new_byte_array(buffer_out, buffer_buf_size),
14897            Error::PngsaveBufferError,
14898        )
14899    }
14900}
14901
14902/// Options for pngsave_buffer operation
14903#[derive(Clone, Debug)]
14904pub struct PngsaveBufferOptions {
14905    /// compression: `i32` -> Compression factor
14906    /// min: 0, max: 9, default: 6
14907    pub compression: i32,
14908    /// interlace: `bool` -> Interlace image
14909    /// default: false
14910    pub interlace: bool,
14911    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14912    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14913    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14914    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14915    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14916    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14917    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14918    pub filter: ForeignPngFilter,
14919    /// palette: `bool` -> Quantise to 8bpp palette
14920    /// default: false
14921    pub palette: bool,
14922    /// q: `i32` -> Quantisation quality
14923    /// min: 0, max: 100, default: 100
14924    pub q: i32,
14925    /// dither: `f64` -> Amount of dithering
14926    /// min: 0, max: 1, default: 1
14927    pub dither: f64,
14928    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14929    /// min: 1, max: 16, default: 8
14930    pub bitdepth: i32,
14931    /// effort: `i32` -> Quantisation CPU effort
14932    /// min: 1, max: 10, default: 7
14933    pub effort: i32,
14934    /// keep: `ForeignKeep` -> Which metadata to retain
14935    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14936    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14937    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14938    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14939    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14940    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14941    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14942    pub keep: ForeignKeep,
14943    /// background: `Vec<f64>` -> Background value
14944    pub background: Vec<f64>,
14945    /// page_height: `i32` -> Set page height for multipage save
14946    /// min: 0, max: 100000000, default: 0
14947    pub page_height: i32,
14948    /// profile: `String` -> Filename of ICC profile to embed
14949    pub profile: String,
14950}
14951
14952impl std::default::Default for PngsaveBufferOptions {
14953    fn default() -> Self {
14954        PngsaveBufferOptions {
14955            compression: i32::from(6),
14956            interlace: false,
14957            filter: ForeignPngFilter::None,
14958            palette: false,
14959            q: i32::from(100),
14960            dither: f64::from(1),
14961            bitdepth: i32::from(8),
14962            effort: i32::from(7),
14963            keep: ForeignKeep::All,
14964            background: Vec::new(),
14965            page_height: i32::from(0),
14966            profile: String::from("sRGB"),
14967        }
14968    }
14969}
14970
14971/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, mono rgb alpha
14972/// inp: `&VipsImage` -> Image to save
14973/// pngsave_buffer_options: `&PngsaveBufferOptions` -> optional arguments
14974/// returns `Vec<u8>` - Buffer to save to
14975pub fn pngsave_buffer_with_opts(
14976    inp: &VipsImage,
14977    pngsave_buffer_options: &PngsaveBufferOptions,
14978) -> Result<Vec<u8>> {
14979    unsafe {
14980        let inp_in: *mut bindings::VipsImage = inp.ctx;
14981        let mut buffer_buf_size: u64 = 0;
14982        let mut buffer_out: *mut c_void = null_mut();
14983
14984        let compression_in: i32 = pngsave_buffer_options.compression;
14985        let compression_in_name = utils::new_c_string("compression")?;
14986
14987        let interlace_in: i32 = if pngsave_buffer_options.interlace {
14988            1
14989        } else {
14990            0
14991        };
14992        let interlace_in_name = utils::new_c_string("interlace")?;
14993
14994        let filter_in: i32 = pngsave_buffer_options.filter as i32;
14995        let filter_in_name = utils::new_c_string("filter")?;
14996
14997        let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14998        let palette_in_name = utils::new_c_string("palette")?;
14999
15000        let q_in: i32 = pngsave_buffer_options.q;
15001        let q_in_name = utils::new_c_string("Q")?;
15002
15003        let dither_in: f64 = pngsave_buffer_options.dither;
15004        let dither_in_name = utils::new_c_string("dither")?;
15005
15006        let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
15007        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15008
15009        let effort_in: i32 = pngsave_buffer_options.effort;
15010        let effort_in_name = utils::new_c_string("effort")?;
15011
15012        let keep_in: i32 = pngsave_buffer_options.keep as i32;
15013        let keep_in_name = utils::new_c_string("keep")?;
15014
15015        let background_wrapper =
15016            utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
15017        let background_in = background_wrapper.ctx;
15018        let background_in_name = utils::new_c_string("background")?;
15019
15020        let page_height_in: i32 = pngsave_buffer_options.page_height;
15021        let page_height_in_name = utils::new_c_string("page-height")?;
15022
15023        let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
15024        let profile_in_name = utils::new_c_string("profile")?;
15025
15026        let vips_op_response = bindings::vips_pngsave_buffer(
15027            inp_in,
15028            &mut buffer_out,
15029            &mut buffer_buf_size,
15030            compression_in_name.as_ptr(),
15031            compression_in,
15032            interlace_in_name.as_ptr(),
15033            interlace_in,
15034            filter_in_name.as_ptr(),
15035            filter_in,
15036            palette_in_name.as_ptr(),
15037            palette_in,
15038            q_in_name.as_ptr(),
15039            q_in,
15040            dither_in_name.as_ptr(),
15041            dither_in,
15042            bitdepth_in_name.as_ptr(),
15043            bitdepth_in,
15044            effort_in_name.as_ptr(),
15045            effort_in,
15046            keep_in_name.as_ptr(),
15047            keep_in,
15048            background_in_name.as_ptr(),
15049            background_in,
15050            page_height_in_name.as_ptr(),
15051            page_height_in,
15052            profile_in_name.as_ptr(),
15053            profile_in.as_ptr(),
15054            NULL,
15055        );
15056        utils::result(
15057            vips_op_response,
15058            utils::new_byte_array(buffer_out, buffer_buf_size),
15059            Error::PngsaveBufferError,
15060        )
15061    }
15062}
15063
15064/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, mono rgb alpha
15065/// inp: `&VipsImage` -> Image to save
15066/// target: `&VipsTarget` -> Target to save to
15067
15068pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15069    unsafe {
15070        let inp_in: *mut bindings::VipsImage = inp.ctx;
15071        let target_in: *mut bindings::VipsTarget = target.ctx;
15072
15073        let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
15074        utils::result(vips_op_response, (), Error::PngsaveTargetError)
15075    }
15076}
15077
15078/// Options for pngsave_target operation
15079#[derive(Clone, Debug)]
15080pub struct PngsaveTargetOptions {
15081    /// compression: `i32` -> Compression factor
15082    /// min: 0, max: 9, default: 6
15083    pub compression: i32,
15084    /// interlace: `bool` -> Interlace image
15085    /// default: false
15086    pub interlace: bool,
15087    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
15088    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
15089    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
15090    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
15091    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
15092    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
15093    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
15094    pub filter: ForeignPngFilter,
15095    /// palette: `bool` -> Quantise to 8bpp palette
15096    /// default: false
15097    pub palette: bool,
15098    /// q: `i32` -> Quantisation quality
15099    /// min: 0, max: 100, default: 100
15100    pub q: i32,
15101    /// dither: `f64` -> Amount of dithering
15102    /// min: 0, max: 1, default: 1
15103    pub dither: f64,
15104    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
15105    /// min: 1, max: 16, default: 8
15106    pub bitdepth: i32,
15107    /// effort: `i32` -> Quantisation CPU effort
15108    /// min: 1, max: 10, default: 7
15109    pub effort: i32,
15110    /// keep: `ForeignKeep` -> Which metadata to retain
15111    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15112    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15113    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15114    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15115    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15116    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15117    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15118    pub keep: ForeignKeep,
15119    /// background: `Vec<f64>` -> Background value
15120    pub background: Vec<f64>,
15121    /// page_height: `i32` -> Set page height for multipage save
15122    /// min: 0, max: 100000000, default: 0
15123    pub page_height: i32,
15124    /// profile: `String` -> Filename of ICC profile to embed
15125    pub profile: String,
15126}
15127
15128impl std::default::Default for PngsaveTargetOptions {
15129    fn default() -> Self {
15130        PngsaveTargetOptions {
15131            compression: i32::from(6),
15132            interlace: false,
15133            filter: ForeignPngFilter::None,
15134            palette: false,
15135            q: i32::from(100),
15136            dither: f64::from(1),
15137            bitdepth: i32::from(8),
15138            effort: i32::from(7),
15139            keep: ForeignKeep::All,
15140            background: Vec::new(),
15141            page_height: i32::from(0),
15142            profile: String::from("sRGB"),
15143        }
15144    }
15145}
15146
15147/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, mono rgb alpha
15148/// inp: `&VipsImage` -> Image to save
15149/// target: `&VipsTarget` -> Target to save to
15150/// pngsave_target_options: `&PngsaveTargetOptions` -> optional arguments
15151
15152pub fn pngsave_target_with_opts(
15153    inp: &VipsImage,
15154    target: &VipsTarget,
15155    pngsave_target_options: &PngsaveTargetOptions,
15156) -> Result<()> {
15157    unsafe {
15158        let inp_in: *mut bindings::VipsImage = inp.ctx;
15159        let target_in: *mut bindings::VipsTarget = target.ctx;
15160
15161        let compression_in: i32 = pngsave_target_options.compression;
15162        let compression_in_name = utils::new_c_string("compression")?;
15163
15164        let interlace_in: i32 = if pngsave_target_options.interlace {
15165            1
15166        } else {
15167            0
15168        };
15169        let interlace_in_name = utils::new_c_string("interlace")?;
15170
15171        let filter_in: i32 = pngsave_target_options.filter as i32;
15172        let filter_in_name = utils::new_c_string("filter")?;
15173
15174        let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
15175        let palette_in_name = utils::new_c_string("palette")?;
15176
15177        let q_in: i32 = pngsave_target_options.q;
15178        let q_in_name = utils::new_c_string("Q")?;
15179
15180        let dither_in: f64 = pngsave_target_options.dither;
15181        let dither_in_name = utils::new_c_string("dither")?;
15182
15183        let bitdepth_in: i32 = pngsave_target_options.bitdepth;
15184        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15185
15186        let effort_in: i32 = pngsave_target_options.effort;
15187        let effort_in_name = utils::new_c_string("effort")?;
15188
15189        let keep_in: i32 = pngsave_target_options.keep as i32;
15190        let keep_in_name = utils::new_c_string("keep")?;
15191
15192        let background_wrapper =
15193            utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
15194        let background_in = background_wrapper.ctx;
15195        let background_in_name = utils::new_c_string("background")?;
15196
15197        let page_height_in: i32 = pngsave_target_options.page_height;
15198        let page_height_in_name = utils::new_c_string("page-height")?;
15199
15200        let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
15201        let profile_in_name = utils::new_c_string("profile")?;
15202
15203        let vips_op_response = bindings::vips_pngsave_target(
15204            inp_in,
15205            target_in,
15206            compression_in_name.as_ptr(),
15207            compression_in,
15208            interlace_in_name.as_ptr(),
15209            interlace_in,
15210            filter_in_name.as_ptr(),
15211            filter_in,
15212            palette_in_name.as_ptr(),
15213            palette_in,
15214            q_in_name.as_ptr(),
15215            q_in,
15216            dither_in_name.as_ptr(),
15217            dither_in,
15218            bitdepth_in_name.as_ptr(),
15219            bitdepth_in,
15220            effort_in_name.as_ptr(),
15221            effort_in,
15222            keep_in_name.as_ptr(),
15223            keep_in,
15224            background_in_name.as_ptr(),
15225            background_in,
15226            page_height_in_name.as_ptr(),
15227            page_height_in,
15228            profile_in_name.as_ptr(),
15229            profile_in.as_ptr(),
15230            NULL,
15231        );
15232        utils::result(vips_op_response, (), Error::PngsaveTargetError)
15233    }
15234}
15235
15236/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15237/// inp: `&VipsImage` -> Image to save
15238/// filename: `&str` -> Filename to save to
15239
15240pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
15241    unsafe {
15242        let inp_in: *mut bindings::VipsImage = inp.ctx;
15243        let filename_in: CString = utils::new_c_string(filename)?;
15244
15245        let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
15246        utils::result(vips_op_response, (), Error::JpegsaveError)
15247    }
15248}
15249
15250/// Options for jpegsave operation
15251#[derive(Clone, Debug)]
15252pub struct JpegsaveOptions {
15253    /// q: `i32` -> Q factor
15254    /// min: 1, max: 100, default: 75
15255    pub q: i32,
15256    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15257    /// default: false
15258    pub optimize_coding: bool,
15259    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15260    /// default: false
15261    pub interlace: bool,
15262    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15263    /// default: false
15264    pub trellis_quant: bool,
15265    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15266    /// default: false
15267    pub overshoot_deringing: bool,
15268    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15269    /// default: false
15270    pub optimize_scans: bool,
15271    /// quant_table: `i32` -> Use predefined quantization table with given index
15272    /// min: 0, max: 8, default: 0
15273    pub quant_table: i32,
15274    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15275    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15276    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15277    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15278    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15279    pub subsample_mode: ForeignSubsample,
15280    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15281    /// min: 0, max: 2147483647, default: 0
15282    pub restart_interval: i32,
15283    /// keep: `ForeignKeep` -> Which metadata to retain
15284    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15285    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15286    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15287    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15288    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15289    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15290    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15291    pub keep: ForeignKeep,
15292    /// background: `Vec<f64>` -> Background value
15293    pub background: Vec<f64>,
15294    /// page_height: `i32` -> Set page height for multipage save
15295    /// min: 0, max: 100000000, default: 0
15296    pub page_height: i32,
15297    /// profile: `String` -> Filename of ICC profile to embed
15298    pub profile: String,
15299}
15300
15301impl std::default::Default for JpegsaveOptions {
15302    fn default() -> Self {
15303        JpegsaveOptions {
15304            q: i32::from(75),
15305            optimize_coding: false,
15306            interlace: false,
15307            trellis_quant: false,
15308            overshoot_deringing: false,
15309            optimize_scans: false,
15310            quant_table: i32::from(0),
15311            subsample_mode: ForeignSubsample::Auto,
15312            restart_interval: i32::from(0),
15313            keep: ForeignKeep::All,
15314            background: Vec::new(),
15315            page_height: i32::from(0),
15316            profile: String::from("sRGB"),
15317        }
15318    }
15319}
15320
15321/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15322/// inp: `&VipsImage` -> Image to save
15323/// filename: `&str` -> Filename to save to
15324/// jpegsave_options: `&JpegsaveOptions` -> optional arguments
15325
15326pub fn jpegsave_with_opts(
15327    inp: &VipsImage,
15328    filename: &str,
15329    jpegsave_options: &JpegsaveOptions,
15330) -> Result<()> {
15331    unsafe {
15332        let inp_in: *mut bindings::VipsImage = inp.ctx;
15333        let filename_in: CString = utils::new_c_string(filename)?;
15334
15335        let q_in: i32 = jpegsave_options.q;
15336        let q_in_name = utils::new_c_string("Q")?;
15337
15338        let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
15339            1
15340        } else {
15341            0
15342        };
15343        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15344
15345        let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
15346        let interlace_in_name = utils::new_c_string("interlace")?;
15347
15348        let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
15349        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15350
15351        let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
15352            1
15353        } else {
15354            0
15355        };
15356        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15357
15358        let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
15359            1
15360        } else {
15361            0
15362        };
15363        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15364
15365        let quant_table_in: i32 = jpegsave_options.quant_table;
15366        let quant_table_in_name = utils::new_c_string("quant-table")?;
15367
15368        let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
15369        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15370
15371        let restart_interval_in: i32 = jpegsave_options.restart_interval;
15372        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15373
15374        let keep_in: i32 = jpegsave_options.keep as i32;
15375        let keep_in_name = utils::new_c_string("keep")?;
15376
15377        let background_wrapper =
15378            utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
15379        let background_in = background_wrapper.ctx;
15380        let background_in_name = utils::new_c_string("background")?;
15381
15382        let page_height_in: i32 = jpegsave_options.page_height;
15383        let page_height_in_name = utils::new_c_string("page-height")?;
15384
15385        let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
15386        let profile_in_name = utils::new_c_string("profile")?;
15387
15388        let vips_op_response = bindings::vips_jpegsave(
15389            inp_in,
15390            filename_in.as_ptr(),
15391            q_in_name.as_ptr(),
15392            q_in,
15393            optimize_coding_in_name.as_ptr(),
15394            optimize_coding_in,
15395            interlace_in_name.as_ptr(),
15396            interlace_in,
15397            trellis_quant_in_name.as_ptr(),
15398            trellis_quant_in,
15399            overshoot_deringing_in_name.as_ptr(),
15400            overshoot_deringing_in,
15401            optimize_scans_in_name.as_ptr(),
15402            optimize_scans_in,
15403            quant_table_in_name.as_ptr(),
15404            quant_table_in,
15405            subsample_mode_in_name.as_ptr(),
15406            subsample_mode_in,
15407            restart_interval_in_name.as_ptr(),
15408            restart_interval_in,
15409            keep_in_name.as_ptr(),
15410            keep_in,
15411            background_in_name.as_ptr(),
15412            background_in,
15413            page_height_in_name.as_ptr(),
15414            page_height_in,
15415            profile_in_name.as_ptr(),
15416            profile_in.as_ptr(),
15417            NULL,
15418        );
15419        utils::result(vips_op_response, (), Error::JpegsaveError)
15420    }
15421}
15422
15423/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15424/// inp: `&VipsImage` -> Image to save
15425/// returns `Vec<u8>` - Buffer to save to
15426pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15427    unsafe {
15428        let inp_in: *mut bindings::VipsImage = inp.ctx;
15429        let mut buffer_buf_size: u64 = 0;
15430        let mut buffer_out: *mut c_void = null_mut();
15431
15432        let vips_op_response =
15433            bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15434        utils::result(
15435            vips_op_response,
15436            utils::new_byte_array(buffer_out, buffer_buf_size),
15437            Error::JpegsaveBufferError,
15438        )
15439    }
15440}
15441
15442/// Options for jpegsave_buffer operation
15443#[derive(Clone, Debug)]
15444pub struct JpegsaveBufferOptions {
15445    /// q: `i32` -> Q factor
15446    /// min: 1, max: 100, default: 75
15447    pub q: i32,
15448    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15449    /// default: false
15450    pub optimize_coding: bool,
15451    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15452    /// default: false
15453    pub interlace: bool,
15454    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15455    /// default: false
15456    pub trellis_quant: bool,
15457    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15458    /// default: false
15459    pub overshoot_deringing: bool,
15460    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15461    /// default: false
15462    pub optimize_scans: bool,
15463    /// quant_table: `i32` -> Use predefined quantization table with given index
15464    /// min: 0, max: 8, default: 0
15465    pub quant_table: i32,
15466    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15467    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15468    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15469    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15470    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15471    pub subsample_mode: ForeignSubsample,
15472    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15473    /// min: 0, max: 2147483647, default: 0
15474    pub restart_interval: i32,
15475    /// keep: `ForeignKeep` -> Which metadata to retain
15476    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15477    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15478    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15479    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15480    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15481    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15482    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15483    pub keep: ForeignKeep,
15484    /// background: `Vec<f64>` -> Background value
15485    pub background: Vec<f64>,
15486    /// page_height: `i32` -> Set page height for multipage save
15487    /// min: 0, max: 100000000, default: 0
15488    pub page_height: i32,
15489    /// profile: `String` -> Filename of ICC profile to embed
15490    pub profile: String,
15491}
15492
15493impl std::default::Default for JpegsaveBufferOptions {
15494    fn default() -> Self {
15495        JpegsaveBufferOptions {
15496            q: i32::from(75),
15497            optimize_coding: false,
15498            interlace: false,
15499            trellis_quant: false,
15500            overshoot_deringing: false,
15501            optimize_scans: false,
15502            quant_table: i32::from(0),
15503            subsample_mode: ForeignSubsample::Auto,
15504            restart_interval: i32::from(0),
15505            keep: ForeignKeep::All,
15506            background: Vec::new(),
15507            page_height: i32::from(0),
15508            profile: String::from("sRGB"),
15509        }
15510    }
15511}
15512
15513/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15514/// inp: `&VipsImage` -> Image to save
15515/// jpegsave_buffer_options: `&JpegsaveBufferOptions` -> optional arguments
15516/// returns `Vec<u8>` - Buffer to save to
15517pub fn jpegsave_buffer_with_opts(
15518    inp: &VipsImage,
15519    jpegsave_buffer_options: &JpegsaveBufferOptions,
15520) -> Result<Vec<u8>> {
15521    unsafe {
15522        let inp_in: *mut bindings::VipsImage = inp.ctx;
15523        let mut buffer_buf_size: u64 = 0;
15524        let mut buffer_out: *mut c_void = null_mut();
15525
15526        let q_in: i32 = jpegsave_buffer_options.q;
15527        let q_in_name = utils::new_c_string("Q")?;
15528
15529        let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15530            1
15531        } else {
15532            0
15533        };
15534        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15535
15536        let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15537            1
15538        } else {
15539            0
15540        };
15541        let interlace_in_name = utils::new_c_string("interlace")?;
15542
15543        let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15544            1
15545        } else {
15546            0
15547        };
15548        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15549
15550        let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15551            1
15552        } else {
15553            0
15554        };
15555        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15556
15557        let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15558            1
15559        } else {
15560            0
15561        };
15562        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15563
15564        let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15565        let quant_table_in_name = utils::new_c_string("quant-table")?;
15566
15567        let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15568        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15569
15570        let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15571        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15572
15573        let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15574        let keep_in_name = utils::new_c_string("keep")?;
15575
15576        let background_wrapper =
15577            utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15578        let background_in = background_wrapper.ctx;
15579        let background_in_name = utils::new_c_string("background")?;
15580
15581        let page_height_in: i32 = jpegsave_buffer_options.page_height;
15582        let page_height_in_name = utils::new_c_string("page-height")?;
15583
15584        let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15585        let profile_in_name = utils::new_c_string("profile")?;
15586
15587        let vips_op_response = bindings::vips_jpegsave_buffer(
15588            inp_in,
15589            &mut buffer_out,
15590            &mut buffer_buf_size,
15591            q_in_name.as_ptr(),
15592            q_in,
15593            optimize_coding_in_name.as_ptr(),
15594            optimize_coding_in,
15595            interlace_in_name.as_ptr(),
15596            interlace_in,
15597            trellis_quant_in_name.as_ptr(),
15598            trellis_quant_in,
15599            overshoot_deringing_in_name.as_ptr(),
15600            overshoot_deringing_in,
15601            optimize_scans_in_name.as_ptr(),
15602            optimize_scans_in,
15603            quant_table_in_name.as_ptr(),
15604            quant_table_in,
15605            subsample_mode_in_name.as_ptr(),
15606            subsample_mode_in,
15607            restart_interval_in_name.as_ptr(),
15608            restart_interval_in,
15609            keep_in_name.as_ptr(),
15610            keep_in,
15611            background_in_name.as_ptr(),
15612            background_in,
15613            page_height_in_name.as_ptr(),
15614            page_height_in,
15615            profile_in_name.as_ptr(),
15616            profile_in.as_ptr(),
15617            NULL,
15618        );
15619        utils::result(
15620            vips_op_response,
15621            utils::new_byte_array(buffer_out, buffer_buf_size),
15622            Error::JpegsaveBufferError,
15623        )
15624    }
15625}
15626
15627/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15628/// inp: `&VipsImage` -> Image to save
15629/// target: `&VipsTarget` -> Target to save to
15630
15631pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15632    unsafe {
15633        let inp_in: *mut bindings::VipsImage = inp.ctx;
15634        let target_in: *mut bindings::VipsTarget = target.ctx;
15635
15636        let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15637        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15638    }
15639}
15640
15641/// Options for jpegsave_target operation
15642#[derive(Clone, Debug)]
15643pub struct JpegsaveTargetOptions {
15644    /// q: `i32` -> Q factor
15645    /// min: 1, max: 100, default: 75
15646    pub q: i32,
15647    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15648    /// default: false
15649    pub optimize_coding: bool,
15650    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15651    /// default: false
15652    pub interlace: bool,
15653    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15654    /// default: false
15655    pub trellis_quant: bool,
15656    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15657    /// default: false
15658    pub overshoot_deringing: bool,
15659    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15660    /// default: false
15661    pub optimize_scans: bool,
15662    /// quant_table: `i32` -> Use predefined quantization table with given index
15663    /// min: 0, max: 8, default: 0
15664    pub quant_table: i32,
15665    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15666    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15667    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15668    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15669    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15670    pub subsample_mode: ForeignSubsample,
15671    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15672    /// min: 0, max: 2147483647, default: 0
15673    pub restart_interval: i32,
15674    /// keep: `ForeignKeep` -> Which metadata to retain
15675    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15676    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15677    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15678    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15679    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15680    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15681    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15682    pub keep: ForeignKeep,
15683    /// background: `Vec<f64>` -> Background value
15684    pub background: Vec<f64>,
15685    /// page_height: `i32` -> Set page height for multipage save
15686    /// min: 0, max: 100000000, default: 0
15687    pub page_height: i32,
15688    /// profile: `String` -> Filename of ICC profile to embed
15689    pub profile: String,
15690}
15691
15692impl std::default::Default for JpegsaveTargetOptions {
15693    fn default() -> Self {
15694        JpegsaveTargetOptions {
15695            q: i32::from(75),
15696            optimize_coding: false,
15697            interlace: false,
15698            trellis_quant: false,
15699            overshoot_deringing: false,
15700            optimize_scans: false,
15701            quant_table: i32::from(0),
15702            subsample_mode: ForeignSubsample::Auto,
15703            restart_interval: i32::from(0),
15704            keep: ForeignKeep::All,
15705            background: Vec::new(),
15706            page_height: i32::from(0),
15707            profile: String::from("sRGB"),
15708        }
15709    }
15710}
15711
15712/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15713/// inp: `&VipsImage` -> Image to save
15714/// target: `&VipsTarget` -> Target to save to
15715/// jpegsave_target_options: `&JpegsaveTargetOptions` -> optional arguments
15716
15717pub fn jpegsave_target_with_opts(
15718    inp: &VipsImage,
15719    target: &VipsTarget,
15720    jpegsave_target_options: &JpegsaveTargetOptions,
15721) -> Result<()> {
15722    unsafe {
15723        let inp_in: *mut bindings::VipsImage = inp.ctx;
15724        let target_in: *mut bindings::VipsTarget = target.ctx;
15725
15726        let q_in: i32 = jpegsave_target_options.q;
15727        let q_in_name = utils::new_c_string("Q")?;
15728
15729        let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15730            1
15731        } else {
15732            0
15733        };
15734        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15735
15736        let interlace_in: i32 = if jpegsave_target_options.interlace {
15737            1
15738        } else {
15739            0
15740        };
15741        let interlace_in_name = utils::new_c_string("interlace")?;
15742
15743        let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15744            1
15745        } else {
15746            0
15747        };
15748        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15749
15750        let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15751            1
15752        } else {
15753            0
15754        };
15755        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15756
15757        let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15758            1
15759        } else {
15760            0
15761        };
15762        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15763
15764        let quant_table_in: i32 = jpegsave_target_options.quant_table;
15765        let quant_table_in_name = utils::new_c_string("quant-table")?;
15766
15767        let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15768        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15769
15770        let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15771        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15772
15773        let keep_in: i32 = jpegsave_target_options.keep as i32;
15774        let keep_in_name = utils::new_c_string("keep")?;
15775
15776        let background_wrapper =
15777            utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15778        let background_in = background_wrapper.ctx;
15779        let background_in_name = utils::new_c_string("background")?;
15780
15781        let page_height_in: i32 = jpegsave_target_options.page_height;
15782        let page_height_in_name = utils::new_c_string("page-height")?;
15783
15784        let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15785        let profile_in_name = utils::new_c_string("profile")?;
15786
15787        let vips_op_response = bindings::vips_jpegsave_target(
15788            inp_in,
15789            target_in,
15790            q_in_name.as_ptr(),
15791            q_in,
15792            optimize_coding_in_name.as_ptr(),
15793            optimize_coding_in,
15794            interlace_in_name.as_ptr(),
15795            interlace_in,
15796            trellis_quant_in_name.as_ptr(),
15797            trellis_quant_in,
15798            overshoot_deringing_in_name.as_ptr(),
15799            overshoot_deringing_in,
15800            optimize_scans_in_name.as_ptr(),
15801            optimize_scans_in,
15802            quant_table_in_name.as_ptr(),
15803            quant_table_in,
15804            subsample_mode_in_name.as_ptr(),
15805            subsample_mode_in,
15806            restart_interval_in_name.as_ptr(),
15807            restart_interval_in,
15808            keep_in_name.as_ptr(),
15809            keep_in,
15810            background_in_name.as_ptr(),
15811            background_in,
15812            page_height_in_name.as_ptr(),
15813            page_height_in,
15814            profile_in_name.as_ptr(),
15815            profile_in.as_ptr(),
15816            NULL,
15817        );
15818        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15819    }
15820}
15821
15822/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15823/// inp: `&VipsImage` -> Image to save
15824
15825pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15826    unsafe {
15827        let inp_in: *mut bindings::VipsImage = inp.ctx;
15828
15829        let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15830        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15831    }
15832}
15833
15834/// Options for jpegsave_mime operation
15835#[derive(Clone, Debug)]
15836pub struct JpegsaveMimeOptions {
15837    /// q: `i32` -> Q factor
15838    /// min: 1, max: 100, default: 75
15839    pub q: i32,
15840    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15841    /// default: false
15842    pub optimize_coding: bool,
15843    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15844    /// default: false
15845    pub interlace: bool,
15846    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15847    /// default: false
15848    pub trellis_quant: bool,
15849    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15850    /// default: false
15851    pub overshoot_deringing: bool,
15852    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15853    /// default: false
15854    pub optimize_scans: bool,
15855    /// quant_table: `i32` -> Use predefined quantization table with given index
15856    /// min: 0, max: 8, default: 0
15857    pub quant_table: i32,
15858    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15859    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15860    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15861    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15862    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15863    pub subsample_mode: ForeignSubsample,
15864    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15865    /// min: 0, max: 2147483647, default: 0
15866    pub restart_interval: i32,
15867    /// keep: `ForeignKeep` -> Which metadata to retain
15868    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15869    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15870    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15871    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15872    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15873    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15874    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15875    pub keep: ForeignKeep,
15876    /// background: `Vec<f64>` -> Background value
15877    pub background: Vec<f64>,
15878    /// page_height: `i32` -> Set page height for multipage save
15879    /// min: 0, max: 100000000, default: 0
15880    pub page_height: i32,
15881    /// profile: `String` -> Filename of ICC profile to embed
15882    pub profile: String,
15883}
15884
15885impl std::default::Default for JpegsaveMimeOptions {
15886    fn default() -> Self {
15887        JpegsaveMimeOptions {
15888            q: i32::from(75),
15889            optimize_coding: false,
15890            interlace: false,
15891            trellis_quant: false,
15892            overshoot_deringing: false,
15893            optimize_scans: false,
15894            quant_table: i32::from(0),
15895            subsample_mode: ForeignSubsample::Auto,
15896            restart_interval: i32::from(0),
15897            keep: ForeignKeep::All,
15898            background: Vec::new(),
15899            page_height: i32::from(0),
15900            profile: String::from("sRGB"),
15901        }
15902    }
15903}
15904
15905/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, mono rgb cmyk
15906/// inp: `&VipsImage` -> Image to save
15907/// jpegsave_mime_options: `&JpegsaveMimeOptions` -> optional arguments
15908
15909pub fn jpegsave_mime_with_opts(
15910    inp: &VipsImage,
15911    jpegsave_mime_options: &JpegsaveMimeOptions,
15912) -> Result<()> {
15913    unsafe {
15914        let inp_in: *mut bindings::VipsImage = inp.ctx;
15915
15916        let q_in: i32 = jpegsave_mime_options.q;
15917        let q_in_name = utils::new_c_string("Q")?;
15918
15919        let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15920            1
15921        } else {
15922            0
15923        };
15924        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15925
15926        let interlace_in: i32 = if jpegsave_mime_options.interlace {
15927            1
15928        } else {
15929            0
15930        };
15931        let interlace_in_name = utils::new_c_string("interlace")?;
15932
15933        let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15934            1
15935        } else {
15936            0
15937        };
15938        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15939
15940        let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15941            1
15942        } else {
15943            0
15944        };
15945        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15946
15947        let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15948            1
15949        } else {
15950            0
15951        };
15952        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15953
15954        let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15955        let quant_table_in_name = utils::new_c_string("quant-table")?;
15956
15957        let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15958        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15959
15960        let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15961        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15962
15963        let keep_in: i32 = jpegsave_mime_options.keep as i32;
15964        let keep_in_name = utils::new_c_string("keep")?;
15965
15966        let background_wrapper =
15967            utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15968        let background_in = background_wrapper.ctx;
15969        let background_in_name = utils::new_c_string("background")?;
15970
15971        let page_height_in: i32 = jpegsave_mime_options.page_height;
15972        let page_height_in_name = utils::new_c_string("page-height")?;
15973
15974        let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15975        let profile_in_name = utils::new_c_string("profile")?;
15976
15977        let vips_op_response = bindings::vips_jpegsave_mime(
15978            inp_in,
15979            q_in_name.as_ptr(),
15980            q_in,
15981            optimize_coding_in_name.as_ptr(),
15982            optimize_coding_in,
15983            interlace_in_name.as_ptr(),
15984            interlace_in,
15985            trellis_quant_in_name.as_ptr(),
15986            trellis_quant_in,
15987            overshoot_deringing_in_name.as_ptr(),
15988            overshoot_deringing_in,
15989            optimize_scans_in_name.as_ptr(),
15990            optimize_scans_in,
15991            quant_table_in_name.as_ptr(),
15992            quant_table_in,
15993            subsample_mode_in_name.as_ptr(),
15994            subsample_mode_in,
15995            restart_interval_in_name.as_ptr(),
15996            restart_interval_in,
15997            keep_in_name.as_ptr(),
15998            keep_in,
15999            background_in_name.as_ptr(),
16000            background_in,
16001            page_height_in_name.as_ptr(),
16002            page_height_in,
16003            profile_in_name.as_ptr(),
16004            profile_in.as_ptr(),
16005            NULL,
16006        );
16007        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
16008    }
16009}
16010
16011/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgb alpha
16012/// inp: `&VipsImage` -> Image to save
16013/// filename: `&str` -> Filename to save to
16014
16015pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
16016    unsafe {
16017        let inp_in: *mut bindings::VipsImage = inp.ctx;
16018        let filename_in: CString = utils::new_c_string(filename)?;
16019
16020        let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
16021        utils::result(vips_op_response, (), Error::WebpsaveError)
16022    }
16023}
16024
16025/// Options for webpsave operation
16026#[derive(Clone, Debug)]
16027pub struct WebpsaveOptions {
16028    /// q: `i32` -> Q factor
16029    /// min: 0, max: 100, default: 75
16030    pub q: i32,
16031    /// lossless: `bool` -> Enable lossless compression
16032    /// default: false
16033    pub lossless: bool,
16034    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16035    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16036    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16037    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16038    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16039    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16040    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16041    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16042    pub preset: ForeignWebpPreset,
16043    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16044    /// default: false
16045    pub smart_subsample: bool,
16046    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16047    /// default: false
16048    pub near_lossless: bool,
16049    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16050    /// min: 0, max: 100, default: 100
16051    pub alpha_q: i32,
16052    /// min_size: `bool` -> Optimise for minimum size
16053    /// default: false
16054    pub min_size: bool,
16055    /// kmin: `i32` -> Minimum number of frames between key frames
16056    /// min: 0, max: 2147483647, default: 2147483646
16057    pub kmin: i32,
16058    /// kmax: `i32` -> Maximum number of frames between key frames
16059    /// min: 0, max: 2147483647, default: 2147483647
16060    pub kmax: i32,
16061    /// effort: `i32` -> Level of CPU effort to reduce file size
16062    /// min: 0, max: 6, default: 4
16063    pub effort: i32,
16064    /// target_size: `i32` -> Desired target size in bytes
16065    /// min: 0, max: 2147483647, default: 0
16066    pub target_size: i32,
16067    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16068    /// default: false
16069    pub mixed: bool,
16070    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16071    /// default: false
16072    pub smart_deblock: bool,
16073    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16074    /// min: 1, max: 10, default: 1
16075    pub passes: i32,
16076    /// keep: `ForeignKeep` -> Which metadata to retain
16077    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16078    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16079    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16080    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16081    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16082    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16083    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16084    pub keep: ForeignKeep,
16085    /// background: `Vec<f64>` -> Background value
16086    pub background: Vec<f64>,
16087    /// page_height: `i32` -> Set page height for multipage save
16088    /// min: 0, max: 100000000, default: 0
16089    pub page_height: i32,
16090    /// profile: `String` -> Filename of ICC profile to embed
16091    pub profile: String,
16092}
16093
16094impl std::default::Default for WebpsaveOptions {
16095    fn default() -> Self {
16096        WebpsaveOptions {
16097            q: i32::from(75),
16098            lossless: false,
16099            preset: ForeignWebpPreset::Default,
16100            smart_subsample: false,
16101            near_lossless: false,
16102            alpha_q: i32::from(100),
16103            min_size: false,
16104            kmin: i32::from(2147483646),
16105            kmax: i32::from(2147483647),
16106            effort: i32::from(4),
16107            target_size: i32::from(0),
16108            mixed: false,
16109            smart_deblock: false,
16110            passes: i32::from(1),
16111            keep: ForeignKeep::All,
16112            background: Vec::new(),
16113            page_height: i32::from(0),
16114            profile: String::from("sRGB"),
16115        }
16116    }
16117}
16118
16119/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgb alpha
16120/// inp: `&VipsImage` -> Image to save
16121/// filename: `&str` -> Filename to save to
16122/// webpsave_options: `&WebpsaveOptions` -> optional arguments
16123
16124pub fn webpsave_with_opts(
16125    inp: &VipsImage,
16126    filename: &str,
16127    webpsave_options: &WebpsaveOptions,
16128) -> Result<()> {
16129    unsafe {
16130        let inp_in: *mut bindings::VipsImage = inp.ctx;
16131        let filename_in: CString = utils::new_c_string(filename)?;
16132
16133        let q_in: i32 = webpsave_options.q;
16134        let q_in_name = utils::new_c_string("Q")?;
16135
16136        let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
16137        let lossless_in_name = utils::new_c_string("lossless")?;
16138
16139        let preset_in: i32 = webpsave_options.preset as i32;
16140        let preset_in_name = utils::new_c_string("preset")?;
16141
16142        let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
16143            1
16144        } else {
16145            0
16146        };
16147        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16148
16149        let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
16150        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16151
16152        let alpha_q_in: i32 = webpsave_options.alpha_q;
16153        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16154
16155        let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
16156        let min_size_in_name = utils::new_c_string("min-size")?;
16157
16158        let kmin_in: i32 = webpsave_options.kmin;
16159        let kmin_in_name = utils::new_c_string("kmin")?;
16160
16161        let kmax_in: i32 = webpsave_options.kmax;
16162        let kmax_in_name = utils::new_c_string("kmax")?;
16163
16164        let effort_in: i32 = webpsave_options.effort;
16165        let effort_in_name = utils::new_c_string("effort")?;
16166
16167        let target_size_in: i32 = webpsave_options.target_size;
16168        let target_size_in_name = utils::new_c_string("target-size")?;
16169
16170        let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
16171        let mixed_in_name = utils::new_c_string("mixed")?;
16172
16173        let smart_deblock_in: i32 = if webpsave_options.smart_deblock { 1 } else { 0 };
16174        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16175
16176        let passes_in: i32 = webpsave_options.passes;
16177        let passes_in_name = utils::new_c_string("passes")?;
16178
16179        let keep_in: i32 = webpsave_options.keep as i32;
16180        let keep_in_name = utils::new_c_string("keep")?;
16181
16182        let background_wrapper =
16183            utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
16184        let background_in = background_wrapper.ctx;
16185        let background_in_name = utils::new_c_string("background")?;
16186
16187        let page_height_in: i32 = webpsave_options.page_height;
16188        let page_height_in_name = utils::new_c_string("page-height")?;
16189
16190        let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
16191        let profile_in_name = utils::new_c_string("profile")?;
16192
16193        let vips_op_response = bindings::vips_webpsave(
16194            inp_in,
16195            filename_in.as_ptr(),
16196            q_in_name.as_ptr(),
16197            q_in,
16198            lossless_in_name.as_ptr(),
16199            lossless_in,
16200            preset_in_name.as_ptr(),
16201            preset_in,
16202            smart_subsample_in_name.as_ptr(),
16203            smart_subsample_in,
16204            near_lossless_in_name.as_ptr(),
16205            near_lossless_in,
16206            alpha_q_in_name.as_ptr(),
16207            alpha_q_in,
16208            min_size_in_name.as_ptr(),
16209            min_size_in,
16210            kmin_in_name.as_ptr(),
16211            kmin_in,
16212            kmax_in_name.as_ptr(),
16213            kmax_in,
16214            effort_in_name.as_ptr(),
16215            effort_in,
16216            target_size_in_name.as_ptr(),
16217            target_size_in,
16218            mixed_in_name.as_ptr(),
16219            mixed_in,
16220            smart_deblock_in_name.as_ptr(),
16221            smart_deblock_in,
16222            passes_in_name.as_ptr(),
16223            passes_in,
16224            keep_in_name.as_ptr(),
16225            keep_in,
16226            background_in_name.as_ptr(),
16227            background_in,
16228            page_height_in_name.as_ptr(),
16229            page_height_in,
16230            profile_in_name.as_ptr(),
16231            profile_in.as_ptr(),
16232            NULL,
16233        );
16234        utils::result(vips_op_response, (), Error::WebpsaveError)
16235    }
16236}
16237
16238/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgb alpha
16239/// inp: `&VipsImage` -> Image to save
16240/// returns `Vec<u8>` - Buffer to save to
16241pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16242    unsafe {
16243        let inp_in: *mut bindings::VipsImage = inp.ctx;
16244        let mut buffer_buf_size: u64 = 0;
16245        let mut buffer_out: *mut c_void = null_mut();
16246
16247        let vips_op_response =
16248            bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16249        utils::result(
16250            vips_op_response,
16251            utils::new_byte_array(buffer_out, buffer_buf_size),
16252            Error::WebpsaveBufferError,
16253        )
16254    }
16255}
16256
16257/// Options for webpsave_buffer operation
16258#[derive(Clone, Debug)]
16259pub struct WebpsaveBufferOptions {
16260    /// q: `i32` -> Q factor
16261    /// min: 0, max: 100, default: 75
16262    pub q: i32,
16263    /// lossless: `bool` -> Enable lossless compression
16264    /// default: false
16265    pub lossless: bool,
16266    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16267    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16268    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16269    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16270    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16271    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16272    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16273    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16274    pub preset: ForeignWebpPreset,
16275    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16276    /// default: false
16277    pub smart_subsample: bool,
16278    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16279    /// default: false
16280    pub near_lossless: bool,
16281    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16282    /// min: 0, max: 100, default: 100
16283    pub alpha_q: i32,
16284    /// min_size: `bool` -> Optimise for minimum size
16285    /// default: false
16286    pub min_size: bool,
16287    /// kmin: `i32` -> Minimum number of frames between key frames
16288    /// min: 0, max: 2147483647, default: 2147483646
16289    pub kmin: i32,
16290    /// kmax: `i32` -> Maximum number of frames between key frames
16291    /// min: 0, max: 2147483647, default: 2147483647
16292    pub kmax: i32,
16293    /// effort: `i32` -> Level of CPU effort to reduce file size
16294    /// min: 0, max: 6, default: 4
16295    pub effort: i32,
16296    /// target_size: `i32` -> Desired target size in bytes
16297    /// min: 0, max: 2147483647, default: 0
16298    pub target_size: i32,
16299    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16300    /// default: false
16301    pub mixed: bool,
16302    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16303    /// default: false
16304    pub smart_deblock: bool,
16305    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16306    /// min: 1, max: 10, default: 1
16307    pub passes: i32,
16308    /// keep: `ForeignKeep` -> Which metadata to retain
16309    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16310    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16311    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16312    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16313    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16314    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16315    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16316    pub keep: ForeignKeep,
16317    /// background: `Vec<f64>` -> Background value
16318    pub background: Vec<f64>,
16319    /// page_height: `i32` -> Set page height for multipage save
16320    /// min: 0, max: 100000000, default: 0
16321    pub page_height: i32,
16322    /// profile: `String` -> Filename of ICC profile to embed
16323    pub profile: String,
16324}
16325
16326impl std::default::Default for WebpsaveBufferOptions {
16327    fn default() -> Self {
16328        WebpsaveBufferOptions {
16329            q: i32::from(75),
16330            lossless: false,
16331            preset: ForeignWebpPreset::Default,
16332            smart_subsample: false,
16333            near_lossless: false,
16334            alpha_q: i32::from(100),
16335            min_size: false,
16336            kmin: i32::from(2147483646),
16337            kmax: i32::from(2147483647),
16338            effort: i32::from(4),
16339            target_size: i32::from(0),
16340            mixed: false,
16341            smart_deblock: false,
16342            passes: i32::from(1),
16343            keep: ForeignKeep::All,
16344            background: Vec::new(),
16345            page_height: i32::from(0),
16346            profile: String::from("sRGB"),
16347        }
16348    }
16349}
16350
16351/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgb alpha
16352/// inp: `&VipsImage` -> Image to save
16353/// webpsave_buffer_options: `&WebpsaveBufferOptions` -> optional arguments
16354/// returns `Vec<u8>` - Buffer to save to
16355pub fn webpsave_buffer_with_opts(
16356    inp: &VipsImage,
16357    webpsave_buffer_options: &WebpsaveBufferOptions,
16358) -> Result<Vec<u8>> {
16359    unsafe {
16360        let inp_in: *mut bindings::VipsImage = inp.ctx;
16361        let mut buffer_buf_size: u64 = 0;
16362        let mut buffer_out: *mut c_void = null_mut();
16363
16364        let q_in: i32 = webpsave_buffer_options.q;
16365        let q_in_name = utils::new_c_string("Q")?;
16366
16367        let lossless_in: i32 = if webpsave_buffer_options.lossless {
16368            1
16369        } else {
16370            0
16371        };
16372        let lossless_in_name = utils::new_c_string("lossless")?;
16373
16374        let preset_in: i32 = webpsave_buffer_options.preset as i32;
16375        let preset_in_name = utils::new_c_string("preset")?;
16376
16377        let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
16378            1
16379        } else {
16380            0
16381        };
16382        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16383
16384        let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
16385            1
16386        } else {
16387            0
16388        };
16389        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16390
16391        let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
16392        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16393
16394        let min_size_in: i32 = if webpsave_buffer_options.min_size {
16395            1
16396        } else {
16397            0
16398        };
16399        let min_size_in_name = utils::new_c_string("min-size")?;
16400
16401        let kmin_in: i32 = webpsave_buffer_options.kmin;
16402        let kmin_in_name = utils::new_c_string("kmin")?;
16403
16404        let kmax_in: i32 = webpsave_buffer_options.kmax;
16405        let kmax_in_name = utils::new_c_string("kmax")?;
16406
16407        let effort_in: i32 = webpsave_buffer_options.effort;
16408        let effort_in_name = utils::new_c_string("effort")?;
16409
16410        let target_size_in: i32 = webpsave_buffer_options.target_size;
16411        let target_size_in_name = utils::new_c_string("target-size")?;
16412
16413        let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
16414        let mixed_in_name = utils::new_c_string("mixed")?;
16415
16416        let smart_deblock_in: i32 = if webpsave_buffer_options.smart_deblock {
16417            1
16418        } else {
16419            0
16420        };
16421        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16422
16423        let passes_in: i32 = webpsave_buffer_options.passes;
16424        let passes_in_name = utils::new_c_string("passes")?;
16425
16426        let keep_in: i32 = webpsave_buffer_options.keep as i32;
16427        let keep_in_name = utils::new_c_string("keep")?;
16428
16429        let background_wrapper =
16430            utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
16431        let background_in = background_wrapper.ctx;
16432        let background_in_name = utils::new_c_string("background")?;
16433
16434        let page_height_in: i32 = webpsave_buffer_options.page_height;
16435        let page_height_in_name = utils::new_c_string("page-height")?;
16436
16437        let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
16438        let profile_in_name = utils::new_c_string("profile")?;
16439
16440        let vips_op_response = bindings::vips_webpsave_buffer(
16441            inp_in,
16442            &mut buffer_out,
16443            &mut buffer_buf_size,
16444            q_in_name.as_ptr(),
16445            q_in,
16446            lossless_in_name.as_ptr(),
16447            lossless_in,
16448            preset_in_name.as_ptr(),
16449            preset_in,
16450            smart_subsample_in_name.as_ptr(),
16451            smart_subsample_in,
16452            near_lossless_in_name.as_ptr(),
16453            near_lossless_in,
16454            alpha_q_in_name.as_ptr(),
16455            alpha_q_in,
16456            min_size_in_name.as_ptr(),
16457            min_size_in,
16458            kmin_in_name.as_ptr(),
16459            kmin_in,
16460            kmax_in_name.as_ptr(),
16461            kmax_in,
16462            effort_in_name.as_ptr(),
16463            effort_in,
16464            target_size_in_name.as_ptr(),
16465            target_size_in,
16466            mixed_in_name.as_ptr(),
16467            mixed_in,
16468            smart_deblock_in_name.as_ptr(),
16469            smart_deblock_in,
16470            passes_in_name.as_ptr(),
16471            passes_in,
16472            keep_in_name.as_ptr(),
16473            keep_in,
16474            background_in_name.as_ptr(),
16475            background_in,
16476            page_height_in_name.as_ptr(),
16477            page_height_in,
16478            profile_in_name.as_ptr(),
16479            profile_in.as_ptr(),
16480            NULL,
16481        );
16482        utils::result(
16483            vips_op_response,
16484            utils::new_byte_array(buffer_out, buffer_buf_size),
16485            Error::WebpsaveBufferError,
16486        )
16487    }
16488}
16489
16490/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgb alpha
16491/// inp: `&VipsImage` -> Image to save
16492/// target: `&VipsTarget` -> Target to save to
16493
16494pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16495    unsafe {
16496        let inp_in: *mut bindings::VipsImage = inp.ctx;
16497        let target_in: *mut bindings::VipsTarget = target.ctx;
16498
16499        let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
16500        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16501    }
16502}
16503
16504/// Options for webpsave_target operation
16505#[derive(Clone, Debug)]
16506pub struct WebpsaveTargetOptions {
16507    /// q: `i32` -> Q factor
16508    /// min: 0, max: 100, default: 75
16509    pub q: i32,
16510    /// lossless: `bool` -> Enable lossless compression
16511    /// default: false
16512    pub lossless: bool,
16513    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16514    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16515    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16516    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16517    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16518    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16519    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16520    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16521    pub preset: ForeignWebpPreset,
16522    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16523    /// default: false
16524    pub smart_subsample: bool,
16525    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16526    /// default: false
16527    pub near_lossless: bool,
16528    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16529    /// min: 0, max: 100, default: 100
16530    pub alpha_q: i32,
16531    /// min_size: `bool` -> Optimise for minimum size
16532    /// default: false
16533    pub min_size: bool,
16534    /// kmin: `i32` -> Minimum number of frames between key frames
16535    /// min: 0, max: 2147483647, default: 2147483646
16536    pub kmin: i32,
16537    /// kmax: `i32` -> Maximum number of frames between key frames
16538    /// min: 0, max: 2147483647, default: 2147483647
16539    pub kmax: i32,
16540    /// effort: `i32` -> Level of CPU effort to reduce file size
16541    /// min: 0, max: 6, default: 4
16542    pub effort: i32,
16543    /// target_size: `i32` -> Desired target size in bytes
16544    /// min: 0, max: 2147483647, default: 0
16545    pub target_size: i32,
16546    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16547    /// default: false
16548    pub mixed: bool,
16549    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16550    /// default: false
16551    pub smart_deblock: bool,
16552    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16553    /// min: 1, max: 10, default: 1
16554    pub passes: i32,
16555    /// keep: `ForeignKeep` -> Which metadata to retain
16556    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16557    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16558    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16559    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16560    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16561    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16562    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16563    pub keep: ForeignKeep,
16564    /// background: `Vec<f64>` -> Background value
16565    pub background: Vec<f64>,
16566    /// page_height: `i32` -> Set page height for multipage save
16567    /// min: 0, max: 100000000, default: 0
16568    pub page_height: i32,
16569    /// profile: `String` -> Filename of ICC profile to embed
16570    pub profile: String,
16571}
16572
16573impl std::default::Default for WebpsaveTargetOptions {
16574    fn default() -> Self {
16575        WebpsaveTargetOptions {
16576            q: i32::from(75),
16577            lossless: false,
16578            preset: ForeignWebpPreset::Default,
16579            smart_subsample: false,
16580            near_lossless: false,
16581            alpha_q: i32::from(100),
16582            min_size: false,
16583            kmin: i32::from(2147483646),
16584            kmax: i32::from(2147483647),
16585            effort: i32::from(4),
16586            target_size: i32::from(0),
16587            mixed: false,
16588            smart_deblock: false,
16589            passes: i32::from(1),
16590            keep: ForeignKeep::All,
16591            background: Vec::new(),
16592            page_height: i32::from(0),
16593            profile: String::from("sRGB"),
16594        }
16595    }
16596}
16597
16598/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgb alpha
16599/// inp: `&VipsImage` -> Image to save
16600/// target: `&VipsTarget` -> Target to save to
16601/// webpsave_target_options: `&WebpsaveTargetOptions` -> optional arguments
16602
16603pub fn webpsave_target_with_opts(
16604    inp: &VipsImage,
16605    target: &VipsTarget,
16606    webpsave_target_options: &WebpsaveTargetOptions,
16607) -> Result<()> {
16608    unsafe {
16609        let inp_in: *mut bindings::VipsImage = inp.ctx;
16610        let target_in: *mut bindings::VipsTarget = target.ctx;
16611
16612        let q_in: i32 = webpsave_target_options.q;
16613        let q_in_name = utils::new_c_string("Q")?;
16614
16615        let lossless_in: i32 = if webpsave_target_options.lossless {
16616            1
16617        } else {
16618            0
16619        };
16620        let lossless_in_name = utils::new_c_string("lossless")?;
16621
16622        let preset_in: i32 = webpsave_target_options.preset as i32;
16623        let preset_in_name = utils::new_c_string("preset")?;
16624
16625        let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16626            1
16627        } else {
16628            0
16629        };
16630        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16631
16632        let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16633            1
16634        } else {
16635            0
16636        };
16637        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16638
16639        let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16640        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16641
16642        let min_size_in: i32 = if webpsave_target_options.min_size {
16643            1
16644        } else {
16645            0
16646        };
16647        let min_size_in_name = utils::new_c_string("min-size")?;
16648
16649        let kmin_in: i32 = webpsave_target_options.kmin;
16650        let kmin_in_name = utils::new_c_string("kmin")?;
16651
16652        let kmax_in: i32 = webpsave_target_options.kmax;
16653        let kmax_in_name = utils::new_c_string("kmax")?;
16654
16655        let effort_in: i32 = webpsave_target_options.effort;
16656        let effort_in_name = utils::new_c_string("effort")?;
16657
16658        let target_size_in: i32 = webpsave_target_options.target_size;
16659        let target_size_in_name = utils::new_c_string("target-size")?;
16660
16661        let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16662        let mixed_in_name = utils::new_c_string("mixed")?;
16663
16664        let smart_deblock_in: i32 = if webpsave_target_options.smart_deblock {
16665            1
16666        } else {
16667            0
16668        };
16669        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16670
16671        let passes_in: i32 = webpsave_target_options.passes;
16672        let passes_in_name = utils::new_c_string("passes")?;
16673
16674        let keep_in: i32 = webpsave_target_options.keep as i32;
16675        let keep_in_name = utils::new_c_string("keep")?;
16676
16677        let background_wrapper =
16678            utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16679        let background_in = background_wrapper.ctx;
16680        let background_in_name = utils::new_c_string("background")?;
16681
16682        let page_height_in: i32 = webpsave_target_options.page_height;
16683        let page_height_in_name = utils::new_c_string("page-height")?;
16684
16685        let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16686        let profile_in_name = utils::new_c_string("profile")?;
16687
16688        let vips_op_response = bindings::vips_webpsave_target(
16689            inp_in,
16690            target_in,
16691            q_in_name.as_ptr(),
16692            q_in,
16693            lossless_in_name.as_ptr(),
16694            lossless_in,
16695            preset_in_name.as_ptr(),
16696            preset_in,
16697            smart_subsample_in_name.as_ptr(),
16698            smart_subsample_in,
16699            near_lossless_in_name.as_ptr(),
16700            near_lossless_in,
16701            alpha_q_in_name.as_ptr(),
16702            alpha_q_in,
16703            min_size_in_name.as_ptr(),
16704            min_size_in,
16705            kmin_in_name.as_ptr(),
16706            kmin_in,
16707            kmax_in_name.as_ptr(),
16708            kmax_in,
16709            effort_in_name.as_ptr(),
16710            effort_in,
16711            target_size_in_name.as_ptr(),
16712            target_size_in,
16713            mixed_in_name.as_ptr(),
16714            mixed_in,
16715            smart_deblock_in_name.as_ptr(),
16716            smart_deblock_in,
16717            passes_in_name.as_ptr(),
16718            passes_in,
16719            keep_in_name.as_ptr(),
16720            keep_in,
16721            background_in_name.as_ptr(),
16722            background_in,
16723            page_height_in_name.as_ptr(),
16724            page_height_in,
16725            profile_in_name.as_ptr(),
16726            profile_in.as_ptr(),
16727            NULL,
16728        );
16729        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16730    }
16731}
16732
16733/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgb alpha
16734/// inp: `&VipsImage` -> Image to save
16735
16736pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16737    unsafe {
16738        let inp_in: *mut bindings::VipsImage = inp.ctx;
16739
16740        let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16741        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16742    }
16743}
16744
16745/// Options for webpsave_mime operation
16746#[derive(Clone, Debug)]
16747pub struct WebpsaveMimeOptions {
16748    /// q: `i32` -> Q factor
16749    /// min: 0, max: 100, default: 75
16750    pub q: i32,
16751    /// lossless: `bool` -> Enable lossless compression
16752    /// default: false
16753    pub lossless: bool,
16754    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16755    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16756    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16757    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16758    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16759    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16760    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16761    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16762    pub preset: ForeignWebpPreset,
16763    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16764    /// default: false
16765    pub smart_subsample: bool,
16766    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16767    /// default: false
16768    pub near_lossless: bool,
16769    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16770    /// min: 0, max: 100, default: 100
16771    pub alpha_q: i32,
16772    /// min_size: `bool` -> Optimise for minimum size
16773    /// default: false
16774    pub min_size: bool,
16775    /// kmin: `i32` -> Minimum number of frames between key frames
16776    /// min: 0, max: 2147483647, default: 2147483646
16777    pub kmin: i32,
16778    /// kmax: `i32` -> Maximum number of frames between key frames
16779    /// min: 0, max: 2147483647, default: 2147483647
16780    pub kmax: i32,
16781    /// effort: `i32` -> Level of CPU effort to reduce file size
16782    /// min: 0, max: 6, default: 4
16783    pub effort: i32,
16784    /// target_size: `i32` -> Desired target size in bytes
16785    /// min: 0, max: 2147483647, default: 0
16786    pub target_size: i32,
16787    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16788    /// default: false
16789    pub mixed: bool,
16790    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16791    /// default: false
16792    pub smart_deblock: bool,
16793    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16794    /// min: 1, max: 10, default: 1
16795    pub passes: i32,
16796    /// keep: `ForeignKeep` -> Which metadata to retain
16797    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16798    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16799    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16800    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16801    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16802    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16803    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16804    pub keep: ForeignKeep,
16805    /// background: `Vec<f64>` -> Background value
16806    pub background: Vec<f64>,
16807    /// page_height: `i32` -> Set page height for multipage save
16808    /// min: 0, max: 100000000, default: 0
16809    pub page_height: i32,
16810    /// profile: `String` -> Filename of ICC profile to embed
16811    pub profile: String,
16812}
16813
16814impl std::default::Default for WebpsaveMimeOptions {
16815    fn default() -> Self {
16816        WebpsaveMimeOptions {
16817            q: i32::from(75),
16818            lossless: false,
16819            preset: ForeignWebpPreset::Default,
16820            smart_subsample: false,
16821            near_lossless: false,
16822            alpha_q: i32::from(100),
16823            min_size: false,
16824            kmin: i32::from(2147483646),
16825            kmax: i32::from(2147483647),
16826            effort: i32::from(4),
16827            target_size: i32::from(0),
16828            mixed: false,
16829            smart_deblock: false,
16830            passes: i32::from(1),
16831            keep: ForeignKeep::All,
16832            background: Vec::new(),
16833            page_height: i32::from(0),
16834            profile: String::from("sRGB"),
16835        }
16836    }
16837}
16838
16839/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgb alpha
16840/// inp: `&VipsImage` -> Image to save
16841/// webpsave_mime_options: `&WebpsaveMimeOptions` -> optional arguments
16842
16843pub fn webpsave_mime_with_opts(
16844    inp: &VipsImage,
16845    webpsave_mime_options: &WebpsaveMimeOptions,
16846) -> Result<()> {
16847    unsafe {
16848        let inp_in: *mut bindings::VipsImage = inp.ctx;
16849
16850        let q_in: i32 = webpsave_mime_options.q;
16851        let q_in_name = utils::new_c_string("Q")?;
16852
16853        let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16854        let lossless_in_name = utils::new_c_string("lossless")?;
16855
16856        let preset_in: i32 = webpsave_mime_options.preset as i32;
16857        let preset_in_name = utils::new_c_string("preset")?;
16858
16859        let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16860            1
16861        } else {
16862            0
16863        };
16864        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16865
16866        let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16867            1
16868        } else {
16869            0
16870        };
16871        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16872
16873        let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16874        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16875
16876        let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16877        let min_size_in_name = utils::new_c_string("min-size")?;
16878
16879        let kmin_in: i32 = webpsave_mime_options.kmin;
16880        let kmin_in_name = utils::new_c_string("kmin")?;
16881
16882        let kmax_in: i32 = webpsave_mime_options.kmax;
16883        let kmax_in_name = utils::new_c_string("kmax")?;
16884
16885        let effort_in: i32 = webpsave_mime_options.effort;
16886        let effort_in_name = utils::new_c_string("effort")?;
16887
16888        let target_size_in: i32 = webpsave_mime_options.target_size;
16889        let target_size_in_name = utils::new_c_string("target-size")?;
16890
16891        let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16892        let mixed_in_name = utils::new_c_string("mixed")?;
16893
16894        let smart_deblock_in: i32 = if webpsave_mime_options.smart_deblock {
16895            1
16896        } else {
16897            0
16898        };
16899        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16900
16901        let passes_in: i32 = webpsave_mime_options.passes;
16902        let passes_in_name = utils::new_c_string("passes")?;
16903
16904        let keep_in: i32 = webpsave_mime_options.keep as i32;
16905        let keep_in_name = utils::new_c_string("keep")?;
16906
16907        let background_wrapper =
16908            utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16909        let background_in = background_wrapper.ctx;
16910        let background_in_name = utils::new_c_string("background")?;
16911
16912        let page_height_in: i32 = webpsave_mime_options.page_height;
16913        let page_height_in_name = utils::new_c_string("page-height")?;
16914
16915        let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16916        let profile_in_name = utils::new_c_string("profile")?;
16917
16918        let vips_op_response = bindings::vips_webpsave_mime(
16919            inp_in,
16920            q_in_name.as_ptr(),
16921            q_in,
16922            lossless_in_name.as_ptr(),
16923            lossless_in,
16924            preset_in_name.as_ptr(),
16925            preset_in,
16926            smart_subsample_in_name.as_ptr(),
16927            smart_subsample_in,
16928            near_lossless_in_name.as_ptr(),
16929            near_lossless_in,
16930            alpha_q_in_name.as_ptr(),
16931            alpha_q_in,
16932            min_size_in_name.as_ptr(),
16933            min_size_in,
16934            kmin_in_name.as_ptr(),
16935            kmin_in,
16936            kmax_in_name.as_ptr(),
16937            kmax_in,
16938            effort_in_name.as_ptr(),
16939            effort_in,
16940            target_size_in_name.as_ptr(),
16941            target_size_in,
16942            mixed_in_name.as_ptr(),
16943            mixed_in,
16944            smart_deblock_in_name.as_ptr(),
16945            smart_deblock_in,
16946            passes_in_name.as_ptr(),
16947            passes_in,
16948            keep_in_name.as_ptr(),
16949            keep_in,
16950            background_in_name.as_ptr(),
16951            background_in,
16952            page_height_in_name.as_ptr(),
16953            page_height_in,
16954            profile_in_name.as_ptr(),
16955            profile_in.as_ptr(),
16956            NULL,
16957        );
16958        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16959    }
16960}
16961
16962/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0,
16963/// inp: `&VipsImage` -> Image to save
16964/// filename: `&str` -> Filename to save to
16965
16966pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16967    unsafe {
16968        let inp_in: *mut bindings::VipsImage = inp.ctx;
16969        let filename_in: CString = utils::new_c_string(filename)?;
16970
16971        let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16972        utils::result(vips_op_response, (), Error::TiffsaveError)
16973    }
16974}
16975
16976/// Options for tiffsave operation
16977#[derive(Clone, Debug)]
16978pub struct TiffsaveOptions {
16979    /// compression: `ForeignTiffCompression` -> Compression for this file
16980    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16981    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16982    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16983    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16984    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16985    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16986    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16987    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16988    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16989    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
16990    pub compression: ForeignTiffCompression,
16991    /// q: `i32` -> Q factor
16992    /// min: 1, max: 100, default: 75
16993    pub q: i32,
16994    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16995    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16996    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16997    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16998    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
16999    pub predictor: ForeignTiffPredictor,
17000    /// tile: `bool` -> Write a tiled tiff
17001    /// default: false
17002    pub tile: bool,
17003    /// tile_width: `i32` -> Tile width in pixels
17004    /// min: 1, max: 32768, default: 128
17005    pub tile_width: i32,
17006    /// tile_height: `i32` -> Tile height in pixels
17007    /// min: 1, max: 32768, default: 128
17008    pub tile_height: i32,
17009    /// pyramid: `bool` -> Write a pyramidal tiff
17010    /// default: false
17011    pub pyramid: bool,
17012    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17013    /// default: false
17014    pub miniswhite: bool,
17015    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17016    /// min: 0, max: 8, default: 0
17017    pub bitdepth: i32,
17018    /// resunit: `ForeignTiffResunit` -> Resolution unit
17019    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17020    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17021    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17022    pub resunit: ForeignTiffResunit,
17023    /// xres: `f64` -> Horizontal resolution in pixels/mm
17024    /// min: 0.001, max: 1000000, default: 1
17025    pub xres: f64,
17026    /// yres: `f64` -> Vertical resolution in pixels/mm
17027    /// min: 0.001, max: 1000000, default: 1
17028    pub yres: f64,
17029    /// bigtiff: `bool` -> Write a bigtiff image
17030    /// default: false
17031    pub bigtiff: bool,
17032    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17033    /// default: false
17034    pub properties: bool,
17035    /// region_shrink: `RegionShrink` -> Method to shrink regions
17036    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17037    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17038    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17039    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17040    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17041    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17042    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17043    pub region_shrink: RegionShrink,
17044    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17045    /// min: 0, max: 22, default: 0
17046    pub level: i32,
17047    /// lossless: `bool` -> Enable WEBP lossless mode
17048    /// default: false
17049    pub lossless: bool,
17050    /// depth: `ForeignDzDepth` -> Pyramid depth
17051    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17052    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17053    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17054    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17055    pub depth: ForeignDzDepth,
17056    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17057    /// default: false
17058    pub subifd: bool,
17059    /// premultiply: `bool` -> Save with premultiplied alpha
17060    /// default: false
17061    pub premultiply: bool,
17062    /// keep: `ForeignKeep` -> Which metadata to retain
17063    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17064    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17065    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17066    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17067    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17068    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17069    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17070    pub keep: ForeignKeep,
17071    /// background: `Vec<f64>` -> Background value
17072    pub background: Vec<f64>,
17073    /// page_height: `i32` -> Set page height for multipage save
17074    /// min: 0, max: 100000000, default: 0
17075    pub page_height: i32,
17076    /// profile: `String` -> Filename of ICC profile to embed
17077    pub profile: String,
17078}
17079
17080impl std::default::Default for TiffsaveOptions {
17081    fn default() -> Self {
17082        TiffsaveOptions {
17083            compression: ForeignTiffCompression::None,
17084            q: i32::from(75),
17085            predictor: ForeignTiffPredictor::Horizontal,
17086            tile: false,
17087            tile_width: i32::from(128),
17088            tile_height: i32::from(128),
17089            pyramid: false,
17090            miniswhite: false,
17091            bitdepth: i32::from(0),
17092            resunit: ForeignTiffResunit::Cm,
17093            xres: f64::from(1),
17094            yres: f64::from(1),
17095            bigtiff: false,
17096            properties: false,
17097            region_shrink: RegionShrink::Mean,
17098            level: i32::from(0),
17099            lossless: false,
17100            depth: ForeignDzDepth::Onetile,
17101            subifd: false,
17102            premultiply: false,
17103            keep: ForeignKeep::All,
17104            background: Vec::new(),
17105            page_height: i32::from(0),
17106            profile: String::from("sRGB"),
17107        }
17108    }
17109}
17110
17111/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0,
17112/// inp: `&VipsImage` -> Image to save
17113/// filename: `&str` -> Filename to save to
17114/// tiffsave_options: `&TiffsaveOptions` -> optional arguments
17115
17116pub fn tiffsave_with_opts(
17117    inp: &VipsImage,
17118    filename: &str,
17119    tiffsave_options: &TiffsaveOptions,
17120) -> Result<()> {
17121    unsafe {
17122        let inp_in: *mut bindings::VipsImage = inp.ctx;
17123        let filename_in: CString = utils::new_c_string(filename)?;
17124
17125        let compression_in: i32 = tiffsave_options.compression as i32;
17126        let compression_in_name = utils::new_c_string("compression")?;
17127
17128        let q_in: i32 = tiffsave_options.q;
17129        let q_in_name = utils::new_c_string("Q")?;
17130
17131        let predictor_in: i32 = tiffsave_options.predictor as i32;
17132        let predictor_in_name = utils::new_c_string("predictor")?;
17133
17134        let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
17135        let tile_in_name = utils::new_c_string("tile")?;
17136
17137        let tile_width_in: i32 = tiffsave_options.tile_width;
17138        let tile_width_in_name = utils::new_c_string("tile-width")?;
17139
17140        let tile_height_in: i32 = tiffsave_options.tile_height;
17141        let tile_height_in_name = utils::new_c_string("tile-height")?;
17142
17143        let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
17144        let pyramid_in_name = utils::new_c_string("pyramid")?;
17145
17146        let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
17147        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17148
17149        let bitdepth_in: i32 = tiffsave_options.bitdepth;
17150        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17151
17152        let resunit_in: i32 = tiffsave_options.resunit as i32;
17153        let resunit_in_name = utils::new_c_string("resunit")?;
17154
17155        let xres_in: f64 = tiffsave_options.xres;
17156        let xres_in_name = utils::new_c_string("xres")?;
17157
17158        let yres_in: f64 = tiffsave_options.yres;
17159        let yres_in_name = utils::new_c_string("yres")?;
17160
17161        let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
17162        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17163
17164        let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
17165        let properties_in_name = utils::new_c_string("properties")?;
17166
17167        let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
17168        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17169
17170        let level_in: i32 = tiffsave_options.level;
17171        let level_in_name = utils::new_c_string("level")?;
17172
17173        let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
17174        let lossless_in_name = utils::new_c_string("lossless")?;
17175
17176        let depth_in: i32 = tiffsave_options.depth as i32;
17177        let depth_in_name = utils::new_c_string("depth")?;
17178
17179        let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
17180        let subifd_in_name = utils::new_c_string("subifd")?;
17181
17182        let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
17183        let premultiply_in_name = utils::new_c_string("premultiply")?;
17184
17185        let keep_in: i32 = tiffsave_options.keep as i32;
17186        let keep_in_name = utils::new_c_string("keep")?;
17187
17188        let background_wrapper =
17189            utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
17190        let background_in = background_wrapper.ctx;
17191        let background_in_name = utils::new_c_string("background")?;
17192
17193        let page_height_in: i32 = tiffsave_options.page_height;
17194        let page_height_in_name = utils::new_c_string("page-height")?;
17195
17196        let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
17197        let profile_in_name = utils::new_c_string("profile")?;
17198
17199        let vips_op_response = bindings::vips_tiffsave(
17200            inp_in,
17201            filename_in.as_ptr(),
17202            compression_in_name.as_ptr(),
17203            compression_in,
17204            q_in_name.as_ptr(),
17205            q_in,
17206            predictor_in_name.as_ptr(),
17207            predictor_in,
17208            tile_in_name.as_ptr(),
17209            tile_in,
17210            tile_width_in_name.as_ptr(),
17211            tile_width_in,
17212            tile_height_in_name.as_ptr(),
17213            tile_height_in,
17214            pyramid_in_name.as_ptr(),
17215            pyramid_in,
17216            miniswhite_in_name.as_ptr(),
17217            miniswhite_in,
17218            bitdepth_in_name.as_ptr(),
17219            bitdepth_in,
17220            resunit_in_name.as_ptr(),
17221            resunit_in,
17222            xres_in_name.as_ptr(),
17223            xres_in,
17224            yres_in_name.as_ptr(),
17225            yres_in,
17226            bigtiff_in_name.as_ptr(),
17227            bigtiff_in,
17228            properties_in_name.as_ptr(),
17229            properties_in,
17230            region_shrink_in_name.as_ptr(),
17231            region_shrink_in,
17232            level_in_name.as_ptr(),
17233            level_in,
17234            lossless_in_name.as_ptr(),
17235            lossless_in,
17236            depth_in_name.as_ptr(),
17237            depth_in,
17238            subifd_in_name.as_ptr(),
17239            subifd_in,
17240            premultiply_in_name.as_ptr(),
17241            premultiply_in,
17242            keep_in_name.as_ptr(),
17243            keep_in,
17244            background_in_name.as_ptr(),
17245            background_in,
17246            page_height_in_name.as_ptr(),
17247            page_height_in,
17248            profile_in_name.as_ptr(),
17249            profile_in.as_ptr(),
17250            NULL,
17251        );
17252        utils::result(vips_op_response, (), Error::TiffsaveError)
17253    }
17254}
17255
17256/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0,
17257/// inp: `&VipsImage` -> Image to save
17258/// returns `Vec<u8>` - Buffer to save to
17259pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17260    unsafe {
17261        let inp_in: *mut bindings::VipsImage = inp.ctx;
17262        let mut buffer_buf_size: u64 = 0;
17263        let mut buffer_out: *mut c_void = null_mut();
17264
17265        let vips_op_response =
17266            bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17267        utils::result(
17268            vips_op_response,
17269            utils::new_byte_array(buffer_out, buffer_buf_size),
17270            Error::TiffsaveBufferError,
17271        )
17272    }
17273}
17274
17275/// Options for tiffsave_buffer operation
17276#[derive(Clone, Debug)]
17277pub struct TiffsaveBufferOptions {
17278    /// compression: `ForeignTiffCompression` -> Compression for this file
17279    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17280    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17281    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17282    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17283    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17284    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17285    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17286    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17287    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17288    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
17289    pub compression: ForeignTiffCompression,
17290    /// q: `i32` -> Q factor
17291    /// min: 1, max: 100, default: 75
17292    pub q: i32,
17293    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17294    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17295    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17296    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17297    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
17298    pub predictor: ForeignTiffPredictor,
17299    /// tile: `bool` -> Write a tiled tiff
17300    /// default: false
17301    pub tile: bool,
17302    /// tile_width: `i32` -> Tile width in pixels
17303    /// min: 1, max: 32768, default: 128
17304    pub tile_width: i32,
17305    /// tile_height: `i32` -> Tile height in pixels
17306    /// min: 1, max: 32768, default: 128
17307    pub tile_height: i32,
17308    /// pyramid: `bool` -> Write a pyramidal tiff
17309    /// default: false
17310    pub pyramid: bool,
17311    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17312    /// default: false
17313    pub miniswhite: bool,
17314    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17315    /// min: 0, max: 8, default: 0
17316    pub bitdepth: i32,
17317    /// resunit: `ForeignTiffResunit` -> Resolution unit
17318    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17319    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17320    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17321    pub resunit: ForeignTiffResunit,
17322    /// xres: `f64` -> Horizontal resolution in pixels/mm
17323    /// min: 0.001, max: 1000000, default: 1
17324    pub xres: f64,
17325    /// yres: `f64` -> Vertical resolution in pixels/mm
17326    /// min: 0.001, max: 1000000, default: 1
17327    pub yres: f64,
17328    /// bigtiff: `bool` -> Write a bigtiff image
17329    /// default: false
17330    pub bigtiff: bool,
17331    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17332    /// default: false
17333    pub properties: bool,
17334    /// region_shrink: `RegionShrink` -> Method to shrink regions
17335    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17336    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17337    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17338    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17339    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17340    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17341    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17342    pub region_shrink: RegionShrink,
17343    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17344    /// min: 0, max: 22, default: 0
17345    pub level: i32,
17346    /// lossless: `bool` -> Enable WEBP lossless mode
17347    /// default: false
17348    pub lossless: bool,
17349    /// depth: `ForeignDzDepth` -> Pyramid depth
17350    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17351    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17352    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17353    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17354    pub depth: ForeignDzDepth,
17355    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17356    /// default: false
17357    pub subifd: bool,
17358    /// premultiply: `bool` -> Save with premultiplied alpha
17359    /// default: false
17360    pub premultiply: bool,
17361    /// keep: `ForeignKeep` -> Which metadata to retain
17362    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17363    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17364    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17365    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17366    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17367    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17368    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17369    pub keep: ForeignKeep,
17370    /// background: `Vec<f64>` -> Background value
17371    pub background: Vec<f64>,
17372    /// page_height: `i32` -> Set page height for multipage save
17373    /// min: 0, max: 100000000, default: 0
17374    pub page_height: i32,
17375    /// profile: `String` -> Filename of ICC profile to embed
17376    pub profile: String,
17377}
17378
17379impl std::default::Default for TiffsaveBufferOptions {
17380    fn default() -> Self {
17381        TiffsaveBufferOptions {
17382            compression: ForeignTiffCompression::None,
17383            q: i32::from(75),
17384            predictor: ForeignTiffPredictor::Horizontal,
17385            tile: false,
17386            tile_width: i32::from(128),
17387            tile_height: i32::from(128),
17388            pyramid: false,
17389            miniswhite: false,
17390            bitdepth: i32::from(0),
17391            resunit: ForeignTiffResunit::Cm,
17392            xres: f64::from(1),
17393            yres: f64::from(1),
17394            bigtiff: false,
17395            properties: false,
17396            region_shrink: RegionShrink::Mean,
17397            level: i32::from(0),
17398            lossless: false,
17399            depth: ForeignDzDepth::Onetile,
17400            subifd: false,
17401            premultiply: false,
17402            keep: ForeignKeep::All,
17403            background: Vec::new(),
17404            page_height: i32::from(0),
17405            profile: String::from("sRGB"),
17406        }
17407    }
17408}
17409
17410/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0,
17411/// inp: `&VipsImage` -> Image to save
17412/// tiffsave_buffer_options: `&TiffsaveBufferOptions` -> optional arguments
17413/// returns `Vec<u8>` - Buffer to save to
17414pub fn tiffsave_buffer_with_opts(
17415    inp: &VipsImage,
17416    tiffsave_buffer_options: &TiffsaveBufferOptions,
17417) -> Result<Vec<u8>> {
17418    unsafe {
17419        let inp_in: *mut bindings::VipsImage = inp.ctx;
17420        let mut buffer_buf_size: u64 = 0;
17421        let mut buffer_out: *mut c_void = null_mut();
17422
17423        let compression_in: i32 = tiffsave_buffer_options.compression as i32;
17424        let compression_in_name = utils::new_c_string("compression")?;
17425
17426        let q_in: i32 = tiffsave_buffer_options.q;
17427        let q_in_name = utils::new_c_string("Q")?;
17428
17429        let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
17430        let predictor_in_name = utils::new_c_string("predictor")?;
17431
17432        let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
17433        let tile_in_name = utils::new_c_string("tile")?;
17434
17435        let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
17436        let tile_width_in_name = utils::new_c_string("tile-width")?;
17437
17438        let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
17439        let tile_height_in_name = utils::new_c_string("tile-height")?;
17440
17441        let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
17442            1
17443        } else {
17444            0
17445        };
17446        let pyramid_in_name = utils::new_c_string("pyramid")?;
17447
17448        let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
17449            1
17450        } else {
17451            0
17452        };
17453        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17454
17455        let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
17456        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17457
17458        let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
17459        let resunit_in_name = utils::new_c_string("resunit")?;
17460
17461        let xres_in: f64 = tiffsave_buffer_options.xres;
17462        let xres_in_name = utils::new_c_string("xres")?;
17463
17464        let yres_in: f64 = tiffsave_buffer_options.yres;
17465        let yres_in_name = utils::new_c_string("yres")?;
17466
17467        let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
17468            1
17469        } else {
17470            0
17471        };
17472        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17473
17474        let properties_in: i32 = if tiffsave_buffer_options.properties {
17475            1
17476        } else {
17477            0
17478        };
17479        let properties_in_name = utils::new_c_string("properties")?;
17480
17481        let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
17482        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17483
17484        let level_in: i32 = tiffsave_buffer_options.level;
17485        let level_in_name = utils::new_c_string("level")?;
17486
17487        let lossless_in: i32 = if tiffsave_buffer_options.lossless {
17488            1
17489        } else {
17490            0
17491        };
17492        let lossless_in_name = utils::new_c_string("lossless")?;
17493
17494        let depth_in: i32 = tiffsave_buffer_options.depth as i32;
17495        let depth_in_name = utils::new_c_string("depth")?;
17496
17497        let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
17498        let subifd_in_name = utils::new_c_string("subifd")?;
17499
17500        let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
17501            1
17502        } else {
17503            0
17504        };
17505        let premultiply_in_name = utils::new_c_string("premultiply")?;
17506
17507        let keep_in: i32 = tiffsave_buffer_options.keep as i32;
17508        let keep_in_name = utils::new_c_string("keep")?;
17509
17510        let background_wrapper =
17511            utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
17512        let background_in = background_wrapper.ctx;
17513        let background_in_name = utils::new_c_string("background")?;
17514
17515        let page_height_in: i32 = tiffsave_buffer_options.page_height;
17516        let page_height_in_name = utils::new_c_string("page-height")?;
17517
17518        let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
17519        let profile_in_name = utils::new_c_string("profile")?;
17520
17521        let vips_op_response = bindings::vips_tiffsave_buffer(
17522            inp_in,
17523            &mut buffer_out,
17524            &mut buffer_buf_size,
17525            compression_in_name.as_ptr(),
17526            compression_in,
17527            q_in_name.as_ptr(),
17528            q_in,
17529            predictor_in_name.as_ptr(),
17530            predictor_in,
17531            tile_in_name.as_ptr(),
17532            tile_in,
17533            tile_width_in_name.as_ptr(),
17534            tile_width_in,
17535            tile_height_in_name.as_ptr(),
17536            tile_height_in,
17537            pyramid_in_name.as_ptr(),
17538            pyramid_in,
17539            miniswhite_in_name.as_ptr(),
17540            miniswhite_in,
17541            bitdepth_in_name.as_ptr(),
17542            bitdepth_in,
17543            resunit_in_name.as_ptr(),
17544            resunit_in,
17545            xres_in_name.as_ptr(),
17546            xres_in,
17547            yres_in_name.as_ptr(),
17548            yres_in,
17549            bigtiff_in_name.as_ptr(),
17550            bigtiff_in,
17551            properties_in_name.as_ptr(),
17552            properties_in,
17553            region_shrink_in_name.as_ptr(),
17554            region_shrink_in,
17555            level_in_name.as_ptr(),
17556            level_in,
17557            lossless_in_name.as_ptr(),
17558            lossless_in,
17559            depth_in_name.as_ptr(),
17560            depth_in,
17561            subifd_in_name.as_ptr(),
17562            subifd_in,
17563            premultiply_in_name.as_ptr(),
17564            premultiply_in,
17565            keep_in_name.as_ptr(),
17566            keep_in,
17567            background_in_name.as_ptr(),
17568            background_in,
17569            page_height_in_name.as_ptr(),
17570            page_height_in,
17571            profile_in_name.as_ptr(),
17572            profile_in.as_ptr(),
17573            NULL,
17574        );
17575        utils::result(
17576            vips_op_response,
17577            utils::new_byte_array(buffer_out, buffer_buf_size),
17578            Error::TiffsaveBufferError,
17579        )
17580    }
17581}
17582
17583/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0,
17584/// inp: `&VipsImage` -> Image to save
17585/// target: `&VipsTarget` -> Target to save to
17586
17587pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17588    unsafe {
17589        let inp_in: *mut bindings::VipsImage = inp.ctx;
17590        let target_in: *mut bindings::VipsTarget = target.ctx;
17591
17592        let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
17593        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17594    }
17595}
17596
17597/// Options for tiffsave_target operation
17598#[derive(Clone, Debug)]
17599pub struct TiffsaveTargetOptions {
17600    /// compression: `ForeignTiffCompression` -> Compression for this file
17601    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17602    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17603    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17604    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17605    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17606    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17607    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17608    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17609    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17610    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
17611    pub compression: ForeignTiffCompression,
17612    /// q: `i32` -> Q factor
17613    /// min: 1, max: 100, default: 75
17614    pub q: i32,
17615    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17616    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17617    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17618    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17619    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
17620    pub predictor: ForeignTiffPredictor,
17621    /// tile: `bool` -> Write a tiled tiff
17622    /// default: false
17623    pub tile: bool,
17624    /// tile_width: `i32` -> Tile width in pixels
17625    /// min: 1, max: 32768, default: 128
17626    pub tile_width: i32,
17627    /// tile_height: `i32` -> Tile height in pixels
17628    /// min: 1, max: 32768, default: 128
17629    pub tile_height: i32,
17630    /// pyramid: `bool` -> Write a pyramidal tiff
17631    /// default: false
17632    pub pyramid: bool,
17633    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17634    /// default: false
17635    pub miniswhite: bool,
17636    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17637    /// min: 0, max: 8, default: 0
17638    pub bitdepth: i32,
17639    /// resunit: `ForeignTiffResunit` -> Resolution unit
17640    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17641    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17642    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17643    pub resunit: ForeignTiffResunit,
17644    /// xres: `f64` -> Horizontal resolution in pixels/mm
17645    /// min: 0.001, max: 1000000, default: 1
17646    pub xres: f64,
17647    /// yres: `f64` -> Vertical resolution in pixels/mm
17648    /// min: 0.001, max: 1000000, default: 1
17649    pub yres: f64,
17650    /// bigtiff: `bool` -> Write a bigtiff image
17651    /// default: false
17652    pub bigtiff: bool,
17653    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17654    /// default: false
17655    pub properties: bool,
17656    /// region_shrink: `RegionShrink` -> Method to shrink regions
17657    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17658    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17659    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17660    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17661    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17662    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17663    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17664    pub region_shrink: RegionShrink,
17665    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17666    /// min: 0, max: 22, default: 0
17667    pub level: i32,
17668    /// lossless: `bool` -> Enable WEBP lossless mode
17669    /// default: false
17670    pub lossless: bool,
17671    /// depth: `ForeignDzDepth` -> Pyramid depth
17672    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17673    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17674    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17675    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17676    pub depth: ForeignDzDepth,
17677    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17678    /// default: false
17679    pub subifd: bool,
17680    /// premultiply: `bool` -> Save with premultiplied alpha
17681    /// default: false
17682    pub premultiply: bool,
17683    /// keep: `ForeignKeep` -> Which metadata to retain
17684    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17685    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17686    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17687    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17688    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17689    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17690    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17691    pub keep: ForeignKeep,
17692    /// background: `Vec<f64>` -> Background value
17693    pub background: Vec<f64>,
17694    /// page_height: `i32` -> Set page height for multipage save
17695    /// min: 0, max: 100000000, default: 0
17696    pub page_height: i32,
17697    /// profile: `String` -> Filename of ICC profile to embed
17698    pub profile: String,
17699}
17700
17701impl std::default::Default for TiffsaveTargetOptions {
17702    fn default() -> Self {
17703        TiffsaveTargetOptions {
17704            compression: ForeignTiffCompression::None,
17705            q: i32::from(75),
17706            predictor: ForeignTiffPredictor::Horizontal,
17707            tile: false,
17708            tile_width: i32::from(128),
17709            tile_height: i32::from(128),
17710            pyramid: false,
17711            miniswhite: false,
17712            bitdepth: i32::from(0),
17713            resunit: ForeignTiffResunit::Cm,
17714            xres: f64::from(1),
17715            yres: f64::from(1),
17716            bigtiff: false,
17717            properties: false,
17718            region_shrink: RegionShrink::Mean,
17719            level: i32::from(0),
17720            lossless: false,
17721            depth: ForeignDzDepth::Onetile,
17722            subifd: false,
17723            premultiply: false,
17724            keep: ForeignKeep::All,
17725            background: Vec::new(),
17726            page_height: i32::from(0),
17727            profile: String::from("sRGB"),
17728        }
17729    }
17730}
17731
17732/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0,
17733/// inp: `&VipsImage` -> Image to save
17734/// target: `&VipsTarget` -> Target to save to
17735/// tiffsave_target_options: `&TiffsaveTargetOptions` -> optional arguments
17736
17737pub fn tiffsave_target_with_opts(
17738    inp: &VipsImage,
17739    target: &VipsTarget,
17740    tiffsave_target_options: &TiffsaveTargetOptions,
17741) -> Result<()> {
17742    unsafe {
17743        let inp_in: *mut bindings::VipsImage = inp.ctx;
17744        let target_in: *mut bindings::VipsTarget = target.ctx;
17745
17746        let compression_in: i32 = tiffsave_target_options.compression as i32;
17747        let compression_in_name = utils::new_c_string("compression")?;
17748
17749        let q_in: i32 = tiffsave_target_options.q;
17750        let q_in_name = utils::new_c_string("Q")?;
17751
17752        let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17753        let predictor_in_name = utils::new_c_string("predictor")?;
17754
17755        let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17756        let tile_in_name = utils::new_c_string("tile")?;
17757
17758        let tile_width_in: i32 = tiffsave_target_options.tile_width;
17759        let tile_width_in_name = utils::new_c_string("tile-width")?;
17760
17761        let tile_height_in: i32 = tiffsave_target_options.tile_height;
17762        let tile_height_in_name = utils::new_c_string("tile-height")?;
17763
17764        let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17765            1
17766        } else {
17767            0
17768        };
17769        let pyramid_in_name = utils::new_c_string("pyramid")?;
17770
17771        let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17772            1
17773        } else {
17774            0
17775        };
17776        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17777
17778        let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17779        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17780
17781        let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17782        let resunit_in_name = utils::new_c_string("resunit")?;
17783
17784        let xres_in: f64 = tiffsave_target_options.xres;
17785        let xres_in_name = utils::new_c_string("xres")?;
17786
17787        let yres_in: f64 = tiffsave_target_options.yres;
17788        let yres_in_name = utils::new_c_string("yres")?;
17789
17790        let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17791            1
17792        } else {
17793            0
17794        };
17795        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17796
17797        let properties_in: i32 = if tiffsave_target_options.properties {
17798            1
17799        } else {
17800            0
17801        };
17802        let properties_in_name = utils::new_c_string("properties")?;
17803
17804        let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17805        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17806
17807        let level_in: i32 = tiffsave_target_options.level;
17808        let level_in_name = utils::new_c_string("level")?;
17809
17810        let lossless_in: i32 = if tiffsave_target_options.lossless {
17811            1
17812        } else {
17813            0
17814        };
17815        let lossless_in_name = utils::new_c_string("lossless")?;
17816
17817        let depth_in: i32 = tiffsave_target_options.depth as i32;
17818        let depth_in_name = utils::new_c_string("depth")?;
17819
17820        let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17821        let subifd_in_name = utils::new_c_string("subifd")?;
17822
17823        let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17824            1
17825        } else {
17826            0
17827        };
17828        let premultiply_in_name = utils::new_c_string("premultiply")?;
17829
17830        let keep_in: i32 = tiffsave_target_options.keep as i32;
17831        let keep_in_name = utils::new_c_string("keep")?;
17832
17833        let background_wrapper =
17834            utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17835        let background_in = background_wrapper.ctx;
17836        let background_in_name = utils::new_c_string("background")?;
17837
17838        let page_height_in: i32 = tiffsave_target_options.page_height;
17839        let page_height_in_name = utils::new_c_string("page-height")?;
17840
17841        let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17842        let profile_in_name = utils::new_c_string("profile")?;
17843
17844        let vips_op_response = bindings::vips_tiffsave_target(
17845            inp_in,
17846            target_in,
17847            compression_in_name.as_ptr(),
17848            compression_in,
17849            q_in_name.as_ptr(),
17850            q_in,
17851            predictor_in_name.as_ptr(),
17852            predictor_in,
17853            tile_in_name.as_ptr(),
17854            tile_in,
17855            tile_width_in_name.as_ptr(),
17856            tile_width_in,
17857            tile_height_in_name.as_ptr(),
17858            tile_height_in,
17859            pyramid_in_name.as_ptr(),
17860            pyramid_in,
17861            miniswhite_in_name.as_ptr(),
17862            miniswhite_in,
17863            bitdepth_in_name.as_ptr(),
17864            bitdepth_in,
17865            resunit_in_name.as_ptr(),
17866            resunit_in,
17867            xres_in_name.as_ptr(),
17868            xres_in,
17869            yres_in_name.as_ptr(),
17870            yres_in,
17871            bigtiff_in_name.as_ptr(),
17872            bigtiff_in,
17873            properties_in_name.as_ptr(),
17874            properties_in,
17875            region_shrink_in_name.as_ptr(),
17876            region_shrink_in,
17877            level_in_name.as_ptr(),
17878            level_in,
17879            lossless_in_name.as_ptr(),
17880            lossless_in,
17881            depth_in_name.as_ptr(),
17882            depth_in,
17883            subifd_in_name.as_ptr(),
17884            subifd_in,
17885            premultiply_in_name.as_ptr(),
17886            premultiply_in,
17887            keep_in_name.as_ptr(),
17888            keep_in,
17889            background_in_name.as_ptr(),
17890            background_in,
17891            page_height_in_name.as_ptr(),
17892            page_height_in,
17893            profile_in_name.as_ptr(),
17894            profile_in.as_ptr(),
17895            NULL,
17896        );
17897        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17898    }
17899}
17900
17901/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgb alpha
17902/// inp: `&VipsImage` -> Image to save
17903/// filename: `&str` -> Filename to save to
17904
17905pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17906    unsafe {
17907        let inp_in: *mut bindings::VipsImage = inp.ctx;
17908        let filename_in: CString = utils::new_c_string(filename)?;
17909
17910        let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17911        utils::result(vips_op_response, (), Error::HeifsaveError)
17912    }
17913}
17914
17915/// Options for heifsave operation
17916#[derive(Clone, Debug)]
17917pub struct HeifsaveOptions {
17918    /// q: `i32` -> Q factor
17919    /// min: 1, max: 100, default: 50
17920    pub q: i32,
17921    /// bitdepth: `i32` -> Number of bits per pixel
17922    /// min: 8, max: 12, default: 12
17923    pub bitdepth: i32,
17924    /// lossless: `bool` -> Enable lossless compression
17925    /// default: false
17926    pub lossless: bool,
17927    /// compression: `ForeignHeifCompression` -> Compression format
17928    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17929    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17930    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17931    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17932    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17933    pub compression: ForeignHeifCompression,
17934    /// effort: `i32` -> CPU effort
17935    /// min: 0, max: 9, default: 4
17936    pub effort: i32,
17937    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17938    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17939    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17940    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17941    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17942    pub subsample_mode: ForeignSubsample,
17943    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17944    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17945    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17946    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17947    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17948    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17949    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17950    pub encoder: ForeignHeifEncoder,
17951    /// keep: `ForeignKeep` -> Which metadata to retain
17952    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17953    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17954    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17955    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17956    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17957    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17958    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17959    pub keep: ForeignKeep,
17960    /// background: `Vec<f64>` -> Background value
17961    pub background: Vec<f64>,
17962    /// page_height: `i32` -> Set page height for multipage save
17963    /// min: 0, max: 100000000, default: 0
17964    pub page_height: i32,
17965    /// profile: `String` -> Filename of ICC profile to embed
17966    pub profile: String,
17967}
17968
17969impl std::default::Default for HeifsaveOptions {
17970    fn default() -> Self {
17971        HeifsaveOptions {
17972            q: i32::from(50),
17973            bitdepth: i32::from(12),
17974            lossless: false,
17975            compression: ForeignHeifCompression::Hevc,
17976            effort: i32::from(4),
17977            subsample_mode: ForeignSubsample::Auto,
17978            encoder: ForeignHeifEncoder::Auto,
17979            keep: ForeignKeep::All,
17980            background: Vec::new(),
17981            page_height: i32::from(0),
17982            profile: String::from("sRGB"),
17983        }
17984    }
17985}
17986
17987/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgb alpha
17988/// inp: `&VipsImage` -> Image to save
17989/// filename: `&str` -> Filename to save to
17990/// heifsave_options: `&HeifsaveOptions` -> optional arguments
17991
17992pub fn heifsave_with_opts(
17993    inp: &VipsImage,
17994    filename: &str,
17995    heifsave_options: &HeifsaveOptions,
17996) -> Result<()> {
17997    unsafe {
17998        let inp_in: *mut bindings::VipsImage = inp.ctx;
17999        let filename_in: CString = utils::new_c_string(filename)?;
18000
18001        let q_in: i32 = heifsave_options.q;
18002        let q_in_name = utils::new_c_string("Q")?;
18003
18004        let bitdepth_in: i32 = heifsave_options.bitdepth;
18005        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18006
18007        let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
18008        let lossless_in_name = utils::new_c_string("lossless")?;
18009
18010        let compression_in: i32 = heifsave_options.compression as i32;
18011        let compression_in_name = utils::new_c_string("compression")?;
18012
18013        let effort_in: i32 = heifsave_options.effort;
18014        let effort_in_name = utils::new_c_string("effort")?;
18015
18016        let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
18017        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18018
18019        let encoder_in: i32 = heifsave_options.encoder as i32;
18020        let encoder_in_name = utils::new_c_string("encoder")?;
18021
18022        let keep_in: i32 = heifsave_options.keep as i32;
18023        let keep_in_name = utils::new_c_string("keep")?;
18024
18025        let background_wrapper =
18026            utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
18027        let background_in = background_wrapper.ctx;
18028        let background_in_name = utils::new_c_string("background")?;
18029
18030        let page_height_in: i32 = heifsave_options.page_height;
18031        let page_height_in_name = utils::new_c_string("page-height")?;
18032
18033        let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
18034        let profile_in_name = utils::new_c_string("profile")?;
18035
18036        let vips_op_response = bindings::vips_heifsave(
18037            inp_in,
18038            filename_in.as_ptr(),
18039            q_in_name.as_ptr(),
18040            q_in,
18041            bitdepth_in_name.as_ptr(),
18042            bitdepth_in,
18043            lossless_in_name.as_ptr(),
18044            lossless_in,
18045            compression_in_name.as_ptr(),
18046            compression_in,
18047            effort_in_name.as_ptr(),
18048            effort_in,
18049            subsample_mode_in_name.as_ptr(),
18050            subsample_mode_in,
18051            encoder_in_name.as_ptr(),
18052            encoder_in,
18053            keep_in_name.as_ptr(),
18054            keep_in,
18055            background_in_name.as_ptr(),
18056            background_in,
18057            page_height_in_name.as_ptr(),
18058            page_height_in,
18059            profile_in_name.as_ptr(),
18060            profile_in.as_ptr(),
18061            NULL,
18062        );
18063        utils::result(vips_op_response, (), Error::HeifsaveError)
18064    }
18065}
18066
18067/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgb alpha
18068/// inp: `&VipsImage` -> Image to save
18069/// returns `Vec<u8>` - Buffer to save to
18070pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
18071    unsafe {
18072        let inp_in: *mut bindings::VipsImage = inp.ctx;
18073        let mut buffer_buf_size: u64 = 0;
18074        let mut buffer_out: *mut c_void = null_mut();
18075
18076        let vips_op_response =
18077            bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18078        utils::result(
18079            vips_op_response,
18080            utils::new_byte_array(buffer_out, buffer_buf_size),
18081            Error::HeifsaveBufferError,
18082        )
18083    }
18084}
18085
18086/// Options for heifsave_buffer operation
18087#[derive(Clone, Debug)]
18088pub struct HeifsaveBufferOptions {
18089    /// q: `i32` -> Q factor
18090    /// min: 1, max: 100, default: 50
18091    pub q: i32,
18092    /// bitdepth: `i32` -> Number of bits per pixel
18093    /// min: 8, max: 12, default: 12
18094    pub bitdepth: i32,
18095    /// lossless: `bool` -> Enable lossless compression
18096    /// default: false
18097    pub lossless: bool,
18098    /// compression: `ForeignHeifCompression` -> Compression format
18099    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
18100    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
18101    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
18102    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
18103    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
18104    pub compression: ForeignHeifCompression,
18105    /// effort: `i32` -> CPU effort
18106    /// min: 0, max: 9, default: 4
18107    pub effort: i32,
18108    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18109    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18110    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18111    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18112    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18113    pub subsample_mode: ForeignSubsample,
18114    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
18115    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
18116    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
18117    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
18118    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
18119    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
18120    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
18121    pub encoder: ForeignHeifEncoder,
18122    /// keep: `ForeignKeep` -> Which metadata to retain
18123    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18124    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18125    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18126    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18127    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18128    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18129    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18130    pub keep: ForeignKeep,
18131    /// background: `Vec<f64>` -> Background value
18132    pub background: Vec<f64>,
18133    /// page_height: `i32` -> Set page height for multipage save
18134    /// min: 0, max: 100000000, default: 0
18135    pub page_height: i32,
18136    /// profile: `String` -> Filename of ICC profile to embed
18137    pub profile: String,
18138}
18139
18140impl std::default::Default for HeifsaveBufferOptions {
18141    fn default() -> Self {
18142        HeifsaveBufferOptions {
18143            q: i32::from(50),
18144            bitdepth: i32::from(12),
18145            lossless: false,
18146            compression: ForeignHeifCompression::Hevc,
18147            effort: i32::from(4),
18148            subsample_mode: ForeignSubsample::Auto,
18149            encoder: ForeignHeifEncoder::Auto,
18150            keep: ForeignKeep::All,
18151            background: Vec::new(),
18152            page_height: i32::from(0),
18153            profile: String::from("sRGB"),
18154        }
18155    }
18156}
18157
18158/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgb alpha
18159/// inp: `&VipsImage` -> Image to save
18160/// heifsave_buffer_options: `&HeifsaveBufferOptions` -> optional arguments
18161/// returns `Vec<u8>` - Buffer to save to
18162pub fn heifsave_buffer_with_opts(
18163    inp: &VipsImage,
18164    heifsave_buffer_options: &HeifsaveBufferOptions,
18165) -> Result<Vec<u8>> {
18166    unsafe {
18167        let inp_in: *mut bindings::VipsImage = inp.ctx;
18168        let mut buffer_buf_size: u64 = 0;
18169        let mut buffer_out: *mut c_void = null_mut();
18170
18171        let q_in: i32 = heifsave_buffer_options.q;
18172        let q_in_name = utils::new_c_string("Q")?;
18173
18174        let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
18175        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18176
18177        let lossless_in: i32 = if heifsave_buffer_options.lossless {
18178            1
18179        } else {
18180            0
18181        };
18182        let lossless_in_name = utils::new_c_string("lossless")?;
18183
18184        let compression_in: i32 = heifsave_buffer_options.compression as i32;
18185        let compression_in_name = utils::new_c_string("compression")?;
18186
18187        let effort_in: i32 = heifsave_buffer_options.effort;
18188        let effort_in_name = utils::new_c_string("effort")?;
18189
18190        let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
18191        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18192
18193        let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
18194        let encoder_in_name = utils::new_c_string("encoder")?;
18195
18196        let keep_in: i32 = heifsave_buffer_options.keep as i32;
18197        let keep_in_name = utils::new_c_string("keep")?;
18198
18199        let background_wrapper =
18200            utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
18201        let background_in = background_wrapper.ctx;
18202        let background_in_name = utils::new_c_string("background")?;
18203
18204        let page_height_in: i32 = heifsave_buffer_options.page_height;
18205        let page_height_in_name = utils::new_c_string("page-height")?;
18206
18207        let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
18208        let profile_in_name = utils::new_c_string("profile")?;
18209
18210        let vips_op_response = bindings::vips_heifsave_buffer(
18211            inp_in,
18212            &mut buffer_out,
18213            &mut buffer_buf_size,
18214            q_in_name.as_ptr(),
18215            q_in,
18216            bitdepth_in_name.as_ptr(),
18217            bitdepth_in,
18218            lossless_in_name.as_ptr(),
18219            lossless_in,
18220            compression_in_name.as_ptr(),
18221            compression_in,
18222            effort_in_name.as_ptr(),
18223            effort_in,
18224            subsample_mode_in_name.as_ptr(),
18225            subsample_mode_in,
18226            encoder_in_name.as_ptr(),
18227            encoder_in,
18228            keep_in_name.as_ptr(),
18229            keep_in,
18230            background_in_name.as_ptr(),
18231            background_in,
18232            page_height_in_name.as_ptr(),
18233            page_height_in,
18234            profile_in_name.as_ptr(),
18235            profile_in.as_ptr(),
18236            NULL,
18237        );
18238        utils::result(
18239            vips_op_response,
18240            utils::new_byte_array(buffer_out, buffer_buf_size),
18241            Error::HeifsaveBufferError,
18242        )
18243    }
18244}
18245
18246/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgb alpha
18247/// inp: `&VipsImage` -> Image to save
18248/// target: `&VipsTarget` -> Target to save to
18249
18250pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18251    unsafe {
18252        let inp_in: *mut bindings::VipsImage = inp.ctx;
18253        let target_in: *mut bindings::VipsTarget = target.ctx;
18254
18255        let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
18256        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18257    }
18258}
18259
18260/// Options for heifsave_target operation
18261#[derive(Clone, Debug)]
18262pub struct HeifsaveTargetOptions {
18263    /// q: `i32` -> Q factor
18264    /// min: 1, max: 100, default: 50
18265    pub q: i32,
18266    /// bitdepth: `i32` -> Number of bits per pixel
18267    /// min: 8, max: 12, default: 12
18268    pub bitdepth: i32,
18269    /// lossless: `bool` -> Enable lossless compression
18270    /// default: false
18271    pub lossless: bool,
18272    /// compression: `ForeignHeifCompression` -> Compression format
18273    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
18274    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
18275    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
18276    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
18277    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
18278    pub compression: ForeignHeifCompression,
18279    /// effort: `i32` -> CPU effort
18280    /// min: 0, max: 9, default: 4
18281    pub effort: i32,
18282    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18283    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18284    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18285    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18286    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18287    pub subsample_mode: ForeignSubsample,
18288    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
18289    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
18290    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
18291    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
18292    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
18293    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
18294    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
18295    pub encoder: ForeignHeifEncoder,
18296    /// keep: `ForeignKeep` -> Which metadata to retain
18297    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18298    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18299    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18300    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18301    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18302    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18303    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18304    pub keep: ForeignKeep,
18305    /// background: `Vec<f64>` -> Background value
18306    pub background: Vec<f64>,
18307    /// page_height: `i32` -> Set page height for multipage save
18308    /// min: 0, max: 100000000, default: 0
18309    pub page_height: i32,
18310    /// profile: `String` -> Filename of ICC profile to embed
18311    pub profile: String,
18312}
18313
18314impl std::default::Default for HeifsaveTargetOptions {
18315    fn default() -> Self {
18316        HeifsaveTargetOptions {
18317            q: i32::from(50),
18318            bitdepth: i32::from(12),
18319            lossless: false,
18320            compression: ForeignHeifCompression::Hevc,
18321            effort: i32::from(4),
18322            subsample_mode: ForeignSubsample::Auto,
18323            encoder: ForeignHeifEncoder::Auto,
18324            keep: ForeignKeep::All,
18325            background: Vec::new(),
18326            page_height: i32::from(0),
18327            profile: String::from("sRGB"),
18328        }
18329    }
18330}
18331
18332/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgb alpha
18333/// inp: `&VipsImage` -> Image to save
18334/// target: `&VipsTarget` -> Target to save to
18335/// heifsave_target_options: `&HeifsaveTargetOptions` -> optional arguments
18336
18337pub fn heifsave_target_with_opts(
18338    inp: &VipsImage,
18339    target: &VipsTarget,
18340    heifsave_target_options: &HeifsaveTargetOptions,
18341) -> Result<()> {
18342    unsafe {
18343        let inp_in: *mut bindings::VipsImage = inp.ctx;
18344        let target_in: *mut bindings::VipsTarget = target.ctx;
18345
18346        let q_in: i32 = heifsave_target_options.q;
18347        let q_in_name = utils::new_c_string("Q")?;
18348
18349        let bitdepth_in: i32 = heifsave_target_options.bitdepth;
18350        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18351
18352        let lossless_in: i32 = if heifsave_target_options.lossless {
18353            1
18354        } else {
18355            0
18356        };
18357        let lossless_in_name = utils::new_c_string("lossless")?;
18358
18359        let compression_in: i32 = heifsave_target_options.compression as i32;
18360        let compression_in_name = utils::new_c_string("compression")?;
18361
18362        let effort_in: i32 = heifsave_target_options.effort;
18363        let effort_in_name = utils::new_c_string("effort")?;
18364
18365        let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
18366        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18367
18368        let encoder_in: i32 = heifsave_target_options.encoder as i32;
18369        let encoder_in_name = utils::new_c_string("encoder")?;
18370
18371        let keep_in: i32 = heifsave_target_options.keep as i32;
18372        let keep_in_name = utils::new_c_string("keep")?;
18373
18374        let background_wrapper =
18375            utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
18376        let background_in = background_wrapper.ctx;
18377        let background_in_name = utils::new_c_string("background")?;
18378
18379        let page_height_in: i32 = heifsave_target_options.page_height;
18380        let page_height_in_name = utils::new_c_string("page-height")?;
18381
18382        let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
18383        let profile_in_name = utils::new_c_string("profile")?;
18384
18385        let vips_op_response = bindings::vips_heifsave_target(
18386            inp_in,
18387            target_in,
18388            q_in_name.as_ptr(),
18389            q_in,
18390            bitdepth_in_name.as_ptr(),
18391            bitdepth_in,
18392            lossless_in_name.as_ptr(),
18393            lossless_in,
18394            compression_in_name.as_ptr(),
18395            compression_in,
18396            effort_in_name.as_ptr(),
18397            effort_in,
18398            subsample_mode_in_name.as_ptr(),
18399            subsample_mode_in,
18400            encoder_in_name.as_ptr(),
18401            encoder_in,
18402            keep_in_name.as_ptr(),
18403            keep_in,
18404            background_in_name.as_ptr(),
18405            background_in,
18406            page_height_in_name.as_ptr(),
18407            page_height_in,
18408            profile_in_name.as_ptr(),
18409            profile_in.as_ptr(),
18410            NULL,
18411        );
18412        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18413    }
18414}
18415
18416/// VipsThumbnailFile (thumbnail), generate thumbnail from file
18417/// filename: `&str` -> Filename to read from
18418/// width: `i32` -> Size to this width
18419/// min: 1, max: 100000000, default: 1
18420/// returns `VipsImage` - Output image
18421pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
18422    unsafe {
18423        let filename_in: CString = utils::new_c_string(filename)?;
18424        let width_in: i32 = width;
18425        let mut out_out: *mut bindings::VipsImage = null_mut();
18426
18427        let vips_op_response =
18428            bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
18429        utils::result(
18430            vips_op_response,
18431            VipsImage { ctx: out_out },
18432            Error::ThumbnailError,
18433        )
18434    }
18435}
18436
18437/// Options for thumbnail operation
18438#[derive(Clone, Debug)]
18439pub struct ThumbnailOptions {
18440    /// height: `i32` -> Size to this height
18441    /// min: 1, max: 100000000, default: 1
18442    pub height: i32,
18443    /// size: `Size` -> Only upsize, only downsize, or both
18444    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18445    ///  `Up` -> VIPS_SIZE_UP = 1
18446    ///  `Down` -> VIPS_SIZE_DOWN = 2
18447    ///  `Force` -> VIPS_SIZE_FORCE = 3
18448    ///  `Last` -> VIPS_SIZE_LAST = 4
18449    pub size: Size,
18450    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18451    /// default: false
18452    pub no_rotate: bool,
18453    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18454    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18455    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18456    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18457    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18458    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18459    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18460    ///  `All` -> VIPS_INTERESTING_ALL = 6
18461    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18462    pub crop: Interesting,
18463    /// linear: `bool` -> Reduce in linear light
18464    /// default: false
18465    pub linear: bool,
18466    /// input_profile: `String` -> Fallback input profile
18467    pub input_profile: String,
18468    /// output_profile: `String` -> Fallback output profile
18469    pub output_profile: String,
18470    /// intent: `Intent` -> Rendering intent
18471    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18472    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18473    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18474    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18475    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18476    ///  `Last` -> VIPS_INTENT_LAST = 33
18477    pub intent: Intent,
18478    /// fail_on: `FailOn` -> Error level to fail on
18479    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18480    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18481    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18482    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18483    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18484    pub fail_on: FailOn,
18485}
18486
18487impl std::default::Default for ThumbnailOptions {
18488    fn default() -> Self {
18489        ThumbnailOptions {
18490            height: i32::from(1),
18491            size: Size::Both,
18492            no_rotate: false,
18493            crop: Interesting::None,
18494            linear: false,
18495            input_profile: String::new(),
18496            output_profile: String::new(),
18497            intent: Intent::Relative,
18498            fail_on: FailOn::None,
18499        }
18500    }
18501}
18502
18503/// VipsThumbnailFile (thumbnail), generate thumbnail from file
18504/// filename: `&str` -> Filename to read from
18505/// width: `i32` -> Size to this width
18506/// min: 1, max: 100000000, default: 1
18507/// thumbnail_options: `&ThumbnailOptions` -> optional arguments
18508/// returns `VipsImage` - Output image
18509pub fn thumbnail_with_opts(
18510    filename: &str,
18511    width: i32,
18512    thumbnail_options: &ThumbnailOptions,
18513) -> Result<VipsImage> {
18514    unsafe {
18515        let filename_in: CString = utils::new_c_string(filename)?;
18516        let width_in: i32 = width;
18517        let mut out_out: *mut bindings::VipsImage = null_mut();
18518
18519        let height_in: i32 = thumbnail_options.height;
18520        let height_in_name = utils::new_c_string("height")?;
18521
18522        let size_in: i32 = thumbnail_options.size as i32;
18523        let size_in_name = utils::new_c_string("size")?;
18524
18525        let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
18526        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18527
18528        let crop_in: i32 = thumbnail_options.crop as i32;
18529        let crop_in_name = utils::new_c_string("crop")?;
18530
18531        let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
18532        let linear_in_name = utils::new_c_string("linear")?;
18533
18534        let input_profile_in: CString = utils::new_c_string(&thumbnail_options.input_profile)?;
18535        let input_profile_in_name = utils::new_c_string("input-profile")?;
18536
18537        let output_profile_in: CString = utils::new_c_string(&thumbnail_options.output_profile)?;
18538        let output_profile_in_name = utils::new_c_string("output-profile")?;
18539
18540        let intent_in: i32 = thumbnail_options.intent as i32;
18541        let intent_in_name = utils::new_c_string("intent")?;
18542
18543        let fail_on_in: i32 = thumbnail_options.fail_on as i32;
18544        let fail_on_in_name = utils::new_c_string("fail-on")?;
18545
18546        let vips_op_response = bindings::vips_thumbnail(
18547            filename_in.as_ptr(),
18548            &mut out_out,
18549            width_in,
18550            height_in_name.as_ptr(),
18551            height_in,
18552            size_in_name.as_ptr(),
18553            size_in,
18554            no_rotate_in_name.as_ptr(),
18555            no_rotate_in,
18556            crop_in_name.as_ptr(),
18557            crop_in,
18558            linear_in_name.as_ptr(),
18559            linear_in,
18560            input_profile_in_name.as_ptr(),
18561            input_profile_in.as_ptr(),
18562            output_profile_in_name.as_ptr(),
18563            output_profile_in.as_ptr(),
18564            intent_in_name.as_ptr(),
18565            intent_in,
18566            fail_on_in_name.as_ptr(),
18567            fail_on_in,
18568            NULL,
18569        );
18570        utils::result(
18571            vips_op_response,
18572            VipsImage { ctx: out_out },
18573            Error::ThumbnailError,
18574        )
18575    }
18576}
18577
18578/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
18579/// buffer: `&[u8]` -> Buffer to load from
18580/// width: `i32` -> Size to this width
18581/// min: 1, max: 100000000, default: 1
18582/// returns `VipsImage` - Output image
18583pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
18584    unsafe {
18585        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18586        let width_in: i32 = width;
18587        let mut out_out: *mut bindings::VipsImage = null_mut();
18588
18589        let vips_op_response = bindings::vips_thumbnail_buffer(
18590            buffer_in,
18591            buffer.len() as u64,
18592            &mut out_out,
18593            width_in,
18594            NULL,
18595        );
18596        utils::result(
18597            vips_op_response,
18598            VipsImage { ctx: out_out },
18599            Error::ThumbnailBufferError,
18600        )
18601    }
18602}
18603
18604/// Options for thumbnail_buffer operation
18605#[derive(Clone, Debug)]
18606pub struct ThumbnailBufferOptions {
18607    /// option_string: `String` -> Options that are passed on to the underlying loader
18608    pub option_string: String,
18609    /// height: `i32` -> Size to this height
18610    /// min: 1, max: 100000000, default: 1
18611    pub height: i32,
18612    /// size: `Size` -> Only upsize, only downsize, or both
18613    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18614    ///  `Up` -> VIPS_SIZE_UP = 1
18615    ///  `Down` -> VIPS_SIZE_DOWN = 2
18616    ///  `Force` -> VIPS_SIZE_FORCE = 3
18617    ///  `Last` -> VIPS_SIZE_LAST = 4
18618    pub size: Size,
18619    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18620    /// default: false
18621    pub no_rotate: bool,
18622    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18623    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18624    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18625    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18626    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18627    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18628    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18629    ///  `All` -> VIPS_INTERESTING_ALL = 6
18630    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18631    pub crop: Interesting,
18632    /// linear: `bool` -> Reduce in linear light
18633    /// default: false
18634    pub linear: bool,
18635    /// input_profile: `String` -> Fallback input profile
18636    pub input_profile: String,
18637    /// output_profile: `String` -> Fallback output profile
18638    pub output_profile: String,
18639    /// intent: `Intent` -> Rendering intent
18640    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18641    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18642    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18643    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18644    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18645    ///  `Last` -> VIPS_INTENT_LAST = 33
18646    pub intent: Intent,
18647    /// fail_on: `FailOn` -> Error level to fail on
18648    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18649    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18650    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18651    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18652    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18653    pub fail_on: FailOn,
18654}
18655
18656impl std::default::Default for ThumbnailBufferOptions {
18657    fn default() -> Self {
18658        ThumbnailBufferOptions {
18659            option_string: String::new(),
18660            height: i32::from(1),
18661            size: Size::Both,
18662            no_rotate: false,
18663            crop: Interesting::None,
18664            linear: false,
18665            input_profile: String::new(),
18666            output_profile: String::new(),
18667            intent: Intent::Relative,
18668            fail_on: FailOn::None,
18669        }
18670    }
18671}
18672
18673/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
18674/// buffer: `&[u8]` -> Buffer to load from
18675/// width: `i32` -> Size to this width
18676/// min: 1, max: 100000000, default: 1
18677/// thumbnail_buffer_options: `&ThumbnailBufferOptions` -> optional arguments
18678/// returns `VipsImage` - Output image
18679pub fn thumbnail_buffer_with_opts(
18680    buffer: &[u8],
18681    width: i32,
18682    thumbnail_buffer_options: &ThumbnailBufferOptions,
18683) -> Result<VipsImage> {
18684    unsafe {
18685        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18686        let width_in: i32 = width;
18687        let mut out_out: *mut bindings::VipsImage = null_mut();
18688
18689        let option_string_in: CString =
18690            utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18691        let option_string_in_name = utils::new_c_string("option-string")?;
18692
18693        let height_in: i32 = thumbnail_buffer_options.height;
18694        let height_in_name = utils::new_c_string("height")?;
18695
18696        let size_in: i32 = thumbnail_buffer_options.size as i32;
18697        let size_in_name = utils::new_c_string("size")?;
18698
18699        let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18700            1
18701        } else {
18702            0
18703        };
18704        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18705
18706        let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18707        let crop_in_name = utils::new_c_string("crop")?;
18708
18709        let linear_in: i32 = if thumbnail_buffer_options.linear {
18710            1
18711        } else {
18712            0
18713        };
18714        let linear_in_name = utils::new_c_string("linear")?;
18715
18716        let input_profile_in: CString =
18717            utils::new_c_string(&thumbnail_buffer_options.input_profile)?;
18718        let input_profile_in_name = utils::new_c_string("input-profile")?;
18719
18720        let output_profile_in: CString =
18721            utils::new_c_string(&thumbnail_buffer_options.output_profile)?;
18722        let output_profile_in_name = utils::new_c_string("output-profile")?;
18723
18724        let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18725        let intent_in_name = utils::new_c_string("intent")?;
18726
18727        let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18728        let fail_on_in_name = utils::new_c_string("fail-on")?;
18729
18730        let vips_op_response = bindings::vips_thumbnail_buffer(
18731            buffer_in,
18732            buffer.len() as u64,
18733            &mut out_out,
18734            width_in,
18735            option_string_in_name.as_ptr(),
18736            option_string_in.as_ptr(),
18737            height_in_name.as_ptr(),
18738            height_in,
18739            size_in_name.as_ptr(),
18740            size_in,
18741            no_rotate_in_name.as_ptr(),
18742            no_rotate_in,
18743            crop_in_name.as_ptr(),
18744            crop_in,
18745            linear_in_name.as_ptr(),
18746            linear_in,
18747            input_profile_in_name.as_ptr(),
18748            input_profile_in.as_ptr(),
18749            output_profile_in_name.as_ptr(),
18750            output_profile_in.as_ptr(),
18751            intent_in_name.as_ptr(),
18752            intent_in,
18753            fail_on_in_name.as_ptr(),
18754            fail_on_in,
18755            NULL,
18756        );
18757        utils::result(
18758            vips_op_response,
18759            VipsImage { ctx: out_out },
18760            Error::ThumbnailBufferError,
18761        )
18762    }
18763}
18764
18765/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18766/// inp: `&VipsImage` -> Input image argument
18767/// width: `i32` -> Size to this width
18768/// min: 1, max: 100000000, default: 1
18769/// returns `VipsImage` - Output image
18770pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18771    unsafe {
18772        let inp_in: *mut bindings::VipsImage = inp.ctx;
18773        let width_in: i32 = width;
18774        let mut out_out: *mut bindings::VipsImage = null_mut();
18775
18776        let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18777        utils::result(
18778            vips_op_response,
18779            VipsImage { ctx: out_out },
18780            Error::ThumbnailImageError,
18781        )
18782    }
18783}
18784
18785/// Options for thumbnail_image operation
18786#[derive(Clone, Debug)]
18787pub struct ThumbnailImageOptions {
18788    /// height: `i32` -> Size to this height
18789    /// min: 1, max: 100000000, default: 1
18790    pub height: i32,
18791    /// size: `Size` -> Only upsize, only downsize, or both
18792    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18793    ///  `Up` -> VIPS_SIZE_UP = 1
18794    ///  `Down` -> VIPS_SIZE_DOWN = 2
18795    ///  `Force` -> VIPS_SIZE_FORCE = 3
18796    ///  `Last` -> VIPS_SIZE_LAST = 4
18797    pub size: Size,
18798    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18799    /// default: false
18800    pub no_rotate: bool,
18801    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18802    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18803    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18804    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18805    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18806    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18807    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18808    ///  `All` -> VIPS_INTERESTING_ALL = 6
18809    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18810    pub crop: Interesting,
18811    /// linear: `bool` -> Reduce in linear light
18812    /// default: false
18813    pub linear: bool,
18814    /// input_profile: `String` -> Fallback input profile
18815    pub input_profile: String,
18816    /// output_profile: `String` -> Fallback output profile
18817    pub output_profile: String,
18818    /// intent: `Intent` -> Rendering intent
18819    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18820    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18821    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18822    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18823    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18824    ///  `Last` -> VIPS_INTENT_LAST = 33
18825    pub intent: Intent,
18826    /// fail_on: `FailOn` -> Error level to fail on
18827    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18828    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18829    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18830    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18831    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18832    pub fail_on: FailOn,
18833}
18834
18835impl std::default::Default for ThumbnailImageOptions {
18836    fn default() -> Self {
18837        ThumbnailImageOptions {
18838            height: i32::from(1),
18839            size: Size::Both,
18840            no_rotate: false,
18841            crop: Interesting::None,
18842            linear: false,
18843            input_profile: String::new(),
18844            output_profile: String::new(),
18845            intent: Intent::Relative,
18846            fail_on: FailOn::None,
18847        }
18848    }
18849}
18850
18851/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18852/// inp: `&VipsImage` -> Input image argument
18853/// width: `i32` -> Size to this width
18854/// min: 1, max: 100000000, default: 1
18855/// thumbnail_image_options: `&ThumbnailImageOptions` -> optional arguments
18856/// returns `VipsImage` - Output image
18857pub fn thumbnail_image_with_opts(
18858    inp: &VipsImage,
18859    width: i32,
18860    thumbnail_image_options: &ThumbnailImageOptions,
18861) -> Result<VipsImage> {
18862    unsafe {
18863        let inp_in: *mut bindings::VipsImage = inp.ctx;
18864        let width_in: i32 = width;
18865        let mut out_out: *mut bindings::VipsImage = null_mut();
18866
18867        let height_in: i32 = thumbnail_image_options.height;
18868        let height_in_name = utils::new_c_string("height")?;
18869
18870        let size_in: i32 = thumbnail_image_options.size as i32;
18871        let size_in_name = utils::new_c_string("size")?;
18872
18873        let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18874            1
18875        } else {
18876            0
18877        };
18878        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18879
18880        let crop_in: i32 = thumbnail_image_options.crop as i32;
18881        let crop_in_name = utils::new_c_string("crop")?;
18882
18883        let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18884        let linear_in_name = utils::new_c_string("linear")?;
18885
18886        let input_profile_in: CString =
18887            utils::new_c_string(&thumbnail_image_options.input_profile)?;
18888        let input_profile_in_name = utils::new_c_string("input-profile")?;
18889
18890        let output_profile_in: CString =
18891            utils::new_c_string(&thumbnail_image_options.output_profile)?;
18892        let output_profile_in_name = utils::new_c_string("output-profile")?;
18893
18894        let intent_in: i32 = thumbnail_image_options.intent as i32;
18895        let intent_in_name = utils::new_c_string("intent")?;
18896
18897        let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18898        let fail_on_in_name = utils::new_c_string("fail-on")?;
18899
18900        let vips_op_response = bindings::vips_thumbnail_image(
18901            inp_in,
18902            &mut out_out,
18903            width_in,
18904            height_in_name.as_ptr(),
18905            height_in,
18906            size_in_name.as_ptr(),
18907            size_in,
18908            no_rotate_in_name.as_ptr(),
18909            no_rotate_in,
18910            crop_in_name.as_ptr(),
18911            crop_in,
18912            linear_in_name.as_ptr(),
18913            linear_in,
18914            input_profile_in_name.as_ptr(),
18915            input_profile_in.as_ptr(),
18916            output_profile_in_name.as_ptr(),
18917            output_profile_in.as_ptr(),
18918            intent_in_name.as_ptr(),
18919            intent_in,
18920            fail_on_in_name.as_ptr(),
18921            fail_on_in,
18922            NULL,
18923        );
18924        utils::result(
18925            vips_op_response,
18926            VipsImage { ctx: out_out },
18927            Error::ThumbnailImageError,
18928        )
18929    }
18930}
18931
18932/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
18933/// source: `&VipsSource` -> Source to load from
18934/// width: `i32` -> Size to this width
18935/// min: 1, max: 100000000, default: 1
18936/// returns `VipsImage` - Output image
18937pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18938    unsafe {
18939        let source_in: *mut bindings::VipsSource = source.ctx;
18940        let width_in: i32 = width;
18941        let mut out_out: *mut bindings::VipsImage = null_mut();
18942
18943        let vips_op_response =
18944            bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18945        utils::result(
18946            vips_op_response,
18947            VipsImage { ctx: out_out },
18948            Error::ThumbnailSourceError,
18949        )
18950    }
18951}
18952
18953/// Options for thumbnail_source operation
18954#[derive(Clone, Debug)]
18955pub struct ThumbnailSourceOptions {
18956    /// option_string: `String` -> Options that are passed on to the underlying loader
18957    pub option_string: String,
18958    /// height: `i32` -> Size to this height
18959    /// min: 1, max: 100000000, default: 1
18960    pub height: i32,
18961    /// size: `Size` -> Only upsize, only downsize, or both
18962    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18963    ///  `Up` -> VIPS_SIZE_UP = 1
18964    ///  `Down` -> VIPS_SIZE_DOWN = 2
18965    ///  `Force` -> VIPS_SIZE_FORCE = 3
18966    ///  `Last` -> VIPS_SIZE_LAST = 4
18967    pub size: Size,
18968    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18969    /// default: false
18970    pub no_rotate: bool,
18971    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18972    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18973    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18974    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18975    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18976    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18977    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18978    ///  `All` -> VIPS_INTERESTING_ALL = 6
18979    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18980    pub crop: Interesting,
18981    /// linear: `bool` -> Reduce in linear light
18982    /// default: false
18983    pub linear: bool,
18984    /// input_profile: `String` -> Fallback input profile
18985    pub input_profile: String,
18986    /// output_profile: `String` -> Fallback output profile
18987    pub output_profile: String,
18988    /// intent: `Intent` -> Rendering intent
18989    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18990    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18991    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18992    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18993    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18994    ///  `Last` -> VIPS_INTENT_LAST = 33
18995    pub intent: Intent,
18996    /// fail_on: `FailOn` -> Error level to fail on
18997    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18998    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18999    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
19000    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
19001    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
19002    pub fail_on: FailOn,
19003}
19004
19005impl std::default::Default for ThumbnailSourceOptions {
19006    fn default() -> Self {
19007        ThumbnailSourceOptions {
19008            option_string: String::new(),
19009            height: i32::from(1),
19010            size: Size::Both,
19011            no_rotate: false,
19012            crop: Interesting::None,
19013            linear: false,
19014            input_profile: String::new(),
19015            output_profile: String::new(),
19016            intent: Intent::Relative,
19017            fail_on: FailOn::None,
19018        }
19019    }
19020}
19021
19022/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
19023/// source: `&VipsSource` -> Source to load from
19024/// width: `i32` -> Size to this width
19025/// min: 1, max: 100000000, default: 1
19026/// thumbnail_source_options: `&ThumbnailSourceOptions` -> optional arguments
19027/// returns `VipsImage` - Output image
19028pub fn thumbnail_source_with_opts(
19029    source: &VipsSource,
19030    width: i32,
19031    thumbnail_source_options: &ThumbnailSourceOptions,
19032) -> Result<VipsImage> {
19033    unsafe {
19034        let source_in: *mut bindings::VipsSource = source.ctx;
19035        let width_in: i32 = width;
19036        let mut out_out: *mut bindings::VipsImage = null_mut();
19037
19038        let option_string_in: CString =
19039            utils::new_c_string(&thumbnail_source_options.option_string)?;
19040        let option_string_in_name = utils::new_c_string("option-string")?;
19041
19042        let height_in: i32 = thumbnail_source_options.height;
19043        let height_in_name = utils::new_c_string("height")?;
19044
19045        let size_in: i32 = thumbnail_source_options.size as i32;
19046        let size_in_name = utils::new_c_string("size")?;
19047
19048        let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
19049            1
19050        } else {
19051            0
19052        };
19053        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
19054
19055        let crop_in: i32 = thumbnail_source_options.crop as i32;
19056        let crop_in_name = utils::new_c_string("crop")?;
19057
19058        let linear_in: i32 = if thumbnail_source_options.linear {
19059            1
19060        } else {
19061            0
19062        };
19063        let linear_in_name = utils::new_c_string("linear")?;
19064
19065        let input_profile_in: CString =
19066            utils::new_c_string(&thumbnail_source_options.input_profile)?;
19067        let input_profile_in_name = utils::new_c_string("input-profile")?;
19068
19069        let output_profile_in: CString =
19070            utils::new_c_string(&thumbnail_source_options.output_profile)?;
19071        let output_profile_in_name = utils::new_c_string("output-profile")?;
19072
19073        let intent_in: i32 = thumbnail_source_options.intent as i32;
19074        let intent_in_name = utils::new_c_string("intent")?;
19075
19076        let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
19077        let fail_on_in_name = utils::new_c_string("fail-on")?;
19078
19079        let vips_op_response = bindings::vips_thumbnail_source(
19080            source_in,
19081            &mut out_out,
19082            width_in,
19083            option_string_in_name.as_ptr(),
19084            option_string_in.as_ptr(),
19085            height_in_name.as_ptr(),
19086            height_in,
19087            size_in_name.as_ptr(),
19088            size_in,
19089            no_rotate_in_name.as_ptr(),
19090            no_rotate_in,
19091            crop_in_name.as_ptr(),
19092            crop_in,
19093            linear_in_name.as_ptr(),
19094            linear_in,
19095            input_profile_in_name.as_ptr(),
19096            input_profile_in.as_ptr(),
19097            output_profile_in_name.as_ptr(),
19098            output_profile_in.as_ptr(),
19099            intent_in_name.as_ptr(),
19100            intent_in,
19101            fail_on_in_name.as_ptr(),
19102            fail_on_in,
19103            NULL,
19104        );
19105        utils::result(
19106            vips_op_response,
19107            VipsImage { ctx: out_out },
19108            Error::ThumbnailSourceError,
19109        )
19110    }
19111}
19112
19113/// VipsMapim (mapim), resample with a map image
19114/// inp: `&VipsImage` -> Input image argument
19115/// index: `&VipsImage` -> Index pixels with this
19116/// returns `VipsImage` - Output image
19117pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
19118    unsafe {
19119        let inp_in: *mut bindings::VipsImage = inp.ctx;
19120        let index_in: *mut bindings::VipsImage = index.ctx;
19121        let mut out_out: *mut bindings::VipsImage = null_mut();
19122
19123        let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
19124        utils::result(
19125            vips_op_response,
19126            VipsImage { ctx: out_out },
19127            Error::MapimError,
19128        )
19129    }
19130}
19131
19132/// Options for mapim operation
19133#[derive(Clone, Debug)]
19134pub struct MapimOptions {
19135    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19136    pub interpolate: VipsInterpolate,
19137    /// background: `Vec<f64>` -> Background value
19138    pub background: Vec<f64>,
19139    /// premultiplied: `bool` -> Images have premultiplied alpha
19140    /// default: false
19141    pub premultiplied: bool,
19142    /// extend: `Extend` -> How to generate the extra pixels
19143    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19144    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19145    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19146    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19147    ///  `White` -> VIPS_EXTEND_WHITE = 4
19148    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19149    ///  `Last` -> VIPS_EXTEND_LAST = 6
19150    pub extend: Extend,
19151}
19152
19153impl std::default::Default for MapimOptions {
19154    fn default() -> Self {
19155        MapimOptions {
19156            interpolate: VipsInterpolate::new(),
19157            background: Vec::new(),
19158            premultiplied: false,
19159            extend: Extend::Background,
19160        }
19161    }
19162}
19163
19164/// VipsMapim (mapim), resample with a map image
19165/// inp: `&VipsImage` -> Input image argument
19166/// index: `&VipsImage` -> Index pixels with this
19167/// mapim_options: `&MapimOptions` -> optional arguments
19168/// returns `VipsImage` - Output image
19169pub fn mapim_with_opts(
19170    inp: &VipsImage,
19171    index: &VipsImage,
19172    mapim_options: &MapimOptions,
19173) -> Result<VipsImage> {
19174    unsafe {
19175        let inp_in: *mut bindings::VipsImage = inp.ctx;
19176        let index_in: *mut bindings::VipsImage = index.ctx;
19177        let mut out_out: *mut bindings::VipsImage = null_mut();
19178
19179        let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
19180        let interpolate_in_name = utils::new_c_string("interpolate")?;
19181
19182        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
19183        let background_in = background_wrapper.ctx;
19184        let background_in_name = utils::new_c_string("background")?;
19185
19186        let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
19187        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19188
19189        let extend_in: i32 = mapim_options.extend as i32;
19190        let extend_in_name = utils::new_c_string("extend")?;
19191
19192        let vips_op_response = bindings::vips_mapim(
19193            inp_in,
19194            &mut out_out,
19195            index_in,
19196            interpolate_in_name.as_ptr(),
19197            interpolate_in,
19198            background_in_name.as_ptr(),
19199            background_in,
19200            premultiplied_in_name.as_ptr(),
19201            premultiplied_in,
19202            extend_in_name.as_ptr(),
19203            extend_in,
19204            NULL,
19205        );
19206        utils::result(
19207            vips_op_response,
19208            VipsImage { ctx: out_out },
19209            Error::MapimError,
19210        )
19211    }
19212}
19213
19214/// VipsShrink (shrink), shrink an image
19215/// inp: `&VipsImage` -> Input image argument
19216/// hshrink: `f64` -> Horizontal shrink factor
19217/// min: 1, max: 1000000, default: 1
19218/// vshrink: `f64` -> Vertical shrink factor
19219/// min: 1, max: 1000000, default: 1
19220/// returns `VipsImage` - Output image
19221pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19222    unsafe {
19223        let inp_in: *mut bindings::VipsImage = inp.ctx;
19224        let hshrink_in: f64 = hshrink;
19225        let vshrink_in: f64 = vshrink;
19226        let mut out_out: *mut bindings::VipsImage = null_mut();
19227
19228        let vips_op_response =
19229            bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19230        utils::result(
19231            vips_op_response,
19232            VipsImage { ctx: out_out },
19233            Error::ShrinkError,
19234        )
19235    }
19236}
19237
19238/// Options for shrink operation
19239#[derive(Clone, Debug)]
19240pub struct ShrinkOptions {
19241    /// ceil: `bool` -> Round-up output dimensions
19242    /// default: false
19243    pub ceil: bool,
19244}
19245
19246impl std::default::Default for ShrinkOptions {
19247    fn default() -> Self {
19248        ShrinkOptions { ceil: false }
19249    }
19250}
19251
19252/// VipsShrink (shrink), shrink an image
19253/// inp: `&VipsImage` -> Input image argument
19254/// hshrink: `f64` -> Horizontal shrink factor
19255/// min: 1, max: 1000000, default: 1
19256/// vshrink: `f64` -> Vertical shrink factor
19257/// min: 1, max: 1000000, default: 1
19258/// shrink_options: `&ShrinkOptions` -> optional arguments
19259/// returns `VipsImage` - Output image
19260pub fn shrink_with_opts(
19261    inp: &VipsImage,
19262    hshrink: f64,
19263    vshrink: f64,
19264    shrink_options: &ShrinkOptions,
19265) -> Result<VipsImage> {
19266    unsafe {
19267        let inp_in: *mut bindings::VipsImage = inp.ctx;
19268        let hshrink_in: f64 = hshrink;
19269        let vshrink_in: f64 = vshrink;
19270        let mut out_out: *mut bindings::VipsImage = null_mut();
19271
19272        let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
19273        let ceil_in_name = utils::new_c_string("ceil")?;
19274
19275        let vips_op_response = bindings::vips_shrink(
19276            inp_in,
19277            &mut out_out,
19278            hshrink_in,
19279            vshrink_in,
19280            ceil_in_name.as_ptr(),
19281            ceil_in,
19282            NULL,
19283        );
19284        utils::result(
19285            vips_op_response,
19286            VipsImage { ctx: out_out },
19287            Error::ShrinkError,
19288        )
19289    }
19290}
19291
19292/// VipsShrinkh (shrinkh), shrink an image horizontally
19293/// inp: `&VipsImage` -> Input image argument
19294/// hshrink: `i32` -> Horizontal shrink factor
19295/// min: 1, max: 1000000, default: 1
19296/// returns `VipsImage` - Output image
19297pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
19298    unsafe {
19299        let inp_in: *mut bindings::VipsImage = inp.ctx;
19300        let hshrink_in: i32 = hshrink;
19301        let mut out_out: *mut bindings::VipsImage = null_mut();
19302
19303        let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
19304        utils::result(
19305            vips_op_response,
19306            VipsImage { ctx: out_out },
19307            Error::ShrinkhError,
19308        )
19309    }
19310}
19311
19312/// Options for shrinkh operation
19313#[derive(Clone, Debug)]
19314pub struct ShrinkhOptions {
19315    /// ceil: `bool` -> Round-up output dimensions
19316    /// default: false
19317    pub ceil: bool,
19318}
19319
19320impl std::default::Default for ShrinkhOptions {
19321    fn default() -> Self {
19322        ShrinkhOptions { ceil: false }
19323    }
19324}
19325
19326/// VipsShrinkh (shrinkh), shrink an image horizontally
19327/// inp: `&VipsImage` -> Input image argument
19328/// hshrink: `i32` -> Horizontal shrink factor
19329/// min: 1, max: 1000000, default: 1
19330/// shrinkh_options: `&ShrinkhOptions` -> optional arguments
19331/// returns `VipsImage` - Output image
19332pub fn shrinkh_with_opts(
19333    inp: &VipsImage,
19334    hshrink: i32,
19335    shrinkh_options: &ShrinkhOptions,
19336) -> Result<VipsImage> {
19337    unsafe {
19338        let inp_in: *mut bindings::VipsImage = inp.ctx;
19339        let hshrink_in: i32 = hshrink;
19340        let mut out_out: *mut bindings::VipsImage = null_mut();
19341
19342        let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
19343        let ceil_in_name = utils::new_c_string("ceil")?;
19344
19345        let vips_op_response = bindings::vips_shrinkh(
19346            inp_in,
19347            &mut out_out,
19348            hshrink_in,
19349            ceil_in_name.as_ptr(),
19350            ceil_in,
19351            NULL,
19352        );
19353        utils::result(
19354            vips_op_response,
19355            VipsImage { ctx: out_out },
19356            Error::ShrinkhError,
19357        )
19358    }
19359}
19360
19361/// VipsShrinkv (shrinkv), shrink an image vertically
19362/// inp: `&VipsImage` -> Input image argument
19363/// vshrink: `i32` -> Vertical shrink factor
19364/// min: 1, max: 1000000, default: 1
19365/// returns `VipsImage` - Output image
19366pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
19367    unsafe {
19368        let inp_in: *mut bindings::VipsImage = inp.ctx;
19369        let vshrink_in: i32 = vshrink;
19370        let mut out_out: *mut bindings::VipsImage = null_mut();
19371
19372        let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
19373        utils::result(
19374            vips_op_response,
19375            VipsImage { ctx: out_out },
19376            Error::ShrinkvError,
19377        )
19378    }
19379}
19380
19381/// Options for shrinkv operation
19382#[derive(Clone, Debug)]
19383pub struct ShrinkvOptions {
19384    /// ceil: `bool` -> Round-up output dimensions
19385    /// default: false
19386    pub ceil: bool,
19387}
19388
19389impl std::default::Default for ShrinkvOptions {
19390    fn default() -> Self {
19391        ShrinkvOptions { ceil: false }
19392    }
19393}
19394
19395/// VipsShrinkv (shrinkv), shrink an image vertically
19396/// inp: `&VipsImage` -> Input image argument
19397/// vshrink: `i32` -> Vertical shrink factor
19398/// min: 1, max: 1000000, default: 1
19399/// shrinkv_options: `&ShrinkvOptions` -> optional arguments
19400/// returns `VipsImage` - Output image
19401pub fn shrinkv_with_opts(
19402    inp: &VipsImage,
19403    vshrink: i32,
19404    shrinkv_options: &ShrinkvOptions,
19405) -> Result<VipsImage> {
19406    unsafe {
19407        let inp_in: *mut bindings::VipsImage = inp.ctx;
19408        let vshrink_in: i32 = vshrink;
19409        let mut out_out: *mut bindings::VipsImage = null_mut();
19410
19411        let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
19412        let ceil_in_name = utils::new_c_string("ceil")?;
19413
19414        let vips_op_response = bindings::vips_shrinkv(
19415            inp_in,
19416            &mut out_out,
19417            vshrink_in,
19418            ceil_in_name.as_ptr(),
19419            ceil_in,
19420            NULL,
19421        );
19422        utils::result(
19423            vips_op_response,
19424            VipsImage { ctx: out_out },
19425            Error::ShrinkvError,
19426        )
19427    }
19428}
19429
19430/// VipsReduceh (reduceh), shrink an image horizontally
19431/// inp: `&VipsImage` -> Input image argument
19432/// hshrink: `f64` -> Horizontal shrink factor
19433/// min: 1, max: 1000000, default: 1
19434/// returns `VipsImage` - Output image
19435pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
19436    unsafe {
19437        let inp_in: *mut bindings::VipsImage = inp.ctx;
19438        let hshrink_in: f64 = hshrink;
19439        let mut out_out: *mut bindings::VipsImage = null_mut();
19440
19441        let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
19442        utils::result(
19443            vips_op_response,
19444            VipsImage { ctx: out_out },
19445            Error::ReducehError,
19446        )
19447    }
19448}
19449
19450/// Options for reduceh operation
19451#[derive(Clone, Debug)]
19452pub struct ReducehOptions {
19453    /// kernel: `Kernel` -> Resampling kernel
19454    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19455    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19456    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19457    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19458    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19459    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19460    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19461    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19462    ///  `Last` -> VIPS_KERNEL_LAST = 8
19463    pub kernel: Kernel,
19464    /// gap: `f64` -> Reducing gap
19465    /// min: 0, max: 1000000, default: 0
19466    pub gap: f64,
19467}
19468
19469impl std::default::Default for ReducehOptions {
19470    fn default() -> Self {
19471        ReducehOptions {
19472            kernel: Kernel::Lanczos3,
19473            gap: f64::from(0),
19474        }
19475    }
19476}
19477
19478/// VipsReduceh (reduceh), shrink an image horizontally
19479/// inp: `&VipsImage` -> Input image argument
19480/// hshrink: `f64` -> Horizontal shrink factor
19481/// min: 1, max: 1000000, default: 1
19482/// reduceh_options: `&ReducehOptions` -> optional arguments
19483/// returns `VipsImage` - Output image
19484pub fn reduceh_with_opts(
19485    inp: &VipsImage,
19486    hshrink: f64,
19487    reduceh_options: &ReducehOptions,
19488) -> Result<VipsImage> {
19489    unsafe {
19490        let inp_in: *mut bindings::VipsImage = inp.ctx;
19491        let hshrink_in: f64 = hshrink;
19492        let mut out_out: *mut bindings::VipsImage = null_mut();
19493
19494        let kernel_in: i32 = reduceh_options.kernel as i32;
19495        let kernel_in_name = utils::new_c_string("kernel")?;
19496
19497        let gap_in: f64 = reduceh_options.gap;
19498        let gap_in_name = utils::new_c_string("gap")?;
19499
19500        let vips_op_response = bindings::vips_reduceh(
19501            inp_in,
19502            &mut out_out,
19503            hshrink_in,
19504            kernel_in_name.as_ptr(),
19505            kernel_in,
19506            gap_in_name.as_ptr(),
19507            gap_in,
19508            NULL,
19509        );
19510        utils::result(
19511            vips_op_response,
19512            VipsImage { ctx: out_out },
19513            Error::ReducehError,
19514        )
19515    }
19516}
19517
19518/// VipsReducev (reducev), shrink an image vertically
19519/// inp: `&VipsImage` -> Input image argument
19520/// vshrink: `f64` -> Vertical shrink factor
19521/// min: 1, max: 1000000, default: 1
19522/// returns `VipsImage` - Output image
19523pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
19524    unsafe {
19525        let inp_in: *mut bindings::VipsImage = inp.ctx;
19526        let vshrink_in: f64 = vshrink;
19527        let mut out_out: *mut bindings::VipsImage = null_mut();
19528
19529        let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
19530        utils::result(
19531            vips_op_response,
19532            VipsImage { ctx: out_out },
19533            Error::ReducevError,
19534        )
19535    }
19536}
19537
19538/// Options for reducev operation
19539#[derive(Clone, Debug)]
19540pub struct ReducevOptions {
19541    /// kernel: `Kernel` -> Resampling kernel
19542    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19543    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19544    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19545    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19546    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19547    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19548    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19549    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19550    ///  `Last` -> VIPS_KERNEL_LAST = 8
19551    pub kernel: Kernel,
19552    /// gap: `f64` -> Reducing gap
19553    /// min: 0, max: 1000000, default: 0
19554    pub gap: f64,
19555}
19556
19557impl std::default::Default for ReducevOptions {
19558    fn default() -> Self {
19559        ReducevOptions {
19560            kernel: Kernel::Lanczos3,
19561            gap: f64::from(0),
19562        }
19563    }
19564}
19565
19566/// VipsReducev (reducev), shrink an image vertically
19567/// inp: `&VipsImage` -> Input image argument
19568/// vshrink: `f64` -> Vertical shrink factor
19569/// min: 1, max: 1000000, default: 1
19570/// reducev_options: `&ReducevOptions` -> optional arguments
19571/// returns `VipsImage` - Output image
19572pub fn reducev_with_opts(
19573    inp: &VipsImage,
19574    vshrink: f64,
19575    reducev_options: &ReducevOptions,
19576) -> Result<VipsImage> {
19577    unsafe {
19578        let inp_in: *mut bindings::VipsImage = inp.ctx;
19579        let vshrink_in: f64 = vshrink;
19580        let mut out_out: *mut bindings::VipsImage = null_mut();
19581
19582        let kernel_in: i32 = reducev_options.kernel as i32;
19583        let kernel_in_name = utils::new_c_string("kernel")?;
19584
19585        let gap_in: f64 = reducev_options.gap;
19586        let gap_in_name = utils::new_c_string("gap")?;
19587
19588        let vips_op_response = bindings::vips_reducev(
19589            inp_in,
19590            &mut out_out,
19591            vshrink_in,
19592            kernel_in_name.as_ptr(),
19593            kernel_in,
19594            gap_in_name.as_ptr(),
19595            gap_in,
19596            NULL,
19597        );
19598        utils::result(
19599            vips_op_response,
19600            VipsImage { ctx: out_out },
19601            Error::ReducevError,
19602        )
19603    }
19604}
19605
19606/// VipsReduce (reduce), reduce an image
19607/// inp: `&VipsImage` -> Input image argument
19608/// hshrink: `f64` -> Horizontal shrink factor
19609/// min: 1, max: 1000000, default: 1
19610/// vshrink: `f64` -> Vertical shrink factor
19611/// min: 1, max: 1000000, default: 1
19612/// returns `VipsImage` - Output image
19613pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19614    unsafe {
19615        let inp_in: *mut bindings::VipsImage = inp.ctx;
19616        let hshrink_in: f64 = hshrink;
19617        let vshrink_in: f64 = vshrink;
19618        let mut out_out: *mut bindings::VipsImage = null_mut();
19619
19620        let vips_op_response =
19621            bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19622        utils::result(
19623            vips_op_response,
19624            VipsImage { ctx: out_out },
19625            Error::ReduceError,
19626        )
19627    }
19628}
19629
19630/// Options for reduce operation
19631#[derive(Clone, Debug)]
19632pub struct ReduceOptions {
19633    /// kernel: `Kernel` -> Resampling kernel
19634    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19635    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19636    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19637    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19638    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19639    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19640    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19641    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19642    ///  `Last` -> VIPS_KERNEL_LAST = 8
19643    pub kernel: Kernel,
19644    /// gap: `f64` -> Reducing gap
19645    /// min: 0, max: 1000000, default: 0
19646    pub gap: f64,
19647}
19648
19649impl std::default::Default for ReduceOptions {
19650    fn default() -> Self {
19651        ReduceOptions {
19652            kernel: Kernel::Lanczos3,
19653            gap: f64::from(0),
19654        }
19655    }
19656}
19657
19658/// VipsReduce (reduce), reduce an image
19659/// inp: `&VipsImage` -> Input image argument
19660/// hshrink: `f64` -> Horizontal shrink factor
19661/// min: 1, max: 1000000, default: 1
19662/// vshrink: `f64` -> Vertical shrink factor
19663/// min: 1, max: 1000000, default: 1
19664/// reduce_options: `&ReduceOptions` -> optional arguments
19665/// returns `VipsImage` - Output image
19666pub fn reduce_with_opts(
19667    inp: &VipsImage,
19668    hshrink: f64,
19669    vshrink: f64,
19670    reduce_options: &ReduceOptions,
19671) -> Result<VipsImage> {
19672    unsafe {
19673        let inp_in: *mut bindings::VipsImage = inp.ctx;
19674        let hshrink_in: f64 = hshrink;
19675        let vshrink_in: f64 = vshrink;
19676        let mut out_out: *mut bindings::VipsImage = null_mut();
19677
19678        let kernel_in: i32 = reduce_options.kernel as i32;
19679        let kernel_in_name = utils::new_c_string("kernel")?;
19680
19681        let gap_in: f64 = reduce_options.gap;
19682        let gap_in_name = utils::new_c_string("gap")?;
19683
19684        let vips_op_response = bindings::vips_reduce(
19685            inp_in,
19686            &mut out_out,
19687            hshrink_in,
19688            vshrink_in,
19689            kernel_in_name.as_ptr(),
19690            kernel_in,
19691            gap_in_name.as_ptr(),
19692            gap_in,
19693            NULL,
19694        );
19695        utils::result(
19696            vips_op_response,
19697            VipsImage { ctx: out_out },
19698            Error::ReduceError,
19699        )
19700    }
19701}
19702
19703/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19704/// inp: `&VipsImage` -> Input image argument
19705/// coeff: `&VipsImage` -> Coefficient matrix
19706/// returns `VipsImage` - Output image
19707pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19708    unsafe {
19709        let inp_in: *mut bindings::VipsImage = inp.ctx;
19710        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19711        let mut out_out: *mut bindings::VipsImage = null_mut();
19712
19713        let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19714        utils::result(
19715            vips_op_response,
19716            VipsImage { ctx: out_out },
19717            Error::QuadraticError,
19718        )
19719    }
19720}
19721
19722/// Options for quadratic operation
19723#[derive(Clone, Debug)]
19724pub struct QuadraticOptions {
19725    /// interpolate: `VipsInterpolate` -> Interpolate values with this
19726    pub interpolate: VipsInterpolate,
19727}
19728
19729impl std::default::Default for QuadraticOptions {
19730    fn default() -> Self {
19731        QuadraticOptions {
19732            interpolate: VipsInterpolate::new(),
19733        }
19734    }
19735}
19736
19737/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19738/// inp: `&VipsImage` -> Input image argument
19739/// coeff: `&VipsImage` -> Coefficient matrix
19740/// quadratic_options: `&QuadraticOptions` -> optional arguments
19741/// returns `VipsImage` - Output image
19742pub fn quadratic_with_opts(
19743    inp: &VipsImage,
19744    coeff: &VipsImage,
19745    quadratic_options: &QuadraticOptions,
19746) -> Result<VipsImage> {
19747    unsafe {
19748        let inp_in: *mut bindings::VipsImage = inp.ctx;
19749        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19750        let mut out_out: *mut bindings::VipsImage = null_mut();
19751
19752        let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19753        let interpolate_in_name = utils::new_c_string("interpolate")?;
19754
19755        let vips_op_response = bindings::vips_quadratic(
19756            inp_in,
19757            &mut out_out,
19758            coeff_in,
19759            interpolate_in_name.as_ptr(),
19760            interpolate_in,
19761            NULL,
19762        );
19763        utils::result(
19764            vips_op_response,
19765            VipsImage { ctx: out_out },
19766            Error::QuadraticError,
19767        )
19768    }
19769}
19770
19771/// VipsAffine (affine), affine transform of an image
19772/// inp: `&VipsImage` -> Input image argument
19773/// a: `f64` -> Transformation Matrix coefficient
19774/// min: -inf, max: inf, default: 0
19775/// b: `f64` -> Transformation Matrix coefficient
19776/// min: -inf, max: inf, default: 0
19777/// c: `f64` -> Transformation Matrix coefficient
19778/// min: -inf, max: inf, default: 0
19779/// d: `f64` -> Transformation Matrix coefficient
19780/// min: -inf, max: inf, default: 0
19781/// returns `VipsImage` - Output image
19782pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19783    unsafe {
19784        let inp_in: *mut bindings::VipsImage = inp.ctx;
19785        let a_in: f64 = a;
19786        let b_in: f64 = b;
19787        let c_in: f64 = c;
19788        let d_in: f64 = d;
19789        let mut out_out: *mut bindings::VipsImage = null_mut();
19790
19791        let vips_op_response =
19792            bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19793        utils::result(
19794            vips_op_response,
19795            VipsImage { ctx: out_out },
19796            Error::AffineError,
19797        )
19798    }
19799}
19800
19801/// Options for affine operation
19802#[derive(Clone, Debug)]
19803pub struct AffineOptions {
19804    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19805    pub interpolate: VipsInterpolate,
19806    /// oarea: `Vec<i32>` -> Area of output to generate
19807    pub oarea: Vec<i32>,
19808    /// odx: `f64` -> Horizontal output displacement
19809    /// min: -10000000, max: 10000000, default: 0
19810    pub odx: f64,
19811    /// ody: `f64` -> Vertical output displacement
19812    /// min: -10000000, max: 10000000, default: 0
19813    pub ody: f64,
19814    /// idx: `f64` -> Horizontal input displacement
19815    /// min: -10000000, max: 10000000, default: 0
19816    pub idx: f64,
19817    /// idy: `f64` -> Vertical input displacement
19818    /// min: -10000000, max: 10000000, default: 0
19819    pub idy: f64,
19820    /// background: `Vec<f64>` -> Background value
19821    pub background: Vec<f64>,
19822    /// premultiplied: `bool` -> Images have premultiplied alpha
19823    /// default: false
19824    pub premultiplied: bool,
19825    /// extend: `Extend` -> How to generate the extra pixels
19826    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19827    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19828    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19829    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19830    ///  `White` -> VIPS_EXTEND_WHITE = 4
19831    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19832    ///  `Last` -> VIPS_EXTEND_LAST = 6
19833    pub extend: Extend,
19834}
19835
19836impl std::default::Default for AffineOptions {
19837    fn default() -> Self {
19838        AffineOptions {
19839            interpolate: VipsInterpolate::new(),
19840            oarea: Vec::new(),
19841            odx: f64::from(0),
19842            ody: f64::from(0),
19843            idx: f64::from(0),
19844            idy: f64::from(0),
19845            background: Vec::new(),
19846            premultiplied: false,
19847            extend: Extend::Background,
19848        }
19849    }
19850}
19851
19852/// VipsAffine (affine), affine transform of an image
19853/// inp: `&VipsImage` -> Input image argument
19854/// a: `f64` -> Transformation Matrix coefficient
19855/// min: -inf, max: inf, default: 0
19856/// b: `f64` -> Transformation Matrix coefficient
19857/// min: -inf, max: inf, default: 0
19858/// c: `f64` -> Transformation Matrix coefficient
19859/// min: -inf, max: inf, default: 0
19860/// d: `f64` -> Transformation Matrix coefficient
19861/// min: -inf, max: inf, default: 0
19862/// affine_options: `&AffineOptions` -> optional arguments
19863/// returns `VipsImage` - Output image
19864pub fn affine_with_opts(
19865    inp: &VipsImage,
19866    a: f64,
19867    b: f64,
19868    c: f64,
19869    d: f64,
19870    affine_options: &AffineOptions,
19871) -> Result<VipsImage> {
19872    unsafe {
19873        let inp_in: *mut bindings::VipsImage = inp.ctx;
19874        let a_in: f64 = a;
19875        let b_in: f64 = b;
19876        let c_in: f64 = c;
19877        let d_in: f64 = d;
19878        let mut out_out: *mut bindings::VipsImage = null_mut();
19879
19880        let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19881        let interpolate_in_name = utils::new_c_string("interpolate")?;
19882
19883        let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19884        let oarea_in = oarea_wrapper.ctx;
19885        let oarea_in_name = utils::new_c_string("oarea")?;
19886
19887        let odx_in: f64 = affine_options.odx;
19888        let odx_in_name = utils::new_c_string("odx")?;
19889
19890        let ody_in: f64 = affine_options.ody;
19891        let ody_in_name = utils::new_c_string("ody")?;
19892
19893        let idx_in: f64 = affine_options.idx;
19894        let idx_in_name = utils::new_c_string("idx")?;
19895
19896        let idy_in: f64 = affine_options.idy;
19897        let idy_in_name = utils::new_c_string("idy")?;
19898
19899        let background_wrapper =
19900            utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19901        let background_in = background_wrapper.ctx;
19902        let background_in_name = utils::new_c_string("background")?;
19903
19904        let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19905        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19906
19907        let extend_in: i32 = affine_options.extend as i32;
19908        let extend_in_name = utils::new_c_string("extend")?;
19909
19910        let vips_op_response = bindings::vips_affine(
19911            inp_in,
19912            &mut out_out,
19913            a_in,
19914            b_in,
19915            c_in,
19916            d_in,
19917            interpolate_in_name.as_ptr(),
19918            interpolate_in,
19919            oarea_in_name.as_ptr(),
19920            oarea_in,
19921            odx_in_name.as_ptr(),
19922            odx_in,
19923            ody_in_name.as_ptr(),
19924            ody_in,
19925            idx_in_name.as_ptr(),
19926            idx_in,
19927            idy_in_name.as_ptr(),
19928            idy_in,
19929            background_in_name.as_ptr(),
19930            background_in,
19931            premultiplied_in_name.as_ptr(),
19932            premultiplied_in,
19933            extend_in_name.as_ptr(),
19934            extend_in,
19935            NULL,
19936        );
19937        utils::result(
19938            vips_op_response,
19939            VipsImage { ctx: out_out },
19940            Error::AffineError,
19941        )
19942    }
19943}
19944
19945/// VipsSimilarity (similarity), similarity transform of an image
19946/// inp: `&VipsImage` -> Input image argument
19947/// returns `VipsImage` - Output image
19948pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19949    unsafe {
19950        let inp_in: *mut bindings::VipsImage = inp.ctx;
19951        let mut out_out: *mut bindings::VipsImage = null_mut();
19952
19953        let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19954        utils::result(
19955            vips_op_response,
19956            VipsImage { ctx: out_out },
19957            Error::SimilarityError,
19958        )
19959    }
19960}
19961
19962/// Options for similarity operation
19963#[derive(Clone, Debug)]
19964pub struct SimilarityOptions {
19965    /// scale: `f64` -> Scale by this factor
19966    /// min: 0, max: 10000000, default: 1
19967    pub scale: f64,
19968    /// angle: `f64` -> Rotate clockwise by this many degrees
19969    /// min: -10000000, max: 10000000, default: 0
19970    pub angle: f64,
19971    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19972    pub interpolate: VipsInterpolate,
19973    /// background: `Vec<f64>` -> Background value
19974    pub background: Vec<f64>,
19975    /// odx: `f64` -> Horizontal output displacement
19976    /// min: -10000000, max: 10000000, default: 0
19977    pub odx: f64,
19978    /// ody: `f64` -> Vertical output displacement
19979    /// min: -10000000, max: 10000000, default: 0
19980    pub ody: f64,
19981    /// idx: `f64` -> Horizontal input displacement
19982    /// min: -10000000, max: 10000000, default: 0
19983    pub idx: f64,
19984    /// idy: `f64` -> Vertical input displacement
19985    /// min: -10000000, max: 10000000, default: 0
19986    pub idy: f64,
19987}
19988
19989impl std::default::Default for SimilarityOptions {
19990    fn default() -> Self {
19991        SimilarityOptions {
19992            scale: f64::from(1),
19993            angle: f64::from(0),
19994            interpolate: VipsInterpolate::new(),
19995            background: Vec::new(),
19996            odx: f64::from(0),
19997            ody: f64::from(0),
19998            idx: f64::from(0),
19999            idy: f64::from(0),
20000        }
20001    }
20002}
20003
20004/// VipsSimilarity (similarity), similarity transform of an image
20005/// inp: `&VipsImage` -> Input image argument
20006/// similarity_options: `&SimilarityOptions` -> optional arguments
20007/// returns `VipsImage` - Output image
20008pub fn similarity_with_opts(
20009    inp: &VipsImage,
20010    similarity_options: &SimilarityOptions,
20011) -> Result<VipsImage> {
20012    unsafe {
20013        let inp_in: *mut bindings::VipsImage = inp.ctx;
20014        let mut out_out: *mut bindings::VipsImage = null_mut();
20015
20016        let scale_in: f64 = similarity_options.scale;
20017        let scale_in_name = utils::new_c_string("scale")?;
20018
20019        let angle_in: f64 = similarity_options.angle;
20020        let angle_in_name = utils::new_c_string("angle")?;
20021
20022        let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
20023        let interpolate_in_name = utils::new_c_string("interpolate")?;
20024
20025        let background_wrapper =
20026            utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
20027        let background_in = background_wrapper.ctx;
20028        let background_in_name = utils::new_c_string("background")?;
20029
20030        let odx_in: f64 = similarity_options.odx;
20031        let odx_in_name = utils::new_c_string("odx")?;
20032
20033        let ody_in: f64 = similarity_options.ody;
20034        let ody_in_name = utils::new_c_string("ody")?;
20035
20036        let idx_in: f64 = similarity_options.idx;
20037        let idx_in_name = utils::new_c_string("idx")?;
20038
20039        let idy_in: f64 = similarity_options.idy;
20040        let idy_in_name = utils::new_c_string("idy")?;
20041
20042        let vips_op_response = bindings::vips_similarity(
20043            inp_in,
20044            &mut out_out,
20045            scale_in_name.as_ptr(),
20046            scale_in,
20047            angle_in_name.as_ptr(),
20048            angle_in,
20049            interpolate_in_name.as_ptr(),
20050            interpolate_in,
20051            background_in_name.as_ptr(),
20052            background_in,
20053            odx_in_name.as_ptr(),
20054            odx_in,
20055            ody_in_name.as_ptr(),
20056            ody_in,
20057            idx_in_name.as_ptr(),
20058            idx_in,
20059            idy_in_name.as_ptr(),
20060            idy_in,
20061            NULL,
20062        );
20063        utils::result(
20064            vips_op_response,
20065            VipsImage { ctx: out_out },
20066            Error::SimilarityError,
20067        )
20068    }
20069}
20070
20071/// VipsRotate (rotate), rotate an image by a number of degrees
20072/// inp: `&VipsImage` -> Input image argument
20073/// angle: `f64` -> Rotate clockwise by this many degrees
20074/// min: -10000000, max: 10000000, default: 0
20075/// returns `VipsImage` - Output image
20076pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
20077    unsafe {
20078        let inp_in: *mut bindings::VipsImage = inp.ctx;
20079        let angle_in: f64 = angle;
20080        let mut out_out: *mut bindings::VipsImage = null_mut();
20081
20082        let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
20083        utils::result(
20084            vips_op_response,
20085            VipsImage { ctx: out_out },
20086            Error::RotateError,
20087        )
20088    }
20089}
20090
20091/// Options for rotate operation
20092#[derive(Clone, Debug)]
20093pub struct RotateOptions {
20094    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
20095    pub interpolate: VipsInterpolate,
20096    /// background: `Vec<f64>` -> Background value
20097    pub background: Vec<f64>,
20098    /// odx: `f64` -> Horizontal output displacement
20099    /// min: -10000000, max: 10000000, default: 0
20100    pub odx: f64,
20101    /// ody: `f64` -> Vertical output displacement
20102    /// min: -10000000, max: 10000000, default: 0
20103    pub ody: f64,
20104    /// idx: `f64` -> Horizontal input displacement
20105    /// min: -10000000, max: 10000000, default: 0
20106    pub idx: f64,
20107    /// idy: `f64` -> Vertical input displacement
20108    /// min: -10000000, max: 10000000, default: 0
20109    pub idy: f64,
20110}
20111
20112impl std::default::Default for RotateOptions {
20113    fn default() -> Self {
20114        RotateOptions {
20115            interpolate: VipsInterpolate::new(),
20116            background: Vec::new(),
20117            odx: f64::from(0),
20118            ody: f64::from(0),
20119            idx: f64::from(0),
20120            idy: f64::from(0),
20121        }
20122    }
20123}
20124
20125/// VipsRotate (rotate), rotate an image by a number of degrees
20126/// inp: `&VipsImage` -> Input image argument
20127/// angle: `f64` -> Rotate clockwise by this many degrees
20128/// min: -10000000, max: 10000000, default: 0
20129/// rotate_options: `&RotateOptions` -> optional arguments
20130/// returns `VipsImage` - Output image
20131pub fn rotate_with_opts(
20132    inp: &VipsImage,
20133    angle: f64,
20134    rotate_options: &RotateOptions,
20135) -> Result<VipsImage> {
20136    unsafe {
20137        let inp_in: *mut bindings::VipsImage = inp.ctx;
20138        let angle_in: f64 = angle;
20139        let mut out_out: *mut bindings::VipsImage = null_mut();
20140
20141        let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
20142        let interpolate_in_name = utils::new_c_string("interpolate")?;
20143
20144        let background_wrapper =
20145            utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
20146        let background_in = background_wrapper.ctx;
20147        let background_in_name = utils::new_c_string("background")?;
20148
20149        let odx_in: f64 = rotate_options.odx;
20150        let odx_in_name = utils::new_c_string("odx")?;
20151
20152        let ody_in: f64 = rotate_options.ody;
20153        let ody_in_name = utils::new_c_string("ody")?;
20154
20155        let idx_in: f64 = rotate_options.idx;
20156        let idx_in_name = utils::new_c_string("idx")?;
20157
20158        let idy_in: f64 = rotate_options.idy;
20159        let idy_in_name = utils::new_c_string("idy")?;
20160
20161        let vips_op_response = bindings::vips_rotate(
20162            inp_in,
20163            &mut out_out,
20164            angle_in,
20165            interpolate_in_name.as_ptr(),
20166            interpolate_in,
20167            background_in_name.as_ptr(),
20168            background_in,
20169            odx_in_name.as_ptr(),
20170            odx_in,
20171            ody_in_name.as_ptr(),
20172            ody_in,
20173            idx_in_name.as_ptr(),
20174            idx_in,
20175            idy_in_name.as_ptr(),
20176            idy_in,
20177            NULL,
20178        );
20179        utils::result(
20180            vips_op_response,
20181            VipsImage { ctx: out_out },
20182            Error::RotateError,
20183        )
20184    }
20185}
20186
20187/// VipsResize (resize), resize an image
20188/// inp: `&VipsImage` -> Input image argument
20189/// scale: `f64` -> Scale image by this factor
20190/// min: 0, max: 10000000, default: 0
20191/// returns `VipsImage` - Output image
20192pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
20193    unsafe {
20194        let inp_in: *mut bindings::VipsImage = inp.ctx;
20195        let scale_in: f64 = scale;
20196        let mut out_out: *mut bindings::VipsImage = null_mut();
20197
20198        let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
20199        utils::result(
20200            vips_op_response,
20201            VipsImage { ctx: out_out },
20202            Error::ResizeError,
20203        )
20204    }
20205}
20206
20207/// Options for resize operation
20208#[derive(Clone, Debug)]
20209pub struct ResizeOptions {
20210    /// kernel: `Kernel` -> Resampling kernel
20211    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
20212    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
20213    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
20214    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
20215    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
20216    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
20217    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
20218    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
20219    ///  `Last` -> VIPS_KERNEL_LAST = 8
20220    pub kernel: Kernel,
20221    /// gap: `f64` -> Reducing gap
20222    /// min: 0, max: 1000000, default: 2
20223    pub gap: f64,
20224    /// vscale: `f64` -> Vertical scale image by this factor
20225    /// min: 0, max: 10000000, default: 0
20226    pub vscale: f64,
20227}
20228
20229impl std::default::Default for ResizeOptions {
20230    fn default() -> Self {
20231        ResizeOptions {
20232            kernel: Kernel::Lanczos3,
20233            gap: f64::from(2),
20234            vscale: f64::from(0),
20235        }
20236    }
20237}
20238
20239/// VipsResize (resize), resize an image
20240/// inp: `&VipsImage` -> Input image argument
20241/// scale: `f64` -> Scale image by this factor
20242/// min: 0, max: 10000000, default: 0
20243/// resize_options: `&ResizeOptions` -> optional arguments
20244/// returns `VipsImage` - Output image
20245pub fn resize_with_opts(
20246    inp: &VipsImage,
20247    scale: f64,
20248    resize_options: &ResizeOptions,
20249) -> Result<VipsImage> {
20250    unsafe {
20251        let inp_in: *mut bindings::VipsImage = inp.ctx;
20252        let scale_in: f64 = scale;
20253        let mut out_out: *mut bindings::VipsImage = null_mut();
20254
20255        let kernel_in: i32 = resize_options.kernel as i32;
20256        let kernel_in_name = utils::new_c_string("kernel")?;
20257
20258        let gap_in: f64 = resize_options.gap;
20259        let gap_in_name = utils::new_c_string("gap")?;
20260
20261        let vscale_in: f64 = resize_options.vscale;
20262        let vscale_in_name = utils::new_c_string("vscale")?;
20263
20264        let vips_op_response = bindings::vips_resize(
20265            inp_in,
20266            &mut out_out,
20267            scale_in,
20268            kernel_in_name.as_ptr(),
20269            kernel_in,
20270            gap_in_name.as_ptr(),
20271            gap_in,
20272            vscale_in_name.as_ptr(),
20273            vscale_in,
20274            NULL,
20275        );
20276        utils::result(
20277            vips_op_response,
20278            VipsImage { ctx: out_out },
20279            Error::ResizeError,
20280        )
20281    }
20282}
20283
20284/// VipsColourspace (colourspace), convert to a new colorspace
20285/// inp: `&VipsImage` -> Input image
20286/// space: `Interpretation` -> Destination color space
20287///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20288///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20289///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20290///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20291///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20292///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20293///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20294///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20295///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20296///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20297///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20298///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20299///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20300///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20301///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20302///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20303///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20304///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20305///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20306///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20307///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20308/// returns `VipsImage` - Output image
20309pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
20310    unsafe {
20311        let inp_in: *mut bindings::VipsImage = inp.ctx;
20312        let space_in: i32 = space as i32;
20313        let mut out_out: *mut bindings::VipsImage = null_mut();
20314
20315        let vips_op_response =
20316            bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
20317        utils::result(
20318            vips_op_response,
20319            VipsImage { ctx: out_out },
20320            Error::ColourspaceError,
20321        )
20322    }
20323}
20324
20325/// Options for colourspace operation
20326#[derive(Clone, Debug)]
20327pub struct ColourspaceOptions {
20328    /// source_space: `Interpretation` -> Source color space
20329    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20330    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20331    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20332    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20333    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20334    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20335    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20336    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20337    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20338    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20339    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20340    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20341    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20342    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20343    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20344    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20345    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20346    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20347    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20348    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20349    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20350    pub source_space: Interpretation,
20351}
20352
20353impl std::default::Default for ColourspaceOptions {
20354    fn default() -> Self {
20355        ColourspaceOptions {
20356            source_space: Interpretation::Srgb,
20357        }
20358    }
20359}
20360
20361/// VipsColourspace (colourspace), convert to a new colorspace
20362/// inp: `&VipsImage` -> Input image
20363/// space: `Interpretation` -> Destination color space
20364///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20365///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20366///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20367///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20368///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20369///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20370///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20371///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20372///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20373///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20374///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20375///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20376///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20377///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20378///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20379///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20380///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20381///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20382///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20383///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20384///  `Last` -> VIPS_INTERPRETATION_LAST = 30
20385/// colourspace_options: `&ColourspaceOptions` -> optional arguments
20386/// returns `VipsImage` - Output image
20387pub fn colourspace_with_opts(
20388    inp: &VipsImage,
20389    space: Interpretation,
20390    colourspace_options: &ColourspaceOptions,
20391) -> Result<VipsImage> {
20392    unsafe {
20393        let inp_in: *mut bindings::VipsImage = inp.ctx;
20394        let space_in: i32 = space as i32;
20395        let mut out_out: *mut bindings::VipsImage = null_mut();
20396
20397        let source_space_in: i32 = colourspace_options.source_space as i32;
20398        let source_space_in_name = utils::new_c_string("source-space")?;
20399
20400        let vips_op_response = bindings::vips_colourspace(
20401            inp_in,
20402            &mut out_out,
20403            space_in.try_into().unwrap(),
20404            source_space_in_name.as_ptr(),
20405            source_space_in,
20406            NULL,
20407        );
20408        utils::result(
20409            vips_op_response,
20410            VipsImage { ctx: out_out },
20411            Error::ColourspaceError,
20412        )
20413    }
20414}
20415
20416/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20417/// inp: `&VipsImage` -> Input image
20418/// returns `VipsImage` - Output image
20419pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20420    unsafe {
20421        let inp_in: *mut bindings::VipsImage = inp.ctx;
20422        let mut out_out: *mut bindings::VipsImage = null_mut();
20423
20424        let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
20425        utils::result(
20426            vips_op_response,
20427            VipsImage { ctx: out_out },
20428            Error::Lab2XyzError,
20429        )
20430    }
20431}
20432
20433/// Options for lab_2xyz operation
20434#[derive(Clone, Debug)]
20435pub struct Lab2XyzOptions {
20436    /// temp: `Vec<f64>` -> Color temperature
20437    pub temp: Vec<f64>,
20438}
20439
20440impl std::default::Default for Lab2XyzOptions {
20441    fn default() -> Self {
20442        Lab2XyzOptions { temp: Vec::new() }
20443    }
20444}
20445
20446/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20447/// inp: `&VipsImage` -> Input image
20448/// lab_2xyz_options: `&Lab2XyzOptions` -> optional arguments
20449/// returns `VipsImage` - Output image
20450pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> 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 temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
20456        let temp_in = temp_wrapper.ctx;
20457        let temp_in_name = utils::new_c_string("temp")?;
20458
20459        let vips_op_response =
20460            bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20461        utils::result(
20462            vips_op_response,
20463            VipsImage { ctx: out_out },
20464            Error::Lab2XyzError,
20465        )
20466    }
20467}
20468
20469/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20470/// inp: `&VipsImage` -> Input image
20471/// returns `VipsImage` - Output image
20472pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
20473    unsafe {
20474        let inp_in: *mut bindings::VipsImage = inp.ctx;
20475        let mut out_out: *mut bindings::VipsImage = null_mut();
20476
20477        let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
20478        utils::result(
20479            vips_op_response,
20480            VipsImage { ctx: out_out },
20481            Error::Xyz2LabError,
20482        )
20483    }
20484}
20485
20486/// Options for xyz2_lab operation
20487#[derive(Clone, Debug)]
20488pub struct Xyz2LabOptions {
20489    /// temp: `Vec<f64>` -> Colour temperature
20490    pub temp: Vec<f64>,
20491}
20492
20493impl std::default::Default for Xyz2LabOptions {
20494    fn default() -> Self {
20495        Xyz2LabOptions { temp: Vec::new() }
20496    }
20497}
20498
20499/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20500/// inp: `&VipsImage` -> Input image
20501/// xyz2_lab_options: `&Xyz2LabOptions` -> optional arguments
20502/// returns `VipsImage` - Output image
20503pub fn xyz2_lab_with_opts(
20504    inp: &VipsImage,
20505    xyz_2_lab_options: &Xyz2LabOptions,
20506) -> Result<VipsImage> {
20507    unsafe {
20508        let inp_in: *mut bindings::VipsImage = inp.ctx;
20509        let mut out_out: *mut bindings::VipsImage = null_mut();
20510
20511        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
20512        let temp_in = temp_wrapper.ctx;
20513        let temp_in_name = utils::new_c_string("temp")?;
20514
20515        let vips_op_response =
20516            bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20517        utils::result(
20518            vips_op_response,
20519            VipsImage { ctx: out_out },
20520            Error::Xyz2LabError,
20521        )
20522    }
20523}
20524
20525/// VipsLab2LCh (Lab2LCh), transform Lab to LCh
20526/// inp: `&VipsImage` -> Input image
20527/// returns `VipsImage` - Output image
20528pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20529    unsafe {
20530        let inp_in: *mut bindings::VipsImage = inp.ctx;
20531        let mut out_out: *mut bindings::VipsImage = null_mut();
20532
20533        let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
20534        utils::result(
20535            vips_op_response,
20536            VipsImage { ctx: out_out },
20537            Error::Lab2LChError,
20538        )
20539    }
20540}
20541
20542/// VipsLCh2Lab (LCh2Lab), transform LCh to Lab
20543/// inp: `&VipsImage` -> Input image
20544/// returns `VipsImage` - Output image
20545pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
20546    unsafe {
20547        let inp_in: *mut bindings::VipsImage = inp.ctx;
20548        let mut out_out: *mut bindings::VipsImage = null_mut();
20549
20550        let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
20551        utils::result(
20552            vips_op_response,
20553            VipsImage { ctx: out_out },
20554            Error::LCh2LabError,
20555        )
20556    }
20557}
20558
20559/// VipsLCh2CMC (LCh2CMC), transform LCh to CMC
20560/// inp: `&VipsImage` -> Input image
20561/// returns `VipsImage` - Output image
20562pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
20563    unsafe {
20564        let inp_in: *mut bindings::VipsImage = inp.ctx;
20565        let mut out_out: *mut bindings::VipsImage = null_mut();
20566
20567        let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
20568        utils::result(
20569            vips_op_response,
20570            VipsImage { ctx: out_out },
20571            Error::LCh2CmcError,
20572        )
20573    }
20574}
20575
20576/// VipsCMC2LCh (CMC2LCh), transform LCh to CMC
20577/// inp: `&VipsImage` -> Input image
20578/// returns `VipsImage` - Output image
20579pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20580    unsafe {
20581        let inp_in: *mut bindings::VipsImage = inp.ctx;
20582        let mut out_out: *mut bindings::VipsImage = null_mut();
20583
20584        let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
20585        utils::result(
20586            vips_op_response,
20587            VipsImage { ctx: out_out },
20588            Error::Cmc2LChError,
20589        )
20590    }
20591}
20592
20593/// VipsXYZ2Yxy (XYZ2Yxy), transform XYZ to Yxy
20594/// inp: `&VipsImage` -> Input image
20595/// returns `VipsImage` - Output image
20596pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
20597    unsafe {
20598        let inp_in: *mut bindings::VipsImage = inp.ctx;
20599        let mut out_out: *mut bindings::VipsImage = null_mut();
20600
20601        let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
20602        utils::result(
20603            vips_op_response,
20604            VipsImage { ctx: out_out },
20605            Error::Xyz2YxyError,
20606        )
20607    }
20608}
20609
20610/// VipsYxy2XYZ (Yxy2XYZ), transform Yxy to XYZ
20611/// inp: `&VipsImage` -> Input image
20612/// returns `VipsImage` - Output image
20613pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20614    unsafe {
20615        let inp_in: *mut bindings::VipsImage = inp.ctx;
20616        let mut out_out: *mut bindings::VipsImage = null_mut();
20617
20618        let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
20619        utils::result(
20620            vips_op_response,
20621            VipsImage { ctx: out_out },
20622            Error::Yxy2XyzError,
20623        )
20624    }
20625}
20626
20627/// VipsscRGB2XYZ (scRGB2XYZ), transform scRGB to XYZ
20628/// inp: `&VipsImage` -> Input image
20629/// returns `VipsImage` - Output image
20630pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20631    unsafe {
20632        let inp_in: *mut bindings::VipsImage = inp.ctx;
20633        let mut out_out: *mut bindings::VipsImage = null_mut();
20634
20635        let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20636        utils::result(
20637            vips_op_response,
20638            VipsImage { ctx: out_out },
20639            Error::ScRgb2XyzError,
20640        )
20641    }
20642}
20643
20644/// VipsXYZ2scRGB (XYZ2scRGB), transform XYZ to scRGB
20645/// inp: `&VipsImage` -> Input image
20646/// returns `VipsImage` - Output image
20647pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20648    unsafe {
20649        let inp_in: *mut bindings::VipsImage = inp.ctx;
20650        let mut out_out: *mut bindings::VipsImage = null_mut();
20651
20652        let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
20653        utils::result(
20654            vips_op_response,
20655            VipsImage { ctx: out_out },
20656            Error::Xyz2ScRgbError,
20657        )
20658    }
20659}
20660
20661/// VipsLabQ2Lab (LabQ2Lab), unpack a LabQ image to float Lab
20662/// inp: `&VipsImage` -> Input image
20663/// returns `VipsImage` - Output image
20664pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
20665    unsafe {
20666        let inp_in: *mut bindings::VipsImage = inp.ctx;
20667        let mut out_out: *mut bindings::VipsImage = null_mut();
20668
20669        let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
20670        utils::result(
20671            vips_op_response,
20672            VipsImage { ctx: out_out },
20673            Error::LabQ2LabError,
20674        )
20675    }
20676}
20677
20678/// VipsLab2LabQ (Lab2LabQ), transform float Lab to LabQ coding
20679/// inp: `&VipsImage` -> Input image
20680/// returns `VipsImage` - Output image
20681pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20682    unsafe {
20683        let inp_in: *mut bindings::VipsImage = inp.ctx;
20684        let mut out_out: *mut bindings::VipsImage = null_mut();
20685
20686        let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20687        utils::result(
20688            vips_op_response,
20689            VipsImage { ctx: out_out },
20690            Error::Lab2LabQError,
20691        )
20692    }
20693}
20694
20695/// VipsLabQ2LabS (LabQ2LabS), unpack a LabQ image to short Lab
20696/// inp: `&VipsImage` -> Input image
20697/// returns `VipsImage` - Output image
20698pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20699    unsafe {
20700        let inp_in: *mut bindings::VipsImage = inp.ctx;
20701        let mut out_out: *mut bindings::VipsImage = null_mut();
20702
20703        let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20704        utils::result(
20705            vips_op_response,
20706            VipsImage { ctx: out_out },
20707            Error::LabQ2LabSError,
20708        )
20709    }
20710}
20711
20712/// VipsLabS2LabQ (LabS2LabQ), transform short Lab to LabQ coding
20713/// inp: `&VipsImage` -> Input image
20714/// returns `VipsImage` - Output image
20715pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20716    unsafe {
20717        let inp_in: *mut bindings::VipsImage = inp.ctx;
20718        let mut out_out: *mut bindings::VipsImage = null_mut();
20719
20720        let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20721        utils::result(
20722            vips_op_response,
20723            VipsImage { ctx: out_out },
20724            Error::LabS2LabQError,
20725        )
20726    }
20727}
20728
20729/// VipsLabS2Lab (LabS2Lab), transform signed short Lab to float
20730/// inp: `&VipsImage` -> Input image
20731/// returns `VipsImage` - Output image
20732pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20733    unsafe {
20734        let inp_in: *mut bindings::VipsImage = inp.ctx;
20735        let mut out_out: *mut bindings::VipsImage = null_mut();
20736
20737        let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20738        utils::result(
20739            vips_op_response,
20740            VipsImage { ctx: out_out },
20741            Error::LabS2LabError,
20742        )
20743    }
20744}
20745
20746/// VipsLab2LabS (Lab2LabS), transform float Lab to signed short
20747/// inp: `&VipsImage` -> Input image
20748/// returns `VipsImage` - Output image
20749pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20750    unsafe {
20751        let inp_in: *mut bindings::VipsImage = inp.ctx;
20752        let mut out_out: *mut bindings::VipsImage = null_mut();
20753
20754        let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20755        utils::result(
20756            vips_op_response,
20757            VipsImage { ctx: out_out },
20758            Error::Lab2LabSError,
20759        )
20760    }
20761}
20762
20763/// VipsRad2float (rad2float), unpack Radiance coding to float RGB
20764/// inp: `&VipsImage` -> Input image
20765/// returns `VipsImage` - Output image
20766pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20767    unsafe {
20768        let inp_in: *mut bindings::VipsImage = inp.ctx;
20769        let mut out_out: *mut bindings::VipsImage = null_mut();
20770
20771        let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20772        utils::result(
20773            vips_op_response,
20774            VipsImage { ctx: out_out },
20775            Error::Rad2FloatError,
20776        )
20777    }
20778}
20779
20780/// VipsFloat2rad (float2rad), transform float RGB to Radiance coding
20781/// inp: `&VipsImage` -> Input image
20782/// returns `VipsImage` - Output image
20783pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20784    unsafe {
20785        let inp_in: *mut bindings::VipsImage = inp.ctx;
20786        let mut out_out: *mut bindings::VipsImage = null_mut();
20787
20788        let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20789        utils::result(
20790            vips_op_response,
20791            VipsImage { ctx: out_out },
20792            Error::Float2RadError,
20793        )
20794    }
20795}
20796
20797/// VipsLabQ2sRGB (LabQ2sRGB), convert a LabQ image to sRGB
20798/// inp: `&VipsImage` -> Input image
20799/// returns `VipsImage` - Output image
20800pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20801    unsafe {
20802        let inp_in: *mut bindings::VipsImage = inp.ctx;
20803        let mut out_out: *mut bindings::VipsImage = null_mut();
20804
20805        let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20806        utils::result(
20807            vips_op_response,
20808            VipsImage { ctx: out_out },
20809            Error::LabQ2SRgbError,
20810        )
20811    }
20812}
20813
20814/// VipssRGB2scRGB (sRGB2scRGB), convert an sRGB image to scRGB
20815/// inp: `&VipsImage` -> Input image
20816/// returns `VipsImage` - Output image
20817pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20818    unsafe {
20819        let inp_in: *mut bindings::VipsImage = inp.ctx;
20820        let mut out_out: *mut bindings::VipsImage = null_mut();
20821
20822        let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20823        utils::result(
20824            vips_op_response,
20825            VipsImage { ctx: out_out },
20826            Error::SRgb2ScRgbError,
20827        )
20828    }
20829}
20830
20831/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20832/// inp: `&VipsImage` -> Input image
20833/// returns `VipsImage` - Output image
20834pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
20835    unsafe {
20836        let inp_in: *mut bindings::VipsImage = inp.ctx;
20837        let mut out_out: *mut bindings::VipsImage = null_mut();
20838
20839        let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
20840        utils::result(
20841            vips_op_response,
20842            VipsImage { ctx: out_out },
20843            Error::ScRgb2BwError,
20844        )
20845    }
20846}
20847
20848/// Options for sc_rgb2bw operation
20849#[derive(Clone, Debug)]
20850pub struct ScRgb2BwOptions {
20851    /// depth: `i32` -> Output device space depth in bits
20852    /// min: 8, max: 16, default: 8
20853    pub depth: i32,
20854}
20855
20856impl std::default::Default for ScRgb2BwOptions {
20857    fn default() -> Self {
20858        ScRgb2BwOptions {
20859            depth: i32::from(8),
20860        }
20861    }
20862}
20863
20864/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20865/// inp: `&VipsImage` -> Input image
20866/// sc_rgb2bw_options: `&ScRgb2BwOptions` -> optional arguments
20867/// returns `VipsImage` - Output image
20868pub fn sc_rgb2bw_with_opts(
20869    inp: &VipsImage,
20870    sc_rgb_2bw_options: &ScRgb2BwOptions,
20871) -> Result<VipsImage> {
20872    unsafe {
20873        let inp_in: *mut bindings::VipsImage = inp.ctx;
20874        let mut out_out: *mut bindings::VipsImage = null_mut();
20875
20876        let depth_in: i32 = sc_rgb_2bw_options.depth;
20877        let depth_in_name = utils::new_c_string("depth")?;
20878
20879        let vips_op_response =
20880            bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20881        utils::result(
20882            vips_op_response,
20883            VipsImage { ctx: out_out },
20884            Error::ScRgb2BwError,
20885        )
20886    }
20887}
20888
20889/// VipssRGB2HSV (sRGB2HSV), transform sRGB to HSV
20890/// inp: `&VipsImage` -> Input image
20891/// returns `VipsImage` - Output image
20892pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20893    unsafe {
20894        let inp_in: *mut bindings::VipsImage = inp.ctx;
20895        let mut out_out: *mut bindings::VipsImage = null_mut();
20896
20897        let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20898        utils::result(
20899            vips_op_response,
20900            VipsImage { ctx: out_out },
20901            Error::SRgb2HsvError,
20902        )
20903    }
20904}
20905
20906/// VipsHSV2sRGB (HSV2sRGB), transform HSV to sRGB
20907/// inp: `&VipsImage` -> Input image
20908/// returns `VipsImage` - Output image
20909pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20910    unsafe {
20911        let inp_in: *mut bindings::VipsImage = inp.ctx;
20912        let mut out_out: *mut bindings::VipsImage = null_mut();
20913
20914        let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20915        utils::result(
20916            vips_op_response,
20917            VipsImage { ctx: out_out },
20918            Error::Hsv2SRgbError,
20919        )
20920    }
20921}
20922
20923/// VipsscRGB2sRGB (scRGB2sRGB), convert scRGB to sRGB
20924/// inp: `&VipsImage` -> Input image
20925/// returns `VipsImage` - Output image
20926pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20927    unsafe {
20928        let inp_in: *mut bindings::VipsImage = inp.ctx;
20929        let mut out_out: *mut bindings::VipsImage = null_mut();
20930
20931        let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
20932        utils::result(
20933            vips_op_response,
20934            VipsImage { ctx: out_out },
20935            Error::ScRgb2SRgbError,
20936        )
20937    }
20938}
20939
20940/// Options for sc_rgb_2s_rgb operation
20941#[derive(Clone, Debug)]
20942pub struct ScRgb2SRgbOptions {
20943    /// depth: `i32` -> Output device space depth in bits
20944    /// min: 8, max: 16, default: 8
20945    pub depth: i32,
20946}
20947
20948impl std::default::Default for ScRgb2SRgbOptions {
20949    fn default() -> Self {
20950        ScRgb2SRgbOptions {
20951            depth: i32::from(8),
20952        }
20953    }
20954}
20955
20956/// VipsscRGB2sRGB (scRGB2sRGB), convert scRGB to sRGB
20957/// inp: `&VipsImage` -> Input image
20958/// sc_rgb_2s_rgb_options: `&ScRgb2SRgbOptions` -> optional arguments
20959/// returns `VipsImage` - Output image
20960pub fn sc_rgb_2s_rgb_with_opts(
20961    inp: &VipsImage,
20962    sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
20963) -> Result<VipsImage> {
20964    unsafe {
20965        let inp_in: *mut bindings::VipsImage = inp.ctx;
20966        let mut out_out: *mut bindings::VipsImage = null_mut();
20967
20968        let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
20969        let depth_in_name = utils::new_c_string("depth")?;
20970
20971        let vips_op_response =
20972            bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20973        utils::result(
20974            vips_op_response,
20975            VipsImage { ctx: out_out },
20976            Error::ScRgb2SRgbError,
20977        )
20978    }
20979}
20980
20981/// VipsIccImport (icc_import), import from device with ICC profile
20982/// inp: `&VipsImage` -> Input image
20983/// returns `VipsImage` - Output image
20984pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20985    unsafe {
20986        let inp_in: *mut bindings::VipsImage = inp.ctx;
20987        let mut out_out: *mut bindings::VipsImage = null_mut();
20988
20989        let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20990        utils::result(
20991            vips_op_response,
20992            VipsImage { ctx: out_out },
20993            Error::IccImportError,
20994        )
20995    }
20996}
20997
20998/// Options for icc_import operation
20999#[derive(Clone, Debug)]
21000pub struct IccImportOptions {
21001    /// pcs: `PCS` -> Set Profile Connection Space
21002    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
21003    ///  `Xyz` -> VIPS_PCS_XYZ = 1
21004    ///  `Last` -> VIPS_PCS_LAST = 2
21005    pub pcs: PCS,
21006    /// intent: `Intent` -> Rendering intent
21007    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
21008    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
21009    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
21010    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
21011    ///  `Auto` -> VIPS_INTENT_AUTO = 32
21012    ///  `Last` -> VIPS_INTENT_LAST = 33
21013    pub intent: Intent,
21014    /// black_point_compensation: `bool` -> Enable black point compensation
21015    /// default: false
21016    pub black_point_compensation: bool,
21017    /// embedded: `bool` -> Use embedded input profile, if available
21018    /// default: false
21019    pub embedded: bool,
21020    /// input_profile: `String` -> Filename to load input profile from
21021    pub input_profile: String,
21022}
21023
21024impl std::default::Default for IccImportOptions {
21025    fn default() -> Self {
21026        IccImportOptions {
21027            pcs: PCS::Lab,
21028            intent: Intent::Relative,
21029            black_point_compensation: false,
21030            embedded: false,
21031            input_profile: String::new(),
21032        }
21033    }
21034}
21035
21036/// VipsIccImport (icc_import), import from device with ICC profile
21037/// inp: `&VipsImage` -> Input image
21038/// icc_import_options: `&IccImportOptions` -> optional arguments
21039/// returns `VipsImage` - Output image
21040pub fn icc_import_with_opts(
21041    inp: &VipsImage,
21042    icc_import_options: &IccImportOptions,
21043) -> Result<VipsImage> {
21044    unsafe {
21045        let inp_in: *mut bindings::VipsImage = inp.ctx;
21046        let mut out_out: *mut bindings::VipsImage = null_mut();
21047
21048        let pcs_in: i32 = icc_import_options.pcs as i32;
21049        let pcs_in_name = utils::new_c_string("pcs")?;
21050
21051        let intent_in: i32 = icc_import_options.intent as i32;
21052        let intent_in_name = utils::new_c_string("intent")?;
21053
21054        let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
21055            1
21056        } else {
21057            0
21058        };
21059        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21060
21061        let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
21062        let embedded_in_name = utils::new_c_string("embedded")?;
21063
21064        let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
21065        let input_profile_in_name = utils::new_c_string("input-profile")?;
21066
21067        let vips_op_response = bindings::vips_icc_import(
21068            inp_in,
21069            &mut out_out,
21070            pcs_in_name.as_ptr(),
21071            pcs_in,
21072            intent_in_name.as_ptr(),
21073            intent_in,
21074            black_point_compensation_in_name.as_ptr(),
21075            black_point_compensation_in,
21076            embedded_in_name.as_ptr(),
21077            embedded_in,
21078            input_profile_in_name.as_ptr(),
21079            input_profile_in.as_ptr(),
21080            NULL,
21081        );
21082        utils::result(
21083            vips_op_response,
21084            VipsImage { ctx: out_out },
21085            Error::IccImportError,
21086        )
21087    }
21088}
21089
21090/// VipsIccExport (icc_export), output to device with ICC profile
21091/// inp: `&VipsImage` -> Input image
21092/// returns `VipsImage` - Output image
21093pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
21094    unsafe {
21095        let inp_in: *mut bindings::VipsImage = inp.ctx;
21096        let mut out_out: *mut bindings::VipsImage = null_mut();
21097
21098        let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
21099        utils::result(
21100            vips_op_response,
21101            VipsImage { ctx: out_out },
21102            Error::IccExportError,
21103        )
21104    }
21105}
21106
21107/// Options for icc_export operation
21108#[derive(Clone, Debug)]
21109pub struct IccExportOptions {
21110    /// pcs: `PCS` -> Set Profile Connection Space
21111    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
21112    ///  `Xyz` -> VIPS_PCS_XYZ = 1
21113    ///  `Last` -> VIPS_PCS_LAST = 2
21114    pub pcs: PCS,
21115    /// intent: `Intent` -> Rendering intent
21116    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
21117    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
21118    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
21119    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
21120    ///  `Auto` -> VIPS_INTENT_AUTO = 32
21121    ///  `Last` -> VIPS_INTENT_LAST = 33
21122    pub intent: Intent,
21123    /// black_point_compensation: `bool` -> Enable black point compensation
21124    /// default: false
21125    pub black_point_compensation: bool,
21126    /// output_profile: `String` -> Filename to load output profile from
21127    pub output_profile: String,
21128    /// depth: `i32` -> Output device space depth in bits
21129    /// min: 8, max: 16, default: 8
21130    pub depth: i32,
21131}
21132
21133impl std::default::Default for IccExportOptions {
21134    fn default() -> Self {
21135        IccExportOptions {
21136            pcs: PCS::Lab,
21137            intent: Intent::Relative,
21138            black_point_compensation: false,
21139            output_profile: String::new(),
21140            depth: i32::from(8),
21141        }
21142    }
21143}
21144
21145/// VipsIccExport (icc_export), output to device with ICC profile
21146/// inp: `&VipsImage` -> Input image
21147/// icc_export_options: `&IccExportOptions` -> optional arguments
21148/// returns `VipsImage` - Output image
21149pub fn icc_export_with_opts(
21150    inp: &VipsImage,
21151    icc_export_options: &IccExportOptions,
21152) -> Result<VipsImage> {
21153    unsafe {
21154        let inp_in: *mut bindings::VipsImage = inp.ctx;
21155        let mut out_out: *mut bindings::VipsImage = null_mut();
21156
21157        let pcs_in: i32 = icc_export_options.pcs as i32;
21158        let pcs_in_name = utils::new_c_string("pcs")?;
21159
21160        let intent_in: i32 = icc_export_options.intent as i32;
21161        let intent_in_name = utils::new_c_string("intent")?;
21162
21163        let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
21164            1
21165        } else {
21166            0
21167        };
21168        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21169
21170        let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
21171        let output_profile_in_name = utils::new_c_string("output-profile")?;
21172
21173        let depth_in: i32 = icc_export_options.depth;
21174        let depth_in_name = utils::new_c_string("depth")?;
21175
21176        let vips_op_response = bindings::vips_icc_export(
21177            inp_in,
21178            &mut out_out,
21179            pcs_in_name.as_ptr(),
21180            pcs_in,
21181            intent_in_name.as_ptr(),
21182            intent_in,
21183            black_point_compensation_in_name.as_ptr(),
21184            black_point_compensation_in,
21185            output_profile_in_name.as_ptr(),
21186            output_profile_in.as_ptr(),
21187            depth_in_name.as_ptr(),
21188            depth_in,
21189            NULL,
21190        );
21191        utils::result(
21192            vips_op_response,
21193            VipsImage { ctx: out_out },
21194            Error::IccExportError,
21195        )
21196    }
21197}
21198
21199/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
21200/// inp: `&VipsImage` -> Input image
21201/// output_profile: `&str` -> Filename to load output profile from
21202/// returns `VipsImage` - Output image
21203pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
21204    unsafe {
21205        let inp_in: *mut bindings::VipsImage = inp.ctx;
21206        let output_profile_in: CString = utils::new_c_string(output_profile)?;
21207        let mut out_out: *mut bindings::VipsImage = null_mut();
21208
21209        let vips_op_response =
21210            bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
21211        utils::result(
21212            vips_op_response,
21213            VipsImage { ctx: out_out },
21214            Error::IccTransformError,
21215        )
21216    }
21217}
21218
21219/// Options for icc_transform operation
21220#[derive(Clone, Debug)]
21221pub struct IccTransformOptions {
21222    /// pcs: `PCS` -> Set Profile Connection Space
21223    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
21224    ///  `Xyz` -> VIPS_PCS_XYZ = 1
21225    ///  `Last` -> VIPS_PCS_LAST = 2
21226    pub pcs: PCS,
21227    /// intent: `Intent` -> Rendering intent
21228    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
21229    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
21230    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
21231    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
21232    ///  `Auto` -> VIPS_INTENT_AUTO = 32
21233    ///  `Last` -> VIPS_INTENT_LAST = 33
21234    pub intent: Intent,
21235    /// black_point_compensation: `bool` -> Enable black point compensation
21236    /// default: false
21237    pub black_point_compensation: bool,
21238    /// embedded: `bool` -> Use embedded input profile, if available
21239    /// default: false
21240    pub embedded: bool,
21241    /// input_profile: `String` -> Filename to load input profile from
21242    pub input_profile: String,
21243    /// depth: `i32` -> Output device space depth in bits
21244    /// min: 8, max: 16, default: 8
21245    pub depth: i32,
21246}
21247
21248impl std::default::Default for IccTransformOptions {
21249    fn default() -> Self {
21250        IccTransformOptions {
21251            pcs: PCS::Lab,
21252            intent: Intent::Relative,
21253            black_point_compensation: false,
21254            embedded: false,
21255            input_profile: String::new(),
21256            depth: i32::from(8),
21257        }
21258    }
21259}
21260
21261/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
21262/// inp: `&VipsImage` -> Input image
21263/// output_profile: `&str` -> Filename to load output profile from
21264/// icc_transform_options: `&IccTransformOptions` -> optional arguments
21265/// returns `VipsImage` - Output image
21266pub fn icc_transform_with_opts(
21267    inp: &VipsImage,
21268    output_profile: &str,
21269    icc_transform_options: &IccTransformOptions,
21270) -> Result<VipsImage> {
21271    unsafe {
21272        let inp_in: *mut bindings::VipsImage = inp.ctx;
21273        let output_profile_in: CString = utils::new_c_string(output_profile)?;
21274        let mut out_out: *mut bindings::VipsImage = null_mut();
21275
21276        let pcs_in: i32 = icc_transform_options.pcs as i32;
21277        let pcs_in_name = utils::new_c_string("pcs")?;
21278
21279        let intent_in: i32 = icc_transform_options.intent as i32;
21280        let intent_in_name = utils::new_c_string("intent")?;
21281
21282        let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
21283            1
21284        } else {
21285            0
21286        };
21287        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21288
21289        let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
21290        let embedded_in_name = utils::new_c_string("embedded")?;
21291
21292        let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
21293        let input_profile_in_name = utils::new_c_string("input-profile")?;
21294
21295        let depth_in: i32 = icc_transform_options.depth;
21296        let depth_in_name = utils::new_c_string("depth")?;
21297
21298        let vips_op_response = bindings::vips_icc_transform(
21299            inp_in,
21300            &mut out_out,
21301            output_profile_in.as_ptr(),
21302            pcs_in_name.as_ptr(),
21303            pcs_in,
21304            intent_in_name.as_ptr(),
21305            intent_in,
21306            black_point_compensation_in_name.as_ptr(),
21307            black_point_compensation_in,
21308            embedded_in_name.as_ptr(),
21309            embedded_in,
21310            input_profile_in_name.as_ptr(),
21311            input_profile_in.as_ptr(),
21312            depth_in_name.as_ptr(),
21313            depth_in,
21314            NULL,
21315        );
21316        utils::result(
21317            vips_op_response,
21318            VipsImage { ctx: out_out },
21319            Error::IccTransformError,
21320        )
21321    }
21322}
21323
21324/// VipsdE76 (dE76), calculate dE76
21325/// left: `&VipsImage` -> Left-hand input image
21326/// right: `&VipsImage` -> Right-hand input image
21327/// returns `VipsImage` - Output image
21328pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21329    unsafe {
21330        let left_in: *mut bindings::VipsImage = left.ctx;
21331        let right_in: *mut bindings::VipsImage = right.ctx;
21332        let mut out_out: *mut bindings::VipsImage = null_mut();
21333
21334        let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
21335        utils::result(
21336            vips_op_response,
21337            VipsImage { ctx: out_out },
21338            Error::DE76Error,
21339        )
21340    }
21341}
21342
21343/// VipsdE00 (dE00), calculate dE00
21344/// left: `&VipsImage` -> Left-hand input image
21345/// right: `&VipsImage` -> Right-hand input image
21346/// returns `VipsImage` - Output image
21347pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21348    unsafe {
21349        let left_in: *mut bindings::VipsImage = left.ctx;
21350        let right_in: *mut bindings::VipsImage = right.ctx;
21351        let mut out_out: *mut bindings::VipsImage = null_mut();
21352
21353        let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
21354        utils::result(
21355            vips_op_response,
21356            VipsImage { ctx: out_out },
21357            Error::DE00Error,
21358        )
21359    }
21360}
21361
21362/// VipsdECMC (dECMC), calculate dECMC
21363/// left: `&VipsImage` -> Left-hand input image
21364/// right: `&VipsImage` -> Right-hand input image
21365/// returns `VipsImage` - Output image
21366pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21367    unsafe {
21368        let left_in: *mut bindings::VipsImage = left.ctx;
21369        let right_in: *mut bindings::VipsImage = right.ctx;
21370        let mut out_out: *mut bindings::VipsImage = null_mut();
21371
21372        let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
21373        utils::result(
21374            vips_op_response,
21375            VipsImage { ctx: out_out },
21376            Error::DEcmcError,
21377        )
21378    }
21379}
21380
21381/// VipsCMYK2XYZ (CMYK2XYZ), transform CMYK to XYZ
21382/// inp: `&VipsImage` -> Input image
21383/// returns `VipsImage` - Output image
21384pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
21385    unsafe {
21386        let inp_in: *mut bindings::VipsImage = inp.ctx;
21387        let mut out_out: *mut bindings::VipsImage = null_mut();
21388
21389        let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
21390        utils::result(
21391            vips_op_response,
21392            VipsImage { ctx: out_out },
21393            Error::Cmyk2XyzError,
21394        )
21395    }
21396}
21397
21398/// VipsXYZ2CMYK (XYZ2CMYK), transform XYZ to CMYK
21399/// inp: `&VipsImage` -> Input image
21400/// returns `VipsImage` - Output image
21401pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
21402    unsafe {
21403        let inp_in: *mut bindings::VipsImage = inp.ctx;
21404        let mut out_out: *mut bindings::VipsImage = null_mut();
21405
21406        let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
21407        utils::result(
21408            vips_op_response,
21409            VipsImage { ctx: out_out },
21410            Error::Xyz2CmykError,
21411        )
21412    }
21413}
21414
21415/// VipsProfileLoad (profile_load), load named ICC profile
21416/// name: `&str` -> Profile name
21417/// returns `Vec<u8>` - Loaded profile
21418pub fn profile_load(name: &str) -> Result<Vec<u8>> {
21419    unsafe {
21420        let name_in: CString = utils::new_c_string(name)?;
21421        let mut profile_out: *mut bindings::VipsBlob = null_mut();
21422
21423        let vips_op_response =
21424            bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
21425        utils::result(
21426            vips_op_response,
21427            VipsBlob { ctx: profile_out }.into(),
21428            Error::ProfileLoadError,
21429        )
21430    }
21431}
21432
21433/// VipsMaplut (maplut), map an image though a lut
21434/// inp: `&VipsImage` -> Input image
21435/// lut: `&VipsImage` -> Look-up table image
21436/// returns `VipsImage` - Output image
21437pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
21438    unsafe {
21439        let inp_in: *mut bindings::VipsImage = inp.ctx;
21440        let lut_in: *mut bindings::VipsImage = lut.ctx;
21441        let mut out_out: *mut bindings::VipsImage = null_mut();
21442
21443        let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
21444        utils::result(
21445            vips_op_response,
21446            VipsImage { ctx: out_out },
21447            Error::MaplutError,
21448        )
21449    }
21450}
21451
21452/// Options for maplut operation
21453#[derive(Clone, Debug)]
21454pub struct MaplutOptions {
21455    /// band: `i32` -> Apply one-band lut to this band of in
21456    /// min: -1, max: 10000, default: -1
21457    pub band: i32,
21458}
21459
21460impl std::default::Default for MaplutOptions {
21461    fn default() -> Self {
21462        MaplutOptions {
21463            band: i32::from(-1),
21464        }
21465    }
21466}
21467
21468/// VipsMaplut (maplut), map an image though a lut
21469/// inp: `&VipsImage` -> Input image
21470/// lut: `&VipsImage` -> Look-up table image
21471/// maplut_options: `&MaplutOptions` -> optional arguments
21472/// returns `VipsImage` - Output image
21473pub fn maplut_with_opts(
21474    inp: &VipsImage,
21475    lut: &VipsImage,
21476    maplut_options: &MaplutOptions,
21477) -> Result<VipsImage> {
21478    unsafe {
21479        let inp_in: *mut bindings::VipsImage = inp.ctx;
21480        let lut_in: *mut bindings::VipsImage = lut.ctx;
21481        let mut out_out: *mut bindings::VipsImage = null_mut();
21482
21483        let band_in: i32 = maplut_options.band;
21484        let band_in_name = utils::new_c_string("band")?;
21485
21486        let vips_op_response = bindings::vips_maplut(
21487            inp_in,
21488            &mut out_out,
21489            lut_in,
21490            band_in_name.as_ptr(),
21491            band_in,
21492            NULL,
21493        );
21494        utils::result(
21495            vips_op_response,
21496            VipsImage { ctx: out_out },
21497            Error::MaplutError,
21498        )
21499    }
21500}
21501
21502/// VipsPercent (percent), find threshold for percent of pixels
21503/// inp: `&VipsImage` -> Input image
21504/// percent: `f64` -> Percent of pixels
21505/// min: 0, max: 100, default: 50
21506/// returns `i32` - Threshold above which lie percent of pixels
21507pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
21508    unsafe {
21509        let inp_in: *mut bindings::VipsImage = inp.ctx;
21510        let percent_in: f64 = percent;
21511        let mut threshold_out: i32 = i32::from(0);
21512
21513        let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
21514        utils::result(vips_op_response, threshold_out, Error::PercentError)
21515    }
21516}
21517
21518/// VipsStdif (stdif), statistical difference
21519/// inp: `&VipsImage` -> Input image
21520/// width: `i32` -> Window width in pixels
21521/// min: 1, max: 256, default: 11
21522/// height: `i32` -> Window height in pixels
21523/// min: 1, max: 256, default: 11
21524/// returns `VipsImage` - Output image
21525pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21526    unsafe {
21527        let inp_in: *mut bindings::VipsImage = inp.ctx;
21528        let width_in: i32 = width;
21529        let height_in: i32 = height;
21530        let mut out_out: *mut bindings::VipsImage = null_mut();
21531
21532        let vips_op_response =
21533            bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
21534        utils::result(
21535            vips_op_response,
21536            VipsImage { ctx: out_out },
21537            Error::StdifError,
21538        )
21539    }
21540}
21541
21542/// Options for stdif operation
21543#[derive(Clone, Debug)]
21544pub struct StdifOptions {
21545    /// s_0: `f64` -> New deviation
21546    /// min: -inf, max: inf, default: 50
21547    pub s_0: f64,
21548    /// b: `f64` -> Weight of new deviation
21549    /// min: 0, max: 2, default: 0.5
21550    pub b: f64,
21551    /// m_0: `f64` -> New mean
21552    /// min: -inf, max: inf, default: 128
21553    pub m_0: f64,
21554    /// a: `f64` -> Weight of new mean
21555    /// min: 0, max: 1, default: 0.5
21556    pub a: f64,
21557}
21558
21559impl std::default::Default for StdifOptions {
21560    fn default() -> Self {
21561        StdifOptions {
21562            s_0: f64::from(50),
21563            b: f64::from(0.5),
21564            m_0: f64::from(128),
21565            a: f64::from(0.5),
21566        }
21567    }
21568}
21569
21570/// VipsStdif (stdif), statistical difference
21571/// inp: `&VipsImage` -> Input image
21572/// width: `i32` -> Window width in pixels
21573/// min: 1, max: 256, default: 11
21574/// height: `i32` -> Window height in pixels
21575/// min: 1, max: 256, default: 11
21576/// stdif_options: `&StdifOptions` -> optional arguments
21577/// returns `VipsImage` - Output image
21578pub fn stdif_with_opts(
21579    inp: &VipsImage,
21580    width: i32,
21581    height: i32,
21582    stdif_options: &StdifOptions,
21583) -> Result<VipsImage> {
21584    unsafe {
21585        let inp_in: *mut bindings::VipsImage = inp.ctx;
21586        let width_in: i32 = width;
21587        let height_in: i32 = height;
21588        let mut out_out: *mut bindings::VipsImage = null_mut();
21589
21590        let s_0_in: f64 = stdif_options.s_0;
21591        let s_0_in_name = utils::new_c_string("s0")?;
21592
21593        let b_in: f64 = stdif_options.b;
21594        let b_in_name = utils::new_c_string("b")?;
21595
21596        let m_0_in: f64 = stdif_options.m_0;
21597        let m_0_in_name = utils::new_c_string("m0")?;
21598
21599        let a_in: f64 = stdif_options.a;
21600        let a_in_name = utils::new_c_string("a")?;
21601
21602        let vips_op_response = bindings::vips_stdif(
21603            inp_in,
21604            &mut out_out,
21605            width_in,
21606            height_in,
21607            s_0_in_name.as_ptr(),
21608            s_0_in,
21609            b_in_name.as_ptr(),
21610            b_in,
21611            m_0_in_name.as_ptr(),
21612            m_0_in,
21613            a_in_name.as_ptr(),
21614            a_in,
21615            NULL,
21616        );
21617        utils::result(
21618            vips_op_response,
21619            VipsImage { ctx: out_out },
21620            Error::StdifError,
21621        )
21622    }
21623}
21624
21625/// VipsHistCum (hist_cum), form cumulative histogram
21626/// inp: `&VipsImage` -> Input image
21627/// returns `VipsImage` - Output image
21628pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
21629    unsafe {
21630        let inp_in: *mut bindings::VipsImage = inp.ctx;
21631        let mut out_out: *mut bindings::VipsImage = null_mut();
21632
21633        let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
21634        utils::result(
21635            vips_op_response,
21636            VipsImage { ctx: out_out },
21637            Error::HistCumError,
21638        )
21639    }
21640}
21641
21642/// VipsHistMatch (hist_match), match two histograms
21643/// inp: `&VipsImage` -> Input histogram
21644/// refp: `&VipsImage` -> Reference histogram
21645/// returns `VipsImage` - Output image
21646pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21647    unsafe {
21648        let inp_in: *mut bindings::VipsImage = inp.ctx;
21649        let refp_in: *mut bindings::VipsImage = refp.ctx;
21650        let mut out_out: *mut bindings::VipsImage = null_mut();
21651
21652        let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21653        utils::result(
21654            vips_op_response,
21655            VipsImage { ctx: out_out },
21656            Error::HistMatchError,
21657        )
21658    }
21659}
21660
21661/// VipsHistNorm (hist_norm), normalise histogram
21662/// inp: `&VipsImage` -> Input image
21663/// returns `VipsImage` - Output image
21664pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21665    unsafe {
21666        let inp_in: *mut bindings::VipsImage = inp.ctx;
21667        let mut out_out: *mut bindings::VipsImage = null_mut();
21668
21669        let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21670        utils::result(
21671            vips_op_response,
21672            VipsImage { ctx: out_out },
21673            Error::HistNormError,
21674        )
21675    }
21676}
21677
21678/// VipsHistEqual (hist_equal), histogram equalisation
21679/// inp: `&VipsImage` -> Input image
21680/// returns `VipsImage` - Output image
21681pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21682    unsafe {
21683        let inp_in: *mut bindings::VipsImage = inp.ctx;
21684        let mut out_out: *mut bindings::VipsImage = null_mut();
21685
21686        let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21687        utils::result(
21688            vips_op_response,
21689            VipsImage { ctx: out_out },
21690            Error::HistEqualError,
21691        )
21692    }
21693}
21694
21695/// Options for hist_equal operation
21696#[derive(Clone, Debug)]
21697pub struct HistEqualOptions {
21698    /// band: `i32` -> Equalise with this band
21699    /// min: -1, max: 100000, default: -1
21700    pub band: i32,
21701}
21702
21703impl std::default::Default for HistEqualOptions {
21704    fn default() -> Self {
21705        HistEqualOptions {
21706            band: i32::from(-1),
21707        }
21708    }
21709}
21710
21711/// VipsHistEqual (hist_equal), histogram equalisation
21712/// inp: `&VipsImage` -> Input image
21713/// hist_equal_options: `&HistEqualOptions` -> optional arguments
21714/// returns `VipsImage` - Output image
21715pub fn hist_equal_with_opts(
21716    inp: &VipsImage,
21717    hist_equal_options: &HistEqualOptions,
21718) -> Result<VipsImage> {
21719    unsafe {
21720        let inp_in: *mut bindings::VipsImage = inp.ctx;
21721        let mut out_out: *mut bindings::VipsImage = null_mut();
21722
21723        let band_in: i32 = hist_equal_options.band;
21724        let band_in_name = utils::new_c_string("band")?;
21725
21726        let vips_op_response =
21727            bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21728        utils::result(
21729            vips_op_response,
21730            VipsImage { ctx: out_out },
21731            Error::HistEqualError,
21732        )
21733    }
21734}
21735
21736/// VipsHistPlot (hist_plot), plot histogram
21737/// inp: `&VipsImage` -> Input image
21738/// returns `VipsImage` - Output image
21739pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21740    unsafe {
21741        let inp_in: *mut bindings::VipsImage = inp.ctx;
21742        let mut out_out: *mut bindings::VipsImage = null_mut();
21743
21744        let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21745        utils::result(
21746            vips_op_response,
21747            VipsImage { ctx: out_out },
21748            Error::HistPlotError,
21749        )
21750    }
21751}
21752
21753/// VipsHistLocal (hist_local), local histogram equalisation
21754/// inp: `&VipsImage` -> Input image
21755/// width: `i32` -> Window width in pixels
21756/// min: 1, max: 100000000, default: 1
21757/// height: `i32` -> Window height in pixels
21758/// min: 1, max: 100000000, default: 1
21759/// returns `VipsImage` - Output image
21760pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21761    unsafe {
21762        let inp_in: *mut bindings::VipsImage = inp.ctx;
21763        let width_in: i32 = width;
21764        let height_in: i32 = height;
21765        let mut out_out: *mut bindings::VipsImage = null_mut();
21766
21767        let vips_op_response =
21768            bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21769        utils::result(
21770            vips_op_response,
21771            VipsImage { ctx: out_out },
21772            Error::HistLocalError,
21773        )
21774    }
21775}
21776
21777/// Options for hist_local operation
21778#[derive(Clone, Debug)]
21779pub struct HistLocalOptions {
21780    /// max_slope: `i32` -> Maximum slope (CLAHE)
21781    /// min: 0, max: 100, default: 0
21782    pub max_slope: i32,
21783}
21784
21785impl std::default::Default for HistLocalOptions {
21786    fn default() -> Self {
21787        HistLocalOptions {
21788            max_slope: i32::from(0),
21789        }
21790    }
21791}
21792
21793/// VipsHistLocal (hist_local), local histogram equalisation
21794/// inp: `&VipsImage` -> Input image
21795/// width: `i32` -> Window width in pixels
21796/// min: 1, max: 100000000, default: 1
21797/// height: `i32` -> Window height in pixels
21798/// min: 1, max: 100000000, default: 1
21799/// hist_local_options: `&HistLocalOptions` -> optional arguments
21800/// returns `VipsImage` - Output image
21801pub fn hist_local_with_opts(
21802    inp: &VipsImage,
21803    width: i32,
21804    height: i32,
21805    hist_local_options: &HistLocalOptions,
21806) -> Result<VipsImage> {
21807    unsafe {
21808        let inp_in: *mut bindings::VipsImage = inp.ctx;
21809        let width_in: i32 = width;
21810        let height_in: i32 = height;
21811        let mut out_out: *mut bindings::VipsImage = null_mut();
21812
21813        let max_slope_in: i32 = hist_local_options.max_slope;
21814        let max_slope_in_name = utils::new_c_string("max-slope")?;
21815
21816        let vips_op_response = bindings::vips_hist_local(
21817            inp_in,
21818            &mut out_out,
21819            width_in,
21820            height_in,
21821            max_slope_in_name.as_ptr(),
21822            max_slope_in,
21823            NULL,
21824        );
21825        utils::result(
21826            vips_op_response,
21827            VipsImage { ctx: out_out },
21828            Error::HistLocalError,
21829        )
21830    }
21831}
21832
21833/// VipsHistIsmonotonic (hist_ismonotonic), test for monotonicity
21834/// inp: `&VipsImage` -> Input histogram image
21835/// returns `bool` - true if in is monotonic
21836pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21837    unsafe {
21838        let inp_in: *mut bindings::VipsImage = inp.ctx;
21839        let mut monotonic_out: i32 = 0;
21840
21841        let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21842        utils::result(
21843            vips_op_response,
21844            monotonic_out != 0,
21845            Error::HistIsmonotonicError,
21846        )
21847    }
21848}
21849
21850/// VipsHistEntropy (hist_entropy), estimate image entropy
21851/// inp: `&VipsImage` -> Input histogram image
21852/// returns `f64` - Output value
21853pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21854    unsafe {
21855        let inp_in: *mut bindings::VipsImage = inp.ctx;
21856        let mut out_out: f64 = f64::from(0);
21857
21858        let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21859        utils::result(vips_op_response, out_out, Error::HistEntropyError)
21860    }
21861}
21862
21863/// VipsConv (conv), convolution operation
21864/// inp: `&VipsImage` -> Input image argument
21865/// mask: `&VipsImage` -> Input matrix image
21866/// returns `VipsImage` - Output image
21867pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21868    unsafe {
21869        let inp_in: *mut bindings::VipsImage = inp.ctx;
21870        let mask_in: *mut bindings::VipsImage = mask.ctx;
21871        let mut out_out: *mut bindings::VipsImage = null_mut();
21872
21873        let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21874        utils::result(
21875            vips_op_response,
21876            VipsImage { ctx: out_out },
21877            Error::ConvError,
21878        )
21879    }
21880}
21881
21882/// Options for conv operation
21883#[derive(Clone, Debug)]
21884pub struct ConvOptions {
21885    /// precision: `Precision` -> Convolve with this precision
21886    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21887    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21888    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21889    ///  `Last` -> VIPS_PRECISION_LAST = 3
21890    pub precision: Precision,
21891    /// layers: `i32` -> Use this many layers in approximation
21892    /// min: 1, max: 1000, default: 5
21893    pub layers: i32,
21894    /// cluster: `i32` -> Cluster lines closer than this in approximation
21895    /// min: 1, max: 100, default: 1
21896    pub cluster: i32,
21897}
21898
21899impl std::default::Default for ConvOptions {
21900    fn default() -> Self {
21901        ConvOptions {
21902            precision: Precision::Float,
21903            layers: i32::from(5),
21904            cluster: i32::from(1),
21905        }
21906    }
21907}
21908
21909/// VipsConv (conv), convolution operation
21910/// inp: `&VipsImage` -> Input image argument
21911/// mask: `&VipsImage` -> Input matrix image
21912/// conv_options: `&ConvOptions` -> optional arguments
21913/// returns `VipsImage` - Output image
21914pub fn conv_with_opts(
21915    inp: &VipsImage,
21916    mask: &VipsImage,
21917    conv_options: &ConvOptions,
21918) -> Result<VipsImage> {
21919    unsafe {
21920        let inp_in: *mut bindings::VipsImage = inp.ctx;
21921        let mask_in: *mut bindings::VipsImage = mask.ctx;
21922        let mut out_out: *mut bindings::VipsImage = null_mut();
21923
21924        let precision_in: i32 = conv_options.precision as i32;
21925        let precision_in_name = utils::new_c_string("precision")?;
21926
21927        let layers_in: i32 = conv_options.layers;
21928        let layers_in_name = utils::new_c_string("layers")?;
21929
21930        let cluster_in: i32 = conv_options.cluster;
21931        let cluster_in_name = utils::new_c_string("cluster")?;
21932
21933        let vips_op_response = bindings::vips_conv(
21934            inp_in,
21935            &mut out_out,
21936            mask_in,
21937            precision_in_name.as_ptr(),
21938            precision_in,
21939            layers_in_name.as_ptr(),
21940            layers_in,
21941            cluster_in_name.as_ptr(),
21942            cluster_in,
21943            NULL,
21944        );
21945        utils::result(
21946            vips_op_response,
21947            VipsImage { ctx: out_out },
21948            Error::ConvError,
21949        )
21950    }
21951}
21952
21953/// VipsConva (conva), approximate integer convolution
21954/// inp: `&VipsImage` -> Input image argument
21955/// mask: `&VipsImage` -> Input matrix image
21956/// returns `VipsImage` - Output image
21957pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21958    unsafe {
21959        let inp_in: *mut bindings::VipsImage = inp.ctx;
21960        let mask_in: *mut bindings::VipsImage = mask.ctx;
21961        let mut out_out: *mut bindings::VipsImage = null_mut();
21962
21963        let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21964        utils::result(
21965            vips_op_response,
21966            VipsImage { ctx: out_out },
21967            Error::ConvaError,
21968        )
21969    }
21970}
21971
21972/// Options for conva operation
21973#[derive(Clone, Debug)]
21974pub struct ConvaOptions {
21975    /// layers: `i32` -> Use this many layers in approximation
21976    /// min: 1, max: 1000, default: 5
21977    pub layers: i32,
21978    /// cluster: `i32` -> Cluster lines closer than this in approximation
21979    /// min: 1, max: 100, default: 1
21980    pub cluster: i32,
21981}
21982
21983impl std::default::Default for ConvaOptions {
21984    fn default() -> Self {
21985        ConvaOptions {
21986            layers: i32::from(5),
21987            cluster: i32::from(1),
21988        }
21989    }
21990}
21991
21992/// VipsConva (conva), approximate integer convolution
21993/// inp: `&VipsImage` -> Input image argument
21994/// mask: `&VipsImage` -> Input matrix image
21995/// conva_options: `&ConvaOptions` -> optional arguments
21996/// returns `VipsImage` - Output image
21997pub fn conva_with_opts(
21998    inp: &VipsImage,
21999    mask: &VipsImage,
22000    conva_options: &ConvaOptions,
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 layers_in: i32 = conva_options.layers;
22008        let layers_in_name = utils::new_c_string("layers")?;
22009
22010        let cluster_in: i32 = conva_options.cluster;
22011        let cluster_in_name = utils::new_c_string("cluster")?;
22012
22013        let vips_op_response = bindings::vips_conva(
22014            inp_in,
22015            &mut out_out,
22016            mask_in,
22017            layers_in_name.as_ptr(),
22018            layers_in,
22019            cluster_in_name.as_ptr(),
22020            cluster_in,
22021            NULL,
22022        );
22023        utils::result(
22024            vips_op_response,
22025            VipsImage { ctx: out_out },
22026            Error::ConvaError,
22027        )
22028    }
22029}
22030
22031/// VipsConvf (convf), float convolution operation
22032/// inp: `&VipsImage` -> Input image argument
22033/// mask: `&VipsImage` -> Input matrix image
22034/// returns `VipsImage` - Output image
22035pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22036    unsafe {
22037        let inp_in: *mut bindings::VipsImage = inp.ctx;
22038        let mask_in: *mut bindings::VipsImage = mask.ctx;
22039        let mut out_out: *mut bindings::VipsImage = null_mut();
22040
22041        let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
22042        utils::result(
22043            vips_op_response,
22044            VipsImage { ctx: out_out },
22045            Error::ConvfError,
22046        )
22047    }
22048}
22049
22050/// VipsConvi (convi), int convolution operation
22051/// inp: `&VipsImage` -> Input image argument
22052/// mask: `&VipsImage` -> Input matrix image
22053/// returns `VipsImage` - Output image
22054pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22055    unsafe {
22056        let inp_in: *mut bindings::VipsImage = inp.ctx;
22057        let mask_in: *mut bindings::VipsImage = mask.ctx;
22058        let mut out_out: *mut bindings::VipsImage = null_mut();
22059
22060        let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
22061        utils::result(
22062            vips_op_response,
22063            VipsImage { ctx: out_out },
22064            Error::ConviError,
22065        )
22066    }
22067}
22068
22069/// VipsCompass (compass), convolve with rotating mask
22070/// inp: `&VipsImage` -> Input image argument
22071/// mask: `&VipsImage` -> Input matrix image
22072/// returns `VipsImage` - Output image
22073pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22074    unsafe {
22075        let inp_in: *mut bindings::VipsImage = inp.ctx;
22076        let mask_in: *mut bindings::VipsImage = mask.ctx;
22077        let mut out_out: *mut bindings::VipsImage = null_mut();
22078
22079        let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
22080        utils::result(
22081            vips_op_response,
22082            VipsImage { ctx: out_out },
22083            Error::CompassError,
22084        )
22085    }
22086}
22087
22088/// Options for compass operation
22089#[derive(Clone, Debug)]
22090pub struct CompassOptions {
22091    /// times: `i32` -> Rotate and convolve this many times
22092    /// min: 1, max: 1000, default: 2
22093    pub times: i32,
22094    /// angle: `Angle45` -> Rotate mask by this much between convolutions
22095    ///  `D0` -> VIPS_ANGLE45_D0 = 0
22096    ///  `D45` -> VIPS_ANGLE45_D45 = 1
22097    ///  `D90` -> VIPS_ANGLE45_D90 = 2 [DEFAULT]
22098    ///  `D135` -> VIPS_ANGLE45_D135 = 3
22099    ///  `D180` -> VIPS_ANGLE45_D180 = 4
22100    ///  `D225` -> VIPS_ANGLE45_D225 = 5
22101    ///  `D270` -> VIPS_ANGLE45_D270 = 6
22102    ///  `D315` -> VIPS_ANGLE45_D315 = 7
22103    ///  `Last` -> VIPS_ANGLE45_LAST = 8
22104    pub angle: Angle45,
22105    /// combine: `Combine` -> Combine convolution results like this
22106    ///  `Max` -> VIPS_COMBINE_MAX = 0 [DEFAULT]
22107    ///  `Sum` -> VIPS_COMBINE_SUM = 1
22108    ///  `Min` -> VIPS_COMBINE_MIN = 2
22109    ///  `Last` -> VIPS_COMBINE_LAST = 3
22110    pub combine: Combine,
22111    /// precision: `Precision` -> Convolve with this precision
22112    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22113    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22114    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22115    ///  `Last` -> VIPS_PRECISION_LAST = 3
22116    pub precision: Precision,
22117    /// layers: `i32` -> Use this many layers in approximation
22118    /// min: 1, max: 1000, default: 5
22119    pub layers: i32,
22120    /// cluster: `i32` -> Cluster lines closer than this in approximation
22121    /// min: 1, max: 100, default: 1
22122    pub cluster: i32,
22123}
22124
22125impl std::default::Default for CompassOptions {
22126    fn default() -> Self {
22127        CompassOptions {
22128            times: i32::from(2),
22129            angle: Angle45::D90,
22130            combine: Combine::Max,
22131            precision: Precision::Float,
22132            layers: i32::from(5),
22133            cluster: i32::from(1),
22134        }
22135    }
22136}
22137
22138/// VipsCompass (compass), convolve with rotating mask
22139/// inp: `&VipsImage` -> Input image argument
22140/// mask: `&VipsImage` -> Input matrix image
22141/// compass_options: `&CompassOptions` -> optional arguments
22142/// returns `VipsImage` - Output image
22143pub fn compass_with_opts(
22144    inp: &VipsImage,
22145    mask: &VipsImage,
22146    compass_options: &CompassOptions,
22147) -> Result<VipsImage> {
22148    unsafe {
22149        let inp_in: *mut bindings::VipsImage = inp.ctx;
22150        let mask_in: *mut bindings::VipsImage = mask.ctx;
22151        let mut out_out: *mut bindings::VipsImage = null_mut();
22152
22153        let times_in: i32 = compass_options.times;
22154        let times_in_name = utils::new_c_string("times")?;
22155
22156        let angle_in: i32 = compass_options.angle as i32;
22157        let angle_in_name = utils::new_c_string("angle")?;
22158
22159        let combine_in: i32 = compass_options.combine as i32;
22160        let combine_in_name = utils::new_c_string("combine")?;
22161
22162        let precision_in: i32 = compass_options.precision as i32;
22163        let precision_in_name = utils::new_c_string("precision")?;
22164
22165        let layers_in: i32 = compass_options.layers;
22166        let layers_in_name = utils::new_c_string("layers")?;
22167
22168        let cluster_in: i32 = compass_options.cluster;
22169        let cluster_in_name = utils::new_c_string("cluster")?;
22170
22171        let vips_op_response = bindings::vips_compass(
22172            inp_in,
22173            &mut out_out,
22174            mask_in,
22175            times_in_name.as_ptr(),
22176            times_in,
22177            angle_in_name.as_ptr(),
22178            angle_in,
22179            combine_in_name.as_ptr(),
22180            combine_in,
22181            precision_in_name.as_ptr(),
22182            precision_in,
22183            layers_in_name.as_ptr(),
22184            layers_in,
22185            cluster_in_name.as_ptr(),
22186            cluster_in,
22187            NULL,
22188        );
22189        utils::result(
22190            vips_op_response,
22191            VipsImage { ctx: out_out },
22192            Error::CompassError,
22193        )
22194    }
22195}
22196
22197/// VipsConvsep (convsep), separable convolution operation
22198/// inp: `&VipsImage` -> Input image argument
22199/// mask: `&VipsImage` -> Input matrix image
22200/// returns `VipsImage` - Output image
22201pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22202    unsafe {
22203        let inp_in: *mut bindings::VipsImage = inp.ctx;
22204        let mask_in: *mut bindings::VipsImage = mask.ctx;
22205        let mut out_out: *mut bindings::VipsImage = null_mut();
22206
22207        let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
22208        utils::result(
22209            vips_op_response,
22210            VipsImage { ctx: out_out },
22211            Error::ConvsepError,
22212        )
22213    }
22214}
22215
22216/// Options for convsep operation
22217#[derive(Clone, Debug)]
22218pub struct ConvsepOptions {
22219    /// precision: `Precision` -> Convolve with this precision
22220    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22221    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22222    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22223    ///  `Last` -> VIPS_PRECISION_LAST = 3
22224    pub precision: Precision,
22225    /// layers: `i32` -> Use this many layers in approximation
22226    /// min: 1, max: 1000, default: 5
22227    pub layers: i32,
22228    /// cluster: `i32` -> Cluster lines closer than this in approximation
22229    /// min: 1, max: 100, default: 1
22230    pub cluster: i32,
22231}
22232
22233impl std::default::Default for ConvsepOptions {
22234    fn default() -> Self {
22235        ConvsepOptions {
22236            precision: Precision::Float,
22237            layers: i32::from(5),
22238            cluster: i32::from(1),
22239        }
22240    }
22241}
22242
22243/// VipsConvsep (convsep), separable convolution operation
22244/// inp: `&VipsImage` -> Input image argument
22245/// mask: `&VipsImage` -> Input matrix image
22246/// convsep_options: `&ConvsepOptions` -> optional arguments
22247/// returns `VipsImage` - Output image
22248pub fn convsep_with_opts(
22249    inp: &VipsImage,
22250    mask: &VipsImage,
22251    convsep_options: &ConvsepOptions,
22252) -> Result<VipsImage> {
22253    unsafe {
22254        let inp_in: *mut bindings::VipsImage = inp.ctx;
22255        let mask_in: *mut bindings::VipsImage = mask.ctx;
22256        let mut out_out: *mut bindings::VipsImage = null_mut();
22257
22258        let precision_in: i32 = convsep_options.precision as i32;
22259        let precision_in_name = utils::new_c_string("precision")?;
22260
22261        let layers_in: i32 = convsep_options.layers;
22262        let layers_in_name = utils::new_c_string("layers")?;
22263
22264        let cluster_in: i32 = convsep_options.cluster;
22265        let cluster_in_name = utils::new_c_string("cluster")?;
22266
22267        let vips_op_response = bindings::vips_convsep(
22268            inp_in,
22269            &mut out_out,
22270            mask_in,
22271            precision_in_name.as_ptr(),
22272            precision_in,
22273            layers_in_name.as_ptr(),
22274            layers_in,
22275            cluster_in_name.as_ptr(),
22276            cluster_in,
22277            NULL,
22278        );
22279        utils::result(
22280            vips_op_response,
22281            VipsImage { ctx: out_out },
22282            Error::ConvsepError,
22283        )
22284    }
22285}
22286
22287/// VipsConvasep (convasep), approximate separable integer convolution
22288/// inp: `&VipsImage` -> Input image argument
22289/// mask: `&VipsImage` -> Input matrix image
22290/// returns `VipsImage` - Output image
22291pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22292    unsafe {
22293        let inp_in: *mut bindings::VipsImage = inp.ctx;
22294        let mask_in: *mut bindings::VipsImage = mask.ctx;
22295        let mut out_out: *mut bindings::VipsImage = null_mut();
22296
22297        let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
22298        utils::result(
22299            vips_op_response,
22300            VipsImage { ctx: out_out },
22301            Error::ConvasepError,
22302        )
22303    }
22304}
22305
22306/// Options for convasep operation
22307#[derive(Clone, Debug)]
22308pub struct ConvasepOptions {
22309    /// layers: `i32` -> Use this many layers in approximation
22310    /// min: 1, max: 1000, default: 5
22311    pub layers: i32,
22312}
22313
22314impl std::default::Default for ConvasepOptions {
22315    fn default() -> Self {
22316        ConvasepOptions {
22317            layers: i32::from(5),
22318        }
22319    }
22320}
22321
22322/// VipsConvasep (convasep), approximate separable integer convolution
22323/// inp: `&VipsImage` -> Input image argument
22324/// mask: `&VipsImage` -> Input matrix image
22325/// convasep_options: `&ConvasepOptions` -> optional arguments
22326/// returns `VipsImage` - Output image
22327pub fn convasep_with_opts(
22328    inp: &VipsImage,
22329    mask: &VipsImage,
22330    convasep_options: &ConvasepOptions,
22331) -> Result<VipsImage> {
22332    unsafe {
22333        let inp_in: *mut bindings::VipsImage = inp.ctx;
22334        let mask_in: *mut bindings::VipsImage = mask.ctx;
22335        let mut out_out: *mut bindings::VipsImage = null_mut();
22336
22337        let layers_in: i32 = convasep_options.layers;
22338        let layers_in_name = utils::new_c_string("layers")?;
22339
22340        let vips_op_response = bindings::vips_convasep(
22341            inp_in,
22342            &mut out_out,
22343            mask_in,
22344            layers_in_name.as_ptr(),
22345            layers_in,
22346            NULL,
22347        );
22348        utils::result(
22349            vips_op_response,
22350            VipsImage { ctx: out_out },
22351            Error::ConvasepError,
22352        )
22353    }
22354}
22355
22356/// VipsFastcor (fastcor), fast correlation
22357/// inp: `&VipsImage` -> Input image argument
22358/// refp: `&VipsImage` -> Input reference image
22359/// returns `VipsImage` - Output image
22360pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22361    unsafe {
22362        let inp_in: *mut bindings::VipsImage = inp.ctx;
22363        let refp_in: *mut bindings::VipsImage = refp.ctx;
22364        let mut out_out: *mut bindings::VipsImage = null_mut();
22365
22366        let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
22367        utils::result(
22368            vips_op_response,
22369            VipsImage { ctx: out_out },
22370            Error::FastcorError,
22371        )
22372    }
22373}
22374
22375/// VipsSpcor (spcor), spatial correlation
22376/// inp: `&VipsImage` -> Input image argument
22377/// refp: `&VipsImage` -> Input reference image
22378/// returns `VipsImage` - Output image
22379pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22380    unsafe {
22381        let inp_in: *mut bindings::VipsImage = inp.ctx;
22382        let refp_in: *mut bindings::VipsImage = refp.ctx;
22383        let mut out_out: *mut bindings::VipsImage = null_mut();
22384
22385        let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
22386        utils::result(
22387            vips_op_response,
22388            VipsImage { ctx: out_out },
22389            Error::SpcorError,
22390        )
22391    }
22392}
22393
22394/// VipsSharpen (sharpen), unsharp masking for print
22395/// inp: `&VipsImage` -> Input image
22396/// returns `VipsImage` - Output image
22397pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
22398    unsafe {
22399        let inp_in: *mut bindings::VipsImage = inp.ctx;
22400        let mut out_out: *mut bindings::VipsImage = null_mut();
22401
22402        let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
22403        utils::result(
22404            vips_op_response,
22405            VipsImage { ctx: out_out },
22406            Error::SharpenError,
22407        )
22408    }
22409}
22410
22411/// Options for sharpen operation
22412#[derive(Clone, Debug)]
22413pub struct SharpenOptions {
22414    /// sigma: `f64` -> Sigma of Gaussian
22415    /// min: 0.000001, max: 10, default: 0.5
22416    pub sigma: f64,
22417    /// x_1: `f64` -> Flat/jaggy threshold
22418    /// min: 0, max: 1000000, default: 2
22419    pub x_1: f64,
22420    /// y_2: `f64` -> Maximum brightening
22421    /// min: 0, max: 1000000, default: 10
22422    pub y_2: f64,
22423    /// y_3: `f64` -> Maximum darkening
22424    /// min: 0, max: 1000000, default: 20
22425    pub y_3: f64,
22426    /// m_1: `f64` -> Slope for flat areas
22427    /// min: 0, max: 1000000, default: 0
22428    pub m_1: f64,
22429    /// m_2: `f64` -> Slope for jaggy areas
22430    /// min: 0, max: 1000000, default: 3
22431    pub m_2: f64,
22432}
22433
22434impl std::default::Default for SharpenOptions {
22435    fn default() -> Self {
22436        SharpenOptions {
22437            sigma: f64::from(0.5),
22438            x_1: f64::from(2),
22439            y_2: f64::from(10),
22440            y_3: f64::from(20),
22441            m_1: f64::from(0),
22442            m_2: f64::from(3),
22443        }
22444    }
22445}
22446
22447/// VipsSharpen (sharpen), unsharp masking for print
22448/// inp: `&VipsImage` -> Input image
22449/// sharpen_options: `&SharpenOptions` -> optional arguments
22450/// returns `VipsImage` - Output image
22451pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
22452    unsafe {
22453        let inp_in: *mut bindings::VipsImage = inp.ctx;
22454        let mut out_out: *mut bindings::VipsImage = null_mut();
22455
22456        let sigma_in: f64 = sharpen_options.sigma;
22457        let sigma_in_name = utils::new_c_string("sigma")?;
22458
22459        let x_1_in: f64 = sharpen_options.x_1;
22460        let x_1_in_name = utils::new_c_string("x1")?;
22461
22462        let y_2_in: f64 = sharpen_options.y_2;
22463        let y_2_in_name = utils::new_c_string("y2")?;
22464
22465        let y_3_in: f64 = sharpen_options.y_3;
22466        let y_3_in_name = utils::new_c_string("y3")?;
22467
22468        let m_1_in: f64 = sharpen_options.m_1;
22469        let m_1_in_name = utils::new_c_string("m1")?;
22470
22471        let m_2_in: f64 = sharpen_options.m_2;
22472        let m_2_in_name = utils::new_c_string("m2")?;
22473
22474        let vips_op_response = bindings::vips_sharpen(
22475            inp_in,
22476            &mut out_out,
22477            sigma_in_name.as_ptr(),
22478            sigma_in,
22479            x_1_in_name.as_ptr(),
22480            x_1_in,
22481            y_2_in_name.as_ptr(),
22482            y_2_in,
22483            y_3_in_name.as_ptr(),
22484            y_3_in,
22485            m_1_in_name.as_ptr(),
22486            m_1_in,
22487            m_2_in_name.as_ptr(),
22488            m_2_in,
22489            NULL,
22490        );
22491        utils::result(
22492            vips_op_response,
22493            VipsImage { ctx: out_out },
22494            Error::SharpenError,
22495        )
22496    }
22497}
22498
22499/// VipsGaussblur (gaussblur), gaussian blur
22500/// inp: `&VipsImage` -> Input image
22501/// sigma: `f64` -> Sigma of Gaussian
22502/// min: 0, max: 1000, default: 1.5
22503/// returns `VipsImage` - Output image
22504pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
22505    unsafe {
22506        let inp_in: *mut bindings::VipsImage = inp.ctx;
22507        let sigma_in: f64 = sigma;
22508        let mut out_out: *mut bindings::VipsImage = null_mut();
22509
22510        let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
22511        utils::result(
22512            vips_op_response,
22513            VipsImage { ctx: out_out },
22514            Error::GaussblurError,
22515        )
22516    }
22517}
22518
22519/// Options for gaussblur operation
22520#[derive(Clone, Debug)]
22521pub struct GaussblurOptions {
22522    /// min_ampl: `f64` -> Minimum amplitude of Gaussian
22523    /// min: 0.001, max: 1, default: 0.2
22524    pub min_ampl: f64,
22525    /// precision: `Precision` -> Convolve with this precision
22526    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
22527    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
22528    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22529    ///  `Last` -> VIPS_PRECISION_LAST = 3
22530    pub precision: Precision,
22531}
22532
22533impl std::default::Default for GaussblurOptions {
22534    fn default() -> Self {
22535        GaussblurOptions {
22536            min_ampl: f64::from(0.2),
22537            precision: Precision::Integer,
22538        }
22539    }
22540}
22541
22542/// VipsGaussblur (gaussblur), gaussian blur
22543/// inp: `&VipsImage` -> Input image
22544/// sigma: `f64` -> Sigma of Gaussian
22545/// min: 0, max: 1000, default: 1.5
22546/// gaussblur_options: `&GaussblurOptions` -> optional arguments
22547/// returns `VipsImage` - Output image
22548pub fn gaussblur_with_opts(
22549    inp: &VipsImage,
22550    sigma: f64,
22551    gaussblur_options: &GaussblurOptions,
22552) -> Result<VipsImage> {
22553    unsafe {
22554        let inp_in: *mut bindings::VipsImage = inp.ctx;
22555        let sigma_in: f64 = sigma;
22556        let mut out_out: *mut bindings::VipsImage = null_mut();
22557
22558        let min_ampl_in: f64 = gaussblur_options.min_ampl;
22559        let min_ampl_in_name = utils::new_c_string("min-ampl")?;
22560
22561        let precision_in: i32 = gaussblur_options.precision as i32;
22562        let precision_in_name = utils::new_c_string("precision")?;
22563
22564        let vips_op_response = bindings::vips_gaussblur(
22565            inp_in,
22566            &mut out_out,
22567            sigma_in,
22568            min_ampl_in_name.as_ptr(),
22569            min_ampl_in,
22570            precision_in_name.as_ptr(),
22571            precision_in,
22572            NULL,
22573        );
22574        utils::result(
22575            vips_op_response,
22576            VipsImage { ctx: out_out },
22577            Error::GaussblurError,
22578        )
22579    }
22580}
22581
22582/// VipsSobel (sobel), Sobel edge detector
22583/// inp: `&VipsImage` -> Input image
22584/// returns `VipsImage` - Output image
22585pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
22586    unsafe {
22587        let inp_in: *mut bindings::VipsImage = inp.ctx;
22588        let mut out_out: *mut bindings::VipsImage = null_mut();
22589
22590        let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
22591        utils::result(
22592            vips_op_response,
22593            VipsImage { ctx: out_out },
22594            Error::SobelError,
22595        )
22596    }
22597}
22598
22599/// VipsScharr (scharr), Scharr edge detector
22600/// inp: `&VipsImage` -> Input image
22601/// returns `VipsImage` - Output image
22602pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
22603    unsafe {
22604        let inp_in: *mut bindings::VipsImage = inp.ctx;
22605        let mut out_out: *mut bindings::VipsImage = null_mut();
22606
22607        let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
22608        utils::result(
22609            vips_op_response,
22610            VipsImage { ctx: out_out },
22611            Error::ScharrError,
22612        )
22613    }
22614}
22615
22616/// VipsPrewitt (prewitt), Prewitt edge detector
22617/// inp: `&VipsImage` -> Input image
22618/// returns `VipsImage` - Output image
22619pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
22620    unsafe {
22621        let inp_in: *mut bindings::VipsImage = inp.ctx;
22622        let mut out_out: *mut bindings::VipsImage = null_mut();
22623
22624        let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
22625        utils::result(
22626            vips_op_response,
22627            VipsImage { ctx: out_out },
22628            Error::PrewittError,
22629        )
22630    }
22631}
22632
22633/// VipsCanny (canny), Canny edge detector
22634/// inp: `&VipsImage` -> Input image
22635/// returns `VipsImage` - Output image
22636pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
22637    unsafe {
22638        let inp_in: *mut bindings::VipsImage = inp.ctx;
22639        let mut out_out: *mut bindings::VipsImage = null_mut();
22640
22641        let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
22642        utils::result(
22643            vips_op_response,
22644            VipsImage { ctx: out_out },
22645            Error::CannyError,
22646        )
22647    }
22648}
22649
22650/// Options for canny operation
22651#[derive(Clone, Debug)]
22652pub struct CannyOptions {
22653    /// sigma: `f64` -> Sigma of Gaussian
22654    /// min: 0.01, max: 1000, default: 1.4
22655    pub sigma: f64,
22656    /// precision: `Precision` -> Convolve with this precision
22657    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22658    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22659    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22660    ///  `Last` -> VIPS_PRECISION_LAST = 3
22661    pub precision: Precision,
22662}
22663
22664impl std::default::Default for CannyOptions {
22665    fn default() -> Self {
22666        CannyOptions {
22667            sigma: f64::from(1.4),
22668            precision: Precision::Float,
22669        }
22670    }
22671}
22672
22673/// VipsCanny (canny), Canny edge detector
22674/// inp: `&VipsImage` -> Input image
22675/// canny_options: `&CannyOptions` -> optional arguments
22676/// returns `VipsImage` - Output image
22677pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22678    unsafe {
22679        let inp_in: *mut bindings::VipsImage = inp.ctx;
22680        let mut out_out: *mut bindings::VipsImage = null_mut();
22681
22682        let sigma_in: f64 = canny_options.sigma;
22683        let sigma_in_name = utils::new_c_string("sigma")?;
22684
22685        let precision_in: i32 = canny_options.precision as i32;
22686        let precision_in_name = utils::new_c_string("precision")?;
22687
22688        let vips_op_response = bindings::vips_canny(
22689            inp_in,
22690            &mut out_out,
22691            sigma_in_name.as_ptr(),
22692            sigma_in,
22693            precision_in_name.as_ptr(),
22694            precision_in,
22695            NULL,
22696        );
22697        utils::result(
22698            vips_op_response,
22699            VipsImage { ctx: out_out },
22700            Error::CannyError,
22701        )
22702    }
22703}
22704
22705/// VipsFwfft (fwfft), forward FFT
22706/// inp: `&VipsImage` -> Input image
22707/// returns `VipsImage` - Output image
22708pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22709    unsafe {
22710        let inp_in: *mut bindings::VipsImage = inp.ctx;
22711        let mut out_out: *mut bindings::VipsImage = null_mut();
22712
22713        let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22714        utils::result(
22715            vips_op_response,
22716            VipsImage { ctx: out_out },
22717            Error::FwfftError,
22718        )
22719    }
22720}
22721
22722/// VipsInvfft (invfft), inverse FFT
22723/// inp: `&VipsImage` -> Input image
22724/// returns `VipsImage` - Output image
22725pub fn invfft(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_invfft(inp_in, &mut out_out, NULL);
22731        utils::result(
22732            vips_op_response,
22733            VipsImage { ctx: out_out },
22734            Error::InvfftError,
22735        )
22736    }
22737}
22738
22739/// Options for invfft operation
22740#[derive(Clone, Debug)]
22741pub struct InvfftOptions {
22742    /// real: `bool` -> Output only the real part of the transform
22743    /// default: false
22744    pub real: bool,
22745}
22746
22747impl std::default::Default for InvfftOptions {
22748    fn default() -> Self {
22749        InvfftOptions { real: false }
22750    }
22751}
22752
22753/// VipsInvfft (invfft), inverse FFT
22754/// inp: `&VipsImage` -> Input image
22755/// invfft_options: `&InvfftOptions` -> optional arguments
22756/// returns `VipsImage` - Output image
22757pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22758    unsafe {
22759        let inp_in: *mut bindings::VipsImage = inp.ctx;
22760        let mut out_out: *mut bindings::VipsImage = null_mut();
22761
22762        let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22763        let real_in_name = utils::new_c_string("real")?;
22764
22765        let vips_op_response =
22766            bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22767        utils::result(
22768            vips_op_response,
22769            VipsImage { ctx: out_out },
22770            Error::InvfftError,
22771        )
22772    }
22773}
22774
22775/// VipsFreqmult (freqmult), frequency-domain filtering
22776/// inp: `&VipsImage` -> Input image
22777/// mask: `&VipsImage` -> Input mask image
22778/// returns `VipsImage` - Output image
22779pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22780    unsafe {
22781        let inp_in: *mut bindings::VipsImage = inp.ctx;
22782        let mask_in: *mut bindings::VipsImage = mask.ctx;
22783        let mut out_out: *mut bindings::VipsImage = null_mut();
22784
22785        let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22786        utils::result(
22787            vips_op_response,
22788            VipsImage { ctx: out_out },
22789            Error::FreqmultError,
22790        )
22791    }
22792}
22793
22794/// VipsSpectrum (spectrum), make displayable power spectrum
22795/// inp: `&VipsImage` -> Input image
22796/// returns `VipsImage` - Output image
22797pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22798    unsafe {
22799        let inp_in: *mut bindings::VipsImage = inp.ctx;
22800        let mut out_out: *mut bindings::VipsImage = null_mut();
22801
22802        let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22803        utils::result(
22804            vips_op_response,
22805            VipsImage { ctx: out_out },
22806            Error::SpectrumError,
22807        )
22808    }
22809}
22810
22811/// VipsPhasecor (phasecor), calculate phase correlation
22812/// inp: `&VipsImage` -> Input image
22813/// in_2: `&VipsImage` -> Second input image
22814/// returns `VipsImage` - Output image
22815pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22816    unsafe {
22817        let inp_in: *mut bindings::VipsImage = inp.ctx;
22818        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22819        let mut out_out: *mut bindings::VipsImage = null_mut();
22820
22821        let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22822        utils::result(
22823            vips_op_response,
22824            VipsImage { ctx: out_out },
22825            Error::PhasecorError,
22826        )
22827    }
22828}
22829
22830/// VipsMorph (morph), morphology operation
22831/// inp: `&VipsImage` -> Input image argument
22832/// mask: `&VipsImage` -> Input matrix image
22833/// morph: `OperationMorphology` -> Morphological operation to perform
22834///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0 [DEFAULT]
22835///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
22836///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
22837/// returns `VipsImage` - Output image
22838pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22839    unsafe {
22840        let inp_in: *mut bindings::VipsImage = inp.ctx;
22841        let mask_in: *mut bindings::VipsImage = mask.ctx;
22842        let morph_in: i32 = morph as i32;
22843        let mut out_out: *mut bindings::VipsImage = null_mut();
22844
22845        let vips_op_response = bindings::vips_morph(
22846            inp_in,
22847            &mut out_out,
22848            mask_in,
22849            morph_in.try_into().unwrap(),
22850            NULL,
22851        );
22852        utils::result(
22853            vips_op_response,
22854            VipsImage { ctx: out_out },
22855            Error::MorphError,
22856        )
22857    }
22858}
22859
22860/// VipsRank (rank), rank filter
22861/// inp: `&VipsImage` -> Input image argument
22862/// width: `i32` -> Window width in pixels
22863/// min: 1, max: 100000, default: 11
22864/// height: `i32` -> Window height in pixels
22865/// min: 1, max: 100000, default: 11
22866/// index: `i32` -> Select pixel at index
22867/// min: 0, max: 100000000, default: 50
22868/// returns `VipsImage` - Output image
22869pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22870    unsafe {
22871        let inp_in: *mut bindings::VipsImage = inp.ctx;
22872        let width_in: i32 = width;
22873        let height_in: i32 = height;
22874        let index_in: i32 = index;
22875        let mut out_out: *mut bindings::VipsImage = null_mut();
22876
22877        let vips_op_response =
22878            bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22879        utils::result(
22880            vips_op_response,
22881            VipsImage { ctx: out_out },
22882            Error::RankError,
22883        )
22884    }
22885}
22886
22887/// VipsCountlines (countlines), count lines in an image
22888/// inp: `&VipsImage` -> Input image argument
22889/// direction: `Direction` -> Countlines left-right or up-down
22890///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22891///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22892///  `Last` -> VIPS_DIRECTION_LAST = 2
22893/// returns `f64` - Number of lines
22894pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22895    unsafe {
22896        let inp_in: *mut bindings::VipsImage = inp.ctx;
22897        let direction_in: i32 = direction as i32;
22898        let mut nolines_out: f64 = f64::from(0);
22899
22900        let vips_op_response = bindings::vips_countlines(
22901            inp_in,
22902            &mut nolines_out,
22903            direction_in.try_into().unwrap(),
22904            NULL,
22905        );
22906        utils::result(vips_op_response, nolines_out, Error::CountlineError)
22907    }
22908}
22909
22910/// VipsLabelregions (labelregions), label regions in an image
22911/// inp: `&VipsImage` -> Input image argument
22912/// returns `VipsImage` - Mask of region labels
22913pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22914    unsafe {
22915        let inp_in: *mut bindings::VipsImage = inp.ctx;
22916        let mut mask_out: *mut bindings::VipsImage = null_mut();
22917
22918        let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22919        utils::result(
22920            vips_op_response,
22921            VipsImage { ctx: mask_out },
22922            Error::LabelregionError,
22923        )
22924    }
22925}
22926
22927/// Options for labelregions operation
22928#[derive(Clone, Debug)]
22929pub struct LabelregionOptions {
22930    /// segments: `i32` -> Number of discrete contiguous regions
22931    /// min: 0, max: 1000000000, default: 0
22932    pub segments: i32,
22933}
22934
22935impl std::default::Default for LabelregionOptions {
22936    fn default() -> Self {
22937        LabelregionOptions {
22938            segments: i32::from(0),
22939        }
22940    }
22941}
22942
22943/// VipsLabelregions (labelregions), label regions in an image
22944/// inp: `&VipsImage` -> Input image argument
22945/// labelregions_options: `&LabelregionOptions` -> optional arguments
22946/// returns `VipsImage` - Mask of region labels
22947pub fn labelregions_with_opts(
22948    inp: &VipsImage,
22949    labelregions_options: &LabelregionOptions,
22950) -> Result<VipsImage> {
22951    unsafe {
22952        let inp_in: *mut bindings::VipsImage = inp.ctx;
22953        let mut mask_out: *mut bindings::VipsImage = null_mut();
22954
22955        let segments_in: i32 = labelregions_options.segments;
22956        let segments_in_name = utils::new_c_string("segments")?;
22957
22958        let vips_op_response = bindings::vips_labelregions(
22959            inp_in,
22960            &mut mask_out,
22961            segments_in_name.as_ptr(),
22962            segments_in,
22963            NULL,
22964        );
22965        utils::result(
22966            vips_op_response,
22967            VipsImage { ctx: mask_out },
22968            Error::LabelregionError,
22969        )
22970    }
22971}
22972
22973/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22974/// inp: `&VipsImage` -> Input image argument
22975/// returns `VipsImage` - Value of nearest non-zero pixel
22976pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22977    unsafe {
22978        let inp_in: *mut bindings::VipsImage = inp.ctx;
22979        let mut out_out: *mut bindings::VipsImage = null_mut();
22980
22981        let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22982        utils::result(
22983            vips_op_response,
22984            VipsImage { ctx: out_out },
22985            Error::FillNearestError,
22986        )
22987    }
22988}
22989
22990/// Options for fill_nearest operation
22991#[derive(Clone, Debug)]
22992pub struct FillNearestOptions {
22993    /// distance: `VipsImage` -> Distance to nearest non-zero pixel
22994    pub distance: VipsImage,
22995}
22996
22997impl std::default::Default for FillNearestOptions {
22998    fn default() -> Self {
22999        FillNearestOptions {
23000            distance: VipsImage::new(),
23001        }
23002    }
23003}
23004
23005/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
23006/// inp: `&VipsImage` -> Input image argument
23007/// fill_nearest_options: `&FillNearestOptions` -> optional arguments
23008/// returns `VipsImage` - Value of nearest non-zero pixel
23009pub fn fill_nearest_with_opts(
23010    inp: &VipsImage,
23011    fill_nearest_options: &FillNearestOptions,
23012) -> Result<VipsImage> {
23013    unsafe {
23014        let inp_in: *mut bindings::VipsImage = inp.ctx;
23015        let mut out_out: *mut bindings::VipsImage = null_mut();
23016
23017        let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
23018        let distance_in_name = utils::new_c_string("distance")?;
23019
23020        let vips_op_response = bindings::vips_fill_nearest(
23021            inp_in,
23022            &mut out_out,
23023            distance_in_name.as_ptr(),
23024            distance_in,
23025            NULL,
23026        );
23027        utils::result(
23028            vips_op_response,
23029            VipsImage { ctx: out_out },
23030            Error::FillNearestError,
23031        )
23032    }
23033}
23034
23035/// VipsDrawRect (draw_rect), paint a rectangle on an image
23036/// image: `&VipsImage` -> Image to draw on
23037/// ink: `&mut [f64]` -> Color for pixels
23038/// left: `i32` -> Rect to fill
23039/// min: -1000000000, max: 1000000000, default: 0
23040/// top: `i32` -> Rect to fill
23041/// min: -1000000000, max: 1000000000, default: 0
23042/// width: `i32` -> Rect to fill
23043/// min: -1000000000, max: 1000000000, default: 0
23044/// height: `i32` -> Rect to fill
23045/// min: -1000000000, max: 1000000000, default: 0
23046
23047pub fn draw_rect(
23048    image: &VipsImage,
23049    ink: &mut [f64],
23050    left: i32,
23051    top: i32,
23052    width: i32,
23053    height: i32,
23054) -> Result<()> {
23055    unsafe {
23056        let image_in: *mut bindings::VipsImage = image.ctx;
23057        let ink_in: *mut f64 = ink.as_mut_ptr();
23058        let left_in: i32 = left;
23059        let top_in: i32 = top;
23060        let width_in: i32 = width;
23061        let height_in: i32 = height;
23062
23063        let vips_op_response = bindings::vips_draw_rect(
23064            image_in,
23065            ink_in,
23066            ink.len() as i32,
23067            left_in,
23068            top_in,
23069            width_in,
23070            height_in,
23071            NULL,
23072        );
23073        utils::result(vips_op_response, (), Error::DrawRectError)
23074    }
23075}
23076
23077/// Options for draw_rect operation
23078#[derive(Clone, Debug)]
23079pub struct DrawRectOptions {
23080    /// fill: `bool` -> Draw a solid object
23081    /// default: false
23082    pub fill: bool,
23083}
23084
23085impl std::default::Default for DrawRectOptions {
23086    fn default() -> Self {
23087        DrawRectOptions { fill: false }
23088    }
23089}
23090
23091/// VipsDrawRect (draw_rect), paint a rectangle on an image
23092/// image: `&VipsImage` -> Image to draw on
23093/// ink: `&mut [f64]` -> Color for pixels
23094/// left: `i32` -> Rect to fill
23095/// min: -1000000000, max: 1000000000, default: 0
23096/// top: `i32` -> Rect to fill
23097/// min: -1000000000, max: 1000000000, default: 0
23098/// width: `i32` -> Rect to fill
23099/// min: -1000000000, max: 1000000000, default: 0
23100/// height: `i32` -> Rect to fill
23101/// min: -1000000000, max: 1000000000, default: 0
23102/// draw_rect_options: `&DrawRectOptions` -> optional arguments
23103
23104pub fn draw_rect_with_opts(
23105    image: &VipsImage,
23106    ink: &mut [f64],
23107    left: i32,
23108    top: i32,
23109    width: i32,
23110    height: i32,
23111    draw_rect_options: &DrawRectOptions,
23112) -> Result<()> {
23113    unsafe {
23114        let image_in: *mut bindings::VipsImage = image.ctx;
23115        let ink_in: *mut f64 = ink.as_mut_ptr();
23116        let left_in: i32 = left;
23117        let top_in: i32 = top;
23118        let width_in: i32 = width;
23119        let height_in: i32 = height;
23120
23121        let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
23122        let fill_in_name = utils::new_c_string("fill")?;
23123
23124        let vips_op_response = bindings::vips_draw_rect(
23125            image_in,
23126            ink_in,
23127            ink.len() as i32,
23128            left_in,
23129            top_in,
23130            width_in,
23131            height_in,
23132            fill_in_name.as_ptr(),
23133            fill_in,
23134            NULL,
23135        );
23136        utils::result(vips_op_response, (), Error::DrawRectError)
23137    }
23138}
23139
23140/// VipsDrawMask (draw_mask), draw a mask on an image
23141/// image: `&VipsImage` -> Image to draw on
23142/// ink: `&mut [f64]` -> Color for pixels
23143/// mask: `&VipsImage` -> Mask of pixels to draw
23144/// x: `i32` -> Draw mask here
23145/// min: -1000000000, max: 1000000000, default: 0
23146/// y: `i32` -> Draw mask here
23147/// min: -1000000000, max: 1000000000, default: 0
23148
23149pub fn draw_mask(
23150    image: &VipsImage,
23151    ink: &mut [f64],
23152    mask: &VipsImage,
23153    x: i32,
23154    y: i32,
23155) -> Result<()> {
23156    unsafe {
23157        let image_in: *mut bindings::VipsImage = image.ctx;
23158        let ink_in: *mut f64 = ink.as_mut_ptr();
23159        let mask_in: *mut bindings::VipsImage = mask.ctx;
23160        let x_in: i32 = x;
23161        let y_in: i32 = y;
23162
23163        let vips_op_response = bindings::vips_draw_mask(
23164            image_in,
23165            ink_in,
23166            ink.len() as i32,
23167            mask_in,
23168            x_in,
23169            y_in,
23170            NULL,
23171        );
23172        utils::result(vips_op_response, (), Error::DrawMaskError)
23173    }
23174}
23175
23176/// VipsDrawLine (draw_line), draw a line on an image
23177/// image: `&VipsImage` -> Image to draw on
23178/// ink: `&mut [f64]` -> Color for pixels
23179/// x_1: `i32` -> Start of draw_line
23180/// min: -1000000000, max: 1000000000, default: 0
23181/// y_1: `i32` -> Start of draw_line
23182/// min: -1000000000, max: 1000000000, default: 0
23183/// x_2: `i32` -> End of draw_line
23184/// min: -1000000000, max: 1000000000, default: 0
23185/// y_2: `i32` -> End of draw_line
23186/// min: -1000000000, max: 1000000000, default: 0
23187
23188pub fn draw_line(
23189    image: &VipsImage,
23190    ink: &mut [f64],
23191    x_1: i32,
23192    y_1: i32,
23193    x_2: i32,
23194    y_2: i32,
23195) -> Result<()> {
23196    unsafe {
23197        let image_in: *mut bindings::VipsImage = image.ctx;
23198        let ink_in: *mut f64 = ink.as_mut_ptr();
23199        let x_1_in: i32 = x_1;
23200        let y_1_in: i32 = y_1;
23201        let x_2_in: i32 = x_2;
23202        let y_2_in: i32 = y_2;
23203
23204        let vips_op_response = bindings::vips_draw_line(
23205            image_in,
23206            ink_in,
23207            ink.len() as i32,
23208            x_1_in,
23209            y_1_in,
23210            x_2_in,
23211            y_2_in,
23212            NULL,
23213        );
23214        utils::result(vips_op_response, (), Error::DrawLineError)
23215    }
23216}
23217
23218/// VipsDrawCircle (draw_circle), draw a circle on an image
23219/// image: `&VipsImage` -> Image to draw on
23220/// ink: `&mut [f64]` -> Color for pixels
23221/// cx: `i32` -> Centre of draw_circle
23222/// min: -1000000000, max: 1000000000, default: 0
23223/// cy: `i32` -> Centre of draw_circle
23224/// min: -1000000000, max: 1000000000, default: 0
23225/// radius: `i32` -> Radius in pixels
23226/// min: 0, max: 1000000000, default: 0
23227
23228pub fn draw_circle(
23229    image: &VipsImage,
23230    ink: &mut [f64],
23231    cx: i32,
23232    cy: i32,
23233    radius: i32,
23234) -> Result<()> {
23235    unsafe {
23236        let image_in: *mut bindings::VipsImage = image.ctx;
23237        let ink_in: *mut f64 = ink.as_mut_ptr();
23238        let cx_in: i32 = cx;
23239        let cy_in: i32 = cy;
23240        let radius_in: i32 = radius;
23241
23242        let vips_op_response = bindings::vips_draw_circle(
23243            image_in,
23244            ink_in,
23245            ink.len() as i32,
23246            cx_in,
23247            cy_in,
23248            radius_in,
23249            NULL,
23250        );
23251        utils::result(vips_op_response, (), Error::DrawCircleError)
23252    }
23253}
23254
23255/// Options for draw_circle operation
23256#[derive(Clone, Debug)]
23257pub struct DrawCircleOptions {
23258    /// fill: `bool` -> Draw a solid object
23259    /// default: false
23260    pub fill: bool,
23261}
23262
23263impl std::default::Default for DrawCircleOptions {
23264    fn default() -> Self {
23265        DrawCircleOptions { fill: false }
23266    }
23267}
23268
23269/// VipsDrawCircle (draw_circle), draw a circle on an image
23270/// image: `&VipsImage` -> Image to draw on
23271/// ink: `&mut [f64]` -> Color for pixels
23272/// cx: `i32` -> Centre of draw_circle
23273/// min: -1000000000, max: 1000000000, default: 0
23274/// cy: `i32` -> Centre of draw_circle
23275/// min: -1000000000, max: 1000000000, default: 0
23276/// radius: `i32` -> Radius in pixels
23277/// min: 0, max: 1000000000, default: 0
23278/// draw_circle_options: `&DrawCircleOptions` -> optional arguments
23279
23280pub fn draw_circle_with_opts(
23281    image: &VipsImage,
23282    ink: &mut [f64],
23283    cx: i32,
23284    cy: i32,
23285    radius: i32,
23286    draw_circle_options: &DrawCircleOptions,
23287) -> Result<()> {
23288    unsafe {
23289        let image_in: *mut bindings::VipsImage = image.ctx;
23290        let ink_in: *mut f64 = ink.as_mut_ptr();
23291        let cx_in: i32 = cx;
23292        let cy_in: i32 = cy;
23293        let radius_in: i32 = radius;
23294
23295        let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
23296        let fill_in_name = utils::new_c_string("fill")?;
23297
23298        let vips_op_response = bindings::vips_draw_circle(
23299            image_in,
23300            ink_in,
23301            ink.len() as i32,
23302            cx_in,
23303            cy_in,
23304            radius_in,
23305            fill_in_name.as_ptr(),
23306            fill_in,
23307            NULL,
23308        );
23309        utils::result(vips_op_response, (), Error::DrawCircleError)
23310    }
23311}
23312
23313/// VipsDrawFlood (draw_flood), flood-fill an area
23314/// image: `&VipsImage` -> Image to draw on
23315/// ink: `&mut [f64]` -> Color for pixels
23316/// x: `i32` -> DrawFlood start point
23317/// min: 0, max: 1000000000, default: 0
23318/// y: `i32` -> DrawFlood start point
23319/// min: 0, max: 1000000000, default: 0
23320
23321pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
23322    unsafe {
23323        let image_in: *mut bindings::VipsImage = image.ctx;
23324        let ink_in: *mut f64 = ink.as_mut_ptr();
23325        let x_in: i32 = x;
23326        let y_in: i32 = y;
23327
23328        let vips_op_response =
23329            bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
23330        utils::result(vips_op_response, (), Error::DrawFloodError)
23331    }
23332}
23333
23334/// Options for draw_flood operation
23335#[derive(Clone, Debug)]
23336pub struct DrawFloodOptions {
23337    /// test: `VipsImage` -> Test pixels in this image
23338    pub test: VipsImage,
23339    /// equal: `bool` -> DrawFlood while equal to edge
23340    /// default: false
23341    pub equal: bool,
23342    /// left: `i32` -> Left edge of modified area
23343    /// min: 0, max: 1000000000, default: 0
23344    pub left: i32,
23345    /// top: `i32` -> Top edge of modified area
23346    /// min: 0, max: 1000000000, default: 0
23347    pub top: i32,
23348    /// width: `i32` -> Width of modified area
23349    /// min: 0, max: 1000000000, default: 0
23350    pub width: i32,
23351    /// height: `i32` -> Height of modified area
23352    /// min: 0, max: 1000000000, default: 0
23353    pub height: i32,
23354}
23355
23356impl std::default::Default for DrawFloodOptions {
23357    fn default() -> Self {
23358        DrawFloodOptions {
23359            test: VipsImage::new(),
23360            equal: false,
23361            left: i32::from(0),
23362            top: i32::from(0),
23363            width: i32::from(0),
23364            height: i32::from(0),
23365        }
23366    }
23367}
23368
23369/// VipsDrawFlood (draw_flood), flood-fill an area
23370/// image: `&VipsImage` -> Image to draw on
23371/// ink: `&mut [f64]` -> Color for pixels
23372/// x: `i32` -> DrawFlood start point
23373/// min: 0, max: 1000000000, default: 0
23374/// y: `i32` -> DrawFlood start point
23375/// min: 0, max: 1000000000, default: 0
23376/// draw_flood_options: `&DrawFloodOptions` -> optional arguments
23377
23378pub fn draw_flood_with_opts(
23379    image: &VipsImage,
23380    ink: &mut [f64],
23381    x: i32,
23382    y: i32,
23383    draw_flood_options: &DrawFloodOptions,
23384) -> Result<()> {
23385    unsafe {
23386        let image_in: *mut bindings::VipsImage = image.ctx;
23387        let ink_in: *mut f64 = ink.as_mut_ptr();
23388        let x_in: i32 = x;
23389        let y_in: i32 = y;
23390
23391        let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
23392        let test_in_name = utils::new_c_string("test")?;
23393
23394        let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
23395        let equal_in_name = utils::new_c_string("equal")?;
23396
23397        let left_in: i32 = draw_flood_options.left;
23398        let left_in_name = utils::new_c_string("left")?;
23399
23400        let top_in: i32 = draw_flood_options.top;
23401        let top_in_name = utils::new_c_string("top")?;
23402
23403        let width_in: i32 = draw_flood_options.width;
23404        let width_in_name = utils::new_c_string("width")?;
23405
23406        let height_in: i32 = draw_flood_options.height;
23407        let height_in_name = utils::new_c_string("height")?;
23408
23409        let vips_op_response = bindings::vips_draw_flood(
23410            image_in,
23411            ink_in,
23412            ink.len() as i32,
23413            x_in,
23414            y_in,
23415            test_in_name.as_ptr(),
23416            test_in,
23417            equal_in_name.as_ptr(),
23418            equal_in,
23419            left_in_name.as_ptr(),
23420            left_in,
23421            top_in_name.as_ptr(),
23422            top_in,
23423            width_in_name.as_ptr(),
23424            width_in,
23425            height_in_name.as_ptr(),
23426            height_in,
23427            NULL,
23428        );
23429        utils::result(vips_op_response, (), Error::DrawFloodError)
23430    }
23431}
23432
23433/// VipsDrawImage (draw_image), paint an image into another image
23434/// image: `&VipsImage` -> Image to draw on
23435/// sub: `&VipsImage` -> Sub-image to insert into main image
23436/// x: `i32` -> Draw image here
23437/// min: -1000000000, max: 1000000000, default: 0
23438/// y: `i32` -> Draw image here
23439/// min: -1000000000, max: 1000000000, default: 0
23440
23441pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
23442    unsafe {
23443        let image_in: *mut bindings::VipsImage = image.ctx;
23444        let sub_in: *mut bindings::VipsImage = sub.ctx;
23445        let x_in: i32 = x;
23446        let y_in: i32 = y;
23447
23448        let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
23449        utils::result(vips_op_response, (), Error::DrawImageError)
23450    }
23451}
23452
23453/// Options for draw_image operation
23454#[derive(Clone, Debug)]
23455pub struct DrawImageOptions {
23456    /// mode: `CombineMode` -> Combining mode
23457    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0 [DEFAULT]
23458    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
23459    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
23460    pub mode: CombineMode,
23461}
23462
23463impl std::default::Default for DrawImageOptions {
23464    fn default() -> Self {
23465        DrawImageOptions {
23466            mode: CombineMode::Set,
23467        }
23468    }
23469}
23470
23471/// VipsDrawImage (draw_image), paint an image into another image
23472/// image: `&VipsImage` -> Image to draw on
23473/// sub: `&VipsImage` -> Sub-image to insert into main image
23474/// x: `i32` -> Draw image here
23475/// min: -1000000000, max: 1000000000, default: 0
23476/// y: `i32` -> Draw image here
23477/// min: -1000000000, max: 1000000000, default: 0
23478/// draw_image_options: `&DrawImageOptions` -> optional arguments
23479
23480pub fn draw_image_with_opts(
23481    image: &VipsImage,
23482    sub: &VipsImage,
23483    x: i32,
23484    y: i32,
23485    draw_image_options: &DrawImageOptions,
23486) -> Result<()> {
23487    unsafe {
23488        let image_in: *mut bindings::VipsImage = image.ctx;
23489        let sub_in: *mut bindings::VipsImage = sub.ctx;
23490        let x_in: i32 = x;
23491        let y_in: i32 = y;
23492
23493        let mode_in: i32 = draw_image_options.mode as i32;
23494        let mode_in_name = utils::new_c_string("mode")?;
23495
23496        let vips_op_response = bindings::vips_draw_image(
23497            image_in,
23498            sub_in,
23499            x_in,
23500            y_in,
23501            mode_in_name.as_ptr(),
23502            mode_in,
23503            NULL,
23504        );
23505        utils::result(vips_op_response, (), Error::DrawImageError)
23506    }
23507}
23508
23509/// VipsDrawSmudge (draw_smudge), blur a rectangle on an image
23510/// image: `&VipsImage` -> Image to draw on
23511/// left: `i32` -> Rect to fill
23512/// min: -1000000000, max: 1000000000, default: 0
23513/// top: `i32` -> Rect to fill
23514/// min: -1000000000, max: 1000000000, default: 0
23515/// width: `i32` -> Rect to fill
23516/// min: -1000000000, max: 1000000000, default: 0
23517/// height: `i32` -> Rect to fill
23518/// min: -1000000000, max: 1000000000, default: 0
23519
23520pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
23521    unsafe {
23522        let image_in: *mut bindings::VipsImage = image.ctx;
23523        let left_in: i32 = left;
23524        let top_in: i32 = top;
23525        let width_in: i32 = width;
23526        let height_in: i32 = height;
23527
23528        let vips_op_response =
23529            bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
23530        utils::result(vips_op_response, (), Error::DrawSmudgeError)
23531    }
23532}
23533
23534/// VipsMerge (merge), merge two images
23535/// refp: `&VipsImage` -> Reference image
23536/// sec: `&VipsImage` -> Secondary image
23537/// direction: `Direction` -> Horizontal or vertical merge
23538///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23539///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23540///  `Last` -> VIPS_DIRECTION_LAST = 2
23541/// dx: `i32` -> Horizontal displacement from sec to ref
23542/// min: -100000000, max: 1000000000, default: 1
23543/// dy: `i32` -> Vertical displacement from sec to ref
23544/// min: -100000000, max: 1000000000, default: 1
23545/// returns `VipsImage` - Output image
23546pub fn merge(
23547    refp: &VipsImage,
23548    sec: &VipsImage,
23549    direction: Direction,
23550    dx: i32,
23551    dy: i32,
23552) -> Result<VipsImage> {
23553    unsafe {
23554        let refp_in: *mut bindings::VipsImage = refp.ctx;
23555        let sec_in: *mut bindings::VipsImage = sec.ctx;
23556        let direction_in: i32 = direction as i32;
23557        let dx_in: i32 = dx;
23558        let dy_in: i32 = dy;
23559        let mut out_out: *mut bindings::VipsImage = null_mut();
23560
23561        let vips_op_response = bindings::vips_merge(
23562            refp_in,
23563            sec_in,
23564            &mut out_out,
23565            direction_in.try_into().unwrap(),
23566            dx_in,
23567            dy_in,
23568            NULL,
23569        );
23570        utils::result(
23571            vips_op_response,
23572            VipsImage { ctx: out_out },
23573            Error::MergeError,
23574        )
23575    }
23576}
23577
23578/// Options for merge operation
23579#[derive(Clone, Debug)]
23580pub struct MergeOptions {
23581    /// mblend: `i32` -> Maximum blend size
23582    /// min: 0, max: 10000, default: 10
23583    pub mblend: i32,
23584}
23585
23586impl std::default::Default for MergeOptions {
23587    fn default() -> Self {
23588        MergeOptions {
23589            mblend: i32::from(10),
23590        }
23591    }
23592}
23593
23594/// VipsMerge (merge), merge two images
23595/// refp: `&VipsImage` -> Reference image
23596/// sec: `&VipsImage` -> Secondary image
23597/// direction: `Direction` -> Horizontal or vertical merge
23598///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23599///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23600///  `Last` -> VIPS_DIRECTION_LAST = 2
23601/// dx: `i32` -> Horizontal displacement from sec to ref
23602/// min: -100000000, max: 1000000000, default: 1
23603/// dy: `i32` -> Vertical displacement from sec to ref
23604/// min: -100000000, max: 1000000000, default: 1
23605/// merge_options: `&MergeOptions` -> optional arguments
23606/// returns `VipsImage` - Output image
23607pub fn merge_with_opts(
23608    refp: &VipsImage,
23609    sec: &VipsImage,
23610    direction: Direction,
23611    dx: i32,
23612    dy: i32,
23613    merge_options: &MergeOptions,
23614) -> Result<VipsImage> {
23615    unsafe {
23616        let refp_in: *mut bindings::VipsImage = refp.ctx;
23617        let sec_in: *mut bindings::VipsImage = sec.ctx;
23618        let direction_in: i32 = direction as i32;
23619        let dx_in: i32 = dx;
23620        let dy_in: i32 = dy;
23621        let mut out_out: *mut bindings::VipsImage = null_mut();
23622
23623        let mblend_in: i32 = merge_options.mblend;
23624        let mblend_in_name = utils::new_c_string("mblend")?;
23625
23626        let vips_op_response = bindings::vips_merge(
23627            refp_in,
23628            sec_in,
23629            &mut out_out,
23630            direction_in.try_into().unwrap(),
23631            dx_in,
23632            dy_in,
23633            mblend_in_name.as_ptr(),
23634            mblend_in,
23635            NULL,
23636        );
23637        utils::result(
23638            vips_op_response,
23639            VipsImage { ctx: out_out },
23640            Error::MergeError,
23641        )
23642    }
23643}
23644
23645/// VipsMosaic (mosaic), mosaic two images
23646/// refp: `&VipsImage` -> Reference image
23647/// sec: `&VipsImage` -> Secondary image
23648/// direction: `Direction` -> Horizontal or vertical mosaic
23649///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23650///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23651///  `Last` -> VIPS_DIRECTION_LAST = 2
23652/// xref: `i32` -> Position of reference tie-point
23653/// min: 0, max: 1000000000, default: 1
23654/// yref: `i32` -> Position of reference tie-point
23655/// min: 0, max: 1000000000, default: 1
23656/// xsec: `i32` -> Position of secondary tie-point
23657/// min: 0, max: 1000000000, default: 1
23658/// ysec: `i32` -> Position of secondary tie-point
23659/// min: 0, max: 1000000000, default: 1
23660/// returns `VipsImage` - Output image
23661pub fn mosaic(
23662    refp: &VipsImage,
23663    sec: &VipsImage,
23664    direction: Direction,
23665    xref: i32,
23666    yref: i32,
23667    xsec: i32,
23668    ysec: i32,
23669) -> Result<VipsImage> {
23670    unsafe {
23671        let refp_in: *mut bindings::VipsImage = refp.ctx;
23672        let sec_in: *mut bindings::VipsImage = sec.ctx;
23673        let direction_in: i32 = direction as i32;
23674        let xref_in: i32 = xref;
23675        let yref_in: i32 = yref;
23676        let xsec_in: i32 = xsec;
23677        let ysec_in: i32 = ysec;
23678        let mut out_out: *mut bindings::VipsImage = null_mut();
23679
23680        let vips_op_response = bindings::vips_mosaic(
23681            refp_in,
23682            sec_in,
23683            &mut out_out,
23684            direction_in.try_into().unwrap(),
23685            xref_in,
23686            yref_in,
23687            xsec_in,
23688            ysec_in,
23689            NULL,
23690        );
23691        utils::result(
23692            vips_op_response,
23693            VipsImage { ctx: out_out },
23694            Error::MosaicError,
23695        )
23696    }
23697}
23698
23699/// Options for mosaic operation
23700#[derive(Clone, Debug)]
23701pub struct MosaicOptions {
23702    /// hwindow: `i32` -> Half window size
23703    /// min: 0, max: 1000000000, default: 5
23704    pub hwindow: i32,
23705    /// harea: `i32` -> Half area size
23706    /// min: 0, max: 1000000000, default: 15
23707    pub harea: i32,
23708    /// mblend: `i32` -> Maximum blend size
23709    /// min: 0, max: 10000, default: 10
23710    pub mblend: i32,
23711    /// bandno: `i32` -> Band to search for features on
23712    /// min: 0, max: 10000, default: 0
23713    pub bandno: i32,
23714    /// dx_0: `i32` -> Detected integer offset
23715    /// min: -10000000, max: 10000000, default: 0
23716    pub dx_0: i32,
23717    /// dy_0: `i32` -> Detected integer offset
23718    /// min: -10000000, max: 10000000, default: 0
23719    pub dy_0: i32,
23720    /// scale_1: `f64` -> Detected scale
23721    /// min: -10000000, max: 10000000, default: 1
23722    pub scale_1: f64,
23723    /// angle_1: `f64` -> Detected rotation
23724    /// min: -10000000, max: 10000000, default: 0
23725    pub angle_1: f64,
23726    /// dy_1: `f64` -> Detected first-order displacement
23727    /// min: -10000000, max: 10000000, default: 0
23728    pub dy_1: f64,
23729    /// dx_1: `f64` -> Detected first-order displacement
23730    /// min: -10000000, max: 10000000, default: 0
23731    pub dx_1: f64,
23732}
23733
23734impl std::default::Default for MosaicOptions {
23735    fn default() -> Self {
23736        MosaicOptions {
23737            hwindow: i32::from(5),
23738            harea: i32::from(15),
23739            mblend: i32::from(10),
23740            bandno: i32::from(0),
23741            dx_0: i32::from(0),
23742            dy_0: i32::from(0),
23743            scale_1: f64::from(1),
23744            angle_1: f64::from(0),
23745            dy_1: f64::from(0),
23746            dx_1: f64::from(0),
23747        }
23748    }
23749}
23750
23751/// VipsMosaic (mosaic), mosaic two images
23752/// refp: `&VipsImage` -> Reference image
23753/// sec: `&VipsImage` -> Secondary image
23754/// direction: `Direction` -> Horizontal or vertical mosaic
23755///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23756///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23757///  `Last` -> VIPS_DIRECTION_LAST = 2
23758/// xref: `i32` -> Position of reference tie-point
23759/// min: 0, max: 1000000000, default: 1
23760/// yref: `i32` -> Position of reference tie-point
23761/// min: 0, max: 1000000000, default: 1
23762/// xsec: `i32` -> Position of secondary tie-point
23763/// min: 0, max: 1000000000, default: 1
23764/// ysec: `i32` -> Position of secondary tie-point
23765/// min: 0, max: 1000000000, default: 1
23766/// mosaic_options: `&MosaicOptions` -> optional arguments
23767/// returns `VipsImage` - Output image
23768pub fn mosaic_with_opts(
23769    refp: &VipsImage,
23770    sec: &VipsImage,
23771    direction: Direction,
23772    xref: i32,
23773    yref: i32,
23774    xsec: i32,
23775    ysec: i32,
23776    mosaic_options: &MosaicOptions,
23777) -> Result<VipsImage> {
23778    unsafe {
23779        let refp_in: *mut bindings::VipsImage = refp.ctx;
23780        let sec_in: *mut bindings::VipsImage = sec.ctx;
23781        let direction_in: i32 = direction as i32;
23782        let xref_in: i32 = xref;
23783        let yref_in: i32 = yref;
23784        let xsec_in: i32 = xsec;
23785        let ysec_in: i32 = ysec;
23786        let mut out_out: *mut bindings::VipsImage = null_mut();
23787
23788        let hwindow_in: i32 = mosaic_options.hwindow;
23789        let hwindow_in_name = utils::new_c_string("hwindow")?;
23790
23791        let harea_in: i32 = mosaic_options.harea;
23792        let harea_in_name = utils::new_c_string("harea")?;
23793
23794        let mblend_in: i32 = mosaic_options.mblend;
23795        let mblend_in_name = utils::new_c_string("mblend")?;
23796
23797        let bandno_in: i32 = mosaic_options.bandno;
23798        let bandno_in_name = utils::new_c_string("bandno")?;
23799
23800        let dx_0_in: i32 = mosaic_options.dx_0;
23801        let dx_0_in_name = utils::new_c_string("dx0")?;
23802
23803        let dy_0_in: i32 = mosaic_options.dy_0;
23804        let dy_0_in_name = utils::new_c_string("dy0")?;
23805
23806        let scale_1_in: f64 = mosaic_options.scale_1;
23807        let scale_1_in_name = utils::new_c_string("scale1")?;
23808
23809        let angle_1_in: f64 = mosaic_options.angle_1;
23810        let angle_1_in_name = utils::new_c_string("angle1")?;
23811
23812        let dy_1_in: f64 = mosaic_options.dy_1;
23813        let dy_1_in_name = utils::new_c_string("dy1")?;
23814
23815        let dx_1_in: f64 = mosaic_options.dx_1;
23816        let dx_1_in_name = utils::new_c_string("dx1")?;
23817
23818        let vips_op_response = bindings::vips_mosaic(
23819            refp_in,
23820            sec_in,
23821            &mut out_out,
23822            direction_in.try_into().unwrap(),
23823            xref_in,
23824            yref_in,
23825            xsec_in,
23826            ysec_in,
23827            hwindow_in_name.as_ptr(),
23828            hwindow_in,
23829            harea_in_name.as_ptr(),
23830            harea_in,
23831            mblend_in_name.as_ptr(),
23832            mblend_in,
23833            bandno_in_name.as_ptr(),
23834            bandno_in,
23835            dx_0_in_name.as_ptr(),
23836            dx_0_in,
23837            dy_0_in_name.as_ptr(),
23838            dy_0_in,
23839            scale_1_in_name.as_ptr(),
23840            scale_1_in,
23841            angle_1_in_name.as_ptr(),
23842            angle_1_in,
23843            dy_1_in_name.as_ptr(),
23844            dy_1_in,
23845            dx_1_in_name.as_ptr(),
23846            dx_1_in,
23847            NULL,
23848        );
23849        utils::result(
23850            vips_op_response,
23851            VipsImage { ctx: out_out },
23852            Error::MosaicError,
23853        )
23854    }
23855}
23856
23857/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23858/// refp: `&VipsImage` -> Reference image
23859/// sec: `&VipsImage` -> Secondary image
23860/// direction: `Direction` -> Horizontal or vertical mosaic
23861///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23862///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23863///  `Last` -> VIPS_DIRECTION_LAST = 2
23864/// xr_1: `i32` -> Position of first reference tie-point
23865/// min: -1000000000, max: 1000000000, default: 1
23866/// yr_1: `i32` -> Position of first reference tie-point
23867/// min: -1000000000, max: 1000000000, default: 1
23868/// xs_1: `i32` -> Position of first secondary tie-point
23869/// min: -1000000000, max: 1000000000, default: 1
23870/// ys_1: `i32` -> Position of first secondary tie-point
23871/// min: -1000000000, max: 1000000000, default: 1
23872/// xr_2: `i32` -> Position of second reference tie-point
23873/// min: -1000000000, max: 1000000000, default: 1
23874/// yr_2: `i32` -> Position of second reference tie-point
23875/// min: -1000000000, max: 1000000000, default: 1
23876/// xs_2: `i32` -> Position of second secondary tie-point
23877/// min: -1000000000, max: 1000000000, default: 1
23878/// ys_2: `i32` -> Position of second secondary tie-point
23879/// min: -1000000000, max: 1000000000, default: 1
23880/// returns `VipsImage` - Output image
23881pub fn mosaic_1(
23882    refp: &VipsImage,
23883    sec: &VipsImage,
23884    direction: Direction,
23885    xr_1: i32,
23886    yr_1: i32,
23887    xs_1: i32,
23888    ys_1: i32,
23889    xr_2: i32,
23890    yr_2: i32,
23891    xs_2: i32,
23892    ys_2: i32,
23893) -> Result<VipsImage> {
23894    unsafe {
23895        let refp_in: *mut bindings::VipsImage = refp.ctx;
23896        let sec_in: *mut bindings::VipsImage = sec.ctx;
23897        let direction_in: i32 = direction as i32;
23898        let xr_1_in: i32 = xr_1;
23899        let yr_1_in: i32 = yr_1;
23900        let xs_1_in: i32 = xs_1;
23901        let ys_1_in: i32 = ys_1;
23902        let xr_2_in: i32 = xr_2;
23903        let yr_2_in: i32 = yr_2;
23904        let xs_2_in: i32 = xs_2;
23905        let ys_2_in: i32 = ys_2;
23906        let mut out_out: *mut bindings::VipsImage = null_mut();
23907
23908        let vips_op_response = bindings::vips_mosaic1(
23909            refp_in,
23910            sec_in,
23911            &mut out_out,
23912            direction_in.try_into().unwrap(),
23913            xr_1_in,
23914            yr_1_in,
23915            xs_1_in,
23916            ys_1_in,
23917            xr_2_in,
23918            yr_2_in,
23919            xs_2_in,
23920            ys_2_in,
23921            NULL,
23922        );
23923        utils::result(
23924            vips_op_response,
23925            VipsImage { ctx: out_out },
23926            Error::Mosaic1Error,
23927        )
23928    }
23929}
23930
23931/// Options for mosaic_1 operation
23932#[derive(Clone, Debug)]
23933pub struct Mosaic1Options {
23934    /// hwindow: `i32` -> Half window size
23935    /// min: 0, max: 1000000000, default: 5
23936    pub hwindow: i32,
23937    /// harea: `i32` -> Half area size
23938    /// min: 0, max: 1000000000, default: 15
23939    pub harea: i32,
23940    /// search: `bool` -> Search to improve tie-points
23941    /// default: false
23942    pub search: bool,
23943    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23944    pub interpolate: VipsInterpolate,
23945    /// mblend: `i32` -> Maximum blend size
23946    /// min: 0, max: 10000, default: 10
23947    pub mblend: i32,
23948}
23949
23950impl std::default::Default for Mosaic1Options {
23951    fn default() -> Self {
23952        Mosaic1Options {
23953            hwindow: i32::from(5),
23954            harea: i32::from(15),
23955            search: false,
23956            interpolate: VipsInterpolate::new(),
23957            mblend: i32::from(10),
23958        }
23959    }
23960}
23961
23962/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23963/// refp: `&VipsImage` -> Reference image
23964/// sec: `&VipsImage` -> Secondary image
23965/// direction: `Direction` -> Horizontal or vertical mosaic
23966///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23967///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23968///  `Last` -> VIPS_DIRECTION_LAST = 2
23969/// xr_1: `i32` -> Position of first reference tie-point
23970/// min: -1000000000, max: 1000000000, default: 1
23971/// yr_1: `i32` -> Position of first reference tie-point
23972/// min: -1000000000, max: 1000000000, default: 1
23973/// xs_1: `i32` -> Position of first secondary tie-point
23974/// min: -1000000000, max: 1000000000, default: 1
23975/// ys_1: `i32` -> Position of first secondary tie-point
23976/// min: -1000000000, max: 1000000000, default: 1
23977/// xr_2: `i32` -> Position of second reference tie-point
23978/// min: -1000000000, max: 1000000000, default: 1
23979/// yr_2: `i32` -> Position of second reference tie-point
23980/// min: -1000000000, max: 1000000000, default: 1
23981/// xs_2: `i32` -> Position of second secondary tie-point
23982/// min: -1000000000, max: 1000000000, default: 1
23983/// ys_2: `i32` -> Position of second secondary tie-point
23984/// min: -1000000000, max: 1000000000, default: 1
23985/// mosaic_1_options: `&Mosaic1Options` -> optional arguments
23986/// returns `VipsImage` - Output image
23987pub fn mosaic_1_with_opts(
23988    refp: &VipsImage,
23989    sec: &VipsImage,
23990    direction: Direction,
23991    xr_1: i32,
23992    yr_1: i32,
23993    xs_1: i32,
23994    ys_1: i32,
23995    xr_2: i32,
23996    yr_2: i32,
23997    xs_2: i32,
23998    ys_2: i32,
23999    mosaic_1_options: &Mosaic1Options,
24000) -> Result<VipsImage> {
24001    unsafe {
24002        let refp_in: *mut bindings::VipsImage = refp.ctx;
24003        let sec_in: *mut bindings::VipsImage = sec.ctx;
24004        let direction_in: i32 = direction as i32;
24005        let xr_1_in: i32 = xr_1;
24006        let yr_1_in: i32 = yr_1;
24007        let xs_1_in: i32 = xs_1;
24008        let ys_1_in: i32 = ys_1;
24009        let xr_2_in: i32 = xr_2;
24010        let yr_2_in: i32 = yr_2;
24011        let xs_2_in: i32 = xs_2;
24012        let ys_2_in: i32 = ys_2;
24013        let mut out_out: *mut bindings::VipsImage = null_mut();
24014
24015        let hwindow_in: i32 = mosaic_1_options.hwindow;
24016        let hwindow_in_name = utils::new_c_string("hwindow")?;
24017
24018        let harea_in: i32 = mosaic_1_options.harea;
24019        let harea_in_name = utils::new_c_string("harea")?;
24020
24021        let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
24022        let search_in_name = utils::new_c_string("search")?;
24023
24024        let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
24025        let interpolate_in_name = utils::new_c_string("interpolate")?;
24026
24027        let mblend_in: i32 = mosaic_1_options.mblend;
24028        let mblend_in_name = utils::new_c_string("mblend")?;
24029
24030        let vips_op_response = bindings::vips_mosaic1(
24031            refp_in,
24032            sec_in,
24033            &mut out_out,
24034            direction_in.try_into().unwrap(),
24035            xr_1_in,
24036            yr_1_in,
24037            xs_1_in,
24038            ys_1_in,
24039            xr_2_in,
24040            yr_2_in,
24041            xs_2_in,
24042            ys_2_in,
24043            hwindow_in_name.as_ptr(),
24044            hwindow_in,
24045            harea_in_name.as_ptr(),
24046            harea_in,
24047            search_in_name.as_ptr(),
24048            search_in,
24049            interpolate_in_name.as_ptr(),
24050            interpolate_in,
24051            mblend_in_name.as_ptr(),
24052            mblend_in,
24053            NULL,
24054        );
24055        utils::result(
24056            vips_op_response,
24057            VipsImage { ctx: out_out },
24058            Error::Mosaic1Error,
24059        )
24060    }
24061}
24062
24063/// VipsMatrixinvert (matrixinvert), invert a matrix
24064/// inp: `&VipsImage` -> An square matrix
24065/// returns `VipsImage` - Output matrix
24066pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
24067    unsafe {
24068        let inp_in: *mut bindings::VipsImage = inp.ctx;
24069        let mut out_out: *mut bindings::VipsImage = null_mut();
24070
24071        let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
24072        utils::result(
24073            vips_op_response,
24074            VipsImage { ctx: out_out },
24075            Error::MatrixinvertError,
24076        )
24077    }
24078}
24079
24080/// VipsMatrixmultiply (matrixmultiply), multiply two matrices
24081/// left: `&VipsImage` -> First matrix to multiply
24082/// right: `&VipsImage` -> Second matrix to multiply
24083/// returns `VipsImage` - Output matrix
24084pub fn matrixmultiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24085    unsafe {
24086        let left_in: *mut bindings::VipsImage = left.ctx;
24087        let right_in: *mut bindings::VipsImage = right.ctx;
24088        let mut out_out: *mut bindings::VipsImage = null_mut();
24089
24090        let vips_op_response = bindings::vips_matrixmultiply(left_in, right_in, &mut out_out, NULL);
24091        utils::result(
24092            vips_op_response,
24093            VipsImage { ctx: out_out },
24094            Error::MatrixmultiplyError,
24095        )
24096    }
24097}
24098
24099/// VipsMatch (match), first-order match of two images
24100/// refp: `&VipsImage` -> Reference image
24101/// sec: `&VipsImage` -> Secondary image
24102/// xr_1: `i32` -> Position of first reference tie-point
24103/// min: -1000000000, max: 1000000000, default: 1
24104/// yr_1: `i32` -> Position of first reference tie-point
24105/// min: -1000000000, max: 1000000000, default: 1
24106/// xs_1: `i32` -> Position of first secondary tie-point
24107/// min: -1000000000, max: 1000000000, default: 1
24108/// ys_1: `i32` -> Position of first secondary tie-point
24109/// min: -1000000000, max: 1000000000, default: 1
24110/// xr_2: `i32` -> Position of second reference tie-point
24111/// min: -1000000000, max: 1000000000, default: 1
24112/// yr_2: `i32` -> Position of second reference tie-point
24113/// min: -1000000000, max: 1000000000, default: 1
24114/// xs_2: `i32` -> Position of second secondary tie-point
24115/// min: -1000000000, max: 1000000000, default: 1
24116/// ys_2: `i32` -> Position of second secondary tie-point
24117/// min: -1000000000, max: 1000000000, default: 1
24118/// returns `VipsImage` - Output image
24119pub fn matches(
24120    refp: &VipsImage,
24121    sec: &VipsImage,
24122    xr_1: i32,
24123    yr_1: i32,
24124    xs_1: i32,
24125    ys_1: i32,
24126    xr_2: i32,
24127    yr_2: i32,
24128    xs_2: i32,
24129    ys_2: i32,
24130) -> Result<VipsImage> {
24131    unsafe {
24132        let refp_in: *mut bindings::VipsImage = refp.ctx;
24133        let sec_in: *mut bindings::VipsImage = sec.ctx;
24134        let xr_1_in: i32 = xr_1;
24135        let yr_1_in: i32 = yr_1;
24136        let xs_1_in: i32 = xs_1;
24137        let ys_1_in: i32 = ys_1;
24138        let xr_2_in: i32 = xr_2;
24139        let yr_2_in: i32 = yr_2;
24140        let xs_2_in: i32 = xs_2;
24141        let ys_2_in: i32 = ys_2;
24142        let mut out_out: *mut bindings::VipsImage = null_mut();
24143
24144        let vips_op_response = bindings::vips_match(
24145            refp_in,
24146            sec_in,
24147            &mut out_out,
24148            xr_1_in,
24149            yr_1_in,
24150            xs_1_in,
24151            ys_1_in,
24152            xr_2_in,
24153            yr_2_in,
24154            xs_2_in,
24155            ys_2_in,
24156            NULL,
24157        );
24158        utils::result(
24159            vips_op_response,
24160            VipsImage { ctx: out_out },
24161            Error::MatchError,
24162        )
24163    }
24164}
24165
24166/// Options for matches operation
24167#[derive(Clone, Debug)]
24168pub struct MatchOptions {
24169    /// hwindow: `i32` -> Half window size
24170    /// min: 0, max: 1000000000, default: 5
24171    pub hwindow: i32,
24172    /// harea: `i32` -> Half area size
24173    /// min: 0, max: 1000000000, default: 15
24174    pub harea: i32,
24175    /// search: `bool` -> Search to improve tie-points
24176    /// default: false
24177    pub search: bool,
24178    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
24179    pub interpolate: VipsInterpolate,
24180}
24181
24182impl std::default::Default for MatchOptions {
24183    fn default() -> Self {
24184        MatchOptions {
24185            hwindow: i32::from(5),
24186            harea: i32::from(15),
24187            search: false,
24188            interpolate: VipsInterpolate::new(),
24189        }
24190    }
24191}
24192
24193/// VipsMatch (match), first-order match of two images
24194/// refp: `&VipsImage` -> Reference image
24195/// sec: `&VipsImage` -> Secondary image
24196/// xr_1: `i32` -> Position of first reference tie-point
24197/// min: -1000000000, max: 1000000000, default: 1
24198/// yr_1: `i32` -> Position of first reference tie-point
24199/// min: -1000000000, max: 1000000000, default: 1
24200/// xs_1: `i32` -> Position of first secondary tie-point
24201/// min: -1000000000, max: 1000000000, default: 1
24202/// ys_1: `i32` -> Position of first secondary tie-point
24203/// min: -1000000000, max: 1000000000, default: 1
24204/// xr_2: `i32` -> Position of second reference tie-point
24205/// min: -1000000000, max: 1000000000, default: 1
24206/// yr_2: `i32` -> Position of second reference tie-point
24207/// min: -1000000000, max: 1000000000, default: 1
24208/// xs_2: `i32` -> Position of second secondary tie-point
24209/// min: -1000000000, max: 1000000000, default: 1
24210/// ys_2: `i32` -> Position of second secondary tie-point
24211/// min: -1000000000, max: 1000000000, default: 1
24212/// matches_options: `&MatchOptions` -> optional arguments
24213/// returns `VipsImage` - Output image
24214pub fn matches_with_opts(
24215    refp: &VipsImage,
24216    sec: &VipsImage,
24217    xr_1: i32,
24218    yr_1: i32,
24219    xs_1: i32,
24220    ys_1: i32,
24221    xr_2: i32,
24222    yr_2: i32,
24223    xs_2: i32,
24224    ys_2: i32,
24225    matches_options: &MatchOptions,
24226) -> Result<VipsImage> {
24227    unsafe {
24228        let refp_in: *mut bindings::VipsImage = refp.ctx;
24229        let sec_in: *mut bindings::VipsImage = sec.ctx;
24230        let xr_1_in: i32 = xr_1;
24231        let yr_1_in: i32 = yr_1;
24232        let xs_1_in: i32 = xs_1;
24233        let ys_1_in: i32 = ys_1;
24234        let xr_2_in: i32 = xr_2;
24235        let yr_2_in: i32 = yr_2;
24236        let xs_2_in: i32 = xs_2;
24237        let ys_2_in: i32 = ys_2;
24238        let mut out_out: *mut bindings::VipsImage = null_mut();
24239
24240        let hwindow_in: i32 = matches_options.hwindow;
24241        let hwindow_in_name = utils::new_c_string("hwindow")?;
24242
24243        let harea_in: i32 = matches_options.harea;
24244        let harea_in_name = utils::new_c_string("harea")?;
24245
24246        let search_in: i32 = if matches_options.search { 1 } else { 0 };
24247        let search_in_name = utils::new_c_string("search")?;
24248
24249        let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
24250        let interpolate_in_name = utils::new_c_string("interpolate")?;
24251
24252        let vips_op_response = bindings::vips_match(
24253            refp_in,
24254            sec_in,
24255            &mut out_out,
24256            xr_1_in,
24257            yr_1_in,
24258            xs_1_in,
24259            ys_1_in,
24260            xr_2_in,
24261            yr_2_in,
24262            xs_2_in,
24263            ys_2_in,
24264            hwindow_in_name.as_ptr(),
24265            hwindow_in,
24266            harea_in_name.as_ptr(),
24267            harea_in,
24268            search_in_name.as_ptr(),
24269            search_in,
24270            interpolate_in_name.as_ptr(),
24271            interpolate_in,
24272            NULL,
24273        );
24274        utils::result(
24275            vips_op_response,
24276            VipsImage { ctx: out_out },
24277            Error::MatchError,
24278        )
24279    }
24280}
24281
24282/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24283/// inp: `&VipsImage` -> Input image
24284/// returns `VipsImage` - Output image
24285pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
24286    unsafe {
24287        let inp_in: *mut bindings::VipsImage = inp.ctx;
24288        let mut out_out: *mut bindings::VipsImage = null_mut();
24289
24290        let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
24291        utils::result(
24292            vips_op_response,
24293            VipsImage { ctx: out_out },
24294            Error::GlobalbalanceError,
24295        )
24296    }
24297}
24298
24299/// Options for globalbalance operation
24300#[derive(Clone, Debug)]
24301pub struct GlobalbalanceOptions {
24302    /// gamma: `f64` -> Image gamma
24303    /// min: 0.00001, max: 10, default: 1.6
24304    pub gamma: f64,
24305    /// int_output: `bool` -> Integer output
24306    /// default: false
24307    pub int_output: bool,
24308}
24309
24310impl std::default::Default for GlobalbalanceOptions {
24311    fn default() -> Self {
24312        GlobalbalanceOptions {
24313            gamma: f64::from(1.6),
24314            int_output: false,
24315        }
24316    }
24317}
24318
24319/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24320/// inp: `&VipsImage` -> Input image
24321/// globalbalance_options: `&GlobalbalanceOptions` -> optional arguments
24322/// returns `VipsImage` - Output image
24323pub fn globalbalance_with_opts(
24324    inp: &VipsImage,
24325    globalbalance_options: &GlobalbalanceOptions,
24326) -> Result<VipsImage> {
24327    unsafe {
24328        let inp_in: *mut bindings::VipsImage = inp.ctx;
24329        let mut out_out: *mut bindings::VipsImage = null_mut();
24330
24331        let gamma_in: f64 = globalbalance_options.gamma;
24332        let gamma_in_name = utils::new_c_string("gamma")?;
24333
24334        let int_output_in: i32 = if globalbalance_options.int_output {
24335            1
24336        } else {
24337            0
24338        };
24339        let int_output_in_name = utils::new_c_string("int-output")?;
24340
24341        let vips_op_response = bindings::vips_globalbalance(
24342            inp_in,
24343            &mut out_out,
24344            gamma_in_name.as_ptr(),
24345            gamma_in,
24346            int_output_in_name.as_ptr(),
24347            int_output_in,
24348            NULL,
24349        );
24350        utils::result(
24351            vips_op_response,
24352            VipsImage { ctx: out_out },
24353            Error::GlobalbalanceError,
24354        )
24355    }
24356}
24357
24358/// VipsRemosaic (remosaic), rebuild an mosaiced image
24359/// inp: `&VipsImage` -> Input image
24360/// old_str: `&str` -> Search for this string
24361/// new_str: `&str` -> And swap for this string
24362/// returns `VipsImage` - Output image
24363pub fn remosaic(inp: &VipsImage, old_str: &str, new_str: &str) -> Result<VipsImage> {
24364    unsafe {
24365        let inp_in: *mut bindings::VipsImage = inp.ctx;
24366        let old_str_in: CString = utils::new_c_string(old_str)?;
24367        let new_str_in: CString = utils::new_c_string(new_str)?;
24368        let mut out_out: *mut bindings::VipsImage = null_mut();
24369
24370        let vips_op_response = bindings::vips_remosaic(
24371            inp_in,
24372            &mut out_out,
24373            old_str_in.as_ptr(),
24374            new_str_in.as_ptr(),
24375            NULL,
24376        );
24377        utils::result(
24378            vips_op_response,
24379            VipsImage { ctx: out_out },
24380            Error::RemosaicError,
24381        )
24382    }
24383}