libvips_rs/
ops.rs

1// (c) Copyright 2019-2025 MIT
2use crate::bindings;
3use crate::error::*;
4use crate::utils;
5use crate::Result;
6use crate::VipsBlob;
7use crate::VipsImage;
8use crate::VipsInterpolate;
9use crate::VipsSource;
10use crate::VipsTarget;
11use std::convert::TryInto;
12use std::ffi::*;
13use std::ptr::null_mut;
14
15const NULL: *const c_void = null_mut();
16
17include!("manual.rs");
18
19#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
20pub enum Access {
21    ///  `Random` -> VIPS_ACCESS_RANDOM = 0
22    Random = 0,
23    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
24    Sequential = 1,
25    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
26    SequentialUnbuffered = 2,
27}
28
29#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
30pub enum Align {
31    ///  `Low` -> VIPS_ALIGN_LOW = 0
32    Low = 0,
33    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
34    Centre = 1,
35    ///  `High` -> VIPS_ALIGN_HIGH = 2
36    High = 2,
37}
38
39#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
40pub enum Angle {
41    ///  `D0` -> VIPS_ANGLE_D0 = 0
42    D0 = 0,
43    ///  `D90` -> VIPS_ANGLE_D90 = 1
44    D90 = 1,
45    ///  `D180` -> VIPS_ANGLE_D180 = 2
46    D180 = 2,
47    ///  `D270` -> VIPS_ANGLE_D270 = 3
48    D270 = 3,
49}
50
51#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
52pub enum Angle45 {
53    ///  `D0` -> VIPS_ANGLE45_D0 = 0
54    D0 = 0,
55    ///  `D45` -> VIPS_ANGLE45_D45 = 1
56    D45 = 1,
57    ///  `D90` -> VIPS_ANGLE45_D90 = 2
58    D90 = 2,
59    ///  `D135` -> VIPS_ANGLE45_D135 = 3
60    D135 = 3,
61    ///  `D180` -> VIPS_ANGLE45_D180 = 4
62    D180 = 4,
63    ///  `D225` -> VIPS_ANGLE45_D225 = 5
64    D225 = 5,
65    ///  `D270` -> VIPS_ANGLE45_D270 = 6
66    D270 = 6,
67    ///  `D315` -> VIPS_ANGLE45_D315 = 7
68    D315 = 7,
69}
70
71#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
72pub enum BandFormat {
73    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
74    Notset = -1,
75    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0
76    Uchar = 0,
77    ///  `Char` -> VIPS_FORMAT_CHAR = 1
78    Char = 1,
79    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
80    Ushort = 2,
81    ///  `Short` -> VIPS_FORMAT_SHORT = 3
82    Short = 3,
83    ///  `Uint` -> VIPS_FORMAT_UINT = 4
84    Uint = 4,
85    ///  `Int` -> VIPS_FORMAT_INT = 5
86    Int = 5,
87    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
88    Float = 6,
89    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
90    Complex = 7,
91    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
92    Double = 8,
93    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
94    Dpcomplex = 9,
95}
96
97#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
98pub enum BlendMode {
99    ///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
100    Clear = 0,
101    ///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
102    Source = 1,
103    ///  `Over` -> VIPS_BLEND_MODE_OVER = 2
104    Over = 2,
105    ///  `In` -> VIPS_BLEND_MODE_IN = 3
106    In = 3,
107    ///  `Out` -> VIPS_BLEND_MODE_OUT = 4
108    Out = 4,
109    ///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
110    Atop = 5,
111    ///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
112    Dest = 6,
113    ///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
114    DestOver = 7,
115    ///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
116    DestIn = 8,
117    ///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
118    DestOut = 9,
119    ///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
120    DestAtop = 10,
121    ///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
122    Xor = 11,
123    ///  `Add` -> VIPS_BLEND_MODE_ADD = 12
124    Add = 12,
125    ///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
126    Saturate = 13,
127    ///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
128    Multiply = 14,
129    ///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
130    Screen = 15,
131    ///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
132    Overlay = 16,
133    ///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
134    Darken = 17,
135    ///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
136    Lighten = 18,
137    ///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
138    ColourDodge = 19,
139    ///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
140    ColourBurn = 20,
141    ///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
142    HardLight = 21,
143    ///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
144    SoftLight = 22,
145    ///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
146    Difference = 23,
147    ///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
148    Exclusion = 24,
149}
150
151#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
152pub enum Coding {
153    ///  `Error` -> VIPS_CODING_ERROR = -1
154    Error = -1,
155    ///  `None` -> VIPS_CODING_NONE = 0
156    None = 0,
157    ///  `Labq` -> VIPS_CODING_LABQ = 2
158    Labq = 2,
159    ///  `Rad` -> VIPS_CODING_RAD = 6
160    Rad = 6,
161}
162
163#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
164pub enum Combine {
165    ///  `Max` -> VIPS_COMBINE_MAX = 0
166    Max = 0,
167    ///  `Sum` -> VIPS_COMBINE_SUM = 1
168    Sum = 1,
169    ///  `Min` -> VIPS_COMBINE_MIN = 2
170    Min = 2,
171}
172
173#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
174pub enum CombineMode {
175    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0
176    Set = 0,
177    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
178    Add = 1,
179}
180
181#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
182pub enum CompassDirection {
183    ///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0
184    Centre = 0,
185    ///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
186    North = 1,
187    ///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
188    East = 2,
189    ///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
190    South = 3,
191    ///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
192    West = 4,
193    ///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
194    NorthEast = 5,
195    ///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
196    SouthEast = 6,
197    ///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
198    SouthWest = 7,
199    ///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
200    NorthWest = 8,
201}
202
203#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
204pub enum Direction {
205    ///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0
206    Horizontal = 0,
207    ///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
208    Vertical = 1,
209}
210
211#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
212pub enum Extend {
213    ///  `Black` -> VIPS_EXTEND_BLACK = 0
214    Black = 0,
215    ///  `Copy` -> VIPS_EXTEND_COPY = 1
216    Copy = 1,
217    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
218    Repeat = 2,
219    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
220    Mirror = 3,
221    ///  `White` -> VIPS_EXTEND_WHITE = 4
222    White = 4,
223    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
224    Background = 5,
225}
226
227#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
228pub enum FailOn {
229    ///  `None` -> VIPS_FAIL_ON_NONE = 0
230    None = 0,
231    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
232    Truncated = 1,
233    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
234    Error = 2,
235    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
236    Warning = 3,
237}
238
239#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
240pub enum ForeignDzDepth {
241    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
242    Onepixel = 0,
243    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
244    Onetile = 1,
245    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
246    One = 2,
247}
248
249#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
250pub enum ForeignFlags {
251    ///  `None` -> VIPS_FOREIGN_NONE = 0
252    None = 0,
253    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
254    Partial = 1,
255    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
256    Bigendian = 2,
257    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
258    Sequential = 4,
259    ///  `All` -> VIPS_FOREIGN_ALL = 7
260    All = 7,
261}
262
263#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
264pub enum ForeignHeifCompression {
265    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1
266    Hevc = 1,
267    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
268    Avc = 2,
269    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
270    Jpeg = 3,
271    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
272    Av1 = 4,
273}
274
275#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
276pub enum ForeignHeifEncoder {
277    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0
278    Auto = 0,
279    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
280    Aom = 1,
281    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
282    Rav1E = 2,
283    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
284    Svt = 3,
285    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
286    X265 = 4,
287}
288
289#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
290pub enum ForeignKeep {
291    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
292    None = 0,
293    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
294    Exif = 1,
295    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
296    Xmp = 2,
297    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
298    Iptc = 4,
299    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
300    Icc = 8,
301    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
302    Other = 16,
303    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
304    Gainmap = 32,
305    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63
306    All = 63,
307}
308
309#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
310pub enum ForeignPngFilter {
311    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8
312    None = 8,
313    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
314    Sub = 16,
315    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
316    Up = 32,
317    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
318    Avg = 64,
319    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
320    Paeth = 128,
321    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
322    All = 248,
323}
324
325#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
326pub enum ForeignPpmFormat {
327    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
328    Pbm = 0,
329    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
330    Pgm = 1,
331    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2
332    Ppm = 2,
333    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
334    Pfm = 3,
335    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
336    Pnm = 4,
337}
338
339#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
340pub enum ForeignSubsample {
341    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
342    Auto = 0,
343    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
344    On = 1,
345    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
346    Off = 2,
347}
348
349#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
350pub enum ForeignTiffCompression {
351    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0
352    None = 0,
353    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
354    Jpeg = 1,
355    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
356    Deflate = 2,
357    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
358    Packbit = 3,
359    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
360    Ccittfax4 = 4,
361    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
362    Lzw = 5,
363    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
364    Webp = 6,
365    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
366    Zstd = 7,
367    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
368    Jp2K = 8,
369}
370
371#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
372pub enum ForeignTiffPredictor {
373    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
374    None = 1,
375    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2
376    Horizontal = 2,
377    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
378    Float = 3,
379}
380
381#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
382pub enum ForeignTiffResunit {
383    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0
384    Cm = 0,
385    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
386    Inch = 1,
387}
388
389#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
390pub enum ForeignWebpPreset {
391    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0
392    Default = 0,
393    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
394    Picture = 1,
395    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
396    Photo = 2,
397    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
398    Drawing = 3,
399    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
400    Icon = 4,
401    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
402    Text = 5,
403}
404
405#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
406pub enum Intent {
407    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
408    Perceptual = 0,
409    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1
410    Relative = 1,
411    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
412    Saturation = 2,
413    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
414    Absolute = 3,
415    ///  `Auto` -> VIPS_INTENT_AUTO = 32
416    Auto = 32,
417}
418
419#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
420pub enum Interesting {
421    ///  `None` -> VIPS_INTERESTING_NONE = 0
422    None = 0,
423    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
424    Centre = 1,
425    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
426    Entropy = 2,
427    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
428    Attention = 3,
429    ///  `Low` -> VIPS_INTERESTING_LOW = 4
430    Low = 4,
431    ///  `High` -> VIPS_INTERESTING_HIGH = 5
432    High = 5,
433    ///  `All` -> VIPS_INTERESTING_ALL = 6
434    All = 6,
435}
436
437#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
438pub enum Interpretation {
439    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
440    Error = -1,
441    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
442    Multiband = 0,
443    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
444    BW = 1,
445    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
446    Histogram = 10,
447    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
448    Xyz = 12,
449    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
450    Lab = 13,
451    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
452    Cmyk = 15,
453    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
454    Labq = 16,
455    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
456    Rgb = 17,
457    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
458    Cmc = 18,
459    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
460    Lch = 19,
461    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
462    Labs = 21,
463    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
464    Srgb = 22,
465    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
466    Yxy = 23,
467    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
468    Fourier = 24,
469    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
470    Rgb16 = 25,
471    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
472    Grey16 = 26,
473    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
474    Matrix = 27,
475    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
476    Scrgb = 28,
477    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
478    Hsv = 29,
479    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
480    Oklab = 30,
481    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
482    Oklch = 31,
483}
484
485#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
486pub enum Kernel {
487    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
488    Nearest = 0,
489    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
490    Linear = 1,
491    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
492    Cubic = 2,
493    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
494    Mitchell = 3,
495    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
496    Lanczos2 = 4,
497    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5
498    Lanczos3 = 5,
499    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
500    Mks2013 = 6,
501    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
502    Mks2021 = 7,
503}
504
505#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
506pub enum OperationBoolean {
507    ///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0
508    And = 0,
509    ///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
510    Or = 1,
511    ///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
512    Eor = 2,
513    ///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
514    Lshift = 3,
515    ///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
516    Rshift = 4,
517}
518
519#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
520pub enum OperationComplex {
521    ///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0
522    Polar = 0,
523    ///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
524    Rect = 1,
525    ///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
526    Conj = 2,
527}
528
529#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
530pub enum OperationComplex2 {
531    ///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0
532    CrossPhase = 0,
533}
534
535#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
536pub enum OperationComplexget {
537    ///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0
538    Real = 0,
539    ///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
540    Imag = 1,
541}
542
543#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
544pub enum OperationMath {
545    ///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0
546    Sin = 0,
547    ///  `Co` -> VIPS_OPERATION_MATH_COS = 1
548    Co = 1,
549    ///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
550    Tan = 2,
551    ///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
552    Asin = 3,
553    ///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
554    Aco = 4,
555    ///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
556    Atan = 5,
557    ///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
558    Log = 6,
559    ///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
560    Log10 = 7,
561    ///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
562    Exp = 8,
563    ///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
564    Exp10 = 9,
565    ///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
566    Sinh = 10,
567    ///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
568    Cosh = 11,
569    ///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
570    Tanh = 12,
571    ///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
572    Asinh = 13,
573    ///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
574    Acosh = 14,
575    ///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
576    Atanh = 15,
577}
578
579#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
580pub enum OperationMath2 {
581    ///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0
582    Pow = 0,
583    ///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
584    Wop = 1,
585    ///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
586    Atan2 = 2,
587}
588
589#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
590pub enum OperationMorphology {
591    ///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0
592    Erode = 0,
593    ///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
594    Dilate = 1,
595}
596
597#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
598pub enum OperationRelational {
599    ///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0
600    Equal = 0,
601    ///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
602    Noteq = 1,
603    ///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
604    Less = 2,
605    ///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
606    Lesseq = 3,
607    ///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
608    More = 4,
609    ///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
610    Moreeq = 5,
611}
612
613#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
614pub enum OperationRound {
615    ///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0
616    Rint = 0,
617    ///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
618    Ceil = 1,
619    ///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
620    Floor = 2,
621}
622
623#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
624pub enum PCS {
625    ///  `Lab` -> VIPS_PCS_LAB = 0
626    Lab = 0,
627    ///  `Xyz` -> VIPS_PCS_XYZ = 1
628    Xyz = 1,
629}
630
631#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
632pub enum Precision {
633    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
634    Integer = 0,
635    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
636    Float = 1,
637    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
638    Approximate = 2,
639}
640
641#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
642pub enum RegionShrink {
643    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0
644    Mean = 0,
645    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
646    Median = 1,
647    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
648    Mode = 2,
649    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
650    Max = 3,
651    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
652    Min = 4,
653    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
654    Nearest = 5,
655}
656
657#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
658pub enum SdfShape {
659    ///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0
660    Circle = 0,
661    ///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
662    Box = 1,
663    ///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
664    RoundedBox = 2,
665    ///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
666    Line = 3,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum Size {
671    ///  `Both` -> VIPS_SIZE_BOTH = 0
672    Both = 0,
673    ///  `Up` -> VIPS_SIZE_UP = 1
674    Up = 1,
675    ///  `Down` -> VIPS_SIZE_DOWN = 2
676    Down = 2,
677    ///  `Force` -> VIPS_SIZE_FORCE = 3
678    Force = 3,
679}
680
681#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
682pub enum TextWrap {
683    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0
684    Word = 0,
685    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
686    Char = 1,
687    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
688    WordChar = 2,
689    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
690    None = 3,
691}
692
693/// VipsSystem (system), run an external command, nocache
694/// cmd_format: `&str` -> Command to run
695
696pub fn system(cmd_format: &str) -> Result<()> {
697    unsafe {
698        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
699
700        let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
701        utils::result(vips_op_response, (), Error::SystemError)
702    }
703}
704
705/// Options for system operation
706#[derive(Clone, Debug)]
707pub struct SystemOptions {
708    /// inp: `Vec<VipsImage>` -> Array of input images
709    pub inp: Vec<VipsImage>,
710    /// out: `VipsImage` -> Output image
711    pub out: VipsImage,
712    /// in_format: `String` -> Format for input filename
713    pub in_format: String,
714    /// out_format: `String` -> Format for output filename
715    pub out_format: String,
716    /// cache: `bool` -> Cache this call
717    /// default: false
718    pub cache: bool,
719    /// log: `String` -> Command log
720    pub log: String,
721}
722
723impl std::default::Default for SystemOptions {
724    fn default() -> Self {
725        SystemOptions {
726            inp: Vec::new(),
727            out: VipsImage::new(),
728            in_format: String::new(),
729            out_format: String::new(),
730            cache: false,
731            log: String::new(),
732        }
733    }
734}
735
736/// VipsSystem (system), run an external command, nocache
737/// cmd_format: `&str` -> Command to run
738/// system_options: `&SystemOptions` -> optional arguments
739
740pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
741    unsafe {
742        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
743
744        let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
745        let inp_in = inp_wrapper.ctx;
746        let inp_in_name = utils::new_c_string("inp")?;
747
748        let out_in: *mut bindings::VipsImage = system_options.out.ctx;
749        let out_in_name = utils::new_c_string("out")?;
750
751        let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
752        let in_format_in_name = utils::new_c_string("in-format")?;
753
754        let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
755        let out_format_in_name = utils::new_c_string("out-format")?;
756
757        let cache_in: i32 = if system_options.cache { 1 } else { 0 };
758        let cache_in_name = utils::new_c_string("cache")?;
759
760        let log_in: CString = utils::new_c_string(&system_options.log)?;
761        let log_in_name = utils::new_c_string("log")?;
762
763        let vips_op_response = bindings::vips_system(
764            cmd_format_in.as_ptr(),
765            inp_in_name.as_ptr(),
766            inp_in,
767            out_in_name.as_ptr(),
768            out_in,
769            in_format_in_name.as_ptr(),
770            in_format_in.as_ptr(),
771            out_format_in_name.as_ptr(),
772            out_format_in.as_ptr(),
773            cache_in_name.as_ptr(),
774            cache_in,
775            log_in_name.as_ptr(),
776            log_in.as_ptr(),
777            NULL,
778        );
779        utils::result(vips_op_response, (), Error::SystemError)
780    }
781}
782
783/// VipsAdd (add), add two images
784/// left: `&VipsImage` -> Left-hand image argument
785/// right: `&VipsImage` -> Right-hand image argument
786/// returns `VipsImage` - Output image
787pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
788    unsafe {
789        let left_in: *mut bindings::VipsImage = left.ctx;
790        let right_in: *mut bindings::VipsImage = right.ctx;
791        let mut out_out: *mut bindings::VipsImage = null_mut();
792
793        let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
794        utils::result(
795            vips_op_response,
796            VipsImage { ctx: out_out },
797            Error::AddError,
798        )
799    }
800}
801
802/// VipsMinpair (minpair), minimum of a pair of images
803/// left: `&VipsImage` -> Left-hand image argument
804/// right: `&VipsImage` -> Right-hand image argument
805/// returns `VipsImage` - Output image
806pub fn minpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
807    unsafe {
808        let left_in: *mut bindings::VipsImage = left.ctx;
809        let right_in: *mut bindings::VipsImage = right.ctx;
810        let mut out_out: *mut bindings::VipsImage = null_mut();
811
812        let vips_op_response = bindings::vips_minpair(left_in, right_in, &mut out_out, NULL);
813        utils::result(
814            vips_op_response,
815            VipsImage { ctx: out_out },
816            Error::MinpairError,
817        )
818    }
819}
820
821/// VipsMaxpair (maxpair), maximum of a pair of images
822/// left: `&VipsImage` -> Left-hand image argument
823/// right: `&VipsImage` -> Right-hand image argument
824/// returns `VipsImage` - Output image
825pub fn maxpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
826    unsafe {
827        let left_in: *mut bindings::VipsImage = left.ctx;
828        let right_in: *mut bindings::VipsImage = right.ctx;
829        let mut out_out: *mut bindings::VipsImage = null_mut();
830
831        let vips_op_response = bindings::vips_maxpair(left_in, right_in, &mut out_out, NULL);
832        utils::result(
833            vips_op_response,
834            VipsImage { ctx: out_out },
835            Error::MaxpairError,
836        )
837    }
838}
839
840/// VipsSubtract (subtract), subtract two images
841/// left: `&VipsImage` -> Left-hand image argument
842/// right: `&VipsImage` -> Right-hand image argument
843/// returns `VipsImage` - Output image
844pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
845    unsafe {
846        let left_in: *mut bindings::VipsImage = left.ctx;
847        let right_in: *mut bindings::VipsImage = right.ctx;
848        let mut out_out: *mut bindings::VipsImage = null_mut();
849
850        let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
851        utils::result(
852            vips_op_response,
853            VipsImage { ctx: out_out },
854            Error::SubtractError,
855        )
856    }
857}
858
859/// VipsMultiply (multiply), multiply two images
860/// left: `&VipsImage` -> Left-hand image argument
861/// right: `&VipsImage` -> Right-hand image argument
862/// returns `VipsImage` - Output image
863pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
864    unsafe {
865        let left_in: *mut bindings::VipsImage = left.ctx;
866        let right_in: *mut bindings::VipsImage = right.ctx;
867        let mut out_out: *mut bindings::VipsImage = null_mut();
868
869        let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
870        utils::result(
871            vips_op_response,
872            VipsImage { ctx: out_out },
873            Error::MultiplyError,
874        )
875    }
876}
877
878/// VipsDivide (divide), divide two images
879/// left: `&VipsImage` -> Left-hand image argument
880/// right: `&VipsImage` -> Right-hand image argument
881/// returns `VipsImage` - Output image
882pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
883    unsafe {
884        let left_in: *mut bindings::VipsImage = left.ctx;
885        let right_in: *mut bindings::VipsImage = right.ctx;
886        let mut out_out: *mut bindings::VipsImage = null_mut();
887
888        let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
889        utils::result(
890            vips_op_response,
891            VipsImage { ctx: out_out },
892            Error::DivideError,
893        )
894    }
895}
896
897/// VipsRelational (relational), relational operation on two images
898/// left: `&VipsImage` -> Left-hand image argument
899/// right: `&VipsImage` -> Right-hand image argument
900/// relational: `OperationRelational` -> Relational to perform
901///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
902///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
903///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
904///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
905///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
906///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
907/// returns `VipsImage` - Output image
908pub fn relational(
909    left: &VipsImage,
910    right: &VipsImage,
911    relational: OperationRelational,
912) -> Result<VipsImage> {
913    unsafe {
914        let left_in: *mut bindings::VipsImage = left.ctx;
915        let right_in: *mut bindings::VipsImage = right.ctx;
916        let relational_in: i32 = relational as i32;
917        let mut out_out: *mut bindings::VipsImage = null_mut();
918
919        let vips_op_response = bindings::vips_relational(
920            left_in,
921            right_in,
922            &mut out_out,
923            relational_in.try_into().unwrap(),
924            NULL,
925        );
926        utils::result(
927            vips_op_response,
928            VipsImage { ctx: out_out },
929            Error::RelationalError,
930        )
931    }
932}
933
934/// VipsRemainder (remainder), remainder after integer division of two images
935/// left: `&VipsImage` -> Left-hand image argument
936/// right: `&VipsImage` -> Right-hand image argument
937/// returns `VipsImage` - Output image
938pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
939    unsafe {
940        let left_in: *mut bindings::VipsImage = left.ctx;
941        let right_in: *mut bindings::VipsImage = right.ctx;
942        let mut out_out: *mut bindings::VipsImage = null_mut();
943
944        let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
945        utils::result(
946            vips_op_response,
947            VipsImage { ctx: out_out },
948            Error::RemainderError,
949        )
950    }
951}
952
953/// VipsBoolean (boolean), boolean operation on two images
954/// left: `&VipsImage` -> Left-hand image argument
955/// right: `&VipsImage` -> Right-hand image argument
956/// boolean: `OperationBoolean` -> Boolean to perform
957///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
958///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
959///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
960///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
961///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
962/// returns `VipsImage` - Output image
963pub fn boolean(
964    left: &VipsImage,
965    right: &VipsImage,
966    boolean: OperationBoolean,
967) -> Result<VipsImage> {
968    unsafe {
969        let left_in: *mut bindings::VipsImage = left.ctx;
970        let right_in: *mut bindings::VipsImage = right.ctx;
971        let boolean_in: i32 = boolean as i32;
972        let mut out_out: *mut bindings::VipsImage = null_mut();
973
974        let vips_op_response = bindings::vips_boolean(
975            left_in,
976            right_in,
977            &mut out_out,
978            boolean_in.try_into().unwrap(),
979            NULL,
980        );
981        utils::result(
982            vips_op_response,
983            VipsImage { ctx: out_out },
984            Error::BooleanError,
985        )
986    }
987}
988
989/// VipsMath2 (math2), binary math operations
990/// left: `&VipsImage` -> Left-hand image argument
991/// right: `&VipsImage` -> Right-hand image argument
992/// math_2: `OperationMath2` -> Math to perform
993///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
994///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
995///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
996/// returns `VipsImage` - Output image
997pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
998    unsafe {
999        let left_in: *mut bindings::VipsImage = left.ctx;
1000        let right_in: *mut bindings::VipsImage = right.ctx;
1001        let math_2_in: i32 = math_2 as i32;
1002        let mut out_out: *mut bindings::VipsImage = null_mut();
1003
1004        let vips_op_response = bindings::vips_math2(
1005            left_in,
1006            right_in,
1007            &mut out_out,
1008            math_2_in.try_into().unwrap(),
1009            NULL,
1010        );
1011        utils::result(
1012            vips_op_response,
1013            VipsImage { ctx: out_out },
1014            Error::Math2Error,
1015        )
1016    }
1017}
1018
1019/// VipsComplex2 (complex2), complex binary operations on two images
1020/// left: `&VipsImage` -> Left-hand image argument
1021/// right: `&VipsImage` -> Right-hand image argument
1022/// cmplx: `OperationComplex2` -> Binary complex operation to perform
1023///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0 [DEFAULT]
1024/// returns `VipsImage` - Output image
1025pub fn complex_2(
1026    left: &VipsImage,
1027    right: &VipsImage,
1028    cmplx: OperationComplex2,
1029) -> Result<VipsImage> {
1030    unsafe {
1031        let left_in: *mut bindings::VipsImage = left.ctx;
1032        let right_in: *mut bindings::VipsImage = right.ctx;
1033        let cmplx_in: i32 = cmplx as i32;
1034        let mut out_out: *mut bindings::VipsImage = null_mut();
1035
1036        let vips_op_response = bindings::vips_complex2(
1037            left_in,
1038            right_in,
1039            &mut out_out,
1040            cmplx_in.try_into().unwrap(),
1041            NULL,
1042        );
1043        utils::result(
1044            vips_op_response,
1045            VipsImage { ctx: out_out },
1046            Error::Complex2Error,
1047        )
1048    }
1049}
1050
1051/// VipsComplexform (complexform), form a complex image from two real images
1052/// left: `&VipsImage` -> Left-hand image argument
1053/// right: `&VipsImage` -> Right-hand image argument
1054/// returns `VipsImage` - Output image
1055pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1056    unsafe {
1057        let left_in: *mut bindings::VipsImage = left.ctx;
1058        let right_in: *mut bindings::VipsImage = right.ctx;
1059        let mut out_out: *mut bindings::VipsImage = null_mut();
1060
1061        let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1062        utils::result(
1063            vips_op_response,
1064            VipsImage { ctx: out_out },
1065            Error::ComplexformError,
1066        )
1067    }
1068}
1069
1070/// VipsClamp (clamp), clamp values of an image
1071/// inp: `&VipsImage` -> Input image
1072/// returns `VipsImage` - Output image
1073pub fn clamp(inp: &VipsImage) -> Result<VipsImage> {
1074    unsafe {
1075        let inp_in: *mut bindings::VipsImage = inp.ctx;
1076        let mut out_out: *mut bindings::VipsImage = null_mut();
1077
1078        let vips_op_response = bindings::vips_clamp(inp_in, &mut out_out, NULL);
1079        utils::result(
1080            vips_op_response,
1081            VipsImage { ctx: out_out },
1082            Error::ClampError,
1083        )
1084    }
1085}
1086
1087/// Options for clamp operation
1088#[derive(Clone, Debug)]
1089pub struct ClampOptions {
1090    /// min: `f64` -> Minimum value
1091    /// min: -inf, max: inf, default: 0
1092    pub min: f64,
1093    /// max: `f64` -> Maximum value
1094    /// min: -inf, max: inf, default: 1
1095    pub max: f64,
1096}
1097
1098impl std::default::Default for ClampOptions {
1099    fn default() -> Self {
1100        ClampOptions {
1101            min: f64::from(0),
1102            max: f64::from(1),
1103        }
1104    }
1105}
1106
1107/// VipsClamp (clamp), clamp values of an image
1108/// inp: `&VipsImage` -> Input image
1109/// clamp_options: `&ClampOptions` -> optional arguments
1110/// returns `VipsImage` - Output image
1111pub fn clamp_with_opts(inp: &VipsImage, clamp_options: &ClampOptions) -> Result<VipsImage> {
1112    unsafe {
1113        let inp_in: *mut bindings::VipsImage = inp.ctx;
1114        let mut out_out: *mut bindings::VipsImage = null_mut();
1115
1116        let min_in: f64 = clamp_options.min;
1117        let min_in_name = utils::new_c_string("min")?;
1118
1119        let max_in: f64 = clamp_options.max;
1120        let max_in_name = utils::new_c_string("max")?;
1121
1122        let vips_op_response = bindings::vips_clamp(
1123            inp_in,
1124            &mut out_out,
1125            min_in_name.as_ptr(),
1126            min_in,
1127            max_in_name.as_ptr(),
1128            max_in,
1129            NULL,
1130        );
1131        utils::result(
1132            vips_op_response,
1133            VipsImage { ctx: out_out },
1134            Error::ClampError,
1135        )
1136    }
1137}
1138
1139/// VipsInvert (invert), invert an image
1140/// inp: `&VipsImage` -> Input image
1141/// returns `VipsImage` - Output image
1142pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1143    unsafe {
1144        let inp_in: *mut bindings::VipsImage = inp.ctx;
1145        let mut out_out: *mut bindings::VipsImage = null_mut();
1146
1147        let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1148        utils::result(
1149            vips_op_response,
1150            VipsImage { ctx: out_out },
1151            Error::InvertError,
1152        )
1153    }
1154}
1155
1156/// VipsMath (math), apply a math operation to an image
1157/// inp: `&VipsImage` -> Input image
1158/// math: `OperationMath` -> Math to perform
1159///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0 [DEFAULT]
1160///  `Co` -> VIPS_OPERATION_MATH_COS = 1
1161///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
1162///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
1163///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
1164///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
1165///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
1166///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
1167///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
1168///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
1169///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
1170///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
1171///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
1172///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
1173///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
1174///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
1175/// returns `VipsImage` - Output image
1176pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1177    unsafe {
1178        let inp_in: *mut bindings::VipsImage = inp.ctx;
1179        let math_in: i32 = math as i32;
1180        let mut out_out: *mut bindings::VipsImage = null_mut();
1181
1182        let vips_op_response =
1183            bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1184        utils::result(
1185            vips_op_response,
1186            VipsImage { ctx: out_out },
1187            Error::MathError,
1188        )
1189    }
1190}
1191
1192/// VipsAbs (abs), absolute value of an image
1193/// inp: `&VipsImage` -> Input image
1194/// returns `VipsImage` - Output image
1195pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1196    unsafe {
1197        let inp_in: *mut bindings::VipsImage = inp.ctx;
1198        let mut out_out: *mut bindings::VipsImage = null_mut();
1199
1200        let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1201        utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1202    }
1203}
1204
1205/// VipsSign (sign), unit vector of pixel
1206/// inp: `&VipsImage` -> Input image
1207/// returns `VipsImage` - Output image
1208pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1209    unsafe {
1210        let inp_in: *mut bindings::VipsImage = inp.ctx;
1211        let mut out_out: *mut bindings::VipsImage = null_mut();
1212
1213        let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1214        utils::result(
1215            vips_op_response,
1216            VipsImage { ctx: out_out },
1217            Error::SignError,
1218        )
1219    }
1220}
1221
1222/// VipsRound (round), perform a round function on an image
1223/// inp: `&VipsImage` -> Input image
1224/// round: `OperationRound` -> Rounding operation to perform
1225///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0 [DEFAULT]
1226///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
1227///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
1228/// returns `VipsImage` - Output image
1229pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1230    unsafe {
1231        let inp_in: *mut bindings::VipsImage = inp.ctx;
1232        let round_in: i32 = round as i32;
1233        let mut out_out: *mut bindings::VipsImage = null_mut();
1234
1235        let vips_op_response =
1236            bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1237        utils::result(
1238            vips_op_response,
1239            VipsImage { ctx: out_out },
1240            Error::RoundError,
1241        )
1242    }
1243}
1244
1245/// VipsRelationalConst (relational_const), relational operations against a constant
1246/// inp: `&VipsImage` -> Input image
1247/// relational: `OperationRelational` -> Relational to perform
1248///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
1249///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
1250///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
1251///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
1252///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
1253///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
1254/// c: `&mut [f64]` -> Array of constants
1255/// returns `VipsImage` - Output image
1256pub fn relational_const(
1257    inp: &VipsImage,
1258    relational: OperationRelational,
1259    c: &mut [f64],
1260) -> Result<VipsImage> {
1261    unsafe {
1262        let inp_in: *mut bindings::VipsImage = inp.ctx;
1263        let relational_in: i32 = relational as i32;
1264        let c_in: *mut f64 = c.as_mut_ptr();
1265        let mut out_out: *mut bindings::VipsImage = null_mut();
1266
1267        let vips_op_response = bindings::vips_relational_const(
1268            inp_in,
1269            &mut out_out,
1270            relational_in.try_into().unwrap(),
1271            c_in,
1272            c.len() as i32,
1273            NULL,
1274        );
1275        utils::result(
1276            vips_op_response,
1277            VipsImage { ctx: out_out },
1278            Error::RelationalConstError,
1279        )
1280    }
1281}
1282
1283/// VipsRemainderConst (remainder_const), remainder after integer division of an image and a constant
1284/// inp: `&VipsImage` -> Input image
1285/// c: `&mut [f64]` -> Array of constants
1286/// returns `VipsImage` - Output image
1287pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1288    unsafe {
1289        let inp_in: *mut bindings::VipsImage = inp.ctx;
1290        let c_in: *mut f64 = c.as_mut_ptr();
1291        let mut out_out: *mut bindings::VipsImage = null_mut();
1292
1293        let vips_op_response =
1294            bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1295        utils::result(
1296            vips_op_response,
1297            VipsImage { ctx: out_out },
1298            Error::RemainderConstError,
1299        )
1300    }
1301}
1302
1303/// VipsBooleanConst (boolean_const), boolean operations against a constant
1304/// inp: `&VipsImage` -> Input image
1305/// boolean: `OperationBoolean` -> Boolean to perform
1306///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1307///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1308///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1309///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1310///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1311/// c: `&mut [f64]` -> Array of constants
1312/// returns `VipsImage` - Output image
1313pub fn boolean_const(
1314    inp: &VipsImage,
1315    boolean: OperationBoolean,
1316    c: &mut [f64],
1317) -> Result<VipsImage> {
1318    unsafe {
1319        let inp_in: *mut bindings::VipsImage = inp.ctx;
1320        let boolean_in: i32 = boolean as i32;
1321        let c_in: *mut f64 = c.as_mut_ptr();
1322        let mut out_out: *mut bindings::VipsImage = null_mut();
1323
1324        let vips_op_response = bindings::vips_boolean_const(
1325            inp_in,
1326            &mut out_out,
1327            boolean_in.try_into().unwrap(),
1328            c_in,
1329            c.len() as i32,
1330            NULL,
1331        );
1332        utils::result(
1333            vips_op_response,
1334            VipsImage { ctx: out_out },
1335            Error::BooleanConstError,
1336        )
1337    }
1338}
1339
1340/// VipsMath2Const (math2_const), binary math operations with a constant
1341/// inp: `&VipsImage` -> Input image
1342/// math_2: `OperationMath2` -> Math to perform
1343///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1344///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1345///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1346/// c: `&mut [f64]` -> Array of constants
1347/// returns `VipsImage` - Output image
1348pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1349    unsafe {
1350        let inp_in: *mut bindings::VipsImage = inp.ctx;
1351        let math_2_in: i32 = math_2 as i32;
1352        let c_in: *mut f64 = c.as_mut_ptr();
1353        let mut out_out: *mut bindings::VipsImage = null_mut();
1354
1355        let vips_op_response = bindings::vips_math2_const(
1356            inp_in,
1357            &mut out_out,
1358            math_2_in.try_into().unwrap(),
1359            c_in,
1360            c.len() as i32,
1361            NULL,
1362        );
1363        utils::result(
1364            vips_op_response,
1365            VipsImage { ctx: out_out },
1366            Error::Math2ConstError,
1367        )
1368    }
1369}
1370
1371/// VipsComplex (complex), perform a complex operation on an image
1372/// inp: `&VipsImage` -> Input image
1373/// cmplx: `OperationComplex` -> Complex to perform
1374///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0 [DEFAULT]
1375///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
1376///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
1377/// returns `VipsImage` - Output image
1378pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1379    unsafe {
1380        let inp_in: *mut bindings::VipsImage = inp.ctx;
1381        let cmplx_in: i32 = cmplx as i32;
1382        let mut out_out: *mut bindings::VipsImage = null_mut();
1383
1384        let vips_op_response =
1385            bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1386        utils::result(
1387            vips_op_response,
1388            VipsImage { ctx: out_out },
1389            Error::ComplexError,
1390        )
1391    }
1392}
1393
1394/// VipsComplexget (complexget), get a component from a complex image
1395/// inp: `&VipsImage` -> Input image
1396/// get: `OperationComplexget` -> Complex to perform
1397///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0 [DEFAULT]
1398///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
1399/// returns `VipsImage` - Output image
1400pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1401    unsafe {
1402        let inp_in: *mut bindings::VipsImage = inp.ctx;
1403        let get_in: i32 = get as i32;
1404        let mut out_out: *mut bindings::VipsImage = null_mut();
1405
1406        let vips_op_response =
1407            bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1408        utils::result(
1409            vips_op_response,
1410            VipsImage { ctx: out_out },
1411            Error::ComplexgetError,
1412        )
1413    }
1414}
1415
1416/// VipsSum (sum), sum an array of images
1417/// inp: `&mut [VipsImage]` -> Array of input images
1418/// returns `VipsImage` - Output image
1419pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1420    unsafe {
1421        let (inp_len, mut inp_in) = {
1422            let len = inp.len();
1423            let mut input = Vec::new();
1424            for img in inp {
1425                input.push(img.ctx)
1426            }
1427            (len as i32, input)
1428        };
1429        let mut out_out: *mut bindings::VipsImage = null_mut();
1430
1431        let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1432        utils::result(
1433            vips_op_response,
1434            VipsImage { ctx: out_out },
1435            Error::SumError,
1436        )
1437    }
1438}
1439
1440/// VipsAvg (avg), find image average
1441/// inp: `&VipsImage` -> Input image
1442/// returns `f64` - Output value
1443pub fn avg(inp: &VipsImage) -> Result<f64> {
1444    unsafe {
1445        let inp_in: *mut bindings::VipsImage = inp.ctx;
1446        let mut out_out: f64 = f64::from(0);
1447
1448        let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1449        utils::result(vips_op_response, out_out, Error::AvgError)
1450    }
1451}
1452
1453/// VipsMin (min), find image minimum
1454/// inp: `&VipsImage` -> Input image
1455/// returns `f64` - Output value
1456pub fn min(inp: &VipsImage) -> Result<f64> {
1457    unsafe {
1458        let inp_in: *mut bindings::VipsImage = inp.ctx;
1459        let mut out_out: f64 = f64::from(0);
1460
1461        let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1462        utils::result(vips_op_response, out_out, Error::MinError)
1463    }
1464}
1465
1466/// Options for min operation
1467#[derive(Clone, Debug)]
1468pub struct MinOptions {
1469    /// x: `i32` -> Horizontal position of minimum
1470    /// min: 0, max: 100000000, default: 0
1471    pub x: i32,
1472    /// y: `i32` -> Vertical position of minimum
1473    /// min: 0, max: 100000000, default: 0
1474    pub y: i32,
1475    /// size: `i32` -> Number of minimum values to find
1476    /// min: 1, max: 1000000, default: 1
1477    pub size: i32,
1478    /// out_array: `Vec<f64>` -> Array of output values
1479    pub out_array: Vec<f64>,
1480    /// x_array: `Vec<i32>` -> Array of horizontal positions
1481    pub x_array: Vec<i32>,
1482    /// y_array: `Vec<i32>` -> Array of vertical positions
1483    pub y_array: Vec<i32>,
1484}
1485
1486impl std::default::Default for MinOptions {
1487    fn default() -> Self {
1488        MinOptions {
1489            x: i32::from(0),
1490            y: i32::from(0),
1491            size: i32::from(1),
1492            out_array: Vec::new(),
1493            x_array: Vec::new(),
1494            y_array: Vec::new(),
1495        }
1496    }
1497}
1498
1499/// VipsMin (min), find image minimum
1500/// inp: `&VipsImage` -> Input image
1501/// min_options: `&MinOptions` -> optional arguments
1502/// returns `f64` - Output value
1503pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1504    unsafe {
1505        let inp_in: *mut bindings::VipsImage = inp.ctx;
1506        let mut out_out: f64 = f64::from(0);
1507
1508        let x_in: i32 = min_options.x;
1509        let x_in_name = utils::new_c_string("x")?;
1510
1511        let y_in: i32 = min_options.y;
1512        let y_in_name = utils::new_c_string("y")?;
1513
1514        let size_in: i32 = min_options.size;
1515        let size_in_name = utils::new_c_string("size")?;
1516
1517        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1518        let out_array_in = out_array_wrapper.ctx;
1519        let out_array_in_name = utils::new_c_string("out-array")?;
1520
1521        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1522        let x_array_in = x_array_wrapper.ctx;
1523        let x_array_in_name = utils::new_c_string("x-array")?;
1524
1525        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1526        let y_array_in = y_array_wrapper.ctx;
1527        let y_array_in_name = utils::new_c_string("y-array")?;
1528
1529        let vips_op_response = bindings::vips_min(
1530            inp_in,
1531            &mut out_out,
1532            x_in_name.as_ptr(),
1533            x_in,
1534            y_in_name.as_ptr(),
1535            y_in,
1536            size_in_name.as_ptr(),
1537            size_in,
1538            out_array_in_name.as_ptr(),
1539            out_array_in,
1540            x_array_in_name.as_ptr(),
1541            x_array_in,
1542            y_array_in_name.as_ptr(),
1543            y_array_in,
1544            NULL,
1545        );
1546        utils::result(vips_op_response, out_out, Error::MinError)
1547    }
1548}
1549
1550/// VipsMax (max), find image maximum
1551/// inp: `&VipsImage` -> Input image
1552/// returns `f64` - Output value
1553pub fn max(inp: &VipsImage) -> Result<f64> {
1554    unsafe {
1555        let inp_in: *mut bindings::VipsImage = inp.ctx;
1556        let mut out_out: f64 = f64::from(0);
1557
1558        let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1559        utils::result(vips_op_response, out_out, Error::MaxError)
1560    }
1561}
1562
1563/// Options for max operation
1564#[derive(Clone, Debug)]
1565pub struct MaxOptions {
1566    /// x: `i32` -> Horizontal position of maximum
1567    /// min: 0, max: 100000000, default: 0
1568    pub x: i32,
1569    /// y: `i32` -> Vertical position of maximum
1570    /// min: 0, max: 100000000, default: 0
1571    pub y: i32,
1572    /// size: `i32` -> Number of maximum values to find
1573    /// min: 1, max: 1000000, default: 1
1574    pub size: i32,
1575    /// out_array: `Vec<f64>` -> Array of output values
1576    pub out_array: Vec<f64>,
1577    /// x_array: `Vec<i32>` -> Array of horizontal positions
1578    pub x_array: Vec<i32>,
1579    /// y_array: `Vec<i32>` -> Array of vertical positions
1580    pub y_array: Vec<i32>,
1581}
1582
1583impl std::default::Default for MaxOptions {
1584    fn default() -> Self {
1585        MaxOptions {
1586            x: i32::from(0),
1587            y: i32::from(0),
1588            size: i32::from(1),
1589            out_array: Vec::new(),
1590            x_array: Vec::new(),
1591            y_array: Vec::new(),
1592        }
1593    }
1594}
1595
1596/// VipsMax (max), find image maximum
1597/// inp: `&VipsImage` -> Input image
1598/// max_options: `&MaxOptions` -> optional arguments
1599/// returns `f64` - Output value
1600pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1601    unsafe {
1602        let inp_in: *mut bindings::VipsImage = inp.ctx;
1603        let mut out_out: f64 = f64::from(0);
1604
1605        let x_in: i32 = max_options.x;
1606        let x_in_name = utils::new_c_string("x")?;
1607
1608        let y_in: i32 = max_options.y;
1609        let y_in_name = utils::new_c_string("y")?;
1610
1611        let size_in: i32 = max_options.size;
1612        let size_in_name = utils::new_c_string("size")?;
1613
1614        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1615        let out_array_in = out_array_wrapper.ctx;
1616        let out_array_in_name = utils::new_c_string("out-array")?;
1617
1618        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1619        let x_array_in = x_array_wrapper.ctx;
1620        let x_array_in_name = utils::new_c_string("x-array")?;
1621
1622        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1623        let y_array_in = y_array_wrapper.ctx;
1624        let y_array_in_name = utils::new_c_string("y-array")?;
1625
1626        let vips_op_response = bindings::vips_max(
1627            inp_in,
1628            &mut out_out,
1629            x_in_name.as_ptr(),
1630            x_in,
1631            y_in_name.as_ptr(),
1632            y_in,
1633            size_in_name.as_ptr(),
1634            size_in,
1635            out_array_in_name.as_ptr(),
1636            out_array_in,
1637            x_array_in_name.as_ptr(),
1638            x_array_in,
1639            y_array_in_name.as_ptr(),
1640            y_array_in,
1641            NULL,
1642        );
1643        utils::result(vips_op_response, out_out, Error::MaxError)
1644    }
1645}
1646
1647/// VipsDeviate (deviate), find image standard deviation
1648/// inp: `&VipsImage` -> Input image
1649/// returns `f64` - Output value
1650pub fn deviate(inp: &VipsImage) -> Result<f64> {
1651    unsafe {
1652        let inp_in: *mut bindings::VipsImage = inp.ctx;
1653        let mut out_out: f64 = f64::from(0);
1654
1655        let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1656        utils::result(vips_op_response, out_out, Error::DeviateError)
1657    }
1658}
1659
1660/// VipsStats (stats), find many image stats
1661/// inp: `&VipsImage` -> Input image
1662/// returns `VipsImage` - Output array of statistics
1663pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1664    unsafe {
1665        let inp_in: *mut bindings::VipsImage = inp.ctx;
1666        let mut out_out: *mut bindings::VipsImage = null_mut();
1667
1668        let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1669        utils::result(
1670            vips_op_response,
1671            VipsImage { ctx: out_out },
1672            Error::StatError,
1673        )
1674    }
1675}
1676
1677/// VipsHistFind (hist_find), find image histogram
1678/// inp: `&VipsImage` -> Input image
1679/// returns `VipsImage` - Output histogram
1680pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1681    unsafe {
1682        let inp_in: *mut bindings::VipsImage = inp.ctx;
1683        let mut out_out: *mut bindings::VipsImage = null_mut();
1684
1685        let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1686        utils::result(
1687            vips_op_response,
1688            VipsImage { ctx: out_out },
1689            Error::HistFindError,
1690        )
1691    }
1692}
1693
1694/// Options for hist_find operation
1695#[derive(Clone, Debug)]
1696pub struct HistFindOptions {
1697    /// band: `i32` -> Find histogram of band
1698    /// min: -1, max: 100000, default: -1
1699    pub band: i32,
1700}
1701
1702impl std::default::Default for HistFindOptions {
1703    fn default() -> Self {
1704        HistFindOptions {
1705            band: i32::from(-1),
1706        }
1707    }
1708}
1709
1710/// VipsHistFind (hist_find), find image histogram
1711/// inp: `&VipsImage` -> Input image
1712/// hist_find_options: `&HistFindOptions` -> optional arguments
1713/// returns `VipsImage` - Output histogram
1714pub fn hist_find_with_opts(
1715    inp: &VipsImage,
1716    hist_find_options: &HistFindOptions,
1717) -> Result<VipsImage> {
1718    unsafe {
1719        let inp_in: *mut bindings::VipsImage = inp.ctx;
1720        let mut out_out: *mut bindings::VipsImage = null_mut();
1721
1722        let band_in: i32 = hist_find_options.band;
1723        let band_in_name = utils::new_c_string("band")?;
1724
1725        let vips_op_response =
1726            bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1727        utils::result(
1728            vips_op_response,
1729            VipsImage { ctx: out_out },
1730            Error::HistFindError,
1731        )
1732    }
1733}
1734
1735/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1736/// inp: `&VipsImage` -> Input image
1737/// returns `VipsImage` - Output histogram
1738pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1739    unsafe {
1740        let inp_in: *mut bindings::VipsImage = inp.ctx;
1741        let mut out_out: *mut bindings::VipsImage = null_mut();
1742
1743        let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1744        utils::result(
1745            vips_op_response,
1746            VipsImage { ctx: out_out },
1747            Error::HistFindNdimError,
1748        )
1749    }
1750}
1751
1752/// Options for hist_find_ndim operation
1753#[derive(Clone, Debug)]
1754pub struct HistFindNdimOptions {
1755    /// bins: `i32` -> Number of bins in each dimension
1756    /// min: 1, max: 65536, default: 10
1757    pub bins: i32,
1758}
1759
1760impl std::default::Default for HistFindNdimOptions {
1761    fn default() -> Self {
1762        HistFindNdimOptions {
1763            bins: i32::from(10),
1764        }
1765    }
1766}
1767
1768/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1769/// inp: `&VipsImage` -> Input image
1770/// hist_find_ndim_options: `&HistFindNdimOptions` -> optional arguments
1771/// returns `VipsImage` - Output histogram
1772pub fn hist_find_ndim_with_opts(
1773    inp: &VipsImage,
1774    hist_find_ndim_options: &HistFindNdimOptions,
1775) -> Result<VipsImage> {
1776    unsafe {
1777        let inp_in: *mut bindings::VipsImage = inp.ctx;
1778        let mut out_out: *mut bindings::VipsImage = null_mut();
1779
1780        let bins_in: i32 = hist_find_ndim_options.bins;
1781        let bins_in_name = utils::new_c_string("bins")?;
1782
1783        let vips_op_response = bindings::vips_hist_find_ndim(
1784            inp_in,
1785            &mut out_out,
1786            bins_in_name.as_ptr(),
1787            bins_in,
1788            NULL,
1789        );
1790        utils::result(
1791            vips_op_response,
1792            VipsImage { ctx: out_out },
1793            Error::HistFindNdimError,
1794        )
1795    }
1796}
1797
1798/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1799/// inp: `&VipsImage` -> Input image
1800/// index: `&VipsImage` -> Index image
1801/// returns `VipsImage` - Output histogram
1802pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1803    unsafe {
1804        let inp_in: *mut bindings::VipsImage = inp.ctx;
1805        let index_in: *mut bindings::VipsImage = index.ctx;
1806        let mut out_out: *mut bindings::VipsImage = null_mut();
1807
1808        let vips_op_response =
1809            bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1810        utils::result(
1811            vips_op_response,
1812            VipsImage { ctx: out_out },
1813            Error::HistFindIndexedError,
1814        )
1815    }
1816}
1817
1818/// Options for hist_find_indexed operation
1819#[derive(Clone, Debug)]
1820pub struct HistFindIndexedOptions {
1821    /// combine: `Combine` -> Combine bins like this
1822    ///  `Max` -> VIPS_COMBINE_MAX = 0
1823    ///  `Sum` -> VIPS_COMBINE_SUM = 1 [DEFAULT]
1824    ///  `Min` -> VIPS_COMBINE_MIN = 2
1825    pub combine: Combine,
1826}
1827
1828impl std::default::Default for HistFindIndexedOptions {
1829    fn default() -> Self {
1830        HistFindIndexedOptions {
1831            combine: Combine::Sum,
1832        }
1833    }
1834}
1835
1836/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1837/// inp: `&VipsImage` -> Input image
1838/// index: `&VipsImage` -> Index image
1839/// hist_find_indexed_options: `&HistFindIndexedOptions` -> optional arguments
1840/// returns `VipsImage` - Output histogram
1841pub fn hist_find_indexed_with_opts(
1842    inp: &VipsImage,
1843    index: &VipsImage,
1844    hist_find_indexed_options: &HistFindIndexedOptions,
1845) -> Result<VipsImage> {
1846    unsafe {
1847        let inp_in: *mut bindings::VipsImage = inp.ctx;
1848        let index_in: *mut bindings::VipsImage = index.ctx;
1849        let mut out_out: *mut bindings::VipsImage = null_mut();
1850
1851        let combine_in: i32 = hist_find_indexed_options.combine as i32;
1852        let combine_in_name = utils::new_c_string("combine")?;
1853
1854        let vips_op_response = bindings::vips_hist_find_indexed(
1855            inp_in,
1856            index_in,
1857            &mut out_out,
1858            combine_in_name.as_ptr(),
1859            combine_in,
1860            NULL,
1861        );
1862        utils::result(
1863            vips_op_response,
1864            VipsImage { ctx: out_out },
1865            Error::HistFindIndexedError,
1866        )
1867    }
1868}
1869
1870/// VipsHoughLine (hough_line), find hough line transform
1871/// inp: `&VipsImage` -> Input image
1872/// returns `VipsImage` - Output image
1873pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1874    unsafe {
1875        let inp_in: *mut bindings::VipsImage = inp.ctx;
1876        let mut out_out: *mut bindings::VipsImage = null_mut();
1877
1878        let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1879        utils::result(
1880            vips_op_response,
1881            VipsImage { ctx: out_out },
1882            Error::HoughLineError,
1883        )
1884    }
1885}
1886
1887/// Options for hough_line operation
1888#[derive(Clone, Debug)]
1889pub struct HoughLineOptions {
1890    /// width: `i32` -> Horizontal size of parameter space
1891    /// min: 1, max: 100000, default: 256
1892    pub width: i32,
1893    /// height: `i32` -> Vertical size of parameter space
1894    /// min: 1, max: 100000, default: 256
1895    pub height: i32,
1896}
1897
1898impl std::default::Default for HoughLineOptions {
1899    fn default() -> Self {
1900        HoughLineOptions {
1901            width: i32::from(256),
1902            height: i32::from(256),
1903        }
1904    }
1905}
1906
1907/// VipsHoughLine (hough_line), find hough line transform
1908/// inp: `&VipsImage` -> Input image
1909/// hough_line_options: `&HoughLineOptions` -> optional arguments
1910/// returns `VipsImage` - Output image
1911pub fn hough_line_with_opts(
1912    inp: &VipsImage,
1913    hough_line_options: &HoughLineOptions,
1914) -> Result<VipsImage> {
1915    unsafe {
1916        let inp_in: *mut bindings::VipsImage = inp.ctx;
1917        let mut out_out: *mut bindings::VipsImage = null_mut();
1918
1919        let width_in: i32 = hough_line_options.width;
1920        let width_in_name = utils::new_c_string("width")?;
1921
1922        let height_in: i32 = hough_line_options.height;
1923        let height_in_name = utils::new_c_string("height")?;
1924
1925        let vips_op_response = bindings::vips_hough_line(
1926            inp_in,
1927            &mut out_out,
1928            width_in_name.as_ptr(),
1929            width_in,
1930            height_in_name.as_ptr(),
1931            height_in,
1932            NULL,
1933        );
1934        utils::result(
1935            vips_op_response,
1936            VipsImage { ctx: out_out },
1937            Error::HoughLineError,
1938        )
1939    }
1940}
1941
1942/// VipsHoughCircle (hough_circle), find hough circle transform
1943/// inp: `&VipsImage` -> Input image
1944/// returns `VipsImage` - Output image
1945pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
1946    unsafe {
1947        let inp_in: *mut bindings::VipsImage = inp.ctx;
1948        let mut out_out: *mut bindings::VipsImage = null_mut();
1949
1950        let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
1951        utils::result(
1952            vips_op_response,
1953            VipsImage { ctx: out_out },
1954            Error::HoughCircleError,
1955        )
1956    }
1957}
1958
1959/// Options for hough_circle operation
1960#[derive(Clone, Debug)]
1961pub struct HoughCircleOptions {
1962    /// scale: `i32` -> Scale down dimensions by this factor
1963    /// min: 1, max: 100000, default: 1
1964    pub scale: i32,
1965    /// min_radius: `i32` -> Smallest radius to search for
1966    /// min: 1, max: 100000, default: 10
1967    pub min_radius: i32,
1968    /// max_radius: `i32` -> Largest radius to search for
1969    /// min: 1, max: 100000, default: 20
1970    pub max_radius: i32,
1971}
1972
1973impl std::default::Default for HoughCircleOptions {
1974    fn default() -> Self {
1975        HoughCircleOptions {
1976            scale: i32::from(1),
1977            min_radius: i32::from(10),
1978            max_radius: i32::from(20),
1979        }
1980    }
1981}
1982
1983/// VipsHoughCircle (hough_circle), find hough circle transform
1984/// inp: `&VipsImage` -> Input image
1985/// hough_circle_options: `&HoughCircleOptions` -> optional arguments
1986/// returns `VipsImage` - Output image
1987pub fn hough_circle_with_opts(
1988    inp: &VipsImage,
1989    hough_circle_options: &HoughCircleOptions,
1990) -> Result<VipsImage> {
1991    unsafe {
1992        let inp_in: *mut bindings::VipsImage = inp.ctx;
1993        let mut out_out: *mut bindings::VipsImage = null_mut();
1994
1995        let scale_in: i32 = hough_circle_options.scale;
1996        let scale_in_name = utils::new_c_string("scale")?;
1997
1998        let min_radius_in: i32 = hough_circle_options.min_radius;
1999        let min_radius_in_name = utils::new_c_string("min-radius")?;
2000
2001        let max_radius_in: i32 = hough_circle_options.max_radius;
2002        let max_radius_in_name = utils::new_c_string("max-radius")?;
2003
2004        let vips_op_response = bindings::vips_hough_circle(
2005            inp_in,
2006            &mut out_out,
2007            scale_in_name.as_ptr(),
2008            scale_in,
2009            min_radius_in_name.as_ptr(),
2010            min_radius_in,
2011            max_radius_in_name.as_ptr(),
2012            max_radius_in,
2013            NULL,
2014        );
2015        utils::result(
2016            vips_op_response,
2017            VipsImage { ctx: out_out },
2018            Error::HoughCircleError,
2019        )
2020    }
2021}
2022
2023/// VipsProject (project), find image projections
2024/// inp: `&VipsImage` -> Input image
2025/// Tuple (
2026/// VipsImage - Sums of columns
2027/// VipsImage - Sums of rows
2028///)
2029pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2030    unsafe {
2031        let inp_in: *mut bindings::VipsImage = inp.ctx;
2032        let mut columns_out: *mut bindings::VipsImage = null_mut();
2033        let mut rows_out: *mut bindings::VipsImage = null_mut();
2034
2035        let vips_op_response =
2036            bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2037        utils::result(
2038            vips_op_response,
2039            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2040            Error::ProjectError,
2041        )
2042    }
2043}
2044
2045/// VipsProfile (profile), find image profiles
2046/// inp: `&VipsImage` -> Input image
2047/// Tuple (
2048/// VipsImage - First non-zero pixel in column
2049/// VipsImage - First non-zero pixel in row
2050///)
2051pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2052    unsafe {
2053        let inp_in: *mut bindings::VipsImage = inp.ctx;
2054        let mut columns_out: *mut bindings::VipsImage = null_mut();
2055        let mut rows_out: *mut bindings::VipsImage = null_mut();
2056
2057        let vips_op_response =
2058            bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2059        utils::result(
2060            vips_op_response,
2061            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2062            Error::ProfileError,
2063        )
2064    }
2065}
2066
2067/// VipsMeasure (measure), measure a set of patches on a color chart
2068/// inp: `&VipsImage` -> Image to measure
2069/// h: `i32` -> Number of patches across chart
2070/// min: 1, max: 100000000, default: 1
2071/// v: `i32` -> Number of patches down chart
2072/// min: 1, max: 100000000, default: 1
2073/// returns `VipsImage` - Output array of statistics
2074pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2075    unsafe {
2076        let inp_in: *mut bindings::VipsImage = inp.ctx;
2077        let h_in: i32 = h;
2078        let v_in: i32 = v;
2079        let mut out_out: *mut bindings::VipsImage = null_mut();
2080
2081        let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2082        utils::result(
2083            vips_op_response,
2084            VipsImage { ctx: out_out },
2085            Error::MeasureError,
2086        )
2087    }
2088}
2089
2090/// Options for measure operation
2091#[derive(Clone, Debug)]
2092pub struct MeasureOptions {
2093    /// left: `i32` -> Left edge of extract area
2094    /// min: 0, max: 100000000, default: 0
2095    pub left: i32,
2096    /// top: `i32` -> Top edge of extract area
2097    /// min: 0, max: 100000000, default: 0
2098    pub top: i32,
2099    /// width: `i32` -> Width of extract area
2100    /// min: 1, max: 100000000, default: 1
2101    pub width: i32,
2102    /// height: `i32` -> Height of extract area
2103    /// min: 1, max: 100000000, default: 1
2104    pub height: i32,
2105}
2106
2107impl std::default::Default for MeasureOptions {
2108    fn default() -> Self {
2109        MeasureOptions {
2110            left: i32::from(0),
2111            top: i32::from(0),
2112            width: i32::from(1),
2113            height: i32::from(1),
2114        }
2115    }
2116}
2117
2118/// VipsMeasure (measure), measure a set of patches on a color chart
2119/// inp: `&VipsImage` -> Image to measure
2120/// h: `i32` -> Number of patches across chart
2121/// min: 1, max: 100000000, default: 1
2122/// v: `i32` -> Number of patches down chart
2123/// min: 1, max: 100000000, default: 1
2124/// measure_options: `&MeasureOptions` -> optional arguments
2125/// returns `VipsImage` - Output array of statistics
2126pub fn measure_with_opts(
2127    inp: &VipsImage,
2128    h: i32,
2129    v: i32,
2130    measure_options: &MeasureOptions,
2131) -> Result<VipsImage> {
2132    unsafe {
2133        let inp_in: *mut bindings::VipsImage = inp.ctx;
2134        let h_in: i32 = h;
2135        let v_in: i32 = v;
2136        let mut out_out: *mut bindings::VipsImage = null_mut();
2137
2138        let left_in: i32 = measure_options.left;
2139        let left_in_name = utils::new_c_string("left")?;
2140
2141        let top_in: i32 = measure_options.top;
2142        let top_in_name = utils::new_c_string("top")?;
2143
2144        let width_in: i32 = measure_options.width;
2145        let width_in_name = utils::new_c_string("width")?;
2146
2147        let height_in: i32 = measure_options.height;
2148        let height_in_name = utils::new_c_string("height")?;
2149
2150        let vips_op_response = bindings::vips_measure(
2151            inp_in,
2152            &mut out_out,
2153            h_in,
2154            v_in,
2155            left_in_name.as_ptr(),
2156            left_in,
2157            top_in_name.as_ptr(),
2158            top_in,
2159            width_in_name.as_ptr(),
2160            width_in,
2161            height_in_name.as_ptr(),
2162            height_in,
2163            NULL,
2164        );
2165        utils::result(
2166            vips_op_response,
2167            VipsImage { ctx: out_out },
2168            Error::MeasureError,
2169        )
2170    }
2171}
2172
2173/// VipsFindTrim (find_trim), search an image for non-edge areas
2174/// inp: `&VipsImage` -> Image to find_trim
2175/// Tuple (
2176/// i32 - Left edge of image
2177/// i32 - Top edge of extract area
2178/// i32 - Width of extract area
2179/// i32 - Height of extract area
2180///)
2181pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2182    unsafe {
2183        let inp_in: *mut bindings::VipsImage = inp.ctx;
2184        let mut left_out: i32 = i32::from(1);
2185        let mut top_out: i32 = i32::from(0);
2186        let mut width_out: i32 = i32::from(1);
2187        let mut height_out: i32 = i32::from(1);
2188
2189        let vips_op_response = bindings::vips_find_trim(
2190            inp_in,
2191            &mut left_out,
2192            &mut top_out,
2193            &mut width_out,
2194            &mut height_out,
2195            NULL,
2196        );
2197        utils::result(
2198            vips_op_response,
2199            (left_out, top_out, width_out, height_out),
2200            Error::FindTrimError,
2201        )
2202    }
2203}
2204
2205/// Options for find_trim operation
2206#[derive(Clone, Debug)]
2207pub struct FindTrimOptions {
2208    /// threshold: `f64` -> Object threshold
2209    /// min: 0, max: inf, default: 10
2210    pub threshold: f64,
2211    /// background: `Vec<f64>` -> Color for background pixels
2212    pub background: Vec<f64>,
2213    /// line_art: `bool` -> Enable line art mode
2214    /// default: false
2215    pub line_art: bool,
2216}
2217
2218impl std::default::Default for FindTrimOptions {
2219    fn default() -> Self {
2220        FindTrimOptions {
2221            threshold: f64::from(10),
2222            background: Vec::new(),
2223            line_art: false,
2224        }
2225    }
2226}
2227
2228/// VipsFindTrim (find_trim), search an image for non-edge areas
2229/// inp: `&VipsImage` -> Image to find_trim
2230/// find_trim_options: `&FindTrimOptions` -> optional arguments
2231/// Tuple (
2232/// i32 - Left edge of image
2233/// i32 - Top edge of extract area
2234/// i32 - Width of extract area
2235/// i32 - Height of extract area
2236///)
2237pub fn find_trim_with_opts(
2238    inp: &VipsImage,
2239    find_trim_options: &FindTrimOptions,
2240) -> Result<(i32, i32, i32, i32)> {
2241    unsafe {
2242        let inp_in: *mut bindings::VipsImage = inp.ctx;
2243        let mut left_out: i32 = i32::from(1);
2244        let mut top_out: i32 = i32::from(0);
2245        let mut width_out: i32 = i32::from(1);
2246        let mut height_out: i32 = i32::from(1);
2247
2248        let threshold_in: f64 = find_trim_options.threshold;
2249        let threshold_in_name = utils::new_c_string("threshold")?;
2250
2251        let background_wrapper =
2252            utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2253        let background_in = background_wrapper.ctx;
2254        let background_in_name = utils::new_c_string("background")?;
2255
2256        let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2257        let line_art_in_name = utils::new_c_string("line-art")?;
2258
2259        let vips_op_response = bindings::vips_find_trim(
2260            inp_in,
2261            &mut left_out,
2262            &mut top_out,
2263            &mut width_out,
2264            &mut height_out,
2265            threshold_in_name.as_ptr(),
2266            threshold_in,
2267            background_in_name.as_ptr(),
2268            background_in,
2269            line_art_in_name.as_ptr(),
2270            line_art_in,
2271            NULL,
2272        );
2273        utils::result(
2274            vips_op_response,
2275            (left_out, top_out, width_out, height_out),
2276            Error::FindTrimError,
2277        )
2278    }
2279}
2280
2281/// VipsCopy (copy), copy an image, nocache
2282/// inp: `&VipsImage` -> Input image
2283/// returns `VipsImage` - Output image
2284pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2285    unsafe {
2286        let inp_in: *mut bindings::VipsImage = inp.ctx;
2287        let mut out_out: *mut bindings::VipsImage = null_mut();
2288
2289        let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2290        utils::result(
2291            vips_op_response,
2292            VipsImage { ctx: out_out },
2293            Error::CopyError,
2294        )
2295    }
2296}
2297
2298/// Options for copy operation
2299#[derive(Clone, Debug)]
2300pub struct CopyOptions {
2301    /// width: `i32` -> Image width in pixels
2302    /// min: 0, max: 100000000, default: 0
2303    pub width: i32,
2304    /// height: `i32` -> Image height in pixels
2305    /// min: 0, max: 100000000, default: 0
2306    pub height: i32,
2307    /// bands: `i32` -> Number of bands in image
2308    /// min: 0, max: 100000000, default: 0
2309    pub bands: i32,
2310    /// format: `BandFormat` -> Pixel format in image
2311    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
2312    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
2313    ///  `Char` -> VIPS_FORMAT_CHAR = 1
2314    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
2315    ///  `Short` -> VIPS_FORMAT_SHORT = 3
2316    ///  `Uint` -> VIPS_FORMAT_UINT = 4
2317    ///  `Int` -> VIPS_FORMAT_INT = 5
2318    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
2319    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
2320    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
2321    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
2322    pub format: BandFormat,
2323    /// coding: `Coding` -> Pixel coding
2324    ///  `Error` -> VIPS_CODING_ERROR = -1
2325    ///  `None` -> VIPS_CODING_NONE = 0 [DEFAULT]
2326    ///  `Labq` -> VIPS_CODING_LABQ = 2
2327    ///  `Rad` -> VIPS_CODING_RAD = 6
2328    pub coding: Coding,
2329    /// interpretation: `Interpretation` -> Pixel interpretation
2330    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
2331    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
2332    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
2333    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
2334    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
2335    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
2336    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
2337    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
2338    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
2339    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
2340    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
2341    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
2342    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
2343    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
2344    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
2345    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
2346    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
2347    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
2348    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
2349    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
2350    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
2351    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
2352    pub interpretation: Interpretation,
2353    /// xres: `f64` -> Horizontal resolution in pixels/mm
2354    /// min: -0, max: 1000000, default: 0
2355    pub xres: f64,
2356    /// yres: `f64` -> Vertical resolution in pixels/mm
2357    /// min: -0, max: 1000000, default: 0
2358    pub yres: f64,
2359    /// xoffset: `i32` -> Horizontal offset of origin
2360    /// min: -100000000, max: 100000000, default: 0
2361    pub xoffset: i32,
2362    /// yoffset: `i32` -> Vertical offset of origin
2363    /// min: -100000000, max: 100000000, default: 0
2364    pub yoffset: i32,
2365}
2366
2367impl std::default::Default for CopyOptions {
2368    fn default() -> Self {
2369        CopyOptions {
2370            width: i32::from(0),
2371            height: i32::from(0),
2372            bands: i32::from(0),
2373            format: BandFormat::Uchar,
2374            coding: Coding::None,
2375            interpretation: Interpretation::Multiband,
2376            xres: f64::from(0),
2377            yres: f64::from(0),
2378            xoffset: i32::from(0),
2379            yoffset: i32::from(0),
2380        }
2381    }
2382}
2383
2384/// VipsCopy (copy), copy an image, nocache
2385/// inp: `&VipsImage` -> Input image
2386/// copy_options: `&CopyOptions` -> optional arguments
2387/// returns `VipsImage` - Output image
2388pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2389    unsafe {
2390        let inp_in: *mut bindings::VipsImage = inp.ctx;
2391        let mut out_out: *mut bindings::VipsImage = null_mut();
2392
2393        let width_in: i32 = copy_options.width;
2394        let width_in_name = utils::new_c_string("width")?;
2395
2396        let height_in: i32 = copy_options.height;
2397        let height_in_name = utils::new_c_string("height")?;
2398
2399        let bands_in: i32 = copy_options.bands;
2400        let bands_in_name = utils::new_c_string("bands")?;
2401
2402        let format_in: i32 = copy_options.format as i32;
2403        let format_in_name = utils::new_c_string("format")?;
2404
2405        let coding_in: i32 = copy_options.coding as i32;
2406        let coding_in_name = utils::new_c_string("coding")?;
2407
2408        let interpretation_in: i32 = copy_options.interpretation as i32;
2409        let interpretation_in_name = utils::new_c_string("interpretation")?;
2410
2411        let xres_in: f64 = copy_options.xres;
2412        let xres_in_name = utils::new_c_string("xres")?;
2413
2414        let yres_in: f64 = copy_options.yres;
2415        let yres_in_name = utils::new_c_string("yres")?;
2416
2417        let xoffset_in: i32 = copy_options.xoffset;
2418        let xoffset_in_name = utils::new_c_string("xoffset")?;
2419
2420        let yoffset_in: i32 = copy_options.yoffset;
2421        let yoffset_in_name = utils::new_c_string("yoffset")?;
2422
2423        let vips_op_response = bindings::vips_copy(
2424            inp_in,
2425            &mut out_out,
2426            width_in_name.as_ptr(),
2427            width_in,
2428            height_in_name.as_ptr(),
2429            height_in,
2430            bands_in_name.as_ptr(),
2431            bands_in,
2432            format_in_name.as_ptr(),
2433            format_in,
2434            coding_in_name.as_ptr(),
2435            coding_in,
2436            interpretation_in_name.as_ptr(),
2437            interpretation_in,
2438            xres_in_name.as_ptr(),
2439            xres_in,
2440            yres_in_name.as_ptr(),
2441            yres_in,
2442            xoffset_in_name.as_ptr(),
2443            xoffset_in,
2444            yoffset_in_name.as_ptr(),
2445            yoffset_in,
2446            NULL,
2447        );
2448        utils::result(
2449            vips_op_response,
2450            VipsImage { ctx: out_out },
2451            Error::CopyError,
2452        )
2453    }
2454}
2455
2456/// VipsTileCache (tilecache), cache an image as a set of tiles
2457/// inp: `&VipsImage` -> Input image
2458/// returns `VipsImage` - Output image
2459pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2460    unsafe {
2461        let inp_in: *mut bindings::VipsImage = inp.ctx;
2462        let mut out_out: *mut bindings::VipsImage = null_mut();
2463
2464        let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2465        utils::result(
2466            vips_op_response,
2467            VipsImage { ctx: out_out },
2468            Error::TilecacheError,
2469        )
2470    }
2471}
2472
2473/// Options for tilecache operation
2474#[derive(Clone, Debug)]
2475pub struct TilecacheOptions {
2476    /// tile_width: `i32` -> Tile width in pixels
2477    /// min: 1, max: 1000000, default: 128
2478    pub tile_width: i32,
2479    /// tile_height: `i32` -> Tile height in pixels
2480    /// min: 1, max: 1000000, default: 128
2481    pub tile_height: i32,
2482    /// max_tiles: `i32` -> Maximum number of tiles to cache
2483    /// min: -1, max: 1000000, default: 1000
2484    pub max_tiles: i32,
2485    /// access: `Access` -> Expected access pattern
2486    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2487    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2488    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2489    pub access: Access,
2490    /// threaded: `bool` -> Allow threaded access
2491    /// default: false
2492    pub threaded: bool,
2493    /// persistent: `bool` -> Keep cache between evaluations
2494    /// default: false
2495    pub persistent: bool,
2496}
2497
2498impl std::default::Default for TilecacheOptions {
2499    fn default() -> Self {
2500        TilecacheOptions {
2501            tile_width: i32::from(128),
2502            tile_height: i32::from(128),
2503            max_tiles: i32::from(1000),
2504            access: Access::Random,
2505            threaded: false,
2506            persistent: false,
2507        }
2508    }
2509}
2510
2511/// VipsTileCache (tilecache), cache an image as a set of tiles
2512/// inp: `&VipsImage` -> Input image
2513/// tilecache_options: `&TilecacheOptions` -> optional arguments
2514/// returns `VipsImage` - Output image
2515pub fn tilecache_with_opts(
2516    inp: &VipsImage,
2517    tilecache_options: &TilecacheOptions,
2518) -> Result<VipsImage> {
2519    unsafe {
2520        let inp_in: *mut bindings::VipsImage = inp.ctx;
2521        let mut out_out: *mut bindings::VipsImage = null_mut();
2522
2523        let tile_width_in: i32 = tilecache_options.tile_width;
2524        let tile_width_in_name = utils::new_c_string("tile-width")?;
2525
2526        let tile_height_in: i32 = tilecache_options.tile_height;
2527        let tile_height_in_name = utils::new_c_string("tile-height")?;
2528
2529        let max_tiles_in: i32 = tilecache_options.max_tiles;
2530        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2531
2532        let access_in: i32 = tilecache_options.access as i32;
2533        let access_in_name = utils::new_c_string("access")?;
2534
2535        let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2536        let threaded_in_name = utils::new_c_string("threaded")?;
2537
2538        let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2539        let persistent_in_name = utils::new_c_string("persistent")?;
2540
2541        let vips_op_response = bindings::vips_tilecache(
2542            inp_in,
2543            &mut out_out,
2544            tile_width_in_name.as_ptr(),
2545            tile_width_in,
2546            tile_height_in_name.as_ptr(),
2547            tile_height_in,
2548            max_tiles_in_name.as_ptr(),
2549            max_tiles_in,
2550            access_in_name.as_ptr(),
2551            access_in,
2552            threaded_in_name.as_ptr(),
2553            threaded_in,
2554            persistent_in_name.as_ptr(),
2555            persistent_in,
2556            NULL,
2557        );
2558        utils::result(
2559            vips_op_response,
2560            VipsImage { ctx: out_out },
2561            Error::TilecacheError,
2562        )
2563    }
2564}
2565
2566/// VipsLineCache (linecache), cache an image as a set of lines
2567/// inp: `&VipsImage` -> Input image
2568/// returns `VipsImage` - Output image
2569pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2570    unsafe {
2571        let inp_in: *mut bindings::VipsImage = inp.ctx;
2572        let mut out_out: *mut bindings::VipsImage = null_mut();
2573
2574        let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2575        utils::result(
2576            vips_op_response,
2577            VipsImage { ctx: out_out },
2578            Error::LinecacheError,
2579        )
2580    }
2581}
2582
2583/// Options for linecache operation
2584#[derive(Clone, Debug)]
2585pub struct LinecacheOptions {
2586    /// tile_height: `i32` -> Tile height in pixels
2587    /// min: 1, max: 1000000, default: 128
2588    pub tile_height: i32,
2589    /// access: `Access` -> Expected access pattern
2590    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2591    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2592    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2593    pub access: Access,
2594    /// threaded: `bool` -> Allow threaded access
2595    /// default: false
2596    pub threaded: bool,
2597    /// persistent: `bool` -> Keep cache between evaluations
2598    /// default: false
2599    pub persistent: bool,
2600}
2601
2602impl std::default::Default for LinecacheOptions {
2603    fn default() -> Self {
2604        LinecacheOptions {
2605            tile_height: i32::from(128),
2606            access: Access::Random,
2607            threaded: false,
2608            persistent: false,
2609        }
2610    }
2611}
2612
2613/// VipsLineCache (linecache), cache an image as a set of lines
2614/// inp: `&VipsImage` -> Input image
2615/// linecache_options: `&LinecacheOptions` -> optional arguments
2616/// returns `VipsImage` - Output image
2617pub fn linecache_with_opts(
2618    inp: &VipsImage,
2619    linecache_options: &LinecacheOptions,
2620) -> Result<VipsImage> {
2621    unsafe {
2622        let inp_in: *mut bindings::VipsImage = inp.ctx;
2623        let mut out_out: *mut bindings::VipsImage = null_mut();
2624
2625        let tile_height_in: i32 = linecache_options.tile_height;
2626        let tile_height_in_name = utils::new_c_string("tile-height")?;
2627
2628        let access_in: i32 = linecache_options.access as i32;
2629        let access_in_name = utils::new_c_string("access")?;
2630
2631        let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2632        let threaded_in_name = utils::new_c_string("threaded")?;
2633
2634        let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2635        let persistent_in_name = utils::new_c_string("persistent")?;
2636
2637        let vips_op_response = bindings::vips_linecache(
2638            inp_in,
2639            &mut out_out,
2640            tile_height_in_name.as_ptr(),
2641            tile_height_in,
2642            access_in_name.as_ptr(),
2643            access_in,
2644            threaded_in_name.as_ptr(),
2645            threaded_in,
2646            persistent_in_name.as_ptr(),
2647            persistent_in,
2648            NULL,
2649        );
2650        utils::result(
2651            vips_op_response,
2652            VipsImage { ctx: out_out },
2653            Error::LinecacheError,
2654        )
2655    }
2656}
2657
2658/// VipsSequential (sequential), check sequential access
2659/// inp: `&VipsImage` -> Input image
2660/// returns `VipsImage` - Output image
2661pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2662    unsafe {
2663        let inp_in: *mut bindings::VipsImage = inp.ctx;
2664        let mut out_out: *mut bindings::VipsImage = null_mut();
2665
2666        let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2667        utils::result(
2668            vips_op_response,
2669            VipsImage { ctx: out_out },
2670            Error::SequentialError,
2671        )
2672    }
2673}
2674
2675/// Options for sequential operation
2676#[derive(Clone, Debug)]
2677pub struct SequentialOptions {
2678    /// tile_height: `i32` -> Tile height in pixels
2679    /// min: 1, max: 1000000, default: 1
2680    pub tile_height: i32,
2681}
2682
2683impl std::default::Default for SequentialOptions {
2684    fn default() -> Self {
2685        SequentialOptions {
2686            tile_height: i32::from(1),
2687        }
2688    }
2689}
2690
2691/// VipsSequential (sequential), check sequential access
2692/// inp: `&VipsImage` -> Input image
2693/// sequential_options: `&SequentialOptions` -> optional arguments
2694/// returns `VipsImage` - Output image
2695pub fn sequential_with_opts(
2696    inp: &VipsImage,
2697    sequential_options: &SequentialOptions,
2698) -> Result<VipsImage> {
2699    unsafe {
2700        let inp_in: *mut bindings::VipsImage = inp.ctx;
2701        let mut out_out: *mut bindings::VipsImage = null_mut();
2702
2703        let tile_height_in: i32 = sequential_options.tile_height;
2704        let tile_height_in_name = utils::new_c_string("tile-height")?;
2705
2706        let vips_op_response = bindings::vips_sequential(
2707            inp_in,
2708            &mut out_out,
2709            tile_height_in_name.as_ptr(),
2710            tile_height_in,
2711            NULL,
2712        );
2713        utils::result(
2714            vips_op_response,
2715            VipsImage { ctx: out_out },
2716            Error::SequentialError,
2717        )
2718    }
2719}
2720
2721/// VipsEmbed (embed), embed an image in a larger image
2722/// inp: `&VipsImage` -> Input image
2723/// x: `i32` -> Left edge of input in output
2724/// min: -1000000000, max: 1000000000, default: 0
2725/// y: `i32` -> Top edge of input in output
2726/// min: -1000000000, max: 1000000000, default: 0
2727/// width: `i32` -> Image width in pixels
2728/// min: 1, max: 1000000000, default: 1
2729/// height: `i32` -> Image height in pixels
2730/// min: 1, max: 1000000000, default: 1
2731/// returns `VipsImage` - Output image
2732pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2733    unsafe {
2734        let inp_in: *mut bindings::VipsImage = inp.ctx;
2735        let x_in: i32 = x;
2736        let y_in: i32 = y;
2737        let width_in: i32 = width;
2738        let height_in: i32 = height;
2739        let mut out_out: *mut bindings::VipsImage = null_mut();
2740
2741        let vips_op_response =
2742            bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2743        utils::result(
2744            vips_op_response,
2745            VipsImage { ctx: out_out },
2746            Error::EmbedError,
2747        )
2748    }
2749}
2750
2751/// Options for embed operation
2752#[derive(Clone, Debug)]
2753pub struct EmbedOptions {
2754    /// extend: `Extend` -> How to generate the extra pixels
2755    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2756    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2757    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2758    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2759    ///  `White` -> VIPS_EXTEND_WHITE = 4
2760    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2761    pub extend: Extend,
2762    /// background: `Vec<f64>` -> Color for background pixels
2763    pub background: Vec<f64>,
2764}
2765
2766impl std::default::Default for EmbedOptions {
2767    fn default() -> Self {
2768        EmbedOptions {
2769            extend: Extend::Black,
2770            background: Vec::new(),
2771        }
2772    }
2773}
2774
2775/// VipsEmbed (embed), embed an image in a larger image
2776/// inp: `&VipsImage` -> Input image
2777/// x: `i32` -> Left edge of input in output
2778/// min: -1000000000, max: 1000000000, default: 0
2779/// y: `i32` -> Top edge of input in output
2780/// min: -1000000000, max: 1000000000, default: 0
2781/// width: `i32` -> Image width in pixels
2782/// min: 1, max: 1000000000, default: 1
2783/// height: `i32` -> Image height in pixels
2784/// min: 1, max: 1000000000, default: 1
2785/// embed_options: `&EmbedOptions` -> optional arguments
2786/// returns `VipsImage` - Output image
2787pub fn embed_with_opts(
2788    inp: &VipsImage,
2789    x: i32,
2790    y: i32,
2791    width: i32,
2792    height: i32,
2793    embed_options: &EmbedOptions,
2794) -> Result<VipsImage> {
2795    unsafe {
2796        let inp_in: *mut bindings::VipsImage = inp.ctx;
2797        let x_in: i32 = x;
2798        let y_in: i32 = y;
2799        let width_in: i32 = width;
2800        let height_in: i32 = height;
2801        let mut out_out: *mut bindings::VipsImage = null_mut();
2802
2803        let extend_in: i32 = embed_options.extend as i32;
2804        let extend_in_name = utils::new_c_string("extend")?;
2805
2806        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2807        let background_in = background_wrapper.ctx;
2808        let background_in_name = utils::new_c_string("background")?;
2809
2810        let vips_op_response = bindings::vips_embed(
2811            inp_in,
2812            &mut out_out,
2813            x_in,
2814            y_in,
2815            width_in,
2816            height_in,
2817            extend_in_name.as_ptr(),
2818            extend_in,
2819            background_in_name.as_ptr(),
2820            background_in,
2821            NULL,
2822        );
2823        utils::result(
2824            vips_op_response,
2825            VipsImage { ctx: out_out },
2826            Error::EmbedError,
2827        )
2828    }
2829}
2830
2831/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2832/// inp: `&VipsImage` -> Input image
2833/// direction: `CompassDirection` -> Direction to place image within width/height
2834///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2835///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2836///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2837///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2838///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2839///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2840///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2841///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2842///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2843/// width: `i32` -> Image width in pixels
2844/// min: 1, max: 1000000000, default: 1
2845/// height: `i32` -> Image height in pixels
2846/// min: 1, max: 1000000000, default: 1
2847/// returns `VipsImage` - Output image
2848pub fn gravity(
2849    inp: &VipsImage,
2850    direction: CompassDirection,
2851    width: i32,
2852    height: i32,
2853) -> Result<VipsImage> {
2854    unsafe {
2855        let inp_in: *mut bindings::VipsImage = inp.ctx;
2856        let direction_in: i32 = direction as i32;
2857        let width_in: i32 = width;
2858        let height_in: i32 = height;
2859        let mut out_out: *mut bindings::VipsImage = null_mut();
2860
2861        let vips_op_response = bindings::vips_gravity(
2862            inp_in,
2863            &mut out_out,
2864            direction_in.try_into().unwrap(),
2865            width_in,
2866            height_in,
2867            NULL,
2868        );
2869        utils::result(
2870            vips_op_response,
2871            VipsImage { ctx: out_out },
2872            Error::GravityError,
2873        )
2874    }
2875}
2876
2877/// Options for gravity operation
2878#[derive(Clone, Debug)]
2879pub struct GravityOptions {
2880    /// extend: `Extend` -> How to generate the extra pixels
2881    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2882    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2883    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2884    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2885    ///  `White` -> VIPS_EXTEND_WHITE = 4
2886    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2887    pub extend: Extend,
2888    /// background: `Vec<f64>` -> Color for background pixels
2889    pub background: Vec<f64>,
2890}
2891
2892impl std::default::Default for GravityOptions {
2893    fn default() -> Self {
2894        GravityOptions {
2895            extend: Extend::Black,
2896            background: Vec::new(),
2897        }
2898    }
2899}
2900
2901/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2902/// inp: `&VipsImage` -> Input image
2903/// direction: `CompassDirection` -> Direction to place image within width/height
2904///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2905///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2906///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2907///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2908///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2909///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2910///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2911///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2912///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2913/// width: `i32` -> Image width in pixels
2914/// min: 1, max: 1000000000, default: 1
2915/// height: `i32` -> Image height in pixels
2916/// min: 1, max: 1000000000, default: 1
2917/// gravity_options: `&GravityOptions` -> optional arguments
2918/// returns `VipsImage` - Output image
2919pub fn gravity_with_opts(
2920    inp: &VipsImage,
2921    direction: CompassDirection,
2922    width: i32,
2923    height: i32,
2924    gravity_options: &GravityOptions,
2925) -> Result<VipsImage> {
2926    unsafe {
2927        let inp_in: *mut bindings::VipsImage = inp.ctx;
2928        let direction_in: i32 = direction as i32;
2929        let width_in: i32 = width;
2930        let height_in: i32 = height;
2931        let mut out_out: *mut bindings::VipsImage = null_mut();
2932
2933        let extend_in: i32 = gravity_options.extend as i32;
2934        let extend_in_name = utils::new_c_string("extend")?;
2935
2936        let background_wrapper =
2937            utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
2938        let background_in = background_wrapper.ctx;
2939        let background_in_name = utils::new_c_string("background")?;
2940
2941        let vips_op_response = bindings::vips_gravity(
2942            inp_in,
2943            &mut out_out,
2944            direction_in.try_into().unwrap(),
2945            width_in,
2946            height_in,
2947            extend_in_name.as_ptr(),
2948            extend_in,
2949            background_in_name.as_ptr(),
2950            background_in,
2951            NULL,
2952        );
2953        utils::result(
2954            vips_op_response,
2955            VipsImage { ctx: out_out },
2956            Error::GravityError,
2957        )
2958    }
2959}
2960
2961/// VipsFlip (flip), flip an image
2962/// inp: `&VipsImage` -> Input image
2963/// direction: `Direction` -> Direction to flip image
2964///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
2965///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
2966/// returns `VipsImage` - Output image
2967pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
2968    unsafe {
2969        let inp_in: *mut bindings::VipsImage = inp.ctx;
2970        let direction_in: i32 = direction as i32;
2971        let mut out_out: *mut bindings::VipsImage = null_mut();
2972
2973        let vips_op_response =
2974            bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
2975        utils::result(
2976            vips_op_response,
2977            VipsImage { ctx: out_out },
2978            Error::FlipError,
2979        )
2980    }
2981}
2982
2983/// VipsInsert (insert), insert image @sub into @main at @x, @y
2984/// main: `&VipsImage` -> Main input image
2985/// sub: `&VipsImage` -> Sub-image to insert into main image
2986/// x: `i32` -> Left edge of sub in main
2987/// min: -100000000, max: 100000000, default: 0
2988/// y: `i32` -> Top edge of sub in main
2989/// min: -100000000, max: 100000000, default: 0
2990/// returns `VipsImage` - Output image
2991pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
2992    unsafe {
2993        let main_in: *mut bindings::VipsImage = main.ctx;
2994        let sub_in: *mut bindings::VipsImage = sub.ctx;
2995        let x_in: i32 = x;
2996        let y_in: i32 = y;
2997        let mut out_out: *mut bindings::VipsImage = null_mut();
2998
2999        let vips_op_response =
3000            bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3001        utils::result(
3002            vips_op_response,
3003            VipsImage { ctx: out_out },
3004            Error::InsertError,
3005        )
3006    }
3007}
3008
3009/// Options for insert operation
3010#[derive(Clone, Debug)]
3011pub struct InsertOptions {
3012    /// expand: `bool` -> Expand output to hold all of both inputs
3013    /// default: false
3014    pub expand: bool,
3015    /// background: `Vec<f64>` -> Color for new pixels
3016    pub background: Vec<f64>,
3017}
3018
3019impl std::default::Default for InsertOptions {
3020    fn default() -> Self {
3021        InsertOptions {
3022            expand: false,
3023            background: Vec::new(),
3024        }
3025    }
3026}
3027
3028/// VipsInsert (insert), insert image @sub into @main at @x, @y
3029/// main: `&VipsImage` -> Main input image
3030/// sub: `&VipsImage` -> Sub-image to insert into main image
3031/// x: `i32` -> Left edge of sub in main
3032/// min: -100000000, max: 100000000, default: 0
3033/// y: `i32` -> Top edge of sub in main
3034/// min: -100000000, max: 100000000, default: 0
3035/// insert_options: `&InsertOptions` -> optional arguments
3036/// returns `VipsImage` - Output image
3037pub fn insert_with_opts(
3038    main: &VipsImage,
3039    sub: &VipsImage,
3040    x: i32,
3041    y: i32,
3042    insert_options: &InsertOptions,
3043) -> Result<VipsImage> {
3044    unsafe {
3045        let main_in: *mut bindings::VipsImage = main.ctx;
3046        let sub_in: *mut bindings::VipsImage = sub.ctx;
3047        let x_in: i32 = x;
3048        let y_in: i32 = y;
3049        let mut out_out: *mut bindings::VipsImage = null_mut();
3050
3051        let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3052        let expand_in_name = utils::new_c_string("expand")?;
3053
3054        let background_wrapper =
3055            utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3056        let background_in = background_wrapper.ctx;
3057        let background_in_name = utils::new_c_string("background")?;
3058
3059        let vips_op_response = bindings::vips_insert(
3060            main_in,
3061            sub_in,
3062            &mut out_out,
3063            x_in,
3064            y_in,
3065            expand_in_name.as_ptr(),
3066            expand_in,
3067            background_in_name.as_ptr(),
3068            background_in,
3069            NULL,
3070        );
3071        utils::result(
3072            vips_op_response,
3073            VipsImage { ctx: out_out },
3074            Error::InsertError,
3075        )
3076    }
3077}
3078
3079/// VipsJoin (join), join a pair of images
3080/// in_1: `&VipsImage` -> First input image
3081/// in_2: `&VipsImage` -> Second input image
3082/// direction: `Direction` -> Join left-right or up-down
3083///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3084///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3085/// returns `VipsImage` - Output image
3086pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3087    unsafe {
3088        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3089        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3090        let direction_in: i32 = direction as i32;
3091        let mut out_out: *mut bindings::VipsImage = null_mut();
3092
3093        let vips_op_response = bindings::vips_join(
3094            in_1_in,
3095            in_2_in,
3096            &mut out_out,
3097            direction_in.try_into().unwrap(),
3098            NULL,
3099        );
3100        utils::result(
3101            vips_op_response,
3102            VipsImage { ctx: out_out },
3103            Error::JoinError,
3104        )
3105    }
3106}
3107
3108/// Options for join operation
3109#[derive(Clone, Debug)]
3110pub struct JoinOptions {
3111    /// expand: `bool` -> Expand output to hold all of both inputs
3112    /// default: false
3113    pub expand: bool,
3114    /// shim: `i32` -> Pixels between images
3115    /// min: 0, max: 1000000, default: 0
3116    pub shim: i32,
3117    /// background: `Vec<f64>` -> Colour for new pixels
3118    pub background: Vec<f64>,
3119    /// align: `Align` -> Align on the low, centre or high coordinate edge
3120    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3121    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3122    ///  `High` -> VIPS_ALIGN_HIGH = 2
3123    pub align: Align,
3124}
3125
3126impl std::default::Default for JoinOptions {
3127    fn default() -> Self {
3128        JoinOptions {
3129            expand: false,
3130            shim: i32::from(0),
3131            background: Vec::new(),
3132            align: Align::Low,
3133        }
3134    }
3135}
3136
3137/// VipsJoin (join), join a pair of images
3138/// in_1: `&VipsImage` -> First input image
3139/// in_2: `&VipsImage` -> Second input image
3140/// direction: `Direction` -> Join left-right or up-down
3141///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3142///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3143/// join_options: `&JoinOptions` -> optional arguments
3144/// returns `VipsImage` - Output image
3145pub fn join_with_opts(
3146    in_1: &VipsImage,
3147    in_2: &VipsImage,
3148    direction: Direction,
3149    join_options: &JoinOptions,
3150) -> Result<VipsImage> {
3151    unsafe {
3152        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3153        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3154        let direction_in: i32 = direction as i32;
3155        let mut out_out: *mut bindings::VipsImage = null_mut();
3156
3157        let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3158        let expand_in_name = utils::new_c_string("expand")?;
3159
3160        let shim_in: i32 = join_options.shim;
3161        let shim_in_name = utils::new_c_string("shim")?;
3162
3163        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3164        let background_in = background_wrapper.ctx;
3165        let background_in_name = utils::new_c_string("background")?;
3166
3167        let align_in: i32 = join_options.align as i32;
3168        let align_in_name = utils::new_c_string("align")?;
3169
3170        let vips_op_response = bindings::vips_join(
3171            in_1_in,
3172            in_2_in,
3173            &mut out_out,
3174            direction_in.try_into().unwrap(),
3175            expand_in_name.as_ptr(),
3176            expand_in,
3177            shim_in_name.as_ptr(),
3178            shim_in,
3179            background_in_name.as_ptr(),
3180            background_in,
3181            align_in_name.as_ptr(),
3182            align_in,
3183            NULL,
3184        );
3185        utils::result(
3186            vips_op_response,
3187            VipsImage { ctx: out_out },
3188            Error::JoinError,
3189        )
3190    }
3191}
3192
3193/// VipsArrayjoin (arrayjoin), join an array of images
3194/// inp: `&mut [VipsImage]` -> Array of input images
3195/// returns `VipsImage` - Output image
3196pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3197    unsafe {
3198        let (inp_len, mut inp_in) = {
3199            let len = inp.len();
3200            let mut input = Vec::new();
3201            for img in inp {
3202                input.push(img.ctx)
3203            }
3204            (len as i32, input)
3205        };
3206        let mut out_out: *mut bindings::VipsImage = null_mut();
3207
3208        let vips_op_response =
3209            bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3210        utils::result(
3211            vips_op_response,
3212            VipsImage { ctx: out_out },
3213            Error::ArrayjoinError,
3214        )
3215    }
3216}
3217
3218/// Options for arrayjoin operation
3219#[derive(Clone, Debug)]
3220pub struct ArrayjoinOptions {
3221    /// across: `i32` -> Number of images across grid
3222    /// min: 1, max: 1000000, default: 1
3223    pub across: i32,
3224    /// shim: `i32` -> Pixels between images
3225    /// min: 0, max: 1000000, default: 0
3226    pub shim: i32,
3227    /// background: `Vec<f64>` -> Colour for new pixels
3228    pub background: Vec<f64>,
3229    /// halign: `Align` -> Align on the left, centre or right
3230    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3231    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3232    ///  `High` -> VIPS_ALIGN_HIGH = 2
3233    pub halign: Align,
3234    /// valign: `Align` -> Align on the top, centre or bottom
3235    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3236    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3237    ///  `High` -> VIPS_ALIGN_HIGH = 2
3238    pub valign: Align,
3239    /// hspacing: `i32` -> Horizontal spacing between images
3240    /// min: 1, max: 1000000, default: 1
3241    pub hspacing: i32,
3242    /// vspacing: `i32` -> Vertical spacing between images
3243    /// min: 1, max: 1000000, default: 1
3244    pub vspacing: i32,
3245}
3246
3247impl std::default::Default for ArrayjoinOptions {
3248    fn default() -> Self {
3249        ArrayjoinOptions {
3250            across: i32::from(1),
3251            shim: i32::from(0),
3252            background: Vec::new(),
3253            halign: Align::Low,
3254            valign: Align::Low,
3255            hspacing: i32::from(1),
3256            vspacing: i32::from(1),
3257        }
3258    }
3259}
3260
3261/// VipsArrayjoin (arrayjoin), join an array of images
3262/// inp: `&mut [VipsImage]` -> Array of input images
3263/// arrayjoin_options: `&ArrayjoinOptions` -> optional arguments
3264/// returns `VipsImage` - Output image
3265pub fn arrayjoin_with_opts(
3266    inp: &mut [VipsImage],
3267    arrayjoin_options: &ArrayjoinOptions,
3268) -> Result<VipsImage> {
3269    unsafe {
3270        let (inp_len, mut inp_in) = {
3271            let len = inp.len();
3272            let mut input = Vec::new();
3273            for img in inp {
3274                input.push(img.ctx)
3275            }
3276            (len as i32, input)
3277        };
3278        let mut out_out: *mut bindings::VipsImage = null_mut();
3279
3280        let across_in: i32 = arrayjoin_options.across;
3281        let across_in_name = utils::new_c_string("across")?;
3282
3283        let shim_in: i32 = arrayjoin_options.shim;
3284        let shim_in_name = utils::new_c_string("shim")?;
3285
3286        let background_wrapper =
3287            utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3288        let background_in = background_wrapper.ctx;
3289        let background_in_name = utils::new_c_string("background")?;
3290
3291        let halign_in: i32 = arrayjoin_options.halign as i32;
3292        let halign_in_name = utils::new_c_string("halign")?;
3293
3294        let valign_in: i32 = arrayjoin_options.valign as i32;
3295        let valign_in_name = utils::new_c_string("valign")?;
3296
3297        let hspacing_in: i32 = arrayjoin_options.hspacing;
3298        let hspacing_in_name = utils::new_c_string("hspacing")?;
3299
3300        let vspacing_in: i32 = arrayjoin_options.vspacing;
3301        let vspacing_in_name = utils::new_c_string("vspacing")?;
3302
3303        let vips_op_response = bindings::vips_arrayjoin(
3304            inp_in.as_mut_ptr(),
3305            &mut out_out,
3306            inp_len,
3307            across_in_name.as_ptr(),
3308            across_in,
3309            shim_in_name.as_ptr(),
3310            shim_in,
3311            background_in_name.as_ptr(),
3312            background_in,
3313            halign_in_name.as_ptr(),
3314            halign_in,
3315            valign_in_name.as_ptr(),
3316            valign_in,
3317            hspacing_in_name.as_ptr(),
3318            hspacing_in,
3319            vspacing_in_name.as_ptr(),
3320            vspacing_in,
3321            NULL,
3322        );
3323        utils::result(
3324            vips_op_response,
3325            VipsImage { ctx: out_out },
3326            Error::ArrayjoinError,
3327        )
3328    }
3329}
3330
3331/// VipsExtractArea (extract_area), extract an area from an image
3332/// input: `&VipsImage` -> Input image
3333/// left: `i32` -> Left edge of extract area
3334/// min: -100000000, max: 100000000, default: 0
3335/// top: `i32` -> Top edge of extract area
3336/// min: -100000000, max: 100000000, default: 0
3337/// width: `i32` -> Width of extract area
3338/// min: 1, max: 100000000, default: 1
3339/// height: `i32` -> Height of extract area
3340/// min: 1, max: 100000000, default: 1
3341/// returns `VipsImage` - Output image
3342pub fn extract_area(
3343    input: &VipsImage,
3344    left: i32,
3345    top: i32,
3346    width: i32,
3347    height: i32,
3348) -> Result<VipsImage> {
3349    unsafe {
3350        let input_in: *mut bindings::VipsImage = input.ctx;
3351        let left_in: i32 = left;
3352        let top_in: i32 = top;
3353        let width_in: i32 = width;
3354        let height_in: i32 = height;
3355        let mut out_out: *mut bindings::VipsImage = null_mut();
3356
3357        let vips_op_response = bindings::vips_extract_area(
3358            input_in,
3359            &mut out_out,
3360            left_in,
3361            top_in,
3362            width_in,
3363            height_in,
3364            NULL,
3365        );
3366        utils::result(
3367            vips_op_response,
3368            VipsImage { ctx: out_out },
3369            Error::ExtractAreaError,
3370        )
3371    }
3372}
3373
3374/// VipsSmartcrop (smartcrop), extract an area from an image
3375/// input: `&VipsImage` -> Input image
3376/// width: `i32` -> Width of extract area
3377/// min: 1, max: 100000000, default: 1
3378/// height: `i32` -> Height of extract area
3379/// min: 1, max: 100000000, default: 1
3380/// returns `VipsImage` - Output image
3381pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3382    unsafe {
3383        let input_in: *mut bindings::VipsImage = input.ctx;
3384        let width_in: i32 = width;
3385        let height_in: i32 = height;
3386        let mut out_out: *mut bindings::VipsImage = null_mut();
3387
3388        let vips_op_response =
3389            bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3390        utils::result(
3391            vips_op_response,
3392            VipsImage { ctx: out_out },
3393            Error::SmartcropError,
3394        )
3395    }
3396}
3397
3398/// Options for smartcrop operation
3399#[derive(Clone, Debug)]
3400pub struct SmartcropOptions {
3401    /// attention_x: `i32` -> Horizontal position of attention centre
3402    /// min: 0, max: 100000000, default: 0
3403    pub attention_x: i32,
3404    /// attention_y: `i32` -> Vertical position of attention centre
3405    /// min: 0, max: 100000000, default: 0
3406    pub attention_y: i32,
3407    /// interesting: `Interesting` -> How to measure interestingness
3408    ///  `None` -> VIPS_INTERESTING_NONE = 0
3409    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
3410    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
3411    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3 [DEFAULT]
3412    ///  `Low` -> VIPS_INTERESTING_LOW = 4
3413    ///  `High` -> VIPS_INTERESTING_HIGH = 5
3414    ///  `All` -> VIPS_INTERESTING_ALL = 6
3415    pub interesting: Interesting,
3416    /// premultiplied: `bool` -> Input image already has premultiplied alpha
3417    /// default: false
3418    pub premultiplied: bool,
3419}
3420
3421impl std::default::Default for SmartcropOptions {
3422    fn default() -> Self {
3423        SmartcropOptions {
3424            attention_x: i32::from(0),
3425            attention_y: i32::from(0),
3426            interesting: Interesting::Attention,
3427            premultiplied: false,
3428        }
3429    }
3430}
3431
3432/// VipsSmartcrop (smartcrop), extract an area from an image
3433/// input: `&VipsImage` -> Input image
3434/// width: `i32` -> Width of extract area
3435/// min: 1, max: 100000000, default: 1
3436/// height: `i32` -> Height of extract area
3437/// min: 1, max: 100000000, default: 1
3438/// smartcrop_options: `&SmartcropOptions` -> optional arguments
3439/// returns `VipsImage` - Output image
3440pub fn smartcrop_with_opts(
3441    input: &VipsImage,
3442    width: i32,
3443    height: i32,
3444    smartcrop_options: &SmartcropOptions,
3445) -> Result<VipsImage> {
3446    unsafe {
3447        let input_in: *mut bindings::VipsImage = input.ctx;
3448        let width_in: i32 = width;
3449        let height_in: i32 = height;
3450        let mut out_out: *mut bindings::VipsImage = null_mut();
3451
3452        let attention_x_in: i32 = smartcrop_options.attention_x;
3453        let attention_x_in_name = utils::new_c_string("attention-x")?;
3454
3455        let attention_y_in: i32 = smartcrop_options.attention_y;
3456        let attention_y_in_name = utils::new_c_string("attention-y")?;
3457
3458        let interesting_in: i32 = smartcrop_options.interesting as i32;
3459        let interesting_in_name = utils::new_c_string("interesting")?;
3460
3461        let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3462            1
3463        } else {
3464            0
3465        };
3466        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3467
3468        let vips_op_response = bindings::vips_smartcrop(
3469            input_in,
3470            &mut out_out,
3471            width_in,
3472            height_in,
3473            attention_x_in_name.as_ptr(),
3474            attention_x_in,
3475            attention_y_in_name.as_ptr(),
3476            attention_y_in,
3477            interesting_in_name.as_ptr(),
3478            interesting_in,
3479            premultiplied_in_name.as_ptr(),
3480            premultiplied_in,
3481            NULL,
3482        );
3483        utils::result(
3484            vips_op_response,
3485            VipsImage { ctx: out_out },
3486            Error::SmartcropError,
3487        )
3488    }
3489}
3490
3491/// VipsExtractBand (extract_band), extract band from an image
3492/// inp: `&VipsImage` -> Input image
3493/// band: `i32` -> Band to extract
3494/// min: 0, max: 100000000, default: 0
3495/// returns `VipsImage` - Output image
3496pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3497    unsafe {
3498        let inp_in: *mut bindings::VipsImage = inp.ctx;
3499        let band_in: i32 = band;
3500        let mut out_out: *mut bindings::VipsImage = null_mut();
3501
3502        let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3503        utils::result(
3504            vips_op_response,
3505            VipsImage { ctx: out_out },
3506            Error::ExtractBandError,
3507        )
3508    }
3509}
3510
3511/// Options for extract_band operation
3512#[derive(Clone, Debug)]
3513pub struct ExtractBandOptions {
3514    /// n: `i32` -> Number of bands to extract
3515    /// min: 1, max: 100000000, default: 1
3516    pub n: i32,
3517}
3518
3519impl std::default::Default for ExtractBandOptions {
3520    fn default() -> Self {
3521        ExtractBandOptions { n: i32::from(1) }
3522    }
3523}
3524
3525/// VipsExtractBand (extract_band), extract band from an image
3526/// inp: `&VipsImage` -> Input image
3527/// band: `i32` -> Band to extract
3528/// min: 0, max: 100000000, default: 0
3529/// extract_band_options: `&ExtractBandOptions` -> optional arguments
3530/// returns `VipsImage` - Output image
3531pub fn extract_band_with_opts(
3532    inp: &VipsImage,
3533    band: i32,
3534    extract_band_options: &ExtractBandOptions,
3535) -> Result<VipsImage> {
3536    unsafe {
3537        let inp_in: *mut bindings::VipsImage = inp.ctx;
3538        let band_in: i32 = band;
3539        let mut out_out: *mut bindings::VipsImage = null_mut();
3540
3541        let n_in: i32 = extract_band_options.n;
3542        let n_in_name = utils::new_c_string("n")?;
3543
3544        let vips_op_response = bindings::vips_extract_band(
3545            inp_in,
3546            &mut out_out,
3547            band_in,
3548            n_in_name.as_ptr(),
3549            n_in,
3550            NULL,
3551        );
3552        utils::result(
3553            vips_op_response,
3554            VipsImage { ctx: out_out },
3555            Error::ExtractBandError,
3556        )
3557    }
3558}
3559
3560/// VipsBandjoin (bandjoin), bandwise join a set of images
3561/// inp: `&mut [VipsImage]` -> Array of input images
3562/// returns `VipsImage` - Output image
3563pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3564    unsafe {
3565        let (inp_len, mut inp_in) = {
3566            let len = inp.len();
3567            let mut input = Vec::new();
3568            for img in inp {
3569                input.push(img.ctx)
3570            }
3571            (len as i32, input)
3572        };
3573        let mut out_out: *mut bindings::VipsImage = null_mut();
3574
3575        let vips_op_response =
3576            bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3577        utils::result(
3578            vips_op_response,
3579            VipsImage { ctx: out_out },
3580            Error::BandjoinError,
3581        )
3582    }
3583}
3584
3585/// VipsBandjoinConst (bandjoin_const), append a constant band to an image
3586/// inp: `&VipsImage` -> Input image
3587/// c: `&mut [f64]` -> Array of constants to add
3588/// returns `VipsImage` - Output image
3589pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3590    unsafe {
3591        let inp_in: *mut bindings::VipsImage = inp.ctx;
3592        let c_in: *mut f64 = c.as_mut_ptr();
3593        let mut out_out: *mut bindings::VipsImage = null_mut();
3594
3595        let vips_op_response =
3596            bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3597        utils::result(
3598            vips_op_response,
3599            VipsImage { ctx: out_out },
3600            Error::BandjoinConstError,
3601        )
3602    }
3603}
3604
3605/// VipsBandrank (bandrank), band-wise rank of a set of images
3606/// inp: `&mut [VipsImage]` -> Array of input images
3607/// returns `VipsImage` - Output image
3608pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3609    unsafe {
3610        let (inp_len, mut inp_in) = {
3611            let len = inp.len();
3612            let mut input = Vec::new();
3613            for img in inp {
3614                input.push(img.ctx)
3615            }
3616            (len as i32, input)
3617        };
3618        let mut out_out: *mut bindings::VipsImage = null_mut();
3619
3620        let vips_op_response =
3621            bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3622        utils::result(
3623            vips_op_response,
3624            VipsImage { ctx: out_out },
3625            Error::BandrankError,
3626        )
3627    }
3628}
3629
3630/// Options for bandrank operation
3631#[derive(Clone, Debug)]
3632pub struct BandrankOptions {
3633    /// index: `i32` -> Select this band element from sorted list
3634    /// min: -1, max: 1000000, default: -1
3635    pub index: i32,
3636}
3637
3638impl std::default::Default for BandrankOptions {
3639    fn default() -> Self {
3640        BandrankOptions {
3641            index: i32::from(-1),
3642        }
3643    }
3644}
3645
3646/// VipsBandrank (bandrank), band-wise rank of a set of images
3647/// inp: `&mut [VipsImage]` -> Array of input images
3648/// bandrank_options: `&BandrankOptions` -> optional arguments
3649/// returns `VipsImage` - Output image
3650pub fn bandrank_with_opts(
3651    inp: &mut [VipsImage],
3652    bandrank_options: &BandrankOptions,
3653) -> Result<VipsImage> {
3654    unsafe {
3655        let (inp_len, mut inp_in) = {
3656            let len = inp.len();
3657            let mut input = Vec::new();
3658            for img in inp {
3659                input.push(img.ctx)
3660            }
3661            (len as i32, input)
3662        };
3663        let mut out_out: *mut bindings::VipsImage = null_mut();
3664
3665        let index_in: i32 = bandrank_options.index;
3666        let index_in_name = utils::new_c_string("index")?;
3667
3668        let vips_op_response = bindings::vips_bandrank(
3669            inp_in.as_mut_ptr(),
3670            &mut out_out,
3671            inp_len,
3672            index_in_name.as_ptr(),
3673            index_in,
3674            NULL,
3675        );
3676        utils::result(
3677            vips_op_response,
3678            VipsImage { ctx: out_out },
3679            Error::BandrankError,
3680        )
3681    }
3682}
3683
3684/// VipsBandmean (bandmean), band-wise average
3685/// inp: `&VipsImage` -> Input image argument
3686/// returns `VipsImage` - Output image
3687pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3688    unsafe {
3689        let inp_in: *mut bindings::VipsImage = inp.ctx;
3690        let mut out_out: *mut bindings::VipsImage = null_mut();
3691
3692        let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3693        utils::result(
3694            vips_op_response,
3695            VipsImage { ctx: out_out },
3696            Error::BandmeanError,
3697        )
3698    }
3699}
3700
3701/// VipsBandbool (bandbool), boolean operation across image bands
3702/// inp: `&VipsImage` -> Input image argument
3703/// boolean: `OperationBoolean` -> Boolean to perform
3704///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
3705///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
3706///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
3707///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
3708///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
3709/// returns `VipsImage` - Output image
3710pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3711    unsafe {
3712        let inp_in: *mut bindings::VipsImage = inp.ctx;
3713        let boolean_in: i32 = boolean as i32;
3714        let mut out_out: *mut bindings::VipsImage = null_mut();
3715
3716        let vips_op_response =
3717            bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3718        utils::result(
3719            vips_op_response,
3720            VipsImage { ctx: out_out },
3721            Error::BandboolError,
3722        )
3723    }
3724}
3725
3726/// VipsReplicate (replicate), replicate an image
3727/// inp: `&VipsImage` -> Input image
3728/// across: `i32` -> Repeat this many times horizontally
3729/// min: 1, max: 1000000, default: 1
3730/// down: `i32` -> Repeat this many times vertically
3731/// min: 1, max: 1000000, default: 1
3732/// returns `VipsImage` - Output image
3733pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3734    unsafe {
3735        let inp_in: *mut bindings::VipsImage = inp.ctx;
3736        let across_in: i32 = across;
3737        let down_in: i32 = down;
3738        let mut out_out: *mut bindings::VipsImage = null_mut();
3739
3740        let vips_op_response =
3741            bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3742        utils::result(
3743            vips_op_response,
3744            VipsImage { ctx: out_out },
3745            Error::ReplicateError,
3746        )
3747    }
3748}
3749
3750/// VipsCast (cast), cast an image
3751/// inp: `&VipsImage` -> Input image
3752/// format: `BandFormat` -> Format to cast to
3753///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3754///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3755///  `Char` -> VIPS_FORMAT_CHAR = 1
3756///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3757///  `Short` -> VIPS_FORMAT_SHORT = 3
3758///  `Uint` -> VIPS_FORMAT_UINT = 4
3759///  `Int` -> VIPS_FORMAT_INT = 5
3760///  `Float` -> VIPS_FORMAT_FLOAT = 6
3761///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3762///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3763///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3764/// returns `VipsImage` - Output image
3765pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3766    unsafe {
3767        let inp_in: *mut bindings::VipsImage = inp.ctx;
3768        let format_in: i32 = format as i32;
3769        let mut out_out: *mut bindings::VipsImage = null_mut();
3770
3771        let vips_op_response =
3772            bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3773        utils::result(
3774            vips_op_response,
3775            VipsImage { ctx: out_out },
3776            Error::CastError,
3777        )
3778    }
3779}
3780
3781/// Options for cast operation
3782#[derive(Clone, Debug)]
3783pub struct CastOptions {
3784    /// shift: `bool` -> Shift integer values up and down
3785    /// default: false
3786    pub shift: bool,
3787}
3788
3789impl std::default::Default for CastOptions {
3790    fn default() -> Self {
3791        CastOptions { shift: false }
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/// cast_options: `&CastOptions` -> optional arguments
3810/// returns `VipsImage` - Output image
3811pub fn cast_with_opts(
3812    inp: &VipsImage,
3813    format: BandFormat,
3814    cast_options: &CastOptions,
3815) -> Result<VipsImage> {
3816    unsafe {
3817        let inp_in: *mut bindings::VipsImage = inp.ctx;
3818        let format_in: i32 = format as i32;
3819        let mut out_out: *mut bindings::VipsImage = null_mut();
3820
3821        let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3822        let shift_in_name = utils::new_c_string("shift")?;
3823
3824        let vips_op_response = bindings::vips_cast(
3825            inp_in,
3826            &mut out_out,
3827            format_in.try_into().unwrap(),
3828            shift_in_name.as_ptr(),
3829            shift_in,
3830            NULL,
3831        );
3832        utils::result(
3833            vips_op_response,
3834            VipsImage { ctx: out_out },
3835            Error::CastError,
3836        )
3837    }
3838}
3839
3840/// VipsRot (rot), rotate an image
3841/// inp: `&VipsImage` -> Input image
3842/// angle: `Angle` -> Angle to rotate image
3843///  `D0` -> VIPS_ANGLE_D0 = 0
3844///  `D90` -> VIPS_ANGLE_D90 = 1 [DEFAULT]
3845///  `D180` -> VIPS_ANGLE_D180 = 2
3846///  `D270` -> VIPS_ANGLE_D270 = 3
3847/// returns `VipsImage` - Output image
3848pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3849    unsafe {
3850        let inp_in: *mut bindings::VipsImage = inp.ctx;
3851        let angle_in: i32 = angle as i32;
3852        let mut out_out: *mut bindings::VipsImage = null_mut();
3853
3854        let vips_op_response =
3855            bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3856        utils::result(
3857            vips_op_response,
3858            VipsImage { ctx: out_out },
3859            Error::RotError,
3860        )
3861    }
3862}
3863
3864/// VipsRot45 (rot45), rotate an image
3865/// inp: `&VipsImage` -> Input image
3866/// returns `VipsImage` - Output image
3867pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3868    unsafe {
3869        let inp_in: *mut bindings::VipsImage = inp.ctx;
3870        let mut out_out: *mut bindings::VipsImage = null_mut();
3871
3872        let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3873        utils::result(
3874            vips_op_response,
3875            VipsImage { ctx: out_out },
3876            Error::Rot45Error,
3877        )
3878    }
3879}
3880
3881/// Options for rot_45 operation
3882#[derive(Clone, Debug)]
3883pub struct Rot45Options {
3884    /// angle: `Angle45` -> Angle to rotate image
3885    ///  `D0` -> VIPS_ANGLE45_D0 = 0
3886    ///  `D45` -> VIPS_ANGLE45_D45 = 1 [DEFAULT]
3887    ///  `D90` -> VIPS_ANGLE45_D90 = 2
3888    ///  `D135` -> VIPS_ANGLE45_D135 = 3
3889    ///  `D180` -> VIPS_ANGLE45_D180 = 4
3890    ///  `D225` -> VIPS_ANGLE45_D225 = 5
3891    ///  `D270` -> VIPS_ANGLE45_D270 = 6
3892    ///  `D315` -> VIPS_ANGLE45_D315 = 7
3893    pub angle: Angle45,
3894}
3895
3896impl std::default::Default for Rot45Options {
3897    fn default() -> Self {
3898        Rot45Options {
3899            angle: Angle45::D45,
3900        }
3901    }
3902}
3903
3904/// VipsRot45 (rot45), rotate an image
3905/// inp: `&VipsImage` -> Input image
3906/// rot_45_options: `&Rot45Options` -> optional arguments
3907/// returns `VipsImage` - Output image
3908pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
3909    unsafe {
3910        let inp_in: *mut bindings::VipsImage = inp.ctx;
3911        let mut out_out: *mut bindings::VipsImage = null_mut();
3912
3913        let angle_in: i32 = rot_45_options.angle as i32;
3914        let angle_in_name = utils::new_c_string("angle")?;
3915
3916        let vips_op_response =
3917            bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
3918        utils::result(
3919            vips_op_response,
3920            VipsImage { ctx: out_out },
3921            Error::Rot45Error,
3922        )
3923    }
3924}
3925
3926/// VipsAutorot (autorot), autorotate image by exif tag
3927/// inp: `&VipsImage` -> Input image
3928/// returns `VipsImage` - Output image
3929pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
3930    unsafe {
3931        let inp_in: *mut bindings::VipsImage = inp.ctx;
3932        let mut out_out: *mut bindings::VipsImage = null_mut();
3933
3934        let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
3935        utils::result(
3936            vips_op_response,
3937            VipsImage { ctx: out_out },
3938            Error::AutorotError,
3939        )
3940    }
3941}
3942
3943/// Options for autorot operation
3944#[derive(Clone, Debug)]
3945pub struct AutorotOptions {
3946    /// angle: `Angle` -> Angle image was rotated by
3947    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
3948    ///  `D90` -> VIPS_ANGLE_D90 = 1
3949    ///  `D180` -> VIPS_ANGLE_D180 = 2
3950    ///  `D270` -> VIPS_ANGLE_D270 = 3
3951    pub angle: Angle,
3952    /// flip: `bool` -> Whether the image was flipped or not
3953    /// default: false
3954    pub flip: bool,
3955}
3956
3957impl std::default::Default for AutorotOptions {
3958    fn default() -> Self {
3959        AutorotOptions {
3960            angle: Angle::D0,
3961            flip: false,
3962        }
3963    }
3964}
3965
3966/// VipsAutorot (autorot), autorotate image by exif tag
3967/// inp: `&VipsImage` -> Input image
3968/// autorot_options: `&AutorotOptions` -> optional arguments
3969/// returns `VipsImage` - Output image
3970pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
3971    unsafe {
3972        let inp_in: *mut bindings::VipsImage = inp.ctx;
3973        let mut out_out: *mut bindings::VipsImage = null_mut();
3974
3975        let angle_in: i32 = autorot_options.angle as i32;
3976        let angle_in_name = utils::new_c_string("angle")?;
3977
3978        let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
3979        let flip_in_name = utils::new_c_string("flip")?;
3980
3981        let vips_op_response = bindings::vips_autorot(
3982            inp_in,
3983            &mut out_out,
3984            angle_in_name.as_ptr(),
3985            angle_in,
3986            flip_in_name.as_ptr(),
3987            flip_in,
3988            NULL,
3989        );
3990        utils::result(
3991            vips_op_response,
3992            VipsImage { ctx: out_out },
3993            Error::AutorotError,
3994        )
3995    }
3996}
3997
3998/// VipsIfthenelse (ifthenelse), ifthenelse an image
3999/// cond: `&VipsImage` -> Condition input image
4000/// in_1: `&VipsImage` -> Source for TRUE pixels
4001/// in_2: `&VipsImage` -> Source for FALSE pixels
4002/// returns `VipsImage` - Output image
4003pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4004    unsafe {
4005        let cond_in: *mut bindings::VipsImage = cond.ctx;
4006        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4007        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4008        let mut out_out: *mut bindings::VipsImage = null_mut();
4009
4010        let vips_op_response =
4011            bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4012        utils::result(
4013            vips_op_response,
4014            VipsImage { ctx: out_out },
4015            Error::IfthenelseError,
4016        )
4017    }
4018}
4019
4020/// Options for ifthenelse operation
4021#[derive(Clone, Debug)]
4022pub struct IfthenelseOptions {
4023    /// blend: `bool` -> Blend smoothly between then and else parts
4024    /// default: false
4025    pub blend: bool,
4026}
4027
4028impl std::default::Default for IfthenelseOptions {
4029    fn default() -> Self {
4030        IfthenelseOptions { blend: false }
4031    }
4032}
4033
4034/// VipsIfthenelse (ifthenelse), ifthenelse an image
4035/// cond: `&VipsImage` -> Condition input image
4036/// in_1: `&VipsImage` -> Source for TRUE pixels
4037/// in_2: `&VipsImage` -> Source for FALSE pixels
4038/// ifthenelse_options: `&IfthenelseOptions` -> optional arguments
4039/// returns `VipsImage` - Output image
4040pub fn ifthenelse_with_opts(
4041    cond: &VipsImage,
4042    in_1: &VipsImage,
4043    in_2: &VipsImage,
4044    ifthenelse_options: &IfthenelseOptions,
4045) -> Result<VipsImage> {
4046    unsafe {
4047        let cond_in: *mut bindings::VipsImage = cond.ctx;
4048        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4049        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4050        let mut out_out: *mut bindings::VipsImage = null_mut();
4051
4052        let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4053        let blend_in_name = utils::new_c_string("blend")?;
4054
4055        let vips_op_response = bindings::vips_ifthenelse(
4056            cond_in,
4057            in_1_in,
4058            in_2_in,
4059            &mut out_out,
4060            blend_in_name.as_ptr(),
4061            blend_in,
4062            NULL,
4063        );
4064        utils::result(
4065            vips_op_response,
4066            VipsImage { ctx: out_out },
4067            Error::IfthenelseError,
4068        )
4069    }
4070}
4071
4072/// VipsRecomb (recomb), linear recombination with matrix
4073/// inp: `&VipsImage` -> Input image argument
4074/// m: `&VipsImage` -> Matrix of coefficients
4075/// returns `VipsImage` - Output image
4076pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4077    unsafe {
4078        let inp_in: *mut bindings::VipsImage = inp.ctx;
4079        let m_in: *mut bindings::VipsImage = m.ctx;
4080        let mut out_out: *mut bindings::VipsImage = null_mut();
4081
4082        let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4083        utils::result(
4084            vips_op_response,
4085            VipsImage { ctx: out_out },
4086            Error::RecombError,
4087        )
4088    }
4089}
4090
4091/// VipsBandfold (bandfold), fold up x axis into bands
4092/// inp: `&VipsImage` -> Input image
4093/// returns `VipsImage` - Output image
4094pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4095    unsafe {
4096        let inp_in: *mut bindings::VipsImage = inp.ctx;
4097        let mut out_out: *mut bindings::VipsImage = null_mut();
4098
4099        let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4100        utils::result(
4101            vips_op_response,
4102            VipsImage { ctx: out_out },
4103            Error::BandfoldError,
4104        )
4105    }
4106}
4107
4108/// Options for bandfold operation
4109#[derive(Clone, Debug)]
4110pub struct BandfoldOptions {
4111    /// factor: `i32` -> Fold by this factor
4112    /// min: 0, max: 10000000, default: 0
4113    pub factor: i32,
4114}
4115
4116impl std::default::Default for BandfoldOptions {
4117    fn default() -> Self {
4118        BandfoldOptions {
4119            factor: i32::from(0),
4120        }
4121    }
4122}
4123
4124/// VipsBandfold (bandfold), fold up x axis into bands
4125/// inp: `&VipsImage` -> Input image
4126/// bandfold_options: `&BandfoldOptions` -> optional arguments
4127/// returns `VipsImage` - Output image
4128pub fn bandfold_with_opts(
4129    inp: &VipsImage,
4130    bandfold_options: &BandfoldOptions,
4131) -> Result<VipsImage> {
4132    unsafe {
4133        let inp_in: *mut bindings::VipsImage = inp.ctx;
4134        let mut out_out: *mut bindings::VipsImage = null_mut();
4135
4136        let factor_in: i32 = bandfold_options.factor;
4137        let factor_in_name = utils::new_c_string("factor")?;
4138
4139        let vips_op_response = bindings::vips_bandfold(
4140            inp_in,
4141            &mut out_out,
4142            factor_in_name.as_ptr(),
4143            factor_in,
4144            NULL,
4145        );
4146        utils::result(
4147            vips_op_response,
4148            VipsImage { ctx: out_out },
4149            Error::BandfoldError,
4150        )
4151    }
4152}
4153
4154/// VipsBandunfold (bandunfold), unfold image bands into x axis
4155/// inp: `&VipsImage` -> Input image
4156/// returns `VipsImage` - Output image
4157pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4158    unsafe {
4159        let inp_in: *mut bindings::VipsImage = inp.ctx;
4160        let mut out_out: *mut bindings::VipsImage = null_mut();
4161
4162        let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4163        utils::result(
4164            vips_op_response,
4165            VipsImage { ctx: out_out },
4166            Error::BandunfoldError,
4167        )
4168    }
4169}
4170
4171/// Options for bandunfold operation
4172#[derive(Clone, Debug)]
4173pub struct BandunfoldOptions {
4174    /// factor: `i32` -> Unfold by this factor
4175    /// min: 0, max: 10000000, default: 0
4176    pub factor: i32,
4177}
4178
4179impl std::default::Default for BandunfoldOptions {
4180    fn default() -> Self {
4181        BandunfoldOptions {
4182            factor: i32::from(0),
4183        }
4184    }
4185}
4186
4187/// VipsBandunfold (bandunfold), unfold image bands into x axis
4188/// inp: `&VipsImage` -> Input image
4189/// bandunfold_options: `&BandunfoldOptions` -> optional arguments
4190/// returns `VipsImage` - Output image
4191pub fn bandunfold_with_opts(
4192    inp: &VipsImage,
4193    bandunfold_options: &BandunfoldOptions,
4194) -> Result<VipsImage> {
4195    unsafe {
4196        let inp_in: *mut bindings::VipsImage = inp.ctx;
4197        let mut out_out: *mut bindings::VipsImage = null_mut();
4198
4199        let factor_in: i32 = bandunfold_options.factor;
4200        let factor_in_name = utils::new_c_string("factor")?;
4201
4202        let vips_op_response = bindings::vips_bandunfold(
4203            inp_in,
4204            &mut out_out,
4205            factor_in_name.as_ptr(),
4206            factor_in,
4207            NULL,
4208        );
4209        utils::result(
4210            vips_op_response,
4211            VipsImage { ctx: out_out },
4212            Error::BandunfoldError,
4213        )
4214    }
4215}
4216
4217/// VipsFlatten (flatten), flatten alpha out of an image
4218/// inp: `&VipsImage` -> Input image
4219/// returns `VipsImage` - Output image
4220pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4221    unsafe {
4222        let inp_in: *mut bindings::VipsImage = inp.ctx;
4223        let mut out_out: *mut bindings::VipsImage = null_mut();
4224
4225        let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4226        utils::result(
4227            vips_op_response,
4228            VipsImage { ctx: out_out },
4229            Error::FlattenError,
4230        )
4231    }
4232}
4233
4234/// Options for flatten operation
4235#[derive(Clone, Debug)]
4236pub struct FlattenOptions {
4237    /// background: `Vec<f64>` -> Background value
4238    pub background: Vec<f64>,
4239    /// max_alpha: `f64` -> Maximum value of alpha channel
4240    /// min: 0, max: 100000000, default: 255
4241    pub max_alpha: f64,
4242}
4243
4244impl std::default::Default for FlattenOptions {
4245    fn default() -> Self {
4246        FlattenOptions {
4247            background: Vec::new(),
4248            max_alpha: f64::from(255),
4249        }
4250    }
4251}
4252
4253/// VipsFlatten (flatten), flatten alpha out of an image
4254/// inp: `&VipsImage` -> Input image
4255/// flatten_options: `&FlattenOptions` -> optional arguments
4256/// returns `VipsImage` - Output image
4257pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4258    unsafe {
4259        let inp_in: *mut bindings::VipsImage = inp.ctx;
4260        let mut out_out: *mut bindings::VipsImage = null_mut();
4261
4262        let background_wrapper =
4263            utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4264        let background_in = background_wrapper.ctx;
4265        let background_in_name = utils::new_c_string("background")?;
4266
4267        let max_alpha_in: f64 = flatten_options.max_alpha;
4268        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4269
4270        let vips_op_response = bindings::vips_flatten(
4271            inp_in,
4272            &mut out_out,
4273            background_in_name.as_ptr(),
4274            background_in,
4275            max_alpha_in_name.as_ptr(),
4276            max_alpha_in,
4277            NULL,
4278        );
4279        utils::result(
4280            vips_op_response,
4281            VipsImage { ctx: out_out },
4282            Error::FlattenError,
4283        )
4284    }
4285}
4286
4287/// VipsPremultiply (premultiply), premultiply image alpha
4288/// inp: `&VipsImage` -> Input image
4289/// returns `VipsImage` - Output image
4290pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4291    unsafe {
4292        let inp_in: *mut bindings::VipsImage = inp.ctx;
4293        let mut out_out: *mut bindings::VipsImage = null_mut();
4294
4295        let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4296        utils::result(
4297            vips_op_response,
4298            VipsImage { ctx: out_out },
4299            Error::PremultiplyError,
4300        )
4301    }
4302}
4303
4304/// Options for premultiply operation
4305#[derive(Clone, Debug)]
4306pub struct PremultiplyOptions {
4307    /// max_alpha: `f64` -> Maximum value of alpha channel
4308    /// min: 0, max: 100000000, default: 255
4309    pub max_alpha: f64,
4310}
4311
4312impl std::default::Default for PremultiplyOptions {
4313    fn default() -> Self {
4314        PremultiplyOptions {
4315            max_alpha: f64::from(255),
4316        }
4317    }
4318}
4319
4320/// VipsPremultiply (premultiply), premultiply image alpha
4321/// inp: `&VipsImage` -> Input image
4322/// premultiply_options: `&PremultiplyOptions` -> optional arguments
4323/// returns `VipsImage` - Output image
4324pub fn premultiply_with_opts(
4325    inp: &VipsImage,
4326    premultiply_options: &PremultiplyOptions,
4327) -> Result<VipsImage> {
4328    unsafe {
4329        let inp_in: *mut bindings::VipsImage = inp.ctx;
4330        let mut out_out: *mut bindings::VipsImage = null_mut();
4331
4332        let max_alpha_in: f64 = premultiply_options.max_alpha;
4333        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4334
4335        let vips_op_response = bindings::vips_premultiply(
4336            inp_in,
4337            &mut out_out,
4338            max_alpha_in_name.as_ptr(),
4339            max_alpha_in,
4340            NULL,
4341        );
4342        utils::result(
4343            vips_op_response,
4344            VipsImage { ctx: out_out },
4345            Error::PremultiplyError,
4346        )
4347    }
4348}
4349
4350/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4351/// inp: `&VipsImage` -> Input image
4352/// returns `VipsImage` - Output image
4353pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4354    unsafe {
4355        let inp_in: *mut bindings::VipsImage = inp.ctx;
4356        let mut out_out: *mut bindings::VipsImage = null_mut();
4357
4358        let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4359        utils::result(
4360            vips_op_response,
4361            VipsImage { ctx: out_out },
4362            Error::UnpremultiplyError,
4363        )
4364    }
4365}
4366
4367/// Options for unpremultiply operation
4368#[derive(Clone, Debug)]
4369pub struct UnpremultiplyOptions {
4370    /// max_alpha: `f64` -> Maximum value of alpha channel
4371    /// min: 0, max: 100000000, default: 255
4372    pub max_alpha: f64,
4373    /// alpha_band: `i32` -> Unpremultiply with this alpha
4374    /// min: 0, max: 100000000, default: 3
4375    pub alpha_band: i32,
4376}
4377
4378impl std::default::Default for UnpremultiplyOptions {
4379    fn default() -> Self {
4380        UnpremultiplyOptions {
4381            max_alpha: f64::from(255),
4382            alpha_band: i32::from(3),
4383        }
4384    }
4385}
4386
4387/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4388/// inp: `&VipsImage` -> Input image
4389/// unpremultiply_options: `&UnpremultiplyOptions` -> optional arguments
4390/// returns `VipsImage` - Output image
4391pub fn unpremultiply_with_opts(
4392    inp: &VipsImage,
4393    unpremultiply_options: &UnpremultiplyOptions,
4394) -> Result<VipsImage> {
4395    unsafe {
4396        let inp_in: *mut bindings::VipsImage = inp.ctx;
4397        let mut out_out: *mut bindings::VipsImage = null_mut();
4398
4399        let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4400        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4401
4402        let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4403        let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4404
4405        let vips_op_response = bindings::vips_unpremultiply(
4406            inp_in,
4407            &mut out_out,
4408            max_alpha_in_name.as_ptr(),
4409            max_alpha_in,
4410            alpha_band_in_name.as_ptr(),
4411            alpha_band_in,
4412            NULL,
4413        );
4414        utils::result(
4415            vips_op_response,
4416            VipsImage { ctx: out_out },
4417            Error::UnpremultiplyError,
4418        )
4419    }
4420}
4421
4422/// VipsGrid (grid), grid an image
4423/// inp: `&VipsImage` -> Input image
4424/// tile_height: `i32` -> Chop into tiles this high
4425/// min: 1, max: 10000000, default: 128
4426/// across: `i32` -> Number of tiles across
4427/// min: 1, max: 10000000, default: 1
4428/// down: `i32` -> Number of tiles down
4429/// min: 1, max: 10000000, default: 1
4430/// returns `VipsImage` - Output image
4431pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4432    unsafe {
4433        let inp_in: *mut bindings::VipsImage = inp.ctx;
4434        let tile_height_in: i32 = tile_height;
4435        let across_in: i32 = across;
4436        let down_in: i32 = down;
4437        let mut out_out: *mut bindings::VipsImage = null_mut();
4438
4439        let vips_op_response = bindings::vips_grid(
4440            inp_in,
4441            &mut out_out,
4442            tile_height_in,
4443            across_in,
4444            down_in,
4445            NULL,
4446        );
4447        utils::result(
4448            vips_op_response,
4449            VipsImage { ctx: out_out },
4450            Error::GridError,
4451        )
4452    }
4453}
4454
4455/// VipsTranspose3d (transpose3d), transpose3d an image
4456/// inp: `&VipsImage` -> Input image
4457/// returns `VipsImage` - Output image
4458pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4459    unsafe {
4460        let inp_in: *mut bindings::VipsImage = inp.ctx;
4461        let mut out_out: *mut bindings::VipsImage = null_mut();
4462
4463        let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4464        utils::result(
4465            vips_op_response,
4466            VipsImage { ctx: out_out },
4467            Error::Transpose3DError,
4468        )
4469    }
4470}
4471
4472/// Options for transpose_3d operation
4473#[derive(Clone, Debug)]
4474pub struct Transpose3DOptions {
4475    /// page_height: `i32` -> Height of each input page
4476    /// min: 0, max: 10000000, default: 0
4477    pub page_height: i32,
4478}
4479
4480impl std::default::Default for Transpose3DOptions {
4481    fn default() -> Self {
4482        Transpose3DOptions {
4483            page_height: i32::from(0),
4484        }
4485    }
4486}
4487
4488/// VipsTranspose3d (transpose3d), transpose3d an image
4489/// inp: `&VipsImage` -> Input image
4490/// transpose_3d_options: `&Transpose3DOptions` -> optional arguments
4491/// returns `VipsImage` - Output image
4492pub fn transpose_3d_with_opts(
4493    inp: &VipsImage,
4494    transpose_3d_options: &Transpose3DOptions,
4495) -> Result<VipsImage> {
4496    unsafe {
4497        let inp_in: *mut bindings::VipsImage = inp.ctx;
4498        let mut out_out: *mut bindings::VipsImage = null_mut();
4499
4500        let page_height_in: i32 = transpose_3d_options.page_height;
4501        let page_height_in_name = utils::new_c_string("page-height")?;
4502
4503        let vips_op_response = bindings::vips_transpose3d(
4504            inp_in,
4505            &mut out_out,
4506            page_height_in_name.as_ptr(),
4507            page_height_in,
4508            NULL,
4509        );
4510        utils::result(
4511            vips_op_response,
4512            VipsImage { ctx: out_out },
4513            Error::Transpose3DError,
4514        )
4515    }
4516}
4517
4518/// VipsScale (scale), scale an image to uchar
4519/// inp: `&VipsImage` -> Input image
4520/// returns `VipsImage` - Output image
4521pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4522    unsafe {
4523        let inp_in: *mut bindings::VipsImage = inp.ctx;
4524        let mut out_out: *mut bindings::VipsImage = null_mut();
4525
4526        let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4527        utils::result(
4528            vips_op_response,
4529            VipsImage { ctx: out_out },
4530            Error::ScaleError,
4531        )
4532    }
4533}
4534
4535/// Options for scale operation
4536#[derive(Clone, Debug)]
4537pub struct ScaleOptions {
4538    /// exp: `f64` -> Exponent for log scale
4539    /// min: 0.00001, max: 10000, default: 0.25
4540    pub exp: f64,
4541    /// log: `bool` -> Log scale
4542    /// default: false
4543    pub log: bool,
4544}
4545
4546impl std::default::Default for ScaleOptions {
4547    fn default() -> Self {
4548        ScaleOptions {
4549            exp: f64::from(0.25),
4550            log: false,
4551        }
4552    }
4553}
4554
4555/// VipsScale (scale), scale an image to uchar
4556/// inp: `&VipsImage` -> Input image
4557/// scale_options: `&ScaleOptions` -> optional arguments
4558/// returns `VipsImage` - Output image
4559pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4560    unsafe {
4561        let inp_in: *mut bindings::VipsImage = inp.ctx;
4562        let mut out_out: *mut bindings::VipsImage = null_mut();
4563
4564        let exp_in: f64 = scale_options.exp;
4565        let exp_in_name = utils::new_c_string("exp")?;
4566
4567        let log_in: i32 = if scale_options.log { 1 } else { 0 };
4568        let log_in_name = utils::new_c_string("log")?;
4569
4570        let vips_op_response = bindings::vips_scale(
4571            inp_in,
4572            &mut out_out,
4573            exp_in_name.as_ptr(),
4574            exp_in,
4575            log_in_name.as_ptr(),
4576            log_in,
4577            NULL,
4578        );
4579        utils::result(
4580            vips_op_response,
4581            VipsImage { ctx: out_out },
4582            Error::ScaleError,
4583        )
4584    }
4585}
4586
4587/// VipsWrap (wrap), wrap image origin
4588/// inp: `&VipsImage` -> Input image
4589/// returns `VipsImage` - Output image
4590pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4591    unsafe {
4592        let inp_in: *mut bindings::VipsImage = inp.ctx;
4593        let mut out_out: *mut bindings::VipsImage = null_mut();
4594
4595        let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4596        utils::result(
4597            vips_op_response,
4598            VipsImage { ctx: out_out },
4599            Error::WrapError,
4600        )
4601    }
4602}
4603
4604/// Options for wrap operation
4605#[derive(Clone, Debug)]
4606pub struct WrapOptions {
4607    /// x: `i32` -> Left edge of input in output
4608    /// min: -100000000, max: 100000000, default: 0
4609    pub x: i32,
4610    /// y: `i32` -> Top edge of input in output
4611    /// min: -100000000, max: 100000000, default: 0
4612    pub y: i32,
4613}
4614
4615impl std::default::Default for WrapOptions {
4616    fn default() -> Self {
4617        WrapOptions {
4618            x: i32::from(0),
4619            y: i32::from(0),
4620        }
4621    }
4622}
4623
4624/// VipsWrap (wrap), wrap image origin
4625/// inp: `&VipsImage` -> Input image
4626/// wrap_options: `&WrapOptions` -> optional arguments
4627/// returns `VipsImage` - Output image
4628pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4629    unsafe {
4630        let inp_in: *mut bindings::VipsImage = inp.ctx;
4631        let mut out_out: *mut bindings::VipsImage = null_mut();
4632
4633        let x_in: i32 = wrap_options.x;
4634        let x_in_name = utils::new_c_string("x")?;
4635
4636        let y_in: i32 = wrap_options.y;
4637        let y_in_name = utils::new_c_string("y")?;
4638
4639        let vips_op_response = bindings::vips_wrap(
4640            inp_in,
4641            &mut out_out,
4642            x_in_name.as_ptr(),
4643            x_in,
4644            y_in_name.as_ptr(),
4645            y_in,
4646            NULL,
4647        );
4648        utils::result(
4649            vips_op_response,
4650            VipsImage { ctx: out_out },
4651            Error::WrapError,
4652        )
4653    }
4654}
4655
4656/// VipsZoom (zoom), zoom an image
4657/// input: `&VipsImage` -> Input image
4658/// xfac: `i32` -> Horizontal zoom factor
4659/// min: 1, max: 100000000, default: 1
4660/// yfac: `i32` -> Vertical zoom factor
4661/// min: 1, max: 100000000, default: 1
4662/// returns `VipsImage` - Output image
4663pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4664    unsafe {
4665        let input_in: *mut bindings::VipsImage = input.ctx;
4666        let xfac_in: i32 = xfac;
4667        let yfac_in: i32 = yfac;
4668        let mut out_out: *mut bindings::VipsImage = null_mut();
4669
4670        let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4671        utils::result(
4672            vips_op_response,
4673            VipsImage { ctx: out_out },
4674            Error::ZoomError,
4675        )
4676    }
4677}
4678
4679/// VipsSubsample (subsample), subsample an image
4680/// input: `&VipsImage` -> Input image
4681/// xfac: `i32` -> Horizontal subsample factor
4682/// min: 1, max: 100000000, default: 1
4683/// yfac: `i32` -> Vertical subsample factor
4684/// min: 1, max: 100000000, default: 1
4685/// returns `VipsImage` - Output image
4686pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4687    unsafe {
4688        let input_in: *mut bindings::VipsImage = input.ctx;
4689        let xfac_in: i32 = xfac;
4690        let yfac_in: i32 = yfac;
4691        let mut out_out: *mut bindings::VipsImage = null_mut();
4692
4693        let vips_op_response =
4694            bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4695        utils::result(
4696            vips_op_response,
4697            VipsImage { ctx: out_out },
4698            Error::SubsampleError,
4699        )
4700    }
4701}
4702
4703/// Options for subsample operation
4704#[derive(Clone, Debug)]
4705pub struct SubsampleOptions {
4706    /// point: `bool` -> Point sample
4707    /// default: false
4708    pub point: bool,
4709}
4710
4711impl std::default::Default for SubsampleOptions {
4712    fn default() -> Self {
4713        SubsampleOptions { point: false }
4714    }
4715}
4716
4717/// VipsSubsample (subsample), subsample an image
4718/// input: `&VipsImage` -> Input image
4719/// xfac: `i32` -> Horizontal subsample factor
4720/// min: 1, max: 100000000, default: 1
4721/// yfac: `i32` -> Vertical subsample factor
4722/// min: 1, max: 100000000, default: 1
4723/// subsample_options: `&SubsampleOptions` -> optional arguments
4724/// returns `VipsImage` - Output image
4725pub fn subsample_with_opts(
4726    input: &VipsImage,
4727    xfac: i32,
4728    yfac: i32,
4729    subsample_options: &SubsampleOptions,
4730) -> Result<VipsImage> {
4731    unsafe {
4732        let input_in: *mut bindings::VipsImage = input.ctx;
4733        let xfac_in: i32 = xfac;
4734        let yfac_in: i32 = yfac;
4735        let mut out_out: *mut bindings::VipsImage = null_mut();
4736
4737        let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4738        let point_in_name = utils::new_c_string("point")?;
4739
4740        let vips_op_response = bindings::vips_subsample(
4741            input_in,
4742            &mut out_out,
4743            xfac_in,
4744            yfac_in,
4745            point_in_name.as_ptr(),
4746            point_in,
4747            NULL,
4748        );
4749        utils::result(
4750            vips_op_response,
4751            VipsImage { ctx: out_out },
4752            Error::SubsampleError,
4753        )
4754    }
4755}
4756
4757/// VipsMsb (msb), pick most-significant byte from an image
4758/// inp: `&VipsImage` -> Input image
4759/// returns `VipsImage` - Output image
4760pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4761    unsafe {
4762        let inp_in: *mut bindings::VipsImage = inp.ctx;
4763        let mut out_out: *mut bindings::VipsImage = null_mut();
4764
4765        let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4766        utils::result(
4767            vips_op_response,
4768            VipsImage { ctx: out_out },
4769            Error::MsbError,
4770        )
4771    }
4772}
4773
4774/// Options for msb operation
4775#[derive(Clone, Debug)]
4776pub struct MsbOptions {
4777    /// band: `i32` -> Band to msb
4778    /// min: -1, max: 100000000, default: -1
4779    pub band: i32,
4780}
4781
4782impl std::default::Default for MsbOptions {
4783    fn default() -> Self {
4784        MsbOptions {
4785            band: i32::from(-1),
4786        }
4787    }
4788}
4789
4790/// VipsMsb (msb), pick most-significant byte from an image
4791/// inp: `&VipsImage` -> Input image
4792/// msb_options: `&MsbOptions` -> optional arguments
4793/// returns `VipsImage` - Output image
4794pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4795    unsafe {
4796        let inp_in: *mut bindings::VipsImage = inp.ctx;
4797        let mut out_out: *mut bindings::VipsImage = null_mut();
4798
4799        let band_in: i32 = msb_options.band;
4800        let band_in_name = utils::new_c_string("band")?;
4801
4802        let vips_op_response =
4803            bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4804        utils::result(
4805            vips_op_response,
4806            VipsImage { ctx: out_out },
4807            Error::MsbError,
4808        )
4809    }
4810}
4811
4812/// VipsByteswap (byteswap), byteswap an image
4813/// inp: `&VipsImage` -> Input image
4814/// returns `VipsImage` - Output image
4815pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4816    unsafe {
4817        let inp_in: *mut bindings::VipsImage = inp.ctx;
4818        let mut out_out: *mut bindings::VipsImage = null_mut();
4819
4820        let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4821        utils::result(
4822            vips_op_response,
4823            VipsImage { ctx: out_out },
4824            Error::ByteswapError,
4825        )
4826    }
4827}
4828
4829/// VipsFalsecolour (falsecolour), false-color an image
4830/// inp: `&VipsImage` -> Input image
4831/// returns `VipsImage` - Output image
4832pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4833    unsafe {
4834        let inp_in: *mut bindings::VipsImage = inp.ctx;
4835        let mut out_out: *mut bindings::VipsImage = null_mut();
4836
4837        let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4838        utils::result(
4839            vips_op_response,
4840            VipsImage { ctx: out_out },
4841            Error::FalsecolourError,
4842        )
4843    }
4844}
4845
4846/// VipsGamma (gamma), gamma an image
4847/// inp: `&VipsImage` -> Input image
4848/// returns `VipsImage` - Output image
4849pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4850    unsafe {
4851        let inp_in: *mut bindings::VipsImage = inp.ctx;
4852        let mut out_out: *mut bindings::VipsImage = null_mut();
4853
4854        let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4855        utils::result(
4856            vips_op_response,
4857            VipsImage { ctx: out_out },
4858            Error::GammaError,
4859        )
4860    }
4861}
4862
4863/// Options for gamma operation
4864#[derive(Clone, Debug)]
4865pub struct GammaOptions {
4866    /// exponent: `f64` -> Gamma factor
4867    /// min: 0.000001, max: 1000, default: 0.416667
4868    pub exponent: f64,
4869}
4870
4871impl std::default::Default for GammaOptions {
4872    fn default() -> Self {
4873        GammaOptions {
4874            exponent: f64::from(0.416667),
4875        }
4876    }
4877}
4878
4879/// VipsGamma (gamma), gamma an image
4880/// inp: `&VipsImage` -> Input image
4881/// gamma_options: `&GammaOptions` -> optional arguments
4882/// returns `VipsImage` - Output image
4883pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4884    unsafe {
4885        let inp_in: *mut bindings::VipsImage = inp.ctx;
4886        let mut out_out: *mut bindings::VipsImage = null_mut();
4887
4888        let exponent_in: f64 = gamma_options.exponent;
4889        let exponent_in_name = utils::new_c_string("exponent")?;
4890
4891        let vips_op_response = bindings::vips_gamma(
4892            inp_in,
4893            &mut out_out,
4894            exponent_in_name.as_ptr(),
4895            exponent_in,
4896            NULL,
4897        );
4898        utils::result(
4899            vips_op_response,
4900            VipsImage { ctx: out_out },
4901            Error::GammaError,
4902        )
4903    }
4904}
4905
4906/// VipsComposite (composite), blend an array of images with an array of blend modes
4907/// inp: `&mut [VipsImage]` -> Array of input images
4908/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
4909/// returns `VipsImage` - Output image
4910pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
4911    unsafe {
4912        let (inp_len, mut inp_in) = {
4913            let len = inp.len();
4914            let mut input = Vec::new();
4915            for img in inp {
4916                input.push(img.ctx)
4917            }
4918            (len as i32, input)
4919        };
4920        let mode_in: *mut i32 = mode.as_mut_ptr();
4921        let mut out_out: *mut bindings::VipsImage = null_mut();
4922
4923        let vips_op_response = bindings::vips_composite(
4924            inp_in.as_mut_ptr(),
4925            &mut out_out,
4926            inp_len,
4927            mode_in,
4928            mode.len() as i32,
4929            NULL,
4930        );
4931        utils::result(
4932            vips_op_response,
4933            VipsImage { ctx: out_out },
4934            Error::CompositeError,
4935        )
4936    }
4937}
4938
4939/// Options for composite operation
4940#[derive(Clone, Debug)]
4941pub struct CompositeOptions {
4942    /// x: `Vec<i32>` -> Array of x coordinates to join at
4943    pub x: Vec<i32>,
4944    /// y: `Vec<i32>` -> Array of y coordinates to join at
4945    pub y: Vec<i32>,
4946    /// compositing_space: `Interpretation` -> Composite images in this colour space
4947    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
4948    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
4949    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
4950    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
4951    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
4952    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
4953    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
4954    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
4955    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
4956    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
4957    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
4958    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
4959    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
4960    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
4961    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
4962    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
4963    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
4964    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
4965    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
4966    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
4967    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
4968    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
4969    pub compositing_space: Interpretation,
4970    /// premultiplied: `bool` -> Images have premultiplied alpha
4971    /// default: false
4972    pub premultiplied: bool,
4973}
4974
4975impl std::default::Default for CompositeOptions {
4976    fn default() -> Self {
4977        CompositeOptions {
4978            x: Vec::new(),
4979            y: Vec::new(),
4980            compositing_space: Interpretation::Srgb,
4981            premultiplied: false,
4982        }
4983    }
4984}
4985
4986/// VipsComposite (composite), blend an array of images with an array of blend modes
4987/// inp: `&mut [VipsImage]` -> Array of input images
4988/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
4989/// composite_options: `&CompositeOptions` -> optional arguments
4990/// returns `VipsImage` - Output image
4991pub fn composite_with_opts(
4992    inp: &mut [VipsImage],
4993    mode: &mut [i32],
4994    composite_options: &CompositeOptions,
4995) -> Result<VipsImage> {
4996    unsafe {
4997        let (inp_len, mut inp_in) = {
4998            let len = inp.len();
4999            let mut input = Vec::new();
5000            for img in inp {
5001                input.push(img.ctx)
5002            }
5003            (len as i32, input)
5004        };
5005        let mode_in: *mut i32 = mode.as_mut_ptr();
5006        let mut out_out: *mut bindings::VipsImage = null_mut();
5007
5008        let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5009        let x_in = x_wrapper.ctx;
5010        let x_in_name = utils::new_c_string("x")?;
5011
5012        let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5013        let y_in = y_wrapper.ctx;
5014        let y_in_name = utils::new_c_string("y")?;
5015
5016        let compositing_space_in: i32 = composite_options.compositing_space as i32;
5017        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5018
5019        let premultiplied_in: i32 = if composite_options.premultiplied {
5020            1
5021        } else {
5022            0
5023        };
5024        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5025
5026        let vips_op_response = bindings::vips_composite(
5027            inp_in.as_mut_ptr(),
5028            &mut out_out,
5029            inp_len,
5030            mode_in,
5031            mode.len() as i32,
5032            x_in_name.as_ptr(),
5033            x_in,
5034            y_in_name.as_ptr(),
5035            y_in,
5036            compositing_space_in_name.as_ptr(),
5037            compositing_space_in,
5038            premultiplied_in_name.as_ptr(),
5039            premultiplied_in,
5040            NULL,
5041        );
5042        utils::result(
5043            vips_op_response,
5044            VipsImage { ctx: out_out },
5045            Error::CompositeError,
5046        )
5047    }
5048}
5049
5050/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5051/// base: `&VipsImage` -> Base image
5052/// overlay: `&VipsImage` -> Overlay image
5053/// mode: `BlendMode` -> VipsBlendMode to join with
5054///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5055///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5056///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5057///  `In` -> VIPS_BLEND_MODE_IN = 3
5058///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5059///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5060///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5061///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5062///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5063///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5064///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5065///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5066///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5067///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5068///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5069///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5070///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5071///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5072///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5073///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5074///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5075///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5076///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5077///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5078///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5079/// returns `VipsImage` - Output image
5080pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5081    unsafe {
5082        let base_in: *mut bindings::VipsImage = base.ctx;
5083        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5084        let mode_in: i32 = mode as i32;
5085        let mut out_out: *mut bindings::VipsImage = null_mut();
5086
5087        let vips_op_response = bindings::vips_composite2(
5088            base_in,
5089            overlay_in,
5090            &mut out_out,
5091            mode_in.try_into().unwrap(),
5092            NULL,
5093        );
5094        utils::result(
5095            vips_op_response,
5096            VipsImage { ctx: out_out },
5097            Error::Composite2Error,
5098        )
5099    }
5100}
5101
5102/// Options for composite_2 operation
5103#[derive(Clone, Debug)]
5104pub struct Composite2Options {
5105    /// x: `i32` -> x position of overlay
5106    /// min: -100000000, max: 100000000, default: 0
5107    pub x: i32,
5108    /// y: `i32` -> y position of overlay
5109    /// min: -100000000, max: 100000000, default: 0
5110    pub y: i32,
5111    /// compositing_space: `Interpretation` -> Composite images in this colour space
5112    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5113    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5114    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5115    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5116    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5117    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5118    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5119    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5120    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5121    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5122    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5123    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5124    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5125    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5126    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5127    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5128    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5129    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5130    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5131    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5132    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
5133    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
5134    pub compositing_space: Interpretation,
5135    /// premultiplied: `bool` -> Images have premultiplied alpha
5136    /// default: false
5137    pub premultiplied: bool,
5138}
5139
5140impl std::default::Default for Composite2Options {
5141    fn default() -> Self {
5142        Composite2Options {
5143            x: i32::from(0),
5144            y: i32::from(0),
5145            compositing_space: Interpretation::Srgb,
5146            premultiplied: false,
5147        }
5148    }
5149}
5150
5151/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5152/// base: `&VipsImage` -> Base image
5153/// overlay: `&VipsImage` -> Overlay image
5154/// mode: `BlendMode` -> VipsBlendMode to join with
5155///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5156///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5157///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5158///  `In` -> VIPS_BLEND_MODE_IN = 3
5159///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5160///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5161///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5162///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5163///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5164///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5165///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5166///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5167///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5168///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5169///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5170///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5171///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5172///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5173///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5174///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5175///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5176///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5177///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5178///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5179///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5180/// composite_2_options: `&Composite2Options` -> optional arguments
5181/// returns `VipsImage` - Output image
5182pub fn composite_2_with_opts(
5183    base: &VipsImage,
5184    overlay: &VipsImage,
5185    mode: BlendMode,
5186    composite_2_options: &Composite2Options,
5187) -> Result<VipsImage> {
5188    unsafe {
5189        let base_in: *mut bindings::VipsImage = base.ctx;
5190        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5191        let mode_in: i32 = mode as i32;
5192        let mut out_out: *mut bindings::VipsImage = null_mut();
5193
5194        let x_in: i32 = composite_2_options.x;
5195        let x_in_name = utils::new_c_string("x")?;
5196
5197        let y_in: i32 = composite_2_options.y;
5198        let y_in_name = utils::new_c_string("y")?;
5199
5200        let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5201        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5202
5203        let premultiplied_in: i32 = if composite_2_options.premultiplied {
5204            1
5205        } else {
5206            0
5207        };
5208        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5209
5210        let vips_op_response = bindings::vips_composite2(
5211            base_in,
5212            overlay_in,
5213            &mut out_out,
5214            mode_in.try_into().unwrap(),
5215            x_in_name.as_ptr(),
5216            x_in,
5217            y_in_name.as_ptr(),
5218            y_in,
5219            compositing_space_in_name.as_ptr(),
5220            compositing_space_in,
5221            premultiplied_in_name.as_ptr(),
5222            premultiplied_in,
5223            NULL,
5224        );
5225        utils::result(
5226            vips_op_response,
5227            VipsImage { ctx: out_out },
5228            Error::Composite2Error,
5229        )
5230    }
5231}
5232
5233/// VipsAddAlpha (addalpha), append an alpha channel
5234/// inp: `&VipsImage` -> Input image
5235/// returns `VipsImage` - Output image
5236pub fn addalpha(inp: &VipsImage) -> Result<VipsImage> {
5237    unsafe {
5238        let inp_in: *mut bindings::VipsImage = inp.ctx;
5239        let mut out_out: *mut bindings::VipsImage = null_mut();
5240
5241        let vips_op_response = bindings::vips_addalpha(inp_in, &mut out_out, NULL);
5242        utils::result(
5243            vips_op_response,
5244            VipsImage { ctx: out_out },
5245            Error::AddalphaError,
5246        )
5247    }
5248}
5249
5250/// VipsBlack (black), make a black image
5251/// width: `i32` -> Image width in pixels
5252/// min: 1, max: 100000000, default: 1
5253/// height: `i32` -> Image height in pixels
5254/// min: 1, max: 100000000, default: 1
5255/// returns `VipsImage` - Output image
5256pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5257    unsafe {
5258        let width_in: i32 = width;
5259        let height_in: i32 = height;
5260        let mut out_out: *mut bindings::VipsImage = null_mut();
5261
5262        let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5263        utils::result(
5264            vips_op_response,
5265            VipsImage { ctx: out_out },
5266            Error::BlackError,
5267        )
5268    }
5269}
5270
5271/// Options for black operation
5272#[derive(Clone, Debug)]
5273pub struct BlackOptions {
5274    /// bands: `i32` -> Number of bands in image
5275    /// min: 1, max: 100000000, default: 1
5276    pub bands: i32,
5277}
5278
5279impl std::default::Default for BlackOptions {
5280    fn default() -> Self {
5281        BlackOptions {
5282            bands: i32::from(1),
5283        }
5284    }
5285}
5286
5287/// VipsBlack (black), make a black image
5288/// width: `i32` -> Image width in pixels
5289/// min: 1, max: 100000000, default: 1
5290/// height: `i32` -> Image height in pixels
5291/// min: 1, max: 100000000, default: 1
5292/// black_options: `&BlackOptions` -> optional arguments
5293/// returns `VipsImage` - Output image
5294pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5295    unsafe {
5296        let width_in: i32 = width;
5297        let height_in: i32 = height;
5298        let mut out_out: *mut bindings::VipsImage = null_mut();
5299
5300        let bands_in: i32 = black_options.bands;
5301        let bands_in_name = utils::new_c_string("bands")?;
5302
5303        let vips_op_response = bindings::vips_black(
5304            &mut out_out,
5305            width_in,
5306            height_in,
5307            bands_in_name.as_ptr(),
5308            bands_in,
5309            NULL,
5310        );
5311        utils::result(
5312            vips_op_response,
5313            VipsImage { ctx: out_out },
5314            Error::BlackError,
5315        )
5316    }
5317}
5318
5319/// VipsGaussnoise (gaussnoise), make a gaussnoise image, nocache
5320/// width: `i32` -> Image width in pixels
5321/// min: 1, max: 100000000, default: 1
5322/// height: `i32` -> Image height in pixels
5323/// min: 1, max: 100000000, default: 1
5324/// returns `VipsImage` - Output image
5325pub fn gaussnoise(width: i32, height: i32) -> 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 vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5332        utils::result(
5333            vips_op_response,
5334            VipsImage { ctx: out_out },
5335            Error::GaussnoiseError,
5336        )
5337    }
5338}
5339
5340/// Options for gaussnoise operation
5341#[derive(Clone, Debug)]
5342pub struct GaussnoiseOptions {
5343    /// sigma: `f64` -> Standard deviation of pixels in generated image
5344    /// min: 0, max: 100000, default: 30
5345    pub sigma: f64,
5346    /// mean: `f64` -> Mean of pixels in generated image
5347    /// min: -10000000, max: 1000000, default: 128
5348    pub mean: f64,
5349    /// seed: `i32` -> Random number seed
5350    /// min: -2147483648, max: 2147483647, default: 0
5351    pub seed: i32,
5352}
5353
5354impl std::default::Default for GaussnoiseOptions {
5355    fn default() -> Self {
5356        GaussnoiseOptions {
5357            sigma: f64::from(30),
5358            mean: f64::from(128),
5359            seed: i32::from(0),
5360        }
5361    }
5362}
5363
5364/// VipsGaussnoise (gaussnoise), make a gaussnoise image, nocache
5365/// width: `i32` -> Image width in pixels
5366/// min: 1, max: 100000000, default: 1
5367/// height: `i32` -> Image height in pixels
5368/// min: 1, max: 100000000, default: 1
5369/// gaussnoise_options: `&GaussnoiseOptions` -> optional arguments
5370/// returns `VipsImage` - Output image
5371pub fn gaussnoise_with_opts(
5372    width: i32,
5373    height: i32,
5374    gaussnoise_options: &GaussnoiseOptions,
5375) -> Result<VipsImage> {
5376    unsafe {
5377        let width_in: i32 = width;
5378        let height_in: i32 = height;
5379        let mut out_out: *mut bindings::VipsImage = null_mut();
5380
5381        let sigma_in: f64 = gaussnoise_options.sigma;
5382        let sigma_in_name = utils::new_c_string("sigma")?;
5383
5384        let mean_in: f64 = gaussnoise_options.mean;
5385        let mean_in_name = utils::new_c_string("mean")?;
5386
5387        let seed_in: i32 = gaussnoise_options.seed;
5388        let seed_in_name = utils::new_c_string("seed")?;
5389
5390        let vips_op_response = bindings::vips_gaussnoise(
5391            &mut out_out,
5392            width_in,
5393            height_in,
5394            sigma_in_name.as_ptr(),
5395            sigma_in,
5396            mean_in_name.as_ptr(),
5397            mean_in,
5398            seed_in_name.as_ptr(),
5399            seed_in,
5400            NULL,
5401        );
5402        utils::result(
5403            vips_op_response,
5404            VipsImage { ctx: out_out },
5405            Error::GaussnoiseError,
5406        )
5407    }
5408}
5409
5410/// VipsXyz (xyz), make an image where pixel values are coordinates
5411/// width: `i32` -> Image width in pixels
5412/// min: 1, max: 100000000, default: 64
5413/// height: `i32` -> Image height in pixels
5414/// min: 1, max: 100000000, default: 64
5415/// returns `VipsImage` - Output image
5416pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5417    unsafe {
5418        let width_in: i32 = width;
5419        let height_in: i32 = height;
5420        let mut out_out: *mut bindings::VipsImage = null_mut();
5421
5422        let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5423        utils::result(
5424            vips_op_response,
5425            VipsImage { ctx: out_out },
5426            Error::XyzError,
5427        )
5428    }
5429}
5430
5431/// Options for xyz operation
5432#[derive(Clone, Debug)]
5433pub struct XyzOptions {
5434    /// csize: `i32` -> Size of third dimension
5435    /// min: 1, max: 100000000, default: 1
5436    pub csize: i32,
5437    /// dsize: `i32` -> Size of fourth dimension
5438    /// min: 1, max: 100000000, default: 1
5439    pub dsize: i32,
5440    /// esize: `i32` -> Size of fifth dimension
5441    /// min: 1, max: 100000000, default: 1
5442    pub esize: i32,
5443}
5444
5445impl std::default::Default for XyzOptions {
5446    fn default() -> Self {
5447        XyzOptions {
5448            csize: i32::from(1),
5449            dsize: i32::from(1),
5450            esize: i32::from(1),
5451        }
5452    }
5453}
5454
5455/// VipsXyz (xyz), make an image where pixel values are coordinates
5456/// width: `i32` -> Image width in pixels
5457/// min: 1, max: 100000000, default: 64
5458/// height: `i32` -> Image height in pixels
5459/// min: 1, max: 100000000, default: 64
5460/// xyz_options: `&XyzOptions` -> optional arguments
5461/// returns `VipsImage` - Output image
5462pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5463    unsafe {
5464        let width_in: i32 = width;
5465        let height_in: i32 = height;
5466        let mut out_out: *mut bindings::VipsImage = null_mut();
5467
5468        let csize_in: i32 = xyz_options.csize;
5469        let csize_in_name = utils::new_c_string("csize")?;
5470
5471        let dsize_in: i32 = xyz_options.dsize;
5472        let dsize_in_name = utils::new_c_string("dsize")?;
5473
5474        let esize_in: i32 = xyz_options.esize;
5475        let esize_in_name = utils::new_c_string("esize")?;
5476
5477        let vips_op_response = bindings::vips_xyz(
5478            &mut out_out,
5479            width_in,
5480            height_in,
5481            csize_in_name.as_ptr(),
5482            csize_in,
5483            dsize_in_name.as_ptr(),
5484            dsize_in,
5485            esize_in_name.as_ptr(),
5486            esize_in,
5487            NULL,
5488        );
5489        utils::result(
5490            vips_op_response,
5491            VipsImage { ctx: out_out },
5492            Error::XyzError,
5493        )
5494    }
5495}
5496
5497/// VipsGaussmat (gaussmat), make a gaussian image
5498/// sigma: `f64` -> Sigma of Gaussian
5499/// min: 0.000001, max: 10000, default: 1
5500/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5501/// min: 0.000001, max: 10000, default: 0.1
5502/// returns `VipsImage` - Output image
5503pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5504    unsafe {
5505        let sigma_in: f64 = sigma;
5506        let min_ampl_in: f64 = min_ampl;
5507        let mut out_out: *mut bindings::VipsImage = null_mut();
5508
5509        let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5510        utils::result(
5511            vips_op_response,
5512            VipsImage { ctx: out_out },
5513            Error::GaussmatError,
5514        )
5515    }
5516}
5517
5518/// Options for gaussmat operation
5519#[derive(Clone, Debug)]
5520pub struct GaussmatOptions {
5521    /// separable: `bool` -> Generate separable Gaussian
5522    /// default: false
5523    pub separable: bool,
5524    /// precision: `Precision` -> Generate with this precision
5525    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5526    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5527    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5528    pub precision: Precision,
5529}
5530
5531impl std::default::Default for GaussmatOptions {
5532    fn default() -> Self {
5533        GaussmatOptions {
5534            separable: false,
5535            precision: Precision::Integer,
5536        }
5537    }
5538}
5539
5540/// VipsGaussmat (gaussmat), make a gaussian image
5541/// sigma: `f64` -> Sigma of Gaussian
5542/// min: 0.000001, max: 10000, default: 1
5543/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5544/// min: 0.000001, max: 10000, default: 0.1
5545/// gaussmat_options: `&GaussmatOptions` -> optional arguments
5546/// returns `VipsImage` - Output image
5547pub fn gaussmat_with_opts(
5548    sigma: f64,
5549    min_ampl: f64,
5550    gaussmat_options: &GaussmatOptions,
5551) -> Result<VipsImage> {
5552    unsafe {
5553        let sigma_in: f64 = sigma;
5554        let min_ampl_in: f64 = min_ampl;
5555        let mut out_out: *mut bindings::VipsImage = null_mut();
5556
5557        let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5558        let separable_in_name = utils::new_c_string("separable")?;
5559
5560        let precision_in: i32 = gaussmat_options.precision as i32;
5561        let precision_in_name = utils::new_c_string("precision")?;
5562
5563        let vips_op_response = bindings::vips_gaussmat(
5564            &mut out_out,
5565            sigma_in,
5566            min_ampl_in,
5567            separable_in_name.as_ptr(),
5568            separable_in,
5569            precision_in_name.as_ptr(),
5570            precision_in,
5571            NULL,
5572        );
5573        utils::result(
5574            vips_op_response,
5575            VipsImage { ctx: out_out },
5576            Error::GaussmatError,
5577        )
5578    }
5579}
5580
5581/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5582/// sigma: `f64` -> Radius of Gaussian
5583/// min: 0.000001, max: 10000, default: 1
5584/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5585/// min: 0.000001, max: 10000, default: 0.1
5586/// returns `VipsImage` - Output image
5587pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5588    unsafe {
5589        let sigma_in: f64 = sigma;
5590        let min_ampl_in: f64 = min_ampl;
5591        let mut out_out: *mut bindings::VipsImage = null_mut();
5592
5593        let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5594        utils::result(
5595            vips_op_response,
5596            VipsImage { ctx: out_out },
5597            Error::LogmatError,
5598        )
5599    }
5600}
5601
5602/// Options for logmat operation
5603#[derive(Clone, Debug)]
5604pub struct LogmatOptions {
5605    /// separable: `bool` -> Generate separable Gaussian
5606    /// default: false
5607    pub separable: bool,
5608    /// precision: `Precision` -> Generate with this precision
5609    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5610    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5611    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5612    pub precision: Precision,
5613}
5614
5615impl std::default::Default for LogmatOptions {
5616    fn default() -> Self {
5617        LogmatOptions {
5618            separable: false,
5619            precision: Precision::Integer,
5620        }
5621    }
5622}
5623
5624/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5625/// sigma: `f64` -> Radius of Gaussian
5626/// min: 0.000001, max: 10000, default: 1
5627/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5628/// min: 0.000001, max: 10000, default: 0.1
5629/// logmat_options: `&LogmatOptions` -> optional arguments
5630/// returns `VipsImage` - Output image
5631pub fn logmat_with_opts(
5632    sigma: f64,
5633    min_ampl: f64,
5634    logmat_options: &LogmatOptions,
5635) -> Result<VipsImage> {
5636    unsafe {
5637        let sigma_in: f64 = sigma;
5638        let min_ampl_in: f64 = min_ampl;
5639        let mut out_out: *mut bindings::VipsImage = null_mut();
5640
5641        let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5642        let separable_in_name = utils::new_c_string("separable")?;
5643
5644        let precision_in: i32 = logmat_options.precision as i32;
5645        let precision_in_name = utils::new_c_string("precision")?;
5646
5647        let vips_op_response = bindings::vips_logmat(
5648            &mut out_out,
5649            sigma_in,
5650            min_ampl_in,
5651            separable_in_name.as_ptr(),
5652            separable_in,
5653            precision_in_name.as_ptr(),
5654            precision_in,
5655            NULL,
5656        );
5657        utils::result(
5658            vips_op_response,
5659            VipsImage { ctx: out_out },
5660            Error::LogmatError,
5661        )
5662    }
5663}
5664
5665/// VipsText (text), make a text image
5666/// text: `&str` -> Text to render
5667/// returns `VipsImage` - Output image
5668pub fn text(text: &str) -> Result<VipsImage> {
5669    unsafe {
5670        let text_in: CString = utils::new_c_string(text)?;
5671        let mut out_out: *mut bindings::VipsImage = null_mut();
5672
5673        let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5674        utils::result(
5675            vips_op_response,
5676            VipsImage { ctx: out_out },
5677            Error::TextError,
5678        )
5679    }
5680}
5681
5682/// Options for text operation
5683#[derive(Clone, Debug)]
5684pub struct TextOptions {
5685    /// font: `String` -> Font to render with
5686    pub font: String,
5687    /// width: `i32` -> Maximum image width in pixels
5688    /// min: 0, max: 100000000, default: 0
5689    pub width: i32,
5690    /// height: `i32` -> Maximum image height in pixels
5691    /// min: 0, max: 100000000, default: 0
5692    pub height: i32,
5693    /// align: `Align` -> Align on the low, centre or high edge
5694    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
5695    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
5696    ///  `High` -> VIPS_ALIGN_HIGH = 2
5697    pub align: Align,
5698    /// justify: `bool` -> Justify lines
5699    /// default: false
5700    pub justify: bool,
5701    /// dpi: `i32` -> DPI to render at
5702    /// min: 1, max: 1000000, default: 72
5703    pub dpi: i32,
5704    /// autofit_dpi: `i32` -> DPI selected by autofit
5705    /// min: 1, max: 1000000, default: 72
5706    pub autofit_dpi: i32,
5707    /// spacing: `i32` -> Line spacing
5708    /// min: -1000000, max: 1000000, default: 0
5709    pub spacing: i32,
5710    /// fontfile: `String` -> Load this font file
5711    pub fontfile: String,
5712    /// rgba: `bool` -> Enable RGBA output
5713    /// default: false
5714    pub rgba: bool,
5715    /// wrap: `TextWrap` -> Wrap lines on word or character boundaries
5716    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0 [DEFAULT]
5717    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
5718    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
5719    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
5720    pub wrap: TextWrap,
5721}
5722
5723impl std::default::Default for TextOptions {
5724    fn default() -> Self {
5725        TextOptions {
5726            font: String::new(),
5727            width: i32::from(0),
5728            height: i32::from(0),
5729            align: Align::Low,
5730            justify: false,
5731            dpi: i32::from(72),
5732            autofit_dpi: i32::from(72),
5733            spacing: i32::from(0),
5734            fontfile: String::new(),
5735            rgba: false,
5736            wrap: TextWrap::Word,
5737        }
5738    }
5739}
5740
5741/// VipsText (text), make a text image
5742/// text: `&str` -> Text to render
5743/// text_options: `&TextOptions` -> optional arguments
5744/// returns `VipsImage` - Output image
5745pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5746    unsafe {
5747        let text_in: CString = utils::new_c_string(text)?;
5748        let mut out_out: *mut bindings::VipsImage = null_mut();
5749
5750        let font_in: CString = utils::new_c_string(&text_options.font)?;
5751        let font_in_name = utils::new_c_string("font")?;
5752
5753        let width_in: i32 = text_options.width;
5754        let width_in_name = utils::new_c_string("width")?;
5755
5756        let height_in: i32 = text_options.height;
5757        let height_in_name = utils::new_c_string("height")?;
5758
5759        let align_in: i32 = text_options.align as i32;
5760        let align_in_name = utils::new_c_string("align")?;
5761
5762        let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5763        let justify_in_name = utils::new_c_string("justify")?;
5764
5765        let dpi_in: i32 = text_options.dpi;
5766        let dpi_in_name = utils::new_c_string("dpi")?;
5767
5768        let autofit_dpi_in: i32 = text_options.autofit_dpi;
5769        let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5770
5771        let spacing_in: i32 = text_options.spacing;
5772        let spacing_in_name = utils::new_c_string("spacing")?;
5773
5774        let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5775        let fontfile_in_name = utils::new_c_string("fontfile")?;
5776
5777        let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5778        let rgba_in_name = utils::new_c_string("rgba")?;
5779
5780        let wrap_in: i32 = text_options.wrap as i32;
5781        let wrap_in_name = utils::new_c_string("wrap")?;
5782
5783        let vips_op_response = bindings::vips_text(
5784            &mut out_out,
5785            text_in.as_ptr(),
5786            font_in_name.as_ptr(),
5787            font_in.as_ptr(),
5788            width_in_name.as_ptr(),
5789            width_in,
5790            height_in_name.as_ptr(),
5791            height_in,
5792            align_in_name.as_ptr(),
5793            align_in,
5794            justify_in_name.as_ptr(),
5795            justify_in,
5796            dpi_in_name.as_ptr(),
5797            dpi_in,
5798            autofit_dpi_in_name.as_ptr(),
5799            autofit_dpi_in,
5800            spacing_in_name.as_ptr(),
5801            spacing_in,
5802            fontfile_in_name.as_ptr(),
5803            fontfile_in.as_ptr(),
5804            rgba_in_name.as_ptr(),
5805            rgba_in,
5806            wrap_in_name.as_ptr(),
5807            wrap_in,
5808            NULL,
5809        );
5810        utils::result(
5811            vips_op_response,
5812            VipsImage { ctx: out_out },
5813            Error::TextError,
5814        )
5815    }
5816}
5817
5818/// VipsSdf (sdf), create an SDF image
5819/// width: `i32` -> Image width in pixels
5820/// min: 1, max: 100000000, default: 1
5821/// height: `i32` -> Image height in pixels
5822/// min: 1, max: 100000000, default: 1
5823/// shape: `SdfShape` -> SDF shape to create
5824///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5825///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5826///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5827///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5828/// returns `VipsImage` - Output image
5829pub fn sdf(width: i32, height: i32, shape: SdfShape) -> Result<VipsImage> {
5830    unsafe {
5831        let width_in: i32 = width;
5832        let height_in: i32 = height;
5833        let shape_in: i32 = shape as i32;
5834        let mut out_out: *mut bindings::VipsImage = null_mut();
5835
5836        let vips_op_response = bindings::vips_sdf(
5837            &mut out_out,
5838            width_in,
5839            height_in,
5840            shape_in.try_into().unwrap(),
5841            NULL,
5842        );
5843        utils::result(
5844            vips_op_response,
5845            VipsImage { ctx: out_out },
5846            Error::SdfError,
5847        )
5848    }
5849}
5850
5851/// Options for sdf operation
5852#[derive(Clone, Debug)]
5853pub struct SdfOptions {
5854    /// r: `f64` -> Radius
5855    /// min: 0, max: 100000000, default: 50
5856    pub r: f64,
5857    /// a: `Vec<f64>` -> Point a
5858    pub a: Vec<f64>,
5859    /// b: `Vec<f64>` -> Point b
5860    pub b: Vec<f64>,
5861    /// corners: `Vec<f64>` -> Corner radii
5862    pub corners: Vec<f64>,
5863}
5864
5865impl std::default::Default for SdfOptions {
5866    fn default() -> Self {
5867        SdfOptions {
5868            r: f64::from(50),
5869            a: Vec::new(),
5870            b: Vec::new(),
5871            corners: Vec::new(),
5872        }
5873    }
5874}
5875
5876/// VipsSdf (sdf), create an SDF image
5877/// width: `i32` -> Image width in pixels
5878/// min: 1, max: 100000000, default: 1
5879/// height: `i32` -> Image height in pixels
5880/// min: 1, max: 100000000, default: 1
5881/// shape: `SdfShape` -> SDF shape to create
5882///  `Circle` -> VIPS_SDF_SHAPE_CIRCLE = 0 [DEFAULT]
5883///  `Box` -> VIPS_SDF_SHAPE_BOX = 1
5884///  `RoundedBox` -> VIPS_SDF_SHAPE_ROUNDED_BOX = 2
5885///  `Line` -> VIPS_SDF_SHAPE_LINE = 3
5886/// sdf_options: `&SdfOptions` -> optional arguments
5887/// returns `VipsImage` - Output image
5888pub fn sdf_with_opts(
5889    width: i32,
5890    height: i32,
5891    shape: SdfShape,
5892    sdf_options: &SdfOptions,
5893) -> Result<VipsImage> {
5894    unsafe {
5895        let width_in: i32 = width;
5896        let height_in: i32 = height;
5897        let shape_in: i32 = shape as i32;
5898        let mut out_out: *mut bindings::VipsImage = null_mut();
5899
5900        let r_in: f64 = sdf_options.r;
5901        let r_in_name = utils::new_c_string("r")?;
5902
5903        let a_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.a[..]);
5904        let a_in = a_wrapper.ctx;
5905        let a_in_name = utils::new_c_string("a")?;
5906
5907        let b_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.b[..]);
5908        let b_in = b_wrapper.ctx;
5909        let b_in_name = utils::new_c_string("b")?;
5910
5911        let corners_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.corners[..]);
5912        let corners_in = corners_wrapper.ctx;
5913        let corners_in_name = utils::new_c_string("corners")?;
5914
5915        let vips_op_response = bindings::vips_sdf(
5916            &mut out_out,
5917            width_in,
5918            height_in,
5919            shape_in.try_into().unwrap(),
5920            r_in_name.as_ptr(),
5921            r_in,
5922            a_in_name.as_ptr(),
5923            a_in,
5924            b_in_name.as_ptr(),
5925            b_in,
5926            corners_in_name.as_ptr(),
5927            corners_in,
5928            NULL,
5929        );
5930        utils::result(
5931            vips_op_response,
5932            VipsImage { ctx: out_out },
5933            Error::SdfError,
5934        )
5935    }
5936}
5937
5938/// VipsEye (eye), make an image showing the eye's spatial response
5939/// width: `i32` -> Image width in pixels
5940/// min: 1, max: 100000000, default: 1
5941/// height: `i32` -> Image height in pixels
5942/// min: 1, max: 100000000, default: 1
5943/// returns `VipsImage` - Output image
5944pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
5945    unsafe {
5946        let width_in: i32 = width;
5947        let height_in: i32 = height;
5948        let mut out_out: *mut bindings::VipsImage = null_mut();
5949
5950        let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
5951        utils::result(
5952            vips_op_response,
5953            VipsImage { ctx: out_out },
5954            Error::EyeError,
5955        )
5956    }
5957}
5958
5959/// Options for eye operation
5960#[derive(Clone, Debug)]
5961pub struct EyeOptions {
5962    /// uchar: `bool` -> Output an unsigned char image
5963    /// default: false
5964    pub uchar: bool,
5965    /// factor: `f64` -> Maximum spatial frequency
5966    /// min: 0, max: 1, default: 0.5
5967    pub factor: f64,
5968}
5969
5970impl std::default::Default for EyeOptions {
5971    fn default() -> Self {
5972        EyeOptions {
5973            uchar: false,
5974            factor: f64::from(0.5),
5975        }
5976    }
5977}
5978
5979/// VipsEye (eye), make an image showing the eye's spatial response
5980/// width: `i32` -> Image width in pixels
5981/// min: 1, max: 100000000, default: 1
5982/// height: `i32` -> Image height in pixels
5983/// min: 1, max: 100000000, default: 1
5984/// eye_options: `&EyeOptions` -> optional arguments
5985/// returns `VipsImage` - Output image
5986pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
5987    unsafe {
5988        let width_in: i32 = width;
5989        let height_in: i32 = height;
5990        let mut out_out: *mut bindings::VipsImage = null_mut();
5991
5992        let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
5993        let uchar_in_name = utils::new_c_string("uchar")?;
5994
5995        let factor_in: f64 = eye_options.factor;
5996        let factor_in_name = utils::new_c_string("factor")?;
5997
5998        let vips_op_response = bindings::vips_eye(
5999            &mut out_out,
6000            width_in,
6001            height_in,
6002            uchar_in_name.as_ptr(),
6003            uchar_in,
6004            factor_in_name.as_ptr(),
6005            factor_in,
6006            NULL,
6007        );
6008        utils::result(
6009            vips_op_response,
6010            VipsImage { ctx: out_out },
6011            Error::EyeError,
6012        )
6013    }
6014}
6015
6016/// VipsGrey (grey), make a grey ramp image
6017/// width: `i32` -> Image width in pixels
6018/// min: 1, max: 100000000, default: 1
6019/// height: `i32` -> Image height in pixels
6020/// min: 1, max: 100000000, default: 1
6021/// returns `VipsImage` - Output image
6022pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
6023    unsafe {
6024        let width_in: i32 = width;
6025        let height_in: i32 = height;
6026        let mut out_out: *mut bindings::VipsImage = null_mut();
6027
6028        let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
6029        utils::result(
6030            vips_op_response,
6031            VipsImage { ctx: out_out },
6032            Error::GreyError,
6033        )
6034    }
6035}
6036
6037/// Options for grey operation
6038#[derive(Clone, Debug)]
6039pub struct GreyOptions {
6040    /// uchar: `bool` -> Output an unsigned char image
6041    /// default: false
6042    pub uchar: bool,
6043}
6044
6045impl std::default::Default for GreyOptions {
6046    fn default() -> Self {
6047        GreyOptions { uchar: false }
6048    }
6049}
6050
6051/// VipsGrey (grey), make a grey ramp image
6052/// width: `i32` -> Image width in pixels
6053/// min: 1, max: 100000000, default: 1
6054/// height: `i32` -> Image height in pixels
6055/// min: 1, max: 100000000, default: 1
6056/// grey_options: `&GreyOptions` -> optional arguments
6057/// returns `VipsImage` - Output image
6058pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6059    unsafe {
6060        let width_in: i32 = width;
6061        let height_in: i32 = height;
6062        let mut out_out: *mut bindings::VipsImage = null_mut();
6063
6064        let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6065        let uchar_in_name = utils::new_c_string("uchar")?;
6066
6067        let vips_op_response = bindings::vips_grey(
6068            &mut out_out,
6069            width_in,
6070            height_in,
6071            uchar_in_name.as_ptr(),
6072            uchar_in,
6073            NULL,
6074        );
6075        utils::result(
6076            vips_op_response,
6077            VipsImage { ctx: out_out },
6078            Error::GreyError,
6079        )
6080    }
6081}
6082
6083/// VipsZone (zone), make a zone plate
6084/// width: `i32` -> Image width in pixels
6085/// min: 1, max: 100000000, default: 1
6086/// height: `i32` -> Image height in pixels
6087/// min: 1, max: 100000000, default: 1
6088/// returns `VipsImage` - Output image
6089pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6090    unsafe {
6091        let width_in: i32 = width;
6092        let height_in: i32 = height;
6093        let mut out_out: *mut bindings::VipsImage = null_mut();
6094
6095        let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6096        utils::result(
6097            vips_op_response,
6098            VipsImage { ctx: out_out },
6099            Error::ZoneError,
6100        )
6101    }
6102}
6103
6104/// Options for zone operation
6105#[derive(Clone, Debug)]
6106pub struct ZoneOptions {
6107    /// uchar: `bool` -> Output an unsigned char image
6108    /// default: false
6109    pub uchar: bool,
6110}
6111
6112impl std::default::Default for ZoneOptions {
6113    fn default() -> Self {
6114        ZoneOptions { uchar: false }
6115    }
6116}
6117
6118/// VipsZone (zone), make a zone plate
6119/// width: `i32` -> Image width in pixels
6120/// min: 1, max: 100000000, default: 1
6121/// height: `i32` -> Image height in pixels
6122/// min: 1, max: 100000000, default: 1
6123/// zone_options: `&ZoneOptions` -> optional arguments
6124/// returns `VipsImage` - Output image
6125pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6126    unsafe {
6127        let width_in: i32 = width;
6128        let height_in: i32 = height;
6129        let mut out_out: *mut bindings::VipsImage = null_mut();
6130
6131        let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6132        let uchar_in_name = utils::new_c_string("uchar")?;
6133
6134        let vips_op_response = bindings::vips_zone(
6135            &mut out_out,
6136            width_in,
6137            height_in,
6138            uchar_in_name.as_ptr(),
6139            uchar_in,
6140            NULL,
6141        );
6142        utils::result(
6143            vips_op_response,
6144            VipsImage { ctx: out_out },
6145            Error::ZoneError,
6146        )
6147    }
6148}
6149
6150/// VipsSines (sines), make a 2D sine wave
6151/// width: `i32` -> Image width in pixels
6152/// min: 1, max: 100000000, default: 1
6153/// height: `i32` -> Image height in pixels
6154/// min: 1, max: 100000000, default: 1
6155/// returns `VipsImage` - Output image
6156pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6157    unsafe {
6158        let width_in: i32 = width;
6159        let height_in: i32 = height;
6160        let mut out_out: *mut bindings::VipsImage = null_mut();
6161
6162        let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6163        utils::result(
6164            vips_op_response,
6165            VipsImage { ctx: out_out },
6166            Error::SineError,
6167        )
6168    }
6169}
6170
6171/// Options for sines operation
6172#[derive(Clone, Debug)]
6173pub struct SineOptions {
6174    /// uchar: `bool` -> Output an unsigned char image
6175    /// default: false
6176    pub uchar: bool,
6177    /// hfreq: `f64` -> Horizontal spatial frequency
6178    /// min: 0, max: 10000, default: 0.5
6179    pub hfreq: f64,
6180    /// vfreq: `f64` -> Vertical spatial frequency
6181    /// min: 0, max: 10000, default: 0.5
6182    pub vfreq: f64,
6183}
6184
6185impl std::default::Default for SineOptions {
6186    fn default() -> Self {
6187        SineOptions {
6188            uchar: false,
6189            hfreq: f64::from(0.5),
6190            vfreq: f64::from(0.5),
6191        }
6192    }
6193}
6194
6195/// VipsSines (sines), make a 2D sine wave
6196/// width: `i32` -> Image width in pixels
6197/// min: 1, max: 100000000, default: 1
6198/// height: `i32` -> Image height in pixels
6199/// min: 1, max: 100000000, default: 1
6200/// sines_options: `&SineOptions` -> optional arguments
6201/// returns `VipsImage` - Output image
6202pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6203    unsafe {
6204        let width_in: i32 = width;
6205        let height_in: i32 = height;
6206        let mut out_out: *mut bindings::VipsImage = null_mut();
6207
6208        let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6209        let uchar_in_name = utils::new_c_string("uchar")?;
6210
6211        let hfreq_in: f64 = sines_options.hfreq;
6212        let hfreq_in_name = utils::new_c_string("hfreq")?;
6213
6214        let vfreq_in: f64 = sines_options.vfreq;
6215        let vfreq_in_name = utils::new_c_string("vfreq")?;
6216
6217        let vips_op_response = bindings::vips_sines(
6218            &mut out_out,
6219            width_in,
6220            height_in,
6221            uchar_in_name.as_ptr(),
6222            uchar_in,
6223            hfreq_in_name.as_ptr(),
6224            hfreq_in,
6225            vfreq_in_name.as_ptr(),
6226            vfreq_in,
6227            NULL,
6228        );
6229        utils::result(
6230            vips_op_response,
6231            VipsImage { ctx: out_out },
6232            Error::SineError,
6233        )
6234    }
6235}
6236
6237/// VipsMaskIdeal (mask_ideal), make an ideal filter
6238/// width: `i32` -> Image width in pixels
6239/// min: 1, max: 100000000, default: 1
6240/// height: `i32` -> Image height in pixels
6241/// min: 1, max: 100000000, default: 1
6242/// frequency_cutoff: `f64` -> Frequency cutoff
6243/// min: 0, max: 1000000, default: 0.5
6244/// returns `VipsImage` - Output image
6245pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6246    unsafe {
6247        let width_in: i32 = width;
6248        let height_in: i32 = height;
6249        let frequency_cutoff_in: f64 = frequency_cutoff;
6250        let mut out_out: *mut bindings::VipsImage = null_mut();
6251
6252        let vips_op_response =
6253            bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6254        utils::result(
6255            vips_op_response,
6256            VipsImage { ctx: out_out },
6257            Error::MaskIdealError,
6258        )
6259    }
6260}
6261
6262/// Options for mask_ideal operation
6263#[derive(Clone, Debug)]
6264pub struct MaskIdealOptions {
6265    /// uchar: `bool` -> Output an unsigned char image
6266    /// default: false
6267    pub uchar: bool,
6268    /// nodc: `bool` -> Remove DC component
6269    /// default: false
6270    pub nodc: bool,
6271    /// reject: `bool` -> Invert the sense of the filter
6272    /// default: false
6273    pub reject: bool,
6274    /// optical: `bool` -> Rotate quadrants to optical space
6275    /// default: false
6276    pub optical: bool,
6277}
6278
6279impl std::default::Default for MaskIdealOptions {
6280    fn default() -> Self {
6281        MaskIdealOptions {
6282            uchar: false,
6283            nodc: false,
6284            reject: false,
6285            optical: false,
6286        }
6287    }
6288}
6289
6290/// VipsMaskIdeal (mask_ideal), make an ideal filter
6291/// width: `i32` -> Image width in pixels
6292/// min: 1, max: 100000000, default: 1
6293/// height: `i32` -> Image height in pixels
6294/// min: 1, max: 100000000, default: 1
6295/// frequency_cutoff: `f64` -> Frequency cutoff
6296/// min: 0, max: 1000000, default: 0.5
6297/// mask_ideal_options: `&MaskIdealOptions` -> optional arguments
6298/// returns `VipsImage` - Output image
6299pub fn mask_ideal_with_opts(
6300    width: i32,
6301    height: i32,
6302    frequency_cutoff: f64,
6303    mask_ideal_options: &MaskIdealOptions,
6304) -> Result<VipsImage> {
6305    unsafe {
6306        let width_in: i32 = width;
6307        let height_in: i32 = height;
6308        let frequency_cutoff_in: f64 = frequency_cutoff;
6309        let mut out_out: *mut bindings::VipsImage = null_mut();
6310
6311        let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6312        let uchar_in_name = utils::new_c_string("uchar")?;
6313
6314        let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6315        let nodc_in_name = utils::new_c_string("nodc")?;
6316
6317        let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6318        let reject_in_name = utils::new_c_string("reject")?;
6319
6320        let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6321        let optical_in_name = utils::new_c_string("optical")?;
6322
6323        let vips_op_response = bindings::vips_mask_ideal(
6324            &mut out_out,
6325            width_in,
6326            height_in,
6327            frequency_cutoff_in,
6328            uchar_in_name.as_ptr(),
6329            uchar_in,
6330            nodc_in_name.as_ptr(),
6331            nodc_in,
6332            reject_in_name.as_ptr(),
6333            reject_in,
6334            optical_in_name.as_ptr(),
6335            optical_in,
6336            NULL,
6337        );
6338        utils::result(
6339            vips_op_response,
6340            VipsImage { ctx: out_out },
6341            Error::MaskIdealError,
6342        )
6343    }
6344}
6345
6346/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6347/// width: `i32` -> Image width in pixels
6348/// min: 1, max: 100000000, default: 1
6349/// height: `i32` -> Image height in pixels
6350/// min: 1, max: 100000000, default: 1
6351/// frequency_cutoff: `f64` -> Frequency cutoff
6352/// min: 0, max: 1000000, default: 0.5
6353/// ringwidth: `f64` -> Ringwidth
6354/// min: 0, max: 1000000, default: 0.5
6355/// returns `VipsImage` - Output image
6356pub fn mask_ideal_ring(
6357    width: i32,
6358    height: i32,
6359    frequency_cutoff: f64,
6360    ringwidth: f64,
6361) -> Result<VipsImage> {
6362    unsafe {
6363        let width_in: i32 = width;
6364        let height_in: i32 = height;
6365        let frequency_cutoff_in: f64 = frequency_cutoff;
6366        let ringwidth_in: f64 = ringwidth;
6367        let mut out_out: *mut bindings::VipsImage = null_mut();
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            NULL,
6376        );
6377        utils::result(
6378            vips_op_response,
6379            VipsImage { ctx: out_out },
6380            Error::MaskIdealRingError,
6381        )
6382    }
6383}
6384
6385/// Options for mask_ideal_ring operation
6386#[derive(Clone, Debug)]
6387pub struct MaskIdealRingOptions {
6388    /// uchar: `bool` -> Output an unsigned char image
6389    /// default: false
6390    pub uchar: bool,
6391    /// nodc: `bool` -> Remove DC component
6392    /// default: false
6393    pub nodc: bool,
6394    /// reject: `bool` -> Invert the sense of the filter
6395    /// default: false
6396    pub reject: bool,
6397    /// optical: `bool` -> Rotate quadrants to optical space
6398    /// default: false
6399    pub optical: bool,
6400}
6401
6402impl std::default::Default for MaskIdealRingOptions {
6403    fn default() -> Self {
6404        MaskIdealRingOptions {
6405            uchar: false,
6406            nodc: false,
6407            reject: false,
6408            optical: false,
6409        }
6410    }
6411}
6412
6413/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6414/// width: `i32` -> Image width in pixels
6415/// min: 1, max: 100000000, default: 1
6416/// height: `i32` -> Image height in pixels
6417/// min: 1, max: 100000000, default: 1
6418/// frequency_cutoff: `f64` -> Frequency cutoff
6419/// min: 0, max: 1000000, default: 0.5
6420/// ringwidth: `f64` -> Ringwidth
6421/// min: 0, max: 1000000, default: 0.5
6422/// mask_ideal_ring_options: `&MaskIdealRingOptions` -> optional arguments
6423/// returns `VipsImage` - Output image
6424pub fn mask_ideal_ring_with_opts(
6425    width: i32,
6426    height: i32,
6427    frequency_cutoff: f64,
6428    ringwidth: f64,
6429    mask_ideal_ring_options: &MaskIdealRingOptions,
6430) -> Result<VipsImage> {
6431    unsafe {
6432        let width_in: i32 = width;
6433        let height_in: i32 = height;
6434        let frequency_cutoff_in: f64 = frequency_cutoff;
6435        let ringwidth_in: f64 = ringwidth;
6436        let mut out_out: *mut bindings::VipsImage = null_mut();
6437
6438        let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6439        let uchar_in_name = utils::new_c_string("uchar")?;
6440
6441        let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6442        let nodc_in_name = utils::new_c_string("nodc")?;
6443
6444        let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6445        let reject_in_name = utils::new_c_string("reject")?;
6446
6447        let optical_in: i32 = if mask_ideal_ring_options.optical {
6448            1
6449        } else {
6450            0
6451        };
6452        let optical_in_name = utils::new_c_string("optical")?;
6453
6454        let vips_op_response = bindings::vips_mask_ideal_ring(
6455            &mut out_out,
6456            width_in,
6457            height_in,
6458            frequency_cutoff_in,
6459            ringwidth_in,
6460            uchar_in_name.as_ptr(),
6461            uchar_in,
6462            nodc_in_name.as_ptr(),
6463            nodc_in,
6464            reject_in_name.as_ptr(),
6465            reject_in,
6466            optical_in_name.as_ptr(),
6467            optical_in,
6468            NULL,
6469        );
6470        utils::result(
6471            vips_op_response,
6472            VipsImage { ctx: out_out },
6473            Error::MaskIdealRingError,
6474        )
6475    }
6476}
6477
6478/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6479/// width: `i32` -> Image width in pixels
6480/// min: 1, max: 100000000, default: 1
6481/// height: `i32` -> Image height in pixels
6482/// min: 1, max: 100000000, default: 1
6483/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6484/// min: 0, max: 1000000, default: 0.5
6485/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6486/// min: 0, max: 1000000, default: 0.5
6487/// radius: `f64` -> Radius of circle
6488/// min: 0, max: 1000000, default: 0.1
6489/// returns `VipsImage` - Output image
6490pub fn mask_ideal_band(
6491    width: i32,
6492    height: i32,
6493    frequency_cutoff_x: f64,
6494    frequency_cutoff_y: f64,
6495    radius: f64,
6496) -> Result<VipsImage> {
6497    unsafe {
6498        let width_in: i32 = width;
6499        let height_in: i32 = height;
6500        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6501        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6502        let radius_in: f64 = radius;
6503        let mut out_out: *mut bindings::VipsImage = null_mut();
6504
6505        let vips_op_response = bindings::vips_mask_ideal_band(
6506            &mut out_out,
6507            width_in,
6508            height_in,
6509            frequency_cutoff_x_in,
6510            frequency_cutoff_y_in,
6511            radius_in,
6512            NULL,
6513        );
6514        utils::result(
6515            vips_op_response,
6516            VipsImage { ctx: out_out },
6517            Error::MaskIdealBandError,
6518        )
6519    }
6520}
6521
6522/// Options for mask_ideal_band operation
6523#[derive(Clone, Debug)]
6524pub struct MaskIdealBandOptions {
6525    /// uchar: `bool` -> Output an unsigned char image
6526    /// default: false
6527    pub uchar: bool,
6528    /// nodc: `bool` -> Remove DC component
6529    /// default: false
6530    pub nodc: bool,
6531    /// reject: `bool` -> Invert the sense of the filter
6532    /// default: false
6533    pub reject: bool,
6534    /// optical: `bool` -> Rotate quadrants to optical space
6535    /// default: false
6536    pub optical: bool,
6537}
6538
6539impl std::default::Default for MaskIdealBandOptions {
6540    fn default() -> Self {
6541        MaskIdealBandOptions {
6542            uchar: false,
6543            nodc: false,
6544            reject: false,
6545            optical: false,
6546        }
6547    }
6548}
6549
6550/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6551/// width: `i32` -> Image width in pixels
6552/// min: 1, max: 100000000, default: 1
6553/// height: `i32` -> Image height in pixels
6554/// min: 1, max: 100000000, default: 1
6555/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6556/// min: 0, max: 1000000, default: 0.5
6557/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6558/// min: 0, max: 1000000, default: 0.5
6559/// radius: `f64` -> Radius of circle
6560/// min: 0, max: 1000000, default: 0.1
6561/// mask_ideal_band_options: `&MaskIdealBandOptions` -> optional arguments
6562/// returns `VipsImage` - Output image
6563pub fn mask_ideal_band_with_opts(
6564    width: i32,
6565    height: i32,
6566    frequency_cutoff_x: f64,
6567    frequency_cutoff_y: f64,
6568    radius: f64,
6569    mask_ideal_band_options: &MaskIdealBandOptions,
6570) -> Result<VipsImage> {
6571    unsafe {
6572        let width_in: i32 = width;
6573        let height_in: i32 = height;
6574        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6575        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6576        let radius_in: f64 = radius;
6577        let mut out_out: *mut bindings::VipsImage = null_mut();
6578
6579        let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6580        let uchar_in_name = utils::new_c_string("uchar")?;
6581
6582        let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6583        let nodc_in_name = utils::new_c_string("nodc")?;
6584
6585        let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6586        let reject_in_name = utils::new_c_string("reject")?;
6587
6588        let optical_in: i32 = if mask_ideal_band_options.optical {
6589            1
6590        } else {
6591            0
6592        };
6593        let optical_in_name = utils::new_c_string("optical")?;
6594
6595        let vips_op_response = bindings::vips_mask_ideal_band(
6596            &mut out_out,
6597            width_in,
6598            height_in,
6599            frequency_cutoff_x_in,
6600            frequency_cutoff_y_in,
6601            radius_in,
6602            uchar_in_name.as_ptr(),
6603            uchar_in,
6604            nodc_in_name.as_ptr(),
6605            nodc_in,
6606            reject_in_name.as_ptr(),
6607            reject_in,
6608            optical_in_name.as_ptr(),
6609            optical_in,
6610            NULL,
6611        );
6612        utils::result(
6613            vips_op_response,
6614            VipsImage { ctx: out_out },
6615            Error::MaskIdealBandError,
6616        )
6617    }
6618}
6619
6620/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6621/// width: `i32` -> Image width in pixels
6622/// min: 1, max: 100000000, default: 1
6623/// height: `i32` -> Image height in pixels
6624/// min: 1, max: 100000000, default: 1
6625/// order: `f64` -> Filter order
6626/// min: 1, max: 1000000, default: 1
6627/// frequency_cutoff: `f64` -> Frequency cutoff
6628/// min: 0, max: 1000000, default: 0.5
6629/// amplitude_cutoff: `f64` -> Amplitude cutoff
6630/// min: 0, max: 1, default: 0.5
6631/// returns `VipsImage` - Output image
6632pub fn mask_butterworth(
6633    width: i32,
6634    height: i32,
6635    order: f64,
6636    frequency_cutoff: f64,
6637    amplitude_cutoff: f64,
6638) -> Result<VipsImage> {
6639    unsafe {
6640        let width_in: i32 = width;
6641        let height_in: i32 = height;
6642        let order_in: f64 = order;
6643        let frequency_cutoff_in: f64 = frequency_cutoff;
6644        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6645        let mut out_out: *mut bindings::VipsImage = null_mut();
6646
6647        let vips_op_response = bindings::vips_mask_butterworth(
6648            &mut out_out,
6649            width_in,
6650            height_in,
6651            order_in,
6652            frequency_cutoff_in,
6653            amplitude_cutoff_in,
6654            NULL,
6655        );
6656        utils::result(
6657            vips_op_response,
6658            VipsImage { ctx: out_out },
6659            Error::MaskButterworthError,
6660        )
6661    }
6662}
6663
6664/// Options for mask_butterworth operation
6665#[derive(Clone, Debug)]
6666pub struct MaskButterworthOptions {
6667    /// uchar: `bool` -> Output an unsigned char image
6668    /// default: false
6669    pub uchar: bool,
6670    /// nodc: `bool` -> Remove DC component
6671    /// default: false
6672    pub nodc: bool,
6673    /// reject: `bool` -> Invert the sense of the filter
6674    /// default: false
6675    pub reject: bool,
6676    /// optical: `bool` -> Rotate quadrants to optical space
6677    /// default: false
6678    pub optical: bool,
6679}
6680
6681impl std::default::Default for MaskButterworthOptions {
6682    fn default() -> Self {
6683        MaskButterworthOptions {
6684            uchar: false,
6685            nodc: false,
6686            reject: false,
6687            optical: false,
6688        }
6689    }
6690}
6691
6692/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6693/// width: `i32` -> Image width in pixels
6694/// min: 1, max: 100000000, default: 1
6695/// height: `i32` -> Image height in pixels
6696/// min: 1, max: 100000000, default: 1
6697/// order: `f64` -> Filter order
6698/// min: 1, max: 1000000, default: 1
6699/// frequency_cutoff: `f64` -> Frequency cutoff
6700/// min: 0, max: 1000000, default: 0.5
6701/// amplitude_cutoff: `f64` -> Amplitude cutoff
6702/// min: 0, max: 1, default: 0.5
6703/// mask_butterworth_options: `&MaskButterworthOptions` -> optional arguments
6704/// returns `VipsImage` - Output image
6705pub fn mask_butterworth_with_opts(
6706    width: i32,
6707    height: i32,
6708    order: f64,
6709    frequency_cutoff: f64,
6710    amplitude_cutoff: f64,
6711    mask_butterworth_options: &MaskButterworthOptions,
6712) -> Result<VipsImage> {
6713    unsafe {
6714        let width_in: i32 = width;
6715        let height_in: i32 = height;
6716        let order_in: f64 = order;
6717        let frequency_cutoff_in: f64 = frequency_cutoff;
6718        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6719        let mut out_out: *mut bindings::VipsImage = null_mut();
6720
6721        let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6722        let uchar_in_name = utils::new_c_string("uchar")?;
6723
6724        let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6725        let nodc_in_name = utils::new_c_string("nodc")?;
6726
6727        let reject_in: i32 = if mask_butterworth_options.reject {
6728            1
6729        } else {
6730            0
6731        };
6732        let reject_in_name = utils::new_c_string("reject")?;
6733
6734        let optical_in: i32 = if mask_butterworth_options.optical {
6735            1
6736        } else {
6737            0
6738        };
6739        let optical_in_name = utils::new_c_string("optical")?;
6740
6741        let vips_op_response = bindings::vips_mask_butterworth(
6742            &mut out_out,
6743            width_in,
6744            height_in,
6745            order_in,
6746            frequency_cutoff_in,
6747            amplitude_cutoff_in,
6748            uchar_in_name.as_ptr(),
6749            uchar_in,
6750            nodc_in_name.as_ptr(),
6751            nodc_in,
6752            reject_in_name.as_ptr(),
6753            reject_in,
6754            optical_in_name.as_ptr(),
6755            optical_in,
6756            NULL,
6757        );
6758        utils::result(
6759            vips_op_response,
6760            VipsImage { ctx: out_out },
6761            Error::MaskButterworthError,
6762        )
6763    }
6764}
6765
6766/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6767/// width: `i32` -> Image width in pixels
6768/// min: 1, max: 100000000, default: 1
6769/// height: `i32` -> Image height in pixels
6770/// min: 1, max: 100000000, default: 1
6771/// order: `f64` -> Filter order
6772/// min: 1, max: 1000000, default: 1
6773/// frequency_cutoff: `f64` -> Frequency cutoff
6774/// min: 0, max: 1000000, default: 0.5
6775/// amplitude_cutoff: `f64` -> Amplitude cutoff
6776/// min: 0, max: 1, default: 0.5
6777/// ringwidth: `f64` -> Ringwidth
6778/// min: 0, max: 1000000, default: 0.1
6779/// returns `VipsImage` - Output image
6780pub fn mask_butterworth_ring(
6781    width: i32,
6782    height: i32,
6783    order: f64,
6784    frequency_cutoff: f64,
6785    amplitude_cutoff: f64,
6786    ringwidth: f64,
6787) -> Result<VipsImage> {
6788    unsafe {
6789        let width_in: i32 = width;
6790        let height_in: i32 = height;
6791        let order_in: f64 = order;
6792        let frequency_cutoff_in: f64 = frequency_cutoff;
6793        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6794        let ringwidth_in: f64 = ringwidth;
6795        let mut out_out: *mut bindings::VipsImage = null_mut();
6796
6797        let vips_op_response = bindings::vips_mask_butterworth_ring(
6798            &mut out_out,
6799            width_in,
6800            height_in,
6801            order_in,
6802            frequency_cutoff_in,
6803            amplitude_cutoff_in,
6804            ringwidth_in,
6805            NULL,
6806        );
6807        utils::result(
6808            vips_op_response,
6809            VipsImage { ctx: out_out },
6810            Error::MaskButterworthRingError,
6811        )
6812    }
6813}
6814
6815/// Options for mask_butterworth_ring operation
6816#[derive(Clone, Debug)]
6817pub struct MaskButterworthRingOptions {
6818    /// uchar: `bool` -> Output an unsigned char image
6819    /// default: false
6820    pub uchar: bool,
6821    /// nodc: `bool` -> Remove DC component
6822    /// default: false
6823    pub nodc: bool,
6824    /// reject: `bool` -> Invert the sense of the filter
6825    /// default: false
6826    pub reject: bool,
6827    /// optical: `bool` -> Rotate quadrants to optical space
6828    /// default: false
6829    pub optical: bool,
6830}
6831
6832impl std::default::Default for MaskButterworthRingOptions {
6833    fn default() -> Self {
6834        MaskButterworthRingOptions {
6835            uchar: false,
6836            nodc: false,
6837            reject: false,
6838            optical: false,
6839        }
6840    }
6841}
6842
6843/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6844/// width: `i32` -> Image width in pixels
6845/// min: 1, max: 100000000, default: 1
6846/// height: `i32` -> Image height in pixels
6847/// min: 1, max: 100000000, default: 1
6848/// order: `f64` -> Filter order
6849/// min: 1, max: 1000000, default: 1
6850/// frequency_cutoff: `f64` -> Frequency cutoff
6851/// min: 0, max: 1000000, default: 0.5
6852/// amplitude_cutoff: `f64` -> Amplitude cutoff
6853/// min: 0, max: 1, default: 0.5
6854/// ringwidth: `f64` -> Ringwidth
6855/// min: 0, max: 1000000, default: 0.1
6856/// mask_butterworth_ring_options: `&MaskButterworthRingOptions` -> optional arguments
6857/// returns `VipsImage` - Output image
6858pub fn mask_butterworth_ring_with_opts(
6859    width: i32,
6860    height: i32,
6861    order: f64,
6862    frequency_cutoff: f64,
6863    amplitude_cutoff: f64,
6864    ringwidth: f64,
6865    mask_butterworth_ring_options: &MaskButterworthRingOptions,
6866) -> Result<VipsImage> {
6867    unsafe {
6868        let width_in: i32 = width;
6869        let height_in: i32 = height;
6870        let order_in: f64 = order;
6871        let frequency_cutoff_in: f64 = frequency_cutoff;
6872        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6873        let ringwidth_in: f64 = ringwidth;
6874        let mut out_out: *mut bindings::VipsImage = null_mut();
6875
6876        let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6877            1
6878        } else {
6879            0
6880        };
6881        let uchar_in_name = utils::new_c_string("uchar")?;
6882
6883        let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6884            1
6885        } else {
6886            0
6887        };
6888        let nodc_in_name = utils::new_c_string("nodc")?;
6889
6890        let reject_in: i32 = if mask_butterworth_ring_options.reject {
6891            1
6892        } else {
6893            0
6894        };
6895        let reject_in_name = utils::new_c_string("reject")?;
6896
6897        let optical_in: i32 = if mask_butterworth_ring_options.optical {
6898            1
6899        } else {
6900            0
6901        };
6902        let optical_in_name = utils::new_c_string("optical")?;
6903
6904        let vips_op_response = bindings::vips_mask_butterworth_ring(
6905            &mut out_out,
6906            width_in,
6907            height_in,
6908            order_in,
6909            frequency_cutoff_in,
6910            amplitude_cutoff_in,
6911            ringwidth_in,
6912            uchar_in_name.as_ptr(),
6913            uchar_in,
6914            nodc_in_name.as_ptr(),
6915            nodc_in,
6916            reject_in_name.as_ptr(),
6917            reject_in,
6918            optical_in_name.as_ptr(),
6919            optical_in,
6920            NULL,
6921        );
6922        utils::result(
6923            vips_op_response,
6924            VipsImage { ctx: out_out },
6925            Error::MaskButterworthRingError,
6926        )
6927    }
6928}
6929
6930/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
6931/// width: `i32` -> Image width in pixels
6932/// min: 1, max: 100000000, default: 1
6933/// height: `i32` -> Image height in pixels
6934/// min: 1, max: 100000000, default: 1
6935/// order: `f64` -> Filter order
6936/// min: 1, max: 1000000, default: 1
6937/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6938/// min: 0, max: 1000000, default: 0.5
6939/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6940/// min: 0, max: 1000000, default: 0.5
6941/// radius: `f64` -> Radius of circle
6942/// min: 0, max: 1000000, default: 0.1
6943/// amplitude_cutoff: `f64` -> Amplitude cutoff
6944/// min: 0, max: 1, default: 0.5
6945/// returns `VipsImage` - Output image
6946pub fn mask_butterworth_band(
6947    width: i32,
6948    height: i32,
6949    order: f64,
6950    frequency_cutoff_x: f64,
6951    frequency_cutoff_y: f64,
6952    radius: f64,
6953    amplitude_cutoff: f64,
6954) -> Result<VipsImage> {
6955    unsafe {
6956        let width_in: i32 = width;
6957        let height_in: i32 = height;
6958        let order_in: f64 = order;
6959        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6960        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6961        let radius_in: f64 = radius;
6962        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6963        let mut out_out: *mut bindings::VipsImage = null_mut();
6964
6965        let vips_op_response = bindings::vips_mask_butterworth_band(
6966            &mut out_out,
6967            width_in,
6968            height_in,
6969            order_in,
6970            frequency_cutoff_x_in,
6971            frequency_cutoff_y_in,
6972            radius_in,
6973            amplitude_cutoff_in,
6974            NULL,
6975        );
6976        utils::result(
6977            vips_op_response,
6978            VipsImage { ctx: out_out },
6979            Error::MaskButterworthBandError,
6980        )
6981    }
6982}
6983
6984/// Options for mask_butterworth_band operation
6985#[derive(Clone, Debug)]
6986pub struct MaskButterworthBandOptions {
6987    /// uchar: `bool` -> Output an unsigned char image
6988    /// default: false
6989    pub uchar: bool,
6990    /// nodc: `bool` -> Remove DC component
6991    /// default: false
6992    pub nodc: bool,
6993    /// reject: `bool` -> Invert the sense of the filter
6994    /// default: false
6995    pub reject: bool,
6996    /// optical: `bool` -> Rotate quadrants to optical space
6997    /// default: false
6998    pub optical: bool,
6999}
7000
7001impl std::default::Default for MaskButterworthBandOptions {
7002    fn default() -> Self {
7003        MaskButterworthBandOptions {
7004            uchar: false,
7005            nodc: false,
7006            reject: false,
7007            optical: false,
7008        }
7009    }
7010}
7011
7012/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
7013/// width: `i32` -> Image width in pixels
7014/// min: 1, max: 100000000, default: 1
7015/// height: `i32` -> Image height in pixels
7016/// min: 1, max: 100000000, default: 1
7017/// order: `f64` -> Filter order
7018/// min: 1, max: 1000000, default: 1
7019/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7020/// min: 0, max: 1000000, default: 0.5
7021/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7022/// min: 0, max: 1000000, default: 0.5
7023/// radius: `f64` -> Radius of circle
7024/// min: 0, max: 1000000, default: 0.1
7025/// amplitude_cutoff: `f64` -> Amplitude cutoff
7026/// min: 0, max: 1, default: 0.5
7027/// mask_butterworth_band_options: `&MaskButterworthBandOptions` -> optional arguments
7028/// returns `VipsImage` - Output image
7029pub fn mask_butterworth_band_with_opts(
7030    width: i32,
7031    height: i32,
7032    order: f64,
7033    frequency_cutoff_x: f64,
7034    frequency_cutoff_y: f64,
7035    radius: f64,
7036    amplitude_cutoff: f64,
7037    mask_butterworth_band_options: &MaskButterworthBandOptions,
7038) -> Result<VipsImage> {
7039    unsafe {
7040        let width_in: i32 = width;
7041        let height_in: i32 = height;
7042        let order_in: f64 = order;
7043        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7044        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7045        let radius_in: f64 = radius;
7046        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7047        let mut out_out: *mut bindings::VipsImage = null_mut();
7048
7049        let uchar_in: i32 = if mask_butterworth_band_options.uchar {
7050            1
7051        } else {
7052            0
7053        };
7054        let uchar_in_name = utils::new_c_string("uchar")?;
7055
7056        let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7057            1
7058        } else {
7059            0
7060        };
7061        let nodc_in_name = utils::new_c_string("nodc")?;
7062
7063        let reject_in: i32 = if mask_butterworth_band_options.reject {
7064            1
7065        } else {
7066            0
7067        };
7068        let reject_in_name = utils::new_c_string("reject")?;
7069
7070        let optical_in: i32 = if mask_butterworth_band_options.optical {
7071            1
7072        } else {
7073            0
7074        };
7075        let optical_in_name = utils::new_c_string("optical")?;
7076
7077        let vips_op_response = bindings::vips_mask_butterworth_band(
7078            &mut out_out,
7079            width_in,
7080            height_in,
7081            order_in,
7082            frequency_cutoff_x_in,
7083            frequency_cutoff_y_in,
7084            radius_in,
7085            amplitude_cutoff_in,
7086            uchar_in_name.as_ptr(),
7087            uchar_in,
7088            nodc_in_name.as_ptr(),
7089            nodc_in,
7090            reject_in_name.as_ptr(),
7091            reject_in,
7092            optical_in_name.as_ptr(),
7093            optical_in,
7094            NULL,
7095        );
7096        utils::result(
7097            vips_op_response,
7098            VipsImage { ctx: out_out },
7099            Error::MaskButterworthBandError,
7100        )
7101    }
7102}
7103
7104/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7105/// width: `i32` -> Image width in pixels
7106/// min: 1, max: 100000000, default: 1
7107/// height: `i32` -> Image height in pixels
7108/// min: 1, max: 100000000, default: 1
7109/// frequency_cutoff: `f64` -> Frequency cutoff
7110/// min: 0, max: 1000000, default: 0.5
7111/// amplitude_cutoff: `f64` -> Amplitude cutoff
7112/// min: 0, max: 1, default: 0.5
7113/// returns `VipsImage` - Output image
7114pub fn mask_gaussian(
7115    width: i32,
7116    height: i32,
7117    frequency_cutoff: f64,
7118    amplitude_cutoff: f64,
7119) -> Result<VipsImage> {
7120    unsafe {
7121        let width_in: i32 = width;
7122        let height_in: i32 = height;
7123        let frequency_cutoff_in: f64 = frequency_cutoff;
7124        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7125        let mut out_out: *mut bindings::VipsImage = null_mut();
7126
7127        let vips_op_response = bindings::vips_mask_gaussian(
7128            &mut out_out,
7129            width_in,
7130            height_in,
7131            frequency_cutoff_in,
7132            amplitude_cutoff_in,
7133            NULL,
7134        );
7135        utils::result(
7136            vips_op_response,
7137            VipsImage { ctx: out_out },
7138            Error::MaskGaussianError,
7139        )
7140    }
7141}
7142
7143/// Options for mask_gaussian operation
7144#[derive(Clone, Debug)]
7145pub struct MaskGaussianOptions {
7146    /// uchar: `bool` -> Output an unsigned char image
7147    /// default: false
7148    pub uchar: bool,
7149    /// nodc: `bool` -> Remove DC component
7150    /// default: false
7151    pub nodc: bool,
7152    /// reject: `bool` -> Invert the sense of the filter
7153    /// default: false
7154    pub reject: bool,
7155    /// optical: `bool` -> Rotate quadrants to optical space
7156    /// default: false
7157    pub optical: bool,
7158}
7159
7160impl std::default::Default for MaskGaussianOptions {
7161    fn default() -> Self {
7162        MaskGaussianOptions {
7163            uchar: false,
7164            nodc: false,
7165            reject: false,
7166            optical: false,
7167        }
7168    }
7169}
7170
7171/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7172/// width: `i32` -> Image width in pixels
7173/// min: 1, max: 100000000, default: 1
7174/// height: `i32` -> Image height in pixels
7175/// min: 1, max: 100000000, default: 1
7176/// frequency_cutoff: `f64` -> Frequency cutoff
7177/// min: 0, max: 1000000, default: 0.5
7178/// amplitude_cutoff: `f64` -> Amplitude cutoff
7179/// min: 0, max: 1, default: 0.5
7180/// mask_gaussian_options: `&MaskGaussianOptions` -> optional arguments
7181/// returns `VipsImage` - Output image
7182pub fn mask_gaussian_with_opts(
7183    width: i32,
7184    height: i32,
7185    frequency_cutoff: f64,
7186    amplitude_cutoff: f64,
7187    mask_gaussian_options: &MaskGaussianOptions,
7188) -> Result<VipsImage> {
7189    unsafe {
7190        let width_in: i32 = width;
7191        let height_in: i32 = height;
7192        let frequency_cutoff_in: f64 = frequency_cutoff;
7193        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7194        let mut out_out: *mut bindings::VipsImage = null_mut();
7195
7196        let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7197        let uchar_in_name = utils::new_c_string("uchar")?;
7198
7199        let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7200        let nodc_in_name = utils::new_c_string("nodc")?;
7201
7202        let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7203        let reject_in_name = utils::new_c_string("reject")?;
7204
7205        let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7206        let optical_in_name = utils::new_c_string("optical")?;
7207
7208        let vips_op_response = bindings::vips_mask_gaussian(
7209            &mut out_out,
7210            width_in,
7211            height_in,
7212            frequency_cutoff_in,
7213            amplitude_cutoff_in,
7214            uchar_in_name.as_ptr(),
7215            uchar_in,
7216            nodc_in_name.as_ptr(),
7217            nodc_in,
7218            reject_in_name.as_ptr(),
7219            reject_in,
7220            optical_in_name.as_ptr(),
7221            optical_in,
7222            NULL,
7223        );
7224        utils::result(
7225            vips_op_response,
7226            VipsImage { ctx: out_out },
7227            Error::MaskGaussianError,
7228        )
7229    }
7230}
7231
7232/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7233/// width: `i32` -> Image width in pixels
7234/// min: 1, max: 100000000, default: 1
7235/// height: `i32` -> Image height in pixels
7236/// min: 1, max: 100000000, default: 1
7237/// frequency_cutoff: `f64` -> Frequency cutoff
7238/// min: 0, max: 1000000, default: 0.5
7239/// amplitude_cutoff: `f64` -> Amplitude cutoff
7240/// min: 0, max: 1, default: 0.5
7241/// ringwidth: `f64` -> Ringwidth
7242/// min: 0, max: 1000000, default: 0.5
7243/// returns `VipsImage` - Output image
7244pub fn mask_gaussian_ring(
7245    width: i32,
7246    height: i32,
7247    frequency_cutoff: f64,
7248    amplitude_cutoff: f64,
7249    ringwidth: f64,
7250) -> Result<VipsImage> {
7251    unsafe {
7252        let width_in: i32 = width;
7253        let height_in: i32 = height;
7254        let frequency_cutoff_in: f64 = frequency_cutoff;
7255        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7256        let ringwidth_in: f64 = ringwidth;
7257        let mut out_out: *mut bindings::VipsImage = null_mut();
7258
7259        let vips_op_response = bindings::vips_mask_gaussian_ring(
7260            &mut out_out,
7261            width_in,
7262            height_in,
7263            frequency_cutoff_in,
7264            amplitude_cutoff_in,
7265            ringwidth_in,
7266            NULL,
7267        );
7268        utils::result(
7269            vips_op_response,
7270            VipsImage { ctx: out_out },
7271            Error::MaskGaussianRingError,
7272        )
7273    }
7274}
7275
7276/// Options for mask_gaussian_ring operation
7277#[derive(Clone, Debug)]
7278pub struct MaskGaussianRingOptions {
7279    /// uchar: `bool` -> Output an unsigned char image
7280    /// default: false
7281    pub uchar: bool,
7282    /// nodc: `bool` -> Remove DC component
7283    /// default: false
7284    pub nodc: bool,
7285    /// reject: `bool` -> Invert the sense of the filter
7286    /// default: false
7287    pub reject: bool,
7288    /// optical: `bool` -> Rotate quadrants to optical space
7289    /// default: false
7290    pub optical: bool,
7291}
7292
7293impl std::default::Default for MaskGaussianRingOptions {
7294    fn default() -> Self {
7295        MaskGaussianRingOptions {
7296            uchar: false,
7297            nodc: false,
7298            reject: false,
7299            optical: false,
7300        }
7301    }
7302}
7303
7304/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7305/// width: `i32` -> Image width in pixels
7306/// min: 1, max: 100000000, default: 1
7307/// height: `i32` -> Image height in pixels
7308/// min: 1, max: 100000000, default: 1
7309/// frequency_cutoff: `f64` -> Frequency cutoff
7310/// min: 0, max: 1000000, default: 0.5
7311/// amplitude_cutoff: `f64` -> Amplitude cutoff
7312/// min: 0, max: 1, default: 0.5
7313/// ringwidth: `f64` -> Ringwidth
7314/// min: 0, max: 1000000, default: 0.5
7315/// mask_gaussian_ring_options: `&MaskGaussianRingOptions` -> optional arguments
7316/// returns `VipsImage` - Output image
7317pub fn mask_gaussian_ring_with_opts(
7318    width: i32,
7319    height: i32,
7320    frequency_cutoff: f64,
7321    amplitude_cutoff: f64,
7322    ringwidth: f64,
7323    mask_gaussian_ring_options: &MaskGaussianRingOptions,
7324) -> Result<VipsImage> {
7325    unsafe {
7326        let width_in: i32 = width;
7327        let height_in: i32 = height;
7328        let frequency_cutoff_in: f64 = frequency_cutoff;
7329        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7330        let ringwidth_in: f64 = ringwidth;
7331        let mut out_out: *mut bindings::VipsImage = null_mut();
7332
7333        let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7334            1
7335        } else {
7336            0
7337        };
7338        let uchar_in_name = utils::new_c_string("uchar")?;
7339
7340        let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7341            1
7342        } else {
7343            0
7344        };
7345        let nodc_in_name = utils::new_c_string("nodc")?;
7346
7347        let reject_in: i32 = if mask_gaussian_ring_options.reject {
7348            1
7349        } else {
7350            0
7351        };
7352        let reject_in_name = utils::new_c_string("reject")?;
7353
7354        let optical_in: i32 = if mask_gaussian_ring_options.optical {
7355            1
7356        } else {
7357            0
7358        };
7359        let optical_in_name = utils::new_c_string("optical")?;
7360
7361        let vips_op_response = bindings::vips_mask_gaussian_ring(
7362            &mut out_out,
7363            width_in,
7364            height_in,
7365            frequency_cutoff_in,
7366            amplitude_cutoff_in,
7367            ringwidth_in,
7368            uchar_in_name.as_ptr(),
7369            uchar_in,
7370            nodc_in_name.as_ptr(),
7371            nodc_in,
7372            reject_in_name.as_ptr(),
7373            reject_in,
7374            optical_in_name.as_ptr(),
7375            optical_in,
7376            NULL,
7377        );
7378        utils::result(
7379            vips_op_response,
7380            VipsImage { ctx: out_out },
7381            Error::MaskGaussianRingError,
7382        )
7383    }
7384}
7385
7386/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7387/// width: `i32` -> Image width in pixels
7388/// min: 1, max: 100000000, default: 1
7389/// height: `i32` -> Image height in pixels
7390/// min: 1, max: 100000000, default: 1
7391/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7392/// min: 0, max: 1000000, default: 0.5
7393/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7394/// min: 0, max: 1000000, default: 0.5
7395/// radius: `f64` -> Radius of circle
7396/// min: 0, max: 1000000, default: 0.1
7397/// amplitude_cutoff: `f64` -> Amplitude cutoff
7398/// min: 0, max: 1, default: 0.5
7399/// returns `VipsImage` - Output image
7400pub fn mask_gaussian_band(
7401    width: i32,
7402    height: i32,
7403    frequency_cutoff_x: f64,
7404    frequency_cutoff_y: f64,
7405    radius: f64,
7406    amplitude_cutoff: f64,
7407) -> Result<VipsImage> {
7408    unsafe {
7409        let width_in: i32 = width;
7410        let height_in: i32 = height;
7411        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7412        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7413        let radius_in: f64 = radius;
7414        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7415        let mut out_out: *mut bindings::VipsImage = null_mut();
7416
7417        let vips_op_response = bindings::vips_mask_gaussian_band(
7418            &mut out_out,
7419            width_in,
7420            height_in,
7421            frequency_cutoff_x_in,
7422            frequency_cutoff_y_in,
7423            radius_in,
7424            amplitude_cutoff_in,
7425            NULL,
7426        );
7427        utils::result(
7428            vips_op_response,
7429            VipsImage { ctx: out_out },
7430            Error::MaskGaussianBandError,
7431        )
7432    }
7433}
7434
7435/// Options for mask_gaussian_band operation
7436#[derive(Clone, Debug)]
7437pub struct MaskGaussianBandOptions {
7438    /// uchar: `bool` -> Output an unsigned char image
7439    /// default: false
7440    pub uchar: bool,
7441    /// nodc: `bool` -> Remove DC component
7442    /// default: false
7443    pub nodc: bool,
7444    /// reject: `bool` -> Invert the sense of the filter
7445    /// default: false
7446    pub reject: bool,
7447    /// optical: `bool` -> Rotate quadrants to optical space
7448    /// default: false
7449    pub optical: bool,
7450}
7451
7452impl std::default::Default for MaskGaussianBandOptions {
7453    fn default() -> Self {
7454        MaskGaussianBandOptions {
7455            uchar: false,
7456            nodc: false,
7457            reject: false,
7458            optical: false,
7459        }
7460    }
7461}
7462
7463/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7464/// width: `i32` -> Image width in pixels
7465/// min: 1, max: 100000000, default: 1
7466/// height: `i32` -> Image height in pixels
7467/// min: 1, max: 100000000, default: 1
7468/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7469/// min: 0, max: 1000000, default: 0.5
7470/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7471/// min: 0, max: 1000000, default: 0.5
7472/// radius: `f64` -> Radius of circle
7473/// min: 0, max: 1000000, default: 0.1
7474/// amplitude_cutoff: `f64` -> Amplitude cutoff
7475/// min: 0, max: 1, default: 0.5
7476/// mask_gaussian_band_options: `&MaskGaussianBandOptions` -> optional arguments
7477/// returns `VipsImage` - Output image
7478pub fn mask_gaussian_band_with_opts(
7479    width: i32,
7480    height: i32,
7481    frequency_cutoff_x: f64,
7482    frequency_cutoff_y: f64,
7483    radius: f64,
7484    amplitude_cutoff: f64,
7485    mask_gaussian_band_options: &MaskGaussianBandOptions,
7486) -> Result<VipsImage> {
7487    unsafe {
7488        let width_in: i32 = width;
7489        let height_in: i32 = height;
7490        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7491        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7492        let radius_in: f64 = radius;
7493        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7494        let mut out_out: *mut bindings::VipsImage = null_mut();
7495
7496        let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7497            1
7498        } else {
7499            0
7500        };
7501        let uchar_in_name = utils::new_c_string("uchar")?;
7502
7503        let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7504            1
7505        } else {
7506            0
7507        };
7508        let nodc_in_name = utils::new_c_string("nodc")?;
7509
7510        let reject_in: i32 = if mask_gaussian_band_options.reject {
7511            1
7512        } else {
7513            0
7514        };
7515        let reject_in_name = utils::new_c_string("reject")?;
7516
7517        let optical_in: i32 = if mask_gaussian_band_options.optical {
7518            1
7519        } else {
7520            0
7521        };
7522        let optical_in_name = utils::new_c_string("optical")?;
7523
7524        let vips_op_response = bindings::vips_mask_gaussian_band(
7525            &mut out_out,
7526            width_in,
7527            height_in,
7528            frequency_cutoff_x_in,
7529            frequency_cutoff_y_in,
7530            radius_in,
7531            amplitude_cutoff_in,
7532            uchar_in_name.as_ptr(),
7533            uchar_in,
7534            nodc_in_name.as_ptr(),
7535            nodc_in,
7536            reject_in_name.as_ptr(),
7537            reject_in,
7538            optical_in_name.as_ptr(),
7539            optical_in,
7540            NULL,
7541        );
7542        utils::result(
7543            vips_op_response,
7544            VipsImage { ctx: out_out },
7545            Error::MaskGaussianBandError,
7546        )
7547    }
7548}
7549
7550/// VipsMaskFractal (mask_fractal), make fractal filter
7551/// width: `i32` -> Image width in pixels
7552/// min: 1, max: 100000000, default: 1
7553/// height: `i32` -> Image height in pixels
7554/// min: 1, max: 100000000, default: 1
7555/// fractal_dimension: `f64` -> Fractal dimension
7556/// min: 2, max: 3, default: 2.5
7557/// returns `VipsImage` - Output image
7558pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7559    unsafe {
7560        let width_in: i32 = width;
7561        let height_in: i32 = height;
7562        let fractal_dimension_in: f64 = fractal_dimension;
7563        let mut out_out: *mut bindings::VipsImage = null_mut();
7564
7565        let vips_op_response = bindings::vips_mask_fractal(
7566            &mut out_out,
7567            width_in,
7568            height_in,
7569            fractal_dimension_in,
7570            NULL,
7571        );
7572        utils::result(
7573            vips_op_response,
7574            VipsImage { ctx: out_out },
7575            Error::MaskFractalError,
7576        )
7577    }
7578}
7579
7580/// Options for mask_fractal operation
7581#[derive(Clone, Debug)]
7582pub struct MaskFractalOptions {
7583    /// uchar: `bool` -> Output an unsigned char image
7584    /// default: false
7585    pub uchar: bool,
7586    /// nodc: `bool` -> Remove DC component
7587    /// default: false
7588    pub nodc: bool,
7589    /// reject: `bool` -> Invert the sense of the filter
7590    /// default: false
7591    pub reject: bool,
7592    /// optical: `bool` -> Rotate quadrants to optical space
7593    /// default: false
7594    pub optical: bool,
7595}
7596
7597impl std::default::Default for MaskFractalOptions {
7598    fn default() -> Self {
7599        MaskFractalOptions {
7600            uchar: false,
7601            nodc: false,
7602            reject: false,
7603            optical: false,
7604        }
7605    }
7606}
7607
7608/// VipsMaskFractal (mask_fractal), make fractal filter
7609/// width: `i32` -> Image width in pixels
7610/// min: 1, max: 100000000, default: 1
7611/// height: `i32` -> Image height in pixels
7612/// min: 1, max: 100000000, default: 1
7613/// fractal_dimension: `f64` -> Fractal dimension
7614/// min: 2, max: 3, default: 2.5
7615/// mask_fractal_options: `&MaskFractalOptions` -> optional arguments
7616/// returns `VipsImage` - Output image
7617pub fn mask_fractal_with_opts(
7618    width: i32,
7619    height: i32,
7620    fractal_dimension: f64,
7621    mask_fractal_options: &MaskFractalOptions,
7622) -> Result<VipsImage> {
7623    unsafe {
7624        let width_in: i32 = width;
7625        let height_in: i32 = height;
7626        let fractal_dimension_in: f64 = fractal_dimension;
7627        let mut out_out: *mut bindings::VipsImage = null_mut();
7628
7629        let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7630        let uchar_in_name = utils::new_c_string("uchar")?;
7631
7632        let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7633        let nodc_in_name = utils::new_c_string("nodc")?;
7634
7635        let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7636        let reject_in_name = utils::new_c_string("reject")?;
7637
7638        let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7639        let optical_in_name = utils::new_c_string("optical")?;
7640
7641        let vips_op_response = bindings::vips_mask_fractal(
7642            &mut out_out,
7643            width_in,
7644            height_in,
7645            fractal_dimension_in,
7646            uchar_in_name.as_ptr(),
7647            uchar_in,
7648            nodc_in_name.as_ptr(),
7649            nodc_in,
7650            reject_in_name.as_ptr(),
7651            reject_in,
7652            optical_in_name.as_ptr(),
7653            optical_in,
7654            NULL,
7655        );
7656        utils::result(
7657            vips_op_response,
7658            VipsImage { ctx: out_out },
7659            Error::MaskFractalError,
7660        )
7661    }
7662}
7663
7664/// VipsBuildlut (buildlut), build a look-up table
7665/// inp: `&VipsImage` -> Matrix of XY coordinates
7666/// returns `VipsImage` - Output image
7667pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7668    unsafe {
7669        let inp_in: *mut bindings::VipsImage = inp.ctx;
7670        let mut out_out: *mut bindings::VipsImage = null_mut();
7671
7672        let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7673        utils::result(
7674            vips_op_response,
7675            VipsImage { ctx: out_out },
7676            Error::BuildlutError,
7677        )
7678    }
7679}
7680
7681/// VipsInvertlut (invertlut), build an inverted look-up table
7682/// inp: `&VipsImage` -> Matrix of XY coordinates
7683/// returns `VipsImage` - Output image
7684pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7685    unsafe {
7686        let inp_in: *mut bindings::VipsImage = inp.ctx;
7687        let mut out_out: *mut bindings::VipsImage = null_mut();
7688
7689        let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7690        utils::result(
7691            vips_op_response,
7692            VipsImage { ctx: out_out },
7693            Error::InvertlutError,
7694        )
7695    }
7696}
7697
7698/// Options for invertlut operation
7699#[derive(Clone, Debug)]
7700pub struct InvertlutOptions {
7701    /// size: `i32` -> LUT size to generate
7702    /// min: 1, max: 1000000, default: 256
7703    pub size: i32,
7704}
7705
7706impl std::default::Default for InvertlutOptions {
7707    fn default() -> Self {
7708        InvertlutOptions {
7709            size: i32::from(256),
7710        }
7711    }
7712}
7713
7714/// VipsInvertlut (invertlut), build an inverted look-up table
7715/// inp: `&VipsImage` -> Matrix of XY coordinates
7716/// invertlut_options: `&InvertlutOptions` -> optional arguments
7717/// returns `VipsImage` - Output image
7718pub fn invertlut_with_opts(
7719    inp: &VipsImage,
7720    invertlut_options: &InvertlutOptions,
7721) -> Result<VipsImage> {
7722    unsafe {
7723        let inp_in: *mut bindings::VipsImage = inp.ctx;
7724        let mut out_out: *mut bindings::VipsImage = null_mut();
7725
7726        let size_in: i32 = invertlut_options.size;
7727        let size_in_name = utils::new_c_string("size")?;
7728
7729        let vips_op_response =
7730            bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7731        utils::result(
7732            vips_op_response,
7733            VipsImage { ctx: out_out },
7734            Error::InvertlutError,
7735        )
7736    }
7737}
7738
7739/// VipsTonelut (tonelut), build a look-up table
7740
7741/// returns `VipsImage` - Output image
7742pub fn tonelut() -> Result<VipsImage> {
7743    unsafe {
7744        let mut out_out: *mut bindings::VipsImage = null_mut();
7745
7746        let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7747        utils::result(
7748            vips_op_response,
7749            VipsImage { ctx: out_out },
7750            Error::TonelutError,
7751        )
7752    }
7753}
7754
7755/// Options for tonelut operation
7756#[derive(Clone, Debug)]
7757pub struct TonelutOptions {
7758    /// in_max: `i32` -> Size of LUT to build
7759    /// min: 1, max: 65535, default: 32767
7760    pub in_max: i32,
7761    /// out_max: `i32` -> Maximum value in output LUT
7762    /// min: 1, max: 65535, default: 32767
7763    pub out_max: i32,
7764    /// lb: `f64` -> Lowest value in output
7765    /// min: 0, max: 100, default: 0
7766    pub lb: f64,
7767    /// lw: `f64` -> Highest value in output
7768    /// min: 0, max: 100, default: 100
7769    pub lw: f64,
7770    /// ps: `f64` -> Position of shadow
7771    /// min: 0, max: 1, default: 0.2
7772    pub ps: f64,
7773    /// pm: `f64` -> Position of mid-tones
7774    /// min: 0, max: 1, default: 0.5
7775    pub pm: f64,
7776    /// ph: `f64` -> Position of highlights
7777    /// min: 0, max: 1, default: 0.8
7778    pub ph: f64,
7779    /// s: `f64` -> Adjust shadows by this much
7780    /// min: -30, max: 30, default: 0
7781    pub s: f64,
7782    /// m: `f64` -> Adjust mid-tones by this much
7783    /// min: -30, max: 30, default: 0
7784    pub m: f64,
7785    /// h: `f64` -> Adjust highlights by this much
7786    /// min: -30, max: 30, default: 0
7787    pub h: f64,
7788}
7789
7790impl std::default::Default for TonelutOptions {
7791    fn default() -> Self {
7792        TonelutOptions {
7793            in_max: i32::from(32767),
7794            out_max: i32::from(32767),
7795            lb: f64::from(0),
7796            lw: f64::from(100),
7797            ps: f64::from(0.2),
7798            pm: f64::from(0.5),
7799            ph: f64::from(0.8),
7800            s: f64::from(0),
7801            m: f64::from(0),
7802            h: f64::from(0),
7803        }
7804    }
7805}
7806
7807/// VipsTonelut (tonelut), build a look-up table
7808
7809/// tonelut_options: `&TonelutOptions` -> optional arguments
7810/// returns `VipsImage` - Output image
7811pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7812    unsafe {
7813        let mut out_out: *mut bindings::VipsImage = null_mut();
7814
7815        let in_max_in: i32 = tonelut_options.in_max;
7816        let in_max_in_name = utils::new_c_string("in-max")?;
7817
7818        let out_max_in: i32 = tonelut_options.out_max;
7819        let out_max_in_name = utils::new_c_string("out-max")?;
7820
7821        let lb_in: f64 = tonelut_options.lb;
7822        let lb_in_name = utils::new_c_string("Lb")?;
7823
7824        let lw_in: f64 = tonelut_options.lw;
7825        let lw_in_name = utils::new_c_string("Lw")?;
7826
7827        let ps_in: f64 = tonelut_options.ps;
7828        let ps_in_name = utils::new_c_string("Ps")?;
7829
7830        let pm_in: f64 = tonelut_options.pm;
7831        let pm_in_name = utils::new_c_string("Pm")?;
7832
7833        let ph_in: f64 = tonelut_options.ph;
7834        let ph_in_name = utils::new_c_string("Ph")?;
7835
7836        let s_in: f64 = tonelut_options.s;
7837        let s_in_name = utils::new_c_string("S")?;
7838
7839        let m_in: f64 = tonelut_options.m;
7840        let m_in_name = utils::new_c_string("M")?;
7841
7842        let h_in: f64 = tonelut_options.h;
7843        let h_in_name = utils::new_c_string("H")?;
7844
7845        let vips_op_response = bindings::vips_tonelut(
7846            &mut out_out,
7847            in_max_in_name.as_ptr(),
7848            in_max_in,
7849            out_max_in_name.as_ptr(),
7850            out_max_in,
7851            lb_in_name.as_ptr(),
7852            lb_in,
7853            lw_in_name.as_ptr(),
7854            lw_in,
7855            ps_in_name.as_ptr(),
7856            ps_in,
7857            pm_in_name.as_ptr(),
7858            pm_in,
7859            ph_in_name.as_ptr(),
7860            ph_in,
7861            s_in_name.as_ptr(),
7862            s_in,
7863            m_in_name.as_ptr(),
7864            m_in,
7865            h_in_name.as_ptr(),
7866            h_in,
7867            NULL,
7868        );
7869        utils::result(
7870            vips_op_response,
7871            VipsImage { ctx: out_out },
7872            Error::TonelutError,
7873        )
7874    }
7875}
7876
7877/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7878
7879/// returns `VipsImage` - Output image
7880pub fn identity() -> Result<VipsImage> {
7881    unsafe {
7882        let mut out_out: *mut bindings::VipsImage = null_mut();
7883
7884        let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7885        utils::result(
7886            vips_op_response,
7887            VipsImage { ctx: out_out },
7888            Error::IdentityError,
7889        )
7890    }
7891}
7892
7893/// Options for identity operation
7894#[derive(Clone, Debug)]
7895pub struct IdentityOptions {
7896    /// bands: `i32` -> Number of bands in LUT
7897    /// min: 1, max: 100000, default: 1
7898    pub bands: i32,
7899    /// ushort: `bool` -> Create a 16-bit LUT
7900    /// default: false
7901    pub ushort: bool,
7902    /// size: `i32` -> Size of 16-bit LUT
7903    /// min: 1, max: 65536, default: 65536
7904    pub size: i32,
7905}
7906
7907impl std::default::Default for IdentityOptions {
7908    fn default() -> Self {
7909        IdentityOptions {
7910            bands: i32::from(1),
7911            ushort: false,
7912            size: i32::from(65536),
7913        }
7914    }
7915}
7916
7917/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7918
7919/// identity_options: `&IdentityOptions` -> optional arguments
7920/// returns `VipsImage` - Output image
7921pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
7922    unsafe {
7923        let mut out_out: *mut bindings::VipsImage = null_mut();
7924
7925        let bands_in: i32 = identity_options.bands;
7926        let bands_in_name = utils::new_c_string("bands")?;
7927
7928        let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
7929        let ushort_in_name = utils::new_c_string("ushort")?;
7930
7931        let size_in: i32 = identity_options.size;
7932        let size_in_name = utils::new_c_string("size")?;
7933
7934        let vips_op_response = bindings::vips_identity(
7935            &mut out_out,
7936            bands_in_name.as_ptr(),
7937            bands_in,
7938            ushort_in_name.as_ptr(),
7939            ushort_in,
7940            size_in_name.as_ptr(),
7941            size_in,
7942            NULL,
7943        );
7944        utils::result(
7945            vips_op_response,
7946            VipsImage { ctx: out_out },
7947            Error::IdentityError,
7948        )
7949    }
7950}
7951
7952/// VipsFractsurf (fractsurf), make a fractal surface
7953/// width: `i32` -> Image width in pixels
7954/// min: 1, max: 100000000, default: 64
7955/// height: `i32` -> Image height in pixels
7956/// min: 1, max: 100000000, default: 64
7957/// fractal_dimension: `f64` -> Fractal dimension
7958/// min: 2, max: 3, default: 2.5
7959/// returns `VipsImage` - Output image
7960pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7961    unsafe {
7962        let width_in: i32 = width;
7963        let height_in: i32 = height;
7964        let fractal_dimension_in: f64 = fractal_dimension;
7965        let mut out_out: *mut bindings::VipsImage = null_mut();
7966
7967        let vips_op_response = bindings::vips_fractsurf(
7968            &mut out_out,
7969            width_in,
7970            height_in,
7971            fractal_dimension_in,
7972            NULL,
7973        );
7974        utils::result(
7975            vips_op_response,
7976            VipsImage { ctx: out_out },
7977            Error::FractsurfError,
7978        )
7979    }
7980}
7981
7982/// VipsWorley (worley), make a worley noise image
7983/// width: `i32` -> Image width in pixels
7984/// min: 1, max: 100000000, default: 1
7985/// height: `i32` -> Image height in pixels
7986/// min: 1, max: 100000000, default: 1
7987/// returns `VipsImage` - Output image
7988pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
7989    unsafe {
7990        let width_in: i32 = width;
7991        let height_in: i32 = height;
7992        let mut out_out: *mut bindings::VipsImage = null_mut();
7993
7994        let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
7995        utils::result(
7996            vips_op_response,
7997            VipsImage { ctx: out_out },
7998            Error::WorleyError,
7999        )
8000    }
8001}
8002
8003/// Options for worley operation
8004#[derive(Clone, Debug)]
8005pub struct WorleyOptions {
8006    /// cell_size: `i32` -> Size of Worley cells
8007    /// min: 1, max: 100000000, default: 256
8008    pub cell_size: i32,
8009    /// seed: `i32` -> Random number seed
8010    /// min: -2147483648, max: 2147483647, default: 0
8011    pub seed: i32,
8012}
8013
8014impl std::default::Default for WorleyOptions {
8015    fn default() -> Self {
8016        WorleyOptions {
8017            cell_size: i32::from(256),
8018            seed: i32::from(0),
8019        }
8020    }
8021}
8022
8023/// VipsWorley (worley), make a worley noise image
8024/// width: `i32` -> Image width in pixels
8025/// min: 1, max: 100000000, default: 1
8026/// height: `i32` -> Image height in pixels
8027/// min: 1, max: 100000000, default: 1
8028/// worley_options: `&WorleyOptions` -> optional arguments
8029/// returns `VipsImage` - Output image
8030pub fn worley_with_opts(
8031    width: i32,
8032    height: i32,
8033    worley_options: &WorleyOptions,
8034) -> Result<VipsImage> {
8035    unsafe {
8036        let width_in: i32 = width;
8037        let height_in: i32 = height;
8038        let mut out_out: *mut bindings::VipsImage = null_mut();
8039
8040        let cell_size_in: i32 = worley_options.cell_size;
8041        let cell_size_in_name = utils::new_c_string("cell-size")?;
8042
8043        let seed_in: i32 = worley_options.seed;
8044        let seed_in_name = utils::new_c_string("seed")?;
8045
8046        let vips_op_response = bindings::vips_worley(
8047            &mut out_out,
8048            width_in,
8049            height_in,
8050            cell_size_in_name.as_ptr(),
8051            cell_size_in,
8052            seed_in_name.as_ptr(),
8053            seed_in,
8054            NULL,
8055        );
8056        utils::result(
8057            vips_op_response,
8058            VipsImage { ctx: out_out },
8059            Error::WorleyError,
8060        )
8061    }
8062}
8063
8064/// VipsPerlin (perlin), make a perlin noise image
8065/// width: `i32` -> Image width in pixels
8066/// min: 1, max: 100000000, default: 1
8067/// height: `i32` -> Image height in pixels
8068/// min: 1, max: 100000000, default: 1
8069/// returns `VipsImage` - Output image
8070pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8071    unsafe {
8072        let width_in: i32 = width;
8073        let height_in: i32 = height;
8074        let mut out_out: *mut bindings::VipsImage = null_mut();
8075
8076        let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8077        utils::result(
8078            vips_op_response,
8079            VipsImage { ctx: out_out },
8080            Error::PerlinError,
8081        )
8082    }
8083}
8084
8085/// Options for perlin operation
8086#[derive(Clone, Debug)]
8087pub struct PerlinOptions {
8088    /// cell_size: `i32` -> Size of Perlin cells
8089    /// min: 1, max: 100000000, default: 256
8090    pub cell_size: i32,
8091    /// uchar: `bool` -> Output an unsigned char image
8092    /// default: false
8093    pub uchar: bool,
8094    /// seed: `i32` -> Random number seed
8095    /// min: -2147483648, max: 2147483647, default: 0
8096    pub seed: i32,
8097}
8098
8099impl std::default::Default for PerlinOptions {
8100    fn default() -> Self {
8101        PerlinOptions {
8102            cell_size: i32::from(256),
8103            uchar: false,
8104            seed: i32::from(0),
8105        }
8106    }
8107}
8108
8109/// VipsPerlin (perlin), make a perlin noise image
8110/// width: `i32` -> Image width in pixels
8111/// min: 1, max: 100000000, default: 1
8112/// height: `i32` -> Image height in pixels
8113/// min: 1, max: 100000000, default: 1
8114/// perlin_options: `&PerlinOptions` -> optional arguments
8115/// returns `VipsImage` - Output image
8116pub fn perlin_with_opts(
8117    width: i32,
8118    height: i32,
8119    perlin_options: &PerlinOptions,
8120) -> Result<VipsImage> {
8121    unsafe {
8122        let width_in: i32 = width;
8123        let height_in: i32 = height;
8124        let mut out_out: *mut bindings::VipsImage = null_mut();
8125
8126        let cell_size_in: i32 = perlin_options.cell_size;
8127        let cell_size_in_name = utils::new_c_string("cell-size")?;
8128
8129        let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8130        let uchar_in_name = utils::new_c_string("uchar")?;
8131
8132        let seed_in: i32 = perlin_options.seed;
8133        let seed_in_name = utils::new_c_string("seed")?;
8134
8135        let vips_op_response = bindings::vips_perlin(
8136            &mut out_out,
8137            width_in,
8138            height_in,
8139            cell_size_in_name.as_ptr(),
8140            cell_size_in,
8141            uchar_in_name.as_ptr(),
8142            uchar_in,
8143            seed_in_name.as_ptr(),
8144            seed_in,
8145            NULL,
8146        );
8147        utils::result(
8148            vips_op_response,
8149            VipsImage { ctx: out_out },
8150            Error::PerlinError,
8151        )
8152    }
8153}
8154
8155/// VipsSwitch (switch), find the index of the first non-zero pixel in tests
8156/// tests: `&mut [VipsImage]` -> Table of images to test
8157/// returns `VipsImage` - Output image
8158pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8159    unsafe {
8160        let (tests_len, mut tests_in) = {
8161            let len = tests.len();
8162            let mut input = Vec::new();
8163            for img in tests {
8164                input.push(img.ctx)
8165            }
8166            (len as i32, input)
8167        };
8168        let mut out_out: *mut bindings::VipsImage = null_mut();
8169
8170        let vips_op_response =
8171            bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8172        utils::result(
8173            vips_op_response,
8174            VipsImage { ctx: out_out },
8175            Error::SwitchError,
8176        )
8177    }
8178}
8179
8180/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8181/// filename: `&str` -> Filename to load from
8182/// returns `VipsImage` - Output image
8183pub fn csvload(filename: &str) -> Result<VipsImage> {
8184    unsafe {
8185        let filename_in: CString = utils::new_c_string(filename)?;
8186        let mut out_out: *mut bindings::VipsImage = null_mut();
8187
8188        let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8189        utils::result(
8190            vips_op_response,
8191            VipsImage { ctx: out_out },
8192            Error::CsvloadError,
8193        )
8194    }
8195}
8196
8197/// Options for csvload operation
8198#[derive(Clone, Debug)]
8199pub struct CsvloadOptions {
8200    /// skip: `i32` -> Skip this many lines at the start of the file
8201    /// min: 0, max: 10000000, default: 0
8202    pub skip: i32,
8203    /// lines: `i32` -> Read this many lines from the file
8204    /// min: -1, max: 10000000, default: -1
8205    pub lines: i32,
8206    /// whitespace: `String` -> Set of whitespace characters
8207    pub whitespace: String,
8208    /// separator: `String` -> Set of separator characters
8209    pub separator: String,
8210    /// flags: `ForeignFlags` -> Flags for this file
8211    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8212    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8213    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8214    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8215    ///  `All` -> VIPS_FOREIGN_ALL = 7
8216    pub flags: ForeignFlags,
8217    /// memory: `bool` -> Force open via memory
8218    /// default: false
8219    pub memory: bool,
8220    /// access: `Access` -> Required access pattern for this file
8221    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8222    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8223    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8224    pub access: Access,
8225    /// fail_on: `FailOn` -> Error level to fail on
8226    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8227    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8228    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8229    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8230    pub fail_on: FailOn,
8231    /// revalidate: `bool` -> Don't use a cached result for this operation
8232    /// default: false
8233    pub revalidate: bool,
8234}
8235
8236impl std::default::Default for CsvloadOptions {
8237    fn default() -> Self {
8238        CsvloadOptions {
8239            skip: i32::from(0),
8240            lines: i32::from(-1),
8241            whitespace: String::new(),
8242            separator: String::new(),
8243            flags: ForeignFlags::None,
8244            memory: false,
8245            access: Access::Random,
8246            fail_on: FailOn::None,
8247            revalidate: false,
8248        }
8249    }
8250}
8251
8252/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8253/// filename: `&str` -> Filename to load from
8254/// csvload_options: `&CsvloadOptions` -> optional arguments
8255/// returns `VipsImage` - Output image
8256pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8257    unsafe {
8258        let filename_in: CString = utils::new_c_string(filename)?;
8259        let mut out_out: *mut bindings::VipsImage = null_mut();
8260
8261        let skip_in: i32 = csvload_options.skip;
8262        let skip_in_name = utils::new_c_string("skip")?;
8263
8264        let lines_in: i32 = csvload_options.lines;
8265        let lines_in_name = utils::new_c_string("lines")?;
8266
8267        let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8268        let whitespace_in_name = utils::new_c_string("whitespace")?;
8269
8270        let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8271        let separator_in_name = utils::new_c_string("separator")?;
8272
8273        let flags_in: i32 = csvload_options.flags as i32;
8274        let flags_in_name = utils::new_c_string("flags")?;
8275
8276        let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8277        let memory_in_name = utils::new_c_string("memory")?;
8278
8279        let access_in: i32 = csvload_options.access as i32;
8280        let access_in_name = utils::new_c_string("access")?;
8281
8282        let fail_on_in: i32 = csvload_options.fail_on as i32;
8283        let fail_on_in_name = utils::new_c_string("fail-on")?;
8284
8285        let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8286        let revalidate_in_name = utils::new_c_string("revalidate")?;
8287
8288        let vips_op_response = bindings::vips_csvload(
8289            filename_in.as_ptr(),
8290            &mut out_out,
8291            skip_in_name.as_ptr(),
8292            skip_in,
8293            lines_in_name.as_ptr(),
8294            lines_in,
8295            whitespace_in_name.as_ptr(),
8296            whitespace_in.as_ptr(),
8297            separator_in_name.as_ptr(),
8298            separator_in.as_ptr(),
8299            flags_in_name.as_ptr(),
8300            flags_in,
8301            memory_in_name.as_ptr(),
8302            memory_in,
8303            access_in_name.as_ptr(),
8304            access_in,
8305            fail_on_in_name.as_ptr(),
8306            fail_on_in,
8307            revalidate_in_name.as_ptr(),
8308            revalidate_in,
8309            NULL,
8310        );
8311        utils::result(
8312            vips_op_response,
8313            VipsImage { ctx: out_out },
8314            Error::CsvloadError,
8315        )
8316    }
8317}
8318
8319/// VipsForeignLoadCsvSource (csvload_source), load csv, nocache, priority=0, untrusted, is_a_source, get_flags, header, load
8320/// source: `&VipsSource` -> Source to load from
8321/// returns `VipsImage` - Output image
8322pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8323    unsafe {
8324        let source_in: *mut bindings::VipsSource = source.ctx;
8325        let mut out_out: *mut bindings::VipsImage = null_mut();
8326
8327        let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8328        utils::result(
8329            vips_op_response,
8330            VipsImage { ctx: out_out },
8331            Error::CsvloadSourceError,
8332        )
8333    }
8334}
8335
8336/// Options for csvload_source operation
8337#[derive(Clone, Debug)]
8338pub struct CsvloadSourceOptions {
8339    /// skip: `i32` -> Skip this many lines at the start of the file
8340    /// min: 0, max: 10000000, default: 0
8341    pub skip: i32,
8342    /// lines: `i32` -> Read this many lines from the file
8343    /// min: -1, max: 10000000, default: -1
8344    pub lines: i32,
8345    /// whitespace: `String` -> Set of whitespace characters
8346    pub whitespace: String,
8347    /// separator: `String` -> Set of separator characters
8348    pub separator: String,
8349    /// flags: `ForeignFlags` -> Flags for this file
8350    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8351    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8352    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8353    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8354    ///  `All` -> VIPS_FOREIGN_ALL = 7
8355    pub flags: ForeignFlags,
8356    /// memory: `bool` -> Force open via memory
8357    /// default: false
8358    pub memory: bool,
8359    /// access: `Access` -> Required access pattern for this file
8360    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8361    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8362    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8363    pub access: Access,
8364    /// fail_on: `FailOn` -> Error level to fail on
8365    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8366    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8367    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8368    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8369    pub fail_on: FailOn,
8370    /// revalidate: `bool` -> Don't use a cached result for this operation
8371    /// default: false
8372    pub revalidate: bool,
8373}
8374
8375impl std::default::Default for CsvloadSourceOptions {
8376    fn default() -> Self {
8377        CsvloadSourceOptions {
8378            skip: i32::from(0),
8379            lines: i32::from(-1),
8380            whitespace: String::new(),
8381            separator: String::new(),
8382            flags: ForeignFlags::None,
8383            memory: false,
8384            access: Access::Random,
8385            fail_on: FailOn::None,
8386            revalidate: false,
8387        }
8388    }
8389}
8390
8391/// VipsForeignLoadCsvSource (csvload_source), load csv, nocache, priority=0, untrusted, is_a_source, get_flags, header, load
8392/// source: `&VipsSource` -> Source to load from
8393/// csvload_source_options: `&CsvloadSourceOptions` -> optional arguments
8394/// returns `VipsImage` - Output image
8395pub fn csvload_source_with_opts(
8396    source: &VipsSource,
8397    csvload_source_options: &CsvloadSourceOptions,
8398) -> Result<VipsImage> {
8399    unsafe {
8400        let source_in: *mut bindings::VipsSource = source.ctx;
8401        let mut out_out: *mut bindings::VipsImage = null_mut();
8402
8403        let skip_in: i32 = csvload_source_options.skip;
8404        let skip_in_name = utils::new_c_string("skip")?;
8405
8406        let lines_in: i32 = csvload_source_options.lines;
8407        let lines_in_name = utils::new_c_string("lines")?;
8408
8409        let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8410        let whitespace_in_name = utils::new_c_string("whitespace")?;
8411
8412        let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8413        let separator_in_name = utils::new_c_string("separator")?;
8414
8415        let flags_in: i32 = csvload_source_options.flags as i32;
8416        let flags_in_name = utils::new_c_string("flags")?;
8417
8418        let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8419        let memory_in_name = utils::new_c_string("memory")?;
8420
8421        let access_in: i32 = csvload_source_options.access as i32;
8422        let access_in_name = utils::new_c_string("access")?;
8423
8424        let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8425        let fail_on_in_name = utils::new_c_string("fail-on")?;
8426
8427        let revalidate_in: i32 = if csvload_source_options.revalidate {
8428            1
8429        } else {
8430            0
8431        };
8432        let revalidate_in_name = utils::new_c_string("revalidate")?;
8433
8434        let vips_op_response = bindings::vips_csvload_source(
8435            source_in,
8436            &mut out_out,
8437            skip_in_name.as_ptr(),
8438            skip_in,
8439            lines_in_name.as_ptr(),
8440            lines_in,
8441            whitespace_in_name.as_ptr(),
8442            whitespace_in.as_ptr(),
8443            separator_in_name.as_ptr(),
8444            separator_in.as_ptr(),
8445            flags_in_name.as_ptr(),
8446            flags_in,
8447            memory_in_name.as_ptr(),
8448            memory_in,
8449            access_in_name.as_ptr(),
8450            access_in,
8451            fail_on_in_name.as_ptr(),
8452            fail_on_in,
8453            revalidate_in_name.as_ptr(),
8454            revalidate_in,
8455            NULL,
8456        );
8457        utils::result(
8458            vips_op_response,
8459            VipsImage { ctx: out_out },
8460            Error::CsvloadSourceError,
8461        )
8462    }
8463}
8464
8465/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8466/// filename: `&str` -> Filename to load from
8467/// returns `VipsImage` - Output image
8468pub fn matrixload(filename: &str) -> Result<VipsImage> {
8469    unsafe {
8470        let filename_in: CString = utils::new_c_string(filename)?;
8471        let mut out_out: *mut bindings::VipsImage = null_mut();
8472
8473        let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8474        utils::result(
8475            vips_op_response,
8476            VipsImage { ctx: out_out },
8477            Error::MatrixloadError,
8478        )
8479    }
8480}
8481
8482/// Options for matrixload operation
8483#[derive(Clone, Debug)]
8484pub struct MatrixloadOptions {
8485    /// flags: `ForeignFlags` -> Flags for this file
8486    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8487    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8488    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8489    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8490    ///  `All` -> VIPS_FOREIGN_ALL = 7
8491    pub flags: ForeignFlags,
8492    /// memory: `bool` -> Force open via memory
8493    /// default: false
8494    pub memory: bool,
8495    /// access: `Access` -> Required access pattern for this file
8496    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8497    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8498    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8499    pub access: Access,
8500    /// fail_on: `FailOn` -> Error level to fail on
8501    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8502    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8503    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8504    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8505    pub fail_on: FailOn,
8506    /// revalidate: `bool` -> Don't use a cached result for this operation
8507    /// default: false
8508    pub revalidate: bool,
8509}
8510
8511impl std::default::Default for MatrixloadOptions {
8512    fn default() -> Self {
8513        MatrixloadOptions {
8514            flags: ForeignFlags::None,
8515            memory: false,
8516            access: Access::Random,
8517            fail_on: FailOn::None,
8518            revalidate: false,
8519        }
8520    }
8521}
8522
8523/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8524/// filename: `&str` -> Filename to load from
8525/// matrixload_options: `&MatrixloadOptions` -> optional arguments
8526/// returns `VipsImage` - Output image
8527pub fn matrixload_with_opts(
8528    filename: &str,
8529    matrixload_options: &MatrixloadOptions,
8530) -> Result<VipsImage> {
8531    unsafe {
8532        let filename_in: CString = utils::new_c_string(filename)?;
8533        let mut out_out: *mut bindings::VipsImage = null_mut();
8534
8535        let flags_in: i32 = matrixload_options.flags as i32;
8536        let flags_in_name = utils::new_c_string("flags")?;
8537
8538        let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8539        let memory_in_name = utils::new_c_string("memory")?;
8540
8541        let access_in: i32 = matrixload_options.access as i32;
8542        let access_in_name = utils::new_c_string("access")?;
8543
8544        let fail_on_in: i32 = matrixload_options.fail_on as i32;
8545        let fail_on_in_name = utils::new_c_string("fail-on")?;
8546
8547        let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8548        let revalidate_in_name = utils::new_c_string("revalidate")?;
8549
8550        let vips_op_response = bindings::vips_matrixload(
8551            filename_in.as_ptr(),
8552            &mut out_out,
8553            flags_in_name.as_ptr(),
8554            flags_in,
8555            memory_in_name.as_ptr(),
8556            memory_in,
8557            access_in_name.as_ptr(),
8558            access_in,
8559            fail_on_in_name.as_ptr(),
8560            fail_on_in,
8561            revalidate_in_name.as_ptr(),
8562            revalidate_in,
8563            NULL,
8564        );
8565        utils::result(
8566            vips_op_response,
8567            VipsImage { ctx: out_out },
8568            Error::MatrixloadError,
8569        )
8570    }
8571}
8572
8573/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, nocache, priority=0, is_a_source, get_flags, header, load
8574/// source: `&VipsSource` -> Source to load from
8575/// returns `VipsImage` - Output image
8576pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8577    unsafe {
8578        let source_in: *mut bindings::VipsSource = source.ctx;
8579        let mut out_out: *mut bindings::VipsImage = null_mut();
8580
8581        let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8582        utils::result(
8583            vips_op_response,
8584            VipsImage { ctx: out_out },
8585            Error::MatrixloadSourceError,
8586        )
8587    }
8588}
8589
8590/// Options for matrixload_source operation
8591#[derive(Clone, Debug)]
8592pub struct MatrixloadSourceOptions {
8593    /// flags: `ForeignFlags` -> Flags for this file
8594    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8595    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8596    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8597    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8598    ///  `All` -> VIPS_FOREIGN_ALL = 7
8599    pub flags: ForeignFlags,
8600    /// memory: `bool` -> Force open via memory
8601    /// default: false
8602    pub memory: bool,
8603    /// access: `Access` -> Required access pattern for this file
8604    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8605    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8606    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8607    pub access: Access,
8608    /// fail_on: `FailOn` -> Error level to fail on
8609    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8610    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8611    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8612    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8613    pub fail_on: FailOn,
8614    /// revalidate: `bool` -> Don't use a cached result for this operation
8615    /// default: false
8616    pub revalidate: bool,
8617}
8618
8619impl std::default::Default for MatrixloadSourceOptions {
8620    fn default() -> Self {
8621        MatrixloadSourceOptions {
8622            flags: ForeignFlags::None,
8623            memory: false,
8624            access: Access::Random,
8625            fail_on: FailOn::None,
8626            revalidate: false,
8627        }
8628    }
8629}
8630
8631/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, nocache, priority=0, is_a_source, get_flags, header, load
8632/// source: `&VipsSource` -> Source to load from
8633/// matrixload_source_options: `&MatrixloadSourceOptions` -> optional arguments
8634/// returns `VipsImage` - Output image
8635pub fn matrixload_source_with_opts(
8636    source: &VipsSource,
8637    matrixload_source_options: &MatrixloadSourceOptions,
8638) -> Result<VipsImage> {
8639    unsafe {
8640        let source_in: *mut bindings::VipsSource = source.ctx;
8641        let mut out_out: *mut bindings::VipsImage = null_mut();
8642
8643        let flags_in: i32 = matrixload_source_options.flags as i32;
8644        let flags_in_name = utils::new_c_string("flags")?;
8645
8646        let memory_in: i32 = if matrixload_source_options.memory {
8647            1
8648        } else {
8649            0
8650        };
8651        let memory_in_name = utils::new_c_string("memory")?;
8652
8653        let access_in: i32 = matrixload_source_options.access as i32;
8654        let access_in_name = utils::new_c_string("access")?;
8655
8656        let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8657        let fail_on_in_name = utils::new_c_string("fail-on")?;
8658
8659        let revalidate_in: i32 = if matrixload_source_options.revalidate {
8660            1
8661        } else {
8662            0
8663        };
8664        let revalidate_in_name = utils::new_c_string("revalidate")?;
8665
8666        let vips_op_response = bindings::vips_matrixload_source(
8667            source_in,
8668            &mut out_out,
8669            flags_in_name.as_ptr(),
8670            flags_in,
8671            memory_in_name.as_ptr(),
8672            memory_in,
8673            access_in_name.as_ptr(),
8674            access_in,
8675            fail_on_in_name.as_ptr(),
8676            fail_on_in,
8677            revalidate_in_name.as_ptr(),
8678            revalidate_in,
8679            NULL,
8680        );
8681        utils::result(
8682            vips_op_response,
8683            VipsImage { ctx: out_out },
8684            Error::MatrixloadSourceError,
8685        )
8686    }
8687}
8688
8689/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8690/// filename: `&str` -> Filename to load from
8691/// width: `i32` -> Image width in pixels
8692/// min: 0, max: 100000000, default: 0
8693/// height: `i32` -> Image height in pixels
8694/// min: 0, max: 100000000, default: 0
8695/// bands: `i32` -> Number of bands in image
8696/// min: 0, max: 100000000, default: 0
8697/// returns `VipsImage` - Output image
8698pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8699    unsafe {
8700        let filename_in: CString = utils::new_c_string(filename)?;
8701        let width_in: i32 = width;
8702        let height_in: i32 = height;
8703        let bands_in: i32 = bands;
8704        let mut out_out: *mut bindings::VipsImage = null_mut();
8705
8706        let vips_op_response = bindings::vips_rawload(
8707            filename_in.as_ptr(),
8708            &mut out_out,
8709            width_in,
8710            height_in,
8711            bands_in,
8712            NULL,
8713        );
8714        utils::result(
8715            vips_op_response,
8716            VipsImage { ctx: out_out },
8717            Error::RawloadError,
8718        )
8719    }
8720}
8721
8722/// Options for rawload operation
8723#[derive(Clone, Debug)]
8724pub struct RawloadOptions {
8725    /// offset: `u64` -> Offset in bytes from start of file
8726    /// min: 0, max: 100000000000, default: 0
8727    pub offset: u64,
8728    /// format: `BandFormat` -> Pixel format in image
8729    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
8730    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
8731    ///  `Char` -> VIPS_FORMAT_CHAR = 1
8732    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
8733    ///  `Short` -> VIPS_FORMAT_SHORT = 3
8734    ///  `Uint` -> VIPS_FORMAT_UINT = 4
8735    ///  `Int` -> VIPS_FORMAT_INT = 5
8736    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
8737    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
8738    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
8739    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
8740    pub format: BandFormat,
8741    /// interpretation: `Interpretation` -> Pixel interpretation
8742    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
8743    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
8744    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
8745    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
8746    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
8747    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
8748    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
8749    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
8750    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
8751    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
8752    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
8753    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
8754    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
8755    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
8756    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
8757    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
8758    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
8759    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
8760    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
8761    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
8762    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
8763    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
8764    pub interpretation: Interpretation,
8765    /// flags: `ForeignFlags` -> Flags for this file
8766    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8767    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8768    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8769    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8770    ///  `All` -> VIPS_FOREIGN_ALL = 7
8771    pub flags: ForeignFlags,
8772    /// memory: `bool` -> Force open via memory
8773    /// default: false
8774    pub memory: bool,
8775    /// access: `Access` -> Required access pattern for this file
8776    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8777    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8778    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8779    pub access: Access,
8780    /// fail_on: `FailOn` -> Error level to fail on
8781    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8782    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8783    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8784    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8785    pub fail_on: FailOn,
8786    /// revalidate: `bool` -> Don't use a cached result for this operation
8787    /// default: false
8788    pub revalidate: bool,
8789}
8790
8791impl std::default::Default for RawloadOptions {
8792    fn default() -> Self {
8793        RawloadOptions {
8794            offset: 0,
8795            format: BandFormat::Uchar,
8796            interpretation: Interpretation::Multiband,
8797            flags: ForeignFlags::None,
8798            memory: false,
8799            access: Access::Random,
8800            fail_on: FailOn::None,
8801            revalidate: false,
8802        }
8803    }
8804}
8805
8806/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8807/// filename: `&str` -> Filename to load from
8808/// width: `i32` -> Image width in pixels
8809/// min: 0, max: 100000000, default: 0
8810/// height: `i32` -> Image height in pixels
8811/// min: 0, max: 100000000, default: 0
8812/// bands: `i32` -> Number of bands in image
8813/// min: 0, max: 100000000, default: 0
8814/// rawload_options: `&RawloadOptions` -> optional arguments
8815/// returns `VipsImage` - Output image
8816pub fn rawload_with_opts(
8817    filename: &str,
8818    width: i32,
8819    height: i32,
8820    bands: i32,
8821    rawload_options: &RawloadOptions,
8822) -> Result<VipsImage> {
8823    unsafe {
8824        let filename_in: CString = utils::new_c_string(filename)?;
8825        let width_in: i32 = width;
8826        let height_in: i32 = height;
8827        let bands_in: i32 = bands;
8828        let mut out_out: *mut bindings::VipsImage = null_mut();
8829
8830        let offset_in: u64 = rawload_options.offset;
8831        let offset_in_name = utils::new_c_string("offset")?;
8832
8833        let format_in: i32 = rawload_options.format as i32;
8834        let format_in_name = utils::new_c_string("format")?;
8835
8836        let interpretation_in: i32 = rawload_options.interpretation as i32;
8837        let interpretation_in_name = utils::new_c_string("interpretation")?;
8838
8839        let flags_in: i32 = rawload_options.flags as i32;
8840        let flags_in_name = utils::new_c_string("flags")?;
8841
8842        let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8843        let memory_in_name = utils::new_c_string("memory")?;
8844
8845        let access_in: i32 = rawload_options.access as i32;
8846        let access_in_name = utils::new_c_string("access")?;
8847
8848        let fail_on_in: i32 = rawload_options.fail_on as i32;
8849        let fail_on_in_name = utils::new_c_string("fail-on")?;
8850
8851        let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8852        let revalidate_in_name = utils::new_c_string("revalidate")?;
8853
8854        let vips_op_response = bindings::vips_rawload(
8855            filename_in.as_ptr(),
8856            &mut out_out,
8857            width_in,
8858            height_in,
8859            bands_in,
8860            offset_in_name.as_ptr(),
8861            offset_in,
8862            format_in_name.as_ptr(),
8863            format_in,
8864            interpretation_in_name.as_ptr(),
8865            interpretation_in,
8866            flags_in_name.as_ptr(),
8867            flags_in,
8868            memory_in_name.as_ptr(),
8869            memory_in,
8870            access_in_name.as_ptr(),
8871            access_in,
8872            fail_on_in_name.as_ptr(),
8873            fail_on_in,
8874            revalidate_in_name.as_ptr(),
8875            revalidate_in,
8876            NULL,
8877        );
8878        utils::result(
8879            vips_op_response,
8880            VipsImage { ctx: out_out },
8881            Error::RawloadError,
8882        )
8883    }
8884}
8885
8886/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8887/// filename: `&str` -> Filename to load from
8888/// returns `VipsImage` - Output image
8889pub fn vipsload(filename: &str) -> Result<VipsImage> {
8890    unsafe {
8891        let filename_in: CString = utils::new_c_string(filename)?;
8892        let mut out_out: *mut bindings::VipsImage = null_mut();
8893
8894        let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
8895        utils::result(
8896            vips_op_response,
8897            VipsImage { ctx: out_out },
8898            Error::VipsloadError,
8899        )
8900    }
8901}
8902
8903/// Options for vipsload operation
8904#[derive(Clone, Debug)]
8905pub struct VipsloadOptions {
8906    /// flags: `ForeignFlags` -> Flags for this file
8907    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8908    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8909    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8910    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8911    ///  `All` -> VIPS_FOREIGN_ALL = 7
8912    pub flags: ForeignFlags,
8913    /// memory: `bool` -> Force open via memory
8914    /// default: false
8915    pub memory: bool,
8916    /// access: `Access` -> Required access pattern for this file
8917    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8918    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8919    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8920    pub access: Access,
8921    /// fail_on: `FailOn` -> Error level to fail on
8922    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8923    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8924    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8925    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8926    pub fail_on: FailOn,
8927    /// revalidate: `bool` -> Don't use a cached result for this operation
8928    /// default: false
8929    pub revalidate: bool,
8930}
8931
8932impl std::default::Default for VipsloadOptions {
8933    fn default() -> Self {
8934        VipsloadOptions {
8935            flags: ForeignFlags::None,
8936            memory: false,
8937            access: Access::Random,
8938            fail_on: FailOn::None,
8939            revalidate: false,
8940        }
8941    }
8942}
8943
8944/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8945/// filename: `&str` -> Filename to load from
8946/// vipsload_options: `&VipsloadOptions` -> optional arguments
8947/// returns `VipsImage` - Output image
8948pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
8949    unsafe {
8950        let filename_in: CString = utils::new_c_string(filename)?;
8951        let mut out_out: *mut bindings::VipsImage = null_mut();
8952
8953        let flags_in: i32 = vipsload_options.flags as i32;
8954        let flags_in_name = utils::new_c_string("flags")?;
8955
8956        let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
8957        let memory_in_name = utils::new_c_string("memory")?;
8958
8959        let access_in: i32 = vipsload_options.access as i32;
8960        let access_in_name = utils::new_c_string("access")?;
8961
8962        let fail_on_in: i32 = vipsload_options.fail_on as i32;
8963        let fail_on_in_name = utils::new_c_string("fail-on")?;
8964
8965        let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
8966        let revalidate_in_name = utils::new_c_string("revalidate")?;
8967
8968        let vips_op_response = bindings::vips_vipsload(
8969            filename_in.as_ptr(),
8970            &mut out_out,
8971            flags_in_name.as_ptr(),
8972            flags_in,
8973            memory_in_name.as_ptr(),
8974            memory_in,
8975            access_in_name.as_ptr(),
8976            access_in,
8977            fail_on_in_name.as_ptr(),
8978            fail_on_in,
8979            revalidate_in_name.as_ptr(),
8980            revalidate_in,
8981            NULL,
8982        );
8983        utils::result(
8984            vips_op_response,
8985            VipsImage { ctx: out_out },
8986            Error::VipsloadError,
8987        )
8988    }
8989}
8990
8991/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, nocache, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
8992/// source: `&VipsSource` -> Source to load from
8993/// returns `VipsImage` - Output image
8994pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
8995    unsafe {
8996        let source_in: *mut bindings::VipsSource = source.ctx;
8997        let mut out_out: *mut bindings::VipsImage = null_mut();
8998
8999        let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
9000        utils::result(
9001            vips_op_response,
9002            VipsImage { ctx: out_out },
9003            Error::VipsloadSourceError,
9004        )
9005    }
9006}
9007
9008/// Options for vipsload_source operation
9009#[derive(Clone, Debug)]
9010pub struct VipsloadSourceOptions {
9011    /// flags: `ForeignFlags` -> Flags for this file
9012    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9013    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9014    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9015    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9016    ///  `All` -> VIPS_FOREIGN_ALL = 7
9017    pub flags: ForeignFlags,
9018    /// memory: `bool` -> Force open via memory
9019    /// default: false
9020    pub memory: bool,
9021    /// access: `Access` -> Required access pattern for this file
9022    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9023    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9024    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9025    pub access: Access,
9026    /// fail_on: `FailOn` -> Error level to fail on
9027    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9028    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9029    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9030    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9031    pub fail_on: FailOn,
9032    /// revalidate: `bool` -> Don't use a cached result for this operation
9033    /// default: false
9034    pub revalidate: bool,
9035}
9036
9037impl std::default::Default for VipsloadSourceOptions {
9038    fn default() -> Self {
9039        VipsloadSourceOptions {
9040            flags: ForeignFlags::None,
9041            memory: false,
9042            access: Access::Random,
9043            fail_on: FailOn::None,
9044            revalidate: false,
9045        }
9046    }
9047}
9048
9049/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, nocache, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9050/// source: `&VipsSource` -> Source to load from
9051/// vipsload_source_options: `&VipsloadSourceOptions` -> optional arguments
9052/// returns `VipsImage` - Output image
9053pub fn vipsload_source_with_opts(
9054    source: &VipsSource,
9055    vipsload_source_options: &VipsloadSourceOptions,
9056) -> Result<VipsImage> {
9057    unsafe {
9058        let source_in: *mut bindings::VipsSource = source.ctx;
9059        let mut out_out: *mut bindings::VipsImage = null_mut();
9060
9061        let flags_in: i32 = vipsload_source_options.flags as i32;
9062        let flags_in_name = utils::new_c_string("flags")?;
9063
9064        let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9065        let memory_in_name = utils::new_c_string("memory")?;
9066
9067        let access_in: i32 = vipsload_source_options.access as i32;
9068        let access_in_name = utils::new_c_string("access")?;
9069
9070        let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9071        let fail_on_in_name = utils::new_c_string("fail-on")?;
9072
9073        let revalidate_in: i32 = if vipsload_source_options.revalidate {
9074            1
9075        } else {
9076            0
9077        };
9078        let revalidate_in_name = utils::new_c_string("revalidate")?;
9079
9080        let vips_op_response = bindings::vips_vipsload_source(
9081            source_in,
9082            &mut out_out,
9083            flags_in_name.as_ptr(),
9084            flags_in,
9085            memory_in_name.as_ptr(),
9086            memory_in,
9087            access_in_name.as_ptr(),
9088            access_in,
9089            fail_on_in_name.as_ptr(),
9090            fail_on_in,
9091            revalidate_in_name.as_ptr(),
9092            revalidate_in,
9093            NULL,
9094        );
9095        utils::result(
9096            vips_op_response,
9097            VipsImage { ctx: out_out },
9098            Error::VipsloadSourceError,
9099        )
9100    }
9101}
9102
9103/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9104/// filename: `&str` -> Filename to load from
9105/// returns `VipsImage` - Output image
9106pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9107    unsafe {
9108        let filename_in: CString = utils::new_c_string(filename)?;
9109        let mut out_out: *mut bindings::VipsImage = null_mut();
9110
9111        let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9112        utils::result(
9113            vips_op_response,
9114            VipsImage { ctx: out_out },
9115            Error::AnalyzeloadError,
9116        )
9117    }
9118}
9119
9120/// Options for analyzeload operation
9121#[derive(Clone, Debug)]
9122pub struct AnalyzeloadOptions {
9123    /// flags: `ForeignFlags` -> Flags for this file
9124    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9125    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9126    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9127    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9128    ///  `All` -> VIPS_FOREIGN_ALL = 7
9129    pub flags: ForeignFlags,
9130    /// memory: `bool` -> Force open via memory
9131    /// default: false
9132    pub memory: bool,
9133    /// access: `Access` -> Required access pattern for this file
9134    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9135    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9136    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9137    pub access: Access,
9138    /// fail_on: `FailOn` -> Error level to fail on
9139    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9140    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9141    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9142    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9143    pub fail_on: FailOn,
9144    /// revalidate: `bool` -> Don't use a cached result for this operation
9145    /// default: false
9146    pub revalidate: bool,
9147}
9148
9149impl std::default::Default for AnalyzeloadOptions {
9150    fn default() -> Self {
9151        AnalyzeloadOptions {
9152            flags: ForeignFlags::None,
9153            memory: false,
9154            access: Access::Random,
9155            fail_on: FailOn::None,
9156            revalidate: false,
9157        }
9158    }
9159}
9160
9161/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9162/// filename: `&str` -> Filename to load from
9163/// analyzeload_options: `&AnalyzeloadOptions` -> optional arguments
9164/// returns `VipsImage` - Output image
9165pub fn analyzeload_with_opts(
9166    filename: &str,
9167    analyzeload_options: &AnalyzeloadOptions,
9168) -> Result<VipsImage> {
9169    unsafe {
9170        let filename_in: CString = utils::new_c_string(filename)?;
9171        let mut out_out: *mut bindings::VipsImage = null_mut();
9172
9173        let flags_in: i32 = analyzeload_options.flags as i32;
9174        let flags_in_name = utils::new_c_string("flags")?;
9175
9176        let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9177        let memory_in_name = utils::new_c_string("memory")?;
9178
9179        let access_in: i32 = analyzeload_options.access as i32;
9180        let access_in_name = utils::new_c_string("access")?;
9181
9182        let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9183        let fail_on_in_name = utils::new_c_string("fail-on")?;
9184
9185        let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9186        let revalidate_in_name = utils::new_c_string("revalidate")?;
9187
9188        let vips_op_response = bindings::vips_analyzeload(
9189            filename_in.as_ptr(),
9190            &mut out_out,
9191            flags_in_name.as_ptr(),
9192            flags_in,
9193            memory_in_name.as_ptr(),
9194            memory_in,
9195            access_in_name.as_ptr(),
9196            access_in,
9197            fail_on_in_name.as_ptr(),
9198            fail_on_in,
9199            revalidate_in_name.as_ptr(),
9200            revalidate_in,
9201            NULL,
9202        );
9203        utils::result(
9204            vips_op_response,
9205            VipsImage { ctx: out_out },
9206            Error::AnalyzeloadError,
9207        )
9208    }
9209}
9210
9211/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9212/// filename: `&str` -> Filename to load from
9213/// returns `VipsImage` - Output image
9214pub fn ppmload(filename: &str) -> Result<VipsImage> {
9215    unsafe {
9216        let filename_in: CString = utils::new_c_string(filename)?;
9217        let mut out_out: *mut bindings::VipsImage = null_mut();
9218
9219        let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9220        utils::result(
9221            vips_op_response,
9222            VipsImage { ctx: out_out },
9223            Error::PpmloadError,
9224        )
9225    }
9226}
9227
9228/// Options for ppmload operation
9229#[derive(Clone, Debug)]
9230pub struct PpmloadOptions {
9231    /// flags: `ForeignFlags` -> Flags for this file
9232    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9233    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9234    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9235    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9236    ///  `All` -> VIPS_FOREIGN_ALL = 7
9237    pub flags: ForeignFlags,
9238    /// memory: `bool` -> Force open via memory
9239    /// default: false
9240    pub memory: bool,
9241    /// access: `Access` -> Required access pattern for this file
9242    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9243    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9244    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9245    pub access: Access,
9246    /// fail_on: `FailOn` -> Error level to fail on
9247    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9248    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9249    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9250    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9251    pub fail_on: FailOn,
9252    /// revalidate: `bool` -> Don't use a cached result for this operation
9253    /// default: false
9254    pub revalidate: bool,
9255}
9256
9257impl std::default::Default for PpmloadOptions {
9258    fn default() -> Self {
9259        PpmloadOptions {
9260            flags: ForeignFlags::None,
9261            memory: false,
9262            access: Access::Random,
9263            fail_on: FailOn::None,
9264            revalidate: false,
9265        }
9266    }
9267}
9268
9269/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9270/// filename: `&str` -> Filename to load from
9271/// ppmload_options: `&PpmloadOptions` -> optional arguments
9272/// returns `VipsImage` - Output image
9273pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9274    unsafe {
9275        let filename_in: CString = utils::new_c_string(filename)?;
9276        let mut out_out: *mut bindings::VipsImage = null_mut();
9277
9278        let flags_in: i32 = ppmload_options.flags as i32;
9279        let flags_in_name = utils::new_c_string("flags")?;
9280
9281        let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9282        let memory_in_name = utils::new_c_string("memory")?;
9283
9284        let access_in: i32 = ppmload_options.access as i32;
9285        let access_in_name = utils::new_c_string("access")?;
9286
9287        let fail_on_in: i32 = ppmload_options.fail_on as i32;
9288        let fail_on_in_name = utils::new_c_string("fail-on")?;
9289
9290        let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9291        let revalidate_in_name = utils::new_c_string("revalidate")?;
9292
9293        let vips_op_response = bindings::vips_ppmload(
9294            filename_in.as_ptr(),
9295            &mut out_out,
9296            flags_in_name.as_ptr(),
9297            flags_in,
9298            memory_in_name.as_ptr(),
9299            memory_in,
9300            access_in_name.as_ptr(),
9301            access_in,
9302            fail_on_in_name.as_ptr(),
9303            fail_on_in,
9304            revalidate_in_name.as_ptr(),
9305            revalidate_in,
9306            NULL,
9307        );
9308        utils::result(
9309            vips_op_response,
9310            VipsImage { ctx: out_out },
9311            Error::PpmloadError,
9312        )
9313    }
9314}
9315
9316/// VipsForeignLoadPpmBuffer (ppmload_buffer), load ppm from buffer (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_buffer, get_flags, header, load
9317/// buffer: `&[u8]` -> Buffer to load from
9318/// returns `VipsImage` - Output image
9319pub fn ppmload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9320    unsafe {
9321        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9322        let mut out_out: *mut bindings::VipsImage = null_mut();
9323
9324        let vips_op_response =
9325            bindings::vips_ppmload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9326        utils::result(
9327            vips_op_response,
9328            VipsImage { ctx: out_out },
9329            Error::PpmloadBufferError,
9330        )
9331    }
9332}
9333
9334/// Options for ppmload_buffer operation
9335#[derive(Clone, Debug)]
9336pub struct PpmloadBufferOptions {
9337    /// flags: `ForeignFlags` -> Flags for this file
9338    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9339    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9340    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9341    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9342    ///  `All` -> VIPS_FOREIGN_ALL = 7
9343    pub flags: ForeignFlags,
9344    /// memory: `bool` -> Force open via memory
9345    /// default: false
9346    pub memory: bool,
9347    /// access: `Access` -> Required access pattern for this file
9348    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9349    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9350    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9351    pub access: Access,
9352    /// fail_on: `FailOn` -> Error level to fail on
9353    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9354    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9355    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9356    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9357    pub fail_on: FailOn,
9358    /// revalidate: `bool` -> Don't use a cached result for this operation
9359    /// default: false
9360    pub revalidate: bool,
9361}
9362
9363impl std::default::Default for PpmloadBufferOptions {
9364    fn default() -> Self {
9365        PpmloadBufferOptions {
9366            flags: ForeignFlags::None,
9367            memory: false,
9368            access: Access::Random,
9369            fail_on: FailOn::None,
9370            revalidate: false,
9371        }
9372    }
9373}
9374
9375/// VipsForeignLoadPpmBuffer (ppmload_buffer), load ppm from buffer (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_buffer, get_flags, header, load
9376/// buffer: `&[u8]` -> Buffer to load from
9377/// ppmload_buffer_options: `&PpmloadBufferOptions` -> optional arguments
9378/// returns `VipsImage` - Output image
9379pub fn ppmload_buffer_with_opts(
9380    buffer: &[u8],
9381    ppmload_buffer_options: &PpmloadBufferOptions,
9382) -> Result<VipsImage> {
9383    unsafe {
9384        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9385        let mut out_out: *mut bindings::VipsImage = null_mut();
9386
9387        let flags_in: i32 = ppmload_buffer_options.flags as i32;
9388        let flags_in_name = utils::new_c_string("flags")?;
9389
9390        let memory_in: i32 = if ppmload_buffer_options.memory { 1 } else { 0 };
9391        let memory_in_name = utils::new_c_string("memory")?;
9392
9393        let access_in: i32 = ppmload_buffer_options.access as i32;
9394        let access_in_name = utils::new_c_string("access")?;
9395
9396        let fail_on_in: i32 = ppmload_buffer_options.fail_on as i32;
9397        let fail_on_in_name = utils::new_c_string("fail-on")?;
9398
9399        let revalidate_in: i32 = if ppmload_buffer_options.revalidate {
9400            1
9401        } else {
9402            0
9403        };
9404        let revalidate_in_name = utils::new_c_string("revalidate")?;
9405
9406        let vips_op_response = bindings::vips_ppmload_buffer(
9407            buffer_in,
9408            buffer.len() as u64,
9409            &mut out_out,
9410            flags_in_name.as_ptr(),
9411            flags_in,
9412            memory_in_name.as_ptr(),
9413            memory_in,
9414            access_in_name.as_ptr(),
9415            access_in,
9416            fail_on_in_name.as_ptr(),
9417            fail_on_in,
9418            revalidate_in_name.as_ptr(),
9419            revalidate_in,
9420            NULL,
9421        );
9422        utils::result(
9423            vips_op_response,
9424            VipsImage { ctx: out_out },
9425            Error::PpmloadBufferError,
9426        )
9427    }
9428}
9429
9430/// VipsForeignLoadPpmSource (ppmload_source), load ppm from source, nocache (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9431/// source: `&VipsSource` -> Source to load from
9432/// returns `VipsImage` - Output image
9433pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9434    unsafe {
9435        let source_in: *mut bindings::VipsSource = source.ctx;
9436        let mut out_out: *mut bindings::VipsImage = null_mut();
9437
9438        let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9439        utils::result(
9440            vips_op_response,
9441            VipsImage { ctx: out_out },
9442            Error::PpmloadSourceError,
9443        )
9444    }
9445}
9446
9447/// Options for ppmload_source operation
9448#[derive(Clone, Debug)]
9449pub struct PpmloadSourceOptions {
9450    /// flags: `ForeignFlags` -> Flags for this file
9451    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9452    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9453    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9454    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9455    ///  `All` -> VIPS_FOREIGN_ALL = 7
9456    pub flags: ForeignFlags,
9457    /// memory: `bool` -> Force open via memory
9458    /// default: false
9459    pub memory: bool,
9460    /// access: `Access` -> Required access pattern for this file
9461    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9462    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9463    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9464    pub access: Access,
9465    /// fail_on: `FailOn` -> Error level to fail on
9466    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9467    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9468    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9469    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9470    pub fail_on: FailOn,
9471    /// revalidate: `bool` -> Don't use a cached result for this operation
9472    /// default: false
9473    pub revalidate: bool,
9474}
9475
9476impl std::default::Default for PpmloadSourceOptions {
9477    fn default() -> Self {
9478        PpmloadSourceOptions {
9479            flags: ForeignFlags::None,
9480            memory: false,
9481            access: Access::Random,
9482            fail_on: FailOn::None,
9483            revalidate: false,
9484        }
9485    }
9486}
9487
9488/// VipsForeignLoadPpmSource (ppmload_source), load ppm from source, nocache (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9489/// source: `&VipsSource` -> Source to load from
9490/// ppmload_source_options: `&PpmloadSourceOptions` -> optional arguments
9491/// returns `VipsImage` - Output image
9492pub fn ppmload_source_with_opts(
9493    source: &VipsSource,
9494    ppmload_source_options: &PpmloadSourceOptions,
9495) -> Result<VipsImage> {
9496    unsafe {
9497        let source_in: *mut bindings::VipsSource = source.ctx;
9498        let mut out_out: *mut bindings::VipsImage = null_mut();
9499
9500        let flags_in: i32 = ppmload_source_options.flags as i32;
9501        let flags_in_name = utils::new_c_string("flags")?;
9502
9503        let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9504        let memory_in_name = utils::new_c_string("memory")?;
9505
9506        let access_in: i32 = ppmload_source_options.access as i32;
9507        let access_in_name = utils::new_c_string("access")?;
9508
9509        let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9510        let fail_on_in_name = utils::new_c_string("fail-on")?;
9511
9512        let revalidate_in: i32 = if ppmload_source_options.revalidate {
9513            1
9514        } else {
9515            0
9516        };
9517        let revalidate_in_name = utils::new_c_string("revalidate")?;
9518
9519        let vips_op_response = bindings::vips_ppmload_source(
9520            source_in,
9521            &mut out_out,
9522            flags_in_name.as_ptr(),
9523            flags_in,
9524            memory_in_name.as_ptr(),
9525            memory_in,
9526            access_in_name.as_ptr(),
9527            access_in,
9528            fail_on_in_name.as_ptr(),
9529            fail_on_in,
9530            revalidate_in_name.as_ptr(),
9531            revalidate_in,
9532            NULL,
9533        );
9534        utils::result(
9535            vips_op_response,
9536            VipsImage { ctx: out_out },
9537            Error::PpmloadSourceError,
9538        )
9539    }
9540}
9541
9542/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9543/// filename: `&str` -> Filename to load from
9544/// returns `VipsImage` - Output image
9545pub fn radload(filename: &str) -> Result<VipsImage> {
9546    unsafe {
9547        let filename_in: CString = utils::new_c_string(filename)?;
9548        let mut out_out: *mut bindings::VipsImage = null_mut();
9549
9550        let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9551        utils::result(
9552            vips_op_response,
9553            VipsImage { ctx: out_out },
9554            Error::RadloadError,
9555        )
9556    }
9557}
9558
9559/// Options for radload operation
9560#[derive(Clone, Debug)]
9561pub struct RadloadOptions {
9562    /// flags: `ForeignFlags` -> Flags for this file
9563    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9564    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9565    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9566    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9567    ///  `All` -> VIPS_FOREIGN_ALL = 7
9568    pub flags: ForeignFlags,
9569    /// memory: `bool` -> Force open via memory
9570    /// default: false
9571    pub memory: bool,
9572    /// access: `Access` -> Required access pattern for this file
9573    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9574    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9575    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9576    pub access: Access,
9577    /// fail_on: `FailOn` -> Error level to fail on
9578    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9579    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9580    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9581    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9582    pub fail_on: FailOn,
9583    /// revalidate: `bool` -> Don't use a cached result for this operation
9584    /// default: false
9585    pub revalidate: bool,
9586}
9587
9588impl std::default::Default for RadloadOptions {
9589    fn default() -> Self {
9590        RadloadOptions {
9591            flags: ForeignFlags::None,
9592            memory: false,
9593            access: Access::Random,
9594            fail_on: FailOn::None,
9595            revalidate: false,
9596        }
9597    }
9598}
9599
9600/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9601/// filename: `&str` -> Filename to load from
9602/// radload_options: `&RadloadOptions` -> optional arguments
9603/// returns `VipsImage` - Output image
9604pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9605    unsafe {
9606        let filename_in: CString = utils::new_c_string(filename)?;
9607        let mut out_out: *mut bindings::VipsImage = null_mut();
9608
9609        let flags_in: i32 = radload_options.flags as i32;
9610        let flags_in_name = utils::new_c_string("flags")?;
9611
9612        let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9613        let memory_in_name = utils::new_c_string("memory")?;
9614
9615        let access_in: i32 = radload_options.access as i32;
9616        let access_in_name = utils::new_c_string("access")?;
9617
9618        let fail_on_in: i32 = radload_options.fail_on as i32;
9619        let fail_on_in_name = utils::new_c_string("fail-on")?;
9620
9621        let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9622        let revalidate_in_name = utils::new_c_string("revalidate")?;
9623
9624        let vips_op_response = bindings::vips_radload(
9625            filename_in.as_ptr(),
9626            &mut out_out,
9627            flags_in_name.as_ptr(),
9628            flags_in,
9629            memory_in_name.as_ptr(),
9630            memory_in,
9631            access_in_name.as_ptr(),
9632            access_in,
9633            fail_on_in_name.as_ptr(),
9634            fail_on_in,
9635            revalidate_in_name.as_ptr(),
9636            revalidate_in,
9637            NULL,
9638        );
9639        utils::result(
9640            vips_op_response,
9641            VipsImage { ctx: out_out },
9642            Error::RadloadError,
9643        )
9644    }
9645}
9646
9647/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9648/// buffer: `&[u8]` -> Buffer to load from
9649/// returns `VipsImage` - Output image
9650pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9651    unsafe {
9652        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9653        let mut out_out: *mut bindings::VipsImage = null_mut();
9654
9655        let vips_op_response =
9656            bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9657        utils::result(
9658            vips_op_response,
9659            VipsImage { ctx: out_out },
9660            Error::RadloadBufferError,
9661        )
9662    }
9663}
9664
9665/// Options for radload_buffer operation
9666#[derive(Clone, Debug)]
9667pub struct RadloadBufferOptions {
9668    /// flags: `ForeignFlags` -> Flags for this file
9669    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9670    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9671    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9672    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9673    ///  `All` -> VIPS_FOREIGN_ALL = 7
9674    pub flags: ForeignFlags,
9675    /// memory: `bool` -> Force open via memory
9676    /// default: false
9677    pub memory: bool,
9678    /// access: `Access` -> Required access pattern for this file
9679    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9680    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9681    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9682    pub access: Access,
9683    /// fail_on: `FailOn` -> Error level to fail on
9684    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9685    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9686    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9687    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9688    pub fail_on: FailOn,
9689    /// revalidate: `bool` -> Don't use a cached result for this operation
9690    /// default: false
9691    pub revalidate: bool,
9692}
9693
9694impl std::default::Default for RadloadBufferOptions {
9695    fn default() -> Self {
9696        RadloadBufferOptions {
9697            flags: ForeignFlags::None,
9698            memory: false,
9699            access: Access::Random,
9700            fail_on: FailOn::None,
9701            revalidate: false,
9702        }
9703    }
9704}
9705
9706/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9707/// buffer: `&[u8]` -> Buffer to load from
9708/// radload_buffer_options: `&RadloadBufferOptions` -> optional arguments
9709/// returns `VipsImage` - Output image
9710pub fn radload_buffer_with_opts(
9711    buffer: &[u8],
9712    radload_buffer_options: &RadloadBufferOptions,
9713) -> Result<VipsImage> {
9714    unsafe {
9715        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9716        let mut out_out: *mut bindings::VipsImage = null_mut();
9717
9718        let flags_in: i32 = radload_buffer_options.flags as i32;
9719        let flags_in_name = utils::new_c_string("flags")?;
9720
9721        let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9722        let memory_in_name = utils::new_c_string("memory")?;
9723
9724        let access_in: i32 = radload_buffer_options.access as i32;
9725        let access_in_name = utils::new_c_string("access")?;
9726
9727        let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9728        let fail_on_in_name = utils::new_c_string("fail-on")?;
9729
9730        let revalidate_in: i32 = if radload_buffer_options.revalidate {
9731            1
9732        } else {
9733            0
9734        };
9735        let revalidate_in_name = utils::new_c_string("revalidate")?;
9736
9737        let vips_op_response = bindings::vips_radload_buffer(
9738            buffer_in,
9739            buffer.len() as u64,
9740            &mut out_out,
9741            flags_in_name.as_ptr(),
9742            flags_in,
9743            memory_in_name.as_ptr(),
9744            memory_in,
9745            access_in_name.as_ptr(),
9746            access_in,
9747            fail_on_in_name.as_ptr(),
9748            fail_on_in,
9749            revalidate_in_name.as_ptr(),
9750            revalidate_in,
9751            NULL,
9752        );
9753        utils::result(
9754            vips_op_response,
9755            VipsImage { ctx: out_out },
9756            Error::RadloadBufferError,
9757        )
9758    }
9759}
9760
9761/// VipsForeignLoadRadSource (radload_source), load rad from source, nocache, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9762/// source: `&VipsSource` -> Source to load from
9763/// returns `VipsImage` - Output image
9764pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9765    unsafe {
9766        let source_in: *mut bindings::VipsSource = source.ctx;
9767        let mut out_out: *mut bindings::VipsImage = null_mut();
9768
9769        let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9770        utils::result(
9771            vips_op_response,
9772            VipsImage { ctx: out_out },
9773            Error::RadloadSourceError,
9774        )
9775    }
9776}
9777
9778/// Options for radload_source operation
9779#[derive(Clone, Debug)]
9780pub struct RadloadSourceOptions {
9781    /// flags: `ForeignFlags` -> Flags for this file
9782    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9783    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9784    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9785    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9786    ///  `All` -> VIPS_FOREIGN_ALL = 7
9787    pub flags: ForeignFlags,
9788    /// memory: `bool` -> Force open via memory
9789    /// default: false
9790    pub memory: bool,
9791    /// access: `Access` -> Required access pattern for this file
9792    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9793    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9794    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9795    pub access: Access,
9796    /// fail_on: `FailOn` -> Error level to fail on
9797    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9798    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9799    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9800    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9801    pub fail_on: FailOn,
9802    /// revalidate: `bool` -> Don't use a cached result for this operation
9803    /// default: false
9804    pub revalidate: bool,
9805}
9806
9807impl std::default::Default for RadloadSourceOptions {
9808    fn default() -> Self {
9809        RadloadSourceOptions {
9810            flags: ForeignFlags::None,
9811            memory: false,
9812            access: Access::Random,
9813            fail_on: FailOn::None,
9814            revalidate: false,
9815        }
9816    }
9817}
9818
9819/// VipsForeignLoadRadSource (radload_source), load rad from source, nocache, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9820/// source: `&VipsSource` -> Source to load from
9821/// radload_source_options: `&RadloadSourceOptions` -> optional arguments
9822/// returns `VipsImage` - Output image
9823pub fn radload_source_with_opts(
9824    source: &VipsSource,
9825    radload_source_options: &RadloadSourceOptions,
9826) -> Result<VipsImage> {
9827    unsafe {
9828        let source_in: *mut bindings::VipsSource = source.ctx;
9829        let mut out_out: *mut bindings::VipsImage = null_mut();
9830
9831        let flags_in: i32 = radload_source_options.flags as i32;
9832        let flags_in_name = utils::new_c_string("flags")?;
9833
9834        let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9835        let memory_in_name = utils::new_c_string("memory")?;
9836
9837        let access_in: i32 = radload_source_options.access as i32;
9838        let access_in_name = utils::new_c_string("access")?;
9839
9840        let fail_on_in: i32 = radload_source_options.fail_on as i32;
9841        let fail_on_in_name = utils::new_c_string("fail-on")?;
9842
9843        let revalidate_in: i32 = if radload_source_options.revalidate {
9844            1
9845        } else {
9846            0
9847        };
9848        let revalidate_in_name = utils::new_c_string("revalidate")?;
9849
9850        let vips_op_response = bindings::vips_radload_source(
9851            source_in,
9852            &mut out_out,
9853            flags_in_name.as_ptr(),
9854            flags_in,
9855            memory_in_name.as_ptr(),
9856            memory_in,
9857            access_in_name.as_ptr(),
9858            access_in,
9859            fail_on_in_name.as_ptr(),
9860            fail_on_in,
9861            revalidate_in_name.as_ptr(),
9862            revalidate_in,
9863            NULL,
9864        );
9865        utils::result(
9866            vips_op_response,
9867            VipsImage { ctx: out_out },
9868            Error::RadloadSourceError,
9869        )
9870    }
9871}
9872
9873/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9874/// filename: `&str` -> Filename to load from
9875/// returns `VipsImage` - Output image
9876pub fn svgload(filename: &str) -> Result<VipsImage> {
9877    unsafe {
9878        let filename_in: CString = utils::new_c_string(filename)?;
9879        let mut out_out: *mut bindings::VipsImage = null_mut();
9880
9881        let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9882        utils::result(
9883            vips_op_response,
9884            VipsImage { ctx: out_out },
9885            Error::SvgloadError,
9886        )
9887    }
9888}
9889
9890/// Options for svgload operation
9891#[derive(Clone, Debug)]
9892pub struct SvgloadOptions {
9893    /// dpi: `f64` -> Render at this DPI
9894    /// min: 0.001, max: 100000, default: 72
9895    pub dpi: f64,
9896    /// scale: `f64` -> Scale output by this factor
9897    /// min: 0, max: 100000, default: 1
9898    pub scale: f64,
9899    /// unlimited: `bool` -> Allow SVG of any size
9900    /// default: false
9901    pub unlimited: bool,
9902    /// stylesheet: `String` -> Custom CSS
9903    pub stylesheet: String,
9904    /// high_bitdepth: `bool` -> Enable scRGB 128-bit output (32-bit per channel)
9905    /// default: false
9906    pub high_bitdepth: bool,
9907    /// flags: `ForeignFlags` -> Flags for this file
9908    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9909    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9910    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9911    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9912    ///  `All` -> VIPS_FOREIGN_ALL = 7
9913    pub flags: ForeignFlags,
9914    /// memory: `bool` -> Force open via memory
9915    /// default: false
9916    pub memory: bool,
9917    /// access: `Access` -> Required access pattern for this file
9918    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9919    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9920    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9921    pub access: Access,
9922    /// fail_on: `FailOn` -> Error level to fail on
9923    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9924    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9925    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9926    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9927    pub fail_on: FailOn,
9928    /// revalidate: `bool` -> Don't use a cached result for this operation
9929    /// default: false
9930    pub revalidate: bool,
9931}
9932
9933impl std::default::Default for SvgloadOptions {
9934    fn default() -> Self {
9935        SvgloadOptions {
9936            dpi: f64::from(72),
9937            scale: f64::from(1),
9938            unlimited: false,
9939            stylesheet: String::new(),
9940            high_bitdepth: false,
9941            flags: ForeignFlags::None,
9942            memory: false,
9943            access: Access::Random,
9944            fail_on: FailOn::None,
9945            revalidate: false,
9946        }
9947    }
9948}
9949
9950/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9951/// filename: `&str` -> Filename to load from
9952/// svgload_options: `&SvgloadOptions` -> optional arguments
9953/// returns `VipsImage` - Output image
9954pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9955    unsafe {
9956        let filename_in: CString = utils::new_c_string(filename)?;
9957        let mut out_out: *mut bindings::VipsImage = null_mut();
9958
9959        let dpi_in: f64 = svgload_options.dpi;
9960        let dpi_in_name = utils::new_c_string("dpi")?;
9961
9962        let scale_in: f64 = svgload_options.scale;
9963        let scale_in_name = utils::new_c_string("scale")?;
9964
9965        let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9966        let unlimited_in_name = utils::new_c_string("unlimited")?;
9967
9968        let stylesheet_in: CString = utils::new_c_string(&svgload_options.stylesheet)?;
9969        let stylesheet_in_name = utils::new_c_string("stylesheet")?;
9970
9971        let high_bitdepth_in: i32 = if svgload_options.high_bitdepth { 1 } else { 0 };
9972        let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
9973
9974        let flags_in: i32 = svgload_options.flags as i32;
9975        let flags_in_name = utils::new_c_string("flags")?;
9976
9977        let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9978        let memory_in_name = utils::new_c_string("memory")?;
9979
9980        let access_in: i32 = svgload_options.access as i32;
9981        let access_in_name = utils::new_c_string("access")?;
9982
9983        let fail_on_in: i32 = svgload_options.fail_on as i32;
9984        let fail_on_in_name = utils::new_c_string("fail-on")?;
9985
9986        let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9987        let revalidate_in_name = utils::new_c_string("revalidate")?;
9988
9989        let vips_op_response = bindings::vips_svgload(
9990            filename_in.as_ptr(),
9991            &mut out_out,
9992            dpi_in_name.as_ptr(),
9993            dpi_in,
9994            scale_in_name.as_ptr(),
9995            scale_in,
9996            unlimited_in_name.as_ptr(),
9997            unlimited_in,
9998            stylesheet_in_name.as_ptr(),
9999            stylesheet_in.as_ptr(),
10000            high_bitdepth_in_name.as_ptr(),
10001            high_bitdepth_in,
10002            flags_in_name.as_ptr(),
10003            flags_in,
10004            memory_in_name.as_ptr(),
10005            memory_in,
10006            access_in_name.as_ptr(),
10007            access_in,
10008            fail_on_in_name.as_ptr(),
10009            fail_on_in,
10010            revalidate_in_name.as_ptr(),
10011            revalidate_in,
10012            NULL,
10013        );
10014        utils::result(
10015            vips_op_response,
10016            VipsImage { ctx: out_out },
10017            Error::SvgloadError,
10018        )
10019    }
10020}
10021
10022/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10023/// buffer: `&[u8]` -> Buffer to load from
10024/// returns `VipsImage` - Output image
10025pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10026    unsafe {
10027        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10028        let mut out_out: *mut bindings::VipsImage = null_mut();
10029
10030        let vips_op_response =
10031            bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10032        utils::result(
10033            vips_op_response,
10034            VipsImage { ctx: out_out },
10035            Error::SvgloadBufferError,
10036        )
10037    }
10038}
10039
10040/// Options for svgload_buffer operation
10041#[derive(Clone, Debug)]
10042pub struct SvgloadBufferOptions {
10043    /// dpi: `f64` -> Render at this DPI
10044    /// min: 0.001, max: 100000, default: 72
10045    pub dpi: f64,
10046    /// scale: `f64` -> Scale output by this factor
10047    /// min: 0, max: 100000, default: 1
10048    pub scale: f64,
10049    /// unlimited: `bool` -> Allow SVG of any size
10050    /// default: false
10051    pub unlimited: bool,
10052    /// stylesheet: `String` -> Custom CSS
10053    pub stylesheet: String,
10054    /// high_bitdepth: `bool` -> Enable scRGB 128-bit output (32-bit per channel)
10055    /// default: false
10056    pub high_bitdepth: bool,
10057    /// flags: `ForeignFlags` -> Flags for this file
10058    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10059    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10060    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10061    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10062    ///  `All` -> VIPS_FOREIGN_ALL = 7
10063    pub flags: ForeignFlags,
10064    /// memory: `bool` -> Force open via memory
10065    /// default: false
10066    pub memory: bool,
10067    /// access: `Access` -> Required access pattern for this file
10068    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10069    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10070    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10071    pub access: Access,
10072    /// fail_on: `FailOn` -> Error level to fail on
10073    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10074    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10075    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10076    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10077    pub fail_on: FailOn,
10078    /// revalidate: `bool` -> Don't use a cached result for this operation
10079    /// default: false
10080    pub revalidate: bool,
10081}
10082
10083impl std::default::Default for SvgloadBufferOptions {
10084    fn default() -> Self {
10085        SvgloadBufferOptions {
10086            dpi: f64::from(72),
10087            scale: f64::from(1),
10088            unlimited: false,
10089            stylesheet: String::new(),
10090            high_bitdepth: false,
10091            flags: ForeignFlags::None,
10092            memory: false,
10093            access: Access::Random,
10094            fail_on: FailOn::None,
10095            revalidate: false,
10096        }
10097    }
10098}
10099
10100/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
10101/// buffer: `&[u8]` -> Buffer to load from
10102/// svgload_buffer_options: `&SvgloadBufferOptions` -> optional arguments
10103/// returns `VipsImage` - Output image
10104pub fn svgload_buffer_with_opts(
10105    buffer: &[u8],
10106    svgload_buffer_options: &SvgloadBufferOptions,
10107) -> Result<VipsImage> {
10108    unsafe {
10109        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10110        let mut out_out: *mut bindings::VipsImage = null_mut();
10111
10112        let dpi_in: f64 = svgload_buffer_options.dpi;
10113        let dpi_in_name = utils::new_c_string("dpi")?;
10114
10115        let scale_in: f64 = svgload_buffer_options.scale;
10116        let scale_in_name = utils::new_c_string("scale")?;
10117
10118        let unlimited_in: i32 = if svgload_buffer_options.unlimited {
10119            1
10120        } else {
10121            0
10122        };
10123        let unlimited_in_name = utils::new_c_string("unlimited")?;
10124
10125        let stylesheet_in: CString = utils::new_c_string(&svgload_buffer_options.stylesheet)?;
10126        let stylesheet_in_name = utils::new_c_string("stylesheet")?;
10127
10128        let high_bitdepth_in: i32 = if svgload_buffer_options.high_bitdepth {
10129            1
10130        } else {
10131            0
10132        };
10133        let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
10134
10135        let flags_in: i32 = svgload_buffer_options.flags as i32;
10136        let flags_in_name = utils::new_c_string("flags")?;
10137
10138        let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
10139        let memory_in_name = utils::new_c_string("memory")?;
10140
10141        let access_in: i32 = svgload_buffer_options.access as i32;
10142        let access_in_name = utils::new_c_string("access")?;
10143
10144        let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
10145        let fail_on_in_name = utils::new_c_string("fail-on")?;
10146
10147        let revalidate_in: i32 = if svgload_buffer_options.revalidate {
10148            1
10149        } else {
10150            0
10151        };
10152        let revalidate_in_name = utils::new_c_string("revalidate")?;
10153
10154        let vips_op_response = bindings::vips_svgload_buffer(
10155            buffer_in,
10156            buffer.len() as u64,
10157            &mut out_out,
10158            dpi_in_name.as_ptr(),
10159            dpi_in,
10160            scale_in_name.as_ptr(),
10161            scale_in,
10162            unlimited_in_name.as_ptr(),
10163            unlimited_in,
10164            stylesheet_in_name.as_ptr(),
10165            stylesheet_in.as_ptr(),
10166            high_bitdepth_in_name.as_ptr(),
10167            high_bitdepth_in,
10168            flags_in_name.as_ptr(),
10169            flags_in,
10170            memory_in_name.as_ptr(),
10171            memory_in,
10172            access_in_name.as_ptr(),
10173            access_in,
10174            fail_on_in_name.as_ptr(),
10175            fail_on_in,
10176            revalidate_in_name.as_ptr(),
10177            revalidate_in,
10178            NULL,
10179        );
10180        utils::result(
10181            vips_op_response,
10182            VipsImage { ctx: out_out },
10183            Error::SvgloadBufferError,
10184        )
10185    }
10186}
10187
10188/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10189/// filename: `&str` -> Filename to load from
10190/// returns `VipsImage` - Output image
10191pub fn gifload(filename: &str) -> Result<VipsImage> {
10192    unsafe {
10193        let filename_in: CString = utils::new_c_string(filename)?;
10194        let mut out_out: *mut bindings::VipsImage = null_mut();
10195
10196        let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10197        utils::result(
10198            vips_op_response,
10199            VipsImage { ctx: out_out },
10200            Error::GifloadError,
10201        )
10202    }
10203}
10204
10205/// Options for gifload operation
10206#[derive(Clone, Debug)]
10207pub struct GifloadOptions {
10208    /// n: `i32` -> Number of pages to load, -1 for all
10209    /// min: -1, max: 100000, default: 1
10210    pub n: i32,
10211    /// page: `i32` -> First page to load
10212    /// min: 0, max: 100000, default: 0
10213    pub page: i32,
10214    /// flags: `ForeignFlags` -> Flags for this file
10215    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10216    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10217    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10218    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10219    ///  `All` -> VIPS_FOREIGN_ALL = 7
10220    pub flags: ForeignFlags,
10221    /// memory: `bool` -> Force open via memory
10222    /// default: false
10223    pub memory: bool,
10224    /// access: `Access` -> Required access pattern for this file
10225    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10226    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10227    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10228    pub access: Access,
10229    /// fail_on: `FailOn` -> Error level to fail on
10230    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10231    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10232    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10233    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10234    pub fail_on: FailOn,
10235    /// revalidate: `bool` -> Don't use a cached result for this operation
10236    /// default: false
10237    pub revalidate: bool,
10238}
10239
10240impl std::default::Default for GifloadOptions {
10241    fn default() -> Self {
10242        GifloadOptions {
10243            n: i32::from(1),
10244            page: i32::from(0),
10245            flags: ForeignFlags::None,
10246            memory: false,
10247            access: Access::Random,
10248            fail_on: FailOn::None,
10249            revalidate: false,
10250        }
10251    }
10252}
10253
10254/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10255/// filename: `&str` -> Filename to load from
10256/// gifload_options: `&GifloadOptions` -> optional arguments
10257/// returns `VipsImage` - Output image
10258pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10259    unsafe {
10260        let filename_in: CString = utils::new_c_string(filename)?;
10261        let mut out_out: *mut bindings::VipsImage = null_mut();
10262
10263        let n_in: i32 = gifload_options.n;
10264        let n_in_name = utils::new_c_string("n")?;
10265
10266        let page_in: i32 = gifload_options.page;
10267        let page_in_name = utils::new_c_string("page")?;
10268
10269        let flags_in: i32 = gifload_options.flags as i32;
10270        let flags_in_name = utils::new_c_string("flags")?;
10271
10272        let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10273        let memory_in_name = utils::new_c_string("memory")?;
10274
10275        let access_in: i32 = gifload_options.access as i32;
10276        let access_in_name = utils::new_c_string("access")?;
10277
10278        let fail_on_in: i32 = gifload_options.fail_on as i32;
10279        let fail_on_in_name = utils::new_c_string("fail-on")?;
10280
10281        let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10282        let revalidate_in_name = utils::new_c_string("revalidate")?;
10283
10284        let vips_op_response = bindings::vips_gifload(
10285            filename_in.as_ptr(),
10286            &mut out_out,
10287            n_in_name.as_ptr(),
10288            n_in,
10289            page_in_name.as_ptr(),
10290            page_in,
10291            flags_in_name.as_ptr(),
10292            flags_in,
10293            memory_in_name.as_ptr(),
10294            memory_in,
10295            access_in_name.as_ptr(),
10296            access_in,
10297            fail_on_in_name.as_ptr(),
10298            fail_on_in,
10299            revalidate_in_name.as_ptr(),
10300            revalidate_in,
10301            NULL,
10302        );
10303        utils::result(
10304            vips_op_response,
10305            VipsImage { ctx: out_out },
10306            Error::GifloadError,
10307        )
10308    }
10309}
10310
10311/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10312/// buffer: `&[u8]` -> Buffer to load from
10313/// returns `VipsImage` - Output image
10314pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10315    unsafe {
10316        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10317        let mut out_out: *mut bindings::VipsImage = null_mut();
10318
10319        let vips_op_response =
10320            bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10321        utils::result(
10322            vips_op_response,
10323            VipsImage { ctx: out_out },
10324            Error::GifloadBufferError,
10325        )
10326    }
10327}
10328
10329/// Options for gifload_buffer operation
10330#[derive(Clone, Debug)]
10331pub struct GifloadBufferOptions {
10332    /// n: `i32` -> Number of pages to load, -1 for all
10333    /// min: -1, max: 100000, default: 1
10334    pub n: i32,
10335    /// page: `i32` -> First page to load
10336    /// min: 0, max: 100000, default: 0
10337    pub page: i32,
10338    /// flags: `ForeignFlags` -> Flags for this file
10339    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10340    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10341    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10342    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10343    ///  `All` -> VIPS_FOREIGN_ALL = 7
10344    pub flags: ForeignFlags,
10345    /// memory: `bool` -> Force open via memory
10346    /// default: false
10347    pub memory: bool,
10348    /// access: `Access` -> Required access pattern for this file
10349    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10350    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10351    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10352    pub access: Access,
10353    /// fail_on: `FailOn` -> Error level to fail on
10354    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10355    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10356    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10357    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10358    pub fail_on: FailOn,
10359    /// revalidate: `bool` -> Don't use a cached result for this operation
10360    /// default: false
10361    pub revalidate: bool,
10362}
10363
10364impl std::default::Default for GifloadBufferOptions {
10365    fn default() -> Self {
10366        GifloadBufferOptions {
10367            n: i32::from(1),
10368            page: i32::from(0),
10369            flags: ForeignFlags::None,
10370            memory: false,
10371            access: Access::Random,
10372            fail_on: FailOn::None,
10373            revalidate: false,
10374        }
10375    }
10376}
10377
10378/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10379/// buffer: `&[u8]` -> Buffer to load from
10380/// gifload_buffer_options: `&GifloadBufferOptions` -> optional arguments
10381/// returns `VipsImage` - Output image
10382pub fn gifload_buffer_with_opts(
10383    buffer: &[u8],
10384    gifload_buffer_options: &GifloadBufferOptions,
10385) -> Result<VipsImage> {
10386    unsafe {
10387        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10388        let mut out_out: *mut bindings::VipsImage = null_mut();
10389
10390        let n_in: i32 = gifload_buffer_options.n;
10391        let n_in_name = utils::new_c_string("n")?;
10392
10393        let page_in: i32 = gifload_buffer_options.page;
10394        let page_in_name = utils::new_c_string("page")?;
10395
10396        let flags_in: i32 = gifload_buffer_options.flags as i32;
10397        let flags_in_name = utils::new_c_string("flags")?;
10398
10399        let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10400        let memory_in_name = utils::new_c_string("memory")?;
10401
10402        let access_in: i32 = gifload_buffer_options.access as i32;
10403        let access_in_name = utils::new_c_string("access")?;
10404
10405        let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10406        let fail_on_in_name = utils::new_c_string("fail-on")?;
10407
10408        let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10409            1
10410        } else {
10411            0
10412        };
10413        let revalidate_in_name = utils::new_c_string("revalidate")?;
10414
10415        let vips_op_response = bindings::vips_gifload_buffer(
10416            buffer_in,
10417            buffer.len() as u64,
10418            &mut out_out,
10419            n_in_name.as_ptr(),
10420            n_in,
10421            page_in_name.as_ptr(),
10422            page_in,
10423            flags_in_name.as_ptr(),
10424            flags_in,
10425            memory_in_name.as_ptr(),
10426            memory_in,
10427            access_in_name.as_ptr(),
10428            access_in,
10429            fail_on_in_name.as_ptr(),
10430            fail_on_in,
10431            revalidate_in_name.as_ptr(),
10432            revalidate_in,
10433            NULL,
10434        );
10435        utils::result(
10436            vips_op_response,
10437            VipsImage { ctx: out_out },
10438            Error::GifloadBufferError,
10439        )
10440    }
10441}
10442
10443/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, nocache, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10444/// source: `&VipsSource` -> Source to load from
10445/// returns `VipsImage` - Output image
10446pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10447    unsafe {
10448        let source_in: *mut bindings::VipsSource = source.ctx;
10449        let mut out_out: *mut bindings::VipsImage = null_mut();
10450
10451        let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10452        utils::result(
10453            vips_op_response,
10454            VipsImage { ctx: out_out },
10455            Error::GifloadSourceError,
10456        )
10457    }
10458}
10459
10460/// Options for gifload_source operation
10461#[derive(Clone, Debug)]
10462pub struct GifloadSourceOptions {
10463    /// n: `i32` -> Number of pages to load, -1 for all
10464    /// min: -1, max: 100000, default: 1
10465    pub n: i32,
10466    /// page: `i32` -> First page to load
10467    /// min: 0, max: 100000, default: 0
10468    pub page: i32,
10469    /// flags: `ForeignFlags` -> Flags for this file
10470    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10471    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10472    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10473    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10474    ///  `All` -> VIPS_FOREIGN_ALL = 7
10475    pub flags: ForeignFlags,
10476    /// memory: `bool` -> Force open via memory
10477    /// default: false
10478    pub memory: bool,
10479    /// access: `Access` -> Required access pattern for this file
10480    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10481    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10482    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10483    pub access: Access,
10484    /// fail_on: `FailOn` -> Error level to fail on
10485    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10486    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10487    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10488    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10489    pub fail_on: FailOn,
10490    /// revalidate: `bool` -> Don't use a cached result for this operation
10491    /// default: false
10492    pub revalidate: bool,
10493}
10494
10495impl std::default::Default for GifloadSourceOptions {
10496    fn default() -> Self {
10497        GifloadSourceOptions {
10498            n: i32::from(1),
10499            page: i32::from(0),
10500            flags: ForeignFlags::None,
10501            memory: false,
10502            access: Access::Random,
10503            fail_on: FailOn::None,
10504            revalidate: false,
10505        }
10506    }
10507}
10508
10509/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, nocache, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10510/// source: `&VipsSource` -> Source to load from
10511/// gifload_source_options: `&GifloadSourceOptions` -> optional arguments
10512/// returns `VipsImage` - Output image
10513pub fn gifload_source_with_opts(
10514    source: &VipsSource,
10515    gifload_source_options: &GifloadSourceOptions,
10516) -> Result<VipsImage> {
10517    unsafe {
10518        let source_in: *mut bindings::VipsSource = source.ctx;
10519        let mut out_out: *mut bindings::VipsImage = null_mut();
10520
10521        let n_in: i32 = gifload_source_options.n;
10522        let n_in_name = utils::new_c_string("n")?;
10523
10524        let page_in: i32 = gifload_source_options.page;
10525        let page_in_name = utils::new_c_string("page")?;
10526
10527        let flags_in: i32 = gifload_source_options.flags as i32;
10528        let flags_in_name = utils::new_c_string("flags")?;
10529
10530        let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10531        let memory_in_name = utils::new_c_string("memory")?;
10532
10533        let access_in: i32 = gifload_source_options.access as i32;
10534        let access_in_name = utils::new_c_string("access")?;
10535
10536        let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10537        let fail_on_in_name = utils::new_c_string("fail-on")?;
10538
10539        let revalidate_in: i32 = if gifload_source_options.revalidate {
10540            1
10541        } else {
10542            0
10543        };
10544        let revalidate_in_name = utils::new_c_string("revalidate")?;
10545
10546        let vips_op_response = bindings::vips_gifload_source(
10547            source_in,
10548            &mut out_out,
10549            n_in_name.as_ptr(),
10550            n_in,
10551            page_in_name.as_ptr(),
10552            page_in,
10553            flags_in_name.as_ptr(),
10554            flags_in,
10555            memory_in_name.as_ptr(),
10556            memory_in,
10557            access_in_name.as_ptr(),
10558            access_in,
10559            fail_on_in_name.as_ptr(),
10560            fail_on_in,
10561            revalidate_in_name.as_ptr(),
10562            revalidate_in,
10563            NULL,
10564        );
10565        utils::result(
10566            vips_op_response,
10567            VipsImage { ctx: out_out },
10568            Error::GifloadSourceError,
10569        )
10570    }
10571}
10572
10573/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10574/// filename: `&str` -> Filename to load from
10575/// returns `VipsImage` - Output image
10576pub fn pngload(filename: &str) -> Result<VipsImage> {
10577    unsafe {
10578        let filename_in: CString = utils::new_c_string(filename)?;
10579        let mut out_out: *mut bindings::VipsImage = null_mut();
10580
10581        let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10582        utils::result(
10583            vips_op_response,
10584            VipsImage { ctx: out_out },
10585            Error::PngloadError,
10586        )
10587    }
10588}
10589
10590/// Options for pngload operation
10591#[derive(Clone, Debug)]
10592pub struct PngloadOptions {
10593    /// unlimited: `bool` -> Remove all denial of service limits
10594    /// default: false
10595    pub unlimited: bool,
10596    /// flags: `ForeignFlags` -> Flags for this file
10597    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10598    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10599    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10600    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10601    ///  `All` -> VIPS_FOREIGN_ALL = 7
10602    pub flags: ForeignFlags,
10603    /// memory: `bool` -> Force open via memory
10604    /// default: false
10605    pub memory: bool,
10606    /// access: `Access` -> Required access pattern for this file
10607    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10608    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10609    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10610    pub access: Access,
10611    /// fail_on: `FailOn` -> Error level to fail on
10612    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10613    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10614    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10615    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10616    pub fail_on: FailOn,
10617    /// revalidate: `bool` -> Don't use a cached result for this operation
10618    /// default: false
10619    pub revalidate: bool,
10620}
10621
10622impl std::default::Default for PngloadOptions {
10623    fn default() -> Self {
10624        PngloadOptions {
10625            unlimited: false,
10626            flags: ForeignFlags::None,
10627            memory: false,
10628            access: Access::Random,
10629            fail_on: FailOn::None,
10630            revalidate: false,
10631        }
10632    }
10633}
10634
10635/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10636/// filename: `&str` -> Filename to load from
10637/// pngload_options: `&PngloadOptions` -> optional arguments
10638/// returns `VipsImage` - Output image
10639pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10640    unsafe {
10641        let filename_in: CString = utils::new_c_string(filename)?;
10642        let mut out_out: *mut bindings::VipsImage = null_mut();
10643
10644        let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10645        let unlimited_in_name = utils::new_c_string("unlimited")?;
10646
10647        let flags_in: i32 = pngload_options.flags as i32;
10648        let flags_in_name = utils::new_c_string("flags")?;
10649
10650        let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10651        let memory_in_name = utils::new_c_string("memory")?;
10652
10653        let access_in: i32 = pngload_options.access as i32;
10654        let access_in_name = utils::new_c_string("access")?;
10655
10656        let fail_on_in: i32 = pngload_options.fail_on as i32;
10657        let fail_on_in_name = utils::new_c_string("fail-on")?;
10658
10659        let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10660        let revalidate_in_name = utils::new_c_string("revalidate")?;
10661
10662        let vips_op_response = bindings::vips_pngload(
10663            filename_in.as_ptr(),
10664            &mut out_out,
10665            unlimited_in_name.as_ptr(),
10666            unlimited_in,
10667            flags_in_name.as_ptr(),
10668            flags_in,
10669            memory_in_name.as_ptr(),
10670            memory_in,
10671            access_in_name.as_ptr(),
10672            access_in,
10673            fail_on_in_name.as_ptr(),
10674            fail_on_in,
10675            revalidate_in_name.as_ptr(),
10676            revalidate_in,
10677            NULL,
10678        );
10679        utils::result(
10680            vips_op_response,
10681            VipsImage { ctx: out_out },
10682            Error::PngloadError,
10683        )
10684    }
10685}
10686
10687/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10688/// buffer: `&[u8]` -> Buffer to load from
10689/// returns `VipsImage` - Output image
10690pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10691    unsafe {
10692        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10693        let mut out_out: *mut bindings::VipsImage = null_mut();
10694
10695        let vips_op_response =
10696            bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10697        utils::result(
10698            vips_op_response,
10699            VipsImage { ctx: out_out },
10700            Error::PngloadBufferError,
10701        )
10702    }
10703}
10704
10705/// Options for pngload_buffer operation
10706#[derive(Clone, Debug)]
10707pub struct PngloadBufferOptions {
10708    /// unlimited: `bool` -> Remove all denial of service limits
10709    /// default: false
10710    pub unlimited: bool,
10711    /// flags: `ForeignFlags` -> Flags for this file
10712    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10713    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10714    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10715    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10716    ///  `All` -> VIPS_FOREIGN_ALL = 7
10717    pub flags: ForeignFlags,
10718    /// memory: `bool` -> Force open via memory
10719    /// default: false
10720    pub memory: bool,
10721    /// access: `Access` -> Required access pattern for this file
10722    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10723    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10724    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10725    pub access: Access,
10726    /// fail_on: `FailOn` -> Error level to fail on
10727    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10728    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10729    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10730    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10731    pub fail_on: FailOn,
10732    /// revalidate: `bool` -> Don't use a cached result for this operation
10733    /// default: false
10734    pub revalidate: bool,
10735}
10736
10737impl std::default::Default for PngloadBufferOptions {
10738    fn default() -> Self {
10739        PngloadBufferOptions {
10740            unlimited: false,
10741            flags: ForeignFlags::None,
10742            memory: false,
10743            access: Access::Random,
10744            fail_on: FailOn::None,
10745            revalidate: false,
10746        }
10747    }
10748}
10749
10750/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
10751/// buffer: `&[u8]` -> Buffer to load from
10752/// pngload_buffer_options: `&PngloadBufferOptions` -> optional arguments
10753/// returns `VipsImage` - Output image
10754pub fn pngload_buffer_with_opts(
10755    buffer: &[u8],
10756    pngload_buffer_options: &PngloadBufferOptions,
10757) -> Result<VipsImage> {
10758    unsafe {
10759        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10760        let mut out_out: *mut bindings::VipsImage = null_mut();
10761
10762        let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10763            1
10764        } else {
10765            0
10766        };
10767        let unlimited_in_name = utils::new_c_string("unlimited")?;
10768
10769        let flags_in: i32 = pngload_buffer_options.flags as i32;
10770        let flags_in_name = utils::new_c_string("flags")?;
10771
10772        let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10773        let memory_in_name = utils::new_c_string("memory")?;
10774
10775        let access_in: i32 = pngload_buffer_options.access as i32;
10776        let access_in_name = utils::new_c_string("access")?;
10777
10778        let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10779        let fail_on_in_name = utils::new_c_string("fail-on")?;
10780
10781        let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10782            1
10783        } else {
10784            0
10785        };
10786        let revalidate_in_name = utils::new_c_string("revalidate")?;
10787
10788        let vips_op_response = bindings::vips_pngload_buffer(
10789            buffer_in,
10790            buffer.len() as u64,
10791            &mut out_out,
10792            unlimited_in_name.as_ptr(),
10793            unlimited_in,
10794            flags_in_name.as_ptr(),
10795            flags_in,
10796            memory_in_name.as_ptr(),
10797            memory_in,
10798            access_in_name.as_ptr(),
10799            access_in,
10800            fail_on_in_name.as_ptr(),
10801            fail_on_in,
10802            revalidate_in_name.as_ptr(),
10803            revalidate_in,
10804            NULL,
10805        );
10806        utils::result(
10807            vips_op_response,
10808            VipsImage { ctx: out_out },
10809            Error::PngloadBufferError,
10810        )
10811    }
10812}
10813
10814/// VipsForeignLoadPngSource (pngload_source), load png from source, nocache, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10815/// source: `&VipsSource` -> Source to load from
10816/// returns `VipsImage` - Output image
10817pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10818    unsafe {
10819        let source_in: *mut bindings::VipsSource = source.ctx;
10820        let mut out_out: *mut bindings::VipsImage = null_mut();
10821
10822        let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10823        utils::result(
10824            vips_op_response,
10825            VipsImage { ctx: out_out },
10826            Error::PngloadSourceError,
10827        )
10828    }
10829}
10830
10831/// Options for pngload_source operation
10832#[derive(Clone, Debug)]
10833pub struct PngloadSourceOptions {
10834    /// unlimited: `bool` -> Remove all denial of service limits
10835    /// default: false
10836    pub unlimited: bool,
10837    /// flags: `ForeignFlags` -> Flags for this file
10838    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10839    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10840    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10841    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10842    ///  `All` -> VIPS_FOREIGN_ALL = 7
10843    pub flags: ForeignFlags,
10844    /// memory: `bool` -> Force open via memory
10845    /// default: false
10846    pub memory: bool,
10847    /// access: `Access` -> Required access pattern for this file
10848    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10849    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10850    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10851    pub access: Access,
10852    /// fail_on: `FailOn` -> Error level to fail on
10853    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10854    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10855    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10856    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10857    pub fail_on: FailOn,
10858    /// revalidate: `bool` -> Don't use a cached result for this operation
10859    /// default: false
10860    pub revalidate: bool,
10861}
10862
10863impl std::default::Default for PngloadSourceOptions {
10864    fn default() -> Self {
10865        PngloadSourceOptions {
10866            unlimited: false,
10867            flags: ForeignFlags::None,
10868            memory: false,
10869            access: Access::Random,
10870            fail_on: FailOn::None,
10871            revalidate: false,
10872        }
10873    }
10874}
10875
10876/// VipsForeignLoadPngSource (pngload_source), load png from source, nocache, priority=200, is_a_source, get_flags, get_flags_filename, header, load
10877/// source: `&VipsSource` -> Source to load from
10878/// pngload_source_options: `&PngloadSourceOptions` -> optional arguments
10879/// returns `VipsImage` - Output image
10880pub fn pngload_source_with_opts(
10881    source: &VipsSource,
10882    pngload_source_options: &PngloadSourceOptions,
10883) -> Result<VipsImage> {
10884    unsafe {
10885        let source_in: *mut bindings::VipsSource = source.ctx;
10886        let mut out_out: *mut bindings::VipsImage = null_mut();
10887
10888        let unlimited_in: i32 = if pngload_source_options.unlimited {
10889            1
10890        } else {
10891            0
10892        };
10893        let unlimited_in_name = utils::new_c_string("unlimited")?;
10894
10895        let flags_in: i32 = pngload_source_options.flags as i32;
10896        let flags_in_name = utils::new_c_string("flags")?;
10897
10898        let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
10899        let memory_in_name = utils::new_c_string("memory")?;
10900
10901        let access_in: i32 = pngload_source_options.access as i32;
10902        let access_in_name = utils::new_c_string("access")?;
10903
10904        let fail_on_in: i32 = pngload_source_options.fail_on as i32;
10905        let fail_on_in_name = utils::new_c_string("fail-on")?;
10906
10907        let revalidate_in: i32 = if pngload_source_options.revalidate {
10908            1
10909        } else {
10910            0
10911        };
10912        let revalidate_in_name = utils::new_c_string("revalidate")?;
10913
10914        let vips_op_response = bindings::vips_pngload_source(
10915            source_in,
10916            &mut out_out,
10917            unlimited_in_name.as_ptr(),
10918            unlimited_in,
10919            flags_in_name.as_ptr(),
10920            flags_in,
10921            memory_in_name.as_ptr(),
10922            memory_in,
10923            access_in_name.as_ptr(),
10924            access_in,
10925            fail_on_in_name.as_ptr(),
10926            fail_on_in,
10927            revalidate_in_name.as_ptr(),
10928            revalidate_in,
10929            NULL,
10930        );
10931        utils::result(
10932            vips_op_response,
10933            VipsImage { ctx: out_out },
10934            Error::PngloadSourceError,
10935        )
10936    }
10937}
10938
10939/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
10940/// filename: `&str` -> Filename to load from
10941/// returns `VipsImage` - Output image
10942pub fn jpegload(filename: &str) -> Result<VipsImage> {
10943    unsafe {
10944        let filename_in: CString = utils::new_c_string(filename)?;
10945        let mut out_out: *mut bindings::VipsImage = null_mut();
10946
10947        let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
10948        utils::result(
10949            vips_op_response,
10950            VipsImage { ctx: out_out },
10951            Error::JpegloadError,
10952        )
10953    }
10954}
10955
10956/// Options for jpegload operation
10957#[derive(Clone, Debug)]
10958pub struct JpegloadOptions {
10959    /// shrink: `i32` -> Shrink factor on load
10960    /// min: 1, max: 8, default: 1
10961    pub shrink: i32,
10962    /// autorotate: `bool` -> Rotate image using exif orientation
10963    /// default: false
10964    pub autorotate: bool,
10965    /// unlimited: `bool` -> Remove all denial of service limits
10966    /// default: false
10967    pub unlimited: bool,
10968    /// flags: `ForeignFlags` -> Flags for this file
10969    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10970    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10971    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10972    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10973    ///  `All` -> VIPS_FOREIGN_ALL = 7
10974    pub flags: ForeignFlags,
10975    /// memory: `bool` -> Force open via memory
10976    /// default: false
10977    pub memory: bool,
10978    /// access: `Access` -> Required access pattern for this file
10979    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10980    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10981    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10982    pub access: Access,
10983    /// fail_on: `FailOn` -> Error level to fail on
10984    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10985    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10986    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10987    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10988    pub fail_on: FailOn,
10989    /// revalidate: `bool` -> Don't use a cached result for this operation
10990    /// default: false
10991    pub revalidate: bool,
10992}
10993
10994impl std::default::Default for JpegloadOptions {
10995    fn default() -> Self {
10996        JpegloadOptions {
10997            shrink: i32::from(1),
10998            autorotate: false,
10999            unlimited: false,
11000            flags: ForeignFlags::None,
11001            memory: false,
11002            access: Access::Random,
11003            fail_on: FailOn::None,
11004            revalidate: false,
11005        }
11006    }
11007}
11008
11009/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
11010/// filename: `&str` -> Filename to load from
11011/// jpegload_options: `&JpegloadOptions` -> optional arguments
11012/// returns `VipsImage` - Output image
11013pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11014    unsafe {
11015        let filename_in: CString = utils::new_c_string(filename)?;
11016        let mut out_out: *mut bindings::VipsImage = null_mut();
11017
11018        let shrink_in: i32 = jpegload_options.shrink;
11019        let shrink_in_name = utils::new_c_string("shrink")?;
11020
11021        let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11022        let autorotate_in_name = utils::new_c_string("autorotate")?;
11023
11024        let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11025        let unlimited_in_name = utils::new_c_string("unlimited")?;
11026
11027        let flags_in: i32 = jpegload_options.flags as i32;
11028        let flags_in_name = utils::new_c_string("flags")?;
11029
11030        let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11031        let memory_in_name = utils::new_c_string("memory")?;
11032
11033        let access_in: i32 = jpegload_options.access as i32;
11034        let access_in_name = utils::new_c_string("access")?;
11035
11036        let fail_on_in: i32 = jpegload_options.fail_on as i32;
11037        let fail_on_in_name = utils::new_c_string("fail-on")?;
11038
11039        let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11040        let revalidate_in_name = utils::new_c_string("revalidate")?;
11041
11042        let vips_op_response = bindings::vips_jpegload(
11043            filename_in.as_ptr(),
11044            &mut out_out,
11045            shrink_in_name.as_ptr(),
11046            shrink_in,
11047            autorotate_in_name.as_ptr(),
11048            autorotate_in,
11049            unlimited_in_name.as_ptr(),
11050            unlimited_in,
11051            flags_in_name.as_ptr(),
11052            flags_in,
11053            memory_in_name.as_ptr(),
11054            memory_in,
11055            access_in_name.as_ptr(),
11056            access_in,
11057            fail_on_in_name.as_ptr(),
11058            fail_on_in,
11059            revalidate_in_name.as_ptr(),
11060            revalidate_in,
11061            NULL,
11062        );
11063        utils::result(
11064            vips_op_response,
11065            VipsImage { ctx: out_out },
11066            Error::JpegloadError,
11067        )
11068    }
11069}
11070
11071/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11072/// buffer: `&[u8]` -> Buffer to load from
11073/// returns `VipsImage` - Output image
11074pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11075    unsafe {
11076        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11077        let mut out_out: *mut bindings::VipsImage = null_mut();
11078
11079        let vips_op_response =
11080            bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11081        utils::result(
11082            vips_op_response,
11083            VipsImage { ctx: out_out },
11084            Error::JpegloadBufferError,
11085        )
11086    }
11087}
11088
11089/// Options for jpegload_buffer operation
11090#[derive(Clone, Debug)]
11091pub struct JpegloadBufferOptions {
11092    /// shrink: `i32` -> Shrink factor on load
11093    /// min: 1, max: 8, default: 1
11094    pub shrink: i32,
11095    /// autorotate: `bool` -> Rotate image using exif orientation
11096    /// default: false
11097    pub autorotate: bool,
11098    /// unlimited: `bool` -> Remove all denial of service limits
11099    /// default: false
11100    pub unlimited: bool,
11101    /// flags: `ForeignFlags` -> Flags for this file
11102    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11103    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11104    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11105    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11106    ///  `All` -> VIPS_FOREIGN_ALL = 7
11107    pub flags: ForeignFlags,
11108    /// memory: `bool` -> Force open via memory
11109    /// default: false
11110    pub memory: bool,
11111    /// access: `Access` -> Required access pattern for this file
11112    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11113    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11114    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11115    pub access: Access,
11116    /// fail_on: `FailOn` -> Error level to fail on
11117    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11118    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11119    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11120    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11121    pub fail_on: FailOn,
11122    /// revalidate: `bool` -> Don't use a cached result for this operation
11123    /// default: false
11124    pub revalidate: bool,
11125}
11126
11127impl std::default::Default for JpegloadBufferOptions {
11128    fn default() -> Self {
11129        JpegloadBufferOptions {
11130            shrink: i32::from(1),
11131            autorotate: false,
11132            unlimited: false,
11133            flags: ForeignFlags::None,
11134            memory: false,
11135            access: Access::Random,
11136            fail_on: FailOn::None,
11137            revalidate: false,
11138        }
11139    }
11140}
11141
11142/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11143/// buffer: `&[u8]` -> Buffer to load from
11144/// jpegload_buffer_options: `&JpegloadBufferOptions` -> optional arguments
11145/// returns `VipsImage` - Output image
11146pub fn jpegload_buffer_with_opts(
11147    buffer: &[u8],
11148    jpegload_buffer_options: &JpegloadBufferOptions,
11149) -> Result<VipsImage> {
11150    unsafe {
11151        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11152        let mut out_out: *mut bindings::VipsImage = null_mut();
11153
11154        let shrink_in: i32 = jpegload_buffer_options.shrink;
11155        let shrink_in_name = utils::new_c_string("shrink")?;
11156
11157        let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11158            1
11159        } else {
11160            0
11161        };
11162        let autorotate_in_name = utils::new_c_string("autorotate")?;
11163
11164        let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11165            1
11166        } else {
11167            0
11168        };
11169        let unlimited_in_name = utils::new_c_string("unlimited")?;
11170
11171        let flags_in: i32 = jpegload_buffer_options.flags as i32;
11172        let flags_in_name = utils::new_c_string("flags")?;
11173
11174        let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11175        let memory_in_name = utils::new_c_string("memory")?;
11176
11177        let access_in: i32 = jpegload_buffer_options.access as i32;
11178        let access_in_name = utils::new_c_string("access")?;
11179
11180        let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11181        let fail_on_in_name = utils::new_c_string("fail-on")?;
11182
11183        let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11184            1
11185        } else {
11186            0
11187        };
11188        let revalidate_in_name = utils::new_c_string("revalidate")?;
11189
11190        let vips_op_response = bindings::vips_jpegload_buffer(
11191            buffer_in,
11192            buffer.len() as u64,
11193            &mut out_out,
11194            shrink_in_name.as_ptr(),
11195            shrink_in,
11196            autorotate_in_name.as_ptr(),
11197            autorotate_in,
11198            unlimited_in_name.as_ptr(),
11199            unlimited_in,
11200            flags_in_name.as_ptr(),
11201            flags_in,
11202            memory_in_name.as_ptr(),
11203            memory_in,
11204            access_in_name.as_ptr(),
11205            access_in,
11206            fail_on_in_name.as_ptr(),
11207            fail_on_in,
11208            revalidate_in_name.as_ptr(),
11209            revalidate_in,
11210            NULL,
11211        );
11212        utils::result(
11213            vips_op_response,
11214            VipsImage { ctx: out_out },
11215            Error::JpegloadBufferError,
11216        )
11217    }
11218}
11219
11220/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11221/// filename: `&str` -> Filename to load from
11222/// returns `VipsImage` - Output image
11223pub fn webpload(filename: &str) -> Result<VipsImage> {
11224    unsafe {
11225        let filename_in: CString = utils::new_c_string(filename)?;
11226        let mut out_out: *mut bindings::VipsImage = null_mut();
11227
11228        let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11229        utils::result(
11230            vips_op_response,
11231            VipsImage { ctx: out_out },
11232            Error::WebploadError,
11233        )
11234    }
11235}
11236
11237/// Options for webpload operation
11238#[derive(Clone, Debug)]
11239pub struct WebploadOptions {
11240    /// page: `i32` -> First page to load
11241    /// min: 0, max: 100000, default: 0
11242    pub page: i32,
11243    /// n: `i32` -> Number of pages to load, -1 for all
11244    /// min: -1, max: 100000, default: 1
11245    pub n: i32,
11246    /// scale: `f64` -> Factor to scale by
11247    /// min: 0, max: 1024, default: 1
11248    pub scale: f64,
11249    /// flags: `ForeignFlags` -> Flags for this file
11250    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11251    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11252    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11253    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11254    ///  `All` -> VIPS_FOREIGN_ALL = 7
11255    pub flags: ForeignFlags,
11256    /// memory: `bool` -> Force open via memory
11257    /// default: false
11258    pub memory: bool,
11259    /// access: `Access` -> Required access pattern for this file
11260    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11261    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11262    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11263    pub access: Access,
11264    /// fail_on: `FailOn` -> Error level to fail on
11265    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11266    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11267    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11268    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11269    pub fail_on: FailOn,
11270    /// revalidate: `bool` -> Don't use a cached result for this operation
11271    /// default: false
11272    pub revalidate: bool,
11273}
11274
11275impl std::default::Default for WebploadOptions {
11276    fn default() -> Self {
11277        WebploadOptions {
11278            page: i32::from(0),
11279            n: i32::from(1),
11280            scale: f64::from(1),
11281            flags: ForeignFlags::None,
11282            memory: false,
11283            access: Access::Random,
11284            fail_on: FailOn::None,
11285            revalidate: false,
11286        }
11287    }
11288}
11289
11290/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11291/// filename: `&str` -> Filename to load from
11292/// webpload_options: `&WebploadOptions` -> optional arguments
11293/// returns `VipsImage` - Output image
11294pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11295    unsafe {
11296        let filename_in: CString = utils::new_c_string(filename)?;
11297        let mut out_out: *mut bindings::VipsImage = null_mut();
11298
11299        let page_in: i32 = webpload_options.page;
11300        let page_in_name = utils::new_c_string("page")?;
11301
11302        let n_in: i32 = webpload_options.n;
11303        let n_in_name = utils::new_c_string("n")?;
11304
11305        let scale_in: f64 = webpload_options.scale;
11306        let scale_in_name = utils::new_c_string("scale")?;
11307
11308        let flags_in: i32 = webpload_options.flags as i32;
11309        let flags_in_name = utils::new_c_string("flags")?;
11310
11311        let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11312        let memory_in_name = utils::new_c_string("memory")?;
11313
11314        let access_in: i32 = webpload_options.access as i32;
11315        let access_in_name = utils::new_c_string("access")?;
11316
11317        let fail_on_in: i32 = webpload_options.fail_on as i32;
11318        let fail_on_in_name = utils::new_c_string("fail-on")?;
11319
11320        let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11321        let revalidate_in_name = utils::new_c_string("revalidate")?;
11322
11323        let vips_op_response = bindings::vips_webpload(
11324            filename_in.as_ptr(),
11325            &mut out_out,
11326            page_in_name.as_ptr(),
11327            page_in,
11328            n_in_name.as_ptr(),
11329            n_in,
11330            scale_in_name.as_ptr(),
11331            scale_in,
11332            flags_in_name.as_ptr(),
11333            flags_in,
11334            memory_in_name.as_ptr(),
11335            memory_in,
11336            access_in_name.as_ptr(),
11337            access_in,
11338            fail_on_in_name.as_ptr(),
11339            fail_on_in,
11340            revalidate_in_name.as_ptr(),
11341            revalidate_in,
11342            NULL,
11343        );
11344        utils::result(
11345            vips_op_response,
11346            VipsImage { ctx: out_out },
11347            Error::WebploadError,
11348        )
11349    }
11350}
11351
11352/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11353/// buffer: `&[u8]` -> Buffer to load from
11354/// returns `VipsImage` - Output image
11355pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11356    unsafe {
11357        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11358        let mut out_out: *mut bindings::VipsImage = null_mut();
11359
11360        let vips_op_response =
11361            bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11362        utils::result(
11363            vips_op_response,
11364            VipsImage { ctx: out_out },
11365            Error::WebploadBufferError,
11366        )
11367    }
11368}
11369
11370/// Options for webpload_buffer operation
11371#[derive(Clone, Debug)]
11372pub struct WebploadBufferOptions {
11373    /// page: `i32` -> First page to load
11374    /// min: 0, max: 100000, default: 0
11375    pub page: i32,
11376    /// n: `i32` -> Number of pages to load, -1 for all
11377    /// min: -1, max: 100000, default: 1
11378    pub n: i32,
11379    /// scale: `f64` -> Factor to scale by
11380    /// min: 0, max: 1024, default: 1
11381    pub scale: f64,
11382    /// flags: `ForeignFlags` -> Flags for this file
11383    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11384    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11385    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11386    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11387    ///  `All` -> VIPS_FOREIGN_ALL = 7
11388    pub flags: ForeignFlags,
11389    /// memory: `bool` -> Force open via memory
11390    /// default: false
11391    pub memory: bool,
11392    /// access: `Access` -> Required access pattern for this file
11393    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11394    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11395    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11396    pub access: Access,
11397    /// fail_on: `FailOn` -> Error level to fail on
11398    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11399    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11400    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11401    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11402    pub fail_on: FailOn,
11403    /// revalidate: `bool` -> Don't use a cached result for this operation
11404    /// default: false
11405    pub revalidate: bool,
11406}
11407
11408impl std::default::Default for WebploadBufferOptions {
11409    fn default() -> Self {
11410        WebploadBufferOptions {
11411            page: i32::from(0),
11412            n: i32::from(1),
11413            scale: f64::from(1),
11414            flags: ForeignFlags::None,
11415            memory: false,
11416            access: Access::Random,
11417            fail_on: FailOn::None,
11418            revalidate: false,
11419        }
11420    }
11421}
11422
11423/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11424/// buffer: `&[u8]` -> Buffer to load from
11425/// webpload_buffer_options: `&WebploadBufferOptions` -> optional arguments
11426/// returns `VipsImage` - Output image
11427pub fn webpload_buffer_with_opts(
11428    buffer: &[u8],
11429    webpload_buffer_options: &WebploadBufferOptions,
11430) -> Result<VipsImage> {
11431    unsafe {
11432        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11433        let mut out_out: *mut bindings::VipsImage = null_mut();
11434
11435        let page_in: i32 = webpload_buffer_options.page;
11436        let page_in_name = utils::new_c_string("page")?;
11437
11438        let n_in: i32 = webpload_buffer_options.n;
11439        let n_in_name = utils::new_c_string("n")?;
11440
11441        let scale_in: f64 = webpload_buffer_options.scale;
11442        let scale_in_name = utils::new_c_string("scale")?;
11443
11444        let flags_in: i32 = webpload_buffer_options.flags as i32;
11445        let flags_in_name = utils::new_c_string("flags")?;
11446
11447        let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11448        let memory_in_name = utils::new_c_string("memory")?;
11449
11450        let access_in: i32 = webpload_buffer_options.access as i32;
11451        let access_in_name = utils::new_c_string("access")?;
11452
11453        let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11454        let fail_on_in_name = utils::new_c_string("fail-on")?;
11455
11456        let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11457            1
11458        } else {
11459            0
11460        };
11461        let revalidate_in_name = utils::new_c_string("revalidate")?;
11462
11463        let vips_op_response = bindings::vips_webpload_buffer(
11464            buffer_in,
11465            buffer.len() as u64,
11466            &mut out_out,
11467            page_in_name.as_ptr(),
11468            page_in,
11469            n_in_name.as_ptr(),
11470            n_in,
11471            scale_in_name.as_ptr(),
11472            scale_in,
11473            flags_in_name.as_ptr(),
11474            flags_in,
11475            memory_in_name.as_ptr(),
11476            memory_in,
11477            access_in_name.as_ptr(),
11478            access_in,
11479            fail_on_in_name.as_ptr(),
11480            fail_on_in,
11481            revalidate_in_name.as_ptr(),
11482            revalidate_in,
11483            NULL,
11484        );
11485        utils::result(
11486            vips_op_response,
11487            VipsImage { ctx: out_out },
11488            Error::WebploadBufferError,
11489        )
11490    }
11491}
11492
11493/// VipsForeignLoadWebpSource (webpload_source), load webp from source, nocache, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11494/// source: `&VipsSource` -> Source to load from
11495/// returns `VipsImage` - Output image
11496pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11497    unsafe {
11498        let source_in: *mut bindings::VipsSource = source.ctx;
11499        let mut out_out: *mut bindings::VipsImage = null_mut();
11500
11501        let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11502        utils::result(
11503            vips_op_response,
11504            VipsImage { ctx: out_out },
11505            Error::WebploadSourceError,
11506        )
11507    }
11508}
11509
11510/// Options for webpload_source operation
11511#[derive(Clone, Debug)]
11512pub struct WebploadSourceOptions {
11513    /// page: `i32` -> First page to load
11514    /// min: 0, max: 100000, default: 0
11515    pub page: i32,
11516    /// n: `i32` -> Number of pages to load, -1 for all
11517    /// min: -1, max: 100000, default: 1
11518    pub n: i32,
11519    /// scale: `f64` -> Factor to scale by
11520    /// min: 0, max: 1024, default: 1
11521    pub scale: f64,
11522    /// flags: `ForeignFlags` -> Flags for this file
11523    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11524    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11525    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11526    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11527    ///  `All` -> VIPS_FOREIGN_ALL = 7
11528    pub flags: ForeignFlags,
11529    /// memory: `bool` -> Force open via memory
11530    /// default: false
11531    pub memory: bool,
11532    /// access: `Access` -> Required access pattern for this file
11533    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11534    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11535    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11536    pub access: Access,
11537    /// fail_on: `FailOn` -> Error level to fail on
11538    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11539    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11540    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11541    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11542    pub fail_on: FailOn,
11543    /// revalidate: `bool` -> Don't use a cached result for this operation
11544    /// default: false
11545    pub revalidate: bool,
11546}
11547
11548impl std::default::Default for WebploadSourceOptions {
11549    fn default() -> Self {
11550        WebploadSourceOptions {
11551            page: i32::from(0),
11552            n: i32::from(1),
11553            scale: f64::from(1),
11554            flags: ForeignFlags::None,
11555            memory: false,
11556            access: Access::Random,
11557            fail_on: FailOn::None,
11558            revalidate: false,
11559        }
11560    }
11561}
11562
11563/// VipsForeignLoadWebpSource (webpload_source), load webp from source, nocache, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11564/// source: `&VipsSource` -> Source to load from
11565/// webpload_source_options: `&WebploadSourceOptions` -> optional arguments
11566/// returns `VipsImage` - Output image
11567pub fn webpload_source_with_opts(
11568    source: &VipsSource,
11569    webpload_source_options: &WebploadSourceOptions,
11570) -> Result<VipsImage> {
11571    unsafe {
11572        let source_in: *mut bindings::VipsSource = source.ctx;
11573        let mut out_out: *mut bindings::VipsImage = null_mut();
11574
11575        let page_in: i32 = webpload_source_options.page;
11576        let page_in_name = utils::new_c_string("page")?;
11577
11578        let n_in: i32 = webpload_source_options.n;
11579        let n_in_name = utils::new_c_string("n")?;
11580
11581        let scale_in: f64 = webpload_source_options.scale;
11582        let scale_in_name = utils::new_c_string("scale")?;
11583
11584        let flags_in: i32 = webpload_source_options.flags as i32;
11585        let flags_in_name = utils::new_c_string("flags")?;
11586
11587        let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11588        let memory_in_name = utils::new_c_string("memory")?;
11589
11590        let access_in: i32 = webpload_source_options.access as i32;
11591        let access_in_name = utils::new_c_string("access")?;
11592
11593        let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11594        let fail_on_in_name = utils::new_c_string("fail-on")?;
11595
11596        let revalidate_in: i32 = if webpload_source_options.revalidate {
11597            1
11598        } else {
11599            0
11600        };
11601        let revalidate_in_name = utils::new_c_string("revalidate")?;
11602
11603        let vips_op_response = bindings::vips_webpload_source(
11604            source_in,
11605            &mut out_out,
11606            page_in_name.as_ptr(),
11607            page_in,
11608            n_in_name.as_ptr(),
11609            n_in,
11610            scale_in_name.as_ptr(),
11611            scale_in,
11612            flags_in_name.as_ptr(),
11613            flags_in,
11614            memory_in_name.as_ptr(),
11615            memory_in,
11616            access_in_name.as_ptr(),
11617            access_in,
11618            fail_on_in_name.as_ptr(),
11619            fail_on_in,
11620            revalidate_in_name.as_ptr(),
11621            revalidate_in,
11622            NULL,
11623        );
11624        utils::result(
11625            vips_op_response,
11626            VipsImage { ctx: out_out },
11627            Error::WebploadSourceError,
11628        )
11629    }
11630}
11631
11632/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11633/// filename: `&str` -> Filename to load from
11634/// returns `VipsImage` - Output image
11635pub fn tiffload(filename: &str) -> Result<VipsImage> {
11636    unsafe {
11637        let filename_in: CString = utils::new_c_string(filename)?;
11638        let mut out_out: *mut bindings::VipsImage = null_mut();
11639
11640        let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11641        utils::result(
11642            vips_op_response,
11643            VipsImage { ctx: out_out },
11644            Error::TiffloadError,
11645        )
11646    }
11647}
11648
11649/// Options for tiffload operation
11650#[derive(Clone, Debug)]
11651pub struct TiffloadOptions {
11652    /// page: `i32` -> First page to load
11653    /// min: 0, max: 100000, default: 0
11654    pub page: i32,
11655    /// n: `i32` -> Number of pages to load, -1 for all
11656    /// min: -1, max: 100000, default: 1
11657    pub n: i32,
11658    /// autorotate: `bool` -> Rotate image using orientation tag
11659    /// default: false
11660    pub autorotate: bool,
11661    /// subifd: `i32` -> Subifd index
11662    /// min: -1, max: 100000, default: -1
11663    pub subifd: i32,
11664    /// unlimited: `bool` -> Remove all denial of service limits
11665    /// default: false
11666    pub unlimited: bool,
11667    /// flags: `ForeignFlags` -> Flags for this file
11668    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11669    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11670    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11671    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11672    ///  `All` -> VIPS_FOREIGN_ALL = 7
11673    pub flags: ForeignFlags,
11674    /// memory: `bool` -> Force open via memory
11675    /// default: false
11676    pub memory: bool,
11677    /// access: `Access` -> Required access pattern for this file
11678    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11679    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11680    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11681    pub access: Access,
11682    /// fail_on: `FailOn` -> Error level to fail on
11683    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11684    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11685    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11686    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11687    pub fail_on: FailOn,
11688    /// revalidate: `bool` -> Don't use a cached result for this operation
11689    /// default: false
11690    pub revalidate: bool,
11691}
11692
11693impl std::default::Default for TiffloadOptions {
11694    fn default() -> Self {
11695        TiffloadOptions {
11696            page: i32::from(0),
11697            n: i32::from(1),
11698            autorotate: false,
11699            subifd: i32::from(-1),
11700            unlimited: false,
11701            flags: ForeignFlags::None,
11702            memory: false,
11703            access: Access::Random,
11704            fail_on: FailOn::None,
11705            revalidate: false,
11706        }
11707    }
11708}
11709
11710/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
11711/// filename: `&str` -> Filename to load from
11712/// tiffload_options: `&TiffloadOptions` -> optional arguments
11713/// returns `VipsImage` - Output image
11714pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11715    unsafe {
11716        let filename_in: CString = utils::new_c_string(filename)?;
11717        let mut out_out: *mut bindings::VipsImage = null_mut();
11718
11719        let page_in: i32 = tiffload_options.page;
11720        let page_in_name = utils::new_c_string("page")?;
11721
11722        let n_in: i32 = tiffload_options.n;
11723        let n_in_name = utils::new_c_string("n")?;
11724
11725        let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11726        let autorotate_in_name = utils::new_c_string("autorotate")?;
11727
11728        let subifd_in: i32 = tiffload_options.subifd;
11729        let subifd_in_name = utils::new_c_string("subifd")?;
11730
11731        let unlimited_in: i32 = if tiffload_options.unlimited { 1 } else { 0 };
11732        let unlimited_in_name = utils::new_c_string("unlimited")?;
11733
11734        let flags_in: i32 = tiffload_options.flags as i32;
11735        let flags_in_name = utils::new_c_string("flags")?;
11736
11737        let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11738        let memory_in_name = utils::new_c_string("memory")?;
11739
11740        let access_in: i32 = tiffload_options.access as i32;
11741        let access_in_name = utils::new_c_string("access")?;
11742
11743        let fail_on_in: i32 = tiffload_options.fail_on as i32;
11744        let fail_on_in_name = utils::new_c_string("fail-on")?;
11745
11746        let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11747        let revalidate_in_name = utils::new_c_string("revalidate")?;
11748
11749        let vips_op_response = bindings::vips_tiffload(
11750            filename_in.as_ptr(),
11751            &mut out_out,
11752            page_in_name.as_ptr(),
11753            page_in,
11754            n_in_name.as_ptr(),
11755            n_in,
11756            autorotate_in_name.as_ptr(),
11757            autorotate_in,
11758            subifd_in_name.as_ptr(),
11759            subifd_in,
11760            unlimited_in_name.as_ptr(),
11761            unlimited_in,
11762            flags_in_name.as_ptr(),
11763            flags_in,
11764            memory_in_name.as_ptr(),
11765            memory_in,
11766            access_in_name.as_ptr(),
11767            access_in,
11768            fail_on_in_name.as_ptr(),
11769            fail_on_in,
11770            revalidate_in_name.as_ptr(),
11771            revalidate_in,
11772            NULL,
11773        );
11774        utils::result(
11775            vips_op_response,
11776            VipsImage { ctx: out_out },
11777            Error::TiffloadError,
11778        )
11779    }
11780}
11781
11782/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11783/// buffer: `&[u8]` -> Buffer to load from
11784/// returns `VipsImage` - Output image
11785pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11786    unsafe {
11787        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11788        let mut out_out: *mut bindings::VipsImage = null_mut();
11789
11790        let vips_op_response =
11791            bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11792        utils::result(
11793            vips_op_response,
11794            VipsImage { ctx: out_out },
11795            Error::TiffloadBufferError,
11796        )
11797    }
11798}
11799
11800/// Options for tiffload_buffer operation
11801#[derive(Clone, Debug)]
11802pub struct TiffloadBufferOptions {
11803    /// page: `i32` -> First page to load
11804    /// min: 0, max: 100000, default: 0
11805    pub page: i32,
11806    /// n: `i32` -> Number of pages to load, -1 for all
11807    /// min: -1, max: 100000, default: 1
11808    pub n: i32,
11809    /// autorotate: `bool` -> Rotate image using orientation tag
11810    /// default: false
11811    pub autorotate: bool,
11812    /// subifd: `i32` -> Subifd index
11813    /// min: -1, max: 100000, default: -1
11814    pub subifd: i32,
11815    /// unlimited: `bool` -> Remove all denial of service limits
11816    /// default: false
11817    pub unlimited: bool,
11818    /// flags: `ForeignFlags` -> Flags for this file
11819    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11820    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11821    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11822    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11823    ///  `All` -> VIPS_FOREIGN_ALL = 7
11824    pub flags: ForeignFlags,
11825    /// memory: `bool` -> Force open via memory
11826    /// default: false
11827    pub memory: bool,
11828    /// access: `Access` -> Required access pattern for this file
11829    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11830    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11831    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11832    pub access: Access,
11833    /// fail_on: `FailOn` -> Error level to fail on
11834    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11835    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11836    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11837    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11838    pub fail_on: FailOn,
11839    /// revalidate: `bool` -> Don't use a cached result for this operation
11840    /// default: false
11841    pub revalidate: bool,
11842}
11843
11844impl std::default::Default for TiffloadBufferOptions {
11845    fn default() -> Self {
11846        TiffloadBufferOptions {
11847            page: i32::from(0),
11848            n: i32::from(1),
11849            autorotate: false,
11850            subifd: i32::from(-1),
11851            unlimited: false,
11852            flags: ForeignFlags::None,
11853            memory: false,
11854            access: Access::Random,
11855            fail_on: FailOn::None,
11856            revalidate: false,
11857        }
11858    }
11859}
11860
11861/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11862/// buffer: `&[u8]` -> Buffer to load from
11863/// tiffload_buffer_options: `&TiffloadBufferOptions` -> optional arguments
11864/// returns `VipsImage` - Output image
11865pub fn tiffload_buffer_with_opts(
11866    buffer: &[u8],
11867    tiffload_buffer_options: &TiffloadBufferOptions,
11868) -> Result<VipsImage> {
11869    unsafe {
11870        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11871        let mut out_out: *mut bindings::VipsImage = null_mut();
11872
11873        let page_in: i32 = tiffload_buffer_options.page;
11874        let page_in_name = utils::new_c_string("page")?;
11875
11876        let n_in: i32 = tiffload_buffer_options.n;
11877        let n_in_name = utils::new_c_string("n")?;
11878
11879        let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
11880            1
11881        } else {
11882            0
11883        };
11884        let autorotate_in_name = utils::new_c_string("autorotate")?;
11885
11886        let subifd_in: i32 = tiffload_buffer_options.subifd;
11887        let subifd_in_name = utils::new_c_string("subifd")?;
11888
11889        let unlimited_in: i32 = if tiffload_buffer_options.unlimited {
11890            1
11891        } else {
11892            0
11893        };
11894        let unlimited_in_name = utils::new_c_string("unlimited")?;
11895
11896        let flags_in: i32 = tiffload_buffer_options.flags as i32;
11897        let flags_in_name = utils::new_c_string("flags")?;
11898
11899        let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
11900        let memory_in_name = utils::new_c_string("memory")?;
11901
11902        let access_in: i32 = tiffload_buffer_options.access as i32;
11903        let access_in_name = utils::new_c_string("access")?;
11904
11905        let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
11906        let fail_on_in_name = utils::new_c_string("fail-on")?;
11907
11908        let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
11909            1
11910        } else {
11911            0
11912        };
11913        let revalidate_in_name = utils::new_c_string("revalidate")?;
11914
11915        let vips_op_response = bindings::vips_tiffload_buffer(
11916            buffer_in,
11917            buffer.len() as u64,
11918            &mut out_out,
11919            page_in_name.as_ptr(),
11920            page_in,
11921            n_in_name.as_ptr(),
11922            n_in,
11923            autorotate_in_name.as_ptr(),
11924            autorotate_in,
11925            subifd_in_name.as_ptr(),
11926            subifd_in,
11927            unlimited_in_name.as_ptr(),
11928            unlimited_in,
11929            flags_in_name.as_ptr(),
11930            flags_in,
11931            memory_in_name.as_ptr(),
11932            memory_in,
11933            access_in_name.as_ptr(),
11934            access_in,
11935            fail_on_in_name.as_ptr(),
11936            fail_on_in,
11937            revalidate_in_name.as_ptr(),
11938            revalidate_in,
11939            NULL,
11940        );
11941        utils::result(
11942            vips_op_response,
11943            VipsImage { ctx: out_out },
11944            Error::TiffloadBufferError,
11945        )
11946    }
11947}
11948
11949/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, nocache, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11950/// source: `&VipsSource` -> Source to load from
11951/// returns `VipsImage` - Output image
11952pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
11953    unsafe {
11954        let source_in: *mut bindings::VipsSource = source.ctx;
11955        let mut out_out: *mut bindings::VipsImage = null_mut();
11956
11957        let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
11958        utils::result(
11959            vips_op_response,
11960            VipsImage { ctx: out_out },
11961            Error::TiffloadSourceError,
11962        )
11963    }
11964}
11965
11966/// Options for tiffload_source operation
11967#[derive(Clone, Debug)]
11968pub struct TiffloadSourceOptions {
11969    /// page: `i32` -> First page to load
11970    /// min: 0, max: 100000, default: 0
11971    pub page: i32,
11972    /// n: `i32` -> Number of pages to load, -1 for all
11973    /// min: -1, max: 100000, default: 1
11974    pub n: i32,
11975    /// autorotate: `bool` -> Rotate image using orientation tag
11976    /// default: false
11977    pub autorotate: bool,
11978    /// subifd: `i32` -> Subifd index
11979    /// min: -1, max: 100000, default: -1
11980    pub subifd: i32,
11981    /// unlimited: `bool` -> Remove all denial of service limits
11982    /// default: false
11983    pub unlimited: bool,
11984    /// flags: `ForeignFlags` -> Flags for this file
11985    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11986    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11987    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11988    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11989    ///  `All` -> VIPS_FOREIGN_ALL = 7
11990    pub flags: ForeignFlags,
11991    /// memory: `bool` -> Force open via memory
11992    /// default: false
11993    pub memory: bool,
11994    /// access: `Access` -> Required access pattern for this file
11995    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11996    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11997    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11998    pub access: Access,
11999    /// fail_on: `FailOn` -> Error level to fail on
12000    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12001    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12002    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12003    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12004    pub fail_on: FailOn,
12005    /// revalidate: `bool` -> Don't use a cached result for this operation
12006    /// default: false
12007    pub revalidate: bool,
12008}
12009
12010impl std::default::Default for TiffloadSourceOptions {
12011    fn default() -> Self {
12012        TiffloadSourceOptions {
12013            page: i32::from(0),
12014            n: i32::from(1),
12015            autorotate: false,
12016            subifd: i32::from(-1),
12017            unlimited: false,
12018            flags: ForeignFlags::None,
12019            memory: false,
12020            access: Access::Random,
12021            fail_on: FailOn::None,
12022            revalidate: false,
12023        }
12024    }
12025}
12026
12027/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, nocache, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12028/// source: `&VipsSource` -> Source to load from
12029/// tiffload_source_options: `&TiffloadSourceOptions` -> optional arguments
12030/// returns `VipsImage` - Output image
12031pub fn tiffload_source_with_opts(
12032    source: &VipsSource,
12033    tiffload_source_options: &TiffloadSourceOptions,
12034) -> Result<VipsImage> {
12035    unsafe {
12036        let source_in: *mut bindings::VipsSource = source.ctx;
12037        let mut out_out: *mut bindings::VipsImage = null_mut();
12038
12039        let page_in: i32 = tiffload_source_options.page;
12040        let page_in_name = utils::new_c_string("page")?;
12041
12042        let n_in: i32 = tiffload_source_options.n;
12043        let n_in_name = utils::new_c_string("n")?;
12044
12045        let autorotate_in: i32 = if tiffload_source_options.autorotate {
12046            1
12047        } else {
12048            0
12049        };
12050        let autorotate_in_name = utils::new_c_string("autorotate")?;
12051
12052        let subifd_in: i32 = tiffload_source_options.subifd;
12053        let subifd_in_name = utils::new_c_string("subifd")?;
12054
12055        let unlimited_in: i32 = if tiffload_source_options.unlimited {
12056            1
12057        } else {
12058            0
12059        };
12060        let unlimited_in_name = utils::new_c_string("unlimited")?;
12061
12062        let flags_in: i32 = tiffload_source_options.flags as i32;
12063        let flags_in_name = utils::new_c_string("flags")?;
12064
12065        let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12066        let memory_in_name = utils::new_c_string("memory")?;
12067
12068        let access_in: i32 = tiffload_source_options.access as i32;
12069        let access_in_name = utils::new_c_string("access")?;
12070
12071        let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12072        let fail_on_in_name = utils::new_c_string("fail-on")?;
12073
12074        let revalidate_in: i32 = if tiffload_source_options.revalidate {
12075            1
12076        } else {
12077            0
12078        };
12079        let revalidate_in_name = utils::new_c_string("revalidate")?;
12080
12081        let vips_op_response = bindings::vips_tiffload_source(
12082            source_in,
12083            &mut out_out,
12084            page_in_name.as_ptr(),
12085            page_in,
12086            n_in_name.as_ptr(),
12087            n_in,
12088            autorotate_in_name.as_ptr(),
12089            autorotate_in,
12090            subifd_in_name.as_ptr(),
12091            subifd_in,
12092            unlimited_in_name.as_ptr(),
12093            unlimited_in,
12094            flags_in_name.as_ptr(),
12095            flags_in,
12096            memory_in_name.as_ptr(),
12097            memory_in,
12098            access_in_name.as_ptr(),
12099            access_in,
12100            fail_on_in_name.as_ptr(),
12101            fail_on_in,
12102            revalidate_in_name.as_ptr(),
12103            revalidate_in,
12104            NULL,
12105        );
12106        utils::result(
12107            vips_op_response,
12108            VipsImage { ctx: out_out },
12109            Error::TiffloadSourceError,
12110        )
12111    }
12112}
12113
12114/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12115/// filename: `&str` -> Filename to load from
12116/// returns `VipsImage` - Output image
12117pub fn heifload(filename: &str) -> Result<VipsImage> {
12118    unsafe {
12119        let filename_in: CString = utils::new_c_string(filename)?;
12120        let mut out_out: *mut bindings::VipsImage = null_mut();
12121
12122        let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12123        utils::result(
12124            vips_op_response,
12125            VipsImage { ctx: out_out },
12126            Error::HeifloadError,
12127        )
12128    }
12129}
12130
12131/// Options for heifload operation
12132#[derive(Clone, Debug)]
12133pub struct HeifloadOptions {
12134    /// page: `i32` -> First page to load
12135    /// min: 0, max: 100000, default: 0
12136    pub page: i32,
12137    /// n: `i32` -> Number of pages to load, -1 for all
12138    /// min: -1, max: 100000, default: 1
12139    pub n: i32,
12140    /// thumbnail: `bool` -> Fetch thumbnail image
12141    /// default: false
12142    pub thumbnail: bool,
12143    /// unlimited: `bool` -> Remove all denial of service limits
12144    /// default: false
12145    pub unlimited: bool,
12146    /// flags: `ForeignFlags` -> Flags for this file
12147    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12148    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12149    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12150    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12151    ///  `All` -> VIPS_FOREIGN_ALL = 7
12152    pub flags: ForeignFlags,
12153    /// memory: `bool` -> Force open via memory
12154    /// default: false
12155    pub memory: bool,
12156    /// access: `Access` -> Required access pattern for this file
12157    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12158    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12159    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12160    pub access: Access,
12161    /// fail_on: `FailOn` -> Error level to fail on
12162    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12163    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12164    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12165    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12166    pub fail_on: FailOn,
12167    /// revalidate: `bool` -> Don't use a cached result for this operation
12168    /// default: false
12169    pub revalidate: bool,
12170}
12171
12172impl std::default::Default for HeifloadOptions {
12173    fn default() -> Self {
12174        HeifloadOptions {
12175            page: i32::from(0),
12176            n: i32::from(1),
12177            thumbnail: false,
12178            unlimited: false,
12179            flags: ForeignFlags::None,
12180            memory: false,
12181            access: Access::Random,
12182            fail_on: FailOn::None,
12183            revalidate: false,
12184        }
12185    }
12186}
12187
12188/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12189/// filename: `&str` -> Filename to load from
12190/// heifload_options: `&HeifloadOptions` -> optional arguments
12191/// returns `VipsImage` - Output image
12192pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
12193    unsafe {
12194        let filename_in: CString = utils::new_c_string(filename)?;
12195        let mut out_out: *mut bindings::VipsImage = null_mut();
12196
12197        let page_in: i32 = heifload_options.page;
12198        let page_in_name = utils::new_c_string("page")?;
12199
12200        let n_in: i32 = heifload_options.n;
12201        let n_in_name = utils::new_c_string("n")?;
12202
12203        let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
12204        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12205
12206        let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
12207        let unlimited_in_name = utils::new_c_string("unlimited")?;
12208
12209        let flags_in: i32 = heifload_options.flags as i32;
12210        let flags_in_name = utils::new_c_string("flags")?;
12211
12212        let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12213        let memory_in_name = utils::new_c_string("memory")?;
12214
12215        let access_in: i32 = heifload_options.access as i32;
12216        let access_in_name = utils::new_c_string("access")?;
12217
12218        let fail_on_in: i32 = heifload_options.fail_on as i32;
12219        let fail_on_in_name = utils::new_c_string("fail-on")?;
12220
12221        let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12222        let revalidate_in_name = utils::new_c_string("revalidate")?;
12223
12224        let vips_op_response = bindings::vips_heifload(
12225            filename_in.as_ptr(),
12226            &mut out_out,
12227            page_in_name.as_ptr(),
12228            page_in,
12229            n_in_name.as_ptr(),
12230            n_in,
12231            thumbnail_in_name.as_ptr(),
12232            thumbnail_in,
12233            unlimited_in_name.as_ptr(),
12234            unlimited_in,
12235            flags_in_name.as_ptr(),
12236            flags_in,
12237            memory_in_name.as_ptr(),
12238            memory_in,
12239            access_in_name.as_ptr(),
12240            access_in,
12241            fail_on_in_name.as_ptr(),
12242            fail_on_in,
12243            revalidate_in_name.as_ptr(),
12244            revalidate_in,
12245            NULL,
12246        );
12247        utils::result(
12248            vips_op_response,
12249            VipsImage { ctx: out_out },
12250            Error::HeifloadError,
12251        )
12252    }
12253}
12254
12255/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12256/// buffer: `&[u8]` -> Buffer to load from
12257/// returns `VipsImage` - Output image
12258pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12259    unsafe {
12260        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12261        let mut out_out: *mut bindings::VipsImage = null_mut();
12262
12263        let vips_op_response =
12264            bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12265        utils::result(
12266            vips_op_response,
12267            VipsImage { ctx: out_out },
12268            Error::HeifloadBufferError,
12269        )
12270    }
12271}
12272
12273/// Options for heifload_buffer operation
12274#[derive(Clone, Debug)]
12275pub struct HeifloadBufferOptions {
12276    /// page: `i32` -> First page to load
12277    /// min: 0, max: 100000, default: 0
12278    pub page: i32,
12279    /// n: `i32` -> Number of pages to load, -1 for all
12280    /// min: -1, max: 100000, default: 1
12281    pub n: i32,
12282    /// thumbnail: `bool` -> Fetch thumbnail image
12283    /// default: false
12284    pub thumbnail: bool,
12285    /// unlimited: `bool` -> Remove all denial of service limits
12286    /// default: false
12287    pub unlimited: bool,
12288    /// flags: `ForeignFlags` -> Flags for this file
12289    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12290    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12291    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12292    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12293    ///  `All` -> VIPS_FOREIGN_ALL = 7
12294    pub flags: ForeignFlags,
12295    /// memory: `bool` -> Force open via memory
12296    /// default: false
12297    pub memory: bool,
12298    /// access: `Access` -> Required access pattern for this file
12299    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12300    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12301    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12302    pub access: Access,
12303    /// fail_on: `FailOn` -> Error level to fail on
12304    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12305    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12306    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12307    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12308    pub fail_on: FailOn,
12309    /// revalidate: `bool` -> Don't use a cached result for this operation
12310    /// default: false
12311    pub revalidate: bool,
12312}
12313
12314impl std::default::Default for HeifloadBufferOptions {
12315    fn default() -> Self {
12316        HeifloadBufferOptions {
12317            page: i32::from(0),
12318            n: i32::from(1),
12319            thumbnail: false,
12320            unlimited: false,
12321            flags: ForeignFlags::None,
12322            memory: false,
12323            access: Access::Random,
12324            fail_on: FailOn::None,
12325            revalidate: false,
12326        }
12327    }
12328}
12329
12330/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
12331/// buffer: `&[u8]` -> Buffer to load from
12332/// heifload_buffer_options: `&HeifloadBufferOptions` -> optional arguments
12333/// returns `VipsImage` - Output image
12334pub fn heifload_buffer_with_opts(
12335    buffer: &[u8],
12336    heifload_buffer_options: &HeifloadBufferOptions,
12337) -> Result<VipsImage> {
12338    unsafe {
12339        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12340        let mut out_out: *mut bindings::VipsImage = null_mut();
12341
12342        let page_in: i32 = heifload_buffer_options.page;
12343        let page_in_name = utils::new_c_string("page")?;
12344
12345        let n_in: i32 = heifload_buffer_options.n;
12346        let n_in_name = utils::new_c_string("n")?;
12347
12348        let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12349            1
12350        } else {
12351            0
12352        };
12353        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12354
12355        let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12356            1
12357        } else {
12358            0
12359        };
12360        let unlimited_in_name = utils::new_c_string("unlimited")?;
12361
12362        let flags_in: i32 = heifload_buffer_options.flags as i32;
12363        let flags_in_name = utils::new_c_string("flags")?;
12364
12365        let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12366        let memory_in_name = utils::new_c_string("memory")?;
12367
12368        let access_in: i32 = heifload_buffer_options.access as i32;
12369        let access_in_name = utils::new_c_string("access")?;
12370
12371        let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12372        let fail_on_in_name = utils::new_c_string("fail-on")?;
12373
12374        let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12375            1
12376        } else {
12377            0
12378        };
12379        let revalidate_in_name = utils::new_c_string("revalidate")?;
12380
12381        let vips_op_response = bindings::vips_heifload_buffer(
12382            buffer_in,
12383            buffer.len() as u64,
12384            &mut out_out,
12385            page_in_name.as_ptr(),
12386            page_in,
12387            n_in_name.as_ptr(),
12388            n_in,
12389            thumbnail_in_name.as_ptr(),
12390            thumbnail_in,
12391            unlimited_in_name.as_ptr(),
12392            unlimited_in,
12393            flags_in_name.as_ptr(),
12394            flags_in,
12395            memory_in_name.as_ptr(),
12396            memory_in,
12397            access_in_name.as_ptr(),
12398            access_in,
12399            fail_on_in_name.as_ptr(),
12400            fail_on_in,
12401            revalidate_in_name.as_ptr(),
12402            revalidate_in,
12403            NULL,
12404        );
12405        utils::result(
12406            vips_op_response,
12407            VipsImage { ctx: out_out },
12408            Error::HeifloadBufferError,
12409        )
12410    }
12411}
12412
12413/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, nocache, priority=0, is_a_source, get_flags, header, load
12414/// source: `&VipsSource` -> Source to load from
12415/// returns `VipsImage` - Output image
12416pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12417    unsafe {
12418        let source_in: *mut bindings::VipsSource = source.ctx;
12419        let mut out_out: *mut bindings::VipsImage = null_mut();
12420
12421        let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12422        utils::result(
12423            vips_op_response,
12424            VipsImage { ctx: out_out },
12425            Error::HeifloadSourceError,
12426        )
12427    }
12428}
12429
12430/// Options for heifload_source operation
12431#[derive(Clone, Debug)]
12432pub struct HeifloadSourceOptions {
12433    /// page: `i32` -> First page to load
12434    /// min: 0, max: 100000, default: 0
12435    pub page: i32,
12436    /// n: `i32` -> Number of pages to load, -1 for all
12437    /// min: -1, max: 100000, default: 1
12438    pub n: i32,
12439    /// thumbnail: `bool` -> Fetch thumbnail image
12440    /// default: false
12441    pub thumbnail: bool,
12442    /// unlimited: `bool` -> Remove all denial of service limits
12443    /// default: false
12444    pub unlimited: bool,
12445    /// flags: `ForeignFlags` -> Flags for this file
12446    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12447    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12448    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12449    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12450    ///  `All` -> VIPS_FOREIGN_ALL = 7
12451    pub flags: ForeignFlags,
12452    /// memory: `bool` -> Force open via memory
12453    /// default: false
12454    pub memory: bool,
12455    /// access: `Access` -> Required access pattern for this file
12456    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12457    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12458    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12459    pub access: Access,
12460    /// fail_on: `FailOn` -> Error level to fail on
12461    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12462    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12463    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12464    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12465    pub fail_on: FailOn,
12466    /// revalidate: `bool` -> Don't use a cached result for this operation
12467    /// default: false
12468    pub revalidate: bool,
12469}
12470
12471impl std::default::Default for HeifloadSourceOptions {
12472    fn default() -> Self {
12473        HeifloadSourceOptions {
12474            page: i32::from(0),
12475            n: i32::from(1),
12476            thumbnail: false,
12477            unlimited: false,
12478            flags: ForeignFlags::None,
12479            memory: false,
12480            access: Access::Random,
12481            fail_on: FailOn::None,
12482            revalidate: false,
12483        }
12484    }
12485}
12486
12487/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, nocache, priority=0, is_a_source, get_flags, header, load
12488/// source: `&VipsSource` -> Source to load from
12489/// heifload_source_options: `&HeifloadSourceOptions` -> optional arguments
12490/// returns `VipsImage` - Output image
12491pub fn heifload_source_with_opts(
12492    source: &VipsSource,
12493    heifload_source_options: &HeifloadSourceOptions,
12494) -> Result<VipsImage> {
12495    unsafe {
12496        let source_in: *mut bindings::VipsSource = source.ctx;
12497        let mut out_out: *mut bindings::VipsImage = null_mut();
12498
12499        let page_in: i32 = heifload_source_options.page;
12500        let page_in_name = utils::new_c_string("page")?;
12501
12502        let n_in: i32 = heifload_source_options.n;
12503        let n_in_name = utils::new_c_string("n")?;
12504
12505        let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12506            1
12507        } else {
12508            0
12509        };
12510        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12511
12512        let unlimited_in: i32 = if heifload_source_options.unlimited {
12513            1
12514        } else {
12515            0
12516        };
12517        let unlimited_in_name = utils::new_c_string("unlimited")?;
12518
12519        let flags_in: i32 = heifload_source_options.flags as i32;
12520        let flags_in_name = utils::new_c_string("flags")?;
12521
12522        let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12523        let memory_in_name = utils::new_c_string("memory")?;
12524
12525        let access_in: i32 = heifload_source_options.access as i32;
12526        let access_in_name = utils::new_c_string("access")?;
12527
12528        let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12529        let fail_on_in_name = utils::new_c_string("fail-on")?;
12530
12531        let revalidate_in: i32 = if heifload_source_options.revalidate {
12532            1
12533        } else {
12534            0
12535        };
12536        let revalidate_in_name = utils::new_c_string("revalidate")?;
12537
12538        let vips_op_response = bindings::vips_heifload_source(
12539            source_in,
12540            &mut out_out,
12541            page_in_name.as_ptr(),
12542            page_in,
12543            n_in_name.as_ptr(),
12544            n_in,
12545            thumbnail_in_name.as_ptr(),
12546            thumbnail_in,
12547            unlimited_in_name.as_ptr(),
12548            unlimited_in,
12549            flags_in_name.as_ptr(),
12550            flags_in,
12551            memory_in_name.as_ptr(),
12552            memory_in,
12553            access_in_name.as_ptr(),
12554            access_in,
12555            fail_on_in_name.as_ptr(),
12556            fail_on_in,
12557            revalidate_in_name.as_ptr(),
12558            revalidate_in,
12559            NULL,
12560        );
12561        utils::result(
12562            vips_op_response,
12563            VipsImage { ctx: out_out },
12564            Error::HeifloadSourceError,
12565        )
12566    }
12567}
12568
12569/// VipsForeignSaveCsvFile (csvsave), save image to csv, nocache (.csv), priority=0, mono
12570/// inp: `&VipsImage` -> Image to save
12571/// filename: `&str` -> Filename to save to
12572
12573pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12574    unsafe {
12575        let inp_in: *mut bindings::VipsImage = inp.ctx;
12576        let filename_in: CString = utils::new_c_string(filename)?;
12577
12578        let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12579        utils::result(vips_op_response, (), Error::CsvsaveError)
12580    }
12581}
12582
12583/// Options for csvsave operation
12584#[derive(Clone, Debug)]
12585pub struct CsvsaveOptions {
12586    /// separator: `String` -> Separator characters
12587    pub separator: String,
12588    /// keep: `ForeignKeep` -> Which metadata to retain
12589    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12590    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12591    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12592    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12593    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12594    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12595    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
12596    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
12597    pub keep: ForeignKeep,
12598    /// background: `Vec<f64>` -> Background value
12599    pub background: Vec<f64>,
12600    /// page_height: `i32` -> Set page height for multipage save
12601    /// min: 0, max: 100000000, default: 0
12602    pub page_height: i32,
12603    /// profile: `String` -> Filename of ICC profile to embed
12604    pub profile: String,
12605}
12606
12607impl std::default::Default for CsvsaveOptions {
12608    fn default() -> Self {
12609        CsvsaveOptions {
12610            separator: String::new(),
12611            keep: ForeignKeep::All,
12612            background: Vec::new(),
12613            page_height: i32::from(0),
12614            profile: String::from("sRGB"),
12615        }
12616    }
12617}
12618
12619/// VipsForeignSaveCsvFile (csvsave), save image to csv, nocache (.csv), priority=0, mono
12620/// inp: `&VipsImage` -> Image to save
12621/// filename: `&str` -> Filename to save to
12622/// csvsave_options: `&CsvsaveOptions` -> optional arguments
12623
12624pub fn csvsave_with_opts(
12625    inp: &VipsImage,
12626    filename: &str,
12627    csvsave_options: &CsvsaveOptions,
12628) -> Result<()> {
12629    unsafe {
12630        let inp_in: *mut bindings::VipsImage = inp.ctx;
12631        let filename_in: CString = utils::new_c_string(filename)?;
12632
12633        let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12634        let separator_in_name = utils::new_c_string("separator")?;
12635
12636        let keep_in: i32 = csvsave_options.keep as i32;
12637        let keep_in_name = utils::new_c_string("keep")?;
12638
12639        let background_wrapper =
12640            utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12641        let background_in = background_wrapper.ctx;
12642        let background_in_name = utils::new_c_string("background")?;
12643
12644        let page_height_in: i32 = csvsave_options.page_height;
12645        let page_height_in_name = utils::new_c_string("page-height")?;
12646
12647        let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12648        let profile_in_name = utils::new_c_string("profile")?;
12649
12650        let vips_op_response = bindings::vips_csvsave(
12651            inp_in,
12652            filename_in.as_ptr(),
12653            separator_in_name.as_ptr(),
12654            separator_in.as_ptr(),
12655            keep_in_name.as_ptr(),
12656            keep_in,
12657            background_in_name.as_ptr(),
12658            background_in,
12659            page_height_in_name.as_ptr(),
12660            page_height_in,
12661            profile_in_name.as_ptr(),
12662            profile_in.as_ptr(),
12663            NULL,
12664        );
12665        utils::result(vips_op_response, (), Error::CsvsaveError)
12666    }
12667}
12668
12669/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv, nocache (.csv), priority=0, mono
12670/// inp: `&VipsImage` -> Image to save
12671/// target: `&VipsTarget` -> Target to save to
12672
12673pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12674    unsafe {
12675        let inp_in: *mut bindings::VipsImage = inp.ctx;
12676        let target_in: *mut bindings::VipsTarget = target.ctx;
12677
12678        let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12679        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12680    }
12681}
12682
12683/// Options for csvsave_target operation
12684#[derive(Clone, Debug)]
12685pub struct CsvsaveTargetOptions {
12686    /// separator: `String` -> Separator characters
12687    pub separator: String,
12688    /// keep: `ForeignKeep` -> Which metadata to retain
12689    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12690    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12691    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12692    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12693    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12694    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12695    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
12696    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
12697    pub keep: ForeignKeep,
12698    /// background: `Vec<f64>` -> Background value
12699    pub background: Vec<f64>,
12700    /// page_height: `i32` -> Set page height for multipage save
12701    /// min: 0, max: 100000000, default: 0
12702    pub page_height: i32,
12703    /// profile: `String` -> Filename of ICC profile to embed
12704    pub profile: String,
12705}
12706
12707impl std::default::Default for CsvsaveTargetOptions {
12708    fn default() -> Self {
12709        CsvsaveTargetOptions {
12710            separator: String::new(),
12711            keep: ForeignKeep::All,
12712            background: Vec::new(),
12713            page_height: i32::from(0),
12714            profile: String::from("sRGB"),
12715        }
12716    }
12717}
12718
12719/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv, nocache (.csv), priority=0, mono
12720/// inp: `&VipsImage` -> Image to save
12721/// target: `&VipsTarget` -> Target to save to
12722/// csvsave_target_options: `&CsvsaveTargetOptions` -> optional arguments
12723
12724pub fn csvsave_target_with_opts(
12725    inp: &VipsImage,
12726    target: &VipsTarget,
12727    csvsave_target_options: &CsvsaveTargetOptions,
12728) -> Result<()> {
12729    unsafe {
12730        let inp_in: *mut bindings::VipsImage = inp.ctx;
12731        let target_in: *mut bindings::VipsTarget = target.ctx;
12732
12733        let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12734        let separator_in_name = utils::new_c_string("separator")?;
12735
12736        let keep_in: i32 = csvsave_target_options.keep as i32;
12737        let keep_in_name = utils::new_c_string("keep")?;
12738
12739        let background_wrapper =
12740            utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12741        let background_in = background_wrapper.ctx;
12742        let background_in_name = utils::new_c_string("background")?;
12743
12744        let page_height_in: i32 = csvsave_target_options.page_height;
12745        let page_height_in_name = utils::new_c_string("page-height")?;
12746
12747        let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12748        let profile_in_name = utils::new_c_string("profile")?;
12749
12750        let vips_op_response = bindings::vips_csvsave_target(
12751            inp_in,
12752            target_in,
12753            separator_in_name.as_ptr(),
12754            separator_in.as_ptr(),
12755            keep_in_name.as_ptr(),
12756            keep_in,
12757            background_in_name.as_ptr(),
12758            background_in,
12759            page_height_in_name.as_ptr(),
12760            page_height_in,
12761            profile_in_name.as_ptr(),
12762            profile_in.as_ptr(),
12763            NULL,
12764        );
12765        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12766    }
12767}
12768
12769/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix, nocache (.mat), priority=0, mono
12770/// inp: `&VipsImage` -> Image to save
12771/// filename: `&str` -> Filename to save to
12772
12773pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12774    unsafe {
12775        let inp_in: *mut bindings::VipsImage = inp.ctx;
12776        let filename_in: CString = utils::new_c_string(filename)?;
12777
12778        let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12779        utils::result(vips_op_response, (), Error::MatrixsaveError)
12780    }
12781}
12782
12783/// Options for matrixsave operation
12784#[derive(Clone, Debug)]
12785pub struct MatrixsaveOptions {
12786    /// keep: `ForeignKeep` -> Which metadata to retain
12787    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12788    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12789    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12790    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12791    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12792    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12793    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
12794    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
12795    pub keep: ForeignKeep,
12796    /// background: `Vec<f64>` -> Background value
12797    pub background: Vec<f64>,
12798    /// page_height: `i32` -> Set page height for multipage save
12799    /// min: 0, max: 100000000, default: 0
12800    pub page_height: i32,
12801    /// profile: `String` -> Filename of ICC profile to embed
12802    pub profile: String,
12803}
12804
12805impl std::default::Default for MatrixsaveOptions {
12806    fn default() -> Self {
12807        MatrixsaveOptions {
12808            keep: ForeignKeep::All,
12809            background: Vec::new(),
12810            page_height: i32::from(0),
12811            profile: String::from("sRGB"),
12812        }
12813    }
12814}
12815
12816/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix, nocache (.mat), priority=0, mono
12817/// inp: `&VipsImage` -> Image to save
12818/// filename: `&str` -> Filename to save to
12819/// matrixsave_options: `&MatrixsaveOptions` -> optional arguments
12820
12821pub fn matrixsave_with_opts(
12822    inp: &VipsImage,
12823    filename: &str,
12824    matrixsave_options: &MatrixsaveOptions,
12825) -> Result<()> {
12826    unsafe {
12827        let inp_in: *mut bindings::VipsImage = inp.ctx;
12828        let filename_in: CString = utils::new_c_string(filename)?;
12829
12830        let keep_in: i32 = matrixsave_options.keep as i32;
12831        let keep_in_name = utils::new_c_string("keep")?;
12832
12833        let background_wrapper =
12834            utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
12835        let background_in = background_wrapper.ctx;
12836        let background_in_name = utils::new_c_string("background")?;
12837
12838        let page_height_in: i32 = matrixsave_options.page_height;
12839        let page_height_in_name = utils::new_c_string("page-height")?;
12840
12841        let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
12842        let profile_in_name = utils::new_c_string("profile")?;
12843
12844        let vips_op_response = bindings::vips_matrixsave(
12845            inp_in,
12846            filename_in.as_ptr(),
12847            keep_in_name.as_ptr(),
12848            keep_in,
12849            background_in_name.as_ptr(),
12850            background_in,
12851            page_height_in_name.as_ptr(),
12852            page_height_in,
12853            profile_in_name.as_ptr(),
12854            profile_in.as_ptr(),
12855            NULL,
12856        );
12857        utils::result(vips_op_response, (), Error::MatrixsaveError)
12858    }
12859}
12860
12861/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix, nocache (.mat), priority=0, mono
12862/// inp: `&VipsImage` -> Image to save
12863/// target: `&VipsTarget` -> Target to save to
12864
12865pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12866    unsafe {
12867        let inp_in: *mut bindings::VipsImage = inp.ctx;
12868        let target_in: *mut bindings::VipsTarget = target.ctx;
12869
12870        let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
12871        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12872    }
12873}
12874
12875/// Options for matrixsave_target operation
12876#[derive(Clone, Debug)]
12877pub struct MatrixsaveTargetOptions {
12878    /// keep: `ForeignKeep` -> Which metadata to retain
12879    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12880    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12881    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12882    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12883    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12884    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12885    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
12886    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
12887    pub keep: ForeignKeep,
12888    /// background: `Vec<f64>` -> Background value
12889    pub background: Vec<f64>,
12890    /// page_height: `i32` -> Set page height for multipage save
12891    /// min: 0, max: 100000000, default: 0
12892    pub page_height: i32,
12893    /// profile: `String` -> Filename of ICC profile to embed
12894    pub profile: String,
12895}
12896
12897impl std::default::Default for MatrixsaveTargetOptions {
12898    fn default() -> Self {
12899        MatrixsaveTargetOptions {
12900            keep: ForeignKeep::All,
12901            background: Vec::new(),
12902            page_height: i32::from(0),
12903            profile: String::from("sRGB"),
12904        }
12905    }
12906}
12907
12908/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix, nocache (.mat), priority=0, mono
12909/// inp: `&VipsImage` -> Image to save
12910/// target: `&VipsTarget` -> Target to save to
12911/// matrixsave_target_options: `&MatrixsaveTargetOptions` -> optional arguments
12912
12913pub fn matrixsave_target_with_opts(
12914    inp: &VipsImage,
12915    target: &VipsTarget,
12916    matrixsave_target_options: &MatrixsaveTargetOptions,
12917) -> Result<()> {
12918    unsafe {
12919        let inp_in: *mut bindings::VipsImage = inp.ctx;
12920        let target_in: *mut bindings::VipsTarget = target.ctx;
12921
12922        let keep_in: i32 = matrixsave_target_options.keep as i32;
12923        let keep_in_name = utils::new_c_string("keep")?;
12924
12925        let background_wrapper =
12926            utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
12927        let background_in = background_wrapper.ctx;
12928        let background_in_name = utils::new_c_string("background")?;
12929
12930        let page_height_in: i32 = matrixsave_target_options.page_height;
12931        let page_height_in_name = utils::new_c_string("page-height")?;
12932
12933        let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
12934        let profile_in_name = utils::new_c_string("profile")?;
12935
12936        let vips_op_response = bindings::vips_matrixsave_target(
12937            inp_in,
12938            target_in,
12939            keep_in_name.as_ptr(),
12940            keep_in,
12941            background_in_name.as_ptr(),
12942            background_in,
12943            page_height_in_name.as_ptr(),
12944            page_height_in,
12945            profile_in_name.as_ptr(),
12946            profile_in.as_ptr(),
12947            NULL,
12948        );
12949        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12950    }
12951}
12952
12953/// VipsForeignPrintMatrix (matrixprint), print matrix, nocache (.mat), priority=0, mono
12954/// inp: `&VipsImage` -> Image to save
12955
12956pub fn matrixprint(inp: &VipsImage) -> Result<()> {
12957    unsafe {
12958        let inp_in: *mut bindings::VipsImage = inp.ctx;
12959
12960        let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
12961        utils::result(vips_op_response, (), Error::MatrixprintError)
12962    }
12963}
12964
12965/// Options for matrixprint operation
12966#[derive(Clone, Debug)]
12967pub struct MatrixprintOptions {
12968    /// keep: `ForeignKeep` -> Which metadata to retain
12969    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
12970    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
12971    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
12972    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
12973    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
12974    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
12975    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
12976    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
12977    pub keep: ForeignKeep,
12978    /// background: `Vec<f64>` -> Background value
12979    pub background: Vec<f64>,
12980    /// page_height: `i32` -> Set page height for multipage save
12981    /// min: 0, max: 100000000, default: 0
12982    pub page_height: i32,
12983    /// profile: `String` -> Filename of ICC profile to embed
12984    pub profile: String,
12985}
12986
12987impl std::default::Default for MatrixprintOptions {
12988    fn default() -> Self {
12989        MatrixprintOptions {
12990            keep: ForeignKeep::All,
12991            background: Vec::new(),
12992            page_height: i32::from(0),
12993            profile: String::from("sRGB"),
12994        }
12995    }
12996}
12997
12998/// VipsForeignPrintMatrix (matrixprint), print matrix, nocache (.mat), priority=0, mono
12999/// inp: `&VipsImage` -> Image to save
13000/// matrixprint_options: `&MatrixprintOptions` -> optional arguments
13001
13002pub fn matrixprint_with_opts(
13003    inp: &VipsImage,
13004    matrixprint_options: &MatrixprintOptions,
13005) -> Result<()> {
13006    unsafe {
13007        let inp_in: *mut bindings::VipsImage = inp.ctx;
13008
13009        let keep_in: i32 = matrixprint_options.keep as i32;
13010        let keep_in_name = utils::new_c_string("keep")?;
13011
13012        let background_wrapper =
13013            utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
13014        let background_in = background_wrapper.ctx;
13015        let background_in_name = utils::new_c_string("background")?;
13016
13017        let page_height_in: i32 = matrixprint_options.page_height;
13018        let page_height_in_name = utils::new_c_string("page-height")?;
13019
13020        let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
13021        let profile_in_name = utils::new_c_string("profile")?;
13022
13023        let vips_op_response = bindings::vips_matrixprint(
13024            inp_in,
13025            keep_in_name.as_ptr(),
13026            keep_in,
13027            background_in_name.as_ptr(),
13028            background_in,
13029            page_height_in_name.as_ptr(),
13030            page_height_in,
13031            profile_in_name.as_ptr(),
13032            profile_in.as_ptr(),
13033            NULL,
13034        );
13035        utils::result(vips_op_response, (), Error::MatrixprintError)
13036    }
13037}
13038
13039/// VipsForeignSaveRawFile (rawsave), save image to raw file, nocache (.raw), priority=0,
13040/// inp: `&VipsImage` -> Image to save
13041/// filename: `&str` -> Filename to save to
13042
13043pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
13044    unsafe {
13045        let inp_in: *mut bindings::VipsImage = inp.ctx;
13046        let filename_in: CString = utils::new_c_string(filename)?;
13047
13048        let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
13049        utils::result(vips_op_response, (), Error::RawsaveError)
13050    }
13051}
13052
13053/// Options for rawsave operation
13054#[derive(Clone, Debug)]
13055pub struct RawsaveOptions {
13056    /// keep: `ForeignKeep` -> Which metadata to retain
13057    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13058    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13059    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13060    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13061    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13062    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13063    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13064    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13065    pub keep: ForeignKeep,
13066    /// background: `Vec<f64>` -> Background value
13067    pub background: Vec<f64>,
13068    /// page_height: `i32` -> Set page height for multipage save
13069    /// min: 0, max: 100000000, default: 0
13070    pub page_height: i32,
13071    /// profile: `String` -> Filename of ICC profile to embed
13072    pub profile: String,
13073}
13074
13075impl std::default::Default for RawsaveOptions {
13076    fn default() -> Self {
13077        RawsaveOptions {
13078            keep: ForeignKeep::All,
13079            background: Vec::new(),
13080            page_height: i32::from(0),
13081            profile: String::from("sRGB"),
13082        }
13083    }
13084}
13085
13086/// VipsForeignSaveRawFile (rawsave), save image to raw file, nocache (.raw), priority=0,
13087/// inp: `&VipsImage` -> Image to save
13088/// filename: `&str` -> Filename to save to
13089/// rawsave_options: `&RawsaveOptions` -> optional arguments
13090
13091pub fn rawsave_with_opts(
13092    inp: &VipsImage,
13093    filename: &str,
13094    rawsave_options: &RawsaveOptions,
13095) -> Result<()> {
13096    unsafe {
13097        let inp_in: *mut bindings::VipsImage = inp.ctx;
13098        let filename_in: CString = utils::new_c_string(filename)?;
13099
13100        let keep_in: i32 = rawsave_options.keep as i32;
13101        let keep_in_name = utils::new_c_string("keep")?;
13102
13103        let background_wrapper =
13104            utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
13105        let background_in = background_wrapper.ctx;
13106        let background_in_name = utils::new_c_string("background")?;
13107
13108        let page_height_in: i32 = rawsave_options.page_height;
13109        let page_height_in_name = utils::new_c_string("page-height")?;
13110
13111        let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
13112        let profile_in_name = utils::new_c_string("profile")?;
13113
13114        let vips_op_response = bindings::vips_rawsave(
13115            inp_in,
13116            filename_in.as_ptr(),
13117            keep_in_name.as_ptr(),
13118            keep_in,
13119            background_in_name.as_ptr(),
13120            background_in,
13121            page_height_in_name.as_ptr(),
13122            page_height_in,
13123            profile_in_name.as_ptr(),
13124            profile_in.as_ptr(),
13125            NULL,
13126        );
13127        utils::result(vips_op_response, (), Error::RawsaveError)
13128    }
13129}
13130
13131/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer, nocache (.raw), priority=0,
13132/// inp: `&VipsImage` -> Image to save
13133/// returns `Vec<u8>` - Buffer to save to
13134pub fn rawsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13135    unsafe {
13136        let inp_in: *mut bindings::VipsImage = inp.ctx;
13137        let mut buffer_buf_size: u64 = 0;
13138        let mut buffer_out: *mut c_void = null_mut();
13139
13140        let vips_op_response =
13141            bindings::vips_rawsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13142        utils::result(
13143            vips_op_response,
13144            utils::new_byte_array(buffer_out, buffer_buf_size),
13145            Error::RawsaveBufferError,
13146        )
13147    }
13148}
13149
13150/// Options for rawsave_buffer operation
13151#[derive(Clone, Debug)]
13152pub struct RawsaveBufferOptions {
13153    /// keep: `ForeignKeep` -> Which metadata to retain
13154    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13155    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13156    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13157    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13158    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13159    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13160    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13161    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13162    pub keep: ForeignKeep,
13163    /// background: `Vec<f64>` -> Background value
13164    pub background: Vec<f64>,
13165    /// page_height: `i32` -> Set page height for multipage save
13166    /// min: 0, max: 100000000, default: 0
13167    pub page_height: i32,
13168    /// profile: `String` -> Filename of ICC profile to embed
13169    pub profile: String,
13170}
13171
13172impl std::default::Default for RawsaveBufferOptions {
13173    fn default() -> Self {
13174        RawsaveBufferOptions {
13175            keep: ForeignKeep::All,
13176            background: Vec::new(),
13177            page_height: i32::from(0),
13178            profile: String::from("sRGB"),
13179        }
13180    }
13181}
13182
13183/// VipsForeignSaveRawBuffer (rawsave_buffer), write raw image to buffer, nocache (.raw), priority=0,
13184/// inp: `&VipsImage` -> Image to save
13185/// rawsave_buffer_options: `&RawsaveBufferOptions` -> optional arguments
13186/// returns `Vec<u8>` - Buffer to save to
13187pub fn rawsave_buffer_with_opts(
13188    inp: &VipsImage,
13189    rawsave_buffer_options: &RawsaveBufferOptions,
13190) -> Result<Vec<u8>> {
13191    unsafe {
13192        let inp_in: *mut bindings::VipsImage = inp.ctx;
13193        let mut buffer_buf_size: u64 = 0;
13194        let mut buffer_out: *mut c_void = null_mut();
13195
13196        let keep_in: i32 = rawsave_buffer_options.keep as i32;
13197        let keep_in_name = utils::new_c_string("keep")?;
13198
13199        let background_wrapper =
13200            utils::VipsArrayDoubleWrapper::from(&rawsave_buffer_options.background[..]);
13201        let background_in = background_wrapper.ctx;
13202        let background_in_name = utils::new_c_string("background")?;
13203
13204        let page_height_in: i32 = rawsave_buffer_options.page_height;
13205        let page_height_in_name = utils::new_c_string("page-height")?;
13206
13207        let profile_in: CString = utils::new_c_string(&rawsave_buffer_options.profile)?;
13208        let profile_in_name = utils::new_c_string("profile")?;
13209
13210        let vips_op_response = bindings::vips_rawsave_buffer(
13211            inp_in,
13212            &mut buffer_out,
13213            &mut buffer_buf_size,
13214            keep_in_name.as_ptr(),
13215            keep_in,
13216            background_in_name.as_ptr(),
13217            background_in,
13218            page_height_in_name.as_ptr(),
13219            page_height_in,
13220            profile_in_name.as_ptr(),
13221            profile_in.as_ptr(),
13222            NULL,
13223        );
13224        utils::result(
13225            vips_op_response,
13226            utils::new_byte_array(buffer_out, buffer_buf_size),
13227            Error::RawsaveBufferError,
13228        )
13229    }
13230}
13231
13232/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target, nocache (.raw), priority=0,
13233/// inp: `&VipsImage` -> Image to save
13234/// target: `&VipsTarget` -> Target to save to
13235
13236pub fn rawsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13237    unsafe {
13238        let inp_in: *mut bindings::VipsImage = inp.ctx;
13239        let target_in: *mut bindings::VipsTarget = target.ctx;
13240
13241        let vips_op_response = bindings::vips_rawsave_target(inp_in, target_in, NULL);
13242        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13243    }
13244}
13245
13246/// Options for rawsave_target operation
13247#[derive(Clone, Debug)]
13248pub struct RawsaveTargetOptions {
13249    /// keep: `ForeignKeep` -> Which metadata to retain
13250    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13251    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13252    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13253    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13254    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13255    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13256    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13257    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13258    pub keep: ForeignKeep,
13259    /// background: `Vec<f64>` -> Background value
13260    pub background: Vec<f64>,
13261    /// page_height: `i32` -> Set page height for multipage save
13262    /// min: 0, max: 100000000, default: 0
13263    pub page_height: i32,
13264    /// profile: `String` -> Filename of ICC profile to embed
13265    pub profile: String,
13266}
13267
13268impl std::default::Default for RawsaveTargetOptions {
13269    fn default() -> Self {
13270        RawsaveTargetOptions {
13271            keep: ForeignKeep::All,
13272            background: Vec::new(),
13273            page_height: i32::from(0),
13274            profile: String::from("sRGB"),
13275        }
13276    }
13277}
13278
13279/// VipsForeignSaveRawTarget (rawsave_target), write raw image to target, nocache (.raw), priority=0,
13280/// inp: `&VipsImage` -> Image to save
13281/// target: `&VipsTarget` -> Target to save to
13282/// rawsave_target_options: `&RawsaveTargetOptions` -> optional arguments
13283
13284pub fn rawsave_target_with_opts(
13285    inp: &VipsImage,
13286    target: &VipsTarget,
13287    rawsave_target_options: &RawsaveTargetOptions,
13288) -> Result<()> {
13289    unsafe {
13290        let inp_in: *mut bindings::VipsImage = inp.ctx;
13291        let target_in: *mut bindings::VipsTarget = target.ctx;
13292
13293        let keep_in: i32 = rawsave_target_options.keep as i32;
13294        let keep_in_name = utils::new_c_string("keep")?;
13295
13296        let background_wrapper =
13297            utils::VipsArrayDoubleWrapper::from(&rawsave_target_options.background[..]);
13298        let background_in = background_wrapper.ctx;
13299        let background_in_name = utils::new_c_string("background")?;
13300
13301        let page_height_in: i32 = rawsave_target_options.page_height;
13302        let page_height_in_name = utils::new_c_string("page-height")?;
13303
13304        let profile_in: CString = utils::new_c_string(&rawsave_target_options.profile)?;
13305        let profile_in_name = utils::new_c_string("profile")?;
13306
13307        let vips_op_response = bindings::vips_rawsave_target(
13308            inp_in,
13309            target_in,
13310            keep_in_name.as_ptr(),
13311            keep_in,
13312            background_in_name.as_ptr(),
13313            background_in,
13314            page_height_in_name.as_ptr(),
13315            page_height_in,
13316            profile_in_name.as_ptr(),
13317            profile_in.as_ptr(),
13318            NULL,
13319        );
13320        utils::result(vips_op_response, (), Error::RawsaveTargetError)
13321    }
13322}
13323
13324/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format, nocache (.v, .vips), priority=0,
13325/// inp: `&VipsImage` -> Image to save
13326/// filename: `&str` -> Filename to save to
13327
13328pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13329    unsafe {
13330        let inp_in: *mut bindings::VipsImage = inp.ctx;
13331        let filename_in: CString = utils::new_c_string(filename)?;
13332
13333        let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13334        utils::result(vips_op_response, (), Error::VipssaveError)
13335    }
13336}
13337
13338/// Options for vipssave operation
13339#[derive(Clone, Debug)]
13340pub struct VipssaveOptions {
13341    /// keep: `ForeignKeep` -> Which metadata to retain
13342    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13343    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13344    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13345    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13346    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13347    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13348    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13349    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13350    pub keep: ForeignKeep,
13351    /// background: `Vec<f64>` -> Background value
13352    pub background: Vec<f64>,
13353    /// page_height: `i32` -> Set page height for multipage save
13354    /// min: 0, max: 100000000, default: 0
13355    pub page_height: i32,
13356    /// profile: `String` -> Filename of ICC profile to embed
13357    pub profile: String,
13358}
13359
13360impl std::default::Default for VipssaveOptions {
13361    fn default() -> Self {
13362        VipssaveOptions {
13363            keep: ForeignKeep::All,
13364            background: Vec::new(),
13365            page_height: i32::from(0),
13366            profile: String::from("sRGB"),
13367        }
13368    }
13369}
13370
13371/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format, nocache (.v, .vips), priority=0,
13372/// inp: `&VipsImage` -> Image to save
13373/// filename: `&str` -> Filename to save to
13374/// vipssave_options: `&VipssaveOptions` -> optional arguments
13375
13376pub fn vipssave_with_opts(
13377    inp: &VipsImage,
13378    filename: &str,
13379    vipssave_options: &VipssaveOptions,
13380) -> Result<()> {
13381    unsafe {
13382        let inp_in: *mut bindings::VipsImage = inp.ctx;
13383        let filename_in: CString = utils::new_c_string(filename)?;
13384
13385        let keep_in: i32 = vipssave_options.keep as i32;
13386        let keep_in_name = utils::new_c_string("keep")?;
13387
13388        let background_wrapper =
13389            utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13390        let background_in = background_wrapper.ctx;
13391        let background_in_name = utils::new_c_string("background")?;
13392
13393        let page_height_in: i32 = vipssave_options.page_height;
13394        let page_height_in_name = utils::new_c_string("page-height")?;
13395
13396        let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13397        let profile_in_name = utils::new_c_string("profile")?;
13398
13399        let vips_op_response = bindings::vips_vipssave(
13400            inp_in,
13401            filename_in.as_ptr(),
13402            keep_in_name.as_ptr(),
13403            keep_in,
13404            background_in_name.as_ptr(),
13405            background_in,
13406            page_height_in_name.as_ptr(),
13407            page_height_in,
13408            profile_in_name.as_ptr(),
13409            profile_in.as_ptr(),
13410            NULL,
13411        );
13412        utils::result(vips_op_response, (), Error::VipssaveError)
13413    }
13414}
13415
13416/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format, nocache (.v, .vips), priority=0,
13417/// inp: `&VipsImage` -> Image to save
13418/// target: `&VipsTarget` -> Target to save to
13419
13420pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13421    unsafe {
13422        let inp_in: *mut bindings::VipsImage = inp.ctx;
13423        let target_in: *mut bindings::VipsTarget = target.ctx;
13424
13425        let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13426        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13427    }
13428}
13429
13430/// Options for vipssave_target operation
13431#[derive(Clone, Debug)]
13432pub struct VipssaveTargetOptions {
13433    /// keep: `ForeignKeep` -> Which metadata to retain
13434    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13435    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13436    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13437    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13438    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13439    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13440    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13441    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13442    pub keep: ForeignKeep,
13443    /// background: `Vec<f64>` -> Background value
13444    pub background: Vec<f64>,
13445    /// page_height: `i32` -> Set page height for multipage save
13446    /// min: 0, max: 100000000, default: 0
13447    pub page_height: i32,
13448    /// profile: `String` -> Filename of ICC profile to embed
13449    pub profile: String,
13450}
13451
13452impl std::default::Default for VipssaveTargetOptions {
13453    fn default() -> Self {
13454        VipssaveTargetOptions {
13455            keep: ForeignKeep::All,
13456            background: Vec::new(),
13457            page_height: i32::from(0),
13458            profile: String::from("sRGB"),
13459        }
13460    }
13461}
13462
13463/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format, nocache (.v, .vips), priority=0,
13464/// inp: `&VipsImage` -> Image to save
13465/// target: `&VipsTarget` -> Target to save to
13466/// vipssave_target_options: `&VipssaveTargetOptions` -> optional arguments
13467
13468pub fn vipssave_target_with_opts(
13469    inp: &VipsImage,
13470    target: &VipsTarget,
13471    vipssave_target_options: &VipssaveTargetOptions,
13472) -> Result<()> {
13473    unsafe {
13474        let inp_in: *mut bindings::VipsImage = inp.ctx;
13475        let target_in: *mut bindings::VipsTarget = target.ctx;
13476
13477        let keep_in: i32 = vipssave_target_options.keep as i32;
13478        let keep_in_name = utils::new_c_string("keep")?;
13479
13480        let background_wrapper =
13481            utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13482        let background_in = background_wrapper.ctx;
13483        let background_in_name = utils::new_c_string("background")?;
13484
13485        let page_height_in: i32 = vipssave_target_options.page_height;
13486        let page_height_in_name = utils::new_c_string("page-height")?;
13487
13488        let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13489        let profile_in_name = utils::new_c_string("profile")?;
13490
13491        let vips_op_response = bindings::vips_vipssave_target(
13492            inp_in,
13493            target_in,
13494            keep_in_name.as_ptr(),
13495            keep_in,
13496            background_in_name.as_ptr(),
13497            background_in,
13498            page_height_in_name.as_ptr(),
13499            page_height_in,
13500            profile_in_name.as_ptr(),
13501            profile_in.as_ptr(),
13502            NULL,
13503        );
13504        utils::result(vips_op_response, (), Error::VipssaveTargetError)
13505    }
13506}
13507
13508/// VipsForeignSavePpmFile (ppmsave), save image to ppm file, nocache (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0,
13509/// inp: `&VipsImage` -> Image to save
13510/// filename: `&str` -> Filename to save to
13511
13512pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13513    unsafe {
13514        let inp_in: *mut bindings::VipsImage = inp.ctx;
13515        let filename_in: CString = utils::new_c_string(filename)?;
13516
13517        let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13518        utils::result(vips_op_response, (), Error::PpmsaveError)
13519    }
13520}
13521
13522/// Options for ppmsave operation
13523#[derive(Clone, Debug)]
13524pub struct PpmsaveOptions {
13525    /// format: `ForeignPpmFormat` -> Format to save in
13526    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13527    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13528    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13529    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13530    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13531    pub format: ForeignPpmFormat,
13532    /// ascii: `bool` -> Save as ascii
13533    /// default: false
13534    pub ascii: bool,
13535    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13536    /// min: 0, max: 1, default: 0
13537    pub bitdepth: i32,
13538    /// keep: `ForeignKeep` -> Which metadata to retain
13539    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13540    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13541    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13542    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13543    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13544    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13545    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13546    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13547    pub keep: ForeignKeep,
13548    /// background: `Vec<f64>` -> Background value
13549    pub background: Vec<f64>,
13550    /// page_height: `i32` -> Set page height for multipage save
13551    /// min: 0, max: 100000000, default: 0
13552    pub page_height: i32,
13553    /// profile: `String` -> Filename of ICC profile to embed
13554    pub profile: String,
13555}
13556
13557impl std::default::Default for PpmsaveOptions {
13558    fn default() -> Self {
13559        PpmsaveOptions {
13560            format: ForeignPpmFormat::Ppm,
13561            ascii: false,
13562            bitdepth: i32::from(0),
13563            keep: ForeignKeep::All,
13564            background: Vec::new(),
13565            page_height: i32::from(0),
13566            profile: String::from("sRGB"),
13567        }
13568    }
13569}
13570
13571/// VipsForeignSavePpmFile (ppmsave), save image to ppm file, nocache (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0,
13572/// inp: `&VipsImage` -> Image to save
13573/// filename: `&str` -> Filename to save to
13574/// ppmsave_options: `&PpmsaveOptions` -> optional arguments
13575
13576pub fn ppmsave_with_opts(
13577    inp: &VipsImage,
13578    filename: &str,
13579    ppmsave_options: &PpmsaveOptions,
13580) -> Result<()> {
13581    unsafe {
13582        let inp_in: *mut bindings::VipsImage = inp.ctx;
13583        let filename_in: CString = utils::new_c_string(filename)?;
13584
13585        let format_in: i32 = ppmsave_options.format as i32;
13586        let format_in_name = utils::new_c_string("format")?;
13587
13588        let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13589        let ascii_in_name = utils::new_c_string("ascii")?;
13590
13591        let bitdepth_in: i32 = ppmsave_options.bitdepth;
13592        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13593
13594        let keep_in: i32 = ppmsave_options.keep as i32;
13595        let keep_in_name = utils::new_c_string("keep")?;
13596
13597        let background_wrapper =
13598            utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13599        let background_in = background_wrapper.ctx;
13600        let background_in_name = utils::new_c_string("background")?;
13601
13602        let page_height_in: i32 = ppmsave_options.page_height;
13603        let page_height_in_name = utils::new_c_string("page-height")?;
13604
13605        let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13606        let profile_in_name = utils::new_c_string("profile")?;
13607
13608        let vips_op_response = bindings::vips_ppmsave(
13609            inp_in,
13610            filename_in.as_ptr(),
13611            format_in_name.as_ptr(),
13612            format_in,
13613            ascii_in_name.as_ptr(),
13614            ascii_in,
13615            bitdepth_in_name.as_ptr(),
13616            bitdepth_in,
13617            keep_in_name.as_ptr(),
13618            keep_in,
13619            background_in_name.as_ptr(),
13620            background_in,
13621            page_height_in_name.as_ptr(),
13622            page_height_in,
13623            profile_in_name.as_ptr(),
13624            profile_in.as_ptr(),
13625            NULL,
13626        );
13627        utils::result(vips_op_response, (), Error::PpmsaveError)
13628    }
13629}
13630
13631/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm, nocache (.ppm), priority=0,
13632/// inp: `&VipsImage` -> Image to save
13633/// target: `&VipsTarget` -> Target to save to
13634
13635pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13636    unsafe {
13637        let inp_in: *mut bindings::VipsImage = inp.ctx;
13638        let target_in: *mut bindings::VipsTarget = target.ctx;
13639
13640        let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13641        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13642    }
13643}
13644
13645/// Options for ppmsave_target operation
13646#[derive(Clone, Debug)]
13647pub struct PpmsaveTargetOptions {
13648    /// format: `ForeignPpmFormat` -> Format to save in
13649    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
13650    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
13651    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
13652    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
13653    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
13654    pub format: ForeignPpmFormat,
13655    /// ascii: `bool` -> Save as ascii
13656    /// default: false
13657    pub ascii: bool,
13658    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
13659    /// min: 0, max: 1, default: 0
13660    pub bitdepth: i32,
13661    /// keep: `ForeignKeep` -> Which metadata to retain
13662    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13663    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13664    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13665    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13666    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13667    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13668    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13669    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13670    pub keep: ForeignKeep,
13671    /// background: `Vec<f64>` -> Background value
13672    pub background: Vec<f64>,
13673    /// page_height: `i32` -> Set page height for multipage save
13674    /// min: 0, max: 100000000, default: 0
13675    pub page_height: i32,
13676    /// profile: `String` -> Filename of ICC profile to embed
13677    pub profile: String,
13678}
13679
13680impl std::default::Default for PpmsaveTargetOptions {
13681    fn default() -> Self {
13682        PpmsaveTargetOptions {
13683            format: ForeignPpmFormat::Ppm,
13684            ascii: false,
13685            bitdepth: i32::from(0),
13686            keep: ForeignKeep::All,
13687            background: Vec::new(),
13688            page_height: i32::from(0),
13689            profile: String::from("sRGB"),
13690        }
13691    }
13692}
13693
13694/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm, nocache (.ppm), priority=0,
13695/// inp: `&VipsImage` -> Image to save
13696/// target: `&VipsTarget` -> Target to save to
13697/// ppmsave_target_options: `&PpmsaveTargetOptions` -> optional arguments
13698
13699pub fn ppmsave_target_with_opts(
13700    inp: &VipsImage,
13701    target: &VipsTarget,
13702    ppmsave_target_options: &PpmsaveTargetOptions,
13703) -> Result<()> {
13704    unsafe {
13705        let inp_in: *mut bindings::VipsImage = inp.ctx;
13706        let target_in: *mut bindings::VipsTarget = target.ctx;
13707
13708        let format_in: i32 = ppmsave_target_options.format as i32;
13709        let format_in_name = utils::new_c_string("format")?;
13710
13711        let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13712        let ascii_in_name = utils::new_c_string("ascii")?;
13713
13714        let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13715        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13716
13717        let keep_in: i32 = ppmsave_target_options.keep as i32;
13718        let keep_in_name = utils::new_c_string("keep")?;
13719
13720        let background_wrapper =
13721            utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13722        let background_in = background_wrapper.ctx;
13723        let background_in_name = utils::new_c_string("background")?;
13724
13725        let page_height_in: i32 = ppmsave_target_options.page_height;
13726        let page_height_in_name = utils::new_c_string("page-height")?;
13727
13728        let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13729        let profile_in_name = utils::new_c_string("profile")?;
13730
13731        let vips_op_response = bindings::vips_ppmsave_target(
13732            inp_in,
13733            target_in,
13734            format_in_name.as_ptr(),
13735            format_in,
13736            ascii_in_name.as_ptr(),
13737            ascii_in,
13738            bitdepth_in_name.as_ptr(),
13739            bitdepth_in,
13740            keep_in_name.as_ptr(),
13741            keep_in,
13742            background_in_name.as_ptr(),
13743            background_in,
13744            page_height_in_name.as_ptr(),
13745            page_height_in,
13746            profile_in_name.as_ptr(),
13747            profile_in.as_ptr(),
13748            NULL,
13749        );
13750        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13751    }
13752}
13753
13754/// VipsForeignSaveRadFile (radsave), save image to Radiance file, nocache (.hdr), priority=0, mono rgb
13755/// inp: `&VipsImage` -> Image to save
13756/// filename: `&str` -> Filename to save to
13757
13758pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13759    unsafe {
13760        let inp_in: *mut bindings::VipsImage = inp.ctx;
13761        let filename_in: CString = utils::new_c_string(filename)?;
13762
13763        let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13764        utils::result(vips_op_response, (), Error::RadsaveError)
13765    }
13766}
13767
13768/// Options for radsave operation
13769#[derive(Clone, Debug)]
13770pub struct RadsaveOptions {
13771    /// keep: `ForeignKeep` -> Which metadata to retain
13772    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13773    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13774    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13775    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13776    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13777    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13778    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13779    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13780    pub keep: ForeignKeep,
13781    /// background: `Vec<f64>` -> Background value
13782    pub background: Vec<f64>,
13783    /// page_height: `i32` -> Set page height for multipage save
13784    /// min: 0, max: 100000000, default: 0
13785    pub page_height: i32,
13786    /// profile: `String` -> Filename of ICC profile to embed
13787    pub profile: String,
13788}
13789
13790impl std::default::Default for RadsaveOptions {
13791    fn default() -> Self {
13792        RadsaveOptions {
13793            keep: ForeignKeep::All,
13794            background: Vec::new(),
13795            page_height: i32::from(0),
13796            profile: String::from("sRGB"),
13797        }
13798    }
13799}
13800
13801/// VipsForeignSaveRadFile (radsave), save image to Radiance file, nocache (.hdr), priority=0, mono rgb
13802/// inp: `&VipsImage` -> Image to save
13803/// filename: `&str` -> Filename to save to
13804/// radsave_options: `&RadsaveOptions` -> optional arguments
13805
13806pub fn radsave_with_opts(
13807    inp: &VipsImage,
13808    filename: &str,
13809    radsave_options: &RadsaveOptions,
13810) -> Result<()> {
13811    unsafe {
13812        let inp_in: *mut bindings::VipsImage = inp.ctx;
13813        let filename_in: CString = utils::new_c_string(filename)?;
13814
13815        let keep_in: i32 = radsave_options.keep as i32;
13816        let keep_in_name = utils::new_c_string("keep")?;
13817
13818        let background_wrapper =
13819            utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13820        let background_in = background_wrapper.ctx;
13821        let background_in_name = utils::new_c_string("background")?;
13822
13823        let page_height_in: i32 = radsave_options.page_height;
13824        let page_height_in_name = utils::new_c_string("page-height")?;
13825
13826        let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13827        let profile_in_name = utils::new_c_string("profile")?;
13828
13829        let vips_op_response = bindings::vips_radsave(
13830            inp_in,
13831            filename_in.as_ptr(),
13832            keep_in_name.as_ptr(),
13833            keep_in,
13834            background_in_name.as_ptr(),
13835            background_in,
13836            page_height_in_name.as_ptr(),
13837            page_height_in,
13838            profile_in_name.as_ptr(),
13839            profile_in.as_ptr(),
13840            NULL,
13841        );
13842        utils::result(vips_op_response, (), Error::RadsaveError)
13843    }
13844}
13845
13846/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer, nocache (.hdr), priority=0, mono rgb
13847/// inp: `&VipsImage` -> Image to save
13848/// returns `Vec<u8>` - Buffer to save to
13849pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13850    unsafe {
13851        let inp_in: *mut bindings::VipsImage = inp.ctx;
13852        let mut buffer_buf_size: u64 = 0;
13853        let mut buffer_out: *mut c_void = null_mut();
13854
13855        let vips_op_response =
13856            bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13857        utils::result(
13858            vips_op_response,
13859            utils::new_byte_array(buffer_out, buffer_buf_size),
13860            Error::RadsaveBufferError,
13861        )
13862    }
13863}
13864
13865/// Options for radsave_buffer operation
13866#[derive(Clone, Debug)]
13867pub struct RadsaveBufferOptions {
13868    /// keep: `ForeignKeep` -> Which metadata to retain
13869    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13870    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13871    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13872    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13873    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13874    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13875    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13876    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13877    pub keep: ForeignKeep,
13878    /// background: `Vec<f64>` -> Background value
13879    pub background: Vec<f64>,
13880    /// page_height: `i32` -> Set page height for multipage save
13881    /// min: 0, max: 100000000, default: 0
13882    pub page_height: i32,
13883    /// profile: `String` -> Filename of ICC profile to embed
13884    pub profile: String,
13885}
13886
13887impl std::default::Default for RadsaveBufferOptions {
13888    fn default() -> Self {
13889        RadsaveBufferOptions {
13890            keep: ForeignKeep::All,
13891            background: Vec::new(),
13892            page_height: i32::from(0),
13893            profile: String::from("sRGB"),
13894        }
13895    }
13896}
13897
13898/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer, nocache (.hdr), priority=0, mono rgb
13899/// inp: `&VipsImage` -> Image to save
13900/// radsave_buffer_options: `&RadsaveBufferOptions` -> optional arguments
13901/// returns `Vec<u8>` - Buffer to save to
13902pub fn radsave_buffer_with_opts(
13903    inp: &VipsImage,
13904    radsave_buffer_options: &RadsaveBufferOptions,
13905) -> Result<Vec<u8>> {
13906    unsafe {
13907        let inp_in: *mut bindings::VipsImage = inp.ctx;
13908        let mut buffer_buf_size: u64 = 0;
13909        let mut buffer_out: *mut c_void = null_mut();
13910
13911        let keep_in: i32 = radsave_buffer_options.keep as i32;
13912        let keep_in_name = utils::new_c_string("keep")?;
13913
13914        let background_wrapper =
13915            utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
13916        let background_in = background_wrapper.ctx;
13917        let background_in_name = utils::new_c_string("background")?;
13918
13919        let page_height_in: i32 = radsave_buffer_options.page_height;
13920        let page_height_in_name = utils::new_c_string("page-height")?;
13921
13922        let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
13923        let profile_in_name = utils::new_c_string("profile")?;
13924
13925        let vips_op_response = bindings::vips_radsave_buffer(
13926            inp_in,
13927            &mut buffer_out,
13928            &mut buffer_buf_size,
13929            keep_in_name.as_ptr(),
13930            keep_in,
13931            background_in_name.as_ptr(),
13932            background_in,
13933            page_height_in_name.as_ptr(),
13934            page_height_in,
13935            profile_in_name.as_ptr(),
13936            profile_in.as_ptr(),
13937            NULL,
13938        );
13939        utils::result(
13940            vips_op_response,
13941            utils::new_byte_array(buffer_out, buffer_buf_size),
13942            Error::RadsaveBufferError,
13943        )
13944    }
13945}
13946
13947/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target, nocache (.hdr), priority=0, mono rgb
13948/// inp: `&VipsImage` -> Image to save
13949/// target: `&VipsTarget` -> Target to save to
13950
13951pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13952    unsafe {
13953        let inp_in: *mut bindings::VipsImage = inp.ctx;
13954        let target_in: *mut bindings::VipsTarget = target.ctx;
13955
13956        let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
13957        utils::result(vips_op_response, (), Error::RadsaveTargetError)
13958    }
13959}
13960
13961/// Options for radsave_target operation
13962#[derive(Clone, Debug)]
13963pub struct RadsaveTargetOptions {
13964    /// keep: `ForeignKeep` -> Which metadata to retain
13965    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
13966    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
13967    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
13968    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
13969    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
13970    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
13971    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
13972    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
13973    pub keep: ForeignKeep,
13974    /// background: `Vec<f64>` -> Background value
13975    pub background: Vec<f64>,
13976    /// page_height: `i32` -> Set page height for multipage save
13977    /// min: 0, max: 100000000, default: 0
13978    pub page_height: i32,
13979    /// profile: `String` -> Filename of ICC profile to embed
13980    pub profile: String,
13981}
13982
13983impl std::default::Default for RadsaveTargetOptions {
13984    fn default() -> Self {
13985        RadsaveTargetOptions {
13986            keep: ForeignKeep::All,
13987            background: Vec::new(),
13988            page_height: i32::from(0),
13989            profile: String::from("sRGB"),
13990        }
13991    }
13992}
13993
13994/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target, nocache (.hdr), priority=0, mono rgb
13995/// inp: `&VipsImage` -> Image to save
13996/// target: `&VipsTarget` -> Target to save to
13997/// radsave_target_options: `&RadsaveTargetOptions` -> optional arguments
13998
13999pub fn radsave_target_with_opts(
14000    inp: &VipsImage,
14001    target: &VipsTarget,
14002    radsave_target_options: &RadsaveTargetOptions,
14003) -> Result<()> {
14004    unsafe {
14005        let inp_in: *mut bindings::VipsImage = inp.ctx;
14006        let target_in: *mut bindings::VipsTarget = target.ctx;
14007
14008        let keep_in: i32 = radsave_target_options.keep as i32;
14009        let keep_in_name = utils::new_c_string("keep")?;
14010
14011        let background_wrapper =
14012            utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
14013        let background_in = background_wrapper.ctx;
14014        let background_in_name = utils::new_c_string("background")?;
14015
14016        let page_height_in: i32 = radsave_target_options.page_height;
14017        let page_height_in_name = utils::new_c_string("page-height")?;
14018
14019        let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
14020        let profile_in_name = utils::new_c_string("profile")?;
14021
14022        let vips_op_response = bindings::vips_radsave_target(
14023            inp_in,
14024            target_in,
14025            keep_in_name.as_ptr(),
14026            keep_in,
14027            background_in_name.as_ptr(),
14028            background_in,
14029            page_height_in_name.as_ptr(),
14030            page_height_in,
14031            profile_in_name.as_ptr(),
14032            profile_in.as_ptr(),
14033            NULL,
14034        );
14035        utils::result(vips_op_response, (), Error::RadsaveTargetError)
14036    }
14037}
14038
14039/// VipsForeignSaveCgifFile (gifsave), save as gif, nocache (.gif), priority=0, rgb alpha
14040/// inp: `&VipsImage` -> Image to save
14041/// filename: `&str` -> Filename to save to
14042
14043pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
14044    unsafe {
14045        let inp_in: *mut bindings::VipsImage = inp.ctx;
14046        let filename_in: CString = utils::new_c_string(filename)?;
14047
14048        let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
14049        utils::result(vips_op_response, (), Error::GifsaveError)
14050    }
14051}
14052
14053/// Options for gifsave operation
14054#[derive(Clone, Debug)]
14055pub struct GifsaveOptions {
14056    /// dither: `f64` -> Amount of dithering
14057    /// min: 0, max: 1, default: 1
14058    pub dither: f64,
14059    /// effort: `i32` -> Quantisation effort
14060    /// min: 1, max: 10, default: 7
14061    pub effort: i32,
14062    /// bitdepth: `i32` -> Number of bits per pixel
14063    /// min: 1, max: 8, default: 8
14064    pub bitdepth: i32,
14065    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14066    /// min: 0, max: 32, default: 0
14067    pub interframe_maxerror: f64,
14068    /// reuse: `bool` -> Reuse palette from input
14069    /// default: false
14070    pub reuse: bool,
14071    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14072    /// min: 0, max: 256, default: 3
14073    pub interpalette_maxerror: f64,
14074    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14075    /// default: false
14076    pub interlace: bool,
14077    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14078    /// default: false
14079    pub keep_duplicate_frames: bool,
14080    /// keep: `ForeignKeep` -> Which metadata to retain
14081    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14082    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14083    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14084    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14085    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14086    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14087    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14088    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14089    pub keep: ForeignKeep,
14090    /// background: `Vec<f64>` -> Background value
14091    pub background: Vec<f64>,
14092    /// page_height: `i32` -> Set page height for multipage save
14093    /// min: 0, max: 100000000, default: 0
14094    pub page_height: i32,
14095    /// profile: `String` -> Filename of ICC profile to embed
14096    pub profile: String,
14097}
14098
14099impl std::default::Default for GifsaveOptions {
14100    fn default() -> Self {
14101        GifsaveOptions {
14102            dither: f64::from(1),
14103            effort: i32::from(7),
14104            bitdepth: i32::from(8),
14105            interframe_maxerror: f64::from(0),
14106            reuse: false,
14107            interpalette_maxerror: f64::from(3),
14108            interlace: false,
14109            keep_duplicate_frames: false,
14110            keep: ForeignKeep::All,
14111            background: Vec::new(),
14112            page_height: i32::from(0),
14113            profile: String::from("sRGB"),
14114        }
14115    }
14116}
14117
14118/// VipsForeignSaveCgifFile (gifsave), save as gif, nocache (.gif), priority=0, rgb alpha
14119/// inp: `&VipsImage` -> Image to save
14120/// filename: `&str` -> Filename to save to
14121/// gifsave_options: `&GifsaveOptions` -> optional arguments
14122
14123pub fn gifsave_with_opts(
14124    inp: &VipsImage,
14125    filename: &str,
14126    gifsave_options: &GifsaveOptions,
14127) -> Result<()> {
14128    unsafe {
14129        let inp_in: *mut bindings::VipsImage = inp.ctx;
14130        let filename_in: CString = utils::new_c_string(filename)?;
14131
14132        let dither_in: f64 = gifsave_options.dither;
14133        let dither_in_name = utils::new_c_string("dither")?;
14134
14135        let effort_in: i32 = gifsave_options.effort;
14136        let effort_in_name = utils::new_c_string("effort")?;
14137
14138        let bitdepth_in: i32 = gifsave_options.bitdepth;
14139        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14140
14141        let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
14142        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14143
14144        let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
14145        let reuse_in_name = utils::new_c_string("reuse")?;
14146
14147        let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
14148        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14149
14150        let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
14151        let interlace_in_name = utils::new_c_string("interlace")?;
14152
14153        let keep_duplicate_frames_in: i32 = if gifsave_options.keep_duplicate_frames {
14154            1
14155        } else {
14156            0
14157        };
14158        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14159
14160        let keep_in: i32 = gifsave_options.keep as i32;
14161        let keep_in_name = utils::new_c_string("keep")?;
14162
14163        let background_wrapper =
14164            utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
14165        let background_in = background_wrapper.ctx;
14166        let background_in_name = utils::new_c_string("background")?;
14167
14168        let page_height_in: i32 = gifsave_options.page_height;
14169        let page_height_in_name = utils::new_c_string("page-height")?;
14170
14171        let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
14172        let profile_in_name = utils::new_c_string("profile")?;
14173
14174        let vips_op_response = bindings::vips_gifsave(
14175            inp_in,
14176            filename_in.as_ptr(),
14177            dither_in_name.as_ptr(),
14178            dither_in,
14179            effort_in_name.as_ptr(),
14180            effort_in,
14181            bitdepth_in_name.as_ptr(),
14182            bitdepth_in,
14183            interframe_maxerror_in_name.as_ptr(),
14184            interframe_maxerror_in,
14185            reuse_in_name.as_ptr(),
14186            reuse_in,
14187            interpalette_maxerror_in_name.as_ptr(),
14188            interpalette_maxerror_in,
14189            interlace_in_name.as_ptr(),
14190            interlace_in,
14191            keep_duplicate_frames_in_name.as_ptr(),
14192            keep_duplicate_frames_in,
14193            keep_in_name.as_ptr(),
14194            keep_in,
14195            background_in_name.as_ptr(),
14196            background_in,
14197            page_height_in_name.as_ptr(),
14198            page_height_in,
14199            profile_in_name.as_ptr(),
14200            profile_in.as_ptr(),
14201            NULL,
14202        );
14203        utils::result(vips_op_response, (), Error::GifsaveError)
14204    }
14205}
14206
14207/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif, nocache (.gif), priority=0, rgb alpha
14208/// inp: `&VipsImage` -> Image to save
14209/// returns `Vec<u8>` - Buffer to save to
14210pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14211    unsafe {
14212        let inp_in: *mut bindings::VipsImage = inp.ctx;
14213        let mut buffer_buf_size: u64 = 0;
14214        let mut buffer_out: *mut c_void = null_mut();
14215
14216        let vips_op_response =
14217            bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14218        utils::result(
14219            vips_op_response,
14220            utils::new_byte_array(buffer_out, buffer_buf_size),
14221            Error::GifsaveBufferError,
14222        )
14223    }
14224}
14225
14226/// Options for gifsave_buffer operation
14227#[derive(Clone, Debug)]
14228pub struct GifsaveBufferOptions {
14229    /// dither: `f64` -> Amount of dithering
14230    /// min: 0, max: 1, default: 1
14231    pub dither: f64,
14232    /// effort: `i32` -> Quantisation effort
14233    /// min: 1, max: 10, default: 7
14234    pub effort: i32,
14235    /// bitdepth: `i32` -> Number of bits per pixel
14236    /// min: 1, max: 8, default: 8
14237    pub bitdepth: i32,
14238    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14239    /// min: 0, max: 32, default: 0
14240    pub interframe_maxerror: f64,
14241    /// reuse: `bool` -> Reuse palette from input
14242    /// default: false
14243    pub reuse: bool,
14244    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14245    /// min: 0, max: 256, default: 3
14246    pub interpalette_maxerror: f64,
14247    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14248    /// default: false
14249    pub interlace: bool,
14250    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14251    /// default: false
14252    pub keep_duplicate_frames: bool,
14253    /// keep: `ForeignKeep` -> Which metadata to retain
14254    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14255    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14256    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14257    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14258    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14259    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14260    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14261    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14262    pub keep: ForeignKeep,
14263    /// background: `Vec<f64>` -> Background value
14264    pub background: Vec<f64>,
14265    /// page_height: `i32` -> Set page height for multipage save
14266    /// min: 0, max: 100000000, default: 0
14267    pub page_height: i32,
14268    /// profile: `String` -> Filename of ICC profile to embed
14269    pub profile: String,
14270}
14271
14272impl std::default::Default for GifsaveBufferOptions {
14273    fn default() -> Self {
14274        GifsaveBufferOptions {
14275            dither: f64::from(1),
14276            effort: i32::from(7),
14277            bitdepth: i32::from(8),
14278            interframe_maxerror: f64::from(0),
14279            reuse: false,
14280            interpalette_maxerror: f64::from(3),
14281            interlace: false,
14282            keep_duplicate_frames: false,
14283            keep: ForeignKeep::All,
14284            background: Vec::new(),
14285            page_height: i32::from(0),
14286            profile: String::from("sRGB"),
14287        }
14288    }
14289}
14290
14291/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif, nocache (.gif), priority=0, rgb alpha
14292/// inp: `&VipsImage` -> Image to save
14293/// gifsave_buffer_options: `&GifsaveBufferOptions` -> optional arguments
14294/// returns `Vec<u8>` - Buffer to save to
14295pub fn gifsave_buffer_with_opts(
14296    inp: &VipsImage,
14297    gifsave_buffer_options: &GifsaveBufferOptions,
14298) -> Result<Vec<u8>> {
14299    unsafe {
14300        let inp_in: *mut bindings::VipsImage = inp.ctx;
14301        let mut buffer_buf_size: u64 = 0;
14302        let mut buffer_out: *mut c_void = null_mut();
14303
14304        let dither_in: f64 = gifsave_buffer_options.dither;
14305        let dither_in_name = utils::new_c_string("dither")?;
14306
14307        let effort_in: i32 = gifsave_buffer_options.effort;
14308        let effort_in_name = utils::new_c_string("effort")?;
14309
14310        let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
14311        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14312
14313        let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
14314        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14315
14316        let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
14317        let reuse_in_name = utils::new_c_string("reuse")?;
14318
14319        let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
14320        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14321
14322        let interlace_in: i32 = if gifsave_buffer_options.interlace {
14323            1
14324        } else {
14325            0
14326        };
14327        let interlace_in_name = utils::new_c_string("interlace")?;
14328
14329        let keep_duplicate_frames_in: i32 = if gifsave_buffer_options.keep_duplicate_frames {
14330            1
14331        } else {
14332            0
14333        };
14334        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14335
14336        let keep_in: i32 = gifsave_buffer_options.keep as i32;
14337        let keep_in_name = utils::new_c_string("keep")?;
14338
14339        let background_wrapper =
14340            utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
14341        let background_in = background_wrapper.ctx;
14342        let background_in_name = utils::new_c_string("background")?;
14343
14344        let page_height_in: i32 = gifsave_buffer_options.page_height;
14345        let page_height_in_name = utils::new_c_string("page-height")?;
14346
14347        let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14348        let profile_in_name = utils::new_c_string("profile")?;
14349
14350        let vips_op_response = bindings::vips_gifsave_buffer(
14351            inp_in,
14352            &mut buffer_out,
14353            &mut buffer_buf_size,
14354            dither_in_name.as_ptr(),
14355            dither_in,
14356            effort_in_name.as_ptr(),
14357            effort_in,
14358            bitdepth_in_name.as_ptr(),
14359            bitdepth_in,
14360            interframe_maxerror_in_name.as_ptr(),
14361            interframe_maxerror_in,
14362            reuse_in_name.as_ptr(),
14363            reuse_in,
14364            interpalette_maxerror_in_name.as_ptr(),
14365            interpalette_maxerror_in,
14366            interlace_in_name.as_ptr(),
14367            interlace_in,
14368            keep_duplicate_frames_in_name.as_ptr(),
14369            keep_duplicate_frames_in,
14370            keep_in_name.as_ptr(),
14371            keep_in,
14372            background_in_name.as_ptr(),
14373            background_in,
14374            page_height_in_name.as_ptr(),
14375            page_height_in,
14376            profile_in_name.as_ptr(),
14377            profile_in.as_ptr(),
14378            NULL,
14379        );
14380        utils::result(
14381            vips_op_response,
14382            utils::new_byte_array(buffer_out, buffer_buf_size),
14383            Error::GifsaveBufferError,
14384        )
14385    }
14386}
14387
14388/// VipsForeignSaveCgifTarget (gifsave_target), save as gif, nocache (.gif), priority=0, rgb alpha
14389/// inp: `&VipsImage` -> Image to save
14390/// target: `&VipsTarget` -> Target to save to
14391
14392pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14393    unsafe {
14394        let inp_in: *mut bindings::VipsImage = inp.ctx;
14395        let target_in: *mut bindings::VipsTarget = target.ctx;
14396
14397        let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14398        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14399    }
14400}
14401
14402/// Options for gifsave_target operation
14403#[derive(Clone, Debug)]
14404pub struct GifsaveTargetOptions {
14405    /// dither: `f64` -> Amount of dithering
14406    /// min: 0, max: 1, default: 1
14407    pub dither: f64,
14408    /// effort: `i32` -> Quantisation effort
14409    /// min: 1, max: 10, default: 7
14410    pub effort: i32,
14411    /// bitdepth: `i32` -> Number of bits per pixel
14412    /// min: 1, max: 8, default: 8
14413    pub bitdepth: i32,
14414    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
14415    /// min: 0, max: 32, default: 0
14416    pub interframe_maxerror: f64,
14417    /// reuse: `bool` -> Reuse palette from input
14418    /// default: false
14419    pub reuse: bool,
14420    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
14421    /// min: 0, max: 256, default: 3
14422    pub interpalette_maxerror: f64,
14423    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
14424    /// default: false
14425    pub interlace: bool,
14426    /// keep_duplicate_frames: `bool` -> Keep duplicate frames in the output instead of combining them
14427    /// default: false
14428    pub keep_duplicate_frames: bool,
14429    /// keep: `ForeignKeep` -> Which metadata to retain
14430    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14431    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14432    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14433    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14434    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14435    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14436    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14437    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14438    pub keep: ForeignKeep,
14439    /// background: `Vec<f64>` -> Background value
14440    pub background: Vec<f64>,
14441    /// page_height: `i32` -> Set page height for multipage save
14442    /// min: 0, max: 100000000, default: 0
14443    pub page_height: i32,
14444    /// profile: `String` -> Filename of ICC profile to embed
14445    pub profile: String,
14446}
14447
14448impl std::default::Default for GifsaveTargetOptions {
14449    fn default() -> Self {
14450        GifsaveTargetOptions {
14451            dither: f64::from(1),
14452            effort: i32::from(7),
14453            bitdepth: i32::from(8),
14454            interframe_maxerror: f64::from(0),
14455            reuse: false,
14456            interpalette_maxerror: f64::from(3),
14457            interlace: false,
14458            keep_duplicate_frames: false,
14459            keep: ForeignKeep::All,
14460            background: Vec::new(),
14461            page_height: i32::from(0),
14462            profile: String::from("sRGB"),
14463        }
14464    }
14465}
14466
14467/// VipsForeignSaveCgifTarget (gifsave_target), save as gif, nocache (.gif), priority=0, rgb alpha
14468/// inp: `&VipsImage` -> Image to save
14469/// target: `&VipsTarget` -> Target to save to
14470/// gifsave_target_options: `&GifsaveTargetOptions` -> optional arguments
14471
14472pub fn gifsave_target_with_opts(
14473    inp: &VipsImage,
14474    target: &VipsTarget,
14475    gifsave_target_options: &GifsaveTargetOptions,
14476) -> Result<()> {
14477    unsafe {
14478        let inp_in: *mut bindings::VipsImage = inp.ctx;
14479        let target_in: *mut bindings::VipsTarget = target.ctx;
14480
14481        let dither_in: f64 = gifsave_target_options.dither;
14482        let dither_in_name = utils::new_c_string("dither")?;
14483
14484        let effort_in: i32 = gifsave_target_options.effort;
14485        let effort_in_name = utils::new_c_string("effort")?;
14486
14487        let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14488        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14489
14490        let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14491        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14492
14493        let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14494        let reuse_in_name = utils::new_c_string("reuse")?;
14495
14496        let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14497        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14498
14499        let interlace_in: i32 = if gifsave_target_options.interlace {
14500            1
14501        } else {
14502            0
14503        };
14504        let interlace_in_name = utils::new_c_string("interlace")?;
14505
14506        let keep_duplicate_frames_in: i32 = if gifsave_target_options.keep_duplicate_frames {
14507            1
14508        } else {
14509            0
14510        };
14511        let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14512
14513        let keep_in: i32 = gifsave_target_options.keep as i32;
14514        let keep_in_name = utils::new_c_string("keep")?;
14515
14516        let background_wrapper =
14517            utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14518        let background_in = background_wrapper.ctx;
14519        let background_in_name = utils::new_c_string("background")?;
14520
14521        let page_height_in: i32 = gifsave_target_options.page_height;
14522        let page_height_in_name = utils::new_c_string("page-height")?;
14523
14524        let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14525        let profile_in_name = utils::new_c_string("profile")?;
14526
14527        let vips_op_response = bindings::vips_gifsave_target(
14528            inp_in,
14529            target_in,
14530            dither_in_name.as_ptr(),
14531            dither_in,
14532            effort_in_name.as_ptr(),
14533            effort_in,
14534            bitdepth_in_name.as_ptr(),
14535            bitdepth_in,
14536            interframe_maxerror_in_name.as_ptr(),
14537            interframe_maxerror_in,
14538            reuse_in_name.as_ptr(),
14539            reuse_in,
14540            interpalette_maxerror_in_name.as_ptr(),
14541            interpalette_maxerror_in,
14542            interlace_in_name.as_ptr(),
14543            interlace_in,
14544            keep_duplicate_frames_in_name.as_ptr(),
14545            keep_duplicate_frames_in,
14546            keep_in_name.as_ptr(),
14547            keep_in,
14548            background_in_name.as_ptr(),
14549            background_in,
14550            page_height_in_name.as_ptr(),
14551            page_height_in,
14552            profile_in_name.as_ptr(),
14553            profile_in.as_ptr(),
14554            NULL,
14555        );
14556        utils::result(vips_op_response, (), Error::GifsaveTargetError)
14557    }
14558}
14559
14560/// VipsForeignSavePngFile (pngsave), save image to file as png, nocache (.png), priority=0, mono rgb alpha
14561/// inp: `&VipsImage` -> Image to save
14562/// filename: `&str` -> Filename to save to
14563
14564pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14565    unsafe {
14566        let inp_in: *mut bindings::VipsImage = inp.ctx;
14567        let filename_in: CString = utils::new_c_string(filename)?;
14568
14569        let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14570        utils::result(vips_op_response, (), Error::PngsaveError)
14571    }
14572}
14573
14574/// Options for pngsave operation
14575#[derive(Clone, Debug)]
14576pub struct PngsaveOptions {
14577    /// compression: `i32` -> Compression factor
14578    /// min: 0, max: 9, default: 6
14579    pub compression: i32,
14580    /// interlace: `bool` -> Interlace image
14581    /// default: false
14582    pub interlace: bool,
14583    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14584    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14585    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14586    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14587    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14588    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14589    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14590    pub filter: ForeignPngFilter,
14591    /// palette: `bool` -> Quantise to 8bpp palette
14592    /// default: false
14593    pub palette: bool,
14594    /// q: `i32` -> Quantisation quality
14595    /// min: 0, max: 100, default: 100
14596    pub q: i32,
14597    /// dither: `f64` -> Amount of dithering
14598    /// min: 0, max: 1, default: 1
14599    pub dither: f64,
14600    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14601    /// min: 1, max: 16, default: 8
14602    pub bitdepth: i32,
14603    /// effort: `i32` -> Quantisation CPU effort
14604    /// min: 1, max: 10, default: 7
14605    pub effort: i32,
14606    /// keep: `ForeignKeep` -> Which metadata to retain
14607    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14608    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14609    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14610    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14611    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14612    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14613    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14614    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14615    pub keep: ForeignKeep,
14616    /// background: `Vec<f64>` -> Background value
14617    pub background: Vec<f64>,
14618    /// page_height: `i32` -> Set page height for multipage save
14619    /// min: 0, max: 100000000, default: 0
14620    pub page_height: i32,
14621    /// profile: `String` -> Filename of ICC profile to embed
14622    pub profile: String,
14623}
14624
14625impl std::default::Default for PngsaveOptions {
14626    fn default() -> Self {
14627        PngsaveOptions {
14628            compression: i32::from(6),
14629            interlace: false,
14630            filter: ForeignPngFilter::None,
14631            palette: false,
14632            q: i32::from(100),
14633            dither: f64::from(1),
14634            bitdepth: i32::from(8),
14635            effort: i32::from(7),
14636            keep: ForeignKeep::All,
14637            background: Vec::new(),
14638            page_height: i32::from(0),
14639            profile: String::from("sRGB"),
14640        }
14641    }
14642}
14643
14644/// VipsForeignSavePngFile (pngsave), save image to file as png, nocache (.png), priority=0, mono rgb alpha
14645/// inp: `&VipsImage` -> Image to save
14646/// filename: `&str` -> Filename to save to
14647/// pngsave_options: `&PngsaveOptions` -> optional arguments
14648
14649pub fn pngsave_with_opts(
14650    inp: &VipsImage,
14651    filename: &str,
14652    pngsave_options: &PngsaveOptions,
14653) -> Result<()> {
14654    unsafe {
14655        let inp_in: *mut bindings::VipsImage = inp.ctx;
14656        let filename_in: CString = utils::new_c_string(filename)?;
14657
14658        let compression_in: i32 = pngsave_options.compression;
14659        let compression_in_name = utils::new_c_string("compression")?;
14660
14661        let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14662        let interlace_in_name = utils::new_c_string("interlace")?;
14663
14664        let filter_in: i32 = pngsave_options.filter as i32;
14665        let filter_in_name = utils::new_c_string("filter")?;
14666
14667        let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14668        let palette_in_name = utils::new_c_string("palette")?;
14669
14670        let q_in: i32 = pngsave_options.q;
14671        let q_in_name = utils::new_c_string("Q")?;
14672
14673        let dither_in: f64 = pngsave_options.dither;
14674        let dither_in_name = utils::new_c_string("dither")?;
14675
14676        let bitdepth_in: i32 = pngsave_options.bitdepth;
14677        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14678
14679        let effort_in: i32 = pngsave_options.effort;
14680        let effort_in_name = utils::new_c_string("effort")?;
14681
14682        let keep_in: i32 = pngsave_options.keep as i32;
14683        let keep_in_name = utils::new_c_string("keep")?;
14684
14685        let background_wrapper =
14686            utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14687        let background_in = background_wrapper.ctx;
14688        let background_in_name = utils::new_c_string("background")?;
14689
14690        let page_height_in: i32 = pngsave_options.page_height;
14691        let page_height_in_name = utils::new_c_string("page-height")?;
14692
14693        let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14694        let profile_in_name = utils::new_c_string("profile")?;
14695
14696        let vips_op_response = bindings::vips_pngsave(
14697            inp_in,
14698            filename_in.as_ptr(),
14699            compression_in_name.as_ptr(),
14700            compression_in,
14701            interlace_in_name.as_ptr(),
14702            interlace_in,
14703            filter_in_name.as_ptr(),
14704            filter_in,
14705            palette_in_name.as_ptr(),
14706            palette_in,
14707            q_in_name.as_ptr(),
14708            q_in,
14709            dither_in_name.as_ptr(),
14710            dither_in,
14711            bitdepth_in_name.as_ptr(),
14712            bitdepth_in,
14713            effort_in_name.as_ptr(),
14714            effort_in,
14715            keep_in_name.as_ptr(),
14716            keep_in,
14717            background_in_name.as_ptr(),
14718            background_in,
14719            page_height_in_name.as_ptr(),
14720            page_height_in,
14721            profile_in_name.as_ptr(),
14722            profile_in.as_ptr(),
14723            NULL,
14724        );
14725        utils::result(vips_op_response, (), Error::PngsaveError)
14726    }
14727}
14728
14729/// VipsForeignSavePngBuffer (pngsave_buffer), save image to buffer as png, nocache (.png), priority=0, mono rgb alpha
14730/// inp: `&VipsImage` -> Image to save
14731/// returns `Vec<u8>` - Buffer to save to
14732pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14733    unsafe {
14734        let inp_in: *mut bindings::VipsImage = inp.ctx;
14735        let mut buffer_buf_size: u64 = 0;
14736        let mut buffer_out: *mut c_void = null_mut();
14737
14738        let vips_op_response =
14739            bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14740        utils::result(
14741            vips_op_response,
14742            utils::new_byte_array(buffer_out, buffer_buf_size),
14743            Error::PngsaveBufferError,
14744        )
14745    }
14746}
14747
14748/// Options for pngsave_buffer operation
14749#[derive(Clone, Debug)]
14750pub struct PngsaveBufferOptions {
14751    /// compression: `i32` -> Compression factor
14752    /// min: 0, max: 9, default: 6
14753    pub compression: i32,
14754    /// interlace: `bool` -> Interlace image
14755    /// default: false
14756    pub interlace: bool,
14757    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14758    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14759    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14760    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14761    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14762    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14763    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14764    pub filter: ForeignPngFilter,
14765    /// palette: `bool` -> Quantise to 8bpp palette
14766    /// default: false
14767    pub palette: bool,
14768    /// q: `i32` -> Quantisation quality
14769    /// min: 0, max: 100, default: 100
14770    pub q: i32,
14771    /// dither: `f64` -> Amount of dithering
14772    /// min: 0, max: 1, default: 1
14773    pub dither: f64,
14774    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14775    /// min: 1, max: 16, default: 8
14776    pub bitdepth: i32,
14777    /// effort: `i32` -> Quantisation CPU effort
14778    /// min: 1, max: 10, default: 7
14779    pub effort: i32,
14780    /// keep: `ForeignKeep` -> Which metadata to retain
14781    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14782    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14783    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14784    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14785    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14786    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14787    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14788    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14789    pub keep: ForeignKeep,
14790    /// background: `Vec<f64>` -> Background value
14791    pub background: Vec<f64>,
14792    /// page_height: `i32` -> Set page height for multipage save
14793    /// min: 0, max: 100000000, default: 0
14794    pub page_height: i32,
14795    /// profile: `String` -> Filename of ICC profile to embed
14796    pub profile: String,
14797}
14798
14799impl std::default::Default for PngsaveBufferOptions {
14800    fn default() -> Self {
14801        PngsaveBufferOptions {
14802            compression: i32::from(6),
14803            interlace: false,
14804            filter: ForeignPngFilter::None,
14805            palette: false,
14806            q: i32::from(100),
14807            dither: f64::from(1),
14808            bitdepth: i32::from(8),
14809            effort: i32::from(7),
14810            keep: ForeignKeep::All,
14811            background: Vec::new(),
14812            page_height: i32::from(0),
14813            profile: String::from("sRGB"),
14814        }
14815    }
14816}
14817
14818/// VipsForeignSavePngBuffer (pngsave_buffer), save image to buffer as png, nocache (.png), priority=0, mono rgb alpha
14819/// inp: `&VipsImage` -> Image to save
14820/// pngsave_buffer_options: `&PngsaveBufferOptions` -> optional arguments
14821/// returns `Vec<u8>` - Buffer to save to
14822pub fn pngsave_buffer_with_opts(
14823    inp: &VipsImage,
14824    pngsave_buffer_options: &PngsaveBufferOptions,
14825) -> Result<Vec<u8>> {
14826    unsafe {
14827        let inp_in: *mut bindings::VipsImage = inp.ctx;
14828        let mut buffer_buf_size: u64 = 0;
14829        let mut buffer_out: *mut c_void = null_mut();
14830
14831        let compression_in: i32 = pngsave_buffer_options.compression;
14832        let compression_in_name = utils::new_c_string("compression")?;
14833
14834        let interlace_in: i32 = if pngsave_buffer_options.interlace {
14835            1
14836        } else {
14837            0
14838        };
14839        let interlace_in_name = utils::new_c_string("interlace")?;
14840
14841        let filter_in: i32 = pngsave_buffer_options.filter as i32;
14842        let filter_in_name = utils::new_c_string("filter")?;
14843
14844        let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14845        let palette_in_name = utils::new_c_string("palette")?;
14846
14847        let q_in: i32 = pngsave_buffer_options.q;
14848        let q_in_name = utils::new_c_string("Q")?;
14849
14850        let dither_in: f64 = pngsave_buffer_options.dither;
14851        let dither_in_name = utils::new_c_string("dither")?;
14852
14853        let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
14854        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14855
14856        let effort_in: i32 = pngsave_buffer_options.effort;
14857        let effort_in_name = utils::new_c_string("effort")?;
14858
14859        let keep_in: i32 = pngsave_buffer_options.keep as i32;
14860        let keep_in_name = utils::new_c_string("keep")?;
14861
14862        let background_wrapper =
14863            utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
14864        let background_in = background_wrapper.ctx;
14865        let background_in_name = utils::new_c_string("background")?;
14866
14867        let page_height_in: i32 = pngsave_buffer_options.page_height;
14868        let page_height_in_name = utils::new_c_string("page-height")?;
14869
14870        let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
14871        let profile_in_name = utils::new_c_string("profile")?;
14872
14873        let vips_op_response = bindings::vips_pngsave_buffer(
14874            inp_in,
14875            &mut buffer_out,
14876            &mut buffer_buf_size,
14877            compression_in_name.as_ptr(),
14878            compression_in,
14879            interlace_in_name.as_ptr(),
14880            interlace_in,
14881            filter_in_name.as_ptr(),
14882            filter_in,
14883            palette_in_name.as_ptr(),
14884            palette_in,
14885            q_in_name.as_ptr(),
14886            q_in,
14887            dither_in_name.as_ptr(),
14888            dither_in,
14889            bitdepth_in_name.as_ptr(),
14890            bitdepth_in,
14891            effort_in_name.as_ptr(),
14892            effort_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(
14904            vips_op_response,
14905            utils::new_byte_array(buffer_out, buffer_buf_size),
14906            Error::PngsaveBufferError,
14907        )
14908    }
14909}
14910
14911/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG, nocache (.png), priority=0, mono rgb alpha
14912/// inp: `&VipsImage` -> Image to save
14913/// target: `&VipsTarget` -> Target to save to
14914
14915pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14916    unsafe {
14917        let inp_in: *mut bindings::VipsImage = inp.ctx;
14918        let target_in: *mut bindings::VipsTarget = target.ctx;
14919
14920        let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
14921        utils::result(vips_op_response, (), Error::PngsaveTargetError)
14922    }
14923}
14924
14925/// Options for pngsave_target operation
14926#[derive(Clone, Debug)]
14927pub struct PngsaveTargetOptions {
14928    /// compression: `i32` -> Compression factor
14929    /// min: 0, max: 9, default: 6
14930    pub compression: i32,
14931    /// interlace: `bool` -> Interlace image
14932    /// default: false
14933    pub interlace: bool,
14934    /// filter: `ForeignPngFilter` -> libpng row filter flag(s)
14935    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
14936    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
14937    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
14938    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
14939    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
14940    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
14941    pub filter: ForeignPngFilter,
14942    /// palette: `bool` -> Quantise to 8bpp palette
14943    /// default: false
14944    pub palette: bool,
14945    /// q: `i32` -> Quantisation quality
14946    /// min: 0, max: 100, default: 100
14947    pub q: i32,
14948    /// dither: `f64` -> Amount of dithering
14949    /// min: 0, max: 1, default: 1
14950    pub dither: f64,
14951    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
14952    /// min: 1, max: 16, default: 8
14953    pub bitdepth: i32,
14954    /// effort: `i32` -> Quantisation CPU effort
14955    /// min: 1, max: 10, default: 7
14956    pub effort: i32,
14957    /// keep: `ForeignKeep` -> Which metadata to retain
14958    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14959    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14960    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14961    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14962    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14963    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14964    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
14965    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
14966    pub keep: ForeignKeep,
14967    /// background: `Vec<f64>` -> Background value
14968    pub background: Vec<f64>,
14969    /// page_height: `i32` -> Set page height for multipage save
14970    /// min: 0, max: 100000000, default: 0
14971    pub page_height: i32,
14972    /// profile: `String` -> Filename of ICC profile to embed
14973    pub profile: String,
14974}
14975
14976impl std::default::Default for PngsaveTargetOptions {
14977    fn default() -> Self {
14978        PngsaveTargetOptions {
14979            compression: i32::from(6),
14980            interlace: false,
14981            filter: ForeignPngFilter::None,
14982            palette: false,
14983            q: i32::from(100),
14984            dither: f64::from(1),
14985            bitdepth: i32::from(8),
14986            effort: i32::from(7),
14987            keep: ForeignKeep::All,
14988            background: Vec::new(),
14989            page_height: i32::from(0),
14990            profile: String::from("sRGB"),
14991        }
14992    }
14993}
14994
14995/// VipsForeignSavePngTarget (pngsave_target), save image to target as PNG, nocache (.png), priority=0, mono rgb alpha
14996/// inp: `&VipsImage` -> Image to save
14997/// target: `&VipsTarget` -> Target to save to
14998/// pngsave_target_options: `&PngsaveTargetOptions` -> optional arguments
14999
15000pub fn pngsave_target_with_opts(
15001    inp: &VipsImage,
15002    target: &VipsTarget,
15003    pngsave_target_options: &PngsaveTargetOptions,
15004) -> Result<()> {
15005    unsafe {
15006        let inp_in: *mut bindings::VipsImage = inp.ctx;
15007        let target_in: *mut bindings::VipsTarget = target.ctx;
15008
15009        let compression_in: i32 = pngsave_target_options.compression;
15010        let compression_in_name = utils::new_c_string("compression")?;
15011
15012        let interlace_in: i32 = if pngsave_target_options.interlace {
15013            1
15014        } else {
15015            0
15016        };
15017        let interlace_in_name = utils::new_c_string("interlace")?;
15018
15019        let filter_in: i32 = pngsave_target_options.filter as i32;
15020        let filter_in_name = utils::new_c_string("filter")?;
15021
15022        let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
15023        let palette_in_name = utils::new_c_string("palette")?;
15024
15025        let q_in: i32 = pngsave_target_options.q;
15026        let q_in_name = utils::new_c_string("Q")?;
15027
15028        let dither_in: f64 = pngsave_target_options.dither;
15029        let dither_in_name = utils::new_c_string("dither")?;
15030
15031        let bitdepth_in: i32 = pngsave_target_options.bitdepth;
15032        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15033
15034        let effort_in: i32 = pngsave_target_options.effort;
15035        let effort_in_name = utils::new_c_string("effort")?;
15036
15037        let keep_in: i32 = pngsave_target_options.keep as i32;
15038        let keep_in_name = utils::new_c_string("keep")?;
15039
15040        let background_wrapper =
15041            utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
15042        let background_in = background_wrapper.ctx;
15043        let background_in_name = utils::new_c_string("background")?;
15044
15045        let page_height_in: i32 = pngsave_target_options.page_height;
15046        let page_height_in_name = utils::new_c_string("page-height")?;
15047
15048        let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
15049        let profile_in_name = utils::new_c_string("profile")?;
15050
15051        let vips_op_response = bindings::vips_pngsave_target(
15052            inp_in,
15053            target_in,
15054            compression_in_name.as_ptr(),
15055            compression_in,
15056            interlace_in_name.as_ptr(),
15057            interlace_in,
15058            filter_in_name.as_ptr(),
15059            filter_in,
15060            palette_in_name.as_ptr(),
15061            palette_in,
15062            q_in_name.as_ptr(),
15063            q_in,
15064            dither_in_name.as_ptr(),
15065            dither_in,
15066            bitdepth_in_name.as_ptr(),
15067            bitdepth_in,
15068            effort_in_name.as_ptr(),
15069            effort_in,
15070            keep_in_name.as_ptr(),
15071            keep_in,
15072            background_in_name.as_ptr(),
15073            background_in,
15074            page_height_in_name.as_ptr(),
15075            page_height_in,
15076            profile_in_name.as_ptr(),
15077            profile_in.as_ptr(),
15078            NULL,
15079        );
15080        utils::result(vips_op_response, (), Error::PngsaveTargetError)
15081    }
15082}
15083
15084/// VipsForeignSaveJpegFile (jpegsave), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15085/// inp: `&VipsImage` -> Image to save
15086/// filename: `&str` -> Filename to save to
15087
15088pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
15089    unsafe {
15090        let inp_in: *mut bindings::VipsImage = inp.ctx;
15091        let filename_in: CString = utils::new_c_string(filename)?;
15092
15093        let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
15094        utils::result(vips_op_response, (), Error::JpegsaveError)
15095    }
15096}
15097
15098/// Options for jpegsave operation
15099#[derive(Clone, Debug)]
15100pub struct JpegsaveOptions {
15101    /// q: `i32` -> Q factor
15102    /// min: 1, max: 100, default: 75
15103    pub q: i32,
15104    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15105    /// default: false
15106    pub optimize_coding: bool,
15107    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15108    /// default: false
15109    pub interlace: bool,
15110    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15111    /// default: false
15112    pub trellis_quant: bool,
15113    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15114    /// default: false
15115    pub overshoot_deringing: bool,
15116    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15117    /// default: false
15118    pub optimize_scans: bool,
15119    /// quant_table: `i32` -> Use predefined quantization table with given index
15120    /// min: 0, max: 8, default: 0
15121    pub quant_table: i32,
15122    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15123    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15124    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15125    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15126    pub subsample_mode: ForeignSubsample,
15127    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15128    /// min: 0, max: 2147483647, default: 0
15129    pub restart_interval: i32,
15130    /// keep: `ForeignKeep` -> Which metadata to retain
15131    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15132    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15133    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15134    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15135    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15136    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15137    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
15138    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
15139    pub keep: ForeignKeep,
15140    /// background: `Vec<f64>` -> Background value
15141    pub background: Vec<f64>,
15142    /// page_height: `i32` -> Set page height for multipage save
15143    /// min: 0, max: 100000000, default: 0
15144    pub page_height: i32,
15145    /// profile: `String` -> Filename of ICC profile to embed
15146    pub profile: String,
15147}
15148
15149impl std::default::Default for JpegsaveOptions {
15150    fn default() -> Self {
15151        JpegsaveOptions {
15152            q: i32::from(75),
15153            optimize_coding: false,
15154            interlace: false,
15155            trellis_quant: false,
15156            overshoot_deringing: false,
15157            optimize_scans: false,
15158            quant_table: i32::from(0),
15159            subsample_mode: ForeignSubsample::Auto,
15160            restart_interval: i32::from(0),
15161            keep: ForeignKeep::All,
15162            background: Vec::new(),
15163            page_height: i32::from(0),
15164            profile: String::from("sRGB"),
15165        }
15166    }
15167}
15168
15169/// VipsForeignSaveJpegFile (jpegsave), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15170/// inp: `&VipsImage` -> Image to save
15171/// filename: `&str` -> Filename to save to
15172/// jpegsave_options: `&JpegsaveOptions` -> optional arguments
15173
15174pub fn jpegsave_with_opts(
15175    inp: &VipsImage,
15176    filename: &str,
15177    jpegsave_options: &JpegsaveOptions,
15178) -> Result<()> {
15179    unsafe {
15180        let inp_in: *mut bindings::VipsImage = inp.ctx;
15181        let filename_in: CString = utils::new_c_string(filename)?;
15182
15183        let q_in: i32 = jpegsave_options.q;
15184        let q_in_name = utils::new_c_string("Q")?;
15185
15186        let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
15187            1
15188        } else {
15189            0
15190        };
15191        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15192
15193        let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
15194        let interlace_in_name = utils::new_c_string("interlace")?;
15195
15196        let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
15197        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15198
15199        let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
15200            1
15201        } else {
15202            0
15203        };
15204        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15205
15206        let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
15207            1
15208        } else {
15209            0
15210        };
15211        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15212
15213        let quant_table_in: i32 = jpegsave_options.quant_table;
15214        let quant_table_in_name = utils::new_c_string("quant-table")?;
15215
15216        let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
15217        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15218
15219        let restart_interval_in: i32 = jpegsave_options.restart_interval;
15220        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15221
15222        let keep_in: i32 = jpegsave_options.keep as i32;
15223        let keep_in_name = utils::new_c_string("keep")?;
15224
15225        let background_wrapper =
15226            utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
15227        let background_in = background_wrapper.ctx;
15228        let background_in_name = utils::new_c_string("background")?;
15229
15230        let page_height_in: i32 = jpegsave_options.page_height;
15231        let page_height_in_name = utils::new_c_string("page-height")?;
15232
15233        let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
15234        let profile_in_name = utils::new_c_string("profile")?;
15235
15236        let vips_op_response = bindings::vips_jpegsave(
15237            inp_in,
15238            filename_in.as_ptr(),
15239            q_in_name.as_ptr(),
15240            q_in,
15241            optimize_coding_in_name.as_ptr(),
15242            optimize_coding_in,
15243            interlace_in_name.as_ptr(),
15244            interlace_in,
15245            trellis_quant_in_name.as_ptr(),
15246            trellis_quant_in,
15247            overshoot_deringing_in_name.as_ptr(),
15248            overshoot_deringing_in,
15249            optimize_scans_in_name.as_ptr(),
15250            optimize_scans_in,
15251            quant_table_in_name.as_ptr(),
15252            quant_table_in,
15253            subsample_mode_in_name.as_ptr(),
15254            subsample_mode_in,
15255            restart_interval_in_name.as_ptr(),
15256            restart_interval_in,
15257            keep_in_name.as_ptr(),
15258            keep_in,
15259            background_in_name.as_ptr(),
15260            background_in,
15261            page_height_in_name.as_ptr(),
15262            page_height_in,
15263            profile_in_name.as_ptr(),
15264            profile_in.as_ptr(),
15265            NULL,
15266        );
15267        utils::result(vips_op_response, (), Error::JpegsaveError)
15268    }
15269}
15270
15271/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15272/// inp: `&VipsImage` -> Image to save
15273/// returns `Vec<u8>` - Buffer to save to
15274pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15275    unsafe {
15276        let inp_in: *mut bindings::VipsImage = inp.ctx;
15277        let mut buffer_buf_size: u64 = 0;
15278        let mut buffer_out: *mut c_void = null_mut();
15279
15280        let vips_op_response =
15281            bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15282        utils::result(
15283            vips_op_response,
15284            utils::new_byte_array(buffer_out, buffer_buf_size),
15285            Error::JpegsaveBufferError,
15286        )
15287    }
15288}
15289
15290/// Options for jpegsave_buffer operation
15291#[derive(Clone, Debug)]
15292pub struct JpegsaveBufferOptions {
15293    /// q: `i32` -> Q factor
15294    /// min: 1, max: 100, default: 75
15295    pub q: i32,
15296    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15297    /// default: false
15298    pub optimize_coding: bool,
15299    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15300    /// default: false
15301    pub interlace: bool,
15302    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15303    /// default: false
15304    pub trellis_quant: bool,
15305    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15306    /// default: false
15307    pub overshoot_deringing: bool,
15308    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15309    /// default: false
15310    pub optimize_scans: bool,
15311    /// quant_table: `i32` -> Use predefined quantization table with given index
15312    /// min: 0, max: 8, default: 0
15313    pub quant_table: i32,
15314    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15315    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15316    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15317    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15318    pub subsample_mode: ForeignSubsample,
15319    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15320    /// min: 0, max: 2147483647, default: 0
15321    pub restart_interval: i32,
15322    /// keep: `ForeignKeep` -> Which metadata to retain
15323    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15324    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15325    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15326    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15327    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15328    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15329    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
15330    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
15331    pub keep: ForeignKeep,
15332    /// background: `Vec<f64>` -> Background value
15333    pub background: Vec<f64>,
15334    /// page_height: `i32` -> Set page height for multipage save
15335    /// min: 0, max: 100000000, default: 0
15336    pub page_height: i32,
15337    /// profile: `String` -> Filename of ICC profile to embed
15338    pub profile: String,
15339}
15340
15341impl std::default::Default for JpegsaveBufferOptions {
15342    fn default() -> Self {
15343        JpegsaveBufferOptions {
15344            q: i32::from(75),
15345            optimize_coding: false,
15346            interlace: false,
15347            trellis_quant: false,
15348            overshoot_deringing: false,
15349            optimize_scans: false,
15350            quant_table: i32::from(0),
15351            subsample_mode: ForeignSubsample::Auto,
15352            restart_interval: i32::from(0),
15353            keep: ForeignKeep::All,
15354            background: Vec::new(),
15355            page_height: i32::from(0),
15356            profile: String::from("sRGB"),
15357        }
15358    }
15359}
15360
15361/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15362/// inp: `&VipsImage` -> Image to save
15363/// jpegsave_buffer_options: `&JpegsaveBufferOptions` -> optional arguments
15364/// returns `Vec<u8>` - Buffer to save to
15365pub fn jpegsave_buffer_with_opts(
15366    inp: &VipsImage,
15367    jpegsave_buffer_options: &JpegsaveBufferOptions,
15368) -> Result<Vec<u8>> {
15369    unsafe {
15370        let inp_in: *mut bindings::VipsImage = inp.ctx;
15371        let mut buffer_buf_size: u64 = 0;
15372        let mut buffer_out: *mut c_void = null_mut();
15373
15374        let q_in: i32 = jpegsave_buffer_options.q;
15375        let q_in_name = utils::new_c_string("Q")?;
15376
15377        let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15378            1
15379        } else {
15380            0
15381        };
15382        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15383
15384        let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15385            1
15386        } else {
15387            0
15388        };
15389        let interlace_in_name = utils::new_c_string("interlace")?;
15390
15391        let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15392            1
15393        } else {
15394            0
15395        };
15396        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15397
15398        let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15399            1
15400        } else {
15401            0
15402        };
15403        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15404
15405        let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15406            1
15407        } else {
15408            0
15409        };
15410        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15411
15412        let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15413        let quant_table_in_name = utils::new_c_string("quant-table")?;
15414
15415        let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15416        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15417
15418        let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15419        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15420
15421        let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15422        let keep_in_name = utils::new_c_string("keep")?;
15423
15424        let background_wrapper =
15425            utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15426        let background_in = background_wrapper.ctx;
15427        let background_in_name = utils::new_c_string("background")?;
15428
15429        let page_height_in: i32 = jpegsave_buffer_options.page_height;
15430        let page_height_in_name = utils::new_c_string("page-height")?;
15431
15432        let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15433        let profile_in_name = utils::new_c_string("profile")?;
15434
15435        let vips_op_response = bindings::vips_jpegsave_buffer(
15436            inp_in,
15437            &mut buffer_out,
15438            &mut buffer_buf_size,
15439            q_in_name.as_ptr(),
15440            q_in,
15441            optimize_coding_in_name.as_ptr(),
15442            optimize_coding_in,
15443            interlace_in_name.as_ptr(),
15444            interlace_in,
15445            trellis_quant_in_name.as_ptr(),
15446            trellis_quant_in,
15447            overshoot_deringing_in_name.as_ptr(),
15448            overshoot_deringing_in,
15449            optimize_scans_in_name.as_ptr(),
15450            optimize_scans_in,
15451            quant_table_in_name.as_ptr(),
15452            quant_table_in,
15453            subsample_mode_in_name.as_ptr(),
15454            subsample_mode_in,
15455            restart_interval_in_name.as_ptr(),
15456            restart_interval_in,
15457            keep_in_name.as_ptr(),
15458            keep_in,
15459            background_in_name.as_ptr(),
15460            background_in,
15461            page_height_in_name.as_ptr(),
15462            page_height_in,
15463            profile_in_name.as_ptr(),
15464            profile_in.as_ptr(),
15465            NULL,
15466        );
15467        utils::result(
15468            vips_op_response,
15469            utils::new_byte_array(buffer_out, buffer_buf_size),
15470            Error::JpegsaveBufferError,
15471        )
15472    }
15473}
15474
15475/// VipsForeignSaveJpegTarget (jpegsave_target), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15476/// inp: `&VipsImage` -> Image to save
15477/// target: `&VipsTarget` -> Target to save to
15478
15479pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15480    unsafe {
15481        let inp_in: *mut bindings::VipsImage = inp.ctx;
15482        let target_in: *mut bindings::VipsTarget = target.ctx;
15483
15484        let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15485        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15486    }
15487}
15488
15489/// Options for jpegsave_target operation
15490#[derive(Clone, Debug)]
15491pub struct JpegsaveTargetOptions {
15492    /// q: `i32` -> Q factor
15493    /// min: 1, max: 100, default: 75
15494    pub q: i32,
15495    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15496    /// default: false
15497    pub optimize_coding: bool,
15498    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15499    /// default: false
15500    pub interlace: bool,
15501    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15502    /// default: false
15503    pub trellis_quant: bool,
15504    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15505    /// default: false
15506    pub overshoot_deringing: bool,
15507    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15508    /// default: false
15509    pub optimize_scans: bool,
15510    /// quant_table: `i32` -> Use predefined quantization table with given index
15511    /// min: 0, max: 8, default: 0
15512    pub quant_table: i32,
15513    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15514    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15515    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15516    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15517    pub subsample_mode: ForeignSubsample,
15518    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15519    /// min: 0, max: 2147483647, default: 0
15520    pub restart_interval: i32,
15521    /// keep: `ForeignKeep` -> Which metadata to retain
15522    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15523    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15524    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15525    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15526    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15527    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15528    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
15529    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
15530    pub keep: ForeignKeep,
15531    /// background: `Vec<f64>` -> Background value
15532    pub background: Vec<f64>,
15533    /// page_height: `i32` -> Set page height for multipage save
15534    /// min: 0, max: 100000000, default: 0
15535    pub page_height: i32,
15536    /// profile: `String` -> Filename of ICC profile to embed
15537    pub profile: String,
15538}
15539
15540impl std::default::Default for JpegsaveTargetOptions {
15541    fn default() -> Self {
15542        JpegsaveTargetOptions {
15543            q: i32::from(75),
15544            optimize_coding: false,
15545            interlace: false,
15546            trellis_quant: false,
15547            overshoot_deringing: false,
15548            optimize_scans: false,
15549            quant_table: i32::from(0),
15550            subsample_mode: ForeignSubsample::Auto,
15551            restart_interval: i32::from(0),
15552            keep: ForeignKeep::All,
15553            background: Vec::new(),
15554            page_height: i32::from(0),
15555            profile: String::from("sRGB"),
15556        }
15557    }
15558}
15559
15560/// VipsForeignSaveJpegTarget (jpegsave_target), save as jpeg, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15561/// inp: `&VipsImage` -> Image to save
15562/// target: `&VipsTarget` -> Target to save to
15563/// jpegsave_target_options: `&JpegsaveTargetOptions` -> optional arguments
15564
15565pub fn jpegsave_target_with_opts(
15566    inp: &VipsImage,
15567    target: &VipsTarget,
15568    jpegsave_target_options: &JpegsaveTargetOptions,
15569) -> Result<()> {
15570    unsafe {
15571        let inp_in: *mut bindings::VipsImage = inp.ctx;
15572        let target_in: *mut bindings::VipsTarget = target.ctx;
15573
15574        let q_in: i32 = jpegsave_target_options.q;
15575        let q_in_name = utils::new_c_string("Q")?;
15576
15577        let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15578            1
15579        } else {
15580            0
15581        };
15582        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15583
15584        let interlace_in: i32 = if jpegsave_target_options.interlace {
15585            1
15586        } else {
15587            0
15588        };
15589        let interlace_in_name = utils::new_c_string("interlace")?;
15590
15591        let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15592            1
15593        } else {
15594            0
15595        };
15596        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15597
15598        let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15599            1
15600        } else {
15601            0
15602        };
15603        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15604
15605        let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15606            1
15607        } else {
15608            0
15609        };
15610        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15611
15612        let quant_table_in: i32 = jpegsave_target_options.quant_table;
15613        let quant_table_in_name = utils::new_c_string("quant-table")?;
15614
15615        let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15616        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15617
15618        let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15619        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15620
15621        let keep_in: i32 = jpegsave_target_options.keep as i32;
15622        let keep_in_name = utils::new_c_string("keep")?;
15623
15624        let background_wrapper =
15625            utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15626        let background_in = background_wrapper.ctx;
15627        let background_in_name = utils::new_c_string("background")?;
15628
15629        let page_height_in: i32 = jpegsave_target_options.page_height;
15630        let page_height_in_name = utils::new_c_string("page-height")?;
15631
15632        let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15633        let profile_in_name = utils::new_c_string("profile")?;
15634
15635        let vips_op_response = bindings::vips_jpegsave_target(
15636            inp_in,
15637            target_in,
15638            q_in_name.as_ptr(),
15639            q_in,
15640            optimize_coding_in_name.as_ptr(),
15641            optimize_coding_in,
15642            interlace_in_name.as_ptr(),
15643            interlace_in,
15644            trellis_quant_in_name.as_ptr(),
15645            trellis_quant_in,
15646            overshoot_deringing_in_name.as_ptr(),
15647            overshoot_deringing_in,
15648            optimize_scans_in_name.as_ptr(),
15649            optimize_scans_in,
15650            quant_table_in_name.as_ptr(),
15651            quant_table_in,
15652            subsample_mode_in_name.as_ptr(),
15653            subsample_mode_in,
15654            restart_interval_in_name.as_ptr(),
15655            restart_interval_in,
15656            keep_in_name.as_ptr(),
15657            keep_in,
15658            background_in_name.as_ptr(),
15659            background_in,
15660            page_height_in_name.as_ptr(),
15661            page_height_in,
15662            profile_in_name.as_ptr(),
15663            profile_in.as_ptr(),
15664            NULL,
15665        );
15666        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15667    }
15668}
15669
15670/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15671/// inp: `&VipsImage` -> Image to save
15672
15673pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15674    unsafe {
15675        let inp_in: *mut bindings::VipsImage = inp.ctx;
15676
15677        let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15678        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15679    }
15680}
15681
15682/// Options for jpegsave_mime operation
15683#[derive(Clone, Debug)]
15684pub struct JpegsaveMimeOptions {
15685    /// q: `i32` -> Q factor
15686    /// min: 1, max: 100, default: 75
15687    pub q: i32,
15688    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
15689    /// default: false
15690    pub optimize_coding: bool,
15691    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
15692    /// default: false
15693    pub interlace: bool,
15694    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
15695    /// default: false
15696    pub trellis_quant: bool,
15697    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
15698    /// default: false
15699    pub overshoot_deringing: bool,
15700    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
15701    /// default: false
15702    pub optimize_scans: bool,
15703    /// quant_table: `i32` -> Use predefined quantization table with given index
15704    /// min: 0, max: 8, default: 0
15705    pub quant_table: i32,
15706    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
15707    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
15708    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
15709    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
15710    pub subsample_mode: ForeignSubsample,
15711    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
15712    /// min: 0, max: 2147483647, default: 0
15713    pub restart_interval: i32,
15714    /// keep: `ForeignKeep` -> Which metadata to retain
15715    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15716    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15717    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15718    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15719    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15720    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15721    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
15722    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
15723    pub keep: ForeignKeep,
15724    /// background: `Vec<f64>` -> Background value
15725    pub background: Vec<f64>,
15726    /// page_height: `i32` -> Set page height for multipage save
15727    /// min: 0, max: 100000000, default: 0
15728    pub page_height: i32,
15729    /// profile: `String` -> Filename of ICC profile to embed
15730    pub profile: String,
15731}
15732
15733impl std::default::Default for JpegsaveMimeOptions {
15734    fn default() -> Self {
15735        JpegsaveMimeOptions {
15736            q: i32::from(75),
15737            optimize_coding: false,
15738            interlace: false,
15739            trellis_quant: false,
15740            overshoot_deringing: false,
15741            optimize_scans: false,
15742            quant_table: i32::from(0),
15743            subsample_mode: ForeignSubsample::Auto,
15744            restart_interval: i32::from(0),
15745            keep: ForeignKeep::All,
15746            background: Vec::new(),
15747            page_height: i32::from(0),
15748            profile: String::from("sRGB"),
15749        }
15750    }
15751}
15752
15753/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime, nocache (.jpg, .jpeg, .jpe, .jfif), priority=0,
15754/// inp: `&VipsImage` -> Image to save
15755/// jpegsave_mime_options: `&JpegsaveMimeOptions` -> optional arguments
15756
15757pub fn jpegsave_mime_with_opts(
15758    inp: &VipsImage,
15759    jpegsave_mime_options: &JpegsaveMimeOptions,
15760) -> Result<()> {
15761    unsafe {
15762        let inp_in: *mut bindings::VipsImage = inp.ctx;
15763
15764        let q_in: i32 = jpegsave_mime_options.q;
15765        let q_in_name = utils::new_c_string("Q")?;
15766
15767        let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15768            1
15769        } else {
15770            0
15771        };
15772        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15773
15774        let interlace_in: i32 = if jpegsave_mime_options.interlace {
15775            1
15776        } else {
15777            0
15778        };
15779        let interlace_in_name = utils::new_c_string("interlace")?;
15780
15781        let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15782            1
15783        } else {
15784            0
15785        };
15786        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15787
15788        let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15789            1
15790        } else {
15791            0
15792        };
15793        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15794
15795        let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15796            1
15797        } else {
15798            0
15799        };
15800        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15801
15802        let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15803        let quant_table_in_name = utils::new_c_string("quant-table")?;
15804
15805        let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15806        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15807
15808        let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15809        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15810
15811        let keep_in: i32 = jpegsave_mime_options.keep as i32;
15812        let keep_in_name = utils::new_c_string("keep")?;
15813
15814        let background_wrapper =
15815            utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15816        let background_in = background_wrapper.ctx;
15817        let background_in_name = utils::new_c_string("background")?;
15818
15819        let page_height_in: i32 = jpegsave_mime_options.page_height;
15820        let page_height_in_name = utils::new_c_string("page-height")?;
15821
15822        let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15823        let profile_in_name = utils::new_c_string("profile")?;
15824
15825        let vips_op_response = bindings::vips_jpegsave_mime(
15826            inp_in,
15827            q_in_name.as_ptr(),
15828            q_in,
15829            optimize_coding_in_name.as_ptr(),
15830            optimize_coding_in,
15831            interlace_in_name.as_ptr(),
15832            interlace_in,
15833            trellis_quant_in_name.as_ptr(),
15834            trellis_quant_in,
15835            overshoot_deringing_in_name.as_ptr(),
15836            overshoot_deringing_in,
15837            optimize_scans_in_name.as_ptr(),
15838            optimize_scans_in,
15839            quant_table_in_name.as_ptr(),
15840            quant_table_in,
15841            subsample_mode_in_name.as_ptr(),
15842            subsample_mode_in,
15843            restart_interval_in_name.as_ptr(),
15844            restart_interval_in,
15845            keep_in_name.as_ptr(),
15846            keep_in,
15847            background_in_name.as_ptr(),
15848            background_in,
15849            page_height_in_name.as_ptr(),
15850            page_height_in,
15851            profile_in_name.as_ptr(),
15852            profile_in.as_ptr(),
15853            NULL,
15854        );
15855        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15856    }
15857}
15858
15859/// VipsForeignSaveWebpFile (webpsave), save as WebP, nocache (.webp), priority=0, rgb alpha
15860/// inp: `&VipsImage` -> Image to save
15861/// filename: `&str` -> Filename to save to
15862
15863pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
15864    unsafe {
15865        let inp_in: *mut bindings::VipsImage = inp.ctx;
15866        let filename_in: CString = utils::new_c_string(filename)?;
15867
15868        let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
15869        utils::result(vips_op_response, (), Error::WebpsaveError)
15870    }
15871}
15872
15873/// Options for webpsave operation
15874#[derive(Clone, Debug)]
15875pub struct WebpsaveOptions {
15876    /// q: `i32` -> Q factor
15877    /// min: 0, max: 100, default: 75
15878    pub q: i32,
15879    /// lossless: `bool` -> Enable lossless compression
15880    /// default: false
15881    pub lossless: bool,
15882    /// exact: `bool` -> Preserve color values from transparent pixels
15883    /// default: false
15884    pub exact: bool,
15885    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
15886    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
15887    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
15888    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
15889    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
15890    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
15891    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
15892    pub preset: ForeignWebpPreset,
15893    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
15894    /// default: false
15895    pub smart_subsample: bool,
15896    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
15897    /// default: false
15898    pub near_lossless: bool,
15899    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
15900    /// min: 0, max: 100, default: 100
15901    pub alpha_q: i32,
15902    /// min_size: `bool` -> Optimise for minimum size
15903    /// default: false
15904    pub min_size: bool,
15905    /// kmin: `i32` -> Minimum number of frames between key frames
15906    /// min: 0, max: 2147483647, default: 2147483646
15907    pub kmin: i32,
15908    /// kmax: `i32` -> Maximum number of frames between key frames
15909    /// min: 0, max: 2147483647, default: 2147483647
15910    pub kmax: i32,
15911    /// effort: `i32` -> Level of CPU effort to reduce file size
15912    /// min: 0, max: 6, default: 4
15913    pub effort: i32,
15914    /// target_size: `i32` -> Desired target size in bytes
15915    /// min: 0, max: 2147483647, default: 0
15916    pub target_size: i32,
15917    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
15918    /// default: false
15919    pub mixed: bool,
15920    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
15921    /// default: false
15922    pub smart_deblock: bool,
15923    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
15924    /// min: 1, max: 10, default: 1
15925    pub passes: i32,
15926    /// keep: `ForeignKeep` -> Which metadata to retain
15927    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15928    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15929    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15930    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15931    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15932    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15933    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
15934    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
15935    pub keep: ForeignKeep,
15936    /// background: `Vec<f64>` -> Background value
15937    pub background: Vec<f64>,
15938    /// page_height: `i32` -> Set page height for multipage save
15939    /// min: 0, max: 100000000, default: 0
15940    pub page_height: i32,
15941    /// profile: `String` -> Filename of ICC profile to embed
15942    pub profile: String,
15943}
15944
15945impl std::default::Default for WebpsaveOptions {
15946    fn default() -> Self {
15947        WebpsaveOptions {
15948            q: i32::from(75),
15949            lossless: false,
15950            exact: false,
15951            preset: ForeignWebpPreset::Default,
15952            smart_subsample: false,
15953            near_lossless: false,
15954            alpha_q: i32::from(100),
15955            min_size: false,
15956            kmin: i32::from(2147483646),
15957            kmax: i32::from(2147483647),
15958            effort: i32::from(4),
15959            target_size: i32::from(0),
15960            mixed: false,
15961            smart_deblock: false,
15962            passes: i32::from(1),
15963            keep: ForeignKeep::All,
15964            background: Vec::new(),
15965            page_height: i32::from(0),
15966            profile: String::from("sRGB"),
15967        }
15968    }
15969}
15970
15971/// VipsForeignSaveWebpFile (webpsave), save as WebP, nocache (.webp), priority=0, rgb alpha
15972/// inp: `&VipsImage` -> Image to save
15973/// filename: `&str` -> Filename to save to
15974/// webpsave_options: `&WebpsaveOptions` -> optional arguments
15975
15976pub fn webpsave_with_opts(
15977    inp: &VipsImage,
15978    filename: &str,
15979    webpsave_options: &WebpsaveOptions,
15980) -> Result<()> {
15981    unsafe {
15982        let inp_in: *mut bindings::VipsImage = inp.ctx;
15983        let filename_in: CString = utils::new_c_string(filename)?;
15984
15985        let q_in: i32 = webpsave_options.q;
15986        let q_in_name = utils::new_c_string("Q")?;
15987
15988        let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
15989        let lossless_in_name = utils::new_c_string("lossless")?;
15990
15991        let exact_in: i32 = if webpsave_options.exact { 1 } else { 0 };
15992        let exact_in_name = utils::new_c_string("exact")?;
15993
15994        let preset_in: i32 = webpsave_options.preset as i32;
15995        let preset_in_name = utils::new_c_string("preset")?;
15996
15997        let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
15998            1
15999        } else {
16000            0
16001        };
16002        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16003
16004        let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
16005        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16006
16007        let alpha_q_in: i32 = webpsave_options.alpha_q;
16008        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16009
16010        let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
16011        let min_size_in_name = utils::new_c_string("min-size")?;
16012
16013        let kmin_in: i32 = webpsave_options.kmin;
16014        let kmin_in_name = utils::new_c_string("kmin")?;
16015
16016        let kmax_in: i32 = webpsave_options.kmax;
16017        let kmax_in_name = utils::new_c_string("kmax")?;
16018
16019        let effort_in: i32 = webpsave_options.effort;
16020        let effort_in_name = utils::new_c_string("effort")?;
16021
16022        let target_size_in: i32 = webpsave_options.target_size;
16023        let target_size_in_name = utils::new_c_string("target-size")?;
16024
16025        let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
16026        let mixed_in_name = utils::new_c_string("mixed")?;
16027
16028        let smart_deblock_in: i32 = if webpsave_options.smart_deblock { 1 } else { 0 };
16029        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16030
16031        let passes_in: i32 = webpsave_options.passes;
16032        let passes_in_name = utils::new_c_string("passes")?;
16033
16034        let keep_in: i32 = webpsave_options.keep as i32;
16035        let keep_in_name = utils::new_c_string("keep")?;
16036
16037        let background_wrapper =
16038            utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
16039        let background_in = background_wrapper.ctx;
16040        let background_in_name = utils::new_c_string("background")?;
16041
16042        let page_height_in: i32 = webpsave_options.page_height;
16043        let page_height_in_name = utils::new_c_string("page-height")?;
16044
16045        let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
16046        let profile_in_name = utils::new_c_string("profile")?;
16047
16048        let vips_op_response = bindings::vips_webpsave(
16049            inp_in,
16050            filename_in.as_ptr(),
16051            q_in_name.as_ptr(),
16052            q_in,
16053            lossless_in_name.as_ptr(),
16054            lossless_in,
16055            exact_in_name.as_ptr(),
16056            exact_in,
16057            preset_in_name.as_ptr(),
16058            preset_in,
16059            smart_subsample_in_name.as_ptr(),
16060            smart_subsample_in,
16061            near_lossless_in_name.as_ptr(),
16062            near_lossless_in,
16063            alpha_q_in_name.as_ptr(),
16064            alpha_q_in,
16065            min_size_in_name.as_ptr(),
16066            min_size_in,
16067            kmin_in_name.as_ptr(),
16068            kmin_in,
16069            kmax_in_name.as_ptr(),
16070            kmax_in,
16071            effort_in_name.as_ptr(),
16072            effort_in,
16073            target_size_in_name.as_ptr(),
16074            target_size_in,
16075            mixed_in_name.as_ptr(),
16076            mixed_in,
16077            smart_deblock_in_name.as_ptr(),
16078            smart_deblock_in,
16079            passes_in_name.as_ptr(),
16080            passes_in,
16081            keep_in_name.as_ptr(),
16082            keep_in,
16083            background_in_name.as_ptr(),
16084            background_in,
16085            page_height_in_name.as_ptr(),
16086            page_height_in,
16087            profile_in_name.as_ptr(),
16088            profile_in.as_ptr(),
16089            NULL,
16090        );
16091        utils::result(vips_op_response, (), Error::WebpsaveError)
16092    }
16093}
16094
16095/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP, nocache (.webp), priority=0, rgb alpha
16096/// inp: `&VipsImage` -> Image to save
16097/// returns `Vec<u8>` - Buffer to save to
16098pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16099    unsafe {
16100        let inp_in: *mut bindings::VipsImage = inp.ctx;
16101        let mut buffer_buf_size: u64 = 0;
16102        let mut buffer_out: *mut c_void = null_mut();
16103
16104        let vips_op_response =
16105            bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16106        utils::result(
16107            vips_op_response,
16108            utils::new_byte_array(buffer_out, buffer_buf_size),
16109            Error::WebpsaveBufferError,
16110        )
16111    }
16112}
16113
16114/// Options for webpsave_buffer operation
16115#[derive(Clone, Debug)]
16116pub struct WebpsaveBufferOptions {
16117    /// q: `i32` -> Q factor
16118    /// min: 0, max: 100, default: 75
16119    pub q: i32,
16120    /// lossless: `bool` -> Enable lossless compression
16121    /// default: false
16122    pub lossless: bool,
16123    /// exact: `bool` -> Preserve color values from transparent pixels
16124    /// default: false
16125    pub exact: bool,
16126    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16127    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16128    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16129    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16130    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16131    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16132    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16133    pub preset: ForeignWebpPreset,
16134    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16135    /// default: false
16136    pub smart_subsample: bool,
16137    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16138    /// default: false
16139    pub near_lossless: bool,
16140    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16141    /// min: 0, max: 100, default: 100
16142    pub alpha_q: i32,
16143    /// min_size: `bool` -> Optimise for minimum size
16144    /// default: false
16145    pub min_size: bool,
16146    /// kmin: `i32` -> Minimum number of frames between key frames
16147    /// min: 0, max: 2147483647, default: 2147483646
16148    pub kmin: i32,
16149    /// kmax: `i32` -> Maximum number of frames between key frames
16150    /// min: 0, max: 2147483647, default: 2147483647
16151    pub kmax: i32,
16152    /// effort: `i32` -> Level of CPU effort to reduce file size
16153    /// min: 0, max: 6, default: 4
16154    pub effort: i32,
16155    /// target_size: `i32` -> Desired target size in bytes
16156    /// min: 0, max: 2147483647, default: 0
16157    pub target_size: i32,
16158    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16159    /// default: false
16160    pub mixed: bool,
16161    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16162    /// default: false
16163    pub smart_deblock: bool,
16164    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16165    /// min: 1, max: 10, default: 1
16166    pub passes: i32,
16167    /// keep: `ForeignKeep` -> Which metadata to retain
16168    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16169    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16170    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16171    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16172    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16173    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16174    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
16175    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
16176    pub keep: ForeignKeep,
16177    /// background: `Vec<f64>` -> Background value
16178    pub background: Vec<f64>,
16179    /// page_height: `i32` -> Set page height for multipage save
16180    /// min: 0, max: 100000000, default: 0
16181    pub page_height: i32,
16182    /// profile: `String` -> Filename of ICC profile to embed
16183    pub profile: String,
16184}
16185
16186impl std::default::Default for WebpsaveBufferOptions {
16187    fn default() -> Self {
16188        WebpsaveBufferOptions {
16189            q: i32::from(75),
16190            lossless: false,
16191            exact: false,
16192            preset: ForeignWebpPreset::Default,
16193            smart_subsample: false,
16194            near_lossless: false,
16195            alpha_q: i32::from(100),
16196            min_size: false,
16197            kmin: i32::from(2147483646),
16198            kmax: i32::from(2147483647),
16199            effort: i32::from(4),
16200            target_size: i32::from(0),
16201            mixed: false,
16202            smart_deblock: false,
16203            passes: i32::from(1),
16204            keep: ForeignKeep::All,
16205            background: Vec::new(),
16206            page_height: i32::from(0),
16207            profile: String::from("sRGB"),
16208        }
16209    }
16210}
16211
16212/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP, nocache (.webp), priority=0, rgb alpha
16213/// inp: `&VipsImage` -> Image to save
16214/// webpsave_buffer_options: `&WebpsaveBufferOptions` -> optional arguments
16215/// returns `Vec<u8>` - Buffer to save to
16216pub fn webpsave_buffer_with_opts(
16217    inp: &VipsImage,
16218    webpsave_buffer_options: &WebpsaveBufferOptions,
16219) -> Result<Vec<u8>> {
16220    unsafe {
16221        let inp_in: *mut bindings::VipsImage = inp.ctx;
16222        let mut buffer_buf_size: u64 = 0;
16223        let mut buffer_out: *mut c_void = null_mut();
16224
16225        let q_in: i32 = webpsave_buffer_options.q;
16226        let q_in_name = utils::new_c_string("Q")?;
16227
16228        let lossless_in: i32 = if webpsave_buffer_options.lossless {
16229            1
16230        } else {
16231            0
16232        };
16233        let lossless_in_name = utils::new_c_string("lossless")?;
16234
16235        let exact_in: i32 = if webpsave_buffer_options.exact { 1 } else { 0 };
16236        let exact_in_name = utils::new_c_string("exact")?;
16237
16238        let preset_in: i32 = webpsave_buffer_options.preset as i32;
16239        let preset_in_name = utils::new_c_string("preset")?;
16240
16241        let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
16242            1
16243        } else {
16244            0
16245        };
16246        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16247
16248        let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
16249            1
16250        } else {
16251            0
16252        };
16253        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16254
16255        let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
16256        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16257
16258        let min_size_in: i32 = if webpsave_buffer_options.min_size {
16259            1
16260        } else {
16261            0
16262        };
16263        let min_size_in_name = utils::new_c_string("min-size")?;
16264
16265        let kmin_in: i32 = webpsave_buffer_options.kmin;
16266        let kmin_in_name = utils::new_c_string("kmin")?;
16267
16268        let kmax_in: i32 = webpsave_buffer_options.kmax;
16269        let kmax_in_name = utils::new_c_string("kmax")?;
16270
16271        let effort_in: i32 = webpsave_buffer_options.effort;
16272        let effort_in_name = utils::new_c_string("effort")?;
16273
16274        let target_size_in: i32 = webpsave_buffer_options.target_size;
16275        let target_size_in_name = utils::new_c_string("target-size")?;
16276
16277        let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
16278        let mixed_in_name = utils::new_c_string("mixed")?;
16279
16280        let smart_deblock_in: i32 = if webpsave_buffer_options.smart_deblock {
16281            1
16282        } else {
16283            0
16284        };
16285        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16286
16287        let passes_in: i32 = webpsave_buffer_options.passes;
16288        let passes_in_name = utils::new_c_string("passes")?;
16289
16290        let keep_in: i32 = webpsave_buffer_options.keep as i32;
16291        let keep_in_name = utils::new_c_string("keep")?;
16292
16293        let background_wrapper =
16294            utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
16295        let background_in = background_wrapper.ctx;
16296        let background_in_name = utils::new_c_string("background")?;
16297
16298        let page_height_in: i32 = webpsave_buffer_options.page_height;
16299        let page_height_in_name = utils::new_c_string("page-height")?;
16300
16301        let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
16302        let profile_in_name = utils::new_c_string("profile")?;
16303
16304        let vips_op_response = bindings::vips_webpsave_buffer(
16305            inp_in,
16306            &mut buffer_out,
16307            &mut buffer_buf_size,
16308            q_in_name.as_ptr(),
16309            q_in,
16310            lossless_in_name.as_ptr(),
16311            lossless_in,
16312            exact_in_name.as_ptr(),
16313            exact_in,
16314            preset_in_name.as_ptr(),
16315            preset_in,
16316            smart_subsample_in_name.as_ptr(),
16317            smart_subsample_in,
16318            near_lossless_in_name.as_ptr(),
16319            near_lossless_in,
16320            alpha_q_in_name.as_ptr(),
16321            alpha_q_in,
16322            min_size_in_name.as_ptr(),
16323            min_size_in,
16324            kmin_in_name.as_ptr(),
16325            kmin_in,
16326            kmax_in_name.as_ptr(),
16327            kmax_in,
16328            effort_in_name.as_ptr(),
16329            effort_in,
16330            target_size_in_name.as_ptr(),
16331            target_size_in,
16332            mixed_in_name.as_ptr(),
16333            mixed_in,
16334            smart_deblock_in_name.as_ptr(),
16335            smart_deblock_in,
16336            passes_in_name.as_ptr(),
16337            passes_in,
16338            keep_in_name.as_ptr(),
16339            keep_in,
16340            background_in_name.as_ptr(),
16341            background_in,
16342            page_height_in_name.as_ptr(),
16343            page_height_in,
16344            profile_in_name.as_ptr(),
16345            profile_in.as_ptr(),
16346            NULL,
16347        );
16348        utils::result(
16349            vips_op_response,
16350            utils::new_byte_array(buffer_out, buffer_buf_size),
16351            Error::WebpsaveBufferError,
16352        )
16353    }
16354}
16355
16356/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP, nocache (.webp), priority=0, rgb alpha
16357/// inp: `&VipsImage` -> Image to save
16358/// target: `&VipsTarget` -> Target to save to
16359
16360pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16361    unsafe {
16362        let inp_in: *mut bindings::VipsImage = inp.ctx;
16363        let target_in: *mut bindings::VipsTarget = target.ctx;
16364
16365        let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
16366        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16367    }
16368}
16369
16370/// Options for webpsave_target operation
16371#[derive(Clone, Debug)]
16372pub struct WebpsaveTargetOptions {
16373    /// q: `i32` -> Q factor
16374    /// min: 0, max: 100, default: 75
16375    pub q: i32,
16376    /// lossless: `bool` -> Enable lossless compression
16377    /// default: false
16378    pub lossless: bool,
16379    /// exact: `bool` -> Preserve color values from transparent pixels
16380    /// default: false
16381    pub exact: bool,
16382    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16383    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16384    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16385    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16386    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16387    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16388    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16389    pub preset: ForeignWebpPreset,
16390    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16391    /// default: false
16392    pub smart_subsample: bool,
16393    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16394    /// default: false
16395    pub near_lossless: bool,
16396    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16397    /// min: 0, max: 100, default: 100
16398    pub alpha_q: i32,
16399    /// min_size: `bool` -> Optimise for minimum size
16400    /// default: false
16401    pub min_size: bool,
16402    /// kmin: `i32` -> Minimum number of frames between key frames
16403    /// min: 0, max: 2147483647, default: 2147483646
16404    pub kmin: i32,
16405    /// kmax: `i32` -> Maximum number of frames between key frames
16406    /// min: 0, max: 2147483647, default: 2147483647
16407    pub kmax: i32,
16408    /// effort: `i32` -> Level of CPU effort to reduce file size
16409    /// min: 0, max: 6, default: 4
16410    pub effort: i32,
16411    /// target_size: `i32` -> Desired target size in bytes
16412    /// min: 0, max: 2147483647, default: 0
16413    pub target_size: i32,
16414    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16415    /// default: false
16416    pub mixed: bool,
16417    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16418    /// default: false
16419    pub smart_deblock: bool,
16420    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16421    /// min: 1, max: 10, default: 1
16422    pub passes: i32,
16423    /// keep: `ForeignKeep` -> Which metadata to retain
16424    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16425    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16426    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16427    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16428    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16429    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16430    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
16431    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
16432    pub keep: ForeignKeep,
16433    /// background: `Vec<f64>` -> Background value
16434    pub background: Vec<f64>,
16435    /// page_height: `i32` -> Set page height for multipage save
16436    /// min: 0, max: 100000000, default: 0
16437    pub page_height: i32,
16438    /// profile: `String` -> Filename of ICC profile to embed
16439    pub profile: String,
16440}
16441
16442impl std::default::Default for WebpsaveTargetOptions {
16443    fn default() -> Self {
16444        WebpsaveTargetOptions {
16445            q: i32::from(75),
16446            lossless: false,
16447            exact: false,
16448            preset: ForeignWebpPreset::Default,
16449            smart_subsample: false,
16450            near_lossless: false,
16451            alpha_q: i32::from(100),
16452            min_size: false,
16453            kmin: i32::from(2147483646),
16454            kmax: i32::from(2147483647),
16455            effort: i32::from(4),
16456            target_size: i32::from(0),
16457            mixed: false,
16458            smart_deblock: false,
16459            passes: i32::from(1),
16460            keep: ForeignKeep::All,
16461            background: Vec::new(),
16462            page_height: i32::from(0),
16463            profile: String::from("sRGB"),
16464        }
16465    }
16466}
16467
16468/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP, nocache (.webp), priority=0, rgb alpha
16469/// inp: `&VipsImage` -> Image to save
16470/// target: `&VipsTarget` -> Target to save to
16471/// webpsave_target_options: `&WebpsaveTargetOptions` -> optional arguments
16472
16473pub fn webpsave_target_with_opts(
16474    inp: &VipsImage,
16475    target: &VipsTarget,
16476    webpsave_target_options: &WebpsaveTargetOptions,
16477) -> Result<()> {
16478    unsafe {
16479        let inp_in: *mut bindings::VipsImage = inp.ctx;
16480        let target_in: *mut bindings::VipsTarget = target.ctx;
16481
16482        let q_in: i32 = webpsave_target_options.q;
16483        let q_in_name = utils::new_c_string("Q")?;
16484
16485        let lossless_in: i32 = if webpsave_target_options.lossless {
16486            1
16487        } else {
16488            0
16489        };
16490        let lossless_in_name = utils::new_c_string("lossless")?;
16491
16492        let exact_in: i32 = if webpsave_target_options.exact { 1 } else { 0 };
16493        let exact_in_name = utils::new_c_string("exact")?;
16494
16495        let preset_in: i32 = webpsave_target_options.preset as i32;
16496        let preset_in_name = utils::new_c_string("preset")?;
16497
16498        let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16499            1
16500        } else {
16501            0
16502        };
16503        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16504
16505        let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16506            1
16507        } else {
16508            0
16509        };
16510        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16511
16512        let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16513        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16514
16515        let min_size_in: i32 = if webpsave_target_options.min_size {
16516            1
16517        } else {
16518            0
16519        };
16520        let min_size_in_name = utils::new_c_string("min-size")?;
16521
16522        let kmin_in: i32 = webpsave_target_options.kmin;
16523        let kmin_in_name = utils::new_c_string("kmin")?;
16524
16525        let kmax_in: i32 = webpsave_target_options.kmax;
16526        let kmax_in_name = utils::new_c_string("kmax")?;
16527
16528        let effort_in: i32 = webpsave_target_options.effort;
16529        let effort_in_name = utils::new_c_string("effort")?;
16530
16531        let target_size_in: i32 = webpsave_target_options.target_size;
16532        let target_size_in_name = utils::new_c_string("target-size")?;
16533
16534        let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16535        let mixed_in_name = utils::new_c_string("mixed")?;
16536
16537        let smart_deblock_in: i32 = if webpsave_target_options.smart_deblock {
16538            1
16539        } else {
16540            0
16541        };
16542        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16543
16544        let passes_in: i32 = webpsave_target_options.passes;
16545        let passes_in_name = utils::new_c_string("passes")?;
16546
16547        let keep_in: i32 = webpsave_target_options.keep as i32;
16548        let keep_in_name = utils::new_c_string("keep")?;
16549
16550        let background_wrapper =
16551            utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16552        let background_in = background_wrapper.ctx;
16553        let background_in_name = utils::new_c_string("background")?;
16554
16555        let page_height_in: i32 = webpsave_target_options.page_height;
16556        let page_height_in_name = utils::new_c_string("page-height")?;
16557
16558        let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16559        let profile_in_name = utils::new_c_string("profile")?;
16560
16561        let vips_op_response = bindings::vips_webpsave_target(
16562            inp_in,
16563            target_in,
16564            q_in_name.as_ptr(),
16565            q_in,
16566            lossless_in_name.as_ptr(),
16567            lossless_in,
16568            exact_in_name.as_ptr(),
16569            exact_in,
16570            preset_in_name.as_ptr(),
16571            preset_in,
16572            smart_subsample_in_name.as_ptr(),
16573            smart_subsample_in,
16574            near_lossless_in_name.as_ptr(),
16575            near_lossless_in,
16576            alpha_q_in_name.as_ptr(),
16577            alpha_q_in,
16578            min_size_in_name.as_ptr(),
16579            min_size_in,
16580            kmin_in_name.as_ptr(),
16581            kmin_in,
16582            kmax_in_name.as_ptr(),
16583            kmax_in,
16584            effort_in_name.as_ptr(),
16585            effort_in,
16586            target_size_in_name.as_ptr(),
16587            target_size_in,
16588            mixed_in_name.as_ptr(),
16589            mixed_in,
16590            smart_deblock_in_name.as_ptr(),
16591            smart_deblock_in,
16592            passes_in_name.as_ptr(),
16593            passes_in,
16594            keep_in_name.as_ptr(),
16595            keep_in,
16596            background_in_name.as_ptr(),
16597            background_in,
16598            page_height_in_name.as_ptr(),
16599            page_height_in,
16600            profile_in_name.as_ptr(),
16601            profile_in.as_ptr(),
16602            NULL,
16603        );
16604        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16605    }
16606}
16607
16608/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime, nocache (.webp), priority=0, rgb alpha
16609/// inp: `&VipsImage` -> Image to save
16610
16611pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16612    unsafe {
16613        let inp_in: *mut bindings::VipsImage = inp.ctx;
16614
16615        let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16616        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16617    }
16618}
16619
16620/// Options for webpsave_mime operation
16621#[derive(Clone, Debug)]
16622pub struct WebpsaveMimeOptions {
16623    /// q: `i32` -> Q factor
16624    /// min: 0, max: 100, default: 75
16625    pub q: i32,
16626    /// lossless: `bool` -> Enable lossless compression
16627    /// default: false
16628    pub lossless: bool,
16629    /// exact: `bool` -> Preserve color values from transparent pixels
16630    /// default: false
16631    pub exact: bool,
16632    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
16633    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
16634    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
16635    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
16636    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
16637    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
16638    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
16639    pub preset: ForeignWebpPreset,
16640    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
16641    /// default: false
16642    pub smart_subsample: bool,
16643    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
16644    /// default: false
16645    pub near_lossless: bool,
16646    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
16647    /// min: 0, max: 100, default: 100
16648    pub alpha_q: i32,
16649    /// min_size: `bool` -> Optimise for minimum size
16650    /// default: false
16651    pub min_size: bool,
16652    /// kmin: `i32` -> Minimum number of frames between key frames
16653    /// min: 0, max: 2147483647, default: 2147483646
16654    pub kmin: i32,
16655    /// kmax: `i32` -> Maximum number of frames between key frames
16656    /// min: 0, max: 2147483647, default: 2147483647
16657    pub kmax: i32,
16658    /// effort: `i32` -> Level of CPU effort to reduce file size
16659    /// min: 0, max: 6, default: 4
16660    pub effort: i32,
16661    /// target_size: `i32` -> Desired target size in bytes
16662    /// min: 0, max: 2147483647, default: 0
16663    pub target_size: i32,
16664    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
16665    /// default: false
16666    pub mixed: bool,
16667    /// smart_deblock: `bool` -> Enable auto-adjusting of the deblocking filter
16668    /// default: false
16669    pub smart_deblock: bool,
16670    /// passes: `i32` -> Number of entropy-analysis passes (in [1..10])
16671    /// min: 1, max: 10, default: 1
16672    pub passes: i32,
16673    /// keep: `ForeignKeep` -> Which metadata to retain
16674    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16675    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16676    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16677    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16678    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16679    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16680    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
16681    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
16682    pub keep: ForeignKeep,
16683    /// background: `Vec<f64>` -> Background value
16684    pub background: Vec<f64>,
16685    /// page_height: `i32` -> Set page height for multipage save
16686    /// min: 0, max: 100000000, default: 0
16687    pub page_height: i32,
16688    /// profile: `String` -> Filename of ICC profile to embed
16689    pub profile: String,
16690}
16691
16692impl std::default::Default for WebpsaveMimeOptions {
16693    fn default() -> Self {
16694        WebpsaveMimeOptions {
16695            q: i32::from(75),
16696            lossless: false,
16697            exact: false,
16698            preset: ForeignWebpPreset::Default,
16699            smart_subsample: false,
16700            near_lossless: false,
16701            alpha_q: i32::from(100),
16702            min_size: false,
16703            kmin: i32::from(2147483646),
16704            kmax: i32::from(2147483647),
16705            effort: i32::from(4),
16706            target_size: i32::from(0),
16707            mixed: false,
16708            smart_deblock: false,
16709            passes: i32::from(1),
16710            keep: ForeignKeep::All,
16711            background: Vec::new(),
16712            page_height: i32::from(0),
16713            profile: String::from("sRGB"),
16714        }
16715    }
16716}
16717
16718/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime, nocache (.webp), priority=0, rgb alpha
16719/// inp: `&VipsImage` -> Image to save
16720/// webpsave_mime_options: `&WebpsaveMimeOptions` -> optional arguments
16721
16722pub fn webpsave_mime_with_opts(
16723    inp: &VipsImage,
16724    webpsave_mime_options: &WebpsaveMimeOptions,
16725) -> Result<()> {
16726    unsafe {
16727        let inp_in: *mut bindings::VipsImage = inp.ctx;
16728
16729        let q_in: i32 = webpsave_mime_options.q;
16730        let q_in_name = utils::new_c_string("Q")?;
16731
16732        let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16733        let lossless_in_name = utils::new_c_string("lossless")?;
16734
16735        let exact_in: i32 = if webpsave_mime_options.exact { 1 } else { 0 };
16736        let exact_in_name = utils::new_c_string("exact")?;
16737
16738        let preset_in: i32 = webpsave_mime_options.preset as i32;
16739        let preset_in_name = utils::new_c_string("preset")?;
16740
16741        let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16742            1
16743        } else {
16744            0
16745        };
16746        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16747
16748        let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16749            1
16750        } else {
16751            0
16752        };
16753        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16754
16755        let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16756        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16757
16758        let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16759        let min_size_in_name = utils::new_c_string("min-size")?;
16760
16761        let kmin_in: i32 = webpsave_mime_options.kmin;
16762        let kmin_in_name = utils::new_c_string("kmin")?;
16763
16764        let kmax_in: i32 = webpsave_mime_options.kmax;
16765        let kmax_in_name = utils::new_c_string("kmax")?;
16766
16767        let effort_in: i32 = webpsave_mime_options.effort;
16768        let effort_in_name = utils::new_c_string("effort")?;
16769
16770        let target_size_in: i32 = webpsave_mime_options.target_size;
16771        let target_size_in_name = utils::new_c_string("target-size")?;
16772
16773        let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16774        let mixed_in_name = utils::new_c_string("mixed")?;
16775
16776        let smart_deblock_in: i32 = if webpsave_mime_options.smart_deblock {
16777            1
16778        } else {
16779            0
16780        };
16781        let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16782
16783        let passes_in: i32 = webpsave_mime_options.passes;
16784        let passes_in_name = utils::new_c_string("passes")?;
16785
16786        let keep_in: i32 = webpsave_mime_options.keep as i32;
16787        let keep_in_name = utils::new_c_string("keep")?;
16788
16789        let background_wrapper =
16790            utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16791        let background_in = background_wrapper.ctx;
16792        let background_in_name = utils::new_c_string("background")?;
16793
16794        let page_height_in: i32 = webpsave_mime_options.page_height;
16795        let page_height_in_name = utils::new_c_string("page-height")?;
16796
16797        let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16798        let profile_in_name = utils::new_c_string("profile")?;
16799
16800        let vips_op_response = bindings::vips_webpsave_mime(
16801            inp_in,
16802            q_in_name.as_ptr(),
16803            q_in,
16804            lossless_in_name.as_ptr(),
16805            lossless_in,
16806            exact_in_name.as_ptr(),
16807            exact_in,
16808            preset_in_name.as_ptr(),
16809            preset_in,
16810            smart_subsample_in_name.as_ptr(),
16811            smart_subsample_in,
16812            near_lossless_in_name.as_ptr(),
16813            near_lossless_in,
16814            alpha_q_in_name.as_ptr(),
16815            alpha_q_in,
16816            min_size_in_name.as_ptr(),
16817            min_size_in,
16818            kmin_in_name.as_ptr(),
16819            kmin_in,
16820            kmax_in_name.as_ptr(),
16821            kmax_in,
16822            effort_in_name.as_ptr(),
16823            effort_in,
16824            target_size_in_name.as_ptr(),
16825            target_size_in,
16826            mixed_in_name.as_ptr(),
16827            mixed_in,
16828            smart_deblock_in_name.as_ptr(),
16829            smart_deblock_in,
16830            passes_in_name.as_ptr(),
16831            passes_in,
16832            keep_in_name.as_ptr(),
16833            keep_in,
16834            background_in_name.as_ptr(),
16835            background_in,
16836            page_height_in_name.as_ptr(),
16837            page_height_in,
16838            profile_in_name.as_ptr(),
16839            profile_in.as_ptr(),
16840            NULL,
16841        );
16842        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16843    }
16844}
16845
16846/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file, nocache (.tif, .tiff), priority=0,
16847/// inp: `&VipsImage` -> Image to save
16848/// filename: `&str` -> Filename to save to
16849
16850pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16851    unsafe {
16852        let inp_in: *mut bindings::VipsImage = inp.ctx;
16853        let filename_in: CString = utils::new_c_string(filename)?;
16854
16855        let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16856        utils::result(vips_op_response, (), Error::TiffsaveError)
16857    }
16858}
16859
16860/// Options for tiffsave operation
16861#[derive(Clone, Debug)]
16862pub struct TiffsaveOptions {
16863    /// compression: `ForeignTiffCompression` -> Compression for this file
16864    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
16865    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
16866    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
16867    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
16868    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
16869    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
16870    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
16871    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
16872    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
16873    pub compression: ForeignTiffCompression,
16874    /// q: `i32` -> Q factor
16875    /// min: 1, max: 100, default: 75
16876    pub q: i32,
16877    /// predictor: `ForeignTiffPredictor` -> Compression prediction
16878    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
16879    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
16880    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
16881    pub predictor: ForeignTiffPredictor,
16882    /// tile: `bool` -> Write a tiled tiff
16883    /// default: false
16884    pub tile: bool,
16885    /// tile_width: `i32` -> Tile width in pixels
16886    /// min: 1, max: 32768, default: 128
16887    pub tile_width: i32,
16888    /// tile_height: `i32` -> Tile height in pixels
16889    /// min: 1, max: 32768, default: 128
16890    pub tile_height: i32,
16891    /// pyramid: `bool` -> Write a pyramidal tiff
16892    /// default: false
16893    pub pyramid: bool,
16894    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
16895    /// default: false
16896    pub miniswhite: bool,
16897    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
16898    /// min: 0, max: 8, default: 0
16899    pub bitdepth: i32,
16900    /// resunit: `ForeignTiffResunit` -> Resolution unit
16901    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
16902    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
16903    pub resunit: ForeignTiffResunit,
16904    /// xres: `f64` -> Horizontal resolution in pixels/mm
16905    /// min: 0.001, max: 1000000, default: 1
16906    pub xres: f64,
16907    /// yres: `f64` -> Vertical resolution in pixels/mm
16908    /// min: 0.001, max: 1000000, default: 1
16909    pub yres: f64,
16910    /// bigtiff: `bool` -> Write a bigtiff image
16911    /// default: false
16912    pub bigtiff: bool,
16913    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
16914    /// default: false
16915    pub properties: bool,
16916    /// region_shrink: `RegionShrink` -> Method to shrink regions
16917    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
16918    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
16919    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
16920    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
16921    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
16922    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
16923    pub region_shrink: RegionShrink,
16924    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
16925    /// min: 0, max: 22, default: 0
16926    pub level: i32,
16927    /// lossless: `bool` -> Enable WEBP lossless mode
16928    /// default: false
16929    pub lossless: bool,
16930    /// depth: `ForeignDzDepth` -> Pyramid depth
16931    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
16932    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
16933    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
16934    pub depth: ForeignDzDepth,
16935    /// subifd: `bool` -> Save pyr layers as sub-IFDs
16936    /// default: false
16937    pub subifd: bool,
16938    /// premultiply: `bool` -> Save with premultiplied alpha
16939    /// default: false
16940    pub premultiply: bool,
16941    /// keep: `ForeignKeep` -> Which metadata to retain
16942    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16943    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16944    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16945    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16946    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16947    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16948    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
16949    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
16950    pub keep: ForeignKeep,
16951    /// background: `Vec<f64>` -> Background value
16952    pub background: Vec<f64>,
16953    /// page_height: `i32` -> Set page height for multipage save
16954    /// min: 0, max: 100000000, default: 0
16955    pub page_height: i32,
16956    /// profile: `String` -> Filename of ICC profile to embed
16957    pub profile: String,
16958}
16959
16960impl std::default::Default for TiffsaveOptions {
16961    fn default() -> Self {
16962        TiffsaveOptions {
16963            compression: ForeignTiffCompression::None,
16964            q: i32::from(75),
16965            predictor: ForeignTiffPredictor::Horizontal,
16966            tile: false,
16967            tile_width: i32::from(128),
16968            tile_height: i32::from(128),
16969            pyramid: false,
16970            miniswhite: false,
16971            bitdepth: i32::from(0),
16972            resunit: ForeignTiffResunit::Cm,
16973            xres: f64::from(1),
16974            yres: f64::from(1),
16975            bigtiff: false,
16976            properties: false,
16977            region_shrink: RegionShrink::Mean,
16978            level: i32::from(0),
16979            lossless: false,
16980            depth: ForeignDzDepth::Onetile,
16981            subifd: false,
16982            premultiply: false,
16983            keep: ForeignKeep::All,
16984            background: Vec::new(),
16985            page_height: i32::from(0),
16986            profile: String::from("sRGB"),
16987        }
16988    }
16989}
16990
16991/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file, nocache (.tif, .tiff), priority=0,
16992/// inp: `&VipsImage` -> Image to save
16993/// filename: `&str` -> Filename to save to
16994/// tiffsave_options: `&TiffsaveOptions` -> optional arguments
16995
16996pub fn tiffsave_with_opts(
16997    inp: &VipsImage,
16998    filename: &str,
16999    tiffsave_options: &TiffsaveOptions,
17000) -> Result<()> {
17001    unsafe {
17002        let inp_in: *mut bindings::VipsImage = inp.ctx;
17003        let filename_in: CString = utils::new_c_string(filename)?;
17004
17005        let compression_in: i32 = tiffsave_options.compression as i32;
17006        let compression_in_name = utils::new_c_string("compression")?;
17007
17008        let q_in: i32 = tiffsave_options.q;
17009        let q_in_name = utils::new_c_string("Q")?;
17010
17011        let predictor_in: i32 = tiffsave_options.predictor as i32;
17012        let predictor_in_name = utils::new_c_string("predictor")?;
17013
17014        let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
17015        let tile_in_name = utils::new_c_string("tile")?;
17016
17017        let tile_width_in: i32 = tiffsave_options.tile_width;
17018        let tile_width_in_name = utils::new_c_string("tile-width")?;
17019
17020        let tile_height_in: i32 = tiffsave_options.tile_height;
17021        let tile_height_in_name = utils::new_c_string("tile-height")?;
17022
17023        let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
17024        let pyramid_in_name = utils::new_c_string("pyramid")?;
17025
17026        let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
17027        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17028
17029        let bitdepth_in: i32 = tiffsave_options.bitdepth;
17030        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17031
17032        let resunit_in: i32 = tiffsave_options.resunit as i32;
17033        let resunit_in_name = utils::new_c_string("resunit")?;
17034
17035        let xres_in: f64 = tiffsave_options.xres;
17036        let xres_in_name = utils::new_c_string("xres")?;
17037
17038        let yres_in: f64 = tiffsave_options.yres;
17039        let yres_in_name = utils::new_c_string("yres")?;
17040
17041        let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
17042        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17043
17044        let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
17045        let properties_in_name = utils::new_c_string("properties")?;
17046
17047        let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
17048        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17049
17050        let level_in: i32 = tiffsave_options.level;
17051        let level_in_name = utils::new_c_string("level")?;
17052
17053        let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
17054        let lossless_in_name = utils::new_c_string("lossless")?;
17055
17056        let depth_in: i32 = tiffsave_options.depth as i32;
17057        let depth_in_name = utils::new_c_string("depth")?;
17058
17059        let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
17060        let subifd_in_name = utils::new_c_string("subifd")?;
17061
17062        let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
17063        let premultiply_in_name = utils::new_c_string("premultiply")?;
17064
17065        let keep_in: i32 = tiffsave_options.keep as i32;
17066        let keep_in_name = utils::new_c_string("keep")?;
17067
17068        let background_wrapper =
17069            utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
17070        let background_in = background_wrapper.ctx;
17071        let background_in_name = utils::new_c_string("background")?;
17072
17073        let page_height_in: i32 = tiffsave_options.page_height;
17074        let page_height_in_name = utils::new_c_string("page-height")?;
17075
17076        let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
17077        let profile_in_name = utils::new_c_string("profile")?;
17078
17079        let vips_op_response = bindings::vips_tiffsave(
17080            inp_in,
17081            filename_in.as_ptr(),
17082            compression_in_name.as_ptr(),
17083            compression_in,
17084            q_in_name.as_ptr(),
17085            q_in,
17086            predictor_in_name.as_ptr(),
17087            predictor_in,
17088            tile_in_name.as_ptr(),
17089            tile_in,
17090            tile_width_in_name.as_ptr(),
17091            tile_width_in,
17092            tile_height_in_name.as_ptr(),
17093            tile_height_in,
17094            pyramid_in_name.as_ptr(),
17095            pyramid_in,
17096            miniswhite_in_name.as_ptr(),
17097            miniswhite_in,
17098            bitdepth_in_name.as_ptr(),
17099            bitdepth_in,
17100            resunit_in_name.as_ptr(),
17101            resunit_in,
17102            xres_in_name.as_ptr(),
17103            xres_in,
17104            yres_in_name.as_ptr(),
17105            yres_in,
17106            bigtiff_in_name.as_ptr(),
17107            bigtiff_in,
17108            properties_in_name.as_ptr(),
17109            properties_in,
17110            region_shrink_in_name.as_ptr(),
17111            region_shrink_in,
17112            level_in_name.as_ptr(),
17113            level_in,
17114            lossless_in_name.as_ptr(),
17115            lossless_in,
17116            depth_in_name.as_ptr(),
17117            depth_in,
17118            subifd_in_name.as_ptr(),
17119            subifd_in,
17120            premultiply_in_name.as_ptr(),
17121            premultiply_in,
17122            keep_in_name.as_ptr(),
17123            keep_in,
17124            background_in_name.as_ptr(),
17125            background_in,
17126            page_height_in_name.as_ptr(),
17127            page_height_in,
17128            profile_in_name.as_ptr(),
17129            profile_in.as_ptr(),
17130            NULL,
17131        );
17132        utils::result(vips_op_response, (), Error::TiffsaveError)
17133    }
17134}
17135
17136/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer, nocache (.tif, .tiff), priority=0,
17137/// inp: `&VipsImage` -> Image to save
17138/// returns `Vec<u8>` - Buffer to save to
17139pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17140    unsafe {
17141        let inp_in: *mut bindings::VipsImage = inp.ctx;
17142        let mut buffer_buf_size: u64 = 0;
17143        let mut buffer_out: *mut c_void = null_mut();
17144
17145        let vips_op_response =
17146            bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17147        utils::result(
17148            vips_op_response,
17149            utils::new_byte_array(buffer_out, buffer_buf_size),
17150            Error::TiffsaveBufferError,
17151        )
17152    }
17153}
17154
17155/// Options for tiffsave_buffer operation
17156#[derive(Clone, Debug)]
17157pub struct TiffsaveBufferOptions {
17158    /// compression: `ForeignTiffCompression` -> Compression for this file
17159    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17160    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17161    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17162    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17163    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17164    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17165    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17166    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17167    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17168    pub compression: ForeignTiffCompression,
17169    /// q: `i32` -> Q factor
17170    /// min: 1, max: 100, default: 75
17171    pub q: i32,
17172    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17173    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17174    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17175    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17176    pub predictor: ForeignTiffPredictor,
17177    /// tile: `bool` -> Write a tiled tiff
17178    /// default: false
17179    pub tile: bool,
17180    /// tile_width: `i32` -> Tile width in pixels
17181    /// min: 1, max: 32768, default: 128
17182    pub tile_width: i32,
17183    /// tile_height: `i32` -> Tile height in pixels
17184    /// min: 1, max: 32768, default: 128
17185    pub tile_height: i32,
17186    /// pyramid: `bool` -> Write a pyramidal tiff
17187    /// default: false
17188    pub pyramid: bool,
17189    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17190    /// default: false
17191    pub miniswhite: bool,
17192    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17193    /// min: 0, max: 8, default: 0
17194    pub bitdepth: i32,
17195    /// resunit: `ForeignTiffResunit` -> Resolution unit
17196    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17197    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17198    pub resunit: ForeignTiffResunit,
17199    /// xres: `f64` -> Horizontal resolution in pixels/mm
17200    /// min: 0.001, max: 1000000, default: 1
17201    pub xres: f64,
17202    /// yres: `f64` -> Vertical resolution in pixels/mm
17203    /// min: 0.001, max: 1000000, default: 1
17204    pub yres: f64,
17205    /// bigtiff: `bool` -> Write a bigtiff image
17206    /// default: false
17207    pub bigtiff: bool,
17208    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17209    /// default: false
17210    pub properties: bool,
17211    /// region_shrink: `RegionShrink` -> Method to shrink regions
17212    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17213    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17214    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17215    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17216    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17217    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17218    pub region_shrink: RegionShrink,
17219    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17220    /// min: 0, max: 22, default: 0
17221    pub level: i32,
17222    /// lossless: `bool` -> Enable WEBP lossless mode
17223    /// default: false
17224    pub lossless: bool,
17225    /// depth: `ForeignDzDepth` -> Pyramid depth
17226    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17227    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17228    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17229    pub depth: ForeignDzDepth,
17230    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17231    /// default: false
17232    pub subifd: bool,
17233    /// premultiply: `bool` -> Save with premultiplied alpha
17234    /// default: false
17235    pub premultiply: bool,
17236    /// keep: `ForeignKeep` -> Which metadata to retain
17237    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17238    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17239    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17240    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17241    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17242    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17243    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
17244    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
17245    pub keep: ForeignKeep,
17246    /// background: `Vec<f64>` -> Background value
17247    pub background: Vec<f64>,
17248    /// page_height: `i32` -> Set page height for multipage save
17249    /// min: 0, max: 100000000, default: 0
17250    pub page_height: i32,
17251    /// profile: `String` -> Filename of ICC profile to embed
17252    pub profile: String,
17253}
17254
17255impl std::default::Default for TiffsaveBufferOptions {
17256    fn default() -> Self {
17257        TiffsaveBufferOptions {
17258            compression: ForeignTiffCompression::None,
17259            q: i32::from(75),
17260            predictor: ForeignTiffPredictor::Horizontal,
17261            tile: false,
17262            tile_width: i32::from(128),
17263            tile_height: i32::from(128),
17264            pyramid: false,
17265            miniswhite: false,
17266            bitdepth: i32::from(0),
17267            resunit: ForeignTiffResunit::Cm,
17268            xres: f64::from(1),
17269            yres: f64::from(1),
17270            bigtiff: false,
17271            properties: false,
17272            region_shrink: RegionShrink::Mean,
17273            level: i32::from(0),
17274            lossless: false,
17275            depth: ForeignDzDepth::Onetile,
17276            subifd: false,
17277            premultiply: false,
17278            keep: ForeignKeep::All,
17279            background: Vec::new(),
17280            page_height: i32::from(0),
17281            profile: String::from("sRGB"),
17282        }
17283    }
17284}
17285
17286/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer, nocache (.tif, .tiff), priority=0,
17287/// inp: `&VipsImage` -> Image to save
17288/// tiffsave_buffer_options: `&TiffsaveBufferOptions` -> optional arguments
17289/// returns `Vec<u8>` - Buffer to save to
17290pub fn tiffsave_buffer_with_opts(
17291    inp: &VipsImage,
17292    tiffsave_buffer_options: &TiffsaveBufferOptions,
17293) -> Result<Vec<u8>> {
17294    unsafe {
17295        let inp_in: *mut bindings::VipsImage = inp.ctx;
17296        let mut buffer_buf_size: u64 = 0;
17297        let mut buffer_out: *mut c_void = null_mut();
17298
17299        let compression_in: i32 = tiffsave_buffer_options.compression as i32;
17300        let compression_in_name = utils::new_c_string("compression")?;
17301
17302        let q_in: i32 = tiffsave_buffer_options.q;
17303        let q_in_name = utils::new_c_string("Q")?;
17304
17305        let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
17306        let predictor_in_name = utils::new_c_string("predictor")?;
17307
17308        let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
17309        let tile_in_name = utils::new_c_string("tile")?;
17310
17311        let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
17312        let tile_width_in_name = utils::new_c_string("tile-width")?;
17313
17314        let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
17315        let tile_height_in_name = utils::new_c_string("tile-height")?;
17316
17317        let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
17318            1
17319        } else {
17320            0
17321        };
17322        let pyramid_in_name = utils::new_c_string("pyramid")?;
17323
17324        let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
17325            1
17326        } else {
17327            0
17328        };
17329        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17330
17331        let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
17332        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17333
17334        let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
17335        let resunit_in_name = utils::new_c_string("resunit")?;
17336
17337        let xres_in: f64 = tiffsave_buffer_options.xres;
17338        let xres_in_name = utils::new_c_string("xres")?;
17339
17340        let yres_in: f64 = tiffsave_buffer_options.yres;
17341        let yres_in_name = utils::new_c_string("yres")?;
17342
17343        let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
17344            1
17345        } else {
17346            0
17347        };
17348        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17349
17350        let properties_in: i32 = if tiffsave_buffer_options.properties {
17351            1
17352        } else {
17353            0
17354        };
17355        let properties_in_name = utils::new_c_string("properties")?;
17356
17357        let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
17358        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17359
17360        let level_in: i32 = tiffsave_buffer_options.level;
17361        let level_in_name = utils::new_c_string("level")?;
17362
17363        let lossless_in: i32 = if tiffsave_buffer_options.lossless {
17364            1
17365        } else {
17366            0
17367        };
17368        let lossless_in_name = utils::new_c_string("lossless")?;
17369
17370        let depth_in: i32 = tiffsave_buffer_options.depth as i32;
17371        let depth_in_name = utils::new_c_string("depth")?;
17372
17373        let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
17374        let subifd_in_name = utils::new_c_string("subifd")?;
17375
17376        let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
17377            1
17378        } else {
17379            0
17380        };
17381        let premultiply_in_name = utils::new_c_string("premultiply")?;
17382
17383        let keep_in: i32 = tiffsave_buffer_options.keep as i32;
17384        let keep_in_name = utils::new_c_string("keep")?;
17385
17386        let background_wrapper =
17387            utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
17388        let background_in = background_wrapper.ctx;
17389        let background_in_name = utils::new_c_string("background")?;
17390
17391        let page_height_in: i32 = tiffsave_buffer_options.page_height;
17392        let page_height_in_name = utils::new_c_string("page-height")?;
17393
17394        let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
17395        let profile_in_name = utils::new_c_string("profile")?;
17396
17397        let vips_op_response = bindings::vips_tiffsave_buffer(
17398            inp_in,
17399            &mut buffer_out,
17400            &mut buffer_buf_size,
17401            compression_in_name.as_ptr(),
17402            compression_in,
17403            q_in_name.as_ptr(),
17404            q_in,
17405            predictor_in_name.as_ptr(),
17406            predictor_in,
17407            tile_in_name.as_ptr(),
17408            tile_in,
17409            tile_width_in_name.as_ptr(),
17410            tile_width_in,
17411            tile_height_in_name.as_ptr(),
17412            tile_height_in,
17413            pyramid_in_name.as_ptr(),
17414            pyramid_in,
17415            miniswhite_in_name.as_ptr(),
17416            miniswhite_in,
17417            bitdepth_in_name.as_ptr(),
17418            bitdepth_in,
17419            resunit_in_name.as_ptr(),
17420            resunit_in,
17421            xres_in_name.as_ptr(),
17422            xres_in,
17423            yres_in_name.as_ptr(),
17424            yres_in,
17425            bigtiff_in_name.as_ptr(),
17426            bigtiff_in,
17427            properties_in_name.as_ptr(),
17428            properties_in,
17429            region_shrink_in_name.as_ptr(),
17430            region_shrink_in,
17431            level_in_name.as_ptr(),
17432            level_in,
17433            lossless_in_name.as_ptr(),
17434            lossless_in,
17435            depth_in_name.as_ptr(),
17436            depth_in,
17437            subifd_in_name.as_ptr(),
17438            subifd_in,
17439            premultiply_in_name.as_ptr(),
17440            premultiply_in,
17441            keep_in_name.as_ptr(),
17442            keep_in,
17443            background_in_name.as_ptr(),
17444            background_in,
17445            page_height_in_name.as_ptr(),
17446            page_height_in,
17447            profile_in_name.as_ptr(),
17448            profile_in.as_ptr(),
17449            NULL,
17450        );
17451        utils::result(
17452            vips_op_response,
17453            utils::new_byte_array(buffer_out, buffer_buf_size),
17454            Error::TiffsaveBufferError,
17455        )
17456    }
17457}
17458
17459/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target, nocache (.tif, .tiff), priority=0,
17460/// inp: `&VipsImage` -> Image to save
17461/// target: `&VipsTarget` -> Target to save to
17462
17463pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17464    unsafe {
17465        let inp_in: *mut bindings::VipsImage = inp.ctx;
17466        let target_in: *mut bindings::VipsTarget = target.ctx;
17467
17468        let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
17469        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17470    }
17471}
17472
17473/// Options for tiffsave_target operation
17474#[derive(Clone, Debug)]
17475pub struct TiffsaveTargetOptions {
17476    /// compression: `ForeignTiffCompression` -> Compression for this file
17477    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
17478    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
17479    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
17480    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
17481    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
17482    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
17483    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
17484    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
17485    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
17486    pub compression: ForeignTiffCompression,
17487    /// q: `i32` -> Q factor
17488    /// min: 1, max: 100, default: 75
17489    pub q: i32,
17490    /// predictor: `ForeignTiffPredictor` -> Compression prediction
17491    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
17492    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
17493    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
17494    pub predictor: ForeignTiffPredictor,
17495    /// tile: `bool` -> Write a tiled tiff
17496    /// default: false
17497    pub tile: bool,
17498    /// tile_width: `i32` -> Tile width in pixels
17499    /// min: 1, max: 32768, default: 128
17500    pub tile_width: i32,
17501    /// tile_height: `i32` -> Tile height in pixels
17502    /// min: 1, max: 32768, default: 128
17503    pub tile_height: i32,
17504    /// pyramid: `bool` -> Write a pyramidal tiff
17505    /// default: false
17506    pub pyramid: bool,
17507    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
17508    /// default: false
17509    pub miniswhite: bool,
17510    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
17511    /// min: 0, max: 8, default: 0
17512    pub bitdepth: i32,
17513    /// resunit: `ForeignTiffResunit` -> Resolution unit
17514    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
17515    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
17516    pub resunit: ForeignTiffResunit,
17517    /// xres: `f64` -> Horizontal resolution in pixels/mm
17518    /// min: 0.001, max: 1000000, default: 1
17519    pub xres: f64,
17520    /// yres: `f64` -> Vertical resolution in pixels/mm
17521    /// min: 0.001, max: 1000000, default: 1
17522    pub yres: f64,
17523    /// bigtiff: `bool` -> Write a bigtiff image
17524    /// default: false
17525    pub bigtiff: bool,
17526    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
17527    /// default: false
17528    pub properties: bool,
17529    /// region_shrink: `RegionShrink` -> Method to shrink regions
17530    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17531    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17532    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17533    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17534    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17535    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17536    pub region_shrink: RegionShrink,
17537    /// level: `i32` -> Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level
17538    /// min: 0, max: 22, default: 0
17539    pub level: i32,
17540    /// lossless: `bool` -> Enable WEBP lossless mode
17541    /// default: false
17542    pub lossless: bool,
17543    /// depth: `ForeignDzDepth` -> Pyramid depth
17544    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
17545    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
17546    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17547    pub depth: ForeignDzDepth,
17548    /// subifd: `bool` -> Save pyr layers as sub-IFDs
17549    /// default: false
17550    pub subifd: bool,
17551    /// premultiply: `bool` -> Save with premultiplied alpha
17552    /// default: false
17553    pub premultiply: bool,
17554    /// keep: `ForeignKeep` -> Which metadata to retain
17555    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17556    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17557    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17558    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17559    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17560    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17561    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
17562    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
17563    pub keep: ForeignKeep,
17564    /// background: `Vec<f64>` -> Background value
17565    pub background: Vec<f64>,
17566    /// page_height: `i32` -> Set page height for multipage save
17567    /// min: 0, max: 100000000, default: 0
17568    pub page_height: i32,
17569    /// profile: `String` -> Filename of ICC profile to embed
17570    pub profile: String,
17571}
17572
17573impl std::default::Default for TiffsaveTargetOptions {
17574    fn default() -> Self {
17575        TiffsaveTargetOptions {
17576            compression: ForeignTiffCompression::None,
17577            q: i32::from(75),
17578            predictor: ForeignTiffPredictor::Horizontal,
17579            tile: false,
17580            tile_width: i32::from(128),
17581            tile_height: i32::from(128),
17582            pyramid: false,
17583            miniswhite: false,
17584            bitdepth: i32::from(0),
17585            resunit: ForeignTiffResunit::Cm,
17586            xres: f64::from(1),
17587            yres: f64::from(1),
17588            bigtiff: false,
17589            properties: false,
17590            region_shrink: RegionShrink::Mean,
17591            level: i32::from(0),
17592            lossless: false,
17593            depth: ForeignDzDepth::Onetile,
17594            subifd: false,
17595            premultiply: false,
17596            keep: ForeignKeep::All,
17597            background: Vec::new(),
17598            page_height: i32::from(0),
17599            profile: String::from("sRGB"),
17600        }
17601    }
17602}
17603
17604/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target, nocache (.tif, .tiff), priority=0,
17605/// inp: `&VipsImage` -> Image to save
17606/// target: `&VipsTarget` -> Target to save to
17607/// tiffsave_target_options: `&TiffsaveTargetOptions` -> optional arguments
17608
17609pub fn tiffsave_target_with_opts(
17610    inp: &VipsImage,
17611    target: &VipsTarget,
17612    tiffsave_target_options: &TiffsaveTargetOptions,
17613) -> Result<()> {
17614    unsafe {
17615        let inp_in: *mut bindings::VipsImage = inp.ctx;
17616        let target_in: *mut bindings::VipsTarget = target.ctx;
17617
17618        let compression_in: i32 = tiffsave_target_options.compression as i32;
17619        let compression_in_name = utils::new_c_string("compression")?;
17620
17621        let q_in: i32 = tiffsave_target_options.q;
17622        let q_in_name = utils::new_c_string("Q")?;
17623
17624        let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17625        let predictor_in_name = utils::new_c_string("predictor")?;
17626
17627        let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17628        let tile_in_name = utils::new_c_string("tile")?;
17629
17630        let tile_width_in: i32 = tiffsave_target_options.tile_width;
17631        let tile_width_in_name = utils::new_c_string("tile-width")?;
17632
17633        let tile_height_in: i32 = tiffsave_target_options.tile_height;
17634        let tile_height_in_name = utils::new_c_string("tile-height")?;
17635
17636        let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17637            1
17638        } else {
17639            0
17640        };
17641        let pyramid_in_name = utils::new_c_string("pyramid")?;
17642
17643        let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17644            1
17645        } else {
17646            0
17647        };
17648        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17649
17650        let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17651        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17652
17653        let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17654        let resunit_in_name = utils::new_c_string("resunit")?;
17655
17656        let xres_in: f64 = tiffsave_target_options.xres;
17657        let xres_in_name = utils::new_c_string("xres")?;
17658
17659        let yres_in: f64 = tiffsave_target_options.yres;
17660        let yres_in_name = utils::new_c_string("yres")?;
17661
17662        let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17663            1
17664        } else {
17665            0
17666        };
17667        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17668
17669        let properties_in: i32 = if tiffsave_target_options.properties {
17670            1
17671        } else {
17672            0
17673        };
17674        let properties_in_name = utils::new_c_string("properties")?;
17675
17676        let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17677        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17678
17679        let level_in: i32 = tiffsave_target_options.level;
17680        let level_in_name = utils::new_c_string("level")?;
17681
17682        let lossless_in: i32 = if tiffsave_target_options.lossless {
17683            1
17684        } else {
17685            0
17686        };
17687        let lossless_in_name = utils::new_c_string("lossless")?;
17688
17689        let depth_in: i32 = tiffsave_target_options.depth as i32;
17690        let depth_in_name = utils::new_c_string("depth")?;
17691
17692        let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17693        let subifd_in_name = utils::new_c_string("subifd")?;
17694
17695        let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17696            1
17697        } else {
17698            0
17699        };
17700        let premultiply_in_name = utils::new_c_string("premultiply")?;
17701
17702        let keep_in: i32 = tiffsave_target_options.keep as i32;
17703        let keep_in_name = utils::new_c_string("keep")?;
17704
17705        let background_wrapper =
17706            utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17707        let background_in = background_wrapper.ctx;
17708        let background_in_name = utils::new_c_string("background")?;
17709
17710        let page_height_in: i32 = tiffsave_target_options.page_height;
17711        let page_height_in_name = utils::new_c_string("page-height")?;
17712
17713        let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17714        let profile_in_name = utils::new_c_string("profile")?;
17715
17716        let vips_op_response = bindings::vips_tiffsave_target(
17717            inp_in,
17718            target_in,
17719            compression_in_name.as_ptr(),
17720            compression_in,
17721            q_in_name.as_ptr(),
17722            q_in,
17723            predictor_in_name.as_ptr(),
17724            predictor_in,
17725            tile_in_name.as_ptr(),
17726            tile_in,
17727            tile_width_in_name.as_ptr(),
17728            tile_width_in,
17729            tile_height_in_name.as_ptr(),
17730            tile_height_in,
17731            pyramid_in_name.as_ptr(),
17732            pyramid_in,
17733            miniswhite_in_name.as_ptr(),
17734            miniswhite_in,
17735            bitdepth_in_name.as_ptr(),
17736            bitdepth_in,
17737            resunit_in_name.as_ptr(),
17738            resunit_in,
17739            xres_in_name.as_ptr(),
17740            xres_in,
17741            yres_in_name.as_ptr(),
17742            yres_in,
17743            bigtiff_in_name.as_ptr(),
17744            bigtiff_in,
17745            properties_in_name.as_ptr(),
17746            properties_in,
17747            region_shrink_in_name.as_ptr(),
17748            region_shrink_in,
17749            level_in_name.as_ptr(),
17750            level_in,
17751            lossless_in_name.as_ptr(),
17752            lossless_in,
17753            depth_in_name.as_ptr(),
17754            depth_in,
17755            subifd_in_name.as_ptr(),
17756            subifd_in,
17757            premultiply_in_name.as_ptr(),
17758            premultiply_in,
17759            keep_in_name.as_ptr(),
17760            keep_in,
17761            background_in_name.as_ptr(),
17762            background_in,
17763            page_height_in_name.as_ptr(),
17764            page_height_in,
17765            profile_in_name.as_ptr(),
17766            profile_in.as_ptr(),
17767            NULL,
17768        );
17769        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17770    }
17771}
17772
17773/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format, nocache (.heic, .heif, .avif), priority=0, rgb alpha
17774/// inp: `&VipsImage` -> Image to save
17775/// filename: `&str` -> Filename to save to
17776
17777pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17778    unsafe {
17779        let inp_in: *mut bindings::VipsImage = inp.ctx;
17780        let filename_in: CString = utils::new_c_string(filename)?;
17781
17782        let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17783        utils::result(vips_op_response, (), Error::HeifsaveError)
17784    }
17785}
17786
17787/// Options for heifsave operation
17788#[derive(Clone, Debug)]
17789pub struct HeifsaveOptions {
17790    /// q: `i32` -> Q factor
17791    /// min: 1, max: 100, default: 50
17792    pub q: i32,
17793    /// bitdepth: `i32` -> Number of bits per pixel
17794    /// min: 8, max: 12, default: 12
17795    pub bitdepth: i32,
17796    /// lossless: `bool` -> Enable lossless compression
17797    /// default: false
17798    pub lossless: bool,
17799    /// compression: `ForeignHeifCompression` -> Compression format
17800    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17801    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17802    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17803    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17804    pub compression: ForeignHeifCompression,
17805    /// effort: `i32` -> CPU effort
17806    /// min: 0, max: 9, default: 4
17807    pub effort: i32,
17808    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17809    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17810    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17811    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17812    pub subsample_mode: ForeignSubsample,
17813    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17814    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17815    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17816    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17817    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17818    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17819    pub encoder: ForeignHeifEncoder,
17820    /// tune: `String` -> Tuning parameters
17821    pub tune: String,
17822    /// keep: `ForeignKeep` -> Which metadata to retain
17823    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17824    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17825    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17826    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17827    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17828    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17829    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
17830    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
17831    pub keep: ForeignKeep,
17832    /// background: `Vec<f64>` -> Background value
17833    pub background: Vec<f64>,
17834    /// page_height: `i32` -> Set page height for multipage save
17835    /// min: 0, max: 100000000, default: 0
17836    pub page_height: i32,
17837    /// profile: `String` -> Filename of ICC profile to embed
17838    pub profile: String,
17839}
17840
17841impl std::default::Default for HeifsaveOptions {
17842    fn default() -> Self {
17843        HeifsaveOptions {
17844            q: i32::from(50),
17845            bitdepth: i32::from(12),
17846            lossless: false,
17847            compression: ForeignHeifCompression::Hevc,
17848            effort: i32::from(4),
17849            subsample_mode: ForeignSubsample::Auto,
17850            encoder: ForeignHeifEncoder::Auto,
17851            tune: String::new(),
17852            keep: ForeignKeep::All,
17853            background: Vec::new(),
17854            page_height: i32::from(0),
17855            profile: String::from("sRGB"),
17856        }
17857    }
17858}
17859
17860/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format, nocache (.heic, .heif, .avif), priority=0, rgb alpha
17861/// inp: `&VipsImage` -> Image to save
17862/// filename: `&str` -> Filename to save to
17863/// heifsave_options: `&HeifsaveOptions` -> optional arguments
17864
17865pub fn heifsave_with_opts(
17866    inp: &VipsImage,
17867    filename: &str,
17868    heifsave_options: &HeifsaveOptions,
17869) -> Result<()> {
17870    unsafe {
17871        let inp_in: *mut bindings::VipsImage = inp.ctx;
17872        let filename_in: CString = utils::new_c_string(filename)?;
17873
17874        let q_in: i32 = heifsave_options.q;
17875        let q_in_name = utils::new_c_string("Q")?;
17876
17877        let bitdepth_in: i32 = heifsave_options.bitdepth;
17878        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17879
17880        let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
17881        let lossless_in_name = utils::new_c_string("lossless")?;
17882
17883        let compression_in: i32 = heifsave_options.compression as i32;
17884        let compression_in_name = utils::new_c_string("compression")?;
17885
17886        let effort_in: i32 = heifsave_options.effort;
17887        let effort_in_name = utils::new_c_string("effort")?;
17888
17889        let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
17890        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17891
17892        let encoder_in: i32 = heifsave_options.encoder as i32;
17893        let encoder_in_name = utils::new_c_string("encoder")?;
17894
17895        let tune_in: CString = utils::new_c_string(&heifsave_options.tune)?;
17896        let tune_in_name = utils::new_c_string("tune")?;
17897
17898        let keep_in: i32 = heifsave_options.keep as i32;
17899        let keep_in_name = utils::new_c_string("keep")?;
17900
17901        let background_wrapper =
17902            utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
17903        let background_in = background_wrapper.ctx;
17904        let background_in_name = utils::new_c_string("background")?;
17905
17906        let page_height_in: i32 = heifsave_options.page_height;
17907        let page_height_in_name = utils::new_c_string("page-height")?;
17908
17909        let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
17910        let profile_in_name = utils::new_c_string("profile")?;
17911
17912        let vips_op_response = bindings::vips_heifsave(
17913            inp_in,
17914            filename_in.as_ptr(),
17915            q_in_name.as_ptr(),
17916            q_in,
17917            bitdepth_in_name.as_ptr(),
17918            bitdepth_in,
17919            lossless_in_name.as_ptr(),
17920            lossless_in,
17921            compression_in_name.as_ptr(),
17922            compression_in,
17923            effort_in_name.as_ptr(),
17924            effort_in,
17925            subsample_mode_in_name.as_ptr(),
17926            subsample_mode_in,
17927            encoder_in_name.as_ptr(),
17928            encoder_in,
17929            tune_in_name.as_ptr(),
17930            tune_in.as_ptr(),
17931            keep_in_name.as_ptr(),
17932            keep_in,
17933            background_in_name.as_ptr(),
17934            background_in,
17935            page_height_in_name.as_ptr(),
17936            page_height_in,
17937            profile_in_name.as_ptr(),
17938            profile_in.as_ptr(),
17939            NULL,
17940        );
17941        utils::result(vips_op_response, (), Error::HeifsaveError)
17942    }
17943}
17944
17945/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format, nocache (.heic, .heif), priority=0, rgb alpha
17946/// inp: `&VipsImage` -> Image to save
17947/// returns `Vec<u8>` - Buffer to save to
17948pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17949    unsafe {
17950        let inp_in: *mut bindings::VipsImage = inp.ctx;
17951        let mut buffer_buf_size: u64 = 0;
17952        let mut buffer_out: *mut c_void = null_mut();
17953
17954        let vips_op_response =
17955            bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17956        utils::result(
17957            vips_op_response,
17958            utils::new_byte_array(buffer_out, buffer_buf_size),
17959            Error::HeifsaveBufferError,
17960        )
17961    }
17962}
17963
17964/// Options for heifsave_buffer operation
17965#[derive(Clone, Debug)]
17966pub struct HeifsaveBufferOptions {
17967    /// q: `i32` -> Q factor
17968    /// min: 1, max: 100, default: 50
17969    pub q: i32,
17970    /// bitdepth: `i32` -> Number of bits per pixel
17971    /// min: 8, max: 12, default: 12
17972    pub bitdepth: i32,
17973    /// lossless: `bool` -> Enable lossless compression
17974    /// default: false
17975    pub lossless: bool,
17976    /// compression: `ForeignHeifCompression` -> Compression format
17977    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
17978    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
17979    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
17980    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
17981    pub compression: ForeignHeifCompression,
17982    /// effort: `i32` -> CPU effort
17983    /// min: 0, max: 9, default: 4
17984    pub effort: i32,
17985    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
17986    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
17987    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
17988    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
17989    pub subsample_mode: ForeignSubsample,
17990    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
17991    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
17992    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
17993    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
17994    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
17995    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
17996    pub encoder: ForeignHeifEncoder,
17997    /// tune: `String` -> Tuning parameters
17998    pub tune: String,
17999    /// keep: `ForeignKeep` -> Which metadata to retain
18000    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18001    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18002    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18003    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18004    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18005    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18006    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
18007    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
18008    pub keep: ForeignKeep,
18009    /// background: `Vec<f64>` -> Background value
18010    pub background: Vec<f64>,
18011    /// page_height: `i32` -> Set page height for multipage save
18012    /// min: 0, max: 100000000, default: 0
18013    pub page_height: i32,
18014    /// profile: `String` -> Filename of ICC profile to embed
18015    pub profile: String,
18016}
18017
18018impl std::default::Default for HeifsaveBufferOptions {
18019    fn default() -> Self {
18020        HeifsaveBufferOptions {
18021            q: i32::from(50),
18022            bitdepth: i32::from(12),
18023            lossless: false,
18024            compression: ForeignHeifCompression::Hevc,
18025            effort: i32::from(4),
18026            subsample_mode: ForeignSubsample::Auto,
18027            encoder: ForeignHeifEncoder::Auto,
18028            tune: String::new(),
18029            keep: ForeignKeep::All,
18030            background: Vec::new(),
18031            page_height: i32::from(0),
18032            profile: String::from("sRGB"),
18033        }
18034    }
18035}
18036
18037/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format, nocache (.heic, .heif), priority=0, rgb alpha
18038/// inp: `&VipsImage` -> Image to save
18039/// heifsave_buffer_options: `&HeifsaveBufferOptions` -> optional arguments
18040/// returns `Vec<u8>` - Buffer to save to
18041pub fn heifsave_buffer_with_opts(
18042    inp: &VipsImage,
18043    heifsave_buffer_options: &HeifsaveBufferOptions,
18044) -> Result<Vec<u8>> {
18045    unsafe {
18046        let inp_in: *mut bindings::VipsImage = inp.ctx;
18047        let mut buffer_buf_size: u64 = 0;
18048        let mut buffer_out: *mut c_void = null_mut();
18049
18050        let q_in: i32 = heifsave_buffer_options.q;
18051        let q_in_name = utils::new_c_string("Q")?;
18052
18053        let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
18054        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18055
18056        let lossless_in: i32 = if heifsave_buffer_options.lossless {
18057            1
18058        } else {
18059            0
18060        };
18061        let lossless_in_name = utils::new_c_string("lossless")?;
18062
18063        let compression_in: i32 = heifsave_buffer_options.compression as i32;
18064        let compression_in_name = utils::new_c_string("compression")?;
18065
18066        let effort_in: i32 = heifsave_buffer_options.effort;
18067        let effort_in_name = utils::new_c_string("effort")?;
18068
18069        let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
18070        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18071
18072        let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
18073        let encoder_in_name = utils::new_c_string("encoder")?;
18074
18075        let tune_in: CString = utils::new_c_string(&heifsave_buffer_options.tune)?;
18076        let tune_in_name = utils::new_c_string("tune")?;
18077
18078        let keep_in: i32 = heifsave_buffer_options.keep as i32;
18079        let keep_in_name = utils::new_c_string("keep")?;
18080
18081        let background_wrapper =
18082            utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
18083        let background_in = background_wrapper.ctx;
18084        let background_in_name = utils::new_c_string("background")?;
18085
18086        let page_height_in: i32 = heifsave_buffer_options.page_height;
18087        let page_height_in_name = utils::new_c_string("page-height")?;
18088
18089        let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
18090        let profile_in_name = utils::new_c_string("profile")?;
18091
18092        let vips_op_response = bindings::vips_heifsave_buffer(
18093            inp_in,
18094            &mut buffer_out,
18095            &mut buffer_buf_size,
18096            q_in_name.as_ptr(),
18097            q_in,
18098            bitdepth_in_name.as_ptr(),
18099            bitdepth_in,
18100            lossless_in_name.as_ptr(),
18101            lossless_in,
18102            compression_in_name.as_ptr(),
18103            compression_in,
18104            effort_in_name.as_ptr(),
18105            effort_in,
18106            subsample_mode_in_name.as_ptr(),
18107            subsample_mode_in,
18108            encoder_in_name.as_ptr(),
18109            encoder_in,
18110            tune_in_name.as_ptr(),
18111            tune_in.as_ptr(),
18112            keep_in_name.as_ptr(),
18113            keep_in,
18114            background_in_name.as_ptr(),
18115            background_in,
18116            page_height_in_name.as_ptr(),
18117            page_height_in,
18118            profile_in_name.as_ptr(),
18119            profile_in.as_ptr(),
18120            NULL,
18121        );
18122        utils::result(
18123            vips_op_response,
18124            utils::new_byte_array(buffer_out, buffer_buf_size),
18125            Error::HeifsaveBufferError,
18126        )
18127    }
18128}
18129
18130/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format, nocache (.heic, .heif), priority=0, rgb alpha
18131/// inp: `&VipsImage` -> Image to save
18132/// target: `&VipsTarget` -> Target to save to
18133
18134pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18135    unsafe {
18136        let inp_in: *mut bindings::VipsImage = inp.ctx;
18137        let target_in: *mut bindings::VipsTarget = target.ctx;
18138
18139        let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
18140        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18141    }
18142}
18143
18144/// Options for heifsave_target operation
18145#[derive(Clone, Debug)]
18146pub struct HeifsaveTargetOptions {
18147    /// q: `i32` -> Q factor
18148    /// min: 1, max: 100, default: 50
18149    pub q: i32,
18150    /// bitdepth: `i32` -> Number of bits per pixel
18151    /// min: 8, max: 12, default: 12
18152    pub bitdepth: i32,
18153    /// lossless: `bool` -> Enable lossless compression
18154    /// default: false
18155    pub lossless: bool,
18156    /// compression: `ForeignHeifCompression` -> Compression format
18157    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
18158    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
18159    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
18160    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
18161    pub compression: ForeignHeifCompression,
18162    /// effort: `i32` -> CPU effort
18163    /// min: 0, max: 9, default: 4
18164    pub effort: i32,
18165    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18166    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18167    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18168    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18169    pub subsample_mode: ForeignSubsample,
18170    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
18171    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
18172    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
18173    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
18174    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
18175    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
18176    pub encoder: ForeignHeifEncoder,
18177    /// tune: `String` -> Tuning parameters
18178    pub tune: String,
18179    /// keep: `ForeignKeep` -> Which metadata to retain
18180    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18181    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18182    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18183    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18184    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18185    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18186    ///  `Gainmap` -> VIPS_FOREIGN_KEEP_GAINMAP = 32
18187    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 63 [DEFAULT]
18188    pub keep: ForeignKeep,
18189    /// background: `Vec<f64>` -> Background value
18190    pub background: Vec<f64>,
18191    /// page_height: `i32` -> Set page height for multipage save
18192    /// min: 0, max: 100000000, default: 0
18193    pub page_height: i32,
18194    /// profile: `String` -> Filename of ICC profile to embed
18195    pub profile: String,
18196}
18197
18198impl std::default::Default for HeifsaveTargetOptions {
18199    fn default() -> Self {
18200        HeifsaveTargetOptions {
18201            q: i32::from(50),
18202            bitdepth: i32::from(12),
18203            lossless: false,
18204            compression: ForeignHeifCompression::Hevc,
18205            effort: i32::from(4),
18206            subsample_mode: ForeignSubsample::Auto,
18207            encoder: ForeignHeifEncoder::Auto,
18208            tune: String::new(),
18209            keep: ForeignKeep::All,
18210            background: Vec::new(),
18211            page_height: i32::from(0),
18212            profile: String::from("sRGB"),
18213        }
18214    }
18215}
18216
18217/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format, nocache (.heic, .heif), priority=0, rgb alpha
18218/// inp: `&VipsImage` -> Image to save
18219/// target: `&VipsTarget` -> Target to save to
18220/// heifsave_target_options: `&HeifsaveTargetOptions` -> optional arguments
18221
18222pub fn heifsave_target_with_opts(
18223    inp: &VipsImage,
18224    target: &VipsTarget,
18225    heifsave_target_options: &HeifsaveTargetOptions,
18226) -> Result<()> {
18227    unsafe {
18228        let inp_in: *mut bindings::VipsImage = inp.ctx;
18229        let target_in: *mut bindings::VipsTarget = target.ctx;
18230
18231        let q_in: i32 = heifsave_target_options.q;
18232        let q_in_name = utils::new_c_string("Q")?;
18233
18234        let bitdepth_in: i32 = heifsave_target_options.bitdepth;
18235        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18236
18237        let lossless_in: i32 = if heifsave_target_options.lossless {
18238            1
18239        } else {
18240            0
18241        };
18242        let lossless_in_name = utils::new_c_string("lossless")?;
18243
18244        let compression_in: i32 = heifsave_target_options.compression as i32;
18245        let compression_in_name = utils::new_c_string("compression")?;
18246
18247        let effort_in: i32 = heifsave_target_options.effort;
18248        let effort_in_name = utils::new_c_string("effort")?;
18249
18250        let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
18251        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18252
18253        let encoder_in: i32 = heifsave_target_options.encoder as i32;
18254        let encoder_in_name = utils::new_c_string("encoder")?;
18255
18256        let tune_in: CString = utils::new_c_string(&heifsave_target_options.tune)?;
18257        let tune_in_name = utils::new_c_string("tune")?;
18258
18259        let keep_in: i32 = heifsave_target_options.keep as i32;
18260        let keep_in_name = utils::new_c_string("keep")?;
18261
18262        let background_wrapper =
18263            utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
18264        let background_in = background_wrapper.ctx;
18265        let background_in_name = utils::new_c_string("background")?;
18266
18267        let page_height_in: i32 = heifsave_target_options.page_height;
18268        let page_height_in_name = utils::new_c_string("page-height")?;
18269
18270        let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
18271        let profile_in_name = utils::new_c_string("profile")?;
18272
18273        let vips_op_response = bindings::vips_heifsave_target(
18274            inp_in,
18275            target_in,
18276            q_in_name.as_ptr(),
18277            q_in,
18278            bitdepth_in_name.as_ptr(),
18279            bitdepth_in,
18280            lossless_in_name.as_ptr(),
18281            lossless_in,
18282            compression_in_name.as_ptr(),
18283            compression_in,
18284            effort_in_name.as_ptr(),
18285            effort_in,
18286            subsample_mode_in_name.as_ptr(),
18287            subsample_mode_in,
18288            encoder_in_name.as_ptr(),
18289            encoder_in,
18290            tune_in_name.as_ptr(),
18291            tune_in.as_ptr(),
18292            keep_in_name.as_ptr(),
18293            keep_in,
18294            background_in_name.as_ptr(),
18295            background_in,
18296            page_height_in_name.as_ptr(),
18297            page_height_in,
18298            profile_in_name.as_ptr(),
18299            profile_in.as_ptr(),
18300            NULL,
18301        );
18302        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18303    }
18304}
18305
18306/// VipsThumbnailFile (thumbnail), generate thumbnail from file, nocache
18307/// filename: `&str` -> Filename to read from
18308/// width: `i32` -> Size to this width
18309/// min: 1, max: 100000000, default: 1
18310/// returns `VipsImage` - Output image
18311pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
18312    unsafe {
18313        let filename_in: CString = utils::new_c_string(filename)?;
18314        let width_in: i32 = width;
18315        let mut out_out: *mut bindings::VipsImage = null_mut();
18316
18317        let vips_op_response =
18318            bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
18319        utils::result(
18320            vips_op_response,
18321            VipsImage { ctx: out_out },
18322            Error::ThumbnailError,
18323        )
18324    }
18325}
18326
18327/// Options for thumbnail operation
18328#[derive(Clone, Debug)]
18329pub struct ThumbnailOptions {
18330    /// height: `i32` -> Size to this height
18331    /// min: 1, max: 100000000, default: 1
18332    pub height: i32,
18333    /// size: `Size` -> Only upsize, only downsize, or both
18334    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18335    ///  `Up` -> VIPS_SIZE_UP = 1
18336    ///  `Down` -> VIPS_SIZE_DOWN = 2
18337    ///  `Force` -> VIPS_SIZE_FORCE = 3
18338    pub size: Size,
18339    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18340    /// default: false
18341    pub no_rotate: bool,
18342    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18343    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18344    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18345    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18346    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18347    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18348    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18349    ///  `All` -> VIPS_INTERESTING_ALL = 6
18350    pub crop: Interesting,
18351    /// linear: `bool` -> Reduce in linear light
18352    /// default: false
18353    pub linear: bool,
18354    /// input_profile: `String` -> Fallback input profile
18355    pub input_profile: String,
18356    /// output_profile: `String` -> Fallback output profile
18357    pub output_profile: String,
18358    /// intent: `Intent` -> Rendering intent
18359    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18360    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18361    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18362    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18363    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18364    pub intent: Intent,
18365    /// fail_on: `FailOn` -> Error level to fail on
18366    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18367    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18368    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18369    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18370    pub fail_on: FailOn,
18371}
18372
18373impl std::default::Default for ThumbnailOptions {
18374    fn default() -> Self {
18375        ThumbnailOptions {
18376            height: i32::from(1),
18377            size: Size::Both,
18378            no_rotate: false,
18379            crop: Interesting::None,
18380            linear: false,
18381            input_profile: String::new(),
18382            output_profile: String::new(),
18383            intent: Intent::Relative,
18384            fail_on: FailOn::None,
18385        }
18386    }
18387}
18388
18389/// VipsThumbnailFile (thumbnail), generate thumbnail from file, nocache
18390/// filename: `&str` -> Filename to read from
18391/// width: `i32` -> Size to this width
18392/// min: 1, max: 100000000, default: 1
18393/// thumbnail_options: `&ThumbnailOptions` -> optional arguments
18394/// returns `VipsImage` - Output image
18395pub fn thumbnail_with_opts(
18396    filename: &str,
18397    width: i32,
18398    thumbnail_options: &ThumbnailOptions,
18399) -> Result<VipsImage> {
18400    unsafe {
18401        let filename_in: CString = utils::new_c_string(filename)?;
18402        let width_in: i32 = width;
18403        let mut out_out: *mut bindings::VipsImage = null_mut();
18404
18405        let height_in: i32 = thumbnail_options.height;
18406        let height_in_name = utils::new_c_string("height")?;
18407
18408        let size_in: i32 = thumbnail_options.size as i32;
18409        let size_in_name = utils::new_c_string("size")?;
18410
18411        let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
18412        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18413
18414        let crop_in: i32 = thumbnail_options.crop as i32;
18415        let crop_in_name = utils::new_c_string("crop")?;
18416
18417        let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
18418        let linear_in_name = utils::new_c_string("linear")?;
18419
18420        let input_profile_in: CString = utils::new_c_string(&thumbnail_options.input_profile)?;
18421        let input_profile_in_name = utils::new_c_string("input-profile")?;
18422
18423        let output_profile_in: CString = utils::new_c_string(&thumbnail_options.output_profile)?;
18424        let output_profile_in_name = utils::new_c_string("output-profile")?;
18425
18426        let intent_in: i32 = thumbnail_options.intent as i32;
18427        let intent_in_name = utils::new_c_string("intent")?;
18428
18429        let fail_on_in: i32 = thumbnail_options.fail_on as i32;
18430        let fail_on_in_name = utils::new_c_string("fail-on")?;
18431
18432        let vips_op_response = bindings::vips_thumbnail(
18433            filename_in.as_ptr(),
18434            &mut out_out,
18435            width_in,
18436            height_in_name.as_ptr(),
18437            height_in,
18438            size_in_name.as_ptr(),
18439            size_in,
18440            no_rotate_in_name.as_ptr(),
18441            no_rotate_in,
18442            crop_in_name.as_ptr(),
18443            crop_in,
18444            linear_in_name.as_ptr(),
18445            linear_in,
18446            input_profile_in_name.as_ptr(),
18447            input_profile_in.as_ptr(),
18448            output_profile_in_name.as_ptr(),
18449            output_profile_in.as_ptr(),
18450            intent_in_name.as_ptr(),
18451            intent_in,
18452            fail_on_in_name.as_ptr(),
18453            fail_on_in,
18454            NULL,
18455        );
18456        utils::result(
18457            vips_op_response,
18458            VipsImage { ctx: out_out },
18459            Error::ThumbnailError,
18460        )
18461    }
18462}
18463
18464/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer, nocache
18465/// buffer: `&[u8]` -> Buffer to load from
18466/// width: `i32` -> Size to this width
18467/// min: 1, max: 100000000, default: 1
18468/// returns `VipsImage` - Output image
18469pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
18470    unsafe {
18471        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18472        let width_in: i32 = width;
18473        let mut out_out: *mut bindings::VipsImage = null_mut();
18474
18475        let vips_op_response = bindings::vips_thumbnail_buffer(
18476            buffer_in,
18477            buffer.len() as u64,
18478            &mut out_out,
18479            width_in,
18480            NULL,
18481        );
18482        utils::result(
18483            vips_op_response,
18484            VipsImage { ctx: out_out },
18485            Error::ThumbnailBufferError,
18486        )
18487    }
18488}
18489
18490/// Options for thumbnail_buffer operation
18491#[derive(Clone, Debug)]
18492pub struct ThumbnailBufferOptions {
18493    /// option_string: `String` -> Options that are passed on to the underlying loader
18494    pub option_string: String,
18495    /// height: `i32` -> Size to this height
18496    /// min: 1, max: 100000000, default: 1
18497    pub height: i32,
18498    /// size: `Size` -> Only upsize, only downsize, or both
18499    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18500    ///  `Up` -> VIPS_SIZE_UP = 1
18501    ///  `Down` -> VIPS_SIZE_DOWN = 2
18502    ///  `Force` -> VIPS_SIZE_FORCE = 3
18503    pub size: Size,
18504    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18505    /// default: false
18506    pub no_rotate: bool,
18507    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18508    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18509    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18510    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18511    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18512    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18513    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18514    ///  `All` -> VIPS_INTERESTING_ALL = 6
18515    pub crop: Interesting,
18516    /// linear: `bool` -> Reduce in linear light
18517    /// default: false
18518    pub linear: bool,
18519    /// input_profile: `String` -> Fallback input profile
18520    pub input_profile: String,
18521    /// output_profile: `String` -> Fallback output profile
18522    pub output_profile: String,
18523    /// intent: `Intent` -> Rendering intent
18524    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18525    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18526    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18527    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18528    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18529    pub intent: Intent,
18530    /// fail_on: `FailOn` -> Error level to fail on
18531    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18532    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18533    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18534    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18535    pub fail_on: FailOn,
18536}
18537
18538impl std::default::Default for ThumbnailBufferOptions {
18539    fn default() -> Self {
18540        ThumbnailBufferOptions {
18541            option_string: String::new(),
18542            height: i32::from(1),
18543            size: Size::Both,
18544            no_rotate: false,
18545            crop: Interesting::None,
18546            linear: false,
18547            input_profile: String::new(),
18548            output_profile: String::new(),
18549            intent: Intent::Relative,
18550            fail_on: FailOn::None,
18551        }
18552    }
18553}
18554
18555/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer, nocache
18556/// buffer: `&[u8]` -> Buffer to load from
18557/// width: `i32` -> Size to this width
18558/// min: 1, max: 100000000, default: 1
18559/// thumbnail_buffer_options: `&ThumbnailBufferOptions` -> optional arguments
18560/// returns `VipsImage` - Output image
18561pub fn thumbnail_buffer_with_opts(
18562    buffer: &[u8],
18563    width: i32,
18564    thumbnail_buffer_options: &ThumbnailBufferOptions,
18565) -> Result<VipsImage> {
18566    unsafe {
18567        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18568        let width_in: i32 = width;
18569        let mut out_out: *mut bindings::VipsImage = null_mut();
18570
18571        let option_string_in: CString =
18572            utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18573        let option_string_in_name = utils::new_c_string("option-string")?;
18574
18575        let height_in: i32 = thumbnail_buffer_options.height;
18576        let height_in_name = utils::new_c_string("height")?;
18577
18578        let size_in: i32 = thumbnail_buffer_options.size as i32;
18579        let size_in_name = utils::new_c_string("size")?;
18580
18581        let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18582            1
18583        } else {
18584            0
18585        };
18586        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18587
18588        let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18589        let crop_in_name = utils::new_c_string("crop")?;
18590
18591        let linear_in: i32 = if thumbnail_buffer_options.linear {
18592            1
18593        } else {
18594            0
18595        };
18596        let linear_in_name = utils::new_c_string("linear")?;
18597
18598        let input_profile_in: CString =
18599            utils::new_c_string(&thumbnail_buffer_options.input_profile)?;
18600        let input_profile_in_name = utils::new_c_string("input-profile")?;
18601
18602        let output_profile_in: CString =
18603            utils::new_c_string(&thumbnail_buffer_options.output_profile)?;
18604        let output_profile_in_name = utils::new_c_string("output-profile")?;
18605
18606        let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18607        let intent_in_name = utils::new_c_string("intent")?;
18608
18609        let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18610        let fail_on_in_name = utils::new_c_string("fail-on")?;
18611
18612        let vips_op_response = bindings::vips_thumbnail_buffer(
18613            buffer_in,
18614            buffer.len() as u64,
18615            &mut out_out,
18616            width_in,
18617            option_string_in_name.as_ptr(),
18618            option_string_in.as_ptr(),
18619            height_in_name.as_ptr(),
18620            height_in,
18621            size_in_name.as_ptr(),
18622            size_in,
18623            no_rotate_in_name.as_ptr(),
18624            no_rotate_in,
18625            crop_in_name.as_ptr(),
18626            crop_in,
18627            linear_in_name.as_ptr(),
18628            linear_in,
18629            input_profile_in_name.as_ptr(),
18630            input_profile_in.as_ptr(),
18631            output_profile_in_name.as_ptr(),
18632            output_profile_in.as_ptr(),
18633            intent_in_name.as_ptr(),
18634            intent_in,
18635            fail_on_in_name.as_ptr(),
18636            fail_on_in,
18637            NULL,
18638        );
18639        utils::result(
18640            vips_op_response,
18641            VipsImage { ctx: out_out },
18642            Error::ThumbnailBufferError,
18643        )
18644    }
18645}
18646
18647/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18648/// inp: `&VipsImage` -> Input image argument
18649/// width: `i32` -> Size to this width
18650/// min: 1, max: 100000000, default: 1
18651/// returns `VipsImage` - Output image
18652pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18653    unsafe {
18654        let inp_in: *mut bindings::VipsImage = inp.ctx;
18655        let width_in: i32 = width;
18656        let mut out_out: *mut bindings::VipsImage = null_mut();
18657
18658        let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18659        utils::result(
18660            vips_op_response,
18661            VipsImage { ctx: out_out },
18662            Error::ThumbnailImageError,
18663        )
18664    }
18665}
18666
18667/// Options for thumbnail_image operation
18668#[derive(Clone, Debug)]
18669pub struct ThumbnailImageOptions {
18670    /// height: `i32` -> Size to this height
18671    /// min: 1, max: 100000000, default: 1
18672    pub height: i32,
18673    /// size: `Size` -> Only upsize, only downsize, or both
18674    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18675    ///  `Up` -> VIPS_SIZE_UP = 1
18676    ///  `Down` -> VIPS_SIZE_DOWN = 2
18677    ///  `Force` -> VIPS_SIZE_FORCE = 3
18678    pub size: Size,
18679    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18680    /// default: false
18681    pub no_rotate: bool,
18682    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18683    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18684    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18685    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18686    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18687    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18688    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18689    ///  `All` -> VIPS_INTERESTING_ALL = 6
18690    pub crop: Interesting,
18691    /// linear: `bool` -> Reduce in linear light
18692    /// default: false
18693    pub linear: bool,
18694    /// input_profile: `String` -> Fallback input profile
18695    pub input_profile: String,
18696    /// output_profile: `String` -> Fallback output profile
18697    pub output_profile: String,
18698    /// intent: `Intent` -> Rendering intent
18699    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18700    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18701    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18702    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18703    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18704    pub intent: Intent,
18705    /// fail_on: `FailOn` -> Error level to fail on
18706    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18707    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18708    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18709    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18710    pub fail_on: FailOn,
18711}
18712
18713impl std::default::Default for ThumbnailImageOptions {
18714    fn default() -> Self {
18715        ThumbnailImageOptions {
18716            height: i32::from(1),
18717            size: Size::Both,
18718            no_rotate: false,
18719            crop: Interesting::None,
18720            linear: false,
18721            input_profile: String::new(),
18722            output_profile: String::new(),
18723            intent: Intent::Relative,
18724            fail_on: FailOn::None,
18725        }
18726    }
18727}
18728
18729/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
18730/// inp: `&VipsImage` -> Input image argument
18731/// width: `i32` -> Size to this width
18732/// min: 1, max: 100000000, default: 1
18733/// thumbnail_image_options: `&ThumbnailImageOptions` -> optional arguments
18734/// returns `VipsImage` - Output image
18735pub fn thumbnail_image_with_opts(
18736    inp: &VipsImage,
18737    width: i32,
18738    thumbnail_image_options: &ThumbnailImageOptions,
18739) -> Result<VipsImage> {
18740    unsafe {
18741        let inp_in: *mut bindings::VipsImage = inp.ctx;
18742        let width_in: i32 = width;
18743        let mut out_out: *mut bindings::VipsImage = null_mut();
18744
18745        let height_in: i32 = thumbnail_image_options.height;
18746        let height_in_name = utils::new_c_string("height")?;
18747
18748        let size_in: i32 = thumbnail_image_options.size as i32;
18749        let size_in_name = utils::new_c_string("size")?;
18750
18751        let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18752            1
18753        } else {
18754            0
18755        };
18756        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18757
18758        let crop_in: i32 = thumbnail_image_options.crop as i32;
18759        let crop_in_name = utils::new_c_string("crop")?;
18760
18761        let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18762        let linear_in_name = utils::new_c_string("linear")?;
18763
18764        let input_profile_in: CString =
18765            utils::new_c_string(&thumbnail_image_options.input_profile)?;
18766        let input_profile_in_name = utils::new_c_string("input-profile")?;
18767
18768        let output_profile_in: CString =
18769            utils::new_c_string(&thumbnail_image_options.output_profile)?;
18770        let output_profile_in_name = utils::new_c_string("output-profile")?;
18771
18772        let intent_in: i32 = thumbnail_image_options.intent as i32;
18773        let intent_in_name = utils::new_c_string("intent")?;
18774
18775        let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18776        let fail_on_in_name = utils::new_c_string("fail-on")?;
18777
18778        let vips_op_response = bindings::vips_thumbnail_image(
18779            inp_in,
18780            &mut out_out,
18781            width_in,
18782            height_in_name.as_ptr(),
18783            height_in,
18784            size_in_name.as_ptr(),
18785            size_in,
18786            no_rotate_in_name.as_ptr(),
18787            no_rotate_in,
18788            crop_in_name.as_ptr(),
18789            crop_in,
18790            linear_in_name.as_ptr(),
18791            linear_in,
18792            input_profile_in_name.as_ptr(),
18793            input_profile_in.as_ptr(),
18794            output_profile_in_name.as_ptr(),
18795            output_profile_in.as_ptr(),
18796            intent_in_name.as_ptr(),
18797            intent_in,
18798            fail_on_in_name.as_ptr(),
18799            fail_on_in,
18800            NULL,
18801        );
18802        utils::result(
18803            vips_op_response,
18804            VipsImage { ctx: out_out },
18805            Error::ThumbnailImageError,
18806        )
18807    }
18808}
18809
18810/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source, nocache
18811/// source: `&VipsSource` -> Source to load from
18812/// width: `i32` -> Size to this width
18813/// min: 1, max: 100000000, default: 1
18814/// returns `VipsImage` - Output image
18815pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18816    unsafe {
18817        let source_in: *mut bindings::VipsSource = source.ctx;
18818        let width_in: i32 = width;
18819        let mut out_out: *mut bindings::VipsImage = null_mut();
18820
18821        let vips_op_response =
18822            bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18823        utils::result(
18824            vips_op_response,
18825            VipsImage { ctx: out_out },
18826            Error::ThumbnailSourceError,
18827        )
18828    }
18829}
18830
18831/// Options for thumbnail_source operation
18832#[derive(Clone, Debug)]
18833pub struct ThumbnailSourceOptions {
18834    /// option_string: `String` -> Options that are passed on to the underlying loader
18835    pub option_string: String,
18836    /// height: `i32` -> Size to this height
18837    /// min: 1, max: 100000000, default: 1
18838    pub height: i32,
18839    /// size: `Size` -> Only upsize, only downsize, or both
18840    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
18841    ///  `Up` -> VIPS_SIZE_UP = 1
18842    ///  `Down` -> VIPS_SIZE_DOWN = 2
18843    ///  `Force` -> VIPS_SIZE_FORCE = 3
18844    pub size: Size,
18845    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
18846    /// default: false
18847    pub no_rotate: bool,
18848    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
18849    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
18850    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
18851    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
18852    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
18853    ///  `Low` -> VIPS_INTERESTING_LOW = 4
18854    ///  `High` -> VIPS_INTERESTING_HIGH = 5
18855    ///  `All` -> VIPS_INTERESTING_ALL = 6
18856    pub crop: Interesting,
18857    /// linear: `bool` -> Reduce in linear light
18858    /// default: false
18859    pub linear: bool,
18860    /// input_profile: `String` -> Fallback input profile
18861    pub input_profile: String,
18862    /// output_profile: `String` -> Fallback output profile
18863    pub output_profile: String,
18864    /// intent: `Intent` -> Rendering intent
18865    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
18866    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
18867    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
18868    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
18869    ///  `Auto` -> VIPS_INTENT_AUTO = 32
18870    pub intent: Intent,
18871    /// fail_on: `FailOn` -> Error level to fail on
18872    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
18873    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
18874    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
18875    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
18876    pub fail_on: FailOn,
18877}
18878
18879impl std::default::Default for ThumbnailSourceOptions {
18880    fn default() -> Self {
18881        ThumbnailSourceOptions {
18882            option_string: String::new(),
18883            height: i32::from(1),
18884            size: Size::Both,
18885            no_rotate: false,
18886            crop: Interesting::None,
18887            linear: false,
18888            input_profile: String::new(),
18889            output_profile: String::new(),
18890            intent: Intent::Relative,
18891            fail_on: FailOn::None,
18892        }
18893    }
18894}
18895
18896/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source, nocache
18897/// source: `&VipsSource` -> Source to load from
18898/// width: `i32` -> Size to this width
18899/// min: 1, max: 100000000, default: 1
18900/// thumbnail_source_options: `&ThumbnailSourceOptions` -> optional arguments
18901/// returns `VipsImage` - Output image
18902pub fn thumbnail_source_with_opts(
18903    source: &VipsSource,
18904    width: i32,
18905    thumbnail_source_options: &ThumbnailSourceOptions,
18906) -> Result<VipsImage> {
18907    unsafe {
18908        let source_in: *mut bindings::VipsSource = source.ctx;
18909        let width_in: i32 = width;
18910        let mut out_out: *mut bindings::VipsImage = null_mut();
18911
18912        let option_string_in: CString =
18913            utils::new_c_string(&thumbnail_source_options.option_string)?;
18914        let option_string_in_name = utils::new_c_string("option-string")?;
18915
18916        let height_in: i32 = thumbnail_source_options.height;
18917        let height_in_name = utils::new_c_string("height")?;
18918
18919        let size_in: i32 = thumbnail_source_options.size as i32;
18920        let size_in_name = utils::new_c_string("size")?;
18921
18922        let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
18923            1
18924        } else {
18925            0
18926        };
18927        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18928
18929        let crop_in: i32 = thumbnail_source_options.crop as i32;
18930        let crop_in_name = utils::new_c_string("crop")?;
18931
18932        let linear_in: i32 = if thumbnail_source_options.linear {
18933            1
18934        } else {
18935            0
18936        };
18937        let linear_in_name = utils::new_c_string("linear")?;
18938
18939        let input_profile_in: CString =
18940            utils::new_c_string(&thumbnail_source_options.input_profile)?;
18941        let input_profile_in_name = utils::new_c_string("input-profile")?;
18942
18943        let output_profile_in: CString =
18944            utils::new_c_string(&thumbnail_source_options.output_profile)?;
18945        let output_profile_in_name = utils::new_c_string("output-profile")?;
18946
18947        let intent_in: i32 = thumbnail_source_options.intent as i32;
18948        let intent_in_name = utils::new_c_string("intent")?;
18949
18950        let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
18951        let fail_on_in_name = utils::new_c_string("fail-on")?;
18952
18953        let vips_op_response = bindings::vips_thumbnail_source(
18954            source_in,
18955            &mut out_out,
18956            width_in,
18957            option_string_in_name.as_ptr(),
18958            option_string_in.as_ptr(),
18959            height_in_name.as_ptr(),
18960            height_in,
18961            size_in_name.as_ptr(),
18962            size_in,
18963            no_rotate_in_name.as_ptr(),
18964            no_rotate_in,
18965            crop_in_name.as_ptr(),
18966            crop_in,
18967            linear_in_name.as_ptr(),
18968            linear_in,
18969            input_profile_in_name.as_ptr(),
18970            input_profile_in.as_ptr(),
18971            output_profile_in_name.as_ptr(),
18972            output_profile_in.as_ptr(),
18973            intent_in_name.as_ptr(),
18974            intent_in,
18975            fail_on_in_name.as_ptr(),
18976            fail_on_in,
18977            NULL,
18978        );
18979        utils::result(
18980            vips_op_response,
18981            VipsImage { ctx: out_out },
18982            Error::ThumbnailSourceError,
18983        )
18984    }
18985}
18986
18987/// VipsMapim (mapim), resample with a map image
18988/// inp: `&VipsImage` -> Input image argument
18989/// index: `&VipsImage` -> Index pixels with this
18990/// returns `VipsImage` - Output image
18991pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
18992    unsafe {
18993        let inp_in: *mut bindings::VipsImage = inp.ctx;
18994        let index_in: *mut bindings::VipsImage = index.ctx;
18995        let mut out_out: *mut bindings::VipsImage = null_mut();
18996
18997        let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
18998        utils::result(
18999            vips_op_response,
19000            VipsImage { ctx: out_out },
19001            Error::MapimError,
19002        )
19003    }
19004}
19005
19006/// Options for mapim operation
19007#[derive(Clone, Debug)]
19008pub struct MapimOptions {
19009    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19010    pub interpolate: VipsInterpolate,
19011    /// background: `Vec<f64>` -> Background value
19012    pub background: Vec<f64>,
19013    /// premultiplied: `bool` -> Images have premultiplied alpha
19014    /// default: false
19015    pub premultiplied: bool,
19016    /// extend: `Extend` -> How to generate the extra pixels
19017    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19018    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19019    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19020    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19021    ///  `White` -> VIPS_EXTEND_WHITE = 4
19022    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19023    pub extend: Extend,
19024}
19025
19026impl std::default::Default for MapimOptions {
19027    fn default() -> Self {
19028        MapimOptions {
19029            interpolate: VipsInterpolate::new(),
19030            background: Vec::new(),
19031            premultiplied: false,
19032            extend: Extend::Background,
19033        }
19034    }
19035}
19036
19037/// VipsMapim (mapim), resample with a map image
19038/// inp: `&VipsImage` -> Input image argument
19039/// index: `&VipsImage` -> Index pixels with this
19040/// mapim_options: `&MapimOptions` -> optional arguments
19041/// returns `VipsImage` - Output image
19042pub fn mapim_with_opts(
19043    inp: &VipsImage,
19044    index: &VipsImage,
19045    mapim_options: &MapimOptions,
19046) -> Result<VipsImage> {
19047    unsafe {
19048        let inp_in: *mut bindings::VipsImage = inp.ctx;
19049        let index_in: *mut bindings::VipsImage = index.ctx;
19050        let mut out_out: *mut bindings::VipsImage = null_mut();
19051
19052        let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
19053        let interpolate_in_name = utils::new_c_string("interpolate")?;
19054
19055        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
19056        let background_in = background_wrapper.ctx;
19057        let background_in_name = utils::new_c_string("background")?;
19058
19059        let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
19060        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19061
19062        let extend_in: i32 = mapim_options.extend as i32;
19063        let extend_in_name = utils::new_c_string("extend")?;
19064
19065        let vips_op_response = bindings::vips_mapim(
19066            inp_in,
19067            &mut out_out,
19068            index_in,
19069            interpolate_in_name.as_ptr(),
19070            interpolate_in,
19071            background_in_name.as_ptr(),
19072            background_in,
19073            premultiplied_in_name.as_ptr(),
19074            premultiplied_in,
19075            extend_in_name.as_ptr(),
19076            extend_in,
19077            NULL,
19078        );
19079        utils::result(
19080            vips_op_response,
19081            VipsImage { ctx: out_out },
19082            Error::MapimError,
19083        )
19084    }
19085}
19086
19087/// VipsShrink (shrink), shrink an image
19088/// inp: `&VipsImage` -> Input image argument
19089/// hshrink: `f64` -> Horizontal shrink factor
19090/// min: 1, max: 1000000, default: 1
19091/// vshrink: `f64` -> Vertical shrink factor
19092/// min: 1, max: 1000000, default: 1
19093/// returns `VipsImage` - Output image
19094pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19095    unsafe {
19096        let inp_in: *mut bindings::VipsImage = inp.ctx;
19097        let hshrink_in: f64 = hshrink;
19098        let vshrink_in: f64 = vshrink;
19099        let mut out_out: *mut bindings::VipsImage = null_mut();
19100
19101        let vips_op_response =
19102            bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19103        utils::result(
19104            vips_op_response,
19105            VipsImage { ctx: out_out },
19106            Error::ShrinkError,
19107        )
19108    }
19109}
19110
19111/// Options for shrink operation
19112#[derive(Clone, Debug)]
19113pub struct ShrinkOptions {
19114    /// ceil: `bool` -> Round-up output dimensions
19115    /// default: false
19116    pub ceil: bool,
19117}
19118
19119impl std::default::Default for ShrinkOptions {
19120    fn default() -> Self {
19121        ShrinkOptions { ceil: false }
19122    }
19123}
19124
19125/// VipsShrink (shrink), shrink an image
19126/// inp: `&VipsImage` -> Input image argument
19127/// hshrink: `f64` -> Horizontal shrink factor
19128/// min: 1, max: 1000000, default: 1
19129/// vshrink: `f64` -> Vertical shrink factor
19130/// min: 1, max: 1000000, default: 1
19131/// shrink_options: `&ShrinkOptions` -> optional arguments
19132/// returns `VipsImage` - Output image
19133pub fn shrink_with_opts(
19134    inp: &VipsImage,
19135    hshrink: f64,
19136    vshrink: f64,
19137    shrink_options: &ShrinkOptions,
19138) -> Result<VipsImage> {
19139    unsafe {
19140        let inp_in: *mut bindings::VipsImage = inp.ctx;
19141        let hshrink_in: f64 = hshrink;
19142        let vshrink_in: f64 = vshrink;
19143        let mut out_out: *mut bindings::VipsImage = null_mut();
19144
19145        let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
19146        let ceil_in_name = utils::new_c_string("ceil")?;
19147
19148        let vips_op_response = bindings::vips_shrink(
19149            inp_in,
19150            &mut out_out,
19151            hshrink_in,
19152            vshrink_in,
19153            ceil_in_name.as_ptr(),
19154            ceil_in,
19155            NULL,
19156        );
19157        utils::result(
19158            vips_op_response,
19159            VipsImage { ctx: out_out },
19160            Error::ShrinkError,
19161        )
19162    }
19163}
19164
19165/// VipsShrinkh (shrinkh), shrink an image horizontally
19166/// inp: `&VipsImage` -> Input image argument
19167/// hshrink: `i32` -> Horizontal shrink factor
19168/// min: 1, max: 1000000, default: 1
19169/// returns `VipsImage` - Output image
19170pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
19171    unsafe {
19172        let inp_in: *mut bindings::VipsImage = inp.ctx;
19173        let hshrink_in: i32 = hshrink;
19174        let mut out_out: *mut bindings::VipsImage = null_mut();
19175
19176        let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
19177        utils::result(
19178            vips_op_response,
19179            VipsImage { ctx: out_out },
19180            Error::ShrinkhError,
19181        )
19182    }
19183}
19184
19185/// Options for shrinkh operation
19186#[derive(Clone, Debug)]
19187pub struct ShrinkhOptions {
19188    /// ceil: `bool` -> Round-up output dimensions
19189    /// default: false
19190    pub ceil: bool,
19191}
19192
19193impl std::default::Default for ShrinkhOptions {
19194    fn default() -> Self {
19195        ShrinkhOptions { ceil: false }
19196    }
19197}
19198
19199/// VipsShrinkh (shrinkh), shrink an image horizontally
19200/// inp: `&VipsImage` -> Input image argument
19201/// hshrink: `i32` -> Horizontal shrink factor
19202/// min: 1, max: 1000000, default: 1
19203/// shrinkh_options: `&ShrinkhOptions` -> optional arguments
19204/// returns `VipsImage` - Output image
19205pub fn shrinkh_with_opts(
19206    inp: &VipsImage,
19207    hshrink: i32,
19208    shrinkh_options: &ShrinkhOptions,
19209) -> Result<VipsImage> {
19210    unsafe {
19211        let inp_in: *mut bindings::VipsImage = inp.ctx;
19212        let hshrink_in: i32 = hshrink;
19213        let mut out_out: *mut bindings::VipsImage = null_mut();
19214
19215        let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
19216        let ceil_in_name = utils::new_c_string("ceil")?;
19217
19218        let vips_op_response = bindings::vips_shrinkh(
19219            inp_in,
19220            &mut out_out,
19221            hshrink_in,
19222            ceil_in_name.as_ptr(),
19223            ceil_in,
19224            NULL,
19225        );
19226        utils::result(
19227            vips_op_response,
19228            VipsImage { ctx: out_out },
19229            Error::ShrinkhError,
19230        )
19231    }
19232}
19233
19234/// VipsShrinkv (shrinkv), shrink an image vertically
19235/// inp: `&VipsImage` -> Input image argument
19236/// vshrink: `i32` -> Vertical shrink factor
19237/// min: 1, max: 1000000, default: 1
19238/// returns `VipsImage` - Output image
19239pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
19240    unsafe {
19241        let inp_in: *mut bindings::VipsImage = inp.ctx;
19242        let vshrink_in: i32 = vshrink;
19243        let mut out_out: *mut bindings::VipsImage = null_mut();
19244
19245        let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
19246        utils::result(
19247            vips_op_response,
19248            VipsImage { ctx: out_out },
19249            Error::ShrinkvError,
19250        )
19251    }
19252}
19253
19254/// Options for shrinkv operation
19255#[derive(Clone, Debug)]
19256pub struct ShrinkvOptions {
19257    /// ceil: `bool` -> Round-up output dimensions
19258    /// default: false
19259    pub ceil: bool,
19260}
19261
19262impl std::default::Default for ShrinkvOptions {
19263    fn default() -> Self {
19264        ShrinkvOptions { ceil: false }
19265    }
19266}
19267
19268/// VipsShrinkv (shrinkv), shrink an image vertically
19269/// inp: `&VipsImage` -> Input image argument
19270/// vshrink: `i32` -> Vertical shrink factor
19271/// min: 1, max: 1000000, default: 1
19272/// shrinkv_options: `&ShrinkvOptions` -> optional arguments
19273/// returns `VipsImage` - Output image
19274pub fn shrinkv_with_opts(
19275    inp: &VipsImage,
19276    vshrink: i32,
19277    shrinkv_options: &ShrinkvOptions,
19278) -> Result<VipsImage> {
19279    unsafe {
19280        let inp_in: *mut bindings::VipsImage = inp.ctx;
19281        let vshrink_in: i32 = vshrink;
19282        let mut out_out: *mut bindings::VipsImage = null_mut();
19283
19284        let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
19285        let ceil_in_name = utils::new_c_string("ceil")?;
19286
19287        let vips_op_response = bindings::vips_shrinkv(
19288            inp_in,
19289            &mut out_out,
19290            vshrink_in,
19291            ceil_in_name.as_ptr(),
19292            ceil_in,
19293            NULL,
19294        );
19295        utils::result(
19296            vips_op_response,
19297            VipsImage { ctx: out_out },
19298            Error::ShrinkvError,
19299        )
19300    }
19301}
19302
19303/// VipsReduceh (reduceh), shrink an image horizontally
19304/// inp: `&VipsImage` -> Input image argument
19305/// hshrink: `f64` -> Horizontal shrink factor
19306/// min: 1, max: 1000000, default: 1
19307/// returns `VipsImage` - Output image
19308pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
19309    unsafe {
19310        let inp_in: *mut bindings::VipsImage = inp.ctx;
19311        let hshrink_in: f64 = hshrink;
19312        let mut out_out: *mut bindings::VipsImage = null_mut();
19313
19314        let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
19315        utils::result(
19316            vips_op_response,
19317            VipsImage { ctx: out_out },
19318            Error::ReducehError,
19319        )
19320    }
19321}
19322
19323/// Options for reduceh operation
19324#[derive(Clone, Debug)]
19325pub struct ReducehOptions {
19326    /// kernel: `Kernel` -> Resampling kernel
19327    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19328    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19329    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19330    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19331    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19332    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19333    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19334    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19335    pub kernel: Kernel,
19336    /// gap: `f64` -> Reducing gap
19337    /// min: 0, max: 1000000, default: 0
19338    pub gap: f64,
19339}
19340
19341impl std::default::Default for ReducehOptions {
19342    fn default() -> Self {
19343        ReducehOptions {
19344            kernel: Kernel::Lanczos3,
19345            gap: f64::from(0),
19346        }
19347    }
19348}
19349
19350/// VipsReduceh (reduceh), shrink an image horizontally
19351/// inp: `&VipsImage` -> Input image argument
19352/// hshrink: `f64` -> Horizontal shrink factor
19353/// min: 1, max: 1000000, default: 1
19354/// reduceh_options: `&ReducehOptions` -> optional arguments
19355/// returns `VipsImage` - Output image
19356pub fn reduceh_with_opts(
19357    inp: &VipsImage,
19358    hshrink: f64,
19359    reduceh_options: &ReducehOptions,
19360) -> Result<VipsImage> {
19361    unsafe {
19362        let inp_in: *mut bindings::VipsImage = inp.ctx;
19363        let hshrink_in: f64 = hshrink;
19364        let mut out_out: *mut bindings::VipsImage = null_mut();
19365
19366        let kernel_in: i32 = reduceh_options.kernel as i32;
19367        let kernel_in_name = utils::new_c_string("kernel")?;
19368
19369        let gap_in: f64 = reduceh_options.gap;
19370        let gap_in_name = utils::new_c_string("gap")?;
19371
19372        let vips_op_response = bindings::vips_reduceh(
19373            inp_in,
19374            &mut out_out,
19375            hshrink_in,
19376            kernel_in_name.as_ptr(),
19377            kernel_in,
19378            gap_in_name.as_ptr(),
19379            gap_in,
19380            NULL,
19381        );
19382        utils::result(
19383            vips_op_response,
19384            VipsImage { ctx: out_out },
19385            Error::ReducehError,
19386        )
19387    }
19388}
19389
19390/// VipsReducev (reducev), shrink an image vertically
19391/// inp: `&VipsImage` -> Input image argument
19392/// vshrink: `f64` -> Vertical shrink factor
19393/// min: 1, max: 1000000, default: 1
19394/// returns `VipsImage` - Output image
19395pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
19396    unsafe {
19397        let inp_in: *mut bindings::VipsImage = inp.ctx;
19398        let vshrink_in: f64 = vshrink;
19399        let mut out_out: *mut bindings::VipsImage = null_mut();
19400
19401        let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
19402        utils::result(
19403            vips_op_response,
19404            VipsImage { ctx: out_out },
19405            Error::ReducevError,
19406        )
19407    }
19408}
19409
19410/// Options for reducev operation
19411#[derive(Clone, Debug)]
19412pub struct ReducevOptions {
19413    /// kernel: `Kernel` -> Resampling kernel
19414    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19415    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19416    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19417    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19418    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19419    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19420    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19421    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19422    pub kernel: Kernel,
19423    /// gap: `f64` -> Reducing gap
19424    /// min: 0, max: 1000000, default: 0
19425    pub gap: f64,
19426}
19427
19428impl std::default::Default for ReducevOptions {
19429    fn default() -> Self {
19430        ReducevOptions {
19431            kernel: Kernel::Lanczos3,
19432            gap: f64::from(0),
19433        }
19434    }
19435}
19436
19437/// VipsReducev (reducev), shrink an image vertically
19438/// inp: `&VipsImage` -> Input image argument
19439/// vshrink: `f64` -> Vertical shrink factor
19440/// min: 1, max: 1000000, default: 1
19441/// reducev_options: `&ReducevOptions` -> optional arguments
19442/// returns `VipsImage` - Output image
19443pub fn reducev_with_opts(
19444    inp: &VipsImage,
19445    vshrink: f64,
19446    reducev_options: &ReducevOptions,
19447) -> Result<VipsImage> {
19448    unsafe {
19449        let inp_in: *mut bindings::VipsImage = inp.ctx;
19450        let vshrink_in: f64 = vshrink;
19451        let mut out_out: *mut bindings::VipsImage = null_mut();
19452
19453        let kernel_in: i32 = reducev_options.kernel as i32;
19454        let kernel_in_name = utils::new_c_string("kernel")?;
19455
19456        let gap_in: f64 = reducev_options.gap;
19457        let gap_in_name = utils::new_c_string("gap")?;
19458
19459        let vips_op_response = bindings::vips_reducev(
19460            inp_in,
19461            &mut out_out,
19462            vshrink_in,
19463            kernel_in_name.as_ptr(),
19464            kernel_in,
19465            gap_in_name.as_ptr(),
19466            gap_in,
19467            NULL,
19468        );
19469        utils::result(
19470            vips_op_response,
19471            VipsImage { ctx: out_out },
19472            Error::ReducevError,
19473        )
19474    }
19475}
19476
19477/// VipsReduce (reduce), reduce an image
19478/// inp: `&VipsImage` -> Input image argument
19479/// hshrink: `f64` -> Horizontal shrink factor
19480/// min: 1, max: 1000000, default: 1
19481/// vshrink: `f64` -> Vertical shrink factor
19482/// min: 1, max: 1000000, default: 1
19483/// returns `VipsImage` - Output image
19484pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19485    unsafe {
19486        let inp_in: *mut bindings::VipsImage = inp.ctx;
19487        let hshrink_in: f64 = hshrink;
19488        let vshrink_in: f64 = vshrink;
19489        let mut out_out: *mut bindings::VipsImage = null_mut();
19490
19491        let vips_op_response =
19492            bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19493        utils::result(
19494            vips_op_response,
19495            VipsImage { ctx: out_out },
19496            Error::ReduceError,
19497        )
19498    }
19499}
19500
19501/// Options for reduce operation
19502#[derive(Clone, Debug)]
19503pub struct ReduceOptions {
19504    /// kernel: `Kernel` -> Resampling kernel
19505    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
19506    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
19507    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
19508    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
19509    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
19510    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
19511    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
19512    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
19513    pub kernel: Kernel,
19514    /// gap: `f64` -> Reducing gap
19515    /// min: 0, max: 1000000, default: 0
19516    pub gap: f64,
19517}
19518
19519impl std::default::Default for ReduceOptions {
19520    fn default() -> Self {
19521        ReduceOptions {
19522            kernel: Kernel::Lanczos3,
19523            gap: f64::from(0),
19524        }
19525    }
19526}
19527
19528/// VipsReduce (reduce), reduce an image
19529/// inp: `&VipsImage` -> Input image argument
19530/// hshrink: `f64` -> Horizontal shrink factor
19531/// min: 1, max: 1000000, default: 1
19532/// vshrink: `f64` -> Vertical shrink factor
19533/// min: 1, max: 1000000, default: 1
19534/// reduce_options: `&ReduceOptions` -> optional arguments
19535/// returns `VipsImage` - Output image
19536pub fn reduce_with_opts(
19537    inp: &VipsImage,
19538    hshrink: f64,
19539    vshrink: f64,
19540    reduce_options: &ReduceOptions,
19541) -> Result<VipsImage> {
19542    unsafe {
19543        let inp_in: *mut bindings::VipsImage = inp.ctx;
19544        let hshrink_in: f64 = hshrink;
19545        let vshrink_in: f64 = vshrink;
19546        let mut out_out: *mut bindings::VipsImage = null_mut();
19547
19548        let kernel_in: i32 = reduce_options.kernel as i32;
19549        let kernel_in_name = utils::new_c_string("kernel")?;
19550
19551        let gap_in: f64 = reduce_options.gap;
19552        let gap_in_name = utils::new_c_string("gap")?;
19553
19554        let vips_op_response = bindings::vips_reduce(
19555            inp_in,
19556            &mut out_out,
19557            hshrink_in,
19558            vshrink_in,
19559            kernel_in_name.as_ptr(),
19560            kernel_in,
19561            gap_in_name.as_ptr(),
19562            gap_in,
19563            NULL,
19564        );
19565        utils::result(
19566            vips_op_response,
19567            VipsImage { ctx: out_out },
19568            Error::ReduceError,
19569        )
19570    }
19571}
19572
19573/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19574/// inp: `&VipsImage` -> Input image argument
19575/// coeff: `&VipsImage` -> Coefficient matrix
19576/// returns `VipsImage` - Output image
19577pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19578    unsafe {
19579        let inp_in: *mut bindings::VipsImage = inp.ctx;
19580        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19581        let mut out_out: *mut bindings::VipsImage = null_mut();
19582
19583        let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19584        utils::result(
19585            vips_op_response,
19586            VipsImage { ctx: out_out },
19587            Error::QuadraticError,
19588        )
19589    }
19590}
19591
19592/// Options for quadratic operation
19593#[derive(Clone, Debug)]
19594pub struct QuadraticOptions {
19595    /// interpolate: `VipsInterpolate` -> Interpolate values with this
19596    pub interpolate: VipsInterpolate,
19597}
19598
19599impl std::default::Default for QuadraticOptions {
19600    fn default() -> Self {
19601        QuadraticOptions {
19602            interpolate: VipsInterpolate::new(),
19603        }
19604    }
19605}
19606
19607/// VipsQuadratic (quadratic), resample an image with a quadratic transform
19608/// inp: `&VipsImage` -> Input image argument
19609/// coeff: `&VipsImage` -> Coefficient matrix
19610/// quadratic_options: `&QuadraticOptions` -> optional arguments
19611/// returns `VipsImage` - Output image
19612pub fn quadratic_with_opts(
19613    inp: &VipsImage,
19614    coeff: &VipsImage,
19615    quadratic_options: &QuadraticOptions,
19616) -> Result<VipsImage> {
19617    unsafe {
19618        let inp_in: *mut bindings::VipsImage = inp.ctx;
19619        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19620        let mut out_out: *mut bindings::VipsImage = null_mut();
19621
19622        let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19623        let interpolate_in_name = utils::new_c_string("interpolate")?;
19624
19625        let vips_op_response = bindings::vips_quadratic(
19626            inp_in,
19627            &mut out_out,
19628            coeff_in,
19629            interpolate_in_name.as_ptr(),
19630            interpolate_in,
19631            NULL,
19632        );
19633        utils::result(
19634            vips_op_response,
19635            VipsImage { ctx: out_out },
19636            Error::QuadraticError,
19637        )
19638    }
19639}
19640
19641/// VipsAffine (affine), affine transform of an image
19642/// inp: `&VipsImage` -> Input image argument
19643/// a: `f64` -> Transformation Matrix coefficient
19644/// min: -inf, max: inf, default: 0
19645/// b: `f64` -> Transformation Matrix coefficient
19646/// min: -inf, max: inf, default: 0
19647/// c: `f64` -> Transformation Matrix coefficient
19648/// min: -inf, max: inf, default: 0
19649/// d: `f64` -> Transformation Matrix coefficient
19650/// min: -inf, max: inf, default: 0
19651/// returns `VipsImage` - Output image
19652pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19653    unsafe {
19654        let inp_in: *mut bindings::VipsImage = inp.ctx;
19655        let a_in: f64 = a;
19656        let b_in: f64 = b;
19657        let c_in: f64 = c;
19658        let d_in: f64 = d;
19659        let mut out_out: *mut bindings::VipsImage = null_mut();
19660
19661        let vips_op_response =
19662            bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19663        utils::result(
19664            vips_op_response,
19665            VipsImage { ctx: out_out },
19666            Error::AffineError,
19667        )
19668    }
19669}
19670
19671/// Options for affine operation
19672#[derive(Clone, Debug)]
19673pub struct AffineOptions {
19674    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19675    pub interpolate: VipsInterpolate,
19676    /// oarea: `Vec<i32>` -> Area of output to generate
19677    pub oarea: Vec<i32>,
19678    /// odx: `f64` -> Horizontal output displacement
19679    /// min: -10000000, max: 10000000, default: 0
19680    pub odx: f64,
19681    /// ody: `f64` -> Vertical output displacement
19682    /// min: -10000000, max: 10000000, default: 0
19683    pub ody: f64,
19684    /// idx: `f64` -> Horizontal input displacement
19685    /// min: -10000000, max: 10000000, default: 0
19686    pub idx: f64,
19687    /// idy: `f64` -> Vertical input displacement
19688    /// min: -10000000, max: 10000000, default: 0
19689    pub idy: f64,
19690    /// background: `Vec<f64>` -> Background value
19691    pub background: Vec<f64>,
19692    /// premultiplied: `bool` -> Images have premultiplied alpha
19693    /// default: false
19694    pub premultiplied: bool,
19695    /// extend: `Extend` -> How to generate the extra pixels
19696    ///  `Black` -> VIPS_EXTEND_BLACK = 0
19697    ///  `Copy` -> VIPS_EXTEND_COPY = 1
19698    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
19699    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
19700    ///  `White` -> VIPS_EXTEND_WHITE = 4
19701    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
19702    pub extend: Extend,
19703}
19704
19705impl std::default::Default for AffineOptions {
19706    fn default() -> Self {
19707        AffineOptions {
19708            interpolate: VipsInterpolate::new(),
19709            oarea: Vec::new(),
19710            odx: f64::from(0),
19711            ody: f64::from(0),
19712            idx: f64::from(0),
19713            idy: f64::from(0),
19714            background: Vec::new(),
19715            premultiplied: false,
19716            extend: Extend::Background,
19717        }
19718    }
19719}
19720
19721/// VipsAffine (affine), affine transform of an image
19722/// inp: `&VipsImage` -> Input image argument
19723/// a: `f64` -> Transformation Matrix coefficient
19724/// min: -inf, max: inf, default: 0
19725/// b: `f64` -> Transformation Matrix coefficient
19726/// min: -inf, max: inf, default: 0
19727/// c: `f64` -> Transformation Matrix coefficient
19728/// min: -inf, max: inf, default: 0
19729/// d: `f64` -> Transformation Matrix coefficient
19730/// min: -inf, max: inf, default: 0
19731/// affine_options: `&AffineOptions` -> optional arguments
19732/// returns `VipsImage` - Output image
19733pub fn affine_with_opts(
19734    inp: &VipsImage,
19735    a: f64,
19736    b: f64,
19737    c: f64,
19738    d: f64,
19739    affine_options: &AffineOptions,
19740) -> Result<VipsImage> {
19741    unsafe {
19742        let inp_in: *mut bindings::VipsImage = inp.ctx;
19743        let a_in: f64 = a;
19744        let b_in: f64 = b;
19745        let c_in: f64 = c;
19746        let d_in: f64 = d;
19747        let mut out_out: *mut bindings::VipsImage = null_mut();
19748
19749        let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19750        let interpolate_in_name = utils::new_c_string("interpolate")?;
19751
19752        let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19753        let oarea_in = oarea_wrapper.ctx;
19754        let oarea_in_name = utils::new_c_string("oarea")?;
19755
19756        let odx_in: f64 = affine_options.odx;
19757        let odx_in_name = utils::new_c_string("odx")?;
19758
19759        let ody_in: f64 = affine_options.ody;
19760        let ody_in_name = utils::new_c_string("ody")?;
19761
19762        let idx_in: f64 = affine_options.idx;
19763        let idx_in_name = utils::new_c_string("idx")?;
19764
19765        let idy_in: f64 = affine_options.idy;
19766        let idy_in_name = utils::new_c_string("idy")?;
19767
19768        let background_wrapper =
19769            utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19770        let background_in = background_wrapper.ctx;
19771        let background_in_name = utils::new_c_string("background")?;
19772
19773        let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19774        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19775
19776        let extend_in: i32 = affine_options.extend as i32;
19777        let extend_in_name = utils::new_c_string("extend")?;
19778
19779        let vips_op_response = bindings::vips_affine(
19780            inp_in,
19781            &mut out_out,
19782            a_in,
19783            b_in,
19784            c_in,
19785            d_in,
19786            interpolate_in_name.as_ptr(),
19787            interpolate_in,
19788            oarea_in_name.as_ptr(),
19789            oarea_in,
19790            odx_in_name.as_ptr(),
19791            odx_in,
19792            ody_in_name.as_ptr(),
19793            ody_in,
19794            idx_in_name.as_ptr(),
19795            idx_in,
19796            idy_in_name.as_ptr(),
19797            idy_in,
19798            background_in_name.as_ptr(),
19799            background_in,
19800            premultiplied_in_name.as_ptr(),
19801            premultiplied_in,
19802            extend_in_name.as_ptr(),
19803            extend_in,
19804            NULL,
19805        );
19806        utils::result(
19807            vips_op_response,
19808            VipsImage { ctx: out_out },
19809            Error::AffineError,
19810        )
19811    }
19812}
19813
19814/// VipsSimilarity (similarity), similarity transform of an image
19815/// inp: `&VipsImage` -> Input image argument
19816/// returns `VipsImage` - Output image
19817pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19818    unsafe {
19819        let inp_in: *mut bindings::VipsImage = inp.ctx;
19820        let mut out_out: *mut bindings::VipsImage = null_mut();
19821
19822        let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19823        utils::result(
19824            vips_op_response,
19825            VipsImage { ctx: out_out },
19826            Error::SimilarityError,
19827        )
19828    }
19829}
19830
19831/// Options for similarity operation
19832#[derive(Clone, Debug)]
19833pub struct SimilarityOptions {
19834    /// scale: `f64` -> Scale by this factor
19835    /// min: 0, max: 10000000, default: 1
19836    pub scale: f64,
19837    /// angle: `f64` -> Rotate clockwise by this many degrees
19838    /// min: -10000000, max: 10000000, default: 0
19839    pub angle: f64,
19840    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19841    pub interpolate: VipsInterpolate,
19842    /// background: `Vec<f64>` -> Background value
19843    pub background: Vec<f64>,
19844    /// odx: `f64` -> Horizontal output displacement
19845    /// min: -10000000, max: 10000000, default: 0
19846    pub odx: f64,
19847    /// ody: `f64` -> Vertical output displacement
19848    /// min: -10000000, max: 10000000, default: 0
19849    pub ody: f64,
19850    /// idx: `f64` -> Horizontal input displacement
19851    /// min: -10000000, max: 10000000, default: 0
19852    pub idx: f64,
19853    /// idy: `f64` -> Vertical input displacement
19854    /// min: -10000000, max: 10000000, default: 0
19855    pub idy: f64,
19856}
19857
19858impl std::default::Default for SimilarityOptions {
19859    fn default() -> Self {
19860        SimilarityOptions {
19861            scale: f64::from(1),
19862            angle: f64::from(0),
19863            interpolate: VipsInterpolate::new(),
19864            background: Vec::new(),
19865            odx: f64::from(0),
19866            ody: f64::from(0),
19867            idx: f64::from(0),
19868            idy: f64::from(0),
19869        }
19870    }
19871}
19872
19873/// VipsSimilarity (similarity), similarity transform of an image
19874/// inp: `&VipsImage` -> Input image argument
19875/// similarity_options: `&SimilarityOptions` -> optional arguments
19876/// returns `VipsImage` - Output image
19877pub fn similarity_with_opts(
19878    inp: &VipsImage,
19879    similarity_options: &SimilarityOptions,
19880) -> 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 scale_in: f64 = similarity_options.scale;
19886        let scale_in_name = utils::new_c_string("scale")?;
19887
19888        let angle_in: f64 = similarity_options.angle;
19889        let angle_in_name = utils::new_c_string("angle")?;
19890
19891        let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
19892        let interpolate_in_name = utils::new_c_string("interpolate")?;
19893
19894        let background_wrapper =
19895            utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
19896        let background_in = background_wrapper.ctx;
19897        let background_in_name = utils::new_c_string("background")?;
19898
19899        let odx_in: f64 = similarity_options.odx;
19900        let odx_in_name = utils::new_c_string("odx")?;
19901
19902        let ody_in: f64 = similarity_options.ody;
19903        let ody_in_name = utils::new_c_string("ody")?;
19904
19905        let idx_in: f64 = similarity_options.idx;
19906        let idx_in_name = utils::new_c_string("idx")?;
19907
19908        let idy_in: f64 = similarity_options.idy;
19909        let idy_in_name = utils::new_c_string("idy")?;
19910
19911        let vips_op_response = bindings::vips_similarity(
19912            inp_in,
19913            &mut out_out,
19914            scale_in_name.as_ptr(),
19915            scale_in,
19916            angle_in_name.as_ptr(),
19917            angle_in,
19918            interpolate_in_name.as_ptr(),
19919            interpolate_in,
19920            background_in_name.as_ptr(),
19921            background_in,
19922            odx_in_name.as_ptr(),
19923            odx_in,
19924            ody_in_name.as_ptr(),
19925            ody_in,
19926            idx_in_name.as_ptr(),
19927            idx_in,
19928            idy_in_name.as_ptr(),
19929            idy_in,
19930            NULL,
19931        );
19932        utils::result(
19933            vips_op_response,
19934            VipsImage { ctx: out_out },
19935            Error::SimilarityError,
19936        )
19937    }
19938}
19939
19940/// VipsRotate (rotate), rotate an image by a number of degrees
19941/// inp: `&VipsImage` -> Input image argument
19942/// angle: `f64` -> Rotate clockwise by this many degrees
19943/// min: -10000000, max: 10000000, default: 0
19944/// returns `VipsImage` - Output image
19945pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
19946    unsafe {
19947        let inp_in: *mut bindings::VipsImage = inp.ctx;
19948        let angle_in: f64 = angle;
19949        let mut out_out: *mut bindings::VipsImage = null_mut();
19950
19951        let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
19952        utils::result(
19953            vips_op_response,
19954            VipsImage { ctx: out_out },
19955            Error::RotateError,
19956        )
19957    }
19958}
19959
19960/// Options for rotate operation
19961#[derive(Clone, Debug)]
19962pub struct RotateOptions {
19963    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
19964    pub interpolate: VipsInterpolate,
19965    /// background: `Vec<f64>` -> Background value
19966    pub background: Vec<f64>,
19967    /// odx: `f64` -> Horizontal output displacement
19968    /// min: -10000000, max: 10000000, default: 0
19969    pub odx: f64,
19970    /// ody: `f64` -> Vertical output displacement
19971    /// min: -10000000, max: 10000000, default: 0
19972    pub ody: f64,
19973    /// idx: `f64` -> Horizontal input displacement
19974    /// min: -10000000, max: 10000000, default: 0
19975    pub idx: f64,
19976    /// idy: `f64` -> Vertical input displacement
19977    /// min: -10000000, max: 10000000, default: 0
19978    pub idy: f64,
19979}
19980
19981impl std::default::Default for RotateOptions {
19982    fn default() -> Self {
19983        RotateOptions {
19984            interpolate: VipsInterpolate::new(),
19985            background: Vec::new(),
19986            odx: f64::from(0),
19987            ody: f64::from(0),
19988            idx: f64::from(0),
19989            idy: f64::from(0),
19990        }
19991    }
19992}
19993
19994/// VipsRotate (rotate), rotate an image by a number of degrees
19995/// inp: `&VipsImage` -> Input image argument
19996/// angle: `f64` -> Rotate clockwise by this many degrees
19997/// min: -10000000, max: 10000000, default: 0
19998/// rotate_options: `&RotateOptions` -> optional arguments
19999/// returns `VipsImage` - Output image
20000pub fn rotate_with_opts(
20001    inp: &VipsImage,
20002    angle: f64,
20003    rotate_options: &RotateOptions,
20004) -> Result<VipsImage> {
20005    unsafe {
20006        let inp_in: *mut bindings::VipsImage = inp.ctx;
20007        let angle_in: f64 = angle;
20008        let mut out_out: *mut bindings::VipsImage = null_mut();
20009
20010        let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
20011        let interpolate_in_name = utils::new_c_string("interpolate")?;
20012
20013        let background_wrapper =
20014            utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
20015        let background_in = background_wrapper.ctx;
20016        let background_in_name = utils::new_c_string("background")?;
20017
20018        let odx_in: f64 = rotate_options.odx;
20019        let odx_in_name = utils::new_c_string("odx")?;
20020
20021        let ody_in: f64 = rotate_options.ody;
20022        let ody_in_name = utils::new_c_string("ody")?;
20023
20024        let idx_in: f64 = rotate_options.idx;
20025        let idx_in_name = utils::new_c_string("idx")?;
20026
20027        let idy_in: f64 = rotate_options.idy;
20028        let idy_in_name = utils::new_c_string("idy")?;
20029
20030        let vips_op_response = bindings::vips_rotate(
20031            inp_in,
20032            &mut out_out,
20033            angle_in,
20034            interpolate_in_name.as_ptr(),
20035            interpolate_in,
20036            background_in_name.as_ptr(),
20037            background_in,
20038            odx_in_name.as_ptr(),
20039            odx_in,
20040            ody_in_name.as_ptr(),
20041            ody_in,
20042            idx_in_name.as_ptr(),
20043            idx_in,
20044            idy_in_name.as_ptr(),
20045            idy_in,
20046            NULL,
20047        );
20048        utils::result(
20049            vips_op_response,
20050            VipsImage { ctx: out_out },
20051            Error::RotateError,
20052        )
20053    }
20054}
20055
20056/// VipsResize (resize), resize an image
20057/// inp: `&VipsImage` -> Input image argument
20058/// scale: `f64` -> Scale image by this factor
20059/// min: 0, max: 10000000, default: 0
20060/// returns `VipsImage` - Output image
20061pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
20062    unsafe {
20063        let inp_in: *mut bindings::VipsImage = inp.ctx;
20064        let scale_in: f64 = scale;
20065        let mut out_out: *mut bindings::VipsImage = null_mut();
20066
20067        let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
20068        utils::result(
20069            vips_op_response,
20070            VipsImage { ctx: out_out },
20071            Error::ResizeError,
20072        )
20073    }
20074}
20075
20076/// Options for resize operation
20077#[derive(Clone, Debug)]
20078pub struct ResizeOptions {
20079    /// kernel: `Kernel` -> Resampling kernel
20080    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
20081    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
20082    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
20083    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
20084    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
20085    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
20086    ///  `Mks2013` -> VIPS_KERNEL_MKS2013 = 6
20087    ///  `Mks2021` -> VIPS_KERNEL_MKS2021 = 7
20088    pub kernel: Kernel,
20089    /// gap: `f64` -> Reducing gap
20090    /// min: 0, max: 1000000, default: 2
20091    pub gap: f64,
20092    /// vscale: `f64` -> Vertical scale image by this factor
20093    /// min: 0, max: 10000000, default: 0
20094    pub vscale: f64,
20095}
20096
20097impl std::default::Default for ResizeOptions {
20098    fn default() -> Self {
20099        ResizeOptions {
20100            kernel: Kernel::Lanczos3,
20101            gap: f64::from(2),
20102            vscale: f64::from(0),
20103        }
20104    }
20105}
20106
20107/// VipsResize (resize), resize an image
20108/// inp: `&VipsImage` -> Input image argument
20109/// scale: `f64` -> Scale image by this factor
20110/// min: 0, max: 10000000, default: 0
20111/// resize_options: `&ResizeOptions` -> optional arguments
20112/// returns `VipsImage` - Output image
20113pub fn resize_with_opts(
20114    inp: &VipsImage,
20115    scale: f64,
20116    resize_options: &ResizeOptions,
20117) -> Result<VipsImage> {
20118    unsafe {
20119        let inp_in: *mut bindings::VipsImage = inp.ctx;
20120        let scale_in: f64 = scale;
20121        let mut out_out: *mut bindings::VipsImage = null_mut();
20122
20123        let kernel_in: i32 = resize_options.kernel as i32;
20124        let kernel_in_name = utils::new_c_string("kernel")?;
20125
20126        let gap_in: f64 = resize_options.gap;
20127        let gap_in_name = utils::new_c_string("gap")?;
20128
20129        let vscale_in: f64 = resize_options.vscale;
20130        let vscale_in_name = utils::new_c_string("vscale")?;
20131
20132        let vips_op_response = bindings::vips_resize(
20133            inp_in,
20134            &mut out_out,
20135            scale_in,
20136            kernel_in_name.as_ptr(),
20137            kernel_in,
20138            gap_in_name.as_ptr(),
20139            gap_in,
20140            vscale_in_name.as_ptr(),
20141            vscale_in,
20142            NULL,
20143        );
20144        utils::result(
20145            vips_op_response,
20146            VipsImage { ctx: out_out },
20147            Error::ResizeError,
20148        )
20149    }
20150}
20151
20152/// VipsColourspace (colourspace), convert to a new colorspace
20153/// inp: `&VipsImage` -> Input image
20154/// space: `Interpretation` -> Destination color space
20155///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20156///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20157///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20158///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20159///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20160///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20161///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20162///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20163///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20164///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20165///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20166///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20167///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20168///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20169///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20170///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20171///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20172///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20173///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20174///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20175///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
20176///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
20177/// returns `VipsImage` - Output image
20178pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
20179    unsafe {
20180        let inp_in: *mut bindings::VipsImage = inp.ctx;
20181        let space_in: i32 = space as i32;
20182        let mut out_out: *mut bindings::VipsImage = null_mut();
20183
20184        let vips_op_response =
20185            bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
20186        utils::result(
20187            vips_op_response,
20188            VipsImage { ctx: out_out },
20189            Error::ColourspaceError,
20190        )
20191    }
20192}
20193
20194/// Options for colourspace operation
20195#[derive(Clone, Debug)]
20196pub struct ColourspaceOptions {
20197    /// source_space: `Interpretation` -> Source color space
20198    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20199    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20200    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20201    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20202    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20203    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20204    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20205    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20206    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20207    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20208    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20209    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20210    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20211    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20212    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20213    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20214    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20215    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20216    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20217    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20218    ///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
20219    ///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
20220    pub source_space: Interpretation,
20221}
20222
20223impl std::default::Default for ColourspaceOptions {
20224    fn default() -> Self {
20225        ColourspaceOptions {
20226            source_space: Interpretation::Srgb,
20227        }
20228    }
20229}
20230
20231/// VipsColourspace (colourspace), convert to a new colorspace
20232/// inp: `&VipsImage` -> Input image
20233/// space: `Interpretation` -> Destination color space
20234///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
20235///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
20236///  `BW` -> VIPS_INTERPRETATION_B_W = 1
20237///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
20238///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
20239///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
20240///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
20241///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
20242///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
20243///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
20244///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
20245///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
20246///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
20247///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
20248///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
20249///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
20250///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
20251///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
20252///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
20253///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
20254///  `Oklab` -> VIPS_INTERPRETATION_OKLAB = 30
20255///  `Oklch` -> VIPS_INTERPRETATION_OKLCH = 31
20256/// colourspace_options: `&ColourspaceOptions` -> optional arguments
20257/// returns `VipsImage` - Output image
20258pub fn colourspace_with_opts(
20259    inp: &VipsImage,
20260    space: Interpretation,
20261    colourspace_options: &ColourspaceOptions,
20262) -> Result<VipsImage> {
20263    unsafe {
20264        let inp_in: *mut bindings::VipsImage = inp.ctx;
20265        let space_in: i32 = space as i32;
20266        let mut out_out: *mut bindings::VipsImage = null_mut();
20267
20268        let source_space_in: i32 = colourspace_options.source_space as i32;
20269        let source_space_in_name = utils::new_c_string("source-space")?;
20270
20271        let vips_op_response = bindings::vips_colourspace(
20272            inp_in,
20273            &mut out_out,
20274            space_in.try_into().unwrap(),
20275            source_space_in_name.as_ptr(),
20276            source_space_in,
20277            NULL,
20278        );
20279        utils::result(
20280            vips_op_response,
20281            VipsImage { ctx: out_out },
20282            Error::ColourspaceError,
20283        )
20284    }
20285}
20286
20287/// VipsOklab2Oklch (Oklab2Oklch), transform Oklab to Oklch
20288/// inp: `&VipsImage` -> Input image
20289/// returns `VipsImage` - Output image
20290pub fn oklab_2_oklch(inp: &VipsImage) -> Result<VipsImage> {
20291    unsafe {
20292        let inp_in: *mut bindings::VipsImage = inp.ctx;
20293        let mut out_out: *mut bindings::VipsImage = null_mut();
20294
20295        let vips_op_response = bindings::vips_Oklab2Oklch(inp_in, &mut out_out, NULL);
20296        utils::result(
20297            vips_op_response,
20298            VipsImage { ctx: out_out },
20299            Error::Oklab2OklchError,
20300        )
20301    }
20302}
20303
20304/// VipsOklch2Oklab (Oklch2Oklab), transform Oklch to Oklab
20305/// inp: `&VipsImage` -> Input image
20306/// returns `VipsImage` - Output image
20307pub fn oklch_2_oklab(inp: &VipsImage) -> Result<VipsImage> {
20308    unsafe {
20309        let inp_in: *mut bindings::VipsImage = inp.ctx;
20310        let mut out_out: *mut bindings::VipsImage = null_mut();
20311
20312        let vips_op_response = bindings::vips_Oklch2Oklab(inp_in, &mut out_out, NULL);
20313        utils::result(
20314            vips_op_response,
20315            VipsImage { ctx: out_out },
20316            Error::Oklch2OklabError,
20317        )
20318    }
20319}
20320
20321/// VipsOklab2XYZ (Oklab2XYZ), transform Oklab to XYZ
20322/// inp: `&VipsImage` -> Input image
20323/// returns `VipsImage` - Output image
20324pub fn oklab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20325    unsafe {
20326        let inp_in: *mut bindings::VipsImage = inp.ctx;
20327        let mut out_out: *mut bindings::VipsImage = null_mut();
20328
20329        let vips_op_response = bindings::vips_Oklab2XYZ(inp_in, &mut out_out, NULL);
20330        utils::result(
20331            vips_op_response,
20332            VipsImage { ctx: out_out },
20333            Error::Oklab2XyzError,
20334        )
20335    }
20336}
20337
20338/// VipsXYZ2Oklab (XYZ2Oklab), transform XYZ to Oklab
20339/// inp: `&VipsImage` -> Input image
20340/// returns `VipsImage` - Output image
20341pub fn xyz2_oklab(inp: &VipsImage) -> Result<VipsImage> {
20342    unsafe {
20343        let inp_in: *mut bindings::VipsImage = inp.ctx;
20344        let mut out_out: *mut bindings::VipsImage = null_mut();
20345
20346        let vips_op_response = bindings::vips_XYZ2Oklab(inp_in, &mut out_out, NULL);
20347        utils::result(
20348            vips_op_response,
20349            VipsImage { ctx: out_out },
20350            Error::Xyz2OklabError,
20351        )
20352    }
20353}
20354
20355/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20356/// inp: `&VipsImage` -> Input image
20357/// returns `VipsImage` - Output image
20358pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20359    unsafe {
20360        let inp_in: *mut bindings::VipsImage = inp.ctx;
20361        let mut out_out: *mut bindings::VipsImage = null_mut();
20362
20363        let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
20364        utils::result(
20365            vips_op_response,
20366            VipsImage { ctx: out_out },
20367            Error::Lab2XyzError,
20368        )
20369    }
20370}
20371
20372/// Options for lab_2xyz operation
20373#[derive(Clone, Debug)]
20374pub struct Lab2XyzOptions {
20375    /// temp: `Vec<f64>` -> Color temperature
20376    pub temp: Vec<f64>,
20377}
20378
20379impl std::default::Default for Lab2XyzOptions {
20380    fn default() -> Self {
20381        Lab2XyzOptions { temp: Vec::new() }
20382    }
20383}
20384
20385/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
20386/// inp: `&VipsImage` -> Input image
20387/// lab_2xyz_options: `&Lab2XyzOptions` -> optional arguments
20388/// returns `VipsImage` - Output image
20389pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
20390    unsafe {
20391        let inp_in: *mut bindings::VipsImage = inp.ctx;
20392        let mut out_out: *mut bindings::VipsImage = null_mut();
20393
20394        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
20395        let temp_in = temp_wrapper.ctx;
20396        let temp_in_name = utils::new_c_string("temp")?;
20397
20398        let vips_op_response =
20399            bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20400        utils::result(
20401            vips_op_response,
20402            VipsImage { ctx: out_out },
20403            Error::Lab2XyzError,
20404        )
20405    }
20406}
20407
20408/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20409/// inp: `&VipsImage` -> Input image
20410/// returns `VipsImage` - Output image
20411pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
20412    unsafe {
20413        let inp_in: *mut bindings::VipsImage = inp.ctx;
20414        let mut out_out: *mut bindings::VipsImage = null_mut();
20415
20416        let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
20417        utils::result(
20418            vips_op_response,
20419            VipsImage { ctx: out_out },
20420            Error::Xyz2LabError,
20421        )
20422    }
20423}
20424
20425/// Options for xyz2_lab operation
20426#[derive(Clone, Debug)]
20427pub struct Xyz2LabOptions {
20428    /// temp: `Vec<f64>` -> Colour temperature
20429    pub temp: Vec<f64>,
20430}
20431
20432impl std::default::Default for Xyz2LabOptions {
20433    fn default() -> Self {
20434        Xyz2LabOptions { temp: Vec::new() }
20435    }
20436}
20437
20438/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
20439/// inp: `&VipsImage` -> Input image
20440/// xyz2_lab_options: `&Xyz2LabOptions` -> optional arguments
20441/// returns `VipsImage` - Output image
20442pub fn xyz2_lab_with_opts(
20443    inp: &VipsImage,
20444    xyz_2_lab_options: &Xyz2LabOptions,
20445) -> Result<VipsImage> {
20446    unsafe {
20447        let inp_in: *mut bindings::VipsImage = inp.ctx;
20448        let mut out_out: *mut bindings::VipsImage = null_mut();
20449
20450        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
20451        let temp_in = temp_wrapper.ctx;
20452        let temp_in_name = utils::new_c_string("temp")?;
20453
20454        let vips_op_response =
20455            bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20456        utils::result(
20457            vips_op_response,
20458            VipsImage { ctx: out_out },
20459            Error::Xyz2LabError,
20460        )
20461    }
20462}
20463
20464/// VipsLab2LCh (Lab2LCh), transform Lab to LCh
20465/// inp: `&VipsImage` -> Input image
20466/// returns `VipsImage` - Output image
20467pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20468    unsafe {
20469        let inp_in: *mut bindings::VipsImage = inp.ctx;
20470        let mut out_out: *mut bindings::VipsImage = null_mut();
20471
20472        let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
20473        utils::result(
20474            vips_op_response,
20475            VipsImage { ctx: out_out },
20476            Error::Lab2LChError,
20477        )
20478    }
20479}
20480
20481/// VipsLCh2Lab (LCh2Lab), transform LCh to Lab
20482/// inp: `&VipsImage` -> Input image
20483/// returns `VipsImage` - Output image
20484pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
20485    unsafe {
20486        let inp_in: *mut bindings::VipsImage = inp.ctx;
20487        let mut out_out: *mut bindings::VipsImage = null_mut();
20488
20489        let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
20490        utils::result(
20491            vips_op_response,
20492            VipsImage { ctx: out_out },
20493            Error::LCh2LabError,
20494        )
20495    }
20496}
20497
20498/// VipsLCh2CMC (LCh2CMC), transform LCh to CMC
20499/// inp: `&VipsImage` -> Input image
20500/// returns `VipsImage` - Output image
20501pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
20502    unsafe {
20503        let inp_in: *mut bindings::VipsImage = inp.ctx;
20504        let mut out_out: *mut bindings::VipsImage = null_mut();
20505
20506        let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
20507        utils::result(
20508            vips_op_response,
20509            VipsImage { ctx: out_out },
20510            Error::LCh2CmcError,
20511        )
20512    }
20513}
20514
20515/// VipsCMC2LCh (CMC2LCh), transform LCh to CMC
20516/// inp: `&VipsImage` -> Input image
20517/// returns `VipsImage` - Output image
20518pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20519    unsafe {
20520        let inp_in: *mut bindings::VipsImage = inp.ctx;
20521        let mut out_out: *mut bindings::VipsImage = null_mut();
20522
20523        let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
20524        utils::result(
20525            vips_op_response,
20526            VipsImage { ctx: out_out },
20527            Error::Cmc2LChError,
20528        )
20529    }
20530}
20531
20532/// VipsXYZ2Yxy (XYZ2Yxy), transform XYZ to Yxy
20533/// inp: `&VipsImage` -> Input image
20534/// returns `VipsImage` - Output image
20535pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
20536    unsafe {
20537        let inp_in: *mut bindings::VipsImage = inp.ctx;
20538        let mut out_out: *mut bindings::VipsImage = null_mut();
20539
20540        let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
20541        utils::result(
20542            vips_op_response,
20543            VipsImage { ctx: out_out },
20544            Error::Xyz2YxyError,
20545        )
20546    }
20547}
20548
20549/// VipsYxy2XYZ (Yxy2XYZ), transform Yxy to XYZ
20550/// inp: `&VipsImage` -> Input image
20551/// returns `VipsImage` - Output image
20552pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20553    unsafe {
20554        let inp_in: *mut bindings::VipsImage = inp.ctx;
20555        let mut out_out: *mut bindings::VipsImage = null_mut();
20556
20557        let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
20558        utils::result(
20559            vips_op_response,
20560            VipsImage { ctx: out_out },
20561            Error::Yxy2XyzError,
20562        )
20563    }
20564}
20565
20566/// VipsscRGB2XYZ (scRGB2XYZ), transform scRGB to XYZ
20567/// inp: `&VipsImage` -> Input image
20568/// returns `VipsImage` - Output image
20569pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20570    unsafe {
20571        let inp_in: *mut bindings::VipsImage = inp.ctx;
20572        let mut out_out: *mut bindings::VipsImage = null_mut();
20573
20574        let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20575        utils::result(
20576            vips_op_response,
20577            VipsImage { ctx: out_out },
20578            Error::ScRgb2XyzError,
20579        )
20580    }
20581}
20582
20583/// VipsXYZ2scRGB (XYZ2scRGB), transform XYZ to scRGB
20584/// inp: `&VipsImage` -> Input image
20585/// returns `VipsImage` - Output image
20586pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20587    unsafe {
20588        let inp_in: *mut bindings::VipsImage = inp.ctx;
20589        let mut out_out: *mut bindings::VipsImage = null_mut();
20590
20591        let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
20592        utils::result(
20593            vips_op_response,
20594            VipsImage { ctx: out_out },
20595            Error::Xyz2ScRgbError,
20596        )
20597    }
20598}
20599
20600/// VipsLabQ2Lab (LabQ2Lab), unpack a LabQ image to float Lab
20601/// inp: `&VipsImage` -> Input image
20602/// returns `VipsImage` - Output image
20603pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
20604    unsafe {
20605        let inp_in: *mut bindings::VipsImage = inp.ctx;
20606        let mut out_out: *mut bindings::VipsImage = null_mut();
20607
20608        let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
20609        utils::result(
20610            vips_op_response,
20611            VipsImage { ctx: out_out },
20612            Error::LabQ2LabError,
20613        )
20614    }
20615}
20616
20617/// VipsLab2LabQ (Lab2LabQ), transform float Lab to LabQ coding
20618/// inp: `&VipsImage` -> Input image
20619/// returns `VipsImage` - Output image
20620pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20621    unsafe {
20622        let inp_in: *mut bindings::VipsImage = inp.ctx;
20623        let mut out_out: *mut bindings::VipsImage = null_mut();
20624
20625        let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20626        utils::result(
20627            vips_op_response,
20628            VipsImage { ctx: out_out },
20629            Error::Lab2LabQError,
20630        )
20631    }
20632}
20633
20634/// VipsLabQ2LabS (LabQ2LabS), unpack a LabQ image to short Lab
20635/// inp: `&VipsImage` -> Input image
20636/// returns `VipsImage` - Output image
20637pub fn lab_q2_lab_s(inp: &VipsImage) -> 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 vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20643        utils::result(
20644            vips_op_response,
20645            VipsImage { ctx: out_out },
20646            Error::LabQ2LabSError,
20647        )
20648    }
20649}
20650
20651/// VipsLabS2LabQ (LabS2LabQ), transform short Lab to LabQ coding
20652/// inp: `&VipsImage` -> Input image
20653/// returns `VipsImage` - Output image
20654pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20655    unsafe {
20656        let inp_in: *mut bindings::VipsImage = inp.ctx;
20657        let mut out_out: *mut bindings::VipsImage = null_mut();
20658
20659        let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20660        utils::result(
20661            vips_op_response,
20662            VipsImage { ctx: out_out },
20663            Error::LabS2LabQError,
20664        )
20665    }
20666}
20667
20668/// VipsLabS2Lab (LabS2Lab), transform signed short Lab to float
20669/// inp: `&VipsImage` -> Input image
20670/// returns `VipsImage` - Output image
20671pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20672    unsafe {
20673        let inp_in: *mut bindings::VipsImage = inp.ctx;
20674        let mut out_out: *mut bindings::VipsImage = null_mut();
20675
20676        let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20677        utils::result(
20678            vips_op_response,
20679            VipsImage { ctx: out_out },
20680            Error::LabS2LabError,
20681        )
20682    }
20683}
20684
20685/// VipsLab2LabS (Lab2LabS), transform float Lab to signed short
20686/// inp: `&VipsImage` -> Input image
20687/// returns `VipsImage` - Output image
20688pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20689    unsafe {
20690        let inp_in: *mut bindings::VipsImage = inp.ctx;
20691        let mut out_out: *mut bindings::VipsImage = null_mut();
20692
20693        let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20694        utils::result(
20695            vips_op_response,
20696            VipsImage { ctx: out_out },
20697            Error::Lab2LabSError,
20698        )
20699    }
20700}
20701
20702/// VipsRad2float (rad2float), unpack Radiance coding to float RGB
20703/// inp: `&VipsImage` -> Input image
20704/// returns `VipsImage` - Output image
20705pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20706    unsafe {
20707        let inp_in: *mut bindings::VipsImage = inp.ctx;
20708        let mut out_out: *mut bindings::VipsImage = null_mut();
20709
20710        let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20711        utils::result(
20712            vips_op_response,
20713            VipsImage { ctx: out_out },
20714            Error::Rad2FloatError,
20715        )
20716    }
20717}
20718
20719/// VipsFloat2rad (float2rad), transform float RGB to Radiance coding
20720/// inp: `&VipsImage` -> Input image
20721/// returns `VipsImage` - Output image
20722pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20723    unsafe {
20724        let inp_in: *mut bindings::VipsImage = inp.ctx;
20725        let mut out_out: *mut bindings::VipsImage = null_mut();
20726
20727        let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20728        utils::result(
20729            vips_op_response,
20730            VipsImage { ctx: out_out },
20731            Error::Float2RadError,
20732        )
20733    }
20734}
20735
20736/// VipsLabQ2sRGB (LabQ2sRGB), convert a LabQ image to sRGB
20737/// inp: `&VipsImage` -> Input image
20738/// returns `VipsImage` - Output image
20739pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20740    unsafe {
20741        let inp_in: *mut bindings::VipsImage = inp.ctx;
20742        let mut out_out: *mut bindings::VipsImage = null_mut();
20743
20744        let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20745        utils::result(
20746            vips_op_response,
20747            VipsImage { ctx: out_out },
20748            Error::LabQ2SRgbError,
20749        )
20750    }
20751}
20752
20753/// VipssRGB2scRGB (sRGB2scRGB), convert an sRGB image to scRGB
20754/// inp: `&VipsImage` -> Input image
20755/// returns `VipsImage` - Output image
20756pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20757    unsafe {
20758        let inp_in: *mut bindings::VipsImage = inp.ctx;
20759        let mut out_out: *mut bindings::VipsImage = null_mut();
20760
20761        let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20762        utils::result(
20763            vips_op_response,
20764            VipsImage { ctx: out_out },
20765            Error::SRgb2ScRgbError,
20766        )
20767    }
20768}
20769
20770/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20771/// inp: `&VipsImage` -> Input image
20772/// returns `VipsImage` - Output image
20773pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
20774    unsafe {
20775        let inp_in: *mut bindings::VipsImage = inp.ctx;
20776        let mut out_out: *mut bindings::VipsImage = null_mut();
20777
20778        let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
20779        utils::result(
20780            vips_op_response,
20781            VipsImage { ctx: out_out },
20782            Error::ScRgb2BwError,
20783        )
20784    }
20785}
20786
20787/// Options for sc_rgb2bw operation
20788#[derive(Clone, Debug)]
20789pub struct ScRgb2BwOptions {
20790    /// depth: `i32` -> Output device space depth in bits
20791    /// min: 8, max: 16, default: 8
20792    pub depth: i32,
20793}
20794
20795impl std::default::Default for ScRgb2BwOptions {
20796    fn default() -> Self {
20797        ScRgb2BwOptions {
20798            depth: i32::from(8),
20799        }
20800    }
20801}
20802
20803/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
20804/// inp: `&VipsImage` -> Input image
20805/// sc_rgb2bw_options: `&ScRgb2BwOptions` -> optional arguments
20806/// returns `VipsImage` - Output image
20807pub fn sc_rgb2bw_with_opts(
20808    inp: &VipsImage,
20809    sc_rgb_2bw_options: &ScRgb2BwOptions,
20810) -> Result<VipsImage> {
20811    unsafe {
20812        let inp_in: *mut bindings::VipsImage = inp.ctx;
20813        let mut out_out: *mut bindings::VipsImage = null_mut();
20814
20815        let depth_in: i32 = sc_rgb_2bw_options.depth;
20816        let depth_in_name = utils::new_c_string("depth")?;
20817
20818        let vips_op_response =
20819            bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20820        utils::result(
20821            vips_op_response,
20822            VipsImage { ctx: out_out },
20823            Error::ScRgb2BwError,
20824        )
20825    }
20826}
20827
20828/// VipssRGB2HSV (sRGB2HSV), transform sRGB to HSV
20829/// inp: `&VipsImage` -> Input image
20830/// returns `VipsImage` - Output image
20831pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20832    unsafe {
20833        let inp_in: *mut bindings::VipsImage = inp.ctx;
20834        let mut out_out: *mut bindings::VipsImage = null_mut();
20835
20836        let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20837        utils::result(
20838            vips_op_response,
20839            VipsImage { ctx: out_out },
20840            Error::SRgb2HsvError,
20841        )
20842    }
20843}
20844
20845/// VipsHSV2sRGB (HSV2sRGB), transform HSV to sRGB
20846/// inp: `&VipsImage` -> Input image
20847/// returns `VipsImage` - Output image
20848pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20849    unsafe {
20850        let inp_in: *mut bindings::VipsImage = inp.ctx;
20851        let mut out_out: *mut bindings::VipsImage = null_mut();
20852
20853        let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20854        utils::result(
20855            vips_op_response,
20856            VipsImage { ctx: out_out },
20857            Error::Hsv2SRgbError,
20858        )
20859    }
20860}
20861
20862/// VipsscRGB2sRGB (scRGB2sRGB), convert scRGB to sRGB
20863/// inp: `&VipsImage` -> Input image
20864/// returns `VipsImage` - Output image
20865pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20866    unsafe {
20867        let inp_in: *mut bindings::VipsImage = inp.ctx;
20868        let mut out_out: *mut bindings::VipsImage = null_mut();
20869
20870        let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
20871        utils::result(
20872            vips_op_response,
20873            VipsImage { ctx: out_out },
20874            Error::ScRgb2SRgbError,
20875        )
20876    }
20877}
20878
20879/// Options for sc_rgb_2s_rgb operation
20880#[derive(Clone, Debug)]
20881pub struct ScRgb2SRgbOptions {
20882    /// depth: `i32` -> Output device space depth in bits
20883    /// min: 8, max: 16, default: 8
20884    pub depth: i32,
20885}
20886
20887impl std::default::Default for ScRgb2SRgbOptions {
20888    fn default() -> Self {
20889        ScRgb2SRgbOptions {
20890            depth: i32::from(8),
20891        }
20892    }
20893}
20894
20895/// VipsscRGB2sRGB (scRGB2sRGB), convert scRGB to sRGB
20896/// inp: `&VipsImage` -> Input image
20897/// sc_rgb_2s_rgb_options: `&ScRgb2SRgbOptions` -> optional arguments
20898/// returns `VipsImage` - Output image
20899pub fn sc_rgb_2s_rgb_with_opts(
20900    inp: &VipsImage,
20901    sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
20902) -> Result<VipsImage> {
20903    unsafe {
20904        let inp_in: *mut bindings::VipsImage = inp.ctx;
20905        let mut out_out: *mut bindings::VipsImage = null_mut();
20906
20907        let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
20908        let depth_in_name = utils::new_c_string("depth")?;
20909
20910        let vips_op_response =
20911            bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20912        utils::result(
20913            vips_op_response,
20914            VipsImage { ctx: out_out },
20915            Error::ScRgb2SRgbError,
20916        )
20917    }
20918}
20919
20920/// VipsIccImport (icc_import), import from device with ICC profile
20921/// inp: `&VipsImage` -> Input image
20922/// returns `VipsImage` - Output image
20923pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20924    unsafe {
20925        let inp_in: *mut bindings::VipsImage = inp.ctx;
20926        let mut out_out: *mut bindings::VipsImage = null_mut();
20927
20928        let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20929        utils::result(
20930            vips_op_response,
20931            VipsImage { ctx: out_out },
20932            Error::IccImportError,
20933        )
20934    }
20935}
20936
20937/// Options for icc_import operation
20938#[derive(Clone, Debug)]
20939pub struct IccImportOptions {
20940    /// pcs: `PCS` -> Set Profile Connection Space
20941    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
20942    ///  `Xyz` -> VIPS_PCS_XYZ = 1
20943    pub pcs: PCS,
20944    /// intent: `Intent` -> Rendering intent
20945    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
20946    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
20947    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
20948    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
20949    ///  `Auto` -> VIPS_INTENT_AUTO = 32
20950    pub intent: Intent,
20951    /// black_point_compensation: `bool` -> Enable black point compensation
20952    /// default: false
20953    pub black_point_compensation: bool,
20954    /// embedded: `bool` -> Use embedded input profile, if available
20955    /// default: false
20956    pub embedded: bool,
20957    /// input_profile: `String` -> Filename to load input profile from
20958    pub input_profile: String,
20959}
20960
20961impl std::default::Default for IccImportOptions {
20962    fn default() -> Self {
20963        IccImportOptions {
20964            pcs: PCS::Lab,
20965            intent: Intent::Relative,
20966            black_point_compensation: false,
20967            embedded: false,
20968            input_profile: String::new(),
20969        }
20970    }
20971}
20972
20973/// VipsIccImport (icc_import), import from device with ICC profile
20974/// inp: `&VipsImage` -> Input image
20975/// icc_import_options: `&IccImportOptions` -> optional arguments
20976/// returns `VipsImage` - Output image
20977pub fn icc_import_with_opts(
20978    inp: &VipsImage,
20979    icc_import_options: &IccImportOptions,
20980) -> Result<VipsImage> {
20981    unsafe {
20982        let inp_in: *mut bindings::VipsImage = inp.ctx;
20983        let mut out_out: *mut bindings::VipsImage = null_mut();
20984
20985        let pcs_in: i32 = icc_import_options.pcs as i32;
20986        let pcs_in_name = utils::new_c_string("pcs")?;
20987
20988        let intent_in: i32 = icc_import_options.intent as i32;
20989        let intent_in_name = utils::new_c_string("intent")?;
20990
20991        let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
20992            1
20993        } else {
20994            0
20995        };
20996        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20997
20998        let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
20999        let embedded_in_name = utils::new_c_string("embedded")?;
21000
21001        let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
21002        let input_profile_in_name = utils::new_c_string("input-profile")?;
21003
21004        let vips_op_response = bindings::vips_icc_import(
21005            inp_in,
21006            &mut out_out,
21007            pcs_in_name.as_ptr(),
21008            pcs_in,
21009            intent_in_name.as_ptr(),
21010            intent_in,
21011            black_point_compensation_in_name.as_ptr(),
21012            black_point_compensation_in,
21013            embedded_in_name.as_ptr(),
21014            embedded_in,
21015            input_profile_in_name.as_ptr(),
21016            input_profile_in.as_ptr(),
21017            NULL,
21018        );
21019        utils::result(
21020            vips_op_response,
21021            VipsImage { ctx: out_out },
21022            Error::IccImportError,
21023        )
21024    }
21025}
21026
21027/// VipsIccExport (icc_export), output to device with ICC profile
21028/// inp: `&VipsImage` -> Input image
21029/// returns `VipsImage` - Output image
21030pub fn icc_export(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_icc_export(inp_in, &mut out_out, NULL);
21036        utils::result(
21037            vips_op_response,
21038            VipsImage { ctx: out_out },
21039            Error::IccExportError,
21040        )
21041    }
21042}
21043
21044/// Options for icc_export operation
21045#[derive(Clone, Debug)]
21046pub struct IccExportOptions {
21047    /// pcs: `PCS` -> Set Profile Connection Space
21048    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
21049    ///  `Xyz` -> VIPS_PCS_XYZ = 1
21050    pub pcs: PCS,
21051    /// intent: `Intent` -> Rendering intent
21052    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
21053    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
21054    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
21055    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
21056    ///  `Auto` -> VIPS_INTENT_AUTO = 32
21057    pub intent: Intent,
21058    /// black_point_compensation: `bool` -> Enable black point compensation
21059    /// default: false
21060    pub black_point_compensation: bool,
21061    /// output_profile: `String` -> Filename to load output profile from
21062    pub output_profile: String,
21063    /// depth: `i32` -> Output device space depth in bits
21064    /// min: 8, max: 16, default: 8
21065    pub depth: i32,
21066}
21067
21068impl std::default::Default for IccExportOptions {
21069    fn default() -> Self {
21070        IccExportOptions {
21071            pcs: PCS::Lab,
21072            intent: Intent::Relative,
21073            black_point_compensation: false,
21074            output_profile: String::new(),
21075            depth: i32::from(8),
21076        }
21077    }
21078}
21079
21080/// VipsIccExport (icc_export), output to device with ICC profile
21081/// inp: `&VipsImage` -> Input image
21082/// icc_export_options: `&IccExportOptions` -> optional arguments
21083/// returns `VipsImage` - Output image
21084pub fn icc_export_with_opts(
21085    inp: &VipsImage,
21086    icc_export_options: &IccExportOptions,
21087) -> Result<VipsImage> {
21088    unsafe {
21089        let inp_in: *mut bindings::VipsImage = inp.ctx;
21090        let mut out_out: *mut bindings::VipsImage = null_mut();
21091
21092        let pcs_in: i32 = icc_export_options.pcs as i32;
21093        let pcs_in_name = utils::new_c_string("pcs")?;
21094
21095        let intent_in: i32 = icc_export_options.intent as i32;
21096        let intent_in_name = utils::new_c_string("intent")?;
21097
21098        let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
21099            1
21100        } else {
21101            0
21102        };
21103        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21104
21105        let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
21106        let output_profile_in_name = utils::new_c_string("output-profile")?;
21107
21108        let depth_in: i32 = icc_export_options.depth;
21109        let depth_in_name = utils::new_c_string("depth")?;
21110
21111        let vips_op_response = bindings::vips_icc_export(
21112            inp_in,
21113            &mut out_out,
21114            pcs_in_name.as_ptr(),
21115            pcs_in,
21116            intent_in_name.as_ptr(),
21117            intent_in,
21118            black_point_compensation_in_name.as_ptr(),
21119            black_point_compensation_in,
21120            output_profile_in_name.as_ptr(),
21121            output_profile_in.as_ptr(),
21122            depth_in_name.as_ptr(),
21123            depth_in,
21124            NULL,
21125        );
21126        utils::result(
21127            vips_op_response,
21128            VipsImage { ctx: out_out },
21129            Error::IccExportError,
21130        )
21131    }
21132}
21133
21134/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
21135/// inp: `&VipsImage` -> Input image
21136/// output_profile: `&str` -> Filename to load output profile from
21137/// returns `VipsImage` - Output image
21138pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
21139    unsafe {
21140        let inp_in: *mut bindings::VipsImage = inp.ctx;
21141        let output_profile_in: CString = utils::new_c_string(output_profile)?;
21142        let mut out_out: *mut bindings::VipsImage = null_mut();
21143
21144        let vips_op_response =
21145            bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
21146        utils::result(
21147            vips_op_response,
21148            VipsImage { ctx: out_out },
21149            Error::IccTransformError,
21150        )
21151    }
21152}
21153
21154/// Options for icc_transform operation
21155#[derive(Clone, Debug)]
21156pub struct IccTransformOptions {
21157    /// pcs: `PCS` -> Set Profile Connection Space
21158    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
21159    ///  `Xyz` -> VIPS_PCS_XYZ = 1
21160    pub pcs: PCS,
21161    /// intent: `Intent` -> Rendering intent
21162    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
21163    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
21164    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
21165    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
21166    ///  `Auto` -> VIPS_INTENT_AUTO = 32
21167    pub intent: Intent,
21168    /// black_point_compensation: `bool` -> Enable black point compensation
21169    /// default: false
21170    pub black_point_compensation: bool,
21171    /// embedded: `bool` -> Use embedded input profile, if available
21172    /// default: false
21173    pub embedded: bool,
21174    /// input_profile: `String` -> Filename to load input profile from
21175    pub input_profile: String,
21176    /// depth: `i32` -> Output device space depth in bits
21177    /// min: 8, max: 16, default: 8
21178    pub depth: i32,
21179}
21180
21181impl std::default::Default for IccTransformOptions {
21182    fn default() -> Self {
21183        IccTransformOptions {
21184            pcs: PCS::Lab,
21185            intent: Intent::Relative,
21186            black_point_compensation: false,
21187            embedded: false,
21188            input_profile: String::new(),
21189            depth: i32::from(8),
21190        }
21191    }
21192}
21193
21194/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
21195/// inp: `&VipsImage` -> Input image
21196/// output_profile: `&str` -> Filename to load output profile from
21197/// icc_transform_options: `&IccTransformOptions` -> optional arguments
21198/// returns `VipsImage` - Output image
21199pub fn icc_transform_with_opts(
21200    inp: &VipsImage,
21201    output_profile: &str,
21202    icc_transform_options: &IccTransformOptions,
21203) -> Result<VipsImage> {
21204    unsafe {
21205        let inp_in: *mut bindings::VipsImage = inp.ctx;
21206        let output_profile_in: CString = utils::new_c_string(output_profile)?;
21207        let mut out_out: *mut bindings::VipsImage = null_mut();
21208
21209        let pcs_in: i32 = icc_transform_options.pcs as i32;
21210        let pcs_in_name = utils::new_c_string("pcs")?;
21211
21212        let intent_in: i32 = icc_transform_options.intent as i32;
21213        let intent_in_name = utils::new_c_string("intent")?;
21214
21215        let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
21216            1
21217        } else {
21218            0
21219        };
21220        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21221
21222        let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
21223        let embedded_in_name = utils::new_c_string("embedded")?;
21224
21225        let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
21226        let input_profile_in_name = utils::new_c_string("input-profile")?;
21227
21228        let depth_in: i32 = icc_transform_options.depth;
21229        let depth_in_name = utils::new_c_string("depth")?;
21230
21231        let vips_op_response = bindings::vips_icc_transform(
21232            inp_in,
21233            &mut out_out,
21234            output_profile_in.as_ptr(),
21235            pcs_in_name.as_ptr(),
21236            pcs_in,
21237            intent_in_name.as_ptr(),
21238            intent_in,
21239            black_point_compensation_in_name.as_ptr(),
21240            black_point_compensation_in,
21241            embedded_in_name.as_ptr(),
21242            embedded_in,
21243            input_profile_in_name.as_ptr(),
21244            input_profile_in.as_ptr(),
21245            depth_in_name.as_ptr(),
21246            depth_in,
21247            NULL,
21248        );
21249        utils::result(
21250            vips_op_response,
21251            VipsImage { ctx: out_out },
21252            Error::IccTransformError,
21253        )
21254    }
21255}
21256
21257/// VipsUhdr2scRGB (uhdr2scRGB), transform uhdr to scRGB
21258/// inp: `&VipsImage` -> Input image
21259/// returns `VipsImage` - Output image
21260pub fn uhdr_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
21261    unsafe {
21262        let inp_in: *mut bindings::VipsImage = inp.ctx;
21263        let mut out_out: *mut bindings::VipsImage = null_mut();
21264
21265        let vips_op_response = bindings::vips_uhdr2scRGB(inp_in, &mut out_out, NULL);
21266        utils::result(
21267            vips_op_response,
21268            VipsImage { ctx: out_out },
21269            Error::Uhdr2ScRgbError,
21270        )
21271    }
21272}
21273
21274/// VipsdE76 (dE76), calculate dE76
21275/// left: `&VipsImage` -> Left-hand input image
21276/// right: `&VipsImage` -> Right-hand input image
21277/// returns `VipsImage` - Output image
21278pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21279    unsafe {
21280        let left_in: *mut bindings::VipsImage = left.ctx;
21281        let right_in: *mut bindings::VipsImage = right.ctx;
21282        let mut out_out: *mut bindings::VipsImage = null_mut();
21283
21284        let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
21285        utils::result(
21286            vips_op_response,
21287            VipsImage { ctx: out_out },
21288            Error::DE76Error,
21289        )
21290    }
21291}
21292
21293/// VipsdE00 (dE00), calculate dE00
21294/// left: `&VipsImage` -> Left-hand input image
21295/// right: `&VipsImage` -> Right-hand input image
21296/// returns `VipsImage` - Output image
21297pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21298    unsafe {
21299        let left_in: *mut bindings::VipsImage = left.ctx;
21300        let right_in: *mut bindings::VipsImage = right.ctx;
21301        let mut out_out: *mut bindings::VipsImage = null_mut();
21302
21303        let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
21304        utils::result(
21305            vips_op_response,
21306            VipsImage { ctx: out_out },
21307            Error::DE00Error,
21308        )
21309    }
21310}
21311
21312/// VipsdECMC (dECMC), calculate dECMC
21313/// left: `&VipsImage` -> Left-hand input image
21314/// right: `&VipsImage` -> Right-hand input image
21315/// returns `VipsImage` - Output image
21316pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21317    unsafe {
21318        let left_in: *mut bindings::VipsImage = left.ctx;
21319        let right_in: *mut bindings::VipsImage = right.ctx;
21320        let mut out_out: *mut bindings::VipsImage = null_mut();
21321
21322        let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
21323        utils::result(
21324            vips_op_response,
21325            VipsImage { ctx: out_out },
21326            Error::DEcmcError,
21327        )
21328    }
21329}
21330
21331/// VipsCMYK2XYZ (CMYK2XYZ), transform CMYK to XYZ
21332/// inp: `&VipsImage` -> Input image
21333/// returns `VipsImage` - Output image
21334pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
21335    unsafe {
21336        let inp_in: *mut bindings::VipsImage = inp.ctx;
21337        let mut out_out: *mut bindings::VipsImage = null_mut();
21338
21339        let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
21340        utils::result(
21341            vips_op_response,
21342            VipsImage { ctx: out_out },
21343            Error::Cmyk2XyzError,
21344        )
21345    }
21346}
21347
21348/// VipsXYZ2CMYK (XYZ2CMYK), transform XYZ to CMYK
21349/// inp: `&VipsImage` -> Input image
21350/// returns `VipsImage` - Output image
21351pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
21352    unsafe {
21353        let inp_in: *mut bindings::VipsImage = inp.ctx;
21354        let mut out_out: *mut bindings::VipsImage = null_mut();
21355
21356        let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
21357        utils::result(
21358            vips_op_response,
21359            VipsImage { ctx: out_out },
21360            Error::Xyz2CmykError,
21361        )
21362    }
21363}
21364
21365/// VipsProfileLoad (profile_load), load named ICC profile
21366/// name: `&str` -> Profile name
21367/// returns `Vec<u8>` - Loaded profile
21368pub fn profile_load(name: &str) -> Result<Vec<u8>> {
21369    unsafe {
21370        let name_in: CString = utils::new_c_string(name)?;
21371        let mut profile_out: *mut bindings::VipsBlob = null_mut();
21372
21373        let vips_op_response =
21374            bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
21375        utils::result(
21376            vips_op_response,
21377            VipsBlob { ctx: profile_out }.into(),
21378            Error::ProfileLoadError,
21379        )
21380    }
21381}
21382
21383/// VipsMaplut (maplut), map an image though a lut
21384/// inp: `&VipsImage` -> Input image
21385/// lut: `&VipsImage` -> Look-up table image
21386/// returns `VipsImage` - Output image
21387pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
21388    unsafe {
21389        let inp_in: *mut bindings::VipsImage = inp.ctx;
21390        let lut_in: *mut bindings::VipsImage = lut.ctx;
21391        let mut out_out: *mut bindings::VipsImage = null_mut();
21392
21393        let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
21394        utils::result(
21395            vips_op_response,
21396            VipsImage { ctx: out_out },
21397            Error::MaplutError,
21398        )
21399    }
21400}
21401
21402/// Options for maplut operation
21403#[derive(Clone, Debug)]
21404pub struct MaplutOptions {
21405    /// band: `i32` -> Apply one-band lut to this band of in
21406    /// min: -1, max: 10000, default: -1
21407    pub band: i32,
21408}
21409
21410impl std::default::Default for MaplutOptions {
21411    fn default() -> Self {
21412        MaplutOptions {
21413            band: i32::from(-1),
21414        }
21415    }
21416}
21417
21418/// VipsMaplut (maplut), map an image though a lut
21419/// inp: `&VipsImage` -> Input image
21420/// lut: `&VipsImage` -> Look-up table image
21421/// maplut_options: `&MaplutOptions` -> optional arguments
21422/// returns `VipsImage` - Output image
21423pub fn maplut_with_opts(
21424    inp: &VipsImage,
21425    lut: &VipsImage,
21426    maplut_options: &MaplutOptions,
21427) -> Result<VipsImage> {
21428    unsafe {
21429        let inp_in: *mut bindings::VipsImage = inp.ctx;
21430        let lut_in: *mut bindings::VipsImage = lut.ctx;
21431        let mut out_out: *mut bindings::VipsImage = null_mut();
21432
21433        let band_in: i32 = maplut_options.band;
21434        let band_in_name = utils::new_c_string("band")?;
21435
21436        let vips_op_response = bindings::vips_maplut(
21437            inp_in,
21438            &mut out_out,
21439            lut_in,
21440            band_in_name.as_ptr(),
21441            band_in,
21442            NULL,
21443        );
21444        utils::result(
21445            vips_op_response,
21446            VipsImage { ctx: out_out },
21447            Error::MaplutError,
21448        )
21449    }
21450}
21451
21452/// VipsPercent (percent), find threshold for percent of pixels
21453/// inp: `&VipsImage` -> Input image
21454/// percent: `f64` -> Percent of pixels
21455/// min: 0, max: 100, default: 50
21456/// returns `i32` - Threshold above which lie percent of pixels
21457pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
21458    unsafe {
21459        let inp_in: *mut bindings::VipsImage = inp.ctx;
21460        let percent_in: f64 = percent;
21461        let mut threshold_out: i32 = i32::from(0);
21462
21463        let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
21464        utils::result(vips_op_response, threshold_out, Error::PercentError)
21465    }
21466}
21467
21468/// VipsStdif (stdif), statistical difference
21469/// inp: `&VipsImage` -> Input image
21470/// width: `i32` -> Window width in pixels
21471/// min: 1, max: 256, default: 11
21472/// height: `i32` -> Window height in pixels
21473/// min: 1, max: 256, default: 11
21474/// returns `VipsImage` - Output image
21475pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21476    unsafe {
21477        let inp_in: *mut bindings::VipsImage = inp.ctx;
21478        let width_in: i32 = width;
21479        let height_in: i32 = height;
21480        let mut out_out: *mut bindings::VipsImage = null_mut();
21481
21482        let vips_op_response =
21483            bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
21484        utils::result(
21485            vips_op_response,
21486            VipsImage { ctx: out_out },
21487            Error::StdifError,
21488        )
21489    }
21490}
21491
21492/// Options for stdif operation
21493#[derive(Clone, Debug)]
21494pub struct StdifOptions {
21495    /// s_0: `f64` -> New deviation
21496    /// min: -inf, max: inf, default: 50
21497    pub s_0: f64,
21498    /// b: `f64` -> Weight of new deviation
21499    /// min: 0, max: 2, default: 0.5
21500    pub b: f64,
21501    /// m_0: `f64` -> New mean
21502    /// min: -inf, max: inf, default: 128
21503    pub m_0: f64,
21504    /// a: `f64` -> Weight of new mean
21505    /// min: 0, max: 1, default: 0.5
21506    pub a: f64,
21507}
21508
21509impl std::default::Default for StdifOptions {
21510    fn default() -> Self {
21511        StdifOptions {
21512            s_0: f64::from(50),
21513            b: f64::from(0.5),
21514            m_0: f64::from(128),
21515            a: f64::from(0.5),
21516        }
21517    }
21518}
21519
21520/// VipsStdif (stdif), statistical difference
21521/// inp: `&VipsImage` -> Input image
21522/// width: `i32` -> Window width in pixels
21523/// min: 1, max: 256, default: 11
21524/// height: `i32` -> Window height in pixels
21525/// min: 1, max: 256, default: 11
21526/// stdif_options: `&StdifOptions` -> optional arguments
21527/// returns `VipsImage` - Output image
21528pub fn stdif_with_opts(
21529    inp: &VipsImage,
21530    width: i32,
21531    height: i32,
21532    stdif_options: &StdifOptions,
21533) -> Result<VipsImage> {
21534    unsafe {
21535        let inp_in: *mut bindings::VipsImage = inp.ctx;
21536        let width_in: i32 = width;
21537        let height_in: i32 = height;
21538        let mut out_out: *mut bindings::VipsImage = null_mut();
21539
21540        let s_0_in: f64 = stdif_options.s_0;
21541        let s_0_in_name = utils::new_c_string("s0")?;
21542
21543        let b_in: f64 = stdif_options.b;
21544        let b_in_name = utils::new_c_string("b")?;
21545
21546        let m_0_in: f64 = stdif_options.m_0;
21547        let m_0_in_name = utils::new_c_string("m0")?;
21548
21549        let a_in: f64 = stdif_options.a;
21550        let a_in_name = utils::new_c_string("a")?;
21551
21552        let vips_op_response = bindings::vips_stdif(
21553            inp_in,
21554            &mut out_out,
21555            width_in,
21556            height_in,
21557            s_0_in_name.as_ptr(),
21558            s_0_in,
21559            b_in_name.as_ptr(),
21560            b_in,
21561            m_0_in_name.as_ptr(),
21562            m_0_in,
21563            a_in_name.as_ptr(),
21564            a_in,
21565            NULL,
21566        );
21567        utils::result(
21568            vips_op_response,
21569            VipsImage { ctx: out_out },
21570            Error::StdifError,
21571        )
21572    }
21573}
21574
21575/// VipsHistCum (hist_cum), form cumulative histogram
21576/// inp: `&VipsImage` -> Input image
21577/// returns `VipsImage` - Output image
21578pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
21579    unsafe {
21580        let inp_in: *mut bindings::VipsImage = inp.ctx;
21581        let mut out_out: *mut bindings::VipsImage = null_mut();
21582
21583        let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
21584        utils::result(
21585            vips_op_response,
21586            VipsImage { ctx: out_out },
21587            Error::HistCumError,
21588        )
21589    }
21590}
21591
21592/// VipsHistMatch (hist_match), match two histograms
21593/// inp: `&VipsImage` -> Input histogram
21594/// refp: `&VipsImage` -> Reference histogram
21595/// returns `VipsImage` - Output image
21596pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21597    unsafe {
21598        let inp_in: *mut bindings::VipsImage = inp.ctx;
21599        let refp_in: *mut bindings::VipsImage = refp.ctx;
21600        let mut out_out: *mut bindings::VipsImage = null_mut();
21601
21602        let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21603        utils::result(
21604            vips_op_response,
21605            VipsImage { ctx: out_out },
21606            Error::HistMatchError,
21607        )
21608    }
21609}
21610
21611/// VipsHistNorm (hist_norm), normalise histogram
21612/// inp: `&VipsImage` -> Input image
21613/// returns `VipsImage` - Output image
21614pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21615    unsafe {
21616        let inp_in: *mut bindings::VipsImage = inp.ctx;
21617        let mut out_out: *mut bindings::VipsImage = null_mut();
21618
21619        let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21620        utils::result(
21621            vips_op_response,
21622            VipsImage { ctx: out_out },
21623            Error::HistNormError,
21624        )
21625    }
21626}
21627
21628/// VipsHistEqual (hist_equal), histogram equalisation
21629/// inp: `&VipsImage` -> Input image
21630/// returns `VipsImage` - Output image
21631pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21632    unsafe {
21633        let inp_in: *mut bindings::VipsImage = inp.ctx;
21634        let mut out_out: *mut bindings::VipsImage = null_mut();
21635
21636        let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21637        utils::result(
21638            vips_op_response,
21639            VipsImage { ctx: out_out },
21640            Error::HistEqualError,
21641        )
21642    }
21643}
21644
21645/// Options for hist_equal operation
21646#[derive(Clone, Debug)]
21647pub struct HistEqualOptions {
21648    /// band: `i32` -> Equalise with this band
21649    /// min: -1, max: 100000, default: -1
21650    pub band: i32,
21651}
21652
21653impl std::default::Default for HistEqualOptions {
21654    fn default() -> Self {
21655        HistEqualOptions {
21656            band: i32::from(-1),
21657        }
21658    }
21659}
21660
21661/// VipsHistEqual (hist_equal), histogram equalisation
21662/// inp: `&VipsImage` -> Input image
21663/// hist_equal_options: `&HistEqualOptions` -> optional arguments
21664/// returns `VipsImage` - Output image
21665pub fn hist_equal_with_opts(
21666    inp: &VipsImage,
21667    hist_equal_options: &HistEqualOptions,
21668) -> Result<VipsImage> {
21669    unsafe {
21670        let inp_in: *mut bindings::VipsImage = inp.ctx;
21671        let mut out_out: *mut bindings::VipsImage = null_mut();
21672
21673        let band_in: i32 = hist_equal_options.band;
21674        let band_in_name = utils::new_c_string("band")?;
21675
21676        let vips_op_response =
21677            bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21678        utils::result(
21679            vips_op_response,
21680            VipsImage { ctx: out_out },
21681            Error::HistEqualError,
21682        )
21683    }
21684}
21685
21686/// VipsHistPlot (hist_plot), plot histogram
21687/// inp: `&VipsImage` -> Input image
21688/// returns `VipsImage` - Output image
21689pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21690    unsafe {
21691        let inp_in: *mut bindings::VipsImage = inp.ctx;
21692        let mut out_out: *mut bindings::VipsImage = null_mut();
21693
21694        let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21695        utils::result(
21696            vips_op_response,
21697            VipsImage { ctx: out_out },
21698            Error::HistPlotError,
21699        )
21700    }
21701}
21702
21703/// VipsHistLocal (hist_local), local histogram equalisation
21704/// inp: `&VipsImage` -> Input image
21705/// width: `i32` -> Window width in pixels
21706/// min: 1, max: 100000000, default: 1
21707/// height: `i32` -> Window height in pixels
21708/// min: 1, max: 100000000, default: 1
21709/// returns `VipsImage` - Output image
21710pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21711    unsafe {
21712        let inp_in: *mut bindings::VipsImage = inp.ctx;
21713        let width_in: i32 = width;
21714        let height_in: i32 = height;
21715        let mut out_out: *mut bindings::VipsImage = null_mut();
21716
21717        let vips_op_response =
21718            bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21719        utils::result(
21720            vips_op_response,
21721            VipsImage { ctx: out_out },
21722            Error::HistLocalError,
21723        )
21724    }
21725}
21726
21727/// Options for hist_local operation
21728#[derive(Clone, Debug)]
21729pub struct HistLocalOptions {
21730    /// max_slope: `i32` -> Maximum slope (CLAHE)
21731    /// min: 0, max: 100, default: 0
21732    pub max_slope: i32,
21733}
21734
21735impl std::default::Default for HistLocalOptions {
21736    fn default() -> Self {
21737        HistLocalOptions {
21738            max_slope: i32::from(0),
21739        }
21740    }
21741}
21742
21743/// VipsHistLocal (hist_local), local histogram equalisation
21744/// inp: `&VipsImage` -> Input image
21745/// width: `i32` -> Window width in pixels
21746/// min: 1, max: 100000000, default: 1
21747/// height: `i32` -> Window height in pixels
21748/// min: 1, max: 100000000, default: 1
21749/// hist_local_options: `&HistLocalOptions` -> optional arguments
21750/// returns `VipsImage` - Output image
21751pub fn hist_local_with_opts(
21752    inp: &VipsImage,
21753    width: i32,
21754    height: i32,
21755    hist_local_options: &HistLocalOptions,
21756) -> Result<VipsImage> {
21757    unsafe {
21758        let inp_in: *mut bindings::VipsImage = inp.ctx;
21759        let width_in: i32 = width;
21760        let height_in: i32 = height;
21761        let mut out_out: *mut bindings::VipsImage = null_mut();
21762
21763        let max_slope_in: i32 = hist_local_options.max_slope;
21764        let max_slope_in_name = utils::new_c_string("max-slope")?;
21765
21766        let vips_op_response = bindings::vips_hist_local(
21767            inp_in,
21768            &mut out_out,
21769            width_in,
21770            height_in,
21771            max_slope_in_name.as_ptr(),
21772            max_slope_in,
21773            NULL,
21774        );
21775        utils::result(
21776            vips_op_response,
21777            VipsImage { ctx: out_out },
21778            Error::HistLocalError,
21779        )
21780    }
21781}
21782
21783/// VipsHistIsmonotonic (hist_ismonotonic), test for monotonicity
21784/// inp: `&VipsImage` -> Input histogram image
21785/// returns `bool` - true if in is monotonic
21786pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21787    unsafe {
21788        let inp_in: *mut bindings::VipsImage = inp.ctx;
21789        let mut monotonic_out: i32 = 0;
21790
21791        let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21792        utils::result(
21793            vips_op_response,
21794            monotonic_out != 0,
21795            Error::HistIsmonotonicError,
21796        )
21797    }
21798}
21799
21800/// VipsHistEntropy (hist_entropy), estimate image entropy
21801/// inp: `&VipsImage` -> Input histogram image
21802/// returns `f64` - Output value
21803pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21804    unsafe {
21805        let inp_in: *mut bindings::VipsImage = inp.ctx;
21806        let mut out_out: f64 = f64::from(0);
21807
21808        let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21809        utils::result(vips_op_response, out_out, Error::HistEntropyError)
21810    }
21811}
21812
21813/// VipsConv (conv), convolution operation
21814/// inp: `&VipsImage` -> Input image argument
21815/// mask: `&VipsImage` -> Input matrix image
21816/// returns `VipsImage` - Output image
21817pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21818    unsafe {
21819        let inp_in: *mut bindings::VipsImage = inp.ctx;
21820        let mask_in: *mut bindings::VipsImage = mask.ctx;
21821        let mut out_out: *mut bindings::VipsImage = null_mut();
21822
21823        let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21824        utils::result(
21825            vips_op_response,
21826            VipsImage { ctx: out_out },
21827            Error::ConvError,
21828        )
21829    }
21830}
21831
21832/// Options for conv operation
21833#[derive(Clone, Debug)]
21834pub struct ConvOptions {
21835    /// precision: `Precision` -> Convolve with this precision
21836    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
21837    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
21838    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
21839    pub precision: Precision,
21840    /// layers: `i32` -> Use this many layers in approximation
21841    /// min: 1, max: 1000, default: 5
21842    pub layers: i32,
21843    /// cluster: `i32` -> Cluster lines closer than this in approximation
21844    /// min: 1, max: 100, default: 1
21845    pub cluster: i32,
21846}
21847
21848impl std::default::Default for ConvOptions {
21849    fn default() -> Self {
21850        ConvOptions {
21851            precision: Precision::Float,
21852            layers: i32::from(5),
21853            cluster: i32::from(1),
21854        }
21855    }
21856}
21857
21858/// VipsConv (conv), convolution operation
21859/// inp: `&VipsImage` -> Input image argument
21860/// mask: `&VipsImage` -> Input matrix image
21861/// conv_options: `&ConvOptions` -> optional arguments
21862/// returns `VipsImage` - Output image
21863pub fn conv_with_opts(
21864    inp: &VipsImage,
21865    mask: &VipsImage,
21866    conv_options: &ConvOptions,
21867) -> Result<VipsImage> {
21868    unsafe {
21869        let inp_in: *mut bindings::VipsImage = inp.ctx;
21870        let mask_in: *mut bindings::VipsImage = mask.ctx;
21871        let mut out_out: *mut bindings::VipsImage = null_mut();
21872
21873        let precision_in: i32 = conv_options.precision as i32;
21874        let precision_in_name = utils::new_c_string("precision")?;
21875
21876        let layers_in: i32 = conv_options.layers;
21877        let layers_in_name = utils::new_c_string("layers")?;
21878
21879        let cluster_in: i32 = conv_options.cluster;
21880        let cluster_in_name = utils::new_c_string("cluster")?;
21881
21882        let vips_op_response = bindings::vips_conv(
21883            inp_in,
21884            &mut out_out,
21885            mask_in,
21886            precision_in_name.as_ptr(),
21887            precision_in,
21888            layers_in_name.as_ptr(),
21889            layers_in,
21890            cluster_in_name.as_ptr(),
21891            cluster_in,
21892            NULL,
21893        );
21894        utils::result(
21895            vips_op_response,
21896            VipsImage { ctx: out_out },
21897            Error::ConvError,
21898        )
21899    }
21900}
21901
21902/// VipsConva (conva), approximate integer convolution
21903/// inp: `&VipsImage` -> Input image argument
21904/// mask: `&VipsImage` -> Input matrix image
21905/// returns `VipsImage` - Output image
21906pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21907    unsafe {
21908        let inp_in: *mut bindings::VipsImage = inp.ctx;
21909        let mask_in: *mut bindings::VipsImage = mask.ctx;
21910        let mut out_out: *mut bindings::VipsImage = null_mut();
21911
21912        let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21913        utils::result(
21914            vips_op_response,
21915            VipsImage { ctx: out_out },
21916            Error::ConvaError,
21917        )
21918    }
21919}
21920
21921/// Options for conva operation
21922#[derive(Clone, Debug)]
21923pub struct ConvaOptions {
21924    /// layers: `i32` -> Use this many layers in approximation
21925    /// min: 1, max: 1000, default: 5
21926    pub layers: i32,
21927    /// cluster: `i32` -> Cluster lines closer than this in approximation
21928    /// min: 1, max: 100, default: 1
21929    pub cluster: i32,
21930}
21931
21932impl std::default::Default for ConvaOptions {
21933    fn default() -> Self {
21934        ConvaOptions {
21935            layers: i32::from(5),
21936            cluster: i32::from(1),
21937        }
21938    }
21939}
21940
21941/// VipsConva (conva), approximate integer convolution
21942/// inp: `&VipsImage` -> Input image argument
21943/// mask: `&VipsImage` -> Input matrix image
21944/// conva_options: `&ConvaOptions` -> optional arguments
21945/// returns `VipsImage` - Output image
21946pub fn conva_with_opts(
21947    inp: &VipsImage,
21948    mask: &VipsImage,
21949    conva_options: &ConvaOptions,
21950) -> Result<VipsImage> {
21951    unsafe {
21952        let inp_in: *mut bindings::VipsImage = inp.ctx;
21953        let mask_in: *mut bindings::VipsImage = mask.ctx;
21954        let mut out_out: *mut bindings::VipsImage = null_mut();
21955
21956        let layers_in: i32 = conva_options.layers;
21957        let layers_in_name = utils::new_c_string("layers")?;
21958
21959        let cluster_in: i32 = conva_options.cluster;
21960        let cluster_in_name = utils::new_c_string("cluster")?;
21961
21962        let vips_op_response = bindings::vips_conva(
21963            inp_in,
21964            &mut out_out,
21965            mask_in,
21966            layers_in_name.as_ptr(),
21967            layers_in,
21968            cluster_in_name.as_ptr(),
21969            cluster_in,
21970            NULL,
21971        );
21972        utils::result(
21973            vips_op_response,
21974            VipsImage { ctx: out_out },
21975            Error::ConvaError,
21976        )
21977    }
21978}
21979
21980/// VipsConvf (convf), float convolution operation
21981/// inp: `&VipsImage` -> Input image argument
21982/// mask: `&VipsImage` -> Input matrix image
21983/// returns `VipsImage` - Output image
21984pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21985    unsafe {
21986        let inp_in: *mut bindings::VipsImage = inp.ctx;
21987        let mask_in: *mut bindings::VipsImage = mask.ctx;
21988        let mut out_out: *mut bindings::VipsImage = null_mut();
21989
21990        let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
21991        utils::result(
21992            vips_op_response,
21993            VipsImage { ctx: out_out },
21994            Error::ConvfError,
21995        )
21996    }
21997}
21998
21999/// VipsConvi (convi), int convolution operation
22000/// inp: `&VipsImage` -> Input image argument
22001/// mask: `&VipsImage` -> Input matrix image
22002/// returns `VipsImage` - Output image
22003pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22004    unsafe {
22005        let inp_in: *mut bindings::VipsImage = inp.ctx;
22006        let mask_in: *mut bindings::VipsImage = mask.ctx;
22007        let mut out_out: *mut bindings::VipsImage = null_mut();
22008
22009        let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
22010        utils::result(
22011            vips_op_response,
22012            VipsImage { ctx: out_out },
22013            Error::ConviError,
22014        )
22015    }
22016}
22017
22018/// VipsCompass (compass), convolve with rotating mask
22019/// inp: `&VipsImage` -> Input image argument
22020/// mask: `&VipsImage` -> Input matrix image
22021/// returns `VipsImage` - Output image
22022pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22023    unsafe {
22024        let inp_in: *mut bindings::VipsImage = inp.ctx;
22025        let mask_in: *mut bindings::VipsImage = mask.ctx;
22026        let mut out_out: *mut bindings::VipsImage = null_mut();
22027
22028        let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
22029        utils::result(
22030            vips_op_response,
22031            VipsImage { ctx: out_out },
22032            Error::CompassError,
22033        )
22034    }
22035}
22036
22037/// Options for compass operation
22038#[derive(Clone, Debug)]
22039pub struct CompassOptions {
22040    /// times: `i32` -> Rotate and convolve this many times
22041    /// min: 1, max: 1000, default: 2
22042    pub times: i32,
22043    /// angle: `Angle45` -> Rotate mask by this much between convolutions
22044    ///  `D0` -> VIPS_ANGLE45_D0 = 0
22045    ///  `D45` -> VIPS_ANGLE45_D45 = 1
22046    ///  `D90` -> VIPS_ANGLE45_D90 = 2 [DEFAULT]
22047    ///  `D135` -> VIPS_ANGLE45_D135 = 3
22048    ///  `D180` -> VIPS_ANGLE45_D180 = 4
22049    ///  `D225` -> VIPS_ANGLE45_D225 = 5
22050    ///  `D270` -> VIPS_ANGLE45_D270 = 6
22051    ///  `D315` -> VIPS_ANGLE45_D315 = 7
22052    pub angle: Angle45,
22053    /// combine: `Combine` -> Combine convolution results like this
22054    ///  `Max` -> VIPS_COMBINE_MAX = 0 [DEFAULT]
22055    ///  `Sum` -> VIPS_COMBINE_SUM = 1
22056    ///  `Min` -> VIPS_COMBINE_MIN = 2
22057    pub combine: Combine,
22058    /// precision: `Precision` -> Convolve with this precision
22059    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22060    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22061    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22062    pub precision: Precision,
22063    /// layers: `i32` -> Use this many layers in approximation
22064    /// min: 1, max: 1000, default: 5
22065    pub layers: i32,
22066    /// cluster: `i32` -> Cluster lines closer than this in approximation
22067    /// min: 1, max: 100, default: 1
22068    pub cluster: i32,
22069}
22070
22071impl std::default::Default for CompassOptions {
22072    fn default() -> Self {
22073        CompassOptions {
22074            times: i32::from(2),
22075            angle: Angle45::D90,
22076            combine: Combine::Max,
22077            precision: Precision::Float,
22078            layers: i32::from(5),
22079            cluster: i32::from(1),
22080        }
22081    }
22082}
22083
22084/// VipsCompass (compass), convolve with rotating mask
22085/// inp: `&VipsImage` -> Input image argument
22086/// mask: `&VipsImage` -> Input matrix image
22087/// compass_options: `&CompassOptions` -> optional arguments
22088/// returns `VipsImage` - Output image
22089pub fn compass_with_opts(
22090    inp: &VipsImage,
22091    mask: &VipsImage,
22092    compass_options: &CompassOptions,
22093) -> Result<VipsImage> {
22094    unsafe {
22095        let inp_in: *mut bindings::VipsImage = inp.ctx;
22096        let mask_in: *mut bindings::VipsImage = mask.ctx;
22097        let mut out_out: *mut bindings::VipsImage = null_mut();
22098
22099        let times_in: i32 = compass_options.times;
22100        let times_in_name = utils::new_c_string("times")?;
22101
22102        let angle_in: i32 = compass_options.angle as i32;
22103        let angle_in_name = utils::new_c_string("angle")?;
22104
22105        let combine_in: i32 = compass_options.combine as i32;
22106        let combine_in_name = utils::new_c_string("combine")?;
22107
22108        let precision_in: i32 = compass_options.precision as i32;
22109        let precision_in_name = utils::new_c_string("precision")?;
22110
22111        let layers_in: i32 = compass_options.layers;
22112        let layers_in_name = utils::new_c_string("layers")?;
22113
22114        let cluster_in: i32 = compass_options.cluster;
22115        let cluster_in_name = utils::new_c_string("cluster")?;
22116
22117        let vips_op_response = bindings::vips_compass(
22118            inp_in,
22119            &mut out_out,
22120            mask_in,
22121            times_in_name.as_ptr(),
22122            times_in,
22123            angle_in_name.as_ptr(),
22124            angle_in,
22125            combine_in_name.as_ptr(),
22126            combine_in,
22127            precision_in_name.as_ptr(),
22128            precision_in,
22129            layers_in_name.as_ptr(),
22130            layers_in,
22131            cluster_in_name.as_ptr(),
22132            cluster_in,
22133            NULL,
22134        );
22135        utils::result(
22136            vips_op_response,
22137            VipsImage { ctx: out_out },
22138            Error::CompassError,
22139        )
22140    }
22141}
22142
22143/// VipsConvsep (convsep), separable convolution operation
22144/// inp: `&VipsImage` -> Input image argument
22145/// mask: `&VipsImage` -> Input matrix image
22146/// returns `VipsImage` - Output image
22147pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22148    unsafe {
22149        let inp_in: *mut bindings::VipsImage = inp.ctx;
22150        let mask_in: *mut bindings::VipsImage = mask.ctx;
22151        let mut out_out: *mut bindings::VipsImage = null_mut();
22152
22153        let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
22154        utils::result(
22155            vips_op_response,
22156            VipsImage { ctx: out_out },
22157            Error::ConvsepError,
22158        )
22159    }
22160}
22161
22162/// Options for convsep operation
22163#[derive(Clone, Debug)]
22164pub struct ConvsepOptions {
22165    /// precision: `Precision` -> Convolve with this precision
22166    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22167    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22168    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22169    pub precision: Precision,
22170    /// layers: `i32` -> Use this many layers in approximation
22171    /// min: 1, max: 1000, default: 5
22172    pub layers: i32,
22173    /// cluster: `i32` -> Cluster lines closer than this in approximation
22174    /// min: 1, max: 100, default: 1
22175    pub cluster: i32,
22176}
22177
22178impl std::default::Default for ConvsepOptions {
22179    fn default() -> Self {
22180        ConvsepOptions {
22181            precision: Precision::Float,
22182            layers: i32::from(5),
22183            cluster: i32::from(1),
22184        }
22185    }
22186}
22187
22188/// VipsConvsep (convsep), separable convolution operation
22189/// inp: `&VipsImage` -> Input image argument
22190/// mask: `&VipsImage` -> Input matrix image
22191/// convsep_options: `&ConvsepOptions` -> optional arguments
22192/// returns `VipsImage` - Output image
22193pub fn convsep_with_opts(
22194    inp: &VipsImage,
22195    mask: &VipsImage,
22196    convsep_options: &ConvsepOptions,
22197) -> Result<VipsImage> {
22198    unsafe {
22199        let inp_in: *mut bindings::VipsImage = inp.ctx;
22200        let mask_in: *mut bindings::VipsImage = mask.ctx;
22201        let mut out_out: *mut bindings::VipsImage = null_mut();
22202
22203        let precision_in: i32 = convsep_options.precision as i32;
22204        let precision_in_name = utils::new_c_string("precision")?;
22205
22206        let layers_in: i32 = convsep_options.layers;
22207        let layers_in_name = utils::new_c_string("layers")?;
22208
22209        let cluster_in: i32 = convsep_options.cluster;
22210        let cluster_in_name = utils::new_c_string("cluster")?;
22211
22212        let vips_op_response = bindings::vips_convsep(
22213            inp_in,
22214            &mut out_out,
22215            mask_in,
22216            precision_in_name.as_ptr(),
22217            precision_in,
22218            layers_in_name.as_ptr(),
22219            layers_in,
22220            cluster_in_name.as_ptr(),
22221            cluster_in,
22222            NULL,
22223        );
22224        utils::result(
22225            vips_op_response,
22226            VipsImage { ctx: out_out },
22227            Error::ConvsepError,
22228        )
22229    }
22230}
22231
22232/// VipsConvasep (convasep), approximate separable integer convolution
22233/// inp: `&VipsImage` -> Input image argument
22234/// mask: `&VipsImage` -> Input matrix image
22235/// returns `VipsImage` - Output image
22236pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22237    unsafe {
22238        let inp_in: *mut bindings::VipsImage = inp.ctx;
22239        let mask_in: *mut bindings::VipsImage = mask.ctx;
22240        let mut out_out: *mut bindings::VipsImage = null_mut();
22241
22242        let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
22243        utils::result(
22244            vips_op_response,
22245            VipsImage { ctx: out_out },
22246            Error::ConvasepError,
22247        )
22248    }
22249}
22250
22251/// Options for convasep operation
22252#[derive(Clone, Debug)]
22253pub struct ConvasepOptions {
22254    /// layers: `i32` -> Use this many layers in approximation
22255    /// min: 1, max: 1000, default: 5
22256    pub layers: i32,
22257}
22258
22259impl std::default::Default for ConvasepOptions {
22260    fn default() -> Self {
22261        ConvasepOptions {
22262            layers: i32::from(5),
22263        }
22264    }
22265}
22266
22267/// VipsConvasep (convasep), approximate separable integer convolution
22268/// inp: `&VipsImage` -> Input image argument
22269/// mask: `&VipsImage` -> Input matrix image
22270/// convasep_options: `&ConvasepOptions` -> optional arguments
22271/// returns `VipsImage` - Output image
22272pub fn convasep_with_opts(
22273    inp: &VipsImage,
22274    mask: &VipsImage,
22275    convasep_options: &ConvasepOptions,
22276) -> Result<VipsImage> {
22277    unsafe {
22278        let inp_in: *mut bindings::VipsImage = inp.ctx;
22279        let mask_in: *mut bindings::VipsImage = mask.ctx;
22280        let mut out_out: *mut bindings::VipsImage = null_mut();
22281
22282        let layers_in: i32 = convasep_options.layers;
22283        let layers_in_name = utils::new_c_string("layers")?;
22284
22285        let vips_op_response = bindings::vips_convasep(
22286            inp_in,
22287            &mut out_out,
22288            mask_in,
22289            layers_in_name.as_ptr(),
22290            layers_in,
22291            NULL,
22292        );
22293        utils::result(
22294            vips_op_response,
22295            VipsImage { ctx: out_out },
22296            Error::ConvasepError,
22297        )
22298    }
22299}
22300
22301/// VipsFastcor (fastcor), fast correlation
22302/// inp: `&VipsImage` -> Input image argument
22303/// refp: `&VipsImage` -> Input reference image
22304/// returns `VipsImage` - Output image
22305pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22306    unsafe {
22307        let inp_in: *mut bindings::VipsImage = inp.ctx;
22308        let refp_in: *mut bindings::VipsImage = refp.ctx;
22309        let mut out_out: *mut bindings::VipsImage = null_mut();
22310
22311        let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
22312        utils::result(
22313            vips_op_response,
22314            VipsImage { ctx: out_out },
22315            Error::FastcorError,
22316        )
22317    }
22318}
22319
22320/// VipsSpcor (spcor), spatial correlation
22321/// inp: `&VipsImage` -> Input image argument
22322/// refp: `&VipsImage` -> Input reference image
22323/// returns `VipsImage` - Output image
22324pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22325    unsafe {
22326        let inp_in: *mut bindings::VipsImage = inp.ctx;
22327        let refp_in: *mut bindings::VipsImage = refp.ctx;
22328        let mut out_out: *mut bindings::VipsImage = null_mut();
22329
22330        let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
22331        utils::result(
22332            vips_op_response,
22333            VipsImage { ctx: out_out },
22334            Error::SpcorError,
22335        )
22336    }
22337}
22338
22339/// VipsSharpen (sharpen), unsharp masking for print
22340/// inp: `&VipsImage` -> Input image
22341/// returns `VipsImage` - Output image
22342pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
22343    unsafe {
22344        let inp_in: *mut bindings::VipsImage = inp.ctx;
22345        let mut out_out: *mut bindings::VipsImage = null_mut();
22346
22347        let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
22348        utils::result(
22349            vips_op_response,
22350            VipsImage { ctx: out_out },
22351            Error::SharpenError,
22352        )
22353    }
22354}
22355
22356/// Options for sharpen operation
22357#[derive(Clone, Debug)]
22358pub struct SharpenOptions {
22359    /// sigma: `f64` -> Sigma of Gaussian
22360    /// min: 0.000001, max: 10, default: 0.5
22361    pub sigma: f64,
22362    /// x_1: `f64` -> Flat/jaggy threshold
22363    /// min: 0, max: 1000000, default: 2
22364    pub x_1: f64,
22365    /// y_2: `f64` -> Maximum brightening
22366    /// min: 0, max: 1000000, default: 10
22367    pub y_2: f64,
22368    /// y_3: `f64` -> Maximum darkening
22369    /// min: 0, max: 1000000, default: 20
22370    pub y_3: f64,
22371    /// m_1: `f64` -> Slope for flat areas
22372    /// min: 0, max: 1000000, default: 0
22373    pub m_1: f64,
22374    /// m_2: `f64` -> Slope for jaggy areas
22375    /// min: 0, max: 1000000, default: 3
22376    pub m_2: f64,
22377}
22378
22379impl std::default::Default for SharpenOptions {
22380    fn default() -> Self {
22381        SharpenOptions {
22382            sigma: f64::from(0.5),
22383            x_1: f64::from(2),
22384            y_2: f64::from(10),
22385            y_3: f64::from(20),
22386            m_1: f64::from(0),
22387            m_2: f64::from(3),
22388        }
22389    }
22390}
22391
22392/// VipsSharpen (sharpen), unsharp masking for print
22393/// inp: `&VipsImage` -> Input image
22394/// sharpen_options: `&SharpenOptions` -> optional arguments
22395/// returns `VipsImage` - Output image
22396pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
22397    unsafe {
22398        let inp_in: *mut bindings::VipsImage = inp.ctx;
22399        let mut out_out: *mut bindings::VipsImage = null_mut();
22400
22401        let sigma_in: f64 = sharpen_options.sigma;
22402        let sigma_in_name = utils::new_c_string("sigma")?;
22403
22404        let x_1_in: f64 = sharpen_options.x_1;
22405        let x_1_in_name = utils::new_c_string("x1")?;
22406
22407        let y_2_in: f64 = sharpen_options.y_2;
22408        let y_2_in_name = utils::new_c_string("y2")?;
22409
22410        let y_3_in: f64 = sharpen_options.y_3;
22411        let y_3_in_name = utils::new_c_string("y3")?;
22412
22413        let m_1_in: f64 = sharpen_options.m_1;
22414        let m_1_in_name = utils::new_c_string("m1")?;
22415
22416        let m_2_in: f64 = sharpen_options.m_2;
22417        let m_2_in_name = utils::new_c_string("m2")?;
22418
22419        let vips_op_response = bindings::vips_sharpen(
22420            inp_in,
22421            &mut out_out,
22422            sigma_in_name.as_ptr(),
22423            sigma_in,
22424            x_1_in_name.as_ptr(),
22425            x_1_in,
22426            y_2_in_name.as_ptr(),
22427            y_2_in,
22428            y_3_in_name.as_ptr(),
22429            y_3_in,
22430            m_1_in_name.as_ptr(),
22431            m_1_in,
22432            m_2_in_name.as_ptr(),
22433            m_2_in,
22434            NULL,
22435        );
22436        utils::result(
22437            vips_op_response,
22438            VipsImage { ctx: out_out },
22439            Error::SharpenError,
22440        )
22441    }
22442}
22443
22444/// VipsGaussblur (gaussblur), gaussian blur
22445/// inp: `&VipsImage` -> Input image
22446/// sigma: `f64` -> Sigma of Gaussian
22447/// min: 0, max: 1000, default: 1.5
22448/// returns `VipsImage` - Output image
22449pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
22450    unsafe {
22451        let inp_in: *mut bindings::VipsImage = inp.ctx;
22452        let sigma_in: f64 = sigma;
22453        let mut out_out: *mut bindings::VipsImage = null_mut();
22454
22455        let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
22456        utils::result(
22457            vips_op_response,
22458            VipsImage { ctx: out_out },
22459            Error::GaussblurError,
22460        )
22461    }
22462}
22463
22464/// Options for gaussblur operation
22465#[derive(Clone, Debug)]
22466pub struct GaussblurOptions {
22467    /// min_ampl: `f64` -> Minimum amplitude of Gaussian
22468    /// min: 0.001, max: 1, default: 0.2
22469    pub min_ampl: f64,
22470    /// precision: `Precision` -> Convolve with this precision
22471    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
22472    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
22473    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22474    pub precision: Precision,
22475}
22476
22477impl std::default::Default for GaussblurOptions {
22478    fn default() -> Self {
22479        GaussblurOptions {
22480            min_ampl: f64::from(0.2),
22481            precision: Precision::Integer,
22482        }
22483    }
22484}
22485
22486/// VipsGaussblur (gaussblur), gaussian blur
22487/// inp: `&VipsImage` -> Input image
22488/// sigma: `f64` -> Sigma of Gaussian
22489/// min: 0, max: 1000, default: 1.5
22490/// gaussblur_options: `&GaussblurOptions` -> optional arguments
22491/// returns `VipsImage` - Output image
22492pub fn gaussblur_with_opts(
22493    inp: &VipsImage,
22494    sigma: f64,
22495    gaussblur_options: &GaussblurOptions,
22496) -> Result<VipsImage> {
22497    unsafe {
22498        let inp_in: *mut bindings::VipsImage = inp.ctx;
22499        let sigma_in: f64 = sigma;
22500        let mut out_out: *mut bindings::VipsImage = null_mut();
22501
22502        let min_ampl_in: f64 = gaussblur_options.min_ampl;
22503        let min_ampl_in_name = utils::new_c_string("min-ampl")?;
22504
22505        let precision_in: i32 = gaussblur_options.precision as i32;
22506        let precision_in_name = utils::new_c_string("precision")?;
22507
22508        let vips_op_response = bindings::vips_gaussblur(
22509            inp_in,
22510            &mut out_out,
22511            sigma_in,
22512            min_ampl_in_name.as_ptr(),
22513            min_ampl_in,
22514            precision_in_name.as_ptr(),
22515            precision_in,
22516            NULL,
22517        );
22518        utils::result(
22519            vips_op_response,
22520            VipsImage { ctx: out_out },
22521            Error::GaussblurError,
22522        )
22523    }
22524}
22525
22526/// VipsSobel (sobel), Sobel edge detector
22527/// inp: `&VipsImage` -> Input image
22528/// returns `VipsImage` - Output image
22529pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
22530    unsafe {
22531        let inp_in: *mut bindings::VipsImage = inp.ctx;
22532        let mut out_out: *mut bindings::VipsImage = null_mut();
22533
22534        let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
22535        utils::result(
22536            vips_op_response,
22537            VipsImage { ctx: out_out },
22538            Error::SobelError,
22539        )
22540    }
22541}
22542
22543/// VipsScharr (scharr), Scharr edge detector
22544/// inp: `&VipsImage` -> Input image
22545/// returns `VipsImage` - Output image
22546pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
22547    unsafe {
22548        let inp_in: *mut bindings::VipsImage = inp.ctx;
22549        let mut out_out: *mut bindings::VipsImage = null_mut();
22550
22551        let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
22552        utils::result(
22553            vips_op_response,
22554            VipsImage { ctx: out_out },
22555            Error::ScharrError,
22556        )
22557    }
22558}
22559
22560/// VipsPrewitt (prewitt), Prewitt edge detector
22561/// inp: `&VipsImage` -> Input image
22562/// returns `VipsImage` - Output image
22563pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
22564    unsafe {
22565        let inp_in: *mut bindings::VipsImage = inp.ctx;
22566        let mut out_out: *mut bindings::VipsImage = null_mut();
22567
22568        let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
22569        utils::result(
22570            vips_op_response,
22571            VipsImage { ctx: out_out },
22572            Error::PrewittError,
22573        )
22574    }
22575}
22576
22577/// VipsCanny (canny), Canny edge detector
22578/// inp: `&VipsImage` -> Input image
22579/// returns `VipsImage` - Output image
22580pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
22581    unsafe {
22582        let inp_in: *mut bindings::VipsImage = inp.ctx;
22583        let mut out_out: *mut bindings::VipsImage = null_mut();
22584
22585        let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
22586        utils::result(
22587            vips_op_response,
22588            VipsImage { ctx: out_out },
22589            Error::CannyError,
22590        )
22591    }
22592}
22593
22594/// Options for canny operation
22595#[derive(Clone, Debug)]
22596pub struct CannyOptions {
22597    /// sigma: `f64` -> Sigma of Gaussian
22598    /// min: 0.01, max: 1000, default: 1.4
22599    pub sigma: f64,
22600    /// precision: `Precision` -> Convolve with this precision
22601    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
22602    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
22603    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
22604    pub precision: Precision,
22605}
22606
22607impl std::default::Default for CannyOptions {
22608    fn default() -> Self {
22609        CannyOptions {
22610            sigma: f64::from(1.4),
22611            precision: Precision::Float,
22612        }
22613    }
22614}
22615
22616/// VipsCanny (canny), Canny edge detector
22617/// inp: `&VipsImage` -> Input image
22618/// canny_options: `&CannyOptions` -> optional arguments
22619/// returns `VipsImage` - Output image
22620pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22621    unsafe {
22622        let inp_in: *mut bindings::VipsImage = inp.ctx;
22623        let mut out_out: *mut bindings::VipsImage = null_mut();
22624
22625        let sigma_in: f64 = canny_options.sigma;
22626        let sigma_in_name = utils::new_c_string("sigma")?;
22627
22628        let precision_in: i32 = canny_options.precision as i32;
22629        let precision_in_name = utils::new_c_string("precision")?;
22630
22631        let vips_op_response = bindings::vips_canny(
22632            inp_in,
22633            &mut out_out,
22634            sigma_in_name.as_ptr(),
22635            sigma_in,
22636            precision_in_name.as_ptr(),
22637            precision_in,
22638            NULL,
22639        );
22640        utils::result(
22641            vips_op_response,
22642            VipsImage { ctx: out_out },
22643            Error::CannyError,
22644        )
22645    }
22646}
22647
22648/// VipsFwfft (fwfft), forward FFT
22649/// inp: `&VipsImage` -> Input image
22650/// returns `VipsImage` - Output image
22651pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22652    unsafe {
22653        let inp_in: *mut bindings::VipsImage = inp.ctx;
22654        let mut out_out: *mut bindings::VipsImage = null_mut();
22655
22656        let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22657        utils::result(
22658            vips_op_response,
22659            VipsImage { ctx: out_out },
22660            Error::FwfftError,
22661        )
22662    }
22663}
22664
22665/// VipsInvfft (invfft), inverse FFT
22666/// inp: `&VipsImage` -> Input image
22667/// returns `VipsImage` - Output image
22668pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
22669    unsafe {
22670        let inp_in: *mut bindings::VipsImage = inp.ctx;
22671        let mut out_out: *mut bindings::VipsImage = null_mut();
22672
22673        let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
22674        utils::result(
22675            vips_op_response,
22676            VipsImage { ctx: out_out },
22677            Error::InvfftError,
22678        )
22679    }
22680}
22681
22682/// Options for invfft operation
22683#[derive(Clone, Debug)]
22684pub struct InvfftOptions {
22685    /// real: `bool` -> Output only the real part of the transform
22686    /// default: false
22687    pub real: bool,
22688}
22689
22690impl std::default::Default for InvfftOptions {
22691    fn default() -> Self {
22692        InvfftOptions { real: false }
22693    }
22694}
22695
22696/// VipsInvfft (invfft), inverse FFT
22697/// inp: `&VipsImage` -> Input image
22698/// invfft_options: `&InvfftOptions` -> optional arguments
22699/// returns `VipsImage` - Output image
22700pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22701    unsafe {
22702        let inp_in: *mut bindings::VipsImage = inp.ctx;
22703        let mut out_out: *mut bindings::VipsImage = null_mut();
22704
22705        let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22706        let real_in_name = utils::new_c_string("real")?;
22707
22708        let vips_op_response =
22709            bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22710        utils::result(
22711            vips_op_response,
22712            VipsImage { ctx: out_out },
22713            Error::InvfftError,
22714        )
22715    }
22716}
22717
22718/// VipsFreqmult (freqmult), frequency-domain filtering
22719/// inp: `&VipsImage` -> Input image
22720/// mask: `&VipsImage` -> Input mask image
22721/// returns `VipsImage` - Output image
22722pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22723    unsafe {
22724        let inp_in: *mut bindings::VipsImage = inp.ctx;
22725        let mask_in: *mut bindings::VipsImage = mask.ctx;
22726        let mut out_out: *mut bindings::VipsImage = null_mut();
22727
22728        let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22729        utils::result(
22730            vips_op_response,
22731            VipsImage { ctx: out_out },
22732            Error::FreqmultError,
22733        )
22734    }
22735}
22736
22737/// VipsSpectrum (spectrum), make displayable power spectrum
22738/// inp: `&VipsImage` -> Input image
22739/// returns `VipsImage` - Output image
22740pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22741    unsafe {
22742        let inp_in: *mut bindings::VipsImage = inp.ctx;
22743        let mut out_out: *mut bindings::VipsImage = null_mut();
22744
22745        let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22746        utils::result(
22747            vips_op_response,
22748            VipsImage { ctx: out_out },
22749            Error::SpectrumError,
22750        )
22751    }
22752}
22753
22754/// VipsPhasecor (phasecor), calculate phase correlation
22755/// inp: `&VipsImage` -> Input image
22756/// in_2: `&VipsImage` -> Second input image
22757/// returns `VipsImage` - Output image
22758pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22759    unsafe {
22760        let inp_in: *mut bindings::VipsImage = inp.ctx;
22761        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22762        let mut out_out: *mut bindings::VipsImage = null_mut();
22763
22764        let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22765        utils::result(
22766            vips_op_response,
22767            VipsImage { ctx: out_out },
22768            Error::PhasecorError,
22769        )
22770    }
22771}
22772
22773/// VipsMorph (morph), morphology operation
22774/// inp: `&VipsImage` -> Input image argument
22775/// mask: `&VipsImage` -> Input matrix image
22776/// morph: `OperationMorphology` -> Morphological operation to perform
22777///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0 [DEFAULT]
22778///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
22779/// returns `VipsImage` - Output image
22780pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22781    unsafe {
22782        let inp_in: *mut bindings::VipsImage = inp.ctx;
22783        let mask_in: *mut bindings::VipsImage = mask.ctx;
22784        let morph_in: i32 = morph as i32;
22785        let mut out_out: *mut bindings::VipsImage = null_mut();
22786
22787        let vips_op_response = bindings::vips_morph(
22788            inp_in,
22789            &mut out_out,
22790            mask_in,
22791            morph_in.try_into().unwrap(),
22792            NULL,
22793        );
22794        utils::result(
22795            vips_op_response,
22796            VipsImage { ctx: out_out },
22797            Error::MorphError,
22798        )
22799    }
22800}
22801
22802/// VipsRank (rank), rank filter
22803/// inp: `&VipsImage` -> Input image argument
22804/// width: `i32` -> Window width in pixels
22805/// min: 1, max: 100000, default: 11
22806/// height: `i32` -> Window height in pixels
22807/// min: 1, max: 100000, default: 11
22808/// index: `i32` -> Select pixel at index
22809/// min: 0, max: 100000000, default: 50
22810/// returns `VipsImage` - Output image
22811pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22812    unsafe {
22813        let inp_in: *mut bindings::VipsImage = inp.ctx;
22814        let width_in: i32 = width;
22815        let height_in: i32 = height;
22816        let index_in: i32 = index;
22817        let mut out_out: *mut bindings::VipsImage = null_mut();
22818
22819        let vips_op_response =
22820            bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22821        utils::result(
22822            vips_op_response,
22823            VipsImage { ctx: out_out },
22824            Error::RankError,
22825        )
22826    }
22827}
22828
22829/// VipsCountlines (countlines), count lines in an image
22830/// inp: `&VipsImage` -> Input image argument
22831/// direction: `Direction` -> Countlines left-right or up-down
22832///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
22833///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
22834/// returns `f64` - Number of lines
22835pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22836    unsafe {
22837        let inp_in: *mut bindings::VipsImage = inp.ctx;
22838        let direction_in: i32 = direction as i32;
22839        let mut nolines_out: f64 = f64::from(0);
22840
22841        let vips_op_response = bindings::vips_countlines(
22842            inp_in,
22843            &mut nolines_out,
22844            direction_in.try_into().unwrap(),
22845            NULL,
22846        );
22847        utils::result(vips_op_response, nolines_out, Error::CountlineError)
22848    }
22849}
22850
22851/// VipsLabelregions (labelregions), label regions in an image
22852/// inp: `&VipsImage` -> Input image argument
22853/// returns `VipsImage` - Mask of region labels
22854pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22855    unsafe {
22856        let inp_in: *mut bindings::VipsImage = inp.ctx;
22857        let mut mask_out: *mut bindings::VipsImage = null_mut();
22858
22859        let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22860        utils::result(
22861            vips_op_response,
22862            VipsImage { ctx: mask_out },
22863            Error::LabelregionError,
22864        )
22865    }
22866}
22867
22868/// Options for labelregions operation
22869#[derive(Clone, Debug)]
22870pub struct LabelregionOptions {
22871    /// segments: `i32` -> Number of discrete contiguous regions
22872    /// min: 0, max: 1000000000, default: 0
22873    pub segments: i32,
22874}
22875
22876impl std::default::Default for LabelregionOptions {
22877    fn default() -> Self {
22878        LabelregionOptions {
22879            segments: i32::from(0),
22880        }
22881    }
22882}
22883
22884/// VipsLabelregions (labelregions), label regions in an image
22885/// inp: `&VipsImage` -> Input image argument
22886/// labelregions_options: `&LabelregionOptions` -> optional arguments
22887/// returns `VipsImage` - Mask of region labels
22888pub fn labelregions_with_opts(
22889    inp: &VipsImage,
22890    labelregions_options: &LabelregionOptions,
22891) -> Result<VipsImage> {
22892    unsafe {
22893        let inp_in: *mut bindings::VipsImage = inp.ctx;
22894        let mut mask_out: *mut bindings::VipsImage = null_mut();
22895
22896        let segments_in: i32 = labelregions_options.segments;
22897        let segments_in_name = utils::new_c_string("segments")?;
22898
22899        let vips_op_response = bindings::vips_labelregions(
22900            inp_in,
22901            &mut mask_out,
22902            segments_in_name.as_ptr(),
22903            segments_in,
22904            NULL,
22905        );
22906        utils::result(
22907            vips_op_response,
22908            VipsImage { ctx: mask_out },
22909            Error::LabelregionError,
22910        )
22911    }
22912}
22913
22914/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22915/// inp: `&VipsImage` -> Input image argument
22916/// returns `VipsImage` - Value of nearest non-zero pixel
22917pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22918    unsafe {
22919        let inp_in: *mut bindings::VipsImage = inp.ctx;
22920        let mut out_out: *mut bindings::VipsImage = null_mut();
22921
22922        let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22923        utils::result(
22924            vips_op_response,
22925            VipsImage { ctx: out_out },
22926            Error::FillNearestError,
22927        )
22928    }
22929}
22930
22931/// Options for fill_nearest operation
22932#[derive(Clone, Debug)]
22933pub struct FillNearestOptions {
22934    /// distance: `VipsImage` -> Distance to nearest non-zero pixel
22935    pub distance: VipsImage,
22936}
22937
22938impl std::default::Default for FillNearestOptions {
22939    fn default() -> Self {
22940        FillNearestOptions {
22941            distance: VipsImage::new(),
22942        }
22943    }
22944}
22945
22946/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
22947/// inp: `&VipsImage` -> Input image argument
22948/// fill_nearest_options: `&FillNearestOptions` -> optional arguments
22949/// returns `VipsImage` - Value of nearest non-zero pixel
22950pub fn fill_nearest_with_opts(
22951    inp: &VipsImage,
22952    fill_nearest_options: &FillNearestOptions,
22953) -> Result<VipsImage> {
22954    unsafe {
22955        let inp_in: *mut bindings::VipsImage = inp.ctx;
22956        let mut out_out: *mut bindings::VipsImage = null_mut();
22957
22958        let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
22959        let distance_in_name = utils::new_c_string("distance")?;
22960
22961        let vips_op_response = bindings::vips_fill_nearest(
22962            inp_in,
22963            &mut out_out,
22964            distance_in_name.as_ptr(),
22965            distance_in,
22966            NULL,
22967        );
22968        utils::result(
22969            vips_op_response,
22970            VipsImage { ctx: out_out },
22971            Error::FillNearestError,
22972        )
22973    }
22974}
22975
22976/// VipsDrawRect (draw_rect), paint a rectangle on an image, nocache
22977/// image: `&VipsImage` -> Image to draw on
22978/// ink: `&mut [f64]` -> Color for pixels
22979/// left: `i32` -> Rect to fill
22980/// min: -1000000000, max: 1000000000, default: 0
22981/// top: `i32` -> Rect to fill
22982/// min: -1000000000, max: 1000000000, default: 0
22983/// width: `i32` -> Rect to fill
22984/// min: -1000000000, max: 1000000000, default: 0
22985/// height: `i32` -> Rect to fill
22986/// min: -1000000000, max: 1000000000, default: 0
22987
22988pub fn draw_rect(
22989    image: &VipsImage,
22990    ink: &mut [f64],
22991    left: i32,
22992    top: i32,
22993    width: i32,
22994    height: i32,
22995) -> Result<()> {
22996    unsafe {
22997        let image_in: *mut bindings::VipsImage = image.ctx;
22998        let ink_in: *mut f64 = ink.as_mut_ptr();
22999        let left_in: i32 = left;
23000        let top_in: i32 = top;
23001        let width_in: i32 = width;
23002        let height_in: i32 = height;
23003
23004        let vips_op_response = bindings::vips_draw_rect(
23005            image_in,
23006            ink_in,
23007            ink.len() as i32,
23008            left_in,
23009            top_in,
23010            width_in,
23011            height_in,
23012            NULL,
23013        );
23014        utils::result(vips_op_response, (), Error::DrawRectError)
23015    }
23016}
23017
23018/// Options for draw_rect operation
23019#[derive(Clone, Debug)]
23020pub struct DrawRectOptions {
23021    /// fill: `bool` -> Draw a solid object
23022    /// default: false
23023    pub fill: bool,
23024}
23025
23026impl std::default::Default for DrawRectOptions {
23027    fn default() -> Self {
23028        DrawRectOptions { fill: false }
23029    }
23030}
23031
23032/// VipsDrawRect (draw_rect), paint a rectangle on an image, nocache
23033/// image: `&VipsImage` -> Image to draw on
23034/// ink: `&mut [f64]` -> Color for pixels
23035/// left: `i32` -> Rect to fill
23036/// min: -1000000000, max: 1000000000, default: 0
23037/// top: `i32` -> Rect to fill
23038/// min: -1000000000, max: 1000000000, default: 0
23039/// width: `i32` -> Rect to fill
23040/// min: -1000000000, max: 1000000000, default: 0
23041/// height: `i32` -> Rect to fill
23042/// min: -1000000000, max: 1000000000, default: 0
23043/// draw_rect_options: `&DrawRectOptions` -> optional arguments
23044
23045pub fn draw_rect_with_opts(
23046    image: &VipsImage,
23047    ink: &mut [f64],
23048    left: i32,
23049    top: i32,
23050    width: i32,
23051    height: i32,
23052    draw_rect_options: &DrawRectOptions,
23053) -> Result<()> {
23054    unsafe {
23055        let image_in: *mut bindings::VipsImage = image.ctx;
23056        let ink_in: *mut f64 = ink.as_mut_ptr();
23057        let left_in: i32 = left;
23058        let top_in: i32 = top;
23059        let width_in: i32 = width;
23060        let height_in: i32 = height;
23061
23062        let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
23063        let fill_in_name = utils::new_c_string("fill")?;
23064
23065        let vips_op_response = bindings::vips_draw_rect(
23066            image_in,
23067            ink_in,
23068            ink.len() as i32,
23069            left_in,
23070            top_in,
23071            width_in,
23072            height_in,
23073            fill_in_name.as_ptr(),
23074            fill_in,
23075            NULL,
23076        );
23077        utils::result(vips_op_response, (), Error::DrawRectError)
23078    }
23079}
23080
23081/// VipsDrawMask (draw_mask), draw a mask on an image, nocache
23082/// image: `&VipsImage` -> Image to draw on
23083/// ink: `&mut [f64]` -> Color for pixels
23084/// mask: `&VipsImage` -> Mask of pixels to draw
23085/// x: `i32` -> Draw mask here
23086/// min: -1000000000, max: 1000000000, default: 0
23087/// y: `i32` -> Draw mask here
23088/// min: -1000000000, max: 1000000000, default: 0
23089
23090pub fn draw_mask(
23091    image: &VipsImage,
23092    ink: &mut [f64],
23093    mask: &VipsImage,
23094    x: i32,
23095    y: i32,
23096) -> Result<()> {
23097    unsafe {
23098        let image_in: *mut bindings::VipsImage = image.ctx;
23099        let ink_in: *mut f64 = ink.as_mut_ptr();
23100        let mask_in: *mut bindings::VipsImage = mask.ctx;
23101        let x_in: i32 = x;
23102        let y_in: i32 = y;
23103
23104        let vips_op_response = bindings::vips_draw_mask(
23105            image_in,
23106            ink_in,
23107            ink.len() as i32,
23108            mask_in,
23109            x_in,
23110            y_in,
23111            NULL,
23112        );
23113        utils::result(vips_op_response, (), Error::DrawMaskError)
23114    }
23115}
23116
23117/// VipsDrawLine (draw_line), draw a line on an image, nocache
23118/// image: `&VipsImage` -> Image to draw on
23119/// ink: `&mut [f64]` -> Color for pixels
23120/// x_1: `i32` -> Start of draw_line
23121/// min: -1000000000, max: 1000000000, default: 0
23122/// y_1: `i32` -> Start of draw_line
23123/// min: -1000000000, max: 1000000000, default: 0
23124/// x_2: `i32` -> End of draw_line
23125/// min: -1000000000, max: 1000000000, default: 0
23126/// y_2: `i32` -> End of draw_line
23127/// min: -1000000000, max: 1000000000, default: 0
23128
23129pub fn draw_line(
23130    image: &VipsImage,
23131    ink: &mut [f64],
23132    x_1: i32,
23133    y_1: i32,
23134    x_2: i32,
23135    y_2: i32,
23136) -> Result<()> {
23137    unsafe {
23138        let image_in: *mut bindings::VipsImage = image.ctx;
23139        let ink_in: *mut f64 = ink.as_mut_ptr();
23140        let x_1_in: i32 = x_1;
23141        let y_1_in: i32 = y_1;
23142        let x_2_in: i32 = x_2;
23143        let y_2_in: i32 = y_2;
23144
23145        let vips_op_response = bindings::vips_draw_line(
23146            image_in,
23147            ink_in,
23148            ink.len() as i32,
23149            x_1_in,
23150            y_1_in,
23151            x_2_in,
23152            y_2_in,
23153            NULL,
23154        );
23155        utils::result(vips_op_response, (), Error::DrawLineError)
23156    }
23157}
23158
23159/// VipsDrawCircle (draw_circle), draw a circle on an image, nocache
23160/// image: `&VipsImage` -> Image to draw on
23161/// ink: `&mut [f64]` -> Color for pixels
23162/// cx: `i32` -> Centre of draw_circle
23163/// min: -1000000000, max: 1000000000, default: 0
23164/// cy: `i32` -> Centre of draw_circle
23165/// min: -1000000000, max: 1000000000, default: 0
23166/// radius: `i32` -> Radius in pixels
23167/// min: 0, max: 1000000000, default: 0
23168
23169pub fn draw_circle(
23170    image: &VipsImage,
23171    ink: &mut [f64],
23172    cx: i32,
23173    cy: i32,
23174    radius: i32,
23175) -> Result<()> {
23176    unsafe {
23177        let image_in: *mut bindings::VipsImage = image.ctx;
23178        let ink_in: *mut f64 = ink.as_mut_ptr();
23179        let cx_in: i32 = cx;
23180        let cy_in: i32 = cy;
23181        let radius_in: i32 = radius;
23182
23183        let vips_op_response = bindings::vips_draw_circle(
23184            image_in,
23185            ink_in,
23186            ink.len() as i32,
23187            cx_in,
23188            cy_in,
23189            radius_in,
23190            NULL,
23191        );
23192        utils::result(vips_op_response, (), Error::DrawCircleError)
23193    }
23194}
23195
23196/// Options for draw_circle operation
23197#[derive(Clone, Debug)]
23198pub struct DrawCircleOptions {
23199    /// fill: `bool` -> Draw a solid object
23200    /// default: false
23201    pub fill: bool,
23202}
23203
23204impl std::default::Default for DrawCircleOptions {
23205    fn default() -> Self {
23206        DrawCircleOptions { fill: false }
23207    }
23208}
23209
23210/// VipsDrawCircle (draw_circle), draw a circle on an image, nocache
23211/// image: `&VipsImage` -> Image to draw on
23212/// ink: `&mut [f64]` -> Color for pixels
23213/// cx: `i32` -> Centre of draw_circle
23214/// min: -1000000000, max: 1000000000, default: 0
23215/// cy: `i32` -> Centre of draw_circle
23216/// min: -1000000000, max: 1000000000, default: 0
23217/// radius: `i32` -> Radius in pixels
23218/// min: 0, max: 1000000000, default: 0
23219/// draw_circle_options: `&DrawCircleOptions` -> optional arguments
23220
23221pub fn draw_circle_with_opts(
23222    image: &VipsImage,
23223    ink: &mut [f64],
23224    cx: i32,
23225    cy: i32,
23226    radius: i32,
23227    draw_circle_options: &DrawCircleOptions,
23228) -> Result<()> {
23229    unsafe {
23230        let image_in: *mut bindings::VipsImage = image.ctx;
23231        let ink_in: *mut f64 = ink.as_mut_ptr();
23232        let cx_in: i32 = cx;
23233        let cy_in: i32 = cy;
23234        let radius_in: i32 = radius;
23235
23236        let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
23237        let fill_in_name = utils::new_c_string("fill")?;
23238
23239        let vips_op_response = bindings::vips_draw_circle(
23240            image_in,
23241            ink_in,
23242            ink.len() as i32,
23243            cx_in,
23244            cy_in,
23245            radius_in,
23246            fill_in_name.as_ptr(),
23247            fill_in,
23248            NULL,
23249        );
23250        utils::result(vips_op_response, (), Error::DrawCircleError)
23251    }
23252}
23253
23254/// VipsDrawFlood (draw_flood), flood-fill an area, nocache
23255/// image: `&VipsImage` -> Image to draw on
23256/// ink: `&mut [f64]` -> Color for pixels
23257/// x: `i32` -> DrawFlood start point
23258/// min: 0, max: 1000000000, default: 0
23259/// y: `i32` -> DrawFlood start point
23260/// min: 0, max: 1000000000, default: 0
23261
23262pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
23263    unsafe {
23264        let image_in: *mut bindings::VipsImage = image.ctx;
23265        let ink_in: *mut f64 = ink.as_mut_ptr();
23266        let x_in: i32 = x;
23267        let y_in: i32 = y;
23268
23269        let vips_op_response =
23270            bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
23271        utils::result(vips_op_response, (), Error::DrawFloodError)
23272    }
23273}
23274
23275/// Options for draw_flood operation
23276#[derive(Clone, Debug)]
23277pub struct DrawFloodOptions {
23278    /// test: `VipsImage` -> Test pixels in this image
23279    pub test: VipsImage,
23280    /// equal: `bool` -> DrawFlood while equal to edge
23281    /// default: false
23282    pub equal: bool,
23283    /// left: `i32` -> Left edge of modified area
23284    /// min: 0, max: 1000000000, default: 0
23285    pub left: i32,
23286    /// top: `i32` -> Top edge of modified area
23287    /// min: 0, max: 1000000000, default: 0
23288    pub top: i32,
23289    /// width: `i32` -> Width of modified area
23290    /// min: 0, max: 1000000000, default: 0
23291    pub width: i32,
23292    /// height: `i32` -> Height of modified area
23293    /// min: 0, max: 1000000000, default: 0
23294    pub height: i32,
23295}
23296
23297impl std::default::Default for DrawFloodOptions {
23298    fn default() -> Self {
23299        DrawFloodOptions {
23300            test: VipsImage::new(),
23301            equal: false,
23302            left: i32::from(0),
23303            top: i32::from(0),
23304            width: i32::from(0),
23305            height: i32::from(0),
23306        }
23307    }
23308}
23309
23310/// VipsDrawFlood (draw_flood), flood-fill an area, nocache
23311/// image: `&VipsImage` -> Image to draw on
23312/// ink: `&mut [f64]` -> Color for pixels
23313/// x: `i32` -> DrawFlood start point
23314/// min: 0, max: 1000000000, default: 0
23315/// y: `i32` -> DrawFlood start point
23316/// min: 0, max: 1000000000, default: 0
23317/// draw_flood_options: `&DrawFloodOptions` -> optional arguments
23318
23319pub fn draw_flood_with_opts(
23320    image: &VipsImage,
23321    ink: &mut [f64],
23322    x: i32,
23323    y: i32,
23324    draw_flood_options: &DrawFloodOptions,
23325) -> Result<()> {
23326    unsafe {
23327        let image_in: *mut bindings::VipsImage = image.ctx;
23328        let ink_in: *mut f64 = ink.as_mut_ptr();
23329        let x_in: i32 = x;
23330        let y_in: i32 = y;
23331
23332        let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
23333        let test_in_name = utils::new_c_string("test")?;
23334
23335        let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
23336        let equal_in_name = utils::new_c_string("equal")?;
23337
23338        let left_in: i32 = draw_flood_options.left;
23339        let left_in_name = utils::new_c_string("left")?;
23340
23341        let top_in: i32 = draw_flood_options.top;
23342        let top_in_name = utils::new_c_string("top")?;
23343
23344        let width_in: i32 = draw_flood_options.width;
23345        let width_in_name = utils::new_c_string("width")?;
23346
23347        let height_in: i32 = draw_flood_options.height;
23348        let height_in_name = utils::new_c_string("height")?;
23349
23350        let vips_op_response = bindings::vips_draw_flood(
23351            image_in,
23352            ink_in,
23353            ink.len() as i32,
23354            x_in,
23355            y_in,
23356            test_in_name.as_ptr(),
23357            test_in,
23358            equal_in_name.as_ptr(),
23359            equal_in,
23360            left_in_name.as_ptr(),
23361            left_in,
23362            top_in_name.as_ptr(),
23363            top_in,
23364            width_in_name.as_ptr(),
23365            width_in,
23366            height_in_name.as_ptr(),
23367            height_in,
23368            NULL,
23369        );
23370        utils::result(vips_op_response, (), Error::DrawFloodError)
23371    }
23372}
23373
23374/// VipsDrawImage (draw_image), paint an image into another image, nocache
23375/// image: `&VipsImage` -> Image to draw on
23376/// sub: `&VipsImage` -> Sub-image to insert into main image
23377/// x: `i32` -> Draw image here
23378/// min: -1000000000, max: 1000000000, default: 0
23379/// y: `i32` -> Draw image here
23380/// min: -1000000000, max: 1000000000, default: 0
23381
23382pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
23383    unsafe {
23384        let image_in: *mut bindings::VipsImage = image.ctx;
23385        let sub_in: *mut bindings::VipsImage = sub.ctx;
23386        let x_in: i32 = x;
23387        let y_in: i32 = y;
23388
23389        let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
23390        utils::result(vips_op_response, (), Error::DrawImageError)
23391    }
23392}
23393
23394/// Options for draw_image operation
23395#[derive(Clone, Debug)]
23396pub struct DrawImageOptions {
23397    /// mode: `CombineMode` -> Combining mode
23398    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0 [DEFAULT]
23399    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
23400    pub mode: CombineMode,
23401}
23402
23403impl std::default::Default for DrawImageOptions {
23404    fn default() -> Self {
23405        DrawImageOptions {
23406            mode: CombineMode::Set,
23407        }
23408    }
23409}
23410
23411/// VipsDrawImage (draw_image), paint an image into another image, nocache
23412/// image: `&VipsImage` -> Image to draw on
23413/// sub: `&VipsImage` -> Sub-image to insert into main image
23414/// x: `i32` -> Draw image here
23415/// min: -1000000000, max: 1000000000, default: 0
23416/// y: `i32` -> Draw image here
23417/// min: -1000000000, max: 1000000000, default: 0
23418/// draw_image_options: `&DrawImageOptions` -> optional arguments
23419
23420pub fn draw_image_with_opts(
23421    image: &VipsImage,
23422    sub: &VipsImage,
23423    x: i32,
23424    y: i32,
23425    draw_image_options: &DrawImageOptions,
23426) -> Result<()> {
23427    unsafe {
23428        let image_in: *mut bindings::VipsImage = image.ctx;
23429        let sub_in: *mut bindings::VipsImage = sub.ctx;
23430        let x_in: i32 = x;
23431        let y_in: i32 = y;
23432
23433        let mode_in: i32 = draw_image_options.mode as i32;
23434        let mode_in_name = utils::new_c_string("mode")?;
23435
23436        let vips_op_response = bindings::vips_draw_image(
23437            image_in,
23438            sub_in,
23439            x_in,
23440            y_in,
23441            mode_in_name.as_ptr(),
23442            mode_in,
23443            NULL,
23444        );
23445        utils::result(vips_op_response, (), Error::DrawImageError)
23446    }
23447}
23448
23449/// VipsDrawSmudge (draw_smudge), blur a rectangle on an image, nocache
23450/// image: `&VipsImage` -> Image to draw on
23451/// left: `i32` -> Rect to fill
23452/// min: -1000000000, max: 1000000000, default: 0
23453/// top: `i32` -> Rect to fill
23454/// min: -1000000000, max: 1000000000, default: 0
23455/// width: `i32` -> Rect to fill
23456/// min: -1000000000, max: 1000000000, default: 0
23457/// height: `i32` -> Rect to fill
23458/// min: -1000000000, max: 1000000000, default: 0
23459
23460pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
23461    unsafe {
23462        let image_in: *mut bindings::VipsImage = image.ctx;
23463        let left_in: i32 = left;
23464        let top_in: i32 = top;
23465        let width_in: i32 = width;
23466        let height_in: i32 = height;
23467
23468        let vips_op_response =
23469            bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
23470        utils::result(vips_op_response, (), Error::DrawSmudgeError)
23471    }
23472}
23473
23474/// VipsMerge (merge), merge two images
23475/// refp: `&VipsImage` -> Reference image
23476/// sec: `&VipsImage` -> Secondary image
23477/// direction: `Direction` -> Horizontal or vertical merge
23478///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23479///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23480/// dx: `i32` -> Horizontal displacement from sec to ref
23481/// min: -100000000, max: 1000000000, default: 1
23482/// dy: `i32` -> Vertical displacement from sec to ref
23483/// min: -100000000, max: 1000000000, default: 1
23484/// returns `VipsImage` - Output image
23485pub fn merge(
23486    refp: &VipsImage,
23487    sec: &VipsImage,
23488    direction: Direction,
23489    dx: i32,
23490    dy: i32,
23491) -> Result<VipsImage> {
23492    unsafe {
23493        let refp_in: *mut bindings::VipsImage = refp.ctx;
23494        let sec_in: *mut bindings::VipsImage = sec.ctx;
23495        let direction_in: i32 = direction as i32;
23496        let dx_in: i32 = dx;
23497        let dy_in: i32 = dy;
23498        let mut out_out: *mut bindings::VipsImage = null_mut();
23499
23500        let vips_op_response = bindings::vips_merge(
23501            refp_in,
23502            sec_in,
23503            &mut out_out,
23504            direction_in.try_into().unwrap(),
23505            dx_in,
23506            dy_in,
23507            NULL,
23508        );
23509        utils::result(
23510            vips_op_response,
23511            VipsImage { ctx: out_out },
23512            Error::MergeError,
23513        )
23514    }
23515}
23516
23517/// Options for merge operation
23518#[derive(Clone, Debug)]
23519pub struct MergeOptions {
23520    /// mblend: `i32` -> Maximum blend size
23521    /// min: 0, max: 10000, default: 10
23522    pub mblend: i32,
23523}
23524
23525impl std::default::Default for MergeOptions {
23526    fn default() -> Self {
23527        MergeOptions {
23528            mblend: i32::from(10),
23529        }
23530    }
23531}
23532
23533/// VipsMerge (merge), merge two images
23534/// refp: `&VipsImage` -> Reference image
23535/// sec: `&VipsImage` -> Secondary image
23536/// direction: `Direction` -> Horizontal or vertical merge
23537///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23538///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23539/// dx: `i32` -> Horizontal displacement from sec to ref
23540/// min: -100000000, max: 1000000000, default: 1
23541/// dy: `i32` -> Vertical displacement from sec to ref
23542/// min: -100000000, max: 1000000000, default: 1
23543/// merge_options: `&MergeOptions` -> optional arguments
23544/// returns `VipsImage` - Output image
23545pub fn merge_with_opts(
23546    refp: &VipsImage,
23547    sec: &VipsImage,
23548    direction: Direction,
23549    dx: i32,
23550    dy: i32,
23551    merge_options: &MergeOptions,
23552) -> Result<VipsImage> {
23553    unsafe {
23554        let refp_in: *mut bindings::VipsImage = refp.ctx;
23555        let sec_in: *mut bindings::VipsImage = sec.ctx;
23556        let direction_in: i32 = direction as i32;
23557        let dx_in: i32 = dx;
23558        let dy_in: i32 = dy;
23559        let mut out_out: *mut bindings::VipsImage = null_mut();
23560
23561        let mblend_in: i32 = merge_options.mblend;
23562        let mblend_in_name = utils::new_c_string("mblend")?;
23563
23564        let vips_op_response = bindings::vips_merge(
23565            refp_in,
23566            sec_in,
23567            &mut out_out,
23568            direction_in.try_into().unwrap(),
23569            dx_in,
23570            dy_in,
23571            mblend_in_name.as_ptr(),
23572            mblend_in,
23573            NULL,
23574        );
23575        utils::result(
23576            vips_op_response,
23577            VipsImage { ctx: out_out },
23578            Error::MergeError,
23579        )
23580    }
23581}
23582
23583/// VipsMosaic (mosaic), mosaic two images
23584/// refp: `&VipsImage` -> Reference image
23585/// sec: `&VipsImage` -> Secondary image
23586/// direction: `Direction` -> Horizontal or vertical mosaic
23587///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23588///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23589/// xref: `i32` -> Position of reference tie-point
23590/// min: 0, max: 1000000000, default: 1
23591/// yref: `i32` -> Position of reference tie-point
23592/// min: 0, max: 1000000000, default: 1
23593/// xsec: `i32` -> Position of secondary tie-point
23594/// min: 0, max: 1000000000, default: 1
23595/// ysec: `i32` -> Position of secondary tie-point
23596/// min: 0, max: 1000000000, default: 1
23597/// returns `VipsImage` - Output image
23598pub fn mosaic(
23599    refp: &VipsImage,
23600    sec: &VipsImage,
23601    direction: Direction,
23602    xref: i32,
23603    yref: i32,
23604    xsec: i32,
23605    ysec: i32,
23606) -> Result<VipsImage> {
23607    unsafe {
23608        let refp_in: *mut bindings::VipsImage = refp.ctx;
23609        let sec_in: *mut bindings::VipsImage = sec.ctx;
23610        let direction_in: i32 = direction as i32;
23611        let xref_in: i32 = xref;
23612        let yref_in: i32 = yref;
23613        let xsec_in: i32 = xsec;
23614        let ysec_in: i32 = ysec;
23615        let mut out_out: *mut bindings::VipsImage = null_mut();
23616
23617        let vips_op_response = bindings::vips_mosaic(
23618            refp_in,
23619            sec_in,
23620            &mut out_out,
23621            direction_in.try_into().unwrap(),
23622            xref_in,
23623            yref_in,
23624            xsec_in,
23625            ysec_in,
23626            NULL,
23627        );
23628        utils::result(
23629            vips_op_response,
23630            VipsImage { ctx: out_out },
23631            Error::MosaicError,
23632        )
23633    }
23634}
23635
23636/// Options for mosaic operation
23637#[derive(Clone, Debug)]
23638pub struct MosaicOptions {
23639    /// hwindow: `i32` -> Half window size
23640    /// min: 0, max: 1000000000, default: 5
23641    pub hwindow: i32,
23642    /// harea: `i32` -> Half area size
23643    /// min: 0, max: 1000000000, default: 15
23644    pub harea: i32,
23645    /// mblend: `i32` -> Maximum blend size
23646    /// min: 0, max: 10000, default: 10
23647    pub mblend: i32,
23648    /// bandno: `i32` -> Band to search for features on
23649    /// min: 0, max: 10000, default: 0
23650    pub bandno: i32,
23651    /// dx_0: `i32` -> Detected integer offset
23652    /// min: -10000000, max: 10000000, default: 0
23653    pub dx_0: i32,
23654    /// dy_0: `i32` -> Detected integer offset
23655    /// min: -10000000, max: 10000000, default: 0
23656    pub dy_0: i32,
23657    /// scale_1: `f64` -> Detected scale
23658    /// min: -10000000, max: 10000000, default: 1
23659    pub scale_1: f64,
23660    /// angle_1: `f64` -> Detected rotation
23661    /// min: -10000000, max: 10000000, default: 0
23662    pub angle_1: f64,
23663    /// dy_1: `f64` -> Detected first-order displacement
23664    /// min: -10000000, max: 10000000, default: 0
23665    pub dy_1: f64,
23666    /// dx_1: `f64` -> Detected first-order displacement
23667    /// min: -10000000, max: 10000000, default: 0
23668    pub dx_1: f64,
23669}
23670
23671impl std::default::Default for MosaicOptions {
23672    fn default() -> Self {
23673        MosaicOptions {
23674            hwindow: i32::from(5),
23675            harea: i32::from(15),
23676            mblend: i32::from(10),
23677            bandno: i32::from(0),
23678            dx_0: i32::from(0),
23679            dy_0: i32::from(0),
23680            scale_1: f64::from(1),
23681            angle_1: f64::from(0),
23682            dy_1: f64::from(0),
23683            dx_1: f64::from(0),
23684        }
23685    }
23686}
23687
23688/// VipsMosaic (mosaic), mosaic two images
23689/// refp: `&VipsImage` -> Reference image
23690/// sec: `&VipsImage` -> Secondary image
23691/// direction: `Direction` -> Horizontal or vertical mosaic
23692///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23693///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23694/// xref: `i32` -> Position of reference tie-point
23695/// min: 0, max: 1000000000, default: 1
23696/// yref: `i32` -> Position of reference tie-point
23697/// min: 0, max: 1000000000, default: 1
23698/// xsec: `i32` -> Position of secondary tie-point
23699/// min: 0, max: 1000000000, default: 1
23700/// ysec: `i32` -> Position of secondary tie-point
23701/// min: 0, max: 1000000000, default: 1
23702/// mosaic_options: `&MosaicOptions` -> optional arguments
23703/// returns `VipsImage` - Output image
23704pub fn mosaic_with_opts(
23705    refp: &VipsImage,
23706    sec: &VipsImage,
23707    direction: Direction,
23708    xref: i32,
23709    yref: i32,
23710    xsec: i32,
23711    ysec: i32,
23712    mosaic_options: &MosaicOptions,
23713) -> Result<VipsImage> {
23714    unsafe {
23715        let refp_in: *mut bindings::VipsImage = refp.ctx;
23716        let sec_in: *mut bindings::VipsImage = sec.ctx;
23717        let direction_in: i32 = direction as i32;
23718        let xref_in: i32 = xref;
23719        let yref_in: i32 = yref;
23720        let xsec_in: i32 = xsec;
23721        let ysec_in: i32 = ysec;
23722        let mut out_out: *mut bindings::VipsImage = null_mut();
23723
23724        let hwindow_in: i32 = mosaic_options.hwindow;
23725        let hwindow_in_name = utils::new_c_string("hwindow")?;
23726
23727        let harea_in: i32 = mosaic_options.harea;
23728        let harea_in_name = utils::new_c_string("harea")?;
23729
23730        let mblend_in: i32 = mosaic_options.mblend;
23731        let mblend_in_name = utils::new_c_string("mblend")?;
23732
23733        let bandno_in: i32 = mosaic_options.bandno;
23734        let bandno_in_name = utils::new_c_string("bandno")?;
23735
23736        let dx_0_in: i32 = mosaic_options.dx_0;
23737        let dx_0_in_name = utils::new_c_string("dx0")?;
23738
23739        let dy_0_in: i32 = mosaic_options.dy_0;
23740        let dy_0_in_name = utils::new_c_string("dy0")?;
23741
23742        let scale_1_in: f64 = mosaic_options.scale_1;
23743        let scale_1_in_name = utils::new_c_string("scale1")?;
23744
23745        let angle_1_in: f64 = mosaic_options.angle_1;
23746        let angle_1_in_name = utils::new_c_string("angle1")?;
23747
23748        let dy_1_in: f64 = mosaic_options.dy_1;
23749        let dy_1_in_name = utils::new_c_string("dy1")?;
23750
23751        let dx_1_in: f64 = mosaic_options.dx_1;
23752        let dx_1_in_name = utils::new_c_string("dx1")?;
23753
23754        let vips_op_response = bindings::vips_mosaic(
23755            refp_in,
23756            sec_in,
23757            &mut out_out,
23758            direction_in.try_into().unwrap(),
23759            xref_in,
23760            yref_in,
23761            xsec_in,
23762            ysec_in,
23763            hwindow_in_name.as_ptr(),
23764            hwindow_in,
23765            harea_in_name.as_ptr(),
23766            harea_in,
23767            mblend_in_name.as_ptr(),
23768            mblend_in,
23769            bandno_in_name.as_ptr(),
23770            bandno_in,
23771            dx_0_in_name.as_ptr(),
23772            dx_0_in,
23773            dy_0_in_name.as_ptr(),
23774            dy_0_in,
23775            scale_1_in_name.as_ptr(),
23776            scale_1_in,
23777            angle_1_in_name.as_ptr(),
23778            angle_1_in,
23779            dy_1_in_name.as_ptr(),
23780            dy_1_in,
23781            dx_1_in_name.as_ptr(),
23782            dx_1_in,
23783            NULL,
23784        );
23785        utils::result(
23786            vips_op_response,
23787            VipsImage { ctx: out_out },
23788            Error::MosaicError,
23789        )
23790    }
23791}
23792
23793/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23794/// refp: `&VipsImage` -> Reference image
23795/// sec: `&VipsImage` -> Secondary image
23796/// direction: `Direction` -> Horizontal or vertical mosaic
23797///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23798///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23799/// xr_1: `i32` -> Position of first reference tie-point
23800/// min: -1000000000, max: 1000000000, default: 1
23801/// yr_1: `i32` -> Position of first reference tie-point
23802/// min: -1000000000, max: 1000000000, default: 1
23803/// xs_1: `i32` -> Position of first secondary tie-point
23804/// min: -1000000000, max: 1000000000, default: 1
23805/// ys_1: `i32` -> Position of first secondary tie-point
23806/// min: -1000000000, max: 1000000000, default: 1
23807/// xr_2: `i32` -> Position of second reference tie-point
23808/// min: -1000000000, max: 1000000000, default: 1
23809/// yr_2: `i32` -> Position of second reference tie-point
23810/// min: -1000000000, max: 1000000000, default: 1
23811/// xs_2: `i32` -> Position of second secondary tie-point
23812/// min: -1000000000, max: 1000000000, default: 1
23813/// ys_2: `i32` -> Position of second secondary tie-point
23814/// min: -1000000000, max: 1000000000, default: 1
23815/// returns `VipsImage` - Output image
23816pub fn mosaic_1(
23817    refp: &VipsImage,
23818    sec: &VipsImage,
23819    direction: Direction,
23820    xr_1: i32,
23821    yr_1: i32,
23822    xs_1: i32,
23823    ys_1: i32,
23824    xr_2: i32,
23825    yr_2: i32,
23826    xs_2: i32,
23827    ys_2: i32,
23828) -> Result<VipsImage> {
23829    unsafe {
23830        let refp_in: *mut bindings::VipsImage = refp.ctx;
23831        let sec_in: *mut bindings::VipsImage = sec.ctx;
23832        let direction_in: i32 = direction as i32;
23833        let xr_1_in: i32 = xr_1;
23834        let yr_1_in: i32 = yr_1;
23835        let xs_1_in: i32 = xs_1;
23836        let ys_1_in: i32 = ys_1;
23837        let xr_2_in: i32 = xr_2;
23838        let yr_2_in: i32 = yr_2;
23839        let xs_2_in: i32 = xs_2;
23840        let ys_2_in: i32 = ys_2;
23841        let mut out_out: *mut bindings::VipsImage = null_mut();
23842
23843        let vips_op_response = bindings::vips_mosaic1(
23844            refp_in,
23845            sec_in,
23846            &mut out_out,
23847            direction_in.try_into().unwrap(),
23848            xr_1_in,
23849            yr_1_in,
23850            xs_1_in,
23851            ys_1_in,
23852            xr_2_in,
23853            yr_2_in,
23854            xs_2_in,
23855            ys_2_in,
23856            NULL,
23857        );
23858        utils::result(
23859            vips_op_response,
23860            VipsImage { ctx: out_out },
23861            Error::Mosaic1Error,
23862        )
23863    }
23864}
23865
23866/// Options for mosaic_1 operation
23867#[derive(Clone, Debug)]
23868pub struct Mosaic1Options {
23869    /// hwindow: `i32` -> Half window size
23870    /// min: 0, max: 1000000000, default: 5
23871    pub hwindow: i32,
23872    /// harea: `i32` -> Half area size
23873    /// min: 0, max: 1000000000, default: 15
23874    pub harea: i32,
23875    /// search: `bool` -> Search to improve tie-points
23876    /// default: false
23877    pub search: bool,
23878    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23879    pub interpolate: VipsInterpolate,
23880    /// mblend: `i32` -> Maximum blend size
23881    /// min: 0, max: 10000, default: 10
23882    pub mblend: i32,
23883}
23884
23885impl std::default::Default for Mosaic1Options {
23886    fn default() -> Self {
23887        Mosaic1Options {
23888            hwindow: i32::from(5),
23889            harea: i32::from(15),
23890            search: false,
23891            interpolate: VipsInterpolate::new(),
23892            mblend: i32::from(10),
23893        }
23894    }
23895}
23896
23897/// VipsMosaic1 (mosaic1), first-order mosaic of two images
23898/// refp: `&VipsImage` -> Reference image
23899/// sec: `&VipsImage` -> Secondary image
23900/// direction: `Direction` -> Horizontal or vertical mosaic
23901///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
23902///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
23903/// xr_1: `i32` -> Position of first reference tie-point
23904/// min: -1000000000, max: 1000000000, default: 1
23905/// yr_1: `i32` -> Position of first reference tie-point
23906/// min: -1000000000, max: 1000000000, default: 1
23907/// xs_1: `i32` -> Position of first secondary tie-point
23908/// min: -1000000000, max: 1000000000, default: 1
23909/// ys_1: `i32` -> Position of first secondary tie-point
23910/// min: -1000000000, max: 1000000000, default: 1
23911/// xr_2: `i32` -> Position of second reference tie-point
23912/// min: -1000000000, max: 1000000000, default: 1
23913/// yr_2: `i32` -> Position of second reference tie-point
23914/// min: -1000000000, max: 1000000000, default: 1
23915/// xs_2: `i32` -> Position of second secondary tie-point
23916/// min: -1000000000, max: 1000000000, default: 1
23917/// ys_2: `i32` -> Position of second secondary tie-point
23918/// min: -1000000000, max: 1000000000, default: 1
23919/// mosaic_1_options: `&Mosaic1Options` -> optional arguments
23920/// returns `VipsImage` - Output image
23921pub fn mosaic_1_with_opts(
23922    refp: &VipsImage,
23923    sec: &VipsImage,
23924    direction: Direction,
23925    xr_1: i32,
23926    yr_1: i32,
23927    xs_1: i32,
23928    ys_1: i32,
23929    xr_2: i32,
23930    yr_2: i32,
23931    xs_2: i32,
23932    ys_2: i32,
23933    mosaic_1_options: &Mosaic1Options,
23934) -> Result<VipsImage> {
23935    unsafe {
23936        let refp_in: *mut bindings::VipsImage = refp.ctx;
23937        let sec_in: *mut bindings::VipsImage = sec.ctx;
23938        let direction_in: i32 = direction as i32;
23939        let xr_1_in: i32 = xr_1;
23940        let yr_1_in: i32 = yr_1;
23941        let xs_1_in: i32 = xs_1;
23942        let ys_1_in: i32 = ys_1;
23943        let xr_2_in: i32 = xr_2;
23944        let yr_2_in: i32 = yr_2;
23945        let xs_2_in: i32 = xs_2;
23946        let ys_2_in: i32 = ys_2;
23947        let mut out_out: *mut bindings::VipsImage = null_mut();
23948
23949        let hwindow_in: i32 = mosaic_1_options.hwindow;
23950        let hwindow_in_name = utils::new_c_string("hwindow")?;
23951
23952        let harea_in: i32 = mosaic_1_options.harea;
23953        let harea_in_name = utils::new_c_string("harea")?;
23954
23955        let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
23956        let search_in_name = utils::new_c_string("search")?;
23957
23958        let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
23959        let interpolate_in_name = utils::new_c_string("interpolate")?;
23960
23961        let mblend_in: i32 = mosaic_1_options.mblend;
23962        let mblend_in_name = utils::new_c_string("mblend")?;
23963
23964        let vips_op_response = bindings::vips_mosaic1(
23965            refp_in,
23966            sec_in,
23967            &mut out_out,
23968            direction_in.try_into().unwrap(),
23969            xr_1_in,
23970            yr_1_in,
23971            xs_1_in,
23972            ys_1_in,
23973            xr_2_in,
23974            yr_2_in,
23975            xs_2_in,
23976            ys_2_in,
23977            hwindow_in_name.as_ptr(),
23978            hwindow_in,
23979            harea_in_name.as_ptr(),
23980            harea_in,
23981            search_in_name.as_ptr(),
23982            search_in,
23983            interpolate_in_name.as_ptr(),
23984            interpolate_in,
23985            mblend_in_name.as_ptr(),
23986            mblend_in,
23987            NULL,
23988        );
23989        utils::result(
23990            vips_op_response,
23991            VipsImage { ctx: out_out },
23992            Error::Mosaic1Error,
23993        )
23994    }
23995}
23996
23997/// VipsMatrixinvert (matrixinvert), invert a matrix
23998/// inp: `&VipsImage` -> An square matrix
23999/// returns `VipsImage` - Output matrix
24000pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
24001    unsafe {
24002        let inp_in: *mut bindings::VipsImage = inp.ctx;
24003        let mut out_out: *mut bindings::VipsImage = null_mut();
24004
24005        let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
24006        utils::result(
24007            vips_op_response,
24008            VipsImage { ctx: out_out },
24009            Error::MatrixinvertError,
24010        )
24011    }
24012}
24013
24014/// VipsMatrixmultiply (matrixmultiply), multiply two matrices
24015/// left: `&VipsImage` -> First matrix to multiply
24016/// right: `&VipsImage` -> Second matrix to multiply
24017/// returns `VipsImage` - Output matrix
24018pub fn matrixmultiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24019    unsafe {
24020        let left_in: *mut bindings::VipsImage = left.ctx;
24021        let right_in: *mut bindings::VipsImage = right.ctx;
24022        let mut out_out: *mut bindings::VipsImage = null_mut();
24023
24024        let vips_op_response = bindings::vips_matrixmultiply(left_in, right_in, &mut out_out, NULL);
24025        utils::result(
24026            vips_op_response,
24027            VipsImage { ctx: out_out },
24028            Error::MatrixmultiplyError,
24029        )
24030    }
24031}
24032
24033/// VipsMatch (match), first-order match of two images
24034/// refp: `&VipsImage` -> Reference image
24035/// sec: `&VipsImage` -> Secondary image
24036/// xr_1: `i32` -> Position of first reference tie-point
24037/// min: -1000000000, max: 1000000000, default: 1
24038/// yr_1: `i32` -> Position of first reference tie-point
24039/// min: -1000000000, max: 1000000000, default: 1
24040/// xs_1: `i32` -> Position of first secondary tie-point
24041/// min: -1000000000, max: 1000000000, default: 1
24042/// ys_1: `i32` -> Position of first secondary tie-point
24043/// min: -1000000000, max: 1000000000, default: 1
24044/// xr_2: `i32` -> Position of second reference tie-point
24045/// min: -1000000000, max: 1000000000, default: 1
24046/// yr_2: `i32` -> Position of second reference tie-point
24047/// min: -1000000000, max: 1000000000, default: 1
24048/// xs_2: `i32` -> Position of second secondary tie-point
24049/// min: -1000000000, max: 1000000000, default: 1
24050/// ys_2: `i32` -> Position of second secondary tie-point
24051/// min: -1000000000, max: 1000000000, default: 1
24052/// returns `VipsImage` - Output image
24053pub fn matches(
24054    refp: &VipsImage,
24055    sec: &VipsImage,
24056    xr_1: i32,
24057    yr_1: i32,
24058    xs_1: i32,
24059    ys_1: i32,
24060    xr_2: i32,
24061    yr_2: i32,
24062    xs_2: i32,
24063    ys_2: i32,
24064) -> Result<VipsImage> {
24065    unsafe {
24066        let refp_in: *mut bindings::VipsImage = refp.ctx;
24067        let sec_in: *mut bindings::VipsImage = sec.ctx;
24068        let xr_1_in: i32 = xr_1;
24069        let yr_1_in: i32 = yr_1;
24070        let xs_1_in: i32 = xs_1;
24071        let ys_1_in: i32 = ys_1;
24072        let xr_2_in: i32 = xr_2;
24073        let yr_2_in: i32 = yr_2;
24074        let xs_2_in: i32 = xs_2;
24075        let ys_2_in: i32 = ys_2;
24076        let mut out_out: *mut bindings::VipsImage = null_mut();
24077
24078        let vips_op_response = bindings::vips_match(
24079            refp_in,
24080            sec_in,
24081            &mut out_out,
24082            xr_1_in,
24083            yr_1_in,
24084            xs_1_in,
24085            ys_1_in,
24086            xr_2_in,
24087            yr_2_in,
24088            xs_2_in,
24089            ys_2_in,
24090            NULL,
24091        );
24092        utils::result(
24093            vips_op_response,
24094            VipsImage { ctx: out_out },
24095            Error::MatchError,
24096        )
24097    }
24098}
24099
24100/// Options for matches operation
24101#[derive(Clone, Debug)]
24102pub struct MatchOptions {
24103    /// hwindow: `i32` -> Half window size
24104    /// min: 0, max: 1000000000, default: 5
24105    pub hwindow: i32,
24106    /// harea: `i32` -> Half area size
24107    /// min: 0, max: 1000000000, default: 15
24108    pub harea: i32,
24109    /// search: `bool` -> Search to improve tie-points
24110    /// default: false
24111    pub search: bool,
24112    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
24113    pub interpolate: VipsInterpolate,
24114}
24115
24116impl std::default::Default for MatchOptions {
24117    fn default() -> Self {
24118        MatchOptions {
24119            hwindow: i32::from(5),
24120            harea: i32::from(15),
24121            search: false,
24122            interpolate: VipsInterpolate::new(),
24123        }
24124    }
24125}
24126
24127/// VipsMatch (match), first-order match of two images
24128/// refp: `&VipsImage` -> Reference image
24129/// sec: `&VipsImage` -> Secondary image
24130/// xr_1: `i32` -> Position of first reference tie-point
24131/// min: -1000000000, max: 1000000000, default: 1
24132/// yr_1: `i32` -> Position of first reference tie-point
24133/// min: -1000000000, max: 1000000000, default: 1
24134/// xs_1: `i32` -> Position of first secondary tie-point
24135/// min: -1000000000, max: 1000000000, default: 1
24136/// ys_1: `i32` -> Position of first secondary tie-point
24137/// min: -1000000000, max: 1000000000, default: 1
24138/// xr_2: `i32` -> Position of second reference tie-point
24139/// min: -1000000000, max: 1000000000, default: 1
24140/// yr_2: `i32` -> Position of second reference tie-point
24141/// min: -1000000000, max: 1000000000, default: 1
24142/// xs_2: `i32` -> Position of second secondary tie-point
24143/// min: -1000000000, max: 1000000000, default: 1
24144/// ys_2: `i32` -> Position of second secondary tie-point
24145/// min: -1000000000, max: 1000000000, default: 1
24146/// matches_options: `&MatchOptions` -> optional arguments
24147/// returns `VipsImage` - Output image
24148pub fn matches_with_opts(
24149    refp: &VipsImage,
24150    sec: &VipsImage,
24151    xr_1: i32,
24152    yr_1: i32,
24153    xs_1: i32,
24154    ys_1: i32,
24155    xr_2: i32,
24156    yr_2: i32,
24157    xs_2: i32,
24158    ys_2: i32,
24159    matches_options: &MatchOptions,
24160) -> Result<VipsImage> {
24161    unsafe {
24162        let refp_in: *mut bindings::VipsImage = refp.ctx;
24163        let sec_in: *mut bindings::VipsImage = sec.ctx;
24164        let xr_1_in: i32 = xr_1;
24165        let yr_1_in: i32 = yr_1;
24166        let xs_1_in: i32 = xs_1;
24167        let ys_1_in: i32 = ys_1;
24168        let xr_2_in: i32 = xr_2;
24169        let yr_2_in: i32 = yr_2;
24170        let xs_2_in: i32 = xs_2;
24171        let ys_2_in: i32 = ys_2;
24172        let mut out_out: *mut bindings::VipsImage = null_mut();
24173
24174        let hwindow_in: i32 = matches_options.hwindow;
24175        let hwindow_in_name = utils::new_c_string("hwindow")?;
24176
24177        let harea_in: i32 = matches_options.harea;
24178        let harea_in_name = utils::new_c_string("harea")?;
24179
24180        let search_in: i32 = if matches_options.search { 1 } else { 0 };
24181        let search_in_name = utils::new_c_string("search")?;
24182
24183        let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
24184        let interpolate_in_name = utils::new_c_string("interpolate")?;
24185
24186        let vips_op_response = bindings::vips_match(
24187            refp_in,
24188            sec_in,
24189            &mut out_out,
24190            xr_1_in,
24191            yr_1_in,
24192            xs_1_in,
24193            ys_1_in,
24194            xr_2_in,
24195            yr_2_in,
24196            xs_2_in,
24197            ys_2_in,
24198            hwindow_in_name.as_ptr(),
24199            hwindow_in,
24200            harea_in_name.as_ptr(),
24201            harea_in,
24202            search_in_name.as_ptr(),
24203            search_in,
24204            interpolate_in_name.as_ptr(),
24205            interpolate_in,
24206            NULL,
24207        );
24208        utils::result(
24209            vips_op_response,
24210            VipsImage { ctx: out_out },
24211            Error::MatchError,
24212        )
24213    }
24214}
24215
24216/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24217/// inp: `&VipsImage` -> Input image
24218/// returns `VipsImage` - Output image
24219pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
24220    unsafe {
24221        let inp_in: *mut bindings::VipsImage = inp.ctx;
24222        let mut out_out: *mut bindings::VipsImage = null_mut();
24223
24224        let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
24225        utils::result(
24226            vips_op_response,
24227            VipsImage { ctx: out_out },
24228            Error::GlobalbalanceError,
24229        )
24230    }
24231}
24232
24233/// Options for globalbalance operation
24234#[derive(Clone, Debug)]
24235pub struct GlobalbalanceOptions {
24236    /// gamma: `f64` -> Image gamma
24237    /// min: 0.00001, max: 10, default: 1.6
24238    pub gamma: f64,
24239    /// int_output: `bool` -> Integer output
24240    /// default: false
24241    pub int_output: bool,
24242}
24243
24244impl std::default::Default for GlobalbalanceOptions {
24245    fn default() -> Self {
24246        GlobalbalanceOptions {
24247            gamma: f64::from(1.6),
24248            int_output: false,
24249        }
24250    }
24251}
24252
24253/// VipsGlobalbalance (globalbalance), global balance an image mosaic
24254/// inp: `&VipsImage` -> Input image
24255/// globalbalance_options: `&GlobalbalanceOptions` -> optional arguments
24256/// returns `VipsImage` - Output image
24257pub fn globalbalance_with_opts(
24258    inp: &VipsImage,
24259    globalbalance_options: &GlobalbalanceOptions,
24260) -> Result<VipsImage> {
24261    unsafe {
24262        let inp_in: *mut bindings::VipsImage = inp.ctx;
24263        let mut out_out: *mut bindings::VipsImage = null_mut();
24264
24265        let gamma_in: f64 = globalbalance_options.gamma;
24266        let gamma_in_name = utils::new_c_string("gamma")?;
24267
24268        let int_output_in: i32 = if globalbalance_options.int_output {
24269            1
24270        } else {
24271            0
24272        };
24273        let int_output_in_name = utils::new_c_string("int-output")?;
24274
24275        let vips_op_response = bindings::vips_globalbalance(
24276            inp_in,
24277            &mut out_out,
24278            gamma_in_name.as_ptr(),
24279            gamma_in,
24280            int_output_in_name.as_ptr(),
24281            int_output_in,
24282            NULL,
24283        );
24284        utils::result(
24285            vips_op_response,
24286            VipsImage { ctx: out_out },
24287            Error::GlobalbalanceError,
24288        )
24289    }
24290}
24291
24292/// VipsRemosaic (remosaic), rebuild an mosaiced image
24293/// inp: `&VipsImage` -> Input image
24294/// old_str: `&str` -> Search for this string
24295/// new_str: `&str` -> And swap for this string
24296/// returns `VipsImage` - Output image
24297pub fn remosaic(inp: &VipsImage, old_str: &str, new_str: &str) -> Result<VipsImage> {
24298    unsafe {
24299        let inp_in: *mut bindings::VipsImage = inp.ctx;
24300        let old_str_in: CString = utils::new_c_string(old_str)?;
24301        let new_str_in: CString = utils::new_c_string(new_str)?;
24302        let mut out_out: *mut bindings::VipsImage = null_mut();
24303
24304        let vips_op_response = bindings::vips_remosaic(
24305            inp_in,
24306            &mut out_out,
24307            old_str_in.as_ptr(),
24308            new_str_in.as_ptr(),
24309            NULL,
24310        );
24311        utils::result(
24312            vips_op_response,
24313            VipsImage { ctx: out_out },
24314            Error::RemosaicError,
24315        )
24316    }
24317}