libvips/
ops.rs

1// (c) Copyright 2019-2024 OLX
2use crate::bindings;
3use crate::error::*;
4use crate::utils;
5use crate::Result;
6use crate::VipsBlob;
7use crate::VipsImage;
8use crate::VipsInterpolate;
9use crate::VipsSource;
10use crate::VipsTarget;
11use std::convert::TryInto;
12use std::ffi::*;
13use std::ptr::null_mut;
14
15const NULL: *const c_void = null_mut();
16
17include!("manual.rs");
18
19#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
20pub enum Access {
21    ///  `Random` -> VIPS_ACCESS_RANDOM = 0
22    Random = 0,
23    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
24    Sequential = 1,
25    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
26    SequentialUnbuffered = 2,
27    ///  `Last` -> VIPS_ACCESS_LAST = 3
28    Last = 3,
29}
30
31#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
32pub enum Align {
33    ///  `Low` -> VIPS_ALIGN_LOW = 0
34    Low = 0,
35    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
36    Centre = 1,
37    ///  `High` -> VIPS_ALIGN_HIGH = 2
38    High = 2,
39    ///  `Last` -> VIPS_ALIGN_LAST = 3
40    Last = 3,
41}
42
43#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
44pub enum Angle {
45    ///  `D0` -> VIPS_ANGLE_D0 = 0
46    D0 = 0,
47    ///  `D90` -> VIPS_ANGLE_D90 = 1
48    D90 = 1,
49    ///  `D180` -> VIPS_ANGLE_D180 = 2
50    D180 = 2,
51    ///  `D270` -> VIPS_ANGLE_D270 = 3
52    D270 = 3,
53    ///  `Last` -> VIPS_ANGLE_LAST = 4
54    Last = 4,
55}
56
57#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
58pub enum Angle45 {
59    ///  `D0` -> VIPS_ANGLE45_D0 = 0
60    D0 = 0,
61    ///  `D45` -> VIPS_ANGLE45_D45 = 1
62    D45 = 1,
63    ///  `D90` -> VIPS_ANGLE45_D90 = 2
64    D90 = 2,
65    ///  `D135` -> VIPS_ANGLE45_D135 = 3
66    D135 = 3,
67    ///  `D180` -> VIPS_ANGLE45_D180 = 4
68    D180 = 4,
69    ///  `D225` -> VIPS_ANGLE45_D225 = 5
70    D225 = 5,
71    ///  `D270` -> VIPS_ANGLE45_D270 = 6
72    D270 = 6,
73    ///  `D315` -> VIPS_ANGLE45_D315 = 7
74    D315 = 7,
75    ///  `Last` -> VIPS_ANGLE45_LAST = 8
76    Last = 8,
77}
78
79#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
80pub enum BandFormat {
81    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
82    Notset = -1,
83    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0
84    Uchar = 0,
85    ///  `Char` -> VIPS_FORMAT_CHAR = 1
86    Char = 1,
87    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
88    Ushort = 2,
89    ///  `Short` -> VIPS_FORMAT_SHORT = 3
90    Short = 3,
91    ///  `Uint` -> VIPS_FORMAT_UINT = 4
92    Uint = 4,
93    ///  `Int` -> VIPS_FORMAT_INT = 5
94    Int = 5,
95    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
96    Float = 6,
97    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
98    Complex = 7,
99    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
100    Double = 8,
101    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
102    Dpcomplex = 9,
103    ///  `Last` -> VIPS_FORMAT_LAST = 10
104    Last = 10,
105}
106
107#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
108pub enum BlendMode {
109    ///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
110    Clear = 0,
111    ///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
112    Source = 1,
113    ///  `Over` -> VIPS_BLEND_MODE_OVER = 2
114    Over = 2,
115    ///  `In` -> VIPS_BLEND_MODE_IN = 3
116    In = 3,
117    ///  `Out` -> VIPS_BLEND_MODE_OUT = 4
118    Out = 4,
119    ///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
120    Atop = 5,
121    ///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
122    Dest = 6,
123    ///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
124    DestOver = 7,
125    ///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
126    DestIn = 8,
127    ///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
128    DestOut = 9,
129    ///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
130    DestAtop = 10,
131    ///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
132    Xor = 11,
133    ///  `Add` -> VIPS_BLEND_MODE_ADD = 12
134    Add = 12,
135    ///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
136    Saturate = 13,
137    ///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
138    Multiply = 14,
139    ///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
140    Screen = 15,
141    ///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
142    Overlay = 16,
143    ///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
144    Darken = 17,
145    ///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
146    Lighten = 18,
147    ///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
148    ColourDodge = 19,
149    ///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
150    ColourBurn = 20,
151    ///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
152    HardLight = 21,
153    ///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
154    SoftLight = 22,
155    ///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
156    Difference = 23,
157    ///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
158    Exclusion = 24,
159    ///  `Last` -> VIPS_BLEND_MODE_LAST = 25
160    Last = 25,
161}
162
163#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
164pub enum Coding {
165    ///  `Error` -> VIPS_CODING_ERROR = -1
166    Error = -1,
167    ///  `None` -> VIPS_CODING_NONE = 0
168    None = 0,
169    ///  `Labq` -> VIPS_CODING_LABQ = 2
170    Labq = 2,
171    ///  `Rad` -> VIPS_CODING_RAD = 6
172    Rad = 6,
173    ///  `Last` -> VIPS_CODING_LAST = 7
174    Last = 7,
175}
176
177#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
178pub enum Combine {
179    ///  `Max` -> VIPS_COMBINE_MAX = 0
180    Max = 0,
181    ///  `Sum` -> VIPS_COMBINE_SUM = 1
182    Sum = 1,
183    ///  `Min` -> VIPS_COMBINE_MIN = 2
184    Min = 2,
185    ///  `Last` -> VIPS_COMBINE_LAST = 3
186    Last = 3,
187}
188
189#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
190pub enum CombineMode {
191    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0
192    Set = 0,
193    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
194    Add = 1,
195    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
196    Last = 2,
197}
198
199#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
200pub enum CompassDirection {
201    ///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0
202    Centre = 0,
203    ///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
204    North = 1,
205    ///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
206    East = 2,
207    ///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
208    South = 3,
209    ///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
210    West = 4,
211    ///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
212    NorthEast = 5,
213    ///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
214    SouthEast = 6,
215    ///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
216    SouthWest = 7,
217    ///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
218    NorthWest = 8,
219    ///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
220    Last = 9,
221}
222
223#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
224pub enum Direction {
225    ///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0
226    Horizontal = 0,
227    ///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
228    Vertical = 1,
229    ///  `Last` -> VIPS_DIRECTION_LAST = 2
230    Last = 2,
231}
232
233#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
234pub enum Extend {
235    ///  `Black` -> VIPS_EXTEND_BLACK = 0
236    Black = 0,
237    ///  `Copy` -> VIPS_EXTEND_COPY = 1
238    Copy = 1,
239    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
240    Repeat = 2,
241    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
242    Mirror = 3,
243    ///  `White` -> VIPS_EXTEND_WHITE = 4
244    White = 4,
245    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
246    Background = 5,
247    ///  `Last` -> VIPS_EXTEND_LAST = 6
248    Last = 6,
249}
250
251#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
252pub enum FailOn {
253    ///  `None` -> VIPS_FAIL_ON_NONE = 0
254    None = 0,
255    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
256    Truncated = 1,
257    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
258    Error = 2,
259    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
260    Warning = 3,
261    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
262    Last = 4,
263}
264
265#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
266pub enum ForeignDzDepth {
267    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
268    Onepixel = 0,
269    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
270    Onetile = 1,
271    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
272    One = 2,
273    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
274    Last = 3,
275}
276
277#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
278pub enum ForeignFlags {
279    ///  `None` -> VIPS_FOREIGN_NONE = 0
280    None = 0,
281    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
282    Partial = 1,
283    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
284    Bigendian = 2,
285    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
286    Sequential = 4,
287    ///  `All` -> VIPS_FOREIGN_ALL = 7
288    All = 7,
289}
290
291#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
292pub enum ForeignHeifCompression {
293    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1
294    Hevc = 1,
295    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
296    Avc = 2,
297    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
298    Jpeg = 3,
299    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
300    Av1 = 4,
301    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
302    Last = 5,
303}
304
305#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
306pub enum ForeignHeifEncoder {
307    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0
308    Auto = 0,
309    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
310    Aom = 1,
311    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
312    Rav1E = 2,
313    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
314    Svt = 3,
315    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
316    X265 = 4,
317    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
318    Last = 5,
319}
320
321#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
322pub enum ForeignKeep {
323    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
324    None = 0,
325    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
326    Exif = 1,
327    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
328    Xmp = 2,
329    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
330    Iptc = 4,
331    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
332    Icc = 8,
333    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
334    Other = 16,
335    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31
336    All = 31,
337}
338
339#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
340pub enum ForeignPngFilter {
341    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8
342    None = 8,
343    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
344    Sub = 16,
345    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
346    Up = 32,
347    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
348    Avg = 64,
349    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
350    Paeth = 128,
351    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
352    All = 248,
353}
354
355#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
356pub enum ForeignPpmFormat {
357    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
358    Pbm = 0,
359    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
360    Pgm = 1,
361    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2
362    Ppm = 2,
363    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
364    Pfm = 3,
365    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
366    Pnm = 4,
367    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
368    Last = 5,
369}
370
371#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
372pub enum ForeignSubsample {
373    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
374    Auto = 0,
375    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
376    On = 1,
377    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
378    Off = 2,
379    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
380    Last = 3,
381}
382
383#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
384pub enum ForeignTiffCompression {
385    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0
386    None = 0,
387    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
388    Jpeg = 1,
389    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
390    Deflate = 2,
391    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
392    Packbit = 3,
393    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
394    Ccittfax4 = 4,
395    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
396    Lzw = 5,
397    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
398    Webp = 6,
399    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
400    Zstd = 7,
401    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
402    Jp2K = 8,
403    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
404    Last = 9,
405}
406
407#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
408pub enum ForeignTiffPredictor {
409    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
410    None = 1,
411    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2
412    Horizontal = 2,
413    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
414    Float = 3,
415    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
416    Last = 4,
417}
418
419#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
420pub enum ForeignTiffResunit {
421    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0
422    Cm = 0,
423    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
424    Inch = 1,
425    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
426    Last = 2,
427}
428
429#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
430pub enum ForeignWebpPreset {
431    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0
432    Default = 0,
433    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
434    Picture = 1,
435    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
436    Photo = 2,
437    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
438    Drawing = 3,
439    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
440    Icon = 4,
441    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
442    Text = 5,
443    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
444    Last = 6,
445}
446
447#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
448pub enum Intent {
449    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
450    Perceptual = 0,
451    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1
452    Relative = 1,
453    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
454    Saturation = 2,
455    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
456    Absolute = 3,
457    ///  `Last` -> VIPS_INTENT_LAST = 4
458    Last = 4,
459}
460
461#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
462pub enum Interesting {
463    ///  `None` -> VIPS_INTERESTING_NONE = 0
464    None = 0,
465    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
466    Centre = 1,
467    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
468    Entropy = 2,
469    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
470    Attention = 3,
471    ///  `Low` -> VIPS_INTERESTING_LOW = 4
472    Low = 4,
473    ///  `High` -> VIPS_INTERESTING_HIGH = 5
474    High = 5,
475    ///  `All` -> VIPS_INTERESTING_ALL = 6
476    All = 6,
477    ///  `Last` -> VIPS_INTERESTING_LAST = 7
478    Last = 7,
479}
480
481#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
482pub enum Interpretation {
483    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
484    Error = -1,
485    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
486    Multiband = 0,
487    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
488    BW = 1,
489    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
490    Histogram = 10,
491    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
492    Xyz = 12,
493    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
494    Lab = 13,
495    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
496    Cmyk = 15,
497    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
498    Labq = 16,
499    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
500    Rgb = 17,
501    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
502    Cmc = 18,
503    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
504    Lch = 19,
505    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
506    Labs = 21,
507    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
508    Srgb = 22,
509    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
510    Yxy = 23,
511    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
512    Fourier = 24,
513    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
514    Rgb16 = 25,
515    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
516    Grey16 = 26,
517    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
518    Matrix = 27,
519    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
520    Scrgb = 28,
521    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
522    Hsv = 29,
523    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
524    Last = 30,
525}
526
527#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
528pub enum Kernel {
529    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
530    Nearest = 0,
531    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
532    Linear = 1,
533    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
534    Cubic = 2,
535    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
536    Mitchell = 3,
537    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
538    Lanczos2 = 4,
539    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5
540    Lanczos3 = 5,
541    ///  `Last` -> VIPS_KERNEL_LAST = 6
542    Last = 6,
543}
544
545#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
546pub enum OperationBoolean {
547    ///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0
548    And = 0,
549    ///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
550    Or = 1,
551    ///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
552    Eor = 2,
553    ///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
554    Lshift = 3,
555    ///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
556    Rshift = 4,
557    ///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
558    Last = 5,
559}
560
561#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
562pub enum OperationComplex {
563    ///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0
564    Polar = 0,
565    ///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
566    Rect = 1,
567    ///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
568    Conj = 2,
569    ///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
570    Last = 3,
571}
572
573#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
574pub enum OperationComplex2 {
575    ///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0
576    CrossPhase = 0,
577    ///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
578    Last = 1,
579}
580
581#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
582pub enum OperationComplexget {
583    ///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0
584    Real = 0,
585    ///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
586    Imag = 1,
587    ///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
588    Last = 2,
589}
590
591#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
592pub enum OperationMath {
593    ///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0
594    Sin = 0,
595    ///  `Co` -> VIPS_OPERATION_MATH_COS = 1
596    Co = 1,
597    ///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
598    Tan = 2,
599    ///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
600    Asin = 3,
601    ///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
602    Aco = 4,
603    ///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
604    Atan = 5,
605    ///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
606    Log = 6,
607    ///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
608    Log10 = 7,
609    ///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
610    Exp = 8,
611    ///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
612    Exp10 = 9,
613    ///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
614    Sinh = 10,
615    ///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
616    Cosh = 11,
617    ///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
618    Tanh = 12,
619    ///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
620    Asinh = 13,
621    ///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
622    Acosh = 14,
623    ///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
624    Atanh = 15,
625    ///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
626    Last = 16,
627}
628
629#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
630pub enum OperationMath2 {
631    ///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0
632    Pow = 0,
633    ///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
634    Wop = 1,
635    ///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
636    Atan2 = 2,
637    ///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
638    Last = 3,
639}
640
641#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
642pub enum OperationMorphology {
643    ///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0
644    Erode = 0,
645    ///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
646    Dilate = 1,
647    ///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
648    Last = 2,
649}
650
651#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
652pub enum OperationRelational {
653    ///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0
654    Equal = 0,
655    ///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
656    Noteq = 1,
657    ///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
658    Less = 2,
659    ///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
660    Lesseq = 3,
661    ///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
662    More = 4,
663    ///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
664    Moreeq = 5,
665    ///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
666    Last = 6,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum OperationRound {
671    ///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0
672    Rint = 0,
673    ///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
674    Ceil = 1,
675    ///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
676    Floor = 2,
677    ///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
678    Last = 3,
679}
680
681#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
682pub enum PCS {
683    ///  `Lab` -> VIPS_PCS_LAB = 0
684    Lab = 0,
685    ///  `Xyz` -> VIPS_PCS_XYZ = 1
686    Xyz = 1,
687    ///  `Last` -> VIPS_PCS_LAST = 2
688    Last = 2,
689}
690
691#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
692pub enum Precision {
693    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
694    Integer = 0,
695    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
696    Float = 1,
697    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
698    Approximate = 2,
699    ///  `Last` -> VIPS_PRECISION_LAST = 3
700    Last = 3,
701}
702
703#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
704pub enum RegionShrink {
705    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0
706    Mean = 0,
707    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
708    Median = 1,
709    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
710    Mode = 2,
711    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
712    Max = 3,
713    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
714    Min = 4,
715    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
716    Nearest = 5,
717    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
718    Last = 6,
719}
720
721#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
722pub enum Size {
723    ///  `Both` -> VIPS_SIZE_BOTH = 0
724    Both = 0,
725    ///  `Up` -> VIPS_SIZE_UP = 1
726    Up = 1,
727    ///  `Down` -> VIPS_SIZE_DOWN = 2
728    Down = 2,
729    ///  `Force` -> VIPS_SIZE_FORCE = 3
730    Force = 3,
731    ///  `Last` -> VIPS_SIZE_LAST = 4
732    Last = 4,
733}
734
735#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
736pub enum TextWrap {
737    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0
738    Word = 0,
739    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
740    Char = 1,
741    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
742    WordChar = 2,
743    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
744    None = 3,
745    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
746    Last = 4,
747}
748
749/// VipsSystem (system), run an external command
750/// cmd_format: `&str` -> Command to run
751
752pub fn system(cmd_format: &str) -> Result<()> {
753    unsafe {
754        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
755
756        let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
757        utils::result(vips_op_response, (), Error::SystemError)
758    }
759}
760
761/// Options for system operation
762#[derive(Clone, Debug)]
763pub struct SystemOptions {
764    /// inp: `Vec<VipsImage>` -> Array of input images
765    pub inp: Vec<VipsImage>,
766    /// out: `VipsImage` -> Output image
767    pub out: VipsImage,
768    /// log: `String` -> Command log
769    pub log: String,
770    /// out_format: `String` -> Format for output filename
771    pub out_format: String,
772    /// in_format: `String` -> Format for input filename
773    pub in_format: String,
774}
775
776impl std::default::Default for SystemOptions {
777    fn default() -> Self {
778        SystemOptions {
779            inp: Vec::new(),
780            out: VipsImage::new(),
781            log: String::new(),
782            out_format: String::new(),
783            in_format: String::new(),
784        }
785    }
786}
787
788/// VipsSystem (system), run an external command
789/// cmd_format: `&str` -> Command to run
790/// system_options: `&SystemOptions` -> optional arguments
791
792pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
793    unsafe {
794        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
795
796        let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
797        let inp_in = inp_wrapper.ctx;
798        let inp_in_name = utils::new_c_string("inp")?;
799
800        let out_in: *mut bindings::VipsImage = system_options.out.ctx;
801        let out_in_name = utils::new_c_string("out")?;
802
803        let log_in: CString = utils::new_c_string(&system_options.log)?;
804        let log_in_name = utils::new_c_string("log")?;
805
806        let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
807        let out_format_in_name = utils::new_c_string("out-format")?;
808
809        let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
810        let in_format_in_name = utils::new_c_string("in-format")?;
811
812        let vips_op_response = bindings::vips_system(
813            cmd_format_in.as_ptr(),
814            inp_in_name.as_ptr(),
815            inp_in,
816            out_in_name.as_ptr(),
817            out_in,
818            log_in_name.as_ptr(),
819            log_in.as_ptr(),
820            out_format_in_name.as_ptr(),
821            out_format_in.as_ptr(),
822            in_format_in_name.as_ptr(),
823            in_format_in.as_ptr(),
824            NULL,
825        );
826        utils::result(vips_op_response, (), Error::SystemError)
827    }
828}
829
830/// VipsAdd (add), add two images
831/// left: `&VipsImage` -> Left-hand image argument
832/// right: `&VipsImage` -> Right-hand image argument
833/// returns `VipsImage` - Output image
834pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
835    unsafe {
836        let left_in: *mut bindings::VipsImage = left.ctx;
837        let right_in: *mut bindings::VipsImage = right.ctx;
838        let mut out_out: *mut bindings::VipsImage = null_mut();
839
840        let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
841        utils::result(
842            vips_op_response,
843            VipsImage { ctx: out_out },
844            Error::AddError,
845        )
846    }
847}
848
849/// VipsSubtract (subtract), subtract two images
850/// left: `&VipsImage` -> Left-hand image argument
851/// right: `&VipsImage` -> Right-hand image argument
852/// returns `VipsImage` - Output image
853pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
854    unsafe {
855        let left_in: *mut bindings::VipsImage = left.ctx;
856        let right_in: *mut bindings::VipsImage = right.ctx;
857        let mut out_out: *mut bindings::VipsImage = null_mut();
858
859        let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
860        utils::result(
861            vips_op_response,
862            VipsImage { ctx: out_out },
863            Error::SubtractError,
864        )
865    }
866}
867
868/// VipsMultiply (multiply), multiply two images
869/// left: `&VipsImage` -> Left-hand image argument
870/// right: `&VipsImage` -> Right-hand image argument
871/// returns `VipsImage` - Output image
872pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
873    unsafe {
874        let left_in: *mut bindings::VipsImage = left.ctx;
875        let right_in: *mut bindings::VipsImage = right.ctx;
876        let mut out_out: *mut bindings::VipsImage = null_mut();
877
878        let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
879        utils::result(
880            vips_op_response,
881            VipsImage { ctx: out_out },
882            Error::MultiplyError,
883        )
884    }
885}
886
887/// VipsDivide (divide), divide two images
888/// left: `&VipsImage` -> Left-hand image argument
889/// right: `&VipsImage` -> Right-hand image argument
890/// returns `VipsImage` - Output image
891pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
892    unsafe {
893        let left_in: *mut bindings::VipsImage = left.ctx;
894        let right_in: *mut bindings::VipsImage = right.ctx;
895        let mut out_out: *mut bindings::VipsImage = null_mut();
896
897        let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
898        utils::result(
899            vips_op_response,
900            VipsImage { ctx: out_out },
901            Error::DivideError,
902        )
903    }
904}
905
906/// VipsRelational (relational), relational operation on two images
907/// left: `&VipsImage` -> Left-hand image argument
908/// right: `&VipsImage` -> Right-hand image argument
909/// relational: `OperationRelational` -> Relational to perform
910///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
911///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
912///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
913///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
914///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
915///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
916///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
917/// returns `VipsImage` - Output image
918pub fn relational(
919    left: &VipsImage,
920    right: &VipsImage,
921    relational: OperationRelational,
922) -> Result<VipsImage> {
923    unsafe {
924        let left_in: *mut bindings::VipsImage = left.ctx;
925        let right_in: *mut bindings::VipsImage = right.ctx;
926        let relational_in: i32 = relational as i32;
927        let mut out_out: *mut bindings::VipsImage = null_mut();
928
929        let vips_op_response = bindings::vips_relational(
930            left_in,
931            right_in,
932            &mut out_out,
933            relational_in.try_into().unwrap(),
934            NULL,
935        );
936        utils::result(
937            vips_op_response,
938            VipsImage { ctx: out_out },
939            Error::RelationalError,
940        )
941    }
942}
943
944/// VipsRemainder (remainder), remainder after integer division of two images
945/// left: `&VipsImage` -> Left-hand image argument
946/// right: `&VipsImage` -> Right-hand image argument
947/// returns `VipsImage` - Output image
948pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
949    unsafe {
950        let left_in: *mut bindings::VipsImage = left.ctx;
951        let right_in: *mut bindings::VipsImage = right.ctx;
952        let mut out_out: *mut bindings::VipsImage = null_mut();
953
954        let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
955        utils::result(
956            vips_op_response,
957            VipsImage { ctx: out_out },
958            Error::RemainderError,
959        )
960    }
961}
962
963/// VipsBoolean (boolean), boolean operation on two images
964/// left: `&VipsImage` -> Left-hand image argument
965/// right: `&VipsImage` -> Right-hand image argument
966/// boolean: `OperationBoolean` -> Boolean to perform
967///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
968///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
969///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
970///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
971///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
972///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
973/// returns `VipsImage` - Output image
974pub fn boolean(
975    left: &VipsImage,
976    right: &VipsImage,
977    boolean: OperationBoolean,
978) -> Result<VipsImage> {
979    unsafe {
980        let left_in: *mut bindings::VipsImage = left.ctx;
981        let right_in: *mut bindings::VipsImage = right.ctx;
982        let boolean_in: i32 = boolean as i32;
983        let mut out_out: *mut bindings::VipsImage = null_mut();
984
985        let vips_op_response = bindings::vips_boolean(
986            left_in,
987            right_in,
988            &mut out_out,
989            boolean_in.try_into().unwrap(),
990            NULL,
991        );
992        utils::result(
993            vips_op_response,
994            VipsImage { ctx: out_out },
995            Error::BooleanError,
996        )
997    }
998}
999
1000/// VipsMath2 (math2), binary math operations
1001/// left: `&VipsImage` -> Left-hand image argument
1002/// right: `&VipsImage` -> Right-hand image argument
1003/// math_2: `OperationMath2` -> Math to perform
1004///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1005///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1006///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1007///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1008/// returns `VipsImage` - Output image
1009pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1010    unsafe {
1011        let left_in: *mut bindings::VipsImage = left.ctx;
1012        let right_in: *mut bindings::VipsImage = right.ctx;
1013        let math_2_in: i32 = math_2 as i32;
1014        let mut out_out: *mut bindings::VipsImage = null_mut();
1015
1016        let vips_op_response = bindings::vips_math2(
1017            left_in,
1018            right_in,
1019            &mut out_out,
1020            math_2_in.try_into().unwrap(),
1021            NULL,
1022        );
1023        utils::result(
1024            vips_op_response,
1025            VipsImage { ctx: out_out },
1026            Error::Math2Error,
1027        )
1028    }
1029}
1030
1031/// VipsComplex2 (complex2), complex binary operations on two images
1032/// left: `&VipsImage` -> Left-hand image argument
1033/// right: `&VipsImage` -> Right-hand image argument
1034/// cmplx: `OperationComplex2` -> Binary complex operation to perform
1035///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0 [DEFAULT]
1036///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
1037/// returns `VipsImage` - Output image
1038pub fn complex_2(
1039    left: &VipsImage,
1040    right: &VipsImage,
1041    cmplx: OperationComplex2,
1042) -> Result<VipsImage> {
1043    unsafe {
1044        let left_in: *mut bindings::VipsImage = left.ctx;
1045        let right_in: *mut bindings::VipsImage = right.ctx;
1046        let cmplx_in: i32 = cmplx as i32;
1047        let mut out_out: *mut bindings::VipsImage = null_mut();
1048
1049        let vips_op_response = bindings::vips_complex2(
1050            left_in,
1051            right_in,
1052            &mut out_out,
1053            cmplx_in.try_into().unwrap(),
1054            NULL,
1055        );
1056        utils::result(
1057            vips_op_response,
1058            VipsImage { ctx: out_out },
1059            Error::Complex2Error,
1060        )
1061    }
1062}
1063
1064/// VipsComplexform (complexform), form a complex image from two real images
1065/// left: `&VipsImage` -> Left-hand image argument
1066/// right: `&VipsImage` -> Right-hand image argument
1067/// returns `VipsImage` - Output image
1068pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1069    unsafe {
1070        let left_in: *mut bindings::VipsImage = left.ctx;
1071        let right_in: *mut bindings::VipsImage = right.ctx;
1072        let mut out_out: *mut bindings::VipsImage = null_mut();
1073
1074        let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1075        utils::result(
1076            vips_op_response,
1077            VipsImage { ctx: out_out },
1078            Error::ComplexformError,
1079        )
1080    }
1081}
1082
1083/// VipsSum (sum), sum an array of images
1084/// inp: `&mut [VipsImage]` -> Array of input images
1085/// returns `VipsImage` - Output image
1086pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1087    unsafe {
1088        let (inp_len, mut inp_in) = {
1089            let len = inp.len();
1090            let mut input = Vec::new();
1091            for img in inp {
1092                input.push(img.ctx)
1093            }
1094            (len as i32, input)
1095        };
1096        let mut out_out: *mut bindings::VipsImage = null_mut();
1097
1098        let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1099        utils::result(
1100            vips_op_response,
1101            VipsImage { ctx: out_out },
1102            Error::SumError,
1103        )
1104    }
1105}
1106
1107/// VipsInvert (invert), invert an image
1108/// inp: `&VipsImage` -> Input image
1109/// returns `VipsImage` - Output image
1110pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1111    unsafe {
1112        let inp_in: *mut bindings::VipsImage = inp.ctx;
1113        let mut out_out: *mut bindings::VipsImage = null_mut();
1114
1115        let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1116        utils::result(
1117            vips_op_response,
1118            VipsImage { ctx: out_out },
1119            Error::InvertError,
1120        )
1121    }
1122}
1123
1124/// VipsMath (math), apply a math operation to an image
1125/// inp: `&VipsImage` -> Input image
1126/// math: `OperationMath` -> Math to perform
1127///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0 [DEFAULT]
1128///  `Co` -> VIPS_OPERATION_MATH_COS = 1
1129///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
1130///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
1131///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
1132///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
1133///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
1134///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
1135///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
1136///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
1137///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
1138///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
1139///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
1140///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
1141///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
1142///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
1143///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
1144/// returns `VipsImage` - Output image
1145pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1146    unsafe {
1147        let inp_in: *mut bindings::VipsImage = inp.ctx;
1148        let math_in: i32 = math as i32;
1149        let mut out_out: *mut bindings::VipsImage = null_mut();
1150
1151        let vips_op_response =
1152            bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1153        utils::result(
1154            vips_op_response,
1155            VipsImage { ctx: out_out },
1156            Error::MathError,
1157        )
1158    }
1159}
1160
1161/// VipsAbs (abs), absolute value of an image
1162/// inp: `&VipsImage` -> Input image
1163/// returns `VipsImage` - Output image
1164pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1165    unsafe {
1166        let inp_in: *mut bindings::VipsImage = inp.ctx;
1167        let mut out_out: *mut bindings::VipsImage = null_mut();
1168
1169        let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1170        utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1171    }
1172}
1173
1174/// VipsSign (sign), unit vector of pixel
1175/// inp: `&VipsImage` -> Input image
1176/// returns `VipsImage` - Output image
1177pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1178    unsafe {
1179        let inp_in: *mut bindings::VipsImage = inp.ctx;
1180        let mut out_out: *mut bindings::VipsImage = null_mut();
1181
1182        let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1183        utils::result(
1184            vips_op_response,
1185            VipsImage { ctx: out_out },
1186            Error::SignError,
1187        )
1188    }
1189}
1190
1191/// VipsRound (round), perform a round function on an image
1192/// inp: `&VipsImage` -> Input image
1193/// round: `OperationRound` -> Rounding operation to perform
1194///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0 [DEFAULT]
1195///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
1196///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
1197///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
1198/// returns `VipsImage` - Output image
1199pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1200    unsafe {
1201        let inp_in: *mut bindings::VipsImage = inp.ctx;
1202        let round_in: i32 = round as i32;
1203        let mut out_out: *mut bindings::VipsImage = null_mut();
1204
1205        let vips_op_response =
1206            bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1207        utils::result(
1208            vips_op_response,
1209            VipsImage { ctx: out_out },
1210            Error::RoundError,
1211        )
1212    }
1213}
1214
1215/// VipsRelationalConst (relational_const), relational operations against a constant
1216/// inp: `&VipsImage` -> Input image
1217/// relational: `OperationRelational` -> Relational to perform
1218///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
1219///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
1220///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
1221///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
1222///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
1223///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
1224///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
1225/// c: `&mut [f64]` -> Array of constants
1226/// returns `VipsImage` - Output image
1227pub fn relational_const(
1228    inp: &VipsImage,
1229    relational: OperationRelational,
1230    c: &mut [f64],
1231) -> Result<VipsImage> {
1232    unsafe {
1233        let inp_in: *mut bindings::VipsImage = inp.ctx;
1234        let relational_in: i32 = relational as i32;
1235        let c_in: *mut f64 = c.as_mut_ptr();
1236        let mut out_out: *mut bindings::VipsImage = null_mut();
1237
1238        let vips_op_response = bindings::vips_relational_const(
1239            inp_in,
1240            &mut out_out,
1241            relational_in.try_into().unwrap(),
1242            c_in,
1243            c.len() as i32,
1244            NULL,
1245        );
1246        utils::result(
1247            vips_op_response,
1248            VipsImage { ctx: out_out },
1249            Error::RelationalConstError,
1250        )
1251    }
1252}
1253
1254/// VipsRemainderConst (remainder_const), remainder after integer division of an image and a constant
1255/// inp: `&VipsImage` -> Input image
1256/// c: `&mut [f64]` -> Array of constants
1257/// returns `VipsImage` - Output image
1258pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1259    unsafe {
1260        let inp_in: *mut bindings::VipsImage = inp.ctx;
1261        let c_in: *mut f64 = c.as_mut_ptr();
1262        let mut out_out: *mut bindings::VipsImage = null_mut();
1263
1264        let vips_op_response =
1265            bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1266        utils::result(
1267            vips_op_response,
1268            VipsImage { ctx: out_out },
1269            Error::RemainderConstError,
1270        )
1271    }
1272}
1273
1274/// VipsBooleanConst (boolean_const), boolean operations against a constant
1275/// inp: `&VipsImage` -> Input image
1276/// boolean: `OperationBoolean` -> Boolean to perform
1277///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1278///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1279///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1280///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1281///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1282///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1283/// c: `&mut [f64]` -> Array of constants
1284/// returns `VipsImage` - Output image
1285pub fn boolean_const(
1286    inp: &VipsImage,
1287    boolean: OperationBoolean,
1288    c: &mut [f64],
1289) -> Result<VipsImage> {
1290    unsafe {
1291        let inp_in: *mut bindings::VipsImage = inp.ctx;
1292        let boolean_in: i32 = boolean as i32;
1293        let c_in: *mut f64 = c.as_mut_ptr();
1294        let mut out_out: *mut bindings::VipsImage = null_mut();
1295
1296        let vips_op_response = bindings::vips_boolean_const(
1297            inp_in,
1298            &mut out_out,
1299            boolean_in.try_into().unwrap(),
1300            c_in,
1301            c.len() as i32,
1302            NULL,
1303        );
1304        utils::result(
1305            vips_op_response,
1306            VipsImage { ctx: out_out },
1307            Error::BooleanConstError,
1308        )
1309    }
1310}
1311
1312/// VipsMath2Const (math2_const), binary math operations with a constant
1313/// inp: `&VipsImage` -> Input image
1314/// math_2: `OperationMath2` -> Math to perform
1315///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1316///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1317///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1318///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1319/// c: `&mut [f64]` -> Array of constants
1320/// returns `VipsImage` - Output image
1321pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1322    unsafe {
1323        let inp_in: *mut bindings::VipsImage = inp.ctx;
1324        let math_2_in: i32 = math_2 as i32;
1325        let c_in: *mut f64 = c.as_mut_ptr();
1326        let mut out_out: *mut bindings::VipsImage = null_mut();
1327
1328        let vips_op_response = bindings::vips_math2_const(
1329            inp_in,
1330            &mut out_out,
1331            math_2_in.try_into().unwrap(),
1332            c_in,
1333            c.len() as i32,
1334            NULL,
1335        );
1336        utils::result(
1337            vips_op_response,
1338            VipsImage { ctx: out_out },
1339            Error::Math2ConstError,
1340        )
1341    }
1342}
1343
1344/// VipsComplex (complex), perform a complex operation on an image
1345/// inp: `&VipsImage` -> Input image
1346/// cmplx: `OperationComplex` -> Complex to perform
1347///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0 [DEFAULT]
1348///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
1349///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
1350///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
1351/// returns `VipsImage` - Output image
1352pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1353    unsafe {
1354        let inp_in: *mut bindings::VipsImage = inp.ctx;
1355        let cmplx_in: i32 = cmplx as i32;
1356        let mut out_out: *mut bindings::VipsImage = null_mut();
1357
1358        let vips_op_response =
1359            bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1360        utils::result(
1361            vips_op_response,
1362            VipsImage { ctx: out_out },
1363            Error::ComplexError,
1364        )
1365    }
1366}
1367
1368/// VipsComplexget (complexget), get a component from a complex image
1369/// inp: `&VipsImage` -> Input image
1370/// get: `OperationComplexget` -> Complex to perform
1371///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0 [DEFAULT]
1372///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
1373///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
1374/// returns `VipsImage` - Output image
1375pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1376    unsafe {
1377        let inp_in: *mut bindings::VipsImage = inp.ctx;
1378        let get_in: i32 = get as i32;
1379        let mut out_out: *mut bindings::VipsImage = null_mut();
1380
1381        let vips_op_response =
1382            bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1383        utils::result(
1384            vips_op_response,
1385            VipsImage { ctx: out_out },
1386            Error::ComplexgetError,
1387        )
1388    }
1389}
1390
1391/// VipsAvg (avg), find image average
1392/// inp: `&VipsImage` -> Input image
1393/// returns `f64` - Output value
1394pub fn avg(inp: &VipsImage) -> Result<f64> {
1395    unsafe {
1396        let inp_in: *mut bindings::VipsImage = inp.ctx;
1397        let mut out_out: f64 = f64::from(0);
1398
1399        let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1400        utils::result(vips_op_response, out_out, Error::AvgError)
1401    }
1402}
1403
1404/// VipsMin (min), find image minimum
1405/// inp: `&VipsImage` -> Input image
1406/// returns `f64` - Output value
1407pub fn min(inp: &VipsImage) -> Result<f64> {
1408    unsafe {
1409        let inp_in: *mut bindings::VipsImage = inp.ctx;
1410        let mut out_out: f64 = f64::from(0);
1411
1412        let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1413        utils::result(vips_op_response, out_out, Error::MinError)
1414    }
1415}
1416
1417/// Options for min operation
1418#[derive(Clone, Debug)]
1419pub struct MinOptions {
1420    /// x: `i32` -> Horizontal position of minimum
1421    /// min: 0, max: 10000000, default: 0
1422    pub x: i32,
1423    /// y: `i32` -> Vertical position of minimum
1424    /// min: 0, max: 10000000, default: 0
1425    pub y: i32,
1426    /// size: `i32` -> Number of minimum values to find
1427    /// min: 1, max: 1000000, default: 10
1428    pub size: i32,
1429    /// out_array: `Vec<f64>` -> Array of output values
1430    pub out_array: Vec<f64>,
1431    /// x_array: `Vec<i32>` -> Array of horizontal positions
1432    pub x_array: Vec<i32>,
1433    /// y_array: `Vec<i32>` -> Array of vertical positions
1434    pub y_array: Vec<i32>,
1435}
1436
1437impl std::default::Default for MinOptions {
1438    fn default() -> Self {
1439        MinOptions {
1440            x: i32::from(0),
1441            y: i32::from(0),
1442            size: i32::from(10),
1443            out_array: Vec::new(),
1444            x_array: Vec::new(),
1445            y_array: Vec::new(),
1446        }
1447    }
1448}
1449
1450/// VipsMin (min), find image minimum
1451/// inp: `&VipsImage` -> Input image
1452/// min_options: `&MinOptions` -> optional arguments
1453/// returns `f64` - Output value
1454pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1455    unsafe {
1456        let inp_in: *mut bindings::VipsImage = inp.ctx;
1457        let mut out_out: f64 = f64::from(0);
1458
1459        let x_in: i32 = min_options.x;
1460        let x_in_name = utils::new_c_string("x")?;
1461
1462        let y_in: i32 = min_options.y;
1463        let y_in_name = utils::new_c_string("y")?;
1464
1465        let size_in: i32 = min_options.size;
1466        let size_in_name = utils::new_c_string("size")?;
1467
1468        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1469        let out_array_in = out_array_wrapper.ctx;
1470        let out_array_in_name = utils::new_c_string("out-array")?;
1471
1472        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1473        let x_array_in = x_array_wrapper.ctx;
1474        let x_array_in_name = utils::new_c_string("x-array")?;
1475
1476        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1477        let y_array_in = y_array_wrapper.ctx;
1478        let y_array_in_name = utils::new_c_string("y-array")?;
1479
1480        let vips_op_response = bindings::vips_min(
1481            inp_in,
1482            &mut out_out,
1483            x_in_name.as_ptr(),
1484            x_in,
1485            y_in_name.as_ptr(),
1486            y_in,
1487            size_in_name.as_ptr(),
1488            size_in,
1489            out_array_in_name.as_ptr(),
1490            out_array_in,
1491            x_array_in_name.as_ptr(),
1492            x_array_in,
1493            y_array_in_name.as_ptr(),
1494            y_array_in,
1495            NULL,
1496        );
1497        utils::result(vips_op_response, out_out, Error::MinError)
1498    }
1499}
1500
1501/// VipsMax (max), find image maximum
1502/// inp: `&VipsImage` -> Input image
1503/// returns `f64` - Output value
1504pub fn max(inp: &VipsImage) -> Result<f64> {
1505    unsafe {
1506        let inp_in: *mut bindings::VipsImage = inp.ctx;
1507        let mut out_out: f64 = f64::from(0);
1508
1509        let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1510        utils::result(vips_op_response, out_out, Error::MaxError)
1511    }
1512}
1513
1514/// Options for max operation
1515#[derive(Clone, Debug)]
1516pub struct MaxOptions {
1517    /// x: `i32` -> Horizontal position of maximum
1518    /// min: 0, max: 10000000, default: 0
1519    pub x: i32,
1520    /// y: `i32` -> Vertical position of maximum
1521    /// min: 0, max: 10000000, default: 0
1522    pub y: i32,
1523    /// size: `i32` -> Number of maximum values to find
1524    /// min: 1, max: 1000000, default: 10
1525    pub size: i32,
1526    /// out_array: `Vec<f64>` -> Array of output values
1527    pub out_array: Vec<f64>,
1528    /// x_array: `Vec<i32>` -> Array of horizontal positions
1529    pub x_array: Vec<i32>,
1530    /// y_array: `Vec<i32>` -> Array of vertical positions
1531    pub y_array: Vec<i32>,
1532}
1533
1534impl std::default::Default for MaxOptions {
1535    fn default() -> Self {
1536        MaxOptions {
1537            x: i32::from(0),
1538            y: i32::from(0),
1539            size: i32::from(10),
1540            out_array: Vec::new(),
1541            x_array: Vec::new(),
1542            y_array: Vec::new(),
1543        }
1544    }
1545}
1546
1547/// VipsMax (max), find image maximum
1548/// inp: `&VipsImage` -> Input image
1549/// max_options: `&MaxOptions` -> optional arguments
1550/// returns `f64` - Output value
1551pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1552    unsafe {
1553        let inp_in: *mut bindings::VipsImage = inp.ctx;
1554        let mut out_out: f64 = f64::from(0);
1555
1556        let x_in: i32 = max_options.x;
1557        let x_in_name = utils::new_c_string("x")?;
1558
1559        let y_in: i32 = max_options.y;
1560        let y_in_name = utils::new_c_string("y")?;
1561
1562        let size_in: i32 = max_options.size;
1563        let size_in_name = utils::new_c_string("size")?;
1564
1565        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1566        let out_array_in = out_array_wrapper.ctx;
1567        let out_array_in_name = utils::new_c_string("out-array")?;
1568
1569        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1570        let x_array_in = x_array_wrapper.ctx;
1571        let x_array_in_name = utils::new_c_string("x-array")?;
1572
1573        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1574        let y_array_in = y_array_wrapper.ctx;
1575        let y_array_in_name = utils::new_c_string("y-array")?;
1576
1577        let vips_op_response = bindings::vips_max(
1578            inp_in,
1579            &mut out_out,
1580            x_in_name.as_ptr(),
1581            x_in,
1582            y_in_name.as_ptr(),
1583            y_in,
1584            size_in_name.as_ptr(),
1585            size_in,
1586            out_array_in_name.as_ptr(),
1587            out_array_in,
1588            x_array_in_name.as_ptr(),
1589            x_array_in,
1590            y_array_in_name.as_ptr(),
1591            y_array_in,
1592            NULL,
1593        );
1594        utils::result(vips_op_response, out_out, Error::MaxError)
1595    }
1596}
1597
1598/// VipsDeviate (deviate), find image standard deviation
1599/// inp: `&VipsImage` -> Input image
1600/// returns `f64` - Output value
1601pub fn deviate(inp: &VipsImage) -> Result<f64> {
1602    unsafe {
1603        let inp_in: *mut bindings::VipsImage = inp.ctx;
1604        let mut out_out: f64 = f64::from(0);
1605
1606        let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1607        utils::result(vips_op_response, out_out, Error::DeviateError)
1608    }
1609}
1610
1611/// VipsStats (stats), find many image stats
1612/// inp: `&VipsImage` -> Input image
1613/// returns `VipsImage` - Output array of statistics
1614pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1615    unsafe {
1616        let inp_in: *mut bindings::VipsImage = inp.ctx;
1617        let mut out_out: *mut bindings::VipsImage = null_mut();
1618
1619        let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1620        utils::result(
1621            vips_op_response,
1622            VipsImage { ctx: out_out },
1623            Error::StatError,
1624        )
1625    }
1626}
1627
1628/// VipsHistFind (hist_find), find image histogram
1629/// inp: `&VipsImage` -> Input image
1630/// returns `VipsImage` - Output histogram
1631pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1632    unsafe {
1633        let inp_in: *mut bindings::VipsImage = inp.ctx;
1634        let mut out_out: *mut bindings::VipsImage = null_mut();
1635
1636        let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1637        utils::result(
1638            vips_op_response,
1639            VipsImage { ctx: out_out },
1640            Error::HistFindError,
1641        )
1642    }
1643}
1644
1645/// Options for hist_find operation
1646#[derive(Clone, Debug)]
1647pub struct HistFindOptions {
1648    /// band: `i32` -> Find histogram of band
1649    /// min: -1, max: 100000, default: -1
1650    pub band: i32,
1651}
1652
1653impl std::default::Default for HistFindOptions {
1654    fn default() -> Self {
1655        HistFindOptions {
1656            band: i32::from(-1),
1657        }
1658    }
1659}
1660
1661/// VipsHistFind (hist_find), find image histogram
1662/// inp: `&VipsImage` -> Input image
1663/// hist_find_options: `&HistFindOptions` -> optional arguments
1664/// returns `VipsImage` - Output histogram
1665pub fn hist_find_with_opts(
1666    inp: &VipsImage,
1667    hist_find_options: &HistFindOptions,
1668) -> Result<VipsImage> {
1669    unsafe {
1670        let inp_in: *mut bindings::VipsImage = inp.ctx;
1671        let mut out_out: *mut bindings::VipsImage = null_mut();
1672
1673        let band_in: i32 = hist_find_options.band;
1674        let band_in_name = utils::new_c_string("band")?;
1675
1676        let vips_op_response =
1677            bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1678        utils::result(
1679            vips_op_response,
1680            VipsImage { ctx: out_out },
1681            Error::HistFindError,
1682        )
1683    }
1684}
1685
1686/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1687/// inp: `&VipsImage` -> Input image
1688/// returns `VipsImage` - Output histogram
1689pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1690    unsafe {
1691        let inp_in: *mut bindings::VipsImage = inp.ctx;
1692        let mut out_out: *mut bindings::VipsImage = null_mut();
1693
1694        let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1695        utils::result(
1696            vips_op_response,
1697            VipsImage { ctx: out_out },
1698            Error::HistFindNdimError,
1699        )
1700    }
1701}
1702
1703/// Options for hist_find_ndim operation
1704#[derive(Clone, Debug)]
1705pub struct HistFindNdimOptions {
1706    /// bins: `i32` -> Number of bins in each dimension
1707    /// min: 1, max: 65536, default: 10
1708    pub bins: i32,
1709}
1710
1711impl std::default::Default for HistFindNdimOptions {
1712    fn default() -> Self {
1713        HistFindNdimOptions {
1714            bins: i32::from(10),
1715        }
1716    }
1717}
1718
1719/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1720/// inp: `&VipsImage` -> Input image
1721/// hist_find_ndim_options: `&HistFindNdimOptions` -> optional arguments
1722/// returns `VipsImage` - Output histogram
1723pub fn hist_find_ndim_with_opts(
1724    inp: &VipsImage,
1725    hist_find_ndim_options: &HistFindNdimOptions,
1726) -> Result<VipsImage> {
1727    unsafe {
1728        let inp_in: *mut bindings::VipsImage = inp.ctx;
1729        let mut out_out: *mut bindings::VipsImage = null_mut();
1730
1731        let bins_in: i32 = hist_find_ndim_options.bins;
1732        let bins_in_name = utils::new_c_string("bins")?;
1733
1734        let vips_op_response = bindings::vips_hist_find_ndim(
1735            inp_in,
1736            &mut out_out,
1737            bins_in_name.as_ptr(),
1738            bins_in,
1739            NULL,
1740        );
1741        utils::result(
1742            vips_op_response,
1743            VipsImage { ctx: out_out },
1744            Error::HistFindNdimError,
1745        )
1746    }
1747}
1748
1749/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1750/// inp: `&VipsImage` -> Input image
1751/// index: `&VipsImage` -> Index image
1752/// returns `VipsImage` - Output histogram
1753pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1754    unsafe {
1755        let inp_in: *mut bindings::VipsImage = inp.ctx;
1756        let index_in: *mut bindings::VipsImage = index.ctx;
1757        let mut out_out: *mut bindings::VipsImage = null_mut();
1758
1759        let vips_op_response =
1760            bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1761        utils::result(
1762            vips_op_response,
1763            VipsImage { ctx: out_out },
1764            Error::HistFindIndexedError,
1765        )
1766    }
1767}
1768
1769/// Options for hist_find_indexed operation
1770#[derive(Clone, Debug)]
1771pub struct HistFindIndexedOptions {
1772    /// combine: `Combine` -> Combine bins like this
1773    ///  `Max` -> VIPS_COMBINE_MAX = 0
1774    ///  `Sum` -> VIPS_COMBINE_SUM = 1 [DEFAULT]
1775    ///  `Min` -> VIPS_COMBINE_MIN = 2
1776    ///  `Last` -> VIPS_COMBINE_LAST = 3
1777    pub combine: Combine,
1778}
1779
1780impl std::default::Default for HistFindIndexedOptions {
1781    fn default() -> Self {
1782        HistFindIndexedOptions {
1783            combine: Combine::Sum,
1784        }
1785    }
1786}
1787
1788/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1789/// inp: `&VipsImage` -> Input image
1790/// index: `&VipsImage` -> Index image
1791/// hist_find_indexed_options: `&HistFindIndexedOptions` -> optional arguments
1792/// returns `VipsImage` - Output histogram
1793pub fn hist_find_indexed_with_opts(
1794    inp: &VipsImage,
1795    index: &VipsImage,
1796    hist_find_indexed_options: &HistFindIndexedOptions,
1797) -> Result<VipsImage> {
1798    unsafe {
1799        let inp_in: *mut bindings::VipsImage = inp.ctx;
1800        let index_in: *mut bindings::VipsImage = index.ctx;
1801        let mut out_out: *mut bindings::VipsImage = null_mut();
1802
1803        let combine_in: i32 = hist_find_indexed_options.combine as i32;
1804        let combine_in_name = utils::new_c_string("combine")?;
1805
1806        let vips_op_response = bindings::vips_hist_find_indexed(
1807            inp_in,
1808            index_in,
1809            &mut out_out,
1810            combine_in_name.as_ptr(),
1811            combine_in,
1812            NULL,
1813        );
1814        utils::result(
1815            vips_op_response,
1816            VipsImage { ctx: out_out },
1817            Error::HistFindIndexedError,
1818        )
1819    }
1820}
1821
1822/// VipsHoughLine (hough_line), find hough line transform
1823/// inp: `&VipsImage` -> Input image
1824/// returns `VipsImage` - Output image
1825pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1826    unsafe {
1827        let inp_in: *mut bindings::VipsImage = inp.ctx;
1828        let mut out_out: *mut bindings::VipsImage = null_mut();
1829
1830        let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1831        utils::result(
1832            vips_op_response,
1833            VipsImage { ctx: out_out },
1834            Error::HoughLineError,
1835        )
1836    }
1837}
1838
1839/// Options for hough_line operation
1840#[derive(Clone, Debug)]
1841pub struct HoughLineOptions {
1842    /// width: `i32` -> Horizontal size of parameter space
1843    /// min: 1, max: 100000, default: 256
1844    pub width: i32,
1845    /// height: `i32` -> Vertical size of parameter space
1846    /// min: 1, max: 100000, default: 256
1847    pub height: i32,
1848}
1849
1850impl std::default::Default for HoughLineOptions {
1851    fn default() -> Self {
1852        HoughLineOptions {
1853            width: i32::from(256),
1854            height: i32::from(256),
1855        }
1856    }
1857}
1858
1859/// VipsHoughLine (hough_line), find hough line transform
1860/// inp: `&VipsImage` -> Input image
1861/// hough_line_options: `&HoughLineOptions` -> optional arguments
1862/// returns `VipsImage` - Output image
1863pub fn hough_line_with_opts(
1864    inp: &VipsImage,
1865    hough_line_options: &HoughLineOptions,
1866) -> Result<VipsImage> {
1867    unsafe {
1868        let inp_in: *mut bindings::VipsImage = inp.ctx;
1869        let mut out_out: *mut bindings::VipsImage = null_mut();
1870
1871        let width_in: i32 = hough_line_options.width;
1872        let width_in_name = utils::new_c_string("width")?;
1873
1874        let height_in: i32 = hough_line_options.height;
1875        let height_in_name = utils::new_c_string("height")?;
1876
1877        let vips_op_response = bindings::vips_hough_line(
1878            inp_in,
1879            &mut out_out,
1880            width_in_name.as_ptr(),
1881            width_in,
1882            height_in_name.as_ptr(),
1883            height_in,
1884            NULL,
1885        );
1886        utils::result(
1887            vips_op_response,
1888            VipsImage { ctx: out_out },
1889            Error::HoughLineError,
1890        )
1891    }
1892}
1893
1894/// VipsHoughCircle (hough_circle), find hough circle transform
1895/// inp: `&VipsImage` -> Input image
1896/// returns `VipsImage` - Output image
1897pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
1898    unsafe {
1899        let inp_in: *mut bindings::VipsImage = inp.ctx;
1900        let mut out_out: *mut bindings::VipsImage = null_mut();
1901
1902        let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
1903        utils::result(
1904            vips_op_response,
1905            VipsImage { ctx: out_out },
1906            Error::HoughCircleError,
1907        )
1908    }
1909}
1910
1911/// Options for hough_circle operation
1912#[derive(Clone, Debug)]
1913pub struct HoughCircleOptions {
1914    /// scale: `i32` -> Scale down dimensions by this factor
1915    /// min: 1, max: 100000, default: 3
1916    pub scale: i32,
1917    /// min_radius: `i32` -> Smallest radius to search for
1918    /// min: 1, max: 100000, default: 10
1919    pub min_radius: i32,
1920    /// max_radius: `i32` -> Largest radius to search for
1921    /// min: 1, max: 100000, default: 20
1922    pub max_radius: i32,
1923}
1924
1925impl std::default::Default for HoughCircleOptions {
1926    fn default() -> Self {
1927        HoughCircleOptions {
1928            scale: i32::from(3),
1929            min_radius: i32::from(10),
1930            max_radius: i32::from(20),
1931        }
1932    }
1933}
1934
1935/// VipsHoughCircle (hough_circle), find hough circle transform
1936/// inp: `&VipsImage` -> Input image
1937/// hough_circle_options: `&HoughCircleOptions` -> optional arguments
1938/// returns `VipsImage` - Output image
1939pub fn hough_circle_with_opts(
1940    inp: &VipsImage,
1941    hough_circle_options: &HoughCircleOptions,
1942) -> Result<VipsImage> {
1943    unsafe {
1944        let inp_in: *mut bindings::VipsImage = inp.ctx;
1945        let mut out_out: *mut bindings::VipsImage = null_mut();
1946
1947        let scale_in: i32 = hough_circle_options.scale;
1948        let scale_in_name = utils::new_c_string("scale")?;
1949
1950        let min_radius_in: i32 = hough_circle_options.min_radius;
1951        let min_radius_in_name = utils::new_c_string("min-radius")?;
1952
1953        let max_radius_in: i32 = hough_circle_options.max_radius;
1954        let max_radius_in_name = utils::new_c_string("max-radius")?;
1955
1956        let vips_op_response = bindings::vips_hough_circle(
1957            inp_in,
1958            &mut out_out,
1959            scale_in_name.as_ptr(),
1960            scale_in,
1961            min_radius_in_name.as_ptr(),
1962            min_radius_in,
1963            max_radius_in_name.as_ptr(),
1964            max_radius_in,
1965            NULL,
1966        );
1967        utils::result(
1968            vips_op_response,
1969            VipsImage { ctx: out_out },
1970            Error::HoughCircleError,
1971        )
1972    }
1973}
1974
1975/// VipsProject (project), find image projections
1976/// inp: `&VipsImage` -> Input image
1977/// Tuple (
1978/// VipsImage - Sums of columns
1979/// VipsImage - Sums of rows
1980///)
1981pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
1982    unsafe {
1983        let inp_in: *mut bindings::VipsImage = inp.ctx;
1984        let mut columns_out: *mut bindings::VipsImage = null_mut();
1985        let mut rows_out: *mut bindings::VipsImage = null_mut();
1986
1987        let vips_op_response =
1988            bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
1989        utils::result(
1990            vips_op_response,
1991            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
1992            Error::ProjectError,
1993        )
1994    }
1995}
1996
1997/// VipsProfile (profile), find image profiles
1998/// inp: `&VipsImage` -> Input image
1999/// Tuple (
2000/// VipsImage - First non-zero pixel in column
2001/// VipsImage - First non-zero pixel in row
2002///)
2003pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2004    unsafe {
2005        let inp_in: *mut bindings::VipsImage = inp.ctx;
2006        let mut columns_out: *mut bindings::VipsImage = null_mut();
2007        let mut rows_out: *mut bindings::VipsImage = null_mut();
2008
2009        let vips_op_response =
2010            bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2011        utils::result(
2012            vips_op_response,
2013            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2014            Error::ProfileError,
2015        )
2016    }
2017}
2018
2019/// VipsMeasure (measure), measure a set of patches on a color chart
2020/// inp: `&VipsImage` -> Image to measure
2021/// h: `i32` -> Number of patches across chart
2022/// min: 1, max: 10000000, default: 1
2023/// v: `i32` -> Number of patches down chart
2024/// min: 1, max: 10000000, default: 1
2025/// returns `VipsImage` - Output array of statistics
2026pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2027    unsafe {
2028        let inp_in: *mut bindings::VipsImage = inp.ctx;
2029        let h_in: i32 = h;
2030        let v_in: i32 = v;
2031        let mut out_out: *mut bindings::VipsImage = null_mut();
2032
2033        let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2034        utils::result(
2035            vips_op_response,
2036            VipsImage { ctx: out_out },
2037            Error::MeasureError,
2038        )
2039    }
2040}
2041
2042/// Options for measure operation
2043#[derive(Clone, Debug)]
2044pub struct MeasureOptions {
2045    /// left: `i32` -> Left edge of extract area
2046    /// min: 0, max: 10000000, default: 0
2047    pub left: i32,
2048    /// top: `i32` -> Top edge of extract area
2049    /// min: 0, max: 10000000, default: 0
2050    pub top: i32,
2051    /// width: `i32` -> Width of extract area
2052    /// min: 1, max: 10000000, default: 1
2053    pub width: i32,
2054    /// height: `i32` -> Height of extract area
2055    /// min: 1, max: 10000000, default: 1
2056    pub height: i32,
2057}
2058
2059impl std::default::Default for MeasureOptions {
2060    fn default() -> Self {
2061        MeasureOptions {
2062            left: i32::from(0),
2063            top: i32::from(0),
2064            width: i32::from(1),
2065            height: i32::from(1),
2066        }
2067    }
2068}
2069
2070/// VipsMeasure (measure), measure a set of patches on a color chart
2071/// inp: `&VipsImage` -> Image to measure
2072/// h: `i32` -> Number of patches across chart
2073/// min: 1, max: 10000000, default: 1
2074/// v: `i32` -> Number of patches down chart
2075/// min: 1, max: 10000000, default: 1
2076/// measure_options: `&MeasureOptions` -> optional arguments
2077/// returns `VipsImage` - Output array of statistics
2078pub fn measure_with_opts(
2079    inp: &VipsImage,
2080    h: i32,
2081    v: i32,
2082    measure_options: &MeasureOptions,
2083) -> Result<VipsImage> {
2084    unsafe {
2085        let inp_in: *mut bindings::VipsImage = inp.ctx;
2086        let h_in: i32 = h;
2087        let v_in: i32 = v;
2088        let mut out_out: *mut bindings::VipsImage = null_mut();
2089
2090        let left_in: i32 = measure_options.left;
2091        let left_in_name = utils::new_c_string("left")?;
2092
2093        let top_in: i32 = measure_options.top;
2094        let top_in_name = utils::new_c_string("top")?;
2095
2096        let width_in: i32 = measure_options.width;
2097        let width_in_name = utils::new_c_string("width")?;
2098
2099        let height_in: i32 = measure_options.height;
2100        let height_in_name = utils::new_c_string("height")?;
2101
2102        let vips_op_response = bindings::vips_measure(
2103            inp_in,
2104            &mut out_out,
2105            h_in,
2106            v_in,
2107            left_in_name.as_ptr(),
2108            left_in,
2109            top_in_name.as_ptr(),
2110            top_in,
2111            width_in_name.as_ptr(),
2112            width_in,
2113            height_in_name.as_ptr(),
2114            height_in,
2115            NULL,
2116        );
2117        utils::result(
2118            vips_op_response,
2119            VipsImage { ctx: out_out },
2120            Error::MeasureError,
2121        )
2122    }
2123}
2124
2125/// VipsFindTrim (find_trim), search an image for non-edge areas
2126/// inp: `&VipsImage` -> Image to find_trim
2127/// Tuple (
2128/// i32 - Left edge of image
2129/// i32 - Top edge of extract area
2130/// i32 - Width of extract area
2131/// i32 - Height of extract area
2132///)
2133pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2134    unsafe {
2135        let inp_in: *mut bindings::VipsImage = inp.ctx;
2136        let mut left_out: i32 = i32::from(1);
2137        let mut top_out: i32 = i32::from(0);
2138        let mut width_out: i32 = i32::from(1);
2139        let mut height_out: i32 = i32::from(1);
2140
2141        let vips_op_response = bindings::vips_find_trim(
2142            inp_in,
2143            &mut left_out,
2144            &mut top_out,
2145            &mut width_out,
2146            &mut height_out,
2147            NULL,
2148        );
2149        utils::result(
2150            vips_op_response,
2151            (left_out, top_out, width_out, height_out),
2152            Error::FindTrimError,
2153        )
2154    }
2155}
2156
2157/// Options for find_trim operation
2158#[derive(Clone, Debug)]
2159pub struct FindTrimOptions {
2160    /// threshold: `f64` -> Object threshold
2161    /// min: 0, max: inf, default: 10
2162    pub threshold: f64,
2163    /// background: `Vec<f64>` -> Color for background pixels
2164    pub background: Vec<f64>,
2165    /// line_art: `bool` -> Enable line art mode
2166    /// default: false
2167    pub line_art: bool,
2168}
2169
2170impl std::default::Default for FindTrimOptions {
2171    fn default() -> Self {
2172        FindTrimOptions {
2173            threshold: f64::from(10),
2174            background: Vec::new(),
2175            line_art: false,
2176        }
2177    }
2178}
2179
2180/// VipsFindTrim (find_trim), search an image for non-edge areas
2181/// inp: `&VipsImage` -> Image to find_trim
2182/// find_trim_options: `&FindTrimOptions` -> optional arguments
2183/// Tuple (
2184/// i32 - Left edge of image
2185/// i32 - Top edge of extract area
2186/// i32 - Width of extract area
2187/// i32 - Height of extract area
2188///)
2189pub fn find_trim_with_opts(
2190    inp: &VipsImage,
2191    find_trim_options: &FindTrimOptions,
2192) -> Result<(i32, i32, i32, i32)> {
2193    unsafe {
2194        let inp_in: *mut bindings::VipsImage = inp.ctx;
2195        let mut left_out: i32 = i32::from(1);
2196        let mut top_out: i32 = i32::from(0);
2197        let mut width_out: i32 = i32::from(1);
2198        let mut height_out: i32 = i32::from(1);
2199
2200        let threshold_in: f64 = find_trim_options.threshold;
2201        let threshold_in_name = utils::new_c_string("threshold")?;
2202
2203        let background_wrapper =
2204            utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2205        let background_in = background_wrapper.ctx;
2206        let background_in_name = utils::new_c_string("background")?;
2207
2208        let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2209        let line_art_in_name = utils::new_c_string("line-art")?;
2210
2211        let vips_op_response = bindings::vips_find_trim(
2212            inp_in,
2213            &mut left_out,
2214            &mut top_out,
2215            &mut width_out,
2216            &mut height_out,
2217            threshold_in_name.as_ptr(),
2218            threshold_in,
2219            background_in_name.as_ptr(),
2220            background_in,
2221            line_art_in_name.as_ptr(),
2222            line_art_in,
2223            NULL,
2224        );
2225        utils::result(
2226            vips_op_response,
2227            (left_out, top_out, width_out, height_out),
2228            Error::FindTrimError,
2229        )
2230    }
2231}
2232
2233/// VipsCopy (copy), copy an image
2234/// inp: `&VipsImage` -> Input image
2235/// returns `VipsImage` - Output image
2236pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2237    unsafe {
2238        let inp_in: *mut bindings::VipsImage = inp.ctx;
2239        let mut out_out: *mut bindings::VipsImage = null_mut();
2240
2241        let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2242        utils::result(
2243            vips_op_response,
2244            VipsImage { ctx: out_out },
2245            Error::CopyError,
2246        )
2247    }
2248}
2249
2250/// Options for copy operation
2251#[derive(Clone, Debug)]
2252pub struct CopyOptions {
2253    /// width: `i32` -> Image width in pixels
2254    /// min: 0, max: 10000000, default: 0
2255    pub width: i32,
2256    /// height: `i32` -> Image height in pixels
2257    /// min: 0, max: 10000000, default: 0
2258    pub height: i32,
2259    /// bands: `i32` -> Number of bands in image
2260    /// min: 0, max: 10000000, default: 0
2261    pub bands: i32,
2262    /// format: `BandFormat` -> Pixel format in image
2263    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
2264    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
2265    ///  `Char` -> VIPS_FORMAT_CHAR = 1
2266    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
2267    ///  `Short` -> VIPS_FORMAT_SHORT = 3
2268    ///  `Uint` -> VIPS_FORMAT_UINT = 4
2269    ///  `Int` -> VIPS_FORMAT_INT = 5
2270    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
2271    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
2272    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
2273    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
2274    ///  `Last` -> VIPS_FORMAT_LAST = 10
2275    pub format: BandFormat,
2276    /// coding: `Coding` -> Pixel coding
2277    ///  `Error` -> VIPS_CODING_ERROR = -1
2278    ///  `None` -> VIPS_CODING_NONE = 0 [DEFAULT]
2279    ///  `Labq` -> VIPS_CODING_LABQ = 2
2280    ///  `Rad` -> VIPS_CODING_RAD = 6
2281    ///  `Last` -> VIPS_CODING_LAST = 7
2282    pub coding: Coding,
2283    /// interpretation: `Interpretation` -> Pixel interpretation
2284    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
2285    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
2286    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
2287    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
2288    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
2289    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
2290    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
2291    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
2292    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
2293    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
2294    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
2295    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
2296    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
2297    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
2298    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
2299    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
2300    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
2301    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
2302    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
2303    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
2304    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
2305    pub interpretation: Interpretation,
2306    /// xres: `f64` -> Horizontal resolution in pixels/mm
2307    /// min: -0, max: 1000000, default: 0
2308    pub xres: f64,
2309    /// yres: `f64` -> Vertical resolution in pixels/mm
2310    /// min: -0, max: 1000000, default: 0
2311    pub yres: f64,
2312    /// xoffset: `i32` -> Horizontal offset of origin
2313    /// min: -10000000, max: 10000000, default: 0
2314    pub xoffset: i32,
2315    /// yoffset: `i32` -> Vertical offset of origin
2316    /// min: -10000000, max: 10000000, default: 0
2317    pub yoffset: i32,
2318}
2319
2320impl std::default::Default for CopyOptions {
2321    fn default() -> Self {
2322        CopyOptions {
2323            width: i32::from(0),
2324            height: i32::from(0),
2325            bands: i32::from(0),
2326            format: BandFormat::Uchar,
2327            coding: Coding::None,
2328            interpretation: Interpretation::Multiband,
2329            xres: f64::from(0),
2330            yres: f64::from(0),
2331            xoffset: i32::from(0),
2332            yoffset: i32::from(0),
2333        }
2334    }
2335}
2336
2337/// VipsCopy (copy), copy an image
2338/// inp: `&VipsImage` -> Input image
2339/// copy_options: `&CopyOptions` -> optional arguments
2340/// returns `VipsImage` - Output image
2341pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2342    unsafe {
2343        let inp_in: *mut bindings::VipsImage = inp.ctx;
2344        let mut out_out: *mut bindings::VipsImage = null_mut();
2345
2346        let width_in: i32 = copy_options.width;
2347        let width_in_name = utils::new_c_string("width")?;
2348
2349        let height_in: i32 = copy_options.height;
2350        let height_in_name = utils::new_c_string("height")?;
2351
2352        let bands_in: i32 = copy_options.bands;
2353        let bands_in_name = utils::new_c_string("bands")?;
2354
2355        let format_in: i32 = copy_options.format as i32;
2356        let format_in_name = utils::new_c_string("format")?;
2357
2358        let coding_in: i32 = copy_options.coding as i32;
2359        let coding_in_name = utils::new_c_string("coding")?;
2360
2361        let interpretation_in: i32 = copy_options.interpretation as i32;
2362        let interpretation_in_name = utils::new_c_string("interpretation")?;
2363
2364        let xres_in: f64 = copy_options.xres;
2365        let xres_in_name = utils::new_c_string("xres")?;
2366
2367        let yres_in: f64 = copy_options.yres;
2368        let yres_in_name = utils::new_c_string("yres")?;
2369
2370        let xoffset_in: i32 = copy_options.xoffset;
2371        let xoffset_in_name = utils::new_c_string("xoffset")?;
2372
2373        let yoffset_in: i32 = copy_options.yoffset;
2374        let yoffset_in_name = utils::new_c_string("yoffset")?;
2375
2376        let vips_op_response = bindings::vips_copy(
2377            inp_in,
2378            &mut out_out,
2379            width_in_name.as_ptr(),
2380            width_in,
2381            height_in_name.as_ptr(),
2382            height_in,
2383            bands_in_name.as_ptr(),
2384            bands_in,
2385            format_in_name.as_ptr(),
2386            format_in,
2387            coding_in_name.as_ptr(),
2388            coding_in,
2389            interpretation_in_name.as_ptr(),
2390            interpretation_in,
2391            xres_in_name.as_ptr(),
2392            xres_in,
2393            yres_in_name.as_ptr(),
2394            yres_in,
2395            xoffset_in_name.as_ptr(),
2396            xoffset_in,
2397            yoffset_in_name.as_ptr(),
2398            yoffset_in,
2399            NULL,
2400        );
2401        utils::result(
2402            vips_op_response,
2403            VipsImage { ctx: out_out },
2404            Error::CopyError,
2405        )
2406    }
2407}
2408
2409/// VipsTileCache (tilecache), cache an image as a set of tiles
2410/// inp: `&VipsImage` -> Input image
2411/// returns `VipsImage` - Output image
2412pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2413    unsafe {
2414        let inp_in: *mut bindings::VipsImage = inp.ctx;
2415        let mut out_out: *mut bindings::VipsImage = null_mut();
2416
2417        let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2418        utils::result(
2419            vips_op_response,
2420            VipsImage { ctx: out_out },
2421            Error::TilecacheError,
2422        )
2423    }
2424}
2425
2426/// Options for tilecache operation
2427#[derive(Clone, Debug)]
2428pub struct TilecacheOptions {
2429    /// tile_width: `i32` -> Tile width in pixels
2430    /// min: 1, max: 1000000, default: 128
2431    pub tile_width: i32,
2432    /// tile_height: `i32` -> Tile height in pixels
2433    /// min: 1, max: 1000000, default: 128
2434    pub tile_height: i32,
2435    /// max_tiles: `i32` -> Maximum number of tiles to cache
2436    /// min: -1, max: 1000000, default: 1000
2437    pub max_tiles: i32,
2438    /// access: `Access` -> Expected access pattern
2439    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2440    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2441    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2442    ///  `Last` -> VIPS_ACCESS_LAST = 3
2443    pub access: Access,
2444    /// threaded: `bool` -> Allow threaded access
2445    /// default: false
2446    pub threaded: bool,
2447    /// persistent: `bool` -> Keep cache between evaluations
2448    /// default: false
2449    pub persistent: bool,
2450}
2451
2452impl std::default::Default for TilecacheOptions {
2453    fn default() -> Self {
2454        TilecacheOptions {
2455            tile_width: i32::from(128),
2456            tile_height: i32::from(128),
2457            max_tiles: i32::from(1000),
2458            access: Access::Random,
2459            threaded: false,
2460            persistent: false,
2461        }
2462    }
2463}
2464
2465/// VipsTileCache (tilecache), cache an image as a set of tiles
2466/// inp: `&VipsImage` -> Input image
2467/// tilecache_options: `&TilecacheOptions` -> optional arguments
2468/// returns `VipsImage` - Output image
2469pub fn tilecache_with_opts(
2470    inp: &VipsImage,
2471    tilecache_options: &TilecacheOptions,
2472) -> Result<VipsImage> {
2473    unsafe {
2474        let inp_in: *mut bindings::VipsImage = inp.ctx;
2475        let mut out_out: *mut bindings::VipsImage = null_mut();
2476
2477        let tile_width_in: i32 = tilecache_options.tile_width;
2478        let tile_width_in_name = utils::new_c_string("tile-width")?;
2479
2480        let tile_height_in: i32 = tilecache_options.tile_height;
2481        let tile_height_in_name = utils::new_c_string("tile-height")?;
2482
2483        let max_tiles_in: i32 = tilecache_options.max_tiles;
2484        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2485
2486        let access_in: i32 = tilecache_options.access as i32;
2487        let access_in_name = utils::new_c_string("access")?;
2488
2489        let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2490        let threaded_in_name = utils::new_c_string("threaded")?;
2491
2492        let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2493        let persistent_in_name = utils::new_c_string("persistent")?;
2494
2495        let vips_op_response = bindings::vips_tilecache(
2496            inp_in,
2497            &mut out_out,
2498            tile_width_in_name.as_ptr(),
2499            tile_width_in,
2500            tile_height_in_name.as_ptr(),
2501            tile_height_in,
2502            max_tiles_in_name.as_ptr(),
2503            max_tiles_in,
2504            access_in_name.as_ptr(),
2505            access_in,
2506            threaded_in_name.as_ptr(),
2507            threaded_in,
2508            persistent_in_name.as_ptr(),
2509            persistent_in,
2510            NULL,
2511        );
2512        utils::result(
2513            vips_op_response,
2514            VipsImage { ctx: out_out },
2515            Error::TilecacheError,
2516        )
2517    }
2518}
2519
2520/// VipsLineCache (linecache), cache an image as a set of lines
2521/// inp: `&VipsImage` -> Input image
2522/// returns `VipsImage` - Output image
2523pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2524    unsafe {
2525        let inp_in: *mut bindings::VipsImage = inp.ctx;
2526        let mut out_out: *mut bindings::VipsImage = null_mut();
2527
2528        let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2529        utils::result(
2530            vips_op_response,
2531            VipsImage { ctx: out_out },
2532            Error::LinecacheError,
2533        )
2534    }
2535}
2536
2537/// Options for linecache operation
2538#[derive(Clone, Debug)]
2539pub struct LinecacheOptions {
2540    /// tile_height: `i32` -> Tile height in pixels
2541    /// min: 1, max: 1000000, default: 128
2542    pub tile_height: i32,
2543    /// access: `Access` -> Expected access pattern
2544    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2545    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2546    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2547    ///  `Last` -> VIPS_ACCESS_LAST = 3
2548    pub access: Access,
2549    /// threaded: `bool` -> Allow threaded access
2550    /// default: false
2551    pub threaded: bool,
2552    /// persistent: `bool` -> Keep cache between evaluations
2553    /// default: false
2554    pub persistent: bool,
2555}
2556
2557impl std::default::Default for LinecacheOptions {
2558    fn default() -> Self {
2559        LinecacheOptions {
2560            tile_height: i32::from(128),
2561            access: Access::Random,
2562            threaded: false,
2563            persistent: false,
2564        }
2565    }
2566}
2567
2568/// VipsLineCache (linecache), cache an image as a set of lines
2569/// inp: `&VipsImage` -> Input image
2570/// linecache_options: `&LinecacheOptions` -> optional arguments
2571/// returns `VipsImage` - Output image
2572pub fn linecache_with_opts(
2573    inp: &VipsImage,
2574    linecache_options: &LinecacheOptions,
2575) -> Result<VipsImage> {
2576    unsafe {
2577        let inp_in: *mut bindings::VipsImage = inp.ctx;
2578        let mut out_out: *mut bindings::VipsImage = null_mut();
2579
2580        let tile_height_in: i32 = linecache_options.tile_height;
2581        let tile_height_in_name = utils::new_c_string("tile-height")?;
2582
2583        let access_in: i32 = linecache_options.access as i32;
2584        let access_in_name = utils::new_c_string("access")?;
2585
2586        let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2587        let threaded_in_name = utils::new_c_string("threaded")?;
2588
2589        let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2590        let persistent_in_name = utils::new_c_string("persistent")?;
2591
2592        let vips_op_response = bindings::vips_linecache(
2593            inp_in,
2594            &mut out_out,
2595            tile_height_in_name.as_ptr(),
2596            tile_height_in,
2597            access_in_name.as_ptr(),
2598            access_in,
2599            threaded_in_name.as_ptr(),
2600            threaded_in,
2601            persistent_in_name.as_ptr(),
2602            persistent_in,
2603            NULL,
2604        );
2605        utils::result(
2606            vips_op_response,
2607            VipsImage { ctx: out_out },
2608            Error::LinecacheError,
2609        )
2610    }
2611}
2612
2613/// VipsSequential (sequential), check sequential access
2614/// inp: `&VipsImage` -> Input image
2615/// returns `VipsImage` - Output image
2616pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2617    unsafe {
2618        let inp_in: *mut bindings::VipsImage = inp.ctx;
2619        let mut out_out: *mut bindings::VipsImage = null_mut();
2620
2621        let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2622        utils::result(
2623            vips_op_response,
2624            VipsImage { ctx: out_out },
2625            Error::SequentialError,
2626        )
2627    }
2628}
2629
2630/// Options for sequential operation
2631#[derive(Clone, Debug)]
2632pub struct SequentialOptions {
2633    /// tile_height: `i32` -> Tile height in pixels
2634    /// min: 1, max: 1000000, default: 1
2635    pub tile_height: i32,
2636}
2637
2638impl std::default::Default for SequentialOptions {
2639    fn default() -> Self {
2640        SequentialOptions {
2641            tile_height: i32::from(1),
2642        }
2643    }
2644}
2645
2646/// VipsSequential (sequential), check sequential access
2647/// inp: `&VipsImage` -> Input image
2648/// sequential_options: `&SequentialOptions` -> optional arguments
2649/// returns `VipsImage` - Output image
2650pub fn sequential_with_opts(
2651    inp: &VipsImage,
2652    sequential_options: &SequentialOptions,
2653) -> Result<VipsImage> {
2654    unsafe {
2655        let inp_in: *mut bindings::VipsImage = inp.ctx;
2656        let mut out_out: *mut bindings::VipsImage = null_mut();
2657
2658        let tile_height_in: i32 = sequential_options.tile_height;
2659        let tile_height_in_name = utils::new_c_string("tile-height")?;
2660
2661        let vips_op_response = bindings::vips_sequential(
2662            inp_in,
2663            &mut out_out,
2664            tile_height_in_name.as_ptr(),
2665            tile_height_in,
2666            NULL,
2667        );
2668        utils::result(
2669            vips_op_response,
2670            VipsImage { ctx: out_out },
2671            Error::SequentialError,
2672        )
2673    }
2674}
2675
2676/// VipsCache (cache), cache an image
2677/// inp: `&VipsImage` -> Input image
2678/// returns `VipsImage` - Output image
2679pub fn cache(inp: &VipsImage) -> Result<VipsImage> {
2680    unsafe {
2681        let inp_in: *mut bindings::VipsImage = inp.ctx;
2682        let mut out_out: *mut bindings::VipsImage = null_mut();
2683
2684        let vips_op_response = bindings::vips_cache(inp_in, &mut out_out, NULL);
2685        utils::result(
2686            vips_op_response,
2687            VipsImage { ctx: out_out },
2688            Error::CacheError,
2689        )
2690    }
2691}
2692
2693/// Options for cache operation
2694#[derive(Clone, Debug)]
2695pub struct CacheOptions {
2696    /// max_tiles: `i32` -> Maximum number of tiles to cache
2697    /// min: -1, max: 1000000, default: 1000
2698    pub max_tiles: i32,
2699    /// tile_height: `i32` -> Tile height in pixels
2700    /// min: 1, max: 1000000, default: 128
2701    pub tile_height: i32,
2702    /// tile_width: `i32` -> Tile width in pixels
2703    /// min: 1, max: 1000000, default: 128
2704    pub tile_width: i32,
2705}
2706
2707impl std::default::Default for CacheOptions {
2708    fn default() -> Self {
2709        CacheOptions {
2710            max_tiles: i32::from(1000),
2711            tile_height: i32::from(128),
2712            tile_width: i32::from(128),
2713        }
2714    }
2715}
2716
2717/// VipsCache (cache), cache an image
2718/// inp: `&VipsImage` -> Input image
2719/// cache_options: `&CacheOptions` -> optional arguments
2720/// returns `VipsImage` - Output image
2721pub fn cache_with_opts(inp: &VipsImage, cache_options: &CacheOptions) -> Result<VipsImage> {
2722    unsafe {
2723        let inp_in: *mut bindings::VipsImage = inp.ctx;
2724        let mut out_out: *mut bindings::VipsImage = null_mut();
2725
2726        let max_tiles_in: i32 = cache_options.max_tiles;
2727        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2728
2729        let tile_height_in: i32 = cache_options.tile_height;
2730        let tile_height_in_name = utils::new_c_string("tile-height")?;
2731
2732        let tile_width_in: i32 = cache_options.tile_width;
2733        let tile_width_in_name = utils::new_c_string("tile-width")?;
2734
2735        let vips_op_response = bindings::vips_cache(
2736            inp_in,
2737            &mut out_out,
2738            max_tiles_in_name.as_ptr(),
2739            max_tiles_in,
2740            tile_height_in_name.as_ptr(),
2741            tile_height_in,
2742            tile_width_in_name.as_ptr(),
2743            tile_width_in,
2744            NULL,
2745        );
2746        utils::result(
2747            vips_op_response,
2748            VipsImage { ctx: out_out },
2749            Error::CacheError,
2750        )
2751    }
2752}
2753
2754/// VipsEmbed (embed), embed an image in a larger image
2755/// inp: `&VipsImage` -> Input image
2756/// x: `i32` -> Left edge of input in output
2757/// min: -1000000000, max: 1000000000, default: 0
2758/// y: `i32` -> Top edge of input in output
2759/// min: -1000000000, max: 1000000000, default: 0
2760/// width: `i32` -> Image width in pixels
2761/// min: 1, max: 1000000000, default: 1
2762/// height: `i32` -> Image height in pixels
2763/// min: 1, max: 1000000000, default: 1
2764/// returns `VipsImage` - Output image
2765pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2766    unsafe {
2767        let inp_in: *mut bindings::VipsImage = inp.ctx;
2768        let x_in: i32 = x;
2769        let y_in: i32 = y;
2770        let width_in: i32 = width;
2771        let height_in: i32 = height;
2772        let mut out_out: *mut bindings::VipsImage = null_mut();
2773
2774        let vips_op_response =
2775            bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2776        utils::result(
2777            vips_op_response,
2778            VipsImage { ctx: out_out },
2779            Error::EmbedError,
2780        )
2781    }
2782}
2783
2784/// Options for embed operation
2785#[derive(Clone, Debug)]
2786pub struct EmbedOptions {
2787    /// extend: `Extend` -> How to generate the extra pixels
2788    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2789    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2790    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2791    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2792    ///  `White` -> VIPS_EXTEND_WHITE = 4
2793    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2794    ///  `Last` -> VIPS_EXTEND_LAST = 6
2795    pub extend: Extend,
2796    /// background: `Vec<f64>` -> Color for background pixels
2797    pub background: Vec<f64>,
2798}
2799
2800impl std::default::Default for EmbedOptions {
2801    fn default() -> Self {
2802        EmbedOptions {
2803            extend: Extend::Black,
2804            background: Vec::new(),
2805        }
2806    }
2807}
2808
2809/// VipsEmbed (embed), embed an image in a larger image
2810/// inp: `&VipsImage` -> Input image
2811/// x: `i32` -> Left edge of input in output
2812/// min: -1000000000, max: 1000000000, default: 0
2813/// y: `i32` -> Top edge of input in output
2814/// min: -1000000000, max: 1000000000, default: 0
2815/// width: `i32` -> Image width in pixels
2816/// min: 1, max: 1000000000, default: 1
2817/// height: `i32` -> Image height in pixels
2818/// min: 1, max: 1000000000, default: 1
2819/// embed_options: `&EmbedOptions` -> optional arguments
2820/// returns `VipsImage` - Output image
2821pub fn embed_with_opts(
2822    inp: &VipsImage,
2823    x: i32,
2824    y: i32,
2825    width: i32,
2826    height: i32,
2827    embed_options: &EmbedOptions,
2828) -> Result<VipsImage> {
2829    unsafe {
2830        let inp_in: *mut bindings::VipsImage = inp.ctx;
2831        let x_in: i32 = x;
2832        let y_in: i32 = y;
2833        let width_in: i32 = width;
2834        let height_in: i32 = height;
2835        let mut out_out: *mut bindings::VipsImage = null_mut();
2836
2837        let extend_in: i32 = embed_options.extend as i32;
2838        let extend_in_name = utils::new_c_string("extend")?;
2839
2840        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2841        let background_in = background_wrapper.ctx;
2842        let background_in_name = utils::new_c_string("background")?;
2843
2844        let vips_op_response = bindings::vips_embed(
2845            inp_in,
2846            &mut out_out,
2847            x_in,
2848            y_in,
2849            width_in,
2850            height_in,
2851            extend_in_name.as_ptr(),
2852            extend_in,
2853            background_in_name.as_ptr(),
2854            background_in,
2855            NULL,
2856        );
2857        utils::result(
2858            vips_op_response,
2859            VipsImage { ctx: out_out },
2860            Error::EmbedError,
2861        )
2862    }
2863}
2864
2865/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2866/// inp: `&VipsImage` -> Input image
2867/// direction: `CompassDirection` -> Direction to place image within width/height
2868///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2869///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2870///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2871///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2872///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2873///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2874///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2875///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2876///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2877///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2878/// width: `i32` -> Image width in pixels
2879/// min: 1, max: 1000000000, default: 1
2880/// height: `i32` -> Image height in pixels
2881/// min: 1, max: 1000000000, default: 1
2882/// returns `VipsImage` - Output image
2883pub fn gravity(
2884    inp: &VipsImage,
2885    direction: CompassDirection,
2886    width: i32,
2887    height: i32,
2888) -> Result<VipsImage> {
2889    unsafe {
2890        let inp_in: *mut bindings::VipsImage = inp.ctx;
2891        let direction_in: i32 = direction as i32;
2892        let width_in: i32 = width;
2893        let height_in: i32 = height;
2894        let mut out_out: *mut bindings::VipsImage = null_mut();
2895
2896        let vips_op_response = bindings::vips_gravity(
2897            inp_in,
2898            &mut out_out,
2899            direction_in.try_into().unwrap(),
2900            width_in,
2901            height_in,
2902            NULL,
2903        );
2904        utils::result(
2905            vips_op_response,
2906            VipsImage { ctx: out_out },
2907            Error::GravityError,
2908        )
2909    }
2910}
2911
2912/// Options for gravity operation
2913#[derive(Clone, Debug)]
2914pub struct GravityOptions {
2915    /// extend: `Extend` -> How to generate the extra pixels
2916    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2917    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2918    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2919    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2920    ///  `White` -> VIPS_EXTEND_WHITE = 4
2921    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2922    ///  `Last` -> VIPS_EXTEND_LAST = 6
2923    pub extend: Extend,
2924    /// background: `Vec<f64>` -> Color for background pixels
2925    pub background: Vec<f64>,
2926}
2927
2928impl std::default::Default for GravityOptions {
2929    fn default() -> Self {
2930        GravityOptions {
2931            extend: Extend::Black,
2932            background: Vec::new(),
2933        }
2934    }
2935}
2936
2937/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2938/// inp: `&VipsImage` -> Input image
2939/// direction: `CompassDirection` -> Direction to place image within width/height
2940///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2941///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2942///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2943///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2944///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2945///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2946///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2947///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2948///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2949///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2950/// width: `i32` -> Image width in pixels
2951/// min: 1, max: 1000000000, default: 1
2952/// height: `i32` -> Image height in pixels
2953/// min: 1, max: 1000000000, default: 1
2954/// gravity_options: `&GravityOptions` -> optional arguments
2955/// returns `VipsImage` - Output image
2956pub fn gravity_with_opts(
2957    inp: &VipsImage,
2958    direction: CompassDirection,
2959    width: i32,
2960    height: i32,
2961    gravity_options: &GravityOptions,
2962) -> Result<VipsImage> {
2963    unsafe {
2964        let inp_in: *mut bindings::VipsImage = inp.ctx;
2965        let direction_in: i32 = direction as i32;
2966        let width_in: i32 = width;
2967        let height_in: i32 = height;
2968        let mut out_out: *mut bindings::VipsImage = null_mut();
2969
2970        let extend_in: i32 = gravity_options.extend as i32;
2971        let extend_in_name = utils::new_c_string("extend")?;
2972
2973        let background_wrapper =
2974            utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
2975        let background_in = background_wrapper.ctx;
2976        let background_in_name = utils::new_c_string("background")?;
2977
2978        let vips_op_response = bindings::vips_gravity(
2979            inp_in,
2980            &mut out_out,
2981            direction_in.try_into().unwrap(),
2982            width_in,
2983            height_in,
2984            extend_in_name.as_ptr(),
2985            extend_in,
2986            background_in_name.as_ptr(),
2987            background_in,
2988            NULL,
2989        );
2990        utils::result(
2991            vips_op_response,
2992            VipsImage { ctx: out_out },
2993            Error::GravityError,
2994        )
2995    }
2996}
2997
2998/// VipsFlip (flip), flip an image
2999/// inp: `&VipsImage` -> Input image
3000/// direction: `Direction` -> Direction to flip image
3001///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3002///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3003///  `Last` -> VIPS_DIRECTION_LAST = 2
3004/// returns `VipsImage` - Output image
3005pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3006    unsafe {
3007        let inp_in: *mut bindings::VipsImage = inp.ctx;
3008        let direction_in: i32 = direction as i32;
3009        let mut out_out: *mut bindings::VipsImage = null_mut();
3010
3011        let vips_op_response =
3012            bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3013        utils::result(
3014            vips_op_response,
3015            VipsImage { ctx: out_out },
3016            Error::FlipError,
3017        )
3018    }
3019}
3020
3021/// VipsInsert (insert), insert image @sub into @main at @x, @y
3022/// main: `&VipsImage` -> Main input image
3023/// sub: `&VipsImage` -> Sub-image to insert into main image
3024/// x: `i32` -> Left edge of sub in main
3025/// min: -10000000, max: 10000000, default: 0
3026/// y: `i32` -> Top edge of sub in main
3027/// min: -10000000, max: 10000000, default: 0
3028/// returns `VipsImage` - Output image
3029pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3030    unsafe {
3031        let main_in: *mut bindings::VipsImage = main.ctx;
3032        let sub_in: *mut bindings::VipsImage = sub.ctx;
3033        let x_in: i32 = x;
3034        let y_in: i32 = y;
3035        let mut out_out: *mut bindings::VipsImage = null_mut();
3036
3037        let vips_op_response =
3038            bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3039        utils::result(
3040            vips_op_response,
3041            VipsImage { ctx: out_out },
3042            Error::InsertError,
3043        )
3044    }
3045}
3046
3047/// Options for insert operation
3048#[derive(Clone, Debug)]
3049pub struct InsertOptions {
3050    /// expand: `bool` -> Expand output to hold all of both inputs
3051    /// default: false
3052    pub expand: bool,
3053    /// background: `Vec<f64>` -> Color for new pixels
3054    pub background: Vec<f64>,
3055}
3056
3057impl std::default::Default for InsertOptions {
3058    fn default() -> Self {
3059        InsertOptions {
3060            expand: false,
3061            background: Vec::new(),
3062        }
3063    }
3064}
3065
3066/// VipsInsert (insert), insert image @sub into @main at @x, @y
3067/// main: `&VipsImage` -> Main input image
3068/// sub: `&VipsImage` -> Sub-image to insert into main image
3069/// x: `i32` -> Left edge of sub in main
3070/// min: -10000000, max: 10000000, default: 0
3071/// y: `i32` -> Top edge of sub in main
3072/// min: -10000000, max: 10000000, default: 0
3073/// insert_options: `&InsertOptions` -> optional arguments
3074/// returns `VipsImage` - Output image
3075pub fn insert_with_opts(
3076    main: &VipsImage,
3077    sub: &VipsImage,
3078    x: i32,
3079    y: i32,
3080    insert_options: &InsertOptions,
3081) -> Result<VipsImage> {
3082    unsafe {
3083        let main_in: *mut bindings::VipsImage = main.ctx;
3084        let sub_in: *mut bindings::VipsImage = sub.ctx;
3085        let x_in: i32 = x;
3086        let y_in: i32 = y;
3087        let mut out_out: *mut bindings::VipsImage = null_mut();
3088
3089        let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3090        let expand_in_name = utils::new_c_string("expand")?;
3091
3092        let background_wrapper =
3093            utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3094        let background_in = background_wrapper.ctx;
3095        let background_in_name = utils::new_c_string("background")?;
3096
3097        let vips_op_response = bindings::vips_insert(
3098            main_in,
3099            sub_in,
3100            &mut out_out,
3101            x_in,
3102            y_in,
3103            expand_in_name.as_ptr(),
3104            expand_in,
3105            background_in_name.as_ptr(),
3106            background_in,
3107            NULL,
3108        );
3109        utils::result(
3110            vips_op_response,
3111            VipsImage { ctx: out_out },
3112            Error::InsertError,
3113        )
3114    }
3115}
3116
3117/// VipsJoin (join), join a pair of images
3118/// in_1: `&VipsImage` -> First input image
3119/// in_2: `&VipsImage` -> Second input image
3120/// direction: `Direction` -> Join left-right or up-down
3121///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3122///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3123///  `Last` -> VIPS_DIRECTION_LAST = 2
3124/// returns `VipsImage` - Output image
3125pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3126    unsafe {
3127        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3128        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3129        let direction_in: i32 = direction as i32;
3130        let mut out_out: *mut bindings::VipsImage = null_mut();
3131
3132        let vips_op_response = bindings::vips_join(
3133            in_1_in,
3134            in_2_in,
3135            &mut out_out,
3136            direction_in.try_into().unwrap(),
3137            NULL,
3138        );
3139        utils::result(
3140            vips_op_response,
3141            VipsImage { ctx: out_out },
3142            Error::JoinError,
3143        )
3144    }
3145}
3146
3147/// Options for join operation
3148#[derive(Clone, Debug)]
3149pub struct JoinOptions {
3150    /// expand: `bool` -> Expand output to hold all of both inputs
3151    /// default: false
3152    pub expand: bool,
3153    /// shim: `i32` -> Pixels between images
3154    /// min: 0, max: 1000000, default: 0
3155    pub shim: i32,
3156    /// background: `Vec<f64>` -> Colour for new pixels
3157    pub background: Vec<f64>,
3158    /// align: `Align` -> Align on the low, centre or high coordinate edge
3159    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3160    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3161    ///  `High` -> VIPS_ALIGN_HIGH = 2
3162    ///  `Last` -> VIPS_ALIGN_LAST = 3
3163    pub align: Align,
3164}
3165
3166impl std::default::Default for JoinOptions {
3167    fn default() -> Self {
3168        JoinOptions {
3169            expand: false,
3170            shim: i32::from(0),
3171            background: Vec::new(),
3172            align: Align::Low,
3173        }
3174    }
3175}
3176
3177/// VipsJoin (join), join a pair of images
3178/// in_1: `&VipsImage` -> First input image
3179/// in_2: `&VipsImage` -> Second input image
3180/// direction: `Direction` -> Join left-right or up-down
3181///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3182///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3183///  `Last` -> VIPS_DIRECTION_LAST = 2
3184/// join_options: `&JoinOptions` -> optional arguments
3185/// returns `VipsImage` - Output image
3186pub fn join_with_opts(
3187    in_1: &VipsImage,
3188    in_2: &VipsImage,
3189    direction: Direction,
3190    join_options: &JoinOptions,
3191) -> Result<VipsImage> {
3192    unsafe {
3193        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3194        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3195        let direction_in: i32 = direction as i32;
3196        let mut out_out: *mut bindings::VipsImage = null_mut();
3197
3198        let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3199        let expand_in_name = utils::new_c_string("expand")?;
3200
3201        let shim_in: i32 = join_options.shim;
3202        let shim_in_name = utils::new_c_string("shim")?;
3203
3204        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3205        let background_in = background_wrapper.ctx;
3206        let background_in_name = utils::new_c_string("background")?;
3207
3208        let align_in: i32 = join_options.align as i32;
3209        let align_in_name = utils::new_c_string("align")?;
3210
3211        let vips_op_response = bindings::vips_join(
3212            in_1_in,
3213            in_2_in,
3214            &mut out_out,
3215            direction_in.try_into().unwrap(),
3216            expand_in_name.as_ptr(),
3217            expand_in,
3218            shim_in_name.as_ptr(),
3219            shim_in,
3220            background_in_name.as_ptr(),
3221            background_in,
3222            align_in_name.as_ptr(),
3223            align_in,
3224            NULL,
3225        );
3226        utils::result(
3227            vips_op_response,
3228            VipsImage { ctx: out_out },
3229            Error::JoinError,
3230        )
3231    }
3232}
3233
3234/// VipsArrayjoin (arrayjoin), join an array of images
3235/// inp: `&mut [VipsImage]` -> Array of input images
3236/// returns `VipsImage` - Output image
3237pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3238    unsafe {
3239        let (inp_len, mut inp_in) = {
3240            let len = inp.len();
3241            let mut input = Vec::new();
3242            for img in inp {
3243                input.push(img.ctx)
3244            }
3245            (len as i32, input)
3246        };
3247        let mut out_out: *mut bindings::VipsImage = null_mut();
3248
3249        let vips_op_response =
3250            bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3251        utils::result(
3252            vips_op_response,
3253            VipsImage { ctx: out_out },
3254            Error::ArrayjoinError,
3255        )
3256    }
3257}
3258
3259/// Options for arrayjoin operation
3260#[derive(Clone, Debug)]
3261pub struct ArrayjoinOptions {
3262    /// across: `i32` -> Number of images across grid
3263    /// min: 1, max: 1000000, default: 1
3264    pub across: i32,
3265    /// shim: `i32` -> Pixels between images
3266    /// min: 0, max: 1000000, default: 0
3267    pub shim: i32,
3268    /// background: `Vec<f64>` -> Colour for new pixels
3269    pub background: Vec<f64>,
3270    /// halign: `Align` -> Align on the left, centre or right
3271    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3272    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3273    ///  `High` -> VIPS_ALIGN_HIGH = 2
3274    ///  `Last` -> VIPS_ALIGN_LAST = 3
3275    pub halign: Align,
3276    /// valign: `Align` -> Align on the top, centre or bottom
3277    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3278    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3279    ///  `High` -> VIPS_ALIGN_HIGH = 2
3280    ///  `Last` -> VIPS_ALIGN_LAST = 3
3281    pub valign: Align,
3282    /// hspacing: `i32` -> Horizontal spacing between images
3283    /// min: 1, max: 1000000, default: 1
3284    pub hspacing: i32,
3285    /// vspacing: `i32` -> Vertical spacing between images
3286    /// min: 1, max: 1000000, default: 1
3287    pub vspacing: i32,
3288}
3289
3290impl std::default::Default for ArrayjoinOptions {
3291    fn default() -> Self {
3292        ArrayjoinOptions {
3293            across: i32::from(1),
3294            shim: i32::from(0),
3295            background: Vec::new(),
3296            halign: Align::Low,
3297            valign: Align::Low,
3298            hspacing: i32::from(1),
3299            vspacing: i32::from(1),
3300        }
3301    }
3302}
3303
3304/// VipsArrayjoin (arrayjoin), join an array of images
3305/// inp: `&mut [VipsImage]` -> Array of input images
3306/// arrayjoin_options: `&ArrayjoinOptions` -> optional arguments
3307/// returns `VipsImage` - Output image
3308pub fn arrayjoin_with_opts(
3309    inp: &mut [VipsImage],
3310    arrayjoin_options: &ArrayjoinOptions,
3311) -> Result<VipsImage> {
3312    unsafe {
3313        let (inp_len, mut inp_in) = {
3314            let len = inp.len();
3315            let mut input = Vec::new();
3316            for img in inp {
3317                input.push(img.ctx)
3318            }
3319            (len as i32, input)
3320        };
3321        let mut out_out: *mut bindings::VipsImage = null_mut();
3322
3323        let across_in: i32 = arrayjoin_options.across;
3324        let across_in_name = utils::new_c_string("across")?;
3325
3326        let shim_in: i32 = arrayjoin_options.shim;
3327        let shim_in_name = utils::new_c_string("shim")?;
3328
3329        let background_wrapper =
3330            utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3331        let background_in = background_wrapper.ctx;
3332        let background_in_name = utils::new_c_string("background")?;
3333
3334        let halign_in: i32 = arrayjoin_options.halign as i32;
3335        let halign_in_name = utils::new_c_string("halign")?;
3336
3337        let valign_in: i32 = arrayjoin_options.valign as i32;
3338        let valign_in_name = utils::new_c_string("valign")?;
3339
3340        let hspacing_in: i32 = arrayjoin_options.hspacing;
3341        let hspacing_in_name = utils::new_c_string("hspacing")?;
3342
3343        let vspacing_in: i32 = arrayjoin_options.vspacing;
3344        let vspacing_in_name = utils::new_c_string("vspacing")?;
3345
3346        let vips_op_response = bindings::vips_arrayjoin(
3347            inp_in.as_mut_ptr(),
3348            &mut out_out,
3349            inp_len,
3350            across_in_name.as_ptr(),
3351            across_in,
3352            shim_in_name.as_ptr(),
3353            shim_in,
3354            background_in_name.as_ptr(),
3355            background_in,
3356            halign_in_name.as_ptr(),
3357            halign_in,
3358            valign_in_name.as_ptr(),
3359            valign_in,
3360            hspacing_in_name.as_ptr(),
3361            hspacing_in,
3362            vspacing_in_name.as_ptr(),
3363            vspacing_in,
3364            NULL,
3365        );
3366        utils::result(
3367            vips_op_response,
3368            VipsImage { ctx: out_out },
3369            Error::ArrayjoinError,
3370        )
3371    }
3372}
3373
3374/// VipsExtractArea (extract_area), extract an area from an image
3375/// input: `&VipsImage` -> Input image
3376/// left: `i32` -> Left edge of extract area
3377/// min: -10000000, max: 10000000, default: 0
3378/// top: `i32` -> Top edge of extract area
3379/// min: -10000000, max: 10000000, default: 0
3380/// width: `i32` -> Width of extract area
3381/// min: 1, max: 10000000, default: 1
3382/// height: `i32` -> Height of extract area
3383/// min: 1, max: 10000000, default: 1
3384/// returns `VipsImage` - Output image
3385pub fn extract_area(
3386    input: &VipsImage,
3387    left: i32,
3388    top: i32,
3389    width: i32,
3390    height: i32,
3391) -> Result<VipsImage> {
3392    unsafe {
3393        let input_in: *mut bindings::VipsImage = input.ctx;
3394        let left_in: i32 = left;
3395        let top_in: i32 = top;
3396        let width_in: i32 = width;
3397        let height_in: i32 = height;
3398        let mut out_out: *mut bindings::VipsImage = null_mut();
3399
3400        let vips_op_response = bindings::vips_extract_area(
3401            input_in,
3402            &mut out_out,
3403            left_in,
3404            top_in,
3405            width_in,
3406            height_in,
3407            NULL,
3408        );
3409        utils::result(
3410            vips_op_response,
3411            VipsImage { ctx: out_out },
3412            Error::ExtractAreaError,
3413        )
3414    }
3415}
3416
3417/// VipsSmartcrop (smartcrop), extract an area from an image
3418/// input: `&VipsImage` -> Input image
3419/// width: `i32` -> Width of extract area
3420/// min: 1, max: 10000000, default: 1
3421/// height: `i32` -> Height of extract area
3422/// min: 1, max: 10000000, default: 1
3423/// returns `VipsImage` - Output image
3424pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3425    unsafe {
3426        let input_in: *mut bindings::VipsImage = input.ctx;
3427        let width_in: i32 = width;
3428        let height_in: i32 = height;
3429        let mut out_out: *mut bindings::VipsImage = null_mut();
3430
3431        let vips_op_response =
3432            bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3433        utils::result(
3434            vips_op_response,
3435            VipsImage { ctx: out_out },
3436            Error::SmartcropError,
3437        )
3438    }
3439}
3440
3441/// Options for smartcrop operation
3442#[derive(Clone, Debug)]
3443pub struct SmartcropOptions {
3444    /// attention_x: `i32` -> Horizontal position of attention centre
3445    /// min: 0, max: 10000000, default: 0
3446    pub attention_x: i32,
3447    /// attention_y: `i32` -> Vertical position of attention centre
3448    /// min: 0, max: 10000000, default: 0
3449    pub attention_y: i32,
3450    /// interesting: `Interesting` -> How to measure interestingness
3451    ///  `None` -> VIPS_INTERESTING_NONE = 0
3452    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
3453    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
3454    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3 [DEFAULT]
3455    ///  `Low` -> VIPS_INTERESTING_LOW = 4
3456    ///  `High` -> VIPS_INTERESTING_HIGH = 5
3457    ///  `All` -> VIPS_INTERESTING_ALL = 6
3458    ///  `Last` -> VIPS_INTERESTING_LAST = 7
3459    pub interesting: Interesting,
3460    /// premultiplied: `bool` -> Input image already has premultiplied alpha
3461    /// default: false
3462    pub premultiplied: bool,
3463}
3464
3465impl std::default::Default for SmartcropOptions {
3466    fn default() -> Self {
3467        SmartcropOptions {
3468            attention_x: i32::from(0),
3469            attention_y: i32::from(0),
3470            interesting: Interesting::Attention,
3471            premultiplied: false,
3472        }
3473    }
3474}
3475
3476/// VipsSmartcrop (smartcrop), extract an area from an image
3477/// input: `&VipsImage` -> Input image
3478/// width: `i32` -> Width of extract area
3479/// min: 1, max: 10000000, default: 1
3480/// height: `i32` -> Height of extract area
3481/// min: 1, max: 10000000, default: 1
3482/// smartcrop_options: `&SmartcropOptions` -> optional arguments
3483/// returns `VipsImage` - Output image
3484pub fn smartcrop_with_opts(
3485    input: &VipsImage,
3486    width: i32,
3487    height: i32,
3488    smartcrop_options: &SmartcropOptions,
3489) -> Result<VipsImage> {
3490    unsafe {
3491        let input_in: *mut bindings::VipsImage = input.ctx;
3492        let width_in: i32 = width;
3493        let height_in: i32 = height;
3494        let mut out_out: *mut bindings::VipsImage = null_mut();
3495
3496        let attention_x_in: i32 = smartcrop_options.attention_x;
3497        let attention_x_in_name = utils::new_c_string("attention-x")?;
3498
3499        let attention_y_in: i32 = smartcrop_options.attention_y;
3500        let attention_y_in_name = utils::new_c_string("attention-y")?;
3501
3502        let interesting_in: i32 = smartcrop_options.interesting as i32;
3503        let interesting_in_name = utils::new_c_string("interesting")?;
3504
3505        let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3506            1
3507        } else {
3508            0
3509        };
3510        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3511
3512        let vips_op_response = bindings::vips_smartcrop(
3513            input_in,
3514            &mut out_out,
3515            width_in,
3516            height_in,
3517            attention_x_in_name.as_ptr(),
3518            attention_x_in,
3519            attention_y_in_name.as_ptr(),
3520            attention_y_in,
3521            interesting_in_name.as_ptr(),
3522            interesting_in,
3523            premultiplied_in_name.as_ptr(),
3524            premultiplied_in,
3525            NULL,
3526        );
3527        utils::result(
3528            vips_op_response,
3529            VipsImage { ctx: out_out },
3530            Error::SmartcropError,
3531        )
3532    }
3533}
3534
3535/// VipsExtractBand (extract_band), extract band from an image
3536/// inp: `&VipsImage` -> Input image
3537/// band: `i32` -> Band to extract
3538/// min: 0, max: 10000000, default: 0
3539/// returns `VipsImage` - Output image
3540pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3541    unsafe {
3542        let inp_in: *mut bindings::VipsImage = inp.ctx;
3543        let band_in: i32 = band;
3544        let mut out_out: *mut bindings::VipsImage = null_mut();
3545
3546        let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3547        utils::result(
3548            vips_op_response,
3549            VipsImage { ctx: out_out },
3550            Error::ExtractBandError,
3551        )
3552    }
3553}
3554
3555/// Options for extract_band operation
3556#[derive(Clone, Debug)]
3557pub struct ExtractBandOptions {
3558    /// n: `i32` -> Number of bands to extract
3559    /// min: 1, max: 10000000, default: 1
3560    pub n: i32,
3561}
3562
3563impl std::default::Default for ExtractBandOptions {
3564    fn default() -> Self {
3565        ExtractBandOptions { n: i32::from(1) }
3566    }
3567}
3568
3569/// VipsExtractBand (extract_band), extract band from an image
3570/// inp: `&VipsImage` -> Input image
3571/// band: `i32` -> Band to extract
3572/// min: 0, max: 10000000, default: 0
3573/// extract_band_options: `&ExtractBandOptions` -> optional arguments
3574/// returns `VipsImage` - Output image
3575pub fn extract_band_with_opts(
3576    inp: &VipsImage,
3577    band: i32,
3578    extract_band_options: &ExtractBandOptions,
3579) -> Result<VipsImage> {
3580    unsafe {
3581        let inp_in: *mut bindings::VipsImage = inp.ctx;
3582        let band_in: i32 = band;
3583        let mut out_out: *mut bindings::VipsImage = null_mut();
3584
3585        let n_in: i32 = extract_band_options.n;
3586        let n_in_name = utils::new_c_string("n")?;
3587
3588        let vips_op_response = bindings::vips_extract_band(
3589            inp_in,
3590            &mut out_out,
3591            band_in,
3592            n_in_name.as_ptr(),
3593            n_in,
3594            NULL,
3595        );
3596        utils::result(
3597            vips_op_response,
3598            VipsImage { ctx: out_out },
3599            Error::ExtractBandError,
3600        )
3601    }
3602}
3603
3604/// VipsBandjoin (bandjoin), bandwise join a set of images
3605/// inp: `&mut [VipsImage]` -> Array of input images
3606/// returns `VipsImage` - Output image
3607pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3608    unsafe {
3609        let (inp_len, mut inp_in) = {
3610            let len = inp.len();
3611            let mut input = Vec::new();
3612            for img in inp {
3613                input.push(img.ctx)
3614            }
3615            (len as i32, input)
3616        };
3617        let mut out_out: *mut bindings::VipsImage = null_mut();
3618
3619        let vips_op_response =
3620            bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3621        utils::result(
3622            vips_op_response,
3623            VipsImage { ctx: out_out },
3624            Error::BandjoinError,
3625        )
3626    }
3627}
3628
3629/// VipsBandjoinConst (bandjoin_const), append a constant band to an image
3630/// inp: `&VipsImage` -> Input image
3631/// c: `&mut [f64]` -> Array of constants to add
3632/// returns `VipsImage` - Output image
3633pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3634    unsafe {
3635        let inp_in: *mut bindings::VipsImage = inp.ctx;
3636        let c_in: *mut f64 = c.as_mut_ptr();
3637        let mut out_out: *mut bindings::VipsImage = null_mut();
3638
3639        let vips_op_response =
3640            bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3641        utils::result(
3642            vips_op_response,
3643            VipsImage { ctx: out_out },
3644            Error::BandjoinConstError,
3645        )
3646    }
3647}
3648
3649/// VipsBandrank (bandrank), band-wise rank of a set of images
3650/// inp: `&mut [VipsImage]` -> Array of input images
3651/// returns `VipsImage` - Output image
3652pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3653    unsafe {
3654        let (inp_len, mut inp_in) = {
3655            let len = inp.len();
3656            let mut input = Vec::new();
3657            for img in inp {
3658                input.push(img.ctx)
3659            }
3660            (len as i32, input)
3661        };
3662        let mut out_out: *mut bindings::VipsImage = null_mut();
3663
3664        let vips_op_response =
3665            bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3666        utils::result(
3667            vips_op_response,
3668            VipsImage { ctx: out_out },
3669            Error::BandrankError,
3670        )
3671    }
3672}
3673
3674/// Options for bandrank operation
3675#[derive(Clone, Debug)]
3676pub struct BandrankOptions {
3677    /// index: `i32` -> Select this band element from sorted list
3678    /// min: -1, max: 1000000, default: -1
3679    pub index: i32,
3680}
3681
3682impl std::default::Default for BandrankOptions {
3683    fn default() -> Self {
3684        BandrankOptions {
3685            index: i32::from(-1),
3686        }
3687    }
3688}
3689
3690/// VipsBandrank (bandrank), band-wise rank of a set of images
3691/// inp: `&mut [VipsImage]` -> Array of input images
3692/// bandrank_options: `&BandrankOptions` -> optional arguments
3693/// returns `VipsImage` - Output image
3694pub fn bandrank_with_opts(
3695    inp: &mut [VipsImage],
3696    bandrank_options: &BandrankOptions,
3697) -> Result<VipsImage> {
3698    unsafe {
3699        let (inp_len, mut inp_in) = {
3700            let len = inp.len();
3701            let mut input = Vec::new();
3702            for img in inp {
3703                input.push(img.ctx)
3704            }
3705            (len as i32, input)
3706        };
3707        let mut out_out: *mut bindings::VipsImage = null_mut();
3708
3709        let index_in: i32 = bandrank_options.index;
3710        let index_in_name = utils::new_c_string("index")?;
3711
3712        let vips_op_response = bindings::vips_bandrank(
3713            inp_in.as_mut_ptr(),
3714            &mut out_out,
3715            inp_len,
3716            index_in_name.as_ptr(),
3717            index_in,
3718            NULL,
3719        );
3720        utils::result(
3721            vips_op_response,
3722            VipsImage { ctx: out_out },
3723            Error::BandrankError,
3724        )
3725    }
3726}
3727
3728/// VipsBandmean (bandmean), band-wise average
3729/// inp: `&VipsImage` -> Input image argument
3730/// returns `VipsImage` - Output image
3731pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3732    unsafe {
3733        let inp_in: *mut bindings::VipsImage = inp.ctx;
3734        let mut out_out: *mut bindings::VipsImage = null_mut();
3735
3736        let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3737        utils::result(
3738            vips_op_response,
3739            VipsImage { ctx: out_out },
3740            Error::BandmeanError,
3741        )
3742    }
3743}
3744
3745/// VipsBandbool (bandbool), boolean operation across image bands
3746/// inp: `&VipsImage` -> Input image argument
3747/// boolean: `OperationBoolean` -> Boolean to perform
3748///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
3749///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
3750///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
3751///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
3752///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
3753///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
3754/// returns `VipsImage` - Output image
3755pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3756    unsafe {
3757        let inp_in: *mut bindings::VipsImage = inp.ctx;
3758        let boolean_in: i32 = boolean as i32;
3759        let mut out_out: *mut bindings::VipsImage = null_mut();
3760
3761        let vips_op_response =
3762            bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3763        utils::result(
3764            vips_op_response,
3765            VipsImage { ctx: out_out },
3766            Error::BandboolError,
3767        )
3768    }
3769}
3770
3771/// VipsReplicate (replicate), replicate an image
3772/// inp: `&VipsImage` -> Input image
3773/// across: `i32` -> Repeat this many times horizontally
3774/// min: 1, max: 1000000, default: 1
3775/// down: `i32` -> Repeat this many times vertically
3776/// min: 1, max: 1000000, default: 1
3777/// returns `VipsImage` - Output image
3778pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3779    unsafe {
3780        let inp_in: *mut bindings::VipsImage = inp.ctx;
3781        let across_in: i32 = across;
3782        let down_in: i32 = down;
3783        let mut out_out: *mut bindings::VipsImage = null_mut();
3784
3785        let vips_op_response =
3786            bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3787        utils::result(
3788            vips_op_response,
3789            VipsImage { ctx: out_out },
3790            Error::ReplicateError,
3791        )
3792    }
3793}
3794
3795/// VipsCast (cast), cast an image
3796/// inp: `&VipsImage` -> Input image
3797/// format: `BandFormat` -> Format to cast to
3798///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3799///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3800///  `Char` -> VIPS_FORMAT_CHAR = 1
3801///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3802///  `Short` -> VIPS_FORMAT_SHORT = 3
3803///  `Uint` -> VIPS_FORMAT_UINT = 4
3804///  `Int` -> VIPS_FORMAT_INT = 5
3805///  `Float` -> VIPS_FORMAT_FLOAT = 6
3806///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3807///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3808///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3809///  `Last` -> VIPS_FORMAT_LAST = 10
3810/// returns `VipsImage` - Output image
3811pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3812    unsafe {
3813        let inp_in: *mut bindings::VipsImage = inp.ctx;
3814        let format_in: i32 = format as i32;
3815        let mut out_out: *mut bindings::VipsImage = null_mut();
3816
3817        let vips_op_response =
3818            bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3819        utils::result(
3820            vips_op_response,
3821            VipsImage { ctx: out_out },
3822            Error::CastError,
3823        )
3824    }
3825}
3826
3827/// Options for cast operation
3828#[derive(Clone, Debug)]
3829pub struct CastOptions {
3830    /// shift: `bool` -> Shift integer values up and down
3831    /// default: false
3832    pub shift: bool,
3833}
3834
3835impl std::default::Default for CastOptions {
3836    fn default() -> Self {
3837        CastOptions { shift: false }
3838    }
3839}
3840
3841/// VipsCast (cast), cast an image
3842/// inp: `&VipsImage` -> Input image
3843/// format: `BandFormat` -> Format to cast to
3844///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3845///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3846///  `Char` -> VIPS_FORMAT_CHAR = 1
3847///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3848///  `Short` -> VIPS_FORMAT_SHORT = 3
3849///  `Uint` -> VIPS_FORMAT_UINT = 4
3850///  `Int` -> VIPS_FORMAT_INT = 5
3851///  `Float` -> VIPS_FORMAT_FLOAT = 6
3852///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3853///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3854///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3855///  `Last` -> VIPS_FORMAT_LAST = 10
3856/// cast_options: `&CastOptions` -> optional arguments
3857/// returns `VipsImage` - Output image
3858pub fn cast_with_opts(
3859    inp: &VipsImage,
3860    format: BandFormat,
3861    cast_options: &CastOptions,
3862) -> Result<VipsImage> {
3863    unsafe {
3864        let inp_in: *mut bindings::VipsImage = inp.ctx;
3865        let format_in: i32 = format as i32;
3866        let mut out_out: *mut bindings::VipsImage = null_mut();
3867
3868        let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3869        let shift_in_name = utils::new_c_string("shift")?;
3870
3871        let vips_op_response = bindings::vips_cast(
3872            inp_in,
3873            &mut out_out,
3874            format_in.try_into().unwrap(),
3875            shift_in_name.as_ptr(),
3876            shift_in,
3877            NULL,
3878        );
3879        utils::result(
3880            vips_op_response,
3881            VipsImage { ctx: out_out },
3882            Error::CastError,
3883        )
3884    }
3885}
3886
3887/// VipsRot (rot), rotate an image
3888/// inp: `&VipsImage` -> Input image
3889/// angle: `Angle` -> Angle to rotate image
3890///  `D0` -> VIPS_ANGLE_D0 = 0
3891///  `D90` -> VIPS_ANGLE_D90 = 1 [DEFAULT]
3892///  `D180` -> VIPS_ANGLE_D180 = 2
3893///  `D270` -> VIPS_ANGLE_D270 = 3
3894///  `Last` -> VIPS_ANGLE_LAST = 4
3895/// returns `VipsImage` - Output image
3896pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3897    unsafe {
3898        let inp_in: *mut bindings::VipsImage = inp.ctx;
3899        let angle_in: i32 = angle as i32;
3900        let mut out_out: *mut bindings::VipsImage = null_mut();
3901
3902        let vips_op_response =
3903            bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3904        utils::result(
3905            vips_op_response,
3906            VipsImage { ctx: out_out },
3907            Error::RotError,
3908        )
3909    }
3910}
3911
3912/// VipsRot45 (rot45), rotate an image
3913/// inp: `&VipsImage` -> Input image
3914/// returns `VipsImage` - Output image
3915pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3916    unsafe {
3917        let inp_in: *mut bindings::VipsImage = inp.ctx;
3918        let mut out_out: *mut bindings::VipsImage = null_mut();
3919
3920        let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3921        utils::result(
3922            vips_op_response,
3923            VipsImage { ctx: out_out },
3924            Error::Rot45Error,
3925        )
3926    }
3927}
3928
3929/// Options for rot_45 operation
3930#[derive(Clone, Debug)]
3931pub struct Rot45Options {
3932    /// angle: `Angle45` -> Angle to rotate image
3933    ///  `D0` -> VIPS_ANGLE45_D0 = 0
3934    ///  `D45` -> VIPS_ANGLE45_D45 = 1 [DEFAULT]
3935    ///  `D90` -> VIPS_ANGLE45_D90 = 2
3936    ///  `D135` -> VIPS_ANGLE45_D135 = 3
3937    ///  `D180` -> VIPS_ANGLE45_D180 = 4
3938    ///  `D225` -> VIPS_ANGLE45_D225 = 5
3939    ///  `D270` -> VIPS_ANGLE45_D270 = 6
3940    ///  `D315` -> VIPS_ANGLE45_D315 = 7
3941    ///  `Last` -> VIPS_ANGLE45_LAST = 8
3942    pub angle: Angle45,
3943}
3944
3945impl std::default::Default for Rot45Options {
3946    fn default() -> Self {
3947        Rot45Options {
3948            angle: Angle45::D45,
3949        }
3950    }
3951}
3952
3953/// VipsRot45 (rot45), rotate an image
3954/// inp: `&VipsImage` -> Input image
3955/// rot_45_options: `&Rot45Options` -> optional arguments
3956/// returns `VipsImage` - Output image
3957pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
3958    unsafe {
3959        let inp_in: *mut bindings::VipsImage = inp.ctx;
3960        let mut out_out: *mut bindings::VipsImage = null_mut();
3961
3962        let angle_in: i32 = rot_45_options.angle as i32;
3963        let angle_in_name = utils::new_c_string("angle")?;
3964
3965        let vips_op_response =
3966            bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
3967        utils::result(
3968            vips_op_response,
3969            VipsImage { ctx: out_out },
3970            Error::Rot45Error,
3971        )
3972    }
3973}
3974
3975/// VipsAutorot (autorot), autorotate image by exif tag
3976/// inp: `&VipsImage` -> Input image
3977/// returns `VipsImage` - Output image
3978pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
3979    unsafe {
3980        let inp_in: *mut bindings::VipsImage = inp.ctx;
3981        let mut out_out: *mut bindings::VipsImage = null_mut();
3982
3983        let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
3984        utils::result(
3985            vips_op_response,
3986            VipsImage { ctx: out_out },
3987            Error::AutorotError,
3988        )
3989    }
3990}
3991
3992/// Options for autorot operation
3993#[derive(Clone, Debug)]
3994pub struct AutorotOptions {
3995    /// angle: `Angle` -> Angle image was rotated by
3996    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
3997    ///  `D90` -> VIPS_ANGLE_D90 = 1
3998    ///  `D180` -> VIPS_ANGLE_D180 = 2
3999    ///  `D270` -> VIPS_ANGLE_D270 = 3
4000    ///  `Last` -> VIPS_ANGLE_LAST = 4
4001    pub angle: Angle,
4002    /// flip: `bool` -> Whether the image was flipped or not
4003    /// default: false
4004    pub flip: bool,
4005}
4006
4007impl std::default::Default for AutorotOptions {
4008    fn default() -> Self {
4009        AutorotOptions {
4010            angle: Angle::D0,
4011            flip: false,
4012        }
4013    }
4014}
4015
4016/// VipsAutorot (autorot), autorotate image by exif tag
4017/// inp: `&VipsImage` -> Input image
4018/// autorot_options: `&AutorotOptions` -> optional arguments
4019/// returns `VipsImage` - Output image
4020pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4021    unsafe {
4022        let inp_in: *mut bindings::VipsImage = inp.ctx;
4023        let mut out_out: *mut bindings::VipsImage = null_mut();
4024
4025        let angle_in: i32 = autorot_options.angle as i32;
4026        let angle_in_name = utils::new_c_string("angle")?;
4027
4028        let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4029        let flip_in_name = utils::new_c_string("flip")?;
4030
4031        let vips_op_response = bindings::vips_autorot(
4032            inp_in,
4033            &mut out_out,
4034            angle_in_name.as_ptr(),
4035            angle_in,
4036            flip_in_name.as_ptr(),
4037            flip_in,
4038            NULL,
4039        );
4040        utils::result(
4041            vips_op_response,
4042            VipsImage { ctx: out_out },
4043            Error::AutorotError,
4044        )
4045    }
4046}
4047
4048/// VipsIfthenelse (ifthenelse), ifthenelse an image
4049/// cond: `&VipsImage` -> Condition input image
4050/// in_1: `&VipsImage` -> Source for TRUE pixels
4051/// in_2: `&VipsImage` -> Source for FALSE pixels
4052/// returns `VipsImage` - Output image
4053pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4054    unsafe {
4055        let cond_in: *mut bindings::VipsImage = cond.ctx;
4056        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4057        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4058        let mut out_out: *mut bindings::VipsImage = null_mut();
4059
4060        let vips_op_response =
4061            bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4062        utils::result(
4063            vips_op_response,
4064            VipsImage { ctx: out_out },
4065            Error::IfthenelseError,
4066        )
4067    }
4068}
4069
4070/// Options for ifthenelse operation
4071#[derive(Clone, Debug)]
4072pub struct IfthenelseOptions {
4073    /// blend: `bool` -> Blend smoothly between then and else parts
4074    /// default: false
4075    pub blend: bool,
4076}
4077
4078impl std::default::Default for IfthenelseOptions {
4079    fn default() -> Self {
4080        IfthenelseOptions { blend: false }
4081    }
4082}
4083
4084/// VipsIfthenelse (ifthenelse), ifthenelse an image
4085/// cond: `&VipsImage` -> Condition input image
4086/// in_1: `&VipsImage` -> Source for TRUE pixels
4087/// in_2: `&VipsImage` -> Source for FALSE pixels
4088/// ifthenelse_options: `&IfthenelseOptions` -> optional arguments
4089/// returns `VipsImage` - Output image
4090pub fn ifthenelse_with_opts(
4091    cond: &VipsImage,
4092    in_1: &VipsImage,
4093    in_2: &VipsImage,
4094    ifthenelse_options: &IfthenelseOptions,
4095) -> Result<VipsImage> {
4096    unsafe {
4097        let cond_in: *mut bindings::VipsImage = cond.ctx;
4098        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4099        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4100        let mut out_out: *mut bindings::VipsImage = null_mut();
4101
4102        let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4103        let blend_in_name = utils::new_c_string("blend")?;
4104
4105        let vips_op_response = bindings::vips_ifthenelse(
4106            cond_in,
4107            in_1_in,
4108            in_2_in,
4109            &mut out_out,
4110            blend_in_name.as_ptr(),
4111            blend_in,
4112            NULL,
4113        );
4114        utils::result(
4115            vips_op_response,
4116            VipsImage { ctx: out_out },
4117            Error::IfthenelseError,
4118        )
4119    }
4120}
4121
4122/// VipsRecomb (recomb), linear recombination with matrix
4123/// inp: `&VipsImage` -> Input image argument
4124/// m: `&VipsImage` -> Matrix of coefficients
4125/// returns `VipsImage` - Output image
4126pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4127    unsafe {
4128        let inp_in: *mut bindings::VipsImage = inp.ctx;
4129        let m_in: *mut bindings::VipsImage = m.ctx;
4130        let mut out_out: *mut bindings::VipsImage = null_mut();
4131
4132        let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4133        utils::result(
4134            vips_op_response,
4135            VipsImage { ctx: out_out },
4136            Error::RecombError,
4137        )
4138    }
4139}
4140
4141/// VipsBandfold (bandfold), fold up x axis into bands
4142/// inp: `&VipsImage` -> Input image
4143/// returns `VipsImage` - Output image
4144pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4145    unsafe {
4146        let inp_in: *mut bindings::VipsImage = inp.ctx;
4147        let mut out_out: *mut bindings::VipsImage = null_mut();
4148
4149        let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4150        utils::result(
4151            vips_op_response,
4152            VipsImage { ctx: out_out },
4153            Error::BandfoldError,
4154        )
4155    }
4156}
4157
4158/// Options for bandfold operation
4159#[derive(Clone, Debug)]
4160pub struct BandfoldOptions {
4161    /// factor: `i32` -> Fold by this factor
4162    /// min: 0, max: 10000000, default: 0
4163    pub factor: i32,
4164}
4165
4166impl std::default::Default for BandfoldOptions {
4167    fn default() -> Self {
4168        BandfoldOptions {
4169            factor: i32::from(0),
4170        }
4171    }
4172}
4173
4174/// VipsBandfold (bandfold), fold up x axis into bands
4175/// inp: `&VipsImage` -> Input image
4176/// bandfold_options: `&BandfoldOptions` -> optional arguments
4177/// returns `VipsImage` - Output image
4178pub fn bandfold_with_opts(
4179    inp: &VipsImage,
4180    bandfold_options: &BandfoldOptions,
4181) -> Result<VipsImage> {
4182    unsafe {
4183        let inp_in: *mut bindings::VipsImage = inp.ctx;
4184        let mut out_out: *mut bindings::VipsImage = null_mut();
4185
4186        let factor_in: i32 = bandfold_options.factor;
4187        let factor_in_name = utils::new_c_string("factor")?;
4188
4189        let vips_op_response = bindings::vips_bandfold(
4190            inp_in,
4191            &mut out_out,
4192            factor_in_name.as_ptr(),
4193            factor_in,
4194            NULL,
4195        );
4196        utils::result(
4197            vips_op_response,
4198            VipsImage { ctx: out_out },
4199            Error::BandfoldError,
4200        )
4201    }
4202}
4203
4204/// VipsBandunfold (bandunfold), unfold image bands into x axis
4205/// inp: `&VipsImage` -> Input image
4206/// returns `VipsImage` - Output image
4207pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4208    unsafe {
4209        let inp_in: *mut bindings::VipsImage = inp.ctx;
4210        let mut out_out: *mut bindings::VipsImage = null_mut();
4211
4212        let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4213        utils::result(
4214            vips_op_response,
4215            VipsImage { ctx: out_out },
4216            Error::BandunfoldError,
4217        )
4218    }
4219}
4220
4221/// Options for bandunfold operation
4222#[derive(Clone, Debug)]
4223pub struct BandunfoldOptions {
4224    /// factor: `i32` -> Unfold by this factor
4225    /// min: 0, max: 10000000, default: 0
4226    pub factor: i32,
4227}
4228
4229impl std::default::Default for BandunfoldOptions {
4230    fn default() -> Self {
4231        BandunfoldOptions {
4232            factor: i32::from(0),
4233        }
4234    }
4235}
4236
4237/// VipsBandunfold (bandunfold), unfold image bands into x axis
4238/// inp: `&VipsImage` -> Input image
4239/// bandunfold_options: `&BandunfoldOptions` -> optional arguments
4240/// returns `VipsImage` - Output image
4241pub fn bandunfold_with_opts(
4242    inp: &VipsImage,
4243    bandunfold_options: &BandunfoldOptions,
4244) -> Result<VipsImage> {
4245    unsafe {
4246        let inp_in: *mut bindings::VipsImage = inp.ctx;
4247        let mut out_out: *mut bindings::VipsImage = null_mut();
4248
4249        let factor_in: i32 = bandunfold_options.factor;
4250        let factor_in_name = utils::new_c_string("factor")?;
4251
4252        let vips_op_response = bindings::vips_bandunfold(
4253            inp_in,
4254            &mut out_out,
4255            factor_in_name.as_ptr(),
4256            factor_in,
4257            NULL,
4258        );
4259        utils::result(
4260            vips_op_response,
4261            VipsImage { ctx: out_out },
4262            Error::BandunfoldError,
4263        )
4264    }
4265}
4266
4267/// VipsFlatten (flatten), flatten alpha out of an image
4268/// inp: `&VipsImage` -> Input image
4269/// returns `VipsImage` - Output image
4270pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4271    unsafe {
4272        let inp_in: *mut bindings::VipsImage = inp.ctx;
4273        let mut out_out: *mut bindings::VipsImage = null_mut();
4274
4275        let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4276        utils::result(
4277            vips_op_response,
4278            VipsImage { ctx: out_out },
4279            Error::FlattenError,
4280        )
4281    }
4282}
4283
4284/// Options for flatten operation
4285#[derive(Clone, Debug)]
4286pub struct FlattenOptions {
4287    /// background: `Vec<f64>` -> Background value
4288    pub background: Vec<f64>,
4289    /// max_alpha: `f64` -> Maximum value of alpha channel
4290    /// min: 0, max: 100000000, default: 255
4291    pub max_alpha: f64,
4292}
4293
4294impl std::default::Default for FlattenOptions {
4295    fn default() -> Self {
4296        FlattenOptions {
4297            background: Vec::new(),
4298            max_alpha: f64::from(255),
4299        }
4300    }
4301}
4302
4303/// VipsFlatten (flatten), flatten alpha out of an image
4304/// inp: `&VipsImage` -> Input image
4305/// flatten_options: `&FlattenOptions` -> optional arguments
4306/// returns `VipsImage` - Output image
4307pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4308    unsafe {
4309        let inp_in: *mut bindings::VipsImage = inp.ctx;
4310        let mut out_out: *mut bindings::VipsImage = null_mut();
4311
4312        let background_wrapper =
4313            utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4314        let background_in = background_wrapper.ctx;
4315        let background_in_name = utils::new_c_string("background")?;
4316
4317        let max_alpha_in: f64 = flatten_options.max_alpha;
4318        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4319
4320        let vips_op_response = bindings::vips_flatten(
4321            inp_in,
4322            &mut out_out,
4323            background_in_name.as_ptr(),
4324            background_in,
4325            max_alpha_in_name.as_ptr(),
4326            max_alpha_in,
4327            NULL,
4328        );
4329        utils::result(
4330            vips_op_response,
4331            VipsImage { ctx: out_out },
4332            Error::FlattenError,
4333        )
4334    }
4335}
4336
4337/// VipsPremultiply (premultiply), premultiply image alpha
4338/// inp: `&VipsImage` -> Input image
4339/// returns `VipsImage` - Output image
4340pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4341    unsafe {
4342        let inp_in: *mut bindings::VipsImage = inp.ctx;
4343        let mut out_out: *mut bindings::VipsImage = null_mut();
4344
4345        let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4346        utils::result(
4347            vips_op_response,
4348            VipsImage { ctx: out_out },
4349            Error::PremultiplyError,
4350        )
4351    }
4352}
4353
4354/// Options for premultiply operation
4355#[derive(Clone, Debug)]
4356pub struct PremultiplyOptions {
4357    /// max_alpha: `f64` -> Maximum value of alpha channel
4358    /// min: 0, max: 100000000, default: 255
4359    pub max_alpha: f64,
4360}
4361
4362impl std::default::Default for PremultiplyOptions {
4363    fn default() -> Self {
4364        PremultiplyOptions {
4365            max_alpha: f64::from(255),
4366        }
4367    }
4368}
4369
4370/// VipsPremultiply (premultiply), premultiply image alpha
4371/// inp: `&VipsImage` -> Input image
4372/// premultiply_options: `&PremultiplyOptions` -> optional arguments
4373/// returns `VipsImage` - Output image
4374pub fn premultiply_with_opts(
4375    inp: &VipsImage,
4376    premultiply_options: &PremultiplyOptions,
4377) -> Result<VipsImage> {
4378    unsafe {
4379        let inp_in: *mut bindings::VipsImage = inp.ctx;
4380        let mut out_out: *mut bindings::VipsImage = null_mut();
4381
4382        let max_alpha_in: f64 = premultiply_options.max_alpha;
4383        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4384
4385        let vips_op_response = bindings::vips_premultiply(
4386            inp_in,
4387            &mut out_out,
4388            max_alpha_in_name.as_ptr(),
4389            max_alpha_in,
4390            NULL,
4391        );
4392        utils::result(
4393            vips_op_response,
4394            VipsImage { ctx: out_out },
4395            Error::PremultiplyError,
4396        )
4397    }
4398}
4399
4400/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4401/// inp: `&VipsImage` -> Input image
4402/// returns `VipsImage` - Output image
4403pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4404    unsafe {
4405        let inp_in: *mut bindings::VipsImage = inp.ctx;
4406        let mut out_out: *mut bindings::VipsImage = null_mut();
4407
4408        let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4409        utils::result(
4410            vips_op_response,
4411            VipsImage { ctx: out_out },
4412            Error::UnpremultiplyError,
4413        )
4414    }
4415}
4416
4417/// Options for unpremultiply operation
4418#[derive(Clone, Debug)]
4419pub struct UnpremultiplyOptions {
4420    /// max_alpha: `f64` -> Maximum value of alpha channel
4421    /// min: 0, max: 100000000, default: 255
4422    pub max_alpha: f64,
4423    /// alpha_band: `i32` -> Unpremultiply with this alpha
4424    /// min: 0, max: 100000000, default: 3
4425    pub alpha_band: i32,
4426}
4427
4428impl std::default::Default for UnpremultiplyOptions {
4429    fn default() -> Self {
4430        UnpremultiplyOptions {
4431            max_alpha: f64::from(255),
4432            alpha_band: i32::from(3),
4433        }
4434    }
4435}
4436
4437/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4438/// inp: `&VipsImage` -> Input image
4439/// unpremultiply_options: `&UnpremultiplyOptions` -> optional arguments
4440/// returns `VipsImage` - Output image
4441pub fn unpremultiply_with_opts(
4442    inp: &VipsImage,
4443    unpremultiply_options: &UnpremultiplyOptions,
4444) -> Result<VipsImage> {
4445    unsafe {
4446        let inp_in: *mut bindings::VipsImage = inp.ctx;
4447        let mut out_out: *mut bindings::VipsImage = null_mut();
4448
4449        let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4450        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4451
4452        let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4453        let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4454
4455        let vips_op_response = bindings::vips_unpremultiply(
4456            inp_in,
4457            &mut out_out,
4458            max_alpha_in_name.as_ptr(),
4459            max_alpha_in,
4460            alpha_band_in_name.as_ptr(),
4461            alpha_band_in,
4462            NULL,
4463        );
4464        utils::result(
4465            vips_op_response,
4466            VipsImage { ctx: out_out },
4467            Error::UnpremultiplyError,
4468        )
4469    }
4470}
4471
4472/// VipsGrid (grid), grid an image
4473/// inp: `&VipsImage` -> Input image
4474/// tile_height: `i32` -> Chop into tiles this high
4475/// min: 1, max: 10000000, default: 128
4476/// across: `i32` -> Number of tiles across
4477/// min: 1, max: 10000000, default: 1
4478/// down: `i32` -> Number of tiles down
4479/// min: 1, max: 10000000, default: 1
4480/// returns `VipsImage` - Output image
4481pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4482    unsafe {
4483        let inp_in: *mut bindings::VipsImage = inp.ctx;
4484        let tile_height_in: i32 = tile_height;
4485        let across_in: i32 = across;
4486        let down_in: i32 = down;
4487        let mut out_out: *mut bindings::VipsImage = null_mut();
4488
4489        let vips_op_response = bindings::vips_grid(
4490            inp_in,
4491            &mut out_out,
4492            tile_height_in,
4493            across_in,
4494            down_in,
4495            NULL,
4496        );
4497        utils::result(
4498            vips_op_response,
4499            VipsImage { ctx: out_out },
4500            Error::GridError,
4501        )
4502    }
4503}
4504
4505/// VipsTranspose3d (transpose3d), transpose3d an image
4506/// inp: `&VipsImage` -> Input image
4507/// returns `VipsImage` - Output image
4508pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4509    unsafe {
4510        let inp_in: *mut bindings::VipsImage = inp.ctx;
4511        let mut out_out: *mut bindings::VipsImage = null_mut();
4512
4513        let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4514        utils::result(
4515            vips_op_response,
4516            VipsImage { ctx: out_out },
4517            Error::Transpose3DError,
4518        )
4519    }
4520}
4521
4522/// Options for transpose_3d operation
4523#[derive(Clone, Debug)]
4524pub struct Transpose3DOptions {
4525    /// page_height: `i32` -> Height of each input page
4526    /// min: 0, max: 10000000, default: 0
4527    pub page_height: i32,
4528}
4529
4530impl std::default::Default for Transpose3DOptions {
4531    fn default() -> Self {
4532        Transpose3DOptions {
4533            page_height: i32::from(0),
4534        }
4535    }
4536}
4537
4538/// VipsTranspose3d (transpose3d), transpose3d an image
4539/// inp: `&VipsImage` -> Input image
4540/// transpose_3d_options: `&Transpose3DOptions` -> optional arguments
4541/// returns `VipsImage` - Output image
4542pub fn transpose_3d_with_opts(
4543    inp: &VipsImage,
4544    transpose_3d_options: &Transpose3DOptions,
4545) -> Result<VipsImage> {
4546    unsafe {
4547        let inp_in: *mut bindings::VipsImage = inp.ctx;
4548        let mut out_out: *mut bindings::VipsImage = null_mut();
4549
4550        let page_height_in: i32 = transpose_3d_options.page_height;
4551        let page_height_in_name = utils::new_c_string("page-height")?;
4552
4553        let vips_op_response = bindings::vips_transpose3d(
4554            inp_in,
4555            &mut out_out,
4556            page_height_in_name.as_ptr(),
4557            page_height_in,
4558            NULL,
4559        );
4560        utils::result(
4561            vips_op_response,
4562            VipsImage { ctx: out_out },
4563            Error::Transpose3DError,
4564        )
4565    }
4566}
4567
4568/// VipsScale (scale), scale an image to uchar
4569/// inp: `&VipsImage` -> Input image
4570/// returns `VipsImage` - Output image
4571pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4572    unsafe {
4573        let inp_in: *mut bindings::VipsImage = inp.ctx;
4574        let mut out_out: *mut bindings::VipsImage = null_mut();
4575
4576        let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4577        utils::result(
4578            vips_op_response,
4579            VipsImage { ctx: out_out },
4580            Error::ScaleError,
4581        )
4582    }
4583}
4584
4585/// Options for scale operation
4586#[derive(Clone, Debug)]
4587pub struct ScaleOptions {
4588    /// exp: `f64` -> Exponent for log scale
4589    /// min: 0.00001, max: 10000, default: 0.25
4590    pub exp: f64,
4591    /// log: `bool` -> Log scale
4592    /// default: false
4593    pub log: bool,
4594}
4595
4596impl std::default::Default for ScaleOptions {
4597    fn default() -> Self {
4598        ScaleOptions {
4599            exp: f64::from(0.25),
4600            log: false,
4601        }
4602    }
4603}
4604
4605/// VipsScale (scale), scale an image to uchar
4606/// inp: `&VipsImage` -> Input image
4607/// scale_options: `&ScaleOptions` -> optional arguments
4608/// returns `VipsImage` - Output image
4609pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4610    unsafe {
4611        let inp_in: *mut bindings::VipsImage = inp.ctx;
4612        let mut out_out: *mut bindings::VipsImage = null_mut();
4613
4614        let exp_in: f64 = scale_options.exp;
4615        let exp_in_name = utils::new_c_string("exp")?;
4616
4617        let log_in: i32 = if scale_options.log { 1 } else { 0 };
4618        let log_in_name = utils::new_c_string("log")?;
4619
4620        let vips_op_response = bindings::vips_scale(
4621            inp_in,
4622            &mut out_out,
4623            exp_in_name.as_ptr(),
4624            exp_in,
4625            log_in_name.as_ptr(),
4626            log_in,
4627            NULL,
4628        );
4629        utils::result(
4630            vips_op_response,
4631            VipsImage { ctx: out_out },
4632            Error::ScaleError,
4633        )
4634    }
4635}
4636
4637/// VipsWrap (wrap), wrap image origin
4638/// inp: `&VipsImage` -> Input image
4639/// returns `VipsImage` - Output image
4640pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4641    unsafe {
4642        let inp_in: *mut bindings::VipsImage = inp.ctx;
4643        let mut out_out: *mut bindings::VipsImage = null_mut();
4644
4645        let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4646        utils::result(
4647            vips_op_response,
4648            VipsImage { ctx: out_out },
4649            Error::WrapError,
4650        )
4651    }
4652}
4653
4654/// Options for wrap operation
4655#[derive(Clone, Debug)]
4656pub struct WrapOptions {
4657    /// x: `i32` -> Left edge of input in output
4658    /// min: -10000000, max: 10000000, default: 0
4659    pub x: i32,
4660    /// y: `i32` -> Top edge of input in output
4661    /// min: -10000000, max: 10000000, default: 0
4662    pub y: i32,
4663}
4664
4665impl std::default::Default for WrapOptions {
4666    fn default() -> Self {
4667        WrapOptions {
4668            x: i32::from(0),
4669            y: i32::from(0),
4670        }
4671    }
4672}
4673
4674/// VipsWrap (wrap), wrap image origin
4675/// inp: `&VipsImage` -> Input image
4676/// wrap_options: `&WrapOptions` -> optional arguments
4677/// returns `VipsImage` - Output image
4678pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4679    unsafe {
4680        let inp_in: *mut bindings::VipsImage = inp.ctx;
4681        let mut out_out: *mut bindings::VipsImage = null_mut();
4682
4683        let x_in: i32 = wrap_options.x;
4684        let x_in_name = utils::new_c_string("x")?;
4685
4686        let y_in: i32 = wrap_options.y;
4687        let y_in_name = utils::new_c_string("y")?;
4688
4689        let vips_op_response = bindings::vips_wrap(
4690            inp_in,
4691            &mut out_out,
4692            x_in_name.as_ptr(),
4693            x_in,
4694            y_in_name.as_ptr(),
4695            y_in,
4696            NULL,
4697        );
4698        utils::result(
4699            vips_op_response,
4700            VipsImage { ctx: out_out },
4701            Error::WrapError,
4702        )
4703    }
4704}
4705
4706/// VipsZoom (zoom), zoom an image
4707/// input: `&VipsImage` -> Input image
4708/// xfac: `i32` -> Horizontal zoom factor
4709/// min: 1, max: 10000000, default: 1
4710/// yfac: `i32` -> Vertical zoom factor
4711/// min: 1, max: 10000000, default: 1
4712/// returns `VipsImage` - Output image
4713pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4714    unsafe {
4715        let input_in: *mut bindings::VipsImage = input.ctx;
4716        let xfac_in: i32 = xfac;
4717        let yfac_in: i32 = yfac;
4718        let mut out_out: *mut bindings::VipsImage = null_mut();
4719
4720        let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4721        utils::result(
4722            vips_op_response,
4723            VipsImage { ctx: out_out },
4724            Error::ZoomError,
4725        )
4726    }
4727}
4728
4729/// VipsSubsample (subsample), subsample an image
4730/// input: `&VipsImage` -> Input image
4731/// xfac: `i32` -> Horizontal subsample factor
4732/// min: 1, max: 10000000, default: 1
4733/// yfac: `i32` -> Vertical subsample factor
4734/// min: 1, max: 10000000, default: 1
4735/// returns `VipsImage` - Output image
4736pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4737    unsafe {
4738        let input_in: *mut bindings::VipsImage = input.ctx;
4739        let xfac_in: i32 = xfac;
4740        let yfac_in: i32 = yfac;
4741        let mut out_out: *mut bindings::VipsImage = null_mut();
4742
4743        let vips_op_response =
4744            bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4745        utils::result(
4746            vips_op_response,
4747            VipsImage { ctx: out_out },
4748            Error::SubsampleError,
4749        )
4750    }
4751}
4752
4753/// Options for subsample operation
4754#[derive(Clone, Debug)]
4755pub struct SubsampleOptions {
4756    /// point: `bool` -> Point sample
4757    /// default: false
4758    pub point: bool,
4759}
4760
4761impl std::default::Default for SubsampleOptions {
4762    fn default() -> Self {
4763        SubsampleOptions { point: false }
4764    }
4765}
4766
4767/// VipsSubsample (subsample), subsample an image
4768/// input: `&VipsImage` -> Input image
4769/// xfac: `i32` -> Horizontal subsample factor
4770/// min: 1, max: 10000000, default: 1
4771/// yfac: `i32` -> Vertical subsample factor
4772/// min: 1, max: 10000000, default: 1
4773/// subsample_options: `&SubsampleOptions` -> optional arguments
4774/// returns `VipsImage` - Output image
4775pub fn subsample_with_opts(
4776    input: &VipsImage,
4777    xfac: i32,
4778    yfac: i32,
4779    subsample_options: &SubsampleOptions,
4780) -> Result<VipsImage> {
4781    unsafe {
4782        let input_in: *mut bindings::VipsImage = input.ctx;
4783        let xfac_in: i32 = xfac;
4784        let yfac_in: i32 = yfac;
4785        let mut out_out: *mut bindings::VipsImage = null_mut();
4786
4787        let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4788        let point_in_name = utils::new_c_string("point")?;
4789
4790        let vips_op_response = bindings::vips_subsample(
4791            input_in,
4792            &mut out_out,
4793            xfac_in,
4794            yfac_in,
4795            point_in_name.as_ptr(),
4796            point_in,
4797            NULL,
4798        );
4799        utils::result(
4800            vips_op_response,
4801            VipsImage { ctx: out_out },
4802            Error::SubsampleError,
4803        )
4804    }
4805}
4806
4807/// VipsMsb (msb), pick most-significant byte from an image
4808/// inp: `&VipsImage` -> Input image
4809/// returns `VipsImage` - Output image
4810pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4811    unsafe {
4812        let inp_in: *mut bindings::VipsImage = inp.ctx;
4813        let mut out_out: *mut bindings::VipsImage = null_mut();
4814
4815        let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4816        utils::result(
4817            vips_op_response,
4818            VipsImage { ctx: out_out },
4819            Error::MsbError,
4820        )
4821    }
4822}
4823
4824/// Options for msb operation
4825#[derive(Clone, Debug)]
4826pub struct MsbOptions {
4827    /// band: `i32` -> Band to msb
4828    /// min: 0, max: 100000000, default: 0
4829    pub band: i32,
4830}
4831
4832impl std::default::Default for MsbOptions {
4833    fn default() -> Self {
4834        MsbOptions { band: i32::from(0) }
4835    }
4836}
4837
4838/// VipsMsb (msb), pick most-significant byte from an image
4839/// inp: `&VipsImage` -> Input image
4840/// msb_options: `&MsbOptions` -> optional arguments
4841/// returns `VipsImage` - Output image
4842pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4843    unsafe {
4844        let inp_in: *mut bindings::VipsImage = inp.ctx;
4845        let mut out_out: *mut bindings::VipsImage = null_mut();
4846
4847        let band_in: i32 = msb_options.band;
4848        let band_in_name = utils::new_c_string("band")?;
4849
4850        let vips_op_response =
4851            bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4852        utils::result(
4853            vips_op_response,
4854            VipsImage { ctx: out_out },
4855            Error::MsbError,
4856        )
4857    }
4858}
4859
4860/// VipsByteswap (byteswap), byteswap an image
4861/// inp: `&VipsImage` -> Input image
4862/// returns `VipsImage` - Output image
4863pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4864    unsafe {
4865        let inp_in: *mut bindings::VipsImage = inp.ctx;
4866        let mut out_out: *mut bindings::VipsImage = null_mut();
4867
4868        let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4869        utils::result(
4870            vips_op_response,
4871            VipsImage { ctx: out_out },
4872            Error::ByteswapError,
4873        )
4874    }
4875}
4876
4877/// VipsFalsecolour (falsecolour), false-color an image
4878/// inp: `&VipsImage` -> Input image
4879/// returns `VipsImage` - Output image
4880pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4881    unsafe {
4882        let inp_in: *mut bindings::VipsImage = inp.ctx;
4883        let mut out_out: *mut bindings::VipsImage = null_mut();
4884
4885        let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4886        utils::result(
4887            vips_op_response,
4888            VipsImage { ctx: out_out },
4889            Error::FalsecolourError,
4890        )
4891    }
4892}
4893
4894/// VipsGamma (gamma), gamma an image
4895/// inp: `&VipsImage` -> Input image
4896/// returns `VipsImage` - Output image
4897pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4898    unsafe {
4899        let inp_in: *mut bindings::VipsImage = inp.ctx;
4900        let mut out_out: *mut bindings::VipsImage = null_mut();
4901
4902        let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4903        utils::result(
4904            vips_op_response,
4905            VipsImage { ctx: out_out },
4906            Error::GammaError,
4907        )
4908    }
4909}
4910
4911/// Options for gamma operation
4912#[derive(Clone, Debug)]
4913pub struct GammaOptions {
4914    /// exponent: `f64` -> Gamma factor
4915    /// min: 0.000001, max: 1000, default: 2.4
4916    pub exponent: f64,
4917}
4918
4919impl std::default::Default for GammaOptions {
4920    fn default() -> Self {
4921        GammaOptions {
4922            exponent: f64::from(2.4),
4923        }
4924    }
4925}
4926
4927/// VipsGamma (gamma), gamma an image
4928/// inp: `&VipsImage` -> Input image
4929/// gamma_options: `&GammaOptions` -> optional arguments
4930/// returns `VipsImage` - Output image
4931pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> 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 exponent_in: f64 = gamma_options.exponent;
4937        let exponent_in_name = utils::new_c_string("exponent")?;
4938
4939        let vips_op_response = bindings::vips_gamma(
4940            inp_in,
4941            &mut out_out,
4942            exponent_in_name.as_ptr(),
4943            exponent_in,
4944            NULL,
4945        );
4946        utils::result(
4947            vips_op_response,
4948            VipsImage { ctx: out_out },
4949            Error::GammaError,
4950        )
4951    }
4952}
4953
4954/// VipsComposite (composite), blend an array of images with an array of blend modes
4955/// inp: `&mut [VipsImage]` -> Array of input images
4956/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
4957/// returns `VipsImage` - Output image
4958pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
4959    unsafe {
4960        let (inp_len, mut inp_in) = {
4961            let len = inp.len();
4962            let mut input = Vec::new();
4963            for img in inp {
4964                input.push(img.ctx)
4965            }
4966            (len as i32, input)
4967        };
4968        let mode_in: *mut i32 = mode.as_mut_ptr();
4969        let mut out_out: *mut bindings::VipsImage = null_mut();
4970
4971        let vips_op_response = bindings::vips_composite(
4972            inp_in.as_mut_ptr(),
4973            &mut out_out,
4974            inp_len,
4975            mode_in,
4976            mode.len() as i32,
4977            NULL,
4978        );
4979        utils::result(
4980            vips_op_response,
4981            VipsImage { ctx: out_out },
4982            Error::CompositeError,
4983        )
4984    }
4985}
4986
4987/// Options for composite operation
4988#[derive(Clone, Debug)]
4989pub struct CompositeOptions {
4990    /// x: `Vec<i32>` -> Array of x coordinates to join at
4991    pub x: Vec<i32>,
4992    /// y: `Vec<i32>` -> Array of y coordinates to join at
4993    pub y: Vec<i32>,
4994    /// compositing_space: `Interpretation` -> Composite images in this colour space
4995    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
4996    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
4997    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
4998    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
4999    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5000    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5001    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5002    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5003    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5004    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5005    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5006    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5007    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5008    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5009    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5010    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5011    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5012    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5013    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5014    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5015    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5016    pub compositing_space: Interpretation,
5017    /// premultiplied: `bool` -> Images have premultiplied alpha
5018    /// default: false
5019    pub premultiplied: bool,
5020}
5021
5022impl std::default::Default for CompositeOptions {
5023    fn default() -> Self {
5024        CompositeOptions {
5025            x: Vec::new(),
5026            y: Vec::new(),
5027            compositing_space: Interpretation::Srgb,
5028            premultiplied: false,
5029        }
5030    }
5031}
5032
5033/// VipsComposite (composite), blend an array of images with an array of blend modes
5034/// inp: `&mut [VipsImage]` -> Array of input images
5035/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5036/// composite_options: `&CompositeOptions` -> optional arguments
5037/// returns `VipsImage` - Output image
5038pub fn composite_with_opts(
5039    inp: &mut [VipsImage],
5040    mode: &mut [i32],
5041    composite_options: &CompositeOptions,
5042) -> Result<VipsImage> {
5043    unsafe {
5044        let (inp_len, mut inp_in) = {
5045            let len = inp.len();
5046            let mut input = Vec::new();
5047            for img in inp {
5048                input.push(img.ctx)
5049            }
5050            (len as i32, input)
5051        };
5052        let mode_in: *mut i32 = mode.as_mut_ptr();
5053        let mut out_out: *mut bindings::VipsImage = null_mut();
5054
5055        let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5056        let x_in = x_wrapper.ctx;
5057        let x_in_name = utils::new_c_string("x")?;
5058
5059        let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5060        let y_in = y_wrapper.ctx;
5061        let y_in_name = utils::new_c_string("y")?;
5062
5063        let compositing_space_in: i32 = composite_options.compositing_space as i32;
5064        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5065
5066        let premultiplied_in: i32 = if composite_options.premultiplied {
5067            1
5068        } else {
5069            0
5070        };
5071        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5072
5073        let vips_op_response = bindings::vips_composite(
5074            inp_in.as_mut_ptr(),
5075            &mut out_out,
5076            inp_len,
5077            mode_in,
5078            mode.len() as i32,
5079            x_in_name.as_ptr(),
5080            x_in,
5081            y_in_name.as_ptr(),
5082            y_in,
5083            compositing_space_in_name.as_ptr(),
5084            compositing_space_in,
5085            premultiplied_in_name.as_ptr(),
5086            premultiplied_in,
5087            NULL,
5088        );
5089        utils::result(
5090            vips_op_response,
5091            VipsImage { ctx: out_out },
5092            Error::CompositeError,
5093        )
5094    }
5095}
5096
5097/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5098/// base: `&VipsImage` -> Base image
5099/// overlay: `&VipsImage` -> Overlay image
5100/// mode: `BlendMode` -> VipsBlendMode to join with
5101///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5102///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5103///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5104///  `In` -> VIPS_BLEND_MODE_IN = 3
5105///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5106///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5107///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5108///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5109///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5110///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5111///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5112///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5113///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5114///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5115///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5116///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5117///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5118///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5119///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5120///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5121///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5122///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5123///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5124///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5125///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5126///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5127/// returns `VipsImage` - Output image
5128pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5129    unsafe {
5130        let base_in: *mut bindings::VipsImage = base.ctx;
5131        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5132        let mode_in: i32 = mode as i32;
5133        let mut out_out: *mut bindings::VipsImage = null_mut();
5134
5135        let vips_op_response = bindings::vips_composite2(
5136            base_in,
5137            overlay_in,
5138            &mut out_out,
5139            mode_in.try_into().unwrap(),
5140            NULL,
5141        );
5142        utils::result(
5143            vips_op_response,
5144            VipsImage { ctx: out_out },
5145            Error::Composite2Error,
5146        )
5147    }
5148}
5149
5150/// Options for composite_2 operation
5151#[derive(Clone, Debug)]
5152pub struct Composite2Options {
5153    /// x: `i32` -> x position of overlay
5154    /// min: -10000000, max: 10000000, default: 0
5155    pub x: i32,
5156    /// y: `i32` -> y position of overlay
5157    /// min: -10000000, max: 10000000, default: 0
5158    pub y: i32,
5159    /// compositing_space: `Interpretation` -> Composite images in this colour space
5160    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5161    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5162    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5163    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5164    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5165    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5166    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5167    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5168    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5169    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5170    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5171    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5172    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5173    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5174    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5175    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5176    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5177    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5178    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5179    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5180    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5181    pub compositing_space: Interpretation,
5182    /// premultiplied: `bool` -> Images have premultiplied alpha
5183    /// default: false
5184    pub premultiplied: bool,
5185}
5186
5187impl std::default::Default for Composite2Options {
5188    fn default() -> Self {
5189        Composite2Options {
5190            x: i32::from(0),
5191            y: i32::from(0),
5192            compositing_space: Interpretation::Srgb,
5193            premultiplied: false,
5194        }
5195    }
5196}
5197
5198/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5199/// base: `&VipsImage` -> Base image
5200/// overlay: `&VipsImage` -> Overlay image
5201/// mode: `BlendMode` -> VipsBlendMode to join with
5202///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5203///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5204///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5205///  `In` -> VIPS_BLEND_MODE_IN = 3
5206///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5207///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5208///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5209///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5210///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5211///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5212///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5213///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5214///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5215///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5216///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5217///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5218///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5219///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5220///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5221///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5222///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5223///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5224///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5225///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5226///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5227///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5228/// composite_2_options: `&Composite2Options` -> optional arguments
5229/// returns `VipsImage` - Output image
5230pub fn composite_2_with_opts(
5231    base: &VipsImage,
5232    overlay: &VipsImage,
5233    mode: BlendMode,
5234    composite_2_options: &Composite2Options,
5235) -> Result<VipsImage> {
5236    unsafe {
5237        let base_in: *mut bindings::VipsImage = base.ctx;
5238        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5239        let mode_in: i32 = mode as i32;
5240        let mut out_out: *mut bindings::VipsImage = null_mut();
5241
5242        let x_in: i32 = composite_2_options.x;
5243        let x_in_name = utils::new_c_string("x")?;
5244
5245        let y_in: i32 = composite_2_options.y;
5246        let y_in_name = utils::new_c_string("y")?;
5247
5248        let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5249        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5250
5251        let premultiplied_in: i32 = if composite_2_options.premultiplied {
5252            1
5253        } else {
5254            0
5255        };
5256        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5257
5258        let vips_op_response = bindings::vips_composite2(
5259            base_in,
5260            overlay_in,
5261            &mut out_out,
5262            mode_in.try_into().unwrap(),
5263            x_in_name.as_ptr(),
5264            x_in,
5265            y_in_name.as_ptr(),
5266            y_in,
5267            compositing_space_in_name.as_ptr(),
5268            compositing_space_in,
5269            premultiplied_in_name.as_ptr(),
5270            premultiplied_in,
5271            NULL,
5272        );
5273        utils::result(
5274            vips_op_response,
5275            VipsImage { ctx: out_out },
5276            Error::Composite2Error,
5277        )
5278    }
5279}
5280
5281/// VipsBlack (black), make a black image
5282/// width: `i32` -> Image width in pixels
5283/// min: 1, max: 10000000, default: 1
5284/// height: `i32` -> Image height in pixels
5285/// min: 1, max: 10000000, default: 1
5286/// returns `VipsImage` - Output image
5287pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5288    unsafe {
5289        let width_in: i32 = width;
5290        let height_in: i32 = height;
5291        let mut out_out: *mut bindings::VipsImage = null_mut();
5292
5293        let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5294        utils::result(
5295            vips_op_response,
5296            VipsImage { ctx: out_out },
5297            Error::BlackError,
5298        )
5299    }
5300}
5301
5302/// Options for black operation
5303#[derive(Clone, Debug)]
5304pub struct BlackOptions {
5305    /// bands: `i32` -> Number of bands in image
5306    /// min: 1, max: 10000000, default: 1
5307    pub bands: i32,
5308}
5309
5310impl std::default::Default for BlackOptions {
5311    fn default() -> Self {
5312        BlackOptions {
5313            bands: i32::from(1),
5314        }
5315    }
5316}
5317
5318/// VipsBlack (black), make a black image
5319/// width: `i32` -> Image width in pixels
5320/// min: 1, max: 10000000, default: 1
5321/// height: `i32` -> Image height in pixels
5322/// min: 1, max: 10000000, default: 1
5323/// black_options: `&BlackOptions` -> optional arguments
5324/// returns `VipsImage` - Output image
5325pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5326    unsafe {
5327        let width_in: i32 = width;
5328        let height_in: i32 = height;
5329        let mut out_out: *mut bindings::VipsImage = null_mut();
5330
5331        let bands_in: i32 = black_options.bands;
5332        let bands_in_name = utils::new_c_string("bands")?;
5333
5334        let vips_op_response = bindings::vips_black(
5335            &mut out_out,
5336            width_in,
5337            height_in,
5338            bands_in_name.as_ptr(),
5339            bands_in,
5340            NULL,
5341        );
5342        utils::result(
5343            vips_op_response,
5344            VipsImage { ctx: out_out },
5345            Error::BlackError,
5346        )
5347    }
5348}
5349
5350/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5351/// width: `i32` -> Image width in pixels
5352/// min: 1, max: 10000000, default: 1
5353/// height: `i32` -> Image height in pixels
5354/// min: 1, max: 10000000, default: 1
5355/// returns `VipsImage` - Output image
5356pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5357    unsafe {
5358        let width_in: i32 = width;
5359        let height_in: i32 = height;
5360        let mut out_out: *mut bindings::VipsImage = null_mut();
5361
5362        let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5363        utils::result(
5364            vips_op_response,
5365            VipsImage { ctx: out_out },
5366            Error::GaussnoiseError,
5367        )
5368    }
5369}
5370
5371/// Options for gaussnoise operation
5372#[derive(Clone, Debug)]
5373pub struct GaussnoiseOptions {
5374    /// sigma: `f64` -> Standard deviation of pixels in generated image
5375    /// min: 0, max: 100000, default: 30
5376    pub sigma: f64,
5377    /// mean: `f64` -> Mean of pixels in generated image
5378    /// min: -10000000, max: 1000000, default: 128
5379    pub mean: f64,
5380    /// seed: `i32` -> Random number seed
5381    /// min: -2147483648, max: 2147483647, default: 0
5382    pub seed: i32,
5383}
5384
5385impl std::default::Default for GaussnoiseOptions {
5386    fn default() -> Self {
5387        GaussnoiseOptions {
5388            sigma: f64::from(30),
5389            mean: f64::from(128),
5390            seed: i32::from(0),
5391        }
5392    }
5393}
5394
5395/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5396/// width: `i32` -> Image width in pixels
5397/// min: 1, max: 10000000, default: 1
5398/// height: `i32` -> Image height in pixels
5399/// min: 1, max: 10000000, default: 1
5400/// gaussnoise_options: `&GaussnoiseOptions` -> optional arguments
5401/// returns `VipsImage` - Output image
5402pub fn gaussnoise_with_opts(
5403    width: i32,
5404    height: i32,
5405    gaussnoise_options: &GaussnoiseOptions,
5406) -> Result<VipsImage> {
5407    unsafe {
5408        let width_in: i32 = width;
5409        let height_in: i32 = height;
5410        let mut out_out: *mut bindings::VipsImage = null_mut();
5411
5412        let sigma_in: f64 = gaussnoise_options.sigma;
5413        let sigma_in_name = utils::new_c_string("sigma")?;
5414
5415        let mean_in: f64 = gaussnoise_options.mean;
5416        let mean_in_name = utils::new_c_string("mean")?;
5417
5418        let seed_in: i32 = gaussnoise_options.seed;
5419        let seed_in_name = utils::new_c_string("seed")?;
5420
5421        let vips_op_response = bindings::vips_gaussnoise(
5422            &mut out_out,
5423            width_in,
5424            height_in,
5425            sigma_in_name.as_ptr(),
5426            sigma_in,
5427            mean_in_name.as_ptr(),
5428            mean_in,
5429            seed_in_name.as_ptr(),
5430            seed_in,
5431            NULL,
5432        );
5433        utils::result(
5434            vips_op_response,
5435            VipsImage { ctx: out_out },
5436            Error::GaussnoiseError,
5437        )
5438    }
5439}
5440
5441/// VipsXyz (xyz), make an image where pixel values are coordinates
5442/// width: `i32` -> Image width in pixels
5443/// min: 1, max: 10000000, default: 64
5444/// height: `i32` -> Image height in pixels
5445/// min: 1, max: 10000000, default: 64
5446/// returns `VipsImage` - Output image
5447pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5448    unsafe {
5449        let width_in: i32 = width;
5450        let height_in: i32 = height;
5451        let mut out_out: *mut bindings::VipsImage = null_mut();
5452
5453        let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5454        utils::result(
5455            vips_op_response,
5456            VipsImage { ctx: out_out },
5457            Error::XyzError,
5458        )
5459    }
5460}
5461
5462/// Options for xyz operation
5463#[derive(Clone, Debug)]
5464pub struct XyzOptions {
5465    /// csize: `i32` -> Size of third dimension
5466    /// min: 1, max: 10000000, default: 1
5467    pub csize: i32,
5468    /// dsize: `i32` -> Size of fourth dimension
5469    /// min: 1, max: 10000000, default: 1
5470    pub dsize: i32,
5471    /// esize: `i32` -> Size of fifth dimension
5472    /// min: 1, max: 10000000, default: 1
5473    pub esize: i32,
5474}
5475
5476impl std::default::Default for XyzOptions {
5477    fn default() -> Self {
5478        XyzOptions {
5479            csize: i32::from(1),
5480            dsize: i32::from(1),
5481            esize: i32::from(1),
5482        }
5483    }
5484}
5485
5486/// VipsXyz (xyz), make an image where pixel values are coordinates
5487/// width: `i32` -> Image width in pixels
5488/// min: 1, max: 10000000, default: 64
5489/// height: `i32` -> Image height in pixels
5490/// min: 1, max: 10000000, default: 64
5491/// xyz_options: `&XyzOptions` -> optional arguments
5492/// returns `VipsImage` - Output image
5493pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5494    unsafe {
5495        let width_in: i32 = width;
5496        let height_in: i32 = height;
5497        let mut out_out: *mut bindings::VipsImage = null_mut();
5498
5499        let csize_in: i32 = xyz_options.csize;
5500        let csize_in_name = utils::new_c_string("csize")?;
5501
5502        let dsize_in: i32 = xyz_options.dsize;
5503        let dsize_in_name = utils::new_c_string("dsize")?;
5504
5505        let esize_in: i32 = xyz_options.esize;
5506        let esize_in_name = utils::new_c_string("esize")?;
5507
5508        let vips_op_response = bindings::vips_xyz(
5509            &mut out_out,
5510            width_in,
5511            height_in,
5512            csize_in_name.as_ptr(),
5513            csize_in,
5514            dsize_in_name.as_ptr(),
5515            dsize_in,
5516            esize_in_name.as_ptr(),
5517            esize_in,
5518            NULL,
5519        );
5520        utils::result(
5521            vips_op_response,
5522            VipsImage { ctx: out_out },
5523            Error::XyzError,
5524        )
5525    }
5526}
5527
5528/// VipsGaussmat (gaussmat), make a gaussian image
5529/// sigma: `f64` -> Sigma of Gaussian
5530/// min: 0.000001, max: 10000, default: 1
5531/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5532/// min: 0.000001, max: 10000, default: 0.1
5533/// returns `VipsImage` - Output image
5534pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5535    unsafe {
5536        let sigma_in: f64 = sigma;
5537        let min_ampl_in: f64 = min_ampl;
5538        let mut out_out: *mut bindings::VipsImage = null_mut();
5539
5540        let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5541        utils::result(
5542            vips_op_response,
5543            VipsImage { ctx: out_out },
5544            Error::GaussmatError,
5545        )
5546    }
5547}
5548
5549/// Options for gaussmat operation
5550#[derive(Clone, Debug)]
5551pub struct GaussmatOptions {
5552    /// separable: `bool` -> Generate separable Gaussian
5553    /// default: false
5554    pub separable: bool,
5555    /// precision: `Precision` -> Generate with this precision
5556    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5557    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5558    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5559    ///  `Last` -> VIPS_PRECISION_LAST = 3
5560    pub precision: Precision,
5561}
5562
5563impl std::default::Default for GaussmatOptions {
5564    fn default() -> Self {
5565        GaussmatOptions {
5566            separable: false,
5567            precision: Precision::Integer,
5568        }
5569    }
5570}
5571
5572/// VipsGaussmat (gaussmat), make a gaussian image
5573/// sigma: `f64` -> Sigma of Gaussian
5574/// min: 0.000001, max: 10000, default: 1
5575/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5576/// min: 0.000001, max: 10000, default: 0.1
5577/// gaussmat_options: `&GaussmatOptions` -> optional arguments
5578/// returns `VipsImage` - Output image
5579pub fn gaussmat_with_opts(
5580    sigma: f64,
5581    min_ampl: f64,
5582    gaussmat_options: &GaussmatOptions,
5583) -> Result<VipsImage> {
5584    unsafe {
5585        let sigma_in: f64 = sigma;
5586        let min_ampl_in: f64 = min_ampl;
5587        let mut out_out: *mut bindings::VipsImage = null_mut();
5588
5589        let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5590        let separable_in_name = utils::new_c_string("separable")?;
5591
5592        let precision_in: i32 = gaussmat_options.precision as i32;
5593        let precision_in_name = utils::new_c_string("precision")?;
5594
5595        let vips_op_response = bindings::vips_gaussmat(
5596            &mut out_out,
5597            sigma_in,
5598            min_ampl_in,
5599            separable_in_name.as_ptr(),
5600            separable_in,
5601            precision_in_name.as_ptr(),
5602            precision_in,
5603            NULL,
5604        );
5605        utils::result(
5606            vips_op_response,
5607            VipsImage { ctx: out_out },
5608            Error::GaussmatError,
5609        )
5610    }
5611}
5612
5613/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5614/// sigma: `f64` -> Radius of Gaussian
5615/// min: 0.000001, max: 10000, default: 1
5616/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5617/// min: 0.000001, max: 10000, default: 0.1
5618/// returns `VipsImage` - Output image
5619pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5620    unsafe {
5621        let sigma_in: f64 = sigma;
5622        let min_ampl_in: f64 = min_ampl;
5623        let mut out_out: *mut bindings::VipsImage = null_mut();
5624
5625        let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5626        utils::result(
5627            vips_op_response,
5628            VipsImage { ctx: out_out },
5629            Error::LogmatError,
5630        )
5631    }
5632}
5633
5634/// Options for logmat operation
5635#[derive(Clone, Debug)]
5636pub struct LogmatOptions {
5637    /// separable: `bool` -> Generate separable Gaussian
5638    /// default: false
5639    pub separable: bool,
5640    /// precision: `Precision` -> Generate with this precision
5641    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5642    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5643    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5644    ///  `Last` -> VIPS_PRECISION_LAST = 3
5645    pub precision: Precision,
5646}
5647
5648impl std::default::Default for LogmatOptions {
5649    fn default() -> Self {
5650        LogmatOptions {
5651            separable: false,
5652            precision: Precision::Integer,
5653        }
5654    }
5655}
5656
5657/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5658/// sigma: `f64` -> Radius of Gaussian
5659/// min: 0.000001, max: 10000, default: 1
5660/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5661/// min: 0.000001, max: 10000, default: 0.1
5662/// logmat_options: `&LogmatOptions` -> optional arguments
5663/// returns `VipsImage` - Output image
5664pub fn logmat_with_opts(
5665    sigma: f64,
5666    min_ampl: f64,
5667    logmat_options: &LogmatOptions,
5668) -> Result<VipsImage> {
5669    unsafe {
5670        let sigma_in: f64 = sigma;
5671        let min_ampl_in: f64 = min_ampl;
5672        let mut out_out: *mut bindings::VipsImage = null_mut();
5673
5674        let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5675        let separable_in_name = utils::new_c_string("separable")?;
5676
5677        let precision_in: i32 = logmat_options.precision as i32;
5678        let precision_in_name = utils::new_c_string("precision")?;
5679
5680        let vips_op_response = bindings::vips_logmat(
5681            &mut out_out,
5682            sigma_in,
5683            min_ampl_in,
5684            separable_in_name.as_ptr(),
5685            separable_in,
5686            precision_in_name.as_ptr(),
5687            precision_in,
5688            NULL,
5689        );
5690        utils::result(
5691            vips_op_response,
5692            VipsImage { ctx: out_out },
5693            Error::LogmatError,
5694        )
5695    }
5696}
5697
5698/// VipsText (text), make a text image
5699/// text: `&str` -> Text to render
5700/// returns `VipsImage` - Output image
5701pub fn text(text: &str) -> Result<VipsImage> {
5702    unsafe {
5703        let text_in: CString = utils::new_c_string(text)?;
5704        let mut out_out: *mut bindings::VipsImage = null_mut();
5705
5706        let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5707        utils::result(
5708            vips_op_response,
5709            VipsImage { ctx: out_out },
5710            Error::TextError,
5711        )
5712    }
5713}
5714
5715/// Options for text operation
5716#[derive(Clone, Debug)]
5717pub struct TextOptions {
5718    /// font: `String` -> Font to render with
5719    pub font: String,
5720    /// width: `i32` -> Maximum image width in pixels
5721    /// min: 0, max: 10000000, default: 0
5722    pub width: i32,
5723    /// height: `i32` -> Maximum image height in pixels
5724    /// min: 0, max: 10000000, default: 0
5725    pub height: i32,
5726    /// align: `Align` -> Align on the low, centre or high edge
5727    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
5728    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
5729    ///  `High` -> VIPS_ALIGN_HIGH = 2
5730    ///  `Last` -> VIPS_ALIGN_LAST = 3
5731    pub align: Align,
5732    /// justify: `bool` -> Justify lines
5733    /// default: false
5734    pub justify: bool,
5735    /// dpi: `i32` -> DPI to render at
5736    /// min: 1, max: 1000000, default: 72
5737    pub dpi: i32,
5738    /// autofit_dpi: `i32` -> DPI selected by autofit
5739    /// min: 1, max: 1000000, default: 72
5740    pub autofit_dpi: i32,
5741    /// spacing: `i32` -> Line spacing
5742    /// min: -1000000, max: 1000000, default: 0
5743    pub spacing: i32,
5744    /// fontfile: `String` -> Load this font file
5745    pub fontfile: String,
5746    /// rgba: `bool` -> Enable RGBA output
5747    /// default: false
5748    pub rgba: bool,
5749    /// wrap: `TextWrap` -> Wrap lines on word or character boundaries
5750    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0 [DEFAULT]
5751    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
5752    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
5753    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
5754    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
5755    pub wrap: TextWrap,
5756}
5757
5758impl std::default::Default for TextOptions {
5759    fn default() -> Self {
5760        TextOptions {
5761            font: String::new(),
5762            width: i32::from(0),
5763            height: i32::from(0),
5764            align: Align::Low,
5765            justify: false,
5766            dpi: i32::from(72),
5767            autofit_dpi: i32::from(72),
5768            spacing: i32::from(0),
5769            fontfile: String::new(),
5770            rgba: false,
5771            wrap: TextWrap::Word,
5772        }
5773    }
5774}
5775
5776/// VipsText (text), make a text image
5777/// text: `&str` -> Text to render
5778/// text_options: `&TextOptions` -> optional arguments
5779/// returns `VipsImage` - Output image
5780pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5781    unsafe {
5782        let text_in: CString = utils::new_c_string(text)?;
5783        let mut out_out: *mut bindings::VipsImage = null_mut();
5784
5785        let font_in: CString = utils::new_c_string(&text_options.font)?;
5786        let font_in_name = utils::new_c_string("font")?;
5787
5788        let width_in: i32 = text_options.width;
5789        let width_in_name = utils::new_c_string("width")?;
5790
5791        let height_in: i32 = text_options.height;
5792        let height_in_name = utils::new_c_string("height")?;
5793
5794        let align_in: i32 = text_options.align as i32;
5795        let align_in_name = utils::new_c_string("align")?;
5796
5797        let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5798        let justify_in_name = utils::new_c_string("justify")?;
5799
5800        let dpi_in: i32 = text_options.dpi;
5801        let dpi_in_name = utils::new_c_string("dpi")?;
5802
5803        let autofit_dpi_in: i32 = text_options.autofit_dpi;
5804        let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5805
5806        let spacing_in: i32 = text_options.spacing;
5807        let spacing_in_name = utils::new_c_string("spacing")?;
5808
5809        let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5810        let fontfile_in_name = utils::new_c_string("fontfile")?;
5811
5812        let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5813        let rgba_in_name = utils::new_c_string("rgba")?;
5814
5815        let wrap_in: i32 = text_options.wrap as i32;
5816        let wrap_in_name = utils::new_c_string("wrap")?;
5817
5818        let vips_op_response = bindings::vips_text(
5819            &mut out_out,
5820            text_in.as_ptr(),
5821            font_in_name.as_ptr(),
5822            font_in.as_ptr(),
5823            width_in_name.as_ptr(),
5824            width_in,
5825            height_in_name.as_ptr(),
5826            height_in,
5827            align_in_name.as_ptr(),
5828            align_in,
5829            justify_in_name.as_ptr(),
5830            justify_in,
5831            dpi_in_name.as_ptr(),
5832            dpi_in,
5833            autofit_dpi_in_name.as_ptr(),
5834            autofit_dpi_in,
5835            spacing_in_name.as_ptr(),
5836            spacing_in,
5837            fontfile_in_name.as_ptr(),
5838            fontfile_in.as_ptr(),
5839            rgba_in_name.as_ptr(),
5840            rgba_in,
5841            wrap_in_name.as_ptr(),
5842            wrap_in,
5843            NULL,
5844        );
5845        utils::result(
5846            vips_op_response,
5847            VipsImage { ctx: out_out },
5848            Error::TextError,
5849        )
5850    }
5851}
5852
5853/// VipsEye (eye), make an image showing the eye's spatial response
5854/// width: `i32` -> Image width in pixels
5855/// min: 1, max: 10000000, default: 1
5856/// height: `i32` -> Image height in pixels
5857/// min: 1, max: 10000000, default: 1
5858/// returns `VipsImage` - Output image
5859pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
5860    unsafe {
5861        let width_in: i32 = width;
5862        let height_in: i32 = height;
5863        let mut out_out: *mut bindings::VipsImage = null_mut();
5864
5865        let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
5866        utils::result(
5867            vips_op_response,
5868            VipsImage { ctx: out_out },
5869            Error::EyeError,
5870        )
5871    }
5872}
5873
5874/// Options for eye operation
5875#[derive(Clone, Debug)]
5876pub struct EyeOptions {
5877    /// uchar: `bool` -> Output an unsigned char image
5878    /// default: false
5879    pub uchar: bool,
5880    /// factor: `f64` -> Maximum spatial frequency
5881    /// min: 0, max: 1, default: 0.5
5882    pub factor: f64,
5883}
5884
5885impl std::default::Default for EyeOptions {
5886    fn default() -> Self {
5887        EyeOptions {
5888            uchar: false,
5889            factor: f64::from(0.5),
5890        }
5891    }
5892}
5893
5894/// VipsEye (eye), make an image showing the eye's spatial response
5895/// width: `i32` -> Image width in pixels
5896/// min: 1, max: 10000000, default: 1
5897/// height: `i32` -> Image height in pixels
5898/// min: 1, max: 10000000, default: 1
5899/// eye_options: `&EyeOptions` -> optional arguments
5900/// returns `VipsImage` - Output image
5901pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
5902    unsafe {
5903        let width_in: i32 = width;
5904        let height_in: i32 = height;
5905        let mut out_out: *mut bindings::VipsImage = null_mut();
5906
5907        let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
5908        let uchar_in_name = utils::new_c_string("uchar")?;
5909
5910        let factor_in: f64 = eye_options.factor;
5911        let factor_in_name = utils::new_c_string("factor")?;
5912
5913        let vips_op_response = bindings::vips_eye(
5914            &mut out_out,
5915            width_in,
5916            height_in,
5917            uchar_in_name.as_ptr(),
5918            uchar_in,
5919            factor_in_name.as_ptr(),
5920            factor_in,
5921            NULL,
5922        );
5923        utils::result(
5924            vips_op_response,
5925            VipsImage { ctx: out_out },
5926            Error::EyeError,
5927        )
5928    }
5929}
5930
5931/// VipsGrey (grey), make a grey ramp image
5932/// width: `i32` -> Image width in pixels
5933/// min: 1, max: 10000000, default: 1
5934/// height: `i32` -> Image height in pixels
5935/// min: 1, max: 10000000, default: 1
5936/// returns `VipsImage` - Output image
5937pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
5938    unsafe {
5939        let width_in: i32 = width;
5940        let height_in: i32 = height;
5941        let mut out_out: *mut bindings::VipsImage = null_mut();
5942
5943        let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
5944        utils::result(
5945            vips_op_response,
5946            VipsImage { ctx: out_out },
5947            Error::GreyError,
5948        )
5949    }
5950}
5951
5952/// Options for grey operation
5953#[derive(Clone, Debug)]
5954pub struct GreyOptions {
5955    /// uchar: `bool` -> Output an unsigned char image
5956    /// default: false
5957    pub uchar: bool,
5958}
5959
5960impl std::default::Default for GreyOptions {
5961    fn default() -> Self {
5962        GreyOptions { uchar: false }
5963    }
5964}
5965
5966/// VipsGrey (grey), make a grey ramp image
5967/// width: `i32` -> Image width in pixels
5968/// min: 1, max: 10000000, default: 1
5969/// height: `i32` -> Image height in pixels
5970/// min: 1, max: 10000000, default: 1
5971/// grey_options: `&GreyOptions` -> optional arguments
5972/// returns `VipsImage` - Output image
5973pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
5974    unsafe {
5975        let width_in: i32 = width;
5976        let height_in: i32 = height;
5977        let mut out_out: *mut bindings::VipsImage = null_mut();
5978
5979        let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
5980        let uchar_in_name = utils::new_c_string("uchar")?;
5981
5982        let vips_op_response = bindings::vips_grey(
5983            &mut out_out,
5984            width_in,
5985            height_in,
5986            uchar_in_name.as_ptr(),
5987            uchar_in,
5988            NULL,
5989        );
5990        utils::result(
5991            vips_op_response,
5992            VipsImage { ctx: out_out },
5993            Error::GreyError,
5994        )
5995    }
5996}
5997
5998/// VipsZone (zone), make a zone plate
5999/// width: `i32` -> Image width in pixels
6000/// min: 1, max: 10000000, default: 1
6001/// height: `i32` -> Image height in pixels
6002/// min: 1, max: 10000000, default: 1
6003/// returns `VipsImage` - Output image
6004pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6005    unsafe {
6006        let width_in: i32 = width;
6007        let height_in: i32 = height;
6008        let mut out_out: *mut bindings::VipsImage = null_mut();
6009
6010        let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6011        utils::result(
6012            vips_op_response,
6013            VipsImage { ctx: out_out },
6014            Error::ZoneError,
6015        )
6016    }
6017}
6018
6019/// Options for zone operation
6020#[derive(Clone, Debug)]
6021pub struct ZoneOptions {
6022    /// uchar: `bool` -> Output an unsigned char image
6023    /// default: false
6024    pub uchar: bool,
6025}
6026
6027impl std::default::Default for ZoneOptions {
6028    fn default() -> Self {
6029        ZoneOptions { uchar: false }
6030    }
6031}
6032
6033/// VipsZone (zone), make a zone plate
6034/// width: `i32` -> Image width in pixels
6035/// min: 1, max: 10000000, default: 1
6036/// height: `i32` -> Image height in pixels
6037/// min: 1, max: 10000000, default: 1
6038/// zone_options: `&ZoneOptions` -> optional arguments
6039/// returns `VipsImage` - Output image
6040pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6041    unsafe {
6042        let width_in: i32 = width;
6043        let height_in: i32 = height;
6044        let mut out_out: *mut bindings::VipsImage = null_mut();
6045
6046        let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6047        let uchar_in_name = utils::new_c_string("uchar")?;
6048
6049        let vips_op_response = bindings::vips_zone(
6050            &mut out_out,
6051            width_in,
6052            height_in,
6053            uchar_in_name.as_ptr(),
6054            uchar_in,
6055            NULL,
6056        );
6057        utils::result(
6058            vips_op_response,
6059            VipsImage { ctx: out_out },
6060            Error::ZoneError,
6061        )
6062    }
6063}
6064
6065/// VipsSines (sines), make a 2D sine wave
6066/// width: `i32` -> Image width in pixels
6067/// min: 1, max: 10000000, default: 1
6068/// height: `i32` -> Image height in pixels
6069/// min: 1, max: 10000000, default: 1
6070/// returns `VipsImage` - Output image
6071pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6072    unsafe {
6073        let width_in: i32 = width;
6074        let height_in: i32 = height;
6075        let mut out_out: *mut bindings::VipsImage = null_mut();
6076
6077        let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6078        utils::result(
6079            vips_op_response,
6080            VipsImage { ctx: out_out },
6081            Error::SineError,
6082        )
6083    }
6084}
6085
6086/// Options for sines operation
6087#[derive(Clone, Debug)]
6088pub struct SineOptions {
6089    /// uchar: `bool` -> Output an unsigned char image
6090    /// default: false
6091    pub uchar: bool,
6092    /// hfreq: `f64` -> Horizontal spatial frequency
6093    /// min: 0, max: 10000, default: 0.5
6094    pub hfreq: f64,
6095    /// vfreq: `f64` -> Vertical spatial frequency
6096    /// min: 0, max: 10000, default: 0.5
6097    pub vfreq: f64,
6098}
6099
6100impl std::default::Default for SineOptions {
6101    fn default() -> Self {
6102        SineOptions {
6103            uchar: false,
6104            hfreq: f64::from(0.5),
6105            vfreq: f64::from(0.5),
6106        }
6107    }
6108}
6109
6110/// VipsSines (sines), make a 2D sine wave
6111/// width: `i32` -> Image width in pixels
6112/// min: 1, max: 10000000, default: 1
6113/// height: `i32` -> Image height in pixels
6114/// min: 1, max: 10000000, default: 1
6115/// sines_options: `&SineOptions` -> optional arguments
6116/// returns `VipsImage` - Output image
6117pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6118    unsafe {
6119        let width_in: i32 = width;
6120        let height_in: i32 = height;
6121        let mut out_out: *mut bindings::VipsImage = null_mut();
6122
6123        let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6124        let uchar_in_name = utils::new_c_string("uchar")?;
6125
6126        let hfreq_in: f64 = sines_options.hfreq;
6127        let hfreq_in_name = utils::new_c_string("hfreq")?;
6128
6129        let vfreq_in: f64 = sines_options.vfreq;
6130        let vfreq_in_name = utils::new_c_string("vfreq")?;
6131
6132        let vips_op_response = bindings::vips_sines(
6133            &mut out_out,
6134            width_in,
6135            height_in,
6136            uchar_in_name.as_ptr(),
6137            uchar_in,
6138            hfreq_in_name.as_ptr(),
6139            hfreq_in,
6140            vfreq_in_name.as_ptr(),
6141            vfreq_in,
6142            NULL,
6143        );
6144        utils::result(
6145            vips_op_response,
6146            VipsImage { ctx: out_out },
6147            Error::SineError,
6148        )
6149    }
6150}
6151
6152/// VipsMaskIdeal (mask_ideal), make an ideal filter
6153/// width: `i32` -> Image width in pixels
6154/// min: 1, max: 10000000, default: 1
6155/// height: `i32` -> Image height in pixels
6156/// min: 1, max: 10000000, default: 1
6157/// frequency_cutoff: `f64` -> Frequency cutoff
6158/// min: 0, max: 1000000, default: 0.5
6159/// returns `VipsImage` - Output image
6160pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6161    unsafe {
6162        let width_in: i32 = width;
6163        let height_in: i32 = height;
6164        let frequency_cutoff_in: f64 = frequency_cutoff;
6165        let mut out_out: *mut bindings::VipsImage = null_mut();
6166
6167        let vips_op_response =
6168            bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6169        utils::result(
6170            vips_op_response,
6171            VipsImage { ctx: out_out },
6172            Error::MaskIdealError,
6173        )
6174    }
6175}
6176
6177/// Options for mask_ideal operation
6178#[derive(Clone, Debug)]
6179pub struct MaskIdealOptions {
6180    /// uchar: `bool` -> Output an unsigned char image
6181    /// default: false
6182    pub uchar: bool,
6183    /// nodc: `bool` -> Remove DC component
6184    /// default: false
6185    pub nodc: bool,
6186    /// reject: `bool` -> Invert the sense of the filter
6187    /// default: false
6188    pub reject: bool,
6189    /// optical: `bool` -> Rotate quadrants to optical space
6190    /// default: false
6191    pub optical: bool,
6192}
6193
6194impl std::default::Default for MaskIdealOptions {
6195    fn default() -> Self {
6196        MaskIdealOptions {
6197            uchar: false,
6198            nodc: false,
6199            reject: false,
6200            optical: false,
6201        }
6202    }
6203}
6204
6205/// VipsMaskIdeal (mask_ideal), make an ideal filter
6206/// width: `i32` -> Image width in pixels
6207/// min: 1, max: 10000000, default: 1
6208/// height: `i32` -> Image height in pixels
6209/// min: 1, max: 10000000, default: 1
6210/// frequency_cutoff: `f64` -> Frequency cutoff
6211/// min: 0, max: 1000000, default: 0.5
6212/// mask_ideal_options: `&MaskIdealOptions` -> optional arguments
6213/// returns `VipsImage` - Output image
6214pub fn mask_ideal_with_opts(
6215    width: i32,
6216    height: i32,
6217    frequency_cutoff: f64,
6218    mask_ideal_options: &MaskIdealOptions,
6219) -> Result<VipsImage> {
6220    unsafe {
6221        let width_in: i32 = width;
6222        let height_in: i32 = height;
6223        let frequency_cutoff_in: f64 = frequency_cutoff;
6224        let mut out_out: *mut bindings::VipsImage = null_mut();
6225
6226        let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6227        let uchar_in_name = utils::new_c_string("uchar")?;
6228
6229        let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6230        let nodc_in_name = utils::new_c_string("nodc")?;
6231
6232        let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6233        let reject_in_name = utils::new_c_string("reject")?;
6234
6235        let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6236        let optical_in_name = utils::new_c_string("optical")?;
6237
6238        let vips_op_response = bindings::vips_mask_ideal(
6239            &mut out_out,
6240            width_in,
6241            height_in,
6242            frequency_cutoff_in,
6243            uchar_in_name.as_ptr(),
6244            uchar_in,
6245            nodc_in_name.as_ptr(),
6246            nodc_in,
6247            reject_in_name.as_ptr(),
6248            reject_in,
6249            optical_in_name.as_ptr(),
6250            optical_in,
6251            NULL,
6252        );
6253        utils::result(
6254            vips_op_response,
6255            VipsImage { ctx: out_out },
6256            Error::MaskIdealError,
6257        )
6258    }
6259}
6260
6261/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6262/// width: `i32` -> Image width in pixels
6263/// min: 1, max: 10000000, default: 1
6264/// height: `i32` -> Image height in pixels
6265/// min: 1, max: 10000000, default: 1
6266/// frequency_cutoff: `f64` -> Frequency cutoff
6267/// min: 0, max: 1000000, default: 0.5
6268/// ringwidth: `f64` -> Ringwidth
6269/// min: 0, max: 1000000, default: 0.5
6270/// returns `VipsImage` - Output image
6271pub fn mask_ideal_ring(
6272    width: i32,
6273    height: i32,
6274    frequency_cutoff: f64,
6275    ringwidth: f64,
6276) -> Result<VipsImage> {
6277    unsafe {
6278        let width_in: i32 = width;
6279        let height_in: i32 = height;
6280        let frequency_cutoff_in: f64 = frequency_cutoff;
6281        let ringwidth_in: f64 = ringwidth;
6282        let mut out_out: *mut bindings::VipsImage = null_mut();
6283
6284        let vips_op_response = bindings::vips_mask_ideal_ring(
6285            &mut out_out,
6286            width_in,
6287            height_in,
6288            frequency_cutoff_in,
6289            ringwidth_in,
6290            NULL,
6291        );
6292        utils::result(
6293            vips_op_response,
6294            VipsImage { ctx: out_out },
6295            Error::MaskIdealRingError,
6296        )
6297    }
6298}
6299
6300/// Options for mask_ideal_ring operation
6301#[derive(Clone, Debug)]
6302pub struct MaskIdealRingOptions {
6303    /// uchar: `bool` -> Output an unsigned char image
6304    /// default: false
6305    pub uchar: bool,
6306    /// nodc: `bool` -> Remove DC component
6307    /// default: false
6308    pub nodc: bool,
6309    /// reject: `bool` -> Invert the sense of the filter
6310    /// default: false
6311    pub reject: bool,
6312    /// optical: `bool` -> Rotate quadrants to optical space
6313    /// default: false
6314    pub optical: bool,
6315}
6316
6317impl std::default::Default for MaskIdealRingOptions {
6318    fn default() -> Self {
6319        MaskIdealRingOptions {
6320            uchar: false,
6321            nodc: false,
6322            reject: false,
6323            optical: false,
6324        }
6325    }
6326}
6327
6328/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6329/// width: `i32` -> Image width in pixels
6330/// min: 1, max: 10000000, default: 1
6331/// height: `i32` -> Image height in pixels
6332/// min: 1, max: 10000000, default: 1
6333/// frequency_cutoff: `f64` -> Frequency cutoff
6334/// min: 0, max: 1000000, default: 0.5
6335/// ringwidth: `f64` -> Ringwidth
6336/// min: 0, max: 1000000, default: 0.5
6337/// mask_ideal_ring_options: `&MaskIdealRingOptions` -> optional arguments
6338/// returns `VipsImage` - Output image
6339pub fn mask_ideal_ring_with_opts(
6340    width: i32,
6341    height: i32,
6342    frequency_cutoff: f64,
6343    ringwidth: f64,
6344    mask_ideal_ring_options: &MaskIdealRingOptions,
6345) -> Result<VipsImage> {
6346    unsafe {
6347        let width_in: i32 = width;
6348        let height_in: i32 = height;
6349        let frequency_cutoff_in: f64 = frequency_cutoff;
6350        let ringwidth_in: f64 = ringwidth;
6351        let mut out_out: *mut bindings::VipsImage = null_mut();
6352
6353        let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6354        let uchar_in_name = utils::new_c_string("uchar")?;
6355
6356        let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6357        let nodc_in_name = utils::new_c_string("nodc")?;
6358
6359        let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6360        let reject_in_name = utils::new_c_string("reject")?;
6361
6362        let optical_in: i32 = if mask_ideal_ring_options.optical {
6363            1
6364        } else {
6365            0
6366        };
6367        let optical_in_name = utils::new_c_string("optical")?;
6368
6369        let vips_op_response = bindings::vips_mask_ideal_ring(
6370            &mut out_out,
6371            width_in,
6372            height_in,
6373            frequency_cutoff_in,
6374            ringwidth_in,
6375            uchar_in_name.as_ptr(),
6376            uchar_in,
6377            nodc_in_name.as_ptr(),
6378            nodc_in,
6379            reject_in_name.as_ptr(),
6380            reject_in,
6381            optical_in_name.as_ptr(),
6382            optical_in,
6383            NULL,
6384        );
6385        utils::result(
6386            vips_op_response,
6387            VipsImage { ctx: out_out },
6388            Error::MaskIdealRingError,
6389        )
6390    }
6391}
6392
6393/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6394/// width: `i32` -> Image width in pixels
6395/// min: 1, max: 10000000, default: 1
6396/// height: `i32` -> Image height in pixels
6397/// min: 1, max: 10000000, default: 1
6398/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6399/// min: 0, max: 1000000, default: 0.5
6400/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6401/// min: 0, max: 1000000, default: 0.5
6402/// radius: `f64` -> Radius of circle
6403/// min: 0, max: 1000000, default: 0.1
6404/// returns `VipsImage` - Output image
6405pub fn mask_ideal_band(
6406    width: i32,
6407    height: i32,
6408    frequency_cutoff_x: f64,
6409    frequency_cutoff_y: f64,
6410    radius: f64,
6411) -> Result<VipsImage> {
6412    unsafe {
6413        let width_in: i32 = width;
6414        let height_in: i32 = height;
6415        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6416        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6417        let radius_in: f64 = radius;
6418        let mut out_out: *mut bindings::VipsImage = null_mut();
6419
6420        let vips_op_response = bindings::vips_mask_ideal_band(
6421            &mut out_out,
6422            width_in,
6423            height_in,
6424            frequency_cutoff_x_in,
6425            frequency_cutoff_y_in,
6426            radius_in,
6427            NULL,
6428        );
6429        utils::result(
6430            vips_op_response,
6431            VipsImage { ctx: out_out },
6432            Error::MaskIdealBandError,
6433        )
6434    }
6435}
6436
6437/// Options for mask_ideal_band operation
6438#[derive(Clone, Debug)]
6439pub struct MaskIdealBandOptions {
6440    /// uchar: `bool` -> Output an unsigned char image
6441    /// default: false
6442    pub uchar: bool,
6443    /// nodc: `bool` -> Remove DC component
6444    /// default: false
6445    pub nodc: bool,
6446    /// reject: `bool` -> Invert the sense of the filter
6447    /// default: false
6448    pub reject: bool,
6449    /// optical: `bool` -> Rotate quadrants to optical space
6450    /// default: false
6451    pub optical: bool,
6452}
6453
6454impl std::default::Default for MaskIdealBandOptions {
6455    fn default() -> Self {
6456        MaskIdealBandOptions {
6457            uchar: false,
6458            nodc: false,
6459            reject: false,
6460            optical: false,
6461        }
6462    }
6463}
6464
6465/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6466/// width: `i32` -> Image width in pixels
6467/// min: 1, max: 10000000, default: 1
6468/// height: `i32` -> Image height in pixels
6469/// min: 1, max: 10000000, default: 1
6470/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6471/// min: 0, max: 1000000, default: 0.5
6472/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6473/// min: 0, max: 1000000, default: 0.5
6474/// radius: `f64` -> Radius of circle
6475/// min: 0, max: 1000000, default: 0.1
6476/// mask_ideal_band_options: `&MaskIdealBandOptions` -> optional arguments
6477/// returns `VipsImage` - Output image
6478pub fn mask_ideal_band_with_opts(
6479    width: i32,
6480    height: i32,
6481    frequency_cutoff_x: f64,
6482    frequency_cutoff_y: f64,
6483    radius: f64,
6484    mask_ideal_band_options: &MaskIdealBandOptions,
6485) -> Result<VipsImage> {
6486    unsafe {
6487        let width_in: i32 = width;
6488        let height_in: i32 = height;
6489        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6490        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6491        let radius_in: f64 = radius;
6492        let mut out_out: *mut bindings::VipsImage = null_mut();
6493
6494        let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6495        let uchar_in_name = utils::new_c_string("uchar")?;
6496
6497        let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6498        let nodc_in_name = utils::new_c_string("nodc")?;
6499
6500        let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6501        let reject_in_name = utils::new_c_string("reject")?;
6502
6503        let optical_in: i32 = if mask_ideal_band_options.optical {
6504            1
6505        } else {
6506            0
6507        };
6508        let optical_in_name = utils::new_c_string("optical")?;
6509
6510        let vips_op_response = bindings::vips_mask_ideal_band(
6511            &mut out_out,
6512            width_in,
6513            height_in,
6514            frequency_cutoff_x_in,
6515            frequency_cutoff_y_in,
6516            radius_in,
6517            uchar_in_name.as_ptr(),
6518            uchar_in,
6519            nodc_in_name.as_ptr(),
6520            nodc_in,
6521            reject_in_name.as_ptr(),
6522            reject_in,
6523            optical_in_name.as_ptr(),
6524            optical_in,
6525            NULL,
6526        );
6527        utils::result(
6528            vips_op_response,
6529            VipsImage { ctx: out_out },
6530            Error::MaskIdealBandError,
6531        )
6532    }
6533}
6534
6535/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6536/// width: `i32` -> Image width in pixels
6537/// min: 1, max: 10000000, default: 1
6538/// height: `i32` -> Image height in pixels
6539/// min: 1, max: 10000000, default: 1
6540/// order: `f64` -> Filter order
6541/// min: 1, max: 1000000, default: 1
6542/// frequency_cutoff: `f64` -> Frequency cutoff
6543/// min: 0, max: 1000000, default: 0.5
6544/// amplitude_cutoff: `f64` -> Amplitude cutoff
6545/// min: 0, max: 1, default: 0.5
6546/// returns `VipsImage` - Output image
6547pub fn mask_butterworth(
6548    width: i32,
6549    height: i32,
6550    order: f64,
6551    frequency_cutoff: f64,
6552    amplitude_cutoff: f64,
6553) -> Result<VipsImage> {
6554    unsafe {
6555        let width_in: i32 = width;
6556        let height_in: i32 = height;
6557        let order_in: f64 = order;
6558        let frequency_cutoff_in: f64 = frequency_cutoff;
6559        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6560        let mut out_out: *mut bindings::VipsImage = null_mut();
6561
6562        let vips_op_response = bindings::vips_mask_butterworth(
6563            &mut out_out,
6564            width_in,
6565            height_in,
6566            order_in,
6567            frequency_cutoff_in,
6568            amplitude_cutoff_in,
6569            NULL,
6570        );
6571        utils::result(
6572            vips_op_response,
6573            VipsImage { ctx: out_out },
6574            Error::MaskButterworthError,
6575        )
6576    }
6577}
6578
6579/// Options for mask_butterworth operation
6580#[derive(Clone, Debug)]
6581pub struct MaskButterworthOptions {
6582    /// uchar: `bool` -> Output an unsigned char image
6583    /// default: false
6584    pub uchar: bool,
6585    /// nodc: `bool` -> Remove DC component
6586    /// default: false
6587    pub nodc: bool,
6588    /// reject: `bool` -> Invert the sense of the filter
6589    /// default: false
6590    pub reject: bool,
6591    /// optical: `bool` -> Rotate quadrants to optical space
6592    /// default: false
6593    pub optical: bool,
6594}
6595
6596impl std::default::Default for MaskButterworthOptions {
6597    fn default() -> Self {
6598        MaskButterworthOptions {
6599            uchar: false,
6600            nodc: false,
6601            reject: false,
6602            optical: false,
6603        }
6604    }
6605}
6606
6607/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6608/// width: `i32` -> Image width in pixels
6609/// min: 1, max: 10000000, default: 1
6610/// height: `i32` -> Image height in pixels
6611/// min: 1, max: 10000000, default: 1
6612/// order: `f64` -> Filter order
6613/// min: 1, max: 1000000, default: 1
6614/// frequency_cutoff: `f64` -> Frequency cutoff
6615/// min: 0, max: 1000000, default: 0.5
6616/// amplitude_cutoff: `f64` -> Amplitude cutoff
6617/// min: 0, max: 1, default: 0.5
6618/// mask_butterworth_options: `&MaskButterworthOptions` -> optional arguments
6619/// returns `VipsImage` - Output image
6620pub fn mask_butterworth_with_opts(
6621    width: i32,
6622    height: i32,
6623    order: f64,
6624    frequency_cutoff: f64,
6625    amplitude_cutoff: f64,
6626    mask_butterworth_options: &MaskButterworthOptions,
6627) -> Result<VipsImage> {
6628    unsafe {
6629        let width_in: i32 = width;
6630        let height_in: i32 = height;
6631        let order_in: f64 = order;
6632        let frequency_cutoff_in: f64 = frequency_cutoff;
6633        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6634        let mut out_out: *mut bindings::VipsImage = null_mut();
6635
6636        let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6637        let uchar_in_name = utils::new_c_string("uchar")?;
6638
6639        let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6640        let nodc_in_name = utils::new_c_string("nodc")?;
6641
6642        let reject_in: i32 = if mask_butterworth_options.reject {
6643            1
6644        } else {
6645            0
6646        };
6647        let reject_in_name = utils::new_c_string("reject")?;
6648
6649        let optical_in: i32 = if mask_butterworth_options.optical {
6650            1
6651        } else {
6652            0
6653        };
6654        let optical_in_name = utils::new_c_string("optical")?;
6655
6656        let vips_op_response = bindings::vips_mask_butterworth(
6657            &mut out_out,
6658            width_in,
6659            height_in,
6660            order_in,
6661            frequency_cutoff_in,
6662            amplitude_cutoff_in,
6663            uchar_in_name.as_ptr(),
6664            uchar_in,
6665            nodc_in_name.as_ptr(),
6666            nodc_in,
6667            reject_in_name.as_ptr(),
6668            reject_in,
6669            optical_in_name.as_ptr(),
6670            optical_in,
6671            NULL,
6672        );
6673        utils::result(
6674            vips_op_response,
6675            VipsImage { ctx: out_out },
6676            Error::MaskButterworthError,
6677        )
6678    }
6679}
6680
6681/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6682/// width: `i32` -> Image width in pixels
6683/// min: 1, max: 10000000, default: 1
6684/// height: `i32` -> Image height in pixels
6685/// min: 1, max: 10000000, default: 1
6686/// order: `f64` -> Filter order
6687/// min: 1, max: 1000000, default: 1
6688/// frequency_cutoff: `f64` -> Frequency cutoff
6689/// min: 0, max: 1000000, default: 0.5
6690/// amplitude_cutoff: `f64` -> Amplitude cutoff
6691/// min: 0, max: 1, default: 0.5
6692/// ringwidth: `f64` -> Ringwidth
6693/// min: 0, max: 1000000, default: 0.1
6694/// returns `VipsImage` - Output image
6695pub fn mask_butterworth_ring(
6696    width: i32,
6697    height: i32,
6698    order: f64,
6699    frequency_cutoff: f64,
6700    amplitude_cutoff: f64,
6701    ringwidth: f64,
6702) -> Result<VipsImage> {
6703    unsafe {
6704        let width_in: i32 = width;
6705        let height_in: i32 = height;
6706        let order_in: f64 = order;
6707        let frequency_cutoff_in: f64 = frequency_cutoff;
6708        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6709        let ringwidth_in: f64 = ringwidth;
6710        let mut out_out: *mut bindings::VipsImage = null_mut();
6711
6712        let vips_op_response = bindings::vips_mask_butterworth_ring(
6713            &mut out_out,
6714            width_in,
6715            height_in,
6716            order_in,
6717            frequency_cutoff_in,
6718            amplitude_cutoff_in,
6719            ringwidth_in,
6720            NULL,
6721        );
6722        utils::result(
6723            vips_op_response,
6724            VipsImage { ctx: out_out },
6725            Error::MaskButterworthRingError,
6726        )
6727    }
6728}
6729
6730/// Options for mask_butterworth_ring operation
6731#[derive(Clone, Debug)]
6732pub struct MaskButterworthRingOptions {
6733    /// uchar: `bool` -> Output an unsigned char image
6734    /// default: false
6735    pub uchar: bool,
6736    /// nodc: `bool` -> Remove DC component
6737    /// default: false
6738    pub nodc: bool,
6739    /// reject: `bool` -> Invert the sense of the filter
6740    /// default: false
6741    pub reject: bool,
6742    /// optical: `bool` -> Rotate quadrants to optical space
6743    /// default: false
6744    pub optical: bool,
6745}
6746
6747impl std::default::Default for MaskButterworthRingOptions {
6748    fn default() -> Self {
6749        MaskButterworthRingOptions {
6750            uchar: false,
6751            nodc: false,
6752            reject: false,
6753            optical: false,
6754        }
6755    }
6756}
6757
6758/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6759/// width: `i32` -> Image width in pixels
6760/// min: 1, max: 10000000, default: 1
6761/// height: `i32` -> Image height in pixels
6762/// min: 1, max: 10000000, default: 1
6763/// order: `f64` -> Filter order
6764/// min: 1, max: 1000000, default: 1
6765/// frequency_cutoff: `f64` -> Frequency cutoff
6766/// min: 0, max: 1000000, default: 0.5
6767/// amplitude_cutoff: `f64` -> Amplitude cutoff
6768/// min: 0, max: 1, default: 0.5
6769/// ringwidth: `f64` -> Ringwidth
6770/// min: 0, max: 1000000, default: 0.1
6771/// mask_butterworth_ring_options: `&MaskButterworthRingOptions` -> optional arguments
6772/// returns `VipsImage` - Output image
6773pub fn mask_butterworth_ring_with_opts(
6774    width: i32,
6775    height: i32,
6776    order: f64,
6777    frequency_cutoff: f64,
6778    amplitude_cutoff: f64,
6779    ringwidth: f64,
6780    mask_butterworth_ring_options: &MaskButterworthRingOptions,
6781) -> Result<VipsImage> {
6782    unsafe {
6783        let width_in: i32 = width;
6784        let height_in: i32 = height;
6785        let order_in: f64 = order;
6786        let frequency_cutoff_in: f64 = frequency_cutoff;
6787        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6788        let ringwidth_in: f64 = ringwidth;
6789        let mut out_out: *mut bindings::VipsImage = null_mut();
6790
6791        let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6792            1
6793        } else {
6794            0
6795        };
6796        let uchar_in_name = utils::new_c_string("uchar")?;
6797
6798        let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6799            1
6800        } else {
6801            0
6802        };
6803        let nodc_in_name = utils::new_c_string("nodc")?;
6804
6805        let reject_in: i32 = if mask_butterworth_ring_options.reject {
6806            1
6807        } else {
6808            0
6809        };
6810        let reject_in_name = utils::new_c_string("reject")?;
6811
6812        let optical_in: i32 = if mask_butterworth_ring_options.optical {
6813            1
6814        } else {
6815            0
6816        };
6817        let optical_in_name = utils::new_c_string("optical")?;
6818
6819        let vips_op_response = bindings::vips_mask_butterworth_ring(
6820            &mut out_out,
6821            width_in,
6822            height_in,
6823            order_in,
6824            frequency_cutoff_in,
6825            amplitude_cutoff_in,
6826            ringwidth_in,
6827            uchar_in_name.as_ptr(),
6828            uchar_in,
6829            nodc_in_name.as_ptr(),
6830            nodc_in,
6831            reject_in_name.as_ptr(),
6832            reject_in,
6833            optical_in_name.as_ptr(),
6834            optical_in,
6835            NULL,
6836        );
6837        utils::result(
6838            vips_op_response,
6839            VipsImage { ctx: out_out },
6840            Error::MaskButterworthRingError,
6841        )
6842    }
6843}
6844
6845/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
6846/// width: `i32` -> Image width in pixels
6847/// min: 1, max: 10000000, default: 1
6848/// height: `i32` -> Image height in pixels
6849/// min: 1, max: 10000000, default: 1
6850/// order: `f64` -> Filter order
6851/// min: 1, max: 1000000, default: 1
6852/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6853/// min: 0, max: 1000000, default: 0.5
6854/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6855/// min: 0, max: 1000000, default: 0.5
6856/// radius: `f64` -> Radius of circle
6857/// min: 0, max: 1000000, default: 0.1
6858/// amplitude_cutoff: `f64` -> Amplitude cutoff
6859/// min: 0, max: 1, default: 0.5
6860/// returns `VipsImage` - Output image
6861pub fn mask_butterworth_band(
6862    width: i32,
6863    height: i32,
6864    order: f64,
6865    frequency_cutoff_x: f64,
6866    frequency_cutoff_y: f64,
6867    radius: f64,
6868    amplitude_cutoff: f64,
6869) -> Result<VipsImage> {
6870    unsafe {
6871        let width_in: i32 = width;
6872        let height_in: i32 = height;
6873        let order_in: f64 = order;
6874        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6875        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6876        let radius_in: f64 = radius;
6877        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6878        let mut out_out: *mut bindings::VipsImage = null_mut();
6879
6880        let vips_op_response = bindings::vips_mask_butterworth_band(
6881            &mut out_out,
6882            width_in,
6883            height_in,
6884            order_in,
6885            frequency_cutoff_x_in,
6886            frequency_cutoff_y_in,
6887            radius_in,
6888            amplitude_cutoff_in,
6889            NULL,
6890        );
6891        utils::result(
6892            vips_op_response,
6893            VipsImage { ctx: out_out },
6894            Error::MaskButterworthBandError,
6895        )
6896    }
6897}
6898
6899/// Options for mask_butterworth_band operation
6900#[derive(Clone, Debug)]
6901pub struct MaskButterworthBandOptions {
6902    /// uchar: `bool` -> Output an unsigned char image
6903    /// default: false
6904    pub uchar: bool,
6905    /// nodc: `bool` -> Remove DC component
6906    /// default: false
6907    pub nodc: bool,
6908    /// reject: `bool` -> Invert the sense of the filter
6909    /// default: false
6910    pub reject: bool,
6911    /// optical: `bool` -> Rotate quadrants to optical space
6912    /// default: false
6913    pub optical: bool,
6914}
6915
6916impl std::default::Default for MaskButterworthBandOptions {
6917    fn default() -> Self {
6918        MaskButterworthBandOptions {
6919            uchar: false,
6920            nodc: false,
6921            reject: false,
6922            optical: false,
6923        }
6924    }
6925}
6926
6927/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
6928/// width: `i32` -> Image width in pixels
6929/// min: 1, max: 10000000, default: 1
6930/// height: `i32` -> Image height in pixels
6931/// min: 1, max: 10000000, default: 1
6932/// order: `f64` -> Filter order
6933/// min: 1, max: 1000000, default: 1
6934/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6935/// min: 0, max: 1000000, default: 0.5
6936/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6937/// min: 0, max: 1000000, default: 0.5
6938/// radius: `f64` -> Radius of circle
6939/// min: 0, max: 1000000, default: 0.1
6940/// amplitude_cutoff: `f64` -> Amplitude cutoff
6941/// min: 0, max: 1, default: 0.5
6942/// mask_butterworth_band_options: `&MaskButterworthBandOptions` -> optional arguments
6943/// returns `VipsImage` - Output image
6944pub fn mask_butterworth_band_with_opts(
6945    width: i32,
6946    height: i32,
6947    order: f64,
6948    frequency_cutoff_x: f64,
6949    frequency_cutoff_y: f64,
6950    radius: f64,
6951    amplitude_cutoff: f64,
6952    mask_butterworth_band_options: &MaskButterworthBandOptions,
6953) -> Result<VipsImage> {
6954    unsafe {
6955        let width_in: i32 = width;
6956        let height_in: i32 = height;
6957        let order_in: f64 = order;
6958        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6959        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6960        let radius_in: f64 = radius;
6961        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6962        let mut out_out: *mut bindings::VipsImage = null_mut();
6963
6964        let uchar_in: i32 = if mask_butterworth_band_options.uchar {
6965            1
6966        } else {
6967            0
6968        };
6969        let uchar_in_name = utils::new_c_string("uchar")?;
6970
6971        let nodc_in: i32 = if mask_butterworth_band_options.nodc {
6972            1
6973        } else {
6974            0
6975        };
6976        let nodc_in_name = utils::new_c_string("nodc")?;
6977
6978        let reject_in: i32 = if mask_butterworth_band_options.reject {
6979            1
6980        } else {
6981            0
6982        };
6983        let reject_in_name = utils::new_c_string("reject")?;
6984
6985        let optical_in: i32 = if mask_butterworth_band_options.optical {
6986            1
6987        } else {
6988            0
6989        };
6990        let optical_in_name = utils::new_c_string("optical")?;
6991
6992        let vips_op_response = bindings::vips_mask_butterworth_band(
6993            &mut out_out,
6994            width_in,
6995            height_in,
6996            order_in,
6997            frequency_cutoff_x_in,
6998            frequency_cutoff_y_in,
6999            radius_in,
7000            amplitude_cutoff_in,
7001            uchar_in_name.as_ptr(),
7002            uchar_in,
7003            nodc_in_name.as_ptr(),
7004            nodc_in,
7005            reject_in_name.as_ptr(),
7006            reject_in,
7007            optical_in_name.as_ptr(),
7008            optical_in,
7009            NULL,
7010        );
7011        utils::result(
7012            vips_op_response,
7013            VipsImage { ctx: out_out },
7014            Error::MaskButterworthBandError,
7015        )
7016    }
7017}
7018
7019/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7020/// width: `i32` -> Image width in pixels
7021/// min: 1, max: 10000000, default: 1
7022/// height: `i32` -> Image height in pixels
7023/// min: 1, max: 10000000, default: 1
7024/// frequency_cutoff: `f64` -> Frequency cutoff
7025/// min: 0, max: 1000000, default: 0.5
7026/// amplitude_cutoff: `f64` -> Amplitude cutoff
7027/// min: 0, max: 1, default: 0.5
7028/// returns `VipsImage` - Output image
7029pub fn mask_gaussian(
7030    width: i32,
7031    height: i32,
7032    frequency_cutoff: f64,
7033    amplitude_cutoff: f64,
7034) -> Result<VipsImage> {
7035    unsafe {
7036        let width_in: i32 = width;
7037        let height_in: i32 = height;
7038        let frequency_cutoff_in: f64 = frequency_cutoff;
7039        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7040        let mut out_out: *mut bindings::VipsImage = null_mut();
7041
7042        let vips_op_response = bindings::vips_mask_gaussian(
7043            &mut out_out,
7044            width_in,
7045            height_in,
7046            frequency_cutoff_in,
7047            amplitude_cutoff_in,
7048            NULL,
7049        );
7050        utils::result(
7051            vips_op_response,
7052            VipsImage { ctx: out_out },
7053            Error::MaskGaussianError,
7054        )
7055    }
7056}
7057
7058/// Options for mask_gaussian operation
7059#[derive(Clone, Debug)]
7060pub struct MaskGaussianOptions {
7061    /// uchar: `bool` -> Output an unsigned char image
7062    /// default: false
7063    pub uchar: bool,
7064    /// nodc: `bool` -> Remove DC component
7065    /// default: false
7066    pub nodc: bool,
7067    /// reject: `bool` -> Invert the sense of the filter
7068    /// default: false
7069    pub reject: bool,
7070    /// optical: `bool` -> Rotate quadrants to optical space
7071    /// default: false
7072    pub optical: bool,
7073}
7074
7075impl std::default::Default for MaskGaussianOptions {
7076    fn default() -> Self {
7077        MaskGaussianOptions {
7078            uchar: false,
7079            nodc: false,
7080            reject: false,
7081            optical: false,
7082        }
7083    }
7084}
7085
7086/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7087/// width: `i32` -> Image width in pixels
7088/// min: 1, max: 10000000, default: 1
7089/// height: `i32` -> Image height in pixels
7090/// min: 1, max: 10000000, default: 1
7091/// frequency_cutoff: `f64` -> Frequency cutoff
7092/// min: 0, max: 1000000, default: 0.5
7093/// amplitude_cutoff: `f64` -> Amplitude cutoff
7094/// min: 0, max: 1, default: 0.5
7095/// mask_gaussian_options: `&MaskGaussianOptions` -> optional arguments
7096/// returns `VipsImage` - Output image
7097pub fn mask_gaussian_with_opts(
7098    width: i32,
7099    height: i32,
7100    frequency_cutoff: f64,
7101    amplitude_cutoff: f64,
7102    mask_gaussian_options: &MaskGaussianOptions,
7103) -> Result<VipsImage> {
7104    unsafe {
7105        let width_in: i32 = width;
7106        let height_in: i32 = height;
7107        let frequency_cutoff_in: f64 = frequency_cutoff;
7108        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7109        let mut out_out: *mut bindings::VipsImage = null_mut();
7110
7111        let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7112        let uchar_in_name = utils::new_c_string("uchar")?;
7113
7114        let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7115        let nodc_in_name = utils::new_c_string("nodc")?;
7116
7117        let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7118        let reject_in_name = utils::new_c_string("reject")?;
7119
7120        let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7121        let optical_in_name = utils::new_c_string("optical")?;
7122
7123        let vips_op_response = bindings::vips_mask_gaussian(
7124            &mut out_out,
7125            width_in,
7126            height_in,
7127            frequency_cutoff_in,
7128            amplitude_cutoff_in,
7129            uchar_in_name.as_ptr(),
7130            uchar_in,
7131            nodc_in_name.as_ptr(),
7132            nodc_in,
7133            reject_in_name.as_ptr(),
7134            reject_in,
7135            optical_in_name.as_ptr(),
7136            optical_in,
7137            NULL,
7138        );
7139        utils::result(
7140            vips_op_response,
7141            VipsImage { ctx: out_out },
7142            Error::MaskGaussianError,
7143        )
7144    }
7145}
7146
7147/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7148/// width: `i32` -> Image width in pixels
7149/// min: 1, max: 10000000, default: 1
7150/// height: `i32` -> Image height in pixels
7151/// min: 1, max: 10000000, default: 1
7152/// frequency_cutoff: `f64` -> Frequency cutoff
7153/// min: 0, max: 1000000, default: 0.5
7154/// amplitude_cutoff: `f64` -> Amplitude cutoff
7155/// min: 0, max: 1, default: 0.5
7156/// ringwidth: `f64` -> Ringwidth
7157/// min: 0, max: 1000000, default: 0.5
7158/// returns `VipsImage` - Output image
7159pub fn mask_gaussian_ring(
7160    width: i32,
7161    height: i32,
7162    frequency_cutoff: f64,
7163    amplitude_cutoff: f64,
7164    ringwidth: f64,
7165) -> Result<VipsImage> {
7166    unsafe {
7167        let width_in: i32 = width;
7168        let height_in: i32 = height;
7169        let frequency_cutoff_in: f64 = frequency_cutoff;
7170        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7171        let ringwidth_in: f64 = ringwidth;
7172        let mut out_out: *mut bindings::VipsImage = null_mut();
7173
7174        let vips_op_response = bindings::vips_mask_gaussian_ring(
7175            &mut out_out,
7176            width_in,
7177            height_in,
7178            frequency_cutoff_in,
7179            amplitude_cutoff_in,
7180            ringwidth_in,
7181            NULL,
7182        );
7183        utils::result(
7184            vips_op_response,
7185            VipsImage { ctx: out_out },
7186            Error::MaskGaussianRingError,
7187        )
7188    }
7189}
7190
7191/// Options for mask_gaussian_ring operation
7192#[derive(Clone, Debug)]
7193pub struct MaskGaussianRingOptions {
7194    /// uchar: `bool` -> Output an unsigned char image
7195    /// default: false
7196    pub uchar: bool,
7197    /// nodc: `bool` -> Remove DC component
7198    /// default: false
7199    pub nodc: bool,
7200    /// reject: `bool` -> Invert the sense of the filter
7201    /// default: false
7202    pub reject: bool,
7203    /// optical: `bool` -> Rotate quadrants to optical space
7204    /// default: false
7205    pub optical: bool,
7206}
7207
7208impl std::default::Default for MaskGaussianRingOptions {
7209    fn default() -> Self {
7210        MaskGaussianRingOptions {
7211            uchar: false,
7212            nodc: false,
7213            reject: false,
7214            optical: false,
7215        }
7216    }
7217}
7218
7219/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7220/// width: `i32` -> Image width in pixels
7221/// min: 1, max: 10000000, default: 1
7222/// height: `i32` -> Image height in pixels
7223/// min: 1, max: 10000000, default: 1
7224/// frequency_cutoff: `f64` -> Frequency cutoff
7225/// min: 0, max: 1000000, default: 0.5
7226/// amplitude_cutoff: `f64` -> Amplitude cutoff
7227/// min: 0, max: 1, default: 0.5
7228/// ringwidth: `f64` -> Ringwidth
7229/// min: 0, max: 1000000, default: 0.5
7230/// mask_gaussian_ring_options: `&MaskGaussianRingOptions` -> optional arguments
7231/// returns `VipsImage` - Output image
7232pub fn mask_gaussian_ring_with_opts(
7233    width: i32,
7234    height: i32,
7235    frequency_cutoff: f64,
7236    amplitude_cutoff: f64,
7237    ringwidth: f64,
7238    mask_gaussian_ring_options: &MaskGaussianRingOptions,
7239) -> Result<VipsImage> {
7240    unsafe {
7241        let width_in: i32 = width;
7242        let height_in: i32 = height;
7243        let frequency_cutoff_in: f64 = frequency_cutoff;
7244        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7245        let ringwidth_in: f64 = ringwidth;
7246        let mut out_out: *mut bindings::VipsImage = null_mut();
7247
7248        let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7249            1
7250        } else {
7251            0
7252        };
7253        let uchar_in_name = utils::new_c_string("uchar")?;
7254
7255        let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7256            1
7257        } else {
7258            0
7259        };
7260        let nodc_in_name = utils::new_c_string("nodc")?;
7261
7262        let reject_in: i32 = if mask_gaussian_ring_options.reject {
7263            1
7264        } else {
7265            0
7266        };
7267        let reject_in_name = utils::new_c_string("reject")?;
7268
7269        let optical_in: i32 = if mask_gaussian_ring_options.optical {
7270            1
7271        } else {
7272            0
7273        };
7274        let optical_in_name = utils::new_c_string("optical")?;
7275
7276        let vips_op_response = bindings::vips_mask_gaussian_ring(
7277            &mut out_out,
7278            width_in,
7279            height_in,
7280            frequency_cutoff_in,
7281            amplitude_cutoff_in,
7282            ringwidth_in,
7283            uchar_in_name.as_ptr(),
7284            uchar_in,
7285            nodc_in_name.as_ptr(),
7286            nodc_in,
7287            reject_in_name.as_ptr(),
7288            reject_in,
7289            optical_in_name.as_ptr(),
7290            optical_in,
7291            NULL,
7292        );
7293        utils::result(
7294            vips_op_response,
7295            VipsImage { ctx: out_out },
7296            Error::MaskGaussianRingError,
7297        )
7298    }
7299}
7300
7301/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7302/// width: `i32` -> Image width in pixels
7303/// min: 1, max: 10000000, default: 1
7304/// height: `i32` -> Image height in pixels
7305/// min: 1, max: 10000000, default: 1
7306/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7307/// min: 0, max: 1000000, default: 0.5
7308/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7309/// min: 0, max: 1000000, default: 0.5
7310/// radius: `f64` -> Radius of circle
7311/// min: 0, max: 1000000, default: 0.1
7312/// amplitude_cutoff: `f64` -> Amplitude cutoff
7313/// min: 0, max: 1, default: 0.5
7314/// returns `VipsImage` - Output image
7315pub fn mask_gaussian_band(
7316    width: i32,
7317    height: i32,
7318    frequency_cutoff_x: f64,
7319    frequency_cutoff_y: f64,
7320    radius: f64,
7321    amplitude_cutoff: f64,
7322) -> Result<VipsImage> {
7323    unsafe {
7324        let width_in: i32 = width;
7325        let height_in: i32 = height;
7326        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7327        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7328        let radius_in: f64 = radius;
7329        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7330        let mut out_out: *mut bindings::VipsImage = null_mut();
7331
7332        let vips_op_response = bindings::vips_mask_gaussian_band(
7333            &mut out_out,
7334            width_in,
7335            height_in,
7336            frequency_cutoff_x_in,
7337            frequency_cutoff_y_in,
7338            radius_in,
7339            amplitude_cutoff_in,
7340            NULL,
7341        );
7342        utils::result(
7343            vips_op_response,
7344            VipsImage { ctx: out_out },
7345            Error::MaskGaussianBandError,
7346        )
7347    }
7348}
7349
7350/// Options for mask_gaussian_band operation
7351#[derive(Clone, Debug)]
7352pub struct MaskGaussianBandOptions {
7353    /// uchar: `bool` -> Output an unsigned char image
7354    /// default: false
7355    pub uchar: bool,
7356    /// nodc: `bool` -> Remove DC component
7357    /// default: false
7358    pub nodc: bool,
7359    /// reject: `bool` -> Invert the sense of the filter
7360    /// default: false
7361    pub reject: bool,
7362    /// optical: `bool` -> Rotate quadrants to optical space
7363    /// default: false
7364    pub optical: bool,
7365}
7366
7367impl std::default::Default for MaskGaussianBandOptions {
7368    fn default() -> Self {
7369        MaskGaussianBandOptions {
7370            uchar: false,
7371            nodc: false,
7372            reject: false,
7373            optical: false,
7374        }
7375    }
7376}
7377
7378/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7379/// width: `i32` -> Image width in pixels
7380/// min: 1, max: 10000000, default: 1
7381/// height: `i32` -> Image height in pixels
7382/// min: 1, max: 10000000, default: 1
7383/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7384/// min: 0, max: 1000000, default: 0.5
7385/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7386/// min: 0, max: 1000000, default: 0.5
7387/// radius: `f64` -> Radius of circle
7388/// min: 0, max: 1000000, default: 0.1
7389/// amplitude_cutoff: `f64` -> Amplitude cutoff
7390/// min: 0, max: 1, default: 0.5
7391/// mask_gaussian_band_options: `&MaskGaussianBandOptions` -> optional arguments
7392/// returns `VipsImage` - Output image
7393pub fn mask_gaussian_band_with_opts(
7394    width: i32,
7395    height: i32,
7396    frequency_cutoff_x: f64,
7397    frequency_cutoff_y: f64,
7398    radius: f64,
7399    amplitude_cutoff: f64,
7400    mask_gaussian_band_options: &MaskGaussianBandOptions,
7401) -> Result<VipsImage> {
7402    unsafe {
7403        let width_in: i32 = width;
7404        let height_in: i32 = height;
7405        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7406        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7407        let radius_in: f64 = radius;
7408        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7409        let mut out_out: *mut bindings::VipsImage = null_mut();
7410
7411        let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7412            1
7413        } else {
7414            0
7415        };
7416        let uchar_in_name = utils::new_c_string("uchar")?;
7417
7418        let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7419            1
7420        } else {
7421            0
7422        };
7423        let nodc_in_name = utils::new_c_string("nodc")?;
7424
7425        let reject_in: i32 = if mask_gaussian_band_options.reject {
7426            1
7427        } else {
7428            0
7429        };
7430        let reject_in_name = utils::new_c_string("reject")?;
7431
7432        let optical_in: i32 = if mask_gaussian_band_options.optical {
7433            1
7434        } else {
7435            0
7436        };
7437        let optical_in_name = utils::new_c_string("optical")?;
7438
7439        let vips_op_response = bindings::vips_mask_gaussian_band(
7440            &mut out_out,
7441            width_in,
7442            height_in,
7443            frequency_cutoff_x_in,
7444            frequency_cutoff_y_in,
7445            radius_in,
7446            amplitude_cutoff_in,
7447            uchar_in_name.as_ptr(),
7448            uchar_in,
7449            nodc_in_name.as_ptr(),
7450            nodc_in,
7451            reject_in_name.as_ptr(),
7452            reject_in,
7453            optical_in_name.as_ptr(),
7454            optical_in,
7455            NULL,
7456        );
7457        utils::result(
7458            vips_op_response,
7459            VipsImage { ctx: out_out },
7460            Error::MaskGaussianBandError,
7461        )
7462    }
7463}
7464
7465/// VipsMaskFractal (mask_fractal), make fractal filter
7466/// width: `i32` -> Image width in pixels
7467/// min: 1, max: 10000000, default: 1
7468/// height: `i32` -> Image height in pixels
7469/// min: 1, max: 10000000, default: 1
7470/// fractal_dimension: `f64` -> Fractal dimension
7471/// min: 2, max: 3, default: 2.5
7472/// returns `VipsImage` - Output image
7473pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7474    unsafe {
7475        let width_in: i32 = width;
7476        let height_in: i32 = height;
7477        let fractal_dimension_in: f64 = fractal_dimension;
7478        let mut out_out: *mut bindings::VipsImage = null_mut();
7479
7480        let vips_op_response = bindings::vips_mask_fractal(
7481            &mut out_out,
7482            width_in,
7483            height_in,
7484            fractal_dimension_in,
7485            NULL,
7486        );
7487        utils::result(
7488            vips_op_response,
7489            VipsImage { ctx: out_out },
7490            Error::MaskFractalError,
7491        )
7492    }
7493}
7494
7495/// Options for mask_fractal operation
7496#[derive(Clone, Debug)]
7497pub struct MaskFractalOptions {
7498    /// uchar: `bool` -> Output an unsigned char image
7499    /// default: false
7500    pub uchar: bool,
7501    /// nodc: `bool` -> Remove DC component
7502    /// default: false
7503    pub nodc: bool,
7504    /// reject: `bool` -> Invert the sense of the filter
7505    /// default: false
7506    pub reject: bool,
7507    /// optical: `bool` -> Rotate quadrants to optical space
7508    /// default: false
7509    pub optical: bool,
7510}
7511
7512impl std::default::Default for MaskFractalOptions {
7513    fn default() -> Self {
7514        MaskFractalOptions {
7515            uchar: false,
7516            nodc: false,
7517            reject: false,
7518            optical: false,
7519        }
7520    }
7521}
7522
7523/// VipsMaskFractal (mask_fractal), make fractal filter
7524/// width: `i32` -> Image width in pixels
7525/// min: 1, max: 10000000, default: 1
7526/// height: `i32` -> Image height in pixels
7527/// min: 1, max: 10000000, default: 1
7528/// fractal_dimension: `f64` -> Fractal dimension
7529/// min: 2, max: 3, default: 2.5
7530/// mask_fractal_options: `&MaskFractalOptions` -> optional arguments
7531/// returns `VipsImage` - Output image
7532pub fn mask_fractal_with_opts(
7533    width: i32,
7534    height: i32,
7535    fractal_dimension: f64,
7536    mask_fractal_options: &MaskFractalOptions,
7537) -> Result<VipsImage> {
7538    unsafe {
7539        let width_in: i32 = width;
7540        let height_in: i32 = height;
7541        let fractal_dimension_in: f64 = fractal_dimension;
7542        let mut out_out: *mut bindings::VipsImage = null_mut();
7543
7544        let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7545        let uchar_in_name = utils::new_c_string("uchar")?;
7546
7547        let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7548        let nodc_in_name = utils::new_c_string("nodc")?;
7549
7550        let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7551        let reject_in_name = utils::new_c_string("reject")?;
7552
7553        let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7554        let optical_in_name = utils::new_c_string("optical")?;
7555
7556        let vips_op_response = bindings::vips_mask_fractal(
7557            &mut out_out,
7558            width_in,
7559            height_in,
7560            fractal_dimension_in,
7561            uchar_in_name.as_ptr(),
7562            uchar_in,
7563            nodc_in_name.as_ptr(),
7564            nodc_in,
7565            reject_in_name.as_ptr(),
7566            reject_in,
7567            optical_in_name.as_ptr(),
7568            optical_in,
7569            NULL,
7570        );
7571        utils::result(
7572            vips_op_response,
7573            VipsImage { ctx: out_out },
7574            Error::MaskFractalError,
7575        )
7576    }
7577}
7578
7579/// VipsBuildlut (buildlut), build a look-up table
7580/// inp: `&VipsImage` -> Matrix of XY coordinates
7581/// returns `VipsImage` - Output image
7582pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7583    unsafe {
7584        let inp_in: *mut bindings::VipsImage = inp.ctx;
7585        let mut out_out: *mut bindings::VipsImage = null_mut();
7586
7587        let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7588        utils::result(
7589            vips_op_response,
7590            VipsImage { ctx: out_out },
7591            Error::BuildlutError,
7592        )
7593    }
7594}
7595
7596/// VipsInvertlut (invertlut), build an inverted look-up table
7597/// inp: `&VipsImage` -> Matrix of XY coordinates
7598/// returns `VipsImage` - Output image
7599pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7600    unsafe {
7601        let inp_in: *mut bindings::VipsImage = inp.ctx;
7602        let mut out_out: *mut bindings::VipsImage = null_mut();
7603
7604        let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7605        utils::result(
7606            vips_op_response,
7607            VipsImage { ctx: out_out },
7608            Error::InvertlutError,
7609        )
7610    }
7611}
7612
7613/// Options for invertlut operation
7614#[derive(Clone, Debug)]
7615pub struct InvertlutOptions {
7616    /// size: `i32` -> LUT size to generate
7617    /// min: 1, max: 1000000, default: 256
7618    pub size: i32,
7619}
7620
7621impl std::default::Default for InvertlutOptions {
7622    fn default() -> Self {
7623        InvertlutOptions {
7624            size: i32::from(256),
7625        }
7626    }
7627}
7628
7629/// VipsInvertlut (invertlut), build an inverted look-up table
7630/// inp: `&VipsImage` -> Matrix of XY coordinates
7631/// invertlut_options: `&InvertlutOptions` -> optional arguments
7632/// returns `VipsImage` - Output image
7633pub fn invertlut_with_opts(
7634    inp: &VipsImage,
7635    invertlut_options: &InvertlutOptions,
7636) -> Result<VipsImage> {
7637    unsafe {
7638        let inp_in: *mut bindings::VipsImage = inp.ctx;
7639        let mut out_out: *mut bindings::VipsImage = null_mut();
7640
7641        let size_in: i32 = invertlut_options.size;
7642        let size_in_name = utils::new_c_string("size")?;
7643
7644        let vips_op_response =
7645            bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7646        utils::result(
7647            vips_op_response,
7648            VipsImage { ctx: out_out },
7649            Error::InvertlutError,
7650        )
7651    }
7652}
7653
7654/// VipsTonelut (tonelut), build a look-up table
7655
7656/// returns `VipsImage` - Output image
7657pub fn tonelut() -> Result<VipsImage> {
7658    unsafe {
7659        let mut out_out: *mut bindings::VipsImage = null_mut();
7660
7661        let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7662        utils::result(
7663            vips_op_response,
7664            VipsImage { ctx: out_out },
7665            Error::TonelutError,
7666        )
7667    }
7668}
7669
7670/// Options for tonelut operation
7671#[derive(Clone, Debug)]
7672pub struct TonelutOptions {
7673    /// in_max: `i32` -> Size of LUT to build
7674    /// min: 1, max: 65535, default: 32767
7675    pub in_max: i32,
7676    /// out_max: `i32` -> Maximum value in output LUT
7677    /// min: 1, max: 65535, default: 32767
7678    pub out_max: i32,
7679    /// lb: `f64` -> Lowest value in output
7680    /// min: 0, max: 100, default: 0
7681    pub lb: f64,
7682    /// lw: `f64` -> Highest value in output
7683    /// min: 0, max: 100, default: 100
7684    pub lw: f64,
7685    /// ps: `f64` -> Position of shadow
7686    /// min: 0, max: 1, default: 0.2
7687    pub ps: f64,
7688    /// pm: `f64` -> Position of mid-tones
7689    /// min: 0, max: 1, default: 0.5
7690    pub pm: f64,
7691    /// ph: `f64` -> Position of highlights
7692    /// min: 0, max: 1, default: 0.8
7693    pub ph: f64,
7694    /// s: `f64` -> Adjust shadows by this much
7695    /// min: -30, max: 30, default: 0
7696    pub s: f64,
7697    /// m: `f64` -> Adjust mid-tones by this much
7698    /// min: -30, max: 30, default: 0
7699    pub m: f64,
7700    /// h: `f64` -> Adjust highlights by this much
7701    /// min: -30, max: 30, default: 0
7702    pub h: f64,
7703}
7704
7705impl std::default::Default for TonelutOptions {
7706    fn default() -> Self {
7707        TonelutOptions {
7708            in_max: i32::from(32767),
7709            out_max: i32::from(32767),
7710            lb: f64::from(0),
7711            lw: f64::from(100),
7712            ps: f64::from(0.2),
7713            pm: f64::from(0.5),
7714            ph: f64::from(0.8),
7715            s: f64::from(0),
7716            m: f64::from(0),
7717            h: f64::from(0),
7718        }
7719    }
7720}
7721
7722/// VipsTonelut (tonelut), build a look-up table
7723
7724/// tonelut_options: `&TonelutOptions` -> optional arguments
7725/// returns `VipsImage` - Output image
7726pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7727    unsafe {
7728        let mut out_out: *mut bindings::VipsImage = null_mut();
7729
7730        let in_max_in: i32 = tonelut_options.in_max;
7731        let in_max_in_name = utils::new_c_string("in-max")?;
7732
7733        let out_max_in: i32 = tonelut_options.out_max;
7734        let out_max_in_name = utils::new_c_string("out-max")?;
7735
7736        let lb_in: f64 = tonelut_options.lb;
7737        let lb_in_name = utils::new_c_string("Lb")?;
7738
7739        let lw_in: f64 = tonelut_options.lw;
7740        let lw_in_name = utils::new_c_string("Lw")?;
7741
7742        let ps_in: f64 = tonelut_options.ps;
7743        let ps_in_name = utils::new_c_string("Ps")?;
7744
7745        let pm_in: f64 = tonelut_options.pm;
7746        let pm_in_name = utils::new_c_string("Pm")?;
7747
7748        let ph_in: f64 = tonelut_options.ph;
7749        let ph_in_name = utils::new_c_string("Ph")?;
7750
7751        let s_in: f64 = tonelut_options.s;
7752        let s_in_name = utils::new_c_string("S")?;
7753
7754        let m_in: f64 = tonelut_options.m;
7755        let m_in_name = utils::new_c_string("M")?;
7756
7757        let h_in: f64 = tonelut_options.h;
7758        let h_in_name = utils::new_c_string("H")?;
7759
7760        let vips_op_response = bindings::vips_tonelut(
7761            &mut out_out,
7762            in_max_in_name.as_ptr(),
7763            in_max_in,
7764            out_max_in_name.as_ptr(),
7765            out_max_in,
7766            lb_in_name.as_ptr(),
7767            lb_in,
7768            lw_in_name.as_ptr(),
7769            lw_in,
7770            ps_in_name.as_ptr(),
7771            ps_in,
7772            pm_in_name.as_ptr(),
7773            pm_in,
7774            ph_in_name.as_ptr(),
7775            ph_in,
7776            s_in_name.as_ptr(),
7777            s_in,
7778            m_in_name.as_ptr(),
7779            m_in,
7780            h_in_name.as_ptr(),
7781            h_in,
7782            NULL,
7783        );
7784        utils::result(
7785            vips_op_response,
7786            VipsImage { ctx: out_out },
7787            Error::TonelutError,
7788        )
7789    }
7790}
7791
7792/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7793
7794/// returns `VipsImage` - Output image
7795pub fn identity() -> Result<VipsImage> {
7796    unsafe {
7797        let mut out_out: *mut bindings::VipsImage = null_mut();
7798
7799        let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7800        utils::result(
7801            vips_op_response,
7802            VipsImage { ctx: out_out },
7803            Error::IdentityError,
7804        )
7805    }
7806}
7807
7808/// Options for identity operation
7809#[derive(Clone, Debug)]
7810pub struct IdentityOptions {
7811    /// bands: `i32` -> Number of bands in LUT
7812    /// min: 1, max: 100000, default: 1
7813    pub bands: i32,
7814    /// ushort: `bool` -> Create a 16-bit LUT
7815    /// default: false
7816    pub ushort: bool,
7817    /// size: `i32` -> Size of 16-bit LUT
7818    /// min: 1, max: 65536, default: 65536
7819    pub size: i32,
7820}
7821
7822impl std::default::Default for IdentityOptions {
7823    fn default() -> Self {
7824        IdentityOptions {
7825            bands: i32::from(1),
7826            ushort: false,
7827            size: i32::from(65536),
7828        }
7829    }
7830}
7831
7832/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7833
7834/// identity_options: `&IdentityOptions` -> optional arguments
7835/// returns `VipsImage` - Output image
7836pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
7837    unsafe {
7838        let mut out_out: *mut bindings::VipsImage = null_mut();
7839
7840        let bands_in: i32 = identity_options.bands;
7841        let bands_in_name = utils::new_c_string("bands")?;
7842
7843        let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
7844        let ushort_in_name = utils::new_c_string("ushort")?;
7845
7846        let size_in: i32 = identity_options.size;
7847        let size_in_name = utils::new_c_string("size")?;
7848
7849        let vips_op_response = bindings::vips_identity(
7850            &mut out_out,
7851            bands_in_name.as_ptr(),
7852            bands_in,
7853            ushort_in_name.as_ptr(),
7854            ushort_in,
7855            size_in_name.as_ptr(),
7856            size_in,
7857            NULL,
7858        );
7859        utils::result(
7860            vips_op_response,
7861            VipsImage { ctx: out_out },
7862            Error::IdentityError,
7863        )
7864    }
7865}
7866
7867/// VipsFractsurf (fractsurf), make a fractal surface
7868/// width: `i32` -> Image width in pixels
7869/// min: 1, max: 10000000, default: 64
7870/// height: `i32` -> Image height in pixels
7871/// min: 1, max: 10000000, default: 64
7872/// fractal_dimension: `f64` -> Fractal dimension
7873/// min: 2, max: 3, default: 2.5
7874/// returns `VipsImage` - Output image
7875pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7876    unsafe {
7877        let width_in: i32 = width;
7878        let height_in: i32 = height;
7879        let fractal_dimension_in: f64 = fractal_dimension;
7880        let mut out_out: *mut bindings::VipsImage = null_mut();
7881
7882        let vips_op_response = bindings::vips_fractsurf(
7883            &mut out_out,
7884            width_in,
7885            height_in,
7886            fractal_dimension_in,
7887            NULL,
7888        );
7889        utils::result(
7890            vips_op_response,
7891            VipsImage { ctx: out_out },
7892            Error::FractsurfError,
7893        )
7894    }
7895}
7896
7897/// VipsWorley (worley), make a worley noise image
7898/// width: `i32` -> Image width in pixels
7899/// min: 1, max: 10000000, default: 1
7900/// height: `i32` -> Image height in pixels
7901/// min: 1, max: 10000000, default: 1
7902/// returns `VipsImage` - Output image
7903pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
7904    unsafe {
7905        let width_in: i32 = width;
7906        let height_in: i32 = height;
7907        let mut out_out: *mut bindings::VipsImage = null_mut();
7908
7909        let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
7910        utils::result(
7911            vips_op_response,
7912            VipsImage { ctx: out_out },
7913            Error::WorleyError,
7914        )
7915    }
7916}
7917
7918/// Options for worley operation
7919#[derive(Clone, Debug)]
7920pub struct WorleyOptions {
7921    /// cell_size: `i32` -> Size of Worley cells
7922    /// min: 1, max: 10000000, default: 256
7923    pub cell_size: i32,
7924    /// seed: `i32` -> Random number seed
7925    /// min: -2147483648, max: 2147483647, default: 0
7926    pub seed: i32,
7927}
7928
7929impl std::default::Default for WorleyOptions {
7930    fn default() -> Self {
7931        WorleyOptions {
7932            cell_size: i32::from(256),
7933            seed: i32::from(0),
7934        }
7935    }
7936}
7937
7938/// VipsWorley (worley), make a worley noise image
7939/// width: `i32` -> Image width in pixels
7940/// min: 1, max: 10000000, default: 1
7941/// height: `i32` -> Image height in pixels
7942/// min: 1, max: 10000000, default: 1
7943/// worley_options: `&WorleyOptions` -> optional arguments
7944/// returns `VipsImage` - Output image
7945pub fn worley_with_opts(
7946    width: i32,
7947    height: i32,
7948    worley_options: &WorleyOptions,
7949) -> Result<VipsImage> {
7950    unsafe {
7951        let width_in: i32 = width;
7952        let height_in: i32 = height;
7953        let mut out_out: *mut bindings::VipsImage = null_mut();
7954
7955        let cell_size_in: i32 = worley_options.cell_size;
7956        let cell_size_in_name = utils::new_c_string("cell-size")?;
7957
7958        let seed_in: i32 = worley_options.seed;
7959        let seed_in_name = utils::new_c_string("seed")?;
7960
7961        let vips_op_response = bindings::vips_worley(
7962            &mut out_out,
7963            width_in,
7964            height_in,
7965            cell_size_in_name.as_ptr(),
7966            cell_size_in,
7967            seed_in_name.as_ptr(),
7968            seed_in,
7969            NULL,
7970        );
7971        utils::result(
7972            vips_op_response,
7973            VipsImage { ctx: out_out },
7974            Error::WorleyError,
7975        )
7976    }
7977}
7978
7979/// VipsPerlin (perlin), make a perlin noise image
7980/// width: `i32` -> Image width in pixels
7981/// min: 1, max: 10000000, default: 1
7982/// height: `i32` -> Image height in pixels
7983/// min: 1, max: 10000000, default: 1
7984/// returns `VipsImage` - Output image
7985pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
7986    unsafe {
7987        let width_in: i32 = width;
7988        let height_in: i32 = height;
7989        let mut out_out: *mut bindings::VipsImage = null_mut();
7990
7991        let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
7992        utils::result(
7993            vips_op_response,
7994            VipsImage { ctx: out_out },
7995            Error::PerlinError,
7996        )
7997    }
7998}
7999
8000/// Options for perlin operation
8001#[derive(Clone, Debug)]
8002pub struct PerlinOptions {
8003    /// cell_size: `i32` -> Size of Perlin cells
8004    /// min: 1, max: 10000000, default: 256
8005    pub cell_size: i32,
8006    /// uchar: `bool` -> Output an unsigned char image
8007    /// default: false
8008    pub uchar: bool,
8009    /// seed: `i32` -> Random number seed
8010    /// min: -2147483648, max: 2147483647, default: 0
8011    pub seed: i32,
8012}
8013
8014impl std::default::Default for PerlinOptions {
8015    fn default() -> Self {
8016        PerlinOptions {
8017            cell_size: i32::from(256),
8018            uchar: false,
8019            seed: i32::from(0),
8020        }
8021    }
8022}
8023
8024/// VipsPerlin (perlin), make a perlin noise image
8025/// width: `i32` -> Image width in pixels
8026/// min: 1, max: 10000000, default: 1
8027/// height: `i32` -> Image height in pixels
8028/// min: 1, max: 10000000, default: 1
8029/// perlin_options: `&PerlinOptions` -> optional arguments
8030/// returns `VipsImage` - Output image
8031pub fn perlin_with_opts(
8032    width: i32,
8033    height: i32,
8034    perlin_options: &PerlinOptions,
8035) -> Result<VipsImage> {
8036    unsafe {
8037        let width_in: i32 = width;
8038        let height_in: i32 = height;
8039        let mut out_out: *mut bindings::VipsImage = null_mut();
8040
8041        let cell_size_in: i32 = perlin_options.cell_size;
8042        let cell_size_in_name = utils::new_c_string("cell-size")?;
8043
8044        let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8045        let uchar_in_name = utils::new_c_string("uchar")?;
8046
8047        let seed_in: i32 = perlin_options.seed;
8048        let seed_in_name = utils::new_c_string("seed")?;
8049
8050        let vips_op_response = bindings::vips_perlin(
8051            &mut out_out,
8052            width_in,
8053            height_in,
8054            cell_size_in_name.as_ptr(),
8055            cell_size_in,
8056            uchar_in_name.as_ptr(),
8057            uchar_in,
8058            seed_in_name.as_ptr(),
8059            seed_in,
8060            NULL,
8061        );
8062        utils::result(
8063            vips_op_response,
8064            VipsImage { ctx: out_out },
8065            Error::PerlinError,
8066        )
8067    }
8068}
8069
8070/// VipsSwitch (switch), find the index of the first non-zero pixel in tests
8071/// tests: `&mut [VipsImage]` -> Table of images to test
8072/// returns `VipsImage` - Output image
8073pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8074    unsafe {
8075        let (tests_len, mut tests_in) = {
8076            let len = tests.len();
8077            let mut input = Vec::new();
8078            for img in tests {
8079                input.push(img.ctx)
8080            }
8081            (len as i32, input)
8082        };
8083        let mut out_out: *mut bindings::VipsImage = null_mut();
8084
8085        let vips_op_response =
8086            bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8087        utils::result(
8088            vips_op_response,
8089            VipsImage { ctx: out_out },
8090            Error::SwitchError,
8091        )
8092    }
8093}
8094
8095/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8096/// filename: `&str` -> Filename to load from
8097/// returns `VipsImage` - Output image
8098pub fn csvload(filename: &str) -> Result<VipsImage> {
8099    unsafe {
8100        let filename_in: CString = utils::new_c_string(filename)?;
8101        let mut out_out: *mut bindings::VipsImage = null_mut();
8102
8103        let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8104        utils::result(
8105            vips_op_response,
8106            VipsImage { ctx: out_out },
8107            Error::CsvloadError,
8108        )
8109    }
8110}
8111
8112/// Options for csvload operation
8113#[derive(Clone, Debug)]
8114pub struct CsvloadOptions {
8115    /// skip: `i32` -> Skip this many lines at the start of the file
8116    /// min: 0, max: 10000000, default: 0
8117    pub skip: i32,
8118    /// lines: `i32` -> Read this many lines from the file
8119    /// min: -1, max: 10000000, default: 0
8120    pub lines: i32,
8121    /// whitespace: `String` -> Set of whitespace characters
8122    pub whitespace: String,
8123    /// separator: `String` -> Set of separator characters
8124    pub separator: String,
8125    /// flags: `ForeignFlags` -> Flags for this file
8126    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8127    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8128    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8129    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8130    ///  `All` -> VIPS_FOREIGN_ALL = 7
8131    pub flags: ForeignFlags,
8132    /// memory: `bool` -> Force open via memory
8133    /// default: false
8134    pub memory: bool,
8135    /// access: `Access` -> Required access pattern for this file
8136    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8137    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8138    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8139    ///  `Last` -> VIPS_ACCESS_LAST = 3
8140    pub access: Access,
8141    /// fail_on: `FailOn` -> Error level to fail on
8142    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8143    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8144    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8145    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8146    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8147    pub fail_on: FailOn,
8148    /// revalidate: `bool` -> Don't use a cached result for this operation
8149    /// default: false
8150    pub revalidate: bool,
8151}
8152
8153impl std::default::Default for CsvloadOptions {
8154    fn default() -> Self {
8155        CsvloadOptions {
8156            skip: i32::from(0),
8157            lines: i32::from(0),
8158            whitespace: String::new(),
8159            separator: String::new(),
8160            flags: ForeignFlags::None,
8161            memory: false,
8162            access: Access::Random,
8163            fail_on: FailOn::None,
8164            revalidate: false,
8165        }
8166    }
8167}
8168
8169/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8170/// filename: `&str` -> Filename to load from
8171/// csvload_options: `&CsvloadOptions` -> optional arguments
8172/// returns `VipsImage` - Output image
8173pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8174    unsafe {
8175        let filename_in: CString = utils::new_c_string(filename)?;
8176        let mut out_out: *mut bindings::VipsImage = null_mut();
8177
8178        let skip_in: i32 = csvload_options.skip;
8179        let skip_in_name = utils::new_c_string("skip")?;
8180
8181        let lines_in: i32 = csvload_options.lines;
8182        let lines_in_name = utils::new_c_string("lines")?;
8183
8184        let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8185        let whitespace_in_name = utils::new_c_string("whitespace")?;
8186
8187        let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8188        let separator_in_name = utils::new_c_string("separator")?;
8189
8190        let flags_in: i32 = csvload_options.flags as i32;
8191        let flags_in_name = utils::new_c_string("flags")?;
8192
8193        let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8194        let memory_in_name = utils::new_c_string("memory")?;
8195
8196        let access_in: i32 = csvload_options.access as i32;
8197        let access_in_name = utils::new_c_string("access")?;
8198
8199        let fail_on_in: i32 = csvload_options.fail_on as i32;
8200        let fail_on_in_name = utils::new_c_string("fail-on")?;
8201
8202        let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8203        let revalidate_in_name = utils::new_c_string("revalidate")?;
8204
8205        let vips_op_response = bindings::vips_csvload(
8206            filename_in.as_ptr(),
8207            &mut out_out,
8208            skip_in_name.as_ptr(),
8209            skip_in,
8210            lines_in_name.as_ptr(),
8211            lines_in,
8212            whitespace_in_name.as_ptr(),
8213            whitespace_in.as_ptr(),
8214            separator_in_name.as_ptr(),
8215            separator_in.as_ptr(),
8216            flags_in_name.as_ptr(),
8217            flags_in,
8218            memory_in_name.as_ptr(),
8219            memory_in,
8220            access_in_name.as_ptr(),
8221            access_in,
8222            fail_on_in_name.as_ptr(),
8223            fail_on_in,
8224            revalidate_in_name.as_ptr(),
8225            revalidate_in,
8226            NULL,
8227        );
8228        utils::result(
8229            vips_op_response,
8230            VipsImage { ctx: out_out },
8231            Error::CsvloadError,
8232        )
8233    }
8234}
8235
8236/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8237/// source: `&VipsSource` -> Source to load from
8238/// returns `VipsImage` - Output image
8239pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8240    unsafe {
8241        let source_in: *mut bindings::VipsSource = source.ctx;
8242        let mut out_out: *mut bindings::VipsImage = null_mut();
8243
8244        let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8245        utils::result(
8246            vips_op_response,
8247            VipsImage { ctx: out_out },
8248            Error::CsvloadSourceError,
8249        )
8250    }
8251}
8252
8253/// Options for csvload_source operation
8254#[derive(Clone, Debug)]
8255pub struct CsvloadSourceOptions {
8256    /// skip: `i32` -> Skip this many lines at the start of the file
8257    /// min: 0, max: 10000000, default: 0
8258    pub skip: i32,
8259    /// lines: `i32` -> Read this many lines from the file
8260    /// min: -1, max: 10000000, default: 0
8261    pub lines: i32,
8262    /// whitespace: `String` -> Set of whitespace characters
8263    pub whitespace: String,
8264    /// separator: `String` -> Set of separator characters
8265    pub separator: String,
8266    /// flags: `ForeignFlags` -> Flags for this file
8267    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8268    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8269    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8270    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8271    ///  `All` -> VIPS_FOREIGN_ALL = 7
8272    pub flags: ForeignFlags,
8273    /// memory: `bool` -> Force open via memory
8274    /// default: false
8275    pub memory: bool,
8276    /// access: `Access` -> Required access pattern for this file
8277    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8278    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8279    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8280    ///  `Last` -> VIPS_ACCESS_LAST = 3
8281    pub access: Access,
8282    /// fail_on: `FailOn` -> Error level to fail on
8283    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8284    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8285    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8286    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8287    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8288    pub fail_on: FailOn,
8289    /// revalidate: `bool` -> Don't use a cached result for this operation
8290    /// default: false
8291    pub revalidate: bool,
8292}
8293
8294impl std::default::Default for CsvloadSourceOptions {
8295    fn default() -> Self {
8296        CsvloadSourceOptions {
8297            skip: i32::from(0),
8298            lines: i32::from(0),
8299            whitespace: String::new(),
8300            separator: String::new(),
8301            flags: ForeignFlags::None,
8302            memory: false,
8303            access: Access::Random,
8304            fail_on: FailOn::None,
8305            revalidate: false,
8306        }
8307    }
8308}
8309
8310/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8311/// source: `&VipsSource` -> Source to load from
8312/// csvload_source_options: `&CsvloadSourceOptions` -> optional arguments
8313/// returns `VipsImage` - Output image
8314pub fn csvload_source_with_opts(
8315    source: &VipsSource,
8316    csvload_source_options: &CsvloadSourceOptions,
8317) -> Result<VipsImage> {
8318    unsafe {
8319        let source_in: *mut bindings::VipsSource = source.ctx;
8320        let mut out_out: *mut bindings::VipsImage = null_mut();
8321
8322        let skip_in: i32 = csvload_source_options.skip;
8323        let skip_in_name = utils::new_c_string("skip")?;
8324
8325        let lines_in: i32 = csvload_source_options.lines;
8326        let lines_in_name = utils::new_c_string("lines")?;
8327
8328        let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8329        let whitespace_in_name = utils::new_c_string("whitespace")?;
8330
8331        let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8332        let separator_in_name = utils::new_c_string("separator")?;
8333
8334        let flags_in: i32 = csvload_source_options.flags as i32;
8335        let flags_in_name = utils::new_c_string("flags")?;
8336
8337        let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8338        let memory_in_name = utils::new_c_string("memory")?;
8339
8340        let access_in: i32 = csvload_source_options.access as i32;
8341        let access_in_name = utils::new_c_string("access")?;
8342
8343        let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8344        let fail_on_in_name = utils::new_c_string("fail-on")?;
8345
8346        let revalidate_in: i32 = if csvload_source_options.revalidate {
8347            1
8348        } else {
8349            0
8350        };
8351        let revalidate_in_name = utils::new_c_string("revalidate")?;
8352
8353        let vips_op_response = bindings::vips_csvload_source(
8354            source_in,
8355            &mut out_out,
8356            skip_in_name.as_ptr(),
8357            skip_in,
8358            lines_in_name.as_ptr(),
8359            lines_in,
8360            whitespace_in_name.as_ptr(),
8361            whitespace_in.as_ptr(),
8362            separator_in_name.as_ptr(),
8363            separator_in.as_ptr(),
8364            flags_in_name.as_ptr(),
8365            flags_in,
8366            memory_in_name.as_ptr(),
8367            memory_in,
8368            access_in_name.as_ptr(),
8369            access_in,
8370            fail_on_in_name.as_ptr(),
8371            fail_on_in,
8372            revalidate_in_name.as_ptr(),
8373            revalidate_in,
8374            NULL,
8375        );
8376        utils::result(
8377            vips_op_response,
8378            VipsImage { ctx: out_out },
8379            Error::CsvloadSourceError,
8380        )
8381    }
8382}
8383
8384/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8385/// filename: `&str` -> Filename to load from
8386/// returns `VipsImage` - Output image
8387pub fn matrixload(filename: &str) -> Result<VipsImage> {
8388    unsafe {
8389        let filename_in: CString = utils::new_c_string(filename)?;
8390        let mut out_out: *mut bindings::VipsImage = null_mut();
8391
8392        let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8393        utils::result(
8394            vips_op_response,
8395            VipsImage { ctx: out_out },
8396            Error::MatrixloadError,
8397        )
8398    }
8399}
8400
8401/// Options for matrixload operation
8402#[derive(Clone, Debug)]
8403pub struct MatrixloadOptions {
8404    /// flags: `ForeignFlags` -> Flags for this file
8405    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8406    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8407    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8408    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8409    ///  `All` -> VIPS_FOREIGN_ALL = 7
8410    pub flags: ForeignFlags,
8411    /// memory: `bool` -> Force open via memory
8412    /// default: false
8413    pub memory: bool,
8414    /// access: `Access` -> Required access pattern for this file
8415    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8416    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8417    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8418    ///  `Last` -> VIPS_ACCESS_LAST = 3
8419    pub access: Access,
8420    /// fail_on: `FailOn` -> Error level to fail on
8421    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8422    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8423    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8424    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8425    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8426    pub fail_on: FailOn,
8427    /// revalidate: `bool` -> Don't use a cached result for this operation
8428    /// default: false
8429    pub revalidate: bool,
8430}
8431
8432impl std::default::Default for MatrixloadOptions {
8433    fn default() -> Self {
8434        MatrixloadOptions {
8435            flags: ForeignFlags::None,
8436            memory: false,
8437            access: Access::Random,
8438            fail_on: FailOn::None,
8439            revalidate: false,
8440        }
8441    }
8442}
8443
8444/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8445/// filename: `&str` -> Filename to load from
8446/// matrixload_options: `&MatrixloadOptions` -> optional arguments
8447/// returns `VipsImage` - Output image
8448pub fn matrixload_with_opts(
8449    filename: &str,
8450    matrixload_options: &MatrixloadOptions,
8451) -> Result<VipsImage> {
8452    unsafe {
8453        let filename_in: CString = utils::new_c_string(filename)?;
8454        let mut out_out: *mut bindings::VipsImage = null_mut();
8455
8456        let flags_in: i32 = matrixload_options.flags as i32;
8457        let flags_in_name = utils::new_c_string("flags")?;
8458
8459        let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8460        let memory_in_name = utils::new_c_string("memory")?;
8461
8462        let access_in: i32 = matrixload_options.access as i32;
8463        let access_in_name = utils::new_c_string("access")?;
8464
8465        let fail_on_in: i32 = matrixload_options.fail_on as i32;
8466        let fail_on_in_name = utils::new_c_string("fail-on")?;
8467
8468        let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8469        let revalidate_in_name = utils::new_c_string("revalidate")?;
8470
8471        let vips_op_response = bindings::vips_matrixload(
8472            filename_in.as_ptr(),
8473            &mut out_out,
8474            flags_in_name.as_ptr(),
8475            flags_in,
8476            memory_in_name.as_ptr(),
8477            memory_in,
8478            access_in_name.as_ptr(),
8479            access_in,
8480            fail_on_in_name.as_ptr(),
8481            fail_on_in,
8482            revalidate_in_name.as_ptr(),
8483            revalidate_in,
8484            NULL,
8485        );
8486        utils::result(
8487            vips_op_response,
8488            VipsImage { ctx: out_out },
8489            Error::MatrixloadError,
8490        )
8491    }
8492}
8493
8494/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8495/// source: `&VipsSource` -> Source to load from
8496/// returns `VipsImage` - Output image
8497pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8498    unsafe {
8499        let source_in: *mut bindings::VipsSource = source.ctx;
8500        let mut out_out: *mut bindings::VipsImage = null_mut();
8501
8502        let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8503        utils::result(
8504            vips_op_response,
8505            VipsImage { ctx: out_out },
8506            Error::MatrixloadSourceError,
8507        )
8508    }
8509}
8510
8511/// Options for matrixload_source operation
8512#[derive(Clone, Debug)]
8513pub struct MatrixloadSourceOptions {
8514    /// flags: `ForeignFlags` -> Flags for this file
8515    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8516    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8517    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8518    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8519    ///  `All` -> VIPS_FOREIGN_ALL = 7
8520    pub flags: ForeignFlags,
8521    /// memory: `bool` -> Force open via memory
8522    /// default: false
8523    pub memory: bool,
8524    /// access: `Access` -> Required access pattern for this file
8525    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8526    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8527    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8528    ///  `Last` -> VIPS_ACCESS_LAST = 3
8529    pub access: Access,
8530    /// fail_on: `FailOn` -> Error level to fail on
8531    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8532    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8533    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8534    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8535    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8536    pub fail_on: FailOn,
8537    /// revalidate: `bool` -> Don't use a cached result for this operation
8538    /// default: false
8539    pub revalidate: bool,
8540}
8541
8542impl std::default::Default for MatrixloadSourceOptions {
8543    fn default() -> Self {
8544        MatrixloadSourceOptions {
8545            flags: ForeignFlags::None,
8546            memory: false,
8547            access: Access::Random,
8548            fail_on: FailOn::None,
8549            revalidate: false,
8550        }
8551    }
8552}
8553
8554/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8555/// source: `&VipsSource` -> Source to load from
8556/// matrixload_source_options: `&MatrixloadSourceOptions` -> optional arguments
8557/// returns `VipsImage` - Output image
8558pub fn matrixload_source_with_opts(
8559    source: &VipsSource,
8560    matrixload_source_options: &MatrixloadSourceOptions,
8561) -> Result<VipsImage> {
8562    unsafe {
8563        let source_in: *mut bindings::VipsSource = source.ctx;
8564        let mut out_out: *mut bindings::VipsImage = null_mut();
8565
8566        let flags_in: i32 = matrixload_source_options.flags as i32;
8567        let flags_in_name = utils::new_c_string("flags")?;
8568
8569        let memory_in: i32 = if matrixload_source_options.memory {
8570            1
8571        } else {
8572            0
8573        };
8574        let memory_in_name = utils::new_c_string("memory")?;
8575
8576        let access_in: i32 = matrixload_source_options.access as i32;
8577        let access_in_name = utils::new_c_string("access")?;
8578
8579        let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8580        let fail_on_in_name = utils::new_c_string("fail-on")?;
8581
8582        let revalidate_in: i32 = if matrixload_source_options.revalidate {
8583            1
8584        } else {
8585            0
8586        };
8587        let revalidate_in_name = utils::new_c_string("revalidate")?;
8588
8589        let vips_op_response = bindings::vips_matrixload_source(
8590            source_in,
8591            &mut out_out,
8592            flags_in_name.as_ptr(),
8593            flags_in,
8594            memory_in_name.as_ptr(),
8595            memory_in,
8596            access_in_name.as_ptr(),
8597            access_in,
8598            fail_on_in_name.as_ptr(),
8599            fail_on_in,
8600            revalidate_in_name.as_ptr(),
8601            revalidate_in,
8602            NULL,
8603        );
8604        utils::result(
8605            vips_op_response,
8606            VipsImage { ctx: out_out },
8607            Error::MatrixloadSourceError,
8608        )
8609    }
8610}
8611
8612/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8613/// filename: `&str` -> Filename to load from
8614/// width: `i32` -> Image width in pixels
8615/// min: 0, max: 10000000, default: 0
8616/// height: `i32` -> Image height in pixels
8617/// min: 0, max: 10000000, default: 0
8618/// bands: `i32` -> Number of bands in image
8619/// min: 0, max: 10000000, default: 0
8620/// returns `VipsImage` - Output image
8621pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8622    unsafe {
8623        let filename_in: CString = utils::new_c_string(filename)?;
8624        let width_in: i32 = width;
8625        let height_in: i32 = height;
8626        let bands_in: i32 = bands;
8627        let mut out_out: *mut bindings::VipsImage = null_mut();
8628
8629        let vips_op_response = bindings::vips_rawload(
8630            filename_in.as_ptr(),
8631            &mut out_out,
8632            width_in,
8633            height_in,
8634            bands_in,
8635            NULL,
8636        );
8637        utils::result(
8638            vips_op_response,
8639            VipsImage { ctx: out_out },
8640            Error::RawloadError,
8641        )
8642    }
8643}
8644
8645/// Options for rawload operation
8646#[derive(Clone, Debug)]
8647pub struct RawloadOptions {
8648    /// offset: `u64` -> Offset in bytes from start of file
8649    /// min: 0, max: 100000000000, default: 0
8650    pub offset: u64,
8651    /// format: `BandFormat` -> Pixel format in image
8652    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
8653    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
8654    ///  `Char` -> VIPS_FORMAT_CHAR = 1
8655    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
8656    ///  `Short` -> VIPS_FORMAT_SHORT = 3
8657    ///  `Uint` -> VIPS_FORMAT_UINT = 4
8658    ///  `Int` -> VIPS_FORMAT_INT = 5
8659    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
8660    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
8661    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
8662    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
8663    ///  `Last` -> VIPS_FORMAT_LAST = 10
8664    pub format: BandFormat,
8665    /// interpretation: `Interpretation` -> Pixel interpretation
8666    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
8667    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
8668    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
8669    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
8670    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
8671    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
8672    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
8673    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
8674    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
8675    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
8676    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
8677    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
8678    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
8679    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
8680    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
8681    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
8682    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
8683    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
8684    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
8685    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
8686    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
8687    pub interpretation: Interpretation,
8688    /// flags: `ForeignFlags` -> Flags for this file
8689    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8690    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8691    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8692    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8693    ///  `All` -> VIPS_FOREIGN_ALL = 7
8694    pub flags: ForeignFlags,
8695    /// memory: `bool` -> Force open via memory
8696    /// default: false
8697    pub memory: bool,
8698    /// access: `Access` -> Required access pattern for this file
8699    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8700    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8701    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8702    ///  `Last` -> VIPS_ACCESS_LAST = 3
8703    pub access: Access,
8704    /// fail_on: `FailOn` -> Error level to fail on
8705    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8706    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8707    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8708    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8709    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8710    pub fail_on: FailOn,
8711    /// revalidate: `bool` -> Don't use a cached result for this operation
8712    /// default: false
8713    pub revalidate: bool,
8714}
8715
8716impl std::default::Default for RawloadOptions {
8717    fn default() -> Self {
8718        RawloadOptions {
8719            offset: 0,
8720            format: BandFormat::Uchar,
8721            interpretation: Interpretation::Multiband,
8722            flags: ForeignFlags::None,
8723            memory: false,
8724            access: Access::Random,
8725            fail_on: FailOn::None,
8726            revalidate: false,
8727        }
8728    }
8729}
8730
8731/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8732/// filename: `&str` -> Filename to load from
8733/// width: `i32` -> Image width in pixels
8734/// min: 0, max: 10000000, default: 0
8735/// height: `i32` -> Image height in pixels
8736/// min: 0, max: 10000000, default: 0
8737/// bands: `i32` -> Number of bands in image
8738/// min: 0, max: 10000000, default: 0
8739/// rawload_options: `&RawloadOptions` -> optional arguments
8740/// returns `VipsImage` - Output image
8741pub fn rawload_with_opts(
8742    filename: &str,
8743    width: i32,
8744    height: i32,
8745    bands: i32,
8746    rawload_options: &RawloadOptions,
8747) -> Result<VipsImage> {
8748    unsafe {
8749        let filename_in: CString = utils::new_c_string(filename)?;
8750        let width_in: i32 = width;
8751        let height_in: i32 = height;
8752        let bands_in: i32 = bands;
8753        let mut out_out: *mut bindings::VipsImage = null_mut();
8754
8755        let offset_in: u64 = rawload_options.offset;
8756        let offset_in_name = utils::new_c_string("offset")?;
8757
8758        let format_in: i32 = rawload_options.format as i32;
8759        let format_in_name = utils::new_c_string("format")?;
8760
8761        let interpretation_in: i32 = rawload_options.interpretation as i32;
8762        let interpretation_in_name = utils::new_c_string("interpretation")?;
8763
8764        let flags_in: i32 = rawload_options.flags as i32;
8765        let flags_in_name = utils::new_c_string("flags")?;
8766
8767        let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8768        let memory_in_name = utils::new_c_string("memory")?;
8769
8770        let access_in: i32 = rawload_options.access as i32;
8771        let access_in_name = utils::new_c_string("access")?;
8772
8773        let fail_on_in: i32 = rawload_options.fail_on as i32;
8774        let fail_on_in_name = utils::new_c_string("fail-on")?;
8775
8776        let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8777        let revalidate_in_name = utils::new_c_string("revalidate")?;
8778
8779        let vips_op_response = bindings::vips_rawload(
8780            filename_in.as_ptr(),
8781            &mut out_out,
8782            width_in,
8783            height_in,
8784            bands_in,
8785            offset_in_name.as_ptr(),
8786            offset_in,
8787            format_in_name.as_ptr(),
8788            format_in,
8789            interpretation_in_name.as_ptr(),
8790            interpretation_in,
8791            flags_in_name.as_ptr(),
8792            flags_in,
8793            memory_in_name.as_ptr(),
8794            memory_in,
8795            access_in_name.as_ptr(),
8796            access_in,
8797            fail_on_in_name.as_ptr(),
8798            fail_on_in,
8799            revalidate_in_name.as_ptr(),
8800            revalidate_in,
8801            NULL,
8802        );
8803        utils::result(
8804            vips_op_response,
8805            VipsImage { ctx: out_out },
8806            Error::RawloadError,
8807        )
8808    }
8809}
8810
8811/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8812/// filename: `&str` -> Filename to load from
8813/// returns `VipsImage` - Output image
8814pub fn vipsload(filename: &str) -> Result<VipsImage> {
8815    unsafe {
8816        let filename_in: CString = utils::new_c_string(filename)?;
8817        let mut out_out: *mut bindings::VipsImage = null_mut();
8818
8819        let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
8820        utils::result(
8821            vips_op_response,
8822            VipsImage { ctx: out_out },
8823            Error::VipsloadError,
8824        )
8825    }
8826}
8827
8828/// Options for vipsload operation
8829#[derive(Clone, Debug)]
8830pub struct VipsloadOptions {
8831    /// flags: `ForeignFlags` -> Flags for this file
8832    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8833    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8834    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8835    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8836    ///  `All` -> VIPS_FOREIGN_ALL = 7
8837    pub flags: ForeignFlags,
8838    /// memory: `bool` -> Force open via memory
8839    /// default: false
8840    pub memory: bool,
8841    /// access: `Access` -> Required access pattern for this file
8842    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8843    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8844    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8845    ///  `Last` -> VIPS_ACCESS_LAST = 3
8846    pub access: Access,
8847    /// fail_on: `FailOn` -> Error level to fail on
8848    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8849    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8850    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8851    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8852    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8853    pub fail_on: FailOn,
8854    /// revalidate: `bool` -> Don't use a cached result for this operation
8855    /// default: false
8856    pub revalidate: bool,
8857}
8858
8859impl std::default::Default for VipsloadOptions {
8860    fn default() -> Self {
8861        VipsloadOptions {
8862            flags: ForeignFlags::None,
8863            memory: false,
8864            access: Access::Random,
8865            fail_on: FailOn::None,
8866            revalidate: false,
8867        }
8868    }
8869}
8870
8871/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8872/// filename: `&str` -> Filename to load from
8873/// vipsload_options: `&VipsloadOptions` -> optional arguments
8874/// returns `VipsImage` - Output image
8875pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
8876    unsafe {
8877        let filename_in: CString = utils::new_c_string(filename)?;
8878        let mut out_out: *mut bindings::VipsImage = null_mut();
8879
8880        let flags_in: i32 = vipsload_options.flags as i32;
8881        let flags_in_name = utils::new_c_string("flags")?;
8882
8883        let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
8884        let memory_in_name = utils::new_c_string("memory")?;
8885
8886        let access_in: i32 = vipsload_options.access as i32;
8887        let access_in_name = utils::new_c_string("access")?;
8888
8889        let fail_on_in: i32 = vipsload_options.fail_on as i32;
8890        let fail_on_in_name = utils::new_c_string("fail-on")?;
8891
8892        let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
8893        let revalidate_in_name = utils::new_c_string("revalidate")?;
8894
8895        let vips_op_response = bindings::vips_vipsload(
8896            filename_in.as_ptr(),
8897            &mut out_out,
8898            flags_in_name.as_ptr(),
8899            flags_in,
8900            memory_in_name.as_ptr(),
8901            memory_in,
8902            access_in_name.as_ptr(),
8903            access_in,
8904            fail_on_in_name.as_ptr(),
8905            fail_on_in,
8906            revalidate_in_name.as_ptr(),
8907            revalidate_in,
8908            NULL,
8909        );
8910        utils::result(
8911            vips_op_response,
8912            VipsImage { ctx: out_out },
8913            Error::VipsloadError,
8914        )
8915    }
8916}
8917
8918/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
8919/// source: `&VipsSource` -> Source to load from
8920/// returns `VipsImage` - Output image
8921pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
8922    unsafe {
8923        let source_in: *mut bindings::VipsSource = source.ctx;
8924        let mut out_out: *mut bindings::VipsImage = null_mut();
8925
8926        let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
8927        utils::result(
8928            vips_op_response,
8929            VipsImage { ctx: out_out },
8930            Error::VipsloadSourceError,
8931        )
8932    }
8933}
8934
8935/// Options for vipsload_source operation
8936#[derive(Clone, Debug)]
8937pub struct VipsloadSourceOptions {
8938    /// flags: `ForeignFlags` -> Flags for this file
8939    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8940    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8941    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8942    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8943    ///  `All` -> VIPS_FOREIGN_ALL = 7
8944    pub flags: ForeignFlags,
8945    /// memory: `bool` -> Force open via memory
8946    /// default: false
8947    pub memory: bool,
8948    /// access: `Access` -> Required access pattern for this file
8949    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8950    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8951    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8952    ///  `Last` -> VIPS_ACCESS_LAST = 3
8953    pub access: Access,
8954    /// fail_on: `FailOn` -> Error level to fail on
8955    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8956    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8957    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8958    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8959    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8960    pub fail_on: FailOn,
8961    /// revalidate: `bool` -> Don't use a cached result for this operation
8962    /// default: false
8963    pub revalidate: bool,
8964}
8965
8966impl std::default::Default for VipsloadSourceOptions {
8967    fn default() -> Self {
8968        VipsloadSourceOptions {
8969            flags: ForeignFlags::None,
8970            memory: false,
8971            access: Access::Random,
8972            fail_on: FailOn::None,
8973            revalidate: false,
8974        }
8975    }
8976}
8977
8978/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
8979/// source: `&VipsSource` -> Source to load from
8980/// vipsload_source_options: `&VipsloadSourceOptions` -> optional arguments
8981/// returns `VipsImage` - Output image
8982pub fn vipsload_source_with_opts(
8983    source: &VipsSource,
8984    vipsload_source_options: &VipsloadSourceOptions,
8985) -> Result<VipsImage> {
8986    unsafe {
8987        let source_in: *mut bindings::VipsSource = source.ctx;
8988        let mut out_out: *mut bindings::VipsImage = null_mut();
8989
8990        let flags_in: i32 = vipsload_source_options.flags as i32;
8991        let flags_in_name = utils::new_c_string("flags")?;
8992
8993        let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
8994        let memory_in_name = utils::new_c_string("memory")?;
8995
8996        let access_in: i32 = vipsload_source_options.access as i32;
8997        let access_in_name = utils::new_c_string("access")?;
8998
8999        let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9000        let fail_on_in_name = utils::new_c_string("fail-on")?;
9001
9002        let revalidate_in: i32 = if vipsload_source_options.revalidate {
9003            1
9004        } else {
9005            0
9006        };
9007        let revalidate_in_name = utils::new_c_string("revalidate")?;
9008
9009        let vips_op_response = bindings::vips_vipsload_source(
9010            source_in,
9011            &mut out_out,
9012            flags_in_name.as_ptr(),
9013            flags_in,
9014            memory_in_name.as_ptr(),
9015            memory_in,
9016            access_in_name.as_ptr(),
9017            access_in,
9018            fail_on_in_name.as_ptr(),
9019            fail_on_in,
9020            revalidate_in_name.as_ptr(),
9021            revalidate_in,
9022            NULL,
9023        );
9024        utils::result(
9025            vips_op_response,
9026            VipsImage { ctx: out_out },
9027            Error::VipsloadSourceError,
9028        )
9029    }
9030}
9031
9032/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9033/// filename: `&str` -> Filename to load from
9034/// returns `VipsImage` - Output image
9035pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9036    unsafe {
9037        let filename_in: CString = utils::new_c_string(filename)?;
9038        let mut out_out: *mut bindings::VipsImage = null_mut();
9039
9040        let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9041        utils::result(
9042            vips_op_response,
9043            VipsImage { ctx: out_out },
9044            Error::AnalyzeloadError,
9045        )
9046    }
9047}
9048
9049/// Options for analyzeload operation
9050#[derive(Clone, Debug)]
9051pub struct AnalyzeloadOptions {
9052    /// flags: `ForeignFlags` -> Flags for this file
9053    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9054    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9055    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9056    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9057    ///  `All` -> VIPS_FOREIGN_ALL = 7
9058    pub flags: ForeignFlags,
9059    /// memory: `bool` -> Force open via memory
9060    /// default: false
9061    pub memory: bool,
9062    /// access: `Access` -> Required access pattern for this file
9063    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9064    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9065    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9066    ///  `Last` -> VIPS_ACCESS_LAST = 3
9067    pub access: Access,
9068    /// fail_on: `FailOn` -> Error level to fail on
9069    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9070    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9071    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9072    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9073    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9074    pub fail_on: FailOn,
9075    /// revalidate: `bool` -> Don't use a cached result for this operation
9076    /// default: false
9077    pub revalidate: bool,
9078}
9079
9080impl std::default::Default for AnalyzeloadOptions {
9081    fn default() -> Self {
9082        AnalyzeloadOptions {
9083            flags: ForeignFlags::None,
9084            memory: false,
9085            access: Access::Random,
9086            fail_on: FailOn::None,
9087            revalidate: false,
9088        }
9089    }
9090}
9091
9092/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9093/// filename: `&str` -> Filename to load from
9094/// analyzeload_options: `&AnalyzeloadOptions` -> optional arguments
9095/// returns `VipsImage` - Output image
9096pub fn analyzeload_with_opts(
9097    filename: &str,
9098    analyzeload_options: &AnalyzeloadOptions,
9099) -> Result<VipsImage> {
9100    unsafe {
9101        let filename_in: CString = utils::new_c_string(filename)?;
9102        let mut out_out: *mut bindings::VipsImage = null_mut();
9103
9104        let flags_in: i32 = analyzeload_options.flags as i32;
9105        let flags_in_name = utils::new_c_string("flags")?;
9106
9107        let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9108        let memory_in_name = utils::new_c_string("memory")?;
9109
9110        let access_in: i32 = analyzeload_options.access as i32;
9111        let access_in_name = utils::new_c_string("access")?;
9112
9113        let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9114        let fail_on_in_name = utils::new_c_string("fail-on")?;
9115
9116        let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9117        let revalidate_in_name = utils::new_c_string("revalidate")?;
9118
9119        let vips_op_response = bindings::vips_analyzeload(
9120            filename_in.as_ptr(),
9121            &mut out_out,
9122            flags_in_name.as_ptr(),
9123            flags_in,
9124            memory_in_name.as_ptr(),
9125            memory_in,
9126            access_in_name.as_ptr(),
9127            access_in,
9128            fail_on_in_name.as_ptr(),
9129            fail_on_in,
9130            revalidate_in_name.as_ptr(),
9131            revalidate_in,
9132            NULL,
9133        );
9134        utils::result(
9135            vips_op_response,
9136            VipsImage { ctx: out_out },
9137            Error::AnalyzeloadError,
9138        )
9139    }
9140}
9141
9142/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9143/// filename: `&str` -> Filename to load from
9144/// returns `VipsImage` - Output image
9145pub fn ppmload(filename: &str) -> Result<VipsImage> {
9146    unsafe {
9147        let filename_in: CString = utils::new_c_string(filename)?;
9148        let mut out_out: *mut bindings::VipsImage = null_mut();
9149
9150        let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9151        utils::result(
9152            vips_op_response,
9153            VipsImage { ctx: out_out },
9154            Error::PpmloadError,
9155        )
9156    }
9157}
9158
9159/// Options for ppmload operation
9160#[derive(Clone, Debug)]
9161pub struct PpmloadOptions {
9162    /// flags: `ForeignFlags` -> Flags for this file
9163    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9164    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9165    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9166    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9167    ///  `All` -> VIPS_FOREIGN_ALL = 7
9168    pub flags: ForeignFlags,
9169    /// memory: `bool` -> Force open via memory
9170    /// default: false
9171    pub memory: bool,
9172    /// access: `Access` -> Required access pattern for this file
9173    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9174    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9175    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9176    ///  `Last` -> VIPS_ACCESS_LAST = 3
9177    pub access: Access,
9178    /// fail_on: `FailOn` -> Error level to fail on
9179    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9180    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9181    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9182    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9183    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9184    pub fail_on: FailOn,
9185    /// revalidate: `bool` -> Don't use a cached result for this operation
9186    /// default: false
9187    pub revalidate: bool,
9188}
9189
9190impl std::default::Default for PpmloadOptions {
9191    fn default() -> Self {
9192        PpmloadOptions {
9193            flags: ForeignFlags::None,
9194            memory: false,
9195            access: Access::Random,
9196            fail_on: FailOn::None,
9197            revalidate: false,
9198        }
9199    }
9200}
9201
9202/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9203/// filename: `&str` -> Filename to load from
9204/// ppmload_options: `&PpmloadOptions` -> optional arguments
9205/// returns `VipsImage` - Output image
9206pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9207    unsafe {
9208        let filename_in: CString = utils::new_c_string(filename)?;
9209        let mut out_out: *mut bindings::VipsImage = null_mut();
9210
9211        let flags_in: i32 = ppmload_options.flags as i32;
9212        let flags_in_name = utils::new_c_string("flags")?;
9213
9214        let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9215        let memory_in_name = utils::new_c_string("memory")?;
9216
9217        let access_in: i32 = ppmload_options.access as i32;
9218        let access_in_name = utils::new_c_string("access")?;
9219
9220        let fail_on_in: i32 = ppmload_options.fail_on as i32;
9221        let fail_on_in_name = utils::new_c_string("fail-on")?;
9222
9223        let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9224        let revalidate_in_name = utils::new_c_string("revalidate")?;
9225
9226        let vips_op_response = bindings::vips_ppmload(
9227            filename_in.as_ptr(),
9228            &mut out_out,
9229            flags_in_name.as_ptr(),
9230            flags_in,
9231            memory_in_name.as_ptr(),
9232            memory_in,
9233            access_in_name.as_ptr(),
9234            access_in,
9235            fail_on_in_name.as_ptr(),
9236            fail_on_in,
9237            revalidate_in_name.as_ptr(),
9238            revalidate_in,
9239            NULL,
9240        );
9241        utils::result(
9242            vips_op_response,
9243            VipsImage { ctx: out_out },
9244            Error::PpmloadError,
9245        )
9246    }
9247}
9248
9249/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9250/// source: `&VipsSource` -> Source to load from
9251/// returns `VipsImage` - Output image
9252pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9253    unsafe {
9254        let source_in: *mut bindings::VipsSource = source.ctx;
9255        let mut out_out: *mut bindings::VipsImage = null_mut();
9256
9257        let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9258        utils::result(
9259            vips_op_response,
9260            VipsImage { ctx: out_out },
9261            Error::PpmloadSourceError,
9262        )
9263    }
9264}
9265
9266/// Options for ppmload_source operation
9267#[derive(Clone, Debug)]
9268pub struct PpmloadSourceOptions {
9269    /// flags: `ForeignFlags` -> Flags for this file
9270    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9271    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9272    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9273    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9274    ///  `All` -> VIPS_FOREIGN_ALL = 7
9275    pub flags: ForeignFlags,
9276    /// memory: `bool` -> Force open via memory
9277    /// default: false
9278    pub memory: bool,
9279    /// access: `Access` -> Required access pattern for this file
9280    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9281    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9282    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9283    ///  `Last` -> VIPS_ACCESS_LAST = 3
9284    pub access: Access,
9285    /// fail_on: `FailOn` -> Error level to fail on
9286    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9287    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9288    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9289    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9290    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9291    pub fail_on: FailOn,
9292    /// revalidate: `bool` -> Don't use a cached result for this operation
9293    /// default: false
9294    pub revalidate: bool,
9295}
9296
9297impl std::default::Default for PpmloadSourceOptions {
9298    fn default() -> Self {
9299        PpmloadSourceOptions {
9300            flags: ForeignFlags::None,
9301            memory: false,
9302            access: Access::Random,
9303            fail_on: FailOn::None,
9304            revalidate: false,
9305        }
9306    }
9307}
9308
9309/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9310/// source: `&VipsSource` -> Source to load from
9311/// ppmload_source_options: `&PpmloadSourceOptions` -> optional arguments
9312/// returns `VipsImage` - Output image
9313pub fn ppmload_source_with_opts(
9314    source: &VipsSource,
9315    ppmload_source_options: &PpmloadSourceOptions,
9316) -> Result<VipsImage> {
9317    unsafe {
9318        let source_in: *mut bindings::VipsSource = source.ctx;
9319        let mut out_out: *mut bindings::VipsImage = null_mut();
9320
9321        let flags_in: i32 = ppmload_source_options.flags as i32;
9322        let flags_in_name = utils::new_c_string("flags")?;
9323
9324        let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9325        let memory_in_name = utils::new_c_string("memory")?;
9326
9327        let access_in: i32 = ppmload_source_options.access as i32;
9328        let access_in_name = utils::new_c_string("access")?;
9329
9330        let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9331        let fail_on_in_name = utils::new_c_string("fail-on")?;
9332
9333        let revalidate_in: i32 = if ppmload_source_options.revalidate {
9334            1
9335        } else {
9336            0
9337        };
9338        let revalidate_in_name = utils::new_c_string("revalidate")?;
9339
9340        let vips_op_response = bindings::vips_ppmload_source(
9341            source_in,
9342            &mut out_out,
9343            flags_in_name.as_ptr(),
9344            flags_in,
9345            memory_in_name.as_ptr(),
9346            memory_in,
9347            access_in_name.as_ptr(),
9348            access_in,
9349            fail_on_in_name.as_ptr(),
9350            fail_on_in,
9351            revalidate_in_name.as_ptr(),
9352            revalidate_in,
9353            NULL,
9354        );
9355        utils::result(
9356            vips_op_response,
9357            VipsImage { ctx: out_out },
9358            Error::PpmloadSourceError,
9359        )
9360    }
9361}
9362
9363/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9364/// filename: `&str` -> Filename to load from
9365/// returns `VipsImage` - Output image
9366pub fn radload(filename: &str) -> Result<VipsImage> {
9367    unsafe {
9368        let filename_in: CString = utils::new_c_string(filename)?;
9369        let mut out_out: *mut bindings::VipsImage = null_mut();
9370
9371        let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9372        utils::result(
9373            vips_op_response,
9374            VipsImage { ctx: out_out },
9375            Error::RadloadError,
9376        )
9377    }
9378}
9379
9380/// Options for radload operation
9381#[derive(Clone, Debug)]
9382pub struct RadloadOptions {
9383    /// flags: `ForeignFlags` -> Flags for this file
9384    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9385    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9386    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9387    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9388    ///  `All` -> VIPS_FOREIGN_ALL = 7
9389    pub flags: ForeignFlags,
9390    /// memory: `bool` -> Force open via memory
9391    /// default: false
9392    pub memory: bool,
9393    /// access: `Access` -> Required access pattern for this file
9394    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9395    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9396    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9397    ///  `Last` -> VIPS_ACCESS_LAST = 3
9398    pub access: Access,
9399    /// fail_on: `FailOn` -> Error level to fail on
9400    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9401    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9402    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9403    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9404    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9405    pub fail_on: FailOn,
9406    /// revalidate: `bool` -> Don't use a cached result for this operation
9407    /// default: false
9408    pub revalidate: bool,
9409}
9410
9411impl std::default::Default for RadloadOptions {
9412    fn default() -> Self {
9413        RadloadOptions {
9414            flags: ForeignFlags::None,
9415            memory: false,
9416            access: Access::Random,
9417            fail_on: FailOn::None,
9418            revalidate: false,
9419        }
9420    }
9421}
9422
9423/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9424/// filename: `&str` -> Filename to load from
9425/// radload_options: `&RadloadOptions` -> optional arguments
9426/// returns `VipsImage` - Output image
9427pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9428    unsafe {
9429        let filename_in: CString = utils::new_c_string(filename)?;
9430        let mut out_out: *mut bindings::VipsImage = null_mut();
9431
9432        let flags_in: i32 = radload_options.flags as i32;
9433        let flags_in_name = utils::new_c_string("flags")?;
9434
9435        let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9436        let memory_in_name = utils::new_c_string("memory")?;
9437
9438        let access_in: i32 = radload_options.access as i32;
9439        let access_in_name = utils::new_c_string("access")?;
9440
9441        let fail_on_in: i32 = radload_options.fail_on as i32;
9442        let fail_on_in_name = utils::new_c_string("fail-on")?;
9443
9444        let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9445        let revalidate_in_name = utils::new_c_string("revalidate")?;
9446
9447        let vips_op_response = bindings::vips_radload(
9448            filename_in.as_ptr(),
9449            &mut out_out,
9450            flags_in_name.as_ptr(),
9451            flags_in,
9452            memory_in_name.as_ptr(),
9453            memory_in,
9454            access_in_name.as_ptr(),
9455            access_in,
9456            fail_on_in_name.as_ptr(),
9457            fail_on_in,
9458            revalidate_in_name.as_ptr(),
9459            revalidate_in,
9460            NULL,
9461        );
9462        utils::result(
9463            vips_op_response,
9464            VipsImage { ctx: out_out },
9465            Error::RadloadError,
9466        )
9467    }
9468}
9469
9470/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9471/// buffer: `&[u8]` -> Buffer to load from
9472/// returns `VipsImage` - Output image
9473pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9474    unsafe {
9475        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9476        let mut out_out: *mut bindings::VipsImage = null_mut();
9477
9478        let vips_op_response =
9479            bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9480        utils::result(
9481            vips_op_response,
9482            VipsImage { ctx: out_out },
9483            Error::RadloadBufferError,
9484        )
9485    }
9486}
9487
9488/// Options for radload_buffer operation
9489#[derive(Clone, Debug)]
9490pub struct RadloadBufferOptions {
9491    /// flags: `ForeignFlags` -> Flags for this file
9492    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9493    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9494    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9495    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9496    ///  `All` -> VIPS_FOREIGN_ALL = 7
9497    pub flags: ForeignFlags,
9498    /// memory: `bool` -> Force open via memory
9499    /// default: false
9500    pub memory: bool,
9501    /// access: `Access` -> Required access pattern for this file
9502    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9503    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9504    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9505    ///  `Last` -> VIPS_ACCESS_LAST = 3
9506    pub access: Access,
9507    /// fail_on: `FailOn` -> Error level to fail on
9508    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9509    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9510    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9511    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9512    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9513    pub fail_on: FailOn,
9514    /// revalidate: `bool` -> Don't use a cached result for this operation
9515    /// default: false
9516    pub revalidate: bool,
9517}
9518
9519impl std::default::Default for RadloadBufferOptions {
9520    fn default() -> Self {
9521        RadloadBufferOptions {
9522            flags: ForeignFlags::None,
9523            memory: false,
9524            access: Access::Random,
9525            fail_on: FailOn::None,
9526            revalidate: false,
9527        }
9528    }
9529}
9530
9531/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9532/// buffer: `&[u8]` -> Buffer to load from
9533/// radload_buffer_options: `&RadloadBufferOptions` -> optional arguments
9534/// returns `VipsImage` - Output image
9535pub fn radload_buffer_with_opts(
9536    buffer: &[u8],
9537    radload_buffer_options: &RadloadBufferOptions,
9538) -> Result<VipsImage> {
9539    unsafe {
9540        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9541        let mut out_out: *mut bindings::VipsImage = null_mut();
9542
9543        let flags_in: i32 = radload_buffer_options.flags as i32;
9544        let flags_in_name = utils::new_c_string("flags")?;
9545
9546        let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9547        let memory_in_name = utils::new_c_string("memory")?;
9548
9549        let access_in: i32 = radload_buffer_options.access as i32;
9550        let access_in_name = utils::new_c_string("access")?;
9551
9552        let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9553        let fail_on_in_name = utils::new_c_string("fail-on")?;
9554
9555        let revalidate_in: i32 = if radload_buffer_options.revalidate {
9556            1
9557        } else {
9558            0
9559        };
9560        let revalidate_in_name = utils::new_c_string("revalidate")?;
9561
9562        let vips_op_response = bindings::vips_radload_buffer(
9563            buffer_in,
9564            buffer.len() as u64,
9565            &mut out_out,
9566            flags_in_name.as_ptr(),
9567            flags_in,
9568            memory_in_name.as_ptr(),
9569            memory_in,
9570            access_in_name.as_ptr(),
9571            access_in,
9572            fail_on_in_name.as_ptr(),
9573            fail_on_in,
9574            revalidate_in_name.as_ptr(),
9575            revalidate_in,
9576            NULL,
9577        );
9578        utils::result(
9579            vips_op_response,
9580            VipsImage { ctx: out_out },
9581            Error::RadloadBufferError,
9582        )
9583    }
9584}
9585
9586/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9587/// source: `&VipsSource` -> Source to load from
9588/// returns `VipsImage` - Output image
9589pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9590    unsafe {
9591        let source_in: *mut bindings::VipsSource = source.ctx;
9592        let mut out_out: *mut bindings::VipsImage = null_mut();
9593
9594        let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9595        utils::result(
9596            vips_op_response,
9597            VipsImage { ctx: out_out },
9598            Error::RadloadSourceError,
9599        )
9600    }
9601}
9602
9603/// Options for radload_source operation
9604#[derive(Clone, Debug)]
9605pub struct RadloadSourceOptions {
9606    /// flags: `ForeignFlags` -> Flags for this file
9607    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9608    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9609    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9610    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9611    ///  `All` -> VIPS_FOREIGN_ALL = 7
9612    pub flags: ForeignFlags,
9613    /// memory: `bool` -> Force open via memory
9614    /// default: false
9615    pub memory: bool,
9616    /// access: `Access` -> Required access pattern for this file
9617    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9618    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9619    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9620    ///  `Last` -> VIPS_ACCESS_LAST = 3
9621    pub access: Access,
9622    /// fail_on: `FailOn` -> Error level to fail on
9623    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9624    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9625    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9626    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9627    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9628    pub fail_on: FailOn,
9629    /// revalidate: `bool` -> Don't use a cached result for this operation
9630    /// default: false
9631    pub revalidate: bool,
9632}
9633
9634impl std::default::Default for RadloadSourceOptions {
9635    fn default() -> Self {
9636        RadloadSourceOptions {
9637            flags: ForeignFlags::None,
9638            memory: false,
9639            access: Access::Random,
9640            fail_on: FailOn::None,
9641            revalidate: false,
9642        }
9643    }
9644}
9645
9646/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9647/// source: `&VipsSource` -> Source to load from
9648/// radload_source_options: `&RadloadSourceOptions` -> optional arguments
9649/// returns `VipsImage` - Output image
9650pub fn radload_source_with_opts(
9651    source: &VipsSource,
9652    radload_source_options: &RadloadSourceOptions,
9653) -> Result<VipsImage> {
9654    unsafe {
9655        let source_in: *mut bindings::VipsSource = source.ctx;
9656        let mut out_out: *mut bindings::VipsImage = null_mut();
9657
9658        let flags_in: i32 = radload_source_options.flags as i32;
9659        let flags_in_name = utils::new_c_string("flags")?;
9660
9661        let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9662        let memory_in_name = utils::new_c_string("memory")?;
9663
9664        let access_in: i32 = radload_source_options.access as i32;
9665        let access_in_name = utils::new_c_string("access")?;
9666
9667        let fail_on_in: i32 = radload_source_options.fail_on as i32;
9668        let fail_on_in_name = utils::new_c_string("fail-on")?;
9669
9670        let revalidate_in: i32 = if radload_source_options.revalidate {
9671            1
9672        } else {
9673            0
9674        };
9675        let revalidate_in_name = utils::new_c_string("revalidate")?;
9676
9677        let vips_op_response = bindings::vips_radload_source(
9678            source_in,
9679            &mut out_out,
9680            flags_in_name.as_ptr(),
9681            flags_in,
9682            memory_in_name.as_ptr(),
9683            memory_in,
9684            access_in_name.as_ptr(),
9685            access_in,
9686            fail_on_in_name.as_ptr(),
9687            fail_on_in,
9688            revalidate_in_name.as_ptr(),
9689            revalidate_in,
9690            NULL,
9691        );
9692        utils::result(
9693            vips_op_response,
9694            VipsImage { ctx: out_out },
9695            Error::RadloadSourceError,
9696        )
9697    }
9698}
9699
9700/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9701/// filename: `&str` -> Filename to load from
9702/// returns `VipsImage` - Output image
9703pub fn svgload(filename: &str) -> Result<VipsImage> {
9704    unsafe {
9705        let filename_in: CString = utils::new_c_string(filename)?;
9706        let mut out_out: *mut bindings::VipsImage = null_mut();
9707
9708        let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9709        utils::result(
9710            vips_op_response,
9711            VipsImage { ctx: out_out },
9712            Error::SvgloadError,
9713        )
9714    }
9715}
9716
9717/// Options for svgload operation
9718#[derive(Clone, Debug)]
9719pub struct SvgloadOptions {
9720    /// dpi: `f64` -> Render at this DPI
9721    /// min: 0.001, max: 100000, default: 72
9722    pub dpi: f64,
9723    /// scale: `f64` -> Scale output by this factor
9724    /// min: 0.001, max: 100000, default: 1
9725    pub scale: f64,
9726    /// unlimited: `bool` -> Allow SVG of any size
9727    /// default: false
9728    pub unlimited: bool,
9729    /// flags: `ForeignFlags` -> Flags for this file
9730    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9731    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9732    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9733    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9734    ///  `All` -> VIPS_FOREIGN_ALL = 7
9735    pub flags: ForeignFlags,
9736    /// memory: `bool` -> Force open via memory
9737    /// default: false
9738    pub memory: bool,
9739    /// access: `Access` -> Required access pattern for this file
9740    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9741    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9742    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9743    ///  `Last` -> VIPS_ACCESS_LAST = 3
9744    pub access: Access,
9745    /// fail_on: `FailOn` -> Error level to fail on
9746    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9747    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9748    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9749    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9750    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9751    pub fail_on: FailOn,
9752    /// revalidate: `bool` -> Don't use a cached result for this operation
9753    /// default: false
9754    pub revalidate: bool,
9755}
9756
9757impl std::default::Default for SvgloadOptions {
9758    fn default() -> Self {
9759        SvgloadOptions {
9760            dpi: f64::from(72),
9761            scale: f64::from(1),
9762            unlimited: false,
9763            flags: ForeignFlags::None,
9764            memory: false,
9765            access: Access::Random,
9766            fail_on: FailOn::None,
9767            revalidate: false,
9768        }
9769    }
9770}
9771
9772/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9773/// filename: `&str` -> Filename to load from
9774/// svgload_options: `&SvgloadOptions` -> optional arguments
9775/// returns `VipsImage` - Output image
9776pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9777    unsafe {
9778        let filename_in: CString = utils::new_c_string(filename)?;
9779        let mut out_out: *mut bindings::VipsImage = null_mut();
9780
9781        let dpi_in: f64 = svgload_options.dpi;
9782        let dpi_in_name = utils::new_c_string("dpi")?;
9783
9784        let scale_in: f64 = svgload_options.scale;
9785        let scale_in_name = utils::new_c_string("scale")?;
9786
9787        let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9788        let unlimited_in_name = utils::new_c_string("unlimited")?;
9789
9790        let flags_in: i32 = svgload_options.flags as i32;
9791        let flags_in_name = utils::new_c_string("flags")?;
9792
9793        let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9794        let memory_in_name = utils::new_c_string("memory")?;
9795
9796        let access_in: i32 = svgload_options.access as i32;
9797        let access_in_name = utils::new_c_string("access")?;
9798
9799        let fail_on_in: i32 = svgload_options.fail_on as i32;
9800        let fail_on_in_name = utils::new_c_string("fail-on")?;
9801
9802        let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9803        let revalidate_in_name = utils::new_c_string("revalidate")?;
9804
9805        let vips_op_response = bindings::vips_svgload(
9806            filename_in.as_ptr(),
9807            &mut out_out,
9808            dpi_in_name.as_ptr(),
9809            dpi_in,
9810            scale_in_name.as_ptr(),
9811            scale_in,
9812            unlimited_in_name.as_ptr(),
9813            unlimited_in,
9814            flags_in_name.as_ptr(),
9815            flags_in,
9816            memory_in_name.as_ptr(),
9817            memory_in,
9818            access_in_name.as_ptr(),
9819            access_in,
9820            fail_on_in_name.as_ptr(),
9821            fail_on_in,
9822            revalidate_in_name.as_ptr(),
9823            revalidate_in,
9824            NULL,
9825        );
9826        utils::result(
9827            vips_op_response,
9828            VipsImage { ctx: out_out },
9829            Error::SvgloadError,
9830        )
9831    }
9832}
9833
9834/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9835/// buffer: `&[u8]` -> Buffer to load from
9836/// returns `VipsImage` - Output image
9837pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9838    unsafe {
9839        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9840        let mut out_out: *mut bindings::VipsImage = null_mut();
9841
9842        let vips_op_response =
9843            bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9844        utils::result(
9845            vips_op_response,
9846            VipsImage { ctx: out_out },
9847            Error::SvgloadBufferError,
9848        )
9849    }
9850}
9851
9852/// Options for svgload_buffer operation
9853#[derive(Clone, Debug)]
9854pub struct SvgloadBufferOptions {
9855    /// dpi: `f64` -> Render at this DPI
9856    /// min: 0.001, max: 100000, default: 72
9857    pub dpi: f64,
9858    /// scale: `f64` -> Scale output by this factor
9859    /// min: 0.001, max: 100000, default: 1
9860    pub scale: f64,
9861    /// unlimited: `bool` -> Allow SVG of any size
9862    /// default: false
9863    pub unlimited: bool,
9864    /// flags: `ForeignFlags` -> Flags for this file
9865    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9866    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9867    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9868    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9869    ///  `All` -> VIPS_FOREIGN_ALL = 7
9870    pub flags: ForeignFlags,
9871    /// memory: `bool` -> Force open via memory
9872    /// default: false
9873    pub memory: bool,
9874    /// access: `Access` -> Required access pattern for this file
9875    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9876    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9877    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9878    ///  `Last` -> VIPS_ACCESS_LAST = 3
9879    pub access: Access,
9880    /// fail_on: `FailOn` -> Error level to fail on
9881    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9882    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9883    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9884    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9885    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9886    pub fail_on: FailOn,
9887    /// revalidate: `bool` -> Don't use a cached result for this operation
9888    /// default: false
9889    pub revalidate: bool,
9890}
9891
9892impl std::default::Default for SvgloadBufferOptions {
9893    fn default() -> Self {
9894        SvgloadBufferOptions {
9895            dpi: f64::from(72),
9896            scale: f64::from(1),
9897            unlimited: false,
9898            flags: ForeignFlags::None,
9899            memory: false,
9900            access: Access::Random,
9901            fail_on: FailOn::None,
9902            revalidate: false,
9903        }
9904    }
9905}
9906
9907/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9908/// buffer: `&[u8]` -> Buffer to load from
9909/// svgload_buffer_options: `&SvgloadBufferOptions` -> optional arguments
9910/// returns `VipsImage` - Output image
9911pub fn svgload_buffer_with_opts(
9912    buffer: &[u8],
9913    svgload_buffer_options: &SvgloadBufferOptions,
9914) -> Result<VipsImage> {
9915    unsafe {
9916        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9917        let mut out_out: *mut bindings::VipsImage = null_mut();
9918
9919        let dpi_in: f64 = svgload_buffer_options.dpi;
9920        let dpi_in_name = utils::new_c_string("dpi")?;
9921
9922        let scale_in: f64 = svgload_buffer_options.scale;
9923        let scale_in_name = utils::new_c_string("scale")?;
9924
9925        let unlimited_in: i32 = if svgload_buffer_options.unlimited {
9926            1
9927        } else {
9928            0
9929        };
9930        let unlimited_in_name = utils::new_c_string("unlimited")?;
9931
9932        let flags_in: i32 = svgload_buffer_options.flags as i32;
9933        let flags_in_name = utils::new_c_string("flags")?;
9934
9935        let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
9936        let memory_in_name = utils::new_c_string("memory")?;
9937
9938        let access_in: i32 = svgload_buffer_options.access as i32;
9939        let access_in_name = utils::new_c_string("access")?;
9940
9941        let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
9942        let fail_on_in_name = utils::new_c_string("fail-on")?;
9943
9944        let revalidate_in: i32 = if svgload_buffer_options.revalidate {
9945            1
9946        } else {
9947            0
9948        };
9949        let revalidate_in_name = utils::new_c_string("revalidate")?;
9950
9951        let vips_op_response = bindings::vips_svgload_buffer(
9952            buffer_in,
9953            buffer.len() as u64,
9954            &mut out_out,
9955            dpi_in_name.as_ptr(),
9956            dpi_in,
9957            scale_in_name.as_ptr(),
9958            scale_in,
9959            unlimited_in_name.as_ptr(),
9960            unlimited_in,
9961            flags_in_name.as_ptr(),
9962            flags_in,
9963            memory_in_name.as_ptr(),
9964            memory_in,
9965            access_in_name.as_ptr(),
9966            access_in,
9967            fail_on_in_name.as_ptr(),
9968            fail_on_in,
9969            revalidate_in_name.as_ptr(),
9970            revalidate_in,
9971            NULL,
9972        );
9973        utils::result(
9974            vips_op_response,
9975            VipsImage { ctx: out_out },
9976            Error::SvgloadBufferError,
9977        )
9978    }
9979}
9980
9981/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
9982/// filename: `&str` -> Filename to load from
9983/// returns `VipsImage` - Output image
9984pub fn gifload(filename: &str) -> Result<VipsImage> {
9985    unsafe {
9986        let filename_in: CString = utils::new_c_string(filename)?;
9987        let mut out_out: *mut bindings::VipsImage = null_mut();
9988
9989        let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
9990        utils::result(
9991            vips_op_response,
9992            VipsImage { ctx: out_out },
9993            Error::GifloadError,
9994        )
9995    }
9996}
9997
9998/// Options for gifload operation
9999#[derive(Clone, Debug)]
10000pub struct GifloadOptions {
10001    /// n: `i32` -> Number of pages to load, -1 for all
10002    /// min: -1, max: 100000, default: 1
10003    pub n: i32,
10004    /// page: `i32` -> First page to load
10005    /// min: 0, max: 100000, default: 0
10006    pub page: i32,
10007    /// flags: `ForeignFlags` -> Flags for this file
10008    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10009    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10010    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10011    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10012    ///  `All` -> VIPS_FOREIGN_ALL = 7
10013    pub flags: ForeignFlags,
10014    /// memory: `bool` -> Force open via memory
10015    /// default: false
10016    pub memory: bool,
10017    /// access: `Access` -> Required access pattern for this file
10018    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10019    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10020    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10021    ///  `Last` -> VIPS_ACCESS_LAST = 3
10022    pub access: Access,
10023    /// fail_on: `FailOn` -> Error level to fail on
10024    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10025    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10026    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10027    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10028    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10029    pub fail_on: FailOn,
10030    /// revalidate: `bool` -> Don't use a cached result for this operation
10031    /// default: false
10032    pub revalidate: bool,
10033}
10034
10035impl std::default::Default for GifloadOptions {
10036    fn default() -> Self {
10037        GifloadOptions {
10038            n: i32::from(1),
10039            page: i32::from(0),
10040            flags: ForeignFlags::None,
10041            memory: false,
10042            access: Access::Random,
10043            fail_on: FailOn::None,
10044            revalidate: false,
10045        }
10046    }
10047}
10048
10049/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10050/// filename: `&str` -> Filename to load from
10051/// gifload_options: `&GifloadOptions` -> optional arguments
10052/// returns `VipsImage` - Output image
10053pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10054    unsafe {
10055        let filename_in: CString = utils::new_c_string(filename)?;
10056        let mut out_out: *mut bindings::VipsImage = null_mut();
10057
10058        let n_in: i32 = gifload_options.n;
10059        let n_in_name = utils::new_c_string("n")?;
10060
10061        let page_in: i32 = gifload_options.page;
10062        let page_in_name = utils::new_c_string("page")?;
10063
10064        let flags_in: i32 = gifload_options.flags as i32;
10065        let flags_in_name = utils::new_c_string("flags")?;
10066
10067        let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10068        let memory_in_name = utils::new_c_string("memory")?;
10069
10070        let access_in: i32 = gifload_options.access as i32;
10071        let access_in_name = utils::new_c_string("access")?;
10072
10073        let fail_on_in: i32 = gifload_options.fail_on as i32;
10074        let fail_on_in_name = utils::new_c_string("fail-on")?;
10075
10076        let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10077        let revalidate_in_name = utils::new_c_string("revalidate")?;
10078
10079        let vips_op_response = bindings::vips_gifload(
10080            filename_in.as_ptr(),
10081            &mut out_out,
10082            n_in_name.as_ptr(),
10083            n_in,
10084            page_in_name.as_ptr(),
10085            page_in,
10086            flags_in_name.as_ptr(),
10087            flags_in,
10088            memory_in_name.as_ptr(),
10089            memory_in,
10090            access_in_name.as_ptr(),
10091            access_in,
10092            fail_on_in_name.as_ptr(),
10093            fail_on_in,
10094            revalidate_in_name.as_ptr(),
10095            revalidate_in,
10096            NULL,
10097        );
10098        utils::result(
10099            vips_op_response,
10100            VipsImage { ctx: out_out },
10101            Error::GifloadError,
10102        )
10103    }
10104}
10105
10106/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10107/// buffer: `&[u8]` -> Buffer to load from
10108/// returns `VipsImage` - Output image
10109pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10110    unsafe {
10111        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10112        let mut out_out: *mut bindings::VipsImage = null_mut();
10113
10114        let vips_op_response =
10115            bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10116        utils::result(
10117            vips_op_response,
10118            VipsImage { ctx: out_out },
10119            Error::GifloadBufferError,
10120        )
10121    }
10122}
10123
10124/// Options for gifload_buffer operation
10125#[derive(Clone, Debug)]
10126pub struct GifloadBufferOptions {
10127    /// n: `i32` -> Number of pages to load, -1 for all
10128    /// min: -1, max: 100000, default: 1
10129    pub n: i32,
10130    /// page: `i32` -> First page to load
10131    /// min: 0, max: 100000, default: 0
10132    pub page: i32,
10133    /// flags: `ForeignFlags` -> Flags for this file
10134    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10135    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10136    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10137    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10138    ///  `All` -> VIPS_FOREIGN_ALL = 7
10139    pub flags: ForeignFlags,
10140    /// memory: `bool` -> Force open via memory
10141    /// default: false
10142    pub memory: bool,
10143    /// access: `Access` -> Required access pattern for this file
10144    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10145    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10146    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10147    ///  `Last` -> VIPS_ACCESS_LAST = 3
10148    pub access: Access,
10149    /// fail_on: `FailOn` -> Error level to fail on
10150    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10151    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10152    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10153    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10154    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10155    pub fail_on: FailOn,
10156    /// revalidate: `bool` -> Don't use a cached result for this operation
10157    /// default: false
10158    pub revalidate: bool,
10159}
10160
10161impl std::default::Default for GifloadBufferOptions {
10162    fn default() -> Self {
10163        GifloadBufferOptions {
10164            n: i32::from(1),
10165            page: i32::from(0),
10166            flags: ForeignFlags::None,
10167            memory: false,
10168            access: Access::Random,
10169            fail_on: FailOn::None,
10170            revalidate: false,
10171        }
10172    }
10173}
10174
10175/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10176/// buffer: `&[u8]` -> Buffer to load from
10177/// gifload_buffer_options: `&GifloadBufferOptions` -> optional arguments
10178/// returns `VipsImage` - Output image
10179pub fn gifload_buffer_with_opts(
10180    buffer: &[u8],
10181    gifload_buffer_options: &GifloadBufferOptions,
10182) -> Result<VipsImage> {
10183    unsafe {
10184        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10185        let mut out_out: *mut bindings::VipsImage = null_mut();
10186
10187        let n_in: i32 = gifload_buffer_options.n;
10188        let n_in_name = utils::new_c_string("n")?;
10189
10190        let page_in: i32 = gifload_buffer_options.page;
10191        let page_in_name = utils::new_c_string("page")?;
10192
10193        let flags_in: i32 = gifload_buffer_options.flags as i32;
10194        let flags_in_name = utils::new_c_string("flags")?;
10195
10196        let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10197        let memory_in_name = utils::new_c_string("memory")?;
10198
10199        let access_in: i32 = gifload_buffer_options.access as i32;
10200        let access_in_name = utils::new_c_string("access")?;
10201
10202        let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10203        let fail_on_in_name = utils::new_c_string("fail-on")?;
10204
10205        let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10206            1
10207        } else {
10208            0
10209        };
10210        let revalidate_in_name = utils::new_c_string("revalidate")?;
10211
10212        let vips_op_response = bindings::vips_gifload_buffer(
10213            buffer_in,
10214            buffer.len() as u64,
10215            &mut out_out,
10216            n_in_name.as_ptr(),
10217            n_in,
10218            page_in_name.as_ptr(),
10219            page_in,
10220            flags_in_name.as_ptr(),
10221            flags_in,
10222            memory_in_name.as_ptr(),
10223            memory_in,
10224            access_in_name.as_ptr(),
10225            access_in,
10226            fail_on_in_name.as_ptr(),
10227            fail_on_in,
10228            revalidate_in_name.as_ptr(),
10229            revalidate_in,
10230            NULL,
10231        );
10232        utils::result(
10233            vips_op_response,
10234            VipsImage { ctx: out_out },
10235            Error::GifloadBufferError,
10236        )
10237    }
10238}
10239
10240/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10241/// source: `&VipsSource` -> Source to load from
10242/// returns `VipsImage` - Output image
10243pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10244    unsafe {
10245        let source_in: *mut bindings::VipsSource = source.ctx;
10246        let mut out_out: *mut bindings::VipsImage = null_mut();
10247
10248        let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10249        utils::result(
10250            vips_op_response,
10251            VipsImage { ctx: out_out },
10252            Error::GifloadSourceError,
10253        )
10254    }
10255}
10256
10257/// Options for gifload_source operation
10258#[derive(Clone, Debug)]
10259pub struct GifloadSourceOptions {
10260    /// n: `i32` -> Number of pages to load, -1 for all
10261    /// min: -1, max: 100000, default: 1
10262    pub n: i32,
10263    /// page: `i32` -> First page to load
10264    /// min: 0, max: 100000, default: 0
10265    pub page: i32,
10266    /// flags: `ForeignFlags` -> Flags for this file
10267    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10268    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10269    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10270    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10271    ///  `All` -> VIPS_FOREIGN_ALL = 7
10272    pub flags: ForeignFlags,
10273    /// memory: `bool` -> Force open via memory
10274    /// default: false
10275    pub memory: bool,
10276    /// access: `Access` -> Required access pattern for this file
10277    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10278    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10279    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10280    ///  `Last` -> VIPS_ACCESS_LAST = 3
10281    pub access: Access,
10282    /// fail_on: `FailOn` -> Error level to fail on
10283    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10284    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10285    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10286    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10287    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10288    pub fail_on: FailOn,
10289    /// revalidate: `bool` -> Don't use a cached result for this operation
10290    /// default: false
10291    pub revalidate: bool,
10292}
10293
10294impl std::default::Default for GifloadSourceOptions {
10295    fn default() -> Self {
10296        GifloadSourceOptions {
10297            n: i32::from(1),
10298            page: i32::from(0),
10299            flags: ForeignFlags::None,
10300            memory: false,
10301            access: Access::Random,
10302            fail_on: FailOn::None,
10303            revalidate: false,
10304        }
10305    }
10306}
10307
10308/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10309/// source: `&VipsSource` -> Source to load from
10310/// gifload_source_options: `&GifloadSourceOptions` -> optional arguments
10311/// returns `VipsImage` - Output image
10312pub fn gifload_source_with_opts(
10313    source: &VipsSource,
10314    gifload_source_options: &GifloadSourceOptions,
10315) -> Result<VipsImage> {
10316    unsafe {
10317        let source_in: *mut bindings::VipsSource = source.ctx;
10318        let mut out_out: *mut bindings::VipsImage = null_mut();
10319
10320        let n_in: i32 = gifload_source_options.n;
10321        let n_in_name = utils::new_c_string("n")?;
10322
10323        let page_in: i32 = gifload_source_options.page;
10324        let page_in_name = utils::new_c_string("page")?;
10325
10326        let flags_in: i32 = gifload_source_options.flags as i32;
10327        let flags_in_name = utils::new_c_string("flags")?;
10328
10329        let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10330        let memory_in_name = utils::new_c_string("memory")?;
10331
10332        let access_in: i32 = gifload_source_options.access as i32;
10333        let access_in_name = utils::new_c_string("access")?;
10334
10335        let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10336        let fail_on_in_name = utils::new_c_string("fail-on")?;
10337
10338        let revalidate_in: i32 = if gifload_source_options.revalidate {
10339            1
10340        } else {
10341            0
10342        };
10343        let revalidate_in_name = utils::new_c_string("revalidate")?;
10344
10345        let vips_op_response = bindings::vips_gifload_source(
10346            source_in,
10347            &mut out_out,
10348            n_in_name.as_ptr(),
10349            n_in,
10350            page_in_name.as_ptr(),
10351            page_in,
10352            flags_in_name.as_ptr(),
10353            flags_in,
10354            memory_in_name.as_ptr(),
10355            memory_in,
10356            access_in_name.as_ptr(),
10357            access_in,
10358            fail_on_in_name.as_ptr(),
10359            fail_on_in,
10360            revalidate_in_name.as_ptr(),
10361            revalidate_in,
10362            NULL,
10363        );
10364        utils::result(
10365            vips_op_response,
10366            VipsImage { ctx: out_out },
10367            Error::GifloadSourceError,
10368        )
10369    }
10370}
10371
10372/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10373/// filename: `&str` -> Filename to load from
10374/// returns `VipsImage` - Output image
10375pub fn pngload(filename: &str) -> Result<VipsImage> {
10376    unsafe {
10377        let filename_in: CString = utils::new_c_string(filename)?;
10378        let mut out_out: *mut bindings::VipsImage = null_mut();
10379
10380        let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10381        utils::result(
10382            vips_op_response,
10383            VipsImage { ctx: out_out },
10384            Error::PngloadError,
10385        )
10386    }
10387}
10388
10389/// Options for pngload operation
10390#[derive(Clone, Debug)]
10391pub struct PngloadOptions {
10392    /// unlimited: `bool` -> Remove all denial of service limits
10393    /// default: false
10394    pub unlimited: bool,
10395    /// flags: `ForeignFlags` -> Flags for this file
10396    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10397    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10398    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10399    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10400    ///  `All` -> VIPS_FOREIGN_ALL = 7
10401    pub flags: ForeignFlags,
10402    /// memory: `bool` -> Force open via memory
10403    /// default: false
10404    pub memory: bool,
10405    /// access: `Access` -> Required access pattern for this file
10406    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10407    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10408    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10409    ///  `Last` -> VIPS_ACCESS_LAST = 3
10410    pub access: Access,
10411    /// fail_on: `FailOn` -> Error level to fail on
10412    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10413    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10414    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10415    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10416    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10417    pub fail_on: FailOn,
10418    /// revalidate: `bool` -> Don't use a cached result for this operation
10419    /// default: false
10420    pub revalidate: bool,
10421}
10422
10423impl std::default::Default for PngloadOptions {
10424    fn default() -> Self {
10425        PngloadOptions {
10426            unlimited: false,
10427            flags: ForeignFlags::None,
10428            memory: false,
10429            access: Access::Random,
10430            fail_on: FailOn::None,
10431            revalidate: false,
10432        }
10433    }
10434}
10435
10436/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10437/// filename: `&str` -> Filename to load from
10438/// pngload_options: `&PngloadOptions` -> optional arguments
10439/// returns `VipsImage` - Output image
10440pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10441    unsafe {
10442        let filename_in: CString = utils::new_c_string(filename)?;
10443        let mut out_out: *mut bindings::VipsImage = null_mut();
10444
10445        let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10446        let unlimited_in_name = utils::new_c_string("unlimited")?;
10447
10448        let flags_in: i32 = pngload_options.flags as i32;
10449        let flags_in_name = utils::new_c_string("flags")?;
10450
10451        let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10452        let memory_in_name = utils::new_c_string("memory")?;
10453
10454        let access_in: i32 = pngload_options.access as i32;
10455        let access_in_name = utils::new_c_string("access")?;
10456
10457        let fail_on_in: i32 = pngload_options.fail_on as i32;
10458        let fail_on_in_name = utils::new_c_string("fail-on")?;
10459
10460        let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10461        let revalidate_in_name = utils::new_c_string("revalidate")?;
10462
10463        let vips_op_response = bindings::vips_pngload(
10464            filename_in.as_ptr(),
10465            &mut out_out,
10466            unlimited_in_name.as_ptr(),
10467            unlimited_in,
10468            flags_in_name.as_ptr(),
10469            flags_in,
10470            memory_in_name.as_ptr(),
10471            memory_in,
10472            access_in_name.as_ptr(),
10473            access_in,
10474            fail_on_in_name.as_ptr(),
10475            fail_on_in,
10476            revalidate_in_name.as_ptr(),
10477            revalidate_in,
10478            NULL,
10479        );
10480        utils::result(
10481            vips_op_response,
10482            VipsImage { ctx: out_out },
10483            Error::PngloadError,
10484        )
10485    }
10486}
10487
10488/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10489/// buffer: `&[u8]` -> Buffer to load from
10490/// returns `VipsImage` - Output image
10491pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10492    unsafe {
10493        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10494        let mut out_out: *mut bindings::VipsImage = null_mut();
10495
10496        let vips_op_response =
10497            bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10498        utils::result(
10499            vips_op_response,
10500            VipsImage { ctx: out_out },
10501            Error::PngloadBufferError,
10502        )
10503    }
10504}
10505
10506/// Options for pngload_buffer operation
10507#[derive(Clone, Debug)]
10508pub struct PngloadBufferOptions {
10509    /// unlimited: `bool` -> Remove all denial of service limits
10510    /// default: false
10511    pub unlimited: bool,
10512    /// flags: `ForeignFlags` -> Flags for this file
10513    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10514    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10515    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10516    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10517    ///  `All` -> VIPS_FOREIGN_ALL = 7
10518    pub flags: ForeignFlags,
10519    /// memory: `bool` -> Force open via memory
10520    /// default: false
10521    pub memory: bool,
10522    /// access: `Access` -> Required access pattern for this file
10523    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10524    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10525    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10526    ///  `Last` -> VIPS_ACCESS_LAST = 3
10527    pub access: Access,
10528    /// fail_on: `FailOn` -> Error level to fail on
10529    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10530    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10531    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10532    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10533    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10534    pub fail_on: FailOn,
10535    /// revalidate: `bool` -> Don't use a cached result for this operation
10536    /// default: false
10537    pub revalidate: bool,
10538}
10539
10540impl std::default::Default for PngloadBufferOptions {
10541    fn default() -> Self {
10542        PngloadBufferOptions {
10543            unlimited: false,
10544            flags: ForeignFlags::None,
10545            memory: false,
10546            access: Access::Random,
10547            fail_on: FailOn::None,
10548            revalidate: false,
10549        }
10550    }
10551}
10552
10553/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10554/// buffer: `&[u8]` -> Buffer to load from
10555/// pngload_buffer_options: `&PngloadBufferOptions` -> optional arguments
10556/// returns `VipsImage` - Output image
10557pub fn pngload_buffer_with_opts(
10558    buffer: &[u8],
10559    pngload_buffer_options: &PngloadBufferOptions,
10560) -> Result<VipsImage> {
10561    unsafe {
10562        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10563        let mut out_out: *mut bindings::VipsImage = null_mut();
10564
10565        let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10566            1
10567        } else {
10568            0
10569        };
10570        let unlimited_in_name = utils::new_c_string("unlimited")?;
10571
10572        let flags_in: i32 = pngload_buffer_options.flags as i32;
10573        let flags_in_name = utils::new_c_string("flags")?;
10574
10575        let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10576        let memory_in_name = utils::new_c_string("memory")?;
10577
10578        let access_in: i32 = pngload_buffer_options.access as i32;
10579        let access_in_name = utils::new_c_string("access")?;
10580
10581        let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10582        let fail_on_in_name = utils::new_c_string("fail-on")?;
10583
10584        let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10585            1
10586        } else {
10587            0
10588        };
10589        let revalidate_in_name = utils::new_c_string("revalidate")?;
10590
10591        let vips_op_response = bindings::vips_pngload_buffer(
10592            buffer_in,
10593            buffer.len() as u64,
10594            &mut out_out,
10595            unlimited_in_name.as_ptr(),
10596            unlimited_in,
10597            flags_in_name.as_ptr(),
10598            flags_in,
10599            memory_in_name.as_ptr(),
10600            memory_in,
10601            access_in_name.as_ptr(),
10602            access_in,
10603            fail_on_in_name.as_ptr(),
10604            fail_on_in,
10605            revalidate_in_name.as_ptr(),
10606            revalidate_in,
10607            NULL,
10608        );
10609        utils::result(
10610            vips_op_response,
10611            VipsImage { ctx: out_out },
10612            Error::PngloadBufferError,
10613        )
10614    }
10615}
10616
10617/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10618/// source: `&VipsSource` -> Source to load from
10619/// returns `VipsImage` - Output image
10620pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10621    unsafe {
10622        let source_in: *mut bindings::VipsSource = source.ctx;
10623        let mut out_out: *mut bindings::VipsImage = null_mut();
10624
10625        let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10626        utils::result(
10627            vips_op_response,
10628            VipsImage { ctx: out_out },
10629            Error::PngloadSourceError,
10630        )
10631    }
10632}
10633
10634/// Options for pngload_source operation
10635#[derive(Clone, Debug)]
10636pub struct PngloadSourceOptions {
10637    /// unlimited: `bool` -> Remove all denial of service limits
10638    /// default: false
10639    pub unlimited: bool,
10640    /// flags: `ForeignFlags` -> Flags for this file
10641    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10642    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10643    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10644    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10645    ///  `All` -> VIPS_FOREIGN_ALL = 7
10646    pub flags: ForeignFlags,
10647    /// memory: `bool` -> Force open via memory
10648    /// default: false
10649    pub memory: bool,
10650    /// access: `Access` -> Required access pattern for this file
10651    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10652    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10653    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10654    ///  `Last` -> VIPS_ACCESS_LAST = 3
10655    pub access: Access,
10656    /// fail_on: `FailOn` -> Error level to fail on
10657    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10658    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10659    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10660    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10661    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10662    pub fail_on: FailOn,
10663    /// revalidate: `bool` -> Don't use a cached result for this operation
10664    /// default: false
10665    pub revalidate: bool,
10666}
10667
10668impl std::default::Default for PngloadSourceOptions {
10669    fn default() -> Self {
10670        PngloadSourceOptions {
10671            unlimited: false,
10672            flags: ForeignFlags::None,
10673            memory: false,
10674            access: Access::Random,
10675            fail_on: FailOn::None,
10676            revalidate: false,
10677        }
10678    }
10679}
10680
10681/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10682/// source: `&VipsSource` -> Source to load from
10683/// pngload_source_options: `&PngloadSourceOptions` -> optional arguments
10684/// returns `VipsImage` - Output image
10685pub fn pngload_source_with_opts(
10686    source: &VipsSource,
10687    pngload_source_options: &PngloadSourceOptions,
10688) -> Result<VipsImage> {
10689    unsafe {
10690        let source_in: *mut bindings::VipsSource = source.ctx;
10691        let mut out_out: *mut bindings::VipsImage = null_mut();
10692
10693        let unlimited_in: i32 = if pngload_source_options.unlimited {
10694            1
10695        } else {
10696            0
10697        };
10698        let unlimited_in_name = utils::new_c_string("unlimited")?;
10699
10700        let flags_in: i32 = pngload_source_options.flags as i32;
10701        let flags_in_name = utils::new_c_string("flags")?;
10702
10703        let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
10704        let memory_in_name = utils::new_c_string("memory")?;
10705
10706        let access_in: i32 = pngload_source_options.access as i32;
10707        let access_in_name = utils::new_c_string("access")?;
10708
10709        let fail_on_in: i32 = pngload_source_options.fail_on as i32;
10710        let fail_on_in_name = utils::new_c_string("fail-on")?;
10711
10712        let revalidate_in: i32 = if pngload_source_options.revalidate {
10713            1
10714        } else {
10715            0
10716        };
10717        let revalidate_in_name = utils::new_c_string("revalidate")?;
10718
10719        let vips_op_response = bindings::vips_pngload_source(
10720            source_in,
10721            &mut out_out,
10722            unlimited_in_name.as_ptr(),
10723            unlimited_in,
10724            flags_in_name.as_ptr(),
10725            flags_in,
10726            memory_in_name.as_ptr(),
10727            memory_in,
10728            access_in_name.as_ptr(),
10729            access_in,
10730            fail_on_in_name.as_ptr(),
10731            fail_on_in,
10732            revalidate_in_name.as_ptr(),
10733            revalidate_in,
10734            NULL,
10735        );
10736        utils::result(
10737            vips_op_response,
10738            VipsImage { ctx: out_out },
10739            Error::PngloadSourceError,
10740        )
10741    }
10742}
10743
10744/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe), priority=50, is_a, get_flags, get_flags_filename, header, load
10745/// filename: `&str` -> Filename to load from
10746/// returns `VipsImage` - Output image
10747pub fn jpegload(filename: &str) -> Result<VipsImage> {
10748    unsafe {
10749        let filename_in: CString = utils::new_c_string(filename)?;
10750        let mut out_out: *mut bindings::VipsImage = null_mut();
10751
10752        let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
10753        utils::result(
10754            vips_op_response,
10755            VipsImage { ctx: out_out },
10756            Error::JpegloadError,
10757        )
10758    }
10759}
10760
10761/// Options for jpegload operation
10762#[derive(Clone, Debug)]
10763pub struct JpegloadOptions {
10764    /// shrink: `i32` -> Shrink factor on load
10765    /// min: 1, max: 16, default: 1
10766    pub shrink: i32,
10767    /// autorotate: `bool` -> Rotate image using exif orientation
10768    /// default: false
10769    pub autorotate: bool,
10770    /// unlimited: `bool` -> Remove all denial of service limits
10771    /// default: false
10772    pub unlimited: bool,
10773    /// flags: `ForeignFlags` -> Flags for this file
10774    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10775    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10776    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10777    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10778    ///  `All` -> VIPS_FOREIGN_ALL = 7
10779    pub flags: ForeignFlags,
10780    /// memory: `bool` -> Force open via memory
10781    /// default: false
10782    pub memory: bool,
10783    /// access: `Access` -> Required access pattern for this file
10784    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10785    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10786    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10787    ///  `Last` -> VIPS_ACCESS_LAST = 3
10788    pub access: Access,
10789    /// fail_on: `FailOn` -> Error level to fail on
10790    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10791    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10792    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10793    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10794    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10795    pub fail_on: FailOn,
10796    /// revalidate: `bool` -> Don't use a cached result for this operation
10797    /// default: false
10798    pub revalidate: bool,
10799}
10800
10801impl std::default::Default for JpegloadOptions {
10802    fn default() -> Self {
10803        JpegloadOptions {
10804            shrink: i32::from(1),
10805            autorotate: false,
10806            unlimited: false,
10807            flags: ForeignFlags::None,
10808            memory: false,
10809            access: Access::Random,
10810            fail_on: FailOn::None,
10811            revalidate: false,
10812        }
10813    }
10814}
10815
10816/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe), priority=50, is_a, get_flags, get_flags_filename, header, load
10817/// filename: `&str` -> Filename to load from
10818/// jpegload_options: `&JpegloadOptions` -> optional arguments
10819/// returns `VipsImage` - Output image
10820pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
10821    unsafe {
10822        let filename_in: CString = utils::new_c_string(filename)?;
10823        let mut out_out: *mut bindings::VipsImage = null_mut();
10824
10825        let shrink_in: i32 = jpegload_options.shrink;
10826        let shrink_in_name = utils::new_c_string("shrink")?;
10827
10828        let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
10829        let autorotate_in_name = utils::new_c_string("autorotate")?;
10830
10831        let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
10832        let unlimited_in_name = utils::new_c_string("unlimited")?;
10833
10834        let flags_in: i32 = jpegload_options.flags as i32;
10835        let flags_in_name = utils::new_c_string("flags")?;
10836
10837        let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
10838        let memory_in_name = utils::new_c_string("memory")?;
10839
10840        let access_in: i32 = jpegload_options.access as i32;
10841        let access_in_name = utils::new_c_string("access")?;
10842
10843        let fail_on_in: i32 = jpegload_options.fail_on as i32;
10844        let fail_on_in_name = utils::new_c_string("fail-on")?;
10845
10846        let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
10847        let revalidate_in_name = utils::new_c_string("revalidate")?;
10848
10849        let vips_op_response = bindings::vips_jpegload(
10850            filename_in.as_ptr(),
10851            &mut out_out,
10852            shrink_in_name.as_ptr(),
10853            shrink_in,
10854            autorotate_in_name.as_ptr(),
10855            autorotate_in,
10856            unlimited_in_name.as_ptr(),
10857            unlimited_in,
10858            flags_in_name.as_ptr(),
10859            flags_in,
10860            memory_in_name.as_ptr(),
10861            memory_in,
10862            access_in_name.as_ptr(),
10863            access_in,
10864            fail_on_in_name.as_ptr(),
10865            fail_on_in,
10866            revalidate_in_name.as_ptr(),
10867            revalidate_in,
10868            NULL,
10869        );
10870        utils::result(
10871            vips_op_response,
10872            VipsImage { ctx: out_out },
10873            Error::JpegloadError,
10874        )
10875    }
10876}
10877
10878/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10879/// buffer: `&[u8]` -> Buffer to load from
10880/// returns `VipsImage` - Output image
10881pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10882    unsafe {
10883        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10884        let mut out_out: *mut bindings::VipsImage = null_mut();
10885
10886        let vips_op_response =
10887            bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10888        utils::result(
10889            vips_op_response,
10890            VipsImage { ctx: out_out },
10891            Error::JpegloadBufferError,
10892        )
10893    }
10894}
10895
10896/// Options for jpegload_buffer operation
10897#[derive(Clone, Debug)]
10898pub struct JpegloadBufferOptions {
10899    /// shrink: `i32` -> Shrink factor on load
10900    /// min: 1, max: 16, default: 1
10901    pub shrink: i32,
10902    /// autorotate: `bool` -> Rotate image using exif orientation
10903    /// default: false
10904    pub autorotate: bool,
10905    /// unlimited: `bool` -> Remove all denial of service limits
10906    /// default: false
10907    pub unlimited: bool,
10908    /// flags: `ForeignFlags` -> Flags for this file
10909    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10910    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10911    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10912    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10913    ///  `All` -> VIPS_FOREIGN_ALL = 7
10914    pub flags: ForeignFlags,
10915    /// memory: `bool` -> Force open via memory
10916    /// default: false
10917    pub memory: bool,
10918    /// access: `Access` -> Required access pattern for this file
10919    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10920    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10921    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10922    ///  `Last` -> VIPS_ACCESS_LAST = 3
10923    pub access: Access,
10924    /// fail_on: `FailOn` -> Error level to fail on
10925    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10926    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10927    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10928    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10929    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10930    pub fail_on: FailOn,
10931    /// revalidate: `bool` -> Don't use a cached result for this operation
10932    /// default: false
10933    pub revalidate: bool,
10934}
10935
10936impl std::default::Default for JpegloadBufferOptions {
10937    fn default() -> Self {
10938        JpegloadBufferOptions {
10939            shrink: i32::from(1),
10940            autorotate: false,
10941            unlimited: false,
10942            flags: ForeignFlags::None,
10943            memory: false,
10944            access: Access::Random,
10945            fail_on: FailOn::None,
10946            revalidate: false,
10947        }
10948    }
10949}
10950
10951/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10952/// buffer: `&[u8]` -> Buffer to load from
10953/// jpegload_buffer_options: `&JpegloadBufferOptions` -> optional arguments
10954/// returns `VipsImage` - Output image
10955pub fn jpegload_buffer_with_opts(
10956    buffer: &[u8],
10957    jpegload_buffer_options: &JpegloadBufferOptions,
10958) -> Result<VipsImage> {
10959    unsafe {
10960        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10961        let mut out_out: *mut bindings::VipsImage = null_mut();
10962
10963        let shrink_in: i32 = jpegload_buffer_options.shrink;
10964        let shrink_in_name = utils::new_c_string("shrink")?;
10965
10966        let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
10967            1
10968        } else {
10969            0
10970        };
10971        let autorotate_in_name = utils::new_c_string("autorotate")?;
10972
10973        let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
10974            1
10975        } else {
10976            0
10977        };
10978        let unlimited_in_name = utils::new_c_string("unlimited")?;
10979
10980        let flags_in: i32 = jpegload_buffer_options.flags as i32;
10981        let flags_in_name = utils::new_c_string("flags")?;
10982
10983        let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
10984        let memory_in_name = utils::new_c_string("memory")?;
10985
10986        let access_in: i32 = jpegload_buffer_options.access as i32;
10987        let access_in_name = utils::new_c_string("access")?;
10988
10989        let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
10990        let fail_on_in_name = utils::new_c_string("fail-on")?;
10991
10992        let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
10993            1
10994        } else {
10995            0
10996        };
10997        let revalidate_in_name = utils::new_c_string("revalidate")?;
10998
10999        let vips_op_response = bindings::vips_jpegload_buffer(
11000            buffer_in,
11001            buffer.len() as u64,
11002            &mut out_out,
11003            shrink_in_name.as_ptr(),
11004            shrink_in,
11005            autorotate_in_name.as_ptr(),
11006            autorotate_in,
11007            unlimited_in_name.as_ptr(),
11008            unlimited_in,
11009            flags_in_name.as_ptr(),
11010            flags_in,
11011            memory_in_name.as_ptr(),
11012            memory_in,
11013            access_in_name.as_ptr(),
11014            access_in,
11015            fail_on_in_name.as_ptr(),
11016            fail_on_in,
11017            revalidate_in_name.as_ptr(),
11018            revalidate_in,
11019            NULL,
11020        );
11021        utils::result(
11022            vips_op_response,
11023            VipsImage { ctx: out_out },
11024            Error::JpegloadBufferError,
11025        )
11026    }
11027}
11028
11029/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11030/// filename: `&str` -> Filename to load from
11031/// returns `VipsImage` - Output image
11032pub fn webpload(filename: &str) -> Result<VipsImage> {
11033    unsafe {
11034        let filename_in: CString = utils::new_c_string(filename)?;
11035        let mut out_out: *mut bindings::VipsImage = null_mut();
11036
11037        let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11038        utils::result(
11039            vips_op_response,
11040            VipsImage { ctx: out_out },
11041            Error::WebploadError,
11042        )
11043    }
11044}
11045
11046/// Options for webpload operation
11047#[derive(Clone, Debug)]
11048pub struct WebploadOptions {
11049    /// page: `i32` -> First page to load
11050    /// min: 0, max: 100000, default: 0
11051    pub page: i32,
11052    /// n: `i32` -> Number of pages to load, -1 for all
11053    /// min: -1, max: 100000, default: 1
11054    pub n: i32,
11055    /// scale: `f64` -> Factor to scale by
11056    /// min: 0, max: 1024, default: 1
11057    pub scale: f64,
11058    /// flags: `ForeignFlags` -> Flags for this file
11059    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11060    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11061    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11062    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11063    ///  `All` -> VIPS_FOREIGN_ALL = 7
11064    pub flags: ForeignFlags,
11065    /// memory: `bool` -> Force open via memory
11066    /// default: false
11067    pub memory: bool,
11068    /// access: `Access` -> Required access pattern for this file
11069    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11070    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11071    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11072    ///  `Last` -> VIPS_ACCESS_LAST = 3
11073    pub access: Access,
11074    /// fail_on: `FailOn` -> Error level to fail on
11075    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11076    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11077    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11078    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11079    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11080    pub fail_on: FailOn,
11081    /// revalidate: `bool` -> Don't use a cached result for this operation
11082    /// default: false
11083    pub revalidate: bool,
11084}
11085
11086impl std::default::Default for WebploadOptions {
11087    fn default() -> Self {
11088        WebploadOptions {
11089            page: i32::from(0),
11090            n: i32::from(1),
11091            scale: f64::from(1),
11092            flags: ForeignFlags::None,
11093            memory: false,
11094            access: Access::Random,
11095            fail_on: FailOn::None,
11096            revalidate: false,
11097        }
11098    }
11099}
11100
11101/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11102/// filename: `&str` -> Filename to load from
11103/// webpload_options: `&WebploadOptions` -> optional arguments
11104/// returns `VipsImage` - Output image
11105pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11106    unsafe {
11107        let filename_in: CString = utils::new_c_string(filename)?;
11108        let mut out_out: *mut bindings::VipsImage = null_mut();
11109
11110        let page_in: i32 = webpload_options.page;
11111        let page_in_name = utils::new_c_string("page")?;
11112
11113        let n_in: i32 = webpload_options.n;
11114        let n_in_name = utils::new_c_string("n")?;
11115
11116        let scale_in: f64 = webpload_options.scale;
11117        let scale_in_name = utils::new_c_string("scale")?;
11118
11119        let flags_in: i32 = webpload_options.flags as i32;
11120        let flags_in_name = utils::new_c_string("flags")?;
11121
11122        let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11123        let memory_in_name = utils::new_c_string("memory")?;
11124
11125        let access_in: i32 = webpload_options.access as i32;
11126        let access_in_name = utils::new_c_string("access")?;
11127
11128        let fail_on_in: i32 = webpload_options.fail_on as i32;
11129        let fail_on_in_name = utils::new_c_string("fail-on")?;
11130
11131        let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11132        let revalidate_in_name = utils::new_c_string("revalidate")?;
11133
11134        let vips_op_response = bindings::vips_webpload(
11135            filename_in.as_ptr(),
11136            &mut out_out,
11137            page_in_name.as_ptr(),
11138            page_in,
11139            n_in_name.as_ptr(),
11140            n_in,
11141            scale_in_name.as_ptr(),
11142            scale_in,
11143            flags_in_name.as_ptr(),
11144            flags_in,
11145            memory_in_name.as_ptr(),
11146            memory_in,
11147            access_in_name.as_ptr(),
11148            access_in,
11149            fail_on_in_name.as_ptr(),
11150            fail_on_in,
11151            revalidate_in_name.as_ptr(),
11152            revalidate_in,
11153            NULL,
11154        );
11155        utils::result(
11156            vips_op_response,
11157            VipsImage { ctx: out_out },
11158            Error::WebploadError,
11159        )
11160    }
11161}
11162
11163/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11164/// buffer: `&[u8]` -> Buffer to load from
11165/// returns `VipsImage` - Output image
11166pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11167    unsafe {
11168        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11169        let mut out_out: *mut bindings::VipsImage = null_mut();
11170
11171        let vips_op_response =
11172            bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11173        utils::result(
11174            vips_op_response,
11175            VipsImage { ctx: out_out },
11176            Error::WebploadBufferError,
11177        )
11178    }
11179}
11180
11181/// Options for webpload_buffer operation
11182#[derive(Clone, Debug)]
11183pub struct WebploadBufferOptions {
11184    /// page: `i32` -> First page to load
11185    /// min: 0, max: 100000, default: 0
11186    pub page: i32,
11187    /// n: `i32` -> Number of pages to load, -1 for all
11188    /// min: -1, max: 100000, default: 1
11189    pub n: i32,
11190    /// scale: `f64` -> Factor to scale by
11191    /// min: 0, max: 1024, default: 1
11192    pub scale: f64,
11193    /// flags: `ForeignFlags` -> Flags for this file
11194    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11195    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11196    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11197    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11198    ///  `All` -> VIPS_FOREIGN_ALL = 7
11199    pub flags: ForeignFlags,
11200    /// memory: `bool` -> Force open via memory
11201    /// default: false
11202    pub memory: bool,
11203    /// access: `Access` -> Required access pattern for this file
11204    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11205    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11206    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11207    ///  `Last` -> VIPS_ACCESS_LAST = 3
11208    pub access: Access,
11209    /// fail_on: `FailOn` -> Error level to fail on
11210    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11211    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11212    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11213    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11214    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11215    pub fail_on: FailOn,
11216    /// revalidate: `bool` -> Don't use a cached result for this operation
11217    /// default: false
11218    pub revalidate: bool,
11219}
11220
11221impl std::default::Default for WebploadBufferOptions {
11222    fn default() -> Self {
11223        WebploadBufferOptions {
11224            page: i32::from(0),
11225            n: i32::from(1),
11226            scale: f64::from(1),
11227            flags: ForeignFlags::None,
11228            memory: false,
11229            access: Access::Random,
11230            fail_on: FailOn::None,
11231            revalidate: false,
11232        }
11233    }
11234}
11235
11236/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11237/// buffer: `&[u8]` -> Buffer to load from
11238/// webpload_buffer_options: `&WebploadBufferOptions` -> optional arguments
11239/// returns `VipsImage` - Output image
11240pub fn webpload_buffer_with_opts(
11241    buffer: &[u8],
11242    webpload_buffer_options: &WebploadBufferOptions,
11243) -> Result<VipsImage> {
11244    unsafe {
11245        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11246        let mut out_out: *mut bindings::VipsImage = null_mut();
11247
11248        let page_in: i32 = webpload_buffer_options.page;
11249        let page_in_name = utils::new_c_string("page")?;
11250
11251        let n_in: i32 = webpload_buffer_options.n;
11252        let n_in_name = utils::new_c_string("n")?;
11253
11254        let scale_in: f64 = webpload_buffer_options.scale;
11255        let scale_in_name = utils::new_c_string("scale")?;
11256
11257        let flags_in: i32 = webpload_buffer_options.flags as i32;
11258        let flags_in_name = utils::new_c_string("flags")?;
11259
11260        let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11261        let memory_in_name = utils::new_c_string("memory")?;
11262
11263        let access_in: i32 = webpload_buffer_options.access as i32;
11264        let access_in_name = utils::new_c_string("access")?;
11265
11266        let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11267        let fail_on_in_name = utils::new_c_string("fail-on")?;
11268
11269        let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11270            1
11271        } else {
11272            0
11273        };
11274        let revalidate_in_name = utils::new_c_string("revalidate")?;
11275
11276        let vips_op_response = bindings::vips_webpload_buffer(
11277            buffer_in,
11278            buffer.len() as u64,
11279            &mut out_out,
11280            page_in_name.as_ptr(),
11281            page_in,
11282            n_in_name.as_ptr(),
11283            n_in,
11284            scale_in_name.as_ptr(),
11285            scale_in,
11286            flags_in_name.as_ptr(),
11287            flags_in,
11288            memory_in_name.as_ptr(),
11289            memory_in,
11290            access_in_name.as_ptr(),
11291            access_in,
11292            fail_on_in_name.as_ptr(),
11293            fail_on_in,
11294            revalidate_in_name.as_ptr(),
11295            revalidate_in,
11296            NULL,
11297        );
11298        utils::result(
11299            vips_op_response,
11300            VipsImage { ctx: out_out },
11301            Error::WebploadBufferError,
11302        )
11303    }
11304}
11305
11306/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11307/// source: `&VipsSource` -> Source to load from
11308/// returns `VipsImage` - Output image
11309pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11310    unsafe {
11311        let source_in: *mut bindings::VipsSource = source.ctx;
11312        let mut out_out: *mut bindings::VipsImage = null_mut();
11313
11314        let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11315        utils::result(
11316            vips_op_response,
11317            VipsImage { ctx: out_out },
11318            Error::WebploadSourceError,
11319        )
11320    }
11321}
11322
11323/// Options for webpload_source operation
11324#[derive(Clone, Debug)]
11325pub struct WebploadSourceOptions {
11326    /// page: `i32` -> First page to load
11327    /// min: 0, max: 100000, default: 0
11328    pub page: i32,
11329    /// n: `i32` -> Number of pages to load, -1 for all
11330    /// min: -1, max: 100000, default: 1
11331    pub n: i32,
11332    /// scale: `f64` -> Factor to scale by
11333    /// min: 0, max: 1024, default: 1
11334    pub scale: f64,
11335    /// flags: `ForeignFlags` -> Flags for this file
11336    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11337    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11338    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11339    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11340    ///  `All` -> VIPS_FOREIGN_ALL = 7
11341    pub flags: ForeignFlags,
11342    /// memory: `bool` -> Force open via memory
11343    /// default: false
11344    pub memory: bool,
11345    /// access: `Access` -> Required access pattern for this file
11346    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11347    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11348    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11349    ///  `Last` -> VIPS_ACCESS_LAST = 3
11350    pub access: Access,
11351    /// fail_on: `FailOn` -> Error level to fail on
11352    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11353    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11354    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11355    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11356    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11357    pub fail_on: FailOn,
11358    /// revalidate: `bool` -> Don't use a cached result for this operation
11359    /// default: false
11360    pub revalidate: bool,
11361}
11362
11363impl std::default::Default for WebploadSourceOptions {
11364    fn default() -> Self {
11365        WebploadSourceOptions {
11366            page: i32::from(0),
11367            n: i32::from(1),
11368            scale: f64::from(1),
11369            flags: ForeignFlags::None,
11370            memory: false,
11371            access: Access::Random,
11372            fail_on: FailOn::None,
11373            revalidate: false,
11374        }
11375    }
11376}
11377
11378/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11379/// source: `&VipsSource` -> Source to load from
11380/// webpload_source_options: `&WebploadSourceOptions` -> optional arguments
11381/// returns `VipsImage` - Output image
11382pub fn webpload_source_with_opts(
11383    source: &VipsSource,
11384    webpload_source_options: &WebploadSourceOptions,
11385) -> Result<VipsImage> {
11386    unsafe {
11387        let source_in: *mut bindings::VipsSource = source.ctx;
11388        let mut out_out: *mut bindings::VipsImage = null_mut();
11389
11390        let page_in: i32 = webpload_source_options.page;
11391        let page_in_name = utils::new_c_string("page")?;
11392
11393        let n_in: i32 = webpload_source_options.n;
11394        let n_in_name = utils::new_c_string("n")?;
11395
11396        let scale_in: f64 = webpload_source_options.scale;
11397        let scale_in_name = utils::new_c_string("scale")?;
11398
11399        let flags_in: i32 = webpload_source_options.flags as i32;
11400        let flags_in_name = utils::new_c_string("flags")?;
11401
11402        let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11403        let memory_in_name = utils::new_c_string("memory")?;
11404
11405        let access_in: i32 = webpload_source_options.access as i32;
11406        let access_in_name = utils::new_c_string("access")?;
11407
11408        let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11409        let fail_on_in_name = utils::new_c_string("fail-on")?;
11410
11411        let revalidate_in: i32 = if webpload_source_options.revalidate {
11412            1
11413        } else {
11414            0
11415        };
11416        let revalidate_in_name = utils::new_c_string("revalidate")?;
11417
11418        let vips_op_response = bindings::vips_webpload_source(
11419            source_in,
11420            &mut out_out,
11421            page_in_name.as_ptr(),
11422            page_in,
11423            n_in_name.as_ptr(),
11424            n_in,
11425            scale_in_name.as_ptr(),
11426            scale_in,
11427            flags_in_name.as_ptr(),
11428            flags_in,
11429            memory_in_name.as_ptr(),
11430            memory_in,
11431            access_in_name.as_ptr(),
11432            access_in,
11433            fail_on_in_name.as_ptr(),
11434            fail_on_in,
11435            revalidate_in_name.as_ptr(),
11436            revalidate_in,
11437            NULL,
11438        );
11439        utils::result(
11440            vips_op_response,
11441            VipsImage { ctx: out_out },
11442            Error::WebploadSourceError,
11443        )
11444    }
11445}
11446
11447/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11448/// filename: `&str` -> Filename to load from
11449/// returns `VipsImage` - Output image
11450pub fn tiffload(filename: &str) -> Result<VipsImage> {
11451    unsafe {
11452        let filename_in: CString = utils::new_c_string(filename)?;
11453        let mut out_out: *mut bindings::VipsImage = null_mut();
11454
11455        let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11456        utils::result(
11457            vips_op_response,
11458            VipsImage { ctx: out_out },
11459            Error::TiffloadError,
11460        )
11461    }
11462}
11463
11464/// Options for tiffload operation
11465#[derive(Clone, Debug)]
11466pub struct TiffloadOptions {
11467    /// page: `i32` -> First page to load
11468    /// min: 0, max: 100000, default: 0
11469    pub page: i32,
11470    /// subifd: `i32` -> Subifd index
11471    /// min: -1, max: 100000, default: -1
11472    pub subifd: i32,
11473    /// n: `i32` -> Number of pages to load, -1 for all
11474    /// min: -1, max: 100000, default: 1
11475    pub n: i32,
11476    /// autorotate: `bool` -> Rotate image using orientation tag
11477    /// default: false
11478    pub autorotate: bool,
11479    /// flags: `ForeignFlags` -> Flags for this file
11480    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11481    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11482    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11483    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11484    ///  `All` -> VIPS_FOREIGN_ALL = 7
11485    pub flags: ForeignFlags,
11486    /// memory: `bool` -> Force open via memory
11487    /// default: false
11488    pub memory: bool,
11489    /// access: `Access` -> Required access pattern for this file
11490    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11491    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11492    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11493    ///  `Last` -> VIPS_ACCESS_LAST = 3
11494    pub access: Access,
11495    /// fail_on: `FailOn` -> Error level to fail on
11496    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11497    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11498    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11499    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11500    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11501    pub fail_on: FailOn,
11502    /// revalidate: `bool` -> Don't use a cached result for this operation
11503    /// default: false
11504    pub revalidate: bool,
11505}
11506
11507impl std::default::Default for TiffloadOptions {
11508    fn default() -> Self {
11509        TiffloadOptions {
11510            page: i32::from(0),
11511            subifd: i32::from(-1),
11512            n: i32::from(1),
11513            autorotate: false,
11514            flags: ForeignFlags::None,
11515            memory: false,
11516            access: Access::Random,
11517            fail_on: FailOn::None,
11518            revalidate: false,
11519        }
11520    }
11521}
11522
11523/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11524/// filename: `&str` -> Filename to load from
11525/// tiffload_options: `&TiffloadOptions` -> optional arguments
11526/// returns `VipsImage` - Output image
11527pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11528    unsafe {
11529        let filename_in: CString = utils::new_c_string(filename)?;
11530        let mut out_out: *mut bindings::VipsImage = null_mut();
11531
11532        let page_in: i32 = tiffload_options.page;
11533        let page_in_name = utils::new_c_string("page")?;
11534
11535        let subifd_in: i32 = tiffload_options.subifd;
11536        let subifd_in_name = utils::new_c_string("subifd")?;
11537
11538        let n_in: i32 = tiffload_options.n;
11539        let n_in_name = utils::new_c_string("n")?;
11540
11541        let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11542        let autorotate_in_name = utils::new_c_string("autorotate")?;
11543
11544        let flags_in: i32 = tiffload_options.flags as i32;
11545        let flags_in_name = utils::new_c_string("flags")?;
11546
11547        let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11548        let memory_in_name = utils::new_c_string("memory")?;
11549
11550        let access_in: i32 = tiffload_options.access as i32;
11551        let access_in_name = utils::new_c_string("access")?;
11552
11553        let fail_on_in: i32 = tiffload_options.fail_on as i32;
11554        let fail_on_in_name = utils::new_c_string("fail-on")?;
11555
11556        let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11557        let revalidate_in_name = utils::new_c_string("revalidate")?;
11558
11559        let vips_op_response = bindings::vips_tiffload(
11560            filename_in.as_ptr(),
11561            &mut out_out,
11562            page_in_name.as_ptr(),
11563            page_in,
11564            subifd_in_name.as_ptr(),
11565            subifd_in,
11566            n_in_name.as_ptr(),
11567            n_in,
11568            autorotate_in_name.as_ptr(),
11569            autorotate_in,
11570            flags_in_name.as_ptr(),
11571            flags_in,
11572            memory_in_name.as_ptr(),
11573            memory_in,
11574            access_in_name.as_ptr(),
11575            access_in,
11576            fail_on_in_name.as_ptr(),
11577            fail_on_in,
11578            revalidate_in_name.as_ptr(),
11579            revalidate_in,
11580            NULL,
11581        );
11582        utils::result(
11583            vips_op_response,
11584            VipsImage { ctx: out_out },
11585            Error::TiffloadError,
11586        )
11587    }
11588}
11589
11590/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11591/// buffer: `&[u8]` -> Buffer to load from
11592/// returns `VipsImage` - Output image
11593pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11594    unsafe {
11595        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11596        let mut out_out: *mut bindings::VipsImage = null_mut();
11597
11598        let vips_op_response =
11599            bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11600        utils::result(
11601            vips_op_response,
11602            VipsImage { ctx: out_out },
11603            Error::TiffloadBufferError,
11604        )
11605    }
11606}
11607
11608/// Options for tiffload_buffer operation
11609#[derive(Clone, Debug)]
11610pub struct TiffloadBufferOptions {
11611    /// page: `i32` -> First page to load
11612    /// min: 0, max: 100000, default: 0
11613    pub page: i32,
11614    /// subifd: `i32` -> Subifd index
11615    /// min: -1, max: 100000, default: -1
11616    pub subifd: i32,
11617    /// n: `i32` -> Number of pages to load, -1 for all
11618    /// min: -1, max: 100000, default: 1
11619    pub n: i32,
11620    /// autorotate: `bool` -> Rotate image using orientation tag
11621    /// default: false
11622    pub autorotate: bool,
11623    /// flags: `ForeignFlags` -> Flags for this file
11624    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11625    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11626    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11627    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11628    ///  `All` -> VIPS_FOREIGN_ALL = 7
11629    pub flags: ForeignFlags,
11630    /// memory: `bool` -> Force open via memory
11631    /// default: false
11632    pub memory: bool,
11633    /// access: `Access` -> Required access pattern for this file
11634    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11635    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11636    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11637    ///  `Last` -> VIPS_ACCESS_LAST = 3
11638    pub access: Access,
11639    /// fail_on: `FailOn` -> Error level to fail on
11640    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11641    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11642    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11643    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11644    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11645    pub fail_on: FailOn,
11646    /// revalidate: `bool` -> Don't use a cached result for this operation
11647    /// default: false
11648    pub revalidate: bool,
11649}
11650
11651impl std::default::Default for TiffloadBufferOptions {
11652    fn default() -> Self {
11653        TiffloadBufferOptions {
11654            page: i32::from(0),
11655            subifd: i32::from(-1),
11656            n: i32::from(1),
11657            autorotate: false,
11658            flags: ForeignFlags::None,
11659            memory: false,
11660            access: Access::Random,
11661            fail_on: FailOn::None,
11662            revalidate: false,
11663        }
11664    }
11665}
11666
11667/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11668/// buffer: `&[u8]` -> Buffer to load from
11669/// tiffload_buffer_options: `&TiffloadBufferOptions` -> optional arguments
11670/// returns `VipsImage` - Output image
11671pub fn tiffload_buffer_with_opts(
11672    buffer: &[u8],
11673    tiffload_buffer_options: &TiffloadBufferOptions,
11674) -> Result<VipsImage> {
11675    unsafe {
11676        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11677        let mut out_out: *mut bindings::VipsImage = null_mut();
11678
11679        let page_in: i32 = tiffload_buffer_options.page;
11680        let page_in_name = utils::new_c_string("page")?;
11681
11682        let subifd_in: i32 = tiffload_buffer_options.subifd;
11683        let subifd_in_name = utils::new_c_string("subifd")?;
11684
11685        let n_in: i32 = tiffload_buffer_options.n;
11686        let n_in_name = utils::new_c_string("n")?;
11687
11688        let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
11689            1
11690        } else {
11691            0
11692        };
11693        let autorotate_in_name = utils::new_c_string("autorotate")?;
11694
11695        let flags_in: i32 = tiffload_buffer_options.flags as i32;
11696        let flags_in_name = utils::new_c_string("flags")?;
11697
11698        let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
11699        let memory_in_name = utils::new_c_string("memory")?;
11700
11701        let access_in: i32 = tiffload_buffer_options.access as i32;
11702        let access_in_name = utils::new_c_string("access")?;
11703
11704        let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
11705        let fail_on_in_name = utils::new_c_string("fail-on")?;
11706
11707        let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
11708            1
11709        } else {
11710            0
11711        };
11712        let revalidate_in_name = utils::new_c_string("revalidate")?;
11713
11714        let vips_op_response = bindings::vips_tiffload_buffer(
11715            buffer_in,
11716            buffer.len() as u64,
11717            &mut out_out,
11718            page_in_name.as_ptr(),
11719            page_in,
11720            subifd_in_name.as_ptr(),
11721            subifd_in,
11722            n_in_name.as_ptr(),
11723            n_in,
11724            autorotate_in_name.as_ptr(),
11725            autorotate_in,
11726            flags_in_name.as_ptr(),
11727            flags_in,
11728            memory_in_name.as_ptr(),
11729            memory_in,
11730            access_in_name.as_ptr(),
11731            access_in,
11732            fail_on_in_name.as_ptr(),
11733            fail_on_in,
11734            revalidate_in_name.as_ptr(),
11735            revalidate_in,
11736            NULL,
11737        );
11738        utils::result(
11739            vips_op_response,
11740            VipsImage { ctx: out_out },
11741            Error::TiffloadBufferError,
11742        )
11743    }
11744}
11745
11746/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11747/// source: `&VipsSource` -> Source to load from
11748/// returns `VipsImage` - Output image
11749pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
11750    unsafe {
11751        let source_in: *mut bindings::VipsSource = source.ctx;
11752        let mut out_out: *mut bindings::VipsImage = null_mut();
11753
11754        let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
11755        utils::result(
11756            vips_op_response,
11757            VipsImage { ctx: out_out },
11758            Error::TiffloadSourceError,
11759        )
11760    }
11761}
11762
11763/// Options for tiffload_source operation
11764#[derive(Clone, Debug)]
11765pub struct TiffloadSourceOptions {
11766    /// page: `i32` -> First page to load
11767    /// min: 0, max: 100000, default: 0
11768    pub page: i32,
11769    /// subifd: `i32` -> Subifd index
11770    /// min: -1, max: 100000, default: -1
11771    pub subifd: i32,
11772    /// n: `i32` -> Number of pages to load, -1 for all
11773    /// min: -1, max: 100000, default: 1
11774    pub n: i32,
11775    /// autorotate: `bool` -> Rotate image using orientation tag
11776    /// default: false
11777    pub autorotate: bool,
11778    /// flags: `ForeignFlags` -> Flags for this file
11779    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11780    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11781    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11782    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11783    ///  `All` -> VIPS_FOREIGN_ALL = 7
11784    pub flags: ForeignFlags,
11785    /// memory: `bool` -> Force open via memory
11786    /// default: false
11787    pub memory: bool,
11788    /// access: `Access` -> Required access pattern for this file
11789    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11790    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11791    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11792    ///  `Last` -> VIPS_ACCESS_LAST = 3
11793    pub access: Access,
11794    /// fail_on: `FailOn` -> Error level to fail on
11795    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11796    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11797    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11798    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11799    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11800    pub fail_on: FailOn,
11801    /// revalidate: `bool` -> Don't use a cached result for this operation
11802    /// default: false
11803    pub revalidate: bool,
11804}
11805
11806impl std::default::Default for TiffloadSourceOptions {
11807    fn default() -> Self {
11808        TiffloadSourceOptions {
11809            page: i32::from(0),
11810            subifd: i32::from(-1),
11811            n: i32::from(1),
11812            autorotate: false,
11813            flags: ForeignFlags::None,
11814            memory: false,
11815            access: Access::Random,
11816            fail_on: FailOn::None,
11817            revalidate: false,
11818        }
11819    }
11820}
11821
11822/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11823/// source: `&VipsSource` -> Source to load from
11824/// tiffload_source_options: `&TiffloadSourceOptions` -> optional arguments
11825/// returns `VipsImage` - Output image
11826pub fn tiffload_source_with_opts(
11827    source: &VipsSource,
11828    tiffload_source_options: &TiffloadSourceOptions,
11829) -> Result<VipsImage> {
11830    unsafe {
11831        let source_in: *mut bindings::VipsSource = source.ctx;
11832        let mut out_out: *mut bindings::VipsImage = null_mut();
11833
11834        let page_in: i32 = tiffload_source_options.page;
11835        let page_in_name = utils::new_c_string("page")?;
11836
11837        let subifd_in: i32 = tiffload_source_options.subifd;
11838        let subifd_in_name = utils::new_c_string("subifd")?;
11839
11840        let n_in: i32 = tiffload_source_options.n;
11841        let n_in_name = utils::new_c_string("n")?;
11842
11843        let autorotate_in: i32 = if tiffload_source_options.autorotate {
11844            1
11845        } else {
11846            0
11847        };
11848        let autorotate_in_name = utils::new_c_string("autorotate")?;
11849
11850        let flags_in: i32 = tiffload_source_options.flags as i32;
11851        let flags_in_name = utils::new_c_string("flags")?;
11852
11853        let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
11854        let memory_in_name = utils::new_c_string("memory")?;
11855
11856        let access_in: i32 = tiffload_source_options.access as i32;
11857        let access_in_name = utils::new_c_string("access")?;
11858
11859        let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
11860        let fail_on_in_name = utils::new_c_string("fail-on")?;
11861
11862        let revalidate_in: i32 = if tiffload_source_options.revalidate {
11863            1
11864        } else {
11865            0
11866        };
11867        let revalidate_in_name = utils::new_c_string("revalidate")?;
11868
11869        let vips_op_response = bindings::vips_tiffload_source(
11870            source_in,
11871            &mut out_out,
11872            page_in_name.as_ptr(),
11873            page_in,
11874            subifd_in_name.as_ptr(),
11875            subifd_in,
11876            n_in_name.as_ptr(),
11877            n_in,
11878            autorotate_in_name.as_ptr(),
11879            autorotate_in,
11880            flags_in_name.as_ptr(),
11881            flags_in,
11882            memory_in_name.as_ptr(),
11883            memory_in,
11884            access_in_name.as_ptr(),
11885            access_in,
11886            fail_on_in_name.as_ptr(),
11887            fail_on_in,
11888            revalidate_in_name.as_ptr(),
11889            revalidate_in,
11890            NULL,
11891        );
11892        utils::result(
11893            vips_op_response,
11894            VipsImage { ctx: out_out },
11895            Error::TiffloadSourceError,
11896        )
11897    }
11898}
11899
11900/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
11901/// filename: `&str` -> Filename to load from
11902/// returns `VipsImage` - Output image
11903pub fn heifload(filename: &str) -> Result<VipsImage> {
11904    unsafe {
11905        let filename_in: CString = utils::new_c_string(filename)?;
11906        let mut out_out: *mut bindings::VipsImage = null_mut();
11907
11908        let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
11909        utils::result(
11910            vips_op_response,
11911            VipsImage { ctx: out_out },
11912            Error::HeifloadError,
11913        )
11914    }
11915}
11916
11917/// Options for heifload operation
11918#[derive(Clone, Debug)]
11919pub struct HeifloadOptions {
11920    /// page: `i32` -> First page to load
11921    /// min: 0, max: 100000, default: 0
11922    pub page: i32,
11923    /// n: `i32` -> Number of pages to load, -1 for all
11924    /// min: -1, max: 100000, default: 1
11925    pub n: i32,
11926    /// thumbnail: `bool` -> Fetch thumbnail image
11927    /// default: false
11928    pub thumbnail: bool,
11929    /// unlimited: `bool` -> Remove all denial of service limits
11930    /// default: false
11931    pub unlimited: bool,
11932    /// flags: `ForeignFlags` -> Flags for this file
11933    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11934    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11935    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11936    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11937    ///  `All` -> VIPS_FOREIGN_ALL = 7
11938    pub flags: ForeignFlags,
11939    /// memory: `bool` -> Force open via memory
11940    /// default: false
11941    pub memory: bool,
11942    /// access: `Access` -> Required access pattern for this file
11943    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11944    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11945    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11946    ///  `Last` -> VIPS_ACCESS_LAST = 3
11947    pub access: Access,
11948    /// fail_on: `FailOn` -> Error level to fail on
11949    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11950    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11951    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11952    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11953    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11954    pub fail_on: FailOn,
11955    /// revalidate: `bool` -> Don't use a cached result for this operation
11956    /// default: false
11957    pub revalidate: bool,
11958}
11959
11960impl std::default::Default for HeifloadOptions {
11961    fn default() -> Self {
11962        HeifloadOptions {
11963            page: i32::from(0),
11964            n: i32::from(1),
11965            thumbnail: false,
11966            unlimited: false,
11967            flags: ForeignFlags::None,
11968            memory: false,
11969            access: Access::Random,
11970            fail_on: FailOn::None,
11971            revalidate: false,
11972        }
11973    }
11974}
11975
11976/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
11977/// filename: `&str` -> Filename to load from
11978/// heifload_options: `&HeifloadOptions` -> optional arguments
11979/// returns `VipsImage` - Output image
11980pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
11981    unsafe {
11982        let filename_in: CString = utils::new_c_string(filename)?;
11983        let mut out_out: *mut bindings::VipsImage = null_mut();
11984
11985        let page_in: i32 = heifload_options.page;
11986        let page_in_name = utils::new_c_string("page")?;
11987
11988        let n_in: i32 = heifload_options.n;
11989        let n_in_name = utils::new_c_string("n")?;
11990
11991        let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
11992        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
11993
11994        let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
11995        let unlimited_in_name = utils::new_c_string("unlimited")?;
11996
11997        let flags_in: i32 = heifload_options.flags as i32;
11998        let flags_in_name = utils::new_c_string("flags")?;
11999
12000        let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12001        let memory_in_name = utils::new_c_string("memory")?;
12002
12003        let access_in: i32 = heifload_options.access as i32;
12004        let access_in_name = utils::new_c_string("access")?;
12005
12006        let fail_on_in: i32 = heifload_options.fail_on as i32;
12007        let fail_on_in_name = utils::new_c_string("fail-on")?;
12008
12009        let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12010        let revalidate_in_name = utils::new_c_string("revalidate")?;
12011
12012        let vips_op_response = bindings::vips_heifload(
12013            filename_in.as_ptr(),
12014            &mut out_out,
12015            page_in_name.as_ptr(),
12016            page_in,
12017            n_in_name.as_ptr(),
12018            n_in,
12019            thumbnail_in_name.as_ptr(),
12020            thumbnail_in,
12021            unlimited_in_name.as_ptr(),
12022            unlimited_in,
12023            flags_in_name.as_ptr(),
12024            flags_in,
12025            memory_in_name.as_ptr(),
12026            memory_in,
12027            access_in_name.as_ptr(),
12028            access_in,
12029            fail_on_in_name.as_ptr(),
12030            fail_on_in,
12031            revalidate_in_name.as_ptr(),
12032            revalidate_in,
12033            NULL,
12034        );
12035        utils::result(
12036            vips_op_response,
12037            VipsImage { ctx: out_out },
12038            Error::HeifloadError,
12039        )
12040    }
12041}
12042
12043/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12044/// buffer: `&[u8]` -> Buffer to load from
12045/// returns `VipsImage` - Output image
12046pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12047    unsafe {
12048        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12049        let mut out_out: *mut bindings::VipsImage = null_mut();
12050
12051        let vips_op_response =
12052            bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12053        utils::result(
12054            vips_op_response,
12055            VipsImage { ctx: out_out },
12056            Error::HeifloadBufferError,
12057        )
12058    }
12059}
12060
12061/// Options for heifload_buffer operation
12062#[derive(Clone, Debug)]
12063pub struct HeifloadBufferOptions {
12064    /// page: `i32` -> First page to load
12065    /// min: 0, max: 100000, default: 0
12066    pub page: i32,
12067    /// n: `i32` -> Number of pages to load, -1 for all
12068    /// min: -1, max: 100000, default: 1
12069    pub n: i32,
12070    /// thumbnail: `bool` -> Fetch thumbnail image
12071    /// default: false
12072    pub thumbnail: bool,
12073    /// unlimited: `bool` -> Remove all denial of service limits
12074    /// default: false
12075    pub unlimited: bool,
12076    /// flags: `ForeignFlags` -> Flags for this file
12077    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12078    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12079    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12080    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12081    ///  `All` -> VIPS_FOREIGN_ALL = 7
12082    pub flags: ForeignFlags,
12083    /// memory: `bool` -> Force open via memory
12084    /// default: false
12085    pub memory: bool,
12086    /// access: `Access` -> Required access pattern for this file
12087    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12088    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12089    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12090    ///  `Last` -> VIPS_ACCESS_LAST = 3
12091    pub access: Access,
12092    /// fail_on: `FailOn` -> Error level to fail on
12093    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12094    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12095    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12096    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12097    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12098    pub fail_on: FailOn,
12099    /// revalidate: `bool` -> Don't use a cached result for this operation
12100    /// default: false
12101    pub revalidate: bool,
12102}
12103
12104impl std::default::Default for HeifloadBufferOptions {
12105    fn default() -> Self {
12106        HeifloadBufferOptions {
12107            page: i32::from(0),
12108            n: i32::from(1),
12109            thumbnail: false,
12110            unlimited: false,
12111            flags: ForeignFlags::None,
12112            memory: false,
12113            access: Access::Random,
12114            fail_on: FailOn::None,
12115            revalidate: false,
12116        }
12117    }
12118}
12119
12120/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12121/// buffer: `&[u8]` -> Buffer to load from
12122/// heifload_buffer_options: `&HeifloadBufferOptions` -> optional arguments
12123/// returns `VipsImage` - Output image
12124pub fn heifload_buffer_with_opts(
12125    buffer: &[u8],
12126    heifload_buffer_options: &HeifloadBufferOptions,
12127) -> Result<VipsImage> {
12128    unsafe {
12129        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12130        let mut out_out: *mut bindings::VipsImage = null_mut();
12131
12132        let page_in: i32 = heifload_buffer_options.page;
12133        let page_in_name = utils::new_c_string("page")?;
12134
12135        let n_in: i32 = heifload_buffer_options.n;
12136        let n_in_name = utils::new_c_string("n")?;
12137
12138        let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12139            1
12140        } else {
12141            0
12142        };
12143        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12144
12145        let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12146            1
12147        } else {
12148            0
12149        };
12150        let unlimited_in_name = utils::new_c_string("unlimited")?;
12151
12152        let flags_in: i32 = heifload_buffer_options.flags as i32;
12153        let flags_in_name = utils::new_c_string("flags")?;
12154
12155        let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12156        let memory_in_name = utils::new_c_string("memory")?;
12157
12158        let access_in: i32 = heifload_buffer_options.access as i32;
12159        let access_in_name = utils::new_c_string("access")?;
12160
12161        let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12162        let fail_on_in_name = utils::new_c_string("fail-on")?;
12163
12164        let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12165            1
12166        } else {
12167            0
12168        };
12169        let revalidate_in_name = utils::new_c_string("revalidate")?;
12170
12171        let vips_op_response = bindings::vips_heifload_buffer(
12172            buffer_in,
12173            buffer.len() as u64,
12174            &mut out_out,
12175            page_in_name.as_ptr(),
12176            page_in,
12177            n_in_name.as_ptr(),
12178            n_in,
12179            thumbnail_in_name.as_ptr(),
12180            thumbnail_in,
12181            unlimited_in_name.as_ptr(),
12182            unlimited_in,
12183            flags_in_name.as_ptr(),
12184            flags_in,
12185            memory_in_name.as_ptr(),
12186            memory_in,
12187            access_in_name.as_ptr(),
12188            access_in,
12189            fail_on_in_name.as_ptr(),
12190            fail_on_in,
12191            revalidate_in_name.as_ptr(),
12192            revalidate_in,
12193            NULL,
12194        );
12195        utils::result(
12196            vips_op_response,
12197            VipsImage { ctx: out_out },
12198            Error::HeifloadBufferError,
12199        )
12200    }
12201}
12202
12203/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12204/// source: `&VipsSource` -> Source to load from
12205/// returns `VipsImage` - Output image
12206pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12207    unsafe {
12208        let source_in: *mut bindings::VipsSource = source.ctx;
12209        let mut out_out: *mut bindings::VipsImage = null_mut();
12210
12211        let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12212        utils::result(
12213            vips_op_response,
12214            VipsImage { ctx: out_out },
12215            Error::HeifloadSourceError,
12216        )
12217    }
12218}
12219
12220/// Options for heifload_source operation
12221#[derive(Clone, Debug)]
12222pub struct HeifloadSourceOptions {
12223    /// page: `i32` -> First page to load
12224    /// min: 0, max: 100000, default: 0
12225    pub page: i32,
12226    /// n: `i32` -> Number of pages to load, -1 for all
12227    /// min: -1, max: 100000, default: 1
12228    pub n: i32,
12229    /// thumbnail: `bool` -> Fetch thumbnail image
12230    /// default: false
12231    pub thumbnail: bool,
12232    /// unlimited: `bool` -> Remove all denial of service limits
12233    /// default: false
12234    pub unlimited: bool,
12235    /// flags: `ForeignFlags` -> Flags for this file
12236    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12237    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12238    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12239    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12240    ///  `All` -> VIPS_FOREIGN_ALL = 7
12241    pub flags: ForeignFlags,
12242    /// memory: `bool` -> Force open via memory
12243    /// default: false
12244    pub memory: bool,
12245    /// access: `Access` -> Required access pattern for this file
12246    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12247    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12248    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12249    ///  `Last` -> VIPS_ACCESS_LAST = 3
12250    pub access: Access,
12251    /// fail_on: `FailOn` -> Error level to fail on
12252    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12253    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12254    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12255    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12256    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12257    pub fail_on: FailOn,
12258    /// revalidate: `bool` -> Don't use a cached result for this operation
12259    /// default: false
12260    pub revalidate: bool,
12261}
12262
12263impl std::default::Default for HeifloadSourceOptions {
12264    fn default() -> Self {
12265        HeifloadSourceOptions {
12266            page: i32::from(0),
12267            n: i32::from(1),
12268            thumbnail: false,
12269            unlimited: false,
12270            flags: ForeignFlags::None,
12271            memory: false,
12272            access: Access::Random,
12273            fail_on: FailOn::None,
12274            revalidate: false,
12275        }
12276    }
12277}
12278
12279/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
12280/// source: `&VipsSource` -> Source to load from
12281/// heifload_source_options: `&HeifloadSourceOptions` -> optional arguments
12282/// returns `VipsImage` - Output image
12283pub fn heifload_source_with_opts(
12284    source: &VipsSource,
12285    heifload_source_options: &HeifloadSourceOptions,
12286) -> Result<VipsImage> {
12287    unsafe {
12288        let source_in: *mut bindings::VipsSource = source.ctx;
12289        let mut out_out: *mut bindings::VipsImage = null_mut();
12290
12291        let page_in: i32 = heifload_source_options.page;
12292        let page_in_name = utils::new_c_string("page")?;
12293
12294        let n_in: i32 = heifload_source_options.n;
12295        let n_in_name = utils::new_c_string("n")?;
12296
12297        let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12298            1
12299        } else {
12300            0
12301        };
12302        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12303
12304        let unlimited_in: i32 = if heifload_source_options.unlimited {
12305            1
12306        } else {
12307            0
12308        };
12309        let unlimited_in_name = utils::new_c_string("unlimited")?;
12310
12311        let flags_in: i32 = heifload_source_options.flags as i32;
12312        let flags_in_name = utils::new_c_string("flags")?;
12313
12314        let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12315        let memory_in_name = utils::new_c_string("memory")?;
12316
12317        let access_in: i32 = heifload_source_options.access as i32;
12318        let access_in_name = utils::new_c_string("access")?;
12319
12320        let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12321        let fail_on_in_name = utils::new_c_string("fail-on")?;
12322
12323        let revalidate_in: i32 = if heifload_source_options.revalidate {
12324            1
12325        } else {
12326            0
12327        };
12328        let revalidate_in_name = utils::new_c_string("revalidate")?;
12329
12330        let vips_op_response = bindings::vips_heifload_source(
12331            source_in,
12332            &mut out_out,
12333            page_in_name.as_ptr(),
12334            page_in,
12335            n_in_name.as_ptr(),
12336            n_in,
12337            thumbnail_in_name.as_ptr(),
12338            thumbnail_in,
12339            unlimited_in_name.as_ptr(),
12340            unlimited_in,
12341            flags_in_name.as_ptr(),
12342            flags_in,
12343            memory_in_name.as_ptr(),
12344            memory_in,
12345            access_in_name.as_ptr(),
12346            access_in,
12347            fail_on_in_name.as_ptr(),
12348            fail_on_in,
12349            revalidate_in_name.as_ptr(),
12350            revalidate_in,
12351            NULL,
12352        );
12353        utils::result(
12354            vips_op_response,
12355            VipsImage { ctx: out_out },
12356            Error::HeifloadSourceError,
12357        )
12358    }
12359}
12360
12361/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12362/// inp: `&VipsImage` -> Image to save
12363/// filename: `&str` -> Filename to save to
12364
12365pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12366    unsafe {
12367        let inp_in: *mut bindings::VipsImage = inp.ctx;
12368        let filename_in: CString = utils::new_c_string(filename)?;
12369
12370        let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12371        utils::result(vips_op_response, (), Error::CsvsaveError)
12372    }
12373}
12374
12375/// Options for csvsave operation
12376#[derive(Clone, Debug)]
12377pub struct CsvsaveOptions {
12378    /// separator: `String` -> Separator characters
12379    pub separator: String,
12380    /// keep: `ForeignKeep` -> Which metadata to retain
12381    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12382    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12383    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12384    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12385    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12386    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12387    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12388    pub keep: ForeignKeep,
12389    /// background: `Vec<f64>` -> Background value
12390    pub background: Vec<f64>,
12391    /// page_height: `i32` -> Set page height for multipage save
12392    /// min: 0, max: 10000000, default: 0
12393    pub page_height: i32,
12394    /// profile: `String` -> Filename of ICC profile to embed
12395    pub profile: String,
12396}
12397
12398impl std::default::Default for CsvsaveOptions {
12399    fn default() -> Self {
12400        CsvsaveOptions {
12401            separator: String::new(),
12402            keep: ForeignKeep::All,
12403            background: Vec::new(),
12404            page_height: i32::from(0),
12405            profile: String::from("sRGB"),
12406        }
12407    }
12408}
12409
12410/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
12411/// inp: `&VipsImage` -> Image to save
12412/// filename: `&str` -> Filename to save to
12413/// csvsave_options: `&CsvsaveOptions` -> optional arguments
12414
12415pub fn csvsave_with_opts(
12416    inp: &VipsImage,
12417    filename: &str,
12418    csvsave_options: &CsvsaveOptions,
12419) -> Result<()> {
12420    unsafe {
12421        let inp_in: *mut bindings::VipsImage = inp.ctx;
12422        let filename_in: CString = utils::new_c_string(filename)?;
12423
12424        let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12425        let separator_in_name = utils::new_c_string("separator")?;
12426
12427        let keep_in: i32 = csvsave_options.keep as i32;
12428        let keep_in_name = utils::new_c_string("keep")?;
12429
12430        let background_wrapper =
12431            utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12432        let background_in = background_wrapper.ctx;
12433        let background_in_name = utils::new_c_string("background")?;
12434
12435        let page_height_in: i32 = csvsave_options.page_height;
12436        let page_height_in_name = utils::new_c_string("page-height")?;
12437
12438        let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12439        let profile_in_name = utils::new_c_string("profile")?;
12440
12441        let vips_op_response = bindings::vips_csvsave(
12442            inp_in,
12443            filename_in.as_ptr(),
12444            separator_in_name.as_ptr(),
12445            separator_in.as_ptr(),
12446            keep_in_name.as_ptr(),
12447            keep_in,
12448            background_in_name.as_ptr(),
12449            background_in,
12450            page_height_in_name.as_ptr(),
12451            page_height_in,
12452            profile_in_name.as_ptr(),
12453            profile_in.as_ptr(),
12454            NULL,
12455        );
12456        utils::result(vips_op_response, (), Error::CsvsaveError)
12457    }
12458}
12459
12460/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12461/// inp: `&VipsImage` -> Image to save
12462/// target: `&VipsTarget` -> Target to save to
12463
12464pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12465    unsafe {
12466        let inp_in: *mut bindings::VipsImage = inp.ctx;
12467        let target_in: *mut bindings::VipsTarget = target.ctx;
12468
12469        let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12470        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12471    }
12472}
12473
12474/// Options for csvsave_target operation
12475#[derive(Clone, Debug)]
12476pub struct CsvsaveTargetOptions {
12477    /// separator: `String` -> Separator characters
12478    pub separator: String,
12479    /// keep: `ForeignKeep` -> Which metadata to retain
12480    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12481    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12482    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12483    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12484    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12485    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12486    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12487    pub keep: ForeignKeep,
12488    /// background: `Vec<f64>` -> Background value
12489    pub background: Vec<f64>,
12490    /// page_height: `i32` -> Set page height for multipage save
12491    /// min: 0, max: 10000000, default: 0
12492    pub page_height: i32,
12493    /// profile: `String` -> Filename of ICC profile to embed
12494    pub profile: String,
12495}
12496
12497impl std::default::Default for CsvsaveTargetOptions {
12498    fn default() -> Self {
12499        CsvsaveTargetOptions {
12500            separator: String::new(),
12501            keep: ForeignKeep::All,
12502            background: Vec::new(),
12503            page_height: i32::from(0),
12504            profile: String::from("sRGB"),
12505        }
12506    }
12507}
12508
12509/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
12510/// inp: `&VipsImage` -> Image to save
12511/// target: `&VipsTarget` -> Target to save to
12512/// csvsave_target_options: `&CsvsaveTargetOptions` -> optional arguments
12513
12514pub fn csvsave_target_with_opts(
12515    inp: &VipsImage,
12516    target: &VipsTarget,
12517    csvsave_target_options: &CsvsaveTargetOptions,
12518) -> Result<()> {
12519    unsafe {
12520        let inp_in: *mut bindings::VipsImage = inp.ctx;
12521        let target_in: *mut bindings::VipsTarget = target.ctx;
12522
12523        let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12524        let separator_in_name = utils::new_c_string("separator")?;
12525
12526        let keep_in: i32 = csvsave_target_options.keep as i32;
12527        let keep_in_name = utils::new_c_string("keep")?;
12528
12529        let background_wrapper =
12530            utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12531        let background_in = background_wrapper.ctx;
12532        let background_in_name = utils::new_c_string("background")?;
12533
12534        let page_height_in: i32 = csvsave_target_options.page_height;
12535        let page_height_in_name = utils::new_c_string("page-height")?;
12536
12537        let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12538        let profile_in_name = utils::new_c_string("profile")?;
12539
12540        let vips_op_response = bindings::vips_csvsave_target(
12541            inp_in,
12542            target_in,
12543            separator_in_name.as_ptr(),
12544            separator_in.as_ptr(),
12545            keep_in_name.as_ptr(),
12546            keep_in,
12547            background_in_name.as_ptr(),
12548            background_in,
12549            page_height_in_name.as_ptr(),
12550            page_height_in,
12551            profile_in_name.as_ptr(),
12552            profile_in.as_ptr(),
12553            NULL,
12554        );
12555        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12556    }
12557}
12558
12559/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12560/// inp: `&VipsImage` -> Image to save
12561/// filename: `&str` -> Filename to save to
12562
12563pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12564    unsafe {
12565        let inp_in: *mut bindings::VipsImage = inp.ctx;
12566        let filename_in: CString = utils::new_c_string(filename)?;
12567
12568        let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12569        utils::result(vips_op_response, (), Error::MatrixsaveError)
12570    }
12571}
12572
12573/// Options for matrixsave operation
12574#[derive(Clone, Debug)]
12575pub struct MatrixsaveOptions {
12576    /// keep: `ForeignKeep` -> Which metadata to retain
12577    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12578    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12579    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12580    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12581    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12582    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12583    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12584    pub keep: ForeignKeep,
12585    /// background: `Vec<f64>` -> Background value
12586    pub background: Vec<f64>,
12587    /// page_height: `i32` -> Set page height for multipage save
12588    /// min: 0, max: 10000000, default: 0
12589    pub page_height: i32,
12590    /// profile: `String` -> Filename of ICC profile to embed
12591    pub profile: String,
12592}
12593
12594impl std::default::Default for MatrixsaveOptions {
12595    fn default() -> Self {
12596        MatrixsaveOptions {
12597            keep: ForeignKeep::All,
12598            background: Vec::new(),
12599            page_height: i32::from(0),
12600            profile: String::from("sRGB"),
12601        }
12602    }
12603}
12604
12605/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
12606/// inp: `&VipsImage` -> Image to save
12607/// filename: `&str` -> Filename to save to
12608/// matrixsave_options: `&MatrixsaveOptions` -> optional arguments
12609
12610pub fn matrixsave_with_opts(
12611    inp: &VipsImage,
12612    filename: &str,
12613    matrixsave_options: &MatrixsaveOptions,
12614) -> Result<()> {
12615    unsafe {
12616        let inp_in: *mut bindings::VipsImage = inp.ctx;
12617        let filename_in: CString = utils::new_c_string(filename)?;
12618
12619        let keep_in: i32 = matrixsave_options.keep as i32;
12620        let keep_in_name = utils::new_c_string("keep")?;
12621
12622        let background_wrapper =
12623            utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
12624        let background_in = background_wrapper.ctx;
12625        let background_in_name = utils::new_c_string("background")?;
12626
12627        let page_height_in: i32 = matrixsave_options.page_height;
12628        let page_height_in_name = utils::new_c_string("page-height")?;
12629
12630        let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
12631        let profile_in_name = utils::new_c_string("profile")?;
12632
12633        let vips_op_response = bindings::vips_matrixsave(
12634            inp_in,
12635            filename_in.as_ptr(),
12636            keep_in_name.as_ptr(),
12637            keep_in,
12638            background_in_name.as_ptr(),
12639            background_in,
12640            page_height_in_name.as_ptr(),
12641            page_height_in,
12642            profile_in_name.as_ptr(),
12643            profile_in.as_ptr(),
12644            NULL,
12645        );
12646        utils::result(vips_op_response, (), Error::MatrixsaveError)
12647    }
12648}
12649
12650/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
12651/// inp: `&VipsImage` -> Image to save
12652/// target: `&VipsTarget` -> Target to save to
12653
12654pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12655    unsafe {
12656        let inp_in: *mut bindings::VipsImage = inp.ctx;
12657        let target_in: *mut bindings::VipsTarget = target.ctx;
12658
12659        let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
12660        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12661    }
12662}
12663
12664/// Options for matrixsave_target operation
12665#[derive(Clone, Debug)]
12666pub struct MatrixsaveTargetOptions {
12667    /// keep: `ForeignKeep` -> Which metadata to retain
12668    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12669    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12670    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12671    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12672    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12673    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12674    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12675    pub keep: ForeignKeep,
12676    /// background: `Vec<f64>` -> Background value
12677    pub background: Vec<f64>,
12678    /// page_height: `i32` -> Set page height for multipage save
12679    /// min: 0, max: 10000000, default: 0
12680    pub page_height: i32,
12681    /// profile: `String` -> Filename of ICC profile to embed
12682    pub profile: String,
12683}
12684
12685impl std::default::Default for MatrixsaveTargetOptions {
12686    fn default() -> Self {
12687        MatrixsaveTargetOptions {
12688            keep: ForeignKeep::All,
12689            background: Vec::new(),
12690            page_height: i32::from(0),
12691            profile: String::from("sRGB"),
12692        }
12693    }
12694}
12695
12696/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
12697/// inp: `&VipsImage` -> Image to save
12698/// target: `&VipsTarget` -> Target to save to
12699/// matrixsave_target_options: `&MatrixsaveTargetOptions` -> optional arguments
12700
12701pub fn matrixsave_target_with_opts(
12702    inp: &VipsImage,
12703    target: &VipsTarget,
12704    matrixsave_target_options: &MatrixsaveTargetOptions,
12705) -> Result<()> {
12706    unsafe {
12707        let inp_in: *mut bindings::VipsImage = inp.ctx;
12708        let target_in: *mut bindings::VipsTarget = target.ctx;
12709
12710        let keep_in: i32 = matrixsave_target_options.keep as i32;
12711        let keep_in_name = utils::new_c_string("keep")?;
12712
12713        let background_wrapper =
12714            utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
12715        let background_in = background_wrapper.ctx;
12716        let background_in_name = utils::new_c_string("background")?;
12717
12718        let page_height_in: i32 = matrixsave_target_options.page_height;
12719        let page_height_in_name = utils::new_c_string("page-height")?;
12720
12721        let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
12722        let profile_in_name = utils::new_c_string("profile")?;
12723
12724        let vips_op_response = bindings::vips_matrixsave_target(
12725            inp_in,
12726            target_in,
12727            keep_in_name.as_ptr(),
12728            keep_in,
12729            background_in_name.as_ptr(),
12730            background_in,
12731            page_height_in_name.as_ptr(),
12732            page_height_in,
12733            profile_in_name.as_ptr(),
12734            profile_in.as_ptr(),
12735            NULL,
12736        );
12737        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12738    }
12739}
12740
12741/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
12742/// inp: `&VipsImage` -> Image to save
12743
12744pub fn matrixprint(inp: &VipsImage) -> Result<()> {
12745    unsafe {
12746        let inp_in: *mut bindings::VipsImage = inp.ctx;
12747
12748        let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
12749        utils::result(vips_op_response, (), Error::MatrixprintError)
12750    }
12751}
12752
12753/// Options for matrixprint operation
12754#[derive(Clone, Debug)]
12755pub struct MatrixprintOptions {
12756    /// keep: `ForeignKeep` -> Which metadata to retain
12757    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12758    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12759    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12760    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12761    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12762    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12763    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12764    pub keep: ForeignKeep,
12765    /// background: `Vec<f64>` -> Background value
12766    pub background: Vec<f64>,
12767    /// page_height: `i32` -> Set page height for multipage save
12768    /// min: 0, max: 10000000, default: 0
12769    pub page_height: i32,
12770    /// profile: `String` -> Filename of ICC profile to embed
12771    pub profile: String,
12772}
12773
12774impl std::default::Default for MatrixprintOptions {
12775    fn default() -> Self {
12776        MatrixprintOptions {
12777            keep: ForeignKeep::All,
12778            background: Vec::new(),
12779            page_height: i32::from(0),
12780            profile: String::from("sRGB"),
12781        }
12782    }
12783}
12784
12785/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
12786/// inp: `&VipsImage` -> Image to save
12787/// matrixprint_options: `&MatrixprintOptions` -> optional arguments
12788
12789pub fn matrixprint_with_opts(
12790    inp: &VipsImage,
12791    matrixprint_options: &MatrixprintOptions,
12792) -> Result<()> {
12793    unsafe {
12794        let inp_in: *mut bindings::VipsImage = inp.ctx;
12795
12796        let keep_in: i32 = matrixprint_options.keep as i32;
12797        let keep_in_name = utils::new_c_string("keep")?;
12798
12799        let background_wrapper =
12800            utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
12801        let background_in = background_wrapper.ctx;
12802        let background_in_name = utils::new_c_string("background")?;
12803
12804        let page_height_in: i32 = matrixprint_options.page_height;
12805        let page_height_in_name = utils::new_c_string("page-height")?;
12806
12807        let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
12808        let profile_in_name = utils::new_c_string("profile")?;
12809
12810        let vips_op_response = bindings::vips_matrixprint(
12811            inp_in,
12812            keep_in_name.as_ptr(),
12813            keep_in,
12814            background_in_name.as_ptr(),
12815            background_in,
12816            page_height_in_name.as_ptr(),
12817            page_height_in,
12818            profile_in_name.as_ptr(),
12819            profile_in.as_ptr(),
12820            NULL,
12821        );
12822        utils::result(vips_op_response, (), Error::MatrixprintError)
12823    }
12824}
12825
12826/// VipsForeignSaveRaw (rawsave), save image to raw file (.raw), priority=0, any
12827/// inp: `&VipsImage` -> Image to save
12828/// filename: `&str` -> Filename to save to
12829
12830pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
12831    unsafe {
12832        let inp_in: *mut bindings::VipsImage = inp.ctx;
12833        let filename_in: CString = utils::new_c_string(filename)?;
12834
12835        let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
12836        utils::result(vips_op_response, (), Error::RawsaveError)
12837    }
12838}
12839
12840/// Options for rawsave operation
12841#[derive(Clone, Debug)]
12842pub struct RawsaveOptions {
12843    /// keep: `ForeignKeep` -> Which metadata to retain
12844    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12845    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12846    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12847    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12848    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12849    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12850    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12851    pub keep: ForeignKeep,
12852    /// background: `Vec<f64>` -> Background value
12853    pub background: Vec<f64>,
12854    /// page_height: `i32` -> Set page height for multipage save
12855    /// min: 0, max: 10000000, default: 0
12856    pub page_height: i32,
12857    /// profile: `String` -> Filename of ICC profile to embed
12858    pub profile: String,
12859}
12860
12861impl std::default::Default for RawsaveOptions {
12862    fn default() -> Self {
12863        RawsaveOptions {
12864            keep: ForeignKeep::All,
12865            background: Vec::new(),
12866            page_height: i32::from(0),
12867            profile: String::from("sRGB"),
12868        }
12869    }
12870}
12871
12872/// VipsForeignSaveRaw (rawsave), save image to raw file (.raw), priority=0, any
12873/// inp: `&VipsImage` -> Image to save
12874/// filename: `&str` -> Filename to save to
12875/// rawsave_options: `&RawsaveOptions` -> optional arguments
12876
12877pub fn rawsave_with_opts(
12878    inp: &VipsImage,
12879    filename: &str,
12880    rawsave_options: &RawsaveOptions,
12881) -> Result<()> {
12882    unsafe {
12883        let inp_in: *mut bindings::VipsImage = inp.ctx;
12884        let filename_in: CString = utils::new_c_string(filename)?;
12885
12886        let keep_in: i32 = rawsave_options.keep as i32;
12887        let keep_in_name = utils::new_c_string("keep")?;
12888
12889        let background_wrapper =
12890            utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
12891        let background_in = background_wrapper.ctx;
12892        let background_in_name = utils::new_c_string("background")?;
12893
12894        let page_height_in: i32 = rawsave_options.page_height;
12895        let page_height_in_name = utils::new_c_string("page-height")?;
12896
12897        let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
12898        let profile_in_name = utils::new_c_string("profile")?;
12899
12900        let vips_op_response = bindings::vips_rawsave(
12901            inp_in,
12902            filename_in.as_ptr(),
12903            keep_in_name.as_ptr(),
12904            keep_in,
12905            background_in_name.as_ptr(),
12906            background_in,
12907            page_height_in_name.as_ptr(),
12908            page_height_in,
12909            profile_in_name.as_ptr(),
12910            profile_in.as_ptr(),
12911            NULL,
12912        );
12913        utils::result(vips_op_response, (), Error::RawsaveError)
12914    }
12915}
12916
12917/// VipsForeignSaveRawFd (rawsave_fd), write raw image to file descriptor (.raw), priority=0, any
12918/// inp: `&VipsImage` -> Image to save
12919/// fd: `i32` -> File descriptor to write to
12920/// min: 0, max: 10000, default: 0
12921
12922pub fn rawsave_fd(inp: &VipsImage, fd: i32) -> Result<()> {
12923    unsafe {
12924        let inp_in: *mut bindings::VipsImage = inp.ctx;
12925        let fd_in: i32 = fd;
12926
12927        let vips_op_response = bindings::vips_rawsave_fd(inp_in, fd_in, NULL);
12928        utils::result(vips_op_response, (), Error::RawsaveFdError)
12929    }
12930}
12931
12932/// Options for rawsave_fd operation
12933#[derive(Clone, Debug)]
12934pub struct RawsaveFdOptions {
12935    /// keep: `ForeignKeep` -> Which metadata to retain
12936    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12937    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12938    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12939    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12940    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12941    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12942    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
12943    pub keep: ForeignKeep,
12944    /// background: `Vec<f64>` -> Background value
12945    pub background: Vec<f64>,
12946    /// page_height: `i32` -> Set page height for multipage save
12947    /// min: 0, max: 10000000, default: 0
12948    pub page_height: i32,
12949    /// profile: `String` -> Filename of ICC profile to embed
12950    pub profile: String,
12951}
12952
12953impl std::default::Default for RawsaveFdOptions {
12954    fn default() -> Self {
12955        RawsaveFdOptions {
12956            keep: ForeignKeep::All,
12957            background: Vec::new(),
12958            page_height: i32::from(0),
12959            profile: String::from("sRGB"),
12960        }
12961    }
12962}
12963
12964/// VipsForeignSaveRawFd (rawsave_fd), write raw image to file descriptor (.raw), priority=0, any
12965/// inp: `&VipsImage` -> Image to save
12966/// fd: `i32` -> File descriptor to write to
12967/// min: 0, max: 10000, default: 0
12968/// rawsave_fd_options: `&RawsaveFdOptions` -> optional arguments
12969
12970pub fn rawsave_fd_with_opts(
12971    inp: &VipsImage,
12972    fd: i32,
12973    rawsave_fd_options: &RawsaveFdOptions,
12974) -> Result<()> {
12975    unsafe {
12976        let inp_in: *mut bindings::VipsImage = inp.ctx;
12977        let fd_in: i32 = fd;
12978
12979        let keep_in: i32 = rawsave_fd_options.keep as i32;
12980        let keep_in_name = utils::new_c_string("keep")?;
12981
12982        let background_wrapper =
12983            utils::VipsArrayDoubleWrapper::from(&rawsave_fd_options.background[..]);
12984        let background_in = background_wrapper.ctx;
12985        let background_in_name = utils::new_c_string("background")?;
12986
12987        let page_height_in: i32 = rawsave_fd_options.page_height;
12988        let page_height_in_name = utils::new_c_string("page-height")?;
12989
12990        let profile_in: CString = utils::new_c_string(&rawsave_fd_options.profile)?;
12991        let profile_in_name = utils::new_c_string("profile")?;
12992
12993        let vips_op_response = bindings::vips_rawsave_fd(
12994            inp_in,
12995            fd_in,
12996            keep_in_name.as_ptr(),
12997            keep_in,
12998            background_in_name.as_ptr(),
12999            background_in,
13000            page_height_in_name.as_ptr(),
13001            page_height_in,
13002            profile_in_name.as_ptr(),
13003            profile_in.as_ptr(),
13004            NULL,
13005        );
13006        utils::result(vips_op_response, (), Error::RawsaveFdError)
13007    }
13008}
13009
13010/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
13011/// inp: `&VipsImage` -> Image to save
13012/// filename: `&str` -> Filename to save to
13013
13014pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13015    unsafe {
13016        let inp_in: *mut bindings::VipsImage = inp.ctx;
13017        let filename_in: CString = utils::new_c_string(filename)?;
13018
13019        let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13020        utils::result(vips_op_response, (), Error::VipssaveError)
13021    }
13022}
13023
13024/// Options for vipssave operation
13025#[derive(Clone, Debug)]
13026pub struct VipssaveOptions {
13027    /// keep: `ForeignKeep` -> Which metadata to retain
13028    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13029    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13030    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13031    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13032    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13033    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13034    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13035    pub keep: ForeignKeep,
13036    /// background: `Vec<f64>` -> Background value
13037    pub background: Vec<f64>,
13038    /// page_height: `i32` -> Set page height for multipage save
13039    /// min: 0, max: 10000000, default: 0
13040    pub page_height: i32,
13041    /// profile: `String` -> Filename of ICC profile to embed
13042    pub profile: String,
13043}
13044
13045impl std::default::Default for VipssaveOptions {
13046    fn default() -> Self {
13047        VipssaveOptions {
13048            keep: ForeignKeep::All,
13049            background: Vec::new(),
13050            page_height: i32::from(0),
13051            profile: String::from("sRGB"),
13052        }
13053    }
13054}
13055
13056/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
13057/// inp: `&VipsImage` -> Image to save
13058/// filename: `&str` -> Filename to save to
13059/// vipssave_options: `&VipssaveOptions` -> optional arguments
13060
13061pub fn vipssave_with_opts(
13062    inp: &VipsImage,
13063    filename: &str,
13064    vipssave_options: &VipssaveOptions,
13065) -> Result<()> {
13066    unsafe {
13067        let inp_in: *mut bindings::VipsImage = inp.ctx;
13068        let filename_in: CString = utils::new_c_string(filename)?;
13069
13070        let keep_in: i32 = vipssave_options.keep as i32;
13071        let keep_in_name = utils::new_c_string("keep")?;
13072
13073        let background_wrapper =
13074            utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13075        let background_in = background_wrapper.ctx;
13076        let background_in_name = utils::new_c_string("background")?;
13077
13078        let page_height_in: i32 = vipssave_options.page_height;
13079        let page_height_in_name = utils::new_c_string("page-height")?;
13080
13081        let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13082        let profile_in_name = utils::new_c_string("profile")?;
13083
13084        let vips_op_response = bindings::vips_vipssave(
13085            inp_in,
13086            filename_in.as_ptr(),
13087            keep_in_name.as_ptr(),
13088            keep_in,
13089            background_in_name.as_ptr(),
13090            background_in,
13091            page_height_in_name.as_ptr(),
13092            page_height_in,
13093            profile_in_name.as_ptr(),
13094            profile_in.as_ptr(),
13095            NULL,
13096        );
13097        utils::result(vips_op_response, (), Error::VipssaveError)
13098    }
13099}
13100
13101/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
13102/// inp: `&VipsImage` -> Image to save
13103/// target: `&VipsTarget` -> Target to save to
13104
13105pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13106    unsafe {
13107        let inp_in: *mut bindings::VipsImage = inp.ctx;
13108        let target_in: *mut bindings::VipsTarget = target.ctx;
13109
13110        let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13111        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13112    }
13113}
13114
13115/// Options for vipssave_target operation
13116#[derive(Clone, Debug)]
13117pub struct VipssaveTargetOptions {
13118    /// keep: `ForeignKeep` -> Which metadata to retain
13119    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13120    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13121    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13122    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13123    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13124    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13125    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13126    pub keep: ForeignKeep,
13127    /// background: `Vec<f64>` -> Background value
13128    pub background: Vec<f64>,
13129    /// page_height: `i32` -> Set page height for multipage save
13130    /// min: 0, max: 10000000, default: 0
13131    pub page_height: i32,
13132    /// profile: `String` -> Filename of ICC profile to embed
13133    pub profile: String,
13134}
13135
13136impl std::default::Default for VipssaveTargetOptions {
13137    fn default() -> Self {
13138        VipssaveTargetOptions {
13139            keep: ForeignKeep::All,
13140            background: Vec::new(),
13141            page_height: i32::from(0),
13142            profile: String::from("sRGB"),
13143        }
13144    }
13145}
13146
13147/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
13148/// inp: `&VipsImage` -> Image to save
13149/// target: `&VipsTarget` -> Target to save to
13150/// vipssave_target_options: `&VipssaveTargetOptions` -> optional arguments
13151
13152pub fn vipssave_target_with_opts(
13153    inp: &VipsImage,
13154    target: &VipsTarget,
13155    vipssave_target_options: &VipssaveTargetOptions,
13156) -> Result<()> {
13157    unsafe {
13158        let inp_in: *mut bindings::VipsImage = inp.ctx;
13159        let target_in: *mut bindings::VipsTarget = target.ctx;
13160
13161        let keep_in: i32 = vipssave_target_options.keep as i32;
13162        let keep_in_name = utils::new_c_string("keep")?;
13163
13164        let background_wrapper =
13165            utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13166        let background_in = background_wrapper.ctx;
13167        let background_in_name = utils::new_c_string("background")?;
13168
13169        let page_height_in: i32 = vipssave_target_options.page_height;
13170        let page_height_in_name = utils::new_c_string("page-height")?;
13171
13172        let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13173        let profile_in_name = utils::new_c_string("profile")?;
13174
13175        let vips_op_response = bindings::vips_vipssave_target(
13176            inp_in,
13177            target_in,
13178            keep_in_name.as_ptr(),
13179            keep_in,
13180            background_in_name.as_ptr(),
13181            background_in,
13182            page_height_in_name.as_ptr(),
13183            page_height_in,
13184            profile_in_name.as_ptr(),
13185            profile_in.as_ptr(),
13186            NULL,
13187        );
13188        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13189    }
13190}
13191
13192/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, rgb
13193/// inp: `&VipsImage` -> Image to save
13194/// filename: `&str` -> Filename to save to
13195
13196pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13197    unsafe {
13198        let inp_in: *mut bindings::VipsImage = inp.ctx;
13199        let filename_in: CString = utils::new_c_string(filename)?;
13200
13201        let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13202        utils::result(vips_op_response, (), Error::PpmsaveError)
13203    }
13204}
13205
13206/// Options for ppmsave operation
13207#[derive(Clone, Debug)]
13208pub struct PpmsaveOptions {
13209    /// format: `ForeignPpmFormat` -> Format to save in
13210    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13211    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13212    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13213    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13214    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13215    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13216    pub format: ForeignPpmFormat,
13217    /// ascii: `bool` -> Save as ascii
13218    /// default: false
13219    pub ascii: bool,
13220    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13221    /// min: 0, max: 1, default: 0
13222    pub bitdepth: i32,
13223    /// keep: `ForeignKeep` -> Which metadata to retain
13224    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13225    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13226    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13227    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13228    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13229    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13230    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13231    pub keep: ForeignKeep,
13232    /// background: `Vec<f64>` -> Background value
13233    pub background: Vec<f64>,
13234    /// page_height: `i32` -> Set page height for multipage save
13235    /// min: 0, max: 10000000, default: 0
13236    pub page_height: i32,
13237    /// profile: `String` -> Filename of ICC profile to embed
13238    pub profile: String,
13239}
13240
13241impl std::default::Default for PpmsaveOptions {
13242    fn default() -> Self {
13243        PpmsaveOptions {
13244            format: ForeignPpmFormat::Ppm,
13245            ascii: false,
13246            bitdepth: i32::from(0),
13247            keep: ForeignKeep::All,
13248            background: Vec::new(),
13249            page_height: i32::from(0),
13250            profile: String::from("sRGB"),
13251        }
13252    }
13253}
13254
13255/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, rgb
13256/// inp: `&VipsImage` -> Image to save
13257/// filename: `&str` -> Filename to save to
13258/// ppmsave_options: `&PpmsaveOptions` -> optional arguments
13259
13260pub fn ppmsave_with_opts(
13261    inp: &VipsImage,
13262    filename: &str,
13263    ppmsave_options: &PpmsaveOptions,
13264) -> Result<()> {
13265    unsafe {
13266        let inp_in: *mut bindings::VipsImage = inp.ctx;
13267        let filename_in: CString = utils::new_c_string(filename)?;
13268
13269        let format_in: i32 = ppmsave_options.format as i32;
13270        let format_in_name = utils::new_c_string("format")?;
13271
13272        let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13273        let ascii_in_name = utils::new_c_string("ascii")?;
13274
13275        let bitdepth_in: i32 = ppmsave_options.bitdepth;
13276        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13277
13278        let keep_in: i32 = ppmsave_options.keep as i32;
13279        let keep_in_name = utils::new_c_string("keep")?;
13280
13281        let background_wrapper =
13282            utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13283        let background_in = background_wrapper.ctx;
13284        let background_in_name = utils::new_c_string("background")?;
13285
13286        let page_height_in: i32 = ppmsave_options.page_height;
13287        let page_height_in_name = utils::new_c_string("page-height")?;
13288
13289        let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13290        let profile_in_name = utils::new_c_string("profile")?;
13291
13292        let vips_op_response = bindings::vips_ppmsave(
13293            inp_in,
13294            filename_in.as_ptr(),
13295            format_in_name.as_ptr(),
13296            format_in,
13297            ascii_in_name.as_ptr(),
13298            ascii_in,
13299            bitdepth_in_name.as_ptr(),
13300            bitdepth_in,
13301            keep_in_name.as_ptr(),
13302            keep_in,
13303            background_in_name.as_ptr(),
13304            background_in,
13305            page_height_in_name.as_ptr(),
13306            page_height_in,
13307            profile_in_name.as_ptr(),
13308            profile_in.as_ptr(),
13309            NULL,
13310        );
13311        utils::result(vips_op_response, (), Error::PpmsaveError)
13312    }
13313}
13314
13315/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, rgb
13316/// inp: `&VipsImage` -> Image to save
13317/// target: `&VipsTarget` -> Target to save to
13318
13319pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13320    unsafe {
13321        let inp_in: *mut bindings::VipsImage = inp.ctx;
13322        let target_in: *mut bindings::VipsTarget = target.ctx;
13323
13324        let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13325        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13326    }
13327}
13328
13329/// Options for ppmsave_target operation
13330#[derive(Clone, Debug)]
13331pub struct PpmsaveTargetOptions {
13332    /// format: `ForeignPpmFormat` -> Format to save in
13333    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13334    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13335    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13336    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13337    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13338    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
13339    pub format: ForeignPpmFormat,
13340    /// ascii: `bool` -> Save as ascii
13341    /// default: false
13342    pub ascii: bool,
13343    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13344    /// min: 0, max: 1, default: 0
13345    pub bitdepth: i32,
13346    /// keep: `ForeignKeep` -> Which metadata to retain
13347    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13348    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13349    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13350    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13351    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13352    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13353    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13354    pub keep: ForeignKeep,
13355    /// background: `Vec<f64>` -> Background value
13356    pub background: Vec<f64>,
13357    /// page_height: `i32` -> Set page height for multipage save
13358    /// min: 0, max: 10000000, default: 0
13359    pub page_height: i32,
13360    /// profile: `String` -> Filename of ICC profile to embed
13361    pub profile: String,
13362}
13363
13364impl std::default::Default for PpmsaveTargetOptions {
13365    fn default() -> Self {
13366        PpmsaveTargetOptions {
13367            format: ForeignPpmFormat::Ppm,
13368            ascii: false,
13369            bitdepth: i32::from(0),
13370            keep: ForeignKeep::All,
13371            background: Vec::new(),
13372            page_height: i32::from(0),
13373            profile: String::from("sRGB"),
13374        }
13375    }
13376}
13377
13378/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, rgb
13379/// inp: `&VipsImage` -> Image to save
13380/// target: `&VipsTarget` -> Target to save to
13381/// ppmsave_target_options: `&PpmsaveTargetOptions` -> optional arguments
13382
13383pub fn ppmsave_target_with_opts(
13384    inp: &VipsImage,
13385    target: &VipsTarget,
13386    ppmsave_target_options: &PpmsaveTargetOptions,
13387) -> Result<()> {
13388    unsafe {
13389        let inp_in: *mut bindings::VipsImage = inp.ctx;
13390        let target_in: *mut bindings::VipsTarget = target.ctx;
13391
13392        let format_in: i32 = ppmsave_target_options.format as i32;
13393        let format_in_name = utils::new_c_string("format")?;
13394
13395        let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13396        let ascii_in_name = utils::new_c_string("ascii")?;
13397
13398        let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13399        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13400
13401        let keep_in: i32 = ppmsave_target_options.keep as i32;
13402        let keep_in_name = utils::new_c_string("keep")?;
13403
13404        let background_wrapper =
13405            utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13406        let background_in = background_wrapper.ctx;
13407        let background_in_name = utils::new_c_string("background")?;
13408
13409        let page_height_in: i32 = ppmsave_target_options.page_height;
13410        let page_height_in_name = utils::new_c_string("page-height")?;
13411
13412        let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13413        let profile_in_name = utils::new_c_string("profile")?;
13414
13415        let vips_op_response = bindings::vips_ppmsave_target(
13416            inp_in,
13417            target_in,
13418            format_in_name.as_ptr(),
13419            format_in,
13420            ascii_in_name.as_ptr(),
13421            ascii_in,
13422            bitdepth_in_name.as_ptr(),
13423            bitdepth_in,
13424            keep_in_name.as_ptr(),
13425            keep_in,
13426            background_in_name.as_ptr(),
13427            background_in,
13428            page_height_in_name.as_ptr(),
13429            page_height_in,
13430            profile_in_name.as_ptr(),
13431            profile_in.as_ptr(),
13432            NULL,
13433        );
13434        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13435    }
13436}
13437
13438/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
13439/// inp: `&VipsImage` -> Image to save
13440/// filename: `&str` -> Filename to save to
13441
13442pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13443    unsafe {
13444        let inp_in: *mut bindings::VipsImage = inp.ctx;
13445        let filename_in: CString = utils::new_c_string(filename)?;
13446
13447        let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13448        utils::result(vips_op_response, (), Error::RadsaveError)
13449    }
13450}
13451
13452/// Options for radsave operation
13453#[derive(Clone, Debug)]
13454pub struct RadsaveOptions {
13455    /// keep: `ForeignKeep` -> Which metadata to retain
13456    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13457    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13458    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13459    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13460    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13461    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13462    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13463    pub keep: ForeignKeep,
13464    /// background: `Vec<f64>` -> Background value
13465    pub background: Vec<f64>,
13466    /// page_height: `i32` -> Set page height for multipage save
13467    /// min: 0, max: 10000000, default: 0
13468    pub page_height: i32,
13469    /// profile: `String` -> Filename of ICC profile to embed
13470    pub profile: String,
13471}
13472
13473impl std::default::Default for RadsaveOptions {
13474    fn default() -> Self {
13475        RadsaveOptions {
13476            keep: ForeignKeep::All,
13477            background: Vec::new(),
13478            page_height: i32::from(0),
13479            profile: String::from("sRGB"),
13480        }
13481    }
13482}
13483
13484/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
13485/// inp: `&VipsImage` -> Image to save
13486/// filename: `&str` -> Filename to save to
13487/// radsave_options: `&RadsaveOptions` -> optional arguments
13488
13489pub fn radsave_with_opts(
13490    inp: &VipsImage,
13491    filename: &str,
13492    radsave_options: &RadsaveOptions,
13493) -> Result<()> {
13494    unsafe {
13495        let inp_in: *mut bindings::VipsImage = inp.ctx;
13496        let filename_in: CString = utils::new_c_string(filename)?;
13497
13498        let keep_in: i32 = radsave_options.keep as i32;
13499        let keep_in_name = utils::new_c_string("keep")?;
13500
13501        let background_wrapper =
13502            utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13503        let background_in = background_wrapper.ctx;
13504        let background_in_name = utils::new_c_string("background")?;
13505
13506        let page_height_in: i32 = radsave_options.page_height;
13507        let page_height_in_name = utils::new_c_string("page-height")?;
13508
13509        let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13510        let profile_in_name = utils::new_c_string("profile")?;
13511
13512        let vips_op_response = bindings::vips_radsave(
13513            inp_in,
13514            filename_in.as_ptr(),
13515            keep_in_name.as_ptr(),
13516            keep_in,
13517            background_in_name.as_ptr(),
13518            background_in,
13519            page_height_in_name.as_ptr(),
13520            page_height_in,
13521            profile_in_name.as_ptr(),
13522            profile_in.as_ptr(),
13523            NULL,
13524        );
13525        utils::result(vips_op_response, (), Error::RadsaveError)
13526    }
13527}
13528
13529/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
13530/// inp: `&VipsImage` -> Image to save
13531/// returns `Vec<u8>` - Buffer to save to
13532pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13533    unsafe {
13534        let inp_in: *mut bindings::VipsImage = inp.ctx;
13535        let mut buffer_buf_size: u64 = 0;
13536        let mut buffer_out: *mut c_void = null_mut();
13537
13538        let vips_op_response =
13539            bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13540        utils::result(
13541            vips_op_response,
13542            utils::new_byte_array(buffer_out, buffer_buf_size),
13543            Error::RadsaveBufferError,
13544        )
13545    }
13546}
13547
13548/// Options for radsave_buffer operation
13549#[derive(Clone, Debug)]
13550pub struct RadsaveBufferOptions {
13551    /// keep: `ForeignKeep` -> Which metadata to retain
13552    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13553    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13554    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13555    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13556    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13557    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13558    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13559    pub keep: ForeignKeep,
13560    /// background: `Vec<f64>` -> Background value
13561    pub background: Vec<f64>,
13562    /// page_height: `i32` -> Set page height for multipage save
13563    /// min: 0, max: 10000000, default: 0
13564    pub page_height: i32,
13565    /// profile: `String` -> Filename of ICC profile to embed
13566    pub profile: String,
13567}
13568
13569impl std::default::Default for RadsaveBufferOptions {
13570    fn default() -> Self {
13571        RadsaveBufferOptions {
13572            keep: ForeignKeep::All,
13573            background: Vec::new(),
13574            page_height: i32::from(0),
13575            profile: String::from("sRGB"),
13576        }
13577    }
13578}
13579
13580/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
13581/// inp: `&VipsImage` -> Image to save
13582/// radsave_buffer_options: `&RadsaveBufferOptions` -> optional arguments
13583/// returns `Vec<u8>` - Buffer to save to
13584pub fn radsave_buffer_with_opts(
13585    inp: &VipsImage,
13586    radsave_buffer_options: &RadsaveBufferOptions,
13587) -> Result<Vec<u8>> {
13588    unsafe {
13589        let inp_in: *mut bindings::VipsImage = inp.ctx;
13590        let mut buffer_buf_size: u64 = 0;
13591        let mut buffer_out: *mut c_void = null_mut();
13592
13593        let keep_in: i32 = radsave_buffer_options.keep as i32;
13594        let keep_in_name = utils::new_c_string("keep")?;
13595
13596        let background_wrapper =
13597            utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
13598        let background_in = background_wrapper.ctx;
13599        let background_in_name = utils::new_c_string("background")?;
13600
13601        let page_height_in: i32 = radsave_buffer_options.page_height;
13602        let page_height_in_name = utils::new_c_string("page-height")?;
13603
13604        let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
13605        let profile_in_name = utils::new_c_string("profile")?;
13606
13607        let vips_op_response = bindings::vips_radsave_buffer(
13608            inp_in,
13609            &mut buffer_out,
13610            &mut buffer_buf_size,
13611            keep_in_name.as_ptr(),
13612            keep_in,
13613            background_in_name.as_ptr(),
13614            background_in,
13615            page_height_in_name.as_ptr(),
13616            page_height_in,
13617            profile_in_name.as_ptr(),
13618            profile_in.as_ptr(),
13619            NULL,
13620        );
13621        utils::result(
13622            vips_op_response,
13623            utils::new_byte_array(buffer_out, buffer_buf_size),
13624            Error::RadsaveBufferError,
13625        )
13626    }
13627}
13628
13629/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
13630/// inp: `&VipsImage` -> Image to save
13631/// target: `&VipsTarget` -> Target to save to
13632
13633pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13634    unsafe {
13635        let inp_in: *mut bindings::VipsImage = inp.ctx;
13636        let target_in: *mut bindings::VipsTarget = target.ctx;
13637
13638        let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
13639        utils::result(vips_op_response, (), Error::RadsaveTargetError)
13640    }
13641}
13642
13643/// Options for radsave_target operation
13644#[derive(Clone, Debug)]
13645pub struct RadsaveTargetOptions {
13646    /// keep: `ForeignKeep` -> Which metadata to retain
13647    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13648    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13649    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13650    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13651    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13652    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13653    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13654    pub keep: ForeignKeep,
13655    /// background: `Vec<f64>` -> Background value
13656    pub background: Vec<f64>,
13657    /// page_height: `i32` -> Set page height for multipage save
13658    /// min: 0, max: 10000000, default: 0
13659    pub page_height: i32,
13660    /// profile: `String` -> Filename of ICC profile to embed
13661    pub profile: String,
13662}
13663
13664impl std::default::Default for RadsaveTargetOptions {
13665    fn default() -> Self {
13666        RadsaveTargetOptions {
13667            keep: ForeignKeep::All,
13668            background: Vec::new(),
13669            page_height: i32::from(0),
13670            profile: String::from("sRGB"),
13671        }
13672    }
13673}
13674
13675/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
13676/// inp: `&VipsImage` -> Image to save
13677/// target: `&VipsTarget` -> Target to save to
13678/// radsave_target_options: `&RadsaveTargetOptions` -> optional arguments
13679
13680pub fn radsave_target_with_opts(
13681    inp: &VipsImage,
13682    target: &VipsTarget,
13683    radsave_target_options: &RadsaveTargetOptions,
13684) -> Result<()> {
13685    unsafe {
13686        let inp_in: *mut bindings::VipsImage = inp.ctx;
13687        let target_in: *mut bindings::VipsTarget = target.ctx;
13688
13689        let keep_in: i32 = radsave_target_options.keep as i32;
13690        let keep_in_name = utils::new_c_string("keep")?;
13691
13692        let background_wrapper =
13693            utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
13694        let background_in = background_wrapper.ctx;
13695        let background_in_name = utils::new_c_string("background")?;
13696
13697        let page_height_in: i32 = radsave_target_options.page_height;
13698        let page_height_in_name = utils::new_c_string("page-height")?;
13699
13700        let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
13701        let profile_in_name = utils::new_c_string("profile")?;
13702
13703        let vips_op_response = bindings::vips_radsave_target(
13704            inp_in,
13705            target_in,
13706            keep_in_name.as_ptr(),
13707            keep_in,
13708            background_in_name.as_ptr(),
13709            background_in,
13710            page_height_in_name.as_ptr(),
13711            page_height_in,
13712            profile_in_name.as_ptr(),
13713            profile_in.as_ptr(),
13714            NULL,
13715        );
13716        utils::result(vips_op_response, (), Error::RadsaveTargetError)
13717    }
13718}
13719
13720/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
13721/// inp: `&VipsImage` -> Image to save
13722/// filename: `&str` -> Filename to save to
13723
13724pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
13725    unsafe {
13726        let inp_in: *mut bindings::VipsImage = inp.ctx;
13727        let filename_in: CString = utils::new_c_string(filename)?;
13728
13729        let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
13730        utils::result(vips_op_response, (), Error::GifsaveError)
13731    }
13732}
13733
13734/// Options for gifsave operation
13735#[derive(Clone, Debug)]
13736pub struct GifsaveOptions {
13737    /// dither: `f64` -> Amount of dithering
13738    /// min: 0, max: 1, default: 1
13739    pub dither: f64,
13740    /// effort: `i32` -> Quantisation effort
13741    /// min: 1, max: 10, default: 7
13742    pub effort: i32,
13743    /// bitdepth: `i32` -> Number of bits per pixel
13744    /// min: 1, max: 8, default: 8
13745    pub bitdepth: i32,
13746    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
13747    /// min: 0, max: 32, default: 0
13748    pub interframe_maxerror: f64,
13749    /// reuse: `bool` -> Reuse palette from input
13750    /// default: false
13751    pub reuse: bool,
13752    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
13753    /// min: 0, max: 256, default: 3
13754    pub interpalette_maxerror: f64,
13755    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
13756    /// default: false
13757    pub interlace: bool,
13758    /// keep: `ForeignKeep` -> Which metadata to retain
13759    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13760    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13761    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13762    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13763    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13764    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13765    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13766    pub keep: ForeignKeep,
13767    /// background: `Vec<f64>` -> Background value
13768    pub background: Vec<f64>,
13769    /// page_height: `i32` -> Set page height for multipage save
13770    /// min: 0, max: 10000000, default: 0
13771    pub page_height: i32,
13772    /// profile: `String` -> Filename of ICC profile to embed
13773    pub profile: String,
13774}
13775
13776impl std::default::Default for GifsaveOptions {
13777    fn default() -> Self {
13778        GifsaveOptions {
13779            dither: f64::from(1),
13780            effort: i32::from(7),
13781            bitdepth: i32::from(8),
13782            interframe_maxerror: f64::from(0),
13783            reuse: false,
13784            interpalette_maxerror: f64::from(3),
13785            interlace: false,
13786            keep: ForeignKeep::All,
13787            background: Vec::new(),
13788            page_height: i32::from(0),
13789            profile: String::from("sRGB"),
13790        }
13791    }
13792}
13793
13794/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
13795/// inp: `&VipsImage` -> Image to save
13796/// filename: `&str` -> Filename to save to
13797/// gifsave_options: `&GifsaveOptions` -> optional arguments
13798
13799pub fn gifsave_with_opts(
13800    inp: &VipsImage,
13801    filename: &str,
13802    gifsave_options: &GifsaveOptions,
13803) -> Result<()> {
13804    unsafe {
13805        let inp_in: *mut bindings::VipsImage = inp.ctx;
13806        let filename_in: CString = utils::new_c_string(filename)?;
13807
13808        let dither_in: f64 = gifsave_options.dither;
13809        let dither_in_name = utils::new_c_string("dither")?;
13810
13811        let effort_in: i32 = gifsave_options.effort;
13812        let effort_in_name = utils::new_c_string("effort")?;
13813
13814        let bitdepth_in: i32 = gifsave_options.bitdepth;
13815        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13816
13817        let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
13818        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
13819
13820        let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
13821        let reuse_in_name = utils::new_c_string("reuse")?;
13822
13823        let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
13824        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
13825
13826        let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
13827        let interlace_in_name = utils::new_c_string("interlace")?;
13828
13829        let keep_in: i32 = gifsave_options.keep as i32;
13830        let keep_in_name = utils::new_c_string("keep")?;
13831
13832        let background_wrapper =
13833            utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
13834        let background_in = background_wrapper.ctx;
13835        let background_in_name = utils::new_c_string("background")?;
13836
13837        let page_height_in: i32 = gifsave_options.page_height;
13838        let page_height_in_name = utils::new_c_string("page-height")?;
13839
13840        let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
13841        let profile_in_name = utils::new_c_string("profile")?;
13842
13843        let vips_op_response = bindings::vips_gifsave(
13844            inp_in,
13845            filename_in.as_ptr(),
13846            dither_in_name.as_ptr(),
13847            dither_in,
13848            effort_in_name.as_ptr(),
13849            effort_in,
13850            bitdepth_in_name.as_ptr(),
13851            bitdepth_in,
13852            interframe_maxerror_in_name.as_ptr(),
13853            interframe_maxerror_in,
13854            reuse_in_name.as_ptr(),
13855            reuse_in,
13856            interpalette_maxerror_in_name.as_ptr(),
13857            interpalette_maxerror_in,
13858            interlace_in_name.as_ptr(),
13859            interlace_in,
13860            keep_in_name.as_ptr(),
13861            keep_in,
13862            background_in_name.as_ptr(),
13863            background_in,
13864            page_height_in_name.as_ptr(),
13865            page_height_in,
13866            profile_in_name.as_ptr(),
13867            profile_in.as_ptr(),
13868            NULL,
13869        );
13870        utils::result(vips_op_response, (), Error::GifsaveError)
13871    }
13872}
13873
13874/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
13875/// inp: `&VipsImage` -> Image to save
13876/// returns `Vec<u8>` - Buffer to save to
13877pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13878    unsafe {
13879        let inp_in: *mut bindings::VipsImage = inp.ctx;
13880        let mut buffer_buf_size: u64 = 0;
13881        let mut buffer_out: *mut c_void = null_mut();
13882
13883        let vips_op_response =
13884            bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13885        utils::result(
13886            vips_op_response,
13887            utils::new_byte_array(buffer_out, buffer_buf_size),
13888            Error::GifsaveBufferError,
13889        )
13890    }
13891}
13892
13893/// Options for gifsave_buffer operation
13894#[derive(Clone, Debug)]
13895pub struct GifsaveBufferOptions {
13896    /// dither: `f64` -> Amount of dithering
13897    /// min: 0, max: 1, default: 1
13898    pub dither: f64,
13899    /// effort: `i32` -> Quantisation effort
13900    /// min: 1, max: 10, default: 7
13901    pub effort: i32,
13902    /// bitdepth: `i32` -> Number of bits per pixel
13903    /// min: 1, max: 8, default: 8
13904    pub bitdepth: i32,
13905    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
13906    /// min: 0, max: 32, default: 0
13907    pub interframe_maxerror: f64,
13908    /// reuse: `bool` -> Reuse palette from input
13909    /// default: false
13910    pub reuse: bool,
13911    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
13912    /// min: 0, max: 256, default: 3
13913    pub interpalette_maxerror: f64,
13914    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
13915    /// default: false
13916    pub interlace: bool,
13917    /// keep: `ForeignKeep` -> Which metadata to retain
13918    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13919    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13920    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13921    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13922    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13923    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13924    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
13925    pub keep: ForeignKeep,
13926    /// background: `Vec<f64>` -> Background value
13927    pub background: Vec<f64>,
13928    /// page_height: `i32` -> Set page height for multipage save
13929    /// min: 0, max: 10000000, default: 0
13930    pub page_height: i32,
13931    /// profile: `String` -> Filename of ICC profile to embed
13932    pub profile: String,
13933}
13934
13935impl std::default::Default for GifsaveBufferOptions {
13936    fn default() -> Self {
13937        GifsaveBufferOptions {
13938            dither: f64::from(1),
13939            effort: i32::from(7),
13940            bitdepth: i32::from(8),
13941            interframe_maxerror: f64::from(0),
13942            reuse: false,
13943            interpalette_maxerror: f64::from(3),
13944            interlace: false,
13945            keep: ForeignKeep::All,
13946            background: Vec::new(),
13947            page_height: i32::from(0),
13948            profile: String::from("sRGB"),
13949        }
13950    }
13951}
13952
13953/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
13954/// inp: `&VipsImage` -> Image to save
13955/// gifsave_buffer_options: `&GifsaveBufferOptions` -> optional arguments
13956/// returns `Vec<u8>` - Buffer to save to
13957pub fn gifsave_buffer_with_opts(
13958    inp: &VipsImage,
13959    gifsave_buffer_options: &GifsaveBufferOptions,
13960) -> Result<Vec<u8>> {
13961    unsafe {
13962        let inp_in: *mut bindings::VipsImage = inp.ctx;
13963        let mut buffer_buf_size: u64 = 0;
13964        let mut buffer_out: *mut c_void = null_mut();
13965
13966        let dither_in: f64 = gifsave_buffer_options.dither;
13967        let dither_in_name = utils::new_c_string("dither")?;
13968
13969        let effort_in: i32 = gifsave_buffer_options.effort;
13970        let effort_in_name = utils::new_c_string("effort")?;
13971
13972        let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
13973        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13974
13975        let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
13976        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
13977
13978        let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
13979        let reuse_in_name = utils::new_c_string("reuse")?;
13980
13981        let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
13982        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
13983
13984        let interlace_in: i32 = if gifsave_buffer_options.interlace {
13985            1
13986        } else {
13987            0
13988        };
13989        let interlace_in_name = utils::new_c_string("interlace")?;
13990
13991        let keep_in: i32 = gifsave_buffer_options.keep as i32;
13992        let keep_in_name = utils::new_c_string("keep")?;
13993
13994        let background_wrapper =
13995            utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
13996        let background_in = background_wrapper.ctx;
13997        let background_in_name = utils::new_c_string("background")?;
13998
13999        let page_height_in: i32 = gifsave_buffer_options.page_height;
14000        let page_height_in_name = utils::new_c_string("page-height")?;
14001
14002        let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14003        let profile_in_name = utils::new_c_string("profile")?;
14004
14005        let vips_op_response = bindings::vips_gifsave_buffer(
14006            inp_in,
14007            &mut buffer_out,
14008            &mut buffer_buf_size,
14009            dither_in_name.as_ptr(),
14010            dither_in,
14011            effort_in_name.as_ptr(),
14012            effort_in,
14013            bitdepth_in_name.as_ptr(),
14014            bitdepth_in,
14015            interframe_maxerror_in_name.as_ptr(),
14016            interframe_maxerror_in,
14017            reuse_in_name.as_ptr(),
14018            reuse_in,
14019            interpalette_maxerror_in_name.as_ptr(),
14020            interpalette_maxerror_in,
14021            interlace_in_name.as_ptr(),
14022            interlace_in,
14023            keep_in_name.as_ptr(),
14024            keep_in,
14025            background_in_name.as_ptr(),
14026            background_in,
14027            page_height_in_name.as_ptr(),
14028            page_height_in,
14029            profile_in_name.as_ptr(),
14030            profile_in.as_ptr(),
14031            NULL,
14032        );
14033        utils::result(
14034            vips_op_response,
14035            utils::new_byte_array(buffer_out, buffer_buf_size),
14036            Error::GifsaveBufferError,
14037        )
14038    }
14039}
14040
14041/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
14042/// inp: `&VipsImage` -> Image to save
14043/// target: `&VipsTarget` -> Target to save to
14044
14045pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14046    unsafe {
14047        let inp_in: *mut bindings::VipsImage = inp.ctx;
14048        let target_in: *mut bindings::VipsTarget = target.ctx;
14049
14050        let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14051        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14052    }
14053}
14054
14055/// Options for gifsave_target operation
14056#[derive(Clone, Debug)]
14057pub struct GifsaveTargetOptions {
14058    /// dither: `f64` -> Amount of dithering
14059    /// min: 0, max: 1, default: 1
14060    pub dither: f64,
14061    /// effort: `i32` -> Quantisation effort
14062    /// min: 1, max: 10, default: 7
14063    pub effort: i32,
14064    /// bitdepth: `i32` -> Number of bits per pixel
14065    /// min: 1, max: 8, default: 8
14066    pub bitdepth: i32,
14067    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14068    /// min: 0, max: 32, default: 0
14069    pub interframe_maxerror: f64,
14070    /// reuse: `bool` -> Reuse palette from input
14071    /// default: false
14072    pub reuse: bool,
14073    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14074    /// min: 0, max: 256, default: 3
14075    pub interpalette_maxerror: f64,
14076    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14077    /// default: false
14078    pub interlace: bool,
14079    /// keep: `ForeignKeep` -> Which metadata to retain
14080    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14081    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14082    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14083    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14084    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14085    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14086    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14087    pub keep: ForeignKeep,
14088    /// background: `Vec<f64>` -> Background value
14089    pub background: Vec<f64>,
14090    /// page_height: `i32` -> Set page height for multipage save
14091    /// min: 0, max: 10000000, default: 0
14092    pub page_height: i32,
14093    /// profile: `String` -> Filename of ICC profile to embed
14094    pub profile: String,
14095}
14096
14097impl std::default::Default for GifsaveTargetOptions {
14098    fn default() -> Self {
14099        GifsaveTargetOptions {
14100            dither: f64::from(1),
14101            effort: i32::from(7),
14102            bitdepth: i32::from(8),
14103            interframe_maxerror: f64::from(0),
14104            reuse: false,
14105            interpalette_maxerror: f64::from(3),
14106            interlace: false,
14107            keep: ForeignKeep::All,
14108            background: Vec::new(),
14109            page_height: i32::from(0),
14110            profile: String::from("sRGB"),
14111        }
14112    }
14113}
14114
14115/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
14116/// inp: `&VipsImage` -> Image to save
14117/// target: `&VipsTarget` -> Target to save to
14118/// gifsave_target_options: `&GifsaveTargetOptions` -> optional arguments
14119
14120pub fn gifsave_target_with_opts(
14121    inp: &VipsImage,
14122    target: &VipsTarget,
14123    gifsave_target_options: &GifsaveTargetOptions,
14124) -> Result<()> {
14125    unsafe {
14126        let inp_in: *mut bindings::VipsImage = inp.ctx;
14127        let target_in: *mut bindings::VipsTarget = target.ctx;
14128
14129        let dither_in: f64 = gifsave_target_options.dither;
14130        let dither_in_name = utils::new_c_string("dither")?;
14131
14132        let effort_in: i32 = gifsave_target_options.effort;
14133        let effort_in_name = utils::new_c_string("effort")?;
14134
14135        let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14136        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14137
14138        let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14139        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14140
14141        let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14142        let reuse_in_name = utils::new_c_string("reuse")?;
14143
14144        let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14145        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14146
14147        let interlace_in: i32 = if gifsave_target_options.interlace {
14148            1
14149        } else {
14150            0
14151        };
14152        let interlace_in_name = utils::new_c_string("interlace")?;
14153
14154        let keep_in: i32 = gifsave_target_options.keep as i32;
14155        let keep_in_name = utils::new_c_string("keep")?;
14156
14157        let background_wrapper =
14158            utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14159        let background_in = background_wrapper.ctx;
14160        let background_in_name = utils::new_c_string("background")?;
14161
14162        let page_height_in: i32 = gifsave_target_options.page_height;
14163        let page_height_in_name = utils::new_c_string("page-height")?;
14164
14165        let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14166        let profile_in_name = utils::new_c_string("profile")?;
14167
14168        let vips_op_response = bindings::vips_gifsave_target(
14169            inp_in,
14170            target_in,
14171            dither_in_name.as_ptr(),
14172            dither_in,
14173            effort_in_name.as_ptr(),
14174            effort_in,
14175            bitdepth_in_name.as_ptr(),
14176            bitdepth_in,
14177            interframe_maxerror_in_name.as_ptr(),
14178            interframe_maxerror_in,
14179            reuse_in_name.as_ptr(),
14180            reuse_in,
14181            interpalette_maxerror_in_name.as_ptr(),
14182            interpalette_maxerror_in,
14183            interlace_in_name.as_ptr(),
14184            interlace_in,
14185            keep_in_name.as_ptr(),
14186            keep_in,
14187            background_in_name.as_ptr(),
14188            background_in,
14189            page_height_in_name.as_ptr(),
14190            page_height_in,
14191            profile_in_name.as_ptr(),
14192            profile_in.as_ptr(),
14193            NULL,
14194        );
14195        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14196    }
14197}
14198
14199/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, rgba
14200/// inp: `&VipsImage` -> Image to save
14201/// filename: `&str` -> Filename to save to
14202
14203pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14204    unsafe {
14205        let inp_in: *mut bindings::VipsImage = inp.ctx;
14206        let filename_in: CString = utils::new_c_string(filename)?;
14207
14208        let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14209        utils::result(vips_op_response, (), Error::PngsaveError)
14210    }
14211}
14212
14213/// Options for pngsave operation
14214#[derive(Clone, Debug)]
14215pub struct PngsaveOptions {
14216    /// compression: `i32` -> Compression factor
14217    /// min: 0, max: 9, default: 6
14218    pub compression: i32,
14219    /// interlace: `bool` -> Interlace image
14220    /// default: false
14221    pub interlace: bool,
14222    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14223    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14224    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14225    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14226    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14227    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14228    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14229    pub filter: ForeignPngFilter,
14230    /// palette: `bool` -> Quantise to 8bpp palette
14231    /// default: false
14232    pub palette: bool,
14233    /// q: `i32` -> Quantisation quality
14234    /// min: 0, max: 100, default: 100
14235    pub q: i32,
14236    /// dither: `f64` -> Amount of dithering
14237    /// min: 0, max: 1, default: 1
14238    pub dither: f64,
14239    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14240    /// min: 1, max: 16, default: 8
14241    pub bitdepth: i32,
14242    /// effort: `i32` -> Quantisation CPU effort
14243    /// min: 1, max: 10, default: 7
14244    pub effort: i32,
14245    /// keep: `ForeignKeep` -> Which metadata to retain
14246    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14247    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14248    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14249    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14250    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14251    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14252    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14253    pub keep: ForeignKeep,
14254    /// background: `Vec<f64>` -> Background value
14255    pub background: Vec<f64>,
14256    /// page_height: `i32` -> Set page height for multipage save
14257    /// min: 0, max: 10000000, default: 0
14258    pub page_height: i32,
14259    /// profile: `String` -> Filename of ICC profile to embed
14260    pub profile: String,
14261}
14262
14263impl std::default::Default for PngsaveOptions {
14264    fn default() -> Self {
14265        PngsaveOptions {
14266            compression: i32::from(6),
14267            interlace: false,
14268            filter: ForeignPngFilter::None,
14269            palette: false,
14270            q: i32::from(100),
14271            dither: f64::from(1),
14272            bitdepth: i32::from(8),
14273            effort: i32::from(7),
14274            keep: ForeignKeep::All,
14275            background: Vec::new(),
14276            page_height: i32::from(0),
14277            profile: String::from("sRGB"),
14278        }
14279    }
14280}
14281
14282/// VipsForeignSavePngFile (pngsave), save image to png file (.png), priority=0, rgba
14283/// inp: `&VipsImage` -> Image to save
14284/// filename: `&str` -> Filename to save to
14285/// pngsave_options: `&PngsaveOptions` -> optional arguments
14286
14287pub fn pngsave_with_opts(
14288    inp: &VipsImage,
14289    filename: &str,
14290    pngsave_options: &PngsaveOptions,
14291) -> Result<()> {
14292    unsafe {
14293        let inp_in: *mut bindings::VipsImage = inp.ctx;
14294        let filename_in: CString = utils::new_c_string(filename)?;
14295
14296        let compression_in: i32 = pngsave_options.compression;
14297        let compression_in_name = utils::new_c_string("compression")?;
14298
14299        let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14300        let interlace_in_name = utils::new_c_string("interlace")?;
14301
14302        let filter_in: i32 = pngsave_options.filter as i32;
14303        let filter_in_name = utils::new_c_string("filter")?;
14304
14305        let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14306        let palette_in_name = utils::new_c_string("palette")?;
14307
14308        let q_in: i32 = pngsave_options.q;
14309        let q_in_name = utils::new_c_string("Q")?;
14310
14311        let dither_in: f64 = pngsave_options.dither;
14312        let dither_in_name = utils::new_c_string("dither")?;
14313
14314        let bitdepth_in: i32 = pngsave_options.bitdepth;
14315        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14316
14317        let effort_in: i32 = pngsave_options.effort;
14318        let effort_in_name = utils::new_c_string("effort")?;
14319
14320        let keep_in: i32 = pngsave_options.keep as i32;
14321        let keep_in_name = utils::new_c_string("keep")?;
14322
14323        let background_wrapper =
14324            utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14325        let background_in = background_wrapper.ctx;
14326        let background_in_name = utils::new_c_string("background")?;
14327
14328        let page_height_in: i32 = pngsave_options.page_height;
14329        let page_height_in_name = utils::new_c_string("page-height")?;
14330
14331        let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14332        let profile_in_name = utils::new_c_string("profile")?;
14333
14334        let vips_op_response = bindings::vips_pngsave(
14335            inp_in,
14336            filename_in.as_ptr(),
14337            compression_in_name.as_ptr(),
14338            compression_in,
14339            interlace_in_name.as_ptr(),
14340            interlace_in,
14341            filter_in_name.as_ptr(),
14342            filter_in,
14343            palette_in_name.as_ptr(),
14344            palette_in,
14345            q_in_name.as_ptr(),
14346            q_in,
14347            dither_in_name.as_ptr(),
14348            dither_in,
14349            bitdepth_in_name.as_ptr(),
14350            bitdepth_in,
14351            effort_in_name.as_ptr(),
14352            effort_in,
14353            keep_in_name.as_ptr(),
14354            keep_in,
14355            background_in_name.as_ptr(),
14356            background_in,
14357            page_height_in_name.as_ptr(),
14358            page_height_in,
14359            profile_in_name.as_ptr(),
14360            profile_in.as_ptr(),
14361            NULL,
14362        );
14363        utils::result(vips_op_response, (), Error::PngsaveError)
14364    }
14365}
14366
14367/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, rgba
14368/// inp: `&VipsImage` -> Image to save
14369/// returns `Vec<u8>` - Buffer to save to
14370pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14371    unsafe {
14372        let inp_in: *mut bindings::VipsImage = inp.ctx;
14373        let mut buffer_buf_size: u64 = 0;
14374        let mut buffer_out: *mut c_void = null_mut();
14375
14376        let vips_op_response =
14377            bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14378        utils::result(
14379            vips_op_response,
14380            utils::new_byte_array(buffer_out, buffer_buf_size),
14381            Error::PngsaveBufferError,
14382        )
14383    }
14384}
14385
14386/// Options for pngsave_buffer operation
14387#[derive(Clone, Debug)]
14388pub struct PngsaveBufferOptions {
14389    /// compression: `i32` -> Compression factor
14390    /// min: 0, max: 9, default: 6
14391    pub compression: i32,
14392    /// interlace: `bool` -> Interlace image
14393    /// default: false
14394    pub interlace: bool,
14395    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14396    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14397    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14398    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14399    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14400    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14401    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14402    pub filter: ForeignPngFilter,
14403    /// palette: `bool` -> Quantise to 8bpp palette
14404    /// default: false
14405    pub palette: bool,
14406    /// q: `i32` -> Quantisation quality
14407    /// min: 0, max: 100, default: 100
14408    pub q: i32,
14409    /// dither: `f64` -> Amount of dithering
14410    /// min: 0, max: 1, default: 1
14411    pub dither: f64,
14412    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14413    /// min: 1, max: 16, default: 8
14414    pub bitdepth: i32,
14415    /// effort: `i32` -> Quantisation CPU effort
14416    /// min: 1, max: 10, default: 7
14417    pub effort: i32,
14418    /// keep: `ForeignKeep` -> Which metadata to retain
14419    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14420    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14421    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14422    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14423    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14424    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14425    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14426    pub keep: ForeignKeep,
14427    /// background: `Vec<f64>` -> Background value
14428    pub background: Vec<f64>,
14429    /// page_height: `i32` -> Set page height for multipage save
14430    /// min: 0, max: 10000000, default: 0
14431    pub page_height: i32,
14432    /// profile: `String` -> Filename of ICC profile to embed
14433    pub profile: String,
14434}
14435
14436impl std::default::Default for PngsaveBufferOptions {
14437    fn default() -> Self {
14438        PngsaveBufferOptions {
14439            compression: i32::from(6),
14440            interlace: false,
14441            filter: ForeignPngFilter::None,
14442            palette: false,
14443            q: i32::from(100),
14444            dither: f64::from(1),
14445            bitdepth: i32::from(8),
14446            effort: i32::from(7),
14447            keep: ForeignKeep::All,
14448            background: Vec::new(),
14449            page_height: i32::from(0),
14450            profile: String::from("sRGB"),
14451        }
14452    }
14453}
14454
14455/// VipsForeignSavePngBuffer (pngsave_buffer), save image to png buffer (.png), priority=0, rgba
14456/// inp: `&VipsImage` -> Image to save
14457/// pngsave_buffer_options: `&PngsaveBufferOptions` -> optional arguments
14458/// returns `Vec<u8>` - Buffer to save to
14459pub fn pngsave_buffer_with_opts(
14460    inp: &VipsImage,
14461    pngsave_buffer_options: &PngsaveBufferOptions,
14462) -> Result<Vec<u8>> {
14463    unsafe {
14464        let inp_in: *mut bindings::VipsImage = inp.ctx;
14465        let mut buffer_buf_size: u64 = 0;
14466        let mut buffer_out: *mut c_void = null_mut();
14467
14468        let compression_in: i32 = pngsave_buffer_options.compression;
14469        let compression_in_name = utils::new_c_string("compression")?;
14470
14471        let interlace_in: i32 = if pngsave_buffer_options.interlace {
14472            1
14473        } else {
14474            0
14475        };
14476        let interlace_in_name = utils::new_c_string("interlace")?;
14477
14478        let filter_in: i32 = pngsave_buffer_options.filter as i32;
14479        let filter_in_name = utils::new_c_string("filter")?;
14480
14481        let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14482        let palette_in_name = utils::new_c_string("palette")?;
14483
14484        let q_in: i32 = pngsave_buffer_options.q;
14485        let q_in_name = utils::new_c_string("Q")?;
14486
14487        let dither_in: f64 = pngsave_buffer_options.dither;
14488        let dither_in_name = utils::new_c_string("dither")?;
14489
14490        let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
14491        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14492
14493        let effort_in: i32 = pngsave_buffer_options.effort;
14494        let effort_in_name = utils::new_c_string("effort")?;
14495
14496        let keep_in: i32 = pngsave_buffer_options.keep as i32;
14497        let keep_in_name = utils::new_c_string("keep")?;
14498
14499        let background_wrapper =
14500            utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
14501        let background_in = background_wrapper.ctx;
14502        let background_in_name = utils::new_c_string("background")?;
14503
14504        let page_height_in: i32 = pngsave_buffer_options.page_height;
14505        let page_height_in_name = utils::new_c_string("page-height")?;
14506
14507        let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
14508        let profile_in_name = utils::new_c_string("profile")?;
14509
14510        let vips_op_response = bindings::vips_pngsave_buffer(
14511            inp_in,
14512            &mut buffer_out,
14513            &mut buffer_buf_size,
14514            compression_in_name.as_ptr(),
14515            compression_in,
14516            interlace_in_name.as_ptr(),
14517            interlace_in,
14518            filter_in_name.as_ptr(),
14519            filter_in,
14520            palette_in_name.as_ptr(),
14521            palette_in,
14522            q_in_name.as_ptr(),
14523            q_in,
14524            dither_in_name.as_ptr(),
14525            dither_in,
14526            bitdepth_in_name.as_ptr(),
14527            bitdepth_in,
14528            effort_in_name.as_ptr(),
14529            effort_in,
14530            keep_in_name.as_ptr(),
14531            keep_in,
14532            background_in_name.as_ptr(),
14533            background_in,
14534            page_height_in_name.as_ptr(),
14535            page_height_in,
14536            profile_in_name.as_ptr(),
14537            profile_in.as_ptr(),
14538            NULL,
14539        );
14540        utils::result(
14541            vips_op_response,
14542            utils::new_byte_array(buffer_out, buffer_buf_size),
14543            Error::PngsaveBufferError,
14544        )
14545    }
14546}
14547
14548/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
14549/// inp: `&VipsImage` -> Image to save
14550/// target: `&VipsTarget` -> Target to save to
14551
14552pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14553    unsafe {
14554        let inp_in: *mut bindings::VipsImage = inp.ctx;
14555        let target_in: *mut bindings::VipsTarget = target.ctx;
14556
14557        let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
14558        utils::result(vips_op_response, (), Error::PngsaveTargetError)
14559    }
14560}
14561
14562/// Options for pngsave_target operation
14563#[derive(Clone, Debug)]
14564pub struct PngsaveTargetOptions {
14565    /// compression: `i32` -> Compression factor
14566    /// min: 0, max: 9, default: 6
14567    pub compression: i32,
14568    /// interlace: `bool` -> Interlace image
14569    /// default: false
14570    pub interlace: bool,
14571    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14572    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14573    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14574    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14575    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14576    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14577    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14578    pub filter: ForeignPngFilter,
14579    /// palette: `bool` -> Quantise to 8bpp palette
14580    /// default: false
14581    pub palette: bool,
14582    /// q: `i32` -> Quantisation quality
14583    /// min: 0, max: 100, default: 100
14584    pub q: i32,
14585    /// dither: `f64` -> Amount of dithering
14586    /// min: 0, max: 1, default: 1
14587    pub dither: f64,
14588    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14589    /// min: 1, max: 16, default: 8
14590    pub bitdepth: i32,
14591    /// effort: `i32` -> Quantisation CPU effort
14592    /// min: 1, max: 10, default: 7
14593    pub effort: i32,
14594    /// keep: `ForeignKeep` -> Which metadata to retain
14595    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14596    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14597    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14598    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14599    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14600    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14601    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14602    pub keep: ForeignKeep,
14603    /// background: `Vec<f64>` -> Background value
14604    pub background: Vec<f64>,
14605    /// page_height: `i32` -> Set page height for multipage save
14606    /// min: 0, max: 10000000, default: 0
14607    pub page_height: i32,
14608    /// profile: `String` -> Filename of ICC profile to embed
14609    pub profile: String,
14610}
14611
14612impl std::default::Default for PngsaveTargetOptions {
14613    fn default() -> Self {
14614        PngsaveTargetOptions {
14615            compression: i32::from(6),
14616            interlace: false,
14617            filter: ForeignPngFilter::None,
14618            palette: false,
14619            q: i32::from(100),
14620            dither: f64::from(1),
14621            bitdepth: i32::from(8),
14622            effort: i32::from(7),
14623            keep: ForeignKeep::All,
14624            background: Vec::new(),
14625            page_height: i32::from(0),
14626            profile: String::from("sRGB"),
14627        }
14628    }
14629}
14630
14631/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
14632/// inp: `&VipsImage` -> Image to save
14633/// target: `&VipsTarget` -> Target to save to
14634/// pngsave_target_options: `&PngsaveTargetOptions` -> optional arguments
14635
14636pub fn pngsave_target_with_opts(
14637    inp: &VipsImage,
14638    target: &VipsTarget,
14639    pngsave_target_options: &PngsaveTargetOptions,
14640) -> Result<()> {
14641    unsafe {
14642        let inp_in: *mut bindings::VipsImage = inp.ctx;
14643        let target_in: *mut bindings::VipsTarget = target.ctx;
14644
14645        let compression_in: i32 = pngsave_target_options.compression;
14646        let compression_in_name = utils::new_c_string("compression")?;
14647
14648        let interlace_in: i32 = if pngsave_target_options.interlace {
14649            1
14650        } else {
14651            0
14652        };
14653        let interlace_in_name = utils::new_c_string("interlace")?;
14654
14655        let filter_in: i32 = pngsave_target_options.filter as i32;
14656        let filter_in_name = utils::new_c_string("filter")?;
14657
14658        let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
14659        let palette_in_name = utils::new_c_string("palette")?;
14660
14661        let q_in: i32 = pngsave_target_options.q;
14662        let q_in_name = utils::new_c_string("Q")?;
14663
14664        let dither_in: f64 = pngsave_target_options.dither;
14665        let dither_in_name = utils::new_c_string("dither")?;
14666
14667        let bitdepth_in: i32 = pngsave_target_options.bitdepth;
14668        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14669
14670        let effort_in: i32 = pngsave_target_options.effort;
14671        let effort_in_name = utils::new_c_string("effort")?;
14672
14673        let keep_in: i32 = pngsave_target_options.keep as i32;
14674        let keep_in_name = utils::new_c_string("keep")?;
14675
14676        let background_wrapper =
14677            utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
14678        let background_in = background_wrapper.ctx;
14679        let background_in_name = utils::new_c_string("background")?;
14680
14681        let page_height_in: i32 = pngsave_target_options.page_height;
14682        let page_height_in_name = utils::new_c_string("page-height")?;
14683
14684        let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
14685        let profile_in_name = utils::new_c_string("profile")?;
14686
14687        let vips_op_response = bindings::vips_pngsave_target(
14688            inp_in,
14689            target_in,
14690            compression_in_name.as_ptr(),
14691            compression_in,
14692            interlace_in_name.as_ptr(),
14693            interlace_in,
14694            filter_in_name.as_ptr(),
14695            filter_in,
14696            palette_in_name.as_ptr(),
14697            palette_in,
14698            q_in_name.as_ptr(),
14699            q_in,
14700            dither_in_name.as_ptr(),
14701            dither_in,
14702            bitdepth_in_name.as_ptr(),
14703            bitdepth_in,
14704            effort_in_name.as_ptr(),
14705            effort_in,
14706            keep_in_name.as_ptr(),
14707            keep_in,
14708            background_in_name.as_ptr(),
14709            background_in,
14710            page_height_in_name.as_ptr(),
14711            page_height_in,
14712            profile_in_name.as_ptr(),
14713            profile_in.as_ptr(),
14714            NULL,
14715        );
14716        utils::result(vips_op_response, (), Error::PngsaveTargetError)
14717    }
14718}
14719
14720/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
14721/// inp: `&VipsImage` -> Image to save
14722/// filename: `&str` -> Filename to save to
14723
14724pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
14725    unsafe {
14726        let inp_in: *mut bindings::VipsImage = inp.ctx;
14727        let filename_in: CString = utils::new_c_string(filename)?;
14728
14729        let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
14730        utils::result(vips_op_response, (), Error::JpegsaveError)
14731    }
14732}
14733
14734/// Options for jpegsave operation
14735#[derive(Clone, Debug)]
14736pub struct JpegsaveOptions {
14737    /// q: `i32` -> Q factor
14738    /// min: 1, max: 100, default: 75
14739    pub q: i32,
14740    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
14741    /// default: false
14742    pub optimize_coding: bool,
14743    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
14744    /// default: false
14745    pub interlace: bool,
14746    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
14747    /// default: false
14748    pub trellis_quant: bool,
14749    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
14750    /// default: false
14751    pub overshoot_deringing: bool,
14752    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
14753    /// default: false
14754    pub optimize_scans: bool,
14755    /// quant_table: `i32` -> Use predefined quantization table with given index
14756    /// min: 0, max: 8, default: 0
14757    pub quant_table: i32,
14758    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
14759    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
14760    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
14761    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
14762    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
14763    pub subsample_mode: ForeignSubsample,
14764    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
14765    /// min: 0, max: 2147483647, default: 0
14766    pub restart_interval: i32,
14767    /// keep: `ForeignKeep` -> Which metadata to retain
14768    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14769    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14770    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14771    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14772    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14773    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14774    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14775    pub keep: ForeignKeep,
14776    /// background: `Vec<f64>` -> Background value
14777    pub background: Vec<f64>,
14778    /// page_height: `i32` -> Set page height for multipage save
14779    /// min: 0, max: 10000000, default: 0
14780    pub page_height: i32,
14781    /// profile: `String` -> Filename of ICC profile to embed
14782    pub profile: String,
14783}
14784
14785impl std::default::Default for JpegsaveOptions {
14786    fn default() -> Self {
14787        JpegsaveOptions {
14788            q: i32::from(75),
14789            optimize_coding: false,
14790            interlace: false,
14791            trellis_quant: false,
14792            overshoot_deringing: false,
14793            optimize_scans: false,
14794            quant_table: i32::from(0),
14795            subsample_mode: ForeignSubsample::Auto,
14796            restart_interval: i32::from(0),
14797            keep: ForeignKeep::All,
14798            background: Vec::new(),
14799            page_height: i32::from(0),
14800            profile: String::from("sRGB"),
14801        }
14802    }
14803}
14804
14805/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
14806/// inp: `&VipsImage` -> Image to save
14807/// filename: `&str` -> Filename to save to
14808/// jpegsave_options: `&JpegsaveOptions` -> optional arguments
14809
14810pub fn jpegsave_with_opts(
14811    inp: &VipsImage,
14812    filename: &str,
14813    jpegsave_options: &JpegsaveOptions,
14814) -> Result<()> {
14815    unsafe {
14816        let inp_in: *mut bindings::VipsImage = inp.ctx;
14817        let filename_in: CString = utils::new_c_string(filename)?;
14818
14819        let q_in: i32 = jpegsave_options.q;
14820        let q_in_name = utils::new_c_string("Q")?;
14821
14822        let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
14823            1
14824        } else {
14825            0
14826        };
14827        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
14828
14829        let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
14830        let interlace_in_name = utils::new_c_string("interlace")?;
14831
14832        let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
14833        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
14834
14835        let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
14836            1
14837        } else {
14838            0
14839        };
14840        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
14841
14842        let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
14843            1
14844        } else {
14845            0
14846        };
14847        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
14848
14849        let quant_table_in: i32 = jpegsave_options.quant_table;
14850        let quant_table_in_name = utils::new_c_string("quant-table")?;
14851
14852        let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
14853        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
14854
14855        let restart_interval_in: i32 = jpegsave_options.restart_interval;
14856        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
14857
14858        let keep_in: i32 = jpegsave_options.keep as i32;
14859        let keep_in_name = utils::new_c_string("keep")?;
14860
14861        let background_wrapper =
14862            utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
14863        let background_in = background_wrapper.ctx;
14864        let background_in_name = utils::new_c_string("background")?;
14865
14866        let page_height_in: i32 = jpegsave_options.page_height;
14867        let page_height_in_name = utils::new_c_string("page-height")?;
14868
14869        let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
14870        let profile_in_name = utils::new_c_string("profile")?;
14871
14872        let vips_op_response = bindings::vips_jpegsave(
14873            inp_in,
14874            filename_in.as_ptr(),
14875            q_in_name.as_ptr(),
14876            q_in,
14877            optimize_coding_in_name.as_ptr(),
14878            optimize_coding_in,
14879            interlace_in_name.as_ptr(),
14880            interlace_in,
14881            trellis_quant_in_name.as_ptr(),
14882            trellis_quant_in,
14883            overshoot_deringing_in_name.as_ptr(),
14884            overshoot_deringing_in,
14885            optimize_scans_in_name.as_ptr(),
14886            optimize_scans_in,
14887            quant_table_in_name.as_ptr(),
14888            quant_table_in,
14889            subsample_mode_in_name.as_ptr(),
14890            subsample_mode_in,
14891            restart_interval_in_name.as_ptr(),
14892            restart_interval_in,
14893            keep_in_name.as_ptr(),
14894            keep_in,
14895            background_in_name.as_ptr(),
14896            background_in,
14897            page_height_in_name.as_ptr(),
14898            page_height_in,
14899            profile_in_name.as_ptr(),
14900            profile_in.as_ptr(),
14901            NULL,
14902        );
14903        utils::result(vips_op_response, (), Error::JpegsaveError)
14904    }
14905}
14906
14907/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
14908/// inp: `&VipsImage` -> Image to save
14909/// returns `Vec<u8>` - Buffer to save to
14910pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14911    unsafe {
14912        let inp_in: *mut bindings::VipsImage = inp.ctx;
14913        let mut buffer_buf_size: u64 = 0;
14914        let mut buffer_out: *mut c_void = null_mut();
14915
14916        let vips_op_response =
14917            bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14918        utils::result(
14919            vips_op_response,
14920            utils::new_byte_array(buffer_out, buffer_buf_size),
14921            Error::JpegsaveBufferError,
14922        )
14923    }
14924}
14925
14926/// Options for jpegsave_buffer operation
14927#[derive(Clone, Debug)]
14928pub struct JpegsaveBufferOptions {
14929    /// q: `i32` -> Q factor
14930    /// min: 1, max: 100, default: 75
14931    pub q: i32,
14932    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
14933    /// default: false
14934    pub optimize_coding: bool,
14935    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
14936    /// default: false
14937    pub interlace: bool,
14938    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
14939    /// default: false
14940    pub trellis_quant: bool,
14941    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
14942    /// default: false
14943    pub overshoot_deringing: bool,
14944    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
14945    /// default: false
14946    pub optimize_scans: bool,
14947    /// quant_table: `i32` -> Use predefined quantization table with given index
14948    /// min: 0, max: 8, default: 0
14949    pub quant_table: i32,
14950    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
14951    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
14952    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
14953    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
14954    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
14955    pub subsample_mode: ForeignSubsample,
14956    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
14957    /// min: 0, max: 2147483647, default: 0
14958    pub restart_interval: i32,
14959    /// keep: `ForeignKeep` -> Which metadata to retain
14960    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14961    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14962    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14963    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14964    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14965    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14966    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14967    pub keep: ForeignKeep,
14968    /// background: `Vec<f64>` -> Background value
14969    pub background: Vec<f64>,
14970    /// page_height: `i32` -> Set page height for multipage save
14971    /// min: 0, max: 10000000, default: 0
14972    pub page_height: i32,
14973    /// profile: `String` -> Filename of ICC profile to embed
14974    pub profile: String,
14975}
14976
14977impl std::default::Default for JpegsaveBufferOptions {
14978    fn default() -> Self {
14979        JpegsaveBufferOptions {
14980            q: i32::from(75),
14981            optimize_coding: false,
14982            interlace: false,
14983            trellis_quant: false,
14984            overshoot_deringing: false,
14985            optimize_scans: false,
14986            quant_table: i32::from(0),
14987            subsample_mode: ForeignSubsample::Auto,
14988            restart_interval: i32::from(0),
14989            keep: ForeignKeep::All,
14990            background: Vec::new(),
14991            page_height: i32::from(0),
14992            profile: String::from("sRGB"),
14993        }
14994    }
14995}
14996
14997/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
14998/// inp: `&VipsImage` -> Image to save
14999/// jpegsave_buffer_options: `&JpegsaveBufferOptions` -> optional arguments
15000/// returns `Vec<u8>` - Buffer to save to
15001pub fn jpegsave_buffer_with_opts(
15002    inp: &VipsImage,
15003    jpegsave_buffer_options: &JpegsaveBufferOptions,
15004) -> Result<Vec<u8>> {
15005    unsafe {
15006        let inp_in: *mut bindings::VipsImage = inp.ctx;
15007        let mut buffer_buf_size: u64 = 0;
15008        let mut buffer_out: *mut c_void = null_mut();
15009
15010        let q_in: i32 = jpegsave_buffer_options.q;
15011        let q_in_name = utils::new_c_string("Q")?;
15012
15013        let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15014            1
15015        } else {
15016            0
15017        };
15018        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15019
15020        let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15021            1
15022        } else {
15023            0
15024        };
15025        let interlace_in_name = utils::new_c_string("interlace")?;
15026
15027        let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15028            1
15029        } else {
15030            0
15031        };
15032        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15033
15034        let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15035            1
15036        } else {
15037            0
15038        };
15039        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15040
15041        let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15042            1
15043        } else {
15044            0
15045        };
15046        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15047
15048        let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15049        let quant_table_in_name = utils::new_c_string("quant-table")?;
15050
15051        let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15052        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15053
15054        let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15055        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15056
15057        let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15058        let keep_in_name = utils::new_c_string("keep")?;
15059
15060        let background_wrapper =
15061            utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15062        let background_in = background_wrapper.ctx;
15063        let background_in_name = utils::new_c_string("background")?;
15064
15065        let page_height_in: i32 = jpegsave_buffer_options.page_height;
15066        let page_height_in_name = utils::new_c_string("page-height")?;
15067
15068        let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15069        let profile_in_name = utils::new_c_string("profile")?;
15070
15071        let vips_op_response = bindings::vips_jpegsave_buffer(
15072            inp_in,
15073            &mut buffer_out,
15074            &mut buffer_buf_size,
15075            q_in_name.as_ptr(),
15076            q_in,
15077            optimize_coding_in_name.as_ptr(),
15078            optimize_coding_in,
15079            interlace_in_name.as_ptr(),
15080            interlace_in,
15081            trellis_quant_in_name.as_ptr(),
15082            trellis_quant_in,
15083            overshoot_deringing_in_name.as_ptr(),
15084            overshoot_deringing_in,
15085            optimize_scans_in_name.as_ptr(),
15086            optimize_scans_in,
15087            quant_table_in_name.as_ptr(),
15088            quant_table_in,
15089            subsample_mode_in_name.as_ptr(),
15090            subsample_mode_in,
15091            restart_interval_in_name.as_ptr(),
15092            restart_interval_in,
15093            keep_in_name.as_ptr(),
15094            keep_in,
15095            background_in_name.as_ptr(),
15096            background_in,
15097            page_height_in_name.as_ptr(),
15098            page_height_in,
15099            profile_in_name.as_ptr(),
15100            profile_in.as_ptr(),
15101            NULL,
15102        );
15103        utils::result(
15104            vips_op_response,
15105            utils::new_byte_array(buffer_out, buffer_buf_size),
15106            Error::JpegsaveBufferError,
15107        )
15108    }
15109}
15110
15111/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
15112/// inp: `&VipsImage` -> Image to save
15113/// target: `&VipsTarget` -> Target to save to
15114
15115pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15116    unsafe {
15117        let inp_in: *mut bindings::VipsImage = inp.ctx;
15118        let target_in: *mut bindings::VipsTarget = target.ctx;
15119
15120        let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15121        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15122    }
15123}
15124
15125/// Options for jpegsave_target operation
15126#[derive(Clone, Debug)]
15127pub struct JpegsaveTargetOptions {
15128    /// q: `i32` -> Q factor
15129    /// min: 1, max: 100, default: 75
15130    pub q: i32,
15131    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15132    /// default: false
15133    pub optimize_coding: bool,
15134    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15135    /// default: false
15136    pub interlace: bool,
15137    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15138    /// default: false
15139    pub trellis_quant: bool,
15140    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15141    /// default: false
15142    pub overshoot_deringing: bool,
15143    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15144    /// default: false
15145    pub optimize_scans: bool,
15146    /// quant_table: `i32` -> Use predefined quantization table with given index
15147    /// min: 0, max: 8, default: 0
15148    pub quant_table: i32,
15149    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15150    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15151    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15152    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15153    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15154    pub subsample_mode: ForeignSubsample,
15155    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15156    /// min: 0, max: 2147483647, default: 0
15157    pub restart_interval: i32,
15158    /// keep: `ForeignKeep` -> Which metadata to retain
15159    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15160    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15161    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15162    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15163    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15164    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15165    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15166    pub keep: ForeignKeep,
15167    /// background: `Vec<f64>` -> Background value
15168    pub background: Vec<f64>,
15169    /// page_height: `i32` -> Set page height for multipage save
15170    /// min: 0, max: 10000000, default: 0
15171    pub page_height: i32,
15172    /// profile: `String` -> Filename of ICC profile to embed
15173    pub profile: String,
15174}
15175
15176impl std::default::Default for JpegsaveTargetOptions {
15177    fn default() -> Self {
15178        JpegsaveTargetOptions {
15179            q: i32::from(75),
15180            optimize_coding: false,
15181            interlace: false,
15182            trellis_quant: false,
15183            overshoot_deringing: false,
15184            optimize_scans: false,
15185            quant_table: i32::from(0),
15186            subsample_mode: ForeignSubsample::Auto,
15187            restart_interval: i32::from(0),
15188            keep: ForeignKeep::All,
15189            background: Vec::new(),
15190            page_height: i32::from(0),
15191            profile: String::from("sRGB"),
15192        }
15193    }
15194}
15195
15196/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
15197/// inp: `&VipsImage` -> Image to save
15198/// target: `&VipsTarget` -> Target to save to
15199/// jpegsave_target_options: `&JpegsaveTargetOptions` -> optional arguments
15200
15201pub fn jpegsave_target_with_opts(
15202    inp: &VipsImage,
15203    target: &VipsTarget,
15204    jpegsave_target_options: &JpegsaveTargetOptions,
15205) -> Result<()> {
15206    unsafe {
15207        let inp_in: *mut bindings::VipsImage = inp.ctx;
15208        let target_in: *mut bindings::VipsTarget = target.ctx;
15209
15210        let q_in: i32 = jpegsave_target_options.q;
15211        let q_in_name = utils::new_c_string("Q")?;
15212
15213        let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15214            1
15215        } else {
15216            0
15217        };
15218        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15219
15220        let interlace_in: i32 = if jpegsave_target_options.interlace {
15221            1
15222        } else {
15223            0
15224        };
15225        let interlace_in_name = utils::new_c_string("interlace")?;
15226
15227        let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15228            1
15229        } else {
15230            0
15231        };
15232        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15233
15234        let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15235            1
15236        } else {
15237            0
15238        };
15239        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15240
15241        let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15242            1
15243        } else {
15244            0
15245        };
15246        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15247
15248        let quant_table_in: i32 = jpegsave_target_options.quant_table;
15249        let quant_table_in_name = utils::new_c_string("quant-table")?;
15250
15251        let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15252        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15253
15254        let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15255        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15256
15257        let keep_in: i32 = jpegsave_target_options.keep as i32;
15258        let keep_in_name = utils::new_c_string("keep")?;
15259
15260        let background_wrapper =
15261            utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15262        let background_in = background_wrapper.ctx;
15263        let background_in_name = utils::new_c_string("background")?;
15264
15265        let page_height_in: i32 = jpegsave_target_options.page_height;
15266        let page_height_in_name = utils::new_c_string("page-height")?;
15267
15268        let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15269        let profile_in_name = utils::new_c_string("profile")?;
15270
15271        let vips_op_response = bindings::vips_jpegsave_target(
15272            inp_in,
15273            target_in,
15274            q_in_name.as_ptr(),
15275            q_in,
15276            optimize_coding_in_name.as_ptr(),
15277            optimize_coding_in,
15278            interlace_in_name.as_ptr(),
15279            interlace_in,
15280            trellis_quant_in_name.as_ptr(),
15281            trellis_quant_in,
15282            overshoot_deringing_in_name.as_ptr(),
15283            overshoot_deringing_in,
15284            optimize_scans_in_name.as_ptr(),
15285            optimize_scans_in,
15286            quant_table_in_name.as_ptr(),
15287            quant_table_in,
15288            subsample_mode_in_name.as_ptr(),
15289            subsample_mode_in,
15290            restart_interval_in_name.as_ptr(),
15291            restart_interval_in,
15292            keep_in_name.as_ptr(),
15293            keep_in,
15294            background_in_name.as_ptr(),
15295            background_in,
15296            page_height_in_name.as_ptr(),
15297            page_height_in,
15298            profile_in_name.as_ptr(),
15299            profile_in.as_ptr(),
15300            NULL,
15301        );
15302        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15303    }
15304}
15305
15306/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
15307/// inp: `&VipsImage` -> Image to save
15308
15309pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15310    unsafe {
15311        let inp_in: *mut bindings::VipsImage = inp.ctx;
15312
15313        let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15314        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15315    }
15316}
15317
15318/// Options for jpegsave_mime operation
15319#[derive(Clone, Debug)]
15320pub struct JpegsaveMimeOptions {
15321    /// q: `i32` -> Q factor
15322    /// min: 1, max: 100, default: 75
15323    pub q: i32,
15324    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15325    /// default: false
15326    pub optimize_coding: bool,
15327    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15328    /// default: false
15329    pub interlace: bool,
15330    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15331    /// default: false
15332    pub trellis_quant: bool,
15333    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15334    /// default: false
15335    pub overshoot_deringing: bool,
15336    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15337    /// default: false
15338    pub optimize_scans: bool,
15339    /// quant_table: `i32` -> Use predefined quantization table with given index
15340    /// min: 0, max: 8, default: 0
15341    pub quant_table: i32,
15342    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15343    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15344    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15345    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15346    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
15347    pub subsample_mode: ForeignSubsample,
15348    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15349    /// min: 0, max: 2147483647, default: 0
15350    pub restart_interval: i32,
15351    /// keep: `ForeignKeep` -> Which metadata to retain
15352    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15353    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15354    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15355    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15356    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15357    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15358    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15359    pub keep: ForeignKeep,
15360    /// background: `Vec<f64>` -> Background value
15361    pub background: Vec<f64>,
15362    /// page_height: `i32` -> Set page height for multipage save
15363    /// min: 0, max: 10000000, default: 0
15364    pub page_height: i32,
15365    /// profile: `String` -> Filename of ICC profile to embed
15366    pub profile: String,
15367}
15368
15369impl std::default::Default for JpegsaveMimeOptions {
15370    fn default() -> Self {
15371        JpegsaveMimeOptions {
15372            q: i32::from(75),
15373            optimize_coding: false,
15374            interlace: false,
15375            trellis_quant: false,
15376            overshoot_deringing: false,
15377            optimize_scans: false,
15378            quant_table: i32::from(0),
15379            subsample_mode: ForeignSubsample::Auto,
15380            restart_interval: i32::from(0),
15381            keep: ForeignKeep::All,
15382            background: Vec::new(),
15383            page_height: i32::from(0),
15384            profile: String::from("sRGB"),
15385        }
15386    }
15387}
15388
15389/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe), priority=0, rgb-cmyk
15390/// inp: `&VipsImage` -> Image to save
15391/// jpegsave_mime_options: `&JpegsaveMimeOptions` -> optional arguments
15392
15393pub fn jpegsave_mime_with_opts(
15394    inp: &VipsImage,
15395    jpegsave_mime_options: &JpegsaveMimeOptions,
15396) -> Result<()> {
15397    unsafe {
15398        let inp_in: *mut bindings::VipsImage = inp.ctx;
15399
15400        let q_in: i32 = jpegsave_mime_options.q;
15401        let q_in_name = utils::new_c_string("Q")?;
15402
15403        let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15404            1
15405        } else {
15406            0
15407        };
15408        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15409
15410        let interlace_in: i32 = if jpegsave_mime_options.interlace {
15411            1
15412        } else {
15413            0
15414        };
15415        let interlace_in_name = utils::new_c_string("interlace")?;
15416
15417        let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15418            1
15419        } else {
15420            0
15421        };
15422        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15423
15424        let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15425            1
15426        } else {
15427            0
15428        };
15429        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15430
15431        let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15432            1
15433        } else {
15434            0
15435        };
15436        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15437
15438        let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15439        let quant_table_in_name = utils::new_c_string("quant-table")?;
15440
15441        let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15442        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15443
15444        let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15445        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15446
15447        let keep_in: i32 = jpegsave_mime_options.keep as i32;
15448        let keep_in_name = utils::new_c_string("keep")?;
15449
15450        let background_wrapper =
15451            utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15452        let background_in = background_wrapper.ctx;
15453        let background_in_name = utils::new_c_string("background")?;
15454
15455        let page_height_in: i32 = jpegsave_mime_options.page_height;
15456        let page_height_in_name = utils::new_c_string("page-height")?;
15457
15458        let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15459        let profile_in_name = utils::new_c_string("profile")?;
15460
15461        let vips_op_response = bindings::vips_jpegsave_mime(
15462            inp_in,
15463            q_in_name.as_ptr(),
15464            q_in,
15465            optimize_coding_in_name.as_ptr(),
15466            optimize_coding_in,
15467            interlace_in_name.as_ptr(),
15468            interlace_in,
15469            trellis_quant_in_name.as_ptr(),
15470            trellis_quant_in,
15471            overshoot_deringing_in_name.as_ptr(),
15472            overshoot_deringing_in,
15473            optimize_scans_in_name.as_ptr(),
15474            optimize_scans_in,
15475            quant_table_in_name.as_ptr(),
15476            quant_table_in,
15477            subsample_mode_in_name.as_ptr(),
15478            subsample_mode_in,
15479            restart_interval_in_name.as_ptr(),
15480            restart_interval_in,
15481            keep_in_name.as_ptr(),
15482            keep_in,
15483            background_in_name.as_ptr(),
15484            background_in,
15485            page_height_in_name.as_ptr(),
15486            page_height_in,
15487            profile_in_name.as_ptr(),
15488            profile_in.as_ptr(),
15489            NULL,
15490        );
15491        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15492    }
15493}
15494
15495/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
15496/// inp: `&VipsImage` -> Image to save
15497/// filename: `&str` -> Filename to save to
15498
15499pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
15500    unsafe {
15501        let inp_in: *mut bindings::VipsImage = inp.ctx;
15502        let filename_in: CString = utils::new_c_string(filename)?;
15503
15504        let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
15505        utils::result(vips_op_response, (), Error::WebpsaveError)
15506    }
15507}
15508
15509/// Options for webpsave operation
15510#[derive(Clone, Debug)]
15511pub struct WebpsaveOptions {
15512    /// q: `i32` -> Q factor
15513    /// min: 0, max: 100, default: 75
15514    pub q: i32,
15515    /// lossless: `bool` -> Enable lossless compression
15516    /// default: false
15517    pub lossless: bool,
15518    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
15519    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
15520    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
15521    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
15522    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
15523    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
15524    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
15525    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
15526    pub preset: ForeignWebpPreset,
15527    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
15528    /// default: false
15529    pub smart_subsample: bool,
15530    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
15531    /// default: false
15532    pub near_lossless: bool,
15533    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
15534    /// min: 0, max: 100, default: 100
15535    pub alpha_q: i32,
15536    /// min_size: `bool` -> Optimise for minimum size
15537    /// default: false
15538    pub min_size: bool,
15539    /// kmin: `i32` -> Minimum number of frames between key frames
15540    /// min: 0, max: 2147483647, default: 2147483646
15541    pub kmin: i32,
15542    /// kmax: `i32` -> Maximum number of frames between key frames
15543    /// min: 0, max: 2147483647, default: 2147483647
15544    pub kmax: i32,
15545    /// effort: `i32` -> Level of CPU effort to reduce file size
15546    /// min: 0, max: 6, default: 4
15547    pub effort: i32,
15548    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
15549    /// default: false
15550    pub mixed: bool,
15551    /// keep: `ForeignKeep` -> Which metadata to retain
15552    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15553    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15554    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15555    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15556    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15557    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15558    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15559    pub keep: ForeignKeep,
15560    /// background: `Vec<f64>` -> Background value
15561    pub background: Vec<f64>,
15562    /// page_height: `i32` -> Set page height for multipage save
15563    /// min: 0, max: 10000000, default: 0
15564    pub page_height: i32,
15565    /// profile: `String` -> Filename of ICC profile to embed
15566    pub profile: String,
15567}
15568
15569impl std::default::Default for WebpsaveOptions {
15570    fn default() -> Self {
15571        WebpsaveOptions {
15572            q: i32::from(75),
15573            lossless: false,
15574            preset: ForeignWebpPreset::Default,
15575            smart_subsample: false,
15576            near_lossless: false,
15577            alpha_q: i32::from(100),
15578            min_size: false,
15579            kmin: i32::from(2147483646),
15580            kmax: i32::from(2147483647),
15581            effort: i32::from(4),
15582            mixed: false,
15583            keep: ForeignKeep::All,
15584            background: Vec::new(),
15585            page_height: i32::from(0),
15586            profile: String::from("sRGB"),
15587        }
15588    }
15589}
15590
15591/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
15592/// inp: `&VipsImage` -> Image to save
15593/// filename: `&str` -> Filename to save to
15594/// webpsave_options: `&WebpsaveOptions` -> optional arguments
15595
15596pub fn webpsave_with_opts(
15597    inp: &VipsImage,
15598    filename: &str,
15599    webpsave_options: &WebpsaveOptions,
15600) -> Result<()> {
15601    unsafe {
15602        let inp_in: *mut bindings::VipsImage = inp.ctx;
15603        let filename_in: CString = utils::new_c_string(filename)?;
15604
15605        let q_in: i32 = webpsave_options.q;
15606        let q_in_name = utils::new_c_string("Q")?;
15607
15608        let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
15609        let lossless_in_name = utils::new_c_string("lossless")?;
15610
15611        let preset_in: i32 = webpsave_options.preset as i32;
15612        let preset_in_name = utils::new_c_string("preset")?;
15613
15614        let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
15615            1
15616        } else {
15617            0
15618        };
15619        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
15620
15621        let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
15622        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
15623
15624        let alpha_q_in: i32 = webpsave_options.alpha_q;
15625        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
15626
15627        let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
15628        let min_size_in_name = utils::new_c_string("min-size")?;
15629
15630        let kmin_in: i32 = webpsave_options.kmin;
15631        let kmin_in_name = utils::new_c_string("kmin")?;
15632
15633        let kmax_in: i32 = webpsave_options.kmax;
15634        let kmax_in_name = utils::new_c_string("kmax")?;
15635
15636        let effort_in: i32 = webpsave_options.effort;
15637        let effort_in_name = utils::new_c_string("effort")?;
15638
15639        let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
15640        let mixed_in_name = utils::new_c_string("mixed")?;
15641
15642        let keep_in: i32 = webpsave_options.keep as i32;
15643        let keep_in_name = utils::new_c_string("keep")?;
15644
15645        let background_wrapper =
15646            utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
15647        let background_in = background_wrapper.ctx;
15648        let background_in_name = utils::new_c_string("background")?;
15649
15650        let page_height_in: i32 = webpsave_options.page_height;
15651        let page_height_in_name = utils::new_c_string("page-height")?;
15652
15653        let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
15654        let profile_in_name = utils::new_c_string("profile")?;
15655
15656        let vips_op_response = bindings::vips_webpsave(
15657            inp_in,
15658            filename_in.as_ptr(),
15659            q_in_name.as_ptr(),
15660            q_in,
15661            lossless_in_name.as_ptr(),
15662            lossless_in,
15663            preset_in_name.as_ptr(),
15664            preset_in,
15665            smart_subsample_in_name.as_ptr(),
15666            smart_subsample_in,
15667            near_lossless_in_name.as_ptr(),
15668            near_lossless_in,
15669            alpha_q_in_name.as_ptr(),
15670            alpha_q_in,
15671            min_size_in_name.as_ptr(),
15672            min_size_in,
15673            kmin_in_name.as_ptr(),
15674            kmin_in,
15675            kmax_in_name.as_ptr(),
15676            kmax_in,
15677            effort_in_name.as_ptr(),
15678            effort_in,
15679            mixed_in_name.as_ptr(),
15680            mixed_in,
15681            keep_in_name.as_ptr(),
15682            keep_in,
15683            background_in_name.as_ptr(),
15684            background_in,
15685            page_height_in_name.as_ptr(),
15686            page_height_in,
15687            profile_in_name.as_ptr(),
15688            profile_in.as_ptr(),
15689            NULL,
15690        );
15691        utils::result(vips_op_response, (), Error::WebpsaveError)
15692    }
15693}
15694
15695/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
15696/// inp: `&VipsImage` -> Image to save
15697/// returns `Vec<u8>` - Buffer to save to
15698pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15699    unsafe {
15700        let inp_in: *mut bindings::VipsImage = inp.ctx;
15701        let mut buffer_buf_size: u64 = 0;
15702        let mut buffer_out: *mut c_void = null_mut();
15703
15704        let vips_op_response =
15705            bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15706        utils::result(
15707            vips_op_response,
15708            utils::new_byte_array(buffer_out, buffer_buf_size),
15709            Error::WebpsaveBufferError,
15710        )
15711    }
15712}
15713
15714/// Options for webpsave_buffer operation
15715#[derive(Clone, Debug)]
15716pub struct WebpsaveBufferOptions {
15717    /// q: `i32` -> Q factor
15718    /// min: 0, max: 100, default: 75
15719    pub q: i32,
15720    /// lossless: `bool` -> Enable lossless compression
15721    /// default: false
15722    pub lossless: bool,
15723    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
15724    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
15725    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
15726    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
15727    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
15728    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
15729    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
15730    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
15731    pub preset: ForeignWebpPreset,
15732    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
15733    /// default: false
15734    pub smart_subsample: bool,
15735    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
15736    /// default: false
15737    pub near_lossless: bool,
15738    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
15739    /// min: 0, max: 100, default: 100
15740    pub alpha_q: i32,
15741    /// min_size: `bool` -> Optimise for minimum size
15742    /// default: false
15743    pub min_size: bool,
15744    /// kmin: `i32` -> Minimum number of frames between key frames
15745    /// min: 0, max: 2147483647, default: 2147483646
15746    pub kmin: i32,
15747    /// kmax: `i32` -> Maximum number of frames between key frames
15748    /// min: 0, max: 2147483647, default: 2147483647
15749    pub kmax: i32,
15750    /// effort: `i32` -> Level of CPU effort to reduce file size
15751    /// min: 0, max: 6, default: 4
15752    pub effort: i32,
15753    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
15754    /// default: false
15755    pub mixed: bool,
15756    /// keep: `ForeignKeep` -> Which metadata to retain
15757    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15758    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15759    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15760    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15761    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15762    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15763    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15764    pub keep: ForeignKeep,
15765    /// background: `Vec<f64>` -> Background value
15766    pub background: Vec<f64>,
15767    /// page_height: `i32` -> Set page height for multipage save
15768    /// min: 0, max: 10000000, default: 0
15769    pub page_height: i32,
15770    /// profile: `String` -> Filename of ICC profile to embed
15771    pub profile: String,
15772}
15773
15774impl std::default::Default for WebpsaveBufferOptions {
15775    fn default() -> Self {
15776        WebpsaveBufferOptions {
15777            q: i32::from(75),
15778            lossless: false,
15779            preset: ForeignWebpPreset::Default,
15780            smart_subsample: false,
15781            near_lossless: false,
15782            alpha_q: i32::from(100),
15783            min_size: false,
15784            kmin: i32::from(2147483646),
15785            kmax: i32::from(2147483647),
15786            effort: i32::from(4),
15787            mixed: false,
15788            keep: ForeignKeep::All,
15789            background: Vec::new(),
15790            page_height: i32::from(0),
15791            profile: String::from("sRGB"),
15792        }
15793    }
15794}
15795
15796/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
15797/// inp: `&VipsImage` -> Image to save
15798/// webpsave_buffer_options: `&WebpsaveBufferOptions` -> optional arguments
15799/// returns `Vec<u8>` - Buffer to save to
15800pub fn webpsave_buffer_with_opts(
15801    inp: &VipsImage,
15802    webpsave_buffer_options: &WebpsaveBufferOptions,
15803) -> Result<Vec<u8>> {
15804    unsafe {
15805        let inp_in: *mut bindings::VipsImage = inp.ctx;
15806        let mut buffer_buf_size: u64 = 0;
15807        let mut buffer_out: *mut c_void = null_mut();
15808
15809        let q_in: i32 = webpsave_buffer_options.q;
15810        let q_in_name = utils::new_c_string("Q")?;
15811
15812        let lossless_in: i32 = if webpsave_buffer_options.lossless {
15813            1
15814        } else {
15815            0
15816        };
15817        let lossless_in_name = utils::new_c_string("lossless")?;
15818
15819        let preset_in: i32 = webpsave_buffer_options.preset as i32;
15820        let preset_in_name = utils::new_c_string("preset")?;
15821
15822        let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
15823            1
15824        } else {
15825            0
15826        };
15827        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
15828
15829        let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
15830            1
15831        } else {
15832            0
15833        };
15834        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
15835
15836        let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
15837        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
15838
15839        let min_size_in: i32 = if webpsave_buffer_options.min_size {
15840            1
15841        } else {
15842            0
15843        };
15844        let min_size_in_name = utils::new_c_string("min-size")?;
15845
15846        let kmin_in: i32 = webpsave_buffer_options.kmin;
15847        let kmin_in_name = utils::new_c_string("kmin")?;
15848
15849        let kmax_in: i32 = webpsave_buffer_options.kmax;
15850        let kmax_in_name = utils::new_c_string("kmax")?;
15851
15852        let effort_in: i32 = webpsave_buffer_options.effort;
15853        let effort_in_name = utils::new_c_string("effort")?;
15854
15855        let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
15856        let mixed_in_name = utils::new_c_string("mixed")?;
15857
15858        let keep_in: i32 = webpsave_buffer_options.keep as i32;
15859        let keep_in_name = utils::new_c_string("keep")?;
15860
15861        let background_wrapper =
15862            utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
15863        let background_in = background_wrapper.ctx;
15864        let background_in_name = utils::new_c_string("background")?;
15865
15866        let page_height_in: i32 = webpsave_buffer_options.page_height;
15867        let page_height_in_name = utils::new_c_string("page-height")?;
15868
15869        let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
15870        let profile_in_name = utils::new_c_string("profile")?;
15871
15872        let vips_op_response = bindings::vips_webpsave_buffer(
15873            inp_in,
15874            &mut buffer_out,
15875            &mut buffer_buf_size,
15876            q_in_name.as_ptr(),
15877            q_in,
15878            lossless_in_name.as_ptr(),
15879            lossless_in,
15880            preset_in_name.as_ptr(),
15881            preset_in,
15882            smart_subsample_in_name.as_ptr(),
15883            smart_subsample_in,
15884            near_lossless_in_name.as_ptr(),
15885            near_lossless_in,
15886            alpha_q_in_name.as_ptr(),
15887            alpha_q_in,
15888            min_size_in_name.as_ptr(),
15889            min_size_in,
15890            kmin_in_name.as_ptr(),
15891            kmin_in,
15892            kmax_in_name.as_ptr(),
15893            kmax_in,
15894            effort_in_name.as_ptr(),
15895            effort_in,
15896            mixed_in_name.as_ptr(),
15897            mixed_in,
15898            keep_in_name.as_ptr(),
15899            keep_in,
15900            background_in_name.as_ptr(),
15901            background_in,
15902            page_height_in_name.as_ptr(),
15903            page_height_in,
15904            profile_in_name.as_ptr(),
15905            profile_in.as_ptr(),
15906            NULL,
15907        );
15908        utils::result(
15909            vips_op_response,
15910            utils::new_byte_array(buffer_out, buffer_buf_size),
15911            Error::WebpsaveBufferError,
15912        )
15913    }
15914}
15915
15916/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
15917/// inp: `&VipsImage` -> Image to save
15918/// target: `&VipsTarget` -> Target to save to
15919
15920pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15921    unsafe {
15922        let inp_in: *mut bindings::VipsImage = inp.ctx;
15923        let target_in: *mut bindings::VipsTarget = target.ctx;
15924
15925        let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
15926        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
15927    }
15928}
15929
15930/// Options for webpsave_target operation
15931#[derive(Clone, Debug)]
15932pub struct WebpsaveTargetOptions {
15933    /// q: `i32` -> Q factor
15934    /// min: 0, max: 100, default: 75
15935    pub q: i32,
15936    /// lossless: `bool` -> Enable lossless compression
15937    /// default: false
15938    pub lossless: bool,
15939    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
15940    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
15941    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
15942    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
15943    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
15944    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
15945    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
15946    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
15947    pub preset: ForeignWebpPreset,
15948    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
15949    /// default: false
15950    pub smart_subsample: bool,
15951    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
15952    /// default: false
15953    pub near_lossless: bool,
15954    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
15955    /// min: 0, max: 100, default: 100
15956    pub alpha_q: i32,
15957    /// min_size: `bool` -> Optimise for minimum size
15958    /// default: false
15959    pub min_size: bool,
15960    /// kmin: `i32` -> Minimum number of frames between key frames
15961    /// min: 0, max: 2147483647, default: 2147483646
15962    pub kmin: i32,
15963    /// kmax: `i32` -> Maximum number of frames between key frames
15964    /// min: 0, max: 2147483647, default: 2147483647
15965    pub kmax: i32,
15966    /// effort: `i32` -> Level of CPU effort to reduce file size
15967    /// min: 0, max: 6, default: 4
15968    pub effort: i32,
15969    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
15970    /// default: false
15971    pub mixed: bool,
15972    /// keep: `ForeignKeep` -> Which metadata to retain
15973    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15974    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15975    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15976    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15977    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15978    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15979    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15980    pub keep: ForeignKeep,
15981    /// background: `Vec<f64>` -> Background value
15982    pub background: Vec<f64>,
15983    /// page_height: `i32` -> Set page height for multipage save
15984    /// min: 0, max: 10000000, default: 0
15985    pub page_height: i32,
15986    /// profile: `String` -> Filename of ICC profile to embed
15987    pub profile: String,
15988}
15989
15990impl std::default::Default for WebpsaveTargetOptions {
15991    fn default() -> Self {
15992        WebpsaveTargetOptions {
15993            q: i32::from(75),
15994            lossless: false,
15995            preset: ForeignWebpPreset::Default,
15996            smart_subsample: false,
15997            near_lossless: false,
15998            alpha_q: i32::from(100),
15999            min_size: false,
16000            kmin: i32::from(2147483646),
16001            kmax: i32::from(2147483647),
16002            effort: i32::from(4),
16003            mixed: false,
16004            keep: ForeignKeep::All,
16005            background: Vec::new(),
16006            page_height: i32::from(0),
16007            profile: String::from("sRGB"),
16008        }
16009    }
16010}
16011
16012/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
16013/// inp: `&VipsImage` -> Image to save
16014/// target: `&VipsTarget` -> Target to save to
16015/// webpsave_target_options: `&WebpsaveTargetOptions` -> optional arguments
16016
16017pub fn webpsave_target_with_opts(
16018    inp: &VipsImage,
16019    target: &VipsTarget,
16020    webpsave_target_options: &WebpsaveTargetOptions,
16021) -> Result<()> {
16022    unsafe {
16023        let inp_in: *mut bindings::VipsImage = inp.ctx;
16024        let target_in: *mut bindings::VipsTarget = target.ctx;
16025
16026        let q_in: i32 = webpsave_target_options.q;
16027        let q_in_name = utils::new_c_string("Q")?;
16028
16029        let lossless_in: i32 = if webpsave_target_options.lossless {
16030            1
16031        } else {
16032            0
16033        };
16034        let lossless_in_name = utils::new_c_string("lossless")?;
16035
16036        let preset_in: i32 = webpsave_target_options.preset as i32;
16037        let preset_in_name = utils::new_c_string("preset")?;
16038
16039        let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16040            1
16041        } else {
16042            0
16043        };
16044        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16045
16046        let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16047            1
16048        } else {
16049            0
16050        };
16051        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16052
16053        let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16054        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16055
16056        let min_size_in: i32 = if webpsave_target_options.min_size {
16057            1
16058        } else {
16059            0
16060        };
16061        let min_size_in_name = utils::new_c_string("min-size")?;
16062
16063        let kmin_in: i32 = webpsave_target_options.kmin;
16064        let kmin_in_name = utils::new_c_string("kmin")?;
16065
16066        let kmax_in: i32 = webpsave_target_options.kmax;
16067        let kmax_in_name = utils::new_c_string("kmax")?;
16068
16069        let effort_in: i32 = webpsave_target_options.effort;
16070        let effort_in_name = utils::new_c_string("effort")?;
16071
16072        let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16073        let mixed_in_name = utils::new_c_string("mixed")?;
16074
16075        let keep_in: i32 = webpsave_target_options.keep as i32;
16076        let keep_in_name = utils::new_c_string("keep")?;
16077
16078        let background_wrapper =
16079            utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16080        let background_in = background_wrapper.ctx;
16081        let background_in_name = utils::new_c_string("background")?;
16082
16083        let page_height_in: i32 = webpsave_target_options.page_height;
16084        let page_height_in_name = utils::new_c_string("page-height")?;
16085
16086        let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16087        let profile_in_name = utils::new_c_string("profile")?;
16088
16089        let vips_op_response = bindings::vips_webpsave_target(
16090            inp_in,
16091            target_in,
16092            q_in_name.as_ptr(),
16093            q_in,
16094            lossless_in_name.as_ptr(),
16095            lossless_in,
16096            preset_in_name.as_ptr(),
16097            preset_in,
16098            smart_subsample_in_name.as_ptr(),
16099            smart_subsample_in,
16100            near_lossless_in_name.as_ptr(),
16101            near_lossless_in,
16102            alpha_q_in_name.as_ptr(),
16103            alpha_q_in,
16104            min_size_in_name.as_ptr(),
16105            min_size_in,
16106            kmin_in_name.as_ptr(),
16107            kmin_in,
16108            kmax_in_name.as_ptr(),
16109            kmax_in,
16110            effort_in_name.as_ptr(),
16111            effort_in,
16112            mixed_in_name.as_ptr(),
16113            mixed_in,
16114            keep_in_name.as_ptr(),
16115            keep_in,
16116            background_in_name.as_ptr(),
16117            background_in,
16118            page_height_in_name.as_ptr(),
16119            page_height_in,
16120            profile_in_name.as_ptr(),
16121            profile_in.as_ptr(),
16122            NULL,
16123        );
16124        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16125    }
16126}
16127
16128/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
16129/// inp: `&VipsImage` -> Image to save
16130
16131pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16132    unsafe {
16133        let inp_in: *mut bindings::VipsImage = inp.ctx;
16134
16135        let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16136        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16137    }
16138}
16139
16140/// Options for webpsave_mime operation
16141#[derive(Clone, Debug)]
16142pub struct WebpsaveMimeOptions {
16143    /// q: `i32` -> Q factor
16144    /// min: 0, max: 100, default: 75
16145    pub q: i32,
16146    /// lossless: `bool` -> Enable lossless compression
16147    /// default: false
16148    pub lossless: bool,
16149    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16150    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16151    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16152    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16153    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16154    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16155    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16156    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
16157    pub preset: ForeignWebpPreset,
16158    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16159    /// default: false
16160    pub smart_subsample: bool,
16161    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16162    /// default: false
16163    pub near_lossless: bool,
16164    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16165    /// min: 0, max: 100, default: 100
16166    pub alpha_q: i32,
16167    /// min_size: `bool` -> Optimise for minimum size
16168    /// default: false
16169    pub min_size: bool,
16170    /// kmin: `i32` -> Minimum number of frames between key frames
16171    /// min: 0, max: 2147483647, default: 2147483646
16172    pub kmin: i32,
16173    /// kmax: `i32` -> Maximum number of frames between key frames
16174    /// min: 0, max: 2147483647, default: 2147483647
16175    pub kmax: i32,
16176    /// effort: `i32` -> Level of CPU effort to reduce file size
16177    /// min: 0, max: 6, default: 4
16178    pub effort: i32,
16179    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16180    /// default: false
16181    pub mixed: bool,
16182    /// keep: `ForeignKeep` -> Which metadata to retain
16183    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16184    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16185    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16186    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16187    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16188    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16189    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16190    pub keep: ForeignKeep,
16191    /// background: `Vec<f64>` -> Background value
16192    pub background: Vec<f64>,
16193    /// page_height: `i32` -> Set page height for multipage save
16194    /// min: 0, max: 10000000, default: 0
16195    pub page_height: i32,
16196    /// profile: `String` -> Filename of ICC profile to embed
16197    pub profile: String,
16198}
16199
16200impl std::default::Default for WebpsaveMimeOptions {
16201    fn default() -> Self {
16202        WebpsaveMimeOptions {
16203            q: i32::from(75),
16204            lossless: false,
16205            preset: ForeignWebpPreset::Default,
16206            smart_subsample: false,
16207            near_lossless: false,
16208            alpha_q: i32::from(100),
16209            min_size: false,
16210            kmin: i32::from(2147483646),
16211            kmax: i32::from(2147483647),
16212            effort: i32::from(4),
16213            mixed: false,
16214            keep: ForeignKeep::All,
16215            background: Vec::new(),
16216            page_height: i32::from(0),
16217            profile: String::from("sRGB"),
16218        }
16219    }
16220}
16221
16222/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
16223/// inp: `&VipsImage` -> Image to save
16224/// webpsave_mime_options: `&WebpsaveMimeOptions` -> optional arguments
16225
16226pub fn webpsave_mime_with_opts(
16227    inp: &VipsImage,
16228    webpsave_mime_options: &WebpsaveMimeOptions,
16229) -> Result<()> {
16230    unsafe {
16231        let inp_in: *mut bindings::VipsImage = inp.ctx;
16232
16233        let q_in: i32 = webpsave_mime_options.q;
16234        let q_in_name = utils::new_c_string("Q")?;
16235
16236        let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16237        let lossless_in_name = utils::new_c_string("lossless")?;
16238
16239        let preset_in: i32 = webpsave_mime_options.preset as i32;
16240        let preset_in_name = utils::new_c_string("preset")?;
16241
16242        let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16243            1
16244        } else {
16245            0
16246        };
16247        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16248
16249        let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16250            1
16251        } else {
16252            0
16253        };
16254        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16255
16256        let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16257        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16258
16259        let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16260        let min_size_in_name = utils::new_c_string("min-size")?;
16261
16262        let kmin_in: i32 = webpsave_mime_options.kmin;
16263        let kmin_in_name = utils::new_c_string("kmin")?;
16264
16265        let kmax_in: i32 = webpsave_mime_options.kmax;
16266        let kmax_in_name = utils::new_c_string("kmax")?;
16267
16268        let effort_in: i32 = webpsave_mime_options.effort;
16269        let effort_in_name = utils::new_c_string("effort")?;
16270
16271        let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16272        let mixed_in_name = utils::new_c_string("mixed")?;
16273
16274        let keep_in: i32 = webpsave_mime_options.keep as i32;
16275        let keep_in_name = utils::new_c_string("keep")?;
16276
16277        let background_wrapper =
16278            utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16279        let background_in = background_wrapper.ctx;
16280        let background_in_name = utils::new_c_string("background")?;
16281
16282        let page_height_in: i32 = webpsave_mime_options.page_height;
16283        let page_height_in_name = utils::new_c_string("page-height")?;
16284
16285        let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16286        let profile_in_name = utils::new_c_string("profile")?;
16287
16288        let vips_op_response = bindings::vips_webpsave_mime(
16289            inp_in,
16290            q_in_name.as_ptr(),
16291            q_in,
16292            lossless_in_name.as_ptr(),
16293            lossless_in,
16294            preset_in_name.as_ptr(),
16295            preset_in,
16296            smart_subsample_in_name.as_ptr(),
16297            smart_subsample_in,
16298            near_lossless_in_name.as_ptr(),
16299            near_lossless_in,
16300            alpha_q_in_name.as_ptr(),
16301            alpha_q_in,
16302            min_size_in_name.as_ptr(),
16303            min_size_in,
16304            kmin_in_name.as_ptr(),
16305            kmin_in,
16306            kmax_in_name.as_ptr(),
16307            kmax_in,
16308            effort_in_name.as_ptr(),
16309            effort_in,
16310            mixed_in_name.as_ptr(),
16311            mixed_in,
16312            keep_in_name.as_ptr(),
16313            keep_in,
16314            background_in_name.as_ptr(),
16315            background_in,
16316            page_height_in_name.as_ptr(),
16317            page_height_in,
16318            profile_in_name.as_ptr(),
16319            profile_in.as_ptr(),
16320            NULL,
16321        );
16322        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16323    }
16324}
16325
16326/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
16327/// inp: `&VipsImage` -> Image to save
16328/// filename: `&str` -> Filename to save to
16329
16330pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16331    unsafe {
16332        let inp_in: *mut bindings::VipsImage = inp.ctx;
16333        let filename_in: CString = utils::new_c_string(filename)?;
16334
16335        let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16336        utils::result(vips_op_response, (), Error::TiffsaveError)
16337    }
16338}
16339
16340/// Options for tiffsave operation
16341#[derive(Clone, Debug)]
16342pub struct TiffsaveOptions {
16343    /// compression: `ForeignTiffCompression` -> Compression for this file
16344    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16345    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16346    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16347    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16348    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16349    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16350    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16351    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16352    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16353    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
16354    pub compression: ForeignTiffCompression,
16355    /// q: `i32` -> Q factor
16356    /// min: 1, max: 100, default: 75
16357    pub q: i32,
16358    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16359    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16360    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16361    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16362    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
16363    pub predictor: ForeignTiffPredictor,
16364    /// tile: `bool` -> Write a tiled tiff
16365    /// default: false
16366    pub tile: bool,
16367    /// tile_width: `i32` -> Tile width in pixels
16368    /// min: 1, max: 32768, default: 128
16369    pub tile_width: i32,
16370    /// tile_height: `i32` -> Tile height in pixels
16371    /// min: 1, max: 32768, default: 128
16372    pub tile_height: i32,
16373    /// pyramid: `bool` -> Write a pyramidal tiff
16374    /// default: false
16375    pub pyramid: bool,
16376    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
16377    /// default: false
16378    pub miniswhite: bool,
16379    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
16380    /// min: 0, max: 8, default: 0
16381    pub bitdepth: i32,
16382    /// resunit: `ForeignTiffResunit` -> Resolution unit
16383    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
16384    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
16385    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
16386    pub resunit: ForeignTiffResunit,
16387    /// xres: `f64` -> Horizontal resolution in pixels/mm
16388    /// min: 0.001, max: 1000000, default: 1
16389    pub xres: f64,
16390    /// yres: `f64` -> Vertical resolution in pixels/mm
16391    /// min: 0.001, max: 1000000, default: 1
16392    pub yres: f64,
16393    /// bigtiff: `bool` -> Write a bigtiff image
16394    /// default: false
16395    pub bigtiff: bool,
16396    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
16397    /// default: false
16398    pub properties: bool,
16399    /// region_shrink: `RegionShrink` -> Method to shrink regions
16400    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
16401    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
16402    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
16403    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
16404    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
16405    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
16406    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
16407    pub region_shrink: RegionShrink,
16408    /// level: `i32` -> ZSTD compression level
16409    /// min: 1, max: 22, default: 10
16410    pub level: i32,
16411    /// lossless: `bool` -> Enable WEBP lossless mode
16412    /// default: false
16413    pub lossless: bool,
16414    /// depth: `ForeignDzDepth` -> Pyramid depth
16415    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
16416    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
16417    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
16418    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
16419    pub depth: ForeignDzDepth,
16420    /// subifd: `bool` -> Save pyr layers as sub-IFDs
16421    /// default: false
16422    pub subifd: bool,
16423    /// premultiply: `bool` -> Save with premultiplied alpha
16424    /// default: false
16425    pub premultiply: bool,
16426    /// keep: `ForeignKeep` -> Which metadata to retain
16427    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16428    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16429    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16430    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16431    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16432    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16433    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16434    pub keep: ForeignKeep,
16435    /// background: `Vec<f64>` -> Background value
16436    pub background: Vec<f64>,
16437    /// page_height: `i32` -> Set page height for multipage save
16438    /// min: 0, max: 10000000, default: 0
16439    pub page_height: i32,
16440    /// profile: `String` -> Filename of ICC profile to embed
16441    pub profile: String,
16442}
16443
16444impl std::default::Default for TiffsaveOptions {
16445    fn default() -> Self {
16446        TiffsaveOptions {
16447            compression: ForeignTiffCompression::None,
16448            q: i32::from(75),
16449            predictor: ForeignTiffPredictor::Horizontal,
16450            tile: false,
16451            tile_width: i32::from(128),
16452            tile_height: i32::from(128),
16453            pyramid: false,
16454            miniswhite: false,
16455            bitdepth: i32::from(0),
16456            resunit: ForeignTiffResunit::Cm,
16457            xres: f64::from(1),
16458            yres: f64::from(1),
16459            bigtiff: false,
16460            properties: false,
16461            region_shrink: RegionShrink::Mean,
16462            level: i32::from(10),
16463            lossless: false,
16464            depth: ForeignDzDepth::Onetile,
16465            subifd: false,
16466            premultiply: false,
16467            keep: ForeignKeep::All,
16468            background: Vec::new(),
16469            page_height: i32::from(0),
16470            profile: String::from("sRGB"),
16471        }
16472    }
16473}
16474
16475/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
16476/// inp: `&VipsImage` -> Image to save
16477/// filename: `&str` -> Filename to save to
16478/// tiffsave_options: `&TiffsaveOptions` -> optional arguments
16479
16480pub fn tiffsave_with_opts(
16481    inp: &VipsImage,
16482    filename: &str,
16483    tiffsave_options: &TiffsaveOptions,
16484) -> Result<()> {
16485    unsafe {
16486        let inp_in: *mut bindings::VipsImage = inp.ctx;
16487        let filename_in: CString = utils::new_c_string(filename)?;
16488
16489        let compression_in: i32 = tiffsave_options.compression as i32;
16490        let compression_in_name = utils::new_c_string("compression")?;
16491
16492        let q_in: i32 = tiffsave_options.q;
16493        let q_in_name = utils::new_c_string("Q")?;
16494
16495        let predictor_in: i32 = tiffsave_options.predictor as i32;
16496        let predictor_in_name = utils::new_c_string("predictor")?;
16497
16498        let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
16499        let tile_in_name = utils::new_c_string("tile")?;
16500
16501        let tile_width_in: i32 = tiffsave_options.tile_width;
16502        let tile_width_in_name = utils::new_c_string("tile-width")?;
16503
16504        let tile_height_in: i32 = tiffsave_options.tile_height;
16505        let tile_height_in_name = utils::new_c_string("tile-height")?;
16506
16507        let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
16508        let pyramid_in_name = utils::new_c_string("pyramid")?;
16509
16510        let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
16511        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
16512
16513        let bitdepth_in: i32 = tiffsave_options.bitdepth;
16514        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16515
16516        let resunit_in: i32 = tiffsave_options.resunit as i32;
16517        let resunit_in_name = utils::new_c_string("resunit")?;
16518
16519        let xres_in: f64 = tiffsave_options.xres;
16520        let xres_in_name = utils::new_c_string("xres")?;
16521
16522        let yres_in: f64 = tiffsave_options.yres;
16523        let yres_in_name = utils::new_c_string("yres")?;
16524
16525        let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
16526        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
16527
16528        let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
16529        let properties_in_name = utils::new_c_string("properties")?;
16530
16531        let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
16532        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
16533
16534        let level_in: i32 = tiffsave_options.level;
16535        let level_in_name = utils::new_c_string("level")?;
16536
16537        let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
16538        let lossless_in_name = utils::new_c_string("lossless")?;
16539
16540        let depth_in: i32 = tiffsave_options.depth as i32;
16541        let depth_in_name = utils::new_c_string("depth")?;
16542
16543        let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
16544        let subifd_in_name = utils::new_c_string("subifd")?;
16545
16546        let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
16547        let premultiply_in_name = utils::new_c_string("premultiply")?;
16548
16549        let keep_in: i32 = tiffsave_options.keep as i32;
16550        let keep_in_name = utils::new_c_string("keep")?;
16551
16552        let background_wrapper =
16553            utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
16554        let background_in = background_wrapper.ctx;
16555        let background_in_name = utils::new_c_string("background")?;
16556
16557        let page_height_in: i32 = tiffsave_options.page_height;
16558        let page_height_in_name = utils::new_c_string("page-height")?;
16559
16560        let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
16561        let profile_in_name = utils::new_c_string("profile")?;
16562
16563        let vips_op_response = bindings::vips_tiffsave(
16564            inp_in,
16565            filename_in.as_ptr(),
16566            compression_in_name.as_ptr(),
16567            compression_in,
16568            q_in_name.as_ptr(),
16569            q_in,
16570            predictor_in_name.as_ptr(),
16571            predictor_in,
16572            tile_in_name.as_ptr(),
16573            tile_in,
16574            tile_width_in_name.as_ptr(),
16575            tile_width_in,
16576            tile_height_in_name.as_ptr(),
16577            tile_height_in,
16578            pyramid_in_name.as_ptr(),
16579            pyramid_in,
16580            miniswhite_in_name.as_ptr(),
16581            miniswhite_in,
16582            bitdepth_in_name.as_ptr(),
16583            bitdepth_in,
16584            resunit_in_name.as_ptr(),
16585            resunit_in,
16586            xres_in_name.as_ptr(),
16587            xres_in,
16588            yres_in_name.as_ptr(),
16589            yres_in,
16590            bigtiff_in_name.as_ptr(),
16591            bigtiff_in,
16592            properties_in_name.as_ptr(),
16593            properties_in,
16594            region_shrink_in_name.as_ptr(),
16595            region_shrink_in,
16596            level_in_name.as_ptr(),
16597            level_in,
16598            lossless_in_name.as_ptr(),
16599            lossless_in,
16600            depth_in_name.as_ptr(),
16601            depth_in,
16602            subifd_in_name.as_ptr(),
16603            subifd_in,
16604            premultiply_in_name.as_ptr(),
16605            premultiply_in,
16606            keep_in_name.as_ptr(),
16607            keep_in,
16608            background_in_name.as_ptr(),
16609            background_in,
16610            page_height_in_name.as_ptr(),
16611            page_height_in,
16612            profile_in_name.as_ptr(),
16613            profile_in.as_ptr(),
16614            NULL,
16615        );
16616        utils::result(vips_op_response, (), Error::TiffsaveError)
16617    }
16618}
16619
16620/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
16621/// inp: `&VipsImage` -> Image to save
16622/// returns `Vec<u8>` - Buffer to save to
16623pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16624    unsafe {
16625        let inp_in: *mut bindings::VipsImage = inp.ctx;
16626        let mut buffer_buf_size: u64 = 0;
16627        let mut buffer_out: *mut c_void = null_mut();
16628
16629        let vips_op_response =
16630            bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16631        utils::result(
16632            vips_op_response,
16633            utils::new_byte_array(buffer_out, buffer_buf_size),
16634            Error::TiffsaveBufferError,
16635        )
16636    }
16637}
16638
16639/// Options for tiffsave_buffer operation
16640#[derive(Clone, Debug)]
16641pub struct TiffsaveBufferOptions {
16642    /// compression: `ForeignTiffCompression` -> Compression for this file
16643    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16644    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16645    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16646    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16647    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16648    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16649    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16650    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16651    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16652    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
16653    pub compression: ForeignTiffCompression,
16654    /// q: `i32` -> Q factor
16655    /// min: 1, max: 100, default: 75
16656    pub q: i32,
16657    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16658    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16659    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16660    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16661    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
16662    pub predictor: ForeignTiffPredictor,
16663    /// tile: `bool` -> Write a tiled tiff
16664    /// default: false
16665    pub tile: bool,
16666    /// tile_width: `i32` -> Tile width in pixels
16667    /// min: 1, max: 32768, default: 128
16668    pub tile_width: i32,
16669    /// tile_height: `i32` -> Tile height in pixels
16670    /// min: 1, max: 32768, default: 128
16671    pub tile_height: i32,
16672    /// pyramid: `bool` -> Write a pyramidal tiff
16673    /// default: false
16674    pub pyramid: bool,
16675    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
16676    /// default: false
16677    pub miniswhite: bool,
16678    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
16679    /// min: 0, max: 8, default: 0
16680    pub bitdepth: i32,
16681    /// resunit: `ForeignTiffResunit` -> Resolution unit
16682    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
16683    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
16684    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
16685    pub resunit: ForeignTiffResunit,
16686    /// xres: `f64` -> Horizontal resolution in pixels/mm
16687    /// min: 0.001, max: 1000000, default: 1
16688    pub xres: f64,
16689    /// yres: `f64` -> Vertical resolution in pixels/mm
16690    /// min: 0.001, max: 1000000, default: 1
16691    pub yres: f64,
16692    /// bigtiff: `bool` -> Write a bigtiff image
16693    /// default: false
16694    pub bigtiff: bool,
16695    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
16696    /// default: false
16697    pub properties: bool,
16698    /// region_shrink: `RegionShrink` -> Method to shrink regions
16699    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
16700    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
16701    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
16702    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
16703    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
16704    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
16705    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
16706    pub region_shrink: RegionShrink,
16707    /// level: `i32` -> ZSTD compression level
16708    /// min: 1, max: 22, default: 10
16709    pub level: i32,
16710    /// lossless: `bool` -> Enable WEBP lossless mode
16711    /// default: false
16712    pub lossless: bool,
16713    /// depth: `ForeignDzDepth` -> Pyramid depth
16714    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
16715    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
16716    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
16717    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
16718    pub depth: ForeignDzDepth,
16719    /// subifd: `bool` -> Save pyr layers as sub-IFDs
16720    /// default: false
16721    pub subifd: bool,
16722    /// premultiply: `bool` -> Save with premultiplied alpha
16723    /// default: false
16724    pub premultiply: bool,
16725    /// keep: `ForeignKeep` -> Which metadata to retain
16726    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16727    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16728    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16729    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16730    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16731    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16732    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16733    pub keep: ForeignKeep,
16734    /// background: `Vec<f64>` -> Background value
16735    pub background: Vec<f64>,
16736    /// page_height: `i32` -> Set page height for multipage save
16737    /// min: 0, max: 10000000, default: 0
16738    pub page_height: i32,
16739    /// profile: `String` -> Filename of ICC profile to embed
16740    pub profile: String,
16741}
16742
16743impl std::default::Default for TiffsaveBufferOptions {
16744    fn default() -> Self {
16745        TiffsaveBufferOptions {
16746            compression: ForeignTiffCompression::None,
16747            q: i32::from(75),
16748            predictor: ForeignTiffPredictor::Horizontal,
16749            tile: false,
16750            tile_width: i32::from(128),
16751            tile_height: i32::from(128),
16752            pyramid: false,
16753            miniswhite: false,
16754            bitdepth: i32::from(0),
16755            resunit: ForeignTiffResunit::Cm,
16756            xres: f64::from(1),
16757            yres: f64::from(1),
16758            bigtiff: false,
16759            properties: false,
16760            region_shrink: RegionShrink::Mean,
16761            level: i32::from(10),
16762            lossless: false,
16763            depth: ForeignDzDepth::Onetile,
16764            subifd: false,
16765            premultiply: false,
16766            keep: ForeignKeep::All,
16767            background: Vec::new(),
16768            page_height: i32::from(0),
16769            profile: String::from("sRGB"),
16770        }
16771    }
16772}
16773
16774/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
16775/// inp: `&VipsImage` -> Image to save
16776/// tiffsave_buffer_options: `&TiffsaveBufferOptions` -> optional arguments
16777/// returns `Vec<u8>` - Buffer to save to
16778pub fn tiffsave_buffer_with_opts(
16779    inp: &VipsImage,
16780    tiffsave_buffer_options: &TiffsaveBufferOptions,
16781) -> Result<Vec<u8>> {
16782    unsafe {
16783        let inp_in: *mut bindings::VipsImage = inp.ctx;
16784        let mut buffer_buf_size: u64 = 0;
16785        let mut buffer_out: *mut c_void = null_mut();
16786
16787        let compression_in: i32 = tiffsave_buffer_options.compression as i32;
16788        let compression_in_name = utils::new_c_string("compression")?;
16789
16790        let q_in: i32 = tiffsave_buffer_options.q;
16791        let q_in_name = utils::new_c_string("Q")?;
16792
16793        let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
16794        let predictor_in_name = utils::new_c_string("predictor")?;
16795
16796        let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
16797        let tile_in_name = utils::new_c_string("tile")?;
16798
16799        let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
16800        let tile_width_in_name = utils::new_c_string("tile-width")?;
16801
16802        let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
16803        let tile_height_in_name = utils::new_c_string("tile-height")?;
16804
16805        let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
16806            1
16807        } else {
16808            0
16809        };
16810        let pyramid_in_name = utils::new_c_string("pyramid")?;
16811
16812        let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
16813            1
16814        } else {
16815            0
16816        };
16817        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
16818
16819        let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
16820        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16821
16822        let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
16823        let resunit_in_name = utils::new_c_string("resunit")?;
16824
16825        let xres_in: f64 = tiffsave_buffer_options.xres;
16826        let xres_in_name = utils::new_c_string("xres")?;
16827
16828        let yres_in: f64 = tiffsave_buffer_options.yres;
16829        let yres_in_name = utils::new_c_string("yres")?;
16830
16831        let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
16832            1
16833        } else {
16834            0
16835        };
16836        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
16837
16838        let properties_in: i32 = if tiffsave_buffer_options.properties {
16839            1
16840        } else {
16841            0
16842        };
16843        let properties_in_name = utils::new_c_string("properties")?;
16844
16845        let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
16846        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
16847
16848        let level_in: i32 = tiffsave_buffer_options.level;
16849        let level_in_name = utils::new_c_string("level")?;
16850
16851        let lossless_in: i32 = if tiffsave_buffer_options.lossless {
16852            1
16853        } else {
16854            0
16855        };
16856        let lossless_in_name = utils::new_c_string("lossless")?;
16857
16858        let depth_in: i32 = tiffsave_buffer_options.depth as i32;
16859        let depth_in_name = utils::new_c_string("depth")?;
16860
16861        let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
16862        let subifd_in_name = utils::new_c_string("subifd")?;
16863
16864        let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
16865            1
16866        } else {
16867            0
16868        };
16869        let premultiply_in_name = utils::new_c_string("premultiply")?;
16870
16871        let keep_in: i32 = tiffsave_buffer_options.keep as i32;
16872        let keep_in_name = utils::new_c_string("keep")?;
16873
16874        let background_wrapper =
16875            utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
16876        let background_in = background_wrapper.ctx;
16877        let background_in_name = utils::new_c_string("background")?;
16878
16879        let page_height_in: i32 = tiffsave_buffer_options.page_height;
16880        let page_height_in_name = utils::new_c_string("page-height")?;
16881
16882        let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
16883        let profile_in_name = utils::new_c_string("profile")?;
16884
16885        let vips_op_response = bindings::vips_tiffsave_buffer(
16886            inp_in,
16887            &mut buffer_out,
16888            &mut buffer_buf_size,
16889            compression_in_name.as_ptr(),
16890            compression_in,
16891            q_in_name.as_ptr(),
16892            q_in,
16893            predictor_in_name.as_ptr(),
16894            predictor_in,
16895            tile_in_name.as_ptr(),
16896            tile_in,
16897            tile_width_in_name.as_ptr(),
16898            tile_width_in,
16899            tile_height_in_name.as_ptr(),
16900            tile_height_in,
16901            pyramid_in_name.as_ptr(),
16902            pyramid_in,
16903            miniswhite_in_name.as_ptr(),
16904            miniswhite_in,
16905            bitdepth_in_name.as_ptr(),
16906            bitdepth_in,
16907            resunit_in_name.as_ptr(),
16908            resunit_in,
16909            xres_in_name.as_ptr(),
16910            xres_in,
16911            yres_in_name.as_ptr(),
16912            yres_in,
16913            bigtiff_in_name.as_ptr(),
16914            bigtiff_in,
16915            properties_in_name.as_ptr(),
16916            properties_in,
16917            region_shrink_in_name.as_ptr(),
16918            region_shrink_in,
16919            level_in_name.as_ptr(),
16920            level_in,
16921            lossless_in_name.as_ptr(),
16922            lossless_in,
16923            depth_in_name.as_ptr(),
16924            depth_in,
16925            subifd_in_name.as_ptr(),
16926            subifd_in,
16927            premultiply_in_name.as_ptr(),
16928            premultiply_in,
16929            keep_in_name.as_ptr(),
16930            keep_in,
16931            background_in_name.as_ptr(),
16932            background_in,
16933            page_height_in_name.as_ptr(),
16934            page_height_in,
16935            profile_in_name.as_ptr(),
16936            profile_in.as_ptr(),
16937            NULL,
16938        );
16939        utils::result(
16940            vips_op_response,
16941            utils::new_byte_array(buffer_out, buffer_buf_size),
16942            Error::TiffsaveBufferError,
16943        )
16944    }
16945}
16946
16947/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
16948/// inp: `&VipsImage` -> Image to save
16949/// target: `&VipsTarget` -> Target to save to
16950
16951pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16952    unsafe {
16953        let inp_in: *mut bindings::VipsImage = inp.ctx;
16954        let target_in: *mut bindings::VipsTarget = target.ctx;
16955
16956        let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
16957        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
16958    }
16959}
16960
16961/// Options for tiffsave_target operation
16962#[derive(Clone, Debug)]
16963pub struct TiffsaveTargetOptions {
16964    /// compression: `ForeignTiffCompression` -> Compression for this file
16965    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16966    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16967    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16968    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16969    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16970    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16971    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16972    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16973    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16974    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
16975    pub compression: ForeignTiffCompression,
16976    /// q: `i32` -> Q factor
16977    /// min: 1, max: 100, default: 75
16978    pub q: i32,
16979    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16980    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16981    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16982    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16983    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
16984    pub predictor: ForeignTiffPredictor,
16985    /// tile: `bool` -> Write a tiled tiff
16986    /// default: false
16987    pub tile: bool,
16988    /// tile_width: `i32` -> Tile width in pixels
16989    /// min: 1, max: 32768, default: 128
16990    pub tile_width: i32,
16991    /// tile_height: `i32` -> Tile height in pixels
16992    /// min: 1, max: 32768, default: 128
16993    pub tile_height: i32,
16994    /// pyramid: `bool` -> Write a pyramidal tiff
16995    /// default: false
16996    pub pyramid: bool,
16997    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
16998    /// default: false
16999    pub miniswhite: bool,
17000    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17001    /// min: 0, max: 8, default: 0
17002    pub bitdepth: i32,
17003    /// resunit: `ForeignTiffResunit` -> Resolution unit
17004    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17005    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17006    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
17007    pub resunit: ForeignTiffResunit,
17008    /// xres: `f64` -> Horizontal resolution in pixels/mm
17009    /// min: 0.001, max: 1000000, default: 1
17010    pub xres: f64,
17011    /// yres: `f64` -> Vertical resolution in pixels/mm
17012    /// min: 0.001, max: 1000000, default: 1
17013    pub yres: f64,
17014    /// bigtiff: `bool` -> Write a bigtiff image
17015    /// default: false
17016    pub bigtiff: bool,
17017    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17018    /// default: false
17019    pub properties: bool,
17020    /// region_shrink: `RegionShrink` -> Method to shrink regions
17021    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17022    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17023    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17024    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17025    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17026    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17027    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17028    pub region_shrink: RegionShrink,
17029    /// level: `i32` -> ZSTD compression level
17030    /// min: 1, max: 22, default: 10
17031    pub level: i32,
17032    /// lossless: `bool` -> Enable WEBP lossless mode
17033    /// default: false
17034    pub lossless: bool,
17035    /// depth: `ForeignDzDepth` -> Pyramid depth
17036    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17037    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17038    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17039    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17040    pub depth: ForeignDzDepth,
17041    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17042    /// default: false
17043    pub subifd: bool,
17044    /// premultiply: `bool` -> Save with premultiplied alpha
17045    /// default: false
17046    pub premultiply: bool,
17047    /// keep: `ForeignKeep` -> Which metadata to retain
17048    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17049    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17050    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17051    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17052    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17053    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17054    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17055    pub keep: ForeignKeep,
17056    /// background: `Vec<f64>` -> Background value
17057    pub background: Vec<f64>,
17058    /// page_height: `i32` -> Set page height for multipage save
17059    /// min: 0, max: 10000000, default: 0
17060    pub page_height: i32,
17061    /// profile: `String` -> Filename of ICC profile to embed
17062    pub profile: String,
17063}
17064
17065impl std::default::Default for TiffsaveTargetOptions {
17066    fn default() -> Self {
17067        TiffsaveTargetOptions {
17068            compression: ForeignTiffCompression::None,
17069            q: i32::from(75),
17070            predictor: ForeignTiffPredictor::Horizontal,
17071            tile: false,
17072            tile_width: i32::from(128),
17073            tile_height: i32::from(128),
17074            pyramid: false,
17075            miniswhite: false,
17076            bitdepth: i32::from(0),
17077            resunit: ForeignTiffResunit::Cm,
17078            xres: f64::from(1),
17079            yres: f64::from(1),
17080            bigtiff: false,
17081            properties: false,
17082            region_shrink: RegionShrink::Mean,
17083            level: i32::from(10),
17084            lossless: false,
17085            depth: ForeignDzDepth::Onetile,
17086            subifd: false,
17087            premultiply: false,
17088            keep: ForeignKeep::All,
17089            background: Vec::new(),
17090            page_height: i32::from(0),
17091            profile: String::from("sRGB"),
17092        }
17093    }
17094}
17095
17096/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
17097/// inp: `&VipsImage` -> Image to save
17098/// target: `&VipsTarget` -> Target to save to
17099/// tiffsave_target_options: `&TiffsaveTargetOptions` -> optional arguments
17100
17101pub fn tiffsave_target_with_opts(
17102    inp: &VipsImage,
17103    target: &VipsTarget,
17104    tiffsave_target_options: &TiffsaveTargetOptions,
17105) -> Result<()> {
17106    unsafe {
17107        let inp_in: *mut bindings::VipsImage = inp.ctx;
17108        let target_in: *mut bindings::VipsTarget = target.ctx;
17109
17110        let compression_in: i32 = tiffsave_target_options.compression as i32;
17111        let compression_in_name = utils::new_c_string("compression")?;
17112
17113        let q_in: i32 = tiffsave_target_options.q;
17114        let q_in_name = utils::new_c_string("Q")?;
17115
17116        let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17117        let predictor_in_name = utils::new_c_string("predictor")?;
17118
17119        let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17120        let tile_in_name = utils::new_c_string("tile")?;
17121
17122        let tile_width_in: i32 = tiffsave_target_options.tile_width;
17123        let tile_width_in_name = utils::new_c_string("tile-width")?;
17124
17125        let tile_height_in: i32 = tiffsave_target_options.tile_height;
17126        let tile_height_in_name = utils::new_c_string("tile-height")?;
17127
17128        let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17129            1
17130        } else {
17131            0
17132        };
17133        let pyramid_in_name = utils::new_c_string("pyramid")?;
17134
17135        let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17136            1
17137        } else {
17138            0
17139        };
17140        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17141
17142        let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17143        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17144
17145        let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17146        let resunit_in_name = utils::new_c_string("resunit")?;
17147
17148        let xres_in: f64 = tiffsave_target_options.xres;
17149        let xres_in_name = utils::new_c_string("xres")?;
17150
17151        let yres_in: f64 = tiffsave_target_options.yres;
17152        let yres_in_name = utils::new_c_string("yres")?;
17153
17154        let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17155            1
17156        } else {
17157            0
17158        };
17159        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17160
17161        let properties_in: i32 = if tiffsave_target_options.properties {
17162            1
17163        } else {
17164            0
17165        };
17166        let properties_in_name = utils::new_c_string("properties")?;
17167
17168        let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17169        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17170
17171        let level_in: i32 = tiffsave_target_options.level;
17172        let level_in_name = utils::new_c_string("level")?;
17173
17174        let lossless_in: i32 = if tiffsave_target_options.lossless {
17175            1
17176        } else {
17177            0
17178        };
17179        let lossless_in_name = utils::new_c_string("lossless")?;
17180
17181        let depth_in: i32 = tiffsave_target_options.depth as i32;
17182        let depth_in_name = utils::new_c_string("depth")?;
17183
17184        let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17185        let subifd_in_name = utils::new_c_string("subifd")?;
17186
17187        let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17188            1
17189        } else {
17190            0
17191        };
17192        let premultiply_in_name = utils::new_c_string("premultiply")?;
17193
17194        let keep_in: i32 = tiffsave_target_options.keep as i32;
17195        let keep_in_name = utils::new_c_string("keep")?;
17196
17197        let background_wrapper =
17198            utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17199        let background_in = background_wrapper.ctx;
17200        let background_in_name = utils::new_c_string("background")?;
17201
17202        let page_height_in: i32 = tiffsave_target_options.page_height;
17203        let page_height_in_name = utils::new_c_string("page-height")?;
17204
17205        let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17206        let profile_in_name = utils::new_c_string("profile")?;
17207
17208        let vips_op_response = bindings::vips_tiffsave_target(
17209            inp_in,
17210            target_in,
17211            compression_in_name.as_ptr(),
17212            compression_in,
17213            q_in_name.as_ptr(),
17214            q_in,
17215            predictor_in_name.as_ptr(),
17216            predictor_in,
17217            tile_in_name.as_ptr(),
17218            tile_in,
17219            tile_width_in_name.as_ptr(),
17220            tile_width_in,
17221            tile_height_in_name.as_ptr(),
17222            tile_height_in,
17223            pyramid_in_name.as_ptr(),
17224            pyramid_in,
17225            miniswhite_in_name.as_ptr(),
17226            miniswhite_in,
17227            bitdepth_in_name.as_ptr(),
17228            bitdepth_in,
17229            resunit_in_name.as_ptr(),
17230            resunit_in,
17231            xres_in_name.as_ptr(),
17232            xres_in,
17233            yres_in_name.as_ptr(),
17234            yres_in,
17235            bigtiff_in_name.as_ptr(),
17236            bigtiff_in,
17237            properties_in_name.as_ptr(),
17238            properties_in,
17239            region_shrink_in_name.as_ptr(),
17240            region_shrink_in,
17241            level_in_name.as_ptr(),
17242            level_in,
17243            lossless_in_name.as_ptr(),
17244            lossless_in,
17245            depth_in_name.as_ptr(),
17246            depth_in,
17247            subifd_in_name.as_ptr(),
17248            subifd_in,
17249            premultiply_in_name.as_ptr(),
17250            premultiply_in,
17251            keep_in_name.as_ptr(),
17252            keep_in,
17253            background_in_name.as_ptr(),
17254            background_in,
17255            page_height_in_name.as_ptr(),
17256            page_height_in,
17257            profile_in_name.as_ptr(),
17258            profile_in.as_ptr(),
17259            NULL,
17260        );
17261        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17262    }
17263}
17264
17265/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
17266/// inp: `&VipsImage` -> Image to save
17267/// filename: `&str` -> Filename to save to
17268
17269pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17270    unsafe {
17271        let inp_in: *mut bindings::VipsImage = inp.ctx;
17272        let filename_in: CString = utils::new_c_string(filename)?;
17273
17274        let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17275        utils::result(vips_op_response, (), Error::HeifsaveError)
17276    }
17277}
17278
17279/// Options for heifsave operation
17280#[derive(Clone, Debug)]
17281pub struct HeifsaveOptions {
17282    /// q: `i32` -> Q factor
17283    /// min: 1, max: 100, default: 50
17284    pub q: i32,
17285    /// bitdepth: `i32` -> Number of bits per pixel
17286    /// min: 1, max: 16, default: 12
17287    pub bitdepth: i32,
17288    /// lossless: `bool` -> Enable lossless compression
17289    /// default: false
17290    pub lossless: bool,
17291    /// compression: `ForeignHeifCompression` -> Compression format
17292    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17293    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17294    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17295    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17296    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17297    pub compression: ForeignHeifCompression,
17298    /// effort: `i32` -> CPU effort
17299    /// min: 0, max: 9, default: 4
17300    pub effort: i32,
17301    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17302    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17303    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17304    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17305    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17306    pub subsample_mode: ForeignSubsample,
17307    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17308    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17309    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17310    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17311    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17312    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17313    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17314    pub encoder: ForeignHeifEncoder,
17315    /// keep: `ForeignKeep` -> Which metadata to retain
17316    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17317    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17318    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17319    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17320    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17321    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17322    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17323    pub keep: ForeignKeep,
17324    /// background: `Vec<f64>` -> Background value
17325    pub background: Vec<f64>,
17326    /// page_height: `i32` -> Set page height for multipage save
17327    /// min: 0, max: 10000000, default: 0
17328    pub page_height: i32,
17329    /// profile: `String` -> Filename of ICC profile to embed
17330    pub profile: String,
17331}
17332
17333impl std::default::Default for HeifsaveOptions {
17334    fn default() -> Self {
17335        HeifsaveOptions {
17336            q: i32::from(50),
17337            bitdepth: i32::from(12),
17338            lossless: false,
17339            compression: ForeignHeifCompression::Hevc,
17340            effort: i32::from(4),
17341            subsample_mode: ForeignSubsample::Auto,
17342            encoder: ForeignHeifEncoder::Auto,
17343            keep: ForeignKeep::All,
17344            background: Vec::new(),
17345            page_height: i32::from(0),
17346            profile: String::from("sRGB"),
17347        }
17348    }
17349}
17350
17351/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
17352/// inp: `&VipsImage` -> Image to save
17353/// filename: `&str` -> Filename to save to
17354/// heifsave_options: `&HeifsaveOptions` -> optional arguments
17355
17356pub fn heifsave_with_opts(
17357    inp: &VipsImage,
17358    filename: &str,
17359    heifsave_options: &HeifsaveOptions,
17360) -> Result<()> {
17361    unsafe {
17362        let inp_in: *mut bindings::VipsImage = inp.ctx;
17363        let filename_in: CString = utils::new_c_string(filename)?;
17364
17365        let q_in: i32 = heifsave_options.q;
17366        let q_in_name = utils::new_c_string("Q")?;
17367
17368        let bitdepth_in: i32 = heifsave_options.bitdepth;
17369        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17370
17371        let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
17372        let lossless_in_name = utils::new_c_string("lossless")?;
17373
17374        let compression_in: i32 = heifsave_options.compression as i32;
17375        let compression_in_name = utils::new_c_string("compression")?;
17376
17377        let effort_in: i32 = heifsave_options.effort;
17378        let effort_in_name = utils::new_c_string("effort")?;
17379
17380        let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
17381        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17382
17383        let encoder_in: i32 = heifsave_options.encoder as i32;
17384        let encoder_in_name = utils::new_c_string("encoder")?;
17385
17386        let keep_in: i32 = heifsave_options.keep as i32;
17387        let keep_in_name = utils::new_c_string("keep")?;
17388
17389        let background_wrapper =
17390            utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
17391        let background_in = background_wrapper.ctx;
17392        let background_in_name = utils::new_c_string("background")?;
17393
17394        let page_height_in: i32 = heifsave_options.page_height;
17395        let page_height_in_name = utils::new_c_string("page-height")?;
17396
17397        let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
17398        let profile_in_name = utils::new_c_string("profile")?;
17399
17400        let vips_op_response = bindings::vips_heifsave(
17401            inp_in,
17402            filename_in.as_ptr(),
17403            q_in_name.as_ptr(),
17404            q_in,
17405            bitdepth_in_name.as_ptr(),
17406            bitdepth_in,
17407            lossless_in_name.as_ptr(),
17408            lossless_in,
17409            compression_in_name.as_ptr(),
17410            compression_in,
17411            effort_in_name.as_ptr(),
17412            effort_in,
17413            subsample_mode_in_name.as_ptr(),
17414            subsample_mode_in,
17415            encoder_in_name.as_ptr(),
17416            encoder_in,
17417            keep_in_name.as_ptr(),
17418            keep_in,
17419            background_in_name.as_ptr(),
17420            background_in,
17421            page_height_in_name.as_ptr(),
17422            page_height_in,
17423            profile_in_name.as_ptr(),
17424            profile_in.as_ptr(),
17425            NULL,
17426        );
17427        utils::result(vips_op_response, (), Error::HeifsaveError)
17428    }
17429}
17430
17431/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17432/// inp: `&VipsImage` -> Image to save
17433/// returns `Vec<u8>` - Buffer to save to
17434pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17435    unsafe {
17436        let inp_in: *mut bindings::VipsImage = inp.ctx;
17437        let mut buffer_buf_size: u64 = 0;
17438        let mut buffer_out: *mut c_void = null_mut();
17439
17440        let vips_op_response =
17441            bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17442        utils::result(
17443            vips_op_response,
17444            utils::new_byte_array(buffer_out, buffer_buf_size),
17445            Error::HeifsaveBufferError,
17446        )
17447    }
17448}
17449
17450/// Options for heifsave_buffer operation
17451#[derive(Clone, Debug)]
17452pub struct HeifsaveBufferOptions {
17453    /// q: `i32` -> Q factor
17454    /// min: 1, max: 100, default: 50
17455    pub q: i32,
17456    /// bitdepth: `i32` -> Number of bits per pixel
17457    /// min: 1, max: 16, default: 12
17458    pub bitdepth: i32,
17459    /// lossless: `bool` -> Enable lossless compression
17460    /// default: false
17461    pub lossless: bool,
17462    /// compression: `ForeignHeifCompression` -> Compression format
17463    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17464    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17465    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17466    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17467    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17468    pub compression: ForeignHeifCompression,
17469    /// effort: `i32` -> CPU effort
17470    /// min: 0, max: 9, default: 4
17471    pub effort: i32,
17472    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17473    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17474    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17475    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17476    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17477    pub subsample_mode: ForeignSubsample,
17478    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17479    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17480    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17481    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17482    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17483    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17484    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17485    pub encoder: ForeignHeifEncoder,
17486    /// keep: `ForeignKeep` -> Which metadata to retain
17487    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17488    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17489    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17490    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17491    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17492    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17493    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17494    pub keep: ForeignKeep,
17495    /// background: `Vec<f64>` -> Background value
17496    pub background: Vec<f64>,
17497    /// page_height: `i32` -> Set page height for multipage save
17498    /// min: 0, max: 10000000, default: 0
17499    pub page_height: i32,
17500    /// profile: `String` -> Filename of ICC profile to embed
17501    pub profile: String,
17502}
17503
17504impl std::default::Default for HeifsaveBufferOptions {
17505    fn default() -> Self {
17506        HeifsaveBufferOptions {
17507            q: i32::from(50),
17508            bitdepth: i32::from(12),
17509            lossless: false,
17510            compression: ForeignHeifCompression::Hevc,
17511            effort: i32::from(4),
17512            subsample_mode: ForeignSubsample::Auto,
17513            encoder: ForeignHeifEncoder::Auto,
17514            keep: ForeignKeep::All,
17515            background: Vec::new(),
17516            page_height: i32::from(0),
17517            profile: String::from("sRGB"),
17518        }
17519    }
17520}
17521
17522/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17523/// inp: `&VipsImage` -> Image to save
17524/// heifsave_buffer_options: `&HeifsaveBufferOptions` -> optional arguments
17525/// returns `Vec<u8>` - Buffer to save to
17526pub fn heifsave_buffer_with_opts(
17527    inp: &VipsImage,
17528    heifsave_buffer_options: &HeifsaveBufferOptions,
17529) -> Result<Vec<u8>> {
17530    unsafe {
17531        let inp_in: *mut bindings::VipsImage = inp.ctx;
17532        let mut buffer_buf_size: u64 = 0;
17533        let mut buffer_out: *mut c_void = null_mut();
17534
17535        let q_in: i32 = heifsave_buffer_options.q;
17536        let q_in_name = utils::new_c_string("Q")?;
17537
17538        let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
17539        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17540
17541        let lossless_in: i32 = if heifsave_buffer_options.lossless {
17542            1
17543        } else {
17544            0
17545        };
17546        let lossless_in_name = utils::new_c_string("lossless")?;
17547
17548        let compression_in: i32 = heifsave_buffer_options.compression as i32;
17549        let compression_in_name = utils::new_c_string("compression")?;
17550
17551        let effort_in: i32 = heifsave_buffer_options.effort;
17552        let effort_in_name = utils::new_c_string("effort")?;
17553
17554        let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
17555        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17556
17557        let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
17558        let encoder_in_name = utils::new_c_string("encoder")?;
17559
17560        let keep_in: i32 = heifsave_buffer_options.keep as i32;
17561        let keep_in_name = utils::new_c_string("keep")?;
17562
17563        let background_wrapper =
17564            utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
17565        let background_in = background_wrapper.ctx;
17566        let background_in_name = utils::new_c_string("background")?;
17567
17568        let page_height_in: i32 = heifsave_buffer_options.page_height;
17569        let page_height_in_name = utils::new_c_string("page-height")?;
17570
17571        let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
17572        let profile_in_name = utils::new_c_string("profile")?;
17573
17574        let vips_op_response = bindings::vips_heifsave_buffer(
17575            inp_in,
17576            &mut buffer_out,
17577            &mut buffer_buf_size,
17578            q_in_name.as_ptr(),
17579            q_in,
17580            bitdepth_in_name.as_ptr(),
17581            bitdepth_in,
17582            lossless_in_name.as_ptr(),
17583            lossless_in,
17584            compression_in_name.as_ptr(),
17585            compression_in,
17586            effort_in_name.as_ptr(),
17587            effort_in,
17588            subsample_mode_in_name.as_ptr(),
17589            subsample_mode_in,
17590            encoder_in_name.as_ptr(),
17591            encoder_in,
17592            keep_in_name.as_ptr(),
17593            keep_in,
17594            background_in_name.as_ptr(),
17595            background_in,
17596            page_height_in_name.as_ptr(),
17597            page_height_in,
17598            profile_in_name.as_ptr(),
17599            profile_in.as_ptr(),
17600            NULL,
17601        );
17602        utils::result(
17603            vips_op_response,
17604            utils::new_byte_array(buffer_out, buffer_buf_size),
17605            Error::HeifsaveBufferError,
17606        )
17607    }
17608}
17609
17610/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17611/// inp: `&VipsImage` -> Image to save
17612/// target: `&VipsTarget` -> Target to save to
17613
17614pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17615    unsafe {
17616        let inp_in: *mut bindings::VipsImage = inp.ctx;
17617        let target_in: *mut bindings::VipsTarget = target.ctx;
17618
17619        let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
17620        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
17621    }
17622}
17623
17624/// Options for heifsave_target operation
17625#[derive(Clone, Debug)]
17626pub struct HeifsaveTargetOptions {
17627    /// q: `i32` -> Q factor
17628    /// min: 1, max: 100, default: 50
17629    pub q: i32,
17630    /// bitdepth: `i32` -> Number of bits per pixel
17631    /// min: 1, max: 16, default: 12
17632    pub bitdepth: i32,
17633    /// lossless: `bool` -> Enable lossless compression
17634    /// default: false
17635    pub lossless: bool,
17636    /// compression: `ForeignHeifCompression` -> Compression format
17637    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17638    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17639    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17640    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17641    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
17642    pub compression: ForeignHeifCompression,
17643    /// effort: `i32` -> CPU effort
17644    /// min: 0, max: 9, default: 4
17645    pub effort: i32,
17646    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17647    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17648    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17649    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17650    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
17651    pub subsample_mode: ForeignSubsample,
17652    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17653    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17654    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17655    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17656    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17657    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17658    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
17659    pub encoder: ForeignHeifEncoder,
17660    /// keep: `ForeignKeep` -> Which metadata to retain
17661    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17662    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17663    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17664    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17665    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17666    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17667    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17668    pub keep: ForeignKeep,
17669    /// background: `Vec<f64>` -> Background value
17670    pub background: Vec<f64>,
17671    /// page_height: `i32` -> Set page height for multipage save
17672    /// min: 0, max: 10000000, default: 0
17673    pub page_height: i32,
17674    /// profile: `String` -> Filename of ICC profile to embed
17675    pub profile: String,
17676}
17677
17678impl std::default::Default for HeifsaveTargetOptions {
17679    fn default() -> Self {
17680        HeifsaveTargetOptions {
17681            q: i32::from(50),
17682            bitdepth: i32::from(12),
17683            lossless: false,
17684            compression: ForeignHeifCompression::Hevc,
17685            effort: i32::from(4),
17686            subsample_mode: ForeignSubsample::Auto,
17687            encoder: ForeignHeifEncoder::Auto,
17688            keep: ForeignKeep::All,
17689            background: Vec::new(),
17690            page_height: i32::from(0),
17691            profile: String::from("sRGB"),
17692        }
17693    }
17694}
17695
17696/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
17697/// inp: `&VipsImage` -> Image to save
17698/// target: `&VipsTarget` -> Target to save to
17699/// heifsave_target_options: `&HeifsaveTargetOptions` -> optional arguments
17700
17701pub fn heifsave_target_with_opts(
17702    inp: &VipsImage,
17703    target: &VipsTarget,
17704    heifsave_target_options: &HeifsaveTargetOptions,
17705) -> Result<()> {
17706    unsafe {
17707        let inp_in: *mut bindings::VipsImage = inp.ctx;
17708        let target_in: *mut bindings::VipsTarget = target.ctx;
17709
17710        let q_in: i32 = heifsave_target_options.q;
17711        let q_in_name = utils::new_c_string("Q")?;
17712
17713        let bitdepth_in: i32 = heifsave_target_options.bitdepth;
17714        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17715
17716        let lossless_in: i32 = if heifsave_target_options.lossless {
17717            1
17718        } else {
17719            0
17720        };
17721        let lossless_in_name = utils::new_c_string("lossless")?;
17722
17723        let compression_in: i32 = heifsave_target_options.compression as i32;
17724        let compression_in_name = utils::new_c_string("compression")?;
17725
17726        let effort_in: i32 = heifsave_target_options.effort;
17727        let effort_in_name = utils::new_c_string("effort")?;
17728
17729        let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
17730        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17731
17732        let encoder_in: i32 = heifsave_target_options.encoder as i32;
17733        let encoder_in_name = utils::new_c_string("encoder")?;
17734
17735        let keep_in: i32 = heifsave_target_options.keep as i32;
17736        let keep_in_name = utils::new_c_string("keep")?;
17737
17738        let background_wrapper =
17739            utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
17740        let background_in = background_wrapper.ctx;
17741        let background_in_name = utils::new_c_string("background")?;
17742
17743        let page_height_in: i32 = heifsave_target_options.page_height;
17744        let page_height_in_name = utils::new_c_string("page-height")?;
17745
17746        let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
17747        let profile_in_name = utils::new_c_string("profile")?;
17748
17749        let vips_op_response = bindings::vips_heifsave_target(
17750            inp_in,
17751            target_in,
17752            q_in_name.as_ptr(),
17753            q_in,
17754            bitdepth_in_name.as_ptr(),
17755            bitdepth_in,
17756            lossless_in_name.as_ptr(),
17757            lossless_in,
17758            compression_in_name.as_ptr(),
17759            compression_in,
17760            effort_in_name.as_ptr(),
17761            effort_in,
17762            subsample_mode_in_name.as_ptr(),
17763            subsample_mode_in,
17764            encoder_in_name.as_ptr(),
17765            encoder_in,
17766            keep_in_name.as_ptr(),
17767            keep_in,
17768            background_in_name.as_ptr(),
17769            background_in,
17770            page_height_in_name.as_ptr(),
17771            page_height_in,
17772            profile_in_name.as_ptr(),
17773            profile_in.as_ptr(),
17774            NULL,
17775        );
17776        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
17777    }
17778}
17779
17780/// VipsThumbnailFile (thumbnail), generate thumbnail from file
17781/// filename: `&str` -> Filename to read from
17782/// width: `i32` -> Size to this width
17783/// min: 1, max: 10000000, default: 1
17784/// returns `VipsImage` - Output image
17785pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
17786    unsafe {
17787        let filename_in: CString = utils::new_c_string(filename)?;
17788        let width_in: i32 = width;
17789        let mut out_out: *mut bindings::VipsImage = null_mut();
17790
17791        let vips_op_response =
17792            bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
17793        utils::result(
17794            vips_op_response,
17795            VipsImage { ctx: out_out },
17796            Error::ThumbnailError,
17797        )
17798    }
17799}
17800
17801/// Options for thumbnail operation
17802#[derive(Clone, Debug)]
17803pub struct ThumbnailOptions {
17804    /// height: `i32` -> Size to this height
17805    /// min: 1, max: 10000000, default: 1
17806    pub height: i32,
17807    /// size: `Size` -> Only upsize, only downsize, or both
17808    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
17809    ///  `Up` -> VIPS_SIZE_UP = 1
17810    ///  `Down` -> VIPS_SIZE_DOWN = 2
17811    ///  `Force` -> VIPS_SIZE_FORCE = 3
17812    ///  `Last` -> VIPS_SIZE_LAST = 4
17813    pub size: Size,
17814    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
17815    /// default: false
17816    pub no_rotate: bool,
17817    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
17818    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
17819    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
17820    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
17821    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
17822    ///  `Low` -> VIPS_INTERESTING_LOW = 4
17823    ///  `High` -> VIPS_INTERESTING_HIGH = 5
17824    ///  `All` -> VIPS_INTERESTING_ALL = 6
17825    ///  `Last` -> VIPS_INTERESTING_LAST = 7
17826    pub crop: Interesting,
17827    /// linear: `bool` -> Reduce in linear light
17828    /// default: false
17829    pub linear: bool,
17830    /// import_profile: `String` -> Fallback import profile
17831    pub import_profile: String,
17832    /// export_profile: `String` -> Fallback export profile
17833    pub export_profile: String,
17834    /// intent: `Intent` -> Rendering intent
17835    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
17836    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
17837    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
17838    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
17839    ///  `Last` -> VIPS_INTENT_LAST = 4
17840    pub intent: Intent,
17841    /// fail_on: `FailOn` -> Error level to fail on
17842    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
17843    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
17844    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
17845    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
17846    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
17847    pub fail_on: FailOn,
17848}
17849
17850impl std::default::Default for ThumbnailOptions {
17851    fn default() -> Self {
17852        ThumbnailOptions {
17853            height: i32::from(1),
17854            size: Size::Both,
17855            no_rotate: false,
17856            crop: Interesting::None,
17857            linear: false,
17858            import_profile: String::new(),
17859            export_profile: String::new(),
17860            intent: Intent::Relative,
17861            fail_on: FailOn::None,
17862        }
17863    }
17864}
17865
17866/// VipsThumbnailFile (thumbnail), generate thumbnail from file
17867/// filename: `&str` -> Filename to read from
17868/// width: `i32` -> Size to this width
17869/// min: 1, max: 10000000, default: 1
17870/// thumbnail_options: `&ThumbnailOptions` -> optional arguments
17871/// returns `VipsImage` - Output image
17872pub fn thumbnail_with_opts(
17873    filename: &str,
17874    width: i32,
17875    thumbnail_options: &ThumbnailOptions,
17876) -> Result<VipsImage> {
17877    unsafe {
17878        let filename_in: CString = utils::new_c_string(filename)?;
17879        let width_in: i32 = width;
17880        let mut out_out: *mut bindings::VipsImage = null_mut();
17881
17882        let height_in: i32 = thumbnail_options.height;
17883        let height_in_name = utils::new_c_string("height")?;
17884
17885        let size_in: i32 = thumbnail_options.size as i32;
17886        let size_in_name = utils::new_c_string("size")?;
17887
17888        let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
17889        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
17890
17891        let crop_in: i32 = thumbnail_options.crop as i32;
17892        let crop_in_name = utils::new_c_string("crop")?;
17893
17894        let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
17895        let linear_in_name = utils::new_c_string("linear")?;
17896
17897        let import_profile_in: CString = utils::new_c_string(&thumbnail_options.import_profile)?;
17898        let import_profile_in_name = utils::new_c_string("import-profile")?;
17899
17900        let export_profile_in: CString = utils::new_c_string(&thumbnail_options.export_profile)?;
17901        let export_profile_in_name = utils::new_c_string("export-profile")?;
17902
17903        let intent_in: i32 = thumbnail_options.intent as i32;
17904        let intent_in_name = utils::new_c_string("intent")?;
17905
17906        let fail_on_in: i32 = thumbnail_options.fail_on as i32;
17907        let fail_on_in_name = utils::new_c_string("fail-on")?;
17908
17909        let vips_op_response = bindings::vips_thumbnail(
17910            filename_in.as_ptr(),
17911            &mut out_out,
17912            width_in,
17913            height_in_name.as_ptr(),
17914            height_in,
17915            size_in_name.as_ptr(),
17916            size_in,
17917            no_rotate_in_name.as_ptr(),
17918            no_rotate_in,
17919            crop_in_name.as_ptr(),
17920            crop_in,
17921            linear_in_name.as_ptr(),
17922            linear_in,
17923            import_profile_in_name.as_ptr(),
17924            import_profile_in.as_ptr(),
17925            export_profile_in_name.as_ptr(),
17926            export_profile_in.as_ptr(),
17927            intent_in_name.as_ptr(),
17928            intent_in,
17929            fail_on_in_name.as_ptr(),
17930            fail_on_in,
17931            NULL,
17932        );
17933        utils::result(
17934            vips_op_response,
17935            VipsImage { ctx: out_out },
17936            Error::ThumbnailError,
17937        )
17938    }
17939}
17940
17941/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
17942/// buffer: `&[u8]` -> Buffer to load from
17943/// width: `i32` -> Size to this width
17944/// min: 1, max: 10000000, default: 1
17945/// returns `VipsImage` - Output image
17946pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
17947    unsafe {
17948        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
17949        let width_in: i32 = width;
17950        let mut out_out: *mut bindings::VipsImage = null_mut();
17951
17952        let vips_op_response = bindings::vips_thumbnail_buffer(
17953            buffer_in,
17954            buffer.len() as u64,
17955            &mut out_out,
17956            width_in,
17957            NULL,
17958        );
17959        utils::result(
17960            vips_op_response,
17961            VipsImage { ctx: out_out },
17962            Error::ThumbnailBufferError,
17963        )
17964    }
17965}
17966
17967/// Options for thumbnail_buffer operation
17968#[derive(Clone, Debug)]
17969pub struct ThumbnailBufferOptions {
17970    /// option_string: `String` -> Options that are passed on to the underlying loader
17971    pub option_string: String,
17972    /// height: `i32` -> Size to this height
17973    /// min: 1, max: 10000000, default: 1
17974    pub height: i32,
17975    /// size: `Size` -> Only upsize, only downsize, or both
17976    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
17977    ///  `Up` -> VIPS_SIZE_UP = 1
17978    ///  `Down` -> VIPS_SIZE_DOWN = 2
17979    ///  `Force` -> VIPS_SIZE_FORCE = 3
17980    ///  `Last` -> VIPS_SIZE_LAST = 4
17981    pub size: Size,
17982    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
17983    /// default: false
17984    pub no_rotate: bool,
17985    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
17986    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
17987    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
17988    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
17989    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
17990    ///  `Low` -> VIPS_INTERESTING_LOW = 4
17991    ///  `High` -> VIPS_INTERESTING_HIGH = 5
17992    ///  `All` -> VIPS_INTERESTING_ALL = 6
17993    ///  `Last` -> VIPS_INTERESTING_LAST = 7
17994    pub crop: Interesting,
17995    /// linear: `bool` -> Reduce in linear light
17996    /// default: false
17997    pub linear: bool,
17998    /// import_profile: `String` -> Fallback import profile
17999    pub import_profile: String,
18000    /// export_profile: `String` -> Fallback export profile
18001    pub export_profile: String,
18002    /// intent: `Intent` -> Rendering intent
18003    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18004    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18005    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18006    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18007    ///  `Last` -> VIPS_INTENT_LAST = 4
18008    pub intent: Intent,
18009    /// fail_on: `FailOn` -> Error level to fail on
18010    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18011    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18012    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18013    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18014    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18015    pub fail_on: FailOn,
18016}
18017
18018impl std::default::Default for ThumbnailBufferOptions {
18019    fn default() -> Self {
18020        ThumbnailBufferOptions {
18021            option_string: String::new(),
18022            height: i32::from(1),
18023            size: Size::Both,
18024            no_rotate: false,
18025            crop: Interesting::None,
18026            linear: false,
18027            import_profile: String::new(),
18028            export_profile: String::new(),
18029            intent: Intent::Relative,
18030            fail_on: FailOn::None,
18031        }
18032    }
18033}
18034
18035/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
18036/// buffer: `&[u8]` -> Buffer to load from
18037/// width: `i32` -> Size to this width
18038/// min: 1, max: 10000000, default: 1
18039/// thumbnail_buffer_options: `&ThumbnailBufferOptions` -> optional arguments
18040/// returns `VipsImage` - Output image
18041pub fn thumbnail_buffer_with_opts(
18042    buffer: &[u8],
18043    width: i32,
18044    thumbnail_buffer_options: &ThumbnailBufferOptions,
18045) -> Result<VipsImage> {
18046    unsafe {
18047        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18048        let width_in: i32 = width;
18049        let mut out_out: *mut bindings::VipsImage = null_mut();
18050
18051        let option_string_in: CString =
18052            utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18053        let option_string_in_name = utils::new_c_string("option-string")?;
18054
18055        let height_in: i32 = thumbnail_buffer_options.height;
18056        let height_in_name = utils::new_c_string("height")?;
18057
18058        let size_in: i32 = thumbnail_buffer_options.size as i32;
18059        let size_in_name = utils::new_c_string("size")?;
18060
18061        let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18062            1
18063        } else {
18064            0
18065        };
18066        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18067
18068        let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18069        let crop_in_name = utils::new_c_string("crop")?;
18070
18071        let linear_in: i32 = if thumbnail_buffer_options.linear {
18072            1
18073        } else {
18074            0
18075        };
18076        let linear_in_name = utils::new_c_string("linear")?;
18077
18078        let import_profile_in: CString =
18079            utils::new_c_string(&thumbnail_buffer_options.import_profile)?;
18080        let import_profile_in_name = utils::new_c_string("import-profile")?;
18081
18082        let export_profile_in: CString =
18083            utils::new_c_string(&thumbnail_buffer_options.export_profile)?;
18084        let export_profile_in_name = utils::new_c_string("export-profile")?;
18085
18086        let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18087        let intent_in_name = utils::new_c_string("intent")?;
18088
18089        let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18090        let fail_on_in_name = utils::new_c_string("fail-on")?;
18091
18092        let vips_op_response = bindings::vips_thumbnail_buffer(
18093            buffer_in,
18094            buffer.len() as u64,
18095            &mut out_out,
18096            width_in,
18097            option_string_in_name.as_ptr(),
18098            option_string_in.as_ptr(),
18099            height_in_name.as_ptr(),
18100            height_in,
18101            size_in_name.as_ptr(),
18102            size_in,
18103            no_rotate_in_name.as_ptr(),
18104            no_rotate_in,
18105            crop_in_name.as_ptr(),
18106            crop_in,
18107            linear_in_name.as_ptr(),
18108            linear_in,
18109            import_profile_in_name.as_ptr(),
18110            import_profile_in.as_ptr(),
18111            export_profile_in_name.as_ptr(),
18112            export_profile_in.as_ptr(),
18113            intent_in_name.as_ptr(),
18114            intent_in,
18115            fail_on_in_name.as_ptr(),
18116            fail_on_in,
18117            NULL,
18118        );
18119        utils::result(
18120            vips_op_response,
18121            VipsImage { ctx: out_out },
18122            Error::ThumbnailBufferError,
18123        )
18124    }
18125}
18126
18127/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18128/// inp: `&VipsImage` -> Input image argument
18129/// width: `i32` -> Size to this width
18130/// min: 1, max: 10000000, default: 1
18131/// returns `VipsImage` - Output image
18132pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18133    unsafe {
18134        let inp_in: *mut bindings::VipsImage = inp.ctx;
18135        let width_in: i32 = width;
18136        let mut out_out: *mut bindings::VipsImage = null_mut();
18137
18138        let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18139        utils::result(
18140            vips_op_response,
18141            VipsImage { ctx: out_out },
18142            Error::ThumbnailImageError,
18143        )
18144    }
18145}
18146
18147/// Options for thumbnail_image operation
18148#[derive(Clone, Debug)]
18149pub struct ThumbnailImageOptions {
18150    /// height: `i32` -> Size to this height
18151    /// min: 1, max: 10000000, default: 1
18152    pub height: i32,
18153    /// size: `Size` -> Only upsize, only downsize, or both
18154    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18155    ///  `Up` -> VIPS_SIZE_UP = 1
18156    ///  `Down` -> VIPS_SIZE_DOWN = 2
18157    ///  `Force` -> VIPS_SIZE_FORCE = 3
18158    ///  `Last` -> VIPS_SIZE_LAST = 4
18159    pub size: Size,
18160    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18161    /// default: false
18162    pub no_rotate: bool,
18163    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18164    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18165    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18166    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18167    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18168    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18169    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18170    ///  `All` -> VIPS_INTERESTING_ALL = 6
18171    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18172    pub crop: Interesting,
18173    /// linear: `bool` -> Reduce in linear light
18174    /// default: false
18175    pub linear: bool,
18176    /// import_profile: `String` -> Fallback import profile
18177    pub import_profile: String,
18178    /// export_profile: `String` -> Fallback export profile
18179    pub export_profile: String,
18180    /// intent: `Intent` -> Rendering intent
18181    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18182    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18183    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18184    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18185    ///  `Last` -> VIPS_INTENT_LAST = 4
18186    pub intent: Intent,
18187    /// fail_on: `FailOn` -> Error level to fail on
18188    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18189    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18190    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18191    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18192    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18193    pub fail_on: FailOn,
18194}
18195
18196impl std::default::Default for ThumbnailImageOptions {
18197    fn default() -> Self {
18198        ThumbnailImageOptions {
18199            height: i32::from(1),
18200            size: Size::Both,
18201            no_rotate: false,
18202            crop: Interesting::None,
18203            linear: false,
18204            import_profile: String::new(),
18205            export_profile: String::new(),
18206            intent: Intent::Relative,
18207            fail_on: FailOn::None,
18208        }
18209    }
18210}
18211
18212/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18213/// inp: `&VipsImage` -> Input image argument
18214/// width: `i32` -> Size to this width
18215/// min: 1, max: 10000000, default: 1
18216/// thumbnail_image_options: `&ThumbnailImageOptions` -> optional arguments
18217/// returns `VipsImage` - Output image
18218pub fn thumbnail_image_with_opts(
18219    inp: &VipsImage,
18220    width: i32,
18221    thumbnail_image_options: &ThumbnailImageOptions,
18222) -> Result<VipsImage> {
18223    unsafe {
18224        let inp_in: *mut bindings::VipsImage = inp.ctx;
18225        let width_in: i32 = width;
18226        let mut out_out: *mut bindings::VipsImage = null_mut();
18227
18228        let height_in: i32 = thumbnail_image_options.height;
18229        let height_in_name = utils::new_c_string("height")?;
18230
18231        let size_in: i32 = thumbnail_image_options.size as i32;
18232        let size_in_name = utils::new_c_string("size")?;
18233
18234        let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18235            1
18236        } else {
18237            0
18238        };
18239        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18240
18241        let crop_in: i32 = thumbnail_image_options.crop as i32;
18242        let crop_in_name = utils::new_c_string("crop")?;
18243
18244        let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18245        let linear_in_name = utils::new_c_string("linear")?;
18246
18247        let import_profile_in: CString =
18248            utils::new_c_string(&thumbnail_image_options.import_profile)?;
18249        let import_profile_in_name = utils::new_c_string("import-profile")?;
18250
18251        let export_profile_in: CString =
18252            utils::new_c_string(&thumbnail_image_options.export_profile)?;
18253        let export_profile_in_name = utils::new_c_string("export-profile")?;
18254
18255        let intent_in: i32 = thumbnail_image_options.intent as i32;
18256        let intent_in_name = utils::new_c_string("intent")?;
18257
18258        let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18259        let fail_on_in_name = utils::new_c_string("fail-on")?;
18260
18261        let vips_op_response = bindings::vips_thumbnail_image(
18262            inp_in,
18263            &mut out_out,
18264            width_in,
18265            height_in_name.as_ptr(),
18266            height_in,
18267            size_in_name.as_ptr(),
18268            size_in,
18269            no_rotate_in_name.as_ptr(),
18270            no_rotate_in,
18271            crop_in_name.as_ptr(),
18272            crop_in,
18273            linear_in_name.as_ptr(),
18274            linear_in,
18275            import_profile_in_name.as_ptr(),
18276            import_profile_in.as_ptr(),
18277            export_profile_in_name.as_ptr(),
18278            export_profile_in.as_ptr(),
18279            intent_in_name.as_ptr(),
18280            intent_in,
18281            fail_on_in_name.as_ptr(),
18282            fail_on_in,
18283            NULL,
18284        );
18285        utils::result(
18286            vips_op_response,
18287            VipsImage { ctx: out_out },
18288            Error::ThumbnailImageError,
18289        )
18290    }
18291}
18292
18293/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
18294/// source: `&VipsSource` -> Source to load from
18295/// width: `i32` -> Size to this width
18296/// min: 1, max: 10000000, default: 1
18297/// returns `VipsImage` - Output image
18298pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18299    unsafe {
18300        let source_in: *mut bindings::VipsSource = source.ctx;
18301        let width_in: i32 = width;
18302        let mut out_out: *mut bindings::VipsImage = null_mut();
18303
18304        let vips_op_response =
18305            bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18306        utils::result(
18307            vips_op_response,
18308            VipsImage { ctx: out_out },
18309            Error::ThumbnailSourceError,
18310        )
18311    }
18312}
18313
18314/// Options for thumbnail_source operation
18315#[derive(Clone, Debug)]
18316pub struct ThumbnailSourceOptions {
18317    /// option_string: `String` -> Options that are passed on to the underlying loader
18318    pub option_string: String,
18319    /// height: `i32` -> Size to this height
18320    /// min: 1, max: 10000000, default: 1
18321    pub height: i32,
18322    /// size: `Size` -> Only upsize, only downsize, or both
18323    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18324    ///  `Up` -> VIPS_SIZE_UP = 1
18325    ///  `Down` -> VIPS_SIZE_DOWN = 2
18326    ///  `Force` -> VIPS_SIZE_FORCE = 3
18327    ///  `Last` -> VIPS_SIZE_LAST = 4
18328    pub size: Size,
18329    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18330    /// default: false
18331    pub no_rotate: bool,
18332    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18333    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18334    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18335    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18336    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18337    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18338    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18339    ///  `All` -> VIPS_INTERESTING_ALL = 6
18340    ///  `Last` -> VIPS_INTERESTING_LAST = 7
18341    pub crop: Interesting,
18342    /// linear: `bool` -> Reduce in linear light
18343    /// default: false
18344    pub linear: bool,
18345    /// import_profile: `String` -> Fallback import profile
18346    pub import_profile: String,
18347    /// export_profile: `String` -> Fallback export profile
18348    pub export_profile: String,
18349    /// intent: `Intent` -> Rendering intent
18350    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18351    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18352    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18353    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18354    ///  `Last` -> VIPS_INTENT_LAST = 4
18355    pub intent: Intent,
18356    /// fail_on: `FailOn` -> Error level to fail on
18357    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18358    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18359    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18360    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18361    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
18362    pub fail_on: FailOn,
18363}
18364
18365impl std::default::Default for ThumbnailSourceOptions {
18366    fn default() -> Self {
18367        ThumbnailSourceOptions {
18368            option_string: String::new(),
18369            height: i32::from(1),
18370            size: Size::Both,
18371            no_rotate: false,
18372            crop: Interesting::None,
18373            linear: false,
18374            import_profile: String::new(),
18375            export_profile: String::new(),
18376            intent: Intent::Relative,
18377            fail_on: FailOn::None,
18378        }
18379    }
18380}
18381
18382/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
18383/// source: `&VipsSource` -> Source to load from
18384/// width: `i32` -> Size to this width
18385/// min: 1, max: 10000000, default: 1
18386/// thumbnail_source_options: `&ThumbnailSourceOptions` -> optional arguments
18387/// returns `VipsImage` - Output image
18388pub fn thumbnail_source_with_opts(
18389    source: &VipsSource,
18390    width: i32,
18391    thumbnail_source_options: &ThumbnailSourceOptions,
18392) -> Result<VipsImage> {
18393    unsafe {
18394        let source_in: *mut bindings::VipsSource = source.ctx;
18395        let width_in: i32 = width;
18396        let mut out_out: *mut bindings::VipsImage = null_mut();
18397
18398        let option_string_in: CString =
18399            utils::new_c_string(&thumbnail_source_options.option_string)?;
18400        let option_string_in_name = utils::new_c_string("option-string")?;
18401
18402        let height_in: i32 = thumbnail_source_options.height;
18403        let height_in_name = utils::new_c_string("height")?;
18404
18405        let size_in: i32 = thumbnail_source_options.size as i32;
18406        let size_in_name = utils::new_c_string("size")?;
18407
18408        let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
18409            1
18410        } else {
18411            0
18412        };
18413        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18414
18415        let crop_in: i32 = thumbnail_source_options.crop as i32;
18416        let crop_in_name = utils::new_c_string("crop")?;
18417
18418        let linear_in: i32 = if thumbnail_source_options.linear {
18419            1
18420        } else {
18421            0
18422        };
18423        let linear_in_name = utils::new_c_string("linear")?;
18424
18425        let import_profile_in: CString =
18426            utils::new_c_string(&thumbnail_source_options.import_profile)?;
18427        let import_profile_in_name = utils::new_c_string("import-profile")?;
18428
18429        let export_profile_in: CString =
18430            utils::new_c_string(&thumbnail_source_options.export_profile)?;
18431        let export_profile_in_name = utils::new_c_string("export-profile")?;
18432
18433        let intent_in: i32 = thumbnail_source_options.intent as i32;
18434        let intent_in_name = utils::new_c_string("intent")?;
18435
18436        let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
18437        let fail_on_in_name = utils::new_c_string("fail-on")?;
18438
18439        let vips_op_response = bindings::vips_thumbnail_source(
18440            source_in,
18441            &mut out_out,
18442            width_in,
18443            option_string_in_name.as_ptr(),
18444            option_string_in.as_ptr(),
18445            height_in_name.as_ptr(),
18446            height_in,
18447            size_in_name.as_ptr(),
18448            size_in,
18449            no_rotate_in_name.as_ptr(),
18450            no_rotate_in,
18451            crop_in_name.as_ptr(),
18452            crop_in,
18453            linear_in_name.as_ptr(),
18454            linear_in,
18455            import_profile_in_name.as_ptr(),
18456            import_profile_in.as_ptr(),
18457            export_profile_in_name.as_ptr(),
18458            export_profile_in.as_ptr(),
18459            intent_in_name.as_ptr(),
18460            intent_in,
18461            fail_on_in_name.as_ptr(),
18462            fail_on_in,
18463            NULL,
18464        );
18465        utils::result(
18466            vips_op_response,
18467            VipsImage { ctx: out_out },
18468            Error::ThumbnailSourceError,
18469        )
18470    }
18471}
18472
18473/// VipsMapim (mapim), resample with a map image
18474/// inp: `&VipsImage` -> Input image argument
18475/// index: `&VipsImage` -> Index pixels with this
18476/// returns `VipsImage` - Output image
18477pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
18478    unsafe {
18479        let inp_in: *mut bindings::VipsImage = inp.ctx;
18480        let index_in: *mut bindings::VipsImage = index.ctx;
18481        let mut out_out: *mut bindings::VipsImage = null_mut();
18482
18483        let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
18484        utils::result(
18485            vips_op_response,
18486            VipsImage { ctx: out_out },
18487            Error::MapimError,
18488        )
18489    }
18490}
18491
18492/// Options for mapim operation
18493#[derive(Clone, Debug)]
18494pub struct MapimOptions {
18495    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
18496    pub interpolate: VipsInterpolate,
18497    /// background: `Vec<f64>` -> Background value
18498    pub background: Vec<f64>,
18499    /// premultiplied: `bool` -> Images have premultiplied alpha
18500    /// default: false
18501    pub premultiplied: bool,
18502    /// extend: `Extend` -> How to generate the extra pixels
18503    ///  `Black` -> VIPS_EXTEND_BLACK = 0
18504    ///  `Copy` -> VIPS_EXTEND_COPY = 1
18505    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
18506    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
18507    ///  `White` -> VIPS_EXTEND_WHITE = 4
18508    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
18509    ///  `Last` -> VIPS_EXTEND_LAST = 6
18510    pub extend: Extend,
18511}
18512
18513impl std::default::Default for MapimOptions {
18514    fn default() -> Self {
18515        MapimOptions {
18516            interpolate: VipsInterpolate::new(),
18517            background: Vec::new(),
18518            premultiplied: false,
18519            extend: Extend::Background,
18520        }
18521    }
18522}
18523
18524/// VipsMapim (mapim), resample with a map image
18525/// inp: `&VipsImage` -> Input image argument
18526/// index: `&VipsImage` -> Index pixels with this
18527/// mapim_options: `&MapimOptions` -> optional arguments
18528/// returns `VipsImage` - Output image
18529pub fn mapim_with_opts(
18530    inp: &VipsImage,
18531    index: &VipsImage,
18532    mapim_options: &MapimOptions,
18533) -> Result<VipsImage> {
18534    unsafe {
18535        let inp_in: *mut bindings::VipsImage = inp.ctx;
18536        let index_in: *mut bindings::VipsImage = index.ctx;
18537        let mut out_out: *mut bindings::VipsImage = null_mut();
18538
18539        let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
18540        let interpolate_in_name = utils::new_c_string("interpolate")?;
18541
18542        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
18543        let background_in = background_wrapper.ctx;
18544        let background_in_name = utils::new_c_string("background")?;
18545
18546        let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
18547        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
18548
18549        let extend_in: i32 = mapim_options.extend as i32;
18550        let extend_in_name = utils::new_c_string("extend")?;
18551
18552        let vips_op_response = bindings::vips_mapim(
18553            inp_in,
18554            &mut out_out,
18555            index_in,
18556            interpolate_in_name.as_ptr(),
18557            interpolate_in,
18558            background_in_name.as_ptr(),
18559            background_in,
18560            premultiplied_in_name.as_ptr(),
18561            premultiplied_in,
18562            extend_in_name.as_ptr(),
18563            extend_in,
18564            NULL,
18565        );
18566        utils::result(
18567            vips_op_response,
18568            VipsImage { ctx: out_out },
18569            Error::MapimError,
18570        )
18571    }
18572}
18573
18574/// VipsShrink (shrink), shrink an image
18575/// inp: `&VipsImage` -> Input image argument
18576/// hshrink: `f64` -> Horizontal shrink factor
18577/// min: 1, max: 1000000, default: 1
18578/// vshrink: `f64` -> Vertical shrink factor
18579/// min: 1, max: 1000000, default: 1
18580/// returns `VipsImage` - Output image
18581pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
18582    unsafe {
18583        let inp_in: *mut bindings::VipsImage = inp.ctx;
18584        let hshrink_in: f64 = hshrink;
18585        let vshrink_in: f64 = vshrink;
18586        let mut out_out: *mut bindings::VipsImage = null_mut();
18587
18588        let vips_op_response =
18589            bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
18590        utils::result(
18591            vips_op_response,
18592            VipsImage { ctx: out_out },
18593            Error::ShrinkError,
18594        )
18595    }
18596}
18597
18598/// Options for shrink operation
18599#[derive(Clone, Debug)]
18600pub struct ShrinkOptions {
18601    /// ceil: `bool` -> Round-up output dimensions
18602    /// default: false
18603    pub ceil: bool,
18604}
18605
18606impl std::default::Default for ShrinkOptions {
18607    fn default() -> Self {
18608        ShrinkOptions { ceil: false }
18609    }
18610}
18611
18612/// VipsShrink (shrink), shrink an image
18613/// inp: `&VipsImage` -> Input image argument
18614/// hshrink: `f64` -> Horizontal shrink factor
18615/// min: 1, max: 1000000, default: 1
18616/// vshrink: `f64` -> Vertical shrink factor
18617/// min: 1, max: 1000000, default: 1
18618/// shrink_options: `&ShrinkOptions` -> optional arguments
18619/// returns `VipsImage` - Output image
18620pub fn shrink_with_opts(
18621    inp: &VipsImage,
18622    hshrink: f64,
18623    vshrink: f64,
18624    shrink_options: &ShrinkOptions,
18625) -> Result<VipsImage> {
18626    unsafe {
18627        let inp_in: *mut bindings::VipsImage = inp.ctx;
18628        let hshrink_in: f64 = hshrink;
18629        let vshrink_in: f64 = vshrink;
18630        let mut out_out: *mut bindings::VipsImage = null_mut();
18631
18632        let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
18633        let ceil_in_name = utils::new_c_string("ceil")?;
18634
18635        let vips_op_response = bindings::vips_shrink(
18636            inp_in,
18637            &mut out_out,
18638            hshrink_in,
18639            vshrink_in,
18640            ceil_in_name.as_ptr(),
18641            ceil_in,
18642            NULL,
18643        );
18644        utils::result(
18645            vips_op_response,
18646            VipsImage { ctx: out_out },
18647            Error::ShrinkError,
18648        )
18649    }
18650}
18651
18652/// VipsShrinkh (shrinkh), shrink an image horizontally
18653/// inp: `&VipsImage` -> Input image argument
18654/// hshrink: `i32` -> Horizontal shrink factor
18655/// min: 1, max: 1000000, default: 1
18656/// returns `VipsImage` - Output image
18657pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
18658    unsafe {
18659        let inp_in: *mut bindings::VipsImage = inp.ctx;
18660        let hshrink_in: i32 = hshrink;
18661        let mut out_out: *mut bindings::VipsImage = null_mut();
18662
18663        let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
18664        utils::result(
18665            vips_op_response,
18666            VipsImage { ctx: out_out },
18667            Error::ShrinkhError,
18668        )
18669    }
18670}
18671
18672/// Options for shrinkh operation
18673#[derive(Clone, Debug)]
18674pub struct ShrinkhOptions {
18675    /// ceil: `bool` -> Round-up output dimensions
18676    /// default: false
18677    pub ceil: bool,
18678}
18679
18680impl std::default::Default for ShrinkhOptions {
18681    fn default() -> Self {
18682        ShrinkhOptions { ceil: false }
18683    }
18684}
18685
18686/// VipsShrinkh (shrinkh), shrink an image horizontally
18687/// inp: `&VipsImage` -> Input image argument
18688/// hshrink: `i32` -> Horizontal shrink factor
18689/// min: 1, max: 1000000, default: 1
18690/// shrinkh_options: `&ShrinkhOptions` -> optional arguments
18691/// returns `VipsImage` - Output image
18692pub fn shrinkh_with_opts(
18693    inp: &VipsImage,
18694    hshrink: i32,
18695    shrinkh_options: &ShrinkhOptions,
18696) -> Result<VipsImage> {
18697    unsafe {
18698        let inp_in: *mut bindings::VipsImage = inp.ctx;
18699        let hshrink_in: i32 = hshrink;
18700        let mut out_out: *mut bindings::VipsImage = null_mut();
18701
18702        let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
18703        let ceil_in_name = utils::new_c_string("ceil")?;
18704
18705        let vips_op_response = bindings::vips_shrinkh(
18706            inp_in,
18707            &mut out_out,
18708            hshrink_in,
18709            ceil_in_name.as_ptr(),
18710            ceil_in,
18711            NULL,
18712        );
18713        utils::result(
18714            vips_op_response,
18715            VipsImage { ctx: out_out },
18716            Error::ShrinkhError,
18717        )
18718    }
18719}
18720
18721/// VipsShrinkv (shrinkv), shrink an image vertically
18722/// inp: `&VipsImage` -> Input image argument
18723/// vshrink: `i32` -> Vertical shrink factor
18724/// min: 1, max: 1000000, default: 1
18725/// returns `VipsImage` - Output image
18726pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
18727    unsafe {
18728        let inp_in: *mut bindings::VipsImage = inp.ctx;
18729        let vshrink_in: i32 = vshrink;
18730        let mut out_out: *mut bindings::VipsImage = null_mut();
18731
18732        let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
18733        utils::result(
18734            vips_op_response,
18735            VipsImage { ctx: out_out },
18736            Error::ShrinkvError,
18737        )
18738    }
18739}
18740
18741/// Options for shrinkv operation
18742#[derive(Clone, Debug)]
18743pub struct ShrinkvOptions {
18744    /// ceil: `bool` -> Round-up output dimensions
18745    /// default: false
18746    pub ceil: bool,
18747}
18748
18749impl std::default::Default for ShrinkvOptions {
18750    fn default() -> Self {
18751        ShrinkvOptions { ceil: false }
18752    }
18753}
18754
18755/// VipsShrinkv (shrinkv), shrink an image vertically
18756/// inp: `&VipsImage` -> Input image argument
18757/// vshrink: `i32` -> Vertical shrink factor
18758/// min: 1, max: 1000000, default: 1
18759/// shrinkv_options: `&ShrinkvOptions` -> optional arguments
18760/// returns `VipsImage` - Output image
18761pub fn shrinkv_with_opts(
18762    inp: &VipsImage,
18763    vshrink: i32,
18764    shrinkv_options: &ShrinkvOptions,
18765) -> Result<VipsImage> {
18766    unsafe {
18767        let inp_in: *mut bindings::VipsImage = inp.ctx;
18768        let vshrink_in: i32 = vshrink;
18769        let mut out_out: *mut bindings::VipsImage = null_mut();
18770
18771        let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
18772        let ceil_in_name = utils::new_c_string("ceil")?;
18773
18774        let vips_op_response = bindings::vips_shrinkv(
18775            inp_in,
18776            &mut out_out,
18777            vshrink_in,
18778            ceil_in_name.as_ptr(),
18779            ceil_in,
18780            NULL,
18781        );
18782        utils::result(
18783            vips_op_response,
18784            VipsImage { ctx: out_out },
18785            Error::ShrinkvError,
18786        )
18787    }
18788}
18789
18790/// VipsReduceh (reduceh), shrink an image horizontally
18791/// inp: `&VipsImage` -> Input image argument
18792/// hshrink: `f64` -> Horizontal shrink factor
18793/// min: 1, max: 1000000, default: 1
18794/// returns `VipsImage` - Output image
18795pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
18796    unsafe {
18797        let inp_in: *mut bindings::VipsImage = inp.ctx;
18798        let hshrink_in: f64 = hshrink;
18799        let mut out_out: *mut bindings::VipsImage = null_mut();
18800
18801        let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
18802        utils::result(
18803            vips_op_response,
18804            VipsImage { ctx: out_out },
18805            Error::ReducehError,
18806        )
18807    }
18808}
18809
18810/// Options for reduceh operation
18811#[derive(Clone, Debug)]
18812pub struct ReducehOptions {
18813    /// kernel: `Kernel` -> Resampling kernel
18814    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
18815    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
18816    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
18817    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
18818    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
18819    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
18820    ///  `Last` -> VIPS_KERNEL_LAST = 6
18821    pub kernel: Kernel,
18822    /// gap: `f64` -> Reducing gap
18823    /// min: 0, max: 1000000, default: 0
18824    pub gap: f64,
18825}
18826
18827impl std::default::Default for ReducehOptions {
18828    fn default() -> Self {
18829        ReducehOptions {
18830            kernel: Kernel::Lanczos3,
18831            gap: f64::from(0),
18832        }
18833    }
18834}
18835
18836/// VipsReduceh (reduceh), shrink an image horizontally
18837/// inp: `&VipsImage` -> Input image argument
18838/// hshrink: `f64` -> Horizontal shrink factor
18839/// min: 1, max: 1000000, default: 1
18840/// reduceh_options: `&ReducehOptions` -> optional arguments
18841/// returns `VipsImage` - Output image
18842pub fn reduceh_with_opts(
18843    inp: &VipsImage,
18844    hshrink: f64,
18845    reduceh_options: &ReducehOptions,
18846) -> Result<VipsImage> {
18847    unsafe {
18848        let inp_in: *mut bindings::VipsImage = inp.ctx;
18849        let hshrink_in: f64 = hshrink;
18850        let mut out_out: *mut bindings::VipsImage = null_mut();
18851
18852        let kernel_in: i32 = reduceh_options.kernel as i32;
18853        let kernel_in_name = utils::new_c_string("kernel")?;
18854
18855        let gap_in: f64 = reduceh_options.gap;
18856        let gap_in_name = utils::new_c_string("gap")?;
18857
18858        let vips_op_response = bindings::vips_reduceh(
18859            inp_in,
18860            &mut out_out,
18861            hshrink_in,
18862            kernel_in_name.as_ptr(),
18863            kernel_in,
18864            gap_in_name.as_ptr(),
18865            gap_in,
18866            NULL,
18867        );
18868        utils::result(
18869            vips_op_response,
18870            VipsImage { ctx: out_out },
18871            Error::ReducehError,
18872        )
18873    }
18874}
18875
18876/// VipsReducev (reducev), shrink an image vertically
18877/// inp: `&VipsImage` -> Input image argument
18878/// vshrink: `f64` -> Vertical shrink factor
18879/// min: 1, max: 1000000, default: 1
18880/// returns `VipsImage` - Output image
18881pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
18882    unsafe {
18883        let inp_in: *mut bindings::VipsImage = inp.ctx;
18884        let vshrink_in: f64 = vshrink;
18885        let mut out_out: *mut bindings::VipsImage = null_mut();
18886
18887        let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
18888        utils::result(
18889            vips_op_response,
18890            VipsImage { ctx: out_out },
18891            Error::ReducevError,
18892        )
18893    }
18894}
18895
18896/// Options for reducev operation
18897#[derive(Clone, Debug)]
18898pub struct ReducevOptions {
18899    /// kernel: `Kernel` -> Resampling kernel
18900    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
18901    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
18902    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
18903    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
18904    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
18905    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
18906    ///  `Last` -> VIPS_KERNEL_LAST = 6
18907    pub kernel: Kernel,
18908    /// gap: `f64` -> Reducing gap
18909    /// min: 0, max: 1000000, default: 0
18910    pub gap: f64,
18911}
18912
18913impl std::default::Default for ReducevOptions {
18914    fn default() -> Self {
18915        ReducevOptions {
18916            kernel: Kernel::Lanczos3,
18917            gap: f64::from(0),
18918        }
18919    }
18920}
18921
18922/// VipsReducev (reducev), shrink an image vertically
18923/// inp: `&VipsImage` -> Input image argument
18924/// vshrink: `f64` -> Vertical shrink factor
18925/// min: 1, max: 1000000, default: 1
18926/// reducev_options: `&ReducevOptions` -> optional arguments
18927/// returns `VipsImage` - Output image
18928pub fn reducev_with_opts(
18929    inp: &VipsImage,
18930    vshrink: f64,
18931    reducev_options: &ReducevOptions,
18932) -> Result<VipsImage> {
18933    unsafe {
18934        let inp_in: *mut bindings::VipsImage = inp.ctx;
18935        let vshrink_in: f64 = vshrink;
18936        let mut out_out: *mut bindings::VipsImage = null_mut();
18937
18938        let kernel_in: i32 = reducev_options.kernel as i32;
18939        let kernel_in_name = utils::new_c_string("kernel")?;
18940
18941        let gap_in: f64 = reducev_options.gap;
18942        let gap_in_name = utils::new_c_string("gap")?;
18943
18944        let vips_op_response = bindings::vips_reducev(
18945            inp_in,
18946            &mut out_out,
18947            vshrink_in,
18948            kernel_in_name.as_ptr(),
18949            kernel_in,
18950            gap_in_name.as_ptr(),
18951            gap_in,
18952            NULL,
18953        );
18954        utils::result(
18955            vips_op_response,
18956            VipsImage { ctx: out_out },
18957            Error::ReducevError,
18958        )
18959    }
18960}
18961
18962/// VipsReduce (reduce), reduce an image
18963/// inp: `&VipsImage` -> Input image argument
18964/// hshrink: `f64` -> Horizontal shrink factor
18965/// min: 1, max: 1000000, default: 1
18966/// vshrink: `f64` -> Vertical shrink factor
18967/// min: 1, max: 1000000, default: 1
18968/// returns `VipsImage` - Output image
18969pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
18970    unsafe {
18971        let inp_in: *mut bindings::VipsImage = inp.ctx;
18972        let hshrink_in: f64 = hshrink;
18973        let vshrink_in: f64 = vshrink;
18974        let mut out_out: *mut bindings::VipsImage = null_mut();
18975
18976        let vips_op_response =
18977            bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
18978        utils::result(
18979            vips_op_response,
18980            VipsImage { ctx: out_out },
18981            Error::ReduceError,
18982        )
18983    }
18984}
18985
18986/// Options for reduce operation
18987#[derive(Clone, Debug)]
18988pub struct ReduceOptions {
18989    /// kernel: `Kernel` -> Resampling kernel
18990    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
18991    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
18992    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
18993    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
18994    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
18995    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
18996    ///  `Last` -> VIPS_KERNEL_LAST = 6
18997    pub kernel: Kernel,
18998    /// gap: `f64` -> Reducing gap
18999    /// min: 0, max: 1000000, default: 0
19000    pub gap: f64,
19001}
19002
19003impl std::default::Default for ReduceOptions {
19004    fn default() -> Self {
19005        ReduceOptions {
19006            kernel: Kernel::Lanczos3,
19007            gap: f64::from(0),
19008        }
19009    }
19010}
19011
19012/// VipsReduce (reduce), reduce an image
19013/// inp: `&VipsImage` -> Input image argument
19014/// hshrink: `f64` -> Horizontal shrink factor
19015/// min: 1, max: 1000000, default: 1
19016/// vshrink: `f64` -> Vertical shrink factor
19017/// min: 1, max: 1000000, default: 1
19018/// reduce_options: `&ReduceOptions` -> optional arguments
19019/// returns `VipsImage` - Output image
19020pub fn reduce_with_opts(
19021    inp: &VipsImage,
19022    hshrink: f64,
19023    vshrink: f64,
19024    reduce_options: &ReduceOptions,
19025) -> Result<VipsImage> {
19026    unsafe {
19027        let inp_in: *mut bindings::VipsImage = inp.ctx;
19028        let hshrink_in: f64 = hshrink;
19029        let vshrink_in: f64 = vshrink;
19030        let mut out_out: *mut bindings::VipsImage = null_mut();
19031
19032        let kernel_in: i32 = reduce_options.kernel as i32;
19033        let kernel_in_name = utils::new_c_string("kernel")?;
19034
19035        let gap_in: f64 = reduce_options.gap;
19036        let gap_in_name = utils::new_c_string("gap")?;
19037
19038        let vips_op_response = bindings::vips_reduce(
19039            inp_in,
19040            &mut out_out,
19041            hshrink_in,
19042            vshrink_in,
19043            kernel_in_name.as_ptr(),
19044            kernel_in,
19045            gap_in_name.as_ptr(),
19046            gap_in,
19047            NULL,
19048        );
19049        utils::result(
19050            vips_op_response,
19051            VipsImage { ctx: out_out },
19052            Error::ReduceError,
19053        )
19054    }
19055}
19056
19057/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19058/// inp: `&VipsImage` -> Input image argument
19059/// coeff: `&VipsImage` -> Coefficient matrix
19060/// returns `VipsImage` - Output image
19061pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19062    unsafe {
19063        let inp_in: *mut bindings::VipsImage = inp.ctx;
19064        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19065        let mut out_out: *mut bindings::VipsImage = null_mut();
19066
19067        let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19068        utils::result(
19069            vips_op_response,
19070            VipsImage { ctx: out_out },
19071            Error::QuadraticError,
19072        )
19073    }
19074}
19075
19076/// Options for quadratic operation
19077#[derive(Clone, Debug)]
19078pub struct QuadraticOptions {
19079    /// interpolate: `VipsInterpolate` -> Interpolate values with this
19080    pub interpolate: VipsInterpolate,
19081}
19082
19083impl std::default::Default for QuadraticOptions {
19084    fn default() -> Self {
19085        QuadraticOptions {
19086            interpolate: VipsInterpolate::new(),
19087        }
19088    }
19089}
19090
19091/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19092/// inp: `&VipsImage` -> Input image argument
19093/// coeff: `&VipsImage` -> Coefficient matrix
19094/// quadratic_options: `&QuadraticOptions` -> optional arguments
19095/// returns `VipsImage` - Output image
19096pub fn quadratic_with_opts(
19097    inp: &VipsImage,
19098    coeff: &VipsImage,
19099    quadratic_options: &QuadraticOptions,
19100) -> Result<VipsImage> {
19101    unsafe {
19102        let inp_in: *mut bindings::VipsImage = inp.ctx;
19103        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19104        let mut out_out: *mut bindings::VipsImage = null_mut();
19105
19106        let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19107        let interpolate_in_name = utils::new_c_string("interpolate")?;
19108
19109        let vips_op_response = bindings::vips_quadratic(
19110            inp_in,
19111            &mut out_out,
19112            coeff_in,
19113            interpolate_in_name.as_ptr(),
19114            interpolate_in,
19115            NULL,
19116        );
19117        utils::result(
19118            vips_op_response,
19119            VipsImage { ctx: out_out },
19120            Error::QuadraticError,
19121        )
19122    }
19123}
19124
19125/// VipsAffine (affine), affine transform of an image
19126/// inp: `&VipsImage` -> Input image argument
19127/// a: `f64` -> Transformation Matrix coefficient
19128/// min: -inf, max: inf, default: 0
19129/// b: `f64` -> Transformation Matrix coefficient
19130/// min: -inf, max: inf, default: 0
19131/// c: `f64` -> Transformation Matrix coefficient
19132/// min: -inf, max: inf, default: 0
19133/// d: `f64` -> Transformation Matrix coefficient
19134/// min: -inf, max: inf, default: 0
19135/// returns `VipsImage` - Output image
19136pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19137    unsafe {
19138        let inp_in: *mut bindings::VipsImage = inp.ctx;
19139        let a_in: f64 = a;
19140        let b_in: f64 = b;
19141        let c_in: f64 = c;
19142        let d_in: f64 = d;
19143        let mut out_out: *mut bindings::VipsImage = null_mut();
19144
19145        let vips_op_response =
19146            bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19147        utils::result(
19148            vips_op_response,
19149            VipsImage { ctx: out_out },
19150            Error::AffineError,
19151        )
19152    }
19153}
19154
19155/// Options for affine operation
19156#[derive(Clone, Debug)]
19157pub struct AffineOptions {
19158    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19159    pub interpolate: VipsInterpolate,
19160    /// oarea: `Vec<i32>` -> Area of output to generate
19161    pub oarea: Vec<i32>,
19162    /// odx: `f64` -> Horizontal output displacement
19163    /// min: -10000000, max: 10000000, default: 0
19164    pub odx: f64,
19165    /// ody: `f64` -> Vertical output displacement
19166    /// min: -10000000, max: 10000000, default: 0
19167    pub ody: f64,
19168    /// idx: `f64` -> Horizontal input displacement
19169    /// min: -10000000, max: 10000000, default: 0
19170    pub idx: f64,
19171    /// idy: `f64` -> Vertical input displacement
19172    /// min: -10000000, max: 10000000, default: 0
19173    pub idy: f64,
19174    /// background: `Vec<f64>` -> Background value
19175    pub background: Vec<f64>,
19176    /// premultiplied: `bool` -> Images have premultiplied alpha
19177    /// default: false
19178    pub premultiplied: bool,
19179    /// extend: `Extend` -> How to generate the extra pixels
19180    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19181    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19182    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19183    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19184    ///  `White` -> VIPS_EXTEND_WHITE = 4
19185    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19186    ///  `Last` -> VIPS_EXTEND_LAST = 6
19187    pub extend: Extend,
19188}
19189
19190impl std::default::Default for AffineOptions {
19191    fn default() -> Self {
19192        AffineOptions {
19193            interpolate: VipsInterpolate::new(),
19194            oarea: Vec::new(),
19195            odx: f64::from(0),
19196            ody: f64::from(0),
19197            idx: f64::from(0),
19198            idy: f64::from(0),
19199            background: Vec::new(),
19200            premultiplied: false,
19201            extend: Extend::Background,
19202        }
19203    }
19204}
19205
19206/// VipsAffine (affine), affine transform of an image
19207/// inp: `&VipsImage` -> Input image argument
19208/// a: `f64` -> Transformation Matrix coefficient
19209/// min: -inf, max: inf, default: 0
19210/// b: `f64` -> Transformation Matrix coefficient
19211/// min: -inf, max: inf, default: 0
19212/// c: `f64` -> Transformation Matrix coefficient
19213/// min: -inf, max: inf, default: 0
19214/// d: `f64` -> Transformation Matrix coefficient
19215/// min: -inf, max: inf, default: 0
19216/// affine_options: `&AffineOptions` -> optional arguments
19217/// returns `VipsImage` - Output image
19218pub fn affine_with_opts(
19219    inp: &VipsImage,
19220    a: f64,
19221    b: f64,
19222    c: f64,
19223    d: f64,
19224    affine_options: &AffineOptions,
19225) -> Result<VipsImage> {
19226    unsafe {
19227        let inp_in: *mut bindings::VipsImage = inp.ctx;
19228        let a_in: f64 = a;
19229        let b_in: f64 = b;
19230        let c_in: f64 = c;
19231        let d_in: f64 = d;
19232        let mut out_out: *mut bindings::VipsImage = null_mut();
19233
19234        let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19235        let interpolate_in_name = utils::new_c_string("interpolate")?;
19236
19237        let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19238        let oarea_in = oarea_wrapper.ctx;
19239        let oarea_in_name = utils::new_c_string("oarea")?;
19240
19241        let odx_in: f64 = affine_options.odx;
19242        let odx_in_name = utils::new_c_string("odx")?;
19243
19244        let ody_in: f64 = affine_options.ody;
19245        let ody_in_name = utils::new_c_string("ody")?;
19246
19247        let idx_in: f64 = affine_options.idx;
19248        let idx_in_name = utils::new_c_string("idx")?;
19249
19250        let idy_in: f64 = affine_options.idy;
19251        let idy_in_name = utils::new_c_string("idy")?;
19252
19253        let background_wrapper =
19254            utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19255        let background_in = background_wrapper.ctx;
19256        let background_in_name = utils::new_c_string("background")?;
19257
19258        let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19259        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19260
19261        let extend_in: i32 = affine_options.extend as i32;
19262        let extend_in_name = utils::new_c_string("extend")?;
19263
19264        let vips_op_response = bindings::vips_affine(
19265            inp_in,
19266            &mut out_out,
19267            a_in,
19268            b_in,
19269            c_in,
19270            d_in,
19271            interpolate_in_name.as_ptr(),
19272            interpolate_in,
19273            oarea_in_name.as_ptr(),
19274            oarea_in,
19275            odx_in_name.as_ptr(),
19276            odx_in,
19277            ody_in_name.as_ptr(),
19278            ody_in,
19279            idx_in_name.as_ptr(),
19280            idx_in,
19281            idy_in_name.as_ptr(),
19282            idy_in,
19283            background_in_name.as_ptr(),
19284            background_in,
19285            premultiplied_in_name.as_ptr(),
19286            premultiplied_in,
19287            extend_in_name.as_ptr(),
19288            extend_in,
19289            NULL,
19290        );
19291        utils::result(
19292            vips_op_response,
19293            VipsImage { ctx: out_out },
19294            Error::AffineError,
19295        )
19296    }
19297}
19298
19299/// VipsSimilarity (similarity), similarity transform of an image
19300/// inp: `&VipsImage` -> Input image argument
19301/// returns `VipsImage` - Output image
19302pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19303    unsafe {
19304        let inp_in: *mut bindings::VipsImage = inp.ctx;
19305        let mut out_out: *mut bindings::VipsImage = null_mut();
19306
19307        let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19308        utils::result(
19309            vips_op_response,
19310            VipsImage { ctx: out_out },
19311            Error::SimilarityError,
19312        )
19313    }
19314}
19315
19316/// Options for similarity operation
19317#[derive(Clone, Debug)]
19318pub struct SimilarityOptions {
19319    /// scale: `f64` -> Scale by this factor
19320    /// min: 0, max: 10000000, default: 1
19321    pub scale: f64,
19322    /// angle: `f64` -> Rotate anticlockwise by this many degrees
19323    /// min: -10000000, max: 10000000, default: 0
19324    pub angle: f64,
19325    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19326    pub interpolate: VipsInterpolate,
19327    /// background: `Vec<f64>` -> Background value
19328    pub background: Vec<f64>,
19329    /// odx: `f64` -> Horizontal output displacement
19330    /// min: -10000000, max: 10000000, default: 0
19331    pub odx: f64,
19332    /// ody: `f64` -> Vertical output displacement
19333    /// min: -10000000, max: 10000000, default: 0
19334    pub ody: f64,
19335    /// idx: `f64` -> Horizontal input displacement
19336    /// min: -10000000, max: 10000000, default: 0
19337    pub idx: f64,
19338    /// idy: `f64` -> Vertical input displacement
19339    /// min: -10000000, max: 10000000, default: 0
19340    pub idy: f64,
19341}
19342
19343impl std::default::Default for SimilarityOptions {
19344    fn default() -> Self {
19345        SimilarityOptions {
19346            scale: f64::from(1),
19347            angle: f64::from(0),
19348            interpolate: VipsInterpolate::new(),
19349            background: Vec::new(),
19350            odx: f64::from(0),
19351            ody: f64::from(0),
19352            idx: f64::from(0),
19353            idy: f64::from(0),
19354        }
19355    }
19356}
19357
19358/// VipsSimilarity (similarity), similarity transform of an image
19359/// inp: `&VipsImage` -> Input image argument
19360/// similarity_options: `&SimilarityOptions` -> optional arguments
19361/// returns `VipsImage` - Output image
19362pub fn similarity_with_opts(
19363    inp: &VipsImage,
19364    similarity_options: &SimilarityOptions,
19365) -> Result<VipsImage> {
19366    unsafe {
19367        let inp_in: *mut bindings::VipsImage = inp.ctx;
19368        let mut out_out: *mut bindings::VipsImage = null_mut();
19369
19370        let scale_in: f64 = similarity_options.scale;
19371        let scale_in_name = utils::new_c_string("scale")?;
19372
19373        let angle_in: f64 = similarity_options.angle;
19374        let angle_in_name = utils::new_c_string("angle")?;
19375
19376        let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
19377        let interpolate_in_name = utils::new_c_string("interpolate")?;
19378
19379        let background_wrapper =
19380            utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
19381        let background_in = background_wrapper.ctx;
19382        let background_in_name = utils::new_c_string("background")?;
19383
19384        let odx_in: f64 = similarity_options.odx;
19385        let odx_in_name = utils::new_c_string("odx")?;
19386
19387        let ody_in: f64 = similarity_options.ody;
19388        let ody_in_name = utils::new_c_string("ody")?;
19389
19390        let idx_in: f64 = similarity_options.idx;
19391        let idx_in_name = utils::new_c_string("idx")?;
19392
19393        let idy_in: f64 = similarity_options.idy;
19394        let idy_in_name = utils::new_c_string("idy")?;
19395
19396        let vips_op_response = bindings::vips_similarity(
19397            inp_in,
19398            &mut out_out,
19399            scale_in_name.as_ptr(),
19400            scale_in,
19401            angle_in_name.as_ptr(),
19402            angle_in,
19403            interpolate_in_name.as_ptr(),
19404            interpolate_in,
19405            background_in_name.as_ptr(),
19406            background_in,
19407            odx_in_name.as_ptr(),
19408            odx_in,
19409            ody_in_name.as_ptr(),
19410            ody_in,
19411            idx_in_name.as_ptr(),
19412            idx_in,
19413            idy_in_name.as_ptr(),
19414            idy_in,
19415            NULL,
19416        );
19417        utils::result(
19418            vips_op_response,
19419            VipsImage { ctx: out_out },
19420            Error::SimilarityError,
19421        )
19422    }
19423}
19424
19425/// VipsRotate (rotate), rotate an image by a number of degrees
19426/// inp: `&VipsImage` -> Input image argument
19427/// angle: `f64` -> Rotate anticlockwise by this many degrees
19428/// min: -10000000, max: 10000000, default: 0
19429/// returns `VipsImage` - Output image
19430pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
19431    unsafe {
19432        let inp_in: *mut bindings::VipsImage = inp.ctx;
19433        let angle_in: f64 = angle;
19434        let mut out_out: *mut bindings::VipsImage = null_mut();
19435
19436        let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
19437        utils::result(
19438            vips_op_response,
19439            VipsImage { ctx: out_out },
19440            Error::RotateError,
19441        )
19442    }
19443}
19444
19445/// Options for rotate operation
19446#[derive(Clone, Debug)]
19447pub struct RotateOptions {
19448    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19449    pub interpolate: VipsInterpolate,
19450    /// background: `Vec<f64>` -> Background value
19451    pub background: Vec<f64>,
19452    /// odx: `f64` -> Horizontal output displacement
19453    /// min: -10000000, max: 10000000, default: 0
19454    pub odx: f64,
19455    /// ody: `f64` -> Vertical output displacement
19456    /// min: -10000000, max: 10000000, default: 0
19457    pub ody: f64,
19458    /// idx: `f64` -> Horizontal input displacement
19459    /// min: -10000000, max: 10000000, default: 0
19460    pub idx: f64,
19461    /// idy: `f64` -> Vertical input displacement
19462    /// min: -10000000, max: 10000000, default: 0
19463    pub idy: f64,
19464}
19465
19466impl std::default::Default for RotateOptions {
19467    fn default() -> Self {
19468        RotateOptions {
19469            interpolate: VipsInterpolate::new(),
19470            background: Vec::new(),
19471            odx: f64::from(0),
19472            ody: f64::from(0),
19473            idx: f64::from(0),
19474            idy: f64::from(0),
19475        }
19476    }
19477}
19478
19479/// VipsRotate (rotate), rotate an image by a number of degrees
19480/// inp: `&VipsImage` -> Input image argument
19481/// angle: `f64` -> Rotate anticlockwise by this many degrees
19482/// min: -10000000, max: 10000000, default: 0
19483/// rotate_options: `&RotateOptions` -> optional arguments
19484/// returns `VipsImage` - Output image
19485pub fn rotate_with_opts(
19486    inp: &VipsImage,
19487    angle: f64,
19488    rotate_options: &RotateOptions,
19489) -> Result<VipsImage> {
19490    unsafe {
19491        let inp_in: *mut bindings::VipsImage = inp.ctx;
19492        let angle_in: f64 = angle;
19493        let mut out_out: *mut bindings::VipsImage = null_mut();
19494
19495        let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
19496        let interpolate_in_name = utils::new_c_string("interpolate")?;
19497
19498        let background_wrapper =
19499            utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
19500        let background_in = background_wrapper.ctx;
19501        let background_in_name = utils::new_c_string("background")?;
19502
19503        let odx_in: f64 = rotate_options.odx;
19504        let odx_in_name = utils::new_c_string("odx")?;
19505
19506        let ody_in: f64 = rotate_options.ody;
19507        let ody_in_name = utils::new_c_string("ody")?;
19508
19509        let idx_in: f64 = rotate_options.idx;
19510        let idx_in_name = utils::new_c_string("idx")?;
19511
19512        let idy_in: f64 = rotate_options.idy;
19513        let idy_in_name = utils::new_c_string("idy")?;
19514
19515        let vips_op_response = bindings::vips_rotate(
19516            inp_in,
19517            &mut out_out,
19518            angle_in,
19519            interpolate_in_name.as_ptr(),
19520            interpolate_in,
19521            background_in_name.as_ptr(),
19522            background_in,
19523            odx_in_name.as_ptr(),
19524            odx_in,
19525            ody_in_name.as_ptr(),
19526            ody_in,
19527            idx_in_name.as_ptr(),
19528            idx_in,
19529            idy_in_name.as_ptr(),
19530            idy_in,
19531            NULL,
19532        );
19533        utils::result(
19534            vips_op_response,
19535            VipsImage { ctx: out_out },
19536            Error::RotateError,
19537        )
19538    }
19539}
19540
19541/// VipsResize (resize), resize an image
19542/// inp: `&VipsImage` -> Input image argument
19543/// scale: `f64` -> Scale image by this factor
19544/// min: 0, max: 10000000, default: 0
19545/// returns `VipsImage` - Output image
19546pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
19547    unsafe {
19548        let inp_in: *mut bindings::VipsImage = inp.ctx;
19549        let scale_in: f64 = scale;
19550        let mut out_out: *mut bindings::VipsImage = null_mut();
19551
19552        let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
19553        utils::result(
19554            vips_op_response,
19555            VipsImage { ctx: out_out },
19556            Error::ResizeError,
19557        )
19558    }
19559}
19560
19561/// Options for resize operation
19562#[derive(Clone, Debug)]
19563pub struct ResizeOptions {
19564    /// kernel: `Kernel` -> Resampling kernel
19565    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19566    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19567    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19568    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19569    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19570    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19571    ///  `Last` -> VIPS_KERNEL_LAST = 6
19572    pub kernel: Kernel,
19573    /// gap: `f64` -> Reducing gap
19574    /// min: 0, max: 1000000, default: 2
19575    pub gap: f64,
19576    /// vscale: `f64` -> Vertical scale image by this factor
19577    /// min: 0, max: 10000000, default: 0
19578    pub vscale: f64,
19579}
19580
19581impl std::default::Default for ResizeOptions {
19582    fn default() -> Self {
19583        ResizeOptions {
19584            kernel: Kernel::Lanczos3,
19585            gap: f64::from(2),
19586            vscale: f64::from(0),
19587        }
19588    }
19589}
19590
19591/// VipsResize (resize), resize an image
19592/// inp: `&VipsImage` -> Input image argument
19593/// scale: `f64` -> Scale image by this factor
19594/// min: 0, max: 10000000, default: 0
19595/// resize_options: `&ResizeOptions` -> optional arguments
19596/// returns `VipsImage` - Output image
19597pub fn resize_with_opts(
19598    inp: &VipsImage,
19599    scale: f64,
19600    resize_options: &ResizeOptions,
19601) -> Result<VipsImage> {
19602    unsafe {
19603        let inp_in: *mut bindings::VipsImage = inp.ctx;
19604        let scale_in: f64 = scale;
19605        let mut out_out: *mut bindings::VipsImage = null_mut();
19606
19607        let kernel_in: i32 = resize_options.kernel as i32;
19608        let kernel_in_name = utils::new_c_string("kernel")?;
19609
19610        let gap_in: f64 = resize_options.gap;
19611        let gap_in_name = utils::new_c_string("gap")?;
19612
19613        let vscale_in: f64 = resize_options.vscale;
19614        let vscale_in_name = utils::new_c_string("vscale")?;
19615
19616        let vips_op_response = bindings::vips_resize(
19617            inp_in,
19618            &mut out_out,
19619            scale_in,
19620            kernel_in_name.as_ptr(),
19621            kernel_in,
19622            gap_in_name.as_ptr(),
19623            gap_in,
19624            vscale_in_name.as_ptr(),
19625            vscale_in,
19626            NULL,
19627        );
19628        utils::result(
19629            vips_op_response,
19630            VipsImage { ctx: out_out },
19631            Error::ResizeError,
19632        )
19633    }
19634}
19635
19636/// VipsColourspace (colourspace), convert to a new colorspace
19637/// inp: `&VipsImage` -> Input image
19638/// space: `Interpretation` -> Destination color space
19639///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
19640///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
19641///  `BW` -> VIPS_INTERPRETATION_B_W = 1
19642///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
19643///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
19644///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
19645///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
19646///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
19647///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
19648///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
19649///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
19650///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
19651///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
19652///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
19653///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
19654///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
19655///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
19656///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
19657///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
19658///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
19659///  `Last` -> VIPS_INTERPRETATION_LAST = 30
19660/// returns `VipsImage` - Output image
19661pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
19662    unsafe {
19663        let inp_in: *mut bindings::VipsImage = inp.ctx;
19664        let space_in: i32 = space as i32;
19665        let mut out_out: *mut bindings::VipsImage = null_mut();
19666
19667        let vips_op_response =
19668            bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
19669        utils::result(
19670            vips_op_response,
19671            VipsImage { ctx: out_out },
19672            Error::ColourspaceError,
19673        )
19674    }
19675}
19676
19677/// Options for colourspace operation
19678#[derive(Clone, Debug)]
19679pub struct ColourspaceOptions {
19680    /// source_space: `Interpretation` -> Source color space
19681    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
19682    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
19683    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
19684    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
19685    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
19686    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
19687    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
19688    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
19689    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
19690    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
19691    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
19692    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
19693    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
19694    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
19695    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
19696    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
19697    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
19698    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
19699    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
19700    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
19701    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
19702    pub source_space: Interpretation,
19703}
19704
19705impl std::default::Default for ColourspaceOptions {
19706    fn default() -> Self {
19707        ColourspaceOptions {
19708            source_space: Interpretation::Srgb,
19709        }
19710    }
19711}
19712
19713/// VipsColourspace (colourspace), convert to a new colorspace
19714/// inp: `&VipsImage` -> Input image
19715/// space: `Interpretation` -> Destination color space
19716///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
19717///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
19718///  `BW` -> VIPS_INTERPRETATION_B_W = 1
19719///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
19720///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
19721///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
19722///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
19723///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
19724///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
19725///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
19726///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
19727///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
19728///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
19729///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
19730///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
19731///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
19732///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
19733///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
19734///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
19735///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
19736///  `Last` -> VIPS_INTERPRETATION_LAST = 30
19737/// colourspace_options: `&ColourspaceOptions` -> optional arguments
19738/// returns `VipsImage` - Output image
19739pub fn colourspace_with_opts(
19740    inp: &VipsImage,
19741    space: Interpretation,
19742    colourspace_options: &ColourspaceOptions,
19743) -> Result<VipsImage> {
19744    unsafe {
19745        let inp_in: *mut bindings::VipsImage = inp.ctx;
19746        let space_in: i32 = space as i32;
19747        let mut out_out: *mut bindings::VipsImage = null_mut();
19748
19749        let source_space_in: i32 = colourspace_options.source_space as i32;
19750        let source_space_in_name = utils::new_c_string("source-space")?;
19751
19752        let vips_op_response = bindings::vips_colourspace(
19753            inp_in,
19754            &mut out_out,
19755            space_in.try_into().unwrap(),
19756            source_space_in_name.as_ptr(),
19757            source_space_in,
19758            NULL,
19759        );
19760        utils::result(
19761            vips_op_response,
19762            VipsImage { ctx: out_out },
19763            Error::ColourspaceError,
19764        )
19765    }
19766}
19767
19768/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
19769/// inp: `&VipsImage` -> Input image
19770/// returns `VipsImage` - Output image
19771pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
19772    unsafe {
19773        let inp_in: *mut bindings::VipsImage = inp.ctx;
19774        let mut out_out: *mut bindings::VipsImage = null_mut();
19775
19776        let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
19777        utils::result(
19778            vips_op_response,
19779            VipsImage { ctx: out_out },
19780            Error::Lab2XyzError,
19781        )
19782    }
19783}
19784
19785/// Options for lab_2xyz operation
19786#[derive(Clone, Debug)]
19787pub struct Lab2XyzOptions {
19788    /// temp: `Vec<f64>` -> Color temperature
19789    pub temp: Vec<f64>,
19790}
19791
19792impl std::default::Default for Lab2XyzOptions {
19793    fn default() -> Self {
19794        Lab2XyzOptions { temp: Vec::new() }
19795    }
19796}
19797
19798/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
19799/// inp: `&VipsImage` -> Input image
19800/// lab_2xyz_options: `&Lab2XyzOptions` -> optional arguments
19801/// returns `VipsImage` - Output image
19802pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
19803    unsafe {
19804        let inp_in: *mut bindings::VipsImage = inp.ctx;
19805        let mut out_out: *mut bindings::VipsImage = null_mut();
19806
19807        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
19808        let temp_in = temp_wrapper.ctx;
19809        let temp_in_name = utils::new_c_string("temp")?;
19810
19811        let vips_op_response =
19812            bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
19813        utils::result(
19814            vips_op_response,
19815            VipsImage { ctx: out_out },
19816            Error::Lab2XyzError,
19817        )
19818    }
19819}
19820
19821/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
19822/// inp: `&VipsImage` -> Input image
19823/// returns `VipsImage` - Output image
19824pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
19825    unsafe {
19826        let inp_in: *mut bindings::VipsImage = inp.ctx;
19827        let mut out_out: *mut bindings::VipsImage = null_mut();
19828
19829        let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
19830        utils::result(
19831            vips_op_response,
19832            VipsImage { ctx: out_out },
19833            Error::Xyz2LabError,
19834        )
19835    }
19836}
19837
19838/// Options for xyz2_lab operation
19839#[derive(Clone, Debug)]
19840pub struct Xyz2LabOptions {
19841    /// temp: `Vec<f64>` -> Colour temperature
19842    pub temp: Vec<f64>,
19843}
19844
19845impl std::default::Default for Xyz2LabOptions {
19846    fn default() -> Self {
19847        Xyz2LabOptions { temp: Vec::new() }
19848    }
19849}
19850
19851/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
19852/// inp: `&VipsImage` -> Input image
19853/// xyz2_lab_options: `&Xyz2LabOptions` -> optional arguments
19854/// returns `VipsImage` - Output image
19855pub fn xyz2_lab_with_opts(
19856    inp: &VipsImage,
19857    xyz_2_lab_options: &Xyz2LabOptions,
19858) -> Result<VipsImage> {
19859    unsafe {
19860        let inp_in: *mut bindings::VipsImage = inp.ctx;
19861        let mut out_out: *mut bindings::VipsImage = null_mut();
19862
19863        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
19864        let temp_in = temp_wrapper.ctx;
19865        let temp_in_name = utils::new_c_string("temp")?;
19866
19867        let vips_op_response =
19868            bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
19869        utils::result(
19870            vips_op_response,
19871            VipsImage { ctx: out_out },
19872            Error::Xyz2LabError,
19873        )
19874    }
19875}
19876
19877/// VipsLab2LCh (Lab2LCh), transform Lab to LCh
19878/// inp: `&VipsImage` -> Input image
19879/// returns `VipsImage` - Output image
19880pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
19881    unsafe {
19882        let inp_in: *mut bindings::VipsImage = inp.ctx;
19883        let mut out_out: *mut bindings::VipsImage = null_mut();
19884
19885        let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
19886        utils::result(
19887            vips_op_response,
19888            VipsImage { ctx: out_out },
19889            Error::Lab2LChError,
19890        )
19891    }
19892}
19893
19894/// VipsLCh2Lab (LCh2Lab), transform LCh to Lab
19895/// inp: `&VipsImage` -> Input image
19896/// returns `VipsImage` - Output image
19897pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
19898    unsafe {
19899        let inp_in: *mut bindings::VipsImage = inp.ctx;
19900        let mut out_out: *mut bindings::VipsImage = null_mut();
19901
19902        let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
19903        utils::result(
19904            vips_op_response,
19905            VipsImage { ctx: out_out },
19906            Error::LCh2LabError,
19907        )
19908    }
19909}
19910
19911/// VipsLCh2CMC (LCh2CMC), transform LCh to CMC
19912/// inp: `&VipsImage` -> Input image
19913/// returns `VipsImage` - Output image
19914pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
19915    unsafe {
19916        let inp_in: *mut bindings::VipsImage = inp.ctx;
19917        let mut out_out: *mut bindings::VipsImage = null_mut();
19918
19919        let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
19920        utils::result(
19921            vips_op_response,
19922            VipsImage { ctx: out_out },
19923            Error::LCh2CmcError,
19924        )
19925    }
19926}
19927
19928/// VipsCMC2LCh (CMC2LCh), transform LCh to CMC
19929/// inp: `&VipsImage` -> Input image
19930/// returns `VipsImage` - Output image
19931pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
19932    unsafe {
19933        let inp_in: *mut bindings::VipsImage = inp.ctx;
19934        let mut out_out: *mut bindings::VipsImage = null_mut();
19935
19936        let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
19937        utils::result(
19938            vips_op_response,
19939            VipsImage { ctx: out_out },
19940            Error::Cmc2LChError,
19941        )
19942    }
19943}
19944
19945/// VipsXYZ2Yxy (XYZ2Yxy), transform XYZ to Yxy
19946/// inp: `&VipsImage` -> Input image
19947/// returns `VipsImage` - Output image
19948pub fn xyz2_yxy(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_XYZ2Yxy(inp_in, &mut out_out, NULL);
19954        utils::result(
19955            vips_op_response,
19956            VipsImage { ctx: out_out },
19957            Error::Xyz2YxyError,
19958        )
19959    }
19960}
19961
19962/// VipsYxy2XYZ (Yxy2XYZ), transform Yxy to XYZ
19963/// inp: `&VipsImage` -> Input image
19964/// returns `VipsImage` - Output image
19965pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
19966    unsafe {
19967        let inp_in: *mut bindings::VipsImage = inp.ctx;
19968        let mut out_out: *mut bindings::VipsImage = null_mut();
19969
19970        let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
19971        utils::result(
19972            vips_op_response,
19973            VipsImage { ctx: out_out },
19974            Error::Yxy2XyzError,
19975        )
19976    }
19977}
19978
19979/// VipsLabQ2Lab (LabQ2Lab), unpack a LabQ image to float Lab
19980/// inp: `&VipsImage` -> Input image
19981/// returns `VipsImage` - Output image
19982pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
19983    unsafe {
19984        let inp_in: *mut bindings::VipsImage = inp.ctx;
19985        let mut out_out: *mut bindings::VipsImage = null_mut();
19986
19987        let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
19988        utils::result(
19989            vips_op_response,
19990            VipsImage { ctx: out_out },
19991            Error::LabQ2LabError,
19992        )
19993    }
19994}
19995
19996/// VipsLab2LabQ (Lab2LabQ), transform float Lab to LabQ coding
19997/// inp: `&VipsImage` -> Input image
19998/// returns `VipsImage` - Output image
19999pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20000    unsafe {
20001        let inp_in: *mut bindings::VipsImage = inp.ctx;
20002        let mut out_out: *mut bindings::VipsImage = null_mut();
20003
20004        let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20005        utils::result(
20006            vips_op_response,
20007            VipsImage { ctx: out_out },
20008            Error::Lab2LabQError,
20009        )
20010    }
20011}
20012
20013/// VipsLabQ2LabS (LabQ2LabS), unpack a LabQ image to short Lab
20014/// inp: `&VipsImage` -> Input image
20015/// returns `VipsImage` - Output image
20016pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20017    unsafe {
20018        let inp_in: *mut bindings::VipsImage = inp.ctx;
20019        let mut out_out: *mut bindings::VipsImage = null_mut();
20020
20021        let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20022        utils::result(
20023            vips_op_response,
20024            VipsImage { ctx: out_out },
20025            Error::LabQ2LabSError,
20026        )
20027    }
20028}
20029
20030/// VipsLabS2LabQ (LabS2LabQ), transform short Lab to LabQ coding
20031/// inp: `&VipsImage` -> Input image
20032/// returns `VipsImage` - Output image
20033pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20034    unsafe {
20035        let inp_in: *mut bindings::VipsImage = inp.ctx;
20036        let mut out_out: *mut bindings::VipsImage = null_mut();
20037
20038        let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20039        utils::result(
20040            vips_op_response,
20041            VipsImage { ctx: out_out },
20042            Error::LabS2LabQError,
20043        )
20044    }
20045}
20046
20047/// VipsLabS2Lab (LabS2Lab), transform signed short Lab to float
20048/// inp: `&VipsImage` -> Input image
20049/// returns `VipsImage` - Output image
20050pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20051    unsafe {
20052        let inp_in: *mut bindings::VipsImage = inp.ctx;
20053        let mut out_out: *mut bindings::VipsImage = null_mut();
20054
20055        let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20056        utils::result(
20057            vips_op_response,
20058            VipsImage { ctx: out_out },
20059            Error::LabS2LabError,
20060        )
20061    }
20062}
20063
20064/// VipsLab2LabS (Lab2LabS), transform float Lab to signed short
20065/// inp: `&VipsImage` -> Input image
20066/// returns `VipsImage` - Output image
20067pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20068    unsafe {
20069        let inp_in: *mut bindings::VipsImage = inp.ctx;
20070        let mut out_out: *mut bindings::VipsImage = null_mut();
20071
20072        let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20073        utils::result(
20074            vips_op_response,
20075            VipsImage { ctx: out_out },
20076            Error::Lab2LabSError,
20077        )
20078    }
20079}
20080
20081/// VipsRad2float (rad2float), unpack Radiance coding to float RGB
20082/// inp: `&VipsImage` -> Input image
20083/// returns `VipsImage` - Output image
20084pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20085    unsafe {
20086        let inp_in: *mut bindings::VipsImage = inp.ctx;
20087        let mut out_out: *mut bindings::VipsImage = null_mut();
20088
20089        let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20090        utils::result(
20091            vips_op_response,
20092            VipsImage { ctx: out_out },
20093            Error::Rad2FloatError,
20094        )
20095    }
20096}
20097
20098/// VipsFloat2rad (float2rad), transform float RGB to Radiance coding
20099/// inp: `&VipsImage` -> Input image
20100/// returns `VipsImage` - Output image
20101pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20102    unsafe {
20103        let inp_in: *mut bindings::VipsImage = inp.ctx;
20104        let mut out_out: *mut bindings::VipsImage = null_mut();
20105
20106        let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20107        utils::result(
20108            vips_op_response,
20109            VipsImage { ctx: out_out },
20110            Error::Float2RadError,
20111        )
20112    }
20113}
20114
20115/// VipsLabQ2sRGB (LabQ2sRGB), convert a LabQ image to sRGB
20116/// inp: `&VipsImage` -> Input image
20117/// returns `VipsImage` - Output image
20118pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20119    unsafe {
20120        let inp_in: *mut bindings::VipsImage = inp.ctx;
20121        let mut out_out: *mut bindings::VipsImage = null_mut();
20122
20123        let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20124        utils::result(
20125            vips_op_response,
20126            VipsImage { ctx: out_out },
20127            Error::LabQ2SRgbError,
20128        )
20129    }
20130}
20131
20132/// VipssRGB2HSV (sRGB2HSV), transform sRGB to HSV
20133/// inp: `&VipsImage` -> Input image
20134/// returns `VipsImage` - Output image
20135pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20136    unsafe {
20137        let inp_in: *mut bindings::VipsImage = inp.ctx;
20138        let mut out_out: *mut bindings::VipsImage = null_mut();
20139
20140        let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20141        utils::result(
20142            vips_op_response,
20143            VipsImage { ctx: out_out },
20144            Error::SRgb2HsvError,
20145        )
20146    }
20147}
20148
20149/// VipsHSV2sRGB (HSV2sRGB), transform HSV to sRGB
20150/// inp: `&VipsImage` -> Input image
20151/// returns `VipsImage` - Output image
20152pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20153    unsafe {
20154        let inp_in: *mut bindings::VipsImage = inp.ctx;
20155        let mut out_out: *mut bindings::VipsImage = null_mut();
20156
20157        let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20158        utils::result(
20159            vips_op_response,
20160            VipsImage { ctx: out_out },
20161            Error::Hsv2SRgbError,
20162        )
20163    }
20164}
20165
20166/// VipsIccImport (icc_import), import from device with ICC profile
20167/// inp: `&VipsImage` -> Input image
20168/// returns `VipsImage` - Output image
20169pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20170    unsafe {
20171        let inp_in: *mut bindings::VipsImage = inp.ctx;
20172        let mut out_out: *mut bindings::VipsImage = null_mut();
20173
20174        let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20175        utils::result(
20176            vips_op_response,
20177            VipsImage { ctx: out_out },
20178            Error::IccImportError,
20179        )
20180    }
20181}
20182
20183/// Options for icc_import operation
20184#[derive(Clone, Debug)]
20185pub struct IccImportOptions {
20186    /// pcs: `PCS` -> Set Profile Connection Space
20187    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20188    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20189    ///  `Last` -> VIPS_PCS_LAST = 2
20190    pub pcs: PCS,
20191    /// intent: `Intent` -> Rendering intent
20192    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20193    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20194    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20195    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20196    ///  `Last` -> VIPS_INTENT_LAST = 4
20197    pub intent: Intent,
20198    /// black_point_compensation: `bool` -> Enable black point compensation
20199    /// default: false
20200    pub black_point_compensation: bool,
20201    /// embedded: `bool` -> Use embedded input profile, if available
20202    /// default: false
20203    pub embedded: bool,
20204    /// input_profile: `String` -> Filename to load input profile from
20205    pub input_profile: String,
20206}
20207
20208impl std::default::Default for IccImportOptions {
20209    fn default() -> Self {
20210        IccImportOptions {
20211            pcs: PCS::Lab,
20212            intent: Intent::Relative,
20213            black_point_compensation: false,
20214            embedded: false,
20215            input_profile: String::new(),
20216        }
20217    }
20218}
20219
20220/// VipsIccImport (icc_import), import from device with ICC profile
20221/// inp: `&VipsImage` -> Input image
20222/// icc_import_options: `&IccImportOptions` -> optional arguments
20223/// returns `VipsImage` - Output image
20224pub fn icc_import_with_opts(
20225    inp: &VipsImage,
20226    icc_import_options: &IccImportOptions,
20227) -> Result<VipsImage> {
20228    unsafe {
20229        let inp_in: *mut bindings::VipsImage = inp.ctx;
20230        let mut out_out: *mut bindings::VipsImage = null_mut();
20231
20232        let pcs_in: i32 = icc_import_options.pcs as i32;
20233        let pcs_in_name = utils::new_c_string("pcs")?;
20234
20235        let intent_in: i32 = icc_import_options.intent as i32;
20236        let intent_in_name = utils::new_c_string("intent")?;
20237
20238        let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
20239            1
20240        } else {
20241            0
20242        };
20243        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20244
20245        let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
20246        let embedded_in_name = utils::new_c_string("embedded")?;
20247
20248        let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
20249        let input_profile_in_name = utils::new_c_string("input-profile")?;
20250
20251        let vips_op_response = bindings::vips_icc_import(
20252            inp_in,
20253            &mut out_out,
20254            pcs_in_name.as_ptr(),
20255            pcs_in,
20256            intent_in_name.as_ptr(),
20257            intent_in,
20258            black_point_compensation_in_name.as_ptr(),
20259            black_point_compensation_in,
20260            embedded_in_name.as_ptr(),
20261            embedded_in,
20262            input_profile_in_name.as_ptr(),
20263            input_profile_in.as_ptr(),
20264            NULL,
20265        );
20266        utils::result(
20267            vips_op_response,
20268            VipsImage { ctx: out_out },
20269            Error::IccImportError,
20270        )
20271    }
20272}
20273
20274/// VipsIccExport (icc_export), output to device with ICC profile
20275/// inp: `&VipsImage` -> Input image
20276/// returns `VipsImage` - Output image
20277pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
20278    unsafe {
20279        let inp_in: *mut bindings::VipsImage = inp.ctx;
20280        let mut out_out: *mut bindings::VipsImage = null_mut();
20281
20282        let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
20283        utils::result(
20284            vips_op_response,
20285            VipsImage { ctx: out_out },
20286            Error::IccExportError,
20287        )
20288    }
20289}
20290
20291/// Options for icc_export operation
20292#[derive(Clone, Debug)]
20293pub struct IccExportOptions {
20294    /// pcs: `PCS` -> Set Profile Connection Space
20295    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20296    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20297    ///  `Last` -> VIPS_PCS_LAST = 2
20298    pub pcs: PCS,
20299    /// intent: `Intent` -> Rendering intent
20300    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20301    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20302    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20303    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20304    ///  `Last` -> VIPS_INTENT_LAST = 4
20305    pub intent: Intent,
20306    /// black_point_compensation: `bool` -> Enable black point compensation
20307    /// default: false
20308    pub black_point_compensation: bool,
20309    /// output_profile: `String` -> Filename to load output profile from
20310    pub output_profile: String,
20311    /// depth: `i32` -> Output device space depth in bits
20312    /// min: 8, max: 16, default: 8
20313    pub depth: i32,
20314}
20315
20316impl std::default::Default for IccExportOptions {
20317    fn default() -> Self {
20318        IccExportOptions {
20319            pcs: PCS::Lab,
20320            intent: Intent::Relative,
20321            black_point_compensation: false,
20322            output_profile: String::new(),
20323            depth: i32::from(8),
20324        }
20325    }
20326}
20327
20328/// VipsIccExport (icc_export), output to device with ICC profile
20329/// inp: `&VipsImage` -> Input image
20330/// icc_export_options: `&IccExportOptions` -> optional arguments
20331/// returns `VipsImage` - Output image
20332pub fn icc_export_with_opts(
20333    inp: &VipsImage,
20334    icc_export_options: &IccExportOptions,
20335) -> Result<VipsImage> {
20336    unsafe {
20337        let inp_in: *mut bindings::VipsImage = inp.ctx;
20338        let mut out_out: *mut bindings::VipsImage = null_mut();
20339
20340        let pcs_in: i32 = icc_export_options.pcs as i32;
20341        let pcs_in_name = utils::new_c_string("pcs")?;
20342
20343        let intent_in: i32 = icc_export_options.intent as i32;
20344        let intent_in_name = utils::new_c_string("intent")?;
20345
20346        let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
20347            1
20348        } else {
20349            0
20350        };
20351        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20352
20353        let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
20354        let output_profile_in_name = utils::new_c_string("output-profile")?;
20355
20356        let depth_in: i32 = icc_export_options.depth;
20357        let depth_in_name = utils::new_c_string("depth")?;
20358
20359        let vips_op_response = bindings::vips_icc_export(
20360            inp_in,
20361            &mut out_out,
20362            pcs_in_name.as_ptr(),
20363            pcs_in,
20364            intent_in_name.as_ptr(),
20365            intent_in,
20366            black_point_compensation_in_name.as_ptr(),
20367            black_point_compensation_in,
20368            output_profile_in_name.as_ptr(),
20369            output_profile_in.as_ptr(),
20370            depth_in_name.as_ptr(),
20371            depth_in,
20372            NULL,
20373        );
20374        utils::result(
20375            vips_op_response,
20376            VipsImage { ctx: out_out },
20377            Error::IccExportError,
20378        )
20379    }
20380}
20381
20382/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
20383/// inp: `&VipsImage` -> Input image
20384/// output_profile: `&str` -> Filename to load output profile from
20385/// returns `VipsImage` - Output image
20386pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
20387    unsafe {
20388        let inp_in: *mut bindings::VipsImage = inp.ctx;
20389        let output_profile_in: CString = utils::new_c_string(output_profile)?;
20390        let mut out_out: *mut bindings::VipsImage = null_mut();
20391
20392        let vips_op_response =
20393            bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
20394        utils::result(
20395            vips_op_response,
20396            VipsImage { ctx: out_out },
20397            Error::IccTransformError,
20398        )
20399    }
20400}
20401
20402/// Options for icc_transform operation
20403#[derive(Clone, Debug)]
20404pub struct IccTransformOptions {
20405    /// pcs: `PCS` -> Set Profile Connection Space
20406    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20407    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20408    ///  `Last` -> VIPS_PCS_LAST = 2
20409    pub pcs: PCS,
20410    /// intent: `Intent` -> Rendering intent
20411    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20412    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20413    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20414    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20415    ///  `Last` -> VIPS_INTENT_LAST = 4
20416    pub intent: Intent,
20417    /// black_point_compensation: `bool` -> Enable black point compensation
20418    /// default: false
20419    pub black_point_compensation: bool,
20420    /// embedded: `bool` -> Use embedded input profile, if available
20421    /// default: false
20422    pub embedded: bool,
20423    /// input_profile: `String` -> Filename to load input profile from
20424    pub input_profile: String,
20425    /// depth: `i32` -> Output device space depth in bits
20426    /// min: 8, max: 16, default: 8
20427    pub depth: i32,
20428}
20429
20430impl std::default::Default for IccTransformOptions {
20431    fn default() -> Self {
20432        IccTransformOptions {
20433            pcs: PCS::Lab,
20434            intent: Intent::Relative,
20435            black_point_compensation: false,
20436            embedded: false,
20437            input_profile: String::new(),
20438            depth: i32::from(8),
20439        }
20440    }
20441}
20442
20443/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
20444/// inp: `&VipsImage` -> Input image
20445/// output_profile: `&str` -> Filename to load output profile from
20446/// icc_transform_options: `&IccTransformOptions` -> optional arguments
20447/// returns `VipsImage` - Output image
20448pub fn icc_transform_with_opts(
20449    inp: &VipsImage,
20450    output_profile: &str,
20451    icc_transform_options: &IccTransformOptions,
20452) -> Result<VipsImage> {
20453    unsafe {
20454        let inp_in: *mut bindings::VipsImage = inp.ctx;
20455        let output_profile_in: CString = utils::new_c_string(output_profile)?;
20456        let mut out_out: *mut bindings::VipsImage = null_mut();
20457
20458        let pcs_in: i32 = icc_transform_options.pcs as i32;
20459        let pcs_in_name = utils::new_c_string("pcs")?;
20460
20461        let intent_in: i32 = icc_transform_options.intent as i32;
20462        let intent_in_name = utils::new_c_string("intent")?;
20463
20464        let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
20465            1
20466        } else {
20467            0
20468        };
20469        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20470
20471        let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
20472        let embedded_in_name = utils::new_c_string("embedded")?;
20473
20474        let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
20475        let input_profile_in_name = utils::new_c_string("input-profile")?;
20476
20477        let depth_in: i32 = icc_transform_options.depth;
20478        let depth_in_name = utils::new_c_string("depth")?;
20479
20480        let vips_op_response = bindings::vips_icc_transform(
20481            inp_in,
20482            &mut out_out,
20483            output_profile_in.as_ptr(),
20484            pcs_in_name.as_ptr(),
20485            pcs_in,
20486            intent_in_name.as_ptr(),
20487            intent_in,
20488            black_point_compensation_in_name.as_ptr(),
20489            black_point_compensation_in,
20490            embedded_in_name.as_ptr(),
20491            embedded_in,
20492            input_profile_in_name.as_ptr(),
20493            input_profile_in.as_ptr(),
20494            depth_in_name.as_ptr(),
20495            depth_in,
20496            NULL,
20497        );
20498        utils::result(
20499            vips_op_response,
20500            VipsImage { ctx: out_out },
20501            Error::IccTransformError,
20502        )
20503    }
20504}
20505
20506/// VipsdE76 (dE76), calculate dE76
20507/// left: `&VipsImage` -> Left-hand input image
20508/// right: `&VipsImage` -> Right-hand input image
20509/// returns `VipsImage` - Output image
20510pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20511    unsafe {
20512        let left_in: *mut bindings::VipsImage = left.ctx;
20513        let right_in: *mut bindings::VipsImage = right.ctx;
20514        let mut out_out: *mut bindings::VipsImage = null_mut();
20515
20516        let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
20517        utils::result(
20518            vips_op_response,
20519            VipsImage { ctx: out_out },
20520            Error::DE76Error,
20521        )
20522    }
20523}
20524
20525/// VipsdE00 (dE00), calculate dE00
20526/// left: `&VipsImage` -> Left-hand input image
20527/// right: `&VipsImage` -> Right-hand input image
20528/// returns `VipsImage` - Output image
20529pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20530    unsafe {
20531        let left_in: *mut bindings::VipsImage = left.ctx;
20532        let right_in: *mut bindings::VipsImage = right.ctx;
20533        let mut out_out: *mut bindings::VipsImage = null_mut();
20534
20535        let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
20536        utils::result(
20537            vips_op_response,
20538            VipsImage { ctx: out_out },
20539            Error::DE00Error,
20540        )
20541    }
20542}
20543
20544/// VipsdECMC (dECMC), calculate dECMC
20545/// left: `&VipsImage` -> Left-hand input image
20546/// right: `&VipsImage` -> Right-hand input image
20547/// returns `VipsImage` - Output image
20548pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20549    unsafe {
20550        let left_in: *mut bindings::VipsImage = left.ctx;
20551        let right_in: *mut bindings::VipsImage = right.ctx;
20552        let mut out_out: *mut bindings::VipsImage = null_mut();
20553
20554        let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
20555        utils::result(
20556            vips_op_response,
20557            VipsImage { ctx: out_out },
20558            Error::DEcmcError,
20559        )
20560    }
20561}
20562
20563/// VipssRGB2scRGB (sRGB2scRGB), convert an sRGB image to scRGB
20564/// inp: `&VipsImage` -> Input image
20565/// returns `VipsImage` - Output image
20566pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20567    unsafe {
20568        let inp_in: *mut bindings::VipsImage = inp.ctx;
20569        let mut out_out: *mut bindings::VipsImage = null_mut();
20570
20571        let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20572        utils::result(
20573            vips_op_response,
20574            VipsImage { ctx: out_out },
20575            Error::SRgb2ScRgbError,
20576        )
20577    }
20578}
20579
20580/// VipsscRGB2XYZ (scRGB2XYZ), transform scRGB to XYZ
20581/// inp: `&VipsImage` -> Input image
20582/// returns `VipsImage` - Output image
20583pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20584    unsafe {
20585        let inp_in: *mut bindings::VipsImage = inp.ctx;
20586        let mut out_out: *mut bindings::VipsImage = null_mut();
20587
20588        let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20589        utils::result(
20590            vips_op_response,
20591            VipsImage { ctx: out_out },
20592            Error::ScRgb2XyzError,
20593        )
20594    }
20595}
20596
20597/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20598/// inp: `&VipsImage` -> Input image
20599/// returns `VipsImage` - Output image
20600pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
20601    unsafe {
20602        let inp_in: *mut bindings::VipsImage = inp.ctx;
20603        let mut out_out: *mut bindings::VipsImage = null_mut();
20604
20605        let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
20606        utils::result(
20607            vips_op_response,
20608            VipsImage { ctx: out_out },
20609            Error::ScRgb2BwError,
20610        )
20611    }
20612}
20613
20614/// Options for sc_rgb2bw operation
20615#[derive(Clone, Debug)]
20616pub struct ScRgb2BwOptions {
20617    /// depth: `i32` -> Output device space depth in bits
20618    /// min: 8, max: 16, default: 8
20619    pub depth: i32,
20620}
20621
20622impl std::default::Default for ScRgb2BwOptions {
20623    fn default() -> Self {
20624        ScRgb2BwOptions {
20625            depth: i32::from(8),
20626        }
20627    }
20628}
20629
20630/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20631/// inp: `&VipsImage` -> Input image
20632/// sc_rgb2bw_options: `&ScRgb2BwOptions` -> optional arguments
20633/// returns `VipsImage` - Output image
20634pub fn sc_rgb2bw_with_opts(
20635    inp: &VipsImage,
20636    sc_rgb_2bw_options: &ScRgb2BwOptions,
20637) -> Result<VipsImage> {
20638    unsafe {
20639        let inp_in: *mut bindings::VipsImage = inp.ctx;
20640        let mut out_out: *mut bindings::VipsImage = null_mut();
20641
20642        let depth_in: i32 = sc_rgb_2bw_options.depth;
20643        let depth_in_name = utils::new_c_string("depth")?;
20644
20645        let vips_op_response =
20646            bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20647        utils::result(
20648            vips_op_response,
20649            VipsImage { ctx: out_out },
20650            Error::ScRgb2BwError,
20651        )
20652    }
20653}
20654
20655/// VipsXYZ2scRGB (XYZ2scRGB), transform XYZ to scRGB
20656/// inp: `&VipsImage` -> Input image
20657/// returns `VipsImage` - Output image
20658pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20659    unsafe {
20660        let inp_in: *mut bindings::VipsImage = inp.ctx;
20661        let mut out_out: *mut bindings::VipsImage = null_mut();
20662
20663        let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
20664        utils::result(
20665            vips_op_response,
20666            VipsImage { ctx: out_out },
20667            Error::Xyz2ScRgbError,
20668        )
20669    }
20670}
20671
20672/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
20673/// inp: `&VipsImage` -> Input image
20674/// returns `VipsImage` - Output image
20675pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20676    unsafe {
20677        let inp_in: *mut bindings::VipsImage = inp.ctx;
20678        let mut out_out: *mut bindings::VipsImage = null_mut();
20679
20680        let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
20681        utils::result(
20682            vips_op_response,
20683            VipsImage { ctx: out_out },
20684            Error::ScRgb2SRgbError,
20685        )
20686    }
20687}
20688
20689/// Options for sc_rgb_2s_rgb operation
20690#[derive(Clone, Debug)]
20691pub struct ScRgb2SRgbOptions {
20692    /// depth: `i32` -> Output device space depth in bits
20693    /// min: 8, max: 16, default: 8
20694    pub depth: i32,
20695}
20696
20697impl std::default::Default for ScRgb2SRgbOptions {
20698    fn default() -> Self {
20699        ScRgb2SRgbOptions {
20700            depth: i32::from(8),
20701        }
20702    }
20703}
20704
20705/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
20706/// inp: `&VipsImage` -> Input image
20707/// sc_rgb_2s_rgb_options: `&ScRgb2SRgbOptions` -> optional arguments
20708/// returns `VipsImage` - Output image
20709pub fn sc_rgb_2s_rgb_with_opts(
20710    inp: &VipsImage,
20711    sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
20712) -> Result<VipsImage> {
20713    unsafe {
20714        let inp_in: *mut bindings::VipsImage = inp.ctx;
20715        let mut out_out: *mut bindings::VipsImage = null_mut();
20716
20717        let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
20718        let depth_in_name = utils::new_c_string("depth")?;
20719
20720        let vips_op_response =
20721            bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20722        utils::result(
20723            vips_op_response,
20724            VipsImage { ctx: out_out },
20725            Error::ScRgb2SRgbError,
20726        )
20727    }
20728}
20729
20730/// VipsCMYK2XYZ (CMYK2XYZ), transform CMYK to XYZ
20731/// inp: `&VipsImage` -> Input image
20732/// returns `VipsImage` - Output image
20733pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
20734    unsafe {
20735        let inp_in: *mut bindings::VipsImage = inp.ctx;
20736        let mut out_out: *mut bindings::VipsImage = null_mut();
20737
20738        let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
20739        utils::result(
20740            vips_op_response,
20741            VipsImage { ctx: out_out },
20742            Error::Cmyk2XyzError,
20743        )
20744    }
20745}
20746
20747/// VipsXYZ2CMYK (XYZ2CMYK), transform XYZ to CMYK
20748/// inp: `&VipsImage` -> Input image
20749/// returns `VipsImage` - Output image
20750pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
20751    unsafe {
20752        let inp_in: *mut bindings::VipsImage = inp.ctx;
20753        let mut out_out: *mut bindings::VipsImage = null_mut();
20754
20755        let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
20756        utils::result(
20757            vips_op_response,
20758            VipsImage { ctx: out_out },
20759            Error::Xyz2CmykError,
20760        )
20761    }
20762}
20763
20764/// VipsProfileLoad (profile_load), load named ICC profile
20765/// name: `&str` -> Profile name
20766/// returns `Vec<u8>` - Loaded profile
20767pub fn profile_load(name: &str) -> Result<Vec<u8>> {
20768    unsafe {
20769        let name_in: CString = utils::new_c_string(name)?;
20770        let mut profile_out: *mut bindings::VipsBlob = null_mut();
20771
20772        let vips_op_response =
20773            bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
20774        utils::result(
20775            vips_op_response,
20776            VipsBlob { ctx: profile_out }.into(),
20777            Error::ProfileLoadError,
20778        )
20779    }
20780}
20781
20782/// VipsMaplut (maplut), map an image though a lut
20783/// inp: `&VipsImage` -> Input image
20784/// lut: `&VipsImage` -> Look-up table image
20785/// returns `VipsImage` - Output image
20786pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
20787    unsafe {
20788        let inp_in: *mut bindings::VipsImage = inp.ctx;
20789        let lut_in: *mut bindings::VipsImage = lut.ctx;
20790        let mut out_out: *mut bindings::VipsImage = null_mut();
20791
20792        let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
20793        utils::result(
20794            vips_op_response,
20795            VipsImage { ctx: out_out },
20796            Error::MaplutError,
20797        )
20798    }
20799}
20800
20801/// Options for maplut operation
20802#[derive(Clone, Debug)]
20803pub struct MaplutOptions {
20804    /// band: `i32` -> Apply one-band lut to this band of in
20805    /// min: -1, max: 10000, default: -1
20806    pub band: i32,
20807}
20808
20809impl std::default::Default for MaplutOptions {
20810    fn default() -> Self {
20811        MaplutOptions {
20812            band: i32::from(-1),
20813        }
20814    }
20815}
20816
20817/// VipsMaplut (maplut), map an image though a lut
20818/// inp: `&VipsImage` -> Input image
20819/// lut: `&VipsImage` -> Look-up table image
20820/// maplut_options: `&MaplutOptions` -> optional arguments
20821/// returns `VipsImage` - Output image
20822pub fn maplut_with_opts(
20823    inp: &VipsImage,
20824    lut: &VipsImage,
20825    maplut_options: &MaplutOptions,
20826) -> Result<VipsImage> {
20827    unsafe {
20828        let inp_in: *mut bindings::VipsImage = inp.ctx;
20829        let lut_in: *mut bindings::VipsImage = lut.ctx;
20830        let mut out_out: *mut bindings::VipsImage = null_mut();
20831
20832        let band_in: i32 = maplut_options.band;
20833        let band_in_name = utils::new_c_string("band")?;
20834
20835        let vips_op_response = bindings::vips_maplut(
20836            inp_in,
20837            &mut out_out,
20838            lut_in,
20839            band_in_name.as_ptr(),
20840            band_in,
20841            NULL,
20842        );
20843        utils::result(
20844            vips_op_response,
20845            VipsImage { ctx: out_out },
20846            Error::MaplutError,
20847        )
20848    }
20849}
20850
20851/// VipsPercent (percent), find threshold for percent of pixels
20852/// inp: `&VipsImage` -> Input image
20853/// percent: `f64` -> Percent of pixels
20854/// min: 0, max: 100, default: 50
20855/// returns `i32` - Threshold above which lie percent of pixels
20856pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
20857    unsafe {
20858        let inp_in: *mut bindings::VipsImage = inp.ctx;
20859        let percent_in: f64 = percent;
20860        let mut threshold_out: i32 = i32::from(0);
20861
20862        let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
20863        utils::result(vips_op_response, threshold_out, Error::PercentError)
20864    }
20865}
20866
20867/// VipsStdif (stdif), statistical difference
20868/// inp: `&VipsImage` -> Input image
20869/// width: `i32` -> Window width in pixels
20870/// min: 1, max: 256, default: 11
20871/// height: `i32` -> Window height in pixels
20872/// min: 1, max: 256, default: 11
20873/// returns `VipsImage` - Output image
20874pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
20875    unsafe {
20876        let inp_in: *mut bindings::VipsImage = inp.ctx;
20877        let width_in: i32 = width;
20878        let height_in: i32 = height;
20879        let mut out_out: *mut bindings::VipsImage = null_mut();
20880
20881        let vips_op_response =
20882            bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
20883        utils::result(
20884            vips_op_response,
20885            VipsImage { ctx: out_out },
20886            Error::StdifError,
20887        )
20888    }
20889}
20890
20891/// Options for stdif operation
20892#[derive(Clone, Debug)]
20893pub struct StdifOptions {
20894    /// s_0: `f64` -> New deviation
20895    /// min: -inf, max: inf, default: 50
20896    pub s_0: f64,
20897    /// b: `f64` -> Weight of new deviation
20898    /// min: 0, max: 2, default: 0.5
20899    pub b: f64,
20900    /// m_0: `f64` -> New mean
20901    /// min: -inf, max: inf, default: 128
20902    pub m_0: f64,
20903    /// a: `f64` -> Weight of new mean
20904    /// min: 0, max: 1, default: 0.5
20905    pub a: f64,
20906}
20907
20908impl std::default::Default for StdifOptions {
20909    fn default() -> Self {
20910        StdifOptions {
20911            s_0: f64::from(50),
20912            b: f64::from(0.5),
20913            m_0: f64::from(128),
20914            a: f64::from(0.5),
20915        }
20916    }
20917}
20918
20919/// VipsStdif (stdif), statistical difference
20920/// inp: `&VipsImage` -> Input image
20921/// width: `i32` -> Window width in pixels
20922/// min: 1, max: 256, default: 11
20923/// height: `i32` -> Window height in pixels
20924/// min: 1, max: 256, default: 11
20925/// stdif_options: `&StdifOptions` -> optional arguments
20926/// returns `VipsImage` - Output image
20927pub fn stdif_with_opts(
20928    inp: &VipsImage,
20929    width: i32,
20930    height: i32,
20931    stdif_options: &StdifOptions,
20932) -> Result<VipsImage> {
20933    unsafe {
20934        let inp_in: *mut bindings::VipsImage = inp.ctx;
20935        let width_in: i32 = width;
20936        let height_in: i32 = height;
20937        let mut out_out: *mut bindings::VipsImage = null_mut();
20938
20939        let s_0_in: f64 = stdif_options.s_0;
20940        let s_0_in_name = utils::new_c_string("s0")?;
20941
20942        let b_in: f64 = stdif_options.b;
20943        let b_in_name = utils::new_c_string("b")?;
20944
20945        let m_0_in: f64 = stdif_options.m_0;
20946        let m_0_in_name = utils::new_c_string("m0")?;
20947
20948        let a_in: f64 = stdif_options.a;
20949        let a_in_name = utils::new_c_string("a")?;
20950
20951        let vips_op_response = bindings::vips_stdif(
20952            inp_in,
20953            &mut out_out,
20954            width_in,
20955            height_in,
20956            s_0_in_name.as_ptr(),
20957            s_0_in,
20958            b_in_name.as_ptr(),
20959            b_in,
20960            m_0_in_name.as_ptr(),
20961            m_0_in,
20962            a_in_name.as_ptr(),
20963            a_in,
20964            NULL,
20965        );
20966        utils::result(
20967            vips_op_response,
20968            VipsImage { ctx: out_out },
20969            Error::StdifError,
20970        )
20971    }
20972}
20973
20974/// VipsHistCum (hist_cum), form cumulative histogram
20975/// inp: `&VipsImage` -> Input image
20976/// returns `VipsImage` - Output image
20977pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
20978    unsafe {
20979        let inp_in: *mut bindings::VipsImage = inp.ctx;
20980        let mut out_out: *mut bindings::VipsImage = null_mut();
20981
20982        let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
20983        utils::result(
20984            vips_op_response,
20985            VipsImage { ctx: out_out },
20986            Error::HistCumError,
20987        )
20988    }
20989}
20990
20991/// VipsHistMatch (hist_match), match two histograms
20992/// inp: `&VipsImage` -> Input histogram
20993/// refp: `&VipsImage` -> Reference histogram
20994/// returns `VipsImage` - Output image
20995pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
20996    unsafe {
20997        let inp_in: *mut bindings::VipsImage = inp.ctx;
20998        let refp_in: *mut bindings::VipsImage = refp.ctx;
20999        let mut out_out: *mut bindings::VipsImage = null_mut();
21000
21001        let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21002        utils::result(
21003            vips_op_response,
21004            VipsImage { ctx: out_out },
21005            Error::HistMatchError,
21006        )
21007    }
21008}
21009
21010/// VipsHistNorm (hist_norm), normalise histogram
21011/// inp: `&VipsImage` -> Input image
21012/// returns `VipsImage` - Output image
21013pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21014    unsafe {
21015        let inp_in: *mut bindings::VipsImage = inp.ctx;
21016        let mut out_out: *mut bindings::VipsImage = null_mut();
21017
21018        let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21019        utils::result(
21020            vips_op_response,
21021            VipsImage { ctx: out_out },
21022            Error::HistNormError,
21023        )
21024    }
21025}
21026
21027/// VipsHistEqual (hist_equal), histogram equalisation
21028/// inp: `&VipsImage` -> Input image
21029/// returns `VipsImage` - Output image
21030pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21031    unsafe {
21032        let inp_in: *mut bindings::VipsImage = inp.ctx;
21033        let mut out_out: *mut bindings::VipsImage = null_mut();
21034
21035        let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21036        utils::result(
21037            vips_op_response,
21038            VipsImage { ctx: out_out },
21039            Error::HistEqualError,
21040        )
21041    }
21042}
21043
21044/// Options for hist_equal operation
21045#[derive(Clone, Debug)]
21046pub struct HistEqualOptions {
21047    /// band: `i32` -> Equalise with this band
21048    /// min: -1, max: 100000, default: -1
21049    pub band: i32,
21050}
21051
21052impl std::default::Default for HistEqualOptions {
21053    fn default() -> Self {
21054        HistEqualOptions {
21055            band: i32::from(-1),
21056        }
21057    }
21058}
21059
21060/// VipsHistEqual (hist_equal), histogram equalisation
21061/// inp: `&VipsImage` -> Input image
21062/// hist_equal_options: `&HistEqualOptions` -> optional arguments
21063/// returns `VipsImage` - Output image
21064pub fn hist_equal_with_opts(
21065    inp: &VipsImage,
21066    hist_equal_options: &HistEqualOptions,
21067) -> Result<VipsImage> {
21068    unsafe {
21069        let inp_in: *mut bindings::VipsImage = inp.ctx;
21070        let mut out_out: *mut bindings::VipsImage = null_mut();
21071
21072        let band_in: i32 = hist_equal_options.band;
21073        let band_in_name = utils::new_c_string("band")?;
21074
21075        let vips_op_response =
21076            bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21077        utils::result(
21078            vips_op_response,
21079            VipsImage { ctx: out_out },
21080            Error::HistEqualError,
21081        )
21082    }
21083}
21084
21085/// VipsHistPlot (hist_plot), plot histogram
21086/// inp: `&VipsImage` -> Input image
21087/// returns `VipsImage` - Output image
21088pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21089    unsafe {
21090        let inp_in: *mut bindings::VipsImage = inp.ctx;
21091        let mut out_out: *mut bindings::VipsImage = null_mut();
21092
21093        let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21094        utils::result(
21095            vips_op_response,
21096            VipsImage { ctx: out_out },
21097            Error::HistPlotError,
21098        )
21099    }
21100}
21101
21102/// VipsHistLocal (hist_local), local histogram equalisation
21103/// inp: `&VipsImage` -> Input image
21104/// width: `i32` -> Window width in pixels
21105/// min: 1, max: 10000000, default: 1
21106/// height: `i32` -> Window height in pixels
21107/// min: 1, max: 10000000, default: 1
21108/// returns `VipsImage` - Output image
21109pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21110    unsafe {
21111        let inp_in: *mut bindings::VipsImage = inp.ctx;
21112        let width_in: i32 = width;
21113        let height_in: i32 = height;
21114        let mut out_out: *mut bindings::VipsImage = null_mut();
21115
21116        let vips_op_response =
21117            bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21118        utils::result(
21119            vips_op_response,
21120            VipsImage { ctx: out_out },
21121            Error::HistLocalError,
21122        )
21123    }
21124}
21125
21126/// Options for hist_local operation
21127#[derive(Clone, Debug)]
21128pub struct HistLocalOptions {
21129    /// max_slope: `i32` -> Maximum slope (CLAHE)
21130    /// min: 0, max: 100, default: 0
21131    pub max_slope: i32,
21132}
21133
21134impl std::default::Default for HistLocalOptions {
21135    fn default() -> Self {
21136        HistLocalOptions {
21137            max_slope: i32::from(0),
21138        }
21139    }
21140}
21141
21142/// VipsHistLocal (hist_local), local histogram equalisation
21143/// inp: `&VipsImage` -> Input image
21144/// width: `i32` -> Window width in pixels
21145/// min: 1, max: 10000000, default: 1
21146/// height: `i32` -> Window height in pixels
21147/// min: 1, max: 10000000, default: 1
21148/// hist_local_options: `&HistLocalOptions` -> optional arguments
21149/// returns `VipsImage` - Output image
21150pub fn hist_local_with_opts(
21151    inp: &VipsImage,
21152    width: i32,
21153    height: i32,
21154    hist_local_options: &HistLocalOptions,
21155) -> Result<VipsImage> {
21156    unsafe {
21157        let inp_in: *mut bindings::VipsImage = inp.ctx;
21158        let width_in: i32 = width;
21159        let height_in: i32 = height;
21160        let mut out_out: *mut bindings::VipsImage = null_mut();
21161
21162        let max_slope_in: i32 = hist_local_options.max_slope;
21163        let max_slope_in_name = utils::new_c_string("max-slope")?;
21164
21165        let vips_op_response = bindings::vips_hist_local(
21166            inp_in,
21167            &mut out_out,
21168            width_in,
21169            height_in,
21170            max_slope_in_name.as_ptr(),
21171            max_slope_in,
21172            NULL,
21173        );
21174        utils::result(
21175            vips_op_response,
21176            VipsImage { ctx: out_out },
21177            Error::HistLocalError,
21178        )
21179    }
21180}
21181
21182/// VipsHistIsmonotonic (hist_ismonotonic), test for monotonicity
21183/// inp: `&VipsImage` -> Input histogram image
21184/// returns `bool` - true if in is monotonic
21185pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21186    unsafe {
21187        let inp_in: *mut bindings::VipsImage = inp.ctx;
21188        let mut monotonic_out: i32 = 0;
21189
21190        let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21191        utils::result(
21192            vips_op_response,
21193            monotonic_out != 0,
21194            Error::HistIsmonotonicError,
21195        )
21196    }
21197}
21198
21199/// VipsHistEntropy (hist_entropy), estimate image entropy
21200/// inp: `&VipsImage` -> Input histogram image
21201/// returns `f64` - Output value
21202pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21203    unsafe {
21204        let inp_in: *mut bindings::VipsImage = inp.ctx;
21205        let mut out_out: f64 = f64::from(0);
21206
21207        let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21208        utils::result(vips_op_response, out_out, Error::HistEntropyError)
21209    }
21210}
21211
21212/// VipsConv (conv), convolution operation
21213/// inp: `&VipsImage` -> Input image argument
21214/// mask: `&VipsImage` -> Input matrix image
21215/// returns `VipsImage` - Output image
21216pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21217    unsafe {
21218        let inp_in: *mut bindings::VipsImage = inp.ctx;
21219        let mask_in: *mut bindings::VipsImage = mask.ctx;
21220        let mut out_out: *mut bindings::VipsImage = null_mut();
21221
21222        let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21223        utils::result(
21224            vips_op_response,
21225            VipsImage { ctx: out_out },
21226            Error::ConvError,
21227        )
21228    }
21229}
21230
21231/// Options for conv operation
21232#[derive(Clone, Debug)]
21233pub struct ConvOptions {
21234    /// precision: `Precision` -> Convolve with this precision
21235    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21236    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21237    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21238    ///  `Last` -> VIPS_PRECISION_LAST = 3
21239    pub precision: Precision,
21240    /// layers: `i32` -> Use this many layers in approximation
21241    /// min: 1, max: 1000, default: 5
21242    pub layers: i32,
21243    /// cluster: `i32` -> Cluster lines closer than this in approximation
21244    /// min: 1, max: 100, default: 1
21245    pub cluster: i32,
21246}
21247
21248impl std::default::Default for ConvOptions {
21249    fn default() -> Self {
21250        ConvOptions {
21251            precision: Precision::Float,
21252            layers: i32::from(5),
21253            cluster: i32::from(1),
21254        }
21255    }
21256}
21257
21258/// VipsConv (conv), convolution operation
21259/// inp: `&VipsImage` -> Input image argument
21260/// mask: `&VipsImage` -> Input matrix image
21261/// conv_options: `&ConvOptions` -> optional arguments
21262/// returns `VipsImage` - Output image
21263pub fn conv_with_opts(
21264    inp: &VipsImage,
21265    mask: &VipsImage,
21266    conv_options: &ConvOptions,
21267) -> Result<VipsImage> {
21268    unsafe {
21269        let inp_in: *mut bindings::VipsImage = inp.ctx;
21270        let mask_in: *mut bindings::VipsImage = mask.ctx;
21271        let mut out_out: *mut bindings::VipsImage = null_mut();
21272
21273        let precision_in: i32 = conv_options.precision as i32;
21274        let precision_in_name = utils::new_c_string("precision")?;
21275
21276        let layers_in: i32 = conv_options.layers;
21277        let layers_in_name = utils::new_c_string("layers")?;
21278
21279        let cluster_in: i32 = conv_options.cluster;
21280        let cluster_in_name = utils::new_c_string("cluster")?;
21281
21282        let vips_op_response = bindings::vips_conv(
21283            inp_in,
21284            &mut out_out,
21285            mask_in,
21286            precision_in_name.as_ptr(),
21287            precision_in,
21288            layers_in_name.as_ptr(),
21289            layers_in,
21290            cluster_in_name.as_ptr(),
21291            cluster_in,
21292            NULL,
21293        );
21294        utils::result(
21295            vips_op_response,
21296            VipsImage { ctx: out_out },
21297            Error::ConvError,
21298        )
21299    }
21300}
21301
21302/// VipsConva (conva), approximate integer convolution
21303/// inp: `&VipsImage` -> Input image argument
21304/// mask: `&VipsImage` -> Input matrix image
21305/// returns `VipsImage` - Output image
21306pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21307    unsafe {
21308        let inp_in: *mut bindings::VipsImage = inp.ctx;
21309        let mask_in: *mut bindings::VipsImage = mask.ctx;
21310        let mut out_out: *mut bindings::VipsImage = null_mut();
21311
21312        let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21313        utils::result(
21314            vips_op_response,
21315            VipsImage { ctx: out_out },
21316            Error::ConvaError,
21317        )
21318    }
21319}
21320
21321/// Options for conva operation
21322#[derive(Clone, Debug)]
21323pub struct ConvaOptions {
21324    /// layers: `i32` -> Use this many layers in approximation
21325    /// min: 1, max: 1000, default: 5
21326    pub layers: i32,
21327    /// cluster: `i32` -> Cluster lines closer than this in approximation
21328    /// min: 1, max: 100, default: 1
21329    pub cluster: i32,
21330}
21331
21332impl std::default::Default for ConvaOptions {
21333    fn default() -> Self {
21334        ConvaOptions {
21335            layers: i32::from(5),
21336            cluster: i32::from(1),
21337        }
21338    }
21339}
21340
21341/// VipsConva (conva), approximate integer convolution
21342/// inp: `&VipsImage` -> Input image argument
21343/// mask: `&VipsImage` -> Input matrix image
21344/// conva_options: `&ConvaOptions` -> optional arguments
21345/// returns `VipsImage` - Output image
21346pub fn conva_with_opts(
21347    inp: &VipsImage,
21348    mask: &VipsImage,
21349    conva_options: &ConvaOptions,
21350) -> Result<VipsImage> {
21351    unsafe {
21352        let inp_in: *mut bindings::VipsImage = inp.ctx;
21353        let mask_in: *mut bindings::VipsImage = mask.ctx;
21354        let mut out_out: *mut bindings::VipsImage = null_mut();
21355
21356        let layers_in: i32 = conva_options.layers;
21357        let layers_in_name = utils::new_c_string("layers")?;
21358
21359        let cluster_in: i32 = conva_options.cluster;
21360        let cluster_in_name = utils::new_c_string("cluster")?;
21361
21362        let vips_op_response = bindings::vips_conva(
21363            inp_in,
21364            &mut out_out,
21365            mask_in,
21366            layers_in_name.as_ptr(),
21367            layers_in,
21368            cluster_in_name.as_ptr(),
21369            cluster_in,
21370            NULL,
21371        );
21372        utils::result(
21373            vips_op_response,
21374            VipsImage { ctx: out_out },
21375            Error::ConvaError,
21376        )
21377    }
21378}
21379
21380/// VipsConvf (convf), float convolution operation
21381/// inp: `&VipsImage` -> Input image argument
21382/// mask: `&VipsImage` -> Input matrix image
21383/// returns `VipsImage` - Output image
21384pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21385    unsafe {
21386        let inp_in: *mut bindings::VipsImage = inp.ctx;
21387        let mask_in: *mut bindings::VipsImage = mask.ctx;
21388        let mut out_out: *mut bindings::VipsImage = null_mut();
21389
21390        let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
21391        utils::result(
21392            vips_op_response,
21393            VipsImage { ctx: out_out },
21394            Error::ConvfError,
21395        )
21396    }
21397}
21398
21399/// VipsConvi (convi), int convolution operation
21400/// inp: `&VipsImage` -> Input image argument
21401/// mask: `&VipsImage` -> Input matrix image
21402/// returns `VipsImage` - Output image
21403pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21404    unsafe {
21405        let inp_in: *mut bindings::VipsImage = inp.ctx;
21406        let mask_in: *mut bindings::VipsImage = mask.ctx;
21407        let mut out_out: *mut bindings::VipsImage = null_mut();
21408
21409        let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
21410        utils::result(
21411            vips_op_response,
21412            VipsImage { ctx: out_out },
21413            Error::ConviError,
21414        )
21415    }
21416}
21417
21418/// VipsCompass (compass), convolve with rotating mask
21419/// inp: `&VipsImage` -> Input image argument
21420/// mask: `&VipsImage` -> Input matrix image
21421/// returns `VipsImage` - Output image
21422pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21423    unsafe {
21424        let inp_in: *mut bindings::VipsImage = inp.ctx;
21425        let mask_in: *mut bindings::VipsImage = mask.ctx;
21426        let mut out_out: *mut bindings::VipsImage = null_mut();
21427
21428        let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
21429        utils::result(
21430            vips_op_response,
21431            VipsImage { ctx: out_out },
21432            Error::CompassError,
21433        )
21434    }
21435}
21436
21437/// Options for compass operation
21438#[derive(Clone, Debug)]
21439pub struct CompassOptions {
21440    /// times: `i32` -> Rotate and convolve this many times
21441    /// min: 1, max: 1000, default: 2
21442    pub times: i32,
21443    /// angle: `Angle45` -> Rotate mask by this much between convolutions
21444    ///  `D0` -> VIPS_ANGLE45_D0 = 0
21445    ///  `D45` -> VIPS_ANGLE45_D45 = 1
21446    ///  `D90` -> VIPS_ANGLE45_D90 = 2 [DEFAULT]
21447    ///  `D135` -> VIPS_ANGLE45_D135 = 3
21448    ///  `D180` -> VIPS_ANGLE45_D180 = 4
21449    ///  `D225` -> VIPS_ANGLE45_D225 = 5
21450    ///  `D270` -> VIPS_ANGLE45_D270 = 6
21451    ///  `D315` -> VIPS_ANGLE45_D315 = 7
21452    ///  `Last` -> VIPS_ANGLE45_LAST = 8
21453    pub angle: Angle45,
21454    /// combine: `Combine` -> Combine convolution results like this
21455    ///  `Max` -> VIPS_COMBINE_MAX = 0 [DEFAULT]
21456    ///  `Sum` -> VIPS_COMBINE_SUM = 1
21457    ///  `Min` -> VIPS_COMBINE_MIN = 2
21458    ///  `Last` -> VIPS_COMBINE_LAST = 3
21459    pub combine: Combine,
21460    /// precision: `Precision` -> Convolve with this precision
21461    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21462    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21463    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21464    ///  `Last` -> VIPS_PRECISION_LAST = 3
21465    pub precision: Precision,
21466    /// layers: `i32` -> Use this many layers in approximation
21467    /// min: 1, max: 1000, default: 5
21468    pub layers: i32,
21469    /// cluster: `i32` -> Cluster lines closer than this in approximation
21470    /// min: 1, max: 100, default: 1
21471    pub cluster: i32,
21472}
21473
21474impl std::default::Default for CompassOptions {
21475    fn default() -> Self {
21476        CompassOptions {
21477            times: i32::from(2),
21478            angle: Angle45::D90,
21479            combine: Combine::Max,
21480            precision: Precision::Float,
21481            layers: i32::from(5),
21482            cluster: i32::from(1),
21483        }
21484    }
21485}
21486
21487/// VipsCompass (compass), convolve with rotating mask
21488/// inp: `&VipsImage` -> Input image argument
21489/// mask: `&VipsImage` -> Input matrix image
21490/// compass_options: `&CompassOptions` -> optional arguments
21491/// returns `VipsImage` - Output image
21492pub fn compass_with_opts(
21493    inp: &VipsImage,
21494    mask: &VipsImage,
21495    compass_options: &CompassOptions,
21496) -> Result<VipsImage> {
21497    unsafe {
21498        let inp_in: *mut bindings::VipsImage = inp.ctx;
21499        let mask_in: *mut bindings::VipsImage = mask.ctx;
21500        let mut out_out: *mut bindings::VipsImage = null_mut();
21501
21502        let times_in: i32 = compass_options.times;
21503        let times_in_name = utils::new_c_string("times")?;
21504
21505        let angle_in: i32 = compass_options.angle as i32;
21506        let angle_in_name = utils::new_c_string("angle")?;
21507
21508        let combine_in: i32 = compass_options.combine as i32;
21509        let combine_in_name = utils::new_c_string("combine")?;
21510
21511        let precision_in: i32 = compass_options.precision as i32;
21512        let precision_in_name = utils::new_c_string("precision")?;
21513
21514        let layers_in: i32 = compass_options.layers;
21515        let layers_in_name = utils::new_c_string("layers")?;
21516
21517        let cluster_in: i32 = compass_options.cluster;
21518        let cluster_in_name = utils::new_c_string("cluster")?;
21519
21520        let vips_op_response = bindings::vips_compass(
21521            inp_in,
21522            &mut out_out,
21523            mask_in,
21524            times_in_name.as_ptr(),
21525            times_in,
21526            angle_in_name.as_ptr(),
21527            angle_in,
21528            combine_in_name.as_ptr(),
21529            combine_in,
21530            precision_in_name.as_ptr(),
21531            precision_in,
21532            layers_in_name.as_ptr(),
21533            layers_in,
21534            cluster_in_name.as_ptr(),
21535            cluster_in,
21536            NULL,
21537        );
21538        utils::result(
21539            vips_op_response,
21540            VipsImage { ctx: out_out },
21541            Error::CompassError,
21542        )
21543    }
21544}
21545
21546/// VipsConvsep (convsep), separable convolution operation
21547/// inp: `&VipsImage` -> Input image argument
21548/// mask: `&VipsImage` -> Input matrix image
21549/// returns `VipsImage` - Output image
21550pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21551    unsafe {
21552        let inp_in: *mut bindings::VipsImage = inp.ctx;
21553        let mask_in: *mut bindings::VipsImage = mask.ctx;
21554        let mut out_out: *mut bindings::VipsImage = null_mut();
21555
21556        let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
21557        utils::result(
21558            vips_op_response,
21559            VipsImage { ctx: out_out },
21560            Error::ConvsepError,
21561        )
21562    }
21563}
21564
21565/// Options for convsep operation
21566#[derive(Clone, Debug)]
21567pub struct ConvsepOptions {
21568    /// precision: `Precision` -> Convolve with this precision
21569    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21570    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21571    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21572    ///  `Last` -> VIPS_PRECISION_LAST = 3
21573    pub precision: Precision,
21574    /// layers: `i32` -> Use this many layers in approximation
21575    /// min: 1, max: 1000, default: 5
21576    pub layers: i32,
21577    /// cluster: `i32` -> Cluster lines closer than this in approximation
21578    /// min: 1, max: 100, default: 1
21579    pub cluster: i32,
21580}
21581
21582impl std::default::Default for ConvsepOptions {
21583    fn default() -> Self {
21584        ConvsepOptions {
21585            precision: Precision::Float,
21586            layers: i32::from(5),
21587            cluster: i32::from(1),
21588        }
21589    }
21590}
21591
21592/// VipsConvsep (convsep), separable convolution operation
21593/// inp: `&VipsImage` -> Input image argument
21594/// mask: `&VipsImage` -> Input matrix image
21595/// convsep_options: `&ConvsepOptions` -> optional arguments
21596/// returns `VipsImage` - Output image
21597pub fn convsep_with_opts(
21598    inp: &VipsImage,
21599    mask: &VipsImage,
21600    convsep_options: &ConvsepOptions,
21601) -> Result<VipsImage> {
21602    unsafe {
21603        let inp_in: *mut bindings::VipsImage = inp.ctx;
21604        let mask_in: *mut bindings::VipsImage = mask.ctx;
21605        let mut out_out: *mut bindings::VipsImage = null_mut();
21606
21607        let precision_in: i32 = convsep_options.precision as i32;
21608        let precision_in_name = utils::new_c_string("precision")?;
21609
21610        let layers_in: i32 = convsep_options.layers;
21611        let layers_in_name = utils::new_c_string("layers")?;
21612
21613        let cluster_in: i32 = convsep_options.cluster;
21614        let cluster_in_name = utils::new_c_string("cluster")?;
21615
21616        let vips_op_response = bindings::vips_convsep(
21617            inp_in,
21618            &mut out_out,
21619            mask_in,
21620            precision_in_name.as_ptr(),
21621            precision_in,
21622            layers_in_name.as_ptr(),
21623            layers_in,
21624            cluster_in_name.as_ptr(),
21625            cluster_in,
21626            NULL,
21627        );
21628        utils::result(
21629            vips_op_response,
21630            VipsImage { ctx: out_out },
21631            Error::ConvsepError,
21632        )
21633    }
21634}
21635
21636/// VipsConvasep (convasep), approximate separable integer convolution
21637/// inp: `&VipsImage` -> Input image argument
21638/// mask: `&VipsImage` -> Input matrix image
21639/// returns `VipsImage` - Output image
21640pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21641    unsafe {
21642        let inp_in: *mut bindings::VipsImage = inp.ctx;
21643        let mask_in: *mut bindings::VipsImage = mask.ctx;
21644        let mut out_out: *mut bindings::VipsImage = null_mut();
21645
21646        let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
21647        utils::result(
21648            vips_op_response,
21649            VipsImage { ctx: out_out },
21650            Error::ConvasepError,
21651        )
21652    }
21653}
21654
21655/// Options for convasep operation
21656#[derive(Clone, Debug)]
21657pub struct ConvasepOptions {
21658    /// layers: `i32` -> Use this many layers in approximation
21659    /// min: 1, max: 1000, default: 5
21660    pub layers: i32,
21661}
21662
21663impl std::default::Default for ConvasepOptions {
21664    fn default() -> Self {
21665        ConvasepOptions {
21666            layers: i32::from(5),
21667        }
21668    }
21669}
21670
21671/// VipsConvasep (convasep), approximate separable integer convolution
21672/// inp: `&VipsImage` -> Input image argument
21673/// mask: `&VipsImage` -> Input matrix image
21674/// convasep_options: `&ConvasepOptions` -> optional arguments
21675/// returns `VipsImage` - Output image
21676pub fn convasep_with_opts(
21677    inp: &VipsImage,
21678    mask: &VipsImage,
21679    convasep_options: &ConvasepOptions,
21680) -> Result<VipsImage> {
21681    unsafe {
21682        let inp_in: *mut bindings::VipsImage = inp.ctx;
21683        let mask_in: *mut bindings::VipsImage = mask.ctx;
21684        let mut out_out: *mut bindings::VipsImage = null_mut();
21685
21686        let layers_in: i32 = convasep_options.layers;
21687        let layers_in_name = utils::new_c_string("layers")?;
21688
21689        let vips_op_response = bindings::vips_convasep(
21690            inp_in,
21691            &mut out_out,
21692            mask_in,
21693            layers_in_name.as_ptr(),
21694            layers_in,
21695            NULL,
21696        );
21697        utils::result(
21698            vips_op_response,
21699            VipsImage { ctx: out_out },
21700            Error::ConvasepError,
21701        )
21702    }
21703}
21704
21705/// VipsFastcor (fastcor), fast correlation
21706/// inp: `&VipsImage` -> Input image argument
21707/// refp: `&VipsImage` -> Input reference image
21708/// returns `VipsImage` - Output image
21709pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21710    unsafe {
21711        let inp_in: *mut bindings::VipsImage = inp.ctx;
21712        let refp_in: *mut bindings::VipsImage = refp.ctx;
21713        let mut out_out: *mut bindings::VipsImage = null_mut();
21714
21715        let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
21716        utils::result(
21717            vips_op_response,
21718            VipsImage { ctx: out_out },
21719            Error::FastcorError,
21720        )
21721    }
21722}
21723
21724/// VipsSpcor (spcor), spatial correlation
21725/// inp: `&VipsImage` -> Input image argument
21726/// refp: `&VipsImage` -> Input reference image
21727/// returns `VipsImage` - Output image
21728pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21729    unsafe {
21730        let inp_in: *mut bindings::VipsImage = inp.ctx;
21731        let refp_in: *mut bindings::VipsImage = refp.ctx;
21732        let mut out_out: *mut bindings::VipsImage = null_mut();
21733
21734        let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
21735        utils::result(
21736            vips_op_response,
21737            VipsImage { ctx: out_out },
21738            Error::SpcorError,
21739        )
21740    }
21741}
21742
21743/// VipsSharpen (sharpen), unsharp masking for print
21744/// inp: `&VipsImage` -> Input image
21745/// returns `VipsImage` - Output image
21746pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
21747    unsafe {
21748        let inp_in: *mut bindings::VipsImage = inp.ctx;
21749        let mut out_out: *mut bindings::VipsImage = null_mut();
21750
21751        let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
21752        utils::result(
21753            vips_op_response,
21754            VipsImage { ctx: out_out },
21755            Error::SharpenError,
21756        )
21757    }
21758}
21759
21760/// Options for sharpen operation
21761#[derive(Clone, Debug)]
21762pub struct SharpenOptions {
21763    /// sigma: `f64` -> Sigma of Gaussian
21764    /// min: 0.000001, max: 10, default: 0.5
21765    pub sigma: f64,
21766    /// x_1: `f64` -> Flat/jaggy threshold
21767    /// min: 0, max: 1000000, default: 2
21768    pub x_1: f64,
21769    /// y_2: `f64` -> Maximum brightening
21770    /// min: 0, max: 1000000, default: 10
21771    pub y_2: f64,
21772    /// y_3: `f64` -> Maximum darkening
21773    /// min: 0, max: 1000000, default: 20
21774    pub y_3: f64,
21775    /// m_1: `f64` -> Slope for flat areas
21776    /// min: 0, max: 1000000, default: 0
21777    pub m_1: f64,
21778    /// m_2: `f64` -> Slope for jaggy areas
21779    /// min: 0, max: 1000000, default: 3
21780    pub m_2: f64,
21781}
21782
21783impl std::default::Default for SharpenOptions {
21784    fn default() -> Self {
21785        SharpenOptions {
21786            sigma: f64::from(0.5),
21787            x_1: f64::from(2),
21788            y_2: f64::from(10),
21789            y_3: f64::from(20),
21790            m_1: f64::from(0),
21791            m_2: f64::from(3),
21792        }
21793    }
21794}
21795
21796/// VipsSharpen (sharpen), unsharp masking for print
21797/// inp: `&VipsImage` -> Input image
21798/// sharpen_options: `&SharpenOptions` -> optional arguments
21799/// returns `VipsImage` - Output image
21800pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
21801    unsafe {
21802        let inp_in: *mut bindings::VipsImage = inp.ctx;
21803        let mut out_out: *mut bindings::VipsImage = null_mut();
21804
21805        let sigma_in: f64 = sharpen_options.sigma;
21806        let sigma_in_name = utils::new_c_string("sigma")?;
21807
21808        let x_1_in: f64 = sharpen_options.x_1;
21809        let x_1_in_name = utils::new_c_string("x1")?;
21810
21811        let y_2_in: f64 = sharpen_options.y_2;
21812        let y_2_in_name = utils::new_c_string("y2")?;
21813
21814        let y_3_in: f64 = sharpen_options.y_3;
21815        let y_3_in_name = utils::new_c_string("y3")?;
21816
21817        let m_1_in: f64 = sharpen_options.m_1;
21818        let m_1_in_name = utils::new_c_string("m1")?;
21819
21820        let m_2_in: f64 = sharpen_options.m_2;
21821        let m_2_in_name = utils::new_c_string("m2")?;
21822
21823        let vips_op_response = bindings::vips_sharpen(
21824            inp_in,
21825            &mut out_out,
21826            sigma_in_name.as_ptr(),
21827            sigma_in,
21828            x_1_in_name.as_ptr(),
21829            x_1_in,
21830            y_2_in_name.as_ptr(),
21831            y_2_in,
21832            y_3_in_name.as_ptr(),
21833            y_3_in,
21834            m_1_in_name.as_ptr(),
21835            m_1_in,
21836            m_2_in_name.as_ptr(),
21837            m_2_in,
21838            NULL,
21839        );
21840        utils::result(
21841            vips_op_response,
21842            VipsImage { ctx: out_out },
21843            Error::SharpenError,
21844        )
21845    }
21846}
21847
21848/// VipsGaussblur (gaussblur), gaussian blur
21849/// inp: `&VipsImage` -> Input image
21850/// sigma: `f64` -> Sigma of Gaussian
21851/// min: 0, max: 1000, default: 1.5
21852/// returns `VipsImage` - Output image
21853pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
21854    unsafe {
21855        let inp_in: *mut bindings::VipsImage = inp.ctx;
21856        let sigma_in: f64 = sigma;
21857        let mut out_out: *mut bindings::VipsImage = null_mut();
21858
21859        let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
21860        utils::result(
21861            vips_op_response,
21862            VipsImage { ctx: out_out },
21863            Error::GaussblurError,
21864        )
21865    }
21866}
21867
21868/// Options for gaussblur operation
21869#[derive(Clone, Debug)]
21870pub struct GaussblurOptions {
21871    /// min_ampl: `f64` -> Minimum amplitude of Gaussian
21872    /// min: 0.001, max: 1, default: 0.2
21873    pub min_ampl: f64,
21874    /// precision: `Precision` -> Convolve with this precision
21875    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
21876    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
21877    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21878    ///  `Last` -> VIPS_PRECISION_LAST = 3
21879    pub precision: Precision,
21880}
21881
21882impl std::default::Default for GaussblurOptions {
21883    fn default() -> Self {
21884        GaussblurOptions {
21885            min_ampl: f64::from(0.2),
21886            precision: Precision::Integer,
21887        }
21888    }
21889}
21890
21891/// VipsGaussblur (gaussblur), gaussian blur
21892/// inp: `&VipsImage` -> Input image
21893/// sigma: `f64` -> Sigma of Gaussian
21894/// min: 0, max: 1000, default: 1.5
21895/// gaussblur_options: `&GaussblurOptions` -> optional arguments
21896/// returns `VipsImage` - Output image
21897pub fn gaussblur_with_opts(
21898    inp: &VipsImage,
21899    sigma: f64,
21900    gaussblur_options: &GaussblurOptions,
21901) -> Result<VipsImage> {
21902    unsafe {
21903        let inp_in: *mut bindings::VipsImage = inp.ctx;
21904        let sigma_in: f64 = sigma;
21905        let mut out_out: *mut bindings::VipsImage = null_mut();
21906
21907        let min_ampl_in: f64 = gaussblur_options.min_ampl;
21908        let min_ampl_in_name = utils::new_c_string("min-ampl")?;
21909
21910        let precision_in: i32 = gaussblur_options.precision as i32;
21911        let precision_in_name = utils::new_c_string("precision")?;
21912
21913        let vips_op_response = bindings::vips_gaussblur(
21914            inp_in,
21915            &mut out_out,
21916            sigma_in,
21917            min_ampl_in_name.as_ptr(),
21918            min_ampl_in,
21919            precision_in_name.as_ptr(),
21920            precision_in,
21921            NULL,
21922        );
21923        utils::result(
21924            vips_op_response,
21925            VipsImage { ctx: out_out },
21926            Error::GaussblurError,
21927        )
21928    }
21929}
21930
21931/// VipsSobel (sobel), Sobel edge detector
21932/// inp: `&VipsImage` -> Input image
21933/// returns `VipsImage` - Output image
21934pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
21935    unsafe {
21936        let inp_in: *mut bindings::VipsImage = inp.ctx;
21937        let mut out_out: *mut bindings::VipsImage = null_mut();
21938
21939        let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
21940        utils::result(
21941            vips_op_response,
21942            VipsImage { ctx: out_out },
21943            Error::SobelError,
21944        )
21945    }
21946}
21947
21948/// VipsScharr (scharr), Scharr edge detector
21949/// inp: `&VipsImage` -> Input image
21950/// returns `VipsImage` - Output image
21951pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
21952    unsafe {
21953        let inp_in: *mut bindings::VipsImage = inp.ctx;
21954        let mut out_out: *mut bindings::VipsImage = null_mut();
21955
21956        let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
21957        utils::result(
21958            vips_op_response,
21959            VipsImage { ctx: out_out },
21960            Error::ScharrError,
21961        )
21962    }
21963}
21964
21965/// VipsPrewitt (prewitt), Prewitt edge detector
21966/// inp: `&VipsImage` -> Input image
21967/// returns `VipsImage` - Output image
21968pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
21969    unsafe {
21970        let inp_in: *mut bindings::VipsImage = inp.ctx;
21971        let mut out_out: *mut bindings::VipsImage = null_mut();
21972
21973        let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
21974        utils::result(
21975            vips_op_response,
21976            VipsImage { ctx: out_out },
21977            Error::PrewittError,
21978        )
21979    }
21980}
21981
21982/// VipsCanny (canny), Canny edge detector
21983/// inp: `&VipsImage` -> Input image
21984/// returns `VipsImage` - Output image
21985pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
21986    unsafe {
21987        let inp_in: *mut bindings::VipsImage = inp.ctx;
21988        let mut out_out: *mut bindings::VipsImage = null_mut();
21989
21990        let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
21991        utils::result(
21992            vips_op_response,
21993            VipsImage { ctx: out_out },
21994            Error::CannyError,
21995        )
21996    }
21997}
21998
21999/// Options for canny operation
22000#[derive(Clone, Debug)]
22001pub struct CannyOptions {
22002    /// sigma: `f64` -> Sigma of Gaussian
22003    /// min: 0.01, max: 1000, default: 1.4
22004    pub sigma: f64,
22005    /// precision: `Precision` -> Convolve with this precision
22006    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22007    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22008    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22009    ///  `Last` -> VIPS_PRECISION_LAST = 3
22010    pub precision: Precision,
22011}
22012
22013impl std::default::Default for CannyOptions {
22014    fn default() -> Self {
22015        CannyOptions {
22016            sigma: f64::from(1.4),
22017            precision: Precision::Float,
22018        }
22019    }
22020}
22021
22022/// VipsCanny (canny), Canny edge detector
22023/// inp: `&VipsImage` -> Input image
22024/// canny_options: `&CannyOptions` -> optional arguments
22025/// returns `VipsImage` - Output image
22026pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22027    unsafe {
22028        let inp_in: *mut bindings::VipsImage = inp.ctx;
22029        let mut out_out: *mut bindings::VipsImage = null_mut();
22030
22031        let sigma_in: f64 = canny_options.sigma;
22032        let sigma_in_name = utils::new_c_string("sigma")?;
22033
22034        let precision_in: i32 = canny_options.precision as i32;
22035        let precision_in_name = utils::new_c_string("precision")?;
22036
22037        let vips_op_response = bindings::vips_canny(
22038            inp_in,
22039            &mut out_out,
22040            sigma_in_name.as_ptr(),
22041            sigma_in,
22042            precision_in_name.as_ptr(),
22043            precision_in,
22044            NULL,
22045        );
22046        utils::result(
22047            vips_op_response,
22048            VipsImage { ctx: out_out },
22049            Error::CannyError,
22050        )
22051    }
22052}
22053
22054/// VipsFwfft (fwfft), forward FFT
22055/// inp: `&VipsImage` -> Input image
22056/// returns `VipsImage` - Output image
22057pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22058    unsafe {
22059        let inp_in: *mut bindings::VipsImage = inp.ctx;
22060        let mut out_out: *mut bindings::VipsImage = null_mut();
22061
22062        let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22063        utils::result(
22064            vips_op_response,
22065            VipsImage { ctx: out_out },
22066            Error::FwfftError,
22067        )
22068    }
22069}
22070
22071/// VipsInvfft (invfft), inverse FFT
22072/// inp: `&VipsImage` -> Input image
22073/// returns `VipsImage` - Output image
22074pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
22075    unsafe {
22076        let inp_in: *mut bindings::VipsImage = inp.ctx;
22077        let mut out_out: *mut bindings::VipsImage = null_mut();
22078
22079        let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
22080        utils::result(
22081            vips_op_response,
22082            VipsImage { ctx: out_out },
22083            Error::InvfftError,
22084        )
22085    }
22086}
22087
22088/// Options for invfft operation
22089#[derive(Clone, Debug)]
22090pub struct InvfftOptions {
22091    /// real: `bool` -> Output only the real part of the transform
22092    /// default: false
22093    pub real: bool,
22094}
22095
22096impl std::default::Default for InvfftOptions {
22097    fn default() -> Self {
22098        InvfftOptions { real: false }
22099    }
22100}
22101
22102/// VipsInvfft (invfft), inverse FFT
22103/// inp: `&VipsImage` -> Input image
22104/// invfft_options: `&InvfftOptions` -> optional arguments
22105/// returns `VipsImage` - Output image
22106pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22107    unsafe {
22108        let inp_in: *mut bindings::VipsImage = inp.ctx;
22109        let mut out_out: *mut bindings::VipsImage = null_mut();
22110
22111        let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22112        let real_in_name = utils::new_c_string("real")?;
22113
22114        let vips_op_response =
22115            bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22116        utils::result(
22117            vips_op_response,
22118            VipsImage { ctx: out_out },
22119            Error::InvfftError,
22120        )
22121    }
22122}
22123
22124/// VipsFreqmult (freqmult), frequency-domain filtering
22125/// inp: `&VipsImage` -> Input image
22126/// mask: `&VipsImage` -> Input mask image
22127/// returns `VipsImage` - Output image
22128pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22129    unsafe {
22130        let inp_in: *mut bindings::VipsImage = inp.ctx;
22131        let mask_in: *mut bindings::VipsImage = mask.ctx;
22132        let mut out_out: *mut bindings::VipsImage = null_mut();
22133
22134        let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22135        utils::result(
22136            vips_op_response,
22137            VipsImage { ctx: out_out },
22138            Error::FreqmultError,
22139        )
22140    }
22141}
22142
22143/// VipsSpectrum (spectrum), make displayable power spectrum
22144/// inp: `&VipsImage` -> Input image
22145/// returns `VipsImage` - Output image
22146pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22147    unsafe {
22148        let inp_in: *mut bindings::VipsImage = inp.ctx;
22149        let mut out_out: *mut bindings::VipsImage = null_mut();
22150
22151        let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22152        utils::result(
22153            vips_op_response,
22154            VipsImage { ctx: out_out },
22155            Error::SpectrumError,
22156        )
22157    }
22158}
22159
22160/// VipsPhasecor (phasecor), calculate phase correlation
22161/// inp: `&VipsImage` -> Input image
22162/// in_2: `&VipsImage` -> Second input image
22163/// returns `VipsImage` - Output image
22164pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22165    unsafe {
22166        let inp_in: *mut bindings::VipsImage = inp.ctx;
22167        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22168        let mut out_out: *mut bindings::VipsImage = null_mut();
22169
22170        let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22171        utils::result(
22172            vips_op_response,
22173            VipsImage { ctx: out_out },
22174            Error::PhasecorError,
22175        )
22176    }
22177}
22178
22179/// VipsMorph (morph), morphology operation
22180/// inp: `&VipsImage` -> Input image argument
22181/// mask: `&VipsImage` -> Input matrix image
22182/// morph: `OperationMorphology` -> Morphological operation to perform
22183///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0 [DEFAULT]
22184///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
22185///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
22186/// returns `VipsImage` - Output image
22187pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22188    unsafe {
22189        let inp_in: *mut bindings::VipsImage = inp.ctx;
22190        let mask_in: *mut bindings::VipsImage = mask.ctx;
22191        let morph_in: i32 = morph as i32;
22192        let mut out_out: *mut bindings::VipsImage = null_mut();
22193
22194        let vips_op_response = bindings::vips_morph(
22195            inp_in,
22196            &mut out_out,
22197            mask_in,
22198            morph_in.try_into().unwrap(),
22199            NULL,
22200        );
22201        utils::result(
22202            vips_op_response,
22203            VipsImage { ctx: out_out },
22204            Error::MorphError,
22205        )
22206    }
22207}
22208
22209/// VipsRank (rank), rank filter
22210/// inp: `&VipsImage` -> Input image argument
22211/// width: `i32` -> Window width in pixels
22212/// min: 1, max: 100000, default: 11
22213/// height: `i32` -> Window height in pixels
22214/// min: 1, max: 100000, default: 11
22215/// index: `i32` -> Select pixel at index
22216/// min: 0, max: 100000000, default: 50
22217/// returns `VipsImage` - Output image
22218pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22219    unsafe {
22220        let inp_in: *mut bindings::VipsImage = inp.ctx;
22221        let width_in: i32 = width;
22222        let height_in: i32 = height;
22223        let index_in: i32 = index;
22224        let mut out_out: *mut bindings::VipsImage = null_mut();
22225
22226        let vips_op_response =
22227            bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22228        utils::result(
22229            vips_op_response,
22230            VipsImage { ctx: out_out },
22231            Error::RankError,
22232        )
22233    }
22234}
22235
22236/// VipsCountlines (countlines), count lines in an image
22237/// inp: `&VipsImage` -> Input image argument
22238/// direction: `Direction` -> Countlines left-right or up-down
22239///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22240///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22241///  `Last` -> VIPS_DIRECTION_LAST = 2
22242/// returns `f64` - Number of lines
22243pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22244    unsafe {
22245        let inp_in: *mut bindings::VipsImage = inp.ctx;
22246        let direction_in: i32 = direction as i32;
22247        let mut nolines_out: f64 = f64::from(0);
22248
22249        let vips_op_response = bindings::vips_countlines(
22250            inp_in,
22251            &mut nolines_out,
22252            direction_in.try_into().unwrap(),
22253            NULL,
22254        );
22255        utils::result(vips_op_response, nolines_out, Error::CountlineError)
22256    }
22257}
22258
22259/// VipsLabelregions (labelregions), label regions in an image
22260/// inp: `&VipsImage` -> Input image argument
22261/// returns `VipsImage` - Mask of region labels
22262pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22263    unsafe {
22264        let inp_in: *mut bindings::VipsImage = inp.ctx;
22265        let mut mask_out: *mut bindings::VipsImage = null_mut();
22266
22267        let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22268        utils::result(
22269            vips_op_response,
22270            VipsImage { ctx: mask_out },
22271            Error::LabelregionError,
22272        )
22273    }
22274}
22275
22276/// Options for labelregions operation
22277#[derive(Clone, Debug)]
22278pub struct LabelregionOptions {
22279    /// segments: `i32` -> Number of discrete contiguous regions
22280    /// min: 0, max: 1000000000, default: 0
22281    pub segments: i32,
22282}
22283
22284impl std::default::Default for LabelregionOptions {
22285    fn default() -> Self {
22286        LabelregionOptions {
22287            segments: i32::from(0),
22288        }
22289    }
22290}
22291
22292/// VipsLabelregions (labelregions), label regions in an image
22293/// inp: `&VipsImage` -> Input image argument
22294/// labelregions_options: `&LabelregionOptions` -> optional arguments
22295/// returns `VipsImage` - Mask of region labels
22296pub fn labelregions_with_opts(
22297    inp: &VipsImage,
22298    labelregions_options: &LabelregionOptions,
22299) -> Result<VipsImage> {
22300    unsafe {
22301        let inp_in: *mut bindings::VipsImage = inp.ctx;
22302        let mut mask_out: *mut bindings::VipsImage = null_mut();
22303
22304        let segments_in: i32 = labelregions_options.segments;
22305        let segments_in_name = utils::new_c_string("segments")?;
22306
22307        let vips_op_response = bindings::vips_labelregions(
22308            inp_in,
22309            &mut mask_out,
22310            segments_in_name.as_ptr(),
22311            segments_in,
22312            NULL,
22313        );
22314        utils::result(
22315            vips_op_response,
22316            VipsImage { ctx: mask_out },
22317            Error::LabelregionError,
22318        )
22319    }
22320}
22321
22322/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22323/// inp: `&VipsImage` -> Input image argument
22324/// returns `VipsImage` - Value of nearest non-zero pixel
22325pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22326    unsafe {
22327        let inp_in: *mut bindings::VipsImage = inp.ctx;
22328        let mut out_out: *mut bindings::VipsImage = null_mut();
22329
22330        let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22331        utils::result(
22332            vips_op_response,
22333            VipsImage { ctx: out_out },
22334            Error::FillNearestError,
22335        )
22336    }
22337}
22338
22339/// Options for fill_nearest operation
22340#[derive(Clone, Debug)]
22341pub struct FillNearestOptions {
22342    /// distance: `VipsImage` -> Distance to nearest non-zero pixel
22343    pub distance: VipsImage,
22344}
22345
22346impl std::default::Default for FillNearestOptions {
22347    fn default() -> Self {
22348        FillNearestOptions {
22349            distance: VipsImage::new(),
22350        }
22351    }
22352}
22353
22354/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22355/// inp: `&VipsImage` -> Input image argument
22356/// fill_nearest_options: `&FillNearestOptions` -> optional arguments
22357/// returns `VipsImage` - Value of nearest non-zero pixel
22358pub fn fill_nearest_with_opts(
22359    inp: &VipsImage,
22360    fill_nearest_options: &FillNearestOptions,
22361) -> Result<VipsImage> {
22362    unsafe {
22363        let inp_in: *mut bindings::VipsImage = inp.ctx;
22364        let mut out_out: *mut bindings::VipsImage = null_mut();
22365
22366        let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
22367        let distance_in_name = utils::new_c_string("distance")?;
22368
22369        let vips_op_response = bindings::vips_fill_nearest(
22370            inp_in,
22371            &mut out_out,
22372            distance_in_name.as_ptr(),
22373            distance_in,
22374            NULL,
22375        );
22376        utils::result(
22377            vips_op_response,
22378            VipsImage { ctx: out_out },
22379            Error::FillNearestError,
22380        )
22381    }
22382}
22383
22384/// VipsDrawRect (draw_rect), paint a rectangle on an image
22385/// image: `&VipsImage` -> Image to draw on
22386/// ink: `&mut [f64]` -> Color for pixels
22387/// left: `i32` -> Rect to fill
22388/// min: -1000000000, max: 1000000000, default: 0
22389/// top: `i32` -> Rect to fill
22390/// min: -1000000000, max: 1000000000, default: 0
22391/// width: `i32` -> Rect to fill
22392/// min: -1000000000, max: 1000000000, default: 0
22393/// height: `i32` -> Rect to fill
22394/// min: -1000000000, max: 1000000000, default: 0
22395
22396pub fn draw_rect(
22397    image: &VipsImage,
22398    ink: &mut [f64],
22399    left: i32,
22400    top: i32,
22401    width: i32,
22402    height: i32,
22403) -> Result<()> {
22404    unsafe {
22405        let image_in: *mut bindings::VipsImage = image.ctx;
22406        let ink_in: *mut f64 = ink.as_mut_ptr();
22407        let left_in: i32 = left;
22408        let top_in: i32 = top;
22409        let width_in: i32 = width;
22410        let height_in: i32 = height;
22411
22412        let vips_op_response = bindings::vips_draw_rect(
22413            image_in,
22414            ink_in,
22415            ink.len() as i32,
22416            left_in,
22417            top_in,
22418            width_in,
22419            height_in,
22420            NULL,
22421        );
22422        utils::result(vips_op_response, (), Error::DrawRectError)
22423    }
22424}
22425
22426/// Options for draw_rect operation
22427#[derive(Clone, Debug)]
22428pub struct DrawRectOptions {
22429    /// fill: `bool` -> Draw a solid object
22430    /// default: false
22431    pub fill: bool,
22432}
22433
22434impl std::default::Default for DrawRectOptions {
22435    fn default() -> Self {
22436        DrawRectOptions { fill: false }
22437    }
22438}
22439
22440/// VipsDrawRect (draw_rect), paint a rectangle on an image
22441/// image: `&VipsImage` -> Image to draw on
22442/// ink: `&mut [f64]` -> Color for pixels
22443/// left: `i32` -> Rect to fill
22444/// min: -1000000000, max: 1000000000, default: 0
22445/// top: `i32` -> Rect to fill
22446/// min: -1000000000, max: 1000000000, default: 0
22447/// width: `i32` -> Rect to fill
22448/// min: -1000000000, max: 1000000000, default: 0
22449/// height: `i32` -> Rect to fill
22450/// min: -1000000000, max: 1000000000, default: 0
22451/// draw_rect_options: `&DrawRectOptions` -> optional arguments
22452
22453pub fn draw_rect_with_opts(
22454    image: &VipsImage,
22455    ink: &mut [f64],
22456    left: i32,
22457    top: i32,
22458    width: i32,
22459    height: i32,
22460    draw_rect_options: &DrawRectOptions,
22461) -> Result<()> {
22462    unsafe {
22463        let image_in: *mut bindings::VipsImage = image.ctx;
22464        let ink_in: *mut f64 = ink.as_mut_ptr();
22465        let left_in: i32 = left;
22466        let top_in: i32 = top;
22467        let width_in: i32 = width;
22468        let height_in: i32 = height;
22469
22470        let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
22471        let fill_in_name = utils::new_c_string("fill")?;
22472
22473        let vips_op_response = bindings::vips_draw_rect(
22474            image_in,
22475            ink_in,
22476            ink.len() as i32,
22477            left_in,
22478            top_in,
22479            width_in,
22480            height_in,
22481            fill_in_name.as_ptr(),
22482            fill_in,
22483            NULL,
22484        );
22485        utils::result(vips_op_response, (), Error::DrawRectError)
22486    }
22487}
22488
22489/// VipsDrawMask (draw_mask), draw a mask on an image
22490/// image: `&VipsImage` -> Image to draw on
22491/// ink: `&mut [f64]` -> Color for pixels
22492/// mask: `&VipsImage` -> Mask of pixels to draw
22493/// x: `i32` -> Draw mask here
22494/// min: -1000000000, max: 1000000000, default: 0
22495/// y: `i32` -> Draw mask here
22496/// min: -1000000000, max: 1000000000, default: 0
22497
22498pub fn draw_mask(
22499    image: &VipsImage,
22500    ink: &mut [f64],
22501    mask: &VipsImage,
22502    x: i32,
22503    y: i32,
22504) -> Result<()> {
22505    unsafe {
22506        let image_in: *mut bindings::VipsImage = image.ctx;
22507        let ink_in: *mut f64 = ink.as_mut_ptr();
22508        let mask_in: *mut bindings::VipsImage = mask.ctx;
22509        let x_in: i32 = x;
22510        let y_in: i32 = y;
22511
22512        let vips_op_response = bindings::vips_draw_mask(
22513            image_in,
22514            ink_in,
22515            ink.len() as i32,
22516            mask_in,
22517            x_in,
22518            y_in,
22519            NULL,
22520        );
22521        utils::result(vips_op_response, (), Error::DrawMaskError)
22522    }
22523}
22524
22525/// VipsDrawLine (draw_line), draw a line on an image
22526/// image: `&VipsImage` -> Image to draw on
22527/// ink: `&mut [f64]` -> Color for pixels
22528/// x_1: `i32` -> Start of draw_line
22529/// min: -1000000000, max: 1000000000, default: 0
22530/// y_1: `i32` -> Start of draw_line
22531/// min: -1000000000, max: 1000000000, default: 0
22532/// x_2: `i32` -> End of draw_line
22533/// min: -1000000000, max: 1000000000, default: 0
22534/// y_2: `i32` -> End of draw_line
22535/// min: -1000000000, max: 1000000000, default: 0
22536
22537pub fn draw_line(
22538    image: &VipsImage,
22539    ink: &mut [f64],
22540    x_1: i32,
22541    y_1: i32,
22542    x_2: i32,
22543    y_2: i32,
22544) -> Result<()> {
22545    unsafe {
22546        let image_in: *mut bindings::VipsImage = image.ctx;
22547        let ink_in: *mut f64 = ink.as_mut_ptr();
22548        let x_1_in: i32 = x_1;
22549        let y_1_in: i32 = y_1;
22550        let x_2_in: i32 = x_2;
22551        let y_2_in: i32 = y_2;
22552
22553        let vips_op_response = bindings::vips_draw_line(
22554            image_in,
22555            ink_in,
22556            ink.len() as i32,
22557            x_1_in,
22558            y_1_in,
22559            x_2_in,
22560            y_2_in,
22561            NULL,
22562        );
22563        utils::result(vips_op_response, (), Error::DrawLineError)
22564    }
22565}
22566
22567/// VipsDrawCircle (draw_circle), draw a circle on an image
22568/// image: `&VipsImage` -> Image to draw on
22569/// ink: `&mut [f64]` -> Color for pixels
22570/// cx: `i32` -> Centre of draw_circle
22571/// min: -1000000000, max: 1000000000, default: 0
22572/// cy: `i32` -> Centre of draw_circle
22573/// min: -1000000000, max: 1000000000, default: 0
22574/// radius: `i32` -> Radius in pixels
22575/// min: 0, max: 1000000000, default: 0
22576
22577pub fn draw_circle(
22578    image: &VipsImage,
22579    ink: &mut [f64],
22580    cx: i32,
22581    cy: i32,
22582    radius: i32,
22583) -> Result<()> {
22584    unsafe {
22585        let image_in: *mut bindings::VipsImage = image.ctx;
22586        let ink_in: *mut f64 = ink.as_mut_ptr();
22587        let cx_in: i32 = cx;
22588        let cy_in: i32 = cy;
22589        let radius_in: i32 = radius;
22590
22591        let vips_op_response = bindings::vips_draw_circle(
22592            image_in,
22593            ink_in,
22594            ink.len() as i32,
22595            cx_in,
22596            cy_in,
22597            radius_in,
22598            NULL,
22599        );
22600        utils::result(vips_op_response, (), Error::DrawCircleError)
22601    }
22602}
22603
22604/// Options for draw_circle operation
22605#[derive(Clone, Debug)]
22606pub struct DrawCircleOptions {
22607    /// fill: `bool` -> Draw a solid object
22608    /// default: false
22609    pub fill: bool,
22610}
22611
22612impl std::default::Default for DrawCircleOptions {
22613    fn default() -> Self {
22614        DrawCircleOptions { fill: false }
22615    }
22616}
22617
22618/// VipsDrawCircle (draw_circle), draw a circle on an image
22619/// image: `&VipsImage` -> Image to draw on
22620/// ink: `&mut [f64]` -> Color for pixels
22621/// cx: `i32` -> Centre of draw_circle
22622/// min: -1000000000, max: 1000000000, default: 0
22623/// cy: `i32` -> Centre of draw_circle
22624/// min: -1000000000, max: 1000000000, default: 0
22625/// radius: `i32` -> Radius in pixels
22626/// min: 0, max: 1000000000, default: 0
22627/// draw_circle_options: `&DrawCircleOptions` -> optional arguments
22628
22629pub fn draw_circle_with_opts(
22630    image: &VipsImage,
22631    ink: &mut [f64],
22632    cx: i32,
22633    cy: i32,
22634    radius: i32,
22635    draw_circle_options: &DrawCircleOptions,
22636) -> Result<()> {
22637    unsafe {
22638        let image_in: *mut bindings::VipsImage = image.ctx;
22639        let ink_in: *mut f64 = ink.as_mut_ptr();
22640        let cx_in: i32 = cx;
22641        let cy_in: i32 = cy;
22642        let radius_in: i32 = radius;
22643
22644        let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
22645        let fill_in_name = utils::new_c_string("fill")?;
22646
22647        let vips_op_response = bindings::vips_draw_circle(
22648            image_in,
22649            ink_in,
22650            ink.len() as i32,
22651            cx_in,
22652            cy_in,
22653            radius_in,
22654            fill_in_name.as_ptr(),
22655            fill_in,
22656            NULL,
22657        );
22658        utils::result(vips_op_response, (), Error::DrawCircleError)
22659    }
22660}
22661
22662/// VipsDrawFlood (draw_flood), flood-fill an area
22663/// image: `&VipsImage` -> Image to draw on
22664/// ink: `&mut [f64]` -> Color for pixels
22665/// x: `i32` -> DrawFlood start point
22666/// min: 0, max: 1000000000, default: 0
22667/// y: `i32` -> DrawFlood start point
22668/// min: 0, max: 1000000000, default: 0
22669
22670pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
22671    unsafe {
22672        let image_in: *mut bindings::VipsImage = image.ctx;
22673        let ink_in: *mut f64 = ink.as_mut_ptr();
22674        let x_in: i32 = x;
22675        let y_in: i32 = y;
22676
22677        let vips_op_response =
22678            bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
22679        utils::result(vips_op_response, (), Error::DrawFloodError)
22680    }
22681}
22682
22683/// Options for draw_flood operation
22684#[derive(Clone, Debug)]
22685pub struct DrawFloodOptions {
22686    /// test: `VipsImage` -> Test pixels in this image
22687    pub test: VipsImage,
22688    /// equal: `bool` -> DrawFlood while equal to edge
22689    /// default: false
22690    pub equal: bool,
22691    /// left: `i32` -> Left edge of modified area
22692    /// min: 0, max: 1000000000, default: 0
22693    pub left: i32,
22694    /// top: `i32` -> Top edge of modified area
22695    /// min: 0, max: 1000000000, default: 0
22696    pub top: i32,
22697    /// width: `i32` -> Width of modified area
22698    /// min: 0, max: 1000000000, default: 0
22699    pub width: i32,
22700    /// height: `i32` -> Height of modified area
22701    /// min: 0, max: 1000000000, default: 0
22702    pub height: i32,
22703}
22704
22705impl std::default::Default for DrawFloodOptions {
22706    fn default() -> Self {
22707        DrawFloodOptions {
22708            test: VipsImage::new(),
22709            equal: false,
22710            left: i32::from(0),
22711            top: i32::from(0),
22712            width: i32::from(0),
22713            height: i32::from(0),
22714        }
22715    }
22716}
22717
22718/// VipsDrawFlood (draw_flood), flood-fill an area
22719/// image: `&VipsImage` -> Image to draw on
22720/// ink: `&mut [f64]` -> Color for pixels
22721/// x: `i32` -> DrawFlood start point
22722/// min: 0, max: 1000000000, default: 0
22723/// y: `i32` -> DrawFlood start point
22724/// min: 0, max: 1000000000, default: 0
22725/// draw_flood_options: `&DrawFloodOptions` -> optional arguments
22726
22727pub fn draw_flood_with_opts(
22728    image: &VipsImage,
22729    ink: &mut [f64],
22730    x: i32,
22731    y: i32,
22732    draw_flood_options: &DrawFloodOptions,
22733) -> Result<()> {
22734    unsafe {
22735        let image_in: *mut bindings::VipsImage = image.ctx;
22736        let ink_in: *mut f64 = ink.as_mut_ptr();
22737        let x_in: i32 = x;
22738        let y_in: i32 = y;
22739
22740        let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
22741        let test_in_name = utils::new_c_string("test")?;
22742
22743        let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
22744        let equal_in_name = utils::new_c_string("equal")?;
22745
22746        let left_in: i32 = draw_flood_options.left;
22747        let left_in_name = utils::new_c_string("left")?;
22748
22749        let top_in: i32 = draw_flood_options.top;
22750        let top_in_name = utils::new_c_string("top")?;
22751
22752        let width_in: i32 = draw_flood_options.width;
22753        let width_in_name = utils::new_c_string("width")?;
22754
22755        let height_in: i32 = draw_flood_options.height;
22756        let height_in_name = utils::new_c_string("height")?;
22757
22758        let vips_op_response = bindings::vips_draw_flood(
22759            image_in,
22760            ink_in,
22761            ink.len() as i32,
22762            x_in,
22763            y_in,
22764            test_in_name.as_ptr(),
22765            test_in,
22766            equal_in_name.as_ptr(),
22767            equal_in,
22768            left_in_name.as_ptr(),
22769            left_in,
22770            top_in_name.as_ptr(),
22771            top_in,
22772            width_in_name.as_ptr(),
22773            width_in,
22774            height_in_name.as_ptr(),
22775            height_in,
22776            NULL,
22777        );
22778        utils::result(vips_op_response, (), Error::DrawFloodError)
22779    }
22780}
22781
22782/// VipsDrawImage (draw_image), paint an image into another image
22783/// image: `&VipsImage` -> Image to draw on
22784/// sub: `&VipsImage` -> Sub-image to insert into main image
22785/// x: `i32` -> Draw image here
22786/// min: -1000000000, max: 1000000000, default: 0
22787/// y: `i32` -> Draw image here
22788/// min: -1000000000, max: 1000000000, default: 0
22789
22790pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
22791    unsafe {
22792        let image_in: *mut bindings::VipsImage = image.ctx;
22793        let sub_in: *mut bindings::VipsImage = sub.ctx;
22794        let x_in: i32 = x;
22795        let y_in: i32 = y;
22796
22797        let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
22798        utils::result(vips_op_response, (), Error::DrawImageError)
22799    }
22800}
22801
22802/// Options for draw_image operation
22803#[derive(Clone, Debug)]
22804pub struct DrawImageOptions {
22805    /// mode: `CombineMode` -> Combining mode
22806    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0 [DEFAULT]
22807    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
22808    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
22809    pub mode: CombineMode,
22810}
22811
22812impl std::default::Default for DrawImageOptions {
22813    fn default() -> Self {
22814        DrawImageOptions {
22815            mode: CombineMode::Set,
22816        }
22817    }
22818}
22819
22820/// VipsDrawImage (draw_image), paint an image into another image
22821/// image: `&VipsImage` -> Image to draw on
22822/// sub: `&VipsImage` -> Sub-image to insert into main image
22823/// x: `i32` -> Draw image here
22824/// min: -1000000000, max: 1000000000, default: 0
22825/// y: `i32` -> Draw image here
22826/// min: -1000000000, max: 1000000000, default: 0
22827/// draw_image_options: `&DrawImageOptions` -> optional arguments
22828
22829pub fn draw_image_with_opts(
22830    image: &VipsImage,
22831    sub: &VipsImage,
22832    x: i32,
22833    y: i32,
22834    draw_image_options: &DrawImageOptions,
22835) -> Result<()> {
22836    unsafe {
22837        let image_in: *mut bindings::VipsImage = image.ctx;
22838        let sub_in: *mut bindings::VipsImage = sub.ctx;
22839        let x_in: i32 = x;
22840        let y_in: i32 = y;
22841
22842        let mode_in: i32 = draw_image_options.mode as i32;
22843        let mode_in_name = utils::new_c_string("mode")?;
22844
22845        let vips_op_response = bindings::vips_draw_image(
22846            image_in,
22847            sub_in,
22848            x_in,
22849            y_in,
22850            mode_in_name.as_ptr(),
22851            mode_in,
22852            NULL,
22853        );
22854        utils::result(vips_op_response, (), Error::DrawImageError)
22855    }
22856}
22857
22858/// VipsDrawSmudge (draw_smudge), blur a rectangle on an image
22859/// image: `&VipsImage` -> Image to draw on
22860/// left: `i32` -> Rect to fill
22861/// min: -1000000000, max: 1000000000, default: 0
22862/// top: `i32` -> Rect to fill
22863/// min: -1000000000, max: 1000000000, default: 0
22864/// width: `i32` -> Rect to fill
22865/// min: -1000000000, max: 1000000000, default: 0
22866/// height: `i32` -> Rect to fill
22867/// min: -1000000000, max: 1000000000, default: 0
22868
22869pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
22870    unsafe {
22871        let image_in: *mut bindings::VipsImage = image.ctx;
22872        let left_in: i32 = left;
22873        let top_in: i32 = top;
22874        let width_in: i32 = width;
22875        let height_in: i32 = height;
22876
22877        let vips_op_response =
22878            bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
22879        utils::result(vips_op_response, (), Error::DrawSmudgeError)
22880    }
22881}
22882
22883/// VipsMerge (merge), merge two images
22884/// refp: `&VipsImage` -> Reference image
22885/// sec: `&VipsImage` -> Secondary image
22886/// direction: `Direction` -> Horizontal or vertical merge
22887///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22888///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22889///  `Last` -> VIPS_DIRECTION_LAST = 2
22890/// dx: `i32` -> Horizontal displacement from sec to ref
22891/// min: -100000000, max: 1000000000, default: 1
22892/// dy: `i32` -> Vertical displacement from sec to ref
22893/// min: -100000000, max: 1000000000, default: 1
22894/// returns `VipsImage` - Output image
22895pub fn merge(
22896    refp: &VipsImage,
22897    sec: &VipsImage,
22898    direction: Direction,
22899    dx: i32,
22900    dy: i32,
22901) -> Result<VipsImage> {
22902    unsafe {
22903        let refp_in: *mut bindings::VipsImage = refp.ctx;
22904        let sec_in: *mut bindings::VipsImage = sec.ctx;
22905        let direction_in: i32 = direction as i32;
22906        let dx_in: i32 = dx;
22907        let dy_in: i32 = dy;
22908        let mut out_out: *mut bindings::VipsImage = null_mut();
22909
22910        let vips_op_response = bindings::vips_merge(
22911            refp_in,
22912            sec_in,
22913            &mut out_out,
22914            direction_in.try_into().unwrap(),
22915            dx_in,
22916            dy_in,
22917            NULL,
22918        );
22919        utils::result(
22920            vips_op_response,
22921            VipsImage { ctx: out_out },
22922            Error::MergeError,
22923        )
22924    }
22925}
22926
22927/// Options for merge operation
22928#[derive(Clone, Debug)]
22929pub struct MergeOptions {
22930    /// mblend: `i32` -> Maximum blend size
22931    /// min: 0, max: 10000, default: 10
22932    pub mblend: i32,
22933}
22934
22935impl std::default::Default for MergeOptions {
22936    fn default() -> Self {
22937        MergeOptions {
22938            mblend: i32::from(10),
22939        }
22940    }
22941}
22942
22943/// VipsMerge (merge), merge two images
22944/// refp: `&VipsImage` -> Reference image
22945/// sec: `&VipsImage` -> Secondary image
22946/// direction: `Direction` -> Horizontal or vertical merge
22947///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22948///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22949///  `Last` -> VIPS_DIRECTION_LAST = 2
22950/// dx: `i32` -> Horizontal displacement from sec to ref
22951/// min: -100000000, max: 1000000000, default: 1
22952/// dy: `i32` -> Vertical displacement from sec to ref
22953/// min: -100000000, max: 1000000000, default: 1
22954/// merge_options: `&MergeOptions` -> optional arguments
22955/// returns `VipsImage` - Output image
22956pub fn merge_with_opts(
22957    refp: &VipsImage,
22958    sec: &VipsImage,
22959    direction: Direction,
22960    dx: i32,
22961    dy: i32,
22962    merge_options: &MergeOptions,
22963) -> Result<VipsImage> {
22964    unsafe {
22965        let refp_in: *mut bindings::VipsImage = refp.ctx;
22966        let sec_in: *mut bindings::VipsImage = sec.ctx;
22967        let direction_in: i32 = direction as i32;
22968        let dx_in: i32 = dx;
22969        let dy_in: i32 = dy;
22970        let mut out_out: *mut bindings::VipsImage = null_mut();
22971
22972        let mblend_in: i32 = merge_options.mblend;
22973        let mblend_in_name = utils::new_c_string("mblend")?;
22974
22975        let vips_op_response = bindings::vips_merge(
22976            refp_in,
22977            sec_in,
22978            &mut out_out,
22979            direction_in.try_into().unwrap(),
22980            dx_in,
22981            dy_in,
22982            mblend_in_name.as_ptr(),
22983            mblend_in,
22984            NULL,
22985        );
22986        utils::result(
22987            vips_op_response,
22988            VipsImage { ctx: out_out },
22989            Error::MergeError,
22990        )
22991    }
22992}
22993
22994/// VipsMosaic (mosaic), mosaic two images
22995/// refp: `&VipsImage` -> Reference image
22996/// sec: `&VipsImage` -> Secondary image
22997/// direction: `Direction` -> Horizontal or vertical mosaic
22998///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22999///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23000///  `Last` -> VIPS_DIRECTION_LAST = 2
23001/// xref: `i32` -> Position of reference tie-point
23002/// min: 0, max: 1000000000, default: 1
23003/// yref: `i32` -> Position of reference tie-point
23004/// min: 0, max: 1000000000, default: 1
23005/// xsec: `i32` -> Position of secondary tie-point
23006/// min: 0, max: 1000000000, default: 1
23007/// ysec: `i32` -> Position of secondary tie-point
23008/// min: 0, max: 1000000000, default: 1
23009/// returns `VipsImage` - Output image
23010pub fn mosaic(
23011    refp: &VipsImage,
23012    sec: &VipsImage,
23013    direction: Direction,
23014    xref: i32,
23015    yref: i32,
23016    xsec: i32,
23017    ysec: i32,
23018) -> Result<VipsImage> {
23019    unsafe {
23020        let refp_in: *mut bindings::VipsImage = refp.ctx;
23021        let sec_in: *mut bindings::VipsImage = sec.ctx;
23022        let direction_in: i32 = direction as i32;
23023        let xref_in: i32 = xref;
23024        let yref_in: i32 = yref;
23025        let xsec_in: i32 = xsec;
23026        let ysec_in: i32 = ysec;
23027        let mut out_out: *mut bindings::VipsImage = null_mut();
23028
23029        let vips_op_response = bindings::vips_mosaic(
23030            refp_in,
23031            sec_in,
23032            &mut out_out,
23033            direction_in.try_into().unwrap(),
23034            xref_in,
23035            yref_in,
23036            xsec_in,
23037            ysec_in,
23038            NULL,
23039        );
23040        utils::result(
23041            vips_op_response,
23042            VipsImage { ctx: out_out },
23043            Error::MosaicError,
23044        )
23045    }
23046}
23047
23048/// Options for mosaic operation
23049#[derive(Clone, Debug)]
23050pub struct MosaicOptions {
23051    /// hwindow: `i32` -> Half window size
23052    /// min: 0, max: 1000000000, default: 5
23053    pub hwindow: i32,
23054    /// harea: `i32` -> Half area size
23055    /// min: 0, max: 1000000000, default: 15
23056    pub harea: i32,
23057    /// mblend: `i32` -> Maximum blend size
23058    /// min: 0, max: 10000, default: 10
23059    pub mblend: i32,
23060    /// bandno: `i32` -> Band to search for features on
23061    /// min: 0, max: 10000, default: 0
23062    pub bandno: i32,
23063    /// dx_0: `i32` -> Detected integer offset
23064    /// min: -10000000, max: 10000000, default: 0
23065    pub dx_0: i32,
23066    /// dy_0: `i32` -> Detected integer offset
23067    /// min: -10000000, max: 10000000, default: 0
23068    pub dy_0: i32,
23069    /// scale_1: `f64` -> Detected scale
23070    /// min: -10000000, max: 10000000, default: 1
23071    pub scale_1: f64,
23072    /// angle_1: `f64` -> Detected rotation
23073    /// min: -10000000, max: 10000000, default: 0
23074    pub angle_1: f64,
23075    /// dy_1: `f64` -> Detected first-order displacement
23076    /// min: -10000000, max: 10000000, default: 0
23077    pub dy_1: f64,
23078    /// dx_1: `f64` -> Detected first-order displacement
23079    /// min: -10000000, max: 10000000, default: 0
23080    pub dx_1: f64,
23081}
23082
23083impl std::default::Default for MosaicOptions {
23084    fn default() -> Self {
23085        MosaicOptions {
23086            hwindow: i32::from(5),
23087            harea: i32::from(15),
23088            mblend: i32::from(10),
23089            bandno: i32::from(0),
23090            dx_0: i32::from(0),
23091            dy_0: i32::from(0),
23092            scale_1: f64::from(1),
23093            angle_1: f64::from(0),
23094            dy_1: f64::from(0),
23095            dx_1: f64::from(0),
23096        }
23097    }
23098}
23099
23100/// VipsMosaic (mosaic), mosaic two images
23101/// refp: `&VipsImage` -> Reference image
23102/// sec: `&VipsImage` -> Secondary image
23103/// direction: `Direction` -> Horizontal or vertical mosaic
23104///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23105///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23106///  `Last` -> VIPS_DIRECTION_LAST = 2
23107/// xref: `i32` -> Position of reference tie-point
23108/// min: 0, max: 1000000000, default: 1
23109/// yref: `i32` -> Position of reference tie-point
23110/// min: 0, max: 1000000000, default: 1
23111/// xsec: `i32` -> Position of secondary tie-point
23112/// min: 0, max: 1000000000, default: 1
23113/// ysec: `i32` -> Position of secondary tie-point
23114/// min: 0, max: 1000000000, default: 1
23115/// mosaic_options: `&MosaicOptions` -> optional arguments
23116/// returns `VipsImage` - Output image
23117pub fn mosaic_with_opts(
23118    refp: &VipsImage,
23119    sec: &VipsImage,
23120    direction: Direction,
23121    xref: i32,
23122    yref: i32,
23123    xsec: i32,
23124    ysec: i32,
23125    mosaic_options: &MosaicOptions,
23126) -> Result<VipsImage> {
23127    unsafe {
23128        let refp_in: *mut bindings::VipsImage = refp.ctx;
23129        let sec_in: *mut bindings::VipsImage = sec.ctx;
23130        let direction_in: i32 = direction as i32;
23131        let xref_in: i32 = xref;
23132        let yref_in: i32 = yref;
23133        let xsec_in: i32 = xsec;
23134        let ysec_in: i32 = ysec;
23135        let mut out_out: *mut bindings::VipsImage = null_mut();
23136
23137        let hwindow_in: i32 = mosaic_options.hwindow;
23138        let hwindow_in_name = utils::new_c_string("hwindow")?;
23139
23140        let harea_in: i32 = mosaic_options.harea;
23141        let harea_in_name = utils::new_c_string("harea")?;
23142
23143        let mblend_in: i32 = mosaic_options.mblend;
23144        let mblend_in_name = utils::new_c_string("mblend")?;
23145
23146        let bandno_in: i32 = mosaic_options.bandno;
23147        let bandno_in_name = utils::new_c_string("bandno")?;
23148
23149        let dx_0_in: i32 = mosaic_options.dx_0;
23150        let dx_0_in_name = utils::new_c_string("dx0")?;
23151
23152        let dy_0_in: i32 = mosaic_options.dy_0;
23153        let dy_0_in_name = utils::new_c_string("dy0")?;
23154
23155        let scale_1_in: f64 = mosaic_options.scale_1;
23156        let scale_1_in_name = utils::new_c_string("scale1")?;
23157
23158        let angle_1_in: f64 = mosaic_options.angle_1;
23159        let angle_1_in_name = utils::new_c_string("angle1")?;
23160
23161        let dy_1_in: f64 = mosaic_options.dy_1;
23162        let dy_1_in_name = utils::new_c_string("dy1")?;
23163
23164        let dx_1_in: f64 = mosaic_options.dx_1;
23165        let dx_1_in_name = utils::new_c_string("dx1")?;
23166
23167        let vips_op_response = bindings::vips_mosaic(
23168            refp_in,
23169            sec_in,
23170            &mut out_out,
23171            direction_in.try_into().unwrap(),
23172            xref_in,
23173            yref_in,
23174            xsec_in,
23175            ysec_in,
23176            hwindow_in_name.as_ptr(),
23177            hwindow_in,
23178            harea_in_name.as_ptr(),
23179            harea_in,
23180            mblend_in_name.as_ptr(),
23181            mblend_in,
23182            bandno_in_name.as_ptr(),
23183            bandno_in,
23184            dx_0_in_name.as_ptr(),
23185            dx_0_in,
23186            dy_0_in_name.as_ptr(),
23187            dy_0_in,
23188            scale_1_in_name.as_ptr(),
23189            scale_1_in,
23190            angle_1_in_name.as_ptr(),
23191            angle_1_in,
23192            dy_1_in_name.as_ptr(),
23193            dy_1_in,
23194            dx_1_in_name.as_ptr(),
23195            dx_1_in,
23196            NULL,
23197        );
23198        utils::result(
23199            vips_op_response,
23200            VipsImage { ctx: out_out },
23201            Error::MosaicError,
23202        )
23203    }
23204}
23205
23206/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23207/// refp: `&VipsImage` -> Reference image
23208/// sec: `&VipsImage` -> Secondary image
23209/// direction: `Direction` -> Horizontal or vertical mosaic
23210///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23211///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23212///  `Last` -> VIPS_DIRECTION_LAST = 2
23213/// xr_1: `i32` -> Position of first reference tie-point
23214/// min: -1000000000, max: 1000000000, default: 1
23215/// yr_1: `i32` -> Position of first reference tie-point
23216/// min: -1000000000, max: 1000000000, default: 1
23217/// xs_1: `i32` -> Position of first secondary tie-point
23218/// min: -1000000000, max: 1000000000, default: 1
23219/// ys_1: `i32` -> Position of first secondary tie-point
23220/// min: -1000000000, max: 1000000000, default: 1
23221/// xr_2: `i32` -> Position of second reference tie-point
23222/// min: -1000000000, max: 1000000000, default: 1
23223/// yr_2: `i32` -> Position of second reference tie-point
23224/// min: -1000000000, max: 1000000000, default: 1
23225/// xs_2: `i32` -> Position of second secondary tie-point
23226/// min: -1000000000, max: 1000000000, default: 1
23227/// ys_2: `i32` -> Position of second secondary tie-point
23228/// min: -1000000000, max: 1000000000, default: 1
23229/// returns `VipsImage` - Output image
23230pub fn mosaic_1(
23231    refp: &VipsImage,
23232    sec: &VipsImage,
23233    direction: Direction,
23234    xr_1: i32,
23235    yr_1: i32,
23236    xs_1: i32,
23237    ys_1: i32,
23238    xr_2: i32,
23239    yr_2: i32,
23240    xs_2: i32,
23241    ys_2: i32,
23242) -> Result<VipsImage> {
23243    unsafe {
23244        let refp_in: *mut bindings::VipsImage = refp.ctx;
23245        let sec_in: *mut bindings::VipsImage = sec.ctx;
23246        let direction_in: i32 = direction as i32;
23247        let xr_1_in: i32 = xr_1;
23248        let yr_1_in: i32 = yr_1;
23249        let xs_1_in: i32 = xs_1;
23250        let ys_1_in: i32 = ys_1;
23251        let xr_2_in: i32 = xr_2;
23252        let yr_2_in: i32 = yr_2;
23253        let xs_2_in: i32 = xs_2;
23254        let ys_2_in: i32 = ys_2;
23255        let mut out_out: *mut bindings::VipsImage = null_mut();
23256
23257        let vips_op_response = bindings::vips_mosaic1(
23258            refp_in,
23259            sec_in,
23260            &mut out_out,
23261            direction_in.try_into().unwrap(),
23262            xr_1_in,
23263            yr_1_in,
23264            xs_1_in,
23265            ys_1_in,
23266            xr_2_in,
23267            yr_2_in,
23268            xs_2_in,
23269            ys_2_in,
23270            NULL,
23271        );
23272        utils::result(
23273            vips_op_response,
23274            VipsImage { ctx: out_out },
23275            Error::Mosaic1Error,
23276        )
23277    }
23278}
23279
23280/// Options for mosaic_1 operation
23281#[derive(Clone, Debug)]
23282pub struct Mosaic1Options {
23283    /// hwindow: `i32` -> Half window size
23284    /// min: 0, max: 1000000000, default: 5
23285    pub hwindow: i32,
23286    /// harea: `i32` -> Half area size
23287    /// min: 0, max: 1000000000, default: 15
23288    pub harea: i32,
23289    /// search: `bool` -> Search to improve tie-points
23290    /// default: false
23291    pub search: bool,
23292    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23293    pub interpolate: VipsInterpolate,
23294    /// mblend: `i32` -> Maximum blend size
23295    /// min: 0, max: 10000, default: 10
23296    pub mblend: i32,
23297}
23298
23299impl std::default::Default for Mosaic1Options {
23300    fn default() -> Self {
23301        Mosaic1Options {
23302            hwindow: i32::from(5),
23303            harea: i32::from(15),
23304            search: false,
23305            interpolate: VipsInterpolate::new(),
23306            mblend: i32::from(10),
23307        }
23308    }
23309}
23310
23311/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23312/// refp: `&VipsImage` -> Reference image
23313/// sec: `&VipsImage` -> Secondary image
23314/// direction: `Direction` -> Horizontal or vertical mosaic
23315///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23316///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23317///  `Last` -> VIPS_DIRECTION_LAST = 2
23318/// xr_1: `i32` -> Position of first reference tie-point
23319/// min: -1000000000, max: 1000000000, default: 1
23320/// yr_1: `i32` -> Position of first reference tie-point
23321/// min: -1000000000, max: 1000000000, default: 1
23322/// xs_1: `i32` -> Position of first secondary tie-point
23323/// min: -1000000000, max: 1000000000, default: 1
23324/// ys_1: `i32` -> Position of first secondary tie-point
23325/// min: -1000000000, max: 1000000000, default: 1
23326/// xr_2: `i32` -> Position of second reference tie-point
23327/// min: -1000000000, max: 1000000000, default: 1
23328/// yr_2: `i32` -> Position of second reference tie-point
23329/// min: -1000000000, max: 1000000000, default: 1
23330/// xs_2: `i32` -> Position of second secondary tie-point
23331/// min: -1000000000, max: 1000000000, default: 1
23332/// ys_2: `i32` -> Position of second secondary tie-point
23333/// min: -1000000000, max: 1000000000, default: 1
23334/// mosaic_1_options: `&Mosaic1Options` -> optional arguments
23335/// returns `VipsImage` - Output image
23336pub fn mosaic_1_with_opts(
23337    refp: &VipsImage,
23338    sec: &VipsImage,
23339    direction: Direction,
23340    xr_1: i32,
23341    yr_1: i32,
23342    xs_1: i32,
23343    ys_1: i32,
23344    xr_2: i32,
23345    yr_2: i32,
23346    xs_2: i32,
23347    ys_2: i32,
23348    mosaic_1_options: &Mosaic1Options,
23349) -> Result<VipsImage> {
23350    unsafe {
23351        let refp_in: *mut bindings::VipsImage = refp.ctx;
23352        let sec_in: *mut bindings::VipsImage = sec.ctx;
23353        let direction_in: i32 = direction as i32;
23354        let xr_1_in: i32 = xr_1;
23355        let yr_1_in: i32 = yr_1;
23356        let xs_1_in: i32 = xs_1;
23357        let ys_1_in: i32 = ys_1;
23358        let xr_2_in: i32 = xr_2;
23359        let yr_2_in: i32 = yr_2;
23360        let xs_2_in: i32 = xs_2;
23361        let ys_2_in: i32 = ys_2;
23362        let mut out_out: *mut bindings::VipsImage = null_mut();
23363
23364        let hwindow_in: i32 = mosaic_1_options.hwindow;
23365        let hwindow_in_name = utils::new_c_string("hwindow")?;
23366
23367        let harea_in: i32 = mosaic_1_options.harea;
23368        let harea_in_name = utils::new_c_string("harea")?;
23369
23370        let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
23371        let search_in_name = utils::new_c_string("search")?;
23372
23373        let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
23374        let interpolate_in_name = utils::new_c_string("interpolate")?;
23375
23376        let mblend_in: i32 = mosaic_1_options.mblend;
23377        let mblend_in_name = utils::new_c_string("mblend")?;
23378
23379        let vips_op_response = bindings::vips_mosaic1(
23380            refp_in,
23381            sec_in,
23382            &mut out_out,
23383            direction_in.try_into().unwrap(),
23384            xr_1_in,
23385            yr_1_in,
23386            xs_1_in,
23387            ys_1_in,
23388            xr_2_in,
23389            yr_2_in,
23390            xs_2_in,
23391            ys_2_in,
23392            hwindow_in_name.as_ptr(),
23393            hwindow_in,
23394            harea_in_name.as_ptr(),
23395            harea_in,
23396            search_in_name.as_ptr(),
23397            search_in,
23398            interpolate_in_name.as_ptr(),
23399            interpolate_in,
23400            mblend_in_name.as_ptr(),
23401            mblend_in,
23402            NULL,
23403        );
23404        utils::result(
23405            vips_op_response,
23406            VipsImage { ctx: out_out },
23407            Error::Mosaic1Error,
23408        )
23409    }
23410}
23411
23412/// VipsMatrixinvert (matrixinvert), invert an matrix
23413/// inp: `&VipsImage` -> An square matrix
23414/// returns `VipsImage` - Output matrix
23415pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
23416    unsafe {
23417        let inp_in: *mut bindings::VipsImage = inp.ctx;
23418        let mut out_out: *mut bindings::VipsImage = null_mut();
23419
23420        let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
23421        utils::result(
23422            vips_op_response,
23423            VipsImage { ctx: out_out },
23424            Error::MatrixinvertError,
23425        )
23426    }
23427}
23428
23429/// VipsMatch (match), first-order match of two images
23430/// refp: `&VipsImage` -> Reference image
23431/// sec: `&VipsImage` -> Secondary image
23432/// xr_1: `i32` -> Position of first reference tie-point
23433/// min: -1000000000, max: 1000000000, default: 1
23434/// yr_1: `i32` -> Position of first reference tie-point
23435/// min: -1000000000, max: 1000000000, default: 1
23436/// xs_1: `i32` -> Position of first secondary tie-point
23437/// min: -1000000000, max: 1000000000, default: 1
23438/// ys_1: `i32` -> Position of first secondary tie-point
23439/// min: -1000000000, max: 1000000000, default: 1
23440/// xr_2: `i32` -> Position of second reference tie-point
23441/// min: -1000000000, max: 1000000000, default: 1
23442/// yr_2: `i32` -> Position of second reference tie-point
23443/// min: -1000000000, max: 1000000000, default: 1
23444/// xs_2: `i32` -> Position of second secondary tie-point
23445/// min: -1000000000, max: 1000000000, default: 1
23446/// ys_2: `i32` -> Position of second secondary tie-point
23447/// min: -1000000000, max: 1000000000, default: 1
23448/// returns `VipsImage` - Output image
23449pub fn matches(
23450    refp: &VipsImage,
23451    sec: &VipsImage,
23452    xr_1: i32,
23453    yr_1: i32,
23454    xs_1: i32,
23455    ys_1: i32,
23456    xr_2: i32,
23457    yr_2: i32,
23458    xs_2: i32,
23459    ys_2: i32,
23460) -> Result<VipsImage> {
23461    unsafe {
23462        let refp_in: *mut bindings::VipsImage = refp.ctx;
23463        let sec_in: *mut bindings::VipsImage = sec.ctx;
23464        let xr_1_in: i32 = xr_1;
23465        let yr_1_in: i32 = yr_1;
23466        let xs_1_in: i32 = xs_1;
23467        let ys_1_in: i32 = ys_1;
23468        let xr_2_in: i32 = xr_2;
23469        let yr_2_in: i32 = yr_2;
23470        let xs_2_in: i32 = xs_2;
23471        let ys_2_in: i32 = ys_2;
23472        let mut out_out: *mut bindings::VipsImage = null_mut();
23473
23474        let vips_op_response = bindings::vips_match(
23475            refp_in,
23476            sec_in,
23477            &mut out_out,
23478            xr_1_in,
23479            yr_1_in,
23480            xs_1_in,
23481            ys_1_in,
23482            xr_2_in,
23483            yr_2_in,
23484            xs_2_in,
23485            ys_2_in,
23486            NULL,
23487        );
23488        utils::result(
23489            vips_op_response,
23490            VipsImage { ctx: out_out },
23491            Error::MatchError,
23492        )
23493    }
23494}
23495
23496/// Options for matches operation
23497#[derive(Clone, Debug)]
23498pub struct MatchOptions {
23499    /// hwindow: `i32` -> Half window size
23500    /// min: 0, max: 1000000000, default: 1
23501    pub hwindow: i32,
23502    /// harea: `i32` -> Half area size
23503    /// min: 0, max: 1000000000, default: 1
23504    pub harea: i32,
23505    /// search: `bool` -> Search to improve tie-points
23506    /// default: false
23507    pub search: bool,
23508    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23509    pub interpolate: VipsInterpolate,
23510}
23511
23512impl std::default::Default for MatchOptions {
23513    fn default() -> Self {
23514        MatchOptions {
23515            hwindow: i32::from(1),
23516            harea: i32::from(1),
23517            search: false,
23518            interpolate: VipsInterpolate::new(),
23519        }
23520    }
23521}
23522
23523/// VipsMatch (match), first-order match of two images
23524/// refp: `&VipsImage` -> Reference image
23525/// sec: `&VipsImage` -> Secondary image
23526/// xr_1: `i32` -> Position of first reference tie-point
23527/// min: -1000000000, max: 1000000000, default: 1
23528/// yr_1: `i32` -> Position of first reference tie-point
23529/// min: -1000000000, max: 1000000000, default: 1
23530/// xs_1: `i32` -> Position of first secondary tie-point
23531/// min: -1000000000, max: 1000000000, default: 1
23532/// ys_1: `i32` -> Position of first secondary tie-point
23533/// min: -1000000000, max: 1000000000, default: 1
23534/// xr_2: `i32` -> Position of second reference tie-point
23535/// min: -1000000000, max: 1000000000, default: 1
23536/// yr_2: `i32` -> Position of second reference tie-point
23537/// min: -1000000000, max: 1000000000, default: 1
23538/// xs_2: `i32` -> Position of second secondary tie-point
23539/// min: -1000000000, max: 1000000000, default: 1
23540/// ys_2: `i32` -> Position of second secondary tie-point
23541/// min: -1000000000, max: 1000000000, default: 1
23542/// matches_options: `&MatchOptions` -> optional arguments
23543/// returns `VipsImage` - Output image
23544pub fn matches_with_opts(
23545    refp: &VipsImage,
23546    sec: &VipsImage,
23547    xr_1: i32,
23548    yr_1: i32,
23549    xs_1: i32,
23550    ys_1: i32,
23551    xr_2: i32,
23552    yr_2: i32,
23553    xs_2: i32,
23554    ys_2: i32,
23555    matches_options: &MatchOptions,
23556) -> Result<VipsImage> {
23557    unsafe {
23558        let refp_in: *mut bindings::VipsImage = refp.ctx;
23559        let sec_in: *mut bindings::VipsImage = sec.ctx;
23560        let xr_1_in: i32 = xr_1;
23561        let yr_1_in: i32 = yr_1;
23562        let xs_1_in: i32 = xs_1;
23563        let ys_1_in: i32 = ys_1;
23564        let xr_2_in: i32 = xr_2;
23565        let yr_2_in: i32 = yr_2;
23566        let xs_2_in: i32 = xs_2;
23567        let ys_2_in: i32 = ys_2;
23568        let mut out_out: *mut bindings::VipsImage = null_mut();
23569
23570        let hwindow_in: i32 = matches_options.hwindow;
23571        let hwindow_in_name = utils::new_c_string("hwindow")?;
23572
23573        let harea_in: i32 = matches_options.harea;
23574        let harea_in_name = utils::new_c_string("harea")?;
23575
23576        let search_in: i32 = if matches_options.search { 1 } else { 0 };
23577        let search_in_name = utils::new_c_string("search")?;
23578
23579        let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
23580        let interpolate_in_name = utils::new_c_string("interpolate")?;
23581
23582        let vips_op_response = bindings::vips_match(
23583            refp_in,
23584            sec_in,
23585            &mut out_out,
23586            xr_1_in,
23587            yr_1_in,
23588            xs_1_in,
23589            ys_1_in,
23590            xr_2_in,
23591            yr_2_in,
23592            xs_2_in,
23593            ys_2_in,
23594            hwindow_in_name.as_ptr(),
23595            hwindow_in,
23596            harea_in_name.as_ptr(),
23597            harea_in,
23598            search_in_name.as_ptr(),
23599            search_in,
23600            interpolate_in_name.as_ptr(),
23601            interpolate_in,
23602            NULL,
23603        );
23604        utils::result(
23605            vips_op_response,
23606            VipsImage { ctx: out_out },
23607            Error::MatchError,
23608        )
23609    }
23610}
23611
23612/// VipsGlobalbalance (globalbalance), global balance an image mosaic
23613/// inp: `&VipsImage` -> Input image
23614/// returns `VipsImage` - Output image
23615pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
23616    unsafe {
23617        let inp_in: *mut bindings::VipsImage = inp.ctx;
23618        let mut out_out: *mut bindings::VipsImage = null_mut();
23619
23620        let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
23621        utils::result(
23622            vips_op_response,
23623            VipsImage { ctx: out_out },
23624            Error::GlobalbalanceError,
23625        )
23626    }
23627}
23628
23629/// Options for globalbalance operation
23630#[derive(Clone, Debug)]
23631pub struct GlobalbalanceOptions {
23632    /// gamma: `f64` -> Image gamma
23633    /// min: 0.00001, max: 10, default: 1.6
23634    pub gamma: f64,
23635    /// int_output: `bool` -> Integer output
23636    /// default: false
23637    pub int_output: bool,
23638}
23639
23640impl std::default::Default for GlobalbalanceOptions {
23641    fn default() -> Self {
23642        GlobalbalanceOptions {
23643            gamma: f64::from(1.6),
23644            int_output: false,
23645        }
23646    }
23647}
23648
23649/// VipsGlobalbalance (globalbalance), global balance an image mosaic
23650/// inp: `&VipsImage` -> Input image
23651/// globalbalance_options: `&GlobalbalanceOptions` -> optional arguments
23652/// returns `VipsImage` - Output image
23653pub fn globalbalance_with_opts(
23654    inp: &VipsImage,
23655    globalbalance_options: &GlobalbalanceOptions,
23656) -> Result<VipsImage> {
23657    unsafe {
23658        let inp_in: *mut bindings::VipsImage = inp.ctx;
23659        let mut out_out: *mut bindings::VipsImage = null_mut();
23660
23661        let gamma_in: f64 = globalbalance_options.gamma;
23662        let gamma_in_name = utils::new_c_string("gamma")?;
23663
23664        let int_output_in: i32 = if globalbalance_options.int_output {
23665            1
23666        } else {
23667            0
23668        };
23669        let int_output_in_name = utils::new_c_string("int-output")?;
23670
23671        let vips_op_response = bindings::vips_globalbalance(
23672            inp_in,
23673            &mut out_out,
23674            gamma_in_name.as_ptr(),
23675            gamma_in,
23676            int_output_in_name.as_ptr(),
23677            int_output_in,
23678            NULL,
23679        );
23680        utils::result(
23681            vips_op_response,
23682            VipsImage { ctx: out_out },
23683            Error::GlobalbalanceError,
23684        )
23685    }
23686}