libvips_rs/
ops.rs

1// (c) Copyright 2019-2023 MIT
2use crate::bindings;
3use crate::error::*;
4use crate::utils;
5use crate::Result;
6use crate::VipsBlob;
7use crate::VipsImage;
8use crate::VipsInterpolate;
9use crate::VipsSource;
10use crate::VipsTarget;
11use std::convert::TryInto;
12use std::ffi::*;
13use std::ptr::null_mut;
14
15const NULL: *const c_void = null_mut();
16
17include!("manual.rs");
18
19#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
20pub enum Access {
21    ///  `Random` -> VIPS_ACCESS_RANDOM = 0
22    Random = 0,
23    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
24    Sequential = 1,
25    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
26    SequentialUnbuffered = 2,
27    ///  `Last` -> VIPS_ACCESS_LAST = 3
28    Last = 3,
29}
30
31#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
32pub enum Align {
33    ///  `Low` -> VIPS_ALIGN_LOW = 0
34    Low = 0,
35    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
36    Centre = 1,
37    ///  `High` -> VIPS_ALIGN_HIGH = 2
38    High = 2,
39    ///  `Last` -> VIPS_ALIGN_LAST = 3
40    Last = 3,
41}
42
43#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
44pub enum Angle {
45    ///  `D0` -> VIPS_ANGLE_D0 = 0
46    D0 = 0,
47    ///  `D90` -> VIPS_ANGLE_D90 = 1
48    D90 = 1,
49    ///  `D180` -> VIPS_ANGLE_D180 = 2
50    D180 = 2,
51    ///  `D270` -> VIPS_ANGLE_D270 = 3
52    D270 = 3,
53    ///  `Last` -> VIPS_ANGLE_LAST = 4
54    Last = 4,
55}
56
57#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
58pub enum Angle45 {
59    ///  `D0` -> VIPS_ANGLE45_D0 = 0
60    D0 = 0,
61    ///  `D45` -> VIPS_ANGLE45_D45 = 1
62    D45 = 1,
63    ///  `D90` -> VIPS_ANGLE45_D90 = 2
64    D90 = 2,
65    ///  `D135` -> VIPS_ANGLE45_D135 = 3
66    D135 = 3,
67    ///  `D180` -> VIPS_ANGLE45_D180 = 4
68    D180 = 4,
69    ///  `D225` -> VIPS_ANGLE45_D225 = 5
70    D225 = 5,
71    ///  `D270` -> VIPS_ANGLE45_D270 = 6
72    D270 = 6,
73    ///  `D315` -> VIPS_ANGLE45_D315 = 7
74    D315 = 7,
75    ///  `Last` -> VIPS_ANGLE45_LAST = 8
76    Last = 8,
77}
78
79#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
80pub enum BandFormat {
81    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
82    Notset = -1,
83    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0
84    Uchar = 0,
85    ///  `Char` -> VIPS_FORMAT_CHAR = 1
86    Char = 1,
87    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
88    Ushort = 2,
89    ///  `Short` -> VIPS_FORMAT_SHORT = 3
90    Short = 3,
91    ///  `Uint` -> VIPS_FORMAT_UINT = 4
92    Uint = 4,
93    ///  `Int` -> VIPS_FORMAT_INT = 5
94    Int = 5,
95    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
96    Float = 6,
97    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
98    Complex = 7,
99    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
100    Double = 8,
101    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
102    Dpcomplex = 9,
103    ///  `Last` -> VIPS_FORMAT_LAST = 10
104    Last = 10,
105}
106
107#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
108pub enum BlendMode {
109    ///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
110    Clear = 0,
111    ///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
112    Source = 1,
113    ///  `Over` -> VIPS_BLEND_MODE_OVER = 2
114    Over = 2,
115    ///  `In` -> VIPS_BLEND_MODE_IN = 3
116    In = 3,
117    ///  `Out` -> VIPS_BLEND_MODE_OUT = 4
118    Out = 4,
119    ///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
120    Atop = 5,
121    ///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
122    Dest = 6,
123    ///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
124    DestOver = 7,
125    ///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
126    DestIn = 8,
127    ///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
128    DestOut = 9,
129    ///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
130    DestAtop = 10,
131    ///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
132    Xor = 11,
133    ///  `Add` -> VIPS_BLEND_MODE_ADD = 12
134    Add = 12,
135    ///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
136    Saturate = 13,
137    ///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
138    Multiply = 14,
139    ///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
140    Screen = 15,
141    ///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
142    Overlay = 16,
143    ///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
144    Darken = 17,
145    ///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
146    Lighten = 18,
147    ///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
148    ColourDodge = 19,
149    ///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
150    ColourBurn = 20,
151    ///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
152    HardLight = 21,
153    ///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
154    SoftLight = 22,
155    ///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
156    Difference = 23,
157    ///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
158    Exclusion = 24,
159    ///  `Last` -> VIPS_BLEND_MODE_LAST = 25
160    Last = 25,
161}
162
163#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
164pub enum Coding {
165    ///  `Error` -> VIPS_CODING_ERROR = -1
166    Error = -1,
167    ///  `None` -> VIPS_CODING_NONE = 0
168    None = 0,
169    ///  `Labq` -> VIPS_CODING_LABQ = 2
170    Labq = 2,
171    ///  `Rad` -> VIPS_CODING_RAD = 6
172    Rad = 6,
173    ///  `Last` -> VIPS_CODING_LAST = 7
174    Last = 7,
175}
176
177#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
178pub enum Combine {
179    ///  `Max` -> VIPS_COMBINE_MAX = 0
180    Max = 0,
181    ///  `Sum` -> VIPS_COMBINE_SUM = 1
182    Sum = 1,
183    ///  `Min` -> VIPS_COMBINE_MIN = 2
184    Min = 2,
185    ///  `Last` -> VIPS_COMBINE_LAST = 3
186    Last = 3,
187}
188
189#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
190pub enum CombineMode {
191    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0
192    Set = 0,
193    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
194    Add = 1,
195    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
196    Last = 2,
197}
198
199#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
200pub enum CompassDirection {
201    ///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0
202    Centre = 0,
203    ///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
204    North = 1,
205    ///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
206    East = 2,
207    ///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
208    South = 3,
209    ///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
210    West = 4,
211    ///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
212    NorthEast = 5,
213    ///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
214    SouthEast = 6,
215    ///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
216    SouthWest = 7,
217    ///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
218    NorthWest = 8,
219    ///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
220    Last = 9,
221}
222
223#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
224pub enum Direction {
225    ///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0
226    Horizontal = 0,
227    ///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
228    Vertical = 1,
229    ///  `Last` -> VIPS_DIRECTION_LAST = 2
230    Last = 2,
231}
232
233#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
234pub enum Extend {
235    ///  `Black` -> VIPS_EXTEND_BLACK = 0
236    Black = 0,
237    ///  `Copy` -> VIPS_EXTEND_COPY = 1
238    Copy = 1,
239    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
240    Repeat = 2,
241    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
242    Mirror = 3,
243    ///  `White` -> VIPS_EXTEND_WHITE = 4
244    White = 4,
245    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
246    Background = 5,
247    ///  `Last` -> VIPS_EXTEND_LAST = 6
248    Last = 6,
249}
250
251#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
252pub enum FailOn {
253    ///  `None` -> VIPS_FAIL_ON_NONE = 0
254    None = 0,
255    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
256    Truncated = 1,
257    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
258    Error = 2,
259    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
260    Warning = 3,
261    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
262    Last = 4,
263}
264
265#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
266pub enum ForeignDzContainer {
267    ///  `F` -> VIPS_FOREIGN_DZ_CONTAINER_FS = 0
268    F = 0,
269    ///  `Zip` -> VIPS_FOREIGN_DZ_CONTAINER_ZIP = 1
270    Zip = 1,
271    ///  `Szi` -> VIPS_FOREIGN_DZ_CONTAINER_SZI = 2
272    Szi = 2,
273    ///  `Last` -> VIPS_FOREIGN_DZ_CONTAINER_LAST = 3
274    Last = 3,
275}
276
277#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
278pub enum ForeignDzDepth {
279    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
280    Onepixel = 0,
281    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
282    Onetile = 1,
283    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
284    One = 2,
285    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
286    Last = 3,
287}
288
289#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
290pub enum ForeignDzLayout {
291    ///  `Dz` -> VIPS_FOREIGN_DZ_LAYOUT_DZ = 0
292    Dz = 0,
293    ///  `Zoomify` -> VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY = 1
294    Zoomify = 1,
295    ///  `Google` -> VIPS_FOREIGN_DZ_LAYOUT_GOOGLE = 2
296    Google = 2,
297    ///  `Iiif` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF = 3
298    Iiif = 3,
299    ///  `Iiif3` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF3 = 4
300    Iiif3 = 4,
301    ///  `Last` -> VIPS_FOREIGN_DZ_LAYOUT_LAST = 5
302    Last = 5,
303}
304
305#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
306pub enum ForeignFlags {
307    ///  `None` -> VIPS_FOREIGN_NONE = 0
308    None = 0,
309    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
310    Partial = 1,
311    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
312    Bigendian = 2,
313    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
314    Sequential = 4,
315    ///  `All` -> VIPS_FOREIGN_ALL = 7
316    All = 7,
317}
318
319#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
320pub enum ForeignHeifCompression {
321    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1
322    Hevc = 1,
323    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
324    Avc = 2,
325    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
326    Jpeg = 3,
327    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
328    Av1 = 4,
329    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
330    Last = 5,
331}
332
333#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
334pub enum ForeignHeifEncoder {
335    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0
336    Auto = 0,
337    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
338    Aom = 1,
339    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
340    Rav1E = 2,
341    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
342    Svt = 3,
343    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
344    X265 = 4,
345    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
346    Last = 5,
347}
348
349#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
350pub enum ForeignKeep {
351    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
352    None = 0,
353    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
354    Exif = 1,
355    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
356    Xmp = 2,
357    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
358    Iptc = 4,
359    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
360    Icc = 8,
361    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
362    Other = 16,
363    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31
364    All = 31,
365}
366
367#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
368pub enum ForeignPngFilter {
369    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8
370    None = 8,
371    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
372    Sub = 16,
373    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
374    Up = 32,
375    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
376    Avg = 64,
377    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
378    Paeth = 128,
379    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
380    All = 248,
381}
382
383#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
384pub enum ForeignPpmFormat {
385    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
386    Pbm = 0,
387    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
388    Pgm = 1,
389    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2
390    Ppm = 2,
391    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
392    Pfm = 3,
393    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
394    Pnm = 4,
395    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
396    Last = 5,
397}
398
399#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
400pub enum ForeignSubsample {
401    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
402    Auto = 0,
403    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
404    On = 1,
405    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
406    Off = 2,
407    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
408    Last = 3,
409}
410
411#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
412pub enum ForeignTiffCompression {
413    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0
414    None = 0,
415    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
416    Jpeg = 1,
417    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
418    Deflate = 2,
419    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
420    Packbit = 3,
421    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
422    Ccittfax4 = 4,
423    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
424    Lzw = 5,
425    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
426    Webp = 6,
427    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
428    Zstd = 7,
429    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
430    Jp2K = 8,
431    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
432    Last = 9,
433}
434
435#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
436pub enum ForeignTiffPredictor {
437    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
438    None = 1,
439    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2
440    Horizontal = 2,
441    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
442    Float = 3,
443    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
444    Last = 4,
445}
446
447#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
448pub enum ForeignTiffResunit {
449    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0
450    Cm = 0,
451    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
452    Inch = 1,
453    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
454    Last = 2,
455}
456
457#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
458pub enum ForeignWebpPreset {
459    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0
460    Default = 0,
461    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
462    Picture = 1,
463    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
464    Photo = 2,
465    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
466    Drawing = 3,
467    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
468    Icon = 4,
469    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
470    Text = 5,
471    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
472    Last = 6,
473}
474
475#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
476pub enum Intent {
477    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
478    Perceptual = 0,
479    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1
480    Relative = 1,
481    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
482    Saturation = 2,
483    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
484    Absolute = 3,
485    ///  `Last` -> VIPS_INTENT_LAST = 4
486    Last = 4,
487}
488
489#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
490pub enum Interesting {
491    ///  `None` -> VIPS_INTERESTING_NONE = 0
492    None = 0,
493    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
494    Centre = 1,
495    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
496    Entropy = 2,
497    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
498    Attention = 3,
499    ///  `Low` -> VIPS_INTERESTING_LOW = 4
500    Low = 4,
501    ///  `High` -> VIPS_INTERESTING_HIGH = 5
502    High = 5,
503    ///  `All` -> VIPS_INTERESTING_ALL = 6
504    All = 6,
505    ///  `Last` -> VIPS_INTERESTING_LAST = 7
506    Last = 7,
507}
508
509#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
510pub enum Interpretation {
511    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
512    Error = -1,
513    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
514    Multiband = 0,
515    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
516    BW = 1,
517    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
518    Histogram = 10,
519    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
520    Xyz = 12,
521    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
522    Lab = 13,
523    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
524    Cmyk = 15,
525    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
526    Labq = 16,
527    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
528    Rgb = 17,
529    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
530    Cmc = 18,
531    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
532    Lch = 19,
533    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
534    Labs = 21,
535    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
536    Srgb = 22,
537    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
538    Yxy = 23,
539    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
540    Fourier = 24,
541    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
542    Rgb16 = 25,
543    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
544    Grey16 = 26,
545    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
546    Matrix = 27,
547    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
548    Scrgb = 28,
549    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
550    Hsv = 29,
551    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
552    Last = 30,
553}
554
555#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
556pub enum Kernel {
557    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
558    Nearest = 0,
559    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
560    Linear = 1,
561    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
562    Cubic = 2,
563    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
564    Mitchell = 3,
565    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
566    Lanczos2 = 4,
567    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5
568    Lanczos3 = 5,
569    ///  `Last` -> VIPS_KERNEL_LAST = 6
570    Last = 6,
571}
572
573#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
574pub enum OperationBoolean {
575    ///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0
576    And = 0,
577    ///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
578    Or = 1,
579    ///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
580    Eor = 2,
581    ///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
582    Lshift = 3,
583    ///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
584    Rshift = 4,
585    ///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
586    Last = 5,
587}
588
589#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
590pub enum OperationComplex {
591    ///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0
592    Polar = 0,
593    ///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
594    Rect = 1,
595    ///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
596    Conj = 2,
597    ///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
598    Last = 3,
599}
600
601#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
602pub enum OperationComplex2 {
603    ///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0
604    CrossPhase = 0,
605    ///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
606    Last = 1,
607}
608
609#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
610pub enum OperationComplexget {
611    ///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0
612    Real = 0,
613    ///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
614    Imag = 1,
615    ///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
616    Last = 2,
617}
618
619#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
620pub enum OperationMath {
621    ///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0
622    Sin = 0,
623    ///  `Co` -> VIPS_OPERATION_MATH_COS = 1
624    Co = 1,
625    ///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
626    Tan = 2,
627    ///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
628    Asin = 3,
629    ///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
630    Aco = 4,
631    ///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
632    Atan = 5,
633    ///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
634    Log = 6,
635    ///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
636    Log10 = 7,
637    ///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
638    Exp = 8,
639    ///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
640    Exp10 = 9,
641    ///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
642    Sinh = 10,
643    ///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
644    Cosh = 11,
645    ///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
646    Tanh = 12,
647    ///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
648    Asinh = 13,
649    ///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
650    Acosh = 14,
651    ///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
652    Atanh = 15,
653    ///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
654    Last = 16,
655}
656
657#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
658pub enum OperationMath2 {
659    ///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0
660    Pow = 0,
661    ///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
662    Wop = 1,
663    ///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
664    Atan2 = 2,
665    ///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
666    Last = 3,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum OperationMorphology {
671    ///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0
672    Erode = 0,
673    ///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
674    Dilate = 1,
675    ///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
676    Last = 2,
677}
678
679#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
680pub enum OperationRelational {
681    ///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0
682    Equal = 0,
683    ///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
684    Noteq = 1,
685    ///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
686    Less = 2,
687    ///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
688    Lesseq = 3,
689    ///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
690    More = 4,
691    ///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
692    Moreeq = 5,
693    ///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
694    Last = 6,
695}
696
697#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
698pub enum OperationRound {
699    ///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0
700    Rint = 0,
701    ///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
702    Ceil = 1,
703    ///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
704    Floor = 2,
705    ///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
706    Last = 3,
707}
708
709#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
710pub enum PCS {
711    ///  `Lab` -> VIPS_PCS_LAB = 0
712    Lab = 0,
713    ///  `Xyz` -> VIPS_PCS_XYZ = 1
714    Xyz = 1,
715    ///  `Last` -> VIPS_PCS_LAST = 2
716    Last = 2,
717}
718
719#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
720pub enum Precision {
721    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
722    Integer = 0,
723    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
724    Float = 1,
725    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
726    Approximate = 2,
727    ///  `Last` -> VIPS_PRECISION_LAST = 3
728    Last = 3,
729}
730
731#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
732pub enum RegionShrink {
733    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0
734    Mean = 0,
735    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
736    Median = 1,
737    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
738    Mode = 2,
739    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
740    Max = 3,
741    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
742    Min = 4,
743    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
744    Nearest = 5,
745    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
746    Last = 6,
747}
748
749#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
750pub enum Size {
751    ///  `Both` -> VIPS_SIZE_BOTH = 0
752    Both = 0,
753    ///  `Up` -> VIPS_SIZE_UP = 1
754    Up = 1,
755    ///  `Down` -> VIPS_SIZE_DOWN = 2
756    Down = 2,
757    ///  `Force` -> VIPS_SIZE_FORCE = 3
758    Force = 3,
759    ///  `Last` -> VIPS_SIZE_LAST = 4
760    Last = 4,
761}
762
763#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
764pub enum TextWrap {
765    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0
766    Word = 0,
767    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
768    Char = 1,
769    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
770    WordChar = 2,
771    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
772    None = 3,
773    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
774    Last = 4,
775}
776
777/// VipsSystem (system), run an external command
778/// cmd_format: `&str` -> Command to run
779
780pub fn system(cmd_format: &str) -> Result<()> {
781    unsafe {
782        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
783
784        let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
785        utils::result(vips_op_response, (), Error::SystemError)
786    }
787}
788
789/// Options for system operation
790#[derive(Clone, Debug)]
791pub struct SystemOptions {
792    /// inp: `Vec<VipsImage>` -> Array of input images
793    pub inp: Vec<VipsImage>,
794    /// out: `VipsImage` -> Output image
795    pub out: VipsImage,
796    /// log: `String` -> Command log
797    pub log: String,
798    /// out_format: `String` -> Format for output filename
799    pub out_format: String,
800    /// in_format: `String` -> Format for input filename
801    pub in_format: String,
802}
803
804impl std::default::Default for SystemOptions {
805    fn default() -> Self {
806        SystemOptions {
807            inp: Vec::new(),
808            out: VipsImage::new(),
809            log: String::new(),
810            out_format: String::new(),
811            in_format: String::new(),
812        }
813    }
814}
815
816/// VipsSystem (system), run an external command
817/// cmd_format: `&str` -> Command to run
818/// system_options: `&SystemOptions` -> optional arguments
819
820pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
821    unsafe {
822        let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
823
824        let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
825        let inp_in = inp_wrapper.ctx;
826        let inp_in_name = utils::new_c_string("inp")?;
827
828        let out_in: *mut bindings::VipsImage = system_options.out.ctx;
829        let out_in_name = utils::new_c_string("out")?;
830
831        let log_in: CString = utils::new_c_string(&system_options.log)?;
832        let log_in_name = utils::new_c_string("log")?;
833
834        let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
835        let out_format_in_name = utils::new_c_string("out-format")?;
836
837        let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
838        let in_format_in_name = utils::new_c_string("in-format")?;
839
840        let vips_op_response = bindings::vips_system(
841            cmd_format_in.as_ptr(),
842            inp_in_name.as_ptr(),
843            inp_in,
844            out_in_name.as_ptr(),
845            out_in,
846            log_in_name.as_ptr(),
847            log_in.as_ptr(),
848            out_format_in_name.as_ptr(),
849            out_format_in.as_ptr(),
850            in_format_in_name.as_ptr(),
851            in_format_in.as_ptr(),
852            NULL,
853        );
854        utils::result(vips_op_response, (), Error::SystemError)
855    }
856}
857
858/// VipsAdd (add), add two images
859/// left: `&VipsImage` -> Left-hand image argument
860/// right: `&VipsImage` -> Right-hand image argument
861/// returns `VipsImage` - Output image
862pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
863    unsafe {
864        let left_in: *mut bindings::VipsImage = left.ctx;
865        let right_in: *mut bindings::VipsImage = right.ctx;
866        let mut out_out: *mut bindings::VipsImage = null_mut();
867
868        let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
869        utils::result(
870            vips_op_response,
871            VipsImage { ctx: out_out },
872            Error::AddError,
873        )
874    }
875}
876
877/// VipsSubtract (subtract), subtract two images
878/// left: `&VipsImage` -> Left-hand image argument
879/// right: `&VipsImage` -> Right-hand image argument
880/// returns `VipsImage` - Output image
881pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
882    unsafe {
883        let left_in: *mut bindings::VipsImage = left.ctx;
884        let right_in: *mut bindings::VipsImage = right.ctx;
885        let mut out_out: *mut bindings::VipsImage = null_mut();
886
887        let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
888        utils::result(
889            vips_op_response,
890            VipsImage { ctx: out_out },
891            Error::SubtractError,
892        )
893    }
894}
895
896/// VipsMultiply (multiply), multiply two images
897/// left: `&VipsImage` -> Left-hand image argument
898/// right: `&VipsImage` -> Right-hand image argument
899/// returns `VipsImage` - Output image
900pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
901    unsafe {
902        let left_in: *mut bindings::VipsImage = left.ctx;
903        let right_in: *mut bindings::VipsImage = right.ctx;
904        let mut out_out: *mut bindings::VipsImage = null_mut();
905
906        let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
907        utils::result(
908            vips_op_response,
909            VipsImage { ctx: out_out },
910            Error::MultiplyError,
911        )
912    }
913}
914
915/// VipsDivide (divide), divide two images
916/// left: `&VipsImage` -> Left-hand image argument
917/// right: `&VipsImage` -> Right-hand image argument
918/// returns `VipsImage` - Output image
919pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
920    unsafe {
921        let left_in: *mut bindings::VipsImage = left.ctx;
922        let right_in: *mut bindings::VipsImage = right.ctx;
923        let mut out_out: *mut bindings::VipsImage = null_mut();
924
925        let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
926        utils::result(
927            vips_op_response,
928            VipsImage { ctx: out_out },
929            Error::DivideError,
930        )
931    }
932}
933
934/// VipsRelational (relational), relational operation on two images
935/// left: `&VipsImage` -> Left-hand image argument
936/// right: `&VipsImage` -> Right-hand image argument
937/// relational: `OperationRelational` -> Relational to perform
938///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
939///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
940///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
941///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
942///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
943///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
944///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
945/// returns `VipsImage` - Output image
946pub fn relational(
947    left: &VipsImage,
948    right: &VipsImage,
949    relational: OperationRelational,
950) -> Result<VipsImage> {
951    unsafe {
952        let left_in: *mut bindings::VipsImage = left.ctx;
953        let right_in: *mut bindings::VipsImage = right.ctx;
954        let relational_in: i32 = relational as i32;
955        let mut out_out: *mut bindings::VipsImage = null_mut();
956
957        let vips_op_response = bindings::vips_relational(
958            left_in,
959            right_in,
960            &mut out_out,
961            relational_in.try_into().unwrap(),
962            NULL,
963        );
964        utils::result(
965            vips_op_response,
966            VipsImage { ctx: out_out },
967            Error::RelationalError,
968        )
969    }
970}
971
972/// VipsRemainder (remainder), remainder after integer division of two images
973/// left: `&VipsImage` -> Left-hand image argument
974/// right: `&VipsImage` -> Right-hand image argument
975/// returns `VipsImage` - Output image
976pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
977    unsafe {
978        let left_in: *mut bindings::VipsImage = left.ctx;
979        let right_in: *mut bindings::VipsImage = right.ctx;
980        let mut out_out: *mut bindings::VipsImage = null_mut();
981
982        let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
983        utils::result(
984            vips_op_response,
985            VipsImage { ctx: out_out },
986            Error::RemainderError,
987        )
988    }
989}
990
991/// VipsBoolean (boolean), boolean operation on two images
992/// left: `&VipsImage` -> Left-hand image argument
993/// right: `&VipsImage` -> Right-hand image argument
994/// boolean: `OperationBoolean` -> Boolean to perform
995///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
996///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
997///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
998///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
999///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1000///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
1001/// returns `VipsImage` - Output image
1002pub fn boolean(
1003    left: &VipsImage,
1004    right: &VipsImage,
1005    boolean: OperationBoolean,
1006) -> Result<VipsImage> {
1007    unsafe {
1008        let left_in: *mut bindings::VipsImage = left.ctx;
1009        let right_in: *mut bindings::VipsImage = right.ctx;
1010        let boolean_in: i32 = boolean as i32;
1011        let mut out_out: *mut bindings::VipsImage = null_mut();
1012
1013        let vips_op_response = bindings::vips_boolean(
1014            left_in,
1015            right_in,
1016            &mut out_out,
1017            boolean_in.try_into().unwrap(),
1018            NULL,
1019        );
1020        utils::result(
1021            vips_op_response,
1022            VipsImage { ctx: out_out },
1023            Error::BooleanError,
1024        )
1025    }
1026}
1027
1028/// VipsMath2 (math2), binary math operations
1029/// left: `&VipsImage` -> Left-hand image argument
1030/// right: `&VipsImage` -> Right-hand image argument
1031/// math_2: `OperationMath2` -> Math to perform
1032///  `Pow` -> VIPS_OPERATION_MATH2_POW = 0 [DEFAULT]
1033///  `Wop` -> VIPS_OPERATION_MATH2_WOP = 1
1034///  `Atan2` -> VIPS_OPERATION_MATH2_ATAN2 = 2
1035///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1036/// returns `VipsImage` - Output image
1037pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1038    unsafe {
1039        let left_in: *mut bindings::VipsImage = left.ctx;
1040        let right_in: *mut bindings::VipsImage = right.ctx;
1041        let math_2_in: i32 = math_2 as i32;
1042        let mut out_out: *mut bindings::VipsImage = null_mut();
1043
1044        let vips_op_response = bindings::vips_math2(
1045            left_in,
1046            right_in,
1047            &mut out_out,
1048            math_2_in.try_into().unwrap(),
1049            NULL,
1050        );
1051        utils::result(
1052            vips_op_response,
1053            VipsImage { ctx: out_out },
1054            Error::Math2Error,
1055        )
1056    }
1057}
1058
1059/// VipsComplex2 (complex2), complex binary operations on two images
1060/// left: `&VipsImage` -> Left-hand image argument
1061/// right: `&VipsImage` -> Right-hand image argument
1062/// cmplx: `OperationComplex2` -> Binary complex operation to perform
1063///  `CrossPhase` -> VIPS_OPERATION_COMPLEX2_CROSS_PHASE = 0 [DEFAULT]
1064///  `Last` -> VIPS_OPERATION_COMPLEX2_LAST = 1
1065/// returns `VipsImage` - Output image
1066pub fn complex_2(
1067    left: &VipsImage,
1068    right: &VipsImage,
1069    cmplx: OperationComplex2,
1070) -> Result<VipsImage> {
1071    unsafe {
1072        let left_in: *mut bindings::VipsImage = left.ctx;
1073        let right_in: *mut bindings::VipsImage = right.ctx;
1074        let cmplx_in: i32 = cmplx as i32;
1075        let mut out_out: *mut bindings::VipsImage = null_mut();
1076
1077        let vips_op_response = bindings::vips_complex2(
1078            left_in,
1079            right_in,
1080            &mut out_out,
1081            cmplx_in.try_into().unwrap(),
1082            NULL,
1083        );
1084        utils::result(
1085            vips_op_response,
1086            VipsImage { ctx: out_out },
1087            Error::Complex2Error,
1088        )
1089    }
1090}
1091
1092/// VipsComplexform (complexform), form a complex image from two real images
1093/// left: `&VipsImage` -> Left-hand image argument
1094/// right: `&VipsImage` -> Right-hand image argument
1095/// returns `VipsImage` - Output image
1096pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1097    unsafe {
1098        let left_in: *mut bindings::VipsImage = left.ctx;
1099        let right_in: *mut bindings::VipsImage = right.ctx;
1100        let mut out_out: *mut bindings::VipsImage = null_mut();
1101
1102        let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1103        utils::result(
1104            vips_op_response,
1105            VipsImage { ctx: out_out },
1106            Error::ComplexformError,
1107        )
1108    }
1109}
1110
1111/// VipsSum (sum), sum an array of images
1112/// inp: `&mut [VipsImage]` -> Array of input images
1113/// returns `VipsImage` - Output image
1114pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1115    unsafe {
1116        let (inp_len, mut inp_in) = {
1117            let len = inp.len();
1118            let mut input = Vec::new();
1119            for img in inp {
1120                input.push(img.ctx)
1121            }
1122            (len as i32, input)
1123        };
1124        let mut out_out: *mut bindings::VipsImage = null_mut();
1125
1126        let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1127        utils::result(
1128            vips_op_response,
1129            VipsImage { ctx: out_out },
1130            Error::SumError,
1131        )
1132    }
1133}
1134
1135/// VipsInvert (invert), invert an image
1136/// inp: `&VipsImage` -> Input image
1137/// returns `VipsImage` - Output image
1138pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1139    unsafe {
1140        let inp_in: *mut bindings::VipsImage = inp.ctx;
1141        let mut out_out: *mut bindings::VipsImage = null_mut();
1142
1143        let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1144        utils::result(
1145            vips_op_response,
1146            VipsImage { ctx: out_out },
1147            Error::InvertError,
1148        )
1149    }
1150}
1151
1152/// VipsMath (math), apply a math operation to an image
1153/// inp: `&VipsImage` -> Input image
1154/// math: `OperationMath` -> Math to perform
1155///  `Sin` -> VIPS_OPERATION_MATH_SIN = 0 [DEFAULT]
1156///  `Co` -> VIPS_OPERATION_MATH_COS = 1
1157///  `Tan` -> VIPS_OPERATION_MATH_TAN = 2
1158///  `Asin` -> VIPS_OPERATION_MATH_ASIN = 3
1159///  `Aco` -> VIPS_OPERATION_MATH_ACOS = 4
1160///  `Atan` -> VIPS_OPERATION_MATH_ATAN = 5
1161///  `Log` -> VIPS_OPERATION_MATH_LOG = 6
1162///  `Log10` -> VIPS_OPERATION_MATH_LOG10 = 7
1163///  `Exp` -> VIPS_OPERATION_MATH_EXP = 8
1164///  `Exp10` -> VIPS_OPERATION_MATH_EXP10 = 9
1165///  `Sinh` -> VIPS_OPERATION_MATH_SINH = 10
1166///  `Cosh` -> VIPS_OPERATION_MATH_COSH = 11
1167///  `Tanh` -> VIPS_OPERATION_MATH_TANH = 12
1168///  `Asinh` -> VIPS_OPERATION_MATH_ASINH = 13
1169///  `Acosh` -> VIPS_OPERATION_MATH_ACOSH = 14
1170///  `Atanh` -> VIPS_OPERATION_MATH_ATANH = 15
1171///  `Last` -> VIPS_OPERATION_MATH_LAST = 16
1172/// returns `VipsImage` - Output image
1173pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1174    unsafe {
1175        let inp_in: *mut bindings::VipsImage = inp.ctx;
1176        let math_in: i32 = math as i32;
1177        let mut out_out: *mut bindings::VipsImage = null_mut();
1178
1179        let vips_op_response =
1180            bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1181        utils::result(
1182            vips_op_response,
1183            VipsImage { ctx: out_out },
1184            Error::MathError,
1185        )
1186    }
1187}
1188
1189/// VipsAbs (abs), absolute value of an image
1190/// inp: `&VipsImage` -> Input image
1191/// returns `VipsImage` - Output image
1192pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1193    unsafe {
1194        let inp_in: *mut bindings::VipsImage = inp.ctx;
1195        let mut out_out: *mut bindings::VipsImage = null_mut();
1196
1197        let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1198        utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1199    }
1200}
1201
1202/// VipsSign (sign), unit vector of pixel
1203/// inp: `&VipsImage` -> Input image
1204/// returns `VipsImage` - Output image
1205pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1206    unsafe {
1207        let inp_in: *mut bindings::VipsImage = inp.ctx;
1208        let mut out_out: *mut bindings::VipsImage = null_mut();
1209
1210        let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1211        utils::result(
1212            vips_op_response,
1213            VipsImage { ctx: out_out },
1214            Error::SignError,
1215        )
1216    }
1217}
1218
1219/// VipsRound (round), perform a round function on an image
1220/// inp: `&VipsImage` -> Input image
1221/// round: `OperationRound` -> Rounding operation to perform
1222///  `Rint` -> VIPS_OPERATION_ROUND_RINT = 0 [DEFAULT]
1223///  `Ceil` -> VIPS_OPERATION_ROUND_CEIL = 1
1224///  `Floor` -> VIPS_OPERATION_ROUND_FLOOR = 2
1225///  `Last` -> VIPS_OPERATION_ROUND_LAST = 3
1226/// returns `VipsImage` - Output image
1227pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1228    unsafe {
1229        let inp_in: *mut bindings::VipsImage = inp.ctx;
1230        let round_in: i32 = round as i32;
1231        let mut out_out: *mut bindings::VipsImage = null_mut();
1232
1233        let vips_op_response =
1234            bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1235        utils::result(
1236            vips_op_response,
1237            VipsImage { ctx: out_out },
1238            Error::RoundError,
1239        )
1240    }
1241}
1242
1243/// VipsRelationalConst (relational_const), relational operations against a constant
1244/// inp: `&VipsImage` -> Input image
1245/// relational: `OperationRelational` -> Relational to perform
1246///  `Equal` -> VIPS_OPERATION_RELATIONAL_EQUAL = 0 [DEFAULT]
1247///  `Noteq` -> VIPS_OPERATION_RELATIONAL_NOTEQ = 1
1248///  `Less` -> VIPS_OPERATION_RELATIONAL_LESS = 2
1249///  `Lesseq` -> VIPS_OPERATION_RELATIONAL_LESSEQ = 3
1250///  `More` -> VIPS_OPERATION_RELATIONAL_MORE = 4
1251///  `Moreeq` -> VIPS_OPERATION_RELATIONAL_MOREEQ = 5
1252///  `Last` -> VIPS_OPERATION_RELATIONAL_LAST = 6
1253/// c: `&mut [f64]` -> Array of constants
1254/// returns `VipsImage` - Output image
1255pub fn relational_const(
1256    inp: &VipsImage,
1257    relational: OperationRelational,
1258    c: &mut [f64],
1259) -> Result<VipsImage> {
1260    unsafe {
1261        let inp_in: *mut bindings::VipsImage = inp.ctx;
1262        let relational_in: i32 = relational as i32;
1263        let c_in: *mut f64 = c.as_mut_ptr();
1264        let mut out_out: *mut bindings::VipsImage = null_mut();
1265
1266        let vips_op_response = bindings::vips_relational_const(
1267            inp_in,
1268            &mut out_out,
1269            relational_in.try_into().unwrap(),
1270            c_in,
1271            c.len() as i32,
1272            NULL,
1273        );
1274        utils::result(
1275            vips_op_response,
1276            VipsImage { ctx: out_out },
1277            Error::RelationalConstError,
1278        )
1279    }
1280}
1281
1282/// VipsRemainderConst (remainder_const), remainder after integer division of an image and a constant
1283/// inp: `&VipsImage` -> Input image
1284/// c: `&mut [f64]` -> Array of constants
1285/// returns `VipsImage` - Output image
1286pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1287    unsafe {
1288        let inp_in: *mut bindings::VipsImage = inp.ctx;
1289        let c_in: *mut f64 = c.as_mut_ptr();
1290        let mut out_out: *mut bindings::VipsImage = null_mut();
1291
1292        let vips_op_response =
1293            bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1294        utils::result(
1295            vips_op_response,
1296            VipsImage { ctx: out_out },
1297            Error::RemainderConstError,
1298        )
1299    }
1300}
1301
1302/// VipsBooleanConst (boolean_const), boolean operations against a constant
1303/// inp: `&VipsImage` -> Input image
1304/// boolean: `OperationBoolean` -> Boolean to perform
1305///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
1306///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
1307///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
1308///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
1309///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
1310///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
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///  `Last` -> VIPS_OPERATION_MATH2_LAST = 3
1347/// c: `&mut [f64]` -> Array of constants
1348/// returns `VipsImage` - Output image
1349pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1350    unsafe {
1351        let inp_in: *mut bindings::VipsImage = inp.ctx;
1352        let math_2_in: i32 = math_2 as i32;
1353        let c_in: *mut f64 = c.as_mut_ptr();
1354        let mut out_out: *mut bindings::VipsImage = null_mut();
1355
1356        let vips_op_response = bindings::vips_math2_const(
1357            inp_in,
1358            &mut out_out,
1359            math_2_in.try_into().unwrap(),
1360            c_in,
1361            c.len() as i32,
1362            NULL,
1363        );
1364        utils::result(
1365            vips_op_response,
1366            VipsImage { ctx: out_out },
1367            Error::Math2ConstError,
1368        )
1369    }
1370}
1371
1372/// VipsComplex (complex), perform a complex operation on an image
1373/// inp: `&VipsImage` -> Input image
1374/// cmplx: `OperationComplex` -> Complex to perform
1375///  `Polar` -> VIPS_OPERATION_COMPLEX_POLAR = 0 [DEFAULT]
1376///  `Rect` -> VIPS_OPERATION_COMPLEX_RECT = 1
1377///  `Conj` -> VIPS_OPERATION_COMPLEX_CONJ = 2
1378///  `Last` -> VIPS_OPERATION_COMPLEX_LAST = 3
1379/// returns `VipsImage` - Output image
1380pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1381    unsafe {
1382        let inp_in: *mut bindings::VipsImage = inp.ctx;
1383        let cmplx_in: i32 = cmplx as i32;
1384        let mut out_out: *mut bindings::VipsImage = null_mut();
1385
1386        let vips_op_response =
1387            bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1388        utils::result(
1389            vips_op_response,
1390            VipsImage { ctx: out_out },
1391            Error::ComplexError,
1392        )
1393    }
1394}
1395
1396/// VipsComplexget (complexget), get a component from a complex image
1397/// inp: `&VipsImage` -> Input image
1398/// get: `OperationComplexget` -> Complex to perform
1399///  `Real` -> VIPS_OPERATION_COMPLEXGET_REAL = 0 [DEFAULT]
1400///  `Imag` -> VIPS_OPERATION_COMPLEXGET_IMAG = 1
1401///  `Last` -> VIPS_OPERATION_COMPLEXGET_LAST = 2
1402/// returns `VipsImage` - Output image
1403pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1404    unsafe {
1405        let inp_in: *mut bindings::VipsImage = inp.ctx;
1406        let get_in: i32 = get as i32;
1407        let mut out_out: *mut bindings::VipsImage = null_mut();
1408
1409        let vips_op_response =
1410            bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1411        utils::result(
1412            vips_op_response,
1413            VipsImage { ctx: out_out },
1414            Error::ComplexgetError,
1415        )
1416    }
1417}
1418
1419/// VipsAvg (avg), find image average
1420/// inp: `&VipsImage` -> Input image
1421/// returns `f64` - Output value
1422pub fn avg(inp: &VipsImage) -> Result<f64> {
1423    unsafe {
1424        let inp_in: *mut bindings::VipsImage = inp.ctx;
1425        let mut out_out: f64 = f64::from(0);
1426
1427        let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1428        utils::result(vips_op_response, out_out, Error::AvgError)
1429    }
1430}
1431
1432/// VipsMin (min), find image minimum
1433/// inp: `&VipsImage` -> Input image
1434/// returns `f64` - Output value
1435pub fn min(inp: &VipsImage) -> Result<f64> {
1436    unsafe {
1437        let inp_in: *mut bindings::VipsImage = inp.ctx;
1438        let mut out_out: f64 = f64::from(0);
1439
1440        let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1441        utils::result(vips_op_response, out_out, Error::MinError)
1442    }
1443}
1444
1445/// Options for min operation
1446#[derive(Clone, Debug)]
1447pub struct MinOptions {
1448    /// x: `i32` -> Horizontal position of minimum
1449    /// min: 0, max: 10000000, default: 0
1450    pub x: i32,
1451    /// y: `i32` -> Vertical position of minimum
1452    /// min: 0, max: 10000000, default: 0
1453    pub y: i32,
1454    /// size: `i32` -> Number of minimum values to find
1455    /// min: 1, max: 1000000, default: 10
1456    pub size: i32,
1457    /// out_array: `Vec<f64>` -> Array of output values
1458    pub out_array: Vec<f64>,
1459    /// x_array: `Vec<i32>` -> Array of horizontal positions
1460    pub x_array: Vec<i32>,
1461    /// y_array: `Vec<i32>` -> Array of vertical positions
1462    pub y_array: Vec<i32>,
1463}
1464
1465impl std::default::Default for MinOptions {
1466    fn default() -> Self {
1467        MinOptions {
1468            x: i32::from(0),
1469            y: i32::from(0),
1470            size: i32::from(10),
1471            out_array: Vec::new(),
1472            x_array: Vec::new(),
1473            y_array: Vec::new(),
1474        }
1475    }
1476}
1477
1478/// VipsMin (min), find image minimum
1479/// inp: `&VipsImage` -> Input image
1480/// min_options: `&MinOptions` -> optional arguments
1481/// returns `f64` - Output value
1482pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1483    unsafe {
1484        let inp_in: *mut bindings::VipsImage = inp.ctx;
1485        let mut out_out: f64 = f64::from(0);
1486
1487        let x_in: i32 = min_options.x;
1488        let x_in_name = utils::new_c_string("x")?;
1489
1490        let y_in: i32 = min_options.y;
1491        let y_in_name = utils::new_c_string("y")?;
1492
1493        let size_in: i32 = min_options.size;
1494        let size_in_name = utils::new_c_string("size")?;
1495
1496        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1497        let out_array_in = out_array_wrapper.ctx;
1498        let out_array_in_name = utils::new_c_string("out-array")?;
1499
1500        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1501        let x_array_in = x_array_wrapper.ctx;
1502        let x_array_in_name = utils::new_c_string("x-array")?;
1503
1504        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1505        let y_array_in = y_array_wrapper.ctx;
1506        let y_array_in_name = utils::new_c_string("y-array")?;
1507
1508        let vips_op_response = bindings::vips_min(
1509            inp_in,
1510            &mut out_out,
1511            x_in_name.as_ptr(),
1512            x_in,
1513            y_in_name.as_ptr(),
1514            y_in,
1515            size_in_name.as_ptr(),
1516            size_in,
1517            out_array_in_name.as_ptr(),
1518            out_array_in,
1519            x_array_in_name.as_ptr(),
1520            x_array_in,
1521            y_array_in_name.as_ptr(),
1522            y_array_in,
1523            NULL,
1524        );
1525        utils::result(vips_op_response, out_out, Error::MinError)
1526    }
1527}
1528
1529/// VipsMax (max), find image maximum
1530/// inp: `&VipsImage` -> Input image
1531/// returns `f64` - Output value
1532pub fn max(inp: &VipsImage) -> Result<f64> {
1533    unsafe {
1534        let inp_in: *mut bindings::VipsImage = inp.ctx;
1535        let mut out_out: f64 = f64::from(0);
1536
1537        let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1538        utils::result(vips_op_response, out_out, Error::MaxError)
1539    }
1540}
1541
1542/// Options for max operation
1543#[derive(Clone, Debug)]
1544pub struct MaxOptions {
1545    /// x: `i32` -> Horizontal position of maximum
1546    /// min: 0, max: 10000000, default: 0
1547    pub x: i32,
1548    /// y: `i32` -> Vertical position of maximum
1549    /// min: 0, max: 10000000, default: 0
1550    pub y: i32,
1551    /// size: `i32` -> Number of maximum values to find
1552    /// min: 1, max: 1000000, default: 10
1553    pub size: i32,
1554    /// out_array: `Vec<f64>` -> Array of output values
1555    pub out_array: Vec<f64>,
1556    /// x_array: `Vec<i32>` -> Array of horizontal positions
1557    pub x_array: Vec<i32>,
1558    /// y_array: `Vec<i32>` -> Array of vertical positions
1559    pub y_array: Vec<i32>,
1560}
1561
1562impl std::default::Default for MaxOptions {
1563    fn default() -> Self {
1564        MaxOptions {
1565            x: i32::from(0),
1566            y: i32::from(0),
1567            size: i32::from(10),
1568            out_array: Vec::new(),
1569            x_array: Vec::new(),
1570            y_array: Vec::new(),
1571        }
1572    }
1573}
1574
1575/// VipsMax (max), find image maximum
1576/// inp: `&VipsImage` -> Input image
1577/// max_options: `&MaxOptions` -> optional arguments
1578/// returns `f64` - Output value
1579pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1580    unsafe {
1581        let inp_in: *mut bindings::VipsImage = inp.ctx;
1582        let mut out_out: f64 = f64::from(0);
1583
1584        let x_in: i32 = max_options.x;
1585        let x_in_name = utils::new_c_string("x")?;
1586
1587        let y_in: i32 = max_options.y;
1588        let y_in_name = utils::new_c_string("y")?;
1589
1590        let size_in: i32 = max_options.size;
1591        let size_in_name = utils::new_c_string("size")?;
1592
1593        let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1594        let out_array_in = out_array_wrapper.ctx;
1595        let out_array_in_name = utils::new_c_string("out-array")?;
1596
1597        let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1598        let x_array_in = x_array_wrapper.ctx;
1599        let x_array_in_name = utils::new_c_string("x-array")?;
1600
1601        let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1602        let y_array_in = y_array_wrapper.ctx;
1603        let y_array_in_name = utils::new_c_string("y-array")?;
1604
1605        let vips_op_response = bindings::vips_max(
1606            inp_in,
1607            &mut out_out,
1608            x_in_name.as_ptr(),
1609            x_in,
1610            y_in_name.as_ptr(),
1611            y_in,
1612            size_in_name.as_ptr(),
1613            size_in,
1614            out_array_in_name.as_ptr(),
1615            out_array_in,
1616            x_array_in_name.as_ptr(),
1617            x_array_in,
1618            y_array_in_name.as_ptr(),
1619            y_array_in,
1620            NULL,
1621        );
1622        utils::result(vips_op_response, out_out, Error::MaxError)
1623    }
1624}
1625
1626/// VipsDeviate (deviate), find image standard deviation
1627/// inp: `&VipsImage` -> Input image
1628/// returns `f64` - Output value
1629pub fn deviate(inp: &VipsImage) -> Result<f64> {
1630    unsafe {
1631        let inp_in: *mut bindings::VipsImage = inp.ctx;
1632        let mut out_out: f64 = f64::from(0);
1633
1634        let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1635        utils::result(vips_op_response, out_out, Error::DeviateError)
1636    }
1637}
1638
1639/// VipsStats (stats), find many image stats
1640/// inp: `&VipsImage` -> Input image
1641/// returns `VipsImage` - Output array of statistics
1642pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1643    unsafe {
1644        let inp_in: *mut bindings::VipsImage = inp.ctx;
1645        let mut out_out: *mut bindings::VipsImage = null_mut();
1646
1647        let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1648        utils::result(
1649            vips_op_response,
1650            VipsImage { ctx: out_out },
1651            Error::StatError,
1652        )
1653    }
1654}
1655
1656/// VipsHistFind (hist_find), find image histogram
1657/// inp: `&VipsImage` -> Input image
1658/// returns `VipsImage` - Output histogram
1659pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1660    unsafe {
1661        let inp_in: *mut bindings::VipsImage = inp.ctx;
1662        let mut out_out: *mut bindings::VipsImage = null_mut();
1663
1664        let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1665        utils::result(
1666            vips_op_response,
1667            VipsImage { ctx: out_out },
1668            Error::HistFindError,
1669        )
1670    }
1671}
1672
1673/// Options for hist_find operation
1674#[derive(Clone, Debug)]
1675pub struct HistFindOptions {
1676    /// band: `i32` -> Find histogram of band
1677    /// min: -1, max: 100000, default: -1
1678    pub band: i32,
1679}
1680
1681impl std::default::Default for HistFindOptions {
1682    fn default() -> Self {
1683        HistFindOptions {
1684            band: i32::from(-1),
1685        }
1686    }
1687}
1688
1689/// VipsHistFind (hist_find), find image histogram
1690/// inp: `&VipsImage` -> Input image
1691/// hist_find_options: `&HistFindOptions` -> optional arguments
1692/// returns `VipsImage` - Output histogram
1693pub fn hist_find_with_opts(
1694    inp: &VipsImage,
1695    hist_find_options: &HistFindOptions,
1696) -> Result<VipsImage> {
1697    unsafe {
1698        let inp_in: *mut bindings::VipsImage = inp.ctx;
1699        let mut out_out: *mut bindings::VipsImage = null_mut();
1700
1701        let band_in: i32 = hist_find_options.band;
1702        let band_in_name = utils::new_c_string("band")?;
1703
1704        let vips_op_response =
1705            bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1706        utils::result(
1707            vips_op_response,
1708            VipsImage { ctx: out_out },
1709            Error::HistFindError,
1710        )
1711    }
1712}
1713
1714/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1715/// inp: `&VipsImage` -> Input image
1716/// returns `VipsImage` - Output histogram
1717pub fn hist_find_ndim(inp: &VipsImage) -> 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 vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1723        utils::result(
1724            vips_op_response,
1725            VipsImage { ctx: out_out },
1726            Error::HistFindNdimError,
1727        )
1728    }
1729}
1730
1731/// Options for hist_find_ndim operation
1732#[derive(Clone, Debug)]
1733pub struct HistFindNdimOptions {
1734    /// bins: `i32` -> Number of bins in each dimension
1735    /// min: 1, max: 65536, default: 10
1736    pub bins: i32,
1737}
1738
1739impl std::default::Default for HistFindNdimOptions {
1740    fn default() -> Self {
1741        HistFindNdimOptions {
1742            bins: i32::from(10),
1743        }
1744    }
1745}
1746
1747/// VipsHistFindNDim (hist_find_ndim), find n-dimensional image histogram
1748/// inp: `&VipsImage` -> Input image
1749/// hist_find_ndim_options: `&HistFindNdimOptions` -> optional arguments
1750/// returns `VipsImage` - Output histogram
1751pub fn hist_find_ndim_with_opts(
1752    inp: &VipsImage,
1753    hist_find_ndim_options: &HistFindNdimOptions,
1754) -> Result<VipsImage> {
1755    unsafe {
1756        let inp_in: *mut bindings::VipsImage = inp.ctx;
1757        let mut out_out: *mut bindings::VipsImage = null_mut();
1758
1759        let bins_in: i32 = hist_find_ndim_options.bins;
1760        let bins_in_name = utils::new_c_string("bins")?;
1761
1762        let vips_op_response = bindings::vips_hist_find_ndim(
1763            inp_in,
1764            &mut out_out,
1765            bins_in_name.as_ptr(),
1766            bins_in,
1767            NULL,
1768        );
1769        utils::result(
1770            vips_op_response,
1771            VipsImage { ctx: out_out },
1772            Error::HistFindNdimError,
1773        )
1774    }
1775}
1776
1777/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1778/// inp: `&VipsImage` -> Input image
1779/// index: `&VipsImage` -> Index image
1780/// returns `VipsImage` - Output histogram
1781pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1782    unsafe {
1783        let inp_in: *mut bindings::VipsImage = inp.ctx;
1784        let index_in: *mut bindings::VipsImage = index.ctx;
1785        let mut out_out: *mut bindings::VipsImage = null_mut();
1786
1787        let vips_op_response =
1788            bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1789        utils::result(
1790            vips_op_response,
1791            VipsImage { ctx: out_out },
1792            Error::HistFindIndexedError,
1793        )
1794    }
1795}
1796
1797/// Options for hist_find_indexed operation
1798#[derive(Clone, Debug)]
1799pub struct HistFindIndexedOptions {
1800    /// combine: `Combine` -> Combine bins like this
1801    ///  `Max` -> VIPS_COMBINE_MAX = 0
1802    ///  `Sum` -> VIPS_COMBINE_SUM = 1 [DEFAULT]
1803    ///  `Min` -> VIPS_COMBINE_MIN = 2
1804    ///  `Last` -> VIPS_COMBINE_LAST = 3
1805    pub combine: Combine,
1806}
1807
1808impl std::default::Default for HistFindIndexedOptions {
1809    fn default() -> Self {
1810        HistFindIndexedOptions {
1811            combine: Combine::Sum,
1812        }
1813    }
1814}
1815
1816/// VipsHistFindIndexed (hist_find_indexed), find indexed image histogram
1817/// inp: `&VipsImage` -> Input image
1818/// index: `&VipsImage` -> Index image
1819/// hist_find_indexed_options: `&HistFindIndexedOptions` -> optional arguments
1820/// returns `VipsImage` - Output histogram
1821pub fn hist_find_indexed_with_opts(
1822    inp: &VipsImage,
1823    index: &VipsImage,
1824    hist_find_indexed_options: &HistFindIndexedOptions,
1825) -> Result<VipsImage> {
1826    unsafe {
1827        let inp_in: *mut bindings::VipsImage = inp.ctx;
1828        let index_in: *mut bindings::VipsImage = index.ctx;
1829        let mut out_out: *mut bindings::VipsImage = null_mut();
1830
1831        let combine_in: i32 = hist_find_indexed_options.combine as i32;
1832        let combine_in_name = utils::new_c_string("combine")?;
1833
1834        let vips_op_response = bindings::vips_hist_find_indexed(
1835            inp_in,
1836            index_in,
1837            &mut out_out,
1838            combine_in_name.as_ptr(),
1839            combine_in,
1840            NULL,
1841        );
1842        utils::result(
1843            vips_op_response,
1844            VipsImage { ctx: out_out },
1845            Error::HistFindIndexedError,
1846        )
1847    }
1848}
1849
1850/// VipsHoughLine (hough_line), find hough line transform
1851/// inp: `&VipsImage` -> Input image
1852/// returns `VipsImage` - Output image
1853pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1854    unsafe {
1855        let inp_in: *mut bindings::VipsImage = inp.ctx;
1856        let mut out_out: *mut bindings::VipsImage = null_mut();
1857
1858        let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1859        utils::result(
1860            vips_op_response,
1861            VipsImage { ctx: out_out },
1862            Error::HoughLineError,
1863        )
1864    }
1865}
1866
1867/// Options for hough_line operation
1868#[derive(Clone, Debug)]
1869pub struct HoughLineOptions {
1870    /// width: `i32` -> Horizontal size of parameter space
1871    /// min: 1, max: 100000, default: 256
1872    pub width: i32,
1873    /// height: `i32` -> Vertical size of parameter space
1874    /// min: 1, max: 100000, default: 256
1875    pub height: i32,
1876}
1877
1878impl std::default::Default for HoughLineOptions {
1879    fn default() -> Self {
1880        HoughLineOptions {
1881            width: i32::from(256),
1882            height: i32::from(256),
1883        }
1884    }
1885}
1886
1887/// VipsHoughLine (hough_line), find hough line transform
1888/// inp: `&VipsImage` -> Input image
1889/// hough_line_options: `&HoughLineOptions` -> optional arguments
1890/// returns `VipsImage` - Output image
1891pub fn hough_line_with_opts(
1892    inp: &VipsImage,
1893    hough_line_options: &HoughLineOptions,
1894) -> Result<VipsImage> {
1895    unsafe {
1896        let inp_in: *mut bindings::VipsImage = inp.ctx;
1897        let mut out_out: *mut bindings::VipsImage = null_mut();
1898
1899        let width_in: i32 = hough_line_options.width;
1900        let width_in_name = utils::new_c_string("width")?;
1901
1902        let height_in: i32 = hough_line_options.height;
1903        let height_in_name = utils::new_c_string("height")?;
1904
1905        let vips_op_response = bindings::vips_hough_line(
1906            inp_in,
1907            &mut out_out,
1908            width_in_name.as_ptr(),
1909            width_in,
1910            height_in_name.as_ptr(),
1911            height_in,
1912            NULL,
1913        );
1914        utils::result(
1915            vips_op_response,
1916            VipsImage { ctx: out_out },
1917            Error::HoughLineError,
1918        )
1919    }
1920}
1921
1922/// VipsHoughCircle (hough_circle), find hough circle transform
1923/// inp: `&VipsImage` -> Input image
1924/// returns `VipsImage` - Output image
1925pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
1926    unsafe {
1927        let inp_in: *mut bindings::VipsImage = inp.ctx;
1928        let mut out_out: *mut bindings::VipsImage = null_mut();
1929
1930        let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
1931        utils::result(
1932            vips_op_response,
1933            VipsImage { ctx: out_out },
1934            Error::HoughCircleError,
1935        )
1936    }
1937}
1938
1939/// Options for hough_circle operation
1940#[derive(Clone, Debug)]
1941pub struct HoughCircleOptions {
1942    /// scale: `i32` -> Scale down dimensions by this factor
1943    /// min: 1, max: 100000, default: 3
1944    pub scale: i32,
1945    /// min_radius: `i32` -> Smallest radius to search for
1946    /// min: 1, max: 100000, default: 10
1947    pub min_radius: i32,
1948    /// max_radius: `i32` -> Largest radius to search for
1949    /// min: 1, max: 100000, default: 20
1950    pub max_radius: i32,
1951}
1952
1953impl std::default::Default for HoughCircleOptions {
1954    fn default() -> Self {
1955        HoughCircleOptions {
1956            scale: i32::from(3),
1957            min_radius: i32::from(10),
1958            max_radius: i32::from(20),
1959        }
1960    }
1961}
1962
1963/// VipsHoughCircle (hough_circle), find hough circle transform
1964/// inp: `&VipsImage` -> Input image
1965/// hough_circle_options: `&HoughCircleOptions` -> optional arguments
1966/// returns `VipsImage` - Output image
1967pub fn hough_circle_with_opts(
1968    inp: &VipsImage,
1969    hough_circle_options: &HoughCircleOptions,
1970) -> Result<VipsImage> {
1971    unsafe {
1972        let inp_in: *mut bindings::VipsImage = inp.ctx;
1973        let mut out_out: *mut bindings::VipsImage = null_mut();
1974
1975        let scale_in: i32 = hough_circle_options.scale;
1976        let scale_in_name = utils::new_c_string("scale")?;
1977
1978        let min_radius_in: i32 = hough_circle_options.min_radius;
1979        let min_radius_in_name = utils::new_c_string("min-radius")?;
1980
1981        let max_radius_in: i32 = hough_circle_options.max_radius;
1982        let max_radius_in_name = utils::new_c_string("max-radius")?;
1983
1984        let vips_op_response = bindings::vips_hough_circle(
1985            inp_in,
1986            &mut out_out,
1987            scale_in_name.as_ptr(),
1988            scale_in,
1989            min_radius_in_name.as_ptr(),
1990            min_radius_in,
1991            max_radius_in_name.as_ptr(),
1992            max_radius_in,
1993            NULL,
1994        );
1995        utils::result(
1996            vips_op_response,
1997            VipsImage { ctx: out_out },
1998            Error::HoughCircleError,
1999        )
2000    }
2001}
2002
2003/// VipsProject (project), find image projections
2004/// inp: `&VipsImage` -> Input image
2005/// Tuple (
2006/// VipsImage - Sums of columns
2007/// VipsImage - Sums of rows
2008///)
2009pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2010    unsafe {
2011        let inp_in: *mut bindings::VipsImage = inp.ctx;
2012        let mut columns_out: *mut bindings::VipsImage = null_mut();
2013        let mut rows_out: *mut bindings::VipsImage = null_mut();
2014
2015        let vips_op_response =
2016            bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2017        utils::result(
2018            vips_op_response,
2019            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2020            Error::ProjectError,
2021        )
2022    }
2023}
2024
2025/// VipsProfile (profile), find image profiles
2026/// inp: `&VipsImage` -> Input image
2027/// Tuple (
2028/// VipsImage - First non-zero pixel in column
2029/// VipsImage - First non-zero pixel in row
2030///)
2031pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2032    unsafe {
2033        let inp_in: *mut bindings::VipsImage = inp.ctx;
2034        let mut columns_out: *mut bindings::VipsImage = null_mut();
2035        let mut rows_out: *mut bindings::VipsImage = null_mut();
2036
2037        let vips_op_response =
2038            bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2039        utils::result(
2040            vips_op_response,
2041            (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2042            Error::ProfileError,
2043        )
2044    }
2045}
2046
2047/// VipsMeasure (measure), measure a set of patches on a color chart
2048/// inp: `&VipsImage` -> Image to measure
2049/// h: `i32` -> Number of patches across chart
2050/// min: 1, max: 10000000, default: 1
2051/// v: `i32` -> Number of patches down chart
2052/// min: 1, max: 10000000, default: 1
2053/// returns `VipsImage` - Output array of statistics
2054pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2055    unsafe {
2056        let inp_in: *mut bindings::VipsImage = inp.ctx;
2057        let h_in: i32 = h;
2058        let v_in: i32 = v;
2059        let mut out_out: *mut bindings::VipsImage = null_mut();
2060
2061        let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2062        utils::result(
2063            vips_op_response,
2064            VipsImage { ctx: out_out },
2065            Error::MeasureError,
2066        )
2067    }
2068}
2069
2070/// Options for measure operation
2071#[derive(Clone, Debug)]
2072pub struct MeasureOptions {
2073    /// left: `i32` -> Left edge of extract area
2074    /// min: 0, max: 10000000, default: 0
2075    pub left: i32,
2076    /// top: `i32` -> Top edge of extract area
2077    /// min: 0, max: 10000000, default: 0
2078    pub top: i32,
2079    /// width: `i32` -> Width of extract area
2080    /// min: 1, max: 10000000, default: 1
2081    pub width: i32,
2082    /// height: `i32` -> Height of extract area
2083    /// min: 1, max: 10000000, default: 1
2084    pub height: i32,
2085}
2086
2087impl std::default::Default for MeasureOptions {
2088    fn default() -> Self {
2089        MeasureOptions {
2090            left: i32::from(0),
2091            top: i32::from(0),
2092            width: i32::from(1),
2093            height: i32::from(1),
2094        }
2095    }
2096}
2097
2098/// VipsMeasure (measure), measure a set of patches on a color chart
2099/// inp: `&VipsImage` -> Image to measure
2100/// h: `i32` -> Number of patches across chart
2101/// min: 1, max: 10000000, default: 1
2102/// v: `i32` -> Number of patches down chart
2103/// min: 1, max: 10000000, default: 1
2104/// measure_options: `&MeasureOptions` -> optional arguments
2105/// returns `VipsImage` - Output array of statistics
2106pub fn measure_with_opts(
2107    inp: &VipsImage,
2108    h: i32,
2109    v: i32,
2110    measure_options: &MeasureOptions,
2111) -> Result<VipsImage> {
2112    unsafe {
2113        let inp_in: *mut bindings::VipsImage = inp.ctx;
2114        let h_in: i32 = h;
2115        let v_in: i32 = v;
2116        let mut out_out: *mut bindings::VipsImage = null_mut();
2117
2118        let left_in: i32 = measure_options.left;
2119        let left_in_name = utils::new_c_string("left")?;
2120
2121        let top_in: i32 = measure_options.top;
2122        let top_in_name = utils::new_c_string("top")?;
2123
2124        let width_in: i32 = measure_options.width;
2125        let width_in_name = utils::new_c_string("width")?;
2126
2127        let height_in: i32 = measure_options.height;
2128        let height_in_name = utils::new_c_string("height")?;
2129
2130        let vips_op_response = bindings::vips_measure(
2131            inp_in,
2132            &mut out_out,
2133            h_in,
2134            v_in,
2135            left_in_name.as_ptr(),
2136            left_in,
2137            top_in_name.as_ptr(),
2138            top_in,
2139            width_in_name.as_ptr(),
2140            width_in,
2141            height_in_name.as_ptr(),
2142            height_in,
2143            NULL,
2144        );
2145        utils::result(
2146            vips_op_response,
2147            VipsImage { ctx: out_out },
2148            Error::MeasureError,
2149        )
2150    }
2151}
2152
2153/// VipsFindTrim (find_trim), search an image for non-edge areas
2154/// inp: `&VipsImage` -> Image to find_trim
2155/// Tuple (
2156/// i32 - Left edge of image
2157/// i32 - Top edge of extract area
2158/// i32 - Width of extract area
2159/// i32 - Height of extract area
2160///)
2161pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2162    unsafe {
2163        let inp_in: *mut bindings::VipsImage = inp.ctx;
2164        let mut left_out: i32 = i32::from(1);
2165        let mut top_out: i32 = i32::from(0);
2166        let mut width_out: i32 = i32::from(1);
2167        let mut height_out: i32 = i32::from(1);
2168
2169        let vips_op_response = bindings::vips_find_trim(
2170            inp_in,
2171            &mut left_out,
2172            &mut top_out,
2173            &mut width_out,
2174            &mut height_out,
2175            NULL,
2176        );
2177        utils::result(
2178            vips_op_response,
2179            (left_out, top_out, width_out, height_out),
2180            Error::FindTrimError,
2181        )
2182    }
2183}
2184
2185/// Options for find_trim operation
2186#[derive(Clone, Debug)]
2187pub struct FindTrimOptions {
2188    /// threshold: `f64` -> Object threshold
2189    /// min: 0, max: inf, default: 10
2190    pub threshold: f64,
2191    /// background: `Vec<f64>` -> Color for background pixels
2192    pub background: Vec<f64>,
2193    /// line_art: `bool` -> Enable line art mode
2194    /// default: false
2195    pub line_art: bool,
2196}
2197
2198impl std::default::Default for FindTrimOptions {
2199    fn default() -> Self {
2200        FindTrimOptions {
2201            threshold: f64::from(10),
2202            background: Vec::new(),
2203            line_art: false,
2204        }
2205    }
2206}
2207
2208/// VipsFindTrim (find_trim), search an image for non-edge areas
2209/// inp: `&VipsImage` -> Image to find_trim
2210/// find_trim_options: `&FindTrimOptions` -> optional arguments
2211/// Tuple (
2212/// i32 - Left edge of image
2213/// i32 - Top edge of extract area
2214/// i32 - Width of extract area
2215/// i32 - Height of extract area
2216///)
2217pub fn find_trim_with_opts(
2218    inp: &VipsImage,
2219    find_trim_options: &FindTrimOptions,
2220) -> Result<(i32, i32, i32, i32)> {
2221    unsafe {
2222        let inp_in: *mut bindings::VipsImage = inp.ctx;
2223        let mut left_out: i32 = i32::from(1);
2224        let mut top_out: i32 = i32::from(0);
2225        let mut width_out: i32 = i32::from(1);
2226        let mut height_out: i32 = i32::from(1);
2227
2228        let threshold_in: f64 = find_trim_options.threshold;
2229        let threshold_in_name = utils::new_c_string("threshold")?;
2230
2231        let background_wrapper =
2232            utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2233        let background_in = background_wrapper.ctx;
2234        let background_in_name = utils::new_c_string("background")?;
2235
2236        let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2237        let line_art_in_name = utils::new_c_string("line-art")?;
2238
2239        let vips_op_response = bindings::vips_find_trim(
2240            inp_in,
2241            &mut left_out,
2242            &mut top_out,
2243            &mut width_out,
2244            &mut height_out,
2245            threshold_in_name.as_ptr(),
2246            threshold_in,
2247            background_in_name.as_ptr(),
2248            background_in,
2249            line_art_in_name.as_ptr(),
2250            line_art_in,
2251            NULL,
2252        );
2253        utils::result(
2254            vips_op_response,
2255            (left_out, top_out, width_out, height_out),
2256            Error::FindTrimError,
2257        )
2258    }
2259}
2260
2261/// VipsCopy (copy), copy an image
2262/// inp: `&VipsImage` -> Input image
2263/// returns `VipsImage` - Output image
2264pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2265    unsafe {
2266        let inp_in: *mut bindings::VipsImage = inp.ctx;
2267        let mut out_out: *mut bindings::VipsImage = null_mut();
2268
2269        let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2270        utils::result(
2271            vips_op_response,
2272            VipsImage { ctx: out_out },
2273            Error::CopyError,
2274        )
2275    }
2276}
2277
2278/// Options for copy operation
2279#[derive(Clone, Debug)]
2280pub struct CopyOptions {
2281    /// width: `i32` -> Image width in pixels
2282    /// min: 0, max: 10000000, default: 0
2283    pub width: i32,
2284    /// height: `i32` -> Image height in pixels
2285    /// min: 0, max: 10000000, default: 0
2286    pub height: i32,
2287    /// bands: `i32` -> Number of bands in image
2288    /// min: 0, max: 10000000, default: 0
2289    pub bands: i32,
2290    /// format: `BandFormat` -> Pixel format in image
2291    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
2292    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
2293    ///  `Char` -> VIPS_FORMAT_CHAR = 1
2294    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
2295    ///  `Short` -> VIPS_FORMAT_SHORT = 3
2296    ///  `Uint` -> VIPS_FORMAT_UINT = 4
2297    ///  `Int` -> VIPS_FORMAT_INT = 5
2298    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
2299    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
2300    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
2301    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
2302    ///  `Last` -> VIPS_FORMAT_LAST = 10
2303    pub format: BandFormat,
2304    /// coding: `Coding` -> Pixel coding
2305    ///  `Error` -> VIPS_CODING_ERROR = -1
2306    ///  `None` -> VIPS_CODING_NONE = 0 [DEFAULT]
2307    ///  `Labq` -> VIPS_CODING_LABQ = 2
2308    ///  `Rad` -> VIPS_CODING_RAD = 6
2309    ///  `Last` -> VIPS_CODING_LAST = 7
2310    pub coding: Coding,
2311    /// interpretation: `Interpretation` -> Pixel interpretation
2312    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
2313    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
2314    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
2315    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
2316    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
2317    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
2318    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
2319    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
2320    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
2321    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
2322    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
2323    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
2324    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
2325    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
2326    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
2327    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
2328    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
2329    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
2330    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
2331    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
2332    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
2333    pub interpretation: Interpretation,
2334    /// xres: `f64` -> Horizontal resolution in pixels/mm
2335    /// min: -0, max: 1000000, default: 0
2336    pub xres: f64,
2337    /// yres: `f64` -> Vertical resolution in pixels/mm
2338    /// min: -0, max: 1000000, default: 0
2339    pub yres: f64,
2340    /// xoffset: `i32` -> Horizontal offset of origin
2341    /// min: -10000000, max: 10000000, default: 0
2342    pub xoffset: i32,
2343    /// yoffset: `i32` -> Vertical offset of origin
2344    /// min: -10000000, max: 10000000, default: 0
2345    pub yoffset: i32,
2346}
2347
2348impl std::default::Default for CopyOptions {
2349    fn default() -> Self {
2350        CopyOptions {
2351            width: i32::from(0),
2352            height: i32::from(0),
2353            bands: i32::from(0),
2354            format: BandFormat::Uchar,
2355            coding: Coding::None,
2356            interpretation: Interpretation::Multiband,
2357            xres: f64::from(0),
2358            yres: f64::from(0),
2359            xoffset: i32::from(0),
2360            yoffset: i32::from(0),
2361        }
2362    }
2363}
2364
2365/// VipsCopy (copy), copy an image
2366/// inp: `&VipsImage` -> Input image
2367/// copy_options: `&CopyOptions` -> optional arguments
2368/// returns `VipsImage` - Output image
2369pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2370    unsafe {
2371        let inp_in: *mut bindings::VipsImage = inp.ctx;
2372        let mut out_out: *mut bindings::VipsImage = null_mut();
2373
2374        let width_in: i32 = copy_options.width;
2375        let width_in_name = utils::new_c_string("width")?;
2376
2377        let height_in: i32 = copy_options.height;
2378        let height_in_name = utils::new_c_string("height")?;
2379
2380        let bands_in: i32 = copy_options.bands;
2381        let bands_in_name = utils::new_c_string("bands")?;
2382
2383        let format_in: i32 = copy_options.format as i32;
2384        let format_in_name = utils::new_c_string("format")?;
2385
2386        let coding_in: i32 = copy_options.coding as i32;
2387        let coding_in_name = utils::new_c_string("coding")?;
2388
2389        let interpretation_in: i32 = copy_options.interpretation as i32;
2390        let interpretation_in_name = utils::new_c_string("interpretation")?;
2391
2392        let xres_in: f64 = copy_options.xres;
2393        let xres_in_name = utils::new_c_string("xres")?;
2394
2395        let yres_in: f64 = copy_options.yres;
2396        let yres_in_name = utils::new_c_string("yres")?;
2397
2398        let xoffset_in: i32 = copy_options.xoffset;
2399        let xoffset_in_name = utils::new_c_string("xoffset")?;
2400
2401        let yoffset_in: i32 = copy_options.yoffset;
2402        let yoffset_in_name = utils::new_c_string("yoffset")?;
2403
2404        let vips_op_response = bindings::vips_copy(
2405            inp_in,
2406            &mut out_out,
2407            width_in_name.as_ptr(),
2408            width_in,
2409            height_in_name.as_ptr(),
2410            height_in,
2411            bands_in_name.as_ptr(),
2412            bands_in,
2413            format_in_name.as_ptr(),
2414            format_in,
2415            coding_in_name.as_ptr(),
2416            coding_in,
2417            interpretation_in_name.as_ptr(),
2418            interpretation_in,
2419            xres_in_name.as_ptr(),
2420            xres_in,
2421            yres_in_name.as_ptr(),
2422            yres_in,
2423            xoffset_in_name.as_ptr(),
2424            xoffset_in,
2425            yoffset_in_name.as_ptr(),
2426            yoffset_in,
2427            NULL,
2428        );
2429        utils::result(
2430            vips_op_response,
2431            VipsImage { ctx: out_out },
2432            Error::CopyError,
2433        )
2434    }
2435}
2436
2437/// VipsTileCache (tilecache), cache an image as a set of tiles
2438/// inp: `&VipsImage` -> Input image
2439/// returns `VipsImage` - Output image
2440pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2441    unsafe {
2442        let inp_in: *mut bindings::VipsImage = inp.ctx;
2443        let mut out_out: *mut bindings::VipsImage = null_mut();
2444
2445        let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2446        utils::result(
2447            vips_op_response,
2448            VipsImage { ctx: out_out },
2449            Error::TilecacheError,
2450        )
2451    }
2452}
2453
2454/// Options for tilecache operation
2455#[derive(Clone, Debug)]
2456pub struct TilecacheOptions {
2457    /// tile_width: `i32` -> Tile width in pixels
2458    /// min: 1, max: 1000000, default: 128
2459    pub tile_width: i32,
2460    /// tile_height: `i32` -> Tile height in pixels
2461    /// min: 1, max: 1000000, default: 128
2462    pub tile_height: i32,
2463    /// max_tiles: `i32` -> Maximum number of tiles to cache
2464    /// min: -1, max: 1000000, default: 1000
2465    pub max_tiles: i32,
2466    /// access: `Access` -> Expected access pattern
2467    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2468    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2469    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2470    ///  `Last` -> VIPS_ACCESS_LAST = 3
2471    pub access: Access,
2472    /// threaded: `bool` -> Allow threaded access
2473    /// default: false
2474    pub threaded: bool,
2475    /// persistent: `bool` -> Keep cache between evaluations
2476    /// default: false
2477    pub persistent: bool,
2478}
2479
2480impl std::default::Default for TilecacheOptions {
2481    fn default() -> Self {
2482        TilecacheOptions {
2483            tile_width: i32::from(128),
2484            tile_height: i32::from(128),
2485            max_tiles: i32::from(1000),
2486            access: Access::Random,
2487            threaded: false,
2488            persistent: false,
2489        }
2490    }
2491}
2492
2493/// VipsTileCache (tilecache), cache an image as a set of tiles
2494/// inp: `&VipsImage` -> Input image
2495/// tilecache_options: `&TilecacheOptions` -> optional arguments
2496/// returns `VipsImage` - Output image
2497pub fn tilecache_with_opts(
2498    inp: &VipsImage,
2499    tilecache_options: &TilecacheOptions,
2500) -> Result<VipsImage> {
2501    unsafe {
2502        let inp_in: *mut bindings::VipsImage = inp.ctx;
2503        let mut out_out: *mut bindings::VipsImage = null_mut();
2504
2505        let tile_width_in: i32 = tilecache_options.tile_width;
2506        let tile_width_in_name = utils::new_c_string("tile-width")?;
2507
2508        let tile_height_in: i32 = tilecache_options.tile_height;
2509        let tile_height_in_name = utils::new_c_string("tile-height")?;
2510
2511        let max_tiles_in: i32 = tilecache_options.max_tiles;
2512        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2513
2514        let access_in: i32 = tilecache_options.access as i32;
2515        let access_in_name = utils::new_c_string("access")?;
2516
2517        let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2518        let threaded_in_name = utils::new_c_string("threaded")?;
2519
2520        let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2521        let persistent_in_name = utils::new_c_string("persistent")?;
2522
2523        let vips_op_response = bindings::vips_tilecache(
2524            inp_in,
2525            &mut out_out,
2526            tile_width_in_name.as_ptr(),
2527            tile_width_in,
2528            tile_height_in_name.as_ptr(),
2529            tile_height_in,
2530            max_tiles_in_name.as_ptr(),
2531            max_tiles_in,
2532            access_in_name.as_ptr(),
2533            access_in,
2534            threaded_in_name.as_ptr(),
2535            threaded_in,
2536            persistent_in_name.as_ptr(),
2537            persistent_in,
2538            NULL,
2539        );
2540        utils::result(
2541            vips_op_response,
2542            VipsImage { ctx: out_out },
2543            Error::TilecacheError,
2544        )
2545    }
2546}
2547
2548/// VipsLineCache (linecache), cache an image as a set of lines
2549/// inp: `&VipsImage` -> Input image
2550/// returns `VipsImage` - Output image
2551pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2552    unsafe {
2553        let inp_in: *mut bindings::VipsImage = inp.ctx;
2554        let mut out_out: *mut bindings::VipsImage = null_mut();
2555
2556        let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2557        utils::result(
2558            vips_op_response,
2559            VipsImage { ctx: out_out },
2560            Error::LinecacheError,
2561        )
2562    }
2563}
2564
2565/// Options for linecache operation
2566#[derive(Clone, Debug)]
2567pub struct LinecacheOptions {
2568    /// tile_height: `i32` -> Tile height in pixels
2569    /// min: 1, max: 1000000, default: 128
2570    pub tile_height: i32,
2571    /// access: `Access` -> Expected access pattern
2572    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
2573    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
2574    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
2575    ///  `Last` -> VIPS_ACCESS_LAST = 3
2576    pub access: Access,
2577    /// threaded: `bool` -> Allow threaded access
2578    /// default: false
2579    pub threaded: bool,
2580    /// persistent: `bool` -> Keep cache between evaluations
2581    /// default: false
2582    pub persistent: bool,
2583}
2584
2585impl std::default::Default for LinecacheOptions {
2586    fn default() -> Self {
2587        LinecacheOptions {
2588            tile_height: i32::from(128),
2589            access: Access::Random,
2590            threaded: false,
2591            persistent: false,
2592        }
2593    }
2594}
2595
2596/// VipsLineCache (linecache), cache an image as a set of lines
2597/// inp: `&VipsImage` -> Input image
2598/// linecache_options: `&LinecacheOptions` -> optional arguments
2599/// returns `VipsImage` - Output image
2600pub fn linecache_with_opts(
2601    inp: &VipsImage,
2602    linecache_options: &LinecacheOptions,
2603) -> Result<VipsImage> {
2604    unsafe {
2605        let inp_in: *mut bindings::VipsImage = inp.ctx;
2606        let mut out_out: *mut bindings::VipsImage = null_mut();
2607
2608        let tile_height_in: i32 = linecache_options.tile_height;
2609        let tile_height_in_name = utils::new_c_string("tile-height")?;
2610
2611        let access_in: i32 = linecache_options.access as i32;
2612        let access_in_name = utils::new_c_string("access")?;
2613
2614        let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2615        let threaded_in_name = utils::new_c_string("threaded")?;
2616
2617        let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2618        let persistent_in_name = utils::new_c_string("persistent")?;
2619
2620        let vips_op_response = bindings::vips_linecache(
2621            inp_in,
2622            &mut out_out,
2623            tile_height_in_name.as_ptr(),
2624            tile_height_in,
2625            access_in_name.as_ptr(),
2626            access_in,
2627            threaded_in_name.as_ptr(),
2628            threaded_in,
2629            persistent_in_name.as_ptr(),
2630            persistent_in,
2631            NULL,
2632        );
2633        utils::result(
2634            vips_op_response,
2635            VipsImage { ctx: out_out },
2636            Error::LinecacheError,
2637        )
2638    }
2639}
2640
2641/// VipsSequential (sequential), check sequential access
2642/// inp: `&VipsImage` -> Input image
2643/// returns `VipsImage` - Output image
2644pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2645    unsafe {
2646        let inp_in: *mut bindings::VipsImage = inp.ctx;
2647        let mut out_out: *mut bindings::VipsImage = null_mut();
2648
2649        let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2650        utils::result(
2651            vips_op_response,
2652            VipsImage { ctx: out_out },
2653            Error::SequentialError,
2654        )
2655    }
2656}
2657
2658/// Options for sequential operation
2659#[derive(Clone, Debug)]
2660pub struct SequentialOptions {
2661    /// tile_height: `i32` -> Tile height in pixels
2662    /// min: 1, max: 1000000, default: 1
2663    pub tile_height: i32,
2664}
2665
2666impl std::default::Default for SequentialOptions {
2667    fn default() -> Self {
2668        SequentialOptions {
2669            tile_height: i32::from(1),
2670        }
2671    }
2672}
2673
2674/// VipsSequential (sequential), check sequential access
2675/// inp: `&VipsImage` -> Input image
2676/// sequential_options: `&SequentialOptions` -> optional arguments
2677/// returns `VipsImage` - Output image
2678pub fn sequential_with_opts(
2679    inp: &VipsImage,
2680    sequential_options: &SequentialOptions,
2681) -> Result<VipsImage> {
2682    unsafe {
2683        let inp_in: *mut bindings::VipsImage = inp.ctx;
2684        let mut out_out: *mut bindings::VipsImage = null_mut();
2685
2686        let tile_height_in: i32 = sequential_options.tile_height;
2687        let tile_height_in_name = utils::new_c_string("tile-height")?;
2688
2689        let vips_op_response = bindings::vips_sequential(
2690            inp_in,
2691            &mut out_out,
2692            tile_height_in_name.as_ptr(),
2693            tile_height_in,
2694            NULL,
2695        );
2696        utils::result(
2697            vips_op_response,
2698            VipsImage { ctx: out_out },
2699            Error::SequentialError,
2700        )
2701    }
2702}
2703
2704/// VipsCache (cache), cache an image
2705/// inp: `&VipsImage` -> Input image
2706/// returns `VipsImage` - Output image
2707pub fn cache(inp: &VipsImage) -> Result<VipsImage> {
2708    unsafe {
2709        let inp_in: *mut bindings::VipsImage = inp.ctx;
2710        let mut out_out: *mut bindings::VipsImage = null_mut();
2711
2712        let vips_op_response = bindings::vips_cache(inp_in, &mut out_out, NULL);
2713        utils::result(
2714            vips_op_response,
2715            VipsImage { ctx: out_out },
2716            Error::CacheError,
2717        )
2718    }
2719}
2720
2721/// Options for cache operation
2722#[derive(Clone, Debug)]
2723pub struct CacheOptions {
2724    /// max_tiles: `i32` -> Maximum number of tiles to cache
2725    /// min: -1, max: 1000000, default: 1000
2726    pub max_tiles: i32,
2727    /// tile_height: `i32` -> Tile height in pixels
2728    /// min: 1, max: 1000000, default: 128
2729    pub tile_height: i32,
2730    /// tile_width: `i32` -> Tile width in pixels
2731    /// min: 1, max: 1000000, default: 128
2732    pub tile_width: i32,
2733}
2734
2735impl std::default::Default for CacheOptions {
2736    fn default() -> Self {
2737        CacheOptions {
2738            max_tiles: i32::from(1000),
2739            tile_height: i32::from(128),
2740            tile_width: i32::from(128),
2741        }
2742    }
2743}
2744
2745/// VipsCache (cache), cache an image
2746/// inp: `&VipsImage` -> Input image
2747/// cache_options: `&CacheOptions` -> optional arguments
2748/// returns `VipsImage` - Output image
2749pub fn cache_with_opts(inp: &VipsImage, cache_options: &CacheOptions) -> Result<VipsImage> {
2750    unsafe {
2751        let inp_in: *mut bindings::VipsImage = inp.ctx;
2752        let mut out_out: *mut bindings::VipsImage = null_mut();
2753
2754        let max_tiles_in: i32 = cache_options.max_tiles;
2755        let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2756
2757        let tile_height_in: i32 = cache_options.tile_height;
2758        let tile_height_in_name = utils::new_c_string("tile-height")?;
2759
2760        let tile_width_in: i32 = cache_options.tile_width;
2761        let tile_width_in_name = utils::new_c_string("tile-width")?;
2762
2763        let vips_op_response = bindings::vips_cache(
2764            inp_in,
2765            &mut out_out,
2766            max_tiles_in_name.as_ptr(),
2767            max_tiles_in,
2768            tile_height_in_name.as_ptr(),
2769            tile_height_in,
2770            tile_width_in_name.as_ptr(),
2771            tile_width_in,
2772            NULL,
2773        );
2774        utils::result(
2775            vips_op_response,
2776            VipsImage { ctx: out_out },
2777            Error::CacheError,
2778        )
2779    }
2780}
2781
2782/// VipsEmbed (embed), embed an image in a larger image
2783/// inp: `&VipsImage` -> Input image
2784/// x: `i32` -> Left edge of input in output
2785/// min: -1000000000, max: 1000000000, default: 0
2786/// y: `i32` -> Top edge of input in output
2787/// min: -1000000000, max: 1000000000, default: 0
2788/// width: `i32` -> Image width in pixels
2789/// min: 1, max: 1000000000, default: 1
2790/// height: `i32` -> Image height in pixels
2791/// min: 1, max: 1000000000, default: 1
2792/// returns `VipsImage` - Output image
2793pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2794    unsafe {
2795        let inp_in: *mut bindings::VipsImage = inp.ctx;
2796        let x_in: i32 = x;
2797        let y_in: i32 = y;
2798        let width_in: i32 = width;
2799        let height_in: i32 = height;
2800        let mut out_out: *mut bindings::VipsImage = null_mut();
2801
2802        let vips_op_response =
2803            bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2804        utils::result(
2805            vips_op_response,
2806            VipsImage { ctx: out_out },
2807            Error::EmbedError,
2808        )
2809    }
2810}
2811
2812/// Options for embed operation
2813#[derive(Clone, Debug)]
2814pub struct EmbedOptions {
2815    /// extend: `Extend` -> How to generate the extra pixels
2816    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2817    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2818    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2819    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2820    ///  `White` -> VIPS_EXTEND_WHITE = 4
2821    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2822    ///  `Last` -> VIPS_EXTEND_LAST = 6
2823    pub extend: Extend,
2824    /// background: `Vec<f64>` -> Color for background pixels
2825    pub background: Vec<f64>,
2826}
2827
2828impl std::default::Default for EmbedOptions {
2829    fn default() -> Self {
2830        EmbedOptions {
2831            extend: Extend::Black,
2832            background: Vec::new(),
2833        }
2834    }
2835}
2836
2837/// VipsEmbed (embed), embed an image in a larger image
2838/// inp: `&VipsImage` -> Input image
2839/// x: `i32` -> Left edge of input in output
2840/// min: -1000000000, max: 1000000000, default: 0
2841/// y: `i32` -> Top edge of input in output
2842/// min: -1000000000, max: 1000000000, default: 0
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/// embed_options: `&EmbedOptions` -> optional arguments
2848/// returns `VipsImage` - Output image
2849pub fn embed_with_opts(
2850    inp: &VipsImage,
2851    x: i32,
2852    y: i32,
2853    width: i32,
2854    height: i32,
2855    embed_options: &EmbedOptions,
2856) -> Result<VipsImage> {
2857    unsafe {
2858        let inp_in: *mut bindings::VipsImage = inp.ctx;
2859        let x_in: i32 = x;
2860        let y_in: i32 = y;
2861        let width_in: i32 = width;
2862        let height_in: i32 = height;
2863        let mut out_out: *mut bindings::VipsImage = null_mut();
2864
2865        let extend_in: i32 = embed_options.extend as i32;
2866        let extend_in_name = utils::new_c_string("extend")?;
2867
2868        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2869        let background_in = background_wrapper.ctx;
2870        let background_in_name = utils::new_c_string("background")?;
2871
2872        let vips_op_response = bindings::vips_embed(
2873            inp_in,
2874            &mut out_out,
2875            x_in,
2876            y_in,
2877            width_in,
2878            height_in,
2879            extend_in_name.as_ptr(),
2880            extend_in,
2881            background_in_name.as_ptr(),
2882            background_in,
2883            NULL,
2884        );
2885        utils::result(
2886            vips_op_response,
2887            VipsImage { ctx: out_out },
2888            Error::EmbedError,
2889        )
2890    }
2891}
2892
2893/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2894/// inp: `&VipsImage` -> Input image
2895/// direction: `CompassDirection` -> Direction to place image within width/height
2896///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2897///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2898///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2899///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2900///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2901///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2902///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2903///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2904///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2905///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2906/// width: `i32` -> Image width in pixels
2907/// min: 1, max: 1000000000, default: 1
2908/// height: `i32` -> Image height in pixels
2909/// min: 1, max: 1000000000, default: 1
2910/// returns `VipsImage` - Output image
2911pub fn gravity(
2912    inp: &VipsImage,
2913    direction: CompassDirection,
2914    width: i32,
2915    height: i32,
2916) -> Result<VipsImage> {
2917    unsafe {
2918        let inp_in: *mut bindings::VipsImage = inp.ctx;
2919        let direction_in: i32 = direction as i32;
2920        let width_in: i32 = width;
2921        let height_in: i32 = height;
2922        let mut out_out: *mut bindings::VipsImage = null_mut();
2923
2924        let vips_op_response = bindings::vips_gravity(
2925            inp_in,
2926            &mut out_out,
2927            direction_in.try_into().unwrap(),
2928            width_in,
2929            height_in,
2930            NULL,
2931        );
2932        utils::result(
2933            vips_op_response,
2934            VipsImage { ctx: out_out },
2935            Error::GravityError,
2936        )
2937    }
2938}
2939
2940/// Options for gravity operation
2941#[derive(Clone, Debug)]
2942pub struct GravityOptions {
2943    /// extend: `Extend` -> How to generate the extra pixels
2944    ///  `Black` -> VIPS_EXTEND_BLACK = 0 [DEFAULT]
2945    ///  `Copy` -> VIPS_EXTEND_COPY = 1
2946    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
2947    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
2948    ///  `White` -> VIPS_EXTEND_WHITE = 4
2949    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5
2950    ///  `Last` -> VIPS_EXTEND_LAST = 6
2951    pub extend: Extend,
2952    /// background: `Vec<f64>` -> Color for background pixels
2953    pub background: Vec<f64>,
2954}
2955
2956impl std::default::Default for GravityOptions {
2957    fn default() -> Self {
2958        GravityOptions {
2959            extend: Extend::Black,
2960            background: Vec::new(),
2961        }
2962    }
2963}
2964
2965/// VipsGravity (gravity), place an image within a larger image with a certain gravity
2966/// inp: `&VipsImage` -> Input image
2967/// direction: `CompassDirection` -> Direction to place image within width/height
2968///  `Centre` -> VIPS_COMPASS_DIRECTION_CENTRE = 0 [DEFAULT]
2969///  `North` -> VIPS_COMPASS_DIRECTION_NORTH = 1
2970///  `East` -> VIPS_COMPASS_DIRECTION_EAST = 2
2971///  `South` -> VIPS_COMPASS_DIRECTION_SOUTH = 3
2972///  `West` -> VIPS_COMPASS_DIRECTION_WEST = 4
2973///  `NorthEast` -> VIPS_COMPASS_DIRECTION_NORTH_EAST = 5
2974///  `SouthEast` -> VIPS_COMPASS_DIRECTION_SOUTH_EAST = 6
2975///  `SouthWest` -> VIPS_COMPASS_DIRECTION_SOUTH_WEST = 7
2976///  `NorthWest` -> VIPS_COMPASS_DIRECTION_NORTH_WEST = 8
2977///  `Last` -> VIPS_COMPASS_DIRECTION_LAST = 9
2978/// width: `i32` -> Image width in pixels
2979/// min: 1, max: 1000000000, default: 1
2980/// height: `i32` -> Image height in pixels
2981/// min: 1, max: 1000000000, default: 1
2982/// gravity_options: `&GravityOptions` -> optional arguments
2983/// returns `VipsImage` - Output image
2984pub fn gravity_with_opts(
2985    inp: &VipsImage,
2986    direction: CompassDirection,
2987    width: i32,
2988    height: i32,
2989    gravity_options: &GravityOptions,
2990) -> Result<VipsImage> {
2991    unsafe {
2992        let inp_in: *mut bindings::VipsImage = inp.ctx;
2993        let direction_in: i32 = direction as i32;
2994        let width_in: i32 = width;
2995        let height_in: i32 = height;
2996        let mut out_out: *mut bindings::VipsImage = null_mut();
2997
2998        let extend_in: i32 = gravity_options.extend as i32;
2999        let extend_in_name = utils::new_c_string("extend")?;
3000
3001        let background_wrapper =
3002            utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
3003        let background_in = background_wrapper.ctx;
3004        let background_in_name = utils::new_c_string("background")?;
3005
3006        let vips_op_response = bindings::vips_gravity(
3007            inp_in,
3008            &mut out_out,
3009            direction_in.try_into().unwrap(),
3010            width_in,
3011            height_in,
3012            extend_in_name.as_ptr(),
3013            extend_in,
3014            background_in_name.as_ptr(),
3015            background_in,
3016            NULL,
3017        );
3018        utils::result(
3019            vips_op_response,
3020            VipsImage { ctx: out_out },
3021            Error::GravityError,
3022        )
3023    }
3024}
3025
3026/// VipsFlip (flip), flip an image
3027/// inp: `&VipsImage` -> Input image
3028/// direction: `Direction` -> Direction to flip image
3029///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3030///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3031///  `Last` -> VIPS_DIRECTION_LAST = 2
3032/// returns `VipsImage` - Output image
3033pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3034    unsafe {
3035        let inp_in: *mut bindings::VipsImage = inp.ctx;
3036        let direction_in: i32 = direction as i32;
3037        let mut out_out: *mut bindings::VipsImage = null_mut();
3038
3039        let vips_op_response =
3040            bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3041        utils::result(
3042            vips_op_response,
3043            VipsImage { ctx: out_out },
3044            Error::FlipError,
3045        )
3046    }
3047}
3048
3049/// VipsInsert (insert), insert image @sub into @main at @x, @y
3050/// main: `&VipsImage` -> Main input image
3051/// sub: `&VipsImage` -> Sub-image to insert into main image
3052/// x: `i32` -> Left edge of sub in main
3053/// min: -10000000, max: 10000000, default: 0
3054/// y: `i32` -> Top edge of sub in main
3055/// min: -10000000, max: 10000000, default: 0
3056/// returns `VipsImage` - Output image
3057pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3058    unsafe {
3059        let main_in: *mut bindings::VipsImage = main.ctx;
3060        let sub_in: *mut bindings::VipsImage = sub.ctx;
3061        let x_in: i32 = x;
3062        let y_in: i32 = y;
3063        let mut out_out: *mut bindings::VipsImage = null_mut();
3064
3065        let vips_op_response =
3066            bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3067        utils::result(
3068            vips_op_response,
3069            VipsImage { ctx: out_out },
3070            Error::InsertError,
3071        )
3072    }
3073}
3074
3075/// Options for insert operation
3076#[derive(Clone, Debug)]
3077pub struct InsertOptions {
3078    /// expand: `bool` -> Expand output to hold all of both inputs
3079    /// default: false
3080    pub expand: bool,
3081    /// background: `Vec<f64>` -> Color for new pixels
3082    pub background: Vec<f64>,
3083}
3084
3085impl std::default::Default for InsertOptions {
3086    fn default() -> Self {
3087        InsertOptions {
3088            expand: false,
3089            background: Vec::new(),
3090        }
3091    }
3092}
3093
3094/// VipsInsert (insert), insert image @sub into @main at @x, @y
3095/// main: `&VipsImage` -> Main input image
3096/// sub: `&VipsImage` -> Sub-image to insert into main image
3097/// x: `i32` -> Left edge of sub in main
3098/// min: -10000000, max: 10000000, default: 0
3099/// y: `i32` -> Top edge of sub in main
3100/// min: -10000000, max: 10000000, default: 0
3101/// insert_options: `&InsertOptions` -> optional arguments
3102/// returns `VipsImage` - Output image
3103pub fn insert_with_opts(
3104    main: &VipsImage,
3105    sub: &VipsImage,
3106    x: i32,
3107    y: i32,
3108    insert_options: &InsertOptions,
3109) -> Result<VipsImage> {
3110    unsafe {
3111        let main_in: *mut bindings::VipsImage = main.ctx;
3112        let sub_in: *mut bindings::VipsImage = sub.ctx;
3113        let x_in: i32 = x;
3114        let y_in: i32 = y;
3115        let mut out_out: *mut bindings::VipsImage = null_mut();
3116
3117        let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3118        let expand_in_name = utils::new_c_string("expand")?;
3119
3120        let background_wrapper =
3121            utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3122        let background_in = background_wrapper.ctx;
3123        let background_in_name = utils::new_c_string("background")?;
3124
3125        let vips_op_response = bindings::vips_insert(
3126            main_in,
3127            sub_in,
3128            &mut out_out,
3129            x_in,
3130            y_in,
3131            expand_in_name.as_ptr(),
3132            expand_in,
3133            background_in_name.as_ptr(),
3134            background_in,
3135            NULL,
3136        );
3137        utils::result(
3138            vips_op_response,
3139            VipsImage { ctx: out_out },
3140            Error::InsertError,
3141        )
3142    }
3143}
3144
3145/// VipsJoin (join), join a pair of images
3146/// in_1: `&VipsImage` -> First input image
3147/// in_2: `&VipsImage` -> Second input image
3148/// direction: `Direction` -> Join left-right or up-down
3149///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3150///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3151///  `Last` -> VIPS_DIRECTION_LAST = 2
3152/// returns `VipsImage` - Output image
3153pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3154    unsafe {
3155        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3156        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3157        let direction_in: i32 = direction as i32;
3158        let mut out_out: *mut bindings::VipsImage = null_mut();
3159
3160        let vips_op_response = bindings::vips_join(
3161            in_1_in,
3162            in_2_in,
3163            &mut out_out,
3164            direction_in.try_into().unwrap(),
3165            NULL,
3166        );
3167        utils::result(
3168            vips_op_response,
3169            VipsImage { ctx: out_out },
3170            Error::JoinError,
3171        )
3172    }
3173}
3174
3175/// Options for join operation
3176#[derive(Clone, Debug)]
3177pub struct JoinOptions {
3178    /// expand: `bool` -> Expand output to hold all of both inputs
3179    /// default: false
3180    pub expand: bool,
3181    /// shim: `i32` -> Pixels between images
3182    /// min: 0, max: 1000000, default: 0
3183    pub shim: i32,
3184    /// background: `Vec<f64>` -> Colour for new pixels
3185    pub background: Vec<f64>,
3186    /// align: `Align` -> Align on the low, centre or high coordinate edge
3187    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3188    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3189    ///  `High` -> VIPS_ALIGN_HIGH = 2
3190    ///  `Last` -> VIPS_ALIGN_LAST = 3
3191    pub align: Align,
3192}
3193
3194impl std::default::Default for JoinOptions {
3195    fn default() -> Self {
3196        JoinOptions {
3197            expand: false,
3198            shim: i32::from(0),
3199            background: Vec::new(),
3200            align: Align::Low,
3201        }
3202    }
3203}
3204
3205/// VipsJoin (join), join a pair of images
3206/// in_1: `&VipsImage` -> First input image
3207/// in_2: `&VipsImage` -> Second input image
3208/// direction: `Direction` -> Join left-right or up-down
3209///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
3210///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
3211///  `Last` -> VIPS_DIRECTION_LAST = 2
3212/// join_options: `&JoinOptions` -> optional arguments
3213/// returns `VipsImage` - Output image
3214pub fn join_with_opts(
3215    in_1: &VipsImage,
3216    in_2: &VipsImage,
3217    direction: Direction,
3218    join_options: &JoinOptions,
3219) -> Result<VipsImage> {
3220    unsafe {
3221        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3222        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3223        let direction_in: i32 = direction as i32;
3224        let mut out_out: *mut bindings::VipsImage = null_mut();
3225
3226        let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3227        let expand_in_name = utils::new_c_string("expand")?;
3228
3229        let shim_in: i32 = join_options.shim;
3230        let shim_in_name = utils::new_c_string("shim")?;
3231
3232        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3233        let background_in = background_wrapper.ctx;
3234        let background_in_name = utils::new_c_string("background")?;
3235
3236        let align_in: i32 = join_options.align as i32;
3237        let align_in_name = utils::new_c_string("align")?;
3238
3239        let vips_op_response = bindings::vips_join(
3240            in_1_in,
3241            in_2_in,
3242            &mut out_out,
3243            direction_in.try_into().unwrap(),
3244            expand_in_name.as_ptr(),
3245            expand_in,
3246            shim_in_name.as_ptr(),
3247            shim_in,
3248            background_in_name.as_ptr(),
3249            background_in,
3250            align_in_name.as_ptr(),
3251            align_in,
3252            NULL,
3253        );
3254        utils::result(
3255            vips_op_response,
3256            VipsImage { ctx: out_out },
3257            Error::JoinError,
3258        )
3259    }
3260}
3261
3262/// VipsArrayjoin (arrayjoin), join an array of images
3263/// inp: `&mut [VipsImage]` -> Array of input images
3264/// returns `VipsImage` - Output image
3265pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3266    unsafe {
3267        let (inp_len, mut inp_in) = {
3268            let len = inp.len();
3269            let mut input = Vec::new();
3270            for img in inp {
3271                input.push(img.ctx)
3272            }
3273            (len as i32, input)
3274        };
3275        let mut out_out: *mut bindings::VipsImage = null_mut();
3276
3277        let vips_op_response =
3278            bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3279        utils::result(
3280            vips_op_response,
3281            VipsImage { ctx: out_out },
3282            Error::ArrayjoinError,
3283        )
3284    }
3285}
3286
3287/// Options for arrayjoin operation
3288#[derive(Clone, Debug)]
3289pub struct ArrayjoinOptions {
3290    /// across: `i32` -> Number of images across grid
3291    /// min: 1, max: 1000000, default: 1
3292    pub across: i32,
3293    /// shim: `i32` -> Pixels between images
3294    /// min: 0, max: 1000000, default: 0
3295    pub shim: i32,
3296    /// background: `Vec<f64>` -> Colour for new pixels
3297    pub background: Vec<f64>,
3298    /// halign: `Align` -> Align on the left, centre or right
3299    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3300    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3301    ///  `High` -> VIPS_ALIGN_HIGH = 2
3302    ///  `Last` -> VIPS_ALIGN_LAST = 3
3303    pub halign: Align,
3304    /// valign: `Align` -> Align on the top, centre or bottom
3305    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
3306    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
3307    ///  `High` -> VIPS_ALIGN_HIGH = 2
3308    ///  `Last` -> VIPS_ALIGN_LAST = 3
3309    pub valign: Align,
3310    /// hspacing: `i32` -> Horizontal spacing between images
3311    /// min: 1, max: 1000000, default: 1
3312    pub hspacing: i32,
3313    /// vspacing: `i32` -> Vertical spacing between images
3314    /// min: 1, max: 1000000, default: 1
3315    pub vspacing: i32,
3316}
3317
3318impl std::default::Default for ArrayjoinOptions {
3319    fn default() -> Self {
3320        ArrayjoinOptions {
3321            across: i32::from(1),
3322            shim: i32::from(0),
3323            background: Vec::new(),
3324            halign: Align::Low,
3325            valign: Align::Low,
3326            hspacing: i32::from(1),
3327            vspacing: i32::from(1),
3328        }
3329    }
3330}
3331
3332/// VipsArrayjoin (arrayjoin), join an array of images
3333/// inp: `&mut [VipsImage]` -> Array of input images
3334/// arrayjoin_options: `&ArrayjoinOptions` -> optional arguments
3335/// returns `VipsImage` - Output image
3336pub fn arrayjoin_with_opts(
3337    inp: &mut [VipsImage],
3338    arrayjoin_options: &ArrayjoinOptions,
3339) -> Result<VipsImage> {
3340    unsafe {
3341        let (inp_len, mut inp_in) = {
3342            let len = inp.len();
3343            let mut input = Vec::new();
3344            for img in inp {
3345                input.push(img.ctx)
3346            }
3347            (len as i32, input)
3348        };
3349        let mut out_out: *mut bindings::VipsImage = null_mut();
3350
3351        let across_in: i32 = arrayjoin_options.across;
3352        let across_in_name = utils::new_c_string("across")?;
3353
3354        let shim_in: i32 = arrayjoin_options.shim;
3355        let shim_in_name = utils::new_c_string("shim")?;
3356
3357        let background_wrapper =
3358            utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3359        let background_in = background_wrapper.ctx;
3360        let background_in_name = utils::new_c_string("background")?;
3361
3362        let halign_in: i32 = arrayjoin_options.halign as i32;
3363        let halign_in_name = utils::new_c_string("halign")?;
3364
3365        let valign_in: i32 = arrayjoin_options.valign as i32;
3366        let valign_in_name = utils::new_c_string("valign")?;
3367
3368        let hspacing_in: i32 = arrayjoin_options.hspacing;
3369        let hspacing_in_name = utils::new_c_string("hspacing")?;
3370
3371        let vspacing_in: i32 = arrayjoin_options.vspacing;
3372        let vspacing_in_name = utils::new_c_string("vspacing")?;
3373
3374        let vips_op_response = bindings::vips_arrayjoin(
3375            inp_in.as_mut_ptr(),
3376            &mut out_out,
3377            inp_len,
3378            across_in_name.as_ptr(),
3379            across_in,
3380            shim_in_name.as_ptr(),
3381            shim_in,
3382            background_in_name.as_ptr(),
3383            background_in,
3384            halign_in_name.as_ptr(),
3385            halign_in,
3386            valign_in_name.as_ptr(),
3387            valign_in,
3388            hspacing_in_name.as_ptr(),
3389            hspacing_in,
3390            vspacing_in_name.as_ptr(),
3391            vspacing_in,
3392            NULL,
3393        );
3394        utils::result(
3395            vips_op_response,
3396            VipsImage { ctx: out_out },
3397            Error::ArrayjoinError,
3398        )
3399    }
3400}
3401
3402/// VipsExtractArea (extract_area), extract an area from an image
3403/// input: `&VipsImage` -> Input image
3404/// left: `i32` -> Left edge of extract area
3405/// min: -10000000, max: 10000000, default: 0
3406/// top: `i32` -> Top edge of extract area
3407/// min: -10000000, max: 10000000, default: 0
3408/// width: `i32` -> Width of extract area
3409/// min: 1, max: 10000000, default: 1
3410/// height: `i32` -> Height of extract area
3411/// min: 1, max: 10000000, default: 1
3412/// returns `VipsImage` - Output image
3413pub fn extract_area(
3414    input: &VipsImage,
3415    left: i32,
3416    top: i32,
3417    width: i32,
3418    height: i32,
3419) -> Result<VipsImage> {
3420    unsafe {
3421        let input_in: *mut bindings::VipsImage = input.ctx;
3422        let left_in: i32 = left;
3423        let top_in: i32 = top;
3424        let width_in: i32 = width;
3425        let height_in: i32 = height;
3426        let mut out_out: *mut bindings::VipsImage = null_mut();
3427
3428        let vips_op_response = bindings::vips_extract_area(
3429            input_in,
3430            &mut out_out,
3431            left_in,
3432            top_in,
3433            width_in,
3434            height_in,
3435            NULL,
3436        );
3437        utils::result(
3438            vips_op_response,
3439            VipsImage { ctx: out_out },
3440            Error::ExtractAreaError,
3441        )
3442    }
3443}
3444
3445/// VipsSmartcrop (smartcrop), extract an area from an image
3446/// input: `&VipsImage` -> Input image
3447/// width: `i32` -> Width of extract area
3448/// min: 1, max: 10000000, default: 1
3449/// height: `i32` -> Height of extract area
3450/// min: 1, max: 10000000, default: 1
3451/// returns `VipsImage` - Output image
3452pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3453    unsafe {
3454        let input_in: *mut bindings::VipsImage = input.ctx;
3455        let width_in: i32 = width;
3456        let height_in: i32 = height;
3457        let mut out_out: *mut bindings::VipsImage = null_mut();
3458
3459        let vips_op_response =
3460            bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3461        utils::result(
3462            vips_op_response,
3463            VipsImage { ctx: out_out },
3464            Error::SmartcropError,
3465        )
3466    }
3467}
3468
3469/// Options for smartcrop operation
3470#[derive(Clone, Debug)]
3471pub struct SmartcropOptions {
3472    /// attention_x: `i32` -> Horizontal position of attention centre
3473    /// min: 0, max: 10000000, default: 0
3474    pub attention_x: i32,
3475    /// attention_y: `i32` -> Vertical position of attention centre
3476    /// min: 0, max: 10000000, default: 0
3477    pub attention_y: i32,
3478    /// interesting: `Interesting` -> How to measure interestingness
3479    ///  `None` -> VIPS_INTERESTING_NONE = 0
3480    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
3481    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
3482    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3 [DEFAULT]
3483    ///  `Low` -> VIPS_INTERESTING_LOW = 4
3484    ///  `High` -> VIPS_INTERESTING_HIGH = 5
3485    ///  `All` -> VIPS_INTERESTING_ALL = 6
3486    ///  `Last` -> VIPS_INTERESTING_LAST = 7
3487    pub interesting: Interesting,
3488    /// premultiplied: `bool` -> Input image already has premultiplied alpha
3489    /// default: false
3490    pub premultiplied: bool,
3491}
3492
3493impl std::default::Default for SmartcropOptions {
3494    fn default() -> Self {
3495        SmartcropOptions {
3496            attention_x: i32::from(0),
3497            attention_y: i32::from(0),
3498            interesting: Interesting::Attention,
3499            premultiplied: false,
3500        }
3501    }
3502}
3503
3504/// VipsSmartcrop (smartcrop), extract an area from an image
3505/// input: `&VipsImage` -> Input image
3506/// width: `i32` -> Width of extract area
3507/// min: 1, max: 10000000, default: 1
3508/// height: `i32` -> Height of extract area
3509/// min: 1, max: 10000000, default: 1
3510/// smartcrop_options: `&SmartcropOptions` -> optional arguments
3511/// returns `VipsImage` - Output image
3512pub fn smartcrop_with_opts(
3513    input: &VipsImage,
3514    width: i32,
3515    height: i32,
3516    smartcrop_options: &SmartcropOptions,
3517) -> Result<VipsImage> {
3518    unsafe {
3519        let input_in: *mut bindings::VipsImage = input.ctx;
3520        let width_in: i32 = width;
3521        let height_in: i32 = height;
3522        let mut out_out: *mut bindings::VipsImage = null_mut();
3523
3524        let attention_x_in: i32 = smartcrop_options.attention_x;
3525        let attention_x_in_name = utils::new_c_string("attention-x")?;
3526
3527        let attention_y_in: i32 = smartcrop_options.attention_y;
3528        let attention_y_in_name = utils::new_c_string("attention-y")?;
3529
3530        let interesting_in: i32 = smartcrop_options.interesting as i32;
3531        let interesting_in_name = utils::new_c_string("interesting")?;
3532
3533        let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3534            1
3535        } else {
3536            0
3537        };
3538        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3539
3540        let vips_op_response = bindings::vips_smartcrop(
3541            input_in,
3542            &mut out_out,
3543            width_in,
3544            height_in,
3545            attention_x_in_name.as_ptr(),
3546            attention_x_in,
3547            attention_y_in_name.as_ptr(),
3548            attention_y_in,
3549            interesting_in_name.as_ptr(),
3550            interesting_in,
3551            premultiplied_in_name.as_ptr(),
3552            premultiplied_in,
3553            NULL,
3554        );
3555        utils::result(
3556            vips_op_response,
3557            VipsImage { ctx: out_out },
3558            Error::SmartcropError,
3559        )
3560    }
3561}
3562
3563/// VipsExtractBand (extract_band), extract band from an image
3564/// inp: `&VipsImage` -> Input image
3565/// band: `i32` -> Band to extract
3566/// min: 0, max: 10000000, default: 0
3567/// returns `VipsImage` - Output image
3568pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3569    unsafe {
3570        let inp_in: *mut bindings::VipsImage = inp.ctx;
3571        let band_in: i32 = band;
3572        let mut out_out: *mut bindings::VipsImage = null_mut();
3573
3574        let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3575        utils::result(
3576            vips_op_response,
3577            VipsImage { ctx: out_out },
3578            Error::ExtractBandError,
3579        )
3580    }
3581}
3582
3583/// Options for extract_band operation
3584#[derive(Clone, Debug)]
3585pub struct ExtractBandOptions {
3586    /// n: `i32` -> Number of bands to extract
3587    /// min: 1, max: 10000000, default: 1
3588    pub n: i32,
3589}
3590
3591impl std::default::Default for ExtractBandOptions {
3592    fn default() -> Self {
3593        ExtractBandOptions { n: i32::from(1) }
3594    }
3595}
3596
3597/// VipsExtractBand (extract_band), extract band from an image
3598/// inp: `&VipsImage` -> Input image
3599/// band: `i32` -> Band to extract
3600/// min: 0, max: 10000000, default: 0
3601/// extract_band_options: `&ExtractBandOptions` -> optional arguments
3602/// returns `VipsImage` - Output image
3603pub fn extract_band_with_opts(
3604    inp: &VipsImage,
3605    band: i32,
3606    extract_band_options: &ExtractBandOptions,
3607) -> Result<VipsImage> {
3608    unsafe {
3609        let inp_in: *mut bindings::VipsImage = inp.ctx;
3610        let band_in: i32 = band;
3611        let mut out_out: *mut bindings::VipsImage = null_mut();
3612
3613        let n_in: i32 = extract_band_options.n;
3614        let n_in_name = utils::new_c_string("n")?;
3615
3616        let vips_op_response = bindings::vips_extract_band(
3617            inp_in,
3618            &mut out_out,
3619            band_in,
3620            n_in_name.as_ptr(),
3621            n_in,
3622            NULL,
3623        );
3624        utils::result(
3625            vips_op_response,
3626            VipsImage { ctx: out_out },
3627            Error::ExtractBandError,
3628        )
3629    }
3630}
3631
3632/// VipsBandjoin (bandjoin), bandwise join a set of images
3633/// inp: `&mut [VipsImage]` -> Array of input images
3634/// returns `VipsImage` - Output image
3635pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3636    unsafe {
3637        let (inp_len, mut inp_in) = {
3638            let len = inp.len();
3639            let mut input = Vec::new();
3640            for img in inp {
3641                input.push(img.ctx)
3642            }
3643            (len as i32, input)
3644        };
3645        let mut out_out: *mut bindings::VipsImage = null_mut();
3646
3647        let vips_op_response =
3648            bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3649        utils::result(
3650            vips_op_response,
3651            VipsImage { ctx: out_out },
3652            Error::BandjoinError,
3653        )
3654    }
3655}
3656
3657/// VipsBandjoinConst (bandjoin_const), append a constant band to an image
3658/// inp: `&VipsImage` -> Input image
3659/// c: `&mut [f64]` -> Array of constants to add
3660/// returns `VipsImage` - Output image
3661pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3662    unsafe {
3663        let inp_in: *mut bindings::VipsImage = inp.ctx;
3664        let c_in: *mut f64 = c.as_mut_ptr();
3665        let mut out_out: *mut bindings::VipsImage = null_mut();
3666
3667        let vips_op_response =
3668            bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3669        utils::result(
3670            vips_op_response,
3671            VipsImage { ctx: out_out },
3672            Error::BandjoinConstError,
3673        )
3674    }
3675}
3676
3677/// VipsBandrank (bandrank), band-wise rank of a set of images
3678/// inp: `&mut [VipsImage]` -> Array of input images
3679/// returns `VipsImage` - Output image
3680pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3681    unsafe {
3682        let (inp_len, mut inp_in) = {
3683            let len = inp.len();
3684            let mut input = Vec::new();
3685            for img in inp {
3686                input.push(img.ctx)
3687            }
3688            (len as i32, input)
3689        };
3690        let mut out_out: *mut bindings::VipsImage = null_mut();
3691
3692        let vips_op_response =
3693            bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3694        utils::result(
3695            vips_op_response,
3696            VipsImage { ctx: out_out },
3697            Error::BandrankError,
3698        )
3699    }
3700}
3701
3702/// Options for bandrank operation
3703#[derive(Clone, Debug)]
3704pub struct BandrankOptions {
3705    /// index: `i32` -> Select this band element from sorted list
3706    /// min: -1, max: 1000000, default: -1
3707    pub index: i32,
3708}
3709
3710impl std::default::Default for BandrankOptions {
3711    fn default() -> Self {
3712        BandrankOptions {
3713            index: i32::from(-1),
3714        }
3715    }
3716}
3717
3718/// VipsBandrank (bandrank), band-wise rank of a set of images
3719/// inp: `&mut [VipsImage]` -> Array of input images
3720/// bandrank_options: `&BandrankOptions` -> optional arguments
3721/// returns `VipsImage` - Output image
3722pub fn bandrank_with_opts(
3723    inp: &mut [VipsImage],
3724    bandrank_options: &BandrankOptions,
3725) -> Result<VipsImage> {
3726    unsafe {
3727        let (inp_len, mut inp_in) = {
3728            let len = inp.len();
3729            let mut input = Vec::new();
3730            for img in inp {
3731                input.push(img.ctx)
3732            }
3733            (len as i32, input)
3734        };
3735        let mut out_out: *mut bindings::VipsImage = null_mut();
3736
3737        let index_in: i32 = bandrank_options.index;
3738        let index_in_name = utils::new_c_string("index")?;
3739
3740        let vips_op_response = bindings::vips_bandrank(
3741            inp_in.as_mut_ptr(),
3742            &mut out_out,
3743            inp_len,
3744            index_in_name.as_ptr(),
3745            index_in,
3746            NULL,
3747        );
3748        utils::result(
3749            vips_op_response,
3750            VipsImage { ctx: out_out },
3751            Error::BandrankError,
3752        )
3753    }
3754}
3755
3756/// VipsBandmean (bandmean), band-wise average
3757/// inp: `&VipsImage` -> Input image argument
3758/// returns `VipsImage` - Output image
3759pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3760    unsafe {
3761        let inp_in: *mut bindings::VipsImage = inp.ctx;
3762        let mut out_out: *mut bindings::VipsImage = null_mut();
3763
3764        let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3765        utils::result(
3766            vips_op_response,
3767            VipsImage { ctx: out_out },
3768            Error::BandmeanError,
3769        )
3770    }
3771}
3772
3773/// VipsBandbool (bandbool), boolean operation across image bands
3774/// inp: `&VipsImage` -> Input image argument
3775/// boolean: `OperationBoolean` -> Boolean to perform
3776///  `And` -> VIPS_OPERATION_BOOLEAN_AND = 0 [DEFAULT]
3777///  `Or` -> VIPS_OPERATION_BOOLEAN_OR = 1
3778///  `Eor` -> VIPS_OPERATION_BOOLEAN_EOR = 2
3779///  `Lshift` -> VIPS_OPERATION_BOOLEAN_LSHIFT = 3
3780///  `Rshift` -> VIPS_OPERATION_BOOLEAN_RSHIFT = 4
3781///  `Last` -> VIPS_OPERATION_BOOLEAN_LAST = 5
3782/// returns `VipsImage` - Output image
3783pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3784    unsafe {
3785        let inp_in: *mut bindings::VipsImage = inp.ctx;
3786        let boolean_in: i32 = boolean as i32;
3787        let mut out_out: *mut bindings::VipsImage = null_mut();
3788
3789        let vips_op_response =
3790            bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3791        utils::result(
3792            vips_op_response,
3793            VipsImage { ctx: out_out },
3794            Error::BandboolError,
3795        )
3796    }
3797}
3798
3799/// VipsReplicate (replicate), replicate an image
3800/// inp: `&VipsImage` -> Input image
3801/// across: `i32` -> Repeat this many times horizontally
3802/// min: 1, max: 1000000, default: 1
3803/// down: `i32` -> Repeat this many times vertically
3804/// min: 1, max: 1000000, default: 1
3805/// returns `VipsImage` - Output image
3806pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3807    unsafe {
3808        let inp_in: *mut bindings::VipsImage = inp.ctx;
3809        let across_in: i32 = across;
3810        let down_in: i32 = down;
3811        let mut out_out: *mut bindings::VipsImage = null_mut();
3812
3813        let vips_op_response =
3814            bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3815        utils::result(
3816            vips_op_response,
3817            VipsImage { ctx: out_out },
3818            Error::ReplicateError,
3819        )
3820    }
3821}
3822
3823/// VipsCast (cast), cast an image
3824/// inp: `&VipsImage` -> Input image
3825/// format: `BandFormat` -> Format to cast to
3826///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3827///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3828///  `Char` -> VIPS_FORMAT_CHAR = 1
3829///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3830///  `Short` -> VIPS_FORMAT_SHORT = 3
3831///  `Uint` -> VIPS_FORMAT_UINT = 4
3832///  `Int` -> VIPS_FORMAT_INT = 5
3833///  `Float` -> VIPS_FORMAT_FLOAT = 6
3834///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3835///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3836///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3837///  `Last` -> VIPS_FORMAT_LAST = 10
3838/// returns `VipsImage` - Output image
3839pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3840    unsafe {
3841        let inp_in: *mut bindings::VipsImage = inp.ctx;
3842        let format_in: i32 = format as i32;
3843        let mut out_out: *mut bindings::VipsImage = null_mut();
3844
3845        let vips_op_response =
3846            bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3847        utils::result(
3848            vips_op_response,
3849            VipsImage { ctx: out_out },
3850            Error::CastError,
3851        )
3852    }
3853}
3854
3855/// Options for cast operation
3856#[derive(Clone, Debug)]
3857pub struct CastOptions {
3858    /// shift: `bool` -> Shift integer values up and down
3859    /// default: false
3860    pub shift: bool,
3861}
3862
3863impl std::default::Default for CastOptions {
3864    fn default() -> Self {
3865        CastOptions { shift: false }
3866    }
3867}
3868
3869/// VipsCast (cast), cast an image
3870/// inp: `&VipsImage` -> Input image
3871/// format: `BandFormat` -> Format to cast to
3872///  `Notset` -> VIPS_FORMAT_NOTSET = -1
3873///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
3874///  `Char` -> VIPS_FORMAT_CHAR = 1
3875///  `Ushort` -> VIPS_FORMAT_USHORT = 2
3876///  `Short` -> VIPS_FORMAT_SHORT = 3
3877///  `Uint` -> VIPS_FORMAT_UINT = 4
3878///  `Int` -> VIPS_FORMAT_INT = 5
3879///  `Float` -> VIPS_FORMAT_FLOAT = 6
3880///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
3881///  `Double` -> VIPS_FORMAT_DOUBLE = 8
3882///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
3883///  `Last` -> VIPS_FORMAT_LAST = 10
3884/// cast_options: `&CastOptions` -> optional arguments
3885/// returns `VipsImage` - Output image
3886pub fn cast_with_opts(
3887    inp: &VipsImage,
3888    format: BandFormat,
3889    cast_options: &CastOptions,
3890) -> Result<VipsImage> {
3891    unsafe {
3892        let inp_in: *mut bindings::VipsImage = inp.ctx;
3893        let format_in: i32 = format as i32;
3894        let mut out_out: *mut bindings::VipsImage = null_mut();
3895
3896        let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3897        let shift_in_name = utils::new_c_string("shift")?;
3898
3899        let vips_op_response = bindings::vips_cast(
3900            inp_in,
3901            &mut out_out,
3902            format_in.try_into().unwrap(),
3903            shift_in_name.as_ptr(),
3904            shift_in,
3905            NULL,
3906        );
3907        utils::result(
3908            vips_op_response,
3909            VipsImage { ctx: out_out },
3910            Error::CastError,
3911        )
3912    }
3913}
3914
3915/// VipsRot (rot), rotate an image
3916/// inp: `&VipsImage` -> Input image
3917/// angle: `Angle` -> Angle to rotate image
3918///  `D0` -> VIPS_ANGLE_D0 = 0
3919///  `D90` -> VIPS_ANGLE_D90 = 1 [DEFAULT]
3920///  `D180` -> VIPS_ANGLE_D180 = 2
3921///  `D270` -> VIPS_ANGLE_D270 = 3
3922///  `Last` -> VIPS_ANGLE_LAST = 4
3923/// returns `VipsImage` - Output image
3924pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3925    unsafe {
3926        let inp_in: *mut bindings::VipsImage = inp.ctx;
3927        let angle_in: i32 = angle as i32;
3928        let mut out_out: *mut bindings::VipsImage = null_mut();
3929
3930        let vips_op_response =
3931            bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3932        utils::result(
3933            vips_op_response,
3934            VipsImage { ctx: out_out },
3935            Error::RotError,
3936        )
3937    }
3938}
3939
3940/// VipsRot45 (rot45), rotate an image
3941/// inp: `&VipsImage` -> Input image
3942/// returns `VipsImage` - Output image
3943pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3944    unsafe {
3945        let inp_in: *mut bindings::VipsImage = inp.ctx;
3946        let mut out_out: *mut bindings::VipsImage = null_mut();
3947
3948        let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3949        utils::result(
3950            vips_op_response,
3951            VipsImage { ctx: out_out },
3952            Error::Rot45Error,
3953        )
3954    }
3955}
3956
3957/// Options for rot_45 operation
3958#[derive(Clone, Debug)]
3959pub struct Rot45Options {
3960    /// angle: `Angle45` -> Angle to rotate image
3961    ///  `D0` -> VIPS_ANGLE45_D0 = 0
3962    ///  `D45` -> VIPS_ANGLE45_D45 = 1 [DEFAULT]
3963    ///  `D90` -> VIPS_ANGLE45_D90 = 2
3964    ///  `D135` -> VIPS_ANGLE45_D135 = 3
3965    ///  `D180` -> VIPS_ANGLE45_D180 = 4
3966    ///  `D225` -> VIPS_ANGLE45_D225 = 5
3967    ///  `D270` -> VIPS_ANGLE45_D270 = 6
3968    ///  `D315` -> VIPS_ANGLE45_D315 = 7
3969    ///  `Last` -> VIPS_ANGLE45_LAST = 8
3970    pub angle: Angle45,
3971}
3972
3973impl std::default::Default for Rot45Options {
3974    fn default() -> Self {
3975        Rot45Options {
3976            angle: Angle45::D45,
3977        }
3978    }
3979}
3980
3981/// VipsRot45 (rot45), rotate an image
3982/// inp: `&VipsImage` -> Input image
3983/// rot_45_options: `&Rot45Options` -> optional arguments
3984/// returns `VipsImage` - Output image
3985pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
3986    unsafe {
3987        let inp_in: *mut bindings::VipsImage = inp.ctx;
3988        let mut out_out: *mut bindings::VipsImage = null_mut();
3989
3990        let angle_in: i32 = rot_45_options.angle as i32;
3991        let angle_in_name = utils::new_c_string("angle")?;
3992
3993        let vips_op_response =
3994            bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
3995        utils::result(
3996            vips_op_response,
3997            VipsImage { ctx: out_out },
3998            Error::Rot45Error,
3999        )
4000    }
4001}
4002
4003/// VipsAutorot (autorot), autorotate image by exif tag
4004/// inp: `&VipsImage` -> Input image
4005/// returns `VipsImage` - Output image
4006pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
4007    unsafe {
4008        let inp_in: *mut bindings::VipsImage = inp.ctx;
4009        let mut out_out: *mut bindings::VipsImage = null_mut();
4010
4011        let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
4012        utils::result(
4013            vips_op_response,
4014            VipsImage { ctx: out_out },
4015            Error::AutorotError,
4016        )
4017    }
4018}
4019
4020/// Options for autorot operation
4021#[derive(Clone, Debug)]
4022pub struct AutorotOptions {
4023    /// angle: `Angle` -> Angle image was rotated by
4024    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
4025    ///  `D90` -> VIPS_ANGLE_D90 = 1
4026    ///  `D180` -> VIPS_ANGLE_D180 = 2
4027    ///  `D270` -> VIPS_ANGLE_D270 = 3
4028    ///  `Last` -> VIPS_ANGLE_LAST = 4
4029    pub angle: Angle,
4030    /// flip: `bool` -> Whether the image was flipped or not
4031    /// default: false
4032    pub flip: bool,
4033}
4034
4035impl std::default::Default for AutorotOptions {
4036    fn default() -> Self {
4037        AutorotOptions {
4038            angle: Angle::D0,
4039            flip: false,
4040        }
4041    }
4042}
4043
4044/// VipsAutorot (autorot), autorotate image by exif tag
4045/// inp: `&VipsImage` -> Input image
4046/// autorot_options: `&AutorotOptions` -> optional arguments
4047/// returns `VipsImage` - Output image
4048pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4049    unsafe {
4050        let inp_in: *mut bindings::VipsImage = inp.ctx;
4051        let mut out_out: *mut bindings::VipsImage = null_mut();
4052
4053        let angle_in: i32 = autorot_options.angle as i32;
4054        let angle_in_name = utils::new_c_string("angle")?;
4055
4056        let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4057        let flip_in_name = utils::new_c_string("flip")?;
4058
4059        let vips_op_response = bindings::vips_autorot(
4060            inp_in,
4061            &mut out_out,
4062            angle_in_name.as_ptr(),
4063            angle_in,
4064            flip_in_name.as_ptr(),
4065            flip_in,
4066            NULL,
4067        );
4068        utils::result(
4069            vips_op_response,
4070            VipsImage { ctx: out_out },
4071            Error::AutorotError,
4072        )
4073    }
4074}
4075
4076/// VipsIfthenelse (ifthenelse), ifthenelse an image
4077/// cond: `&VipsImage` -> Condition input image
4078/// in_1: `&VipsImage` -> Source for TRUE pixels
4079/// in_2: `&VipsImage` -> Source for FALSE pixels
4080/// returns `VipsImage` - Output image
4081pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4082    unsafe {
4083        let cond_in: *mut bindings::VipsImage = cond.ctx;
4084        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4085        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4086        let mut out_out: *mut bindings::VipsImage = null_mut();
4087
4088        let vips_op_response =
4089            bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4090        utils::result(
4091            vips_op_response,
4092            VipsImage { ctx: out_out },
4093            Error::IfthenelseError,
4094        )
4095    }
4096}
4097
4098/// Options for ifthenelse operation
4099#[derive(Clone, Debug)]
4100pub struct IfthenelseOptions {
4101    /// blend: `bool` -> Blend smoothly between then and else parts
4102    /// default: false
4103    pub blend: bool,
4104}
4105
4106impl std::default::Default for IfthenelseOptions {
4107    fn default() -> Self {
4108        IfthenelseOptions { blend: false }
4109    }
4110}
4111
4112/// VipsIfthenelse (ifthenelse), ifthenelse an image
4113/// cond: `&VipsImage` -> Condition input image
4114/// in_1: `&VipsImage` -> Source for TRUE pixels
4115/// in_2: `&VipsImage` -> Source for FALSE pixels
4116/// ifthenelse_options: `&IfthenelseOptions` -> optional arguments
4117/// returns `VipsImage` - Output image
4118pub fn ifthenelse_with_opts(
4119    cond: &VipsImage,
4120    in_1: &VipsImage,
4121    in_2: &VipsImage,
4122    ifthenelse_options: &IfthenelseOptions,
4123) -> Result<VipsImage> {
4124    unsafe {
4125        let cond_in: *mut bindings::VipsImage = cond.ctx;
4126        let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4127        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4128        let mut out_out: *mut bindings::VipsImage = null_mut();
4129
4130        let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4131        let blend_in_name = utils::new_c_string("blend")?;
4132
4133        let vips_op_response = bindings::vips_ifthenelse(
4134            cond_in,
4135            in_1_in,
4136            in_2_in,
4137            &mut out_out,
4138            blend_in_name.as_ptr(),
4139            blend_in,
4140            NULL,
4141        );
4142        utils::result(
4143            vips_op_response,
4144            VipsImage { ctx: out_out },
4145            Error::IfthenelseError,
4146        )
4147    }
4148}
4149
4150/// VipsRecomb (recomb), linear recombination with matrix
4151/// inp: `&VipsImage` -> Input image argument
4152/// m: `&VipsImage` -> Matrix of coefficients
4153/// returns `VipsImage` - Output image
4154pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4155    unsafe {
4156        let inp_in: *mut bindings::VipsImage = inp.ctx;
4157        let m_in: *mut bindings::VipsImage = m.ctx;
4158        let mut out_out: *mut bindings::VipsImage = null_mut();
4159
4160        let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4161        utils::result(
4162            vips_op_response,
4163            VipsImage { ctx: out_out },
4164            Error::RecombError,
4165        )
4166    }
4167}
4168
4169/// VipsBandfold (bandfold), fold up x axis into bands
4170/// inp: `&VipsImage` -> Input image
4171/// returns `VipsImage` - Output image
4172pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4173    unsafe {
4174        let inp_in: *mut bindings::VipsImage = inp.ctx;
4175        let mut out_out: *mut bindings::VipsImage = null_mut();
4176
4177        let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4178        utils::result(
4179            vips_op_response,
4180            VipsImage { ctx: out_out },
4181            Error::BandfoldError,
4182        )
4183    }
4184}
4185
4186/// Options for bandfold operation
4187#[derive(Clone, Debug)]
4188pub struct BandfoldOptions {
4189    /// factor: `i32` -> Fold by this factor
4190    /// min: 0, max: 10000000, default: 0
4191    pub factor: i32,
4192}
4193
4194impl std::default::Default for BandfoldOptions {
4195    fn default() -> Self {
4196        BandfoldOptions {
4197            factor: i32::from(0),
4198        }
4199    }
4200}
4201
4202/// VipsBandfold (bandfold), fold up x axis into bands
4203/// inp: `&VipsImage` -> Input image
4204/// bandfold_options: `&BandfoldOptions` -> optional arguments
4205/// returns `VipsImage` - Output image
4206pub fn bandfold_with_opts(
4207    inp: &VipsImage,
4208    bandfold_options: &BandfoldOptions,
4209) -> Result<VipsImage> {
4210    unsafe {
4211        let inp_in: *mut bindings::VipsImage = inp.ctx;
4212        let mut out_out: *mut bindings::VipsImage = null_mut();
4213
4214        let factor_in: i32 = bandfold_options.factor;
4215        let factor_in_name = utils::new_c_string("factor")?;
4216
4217        let vips_op_response = bindings::vips_bandfold(
4218            inp_in,
4219            &mut out_out,
4220            factor_in_name.as_ptr(),
4221            factor_in,
4222            NULL,
4223        );
4224        utils::result(
4225            vips_op_response,
4226            VipsImage { ctx: out_out },
4227            Error::BandfoldError,
4228        )
4229    }
4230}
4231
4232/// VipsBandunfold (bandunfold), unfold image bands into x axis
4233/// inp: `&VipsImage` -> Input image
4234/// returns `VipsImage` - Output image
4235pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4236    unsafe {
4237        let inp_in: *mut bindings::VipsImage = inp.ctx;
4238        let mut out_out: *mut bindings::VipsImage = null_mut();
4239
4240        let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4241        utils::result(
4242            vips_op_response,
4243            VipsImage { ctx: out_out },
4244            Error::BandunfoldError,
4245        )
4246    }
4247}
4248
4249/// Options for bandunfold operation
4250#[derive(Clone, Debug)]
4251pub struct BandunfoldOptions {
4252    /// factor: `i32` -> Unfold by this factor
4253    /// min: 0, max: 10000000, default: 0
4254    pub factor: i32,
4255}
4256
4257impl std::default::Default for BandunfoldOptions {
4258    fn default() -> Self {
4259        BandunfoldOptions {
4260            factor: i32::from(0),
4261        }
4262    }
4263}
4264
4265/// VipsBandunfold (bandunfold), unfold image bands into x axis
4266/// inp: `&VipsImage` -> Input image
4267/// bandunfold_options: `&BandunfoldOptions` -> optional arguments
4268/// returns `VipsImage` - Output image
4269pub fn bandunfold_with_opts(
4270    inp: &VipsImage,
4271    bandunfold_options: &BandunfoldOptions,
4272) -> Result<VipsImage> {
4273    unsafe {
4274        let inp_in: *mut bindings::VipsImage = inp.ctx;
4275        let mut out_out: *mut bindings::VipsImage = null_mut();
4276
4277        let factor_in: i32 = bandunfold_options.factor;
4278        let factor_in_name = utils::new_c_string("factor")?;
4279
4280        let vips_op_response = bindings::vips_bandunfold(
4281            inp_in,
4282            &mut out_out,
4283            factor_in_name.as_ptr(),
4284            factor_in,
4285            NULL,
4286        );
4287        utils::result(
4288            vips_op_response,
4289            VipsImage { ctx: out_out },
4290            Error::BandunfoldError,
4291        )
4292    }
4293}
4294
4295/// VipsFlatten (flatten), flatten alpha out of an image
4296/// inp: `&VipsImage` -> Input image
4297/// returns `VipsImage` - Output image
4298pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4299    unsafe {
4300        let inp_in: *mut bindings::VipsImage = inp.ctx;
4301        let mut out_out: *mut bindings::VipsImage = null_mut();
4302
4303        let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4304        utils::result(
4305            vips_op_response,
4306            VipsImage { ctx: out_out },
4307            Error::FlattenError,
4308        )
4309    }
4310}
4311
4312/// Options for flatten operation
4313#[derive(Clone, Debug)]
4314pub struct FlattenOptions {
4315    /// background: `Vec<f64>` -> Background value
4316    pub background: Vec<f64>,
4317    /// max_alpha: `f64` -> Maximum value of alpha channel
4318    /// min: 0, max: 100000000, default: 255
4319    pub max_alpha: f64,
4320}
4321
4322impl std::default::Default for FlattenOptions {
4323    fn default() -> Self {
4324        FlattenOptions {
4325            background: Vec::new(),
4326            max_alpha: f64::from(255),
4327        }
4328    }
4329}
4330
4331/// VipsFlatten (flatten), flatten alpha out of an image
4332/// inp: `&VipsImage` -> Input image
4333/// flatten_options: `&FlattenOptions` -> optional arguments
4334/// returns `VipsImage` - Output image
4335pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4336    unsafe {
4337        let inp_in: *mut bindings::VipsImage = inp.ctx;
4338        let mut out_out: *mut bindings::VipsImage = null_mut();
4339
4340        let background_wrapper =
4341            utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4342        let background_in = background_wrapper.ctx;
4343        let background_in_name = utils::new_c_string("background")?;
4344
4345        let max_alpha_in: f64 = flatten_options.max_alpha;
4346        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4347
4348        let vips_op_response = bindings::vips_flatten(
4349            inp_in,
4350            &mut out_out,
4351            background_in_name.as_ptr(),
4352            background_in,
4353            max_alpha_in_name.as_ptr(),
4354            max_alpha_in,
4355            NULL,
4356        );
4357        utils::result(
4358            vips_op_response,
4359            VipsImage { ctx: out_out },
4360            Error::FlattenError,
4361        )
4362    }
4363}
4364
4365/// VipsPremultiply (premultiply), premultiply image alpha
4366/// inp: `&VipsImage` -> Input image
4367/// returns `VipsImage` - Output image
4368pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4369    unsafe {
4370        let inp_in: *mut bindings::VipsImage = inp.ctx;
4371        let mut out_out: *mut bindings::VipsImage = null_mut();
4372
4373        let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4374        utils::result(
4375            vips_op_response,
4376            VipsImage { ctx: out_out },
4377            Error::PremultiplyError,
4378        )
4379    }
4380}
4381
4382/// Options for premultiply operation
4383#[derive(Clone, Debug)]
4384pub struct PremultiplyOptions {
4385    /// max_alpha: `f64` -> Maximum value of alpha channel
4386    /// min: 0, max: 100000000, default: 255
4387    pub max_alpha: f64,
4388}
4389
4390impl std::default::Default for PremultiplyOptions {
4391    fn default() -> Self {
4392        PremultiplyOptions {
4393            max_alpha: f64::from(255),
4394        }
4395    }
4396}
4397
4398/// VipsPremultiply (premultiply), premultiply image alpha
4399/// inp: `&VipsImage` -> Input image
4400/// premultiply_options: `&PremultiplyOptions` -> optional arguments
4401/// returns `VipsImage` - Output image
4402pub fn premultiply_with_opts(
4403    inp: &VipsImage,
4404    premultiply_options: &PremultiplyOptions,
4405) -> Result<VipsImage> {
4406    unsafe {
4407        let inp_in: *mut bindings::VipsImage = inp.ctx;
4408        let mut out_out: *mut bindings::VipsImage = null_mut();
4409
4410        let max_alpha_in: f64 = premultiply_options.max_alpha;
4411        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4412
4413        let vips_op_response = bindings::vips_premultiply(
4414            inp_in,
4415            &mut out_out,
4416            max_alpha_in_name.as_ptr(),
4417            max_alpha_in,
4418            NULL,
4419        );
4420        utils::result(
4421            vips_op_response,
4422            VipsImage { ctx: out_out },
4423            Error::PremultiplyError,
4424        )
4425    }
4426}
4427
4428/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4429/// inp: `&VipsImage` -> Input image
4430/// returns `VipsImage` - Output image
4431pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4432    unsafe {
4433        let inp_in: *mut bindings::VipsImage = inp.ctx;
4434        let mut out_out: *mut bindings::VipsImage = null_mut();
4435
4436        let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4437        utils::result(
4438            vips_op_response,
4439            VipsImage { ctx: out_out },
4440            Error::UnpremultiplyError,
4441        )
4442    }
4443}
4444
4445/// Options for unpremultiply operation
4446#[derive(Clone, Debug)]
4447pub struct UnpremultiplyOptions {
4448    /// max_alpha: `f64` -> Maximum value of alpha channel
4449    /// min: 0, max: 100000000, default: 255
4450    pub max_alpha: f64,
4451    /// alpha_band: `i32` -> Unpremultiply with this alpha
4452    /// min: 0, max: 100000000, default: 3
4453    pub alpha_band: i32,
4454}
4455
4456impl std::default::Default for UnpremultiplyOptions {
4457    fn default() -> Self {
4458        UnpremultiplyOptions {
4459            max_alpha: f64::from(255),
4460            alpha_band: i32::from(3),
4461        }
4462    }
4463}
4464
4465/// VipsUnpremultiply (unpremultiply), unpremultiply image alpha
4466/// inp: `&VipsImage` -> Input image
4467/// unpremultiply_options: `&UnpremultiplyOptions` -> optional arguments
4468/// returns `VipsImage` - Output image
4469pub fn unpremultiply_with_opts(
4470    inp: &VipsImage,
4471    unpremultiply_options: &UnpremultiplyOptions,
4472) -> Result<VipsImage> {
4473    unsafe {
4474        let inp_in: *mut bindings::VipsImage = inp.ctx;
4475        let mut out_out: *mut bindings::VipsImage = null_mut();
4476
4477        let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4478        let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4479
4480        let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4481        let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4482
4483        let vips_op_response = bindings::vips_unpremultiply(
4484            inp_in,
4485            &mut out_out,
4486            max_alpha_in_name.as_ptr(),
4487            max_alpha_in,
4488            alpha_band_in_name.as_ptr(),
4489            alpha_band_in,
4490            NULL,
4491        );
4492        utils::result(
4493            vips_op_response,
4494            VipsImage { ctx: out_out },
4495            Error::UnpremultiplyError,
4496        )
4497    }
4498}
4499
4500/// VipsGrid (grid), grid an image
4501/// inp: `&VipsImage` -> Input image
4502/// tile_height: `i32` -> Chop into tiles this high
4503/// min: 1, max: 10000000, default: 128
4504/// across: `i32` -> Number of tiles across
4505/// min: 1, max: 10000000, default: 1
4506/// down: `i32` -> Number of tiles down
4507/// min: 1, max: 10000000, default: 1
4508/// returns `VipsImage` - Output image
4509pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4510    unsafe {
4511        let inp_in: *mut bindings::VipsImage = inp.ctx;
4512        let tile_height_in: i32 = tile_height;
4513        let across_in: i32 = across;
4514        let down_in: i32 = down;
4515        let mut out_out: *mut bindings::VipsImage = null_mut();
4516
4517        let vips_op_response = bindings::vips_grid(
4518            inp_in,
4519            &mut out_out,
4520            tile_height_in,
4521            across_in,
4522            down_in,
4523            NULL,
4524        );
4525        utils::result(
4526            vips_op_response,
4527            VipsImage { ctx: out_out },
4528            Error::GridError,
4529        )
4530    }
4531}
4532
4533/// VipsTranspose3d (transpose3d), transpose3d an image
4534/// inp: `&VipsImage` -> Input image
4535/// returns `VipsImage` - Output image
4536pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4537    unsafe {
4538        let inp_in: *mut bindings::VipsImage = inp.ctx;
4539        let mut out_out: *mut bindings::VipsImage = null_mut();
4540
4541        let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4542        utils::result(
4543            vips_op_response,
4544            VipsImage { ctx: out_out },
4545            Error::Transpose3DError,
4546        )
4547    }
4548}
4549
4550/// Options for transpose_3d operation
4551#[derive(Clone, Debug)]
4552pub struct Transpose3DOptions {
4553    /// page_height: `i32` -> Height of each input page
4554    /// min: 0, max: 10000000, default: 0
4555    pub page_height: i32,
4556}
4557
4558impl std::default::Default for Transpose3DOptions {
4559    fn default() -> Self {
4560        Transpose3DOptions {
4561            page_height: i32::from(0),
4562        }
4563    }
4564}
4565
4566/// VipsTranspose3d (transpose3d), transpose3d an image
4567/// inp: `&VipsImage` -> Input image
4568/// transpose_3d_options: `&Transpose3DOptions` -> optional arguments
4569/// returns `VipsImage` - Output image
4570pub fn transpose_3d_with_opts(
4571    inp: &VipsImage,
4572    transpose_3d_options: &Transpose3DOptions,
4573) -> Result<VipsImage> {
4574    unsafe {
4575        let inp_in: *mut bindings::VipsImage = inp.ctx;
4576        let mut out_out: *mut bindings::VipsImage = null_mut();
4577
4578        let page_height_in: i32 = transpose_3d_options.page_height;
4579        let page_height_in_name = utils::new_c_string("page-height")?;
4580
4581        let vips_op_response = bindings::vips_transpose3d(
4582            inp_in,
4583            &mut out_out,
4584            page_height_in_name.as_ptr(),
4585            page_height_in,
4586            NULL,
4587        );
4588        utils::result(
4589            vips_op_response,
4590            VipsImage { ctx: out_out },
4591            Error::Transpose3DError,
4592        )
4593    }
4594}
4595
4596/// VipsScale (scale), scale an image to uchar
4597/// inp: `&VipsImage` -> Input image
4598/// returns `VipsImage` - Output image
4599pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4600    unsafe {
4601        let inp_in: *mut bindings::VipsImage = inp.ctx;
4602        let mut out_out: *mut bindings::VipsImage = null_mut();
4603
4604        let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4605        utils::result(
4606            vips_op_response,
4607            VipsImage { ctx: out_out },
4608            Error::ScaleError,
4609        )
4610    }
4611}
4612
4613/// Options for scale operation
4614#[derive(Clone, Debug)]
4615pub struct ScaleOptions {
4616    /// exp: `f64` -> Exponent for log scale
4617    /// min: 0.00001, max: 10000, default: 0.25
4618    pub exp: f64,
4619    /// log: `bool` -> Log scale
4620    /// default: false
4621    pub log: bool,
4622}
4623
4624impl std::default::Default for ScaleOptions {
4625    fn default() -> Self {
4626        ScaleOptions {
4627            exp: f64::from(0.25),
4628            log: false,
4629        }
4630    }
4631}
4632
4633/// VipsScale (scale), scale an image to uchar
4634/// inp: `&VipsImage` -> Input image
4635/// scale_options: `&ScaleOptions` -> optional arguments
4636/// returns `VipsImage` - Output image
4637pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4638    unsafe {
4639        let inp_in: *mut bindings::VipsImage = inp.ctx;
4640        let mut out_out: *mut bindings::VipsImage = null_mut();
4641
4642        let exp_in: f64 = scale_options.exp;
4643        let exp_in_name = utils::new_c_string("exp")?;
4644
4645        let log_in: i32 = if scale_options.log { 1 } else { 0 };
4646        let log_in_name = utils::new_c_string("log")?;
4647
4648        let vips_op_response = bindings::vips_scale(
4649            inp_in,
4650            &mut out_out,
4651            exp_in_name.as_ptr(),
4652            exp_in,
4653            log_in_name.as_ptr(),
4654            log_in,
4655            NULL,
4656        );
4657        utils::result(
4658            vips_op_response,
4659            VipsImage { ctx: out_out },
4660            Error::ScaleError,
4661        )
4662    }
4663}
4664
4665/// VipsWrap (wrap), wrap image origin
4666/// inp: `&VipsImage` -> Input image
4667/// returns `VipsImage` - Output image
4668pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4669    unsafe {
4670        let inp_in: *mut bindings::VipsImage = inp.ctx;
4671        let mut out_out: *mut bindings::VipsImage = null_mut();
4672
4673        let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4674        utils::result(
4675            vips_op_response,
4676            VipsImage { ctx: out_out },
4677            Error::WrapError,
4678        )
4679    }
4680}
4681
4682/// Options for wrap operation
4683#[derive(Clone, Debug)]
4684pub struct WrapOptions {
4685    /// x: `i32` -> Left edge of input in output
4686    /// min: -10000000, max: 10000000, default: 0
4687    pub x: i32,
4688    /// y: `i32` -> Top edge of input in output
4689    /// min: -10000000, max: 10000000, default: 0
4690    pub y: i32,
4691}
4692
4693impl std::default::Default for WrapOptions {
4694    fn default() -> Self {
4695        WrapOptions {
4696            x: i32::from(0),
4697            y: i32::from(0),
4698        }
4699    }
4700}
4701
4702/// VipsWrap (wrap), wrap image origin
4703/// inp: `&VipsImage` -> Input image
4704/// wrap_options: `&WrapOptions` -> optional arguments
4705/// returns `VipsImage` - Output image
4706pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4707    unsafe {
4708        let inp_in: *mut bindings::VipsImage = inp.ctx;
4709        let mut out_out: *mut bindings::VipsImage = null_mut();
4710
4711        let x_in: i32 = wrap_options.x;
4712        let x_in_name = utils::new_c_string("x")?;
4713
4714        let y_in: i32 = wrap_options.y;
4715        let y_in_name = utils::new_c_string("y")?;
4716
4717        let vips_op_response = bindings::vips_wrap(
4718            inp_in,
4719            &mut out_out,
4720            x_in_name.as_ptr(),
4721            x_in,
4722            y_in_name.as_ptr(),
4723            y_in,
4724            NULL,
4725        );
4726        utils::result(
4727            vips_op_response,
4728            VipsImage { ctx: out_out },
4729            Error::WrapError,
4730        )
4731    }
4732}
4733
4734/// VipsZoom (zoom), zoom an image
4735/// input: `&VipsImage` -> Input image
4736/// xfac: `i32` -> Horizontal zoom factor
4737/// min: 1, max: 10000000, default: 1
4738/// yfac: `i32` -> Vertical zoom factor
4739/// min: 1, max: 10000000, default: 1
4740/// returns `VipsImage` - Output image
4741pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4742    unsafe {
4743        let input_in: *mut bindings::VipsImage = input.ctx;
4744        let xfac_in: i32 = xfac;
4745        let yfac_in: i32 = yfac;
4746        let mut out_out: *mut bindings::VipsImage = null_mut();
4747
4748        let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4749        utils::result(
4750            vips_op_response,
4751            VipsImage { ctx: out_out },
4752            Error::ZoomError,
4753        )
4754    }
4755}
4756
4757/// VipsSubsample (subsample), subsample an image
4758/// input: `&VipsImage` -> Input image
4759/// xfac: `i32` -> Horizontal subsample factor
4760/// min: 1, max: 10000000, default: 1
4761/// yfac: `i32` -> Vertical subsample factor
4762/// min: 1, max: 10000000, default: 1
4763/// returns `VipsImage` - Output image
4764pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4765    unsafe {
4766        let input_in: *mut bindings::VipsImage = input.ctx;
4767        let xfac_in: i32 = xfac;
4768        let yfac_in: i32 = yfac;
4769        let mut out_out: *mut bindings::VipsImage = null_mut();
4770
4771        let vips_op_response =
4772            bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4773        utils::result(
4774            vips_op_response,
4775            VipsImage { ctx: out_out },
4776            Error::SubsampleError,
4777        )
4778    }
4779}
4780
4781/// Options for subsample operation
4782#[derive(Clone, Debug)]
4783pub struct SubsampleOptions {
4784    /// point: `bool` -> Point sample
4785    /// default: false
4786    pub point: bool,
4787}
4788
4789impl std::default::Default for SubsampleOptions {
4790    fn default() -> Self {
4791        SubsampleOptions { point: false }
4792    }
4793}
4794
4795/// VipsSubsample (subsample), subsample an image
4796/// input: `&VipsImage` -> Input image
4797/// xfac: `i32` -> Horizontal subsample factor
4798/// min: 1, max: 10000000, default: 1
4799/// yfac: `i32` -> Vertical subsample factor
4800/// min: 1, max: 10000000, default: 1
4801/// subsample_options: `&SubsampleOptions` -> optional arguments
4802/// returns `VipsImage` - Output image
4803pub fn subsample_with_opts(
4804    input: &VipsImage,
4805    xfac: i32,
4806    yfac: i32,
4807    subsample_options: &SubsampleOptions,
4808) -> Result<VipsImage> {
4809    unsafe {
4810        let input_in: *mut bindings::VipsImage = input.ctx;
4811        let xfac_in: i32 = xfac;
4812        let yfac_in: i32 = yfac;
4813        let mut out_out: *mut bindings::VipsImage = null_mut();
4814
4815        let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4816        let point_in_name = utils::new_c_string("point")?;
4817
4818        let vips_op_response = bindings::vips_subsample(
4819            input_in,
4820            &mut out_out,
4821            xfac_in,
4822            yfac_in,
4823            point_in_name.as_ptr(),
4824            point_in,
4825            NULL,
4826        );
4827        utils::result(
4828            vips_op_response,
4829            VipsImage { ctx: out_out },
4830            Error::SubsampleError,
4831        )
4832    }
4833}
4834
4835/// VipsMsb (msb), pick most-significant byte from an image
4836/// inp: `&VipsImage` -> Input image
4837/// returns `VipsImage` - Output image
4838pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4839    unsafe {
4840        let inp_in: *mut bindings::VipsImage = inp.ctx;
4841        let mut out_out: *mut bindings::VipsImage = null_mut();
4842
4843        let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4844        utils::result(
4845            vips_op_response,
4846            VipsImage { ctx: out_out },
4847            Error::MsbError,
4848        )
4849    }
4850}
4851
4852/// Options for msb operation
4853#[derive(Clone, Debug)]
4854pub struct MsbOptions {
4855    /// band: `i32` -> Band to msb
4856    /// min: 0, max: 100000000, default: 0
4857    pub band: i32,
4858}
4859
4860impl std::default::Default for MsbOptions {
4861    fn default() -> Self {
4862        MsbOptions { band: i32::from(0) }
4863    }
4864}
4865
4866/// VipsMsb (msb), pick most-significant byte from an image
4867/// inp: `&VipsImage` -> Input image
4868/// msb_options: `&MsbOptions` -> optional arguments
4869/// returns `VipsImage` - Output image
4870pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4871    unsafe {
4872        let inp_in: *mut bindings::VipsImage = inp.ctx;
4873        let mut out_out: *mut bindings::VipsImage = null_mut();
4874
4875        let band_in: i32 = msb_options.band;
4876        let band_in_name = utils::new_c_string("band")?;
4877
4878        let vips_op_response =
4879            bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4880        utils::result(
4881            vips_op_response,
4882            VipsImage { ctx: out_out },
4883            Error::MsbError,
4884        )
4885    }
4886}
4887
4888/// VipsByteswap (byteswap), byteswap an image
4889/// inp: `&VipsImage` -> Input image
4890/// returns `VipsImage` - Output image
4891pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4892    unsafe {
4893        let inp_in: *mut bindings::VipsImage = inp.ctx;
4894        let mut out_out: *mut bindings::VipsImage = null_mut();
4895
4896        let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4897        utils::result(
4898            vips_op_response,
4899            VipsImage { ctx: out_out },
4900            Error::ByteswapError,
4901        )
4902    }
4903}
4904
4905/// VipsFalsecolour (falsecolour), false-color an image
4906/// inp: `&VipsImage` -> Input image
4907/// returns `VipsImage` - Output image
4908pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4909    unsafe {
4910        let inp_in: *mut bindings::VipsImage = inp.ctx;
4911        let mut out_out: *mut bindings::VipsImage = null_mut();
4912
4913        let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4914        utils::result(
4915            vips_op_response,
4916            VipsImage { ctx: out_out },
4917            Error::FalsecolourError,
4918        )
4919    }
4920}
4921
4922/// VipsGamma (gamma), gamma an image
4923/// inp: `&VipsImage` -> Input image
4924/// returns `VipsImage` - Output image
4925pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4926    unsafe {
4927        let inp_in: *mut bindings::VipsImage = inp.ctx;
4928        let mut out_out: *mut bindings::VipsImage = null_mut();
4929
4930        let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4931        utils::result(
4932            vips_op_response,
4933            VipsImage { ctx: out_out },
4934            Error::GammaError,
4935        )
4936    }
4937}
4938
4939/// Options for gamma operation
4940#[derive(Clone, Debug)]
4941pub struct GammaOptions {
4942    /// exponent: `f64` -> Gamma factor
4943    /// min: 0.000001, max: 1000, default: 2.4
4944    pub exponent: f64,
4945}
4946
4947impl std::default::Default for GammaOptions {
4948    fn default() -> Self {
4949        GammaOptions {
4950            exponent: f64::from(2.4),
4951        }
4952    }
4953}
4954
4955/// VipsGamma (gamma), gamma an image
4956/// inp: `&VipsImage` -> Input image
4957/// gamma_options: `&GammaOptions` -> optional arguments
4958/// returns `VipsImage` - Output image
4959pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4960    unsafe {
4961        let inp_in: *mut bindings::VipsImage = inp.ctx;
4962        let mut out_out: *mut bindings::VipsImage = null_mut();
4963
4964        let exponent_in: f64 = gamma_options.exponent;
4965        let exponent_in_name = utils::new_c_string("exponent")?;
4966
4967        let vips_op_response = bindings::vips_gamma(
4968            inp_in,
4969            &mut out_out,
4970            exponent_in_name.as_ptr(),
4971            exponent_in,
4972            NULL,
4973        );
4974        utils::result(
4975            vips_op_response,
4976            VipsImage { ctx: out_out },
4977            Error::GammaError,
4978        )
4979    }
4980}
4981
4982/// VipsComposite (composite), blend an array of images with an array of blend modes
4983/// inp: `&mut [VipsImage]` -> Array of input images
4984/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
4985/// returns `VipsImage` - Output image
4986pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
4987    unsafe {
4988        let (inp_len, mut inp_in) = {
4989            let len = inp.len();
4990            let mut input = Vec::new();
4991            for img in inp {
4992                input.push(img.ctx)
4993            }
4994            (len as i32, input)
4995        };
4996        let mode_in: *mut i32 = mode.as_mut_ptr();
4997        let mut out_out: *mut bindings::VipsImage = null_mut();
4998
4999        let vips_op_response = bindings::vips_composite(
5000            inp_in.as_mut_ptr(),
5001            &mut out_out,
5002            inp_len,
5003            mode_in,
5004            mode.len() as i32,
5005            NULL,
5006        );
5007        utils::result(
5008            vips_op_response,
5009            VipsImage { ctx: out_out },
5010            Error::CompositeError,
5011        )
5012    }
5013}
5014
5015/// Options for composite operation
5016#[derive(Clone, Debug)]
5017pub struct CompositeOptions {
5018    /// x: `Vec<i32>` -> Array of x coordinates to join at
5019    pub x: Vec<i32>,
5020    /// y: `Vec<i32>` -> Array of y coordinates to join at
5021    pub y: Vec<i32>,
5022    /// compositing_space: `Interpretation` -> Composite images in this colour space
5023    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5024    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5025    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5026    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5027    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5028    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5029    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5030    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5031    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5032    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5033    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5034    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5035    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5036    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5037    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5038    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5039    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5040    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5041    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5042    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5043    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5044    pub compositing_space: Interpretation,
5045    /// premultiplied: `bool` -> Images have premultiplied alpha
5046    /// default: false
5047    pub premultiplied: bool,
5048}
5049
5050impl std::default::Default for CompositeOptions {
5051    fn default() -> Self {
5052        CompositeOptions {
5053            x: Vec::new(),
5054            y: Vec::new(),
5055            compositing_space: Interpretation::Srgb,
5056            premultiplied: false,
5057        }
5058    }
5059}
5060
5061/// VipsComposite (composite), blend an array of images with an array of blend modes
5062/// inp: `&mut [VipsImage]` -> Array of input images
5063/// mode: `&mut [i32]` -> Array of VipsBlendMode to join with
5064/// composite_options: `&CompositeOptions` -> optional arguments
5065/// returns `VipsImage` - Output image
5066pub fn composite_with_opts(
5067    inp: &mut [VipsImage],
5068    mode: &mut [i32],
5069    composite_options: &CompositeOptions,
5070) -> Result<VipsImage> {
5071    unsafe {
5072        let (inp_len, mut inp_in) = {
5073            let len = inp.len();
5074            let mut input = Vec::new();
5075            for img in inp {
5076                input.push(img.ctx)
5077            }
5078            (len as i32, input)
5079        };
5080        let mode_in: *mut i32 = mode.as_mut_ptr();
5081        let mut out_out: *mut bindings::VipsImage = null_mut();
5082
5083        let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5084        let x_in = x_wrapper.ctx;
5085        let x_in_name = utils::new_c_string("x")?;
5086
5087        let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5088        let y_in = y_wrapper.ctx;
5089        let y_in_name = utils::new_c_string("y")?;
5090
5091        let compositing_space_in: i32 = composite_options.compositing_space as i32;
5092        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5093
5094        let premultiplied_in: i32 = if composite_options.premultiplied {
5095            1
5096        } else {
5097            0
5098        };
5099        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5100
5101        let vips_op_response = bindings::vips_composite(
5102            inp_in.as_mut_ptr(),
5103            &mut out_out,
5104            inp_len,
5105            mode_in,
5106            mode.len() as i32,
5107            x_in_name.as_ptr(),
5108            x_in,
5109            y_in_name.as_ptr(),
5110            y_in,
5111            compositing_space_in_name.as_ptr(),
5112            compositing_space_in,
5113            premultiplied_in_name.as_ptr(),
5114            premultiplied_in,
5115            NULL,
5116        );
5117        utils::result(
5118            vips_op_response,
5119            VipsImage { ctx: out_out },
5120            Error::CompositeError,
5121        )
5122    }
5123}
5124
5125/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5126/// base: `&VipsImage` -> Base image
5127/// overlay: `&VipsImage` -> Overlay image
5128/// mode: `BlendMode` -> VipsBlendMode to join with
5129///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5130///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5131///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5132///  `In` -> VIPS_BLEND_MODE_IN = 3
5133///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5134///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5135///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5136///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5137///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5138///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5139///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5140///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5141///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5142///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5143///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5144///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5145///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5146///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5147///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5148///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5149///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5150///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5151///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5152///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5153///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5154///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5155/// returns `VipsImage` - Output image
5156pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5157    unsafe {
5158        let base_in: *mut bindings::VipsImage = base.ctx;
5159        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5160        let mode_in: i32 = mode as i32;
5161        let mut out_out: *mut bindings::VipsImage = null_mut();
5162
5163        let vips_op_response = bindings::vips_composite2(
5164            base_in,
5165            overlay_in,
5166            &mut out_out,
5167            mode_in.try_into().unwrap(),
5168            NULL,
5169        );
5170        utils::result(
5171            vips_op_response,
5172            VipsImage { ctx: out_out },
5173            Error::Composite2Error,
5174        )
5175    }
5176}
5177
5178/// Options for composite_2 operation
5179#[derive(Clone, Debug)]
5180pub struct Composite2Options {
5181    /// x: `i32` -> x position of overlay
5182    /// min: -10000000, max: 10000000, default: 0
5183    pub x: i32,
5184    /// y: `i32` -> y position of overlay
5185    /// min: -10000000, max: 10000000, default: 0
5186    pub y: i32,
5187    /// compositing_space: `Interpretation` -> Composite images in this colour space
5188    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
5189    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
5190    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
5191    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
5192    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
5193    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
5194    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
5195    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
5196    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
5197    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
5198    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
5199    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
5200    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
5201    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
5202    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
5203    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
5204    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
5205    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
5206    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
5207    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
5208    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
5209    pub compositing_space: Interpretation,
5210    /// premultiplied: `bool` -> Images have premultiplied alpha
5211    /// default: false
5212    pub premultiplied: bool,
5213}
5214
5215impl std::default::Default for Composite2Options {
5216    fn default() -> Self {
5217        Composite2Options {
5218            x: i32::from(0),
5219            y: i32::from(0),
5220            compositing_space: Interpretation::Srgb,
5221            premultiplied: false,
5222        }
5223    }
5224}
5225
5226/// VipsComposite2 (composite2), blend a pair of images with a blend mode
5227/// base: `&VipsImage` -> Base image
5228/// overlay: `&VipsImage` -> Overlay image
5229/// mode: `BlendMode` -> VipsBlendMode to join with
5230///  `Clear` -> VIPS_BLEND_MODE_CLEAR = 0
5231///  `Source` -> VIPS_BLEND_MODE_SOURCE = 1
5232///  `Over` -> VIPS_BLEND_MODE_OVER = 2 [DEFAULT]
5233///  `In` -> VIPS_BLEND_MODE_IN = 3
5234///  `Out` -> VIPS_BLEND_MODE_OUT = 4
5235///  `Atop` -> VIPS_BLEND_MODE_ATOP = 5
5236///  `Dest` -> VIPS_BLEND_MODE_DEST = 6
5237///  `DestOver` -> VIPS_BLEND_MODE_DEST_OVER = 7
5238///  `DestIn` -> VIPS_BLEND_MODE_DEST_IN = 8
5239///  `DestOut` -> VIPS_BLEND_MODE_DEST_OUT = 9
5240///  `DestAtop` -> VIPS_BLEND_MODE_DEST_ATOP = 10
5241///  `Xor` -> VIPS_BLEND_MODE_XOR = 11
5242///  `Add` -> VIPS_BLEND_MODE_ADD = 12
5243///  `Saturate` -> VIPS_BLEND_MODE_SATURATE = 13
5244///  `Multiply` -> VIPS_BLEND_MODE_MULTIPLY = 14
5245///  `Screen` -> VIPS_BLEND_MODE_SCREEN = 15
5246///  `Overlay` -> VIPS_BLEND_MODE_OVERLAY = 16
5247///  `Darken` -> VIPS_BLEND_MODE_DARKEN = 17
5248///  `Lighten` -> VIPS_BLEND_MODE_LIGHTEN = 18
5249///  `ColourDodge` -> VIPS_BLEND_MODE_COLOUR_DODGE = 19
5250///  `ColourBurn` -> VIPS_BLEND_MODE_COLOUR_BURN = 20
5251///  `HardLight` -> VIPS_BLEND_MODE_HARD_LIGHT = 21
5252///  `SoftLight` -> VIPS_BLEND_MODE_SOFT_LIGHT = 22
5253///  `Difference` -> VIPS_BLEND_MODE_DIFFERENCE = 23
5254///  `Exclusion` -> VIPS_BLEND_MODE_EXCLUSION = 24
5255///  `Last` -> VIPS_BLEND_MODE_LAST = 25
5256/// composite_2_options: `&Composite2Options` -> optional arguments
5257/// returns `VipsImage` - Output image
5258pub fn composite_2_with_opts(
5259    base: &VipsImage,
5260    overlay: &VipsImage,
5261    mode: BlendMode,
5262    composite_2_options: &Composite2Options,
5263) -> Result<VipsImage> {
5264    unsafe {
5265        let base_in: *mut bindings::VipsImage = base.ctx;
5266        let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5267        let mode_in: i32 = mode as i32;
5268        let mut out_out: *mut bindings::VipsImage = null_mut();
5269
5270        let x_in: i32 = composite_2_options.x;
5271        let x_in_name = utils::new_c_string("x")?;
5272
5273        let y_in: i32 = composite_2_options.y;
5274        let y_in_name = utils::new_c_string("y")?;
5275
5276        let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5277        let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5278
5279        let premultiplied_in: i32 = if composite_2_options.premultiplied {
5280            1
5281        } else {
5282            0
5283        };
5284        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5285
5286        let vips_op_response = bindings::vips_composite2(
5287            base_in,
5288            overlay_in,
5289            &mut out_out,
5290            mode_in.try_into().unwrap(),
5291            x_in_name.as_ptr(),
5292            x_in,
5293            y_in_name.as_ptr(),
5294            y_in,
5295            compositing_space_in_name.as_ptr(),
5296            compositing_space_in,
5297            premultiplied_in_name.as_ptr(),
5298            premultiplied_in,
5299            NULL,
5300        );
5301        utils::result(
5302            vips_op_response,
5303            VipsImage { ctx: out_out },
5304            Error::Composite2Error,
5305        )
5306    }
5307}
5308
5309/// VipsBlack (black), make a black image
5310/// width: `i32` -> Image width in pixels
5311/// min: 1, max: 10000000, default: 1
5312/// height: `i32` -> Image height in pixels
5313/// min: 1, max: 10000000, default: 1
5314/// returns `VipsImage` - Output image
5315pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5316    unsafe {
5317        let width_in: i32 = width;
5318        let height_in: i32 = height;
5319        let mut out_out: *mut bindings::VipsImage = null_mut();
5320
5321        let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5322        utils::result(
5323            vips_op_response,
5324            VipsImage { ctx: out_out },
5325            Error::BlackError,
5326        )
5327    }
5328}
5329
5330/// Options for black operation
5331#[derive(Clone, Debug)]
5332pub struct BlackOptions {
5333    /// bands: `i32` -> Number of bands in image
5334    /// min: 1, max: 10000000, default: 1
5335    pub bands: i32,
5336}
5337
5338impl std::default::Default for BlackOptions {
5339    fn default() -> Self {
5340        BlackOptions {
5341            bands: i32::from(1),
5342        }
5343    }
5344}
5345
5346/// VipsBlack (black), make a black image
5347/// width: `i32` -> Image width in pixels
5348/// min: 1, max: 10000000, default: 1
5349/// height: `i32` -> Image height in pixels
5350/// min: 1, max: 10000000, default: 1
5351/// black_options: `&BlackOptions` -> optional arguments
5352/// returns `VipsImage` - Output image
5353pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5354    unsafe {
5355        let width_in: i32 = width;
5356        let height_in: i32 = height;
5357        let mut out_out: *mut bindings::VipsImage = null_mut();
5358
5359        let bands_in: i32 = black_options.bands;
5360        let bands_in_name = utils::new_c_string("bands")?;
5361
5362        let vips_op_response = bindings::vips_black(
5363            &mut out_out,
5364            width_in,
5365            height_in,
5366            bands_in_name.as_ptr(),
5367            bands_in,
5368            NULL,
5369        );
5370        utils::result(
5371            vips_op_response,
5372            VipsImage { ctx: out_out },
5373            Error::BlackError,
5374        )
5375    }
5376}
5377
5378/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5379/// width: `i32` -> Image width in pixels
5380/// min: 1, max: 10000000, default: 1
5381/// height: `i32` -> Image height in pixels
5382/// min: 1, max: 10000000, default: 1
5383/// returns `VipsImage` - Output image
5384pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5385    unsafe {
5386        let width_in: i32 = width;
5387        let height_in: i32 = height;
5388        let mut out_out: *mut bindings::VipsImage = null_mut();
5389
5390        let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5391        utils::result(
5392            vips_op_response,
5393            VipsImage { ctx: out_out },
5394            Error::GaussnoiseError,
5395        )
5396    }
5397}
5398
5399/// Options for gaussnoise operation
5400#[derive(Clone, Debug)]
5401pub struct GaussnoiseOptions {
5402    /// sigma: `f64` -> Standard deviation of pixels in generated image
5403    /// min: 0, max: 100000, default: 30
5404    pub sigma: f64,
5405    /// mean: `f64` -> Mean of pixels in generated image
5406    /// min: -10000000, max: 1000000, default: 128
5407    pub mean: f64,
5408    /// seed: `i32` -> Random number seed
5409    /// min: -2147483648, max: 2147483647, default: 0
5410    pub seed: i32,
5411}
5412
5413impl std::default::Default for GaussnoiseOptions {
5414    fn default() -> Self {
5415        GaussnoiseOptions {
5416            sigma: f64::from(30),
5417            mean: f64::from(128),
5418            seed: i32::from(0),
5419        }
5420    }
5421}
5422
5423/// VipsGaussnoise (gaussnoise), make a gaussnoise image
5424/// width: `i32` -> Image width in pixels
5425/// min: 1, max: 10000000, default: 1
5426/// height: `i32` -> Image height in pixels
5427/// min: 1, max: 10000000, default: 1
5428/// gaussnoise_options: `&GaussnoiseOptions` -> optional arguments
5429/// returns `VipsImage` - Output image
5430pub fn gaussnoise_with_opts(
5431    width: i32,
5432    height: i32,
5433    gaussnoise_options: &GaussnoiseOptions,
5434) -> Result<VipsImage> {
5435    unsafe {
5436        let width_in: i32 = width;
5437        let height_in: i32 = height;
5438        let mut out_out: *mut bindings::VipsImage = null_mut();
5439
5440        let sigma_in: f64 = gaussnoise_options.sigma;
5441        let sigma_in_name = utils::new_c_string("sigma")?;
5442
5443        let mean_in: f64 = gaussnoise_options.mean;
5444        let mean_in_name = utils::new_c_string("mean")?;
5445
5446        let seed_in: i32 = gaussnoise_options.seed;
5447        let seed_in_name = utils::new_c_string("seed")?;
5448
5449        let vips_op_response = bindings::vips_gaussnoise(
5450            &mut out_out,
5451            width_in,
5452            height_in,
5453            sigma_in_name.as_ptr(),
5454            sigma_in,
5455            mean_in_name.as_ptr(),
5456            mean_in,
5457            seed_in_name.as_ptr(),
5458            seed_in,
5459            NULL,
5460        );
5461        utils::result(
5462            vips_op_response,
5463            VipsImage { ctx: out_out },
5464            Error::GaussnoiseError,
5465        )
5466    }
5467}
5468
5469/// VipsXyz (xyz), make an image where pixel values are coordinates
5470/// width: `i32` -> Image width in pixels
5471/// min: 1, max: 10000000, default: 64
5472/// height: `i32` -> Image height in pixels
5473/// min: 1, max: 10000000, default: 64
5474/// returns `VipsImage` - Output image
5475pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5476    unsafe {
5477        let width_in: i32 = width;
5478        let height_in: i32 = height;
5479        let mut out_out: *mut bindings::VipsImage = null_mut();
5480
5481        let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5482        utils::result(
5483            vips_op_response,
5484            VipsImage { ctx: out_out },
5485            Error::XyzError,
5486        )
5487    }
5488}
5489
5490/// Options for xyz operation
5491#[derive(Clone, Debug)]
5492pub struct XyzOptions {
5493    /// csize: `i32` -> Size of third dimension
5494    /// min: 1, max: 10000000, default: 1
5495    pub csize: i32,
5496    /// dsize: `i32` -> Size of fourth dimension
5497    /// min: 1, max: 10000000, default: 1
5498    pub dsize: i32,
5499    /// esize: `i32` -> Size of fifth dimension
5500    /// min: 1, max: 10000000, default: 1
5501    pub esize: i32,
5502}
5503
5504impl std::default::Default for XyzOptions {
5505    fn default() -> Self {
5506        XyzOptions {
5507            csize: i32::from(1),
5508            dsize: i32::from(1),
5509            esize: i32::from(1),
5510        }
5511    }
5512}
5513
5514/// VipsXyz (xyz), make an image where pixel values are coordinates
5515/// width: `i32` -> Image width in pixels
5516/// min: 1, max: 10000000, default: 64
5517/// height: `i32` -> Image height in pixels
5518/// min: 1, max: 10000000, default: 64
5519/// xyz_options: `&XyzOptions` -> optional arguments
5520/// returns `VipsImage` - Output image
5521pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5522    unsafe {
5523        let width_in: i32 = width;
5524        let height_in: i32 = height;
5525        let mut out_out: *mut bindings::VipsImage = null_mut();
5526
5527        let csize_in: i32 = xyz_options.csize;
5528        let csize_in_name = utils::new_c_string("csize")?;
5529
5530        let dsize_in: i32 = xyz_options.dsize;
5531        let dsize_in_name = utils::new_c_string("dsize")?;
5532
5533        let esize_in: i32 = xyz_options.esize;
5534        let esize_in_name = utils::new_c_string("esize")?;
5535
5536        let vips_op_response = bindings::vips_xyz(
5537            &mut out_out,
5538            width_in,
5539            height_in,
5540            csize_in_name.as_ptr(),
5541            csize_in,
5542            dsize_in_name.as_ptr(),
5543            dsize_in,
5544            esize_in_name.as_ptr(),
5545            esize_in,
5546            NULL,
5547        );
5548        utils::result(
5549            vips_op_response,
5550            VipsImage { ctx: out_out },
5551            Error::XyzError,
5552        )
5553    }
5554}
5555
5556/// VipsGaussmat (gaussmat), make a gaussian image
5557/// sigma: `f64` -> Sigma of Gaussian
5558/// min: 0.000001, max: 10000, default: 1
5559/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5560/// min: 0.000001, max: 10000, default: 0.1
5561/// returns `VipsImage` - Output image
5562pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5563    unsafe {
5564        let sigma_in: f64 = sigma;
5565        let min_ampl_in: f64 = min_ampl;
5566        let mut out_out: *mut bindings::VipsImage = null_mut();
5567
5568        let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5569        utils::result(
5570            vips_op_response,
5571            VipsImage { ctx: out_out },
5572            Error::GaussmatError,
5573        )
5574    }
5575}
5576
5577/// Options for gaussmat operation
5578#[derive(Clone, Debug)]
5579pub struct GaussmatOptions {
5580    /// separable: `bool` -> Generate separable Gaussian
5581    /// default: false
5582    pub separable: bool,
5583    /// precision: `Precision` -> Generate with this precision
5584    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5585    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5586    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5587    ///  `Last` -> VIPS_PRECISION_LAST = 3
5588    pub precision: Precision,
5589}
5590
5591impl std::default::Default for GaussmatOptions {
5592    fn default() -> Self {
5593        GaussmatOptions {
5594            separable: false,
5595            precision: Precision::Integer,
5596        }
5597    }
5598}
5599
5600/// VipsGaussmat (gaussmat), make a gaussian image
5601/// sigma: `f64` -> Sigma of Gaussian
5602/// min: 0.000001, max: 10000, default: 1
5603/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5604/// min: 0.000001, max: 10000, default: 0.1
5605/// gaussmat_options: `&GaussmatOptions` -> optional arguments
5606/// returns `VipsImage` - Output image
5607pub fn gaussmat_with_opts(
5608    sigma: f64,
5609    min_ampl: f64,
5610    gaussmat_options: &GaussmatOptions,
5611) -> Result<VipsImage> {
5612    unsafe {
5613        let sigma_in: f64 = sigma;
5614        let min_ampl_in: f64 = min_ampl;
5615        let mut out_out: *mut bindings::VipsImage = null_mut();
5616
5617        let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5618        let separable_in_name = utils::new_c_string("separable")?;
5619
5620        let precision_in: i32 = gaussmat_options.precision as i32;
5621        let precision_in_name = utils::new_c_string("precision")?;
5622
5623        let vips_op_response = bindings::vips_gaussmat(
5624            &mut out_out,
5625            sigma_in,
5626            min_ampl_in,
5627            separable_in_name.as_ptr(),
5628            separable_in,
5629            precision_in_name.as_ptr(),
5630            precision_in,
5631            NULL,
5632        );
5633        utils::result(
5634            vips_op_response,
5635            VipsImage { ctx: out_out },
5636            Error::GaussmatError,
5637        )
5638    }
5639}
5640
5641/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5642/// sigma: `f64` -> Radius of Gaussian
5643/// min: 0.000001, max: 10000, default: 1
5644/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5645/// min: 0.000001, max: 10000, default: 0.1
5646/// returns `VipsImage` - Output image
5647pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5648    unsafe {
5649        let sigma_in: f64 = sigma;
5650        let min_ampl_in: f64 = min_ampl;
5651        let mut out_out: *mut bindings::VipsImage = null_mut();
5652
5653        let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5654        utils::result(
5655            vips_op_response,
5656            VipsImage { ctx: out_out },
5657            Error::LogmatError,
5658        )
5659    }
5660}
5661
5662/// Options for logmat operation
5663#[derive(Clone, Debug)]
5664pub struct LogmatOptions {
5665    /// separable: `bool` -> Generate separable Gaussian
5666    /// default: false
5667    pub separable: bool,
5668    /// precision: `Precision` -> Generate with this precision
5669    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
5670    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
5671    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
5672    ///  `Last` -> VIPS_PRECISION_LAST = 3
5673    pub precision: Precision,
5674}
5675
5676impl std::default::Default for LogmatOptions {
5677    fn default() -> Self {
5678        LogmatOptions {
5679            separable: false,
5680            precision: Precision::Integer,
5681        }
5682    }
5683}
5684
5685/// VipsLogmat (logmat), make a Laplacian of Gaussian image
5686/// sigma: `f64` -> Radius of Gaussian
5687/// min: 0.000001, max: 10000, default: 1
5688/// min_ampl: `f64` -> Minimum amplitude of Gaussian
5689/// min: 0.000001, max: 10000, default: 0.1
5690/// logmat_options: `&LogmatOptions` -> optional arguments
5691/// returns `VipsImage` - Output image
5692pub fn logmat_with_opts(
5693    sigma: f64,
5694    min_ampl: f64,
5695    logmat_options: &LogmatOptions,
5696) -> Result<VipsImage> {
5697    unsafe {
5698        let sigma_in: f64 = sigma;
5699        let min_ampl_in: f64 = min_ampl;
5700        let mut out_out: *mut bindings::VipsImage = null_mut();
5701
5702        let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5703        let separable_in_name = utils::new_c_string("separable")?;
5704
5705        let precision_in: i32 = logmat_options.precision as i32;
5706        let precision_in_name = utils::new_c_string("precision")?;
5707
5708        let vips_op_response = bindings::vips_logmat(
5709            &mut out_out,
5710            sigma_in,
5711            min_ampl_in,
5712            separable_in_name.as_ptr(),
5713            separable_in,
5714            precision_in_name.as_ptr(),
5715            precision_in,
5716            NULL,
5717        );
5718        utils::result(
5719            vips_op_response,
5720            VipsImage { ctx: out_out },
5721            Error::LogmatError,
5722        )
5723    }
5724}
5725
5726/// VipsText (text), make a text image
5727/// text: `&str` -> Text to render
5728/// returns `VipsImage` - Output image
5729pub fn text(text: &str) -> Result<VipsImage> {
5730    unsafe {
5731        let text_in: CString = utils::new_c_string(text)?;
5732        let mut out_out: *mut bindings::VipsImage = null_mut();
5733
5734        let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5735        utils::result(
5736            vips_op_response,
5737            VipsImage { ctx: out_out },
5738            Error::TextError,
5739        )
5740    }
5741}
5742
5743/// Options for text operation
5744#[derive(Clone, Debug)]
5745pub struct TextOptions {
5746    /// font: `String` -> Font to render with
5747    pub font: String,
5748    /// width: `i32` -> Maximum image width in pixels
5749    /// min: 0, max: 10000000, default: 0
5750    pub width: i32,
5751    /// height: `i32` -> Maximum image height in pixels
5752    /// min: 0, max: 10000000, default: 0
5753    pub height: i32,
5754    /// align: `Align` -> Align on the low, centre or high edge
5755    ///  `Low` -> VIPS_ALIGN_LOW = 0 [DEFAULT]
5756    ///  `Centre` -> VIPS_ALIGN_CENTRE = 1
5757    ///  `High` -> VIPS_ALIGN_HIGH = 2
5758    ///  `Last` -> VIPS_ALIGN_LAST = 3
5759    pub align: Align,
5760    /// justify: `bool` -> Justify lines
5761    /// default: false
5762    pub justify: bool,
5763    /// dpi: `i32` -> DPI to render at
5764    /// min: 1, max: 1000000, default: 72
5765    pub dpi: i32,
5766    /// autofit_dpi: `i32` -> DPI selected by autofit
5767    /// min: 1, max: 1000000, default: 72
5768    pub autofit_dpi: i32,
5769    /// spacing: `i32` -> Line spacing
5770    /// min: -1000000, max: 1000000, default: 0
5771    pub spacing: i32,
5772    /// fontfile: `String` -> Load this font file
5773    pub fontfile: String,
5774    /// rgba: `bool` -> Enable RGBA output
5775    /// default: false
5776    pub rgba: bool,
5777    /// wrap: `TextWrap` -> Wrap lines on word or character boundaries
5778    ///  `Word` -> VIPS_TEXT_WRAP_WORD = 0 [DEFAULT]
5779    ///  `Char` -> VIPS_TEXT_WRAP_CHAR = 1
5780    ///  `WordChar` -> VIPS_TEXT_WRAP_WORD_CHAR = 2
5781    ///  `None` -> VIPS_TEXT_WRAP_NONE = 3
5782    ///  `Last` -> VIPS_TEXT_WRAP_LAST = 4
5783    pub wrap: TextWrap,
5784}
5785
5786impl std::default::Default for TextOptions {
5787    fn default() -> Self {
5788        TextOptions {
5789            font: String::new(),
5790            width: i32::from(0),
5791            height: i32::from(0),
5792            align: Align::Low,
5793            justify: false,
5794            dpi: i32::from(72),
5795            autofit_dpi: i32::from(72),
5796            spacing: i32::from(0),
5797            fontfile: String::new(),
5798            rgba: false,
5799            wrap: TextWrap::Word,
5800        }
5801    }
5802}
5803
5804/// VipsText (text), make a text image
5805/// text: `&str` -> Text to render
5806/// text_options: `&TextOptions` -> optional arguments
5807/// returns `VipsImage` - Output image
5808pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5809    unsafe {
5810        let text_in: CString = utils::new_c_string(text)?;
5811        let mut out_out: *mut bindings::VipsImage = null_mut();
5812
5813        let font_in: CString = utils::new_c_string(&text_options.font)?;
5814        let font_in_name = utils::new_c_string("font")?;
5815
5816        let width_in: i32 = text_options.width;
5817        let width_in_name = utils::new_c_string("width")?;
5818
5819        let height_in: i32 = text_options.height;
5820        let height_in_name = utils::new_c_string("height")?;
5821
5822        let align_in: i32 = text_options.align as i32;
5823        let align_in_name = utils::new_c_string("align")?;
5824
5825        let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5826        let justify_in_name = utils::new_c_string("justify")?;
5827
5828        let dpi_in: i32 = text_options.dpi;
5829        let dpi_in_name = utils::new_c_string("dpi")?;
5830
5831        let autofit_dpi_in: i32 = text_options.autofit_dpi;
5832        let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5833
5834        let spacing_in: i32 = text_options.spacing;
5835        let spacing_in_name = utils::new_c_string("spacing")?;
5836
5837        let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5838        let fontfile_in_name = utils::new_c_string("fontfile")?;
5839
5840        let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5841        let rgba_in_name = utils::new_c_string("rgba")?;
5842
5843        let wrap_in: i32 = text_options.wrap as i32;
5844        let wrap_in_name = utils::new_c_string("wrap")?;
5845
5846        let vips_op_response = bindings::vips_text(
5847            &mut out_out,
5848            text_in.as_ptr(),
5849            font_in_name.as_ptr(),
5850            font_in.as_ptr(),
5851            width_in_name.as_ptr(),
5852            width_in,
5853            height_in_name.as_ptr(),
5854            height_in,
5855            align_in_name.as_ptr(),
5856            align_in,
5857            justify_in_name.as_ptr(),
5858            justify_in,
5859            dpi_in_name.as_ptr(),
5860            dpi_in,
5861            autofit_dpi_in_name.as_ptr(),
5862            autofit_dpi_in,
5863            spacing_in_name.as_ptr(),
5864            spacing_in,
5865            fontfile_in_name.as_ptr(),
5866            fontfile_in.as_ptr(),
5867            rgba_in_name.as_ptr(),
5868            rgba_in,
5869            wrap_in_name.as_ptr(),
5870            wrap_in,
5871            NULL,
5872        );
5873        utils::result(
5874            vips_op_response,
5875            VipsImage { ctx: out_out },
5876            Error::TextError,
5877        )
5878    }
5879}
5880
5881/// VipsEye (eye), make an image showing the eye's spatial response
5882/// width: `i32` -> Image width in pixels
5883/// min: 1, max: 10000000, default: 1
5884/// height: `i32` -> Image height in pixels
5885/// min: 1, max: 10000000, default: 1
5886/// returns `VipsImage` - Output image
5887pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
5888    unsafe {
5889        let width_in: i32 = width;
5890        let height_in: i32 = height;
5891        let mut out_out: *mut bindings::VipsImage = null_mut();
5892
5893        let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
5894        utils::result(
5895            vips_op_response,
5896            VipsImage { ctx: out_out },
5897            Error::EyeError,
5898        )
5899    }
5900}
5901
5902/// Options for eye operation
5903#[derive(Clone, Debug)]
5904pub struct EyeOptions {
5905    /// uchar: `bool` -> Output an unsigned char image
5906    /// default: false
5907    pub uchar: bool,
5908    /// factor: `f64` -> Maximum spatial frequency
5909    /// min: 0, max: 1, default: 0.5
5910    pub factor: f64,
5911}
5912
5913impl std::default::Default for EyeOptions {
5914    fn default() -> Self {
5915        EyeOptions {
5916            uchar: false,
5917            factor: f64::from(0.5),
5918        }
5919    }
5920}
5921
5922/// VipsEye (eye), make an image showing the eye's spatial response
5923/// width: `i32` -> Image width in pixels
5924/// min: 1, max: 10000000, default: 1
5925/// height: `i32` -> Image height in pixels
5926/// min: 1, max: 10000000, default: 1
5927/// eye_options: `&EyeOptions` -> optional arguments
5928/// returns `VipsImage` - Output image
5929pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
5930    unsafe {
5931        let width_in: i32 = width;
5932        let height_in: i32 = height;
5933        let mut out_out: *mut bindings::VipsImage = null_mut();
5934
5935        let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
5936        let uchar_in_name = utils::new_c_string("uchar")?;
5937
5938        let factor_in: f64 = eye_options.factor;
5939        let factor_in_name = utils::new_c_string("factor")?;
5940
5941        let vips_op_response = bindings::vips_eye(
5942            &mut out_out,
5943            width_in,
5944            height_in,
5945            uchar_in_name.as_ptr(),
5946            uchar_in,
5947            factor_in_name.as_ptr(),
5948            factor_in,
5949            NULL,
5950        );
5951        utils::result(
5952            vips_op_response,
5953            VipsImage { ctx: out_out },
5954            Error::EyeError,
5955        )
5956    }
5957}
5958
5959/// VipsGrey (grey), make a grey ramp image
5960/// width: `i32` -> Image width in pixels
5961/// min: 1, max: 10000000, default: 1
5962/// height: `i32` -> Image height in pixels
5963/// min: 1, max: 10000000, default: 1
5964/// returns `VipsImage` - Output image
5965pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
5966    unsafe {
5967        let width_in: i32 = width;
5968        let height_in: i32 = height;
5969        let mut out_out: *mut bindings::VipsImage = null_mut();
5970
5971        let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
5972        utils::result(
5973            vips_op_response,
5974            VipsImage { ctx: out_out },
5975            Error::GreyError,
5976        )
5977    }
5978}
5979
5980/// Options for grey operation
5981#[derive(Clone, Debug)]
5982pub struct GreyOptions {
5983    /// uchar: `bool` -> Output an unsigned char image
5984    /// default: false
5985    pub uchar: bool,
5986}
5987
5988impl std::default::Default for GreyOptions {
5989    fn default() -> Self {
5990        GreyOptions { uchar: false }
5991    }
5992}
5993
5994/// VipsGrey (grey), make a grey ramp image
5995/// width: `i32` -> Image width in pixels
5996/// min: 1, max: 10000000, default: 1
5997/// height: `i32` -> Image height in pixels
5998/// min: 1, max: 10000000, default: 1
5999/// grey_options: `&GreyOptions` -> optional arguments
6000/// returns `VipsImage` - Output image
6001pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6002    unsafe {
6003        let width_in: i32 = width;
6004        let height_in: i32 = height;
6005        let mut out_out: *mut bindings::VipsImage = null_mut();
6006
6007        let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6008        let uchar_in_name = utils::new_c_string("uchar")?;
6009
6010        let vips_op_response = bindings::vips_grey(
6011            &mut out_out,
6012            width_in,
6013            height_in,
6014            uchar_in_name.as_ptr(),
6015            uchar_in,
6016            NULL,
6017        );
6018        utils::result(
6019            vips_op_response,
6020            VipsImage { ctx: out_out },
6021            Error::GreyError,
6022        )
6023    }
6024}
6025
6026/// VipsZone (zone), make a zone plate
6027/// width: `i32` -> Image width in pixels
6028/// min: 1, max: 10000000, default: 1
6029/// height: `i32` -> Image height in pixels
6030/// min: 1, max: 10000000, default: 1
6031/// returns `VipsImage` - Output image
6032pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6033    unsafe {
6034        let width_in: i32 = width;
6035        let height_in: i32 = height;
6036        let mut out_out: *mut bindings::VipsImage = null_mut();
6037
6038        let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6039        utils::result(
6040            vips_op_response,
6041            VipsImage { ctx: out_out },
6042            Error::ZoneError,
6043        )
6044    }
6045}
6046
6047/// Options for zone operation
6048#[derive(Clone, Debug)]
6049pub struct ZoneOptions {
6050    /// uchar: `bool` -> Output an unsigned char image
6051    /// default: false
6052    pub uchar: bool,
6053}
6054
6055impl std::default::Default for ZoneOptions {
6056    fn default() -> Self {
6057        ZoneOptions { uchar: false }
6058    }
6059}
6060
6061/// VipsZone (zone), make a zone plate
6062/// width: `i32` -> Image width in pixels
6063/// min: 1, max: 10000000, default: 1
6064/// height: `i32` -> Image height in pixels
6065/// min: 1, max: 10000000, default: 1
6066/// zone_options: `&ZoneOptions` -> optional arguments
6067/// returns `VipsImage` - Output image
6068pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6069    unsafe {
6070        let width_in: i32 = width;
6071        let height_in: i32 = height;
6072        let mut out_out: *mut bindings::VipsImage = null_mut();
6073
6074        let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6075        let uchar_in_name = utils::new_c_string("uchar")?;
6076
6077        let vips_op_response = bindings::vips_zone(
6078            &mut out_out,
6079            width_in,
6080            height_in,
6081            uchar_in_name.as_ptr(),
6082            uchar_in,
6083            NULL,
6084        );
6085        utils::result(
6086            vips_op_response,
6087            VipsImage { ctx: out_out },
6088            Error::ZoneError,
6089        )
6090    }
6091}
6092
6093/// VipsSines (sines), make a 2D sine wave
6094/// width: `i32` -> Image width in pixels
6095/// min: 1, max: 10000000, default: 1
6096/// height: `i32` -> Image height in pixels
6097/// min: 1, max: 10000000, default: 1
6098/// returns `VipsImage` - Output image
6099pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6100    unsafe {
6101        let width_in: i32 = width;
6102        let height_in: i32 = height;
6103        let mut out_out: *mut bindings::VipsImage = null_mut();
6104
6105        let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6106        utils::result(
6107            vips_op_response,
6108            VipsImage { ctx: out_out },
6109            Error::SineError,
6110        )
6111    }
6112}
6113
6114/// Options for sines operation
6115#[derive(Clone, Debug)]
6116pub struct SineOptions {
6117    /// uchar: `bool` -> Output an unsigned char image
6118    /// default: false
6119    pub uchar: bool,
6120    /// hfreq: `f64` -> Horizontal spatial frequency
6121    /// min: 0, max: 10000, default: 0.5
6122    pub hfreq: f64,
6123    /// vfreq: `f64` -> Vertical spatial frequency
6124    /// min: 0, max: 10000, default: 0.5
6125    pub vfreq: f64,
6126}
6127
6128impl std::default::Default for SineOptions {
6129    fn default() -> Self {
6130        SineOptions {
6131            uchar: false,
6132            hfreq: f64::from(0.5),
6133            vfreq: f64::from(0.5),
6134        }
6135    }
6136}
6137
6138/// VipsSines (sines), make a 2D sine wave
6139/// width: `i32` -> Image width in pixels
6140/// min: 1, max: 10000000, default: 1
6141/// height: `i32` -> Image height in pixels
6142/// min: 1, max: 10000000, default: 1
6143/// sines_options: `&SineOptions` -> optional arguments
6144/// returns `VipsImage` - Output image
6145pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6146    unsafe {
6147        let width_in: i32 = width;
6148        let height_in: i32 = height;
6149        let mut out_out: *mut bindings::VipsImage = null_mut();
6150
6151        let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6152        let uchar_in_name = utils::new_c_string("uchar")?;
6153
6154        let hfreq_in: f64 = sines_options.hfreq;
6155        let hfreq_in_name = utils::new_c_string("hfreq")?;
6156
6157        let vfreq_in: f64 = sines_options.vfreq;
6158        let vfreq_in_name = utils::new_c_string("vfreq")?;
6159
6160        let vips_op_response = bindings::vips_sines(
6161            &mut out_out,
6162            width_in,
6163            height_in,
6164            uchar_in_name.as_ptr(),
6165            uchar_in,
6166            hfreq_in_name.as_ptr(),
6167            hfreq_in,
6168            vfreq_in_name.as_ptr(),
6169            vfreq_in,
6170            NULL,
6171        );
6172        utils::result(
6173            vips_op_response,
6174            VipsImage { ctx: out_out },
6175            Error::SineError,
6176        )
6177    }
6178}
6179
6180/// VipsMaskIdeal (mask_ideal), make an ideal filter
6181/// width: `i32` -> Image width in pixels
6182/// min: 1, max: 10000000, default: 1
6183/// height: `i32` -> Image height in pixels
6184/// min: 1, max: 10000000, default: 1
6185/// frequency_cutoff: `f64` -> Frequency cutoff
6186/// min: 0, max: 1000000, default: 0.5
6187/// returns `VipsImage` - Output image
6188pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6189    unsafe {
6190        let width_in: i32 = width;
6191        let height_in: i32 = height;
6192        let frequency_cutoff_in: f64 = frequency_cutoff;
6193        let mut out_out: *mut bindings::VipsImage = null_mut();
6194
6195        let vips_op_response =
6196            bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6197        utils::result(
6198            vips_op_response,
6199            VipsImage { ctx: out_out },
6200            Error::MaskIdealError,
6201        )
6202    }
6203}
6204
6205/// Options for mask_ideal operation
6206#[derive(Clone, Debug)]
6207pub struct MaskIdealOptions {
6208    /// uchar: `bool` -> Output an unsigned char image
6209    /// default: false
6210    pub uchar: bool,
6211    /// nodc: `bool` -> Remove DC component
6212    /// default: false
6213    pub nodc: bool,
6214    /// reject: `bool` -> Invert the sense of the filter
6215    /// default: false
6216    pub reject: bool,
6217    /// optical: `bool` -> Rotate quadrants to optical space
6218    /// default: false
6219    pub optical: bool,
6220}
6221
6222impl std::default::Default for MaskIdealOptions {
6223    fn default() -> Self {
6224        MaskIdealOptions {
6225            uchar: false,
6226            nodc: false,
6227            reject: false,
6228            optical: false,
6229        }
6230    }
6231}
6232
6233/// VipsMaskIdeal (mask_ideal), make an ideal filter
6234/// width: `i32` -> Image width in pixels
6235/// min: 1, max: 10000000, default: 1
6236/// height: `i32` -> Image height in pixels
6237/// min: 1, max: 10000000, default: 1
6238/// frequency_cutoff: `f64` -> Frequency cutoff
6239/// min: 0, max: 1000000, default: 0.5
6240/// mask_ideal_options: `&MaskIdealOptions` -> optional arguments
6241/// returns `VipsImage` - Output image
6242pub fn mask_ideal_with_opts(
6243    width: i32,
6244    height: i32,
6245    frequency_cutoff: f64,
6246    mask_ideal_options: &MaskIdealOptions,
6247) -> Result<VipsImage> {
6248    unsafe {
6249        let width_in: i32 = width;
6250        let height_in: i32 = height;
6251        let frequency_cutoff_in: f64 = frequency_cutoff;
6252        let mut out_out: *mut bindings::VipsImage = null_mut();
6253
6254        let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6255        let uchar_in_name = utils::new_c_string("uchar")?;
6256
6257        let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6258        let nodc_in_name = utils::new_c_string("nodc")?;
6259
6260        let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6261        let reject_in_name = utils::new_c_string("reject")?;
6262
6263        let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6264        let optical_in_name = utils::new_c_string("optical")?;
6265
6266        let vips_op_response = bindings::vips_mask_ideal(
6267            &mut out_out,
6268            width_in,
6269            height_in,
6270            frequency_cutoff_in,
6271            uchar_in_name.as_ptr(),
6272            uchar_in,
6273            nodc_in_name.as_ptr(),
6274            nodc_in,
6275            reject_in_name.as_ptr(),
6276            reject_in,
6277            optical_in_name.as_ptr(),
6278            optical_in,
6279            NULL,
6280        );
6281        utils::result(
6282            vips_op_response,
6283            VipsImage { ctx: out_out },
6284            Error::MaskIdealError,
6285        )
6286    }
6287}
6288
6289/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6290/// width: `i32` -> Image width in pixels
6291/// min: 1, max: 10000000, default: 1
6292/// height: `i32` -> Image height in pixels
6293/// min: 1, max: 10000000, default: 1
6294/// frequency_cutoff: `f64` -> Frequency cutoff
6295/// min: 0, max: 1000000, default: 0.5
6296/// ringwidth: `f64` -> Ringwidth
6297/// min: 0, max: 1000000, default: 0.5
6298/// returns `VipsImage` - Output image
6299pub fn mask_ideal_ring(
6300    width: i32,
6301    height: i32,
6302    frequency_cutoff: f64,
6303    ringwidth: f64,
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 ringwidth_in: f64 = ringwidth;
6310        let mut out_out: *mut bindings::VipsImage = null_mut();
6311
6312        let vips_op_response = bindings::vips_mask_ideal_ring(
6313            &mut out_out,
6314            width_in,
6315            height_in,
6316            frequency_cutoff_in,
6317            ringwidth_in,
6318            NULL,
6319        );
6320        utils::result(
6321            vips_op_response,
6322            VipsImage { ctx: out_out },
6323            Error::MaskIdealRingError,
6324        )
6325    }
6326}
6327
6328/// Options for mask_ideal_ring operation
6329#[derive(Clone, Debug)]
6330pub struct MaskIdealRingOptions {
6331    /// uchar: `bool` -> Output an unsigned char image
6332    /// default: false
6333    pub uchar: bool,
6334    /// nodc: `bool` -> Remove DC component
6335    /// default: false
6336    pub nodc: bool,
6337    /// reject: `bool` -> Invert the sense of the filter
6338    /// default: false
6339    pub reject: bool,
6340    /// optical: `bool` -> Rotate quadrants to optical space
6341    /// default: false
6342    pub optical: bool,
6343}
6344
6345impl std::default::Default for MaskIdealRingOptions {
6346    fn default() -> Self {
6347        MaskIdealRingOptions {
6348            uchar: false,
6349            nodc: false,
6350            reject: false,
6351            optical: false,
6352        }
6353    }
6354}
6355
6356/// VipsMaskIdealRing (mask_ideal_ring), make an ideal ring filter
6357/// width: `i32` -> Image width in pixels
6358/// min: 1, max: 10000000, default: 1
6359/// height: `i32` -> Image height in pixels
6360/// min: 1, max: 10000000, default: 1
6361/// frequency_cutoff: `f64` -> Frequency cutoff
6362/// min: 0, max: 1000000, default: 0.5
6363/// ringwidth: `f64` -> Ringwidth
6364/// min: 0, max: 1000000, default: 0.5
6365/// mask_ideal_ring_options: `&MaskIdealRingOptions` -> optional arguments
6366/// returns `VipsImage` - Output image
6367pub fn mask_ideal_ring_with_opts(
6368    width: i32,
6369    height: i32,
6370    frequency_cutoff: f64,
6371    ringwidth: f64,
6372    mask_ideal_ring_options: &MaskIdealRingOptions,
6373) -> Result<VipsImage> {
6374    unsafe {
6375        let width_in: i32 = width;
6376        let height_in: i32 = height;
6377        let frequency_cutoff_in: f64 = frequency_cutoff;
6378        let ringwidth_in: f64 = ringwidth;
6379        let mut out_out: *mut bindings::VipsImage = null_mut();
6380
6381        let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6382        let uchar_in_name = utils::new_c_string("uchar")?;
6383
6384        let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6385        let nodc_in_name = utils::new_c_string("nodc")?;
6386
6387        let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6388        let reject_in_name = utils::new_c_string("reject")?;
6389
6390        let optical_in: i32 = if mask_ideal_ring_options.optical {
6391            1
6392        } else {
6393            0
6394        };
6395        let optical_in_name = utils::new_c_string("optical")?;
6396
6397        let vips_op_response = bindings::vips_mask_ideal_ring(
6398            &mut out_out,
6399            width_in,
6400            height_in,
6401            frequency_cutoff_in,
6402            ringwidth_in,
6403            uchar_in_name.as_ptr(),
6404            uchar_in,
6405            nodc_in_name.as_ptr(),
6406            nodc_in,
6407            reject_in_name.as_ptr(),
6408            reject_in,
6409            optical_in_name.as_ptr(),
6410            optical_in,
6411            NULL,
6412        );
6413        utils::result(
6414            vips_op_response,
6415            VipsImage { ctx: out_out },
6416            Error::MaskIdealRingError,
6417        )
6418    }
6419}
6420
6421/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6422/// width: `i32` -> Image width in pixels
6423/// min: 1, max: 10000000, default: 1
6424/// height: `i32` -> Image height in pixels
6425/// min: 1, max: 10000000, default: 1
6426/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6427/// min: 0, max: 1000000, default: 0.5
6428/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6429/// min: 0, max: 1000000, default: 0.5
6430/// radius: `f64` -> Radius of circle
6431/// min: 0, max: 1000000, default: 0.1
6432/// returns `VipsImage` - Output image
6433pub fn mask_ideal_band(
6434    width: i32,
6435    height: i32,
6436    frequency_cutoff_x: f64,
6437    frequency_cutoff_y: f64,
6438    radius: f64,
6439) -> Result<VipsImage> {
6440    unsafe {
6441        let width_in: i32 = width;
6442        let height_in: i32 = height;
6443        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6444        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6445        let radius_in: f64 = radius;
6446        let mut out_out: *mut bindings::VipsImage = null_mut();
6447
6448        let vips_op_response = bindings::vips_mask_ideal_band(
6449            &mut out_out,
6450            width_in,
6451            height_in,
6452            frequency_cutoff_x_in,
6453            frequency_cutoff_y_in,
6454            radius_in,
6455            NULL,
6456        );
6457        utils::result(
6458            vips_op_response,
6459            VipsImage { ctx: out_out },
6460            Error::MaskIdealBandError,
6461        )
6462    }
6463}
6464
6465/// Options for mask_ideal_band operation
6466#[derive(Clone, Debug)]
6467pub struct MaskIdealBandOptions {
6468    /// uchar: `bool` -> Output an unsigned char image
6469    /// default: false
6470    pub uchar: bool,
6471    /// nodc: `bool` -> Remove DC component
6472    /// default: false
6473    pub nodc: bool,
6474    /// reject: `bool` -> Invert the sense of the filter
6475    /// default: false
6476    pub reject: bool,
6477    /// optical: `bool` -> Rotate quadrants to optical space
6478    /// default: false
6479    pub optical: bool,
6480}
6481
6482impl std::default::Default for MaskIdealBandOptions {
6483    fn default() -> Self {
6484        MaskIdealBandOptions {
6485            uchar: false,
6486            nodc: false,
6487            reject: false,
6488            optical: false,
6489        }
6490    }
6491}
6492
6493/// VipsMaskIdealBand (mask_ideal_band), make an ideal band filter
6494/// width: `i32` -> Image width in pixels
6495/// min: 1, max: 10000000, default: 1
6496/// height: `i32` -> Image height in pixels
6497/// min: 1, max: 10000000, default: 1
6498/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6499/// min: 0, max: 1000000, default: 0.5
6500/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6501/// min: 0, max: 1000000, default: 0.5
6502/// radius: `f64` -> Radius of circle
6503/// min: 0, max: 1000000, default: 0.1
6504/// mask_ideal_band_options: `&MaskIdealBandOptions` -> optional arguments
6505/// returns `VipsImage` - Output image
6506pub fn mask_ideal_band_with_opts(
6507    width: i32,
6508    height: i32,
6509    frequency_cutoff_x: f64,
6510    frequency_cutoff_y: f64,
6511    radius: f64,
6512    mask_ideal_band_options: &MaskIdealBandOptions,
6513) -> Result<VipsImage> {
6514    unsafe {
6515        let width_in: i32 = width;
6516        let height_in: i32 = height;
6517        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6518        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6519        let radius_in: f64 = radius;
6520        let mut out_out: *mut bindings::VipsImage = null_mut();
6521
6522        let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6523        let uchar_in_name = utils::new_c_string("uchar")?;
6524
6525        let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6526        let nodc_in_name = utils::new_c_string("nodc")?;
6527
6528        let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6529        let reject_in_name = utils::new_c_string("reject")?;
6530
6531        let optical_in: i32 = if mask_ideal_band_options.optical {
6532            1
6533        } else {
6534            0
6535        };
6536        let optical_in_name = utils::new_c_string("optical")?;
6537
6538        let vips_op_response = bindings::vips_mask_ideal_band(
6539            &mut out_out,
6540            width_in,
6541            height_in,
6542            frequency_cutoff_x_in,
6543            frequency_cutoff_y_in,
6544            radius_in,
6545            uchar_in_name.as_ptr(),
6546            uchar_in,
6547            nodc_in_name.as_ptr(),
6548            nodc_in,
6549            reject_in_name.as_ptr(),
6550            reject_in,
6551            optical_in_name.as_ptr(),
6552            optical_in,
6553            NULL,
6554        );
6555        utils::result(
6556            vips_op_response,
6557            VipsImage { ctx: out_out },
6558            Error::MaskIdealBandError,
6559        )
6560    }
6561}
6562
6563/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6564/// width: `i32` -> Image width in pixels
6565/// min: 1, max: 10000000, default: 1
6566/// height: `i32` -> Image height in pixels
6567/// min: 1, max: 10000000, default: 1
6568/// order: `f64` -> Filter order
6569/// min: 1, max: 1000000, default: 1
6570/// frequency_cutoff: `f64` -> Frequency cutoff
6571/// min: 0, max: 1000000, default: 0.5
6572/// amplitude_cutoff: `f64` -> Amplitude cutoff
6573/// min: 0, max: 1, default: 0.5
6574/// returns `VipsImage` - Output image
6575pub fn mask_butterworth(
6576    width: i32,
6577    height: i32,
6578    order: f64,
6579    frequency_cutoff: f64,
6580    amplitude_cutoff: f64,
6581) -> Result<VipsImage> {
6582    unsafe {
6583        let width_in: i32 = width;
6584        let height_in: i32 = height;
6585        let order_in: f64 = order;
6586        let frequency_cutoff_in: f64 = frequency_cutoff;
6587        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6588        let mut out_out: *mut bindings::VipsImage = null_mut();
6589
6590        let vips_op_response = bindings::vips_mask_butterworth(
6591            &mut out_out,
6592            width_in,
6593            height_in,
6594            order_in,
6595            frequency_cutoff_in,
6596            amplitude_cutoff_in,
6597            NULL,
6598        );
6599        utils::result(
6600            vips_op_response,
6601            VipsImage { ctx: out_out },
6602            Error::MaskButterworthError,
6603        )
6604    }
6605}
6606
6607/// Options for mask_butterworth operation
6608#[derive(Clone, Debug)]
6609pub struct MaskButterworthOptions {
6610    /// uchar: `bool` -> Output an unsigned char image
6611    /// default: false
6612    pub uchar: bool,
6613    /// nodc: `bool` -> Remove DC component
6614    /// default: false
6615    pub nodc: bool,
6616    /// reject: `bool` -> Invert the sense of the filter
6617    /// default: false
6618    pub reject: bool,
6619    /// optical: `bool` -> Rotate quadrants to optical space
6620    /// default: false
6621    pub optical: bool,
6622}
6623
6624impl std::default::Default for MaskButterworthOptions {
6625    fn default() -> Self {
6626        MaskButterworthOptions {
6627            uchar: false,
6628            nodc: false,
6629            reject: false,
6630            optical: false,
6631        }
6632    }
6633}
6634
6635/// VipsMaskButterworth (mask_butterworth), make a butterworth filter
6636/// width: `i32` -> Image width in pixels
6637/// min: 1, max: 10000000, default: 1
6638/// height: `i32` -> Image height in pixels
6639/// min: 1, max: 10000000, default: 1
6640/// order: `f64` -> Filter order
6641/// min: 1, max: 1000000, default: 1
6642/// frequency_cutoff: `f64` -> Frequency cutoff
6643/// min: 0, max: 1000000, default: 0.5
6644/// amplitude_cutoff: `f64` -> Amplitude cutoff
6645/// min: 0, max: 1, default: 0.5
6646/// mask_butterworth_options: `&MaskButterworthOptions` -> optional arguments
6647/// returns `VipsImage` - Output image
6648pub fn mask_butterworth_with_opts(
6649    width: i32,
6650    height: i32,
6651    order: f64,
6652    frequency_cutoff: f64,
6653    amplitude_cutoff: f64,
6654    mask_butterworth_options: &MaskButterworthOptions,
6655) -> Result<VipsImage> {
6656    unsafe {
6657        let width_in: i32 = width;
6658        let height_in: i32 = height;
6659        let order_in: f64 = order;
6660        let frequency_cutoff_in: f64 = frequency_cutoff;
6661        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6662        let mut out_out: *mut bindings::VipsImage = null_mut();
6663
6664        let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6665        let uchar_in_name = utils::new_c_string("uchar")?;
6666
6667        let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6668        let nodc_in_name = utils::new_c_string("nodc")?;
6669
6670        let reject_in: i32 = if mask_butterworth_options.reject {
6671            1
6672        } else {
6673            0
6674        };
6675        let reject_in_name = utils::new_c_string("reject")?;
6676
6677        let optical_in: i32 = if mask_butterworth_options.optical {
6678            1
6679        } else {
6680            0
6681        };
6682        let optical_in_name = utils::new_c_string("optical")?;
6683
6684        let vips_op_response = bindings::vips_mask_butterworth(
6685            &mut out_out,
6686            width_in,
6687            height_in,
6688            order_in,
6689            frequency_cutoff_in,
6690            amplitude_cutoff_in,
6691            uchar_in_name.as_ptr(),
6692            uchar_in,
6693            nodc_in_name.as_ptr(),
6694            nodc_in,
6695            reject_in_name.as_ptr(),
6696            reject_in,
6697            optical_in_name.as_ptr(),
6698            optical_in,
6699            NULL,
6700        );
6701        utils::result(
6702            vips_op_response,
6703            VipsImage { ctx: out_out },
6704            Error::MaskButterworthError,
6705        )
6706    }
6707}
6708
6709/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6710/// width: `i32` -> Image width in pixels
6711/// min: 1, max: 10000000, default: 1
6712/// height: `i32` -> Image height in pixels
6713/// min: 1, max: 10000000, default: 1
6714/// order: `f64` -> Filter order
6715/// min: 1, max: 1000000, default: 1
6716/// frequency_cutoff: `f64` -> Frequency cutoff
6717/// min: 0, max: 1000000, default: 0.5
6718/// amplitude_cutoff: `f64` -> Amplitude cutoff
6719/// min: 0, max: 1, default: 0.5
6720/// ringwidth: `f64` -> Ringwidth
6721/// min: 0, max: 1000000, default: 0.1
6722/// returns `VipsImage` - Output image
6723pub fn mask_butterworth_ring(
6724    width: i32,
6725    height: i32,
6726    order: f64,
6727    frequency_cutoff: f64,
6728    amplitude_cutoff: f64,
6729    ringwidth: f64,
6730) -> Result<VipsImage> {
6731    unsafe {
6732        let width_in: i32 = width;
6733        let height_in: i32 = height;
6734        let order_in: f64 = order;
6735        let frequency_cutoff_in: f64 = frequency_cutoff;
6736        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6737        let ringwidth_in: f64 = ringwidth;
6738        let mut out_out: *mut bindings::VipsImage = null_mut();
6739
6740        let vips_op_response = bindings::vips_mask_butterworth_ring(
6741            &mut out_out,
6742            width_in,
6743            height_in,
6744            order_in,
6745            frequency_cutoff_in,
6746            amplitude_cutoff_in,
6747            ringwidth_in,
6748            NULL,
6749        );
6750        utils::result(
6751            vips_op_response,
6752            VipsImage { ctx: out_out },
6753            Error::MaskButterworthRingError,
6754        )
6755    }
6756}
6757
6758/// Options for mask_butterworth_ring operation
6759#[derive(Clone, Debug)]
6760pub struct MaskButterworthRingOptions {
6761    /// uchar: `bool` -> Output an unsigned char image
6762    /// default: false
6763    pub uchar: bool,
6764    /// nodc: `bool` -> Remove DC component
6765    /// default: false
6766    pub nodc: bool,
6767    /// reject: `bool` -> Invert the sense of the filter
6768    /// default: false
6769    pub reject: bool,
6770    /// optical: `bool` -> Rotate quadrants to optical space
6771    /// default: false
6772    pub optical: bool,
6773}
6774
6775impl std::default::Default for MaskButterworthRingOptions {
6776    fn default() -> Self {
6777        MaskButterworthRingOptions {
6778            uchar: false,
6779            nodc: false,
6780            reject: false,
6781            optical: false,
6782        }
6783    }
6784}
6785
6786/// VipsMaskButterworthRing (mask_butterworth_ring), make a butterworth ring filter
6787/// width: `i32` -> Image width in pixels
6788/// min: 1, max: 10000000, default: 1
6789/// height: `i32` -> Image height in pixels
6790/// min: 1, max: 10000000, default: 1
6791/// order: `f64` -> Filter order
6792/// min: 1, max: 1000000, default: 1
6793/// frequency_cutoff: `f64` -> Frequency cutoff
6794/// min: 0, max: 1000000, default: 0.5
6795/// amplitude_cutoff: `f64` -> Amplitude cutoff
6796/// min: 0, max: 1, default: 0.5
6797/// ringwidth: `f64` -> Ringwidth
6798/// min: 0, max: 1000000, default: 0.1
6799/// mask_butterworth_ring_options: `&MaskButterworthRingOptions` -> optional arguments
6800/// returns `VipsImage` - Output image
6801pub fn mask_butterworth_ring_with_opts(
6802    width: i32,
6803    height: i32,
6804    order: f64,
6805    frequency_cutoff: f64,
6806    amplitude_cutoff: f64,
6807    ringwidth: f64,
6808    mask_butterworth_ring_options: &MaskButterworthRingOptions,
6809) -> Result<VipsImage> {
6810    unsafe {
6811        let width_in: i32 = width;
6812        let height_in: i32 = height;
6813        let order_in: f64 = order;
6814        let frequency_cutoff_in: f64 = frequency_cutoff;
6815        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6816        let ringwidth_in: f64 = ringwidth;
6817        let mut out_out: *mut bindings::VipsImage = null_mut();
6818
6819        let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6820            1
6821        } else {
6822            0
6823        };
6824        let uchar_in_name = utils::new_c_string("uchar")?;
6825
6826        let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6827            1
6828        } else {
6829            0
6830        };
6831        let nodc_in_name = utils::new_c_string("nodc")?;
6832
6833        let reject_in: i32 = if mask_butterworth_ring_options.reject {
6834            1
6835        } else {
6836            0
6837        };
6838        let reject_in_name = utils::new_c_string("reject")?;
6839
6840        let optical_in: i32 = if mask_butterworth_ring_options.optical {
6841            1
6842        } else {
6843            0
6844        };
6845        let optical_in_name = utils::new_c_string("optical")?;
6846
6847        let vips_op_response = bindings::vips_mask_butterworth_ring(
6848            &mut out_out,
6849            width_in,
6850            height_in,
6851            order_in,
6852            frequency_cutoff_in,
6853            amplitude_cutoff_in,
6854            ringwidth_in,
6855            uchar_in_name.as_ptr(),
6856            uchar_in,
6857            nodc_in_name.as_ptr(),
6858            nodc_in,
6859            reject_in_name.as_ptr(),
6860            reject_in,
6861            optical_in_name.as_ptr(),
6862            optical_in,
6863            NULL,
6864        );
6865        utils::result(
6866            vips_op_response,
6867            VipsImage { ctx: out_out },
6868            Error::MaskButterworthRingError,
6869        )
6870    }
6871}
6872
6873/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
6874/// width: `i32` -> Image width in pixels
6875/// min: 1, max: 10000000, default: 1
6876/// height: `i32` -> Image height in pixels
6877/// min: 1, max: 10000000, default: 1
6878/// order: `f64` -> Filter order
6879/// min: 1, max: 1000000, default: 1
6880/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6881/// min: 0, max: 1000000, default: 0.5
6882/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6883/// min: 0, max: 1000000, default: 0.5
6884/// radius: `f64` -> Radius of circle
6885/// min: 0, max: 1000000, default: 0.1
6886/// amplitude_cutoff: `f64` -> Amplitude cutoff
6887/// min: 0, max: 1, default: 0.5
6888/// returns `VipsImage` - Output image
6889pub fn mask_butterworth_band(
6890    width: i32,
6891    height: i32,
6892    order: f64,
6893    frequency_cutoff_x: f64,
6894    frequency_cutoff_y: f64,
6895    radius: f64,
6896    amplitude_cutoff: f64,
6897) -> Result<VipsImage> {
6898    unsafe {
6899        let width_in: i32 = width;
6900        let height_in: i32 = height;
6901        let order_in: f64 = order;
6902        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6903        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6904        let radius_in: f64 = radius;
6905        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6906        let mut out_out: *mut bindings::VipsImage = null_mut();
6907
6908        let vips_op_response = bindings::vips_mask_butterworth_band(
6909            &mut out_out,
6910            width_in,
6911            height_in,
6912            order_in,
6913            frequency_cutoff_x_in,
6914            frequency_cutoff_y_in,
6915            radius_in,
6916            amplitude_cutoff_in,
6917            NULL,
6918        );
6919        utils::result(
6920            vips_op_response,
6921            VipsImage { ctx: out_out },
6922            Error::MaskButterworthBandError,
6923        )
6924    }
6925}
6926
6927/// Options for mask_butterworth_band operation
6928#[derive(Clone, Debug)]
6929pub struct MaskButterworthBandOptions {
6930    /// uchar: `bool` -> Output an unsigned char image
6931    /// default: false
6932    pub uchar: bool,
6933    /// nodc: `bool` -> Remove DC component
6934    /// default: false
6935    pub nodc: bool,
6936    /// reject: `bool` -> Invert the sense of the filter
6937    /// default: false
6938    pub reject: bool,
6939    /// optical: `bool` -> Rotate quadrants to optical space
6940    /// default: false
6941    pub optical: bool,
6942}
6943
6944impl std::default::Default for MaskButterworthBandOptions {
6945    fn default() -> Self {
6946        MaskButterworthBandOptions {
6947            uchar: false,
6948            nodc: false,
6949            reject: false,
6950            optical: false,
6951        }
6952    }
6953}
6954
6955/// VipsMaskButterworthBand (mask_butterworth_band), make a butterworth_band filter
6956/// width: `i32` -> Image width in pixels
6957/// min: 1, max: 10000000, default: 1
6958/// height: `i32` -> Image height in pixels
6959/// min: 1, max: 10000000, default: 1
6960/// order: `f64` -> Filter order
6961/// min: 1, max: 1000000, default: 1
6962/// frequency_cutoff_x: `f64` -> Frequency cutoff x
6963/// min: 0, max: 1000000, default: 0.5
6964/// frequency_cutoff_y: `f64` -> Frequency cutoff y
6965/// min: 0, max: 1000000, default: 0.5
6966/// radius: `f64` -> Radius of circle
6967/// min: 0, max: 1000000, default: 0.1
6968/// amplitude_cutoff: `f64` -> Amplitude cutoff
6969/// min: 0, max: 1, default: 0.5
6970/// mask_butterworth_band_options: `&MaskButterworthBandOptions` -> optional arguments
6971/// returns `VipsImage` - Output image
6972pub fn mask_butterworth_band_with_opts(
6973    width: i32,
6974    height: i32,
6975    order: f64,
6976    frequency_cutoff_x: f64,
6977    frequency_cutoff_y: f64,
6978    radius: f64,
6979    amplitude_cutoff: f64,
6980    mask_butterworth_band_options: &MaskButterworthBandOptions,
6981) -> Result<VipsImage> {
6982    unsafe {
6983        let width_in: i32 = width;
6984        let height_in: i32 = height;
6985        let order_in: f64 = order;
6986        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6987        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6988        let radius_in: f64 = radius;
6989        let amplitude_cutoff_in: f64 = amplitude_cutoff;
6990        let mut out_out: *mut bindings::VipsImage = null_mut();
6991
6992        let uchar_in: i32 = if mask_butterworth_band_options.uchar {
6993            1
6994        } else {
6995            0
6996        };
6997        let uchar_in_name = utils::new_c_string("uchar")?;
6998
6999        let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7000            1
7001        } else {
7002            0
7003        };
7004        let nodc_in_name = utils::new_c_string("nodc")?;
7005
7006        let reject_in: i32 = if mask_butterworth_band_options.reject {
7007            1
7008        } else {
7009            0
7010        };
7011        let reject_in_name = utils::new_c_string("reject")?;
7012
7013        let optical_in: i32 = if mask_butterworth_band_options.optical {
7014            1
7015        } else {
7016            0
7017        };
7018        let optical_in_name = utils::new_c_string("optical")?;
7019
7020        let vips_op_response = bindings::vips_mask_butterworth_band(
7021            &mut out_out,
7022            width_in,
7023            height_in,
7024            order_in,
7025            frequency_cutoff_x_in,
7026            frequency_cutoff_y_in,
7027            radius_in,
7028            amplitude_cutoff_in,
7029            uchar_in_name.as_ptr(),
7030            uchar_in,
7031            nodc_in_name.as_ptr(),
7032            nodc_in,
7033            reject_in_name.as_ptr(),
7034            reject_in,
7035            optical_in_name.as_ptr(),
7036            optical_in,
7037            NULL,
7038        );
7039        utils::result(
7040            vips_op_response,
7041            VipsImage { ctx: out_out },
7042            Error::MaskButterworthBandError,
7043        )
7044    }
7045}
7046
7047/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7048/// width: `i32` -> Image width in pixels
7049/// min: 1, max: 10000000, default: 1
7050/// height: `i32` -> Image height in pixels
7051/// min: 1, max: 10000000, default: 1
7052/// frequency_cutoff: `f64` -> Frequency cutoff
7053/// min: 0, max: 1000000, default: 0.5
7054/// amplitude_cutoff: `f64` -> Amplitude cutoff
7055/// min: 0, max: 1, default: 0.5
7056/// returns `VipsImage` - Output image
7057pub fn mask_gaussian(
7058    width: i32,
7059    height: i32,
7060    frequency_cutoff: f64,
7061    amplitude_cutoff: f64,
7062) -> Result<VipsImage> {
7063    unsafe {
7064        let width_in: i32 = width;
7065        let height_in: i32 = height;
7066        let frequency_cutoff_in: f64 = frequency_cutoff;
7067        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7068        let mut out_out: *mut bindings::VipsImage = null_mut();
7069
7070        let vips_op_response = bindings::vips_mask_gaussian(
7071            &mut out_out,
7072            width_in,
7073            height_in,
7074            frequency_cutoff_in,
7075            amplitude_cutoff_in,
7076            NULL,
7077        );
7078        utils::result(
7079            vips_op_response,
7080            VipsImage { ctx: out_out },
7081            Error::MaskGaussianError,
7082        )
7083    }
7084}
7085
7086/// Options for mask_gaussian operation
7087#[derive(Clone, Debug)]
7088pub struct MaskGaussianOptions {
7089    /// uchar: `bool` -> Output an unsigned char image
7090    /// default: false
7091    pub uchar: bool,
7092    /// nodc: `bool` -> Remove DC component
7093    /// default: false
7094    pub nodc: bool,
7095    /// reject: `bool` -> Invert the sense of the filter
7096    /// default: false
7097    pub reject: bool,
7098    /// optical: `bool` -> Rotate quadrants to optical space
7099    /// default: false
7100    pub optical: bool,
7101}
7102
7103impl std::default::Default for MaskGaussianOptions {
7104    fn default() -> Self {
7105        MaskGaussianOptions {
7106            uchar: false,
7107            nodc: false,
7108            reject: false,
7109            optical: false,
7110        }
7111    }
7112}
7113
7114/// VipsMaskGaussian (mask_gaussian), make a gaussian filter
7115/// width: `i32` -> Image width in pixels
7116/// min: 1, max: 10000000, default: 1
7117/// height: `i32` -> Image height in pixels
7118/// min: 1, max: 10000000, default: 1
7119/// frequency_cutoff: `f64` -> Frequency cutoff
7120/// min: 0, max: 1000000, default: 0.5
7121/// amplitude_cutoff: `f64` -> Amplitude cutoff
7122/// min: 0, max: 1, default: 0.5
7123/// mask_gaussian_options: `&MaskGaussianOptions` -> optional arguments
7124/// returns `VipsImage` - Output image
7125pub fn mask_gaussian_with_opts(
7126    width: i32,
7127    height: i32,
7128    frequency_cutoff: f64,
7129    amplitude_cutoff: f64,
7130    mask_gaussian_options: &MaskGaussianOptions,
7131) -> Result<VipsImage> {
7132    unsafe {
7133        let width_in: i32 = width;
7134        let height_in: i32 = height;
7135        let frequency_cutoff_in: f64 = frequency_cutoff;
7136        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7137        let mut out_out: *mut bindings::VipsImage = null_mut();
7138
7139        let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7140        let uchar_in_name = utils::new_c_string("uchar")?;
7141
7142        let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7143        let nodc_in_name = utils::new_c_string("nodc")?;
7144
7145        let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7146        let reject_in_name = utils::new_c_string("reject")?;
7147
7148        let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7149        let optical_in_name = utils::new_c_string("optical")?;
7150
7151        let vips_op_response = bindings::vips_mask_gaussian(
7152            &mut out_out,
7153            width_in,
7154            height_in,
7155            frequency_cutoff_in,
7156            amplitude_cutoff_in,
7157            uchar_in_name.as_ptr(),
7158            uchar_in,
7159            nodc_in_name.as_ptr(),
7160            nodc_in,
7161            reject_in_name.as_ptr(),
7162            reject_in,
7163            optical_in_name.as_ptr(),
7164            optical_in,
7165            NULL,
7166        );
7167        utils::result(
7168            vips_op_response,
7169            VipsImage { ctx: out_out },
7170            Error::MaskGaussianError,
7171        )
7172    }
7173}
7174
7175/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7176/// width: `i32` -> Image width in pixels
7177/// min: 1, max: 10000000, default: 1
7178/// height: `i32` -> Image height in pixels
7179/// min: 1, max: 10000000, default: 1
7180/// frequency_cutoff: `f64` -> Frequency cutoff
7181/// min: 0, max: 1000000, default: 0.5
7182/// amplitude_cutoff: `f64` -> Amplitude cutoff
7183/// min: 0, max: 1, default: 0.5
7184/// ringwidth: `f64` -> Ringwidth
7185/// min: 0, max: 1000000, default: 0.5
7186/// returns `VipsImage` - Output image
7187pub fn mask_gaussian_ring(
7188    width: i32,
7189    height: i32,
7190    frequency_cutoff: f64,
7191    amplitude_cutoff: f64,
7192    ringwidth: f64,
7193) -> Result<VipsImage> {
7194    unsafe {
7195        let width_in: i32 = width;
7196        let height_in: i32 = height;
7197        let frequency_cutoff_in: f64 = frequency_cutoff;
7198        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7199        let ringwidth_in: f64 = ringwidth;
7200        let mut out_out: *mut bindings::VipsImage = null_mut();
7201
7202        let vips_op_response = bindings::vips_mask_gaussian_ring(
7203            &mut out_out,
7204            width_in,
7205            height_in,
7206            frequency_cutoff_in,
7207            amplitude_cutoff_in,
7208            ringwidth_in,
7209            NULL,
7210        );
7211        utils::result(
7212            vips_op_response,
7213            VipsImage { ctx: out_out },
7214            Error::MaskGaussianRingError,
7215        )
7216    }
7217}
7218
7219/// Options for mask_gaussian_ring operation
7220#[derive(Clone, Debug)]
7221pub struct MaskGaussianRingOptions {
7222    /// uchar: `bool` -> Output an unsigned char image
7223    /// default: false
7224    pub uchar: bool,
7225    /// nodc: `bool` -> Remove DC component
7226    /// default: false
7227    pub nodc: bool,
7228    /// reject: `bool` -> Invert the sense of the filter
7229    /// default: false
7230    pub reject: bool,
7231    /// optical: `bool` -> Rotate quadrants to optical space
7232    /// default: false
7233    pub optical: bool,
7234}
7235
7236impl std::default::Default for MaskGaussianRingOptions {
7237    fn default() -> Self {
7238        MaskGaussianRingOptions {
7239            uchar: false,
7240            nodc: false,
7241            reject: false,
7242            optical: false,
7243        }
7244    }
7245}
7246
7247/// VipsMaskGaussianRing (mask_gaussian_ring), make a gaussian ring filter
7248/// width: `i32` -> Image width in pixels
7249/// min: 1, max: 10000000, default: 1
7250/// height: `i32` -> Image height in pixels
7251/// min: 1, max: 10000000, default: 1
7252/// frequency_cutoff: `f64` -> Frequency cutoff
7253/// min: 0, max: 1000000, default: 0.5
7254/// amplitude_cutoff: `f64` -> Amplitude cutoff
7255/// min: 0, max: 1, default: 0.5
7256/// ringwidth: `f64` -> Ringwidth
7257/// min: 0, max: 1000000, default: 0.5
7258/// mask_gaussian_ring_options: `&MaskGaussianRingOptions` -> optional arguments
7259/// returns `VipsImage` - Output image
7260pub fn mask_gaussian_ring_with_opts(
7261    width: i32,
7262    height: i32,
7263    frequency_cutoff: f64,
7264    amplitude_cutoff: f64,
7265    ringwidth: f64,
7266    mask_gaussian_ring_options: &MaskGaussianRingOptions,
7267) -> Result<VipsImage> {
7268    unsafe {
7269        let width_in: i32 = width;
7270        let height_in: i32 = height;
7271        let frequency_cutoff_in: f64 = frequency_cutoff;
7272        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7273        let ringwidth_in: f64 = ringwidth;
7274        let mut out_out: *mut bindings::VipsImage = null_mut();
7275
7276        let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7277            1
7278        } else {
7279            0
7280        };
7281        let uchar_in_name = utils::new_c_string("uchar")?;
7282
7283        let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7284            1
7285        } else {
7286            0
7287        };
7288        let nodc_in_name = utils::new_c_string("nodc")?;
7289
7290        let reject_in: i32 = if mask_gaussian_ring_options.reject {
7291            1
7292        } else {
7293            0
7294        };
7295        let reject_in_name = utils::new_c_string("reject")?;
7296
7297        let optical_in: i32 = if mask_gaussian_ring_options.optical {
7298            1
7299        } else {
7300            0
7301        };
7302        let optical_in_name = utils::new_c_string("optical")?;
7303
7304        let vips_op_response = bindings::vips_mask_gaussian_ring(
7305            &mut out_out,
7306            width_in,
7307            height_in,
7308            frequency_cutoff_in,
7309            amplitude_cutoff_in,
7310            ringwidth_in,
7311            uchar_in_name.as_ptr(),
7312            uchar_in,
7313            nodc_in_name.as_ptr(),
7314            nodc_in,
7315            reject_in_name.as_ptr(),
7316            reject_in,
7317            optical_in_name.as_ptr(),
7318            optical_in,
7319            NULL,
7320        );
7321        utils::result(
7322            vips_op_response,
7323            VipsImage { ctx: out_out },
7324            Error::MaskGaussianRingError,
7325        )
7326    }
7327}
7328
7329/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7330/// width: `i32` -> Image width in pixels
7331/// min: 1, max: 10000000, default: 1
7332/// height: `i32` -> Image height in pixels
7333/// min: 1, max: 10000000, default: 1
7334/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7335/// min: 0, max: 1000000, default: 0.5
7336/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7337/// min: 0, max: 1000000, default: 0.5
7338/// radius: `f64` -> Radius of circle
7339/// min: 0, max: 1000000, default: 0.1
7340/// amplitude_cutoff: `f64` -> Amplitude cutoff
7341/// min: 0, max: 1, default: 0.5
7342/// returns `VipsImage` - Output image
7343pub fn mask_gaussian_band(
7344    width: i32,
7345    height: i32,
7346    frequency_cutoff_x: f64,
7347    frequency_cutoff_y: f64,
7348    radius: f64,
7349    amplitude_cutoff: f64,
7350) -> Result<VipsImage> {
7351    unsafe {
7352        let width_in: i32 = width;
7353        let height_in: i32 = height;
7354        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7355        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7356        let radius_in: f64 = radius;
7357        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7358        let mut out_out: *mut bindings::VipsImage = null_mut();
7359
7360        let vips_op_response = bindings::vips_mask_gaussian_band(
7361            &mut out_out,
7362            width_in,
7363            height_in,
7364            frequency_cutoff_x_in,
7365            frequency_cutoff_y_in,
7366            radius_in,
7367            amplitude_cutoff_in,
7368            NULL,
7369        );
7370        utils::result(
7371            vips_op_response,
7372            VipsImage { ctx: out_out },
7373            Error::MaskGaussianBandError,
7374        )
7375    }
7376}
7377
7378/// Options for mask_gaussian_band operation
7379#[derive(Clone, Debug)]
7380pub struct MaskGaussianBandOptions {
7381    /// uchar: `bool` -> Output an unsigned char image
7382    /// default: false
7383    pub uchar: bool,
7384    /// nodc: `bool` -> Remove DC component
7385    /// default: false
7386    pub nodc: bool,
7387    /// reject: `bool` -> Invert the sense of the filter
7388    /// default: false
7389    pub reject: bool,
7390    /// optical: `bool` -> Rotate quadrants to optical space
7391    /// default: false
7392    pub optical: bool,
7393}
7394
7395impl std::default::Default for MaskGaussianBandOptions {
7396    fn default() -> Self {
7397        MaskGaussianBandOptions {
7398            uchar: false,
7399            nodc: false,
7400            reject: false,
7401            optical: false,
7402        }
7403    }
7404}
7405
7406/// VipsMaskGaussianBand (mask_gaussian_band), make a gaussian filter
7407/// width: `i32` -> Image width in pixels
7408/// min: 1, max: 10000000, default: 1
7409/// height: `i32` -> Image height in pixels
7410/// min: 1, max: 10000000, default: 1
7411/// frequency_cutoff_x: `f64` -> Frequency cutoff x
7412/// min: 0, max: 1000000, default: 0.5
7413/// frequency_cutoff_y: `f64` -> Frequency cutoff y
7414/// min: 0, max: 1000000, default: 0.5
7415/// radius: `f64` -> Radius of circle
7416/// min: 0, max: 1000000, default: 0.1
7417/// amplitude_cutoff: `f64` -> Amplitude cutoff
7418/// min: 0, max: 1, default: 0.5
7419/// mask_gaussian_band_options: `&MaskGaussianBandOptions` -> optional arguments
7420/// returns `VipsImage` - Output image
7421pub fn mask_gaussian_band_with_opts(
7422    width: i32,
7423    height: i32,
7424    frequency_cutoff_x: f64,
7425    frequency_cutoff_y: f64,
7426    radius: f64,
7427    amplitude_cutoff: f64,
7428    mask_gaussian_band_options: &MaskGaussianBandOptions,
7429) -> Result<VipsImage> {
7430    unsafe {
7431        let width_in: i32 = width;
7432        let height_in: i32 = height;
7433        let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7434        let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7435        let radius_in: f64 = radius;
7436        let amplitude_cutoff_in: f64 = amplitude_cutoff;
7437        let mut out_out: *mut bindings::VipsImage = null_mut();
7438
7439        let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7440            1
7441        } else {
7442            0
7443        };
7444        let uchar_in_name = utils::new_c_string("uchar")?;
7445
7446        let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7447            1
7448        } else {
7449            0
7450        };
7451        let nodc_in_name = utils::new_c_string("nodc")?;
7452
7453        let reject_in: i32 = if mask_gaussian_band_options.reject {
7454            1
7455        } else {
7456            0
7457        };
7458        let reject_in_name = utils::new_c_string("reject")?;
7459
7460        let optical_in: i32 = if mask_gaussian_band_options.optical {
7461            1
7462        } else {
7463            0
7464        };
7465        let optical_in_name = utils::new_c_string("optical")?;
7466
7467        let vips_op_response = bindings::vips_mask_gaussian_band(
7468            &mut out_out,
7469            width_in,
7470            height_in,
7471            frequency_cutoff_x_in,
7472            frequency_cutoff_y_in,
7473            radius_in,
7474            amplitude_cutoff_in,
7475            uchar_in_name.as_ptr(),
7476            uchar_in,
7477            nodc_in_name.as_ptr(),
7478            nodc_in,
7479            reject_in_name.as_ptr(),
7480            reject_in,
7481            optical_in_name.as_ptr(),
7482            optical_in,
7483            NULL,
7484        );
7485        utils::result(
7486            vips_op_response,
7487            VipsImage { ctx: out_out },
7488            Error::MaskGaussianBandError,
7489        )
7490    }
7491}
7492
7493/// VipsMaskFractal (mask_fractal), make fractal filter
7494/// width: `i32` -> Image width in pixels
7495/// min: 1, max: 10000000, default: 1
7496/// height: `i32` -> Image height in pixels
7497/// min: 1, max: 10000000, default: 1
7498/// fractal_dimension: `f64` -> Fractal dimension
7499/// min: 2, max: 3, default: 2.5
7500/// returns `VipsImage` - Output image
7501pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7502    unsafe {
7503        let width_in: i32 = width;
7504        let height_in: i32 = height;
7505        let fractal_dimension_in: f64 = fractal_dimension;
7506        let mut out_out: *mut bindings::VipsImage = null_mut();
7507
7508        let vips_op_response = bindings::vips_mask_fractal(
7509            &mut out_out,
7510            width_in,
7511            height_in,
7512            fractal_dimension_in,
7513            NULL,
7514        );
7515        utils::result(
7516            vips_op_response,
7517            VipsImage { ctx: out_out },
7518            Error::MaskFractalError,
7519        )
7520    }
7521}
7522
7523/// Options for mask_fractal operation
7524#[derive(Clone, Debug)]
7525pub struct MaskFractalOptions {
7526    /// uchar: `bool` -> Output an unsigned char image
7527    /// default: false
7528    pub uchar: bool,
7529    /// nodc: `bool` -> Remove DC component
7530    /// default: false
7531    pub nodc: bool,
7532    /// reject: `bool` -> Invert the sense of the filter
7533    /// default: false
7534    pub reject: bool,
7535    /// optical: `bool` -> Rotate quadrants to optical space
7536    /// default: false
7537    pub optical: bool,
7538}
7539
7540impl std::default::Default for MaskFractalOptions {
7541    fn default() -> Self {
7542        MaskFractalOptions {
7543            uchar: false,
7544            nodc: false,
7545            reject: false,
7546            optical: false,
7547        }
7548    }
7549}
7550
7551/// VipsMaskFractal (mask_fractal), make fractal filter
7552/// width: `i32` -> Image width in pixels
7553/// min: 1, max: 10000000, default: 1
7554/// height: `i32` -> Image height in pixels
7555/// min: 1, max: 10000000, default: 1
7556/// fractal_dimension: `f64` -> Fractal dimension
7557/// min: 2, max: 3, default: 2.5
7558/// mask_fractal_options: `&MaskFractalOptions` -> optional arguments
7559/// returns `VipsImage` - Output image
7560pub fn mask_fractal_with_opts(
7561    width: i32,
7562    height: i32,
7563    fractal_dimension: f64,
7564    mask_fractal_options: &MaskFractalOptions,
7565) -> Result<VipsImage> {
7566    unsafe {
7567        let width_in: i32 = width;
7568        let height_in: i32 = height;
7569        let fractal_dimension_in: f64 = fractal_dimension;
7570        let mut out_out: *mut bindings::VipsImage = null_mut();
7571
7572        let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7573        let uchar_in_name = utils::new_c_string("uchar")?;
7574
7575        let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7576        let nodc_in_name = utils::new_c_string("nodc")?;
7577
7578        let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7579        let reject_in_name = utils::new_c_string("reject")?;
7580
7581        let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7582        let optical_in_name = utils::new_c_string("optical")?;
7583
7584        let vips_op_response = bindings::vips_mask_fractal(
7585            &mut out_out,
7586            width_in,
7587            height_in,
7588            fractal_dimension_in,
7589            uchar_in_name.as_ptr(),
7590            uchar_in,
7591            nodc_in_name.as_ptr(),
7592            nodc_in,
7593            reject_in_name.as_ptr(),
7594            reject_in,
7595            optical_in_name.as_ptr(),
7596            optical_in,
7597            NULL,
7598        );
7599        utils::result(
7600            vips_op_response,
7601            VipsImage { ctx: out_out },
7602            Error::MaskFractalError,
7603        )
7604    }
7605}
7606
7607/// VipsBuildlut (buildlut), build a look-up table
7608/// inp: `&VipsImage` -> Matrix of XY coordinates
7609/// returns `VipsImage` - Output image
7610pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7611    unsafe {
7612        let inp_in: *mut bindings::VipsImage = inp.ctx;
7613        let mut out_out: *mut bindings::VipsImage = null_mut();
7614
7615        let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7616        utils::result(
7617            vips_op_response,
7618            VipsImage { ctx: out_out },
7619            Error::BuildlutError,
7620        )
7621    }
7622}
7623
7624/// VipsInvertlut (invertlut), build an inverted look-up table
7625/// inp: `&VipsImage` -> Matrix of XY coordinates
7626/// returns `VipsImage` - Output image
7627pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7628    unsafe {
7629        let inp_in: *mut bindings::VipsImage = inp.ctx;
7630        let mut out_out: *mut bindings::VipsImage = null_mut();
7631
7632        let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7633        utils::result(
7634            vips_op_response,
7635            VipsImage { ctx: out_out },
7636            Error::InvertlutError,
7637        )
7638    }
7639}
7640
7641/// Options for invertlut operation
7642#[derive(Clone, Debug)]
7643pub struct InvertlutOptions {
7644    /// size: `i32` -> LUT size to generate
7645    /// min: 1, max: 1000000, default: 256
7646    pub size: i32,
7647}
7648
7649impl std::default::Default for InvertlutOptions {
7650    fn default() -> Self {
7651        InvertlutOptions {
7652            size: i32::from(256),
7653        }
7654    }
7655}
7656
7657/// VipsInvertlut (invertlut), build an inverted look-up table
7658/// inp: `&VipsImage` -> Matrix of XY coordinates
7659/// invertlut_options: `&InvertlutOptions` -> optional arguments
7660/// returns `VipsImage` - Output image
7661pub fn invertlut_with_opts(
7662    inp: &VipsImage,
7663    invertlut_options: &InvertlutOptions,
7664) -> Result<VipsImage> {
7665    unsafe {
7666        let inp_in: *mut bindings::VipsImage = inp.ctx;
7667        let mut out_out: *mut bindings::VipsImage = null_mut();
7668
7669        let size_in: i32 = invertlut_options.size;
7670        let size_in_name = utils::new_c_string("size")?;
7671
7672        let vips_op_response =
7673            bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7674        utils::result(
7675            vips_op_response,
7676            VipsImage { ctx: out_out },
7677            Error::InvertlutError,
7678        )
7679    }
7680}
7681
7682/// VipsTonelut (tonelut), build a look-up table
7683
7684/// returns `VipsImage` - Output image
7685pub fn tonelut() -> Result<VipsImage> {
7686    unsafe {
7687        let mut out_out: *mut bindings::VipsImage = null_mut();
7688
7689        let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7690        utils::result(
7691            vips_op_response,
7692            VipsImage { ctx: out_out },
7693            Error::TonelutError,
7694        )
7695    }
7696}
7697
7698/// Options for tonelut operation
7699#[derive(Clone, Debug)]
7700pub struct TonelutOptions {
7701    /// in_max: `i32` -> Size of LUT to build
7702    /// min: 1, max: 65535, default: 32767
7703    pub in_max: i32,
7704    /// out_max: `i32` -> Maximum value in output LUT
7705    /// min: 1, max: 65535, default: 32767
7706    pub out_max: i32,
7707    /// lb: `f64` -> Lowest value in output
7708    /// min: 0, max: 100, default: 0
7709    pub lb: f64,
7710    /// lw: `f64` -> Highest value in output
7711    /// min: 0, max: 100, default: 100
7712    pub lw: f64,
7713    /// ps: `f64` -> Position of shadow
7714    /// min: 0, max: 1, default: 0.2
7715    pub ps: f64,
7716    /// pm: `f64` -> Position of mid-tones
7717    /// min: 0, max: 1, default: 0.5
7718    pub pm: f64,
7719    /// ph: `f64` -> Position of highlights
7720    /// min: 0, max: 1, default: 0.8
7721    pub ph: f64,
7722    /// s: `f64` -> Adjust shadows by this much
7723    /// min: -30, max: 30, default: 0
7724    pub s: f64,
7725    /// m: `f64` -> Adjust mid-tones by this much
7726    /// min: -30, max: 30, default: 0
7727    pub m: f64,
7728    /// h: `f64` -> Adjust highlights by this much
7729    /// min: -30, max: 30, default: 0
7730    pub h: f64,
7731}
7732
7733impl std::default::Default for TonelutOptions {
7734    fn default() -> Self {
7735        TonelutOptions {
7736            in_max: i32::from(32767),
7737            out_max: i32::from(32767),
7738            lb: f64::from(0),
7739            lw: f64::from(100),
7740            ps: f64::from(0.2),
7741            pm: f64::from(0.5),
7742            ph: f64::from(0.8),
7743            s: f64::from(0),
7744            m: f64::from(0),
7745            h: f64::from(0),
7746        }
7747    }
7748}
7749
7750/// VipsTonelut (tonelut), build a look-up table
7751
7752/// tonelut_options: `&TonelutOptions` -> optional arguments
7753/// returns `VipsImage` - Output image
7754pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7755    unsafe {
7756        let mut out_out: *mut bindings::VipsImage = null_mut();
7757
7758        let in_max_in: i32 = tonelut_options.in_max;
7759        let in_max_in_name = utils::new_c_string("in-max")?;
7760
7761        let out_max_in: i32 = tonelut_options.out_max;
7762        let out_max_in_name = utils::new_c_string("out-max")?;
7763
7764        let lb_in: f64 = tonelut_options.lb;
7765        let lb_in_name = utils::new_c_string("Lb")?;
7766
7767        let lw_in: f64 = tonelut_options.lw;
7768        let lw_in_name = utils::new_c_string("Lw")?;
7769
7770        let ps_in: f64 = tonelut_options.ps;
7771        let ps_in_name = utils::new_c_string("Ps")?;
7772
7773        let pm_in: f64 = tonelut_options.pm;
7774        let pm_in_name = utils::new_c_string("Pm")?;
7775
7776        let ph_in: f64 = tonelut_options.ph;
7777        let ph_in_name = utils::new_c_string("Ph")?;
7778
7779        let s_in: f64 = tonelut_options.s;
7780        let s_in_name = utils::new_c_string("S")?;
7781
7782        let m_in: f64 = tonelut_options.m;
7783        let m_in_name = utils::new_c_string("M")?;
7784
7785        let h_in: f64 = tonelut_options.h;
7786        let h_in_name = utils::new_c_string("H")?;
7787
7788        let vips_op_response = bindings::vips_tonelut(
7789            &mut out_out,
7790            in_max_in_name.as_ptr(),
7791            in_max_in,
7792            out_max_in_name.as_ptr(),
7793            out_max_in,
7794            lb_in_name.as_ptr(),
7795            lb_in,
7796            lw_in_name.as_ptr(),
7797            lw_in,
7798            ps_in_name.as_ptr(),
7799            ps_in,
7800            pm_in_name.as_ptr(),
7801            pm_in,
7802            ph_in_name.as_ptr(),
7803            ph_in,
7804            s_in_name.as_ptr(),
7805            s_in,
7806            m_in_name.as_ptr(),
7807            m_in,
7808            h_in_name.as_ptr(),
7809            h_in,
7810            NULL,
7811        );
7812        utils::result(
7813            vips_op_response,
7814            VipsImage { ctx: out_out },
7815            Error::TonelutError,
7816        )
7817    }
7818}
7819
7820/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7821
7822/// returns `VipsImage` - Output image
7823pub fn identity() -> Result<VipsImage> {
7824    unsafe {
7825        let mut out_out: *mut bindings::VipsImage = null_mut();
7826
7827        let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7828        utils::result(
7829            vips_op_response,
7830            VipsImage { ctx: out_out },
7831            Error::IdentityError,
7832        )
7833    }
7834}
7835
7836/// Options for identity operation
7837#[derive(Clone, Debug)]
7838pub struct IdentityOptions {
7839    /// bands: `i32` -> Number of bands in LUT
7840    /// min: 1, max: 100000, default: 1
7841    pub bands: i32,
7842    /// ushort: `bool` -> Create a 16-bit LUT
7843    /// default: false
7844    pub ushort: bool,
7845    /// size: `i32` -> Size of 16-bit LUT
7846    /// min: 1, max: 65536, default: 65536
7847    pub size: i32,
7848}
7849
7850impl std::default::Default for IdentityOptions {
7851    fn default() -> Self {
7852        IdentityOptions {
7853            bands: i32::from(1),
7854            ushort: false,
7855            size: i32::from(65536),
7856        }
7857    }
7858}
7859
7860/// VipsIdentity (identity), make a 1D image where pixel values are indexes
7861
7862/// identity_options: `&IdentityOptions` -> optional arguments
7863/// returns `VipsImage` - Output image
7864pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
7865    unsafe {
7866        let mut out_out: *mut bindings::VipsImage = null_mut();
7867
7868        let bands_in: i32 = identity_options.bands;
7869        let bands_in_name = utils::new_c_string("bands")?;
7870
7871        let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
7872        let ushort_in_name = utils::new_c_string("ushort")?;
7873
7874        let size_in: i32 = identity_options.size;
7875        let size_in_name = utils::new_c_string("size")?;
7876
7877        let vips_op_response = bindings::vips_identity(
7878            &mut out_out,
7879            bands_in_name.as_ptr(),
7880            bands_in,
7881            ushort_in_name.as_ptr(),
7882            ushort_in,
7883            size_in_name.as_ptr(),
7884            size_in,
7885            NULL,
7886        );
7887        utils::result(
7888            vips_op_response,
7889            VipsImage { ctx: out_out },
7890            Error::IdentityError,
7891        )
7892    }
7893}
7894
7895/// VipsFractsurf (fractsurf), make a fractal surface
7896/// width: `i32` -> Image width in pixels
7897/// min: 1, max: 10000000, default: 64
7898/// height: `i32` -> Image height in pixels
7899/// min: 1, max: 10000000, default: 64
7900/// fractal_dimension: `f64` -> Fractal dimension
7901/// min: 2, max: 3, default: 2.5
7902/// returns `VipsImage` - Output image
7903pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7904    unsafe {
7905        let width_in: i32 = width;
7906        let height_in: i32 = height;
7907        let fractal_dimension_in: f64 = fractal_dimension;
7908        let mut out_out: *mut bindings::VipsImage = null_mut();
7909
7910        let vips_op_response = bindings::vips_fractsurf(
7911            &mut out_out,
7912            width_in,
7913            height_in,
7914            fractal_dimension_in,
7915            NULL,
7916        );
7917        utils::result(
7918            vips_op_response,
7919            VipsImage { ctx: out_out },
7920            Error::FractsurfError,
7921        )
7922    }
7923}
7924
7925/// VipsWorley (worley), make a worley noise image
7926/// width: `i32` -> Image width in pixels
7927/// min: 1, max: 10000000, default: 1
7928/// height: `i32` -> Image height in pixels
7929/// min: 1, max: 10000000, default: 1
7930/// returns `VipsImage` - Output image
7931pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
7932    unsafe {
7933        let width_in: i32 = width;
7934        let height_in: i32 = height;
7935        let mut out_out: *mut bindings::VipsImage = null_mut();
7936
7937        let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
7938        utils::result(
7939            vips_op_response,
7940            VipsImage { ctx: out_out },
7941            Error::WorleyError,
7942        )
7943    }
7944}
7945
7946/// Options for worley operation
7947#[derive(Clone, Debug)]
7948pub struct WorleyOptions {
7949    /// cell_size: `i32` -> Size of Worley cells
7950    /// min: 1, max: 10000000, default: 256
7951    pub cell_size: i32,
7952    /// seed: `i32` -> Random number seed
7953    /// min: -2147483648, max: 2147483647, default: 0
7954    pub seed: i32,
7955}
7956
7957impl std::default::Default for WorleyOptions {
7958    fn default() -> Self {
7959        WorleyOptions {
7960            cell_size: i32::from(256),
7961            seed: i32::from(0),
7962        }
7963    }
7964}
7965
7966/// VipsWorley (worley), make a worley noise image
7967/// width: `i32` -> Image width in pixels
7968/// min: 1, max: 10000000, default: 1
7969/// height: `i32` -> Image height in pixels
7970/// min: 1, max: 10000000, default: 1
7971/// worley_options: `&WorleyOptions` -> optional arguments
7972/// returns `VipsImage` - Output image
7973pub fn worley_with_opts(
7974    width: i32,
7975    height: i32,
7976    worley_options: &WorleyOptions,
7977) -> Result<VipsImage> {
7978    unsafe {
7979        let width_in: i32 = width;
7980        let height_in: i32 = height;
7981        let mut out_out: *mut bindings::VipsImage = null_mut();
7982
7983        let cell_size_in: i32 = worley_options.cell_size;
7984        let cell_size_in_name = utils::new_c_string("cell-size")?;
7985
7986        let seed_in: i32 = worley_options.seed;
7987        let seed_in_name = utils::new_c_string("seed")?;
7988
7989        let vips_op_response = bindings::vips_worley(
7990            &mut out_out,
7991            width_in,
7992            height_in,
7993            cell_size_in_name.as_ptr(),
7994            cell_size_in,
7995            seed_in_name.as_ptr(),
7996            seed_in,
7997            NULL,
7998        );
7999        utils::result(
8000            vips_op_response,
8001            VipsImage { ctx: out_out },
8002            Error::WorleyError,
8003        )
8004    }
8005}
8006
8007/// VipsPerlin (perlin), make a perlin noise image
8008/// width: `i32` -> Image width in pixels
8009/// min: 1, max: 10000000, default: 1
8010/// height: `i32` -> Image height in pixels
8011/// min: 1, max: 10000000, default: 1
8012/// returns `VipsImage` - Output image
8013pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8014    unsafe {
8015        let width_in: i32 = width;
8016        let height_in: i32 = height;
8017        let mut out_out: *mut bindings::VipsImage = null_mut();
8018
8019        let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8020        utils::result(
8021            vips_op_response,
8022            VipsImage { ctx: out_out },
8023            Error::PerlinError,
8024        )
8025    }
8026}
8027
8028/// Options for perlin operation
8029#[derive(Clone, Debug)]
8030pub struct PerlinOptions {
8031    /// cell_size: `i32` -> Size of Perlin cells
8032    /// min: 1, max: 10000000, default: 256
8033    pub cell_size: i32,
8034    /// uchar: `bool` -> Output an unsigned char image
8035    /// default: false
8036    pub uchar: bool,
8037    /// seed: `i32` -> Random number seed
8038    /// min: -2147483648, max: 2147483647, default: 0
8039    pub seed: i32,
8040}
8041
8042impl std::default::Default for PerlinOptions {
8043    fn default() -> Self {
8044        PerlinOptions {
8045            cell_size: i32::from(256),
8046            uchar: false,
8047            seed: i32::from(0),
8048        }
8049    }
8050}
8051
8052/// VipsPerlin (perlin), make a perlin noise image
8053/// width: `i32` -> Image width in pixels
8054/// min: 1, max: 10000000, default: 1
8055/// height: `i32` -> Image height in pixels
8056/// min: 1, max: 10000000, default: 1
8057/// perlin_options: `&PerlinOptions` -> optional arguments
8058/// returns `VipsImage` - Output image
8059pub fn perlin_with_opts(
8060    width: i32,
8061    height: i32,
8062    perlin_options: &PerlinOptions,
8063) -> Result<VipsImage> {
8064    unsafe {
8065        let width_in: i32 = width;
8066        let height_in: i32 = height;
8067        let mut out_out: *mut bindings::VipsImage = null_mut();
8068
8069        let cell_size_in: i32 = perlin_options.cell_size;
8070        let cell_size_in_name = utils::new_c_string("cell-size")?;
8071
8072        let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8073        let uchar_in_name = utils::new_c_string("uchar")?;
8074
8075        let seed_in: i32 = perlin_options.seed;
8076        let seed_in_name = utils::new_c_string("seed")?;
8077
8078        let vips_op_response = bindings::vips_perlin(
8079            &mut out_out,
8080            width_in,
8081            height_in,
8082            cell_size_in_name.as_ptr(),
8083            cell_size_in,
8084            uchar_in_name.as_ptr(),
8085            uchar_in,
8086            seed_in_name.as_ptr(),
8087            seed_in,
8088            NULL,
8089        );
8090        utils::result(
8091            vips_op_response,
8092            VipsImage { ctx: out_out },
8093            Error::PerlinError,
8094        )
8095    }
8096}
8097
8098/// VipsSwitch (switch), find the index of the first non-zero pixel in tests
8099/// tests: `&mut [VipsImage]` -> Table of images to test
8100/// returns `VipsImage` - Output image
8101pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8102    unsafe {
8103        let (tests_len, mut tests_in) = {
8104            let len = tests.len();
8105            let mut input = Vec::new();
8106            for img in tests {
8107                input.push(img.ctx)
8108            }
8109            (len as i32, input)
8110        };
8111        let mut out_out: *mut bindings::VipsImage = null_mut();
8112
8113        let vips_op_response =
8114            bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8115        utils::result(
8116            vips_op_response,
8117            VipsImage { ctx: out_out },
8118            Error::SwitchError,
8119        )
8120    }
8121}
8122
8123/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8124/// filename: `&str` -> Filename to load from
8125/// returns `VipsImage` - Output image
8126pub fn csvload(filename: &str) -> Result<VipsImage> {
8127    unsafe {
8128        let filename_in: CString = utils::new_c_string(filename)?;
8129        let mut out_out: *mut bindings::VipsImage = null_mut();
8130
8131        let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8132        utils::result(
8133            vips_op_response,
8134            VipsImage { ctx: out_out },
8135            Error::CsvloadError,
8136        )
8137    }
8138}
8139
8140/// Options for csvload operation
8141#[derive(Clone, Debug)]
8142pub struct CsvloadOptions {
8143    /// skip: `i32` -> Skip this many lines at the start of the file
8144    /// min: 0, max: 10000000, default: 0
8145    pub skip: i32,
8146    /// lines: `i32` -> Read this many lines from the file
8147    /// min: -1, max: 10000000, default: 0
8148    pub lines: i32,
8149    /// whitespace: `String` -> Set of whitespace characters
8150    pub whitespace: String,
8151    /// separator: `String` -> Set of separator characters
8152    pub separator: String,
8153    /// flags: `ForeignFlags` -> Flags for this file
8154    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8155    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8156    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8157    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8158    ///  `All` -> VIPS_FOREIGN_ALL = 7
8159    pub flags: ForeignFlags,
8160    /// memory: `bool` -> Force open via memory
8161    /// default: false
8162    pub memory: bool,
8163    /// access: `Access` -> Required access pattern for this file
8164    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8165    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8166    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8167    ///  `Last` -> VIPS_ACCESS_LAST = 3
8168    pub access: Access,
8169    /// fail_on: `FailOn` -> Error level to fail on
8170    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8171    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8172    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8173    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8174    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8175    pub fail_on: FailOn,
8176    /// revalidate: `bool` -> Don't use a cached result for this operation
8177    /// default: false
8178    pub revalidate: bool,
8179}
8180
8181impl std::default::Default for CsvloadOptions {
8182    fn default() -> Self {
8183        CsvloadOptions {
8184            skip: i32::from(0),
8185            lines: i32::from(0),
8186            whitespace: String::new(),
8187            separator: String::new(),
8188            flags: ForeignFlags::None,
8189            memory: false,
8190            access: Access::Random,
8191            fail_on: FailOn::None,
8192            revalidate: false,
8193        }
8194    }
8195}
8196
8197/// VipsForeignLoadCsvFile (csvload), load csv (.csv), priority=0, untrusted, get_flags, get_flags_filename, header, load
8198/// filename: `&str` -> Filename to load from
8199/// csvload_options: `&CsvloadOptions` -> optional arguments
8200/// returns `VipsImage` - Output image
8201pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8202    unsafe {
8203        let filename_in: CString = utils::new_c_string(filename)?;
8204        let mut out_out: *mut bindings::VipsImage = null_mut();
8205
8206        let skip_in: i32 = csvload_options.skip;
8207        let skip_in_name = utils::new_c_string("skip")?;
8208
8209        let lines_in: i32 = csvload_options.lines;
8210        let lines_in_name = utils::new_c_string("lines")?;
8211
8212        let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8213        let whitespace_in_name = utils::new_c_string("whitespace")?;
8214
8215        let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8216        let separator_in_name = utils::new_c_string("separator")?;
8217
8218        let flags_in: i32 = csvload_options.flags as i32;
8219        let flags_in_name = utils::new_c_string("flags")?;
8220
8221        let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8222        let memory_in_name = utils::new_c_string("memory")?;
8223
8224        let access_in: i32 = csvload_options.access as i32;
8225        let access_in_name = utils::new_c_string("access")?;
8226
8227        let fail_on_in: i32 = csvload_options.fail_on as i32;
8228        let fail_on_in_name = utils::new_c_string("fail-on")?;
8229
8230        let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8231        let revalidate_in_name = utils::new_c_string("revalidate")?;
8232
8233        let vips_op_response = bindings::vips_csvload(
8234            filename_in.as_ptr(),
8235            &mut out_out,
8236            skip_in_name.as_ptr(),
8237            skip_in,
8238            lines_in_name.as_ptr(),
8239            lines_in,
8240            whitespace_in_name.as_ptr(),
8241            whitespace_in.as_ptr(),
8242            separator_in_name.as_ptr(),
8243            separator_in.as_ptr(),
8244            flags_in_name.as_ptr(),
8245            flags_in,
8246            memory_in_name.as_ptr(),
8247            memory_in,
8248            access_in_name.as_ptr(),
8249            access_in,
8250            fail_on_in_name.as_ptr(),
8251            fail_on_in,
8252            revalidate_in_name.as_ptr(),
8253            revalidate_in,
8254            NULL,
8255        );
8256        utils::result(
8257            vips_op_response,
8258            VipsImage { ctx: out_out },
8259            Error::CsvloadError,
8260        )
8261    }
8262}
8263
8264/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8265/// source: `&VipsSource` -> Source to load from
8266/// returns `VipsImage` - Output image
8267pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8268    unsafe {
8269        let source_in: *mut bindings::VipsSource = source.ctx;
8270        let mut out_out: *mut bindings::VipsImage = null_mut();
8271
8272        let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8273        utils::result(
8274            vips_op_response,
8275            VipsImage { ctx: out_out },
8276            Error::CsvloadSourceError,
8277        )
8278    }
8279}
8280
8281/// Options for csvload_source operation
8282#[derive(Clone, Debug)]
8283pub struct CsvloadSourceOptions {
8284    /// skip: `i32` -> Skip this many lines at the start of the file
8285    /// min: 0, max: 10000000, default: 0
8286    pub skip: i32,
8287    /// lines: `i32` -> Read this many lines from the file
8288    /// min: -1, max: 10000000, default: 0
8289    pub lines: i32,
8290    /// whitespace: `String` -> Set of whitespace characters
8291    pub whitespace: String,
8292    /// separator: `String` -> Set of separator characters
8293    pub separator: String,
8294    /// flags: `ForeignFlags` -> Flags for this file
8295    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8296    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8297    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8298    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8299    ///  `All` -> VIPS_FOREIGN_ALL = 7
8300    pub flags: ForeignFlags,
8301    /// memory: `bool` -> Force open via memory
8302    /// default: false
8303    pub memory: bool,
8304    /// access: `Access` -> Required access pattern for this file
8305    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8306    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8307    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8308    ///  `Last` -> VIPS_ACCESS_LAST = 3
8309    pub access: Access,
8310    /// fail_on: `FailOn` -> Error level to fail on
8311    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8312    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8313    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8314    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8315    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8316    pub fail_on: FailOn,
8317    /// revalidate: `bool` -> Don't use a cached result for this operation
8318    /// default: false
8319    pub revalidate: bool,
8320}
8321
8322impl std::default::Default for CsvloadSourceOptions {
8323    fn default() -> Self {
8324        CsvloadSourceOptions {
8325            skip: i32::from(0),
8326            lines: i32::from(0),
8327            whitespace: String::new(),
8328            separator: String::new(),
8329            flags: ForeignFlags::None,
8330            memory: false,
8331            access: Access::Random,
8332            fail_on: FailOn::None,
8333            revalidate: false,
8334        }
8335    }
8336}
8337
8338/// VipsForeignLoadCsvSource (csvload_source), load csv, priority=0, untrusted, is_a_source, get_flags, header, load
8339/// source: `&VipsSource` -> Source to load from
8340/// csvload_source_options: `&CsvloadSourceOptions` -> optional arguments
8341/// returns `VipsImage` - Output image
8342pub fn csvload_source_with_opts(
8343    source: &VipsSource,
8344    csvload_source_options: &CsvloadSourceOptions,
8345) -> Result<VipsImage> {
8346    unsafe {
8347        let source_in: *mut bindings::VipsSource = source.ctx;
8348        let mut out_out: *mut bindings::VipsImage = null_mut();
8349
8350        let skip_in: i32 = csvload_source_options.skip;
8351        let skip_in_name = utils::new_c_string("skip")?;
8352
8353        let lines_in: i32 = csvload_source_options.lines;
8354        let lines_in_name = utils::new_c_string("lines")?;
8355
8356        let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8357        let whitespace_in_name = utils::new_c_string("whitespace")?;
8358
8359        let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8360        let separator_in_name = utils::new_c_string("separator")?;
8361
8362        let flags_in: i32 = csvload_source_options.flags as i32;
8363        let flags_in_name = utils::new_c_string("flags")?;
8364
8365        let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8366        let memory_in_name = utils::new_c_string("memory")?;
8367
8368        let access_in: i32 = csvload_source_options.access as i32;
8369        let access_in_name = utils::new_c_string("access")?;
8370
8371        let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8372        let fail_on_in_name = utils::new_c_string("fail-on")?;
8373
8374        let revalidate_in: i32 = if csvload_source_options.revalidate {
8375            1
8376        } else {
8377            0
8378        };
8379        let revalidate_in_name = utils::new_c_string("revalidate")?;
8380
8381        let vips_op_response = bindings::vips_csvload_source(
8382            source_in,
8383            &mut out_out,
8384            skip_in_name.as_ptr(),
8385            skip_in,
8386            lines_in_name.as_ptr(),
8387            lines_in,
8388            whitespace_in_name.as_ptr(),
8389            whitespace_in.as_ptr(),
8390            separator_in_name.as_ptr(),
8391            separator_in.as_ptr(),
8392            flags_in_name.as_ptr(),
8393            flags_in,
8394            memory_in_name.as_ptr(),
8395            memory_in,
8396            access_in_name.as_ptr(),
8397            access_in,
8398            fail_on_in_name.as_ptr(),
8399            fail_on_in,
8400            revalidate_in_name.as_ptr(),
8401            revalidate_in,
8402            NULL,
8403        );
8404        utils::result(
8405            vips_op_response,
8406            VipsImage { ctx: out_out },
8407            Error::CsvloadSourceError,
8408        )
8409    }
8410}
8411
8412/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8413/// filename: `&str` -> Filename to load from
8414/// returns `VipsImage` - Output image
8415pub fn matrixload(filename: &str) -> Result<VipsImage> {
8416    unsafe {
8417        let filename_in: CString = utils::new_c_string(filename)?;
8418        let mut out_out: *mut bindings::VipsImage = null_mut();
8419
8420        let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8421        utils::result(
8422            vips_op_response,
8423            VipsImage { ctx: out_out },
8424            Error::MatrixloadError,
8425        )
8426    }
8427}
8428
8429/// Options for matrixload operation
8430#[derive(Clone, Debug)]
8431pub struct MatrixloadOptions {
8432    /// flags: `ForeignFlags` -> Flags for this file
8433    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8434    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8435    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8436    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8437    ///  `All` -> VIPS_FOREIGN_ALL = 7
8438    pub flags: ForeignFlags,
8439    /// memory: `bool` -> Force open via memory
8440    /// default: false
8441    pub memory: bool,
8442    /// access: `Access` -> Required access pattern for this file
8443    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8444    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8445    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8446    ///  `Last` -> VIPS_ACCESS_LAST = 3
8447    pub access: Access,
8448    /// fail_on: `FailOn` -> Error level to fail on
8449    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8450    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8451    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8452    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8453    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8454    pub fail_on: FailOn,
8455    /// revalidate: `bool` -> Don't use a cached result for this operation
8456    /// default: false
8457    pub revalidate: bool,
8458}
8459
8460impl std::default::Default for MatrixloadOptions {
8461    fn default() -> Self {
8462        MatrixloadOptions {
8463            flags: ForeignFlags::None,
8464            memory: false,
8465            access: Access::Random,
8466            fail_on: FailOn::None,
8467            revalidate: false,
8468        }
8469    }
8470}
8471
8472/// VipsForeignLoadMatrixFile (matrixload), load matrix (.mat), priority=0, is_a, get_flags, get_flags_filename, header, load
8473/// filename: `&str` -> Filename to load from
8474/// matrixload_options: `&MatrixloadOptions` -> optional arguments
8475/// returns `VipsImage` - Output image
8476pub fn matrixload_with_opts(
8477    filename: &str,
8478    matrixload_options: &MatrixloadOptions,
8479) -> Result<VipsImage> {
8480    unsafe {
8481        let filename_in: CString = utils::new_c_string(filename)?;
8482        let mut out_out: *mut bindings::VipsImage = null_mut();
8483
8484        let flags_in: i32 = matrixload_options.flags as i32;
8485        let flags_in_name = utils::new_c_string("flags")?;
8486
8487        let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8488        let memory_in_name = utils::new_c_string("memory")?;
8489
8490        let access_in: i32 = matrixload_options.access as i32;
8491        let access_in_name = utils::new_c_string("access")?;
8492
8493        let fail_on_in: i32 = matrixload_options.fail_on as i32;
8494        let fail_on_in_name = utils::new_c_string("fail-on")?;
8495
8496        let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8497        let revalidate_in_name = utils::new_c_string("revalidate")?;
8498
8499        let vips_op_response = bindings::vips_matrixload(
8500            filename_in.as_ptr(),
8501            &mut out_out,
8502            flags_in_name.as_ptr(),
8503            flags_in,
8504            memory_in_name.as_ptr(),
8505            memory_in,
8506            access_in_name.as_ptr(),
8507            access_in,
8508            fail_on_in_name.as_ptr(),
8509            fail_on_in,
8510            revalidate_in_name.as_ptr(),
8511            revalidate_in,
8512            NULL,
8513        );
8514        utils::result(
8515            vips_op_response,
8516            VipsImage { ctx: out_out },
8517            Error::MatrixloadError,
8518        )
8519    }
8520}
8521
8522/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8523/// source: `&VipsSource` -> Source to load from
8524/// returns `VipsImage` - Output image
8525pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8526    unsafe {
8527        let source_in: *mut bindings::VipsSource = source.ctx;
8528        let mut out_out: *mut bindings::VipsImage = null_mut();
8529
8530        let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8531        utils::result(
8532            vips_op_response,
8533            VipsImage { ctx: out_out },
8534            Error::MatrixloadSourceError,
8535        )
8536    }
8537}
8538
8539/// Options for matrixload_source operation
8540#[derive(Clone, Debug)]
8541pub struct MatrixloadSourceOptions {
8542    /// flags: `ForeignFlags` -> Flags for this file
8543    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8544    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8545    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8546    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8547    ///  `All` -> VIPS_FOREIGN_ALL = 7
8548    pub flags: ForeignFlags,
8549    /// memory: `bool` -> Force open via memory
8550    /// default: false
8551    pub memory: bool,
8552    /// access: `Access` -> Required access pattern for this file
8553    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8554    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8555    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8556    ///  `Last` -> VIPS_ACCESS_LAST = 3
8557    pub access: Access,
8558    /// fail_on: `FailOn` -> Error level to fail on
8559    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8560    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8561    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8562    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8563    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8564    pub fail_on: FailOn,
8565    /// revalidate: `bool` -> Don't use a cached result for this operation
8566    /// default: false
8567    pub revalidate: bool,
8568}
8569
8570impl std::default::Default for MatrixloadSourceOptions {
8571    fn default() -> Self {
8572        MatrixloadSourceOptions {
8573            flags: ForeignFlags::None,
8574            memory: false,
8575            access: Access::Random,
8576            fail_on: FailOn::None,
8577            revalidate: false,
8578        }
8579    }
8580}
8581
8582/// VipsForeignLoadMatrixSource (matrixload_source), load matrix, priority=0, is_a_source, get_flags, header, load
8583/// source: `&VipsSource` -> Source to load from
8584/// matrixload_source_options: `&MatrixloadSourceOptions` -> optional arguments
8585/// returns `VipsImage` - Output image
8586pub fn matrixload_source_with_opts(
8587    source: &VipsSource,
8588    matrixload_source_options: &MatrixloadSourceOptions,
8589) -> Result<VipsImage> {
8590    unsafe {
8591        let source_in: *mut bindings::VipsSource = source.ctx;
8592        let mut out_out: *mut bindings::VipsImage = null_mut();
8593
8594        let flags_in: i32 = matrixload_source_options.flags as i32;
8595        let flags_in_name = utils::new_c_string("flags")?;
8596
8597        let memory_in: i32 = if matrixload_source_options.memory {
8598            1
8599        } else {
8600            0
8601        };
8602        let memory_in_name = utils::new_c_string("memory")?;
8603
8604        let access_in: i32 = matrixload_source_options.access as i32;
8605        let access_in_name = utils::new_c_string("access")?;
8606
8607        let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8608        let fail_on_in_name = utils::new_c_string("fail-on")?;
8609
8610        let revalidate_in: i32 = if matrixload_source_options.revalidate {
8611            1
8612        } else {
8613            0
8614        };
8615        let revalidate_in_name = utils::new_c_string("revalidate")?;
8616
8617        let vips_op_response = bindings::vips_matrixload_source(
8618            source_in,
8619            &mut out_out,
8620            flags_in_name.as_ptr(),
8621            flags_in,
8622            memory_in_name.as_ptr(),
8623            memory_in,
8624            access_in_name.as_ptr(),
8625            access_in,
8626            fail_on_in_name.as_ptr(),
8627            fail_on_in,
8628            revalidate_in_name.as_ptr(),
8629            revalidate_in,
8630            NULL,
8631        );
8632        utils::result(
8633            vips_op_response,
8634            VipsImage { ctx: out_out },
8635            Error::MatrixloadSourceError,
8636        )
8637    }
8638}
8639
8640/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8641/// filename: `&str` -> Filename to load from
8642/// width: `i32` -> Image width in pixels
8643/// min: 0, max: 10000000, default: 0
8644/// height: `i32` -> Image height in pixels
8645/// min: 0, max: 10000000, default: 0
8646/// bands: `i32` -> Number of bands in image
8647/// min: 0, max: 10000000, default: 0
8648/// returns `VipsImage` - Output image
8649pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8650    unsafe {
8651        let filename_in: CString = utils::new_c_string(filename)?;
8652        let width_in: i32 = width;
8653        let height_in: i32 = height;
8654        let bands_in: i32 = bands;
8655        let mut out_out: *mut bindings::VipsImage = null_mut();
8656
8657        let vips_op_response = bindings::vips_rawload(
8658            filename_in.as_ptr(),
8659            &mut out_out,
8660            width_in,
8661            height_in,
8662            bands_in,
8663            NULL,
8664        );
8665        utils::result(
8666            vips_op_response,
8667            VipsImage { ctx: out_out },
8668            Error::RawloadError,
8669        )
8670    }
8671}
8672
8673/// Options for rawload operation
8674#[derive(Clone, Debug)]
8675pub struct RawloadOptions {
8676    /// offset: `u64` -> Offset in bytes from start of file
8677    /// min: 0, max: 100000000000, default: 0
8678    pub offset: u64,
8679    /// format: `BandFormat` -> Pixel format in image
8680    ///  `Notset` -> VIPS_FORMAT_NOTSET = -1
8681    ///  `Uchar` -> VIPS_FORMAT_UCHAR = 0 [DEFAULT]
8682    ///  `Char` -> VIPS_FORMAT_CHAR = 1
8683    ///  `Ushort` -> VIPS_FORMAT_USHORT = 2
8684    ///  `Short` -> VIPS_FORMAT_SHORT = 3
8685    ///  `Uint` -> VIPS_FORMAT_UINT = 4
8686    ///  `Int` -> VIPS_FORMAT_INT = 5
8687    ///  `Float` -> VIPS_FORMAT_FLOAT = 6
8688    ///  `Complex` -> VIPS_FORMAT_COMPLEX = 7
8689    ///  `Double` -> VIPS_FORMAT_DOUBLE = 8
8690    ///  `Dpcomplex` -> VIPS_FORMAT_DPCOMPLEX = 9
8691    ///  `Last` -> VIPS_FORMAT_LAST = 10
8692    pub format: BandFormat,
8693    /// interpretation: `Interpretation` -> Pixel interpretation
8694    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
8695    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0 [DEFAULT]
8696    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
8697    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
8698    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
8699    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
8700    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
8701    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
8702    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
8703    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
8704    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
8705    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
8706    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22
8707    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
8708    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
8709    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
8710    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
8711    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
8712    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
8713    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
8714    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
8715    pub interpretation: Interpretation,
8716    /// flags: `ForeignFlags` -> Flags for this file
8717    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8718    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8719    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8720    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8721    ///  `All` -> VIPS_FOREIGN_ALL = 7
8722    pub flags: ForeignFlags,
8723    /// memory: `bool` -> Force open via memory
8724    /// default: false
8725    pub memory: bool,
8726    /// access: `Access` -> Required access pattern for this file
8727    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8728    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8729    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8730    ///  `Last` -> VIPS_ACCESS_LAST = 3
8731    pub access: Access,
8732    /// fail_on: `FailOn` -> Error level to fail on
8733    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8734    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8735    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8736    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8737    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8738    pub fail_on: FailOn,
8739    /// revalidate: `bool` -> Don't use a cached result for this operation
8740    /// default: false
8741    pub revalidate: bool,
8742}
8743
8744impl std::default::Default for RawloadOptions {
8745    fn default() -> Self {
8746        RawloadOptions {
8747            offset: 0,
8748            format: BandFormat::Uchar,
8749            interpretation: Interpretation::Multiband,
8750            flags: ForeignFlags::None,
8751            memory: false,
8752            access: Access::Random,
8753            fail_on: FailOn::None,
8754            revalidate: false,
8755        }
8756    }
8757}
8758
8759/// VipsForeignLoadRaw (rawload), load raw data from a file, priority=0, untrusted, get_flags, get_flags_filename, header
8760/// filename: `&str` -> Filename to load from
8761/// width: `i32` -> Image width in pixels
8762/// min: 0, max: 10000000, default: 0
8763/// height: `i32` -> Image height in pixels
8764/// min: 0, max: 10000000, default: 0
8765/// bands: `i32` -> Number of bands in image
8766/// min: 0, max: 10000000, default: 0
8767/// rawload_options: `&RawloadOptions` -> optional arguments
8768/// returns `VipsImage` - Output image
8769pub fn rawload_with_opts(
8770    filename: &str,
8771    width: i32,
8772    height: i32,
8773    bands: i32,
8774    rawload_options: &RawloadOptions,
8775) -> Result<VipsImage> {
8776    unsafe {
8777        let filename_in: CString = utils::new_c_string(filename)?;
8778        let width_in: i32 = width;
8779        let height_in: i32 = height;
8780        let bands_in: i32 = bands;
8781        let mut out_out: *mut bindings::VipsImage = null_mut();
8782
8783        let offset_in: u64 = rawload_options.offset;
8784        let offset_in_name = utils::new_c_string("offset")?;
8785
8786        let format_in: i32 = rawload_options.format as i32;
8787        let format_in_name = utils::new_c_string("format")?;
8788
8789        let interpretation_in: i32 = rawload_options.interpretation as i32;
8790        let interpretation_in_name = utils::new_c_string("interpretation")?;
8791
8792        let flags_in: i32 = rawload_options.flags as i32;
8793        let flags_in_name = utils::new_c_string("flags")?;
8794
8795        let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8796        let memory_in_name = utils::new_c_string("memory")?;
8797
8798        let access_in: i32 = rawload_options.access as i32;
8799        let access_in_name = utils::new_c_string("access")?;
8800
8801        let fail_on_in: i32 = rawload_options.fail_on as i32;
8802        let fail_on_in_name = utils::new_c_string("fail-on")?;
8803
8804        let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8805        let revalidate_in_name = utils::new_c_string("revalidate")?;
8806
8807        let vips_op_response = bindings::vips_rawload(
8808            filename_in.as_ptr(),
8809            &mut out_out,
8810            width_in,
8811            height_in,
8812            bands_in,
8813            offset_in_name.as_ptr(),
8814            offset_in,
8815            format_in_name.as_ptr(),
8816            format_in,
8817            interpretation_in_name.as_ptr(),
8818            interpretation_in,
8819            flags_in_name.as_ptr(),
8820            flags_in,
8821            memory_in_name.as_ptr(),
8822            memory_in,
8823            access_in_name.as_ptr(),
8824            access_in,
8825            fail_on_in_name.as_ptr(),
8826            fail_on_in,
8827            revalidate_in_name.as_ptr(),
8828            revalidate_in,
8829            NULL,
8830        );
8831        utils::result(
8832            vips_op_response,
8833            VipsImage { ctx: out_out },
8834            Error::RawloadError,
8835        )
8836    }
8837}
8838
8839/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8840/// filename: `&str` -> Filename to load from
8841/// returns `VipsImage` - Output image
8842pub fn vipsload(filename: &str) -> Result<VipsImage> {
8843    unsafe {
8844        let filename_in: CString = utils::new_c_string(filename)?;
8845        let mut out_out: *mut bindings::VipsImage = null_mut();
8846
8847        let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
8848        utils::result(
8849            vips_op_response,
8850            VipsImage { ctx: out_out },
8851            Error::VipsloadError,
8852        )
8853    }
8854}
8855
8856/// Options for vipsload operation
8857#[derive(Clone, Debug)]
8858pub struct VipsloadOptions {
8859    /// flags: `ForeignFlags` -> Flags for this file
8860    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8861    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8862    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8863    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8864    ///  `All` -> VIPS_FOREIGN_ALL = 7
8865    pub flags: ForeignFlags,
8866    /// memory: `bool` -> Force open via memory
8867    /// default: false
8868    pub memory: bool,
8869    /// access: `Access` -> Required access pattern for this file
8870    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8871    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8872    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8873    ///  `Last` -> VIPS_ACCESS_LAST = 3
8874    pub access: Access,
8875    /// fail_on: `FailOn` -> Error level to fail on
8876    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8877    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8878    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8879    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8880    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8881    pub fail_on: FailOn,
8882    /// revalidate: `bool` -> Don't use a cached result for this operation
8883    /// default: false
8884    pub revalidate: bool,
8885}
8886
8887impl std::default::Default for VipsloadOptions {
8888    fn default() -> Self {
8889        VipsloadOptions {
8890            flags: ForeignFlags::None,
8891            memory: false,
8892            access: Access::Random,
8893            fail_on: FailOn::None,
8894            revalidate: false,
8895        }
8896    }
8897}
8898
8899/// VipsForeignLoadVipsFile (vipsload), load vips from file (.v, .vips), priority=200, untrusted, is_a, get_flags, get_flags_filename, header
8900/// filename: `&str` -> Filename to load from
8901/// vipsload_options: `&VipsloadOptions` -> optional arguments
8902/// returns `VipsImage` - Output image
8903pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
8904    unsafe {
8905        let filename_in: CString = utils::new_c_string(filename)?;
8906        let mut out_out: *mut bindings::VipsImage = null_mut();
8907
8908        let flags_in: i32 = vipsload_options.flags as i32;
8909        let flags_in_name = utils::new_c_string("flags")?;
8910
8911        let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
8912        let memory_in_name = utils::new_c_string("memory")?;
8913
8914        let access_in: i32 = vipsload_options.access as i32;
8915        let access_in_name = utils::new_c_string("access")?;
8916
8917        let fail_on_in: i32 = vipsload_options.fail_on as i32;
8918        let fail_on_in_name = utils::new_c_string("fail-on")?;
8919
8920        let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
8921        let revalidate_in_name = utils::new_c_string("revalidate")?;
8922
8923        let vips_op_response = bindings::vips_vipsload(
8924            filename_in.as_ptr(),
8925            &mut out_out,
8926            flags_in_name.as_ptr(),
8927            flags_in,
8928            memory_in_name.as_ptr(),
8929            memory_in,
8930            access_in_name.as_ptr(),
8931            access_in,
8932            fail_on_in_name.as_ptr(),
8933            fail_on_in,
8934            revalidate_in_name.as_ptr(),
8935            revalidate_in,
8936            NULL,
8937        );
8938        utils::result(
8939            vips_op_response,
8940            VipsImage { ctx: out_out },
8941            Error::VipsloadError,
8942        )
8943    }
8944}
8945
8946/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
8947/// source: `&VipsSource` -> Source to load from
8948/// returns `VipsImage` - Output image
8949pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
8950    unsafe {
8951        let source_in: *mut bindings::VipsSource = source.ctx;
8952        let mut out_out: *mut bindings::VipsImage = null_mut();
8953
8954        let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
8955        utils::result(
8956            vips_op_response,
8957            VipsImage { ctx: out_out },
8958            Error::VipsloadSourceError,
8959        )
8960    }
8961}
8962
8963/// Options for vipsload_source operation
8964#[derive(Clone, Debug)]
8965pub struct VipsloadSourceOptions {
8966    /// flags: `ForeignFlags` -> Flags for this file
8967    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
8968    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
8969    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
8970    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
8971    ///  `All` -> VIPS_FOREIGN_ALL = 7
8972    pub flags: ForeignFlags,
8973    /// memory: `bool` -> Force open via memory
8974    /// default: false
8975    pub memory: bool,
8976    /// access: `Access` -> Required access pattern for this file
8977    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
8978    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
8979    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
8980    ///  `Last` -> VIPS_ACCESS_LAST = 3
8981    pub access: Access,
8982    /// fail_on: `FailOn` -> Error level to fail on
8983    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
8984    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
8985    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
8986    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
8987    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
8988    pub fail_on: FailOn,
8989    /// revalidate: `bool` -> Don't use a cached result for this operation
8990    /// default: false
8991    pub revalidate: bool,
8992}
8993
8994impl std::default::Default for VipsloadSourceOptions {
8995    fn default() -> Self {
8996        VipsloadSourceOptions {
8997            flags: ForeignFlags::None,
8998            memory: false,
8999            access: Access::Random,
9000            fail_on: FailOn::None,
9001            revalidate: false,
9002        }
9003    }
9004}
9005
9006/// VipsForeignLoadVipsSource (vipsload_source), load vips from source, priority=200, untrusted, is_a_source, get_flags, get_flags_filename, header
9007/// source: `&VipsSource` -> Source to load from
9008/// vipsload_source_options: `&VipsloadSourceOptions` -> optional arguments
9009/// returns `VipsImage` - Output image
9010pub fn vipsload_source_with_opts(
9011    source: &VipsSource,
9012    vipsload_source_options: &VipsloadSourceOptions,
9013) -> Result<VipsImage> {
9014    unsafe {
9015        let source_in: *mut bindings::VipsSource = source.ctx;
9016        let mut out_out: *mut bindings::VipsImage = null_mut();
9017
9018        let flags_in: i32 = vipsload_source_options.flags as i32;
9019        let flags_in_name = utils::new_c_string("flags")?;
9020
9021        let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9022        let memory_in_name = utils::new_c_string("memory")?;
9023
9024        let access_in: i32 = vipsload_source_options.access as i32;
9025        let access_in_name = utils::new_c_string("access")?;
9026
9027        let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9028        let fail_on_in_name = utils::new_c_string("fail-on")?;
9029
9030        let revalidate_in: i32 = if vipsload_source_options.revalidate {
9031            1
9032        } else {
9033            0
9034        };
9035        let revalidate_in_name = utils::new_c_string("revalidate")?;
9036
9037        let vips_op_response = bindings::vips_vipsload_source(
9038            source_in,
9039            &mut out_out,
9040            flags_in_name.as_ptr(),
9041            flags_in,
9042            memory_in_name.as_ptr(),
9043            memory_in,
9044            access_in_name.as_ptr(),
9045            access_in,
9046            fail_on_in_name.as_ptr(),
9047            fail_on_in,
9048            revalidate_in_name.as_ptr(),
9049            revalidate_in,
9050            NULL,
9051        );
9052        utils::result(
9053            vips_op_response,
9054            VipsImage { ctx: out_out },
9055            Error::VipsloadSourceError,
9056        )
9057    }
9058}
9059
9060/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9061/// filename: `&str` -> Filename to load from
9062/// returns `VipsImage` - Output image
9063pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9064    unsafe {
9065        let filename_in: CString = utils::new_c_string(filename)?;
9066        let mut out_out: *mut bindings::VipsImage = null_mut();
9067
9068        let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9069        utils::result(
9070            vips_op_response,
9071            VipsImage { ctx: out_out },
9072            Error::AnalyzeloadError,
9073        )
9074    }
9075}
9076
9077/// Options for analyzeload operation
9078#[derive(Clone, Debug)]
9079pub struct AnalyzeloadOptions {
9080    /// flags: `ForeignFlags` -> Flags for this file
9081    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9082    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9083    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9084    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9085    ///  `All` -> VIPS_FOREIGN_ALL = 7
9086    pub flags: ForeignFlags,
9087    /// memory: `bool` -> Force open via memory
9088    /// default: false
9089    pub memory: bool,
9090    /// access: `Access` -> Required access pattern for this file
9091    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9092    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9093    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9094    ///  `Last` -> VIPS_ACCESS_LAST = 3
9095    pub access: Access,
9096    /// fail_on: `FailOn` -> Error level to fail on
9097    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9098    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9099    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9100    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9101    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9102    pub fail_on: FailOn,
9103    /// revalidate: `bool` -> Don't use a cached result for this operation
9104    /// default: false
9105    pub revalidate: bool,
9106}
9107
9108impl std::default::Default for AnalyzeloadOptions {
9109    fn default() -> Self {
9110        AnalyzeloadOptions {
9111            flags: ForeignFlags::None,
9112            memory: false,
9113            access: Access::Random,
9114            fail_on: FailOn::None,
9115            revalidate: false,
9116        }
9117    }
9118}
9119
9120/// VipsForeignLoadAnalyze (analyzeload), load an Analyze6 image (.img, .hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9121/// filename: `&str` -> Filename to load from
9122/// analyzeload_options: `&AnalyzeloadOptions` -> optional arguments
9123/// returns `VipsImage` - Output image
9124pub fn analyzeload_with_opts(
9125    filename: &str,
9126    analyzeload_options: &AnalyzeloadOptions,
9127) -> Result<VipsImage> {
9128    unsafe {
9129        let filename_in: CString = utils::new_c_string(filename)?;
9130        let mut out_out: *mut bindings::VipsImage = null_mut();
9131
9132        let flags_in: i32 = analyzeload_options.flags as i32;
9133        let flags_in_name = utils::new_c_string("flags")?;
9134
9135        let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9136        let memory_in_name = utils::new_c_string("memory")?;
9137
9138        let access_in: i32 = analyzeload_options.access as i32;
9139        let access_in_name = utils::new_c_string("access")?;
9140
9141        let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9142        let fail_on_in_name = utils::new_c_string("fail-on")?;
9143
9144        let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9145        let revalidate_in_name = utils::new_c_string("revalidate")?;
9146
9147        let vips_op_response = bindings::vips_analyzeload(
9148            filename_in.as_ptr(),
9149            &mut out_out,
9150            flags_in_name.as_ptr(),
9151            flags_in,
9152            memory_in_name.as_ptr(),
9153            memory_in,
9154            access_in_name.as_ptr(),
9155            access_in,
9156            fail_on_in_name.as_ptr(),
9157            fail_on_in,
9158            revalidate_in_name.as_ptr(),
9159            revalidate_in,
9160            NULL,
9161        );
9162        utils::result(
9163            vips_op_response,
9164            VipsImage { ctx: out_out },
9165            Error::AnalyzeloadError,
9166        )
9167    }
9168}
9169
9170/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9171/// filename: `&str` -> Filename to load from
9172/// returns `VipsImage` - Output image
9173pub fn ppmload(filename: &str) -> Result<VipsImage> {
9174    unsafe {
9175        let filename_in: CString = utils::new_c_string(filename)?;
9176        let mut out_out: *mut bindings::VipsImage = null_mut();
9177
9178        let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9179        utils::result(
9180            vips_op_response,
9181            VipsImage { ctx: out_out },
9182            Error::PpmloadError,
9183        )
9184    }
9185}
9186
9187/// Options for ppmload operation
9188#[derive(Clone, Debug)]
9189pub struct PpmloadOptions {
9190    /// flags: `ForeignFlags` -> Flags for this file
9191    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9192    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9193    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9194    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9195    ///  `All` -> VIPS_FOREIGN_ALL = 7
9196    pub flags: ForeignFlags,
9197    /// memory: `bool` -> Force open via memory
9198    /// default: false
9199    pub memory: bool,
9200    /// access: `Access` -> Required access pattern for this file
9201    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9202    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9203    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9204    ///  `Last` -> VIPS_ACCESS_LAST = 3
9205    pub access: Access,
9206    /// fail_on: `FailOn` -> Error level to fail on
9207    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9208    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9209    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9210    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9211    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9212    pub fail_on: FailOn,
9213    /// revalidate: `bool` -> Don't use a cached result for this operation
9214    /// default: false
9215    pub revalidate: bool,
9216}
9217
9218impl std::default::Default for PpmloadOptions {
9219    fn default() -> Self {
9220        PpmloadOptions {
9221            flags: ForeignFlags::None,
9222            memory: false,
9223            access: Access::Random,
9224            fail_on: FailOn::None,
9225            revalidate: false,
9226        }
9227    }
9228}
9229
9230/// VipsForeignLoadPpmFile (ppmload), load ppm from file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a, get_flags, header, load
9231/// filename: `&str` -> Filename to load from
9232/// ppmload_options: `&PpmloadOptions` -> optional arguments
9233/// returns `VipsImage` - Output image
9234pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9235    unsafe {
9236        let filename_in: CString = utils::new_c_string(filename)?;
9237        let mut out_out: *mut bindings::VipsImage = null_mut();
9238
9239        let flags_in: i32 = ppmload_options.flags as i32;
9240        let flags_in_name = utils::new_c_string("flags")?;
9241
9242        let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9243        let memory_in_name = utils::new_c_string("memory")?;
9244
9245        let access_in: i32 = ppmload_options.access as i32;
9246        let access_in_name = utils::new_c_string("access")?;
9247
9248        let fail_on_in: i32 = ppmload_options.fail_on as i32;
9249        let fail_on_in_name = utils::new_c_string("fail-on")?;
9250
9251        let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9252        let revalidate_in_name = utils::new_c_string("revalidate")?;
9253
9254        let vips_op_response = bindings::vips_ppmload(
9255            filename_in.as_ptr(),
9256            &mut out_out,
9257            flags_in_name.as_ptr(),
9258            flags_in,
9259            memory_in_name.as_ptr(),
9260            memory_in,
9261            access_in_name.as_ptr(),
9262            access_in,
9263            fail_on_in_name.as_ptr(),
9264            fail_on_in,
9265            revalidate_in_name.as_ptr(),
9266            revalidate_in,
9267            NULL,
9268        );
9269        utils::result(
9270            vips_op_response,
9271            VipsImage { ctx: out_out },
9272            Error::PpmloadError,
9273        )
9274    }
9275}
9276
9277/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9278/// source: `&VipsSource` -> Source to load from
9279/// returns `VipsImage` - Output image
9280pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9281    unsafe {
9282        let source_in: *mut bindings::VipsSource = source.ctx;
9283        let mut out_out: *mut bindings::VipsImage = null_mut();
9284
9285        let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9286        utils::result(
9287            vips_op_response,
9288            VipsImage { ctx: out_out },
9289            Error::PpmloadSourceError,
9290        )
9291    }
9292}
9293
9294/// Options for ppmload_source operation
9295#[derive(Clone, Debug)]
9296pub struct PpmloadSourceOptions {
9297    /// flags: `ForeignFlags` -> Flags for this file
9298    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9299    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9300    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9301    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9302    ///  `All` -> VIPS_FOREIGN_ALL = 7
9303    pub flags: ForeignFlags,
9304    /// memory: `bool` -> Force open via memory
9305    /// default: false
9306    pub memory: bool,
9307    /// access: `Access` -> Required access pattern for this file
9308    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9309    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9310    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9311    ///  `Last` -> VIPS_ACCESS_LAST = 3
9312    pub access: Access,
9313    /// fail_on: `FailOn` -> Error level to fail on
9314    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9315    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9316    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9317    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9318    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9319    pub fail_on: FailOn,
9320    /// revalidate: `bool` -> Don't use a cached result for this operation
9321    /// default: false
9322    pub revalidate: bool,
9323}
9324
9325impl std::default::Default for PpmloadSourceOptions {
9326    fn default() -> Self {
9327        PpmloadSourceOptions {
9328            flags: ForeignFlags::None,
9329            memory: false,
9330            access: Access::Random,
9331            fail_on: FailOn::None,
9332            revalidate: false,
9333        }
9334    }
9335}
9336
9337/// VipsForeignLoadPpmSource (ppmload_source), load ppm base class (.pbm, .pgm, .ppm, .pfm, .pnm), priority=200, untrusted, is_a_source, get_flags, header, load
9338/// source: `&VipsSource` -> Source to load from
9339/// ppmload_source_options: `&PpmloadSourceOptions` -> optional arguments
9340/// returns `VipsImage` - Output image
9341pub fn ppmload_source_with_opts(
9342    source: &VipsSource,
9343    ppmload_source_options: &PpmloadSourceOptions,
9344) -> Result<VipsImage> {
9345    unsafe {
9346        let source_in: *mut bindings::VipsSource = source.ctx;
9347        let mut out_out: *mut bindings::VipsImage = null_mut();
9348
9349        let flags_in: i32 = ppmload_source_options.flags as i32;
9350        let flags_in_name = utils::new_c_string("flags")?;
9351
9352        let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9353        let memory_in_name = utils::new_c_string("memory")?;
9354
9355        let access_in: i32 = ppmload_source_options.access as i32;
9356        let access_in_name = utils::new_c_string("access")?;
9357
9358        let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9359        let fail_on_in_name = utils::new_c_string("fail-on")?;
9360
9361        let revalidate_in: i32 = if ppmload_source_options.revalidate {
9362            1
9363        } else {
9364            0
9365        };
9366        let revalidate_in_name = utils::new_c_string("revalidate")?;
9367
9368        let vips_op_response = bindings::vips_ppmload_source(
9369            source_in,
9370            &mut out_out,
9371            flags_in_name.as_ptr(),
9372            flags_in,
9373            memory_in_name.as_ptr(),
9374            memory_in,
9375            access_in_name.as_ptr(),
9376            access_in,
9377            fail_on_in_name.as_ptr(),
9378            fail_on_in,
9379            revalidate_in_name.as_ptr(),
9380            revalidate_in,
9381            NULL,
9382        );
9383        utils::result(
9384            vips_op_response,
9385            VipsImage { ctx: out_out },
9386            Error::PpmloadSourceError,
9387        )
9388    }
9389}
9390
9391/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9392/// filename: `&str` -> Filename to load from
9393/// returns `VipsImage` - Output image
9394pub fn radload(filename: &str) -> Result<VipsImage> {
9395    unsafe {
9396        let filename_in: CString = utils::new_c_string(filename)?;
9397        let mut out_out: *mut bindings::VipsImage = null_mut();
9398
9399        let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9400        utils::result(
9401            vips_op_response,
9402            VipsImage { ctx: out_out },
9403            Error::RadloadError,
9404        )
9405    }
9406}
9407
9408/// Options for radload operation
9409#[derive(Clone, Debug)]
9410pub struct RadloadOptions {
9411    /// flags: `ForeignFlags` -> Flags for this file
9412    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9413    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9414    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9415    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9416    ///  `All` -> VIPS_FOREIGN_ALL = 7
9417    pub flags: ForeignFlags,
9418    /// memory: `bool` -> Force open via memory
9419    /// default: false
9420    pub memory: bool,
9421    /// access: `Access` -> Required access pattern for this file
9422    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9423    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9424    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9425    ///  `Last` -> VIPS_ACCESS_LAST = 3
9426    pub access: Access,
9427    /// fail_on: `FailOn` -> Error level to fail on
9428    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9429    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9430    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9431    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9432    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9433    pub fail_on: FailOn,
9434    /// revalidate: `bool` -> Don't use a cached result for this operation
9435    /// default: false
9436    pub revalidate: bool,
9437}
9438
9439impl std::default::Default for RadloadOptions {
9440    fn default() -> Self {
9441        RadloadOptions {
9442            flags: ForeignFlags::None,
9443            memory: false,
9444            access: Access::Random,
9445            fail_on: FailOn::None,
9446            revalidate: false,
9447        }
9448    }
9449}
9450
9451/// VipsForeignLoadRadFile (radload), load a Radiance image from a file (.hdr), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
9452/// filename: `&str` -> Filename to load from
9453/// radload_options: `&RadloadOptions` -> optional arguments
9454/// returns `VipsImage` - Output image
9455pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9456    unsafe {
9457        let filename_in: CString = utils::new_c_string(filename)?;
9458        let mut out_out: *mut bindings::VipsImage = null_mut();
9459
9460        let flags_in: i32 = radload_options.flags as i32;
9461        let flags_in_name = utils::new_c_string("flags")?;
9462
9463        let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9464        let memory_in_name = utils::new_c_string("memory")?;
9465
9466        let access_in: i32 = radload_options.access as i32;
9467        let access_in_name = utils::new_c_string("access")?;
9468
9469        let fail_on_in: i32 = radload_options.fail_on as i32;
9470        let fail_on_in_name = utils::new_c_string("fail-on")?;
9471
9472        let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9473        let revalidate_in_name = utils::new_c_string("revalidate")?;
9474
9475        let vips_op_response = bindings::vips_radload(
9476            filename_in.as_ptr(),
9477            &mut out_out,
9478            flags_in_name.as_ptr(),
9479            flags_in,
9480            memory_in_name.as_ptr(),
9481            memory_in,
9482            access_in_name.as_ptr(),
9483            access_in,
9484            fail_on_in_name.as_ptr(),
9485            fail_on_in,
9486            revalidate_in_name.as_ptr(),
9487            revalidate_in,
9488            NULL,
9489        );
9490        utils::result(
9491            vips_op_response,
9492            VipsImage { ctx: out_out },
9493            Error::RadloadError,
9494        )
9495    }
9496}
9497
9498/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9499/// buffer: `&[u8]` -> Buffer to load from
9500/// returns `VipsImage` - Output image
9501pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9502    unsafe {
9503        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9504        let mut out_out: *mut bindings::VipsImage = null_mut();
9505
9506        let vips_op_response =
9507            bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9508        utils::result(
9509            vips_op_response,
9510            VipsImage { ctx: out_out },
9511            Error::RadloadBufferError,
9512        )
9513    }
9514}
9515
9516/// Options for radload_buffer operation
9517#[derive(Clone, Debug)]
9518pub struct RadloadBufferOptions {
9519    /// flags: `ForeignFlags` -> Flags for this file
9520    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9521    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9522    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9523    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9524    ///  `All` -> VIPS_FOREIGN_ALL = 7
9525    pub flags: ForeignFlags,
9526    /// memory: `bool` -> Force open via memory
9527    /// default: false
9528    pub memory: bool,
9529    /// access: `Access` -> Required access pattern for this file
9530    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9531    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9532    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9533    ///  `Last` -> VIPS_ACCESS_LAST = 3
9534    pub access: Access,
9535    /// fail_on: `FailOn` -> Error level to fail on
9536    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9537    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9538    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9539    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9540    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9541    pub fail_on: FailOn,
9542    /// revalidate: `bool` -> Don't use a cached result for this operation
9543    /// default: false
9544    pub revalidate: bool,
9545}
9546
9547impl std::default::Default for RadloadBufferOptions {
9548    fn default() -> Self {
9549        RadloadBufferOptions {
9550            flags: ForeignFlags::None,
9551            memory: false,
9552            access: Access::Random,
9553            fail_on: FailOn::None,
9554            revalidate: false,
9555        }
9556    }
9557}
9558
9559/// VipsForeignLoadRadBuffer (radload_buffer), load rad from buffer, priority=-50, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9560/// buffer: `&[u8]` -> Buffer to load from
9561/// radload_buffer_options: `&RadloadBufferOptions` -> optional arguments
9562/// returns `VipsImage` - Output image
9563pub fn radload_buffer_with_opts(
9564    buffer: &[u8],
9565    radload_buffer_options: &RadloadBufferOptions,
9566) -> Result<VipsImage> {
9567    unsafe {
9568        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9569        let mut out_out: *mut bindings::VipsImage = null_mut();
9570
9571        let flags_in: i32 = radload_buffer_options.flags as i32;
9572        let flags_in_name = utils::new_c_string("flags")?;
9573
9574        let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9575        let memory_in_name = utils::new_c_string("memory")?;
9576
9577        let access_in: i32 = radload_buffer_options.access as i32;
9578        let access_in_name = utils::new_c_string("access")?;
9579
9580        let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9581        let fail_on_in_name = utils::new_c_string("fail-on")?;
9582
9583        let revalidate_in: i32 = if radload_buffer_options.revalidate {
9584            1
9585        } else {
9586            0
9587        };
9588        let revalidate_in_name = utils::new_c_string("revalidate")?;
9589
9590        let vips_op_response = bindings::vips_radload_buffer(
9591            buffer_in,
9592            buffer.len() as u64,
9593            &mut out_out,
9594            flags_in_name.as_ptr(),
9595            flags_in,
9596            memory_in_name.as_ptr(),
9597            memory_in,
9598            access_in_name.as_ptr(),
9599            access_in,
9600            fail_on_in_name.as_ptr(),
9601            fail_on_in,
9602            revalidate_in_name.as_ptr(),
9603            revalidate_in,
9604            NULL,
9605        );
9606        utils::result(
9607            vips_op_response,
9608            VipsImage { ctx: out_out },
9609            Error::RadloadBufferError,
9610        )
9611    }
9612}
9613
9614/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9615/// source: `&VipsSource` -> Source to load from
9616/// returns `VipsImage` - Output image
9617pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9618    unsafe {
9619        let source_in: *mut bindings::VipsSource = source.ctx;
9620        let mut out_out: *mut bindings::VipsImage = null_mut();
9621
9622        let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9623        utils::result(
9624            vips_op_response,
9625            VipsImage { ctx: out_out },
9626            Error::RadloadSourceError,
9627        )
9628    }
9629}
9630
9631/// Options for radload_source operation
9632#[derive(Clone, Debug)]
9633pub struct RadloadSourceOptions {
9634    /// flags: `ForeignFlags` -> Flags for this file
9635    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9636    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9637    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9638    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9639    ///  `All` -> VIPS_FOREIGN_ALL = 7
9640    pub flags: ForeignFlags,
9641    /// memory: `bool` -> Force open via memory
9642    /// default: false
9643    pub memory: bool,
9644    /// access: `Access` -> Required access pattern for this file
9645    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9646    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9647    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9648    ///  `Last` -> VIPS_ACCESS_LAST = 3
9649    pub access: Access,
9650    /// fail_on: `FailOn` -> Error level to fail on
9651    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9652    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9653    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9654    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9655    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9656    pub fail_on: FailOn,
9657    /// revalidate: `bool` -> Don't use a cached result for this operation
9658    /// default: false
9659    pub revalidate: bool,
9660}
9661
9662impl std::default::Default for RadloadSourceOptions {
9663    fn default() -> Self {
9664        RadloadSourceOptions {
9665            flags: ForeignFlags::None,
9666            memory: false,
9667            access: Access::Random,
9668            fail_on: FailOn::None,
9669            revalidate: false,
9670        }
9671    }
9672}
9673
9674/// VipsForeignLoadRadSource (radload_source), load rad from source, priority=-50, untrusted, is_a_source, get_flags, get_flags_filename, header, load
9675/// source: `&VipsSource` -> Source to load from
9676/// radload_source_options: `&RadloadSourceOptions` -> optional arguments
9677/// returns `VipsImage` - Output image
9678pub fn radload_source_with_opts(
9679    source: &VipsSource,
9680    radload_source_options: &RadloadSourceOptions,
9681) -> Result<VipsImage> {
9682    unsafe {
9683        let source_in: *mut bindings::VipsSource = source.ctx;
9684        let mut out_out: *mut bindings::VipsImage = null_mut();
9685
9686        let flags_in: i32 = radload_source_options.flags as i32;
9687        let flags_in_name = utils::new_c_string("flags")?;
9688
9689        let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9690        let memory_in_name = utils::new_c_string("memory")?;
9691
9692        let access_in: i32 = radload_source_options.access as i32;
9693        let access_in_name = utils::new_c_string("access")?;
9694
9695        let fail_on_in: i32 = radload_source_options.fail_on as i32;
9696        let fail_on_in_name = utils::new_c_string("fail-on")?;
9697
9698        let revalidate_in: i32 = if radload_source_options.revalidate {
9699            1
9700        } else {
9701            0
9702        };
9703        let revalidate_in_name = utils::new_c_string("revalidate")?;
9704
9705        let vips_op_response = bindings::vips_radload_source(
9706            source_in,
9707            &mut out_out,
9708            flags_in_name.as_ptr(),
9709            flags_in,
9710            memory_in_name.as_ptr(),
9711            memory_in,
9712            access_in_name.as_ptr(),
9713            access_in,
9714            fail_on_in_name.as_ptr(),
9715            fail_on_in,
9716            revalidate_in_name.as_ptr(),
9717            revalidate_in,
9718            NULL,
9719        );
9720        utils::result(
9721            vips_op_response,
9722            VipsImage { ctx: out_out },
9723            Error::RadloadSourceError,
9724        )
9725    }
9726}
9727
9728/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9729/// filename: `&str` -> Filename to load from
9730/// returns `VipsImage` - Output image
9731pub fn svgload(filename: &str) -> Result<VipsImage> {
9732    unsafe {
9733        let filename_in: CString = utils::new_c_string(filename)?;
9734        let mut out_out: *mut bindings::VipsImage = null_mut();
9735
9736        let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9737        utils::result(
9738            vips_op_response,
9739            VipsImage { ctx: out_out },
9740            Error::SvgloadError,
9741        )
9742    }
9743}
9744
9745/// Options for svgload operation
9746#[derive(Clone, Debug)]
9747pub struct SvgloadOptions {
9748    /// dpi: `f64` -> Render at this DPI
9749    /// min: 0.001, max: 100000, default: 72
9750    pub dpi: f64,
9751    /// scale: `f64` -> Scale output by this factor
9752    /// min: 0.001, max: 100000, default: 1
9753    pub scale: f64,
9754    /// unlimited: `bool` -> Allow SVG of any size
9755    /// default: false
9756    pub unlimited: bool,
9757    /// flags: `ForeignFlags` -> Flags for this file
9758    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9759    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9760    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9761    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9762    ///  `All` -> VIPS_FOREIGN_ALL = 7
9763    pub flags: ForeignFlags,
9764    /// memory: `bool` -> Force open via memory
9765    /// default: false
9766    pub memory: bool,
9767    /// access: `Access` -> Required access pattern for this file
9768    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9769    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9770    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9771    ///  `Last` -> VIPS_ACCESS_LAST = 3
9772    pub access: Access,
9773    /// fail_on: `FailOn` -> Error level to fail on
9774    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9775    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9776    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9777    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9778    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9779    pub fail_on: FailOn,
9780    /// revalidate: `bool` -> Don't use a cached result for this operation
9781    /// default: false
9782    pub revalidate: bool,
9783}
9784
9785impl std::default::Default for SvgloadOptions {
9786    fn default() -> Self {
9787        SvgloadOptions {
9788            dpi: f64::from(72),
9789            scale: f64::from(1),
9790            unlimited: false,
9791            flags: ForeignFlags::None,
9792            memory: false,
9793            access: Access::Random,
9794            fail_on: FailOn::None,
9795            revalidate: false,
9796        }
9797    }
9798}
9799
9800/// VipsForeignLoadSvgFile (svgload), load SVG with rsvg (.svg, .svgz, .svg.gz), priority=-5, untrusted, is_a, get_flags, get_flags_filename, header, load
9801/// filename: `&str` -> Filename to load from
9802/// svgload_options: `&SvgloadOptions` -> optional arguments
9803/// returns `VipsImage` - Output image
9804pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9805    unsafe {
9806        let filename_in: CString = utils::new_c_string(filename)?;
9807        let mut out_out: *mut bindings::VipsImage = null_mut();
9808
9809        let dpi_in: f64 = svgload_options.dpi;
9810        let dpi_in_name = utils::new_c_string("dpi")?;
9811
9812        let scale_in: f64 = svgload_options.scale;
9813        let scale_in_name = utils::new_c_string("scale")?;
9814
9815        let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9816        let unlimited_in_name = utils::new_c_string("unlimited")?;
9817
9818        let flags_in: i32 = svgload_options.flags as i32;
9819        let flags_in_name = utils::new_c_string("flags")?;
9820
9821        let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9822        let memory_in_name = utils::new_c_string("memory")?;
9823
9824        let access_in: i32 = svgload_options.access as i32;
9825        let access_in_name = utils::new_c_string("access")?;
9826
9827        let fail_on_in: i32 = svgload_options.fail_on as i32;
9828        let fail_on_in_name = utils::new_c_string("fail-on")?;
9829
9830        let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9831        let revalidate_in_name = utils::new_c_string("revalidate")?;
9832
9833        let vips_op_response = bindings::vips_svgload(
9834            filename_in.as_ptr(),
9835            &mut out_out,
9836            dpi_in_name.as_ptr(),
9837            dpi_in,
9838            scale_in_name.as_ptr(),
9839            scale_in,
9840            unlimited_in_name.as_ptr(),
9841            unlimited_in,
9842            flags_in_name.as_ptr(),
9843            flags_in,
9844            memory_in_name.as_ptr(),
9845            memory_in,
9846            access_in_name.as_ptr(),
9847            access_in,
9848            fail_on_in_name.as_ptr(),
9849            fail_on_in,
9850            revalidate_in_name.as_ptr(),
9851            revalidate_in,
9852            NULL,
9853        );
9854        utils::result(
9855            vips_op_response,
9856            VipsImage { ctx: out_out },
9857            Error::SvgloadError,
9858        )
9859    }
9860}
9861
9862/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9863/// buffer: `&[u8]` -> Buffer to load from
9864/// returns `VipsImage` - Output image
9865pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9866    unsafe {
9867        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9868        let mut out_out: *mut bindings::VipsImage = null_mut();
9869
9870        let vips_op_response =
9871            bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9872        utils::result(
9873            vips_op_response,
9874            VipsImage { ctx: out_out },
9875            Error::SvgloadBufferError,
9876        )
9877    }
9878}
9879
9880/// Options for svgload_buffer operation
9881#[derive(Clone, Debug)]
9882pub struct SvgloadBufferOptions {
9883    /// dpi: `f64` -> Render at this DPI
9884    /// min: 0.001, max: 100000, default: 72
9885    pub dpi: f64,
9886    /// scale: `f64` -> Scale output by this factor
9887    /// min: 0.001, max: 100000, default: 1
9888    pub scale: f64,
9889    /// unlimited: `bool` -> Allow SVG of any size
9890    /// default: false
9891    pub unlimited: bool,
9892    /// flags: `ForeignFlags` -> Flags for this file
9893    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
9894    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
9895    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
9896    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
9897    ///  `All` -> VIPS_FOREIGN_ALL = 7
9898    pub flags: ForeignFlags,
9899    /// memory: `bool` -> Force open via memory
9900    /// default: false
9901    pub memory: bool,
9902    /// access: `Access` -> Required access pattern for this file
9903    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
9904    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
9905    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
9906    ///  `Last` -> VIPS_ACCESS_LAST = 3
9907    pub access: Access,
9908    /// fail_on: `FailOn` -> Error level to fail on
9909    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
9910    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
9911    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
9912    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
9913    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
9914    pub fail_on: FailOn,
9915    /// revalidate: `bool` -> Don't use a cached result for this operation
9916    /// default: false
9917    pub revalidate: bool,
9918}
9919
9920impl std::default::Default for SvgloadBufferOptions {
9921    fn default() -> Self {
9922        SvgloadBufferOptions {
9923            dpi: f64::from(72),
9924            scale: f64::from(1),
9925            unlimited: false,
9926            flags: ForeignFlags::None,
9927            memory: false,
9928            access: Access::Random,
9929            fail_on: FailOn::None,
9930            revalidate: false,
9931        }
9932    }
9933}
9934
9935/// VipsForeignLoadSvgBuffer (svgload_buffer), load SVG with rsvg, priority=-5, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
9936/// buffer: `&[u8]` -> Buffer to load from
9937/// svgload_buffer_options: `&SvgloadBufferOptions` -> optional arguments
9938/// returns `VipsImage` - Output image
9939pub fn svgload_buffer_with_opts(
9940    buffer: &[u8],
9941    svgload_buffer_options: &SvgloadBufferOptions,
9942) -> Result<VipsImage> {
9943    unsafe {
9944        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9945        let mut out_out: *mut bindings::VipsImage = null_mut();
9946
9947        let dpi_in: f64 = svgload_buffer_options.dpi;
9948        let dpi_in_name = utils::new_c_string("dpi")?;
9949
9950        let scale_in: f64 = svgload_buffer_options.scale;
9951        let scale_in_name = utils::new_c_string("scale")?;
9952
9953        let unlimited_in: i32 = if svgload_buffer_options.unlimited {
9954            1
9955        } else {
9956            0
9957        };
9958        let unlimited_in_name = utils::new_c_string("unlimited")?;
9959
9960        let flags_in: i32 = svgload_buffer_options.flags as i32;
9961        let flags_in_name = utils::new_c_string("flags")?;
9962
9963        let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
9964        let memory_in_name = utils::new_c_string("memory")?;
9965
9966        let access_in: i32 = svgload_buffer_options.access as i32;
9967        let access_in_name = utils::new_c_string("access")?;
9968
9969        let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
9970        let fail_on_in_name = utils::new_c_string("fail-on")?;
9971
9972        let revalidate_in: i32 = if svgload_buffer_options.revalidate {
9973            1
9974        } else {
9975            0
9976        };
9977        let revalidate_in_name = utils::new_c_string("revalidate")?;
9978
9979        let vips_op_response = bindings::vips_svgload_buffer(
9980            buffer_in,
9981            buffer.len() as u64,
9982            &mut out_out,
9983            dpi_in_name.as_ptr(),
9984            dpi_in,
9985            scale_in_name.as_ptr(),
9986            scale_in,
9987            unlimited_in_name.as_ptr(),
9988            unlimited_in,
9989            flags_in_name.as_ptr(),
9990            flags_in,
9991            memory_in_name.as_ptr(),
9992            memory_in,
9993            access_in_name.as_ptr(),
9994            access_in,
9995            fail_on_in_name.as_ptr(),
9996            fail_on_in,
9997            revalidate_in_name.as_ptr(),
9998            revalidate_in,
9999            NULL,
10000        );
10001        utils::result(
10002            vips_op_response,
10003            VipsImage { ctx: out_out },
10004            Error::SvgloadBufferError,
10005        )
10006    }
10007}
10008
10009/// VipsForeignLoadSvgSource (svgload_source), load svg from source, priority=-5, untrusted, is_a_source, get_flags, get_flags_filename, header, load
10010/// source: `&VipsSource` -> Source to load from
10011/// returns `VipsImage` - Output image
10012pub fn svgload_source(source: &VipsSource) -> Result<VipsImage> {
10013    unsafe {
10014        let source_in: *mut bindings::VipsSource = source.ctx;
10015        let mut out_out: *mut bindings::VipsImage = null_mut();
10016
10017        let vips_op_response = bindings::vips_svgload_source(source_in, &mut out_out, NULL);
10018        utils::result(
10019            vips_op_response,
10020            VipsImage { ctx: out_out },
10021            Error::SvgloadSourceError,
10022        )
10023    }
10024}
10025
10026/// Options for svgload_source operation
10027#[derive(Clone, Debug)]
10028pub struct SvgloadSourceOptions {
10029    /// dpi: `f64` -> Render at this DPI
10030    /// min: 0.001, max: 100000, default: 72
10031    pub dpi: f64,
10032    /// scale: `f64` -> Scale output by this factor
10033    /// min: 0.001, max: 100000, default: 1
10034    pub scale: f64,
10035    /// unlimited: `bool` -> Allow SVG of any size
10036    /// default: false
10037    pub unlimited: bool,
10038    /// flags: `ForeignFlags` -> Flags for this file
10039    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10040    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10041    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10042    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10043    ///  `All` -> VIPS_FOREIGN_ALL = 7
10044    pub flags: ForeignFlags,
10045    /// memory: `bool` -> Force open via memory
10046    /// default: false
10047    pub memory: bool,
10048    /// access: `Access` -> Required access pattern for this file
10049    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10050    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10051    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10052    ///  `Last` -> VIPS_ACCESS_LAST = 3
10053    pub access: Access,
10054    /// fail_on: `FailOn` -> Error level to fail on
10055    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10056    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10057    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10058    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10059    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10060    pub fail_on: FailOn,
10061    /// revalidate: `bool` -> Don't use a cached result for this operation
10062    /// default: false
10063    pub revalidate: bool,
10064}
10065
10066impl std::default::Default for SvgloadSourceOptions {
10067    fn default() -> Self {
10068        SvgloadSourceOptions {
10069            dpi: f64::from(72),
10070            scale: f64::from(1),
10071            unlimited: false,
10072            flags: ForeignFlags::None,
10073            memory: false,
10074            access: Access::Random,
10075            fail_on: FailOn::None,
10076            revalidate: false,
10077        }
10078    }
10079}
10080
10081/// VipsForeignLoadSvgSource (svgload_source), load svg from source, priority=-5, untrusted, is_a_source, get_flags, get_flags_filename, header, load
10082/// source: `&VipsSource` -> Source to load from
10083/// svgload_source_options: `&SvgloadSourceOptions` -> optional arguments
10084/// returns `VipsImage` - Output image
10085pub fn svgload_source_with_opts(
10086    source: &VipsSource,
10087    svgload_source_options: &SvgloadSourceOptions,
10088) -> Result<VipsImage> {
10089    unsafe {
10090        let source_in: *mut bindings::VipsSource = source.ctx;
10091        let mut out_out: *mut bindings::VipsImage = null_mut();
10092
10093        let dpi_in: f64 = svgload_source_options.dpi;
10094        let dpi_in_name = utils::new_c_string("dpi")?;
10095
10096        let scale_in: f64 = svgload_source_options.scale;
10097        let scale_in_name = utils::new_c_string("scale")?;
10098
10099        let unlimited_in: i32 = if svgload_source_options.unlimited {
10100            1
10101        } else {
10102            0
10103        };
10104        let unlimited_in_name = utils::new_c_string("unlimited")?;
10105
10106        let flags_in: i32 = svgload_source_options.flags as i32;
10107        let flags_in_name = utils::new_c_string("flags")?;
10108
10109        let memory_in: i32 = if svgload_source_options.memory { 1 } else { 0 };
10110        let memory_in_name = utils::new_c_string("memory")?;
10111
10112        let access_in: i32 = svgload_source_options.access as i32;
10113        let access_in_name = utils::new_c_string("access")?;
10114
10115        let fail_on_in: i32 = svgload_source_options.fail_on as i32;
10116        let fail_on_in_name = utils::new_c_string("fail-on")?;
10117
10118        let revalidate_in: i32 = if svgload_source_options.revalidate {
10119            1
10120        } else {
10121            0
10122        };
10123        let revalidate_in_name = utils::new_c_string("revalidate")?;
10124
10125        let vips_op_response = bindings::vips_svgload_source(
10126            source_in,
10127            &mut out_out,
10128            dpi_in_name.as_ptr(),
10129            dpi_in,
10130            scale_in_name.as_ptr(),
10131            scale_in,
10132            unlimited_in_name.as_ptr(),
10133            unlimited_in,
10134            flags_in_name.as_ptr(),
10135            flags_in,
10136            memory_in_name.as_ptr(),
10137            memory_in,
10138            access_in_name.as_ptr(),
10139            access_in,
10140            fail_on_in_name.as_ptr(),
10141            fail_on_in,
10142            revalidate_in_name.as_ptr(),
10143            revalidate_in,
10144            NULL,
10145        );
10146        utils::result(
10147            vips_op_response,
10148            VipsImage { ctx: out_out },
10149            Error::SvgloadSourceError,
10150        )
10151    }
10152}
10153
10154/// VipsForeignLoadJp2kFile (jp2kload), load JPEG2000 image (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, untrusted, is_a, get_flags, header, load
10155/// filename: `&str` -> Filename to load from
10156/// returns `VipsImage` - Output image
10157pub fn jp_2kload(filename: &str) -> Result<VipsImage> {
10158    unsafe {
10159        let filename_in: CString = utils::new_c_string(filename)?;
10160        let mut out_out: *mut bindings::VipsImage = null_mut();
10161
10162        let vips_op_response = bindings::vips_jp2kload(filename_in.as_ptr(), &mut out_out, NULL);
10163        utils::result(
10164            vips_op_response,
10165            VipsImage { ctx: out_out },
10166            Error::Jp2KloadError,
10167        )
10168    }
10169}
10170
10171/// Options for jp_2kload operation
10172#[derive(Clone, Debug)]
10173pub struct Jp2KloadOptions {
10174    /// page: `i32` -> Load this page from the image
10175    /// min: 0, max: 100000, default: 0
10176    pub page: i32,
10177    /// flags: `ForeignFlags` -> Flags for this file
10178    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10179    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10180    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10181    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10182    ///  `All` -> VIPS_FOREIGN_ALL = 7
10183    pub flags: ForeignFlags,
10184    /// memory: `bool` -> Force open via memory
10185    /// default: false
10186    pub memory: bool,
10187    /// access: `Access` -> Required access pattern for this file
10188    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10189    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10190    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10191    ///  `Last` -> VIPS_ACCESS_LAST = 3
10192    pub access: Access,
10193    /// fail_on: `FailOn` -> Error level to fail on
10194    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10195    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10196    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10197    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10198    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10199    pub fail_on: FailOn,
10200    /// revalidate: `bool` -> Don't use a cached result for this operation
10201    /// default: false
10202    pub revalidate: bool,
10203}
10204
10205impl std::default::Default for Jp2KloadOptions {
10206    fn default() -> Self {
10207        Jp2KloadOptions {
10208            page: i32::from(0),
10209            flags: ForeignFlags::None,
10210            memory: false,
10211            access: Access::Random,
10212            fail_on: FailOn::None,
10213            revalidate: false,
10214        }
10215    }
10216}
10217
10218/// VipsForeignLoadJp2kFile (jp2kload), load JPEG2000 image (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, untrusted, is_a, get_flags, header, load
10219/// filename: `&str` -> Filename to load from
10220/// jp_2kload_options: `&Jp2KloadOptions` -> optional arguments
10221/// returns `VipsImage` - Output image
10222pub fn jp_2kload_with_opts(
10223    filename: &str,
10224    jp_2kload_options: &Jp2KloadOptions,
10225) -> Result<VipsImage> {
10226    unsafe {
10227        let filename_in: CString = utils::new_c_string(filename)?;
10228        let mut out_out: *mut bindings::VipsImage = null_mut();
10229
10230        let page_in: i32 = jp_2kload_options.page;
10231        let page_in_name = utils::new_c_string("page")?;
10232
10233        let flags_in: i32 = jp_2kload_options.flags as i32;
10234        let flags_in_name = utils::new_c_string("flags")?;
10235
10236        let memory_in: i32 = if jp_2kload_options.memory { 1 } else { 0 };
10237        let memory_in_name = utils::new_c_string("memory")?;
10238
10239        let access_in: i32 = jp_2kload_options.access as i32;
10240        let access_in_name = utils::new_c_string("access")?;
10241
10242        let fail_on_in: i32 = jp_2kload_options.fail_on as i32;
10243        let fail_on_in_name = utils::new_c_string("fail-on")?;
10244
10245        let revalidate_in: i32 = if jp_2kload_options.revalidate { 1 } else { 0 };
10246        let revalidate_in_name = utils::new_c_string("revalidate")?;
10247
10248        let vips_op_response = bindings::vips_jp2kload(
10249            filename_in.as_ptr(),
10250            &mut out_out,
10251            page_in_name.as_ptr(),
10252            page_in,
10253            flags_in_name.as_ptr(),
10254            flags_in,
10255            memory_in_name.as_ptr(),
10256            memory_in,
10257            access_in_name.as_ptr(),
10258            access_in,
10259            fail_on_in_name.as_ptr(),
10260            fail_on_in,
10261            revalidate_in_name.as_ptr(),
10262            revalidate_in,
10263            NULL,
10264        );
10265        utils::result(
10266            vips_op_response,
10267            VipsImage { ctx: out_out },
10268            Error::Jp2KloadError,
10269        )
10270    }
10271}
10272
10273/// VipsForeignLoadJp2kBuffer (jp2kload_buffer), load JPEG2000 image, priority=0, untrusted, is_a_buffer, get_flags, header, load
10274/// buffer: `&[u8]` -> Buffer to load from
10275/// returns `VipsImage` - Output image
10276pub fn jp_2kload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10277    unsafe {
10278        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10279        let mut out_out: *mut bindings::VipsImage = null_mut();
10280
10281        let vips_op_response =
10282            bindings::vips_jp2kload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10283        utils::result(
10284            vips_op_response,
10285            VipsImage { ctx: out_out },
10286            Error::Jp2KloadBufferError,
10287        )
10288    }
10289}
10290
10291/// Options for jp_2kload_buffer operation
10292#[derive(Clone, Debug)]
10293pub struct Jp2KloadBufferOptions {
10294    /// page: `i32` -> Load this page from the image
10295    /// min: 0, max: 100000, default: 0
10296    pub page: i32,
10297    /// flags: `ForeignFlags` -> Flags for this file
10298    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10299    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10300    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10301    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10302    ///  `All` -> VIPS_FOREIGN_ALL = 7
10303    pub flags: ForeignFlags,
10304    /// memory: `bool` -> Force open via memory
10305    /// default: false
10306    pub memory: bool,
10307    /// access: `Access` -> Required access pattern for this file
10308    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10309    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10310    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10311    ///  `Last` -> VIPS_ACCESS_LAST = 3
10312    pub access: Access,
10313    /// fail_on: `FailOn` -> Error level to fail on
10314    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10315    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10316    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10317    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10318    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10319    pub fail_on: FailOn,
10320    /// revalidate: `bool` -> Don't use a cached result for this operation
10321    /// default: false
10322    pub revalidate: bool,
10323}
10324
10325impl std::default::Default for Jp2KloadBufferOptions {
10326    fn default() -> Self {
10327        Jp2KloadBufferOptions {
10328            page: i32::from(0),
10329            flags: ForeignFlags::None,
10330            memory: false,
10331            access: Access::Random,
10332            fail_on: FailOn::None,
10333            revalidate: false,
10334        }
10335    }
10336}
10337
10338/// VipsForeignLoadJp2kBuffer (jp2kload_buffer), load JPEG2000 image, priority=0, untrusted, is_a_buffer, get_flags, header, load
10339/// buffer: `&[u8]` -> Buffer to load from
10340/// jp_2kload_buffer_options: `&Jp2KloadBufferOptions` -> optional arguments
10341/// returns `VipsImage` - Output image
10342pub fn jp_2kload_buffer_with_opts(
10343    buffer: &[u8],
10344    jp_2kload_buffer_options: &Jp2KloadBufferOptions,
10345) -> Result<VipsImage> {
10346    unsafe {
10347        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10348        let mut out_out: *mut bindings::VipsImage = null_mut();
10349
10350        let page_in: i32 = jp_2kload_buffer_options.page;
10351        let page_in_name = utils::new_c_string("page")?;
10352
10353        let flags_in: i32 = jp_2kload_buffer_options.flags as i32;
10354        let flags_in_name = utils::new_c_string("flags")?;
10355
10356        let memory_in: i32 = if jp_2kload_buffer_options.memory {
10357            1
10358        } else {
10359            0
10360        };
10361        let memory_in_name = utils::new_c_string("memory")?;
10362
10363        let access_in: i32 = jp_2kload_buffer_options.access as i32;
10364        let access_in_name = utils::new_c_string("access")?;
10365
10366        let fail_on_in: i32 = jp_2kload_buffer_options.fail_on as i32;
10367        let fail_on_in_name = utils::new_c_string("fail-on")?;
10368
10369        let revalidate_in: i32 = if jp_2kload_buffer_options.revalidate {
10370            1
10371        } else {
10372            0
10373        };
10374        let revalidate_in_name = utils::new_c_string("revalidate")?;
10375
10376        let vips_op_response = bindings::vips_jp2kload_buffer(
10377            buffer_in,
10378            buffer.len() as u64,
10379            &mut out_out,
10380            page_in_name.as_ptr(),
10381            page_in,
10382            flags_in_name.as_ptr(),
10383            flags_in,
10384            memory_in_name.as_ptr(),
10385            memory_in,
10386            access_in_name.as_ptr(),
10387            access_in,
10388            fail_on_in_name.as_ptr(),
10389            fail_on_in,
10390            revalidate_in_name.as_ptr(),
10391            revalidate_in,
10392            NULL,
10393        );
10394        utils::result(
10395            vips_op_response,
10396            VipsImage { ctx: out_out },
10397            Error::Jp2KloadBufferError,
10398        )
10399    }
10400}
10401
10402/// VipsForeignLoadJp2kSource (jp2kload_source), load JPEG2000 image, priority=0, untrusted, is_a_source, get_flags, header, load
10403/// source: `&VipsSource` -> Source to load from
10404/// returns `VipsImage` - Output image
10405pub fn jp_2kload_source(source: &VipsSource) -> Result<VipsImage> {
10406    unsafe {
10407        let source_in: *mut bindings::VipsSource = source.ctx;
10408        let mut out_out: *mut bindings::VipsImage = null_mut();
10409
10410        let vips_op_response = bindings::vips_jp2kload_source(source_in, &mut out_out, NULL);
10411        utils::result(
10412            vips_op_response,
10413            VipsImage { ctx: out_out },
10414            Error::Jp2KloadSourceError,
10415        )
10416    }
10417}
10418
10419/// Options for jp_2kload_source operation
10420#[derive(Clone, Debug)]
10421pub struct Jp2KloadSourceOptions {
10422    /// page: `i32` -> Load this page from the image
10423    /// min: 0, max: 100000, default: 0
10424    pub page: i32,
10425    /// flags: `ForeignFlags` -> Flags for this file
10426    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10427    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10428    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10429    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10430    ///  `All` -> VIPS_FOREIGN_ALL = 7
10431    pub flags: ForeignFlags,
10432    /// memory: `bool` -> Force open via memory
10433    /// default: false
10434    pub memory: bool,
10435    /// access: `Access` -> Required access pattern for this file
10436    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10437    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10438    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10439    ///  `Last` -> VIPS_ACCESS_LAST = 3
10440    pub access: Access,
10441    /// fail_on: `FailOn` -> Error level to fail on
10442    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10443    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10444    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10445    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10446    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10447    pub fail_on: FailOn,
10448    /// revalidate: `bool` -> Don't use a cached result for this operation
10449    /// default: false
10450    pub revalidate: bool,
10451}
10452
10453impl std::default::Default for Jp2KloadSourceOptions {
10454    fn default() -> Self {
10455        Jp2KloadSourceOptions {
10456            page: i32::from(0),
10457            flags: ForeignFlags::None,
10458            memory: false,
10459            access: Access::Random,
10460            fail_on: FailOn::None,
10461            revalidate: false,
10462        }
10463    }
10464}
10465
10466/// VipsForeignLoadJp2kSource (jp2kload_source), load JPEG2000 image, priority=0, untrusted, is_a_source, get_flags, header, load
10467/// source: `&VipsSource` -> Source to load from
10468/// jp_2kload_source_options: `&Jp2KloadSourceOptions` -> optional arguments
10469/// returns `VipsImage` - Output image
10470pub fn jp_2kload_source_with_opts(
10471    source: &VipsSource,
10472    jp_2kload_source_options: &Jp2KloadSourceOptions,
10473) -> Result<VipsImage> {
10474    unsafe {
10475        let source_in: *mut bindings::VipsSource = source.ctx;
10476        let mut out_out: *mut bindings::VipsImage = null_mut();
10477
10478        let page_in: i32 = jp_2kload_source_options.page;
10479        let page_in_name = utils::new_c_string("page")?;
10480
10481        let flags_in: i32 = jp_2kload_source_options.flags as i32;
10482        let flags_in_name = utils::new_c_string("flags")?;
10483
10484        let memory_in: i32 = if jp_2kload_source_options.memory {
10485            1
10486        } else {
10487            0
10488        };
10489        let memory_in_name = utils::new_c_string("memory")?;
10490
10491        let access_in: i32 = jp_2kload_source_options.access as i32;
10492        let access_in_name = utils::new_c_string("access")?;
10493
10494        let fail_on_in: i32 = jp_2kload_source_options.fail_on as i32;
10495        let fail_on_in_name = utils::new_c_string("fail-on")?;
10496
10497        let revalidate_in: i32 = if jp_2kload_source_options.revalidate {
10498            1
10499        } else {
10500            0
10501        };
10502        let revalidate_in_name = utils::new_c_string("revalidate")?;
10503
10504        let vips_op_response = bindings::vips_jp2kload_source(
10505            source_in,
10506            &mut out_out,
10507            page_in_name.as_ptr(),
10508            page_in,
10509            flags_in_name.as_ptr(),
10510            flags_in,
10511            memory_in_name.as_ptr(),
10512            memory_in,
10513            access_in_name.as_ptr(),
10514            access_in,
10515            fail_on_in_name.as_ptr(),
10516            fail_on_in,
10517            revalidate_in_name.as_ptr(),
10518            revalidate_in,
10519            NULL,
10520        );
10521        utils::result(
10522            vips_op_response,
10523            VipsImage { ctx: out_out },
10524            Error::Jp2KloadSourceError,
10525        )
10526    }
10527}
10528
10529/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10530/// filename: `&str` -> Filename to load from
10531/// returns `VipsImage` - Output image
10532pub fn gifload(filename: &str) -> Result<VipsImage> {
10533    unsafe {
10534        let filename_in: CString = utils::new_c_string(filename)?;
10535        let mut out_out: *mut bindings::VipsImage = null_mut();
10536
10537        let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10538        utils::result(
10539            vips_op_response,
10540            VipsImage { ctx: out_out },
10541            Error::GifloadError,
10542        )
10543    }
10544}
10545
10546/// Options for gifload operation
10547#[derive(Clone, Debug)]
10548pub struct GifloadOptions {
10549    /// n: `i32` -> Number of pages to load, -1 for all
10550    /// min: -1, max: 100000, default: 1
10551    pub n: i32,
10552    /// page: `i32` -> First page to load
10553    /// min: 0, max: 100000, default: 0
10554    pub page: i32,
10555    /// flags: `ForeignFlags` -> Flags for this file
10556    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10557    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10558    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10559    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10560    ///  `All` -> VIPS_FOREIGN_ALL = 7
10561    pub flags: ForeignFlags,
10562    /// memory: `bool` -> Force open via memory
10563    /// default: false
10564    pub memory: bool,
10565    /// access: `Access` -> Required access pattern for this file
10566    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10567    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10568    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10569    ///  `Last` -> VIPS_ACCESS_LAST = 3
10570    pub access: Access,
10571    /// fail_on: `FailOn` -> Error level to fail on
10572    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10573    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10574    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10575    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10576    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10577    pub fail_on: FailOn,
10578    /// revalidate: `bool` -> Don't use a cached result for this operation
10579    /// default: false
10580    pub revalidate: bool,
10581}
10582
10583impl std::default::Default for GifloadOptions {
10584    fn default() -> Self {
10585        GifloadOptions {
10586            n: i32::from(1),
10587            page: i32::from(0),
10588            flags: ForeignFlags::None,
10589            memory: false,
10590            access: Access::Random,
10591            fail_on: FailOn::None,
10592            revalidate: false,
10593        }
10594    }
10595}
10596
10597/// VipsForeignLoadNsgifFile (gifload), load GIF with libnsgif (.gif), priority=50, is_a, get_flags, get_flags_filename, header, load
10598/// filename: `&str` -> Filename to load from
10599/// gifload_options: `&GifloadOptions` -> optional arguments
10600/// returns `VipsImage` - Output image
10601pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10602    unsafe {
10603        let filename_in: CString = utils::new_c_string(filename)?;
10604        let mut out_out: *mut bindings::VipsImage = null_mut();
10605
10606        let n_in: i32 = gifload_options.n;
10607        let n_in_name = utils::new_c_string("n")?;
10608
10609        let page_in: i32 = gifload_options.page;
10610        let page_in_name = utils::new_c_string("page")?;
10611
10612        let flags_in: i32 = gifload_options.flags as i32;
10613        let flags_in_name = utils::new_c_string("flags")?;
10614
10615        let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10616        let memory_in_name = utils::new_c_string("memory")?;
10617
10618        let access_in: i32 = gifload_options.access as i32;
10619        let access_in_name = utils::new_c_string("access")?;
10620
10621        let fail_on_in: i32 = gifload_options.fail_on as i32;
10622        let fail_on_in_name = utils::new_c_string("fail-on")?;
10623
10624        let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10625        let revalidate_in_name = utils::new_c_string("revalidate")?;
10626
10627        let vips_op_response = bindings::vips_gifload(
10628            filename_in.as_ptr(),
10629            &mut out_out,
10630            n_in_name.as_ptr(),
10631            n_in,
10632            page_in_name.as_ptr(),
10633            page_in,
10634            flags_in_name.as_ptr(),
10635            flags_in,
10636            memory_in_name.as_ptr(),
10637            memory_in,
10638            access_in_name.as_ptr(),
10639            access_in,
10640            fail_on_in_name.as_ptr(),
10641            fail_on_in,
10642            revalidate_in_name.as_ptr(),
10643            revalidate_in,
10644            NULL,
10645        );
10646        utils::result(
10647            vips_op_response,
10648            VipsImage { ctx: out_out },
10649            Error::GifloadError,
10650        )
10651    }
10652}
10653
10654/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10655/// buffer: `&[u8]` -> Buffer to load from
10656/// returns `VipsImage` - Output image
10657pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10658    unsafe {
10659        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10660        let mut out_out: *mut bindings::VipsImage = null_mut();
10661
10662        let vips_op_response =
10663            bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10664        utils::result(
10665            vips_op_response,
10666            VipsImage { ctx: out_out },
10667            Error::GifloadBufferError,
10668        )
10669    }
10670}
10671
10672/// Options for gifload_buffer operation
10673#[derive(Clone, Debug)]
10674pub struct GifloadBufferOptions {
10675    /// n: `i32` -> Number of pages to load, -1 for all
10676    /// min: -1, max: 100000, default: 1
10677    pub n: i32,
10678    /// page: `i32` -> First page to load
10679    /// min: 0, max: 100000, default: 0
10680    pub page: i32,
10681    /// flags: `ForeignFlags` -> Flags for this file
10682    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10683    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10684    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10685    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10686    ///  `All` -> VIPS_FOREIGN_ALL = 7
10687    pub flags: ForeignFlags,
10688    /// memory: `bool` -> Force open via memory
10689    /// default: false
10690    pub memory: bool,
10691    /// access: `Access` -> Required access pattern for this file
10692    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10693    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10694    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10695    ///  `Last` -> VIPS_ACCESS_LAST = 3
10696    pub access: Access,
10697    /// fail_on: `FailOn` -> Error level to fail on
10698    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10699    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10700    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10701    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10702    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10703    pub fail_on: FailOn,
10704    /// revalidate: `bool` -> Don't use a cached result for this operation
10705    /// default: false
10706    pub revalidate: bool,
10707}
10708
10709impl std::default::Default for GifloadBufferOptions {
10710    fn default() -> Self {
10711        GifloadBufferOptions {
10712            n: i32::from(1),
10713            page: i32::from(0),
10714            flags: ForeignFlags::None,
10715            memory: false,
10716            access: Access::Random,
10717            fail_on: FailOn::None,
10718            revalidate: false,
10719        }
10720    }
10721}
10722
10723/// VipsForeignLoadNsgifBuffer (gifload_buffer), load GIF with libnsgif, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
10724/// buffer: `&[u8]` -> Buffer to load from
10725/// gifload_buffer_options: `&GifloadBufferOptions` -> optional arguments
10726/// returns `VipsImage` - Output image
10727pub fn gifload_buffer_with_opts(
10728    buffer: &[u8],
10729    gifload_buffer_options: &GifloadBufferOptions,
10730) -> Result<VipsImage> {
10731    unsafe {
10732        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10733        let mut out_out: *mut bindings::VipsImage = null_mut();
10734
10735        let n_in: i32 = gifload_buffer_options.n;
10736        let n_in_name = utils::new_c_string("n")?;
10737
10738        let page_in: i32 = gifload_buffer_options.page;
10739        let page_in_name = utils::new_c_string("page")?;
10740
10741        let flags_in: i32 = gifload_buffer_options.flags as i32;
10742        let flags_in_name = utils::new_c_string("flags")?;
10743
10744        let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10745        let memory_in_name = utils::new_c_string("memory")?;
10746
10747        let access_in: i32 = gifload_buffer_options.access as i32;
10748        let access_in_name = utils::new_c_string("access")?;
10749
10750        let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10751        let fail_on_in_name = utils::new_c_string("fail-on")?;
10752
10753        let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10754            1
10755        } else {
10756            0
10757        };
10758        let revalidate_in_name = utils::new_c_string("revalidate")?;
10759
10760        let vips_op_response = bindings::vips_gifload_buffer(
10761            buffer_in,
10762            buffer.len() as u64,
10763            &mut out_out,
10764            n_in_name.as_ptr(),
10765            n_in,
10766            page_in_name.as_ptr(),
10767            page_in,
10768            flags_in_name.as_ptr(),
10769            flags_in,
10770            memory_in_name.as_ptr(),
10771            memory_in,
10772            access_in_name.as_ptr(),
10773            access_in,
10774            fail_on_in_name.as_ptr(),
10775            fail_on_in,
10776            revalidate_in_name.as_ptr(),
10777            revalidate_in,
10778            NULL,
10779        );
10780        utils::result(
10781            vips_op_response,
10782            VipsImage { ctx: out_out },
10783            Error::GifloadBufferError,
10784        )
10785    }
10786}
10787
10788/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10789/// source: `&VipsSource` -> Source to load from
10790/// returns `VipsImage` - Output image
10791pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10792    unsafe {
10793        let source_in: *mut bindings::VipsSource = source.ctx;
10794        let mut out_out: *mut bindings::VipsImage = null_mut();
10795
10796        let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10797        utils::result(
10798            vips_op_response,
10799            VipsImage { ctx: out_out },
10800            Error::GifloadSourceError,
10801        )
10802    }
10803}
10804
10805/// Options for gifload_source operation
10806#[derive(Clone, Debug)]
10807pub struct GifloadSourceOptions {
10808    /// n: `i32` -> Number of pages to load, -1 for all
10809    /// min: -1, max: 100000, default: 1
10810    pub n: i32,
10811    /// page: `i32` -> First page to load
10812    /// min: 0, max: 100000, default: 0
10813    pub page: i32,
10814    /// flags: `ForeignFlags` -> Flags for this file
10815    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10816    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10817    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10818    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10819    ///  `All` -> VIPS_FOREIGN_ALL = 7
10820    pub flags: ForeignFlags,
10821    /// memory: `bool` -> Force open via memory
10822    /// default: false
10823    pub memory: bool,
10824    /// access: `Access` -> Required access pattern for this file
10825    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10826    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10827    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10828    ///  `Last` -> VIPS_ACCESS_LAST = 3
10829    pub access: Access,
10830    /// fail_on: `FailOn` -> Error level to fail on
10831    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10832    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10833    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10834    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10835    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10836    pub fail_on: FailOn,
10837    /// revalidate: `bool` -> Don't use a cached result for this operation
10838    /// default: false
10839    pub revalidate: bool,
10840}
10841
10842impl std::default::Default for GifloadSourceOptions {
10843    fn default() -> Self {
10844        GifloadSourceOptions {
10845            n: i32::from(1),
10846            page: i32::from(0),
10847            flags: ForeignFlags::None,
10848            memory: false,
10849            access: Access::Random,
10850            fail_on: FailOn::None,
10851            revalidate: false,
10852        }
10853    }
10854}
10855
10856/// VipsForeignLoadNsgifSource (gifload_source), load gif from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
10857/// source: `&VipsSource` -> Source to load from
10858/// gifload_source_options: `&GifloadSourceOptions` -> optional arguments
10859/// returns `VipsImage` - Output image
10860pub fn gifload_source_with_opts(
10861    source: &VipsSource,
10862    gifload_source_options: &GifloadSourceOptions,
10863) -> Result<VipsImage> {
10864    unsafe {
10865        let source_in: *mut bindings::VipsSource = source.ctx;
10866        let mut out_out: *mut bindings::VipsImage = null_mut();
10867
10868        let n_in: i32 = gifload_source_options.n;
10869        let n_in_name = utils::new_c_string("n")?;
10870
10871        let page_in: i32 = gifload_source_options.page;
10872        let page_in_name = utils::new_c_string("page")?;
10873
10874        let flags_in: i32 = gifload_source_options.flags as i32;
10875        let flags_in_name = utils::new_c_string("flags")?;
10876
10877        let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10878        let memory_in_name = utils::new_c_string("memory")?;
10879
10880        let access_in: i32 = gifload_source_options.access as i32;
10881        let access_in_name = utils::new_c_string("access")?;
10882
10883        let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10884        let fail_on_in_name = utils::new_c_string("fail-on")?;
10885
10886        let revalidate_in: i32 = if gifload_source_options.revalidate {
10887            1
10888        } else {
10889            0
10890        };
10891        let revalidate_in_name = utils::new_c_string("revalidate")?;
10892
10893        let vips_op_response = bindings::vips_gifload_source(
10894            source_in,
10895            &mut out_out,
10896            n_in_name.as_ptr(),
10897            n_in,
10898            page_in_name.as_ptr(),
10899            page_in,
10900            flags_in_name.as_ptr(),
10901            flags_in,
10902            memory_in_name.as_ptr(),
10903            memory_in,
10904            access_in_name.as_ptr(),
10905            access_in,
10906            fail_on_in_name.as_ptr(),
10907            fail_on_in,
10908            revalidate_in_name.as_ptr(),
10909            revalidate_in,
10910            NULL,
10911        );
10912        utils::result(
10913            vips_op_response,
10914            VipsImage { ctx: out_out },
10915            Error::GifloadSourceError,
10916        )
10917    }
10918}
10919
10920/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10921/// filename: `&str` -> Filename to load from
10922/// returns `VipsImage` - Output image
10923pub fn pngload(filename: &str) -> Result<VipsImage> {
10924    unsafe {
10925        let filename_in: CString = utils::new_c_string(filename)?;
10926        let mut out_out: *mut bindings::VipsImage = null_mut();
10927
10928        let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10929        utils::result(
10930            vips_op_response,
10931            VipsImage { ctx: out_out },
10932            Error::PngloadError,
10933        )
10934    }
10935}
10936
10937/// Options for pngload operation
10938#[derive(Clone, Debug)]
10939pub struct PngloadOptions {
10940    /// unlimited: `bool` -> Remove all denial of service limits
10941    /// default: false
10942    pub unlimited: bool,
10943    /// flags: `ForeignFlags` -> Flags for this file
10944    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
10945    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
10946    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
10947    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
10948    ///  `All` -> VIPS_FOREIGN_ALL = 7
10949    pub flags: ForeignFlags,
10950    /// memory: `bool` -> Force open via memory
10951    /// default: false
10952    pub memory: bool,
10953    /// access: `Access` -> Required access pattern for this file
10954    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
10955    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
10956    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
10957    ///  `Last` -> VIPS_ACCESS_LAST = 3
10958    pub access: Access,
10959    /// fail_on: `FailOn` -> Error level to fail on
10960    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
10961    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
10962    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
10963    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
10964    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
10965    pub fail_on: FailOn,
10966    /// revalidate: `bool` -> Don't use a cached result for this operation
10967    /// default: false
10968    pub revalidate: bool,
10969}
10970
10971impl std::default::Default for PngloadOptions {
10972    fn default() -> Self {
10973        PngloadOptions {
10974            unlimited: false,
10975            flags: ForeignFlags::None,
10976            memory: false,
10977            access: Access::Random,
10978            fail_on: FailOn::None,
10979            revalidate: false,
10980        }
10981    }
10982}
10983
10984/// VipsForeignLoadPngFile (pngload), load png from file (.png), priority=200, is_a, get_flags, get_flags_filename, header, load
10985/// filename: `&str` -> Filename to load from
10986/// pngload_options: `&PngloadOptions` -> optional arguments
10987/// returns `VipsImage` - Output image
10988pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10989    unsafe {
10990        let filename_in: CString = utils::new_c_string(filename)?;
10991        let mut out_out: *mut bindings::VipsImage = null_mut();
10992
10993        let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10994        let unlimited_in_name = utils::new_c_string("unlimited")?;
10995
10996        let flags_in: i32 = pngload_options.flags as i32;
10997        let flags_in_name = utils::new_c_string("flags")?;
10998
10999        let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
11000        let memory_in_name = utils::new_c_string("memory")?;
11001
11002        let access_in: i32 = pngload_options.access as i32;
11003        let access_in_name = utils::new_c_string("access")?;
11004
11005        let fail_on_in: i32 = pngload_options.fail_on as i32;
11006        let fail_on_in_name = utils::new_c_string("fail-on")?;
11007
11008        let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
11009        let revalidate_in_name = utils::new_c_string("revalidate")?;
11010
11011        let vips_op_response = bindings::vips_pngload(
11012            filename_in.as_ptr(),
11013            &mut out_out,
11014            unlimited_in_name.as_ptr(),
11015            unlimited_in,
11016            flags_in_name.as_ptr(),
11017            flags_in,
11018            memory_in_name.as_ptr(),
11019            memory_in,
11020            access_in_name.as_ptr(),
11021            access_in,
11022            fail_on_in_name.as_ptr(),
11023            fail_on_in,
11024            revalidate_in_name.as_ptr(),
11025            revalidate_in,
11026            NULL,
11027        );
11028        utils::result(
11029            vips_op_response,
11030            VipsImage { ctx: out_out },
11031            Error::PngloadError,
11032        )
11033    }
11034}
11035
11036/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11037/// buffer: `&[u8]` -> Buffer to load from
11038/// returns `VipsImage` - Output image
11039pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11040    unsafe {
11041        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11042        let mut out_out: *mut bindings::VipsImage = null_mut();
11043
11044        let vips_op_response =
11045            bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11046        utils::result(
11047            vips_op_response,
11048            VipsImage { ctx: out_out },
11049            Error::PngloadBufferError,
11050        )
11051    }
11052}
11053
11054/// Options for pngload_buffer operation
11055#[derive(Clone, Debug)]
11056pub struct PngloadBufferOptions {
11057    /// unlimited: `bool` -> Remove all denial of service limits
11058    /// default: false
11059    pub unlimited: bool,
11060    /// flags: `ForeignFlags` -> Flags for this file
11061    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11062    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11063    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11064    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11065    ///  `All` -> VIPS_FOREIGN_ALL = 7
11066    pub flags: ForeignFlags,
11067    /// memory: `bool` -> Force open via memory
11068    /// default: false
11069    pub memory: bool,
11070    /// access: `Access` -> Required access pattern for this file
11071    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11072    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11073    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11074    ///  `Last` -> VIPS_ACCESS_LAST = 3
11075    pub access: Access,
11076    /// fail_on: `FailOn` -> Error level to fail on
11077    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11078    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11079    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11080    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11081    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11082    pub fail_on: FailOn,
11083    /// revalidate: `bool` -> Don't use a cached result for this operation
11084    /// default: false
11085    pub revalidate: bool,
11086}
11087
11088impl std::default::Default for PngloadBufferOptions {
11089    fn default() -> Self {
11090        PngloadBufferOptions {
11091            unlimited: false,
11092            flags: ForeignFlags::None,
11093            memory: false,
11094            access: Access::Random,
11095            fail_on: FailOn::None,
11096            revalidate: false,
11097        }
11098    }
11099}
11100
11101/// VipsForeignLoadPngBuffer (pngload_buffer), load png from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11102/// buffer: `&[u8]` -> Buffer to load from
11103/// pngload_buffer_options: `&PngloadBufferOptions` -> optional arguments
11104/// returns `VipsImage` - Output image
11105pub fn pngload_buffer_with_opts(
11106    buffer: &[u8],
11107    pngload_buffer_options: &PngloadBufferOptions,
11108) -> Result<VipsImage> {
11109    unsafe {
11110        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11111        let mut out_out: *mut bindings::VipsImage = null_mut();
11112
11113        let unlimited_in: i32 = if pngload_buffer_options.unlimited {
11114            1
11115        } else {
11116            0
11117        };
11118        let unlimited_in_name = utils::new_c_string("unlimited")?;
11119
11120        let flags_in: i32 = pngload_buffer_options.flags as i32;
11121        let flags_in_name = utils::new_c_string("flags")?;
11122
11123        let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
11124        let memory_in_name = utils::new_c_string("memory")?;
11125
11126        let access_in: i32 = pngload_buffer_options.access as i32;
11127        let access_in_name = utils::new_c_string("access")?;
11128
11129        let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
11130        let fail_on_in_name = utils::new_c_string("fail-on")?;
11131
11132        let revalidate_in: i32 = if pngload_buffer_options.revalidate {
11133            1
11134        } else {
11135            0
11136        };
11137        let revalidate_in_name = utils::new_c_string("revalidate")?;
11138
11139        let vips_op_response = bindings::vips_pngload_buffer(
11140            buffer_in,
11141            buffer.len() as u64,
11142            &mut out_out,
11143            unlimited_in_name.as_ptr(),
11144            unlimited_in,
11145            flags_in_name.as_ptr(),
11146            flags_in,
11147            memory_in_name.as_ptr(),
11148            memory_in,
11149            access_in_name.as_ptr(),
11150            access_in,
11151            fail_on_in_name.as_ptr(),
11152            fail_on_in,
11153            revalidate_in_name.as_ptr(),
11154            revalidate_in,
11155            NULL,
11156        );
11157        utils::result(
11158            vips_op_response,
11159            VipsImage { ctx: out_out },
11160            Error::PngloadBufferError,
11161        )
11162    }
11163}
11164
11165/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11166/// source: `&VipsSource` -> Source to load from
11167/// returns `VipsImage` - Output image
11168pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
11169    unsafe {
11170        let source_in: *mut bindings::VipsSource = source.ctx;
11171        let mut out_out: *mut bindings::VipsImage = null_mut();
11172
11173        let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
11174        utils::result(
11175            vips_op_response,
11176            VipsImage { ctx: out_out },
11177            Error::PngloadSourceError,
11178        )
11179    }
11180}
11181
11182/// Options for pngload_source operation
11183#[derive(Clone, Debug)]
11184pub struct PngloadSourceOptions {
11185    /// unlimited: `bool` -> Remove all denial of service limits
11186    /// default: false
11187    pub unlimited: bool,
11188    /// flags: `ForeignFlags` -> Flags for this file
11189    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11190    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11191    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11192    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11193    ///  `All` -> VIPS_FOREIGN_ALL = 7
11194    pub flags: ForeignFlags,
11195    /// memory: `bool` -> Force open via memory
11196    /// default: false
11197    pub memory: bool,
11198    /// access: `Access` -> Required access pattern for this file
11199    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11200    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11201    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11202    ///  `Last` -> VIPS_ACCESS_LAST = 3
11203    pub access: Access,
11204    /// fail_on: `FailOn` -> Error level to fail on
11205    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11206    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11207    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11208    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11209    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11210    pub fail_on: FailOn,
11211    /// revalidate: `bool` -> Don't use a cached result for this operation
11212    /// default: false
11213    pub revalidate: bool,
11214}
11215
11216impl std::default::Default for PngloadSourceOptions {
11217    fn default() -> Self {
11218        PngloadSourceOptions {
11219            unlimited: false,
11220            flags: ForeignFlags::None,
11221            memory: false,
11222            access: Access::Random,
11223            fail_on: FailOn::None,
11224            revalidate: false,
11225        }
11226    }
11227}
11228
11229/// VipsForeignLoadPngSource (pngload_source), load png from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
11230/// source: `&VipsSource` -> Source to load from
11231/// pngload_source_options: `&PngloadSourceOptions` -> optional arguments
11232/// returns `VipsImage` - Output image
11233pub fn pngload_source_with_opts(
11234    source: &VipsSource,
11235    pngload_source_options: &PngloadSourceOptions,
11236) -> Result<VipsImage> {
11237    unsafe {
11238        let source_in: *mut bindings::VipsSource = source.ctx;
11239        let mut out_out: *mut bindings::VipsImage = null_mut();
11240
11241        let unlimited_in: i32 = if pngload_source_options.unlimited {
11242            1
11243        } else {
11244            0
11245        };
11246        let unlimited_in_name = utils::new_c_string("unlimited")?;
11247
11248        let flags_in: i32 = pngload_source_options.flags as i32;
11249        let flags_in_name = utils::new_c_string("flags")?;
11250
11251        let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
11252        let memory_in_name = utils::new_c_string("memory")?;
11253
11254        let access_in: i32 = pngload_source_options.access as i32;
11255        let access_in_name = utils::new_c_string("access")?;
11256
11257        let fail_on_in: i32 = pngload_source_options.fail_on as i32;
11258        let fail_on_in_name = utils::new_c_string("fail-on")?;
11259
11260        let revalidate_in: i32 = if pngload_source_options.revalidate {
11261            1
11262        } else {
11263            0
11264        };
11265        let revalidate_in_name = utils::new_c_string("revalidate")?;
11266
11267        let vips_op_response = bindings::vips_pngload_source(
11268            source_in,
11269            &mut out_out,
11270            unlimited_in_name.as_ptr(),
11271            unlimited_in,
11272            flags_in_name.as_ptr(),
11273            flags_in,
11274            memory_in_name.as_ptr(),
11275            memory_in,
11276            access_in_name.as_ptr(),
11277            access_in,
11278            fail_on_in_name.as_ptr(),
11279            fail_on_in,
11280            revalidate_in_name.as_ptr(),
11281            revalidate_in,
11282            NULL,
11283        );
11284        utils::result(
11285            vips_op_response,
11286            VipsImage { ctx: out_out },
11287            Error::PngloadSourceError,
11288        )
11289    }
11290}
11291
11292/// VipsForeignLoadMat (matload), load mat from file (.mat), priority=0, untrusted, is_a, get_flags, get_flags_filename, header, load
11293/// filename: `&str` -> Filename to load from
11294/// returns `VipsImage` - Output image
11295pub fn matload(filename: &str) -> Result<VipsImage> {
11296    unsafe {
11297        let filename_in: CString = utils::new_c_string(filename)?;
11298        let mut out_out: *mut bindings::VipsImage = null_mut();
11299
11300        let vips_op_response = bindings::vips_matload(filename_in.as_ptr(), &mut out_out, NULL);
11301        utils::result(
11302            vips_op_response,
11303            VipsImage { ctx: out_out },
11304            Error::MatloadError,
11305        )
11306    }
11307}
11308
11309/// Options for matload operation
11310#[derive(Clone, Debug)]
11311pub struct MatloadOptions {
11312    /// flags: `ForeignFlags` -> Flags for this file
11313    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11314    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11315    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11316    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11317    ///  `All` -> VIPS_FOREIGN_ALL = 7
11318    pub flags: ForeignFlags,
11319    /// memory: `bool` -> Force open via memory
11320    /// default: false
11321    pub memory: bool,
11322    /// access: `Access` -> Required access pattern for this file
11323    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11324    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11325    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11326    ///  `Last` -> VIPS_ACCESS_LAST = 3
11327    pub access: Access,
11328    /// fail_on: `FailOn` -> Error level to fail on
11329    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11330    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11331    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11332    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11333    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11334    pub fail_on: FailOn,
11335    /// revalidate: `bool` -> Don't use a cached result for this operation
11336    /// default: false
11337    pub revalidate: bool,
11338}
11339
11340impl std::default::Default for MatloadOptions {
11341    fn default() -> Self {
11342        MatloadOptions {
11343            flags: ForeignFlags::None,
11344            memory: false,
11345            access: Access::Random,
11346            fail_on: FailOn::None,
11347            revalidate: false,
11348        }
11349    }
11350}
11351
11352/// VipsForeignLoadMat (matload), load mat from file (.mat), priority=0, untrusted, is_a, get_flags, get_flags_filename, header, load
11353/// filename: `&str` -> Filename to load from
11354/// matload_options: `&MatloadOptions` -> optional arguments
11355/// returns `VipsImage` - Output image
11356pub fn matload_with_opts(filename: &str, matload_options: &MatloadOptions) -> Result<VipsImage> {
11357    unsafe {
11358        let filename_in: CString = utils::new_c_string(filename)?;
11359        let mut out_out: *mut bindings::VipsImage = null_mut();
11360
11361        let flags_in: i32 = matload_options.flags as i32;
11362        let flags_in_name = utils::new_c_string("flags")?;
11363
11364        let memory_in: i32 = if matload_options.memory { 1 } else { 0 };
11365        let memory_in_name = utils::new_c_string("memory")?;
11366
11367        let access_in: i32 = matload_options.access as i32;
11368        let access_in_name = utils::new_c_string("access")?;
11369
11370        let fail_on_in: i32 = matload_options.fail_on as i32;
11371        let fail_on_in_name = utils::new_c_string("fail-on")?;
11372
11373        let revalidate_in: i32 = if matload_options.revalidate { 1 } else { 0 };
11374        let revalidate_in_name = utils::new_c_string("revalidate")?;
11375
11376        let vips_op_response = bindings::vips_matload(
11377            filename_in.as_ptr(),
11378            &mut out_out,
11379            flags_in_name.as_ptr(),
11380            flags_in,
11381            memory_in_name.as_ptr(),
11382            memory_in,
11383            access_in_name.as_ptr(),
11384            access_in,
11385            fail_on_in_name.as_ptr(),
11386            fail_on_in,
11387            revalidate_in_name.as_ptr(),
11388            revalidate_in,
11389            NULL,
11390        );
11391        utils::result(
11392            vips_op_response,
11393            VipsImage { ctx: out_out },
11394            Error::MatloadError,
11395        )
11396    }
11397}
11398
11399/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
11400/// filename: `&str` -> Filename to load from
11401/// returns `VipsImage` - Output image
11402pub fn jpegload(filename: &str) -> Result<VipsImage> {
11403    unsafe {
11404        let filename_in: CString = utils::new_c_string(filename)?;
11405        let mut out_out: *mut bindings::VipsImage = null_mut();
11406
11407        let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
11408        utils::result(
11409            vips_op_response,
11410            VipsImage { ctx: out_out },
11411            Error::JpegloadError,
11412        )
11413    }
11414}
11415
11416/// Options for jpegload operation
11417#[derive(Clone, Debug)]
11418pub struct JpegloadOptions {
11419    /// shrink: `i32` -> Shrink factor on load
11420    /// min: 1, max: 16, default: 1
11421    pub shrink: i32,
11422    /// autorotate: `bool` -> Rotate image using exif orientation
11423    /// default: false
11424    pub autorotate: bool,
11425    /// unlimited: `bool` -> Remove all denial of service limits
11426    /// default: false
11427    pub unlimited: bool,
11428    /// flags: `ForeignFlags` -> Flags for this file
11429    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11430    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11431    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11432    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11433    ///  `All` -> VIPS_FOREIGN_ALL = 7
11434    pub flags: ForeignFlags,
11435    /// memory: `bool` -> Force open via memory
11436    /// default: false
11437    pub memory: bool,
11438    /// access: `Access` -> Required access pattern for this file
11439    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11440    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11441    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11442    ///  `Last` -> VIPS_ACCESS_LAST = 3
11443    pub access: Access,
11444    /// fail_on: `FailOn` -> Error level to fail on
11445    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11446    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11447    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11448    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11449    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11450    pub fail_on: FailOn,
11451    /// revalidate: `bool` -> Don't use a cached result for this operation
11452    /// default: false
11453    pub revalidate: bool,
11454}
11455
11456impl std::default::Default for JpegloadOptions {
11457    fn default() -> Self {
11458        JpegloadOptions {
11459            shrink: i32::from(1),
11460            autorotate: false,
11461            unlimited: false,
11462            flags: ForeignFlags::None,
11463            memory: false,
11464            access: Access::Random,
11465            fail_on: FailOn::None,
11466            revalidate: false,
11467        }
11468    }
11469}
11470
11471/// VipsForeignLoadJpegFile (jpegload), load jpeg from file (.jpg, .jpeg, .jpe, .jfif), priority=50, is_a, get_flags, get_flags_filename, header, load
11472/// filename: `&str` -> Filename to load from
11473/// jpegload_options: `&JpegloadOptions` -> optional arguments
11474/// returns `VipsImage` - Output image
11475pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11476    unsafe {
11477        let filename_in: CString = utils::new_c_string(filename)?;
11478        let mut out_out: *mut bindings::VipsImage = null_mut();
11479
11480        let shrink_in: i32 = jpegload_options.shrink;
11481        let shrink_in_name = utils::new_c_string("shrink")?;
11482
11483        let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11484        let autorotate_in_name = utils::new_c_string("autorotate")?;
11485
11486        let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11487        let unlimited_in_name = utils::new_c_string("unlimited")?;
11488
11489        let flags_in: i32 = jpegload_options.flags as i32;
11490        let flags_in_name = utils::new_c_string("flags")?;
11491
11492        let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11493        let memory_in_name = utils::new_c_string("memory")?;
11494
11495        let access_in: i32 = jpegload_options.access as i32;
11496        let access_in_name = utils::new_c_string("access")?;
11497
11498        let fail_on_in: i32 = jpegload_options.fail_on as i32;
11499        let fail_on_in_name = utils::new_c_string("fail-on")?;
11500
11501        let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11502        let revalidate_in_name = utils::new_c_string("revalidate")?;
11503
11504        let vips_op_response = bindings::vips_jpegload(
11505            filename_in.as_ptr(),
11506            &mut out_out,
11507            shrink_in_name.as_ptr(),
11508            shrink_in,
11509            autorotate_in_name.as_ptr(),
11510            autorotate_in,
11511            unlimited_in_name.as_ptr(),
11512            unlimited_in,
11513            flags_in_name.as_ptr(),
11514            flags_in,
11515            memory_in_name.as_ptr(),
11516            memory_in,
11517            access_in_name.as_ptr(),
11518            access_in,
11519            fail_on_in_name.as_ptr(),
11520            fail_on_in,
11521            revalidate_in_name.as_ptr(),
11522            revalidate_in,
11523            NULL,
11524        );
11525        utils::result(
11526            vips_op_response,
11527            VipsImage { ctx: out_out },
11528            Error::JpegloadError,
11529        )
11530    }
11531}
11532
11533/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11534/// buffer: `&[u8]` -> Buffer to load from
11535/// returns `VipsImage` - Output image
11536pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11537    unsafe {
11538        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11539        let mut out_out: *mut bindings::VipsImage = null_mut();
11540
11541        let vips_op_response =
11542            bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11543        utils::result(
11544            vips_op_response,
11545            VipsImage { ctx: out_out },
11546            Error::JpegloadBufferError,
11547        )
11548    }
11549}
11550
11551/// Options for jpegload_buffer operation
11552#[derive(Clone, Debug)]
11553pub struct JpegloadBufferOptions {
11554    /// shrink: `i32` -> Shrink factor on load
11555    /// min: 1, max: 16, default: 1
11556    pub shrink: i32,
11557    /// autorotate: `bool` -> Rotate image using exif orientation
11558    /// default: false
11559    pub autorotate: bool,
11560    /// unlimited: `bool` -> Remove all denial of service limits
11561    /// default: false
11562    pub unlimited: bool,
11563    /// flags: `ForeignFlags` -> Flags for this file
11564    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11565    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11566    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11567    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11568    ///  `All` -> VIPS_FOREIGN_ALL = 7
11569    pub flags: ForeignFlags,
11570    /// memory: `bool` -> Force open via memory
11571    /// default: false
11572    pub memory: bool,
11573    /// access: `Access` -> Required access pattern for this file
11574    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11575    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11576    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11577    ///  `Last` -> VIPS_ACCESS_LAST = 3
11578    pub access: Access,
11579    /// fail_on: `FailOn` -> Error level to fail on
11580    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11581    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11582    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11583    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11584    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11585    pub fail_on: FailOn,
11586    /// revalidate: `bool` -> Don't use a cached result for this operation
11587    /// default: false
11588    pub revalidate: bool,
11589}
11590
11591impl std::default::Default for JpegloadBufferOptions {
11592    fn default() -> Self {
11593        JpegloadBufferOptions {
11594            shrink: i32::from(1),
11595            autorotate: false,
11596            unlimited: false,
11597            flags: ForeignFlags::None,
11598            memory: false,
11599            access: Access::Random,
11600            fail_on: FailOn::None,
11601            revalidate: false,
11602        }
11603    }
11604}
11605
11606/// VipsForeignLoadJpegBuffer (jpegload_buffer), load jpeg from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
11607/// buffer: `&[u8]` -> Buffer to load from
11608/// jpegload_buffer_options: `&JpegloadBufferOptions` -> optional arguments
11609/// returns `VipsImage` - Output image
11610pub fn jpegload_buffer_with_opts(
11611    buffer: &[u8],
11612    jpegload_buffer_options: &JpegloadBufferOptions,
11613) -> Result<VipsImage> {
11614    unsafe {
11615        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11616        let mut out_out: *mut bindings::VipsImage = null_mut();
11617
11618        let shrink_in: i32 = jpegload_buffer_options.shrink;
11619        let shrink_in_name = utils::new_c_string("shrink")?;
11620
11621        let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11622            1
11623        } else {
11624            0
11625        };
11626        let autorotate_in_name = utils::new_c_string("autorotate")?;
11627
11628        let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11629            1
11630        } else {
11631            0
11632        };
11633        let unlimited_in_name = utils::new_c_string("unlimited")?;
11634
11635        let flags_in: i32 = jpegload_buffer_options.flags as i32;
11636        let flags_in_name = utils::new_c_string("flags")?;
11637
11638        let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11639        let memory_in_name = utils::new_c_string("memory")?;
11640
11641        let access_in: i32 = jpegload_buffer_options.access as i32;
11642        let access_in_name = utils::new_c_string("access")?;
11643
11644        let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11645        let fail_on_in_name = utils::new_c_string("fail-on")?;
11646
11647        let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11648            1
11649        } else {
11650            0
11651        };
11652        let revalidate_in_name = utils::new_c_string("revalidate")?;
11653
11654        let vips_op_response = bindings::vips_jpegload_buffer(
11655            buffer_in,
11656            buffer.len() as u64,
11657            &mut out_out,
11658            shrink_in_name.as_ptr(),
11659            shrink_in,
11660            autorotate_in_name.as_ptr(),
11661            autorotate_in,
11662            unlimited_in_name.as_ptr(),
11663            unlimited_in,
11664            flags_in_name.as_ptr(),
11665            flags_in,
11666            memory_in_name.as_ptr(),
11667            memory_in,
11668            access_in_name.as_ptr(),
11669            access_in,
11670            fail_on_in_name.as_ptr(),
11671            fail_on_in,
11672            revalidate_in_name.as_ptr(),
11673            revalidate_in,
11674            NULL,
11675        );
11676        utils::result(
11677            vips_op_response,
11678            VipsImage { ctx: out_out },
11679            Error::JpegloadBufferError,
11680        )
11681    }
11682}
11683
11684/// VipsForeignLoadJpegSource (jpegload_source), load image from jpeg source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11685/// source: `&VipsSource` -> Source to load from
11686/// returns `VipsImage` - Output image
11687pub fn jpegload_source(source: &VipsSource) -> Result<VipsImage> {
11688    unsafe {
11689        let source_in: *mut bindings::VipsSource = source.ctx;
11690        let mut out_out: *mut bindings::VipsImage = null_mut();
11691
11692        let vips_op_response = bindings::vips_jpegload_source(source_in, &mut out_out, NULL);
11693        utils::result(
11694            vips_op_response,
11695            VipsImage { ctx: out_out },
11696            Error::JpegloadSourceError,
11697        )
11698    }
11699}
11700
11701/// Options for jpegload_source operation
11702#[derive(Clone, Debug)]
11703pub struct JpegloadSourceOptions {
11704    /// shrink: `i32` -> Shrink factor on load
11705    /// min: 1, max: 16, default: 1
11706    pub shrink: i32,
11707    /// autorotate: `bool` -> Rotate image using exif orientation
11708    /// default: false
11709    pub autorotate: bool,
11710    /// unlimited: `bool` -> Remove all denial of service limits
11711    /// default: false
11712    pub unlimited: bool,
11713    /// flags: `ForeignFlags` -> Flags for this file
11714    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11715    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11716    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11717    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11718    ///  `All` -> VIPS_FOREIGN_ALL = 7
11719    pub flags: ForeignFlags,
11720    /// memory: `bool` -> Force open via memory
11721    /// default: false
11722    pub memory: bool,
11723    /// access: `Access` -> Required access pattern for this file
11724    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11725    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11726    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11727    ///  `Last` -> VIPS_ACCESS_LAST = 3
11728    pub access: Access,
11729    /// fail_on: `FailOn` -> Error level to fail on
11730    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11731    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11732    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11733    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11734    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11735    pub fail_on: FailOn,
11736    /// revalidate: `bool` -> Don't use a cached result for this operation
11737    /// default: false
11738    pub revalidate: bool,
11739}
11740
11741impl std::default::Default for JpegloadSourceOptions {
11742    fn default() -> Self {
11743        JpegloadSourceOptions {
11744            shrink: i32::from(1),
11745            autorotate: false,
11746            unlimited: false,
11747            flags: ForeignFlags::None,
11748            memory: false,
11749            access: Access::Random,
11750            fail_on: FailOn::None,
11751            revalidate: false,
11752        }
11753    }
11754}
11755
11756/// VipsForeignLoadJpegSource (jpegload_source), load image from jpeg source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
11757/// source: `&VipsSource` -> Source to load from
11758/// jpegload_source_options: `&JpegloadSourceOptions` -> optional arguments
11759/// returns `VipsImage` - Output image
11760pub fn jpegload_source_with_opts(
11761    source: &VipsSource,
11762    jpegload_source_options: &JpegloadSourceOptions,
11763) -> Result<VipsImage> {
11764    unsafe {
11765        let source_in: *mut bindings::VipsSource = source.ctx;
11766        let mut out_out: *mut bindings::VipsImage = null_mut();
11767
11768        let shrink_in: i32 = jpegload_source_options.shrink;
11769        let shrink_in_name = utils::new_c_string("shrink")?;
11770
11771        let autorotate_in: i32 = if jpegload_source_options.autorotate {
11772            1
11773        } else {
11774            0
11775        };
11776        let autorotate_in_name = utils::new_c_string("autorotate")?;
11777
11778        let unlimited_in: i32 = if jpegload_source_options.unlimited {
11779            1
11780        } else {
11781            0
11782        };
11783        let unlimited_in_name = utils::new_c_string("unlimited")?;
11784
11785        let flags_in: i32 = jpegload_source_options.flags as i32;
11786        let flags_in_name = utils::new_c_string("flags")?;
11787
11788        let memory_in: i32 = if jpegload_source_options.memory { 1 } else { 0 };
11789        let memory_in_name = utils::new_c_string("memory")?;
11790
11791        let access_in: i32 = jpegload_source_options.access as i32;
11792        let access_in_name = utils::new_c_string("access")?;
11793
11794        let fail_on_in: i32 = jpegload_source_options.fail_on as i32;
11795        let fail_on_in_name = utils::new_c_string("fail-on")?;
11796
11797        let revalidate_in: i32 = if jpegload_source_options.revalidate {
11798            1
11799        } else {
11800            0
11801        };
11802        let revalidate_in_name = utils::new_c_string("revalidate")?;
11803
11804        let vips_op_response = bindings::vips_jpegload_source(
11805            source_in,
11806            &mut out_out,
11807            shrink_in_name.as_ptr(),
11808            shrink_in,
11809            autorotate_in_name.as_ptr(),
11810            autorotate_in,
11811            unlimited_in_name.as_ptr(),
11812            unlimited_in,
11813            flags_in_name.as_ptr(),
11814            flags_in,
11815            memory_in_name.as_ptr(),
11816            memory_in,
11817            access_in_name.as_ptr(),
11818            access_in,
11819            fail_on_in_name.as_ptr(),
11820            fail_on_in,
11821            revalidate_in_name.as_ptr(),
11822            revalidate_in,
11823            NULL,
11824        );
11825        utils::result(
11826            vips_op_response,
11827            VipsImage { ctx: out_out },
11828            Error::JpegloadSourceError,
11829        )
11830    }
11831}
11832
11833/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11834/// filename: `&str` -> Filename to load from
11835/// returns `VipsImage` - Output image
11836pub fn webpload(filename: &str) -> Result<VipsImage> {
11837    unsafe {
11838        let filename_in: CString = utils::new_c_string(filename)?;
11839        let mut out_out: *mut bindings::VipsImage = null_mut();
11840
11841        let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11842        utils::result(
11843            vips_op_response,
11844            VipsImage { ctx: out_out },
11845            Error::WebploadError,
11846        )
11847    }
11848}
11849
11850/// Options for webpload operation
11851#[derive(Clone, Debug)]
11852pub struct WebploadOptions {
11853    /// page: `i32` -> First page to load
11854    /// min: 0, max: 100000, default: 0
11855    pub page: i32,
11856    /// n: `i32` -> Number of pages to load, -1 for all
11857    /// min: -1, max: 100000, default: 1
11858    pub n: i32,
11859    /// scale: `f64` -> Factor to scale by
11860    /// min: 0, max: 1024, default: 1
11861    pub scale: f64,
11862    /// flags: `ForeignFlags` -> Flags for this file
11863    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11864    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
11865    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
11866    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
11867    ///  `All` -> VIPS_FOREIGN_ALL = 7
11868    pub flags: ForeignFlags,
11869    /// memory: `bool` -> Force open via memory
11870    /// default: false
11871    pub memory: bool,
11872    /// access: `Access` -> Required access pattern for this file
11873    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
11874    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
11875    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
11876    ///  `Last` -> VIPS_ACCESS_LAST = 3
11877    pub access: Access,
11878    /// fail_on: `FailOn` -> Error level to fail on
11879    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
11880    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
11881    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
11882    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
11883    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
11884    pub fail_on: FailOn,
11885    /// revalidate: `bool` -> Don't use a cached result for this operation
11886    /// default: false
11887    pub revalidate: bool,
11888}
11889
11890impl std::default::Default for WebploadOptions {
11891    fn default() -> Self {
11892        WebploadOptions {
11893            page: i32::from(0),
11894            n: i32::from(1),
11895            scale: f64::from(1),
11896            flags: ForeignFlags::None,
11897            memory: false,
11898            access: Access::Random,
11899            fail_on: FailOn::None,
11900            revalidate: false,
11901        }
11902    }
11903}
11904
11905/// VipsForeignLoadWebpFile (webpload), load webp from file (.webp), priority=200, is_a, get_flags, get_flags_filename, header, load
11906/// filename: `&str` -> Filename to load from
11907/// webpload_options: `&WebploadOptions` -> optional arguments
11908/// returns `VipsImage` - Output image
11909pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11910    unsafe {
11911        let filename_in: CString = utils::new_c_string(filename)?;
11912        let mut out_out: *mut bindings::VipsImage = null_mut();
11913
11914        let page_in: i32 = webpload_options.page;
11915        let page_in_name = utils::new_c_string("page")?;
11916
11917        let n_in: i32 = webpload_options.n;
11918        let n_in_name = utils::new_c_string("n")?;
11919
11920        let scale_in: f64 = webpload_options.scale;
11921        let scale_in_name = utils::new_c_string("scale")?;
11922
11923        let flags_in: i32 = webpload_options.flags as i32;
11924        let flags_in_name = utils::new_c_string("flags")?;
11925
11926        let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11927        let memory_in_name = utils::new_c_string("memory")?;
11928
11929        let access_in: i32 = webpload_options.access as i32;
11930        let access_in_name = utils::new_c_string("access")?;
11931
11932        let fail_on_in: i32 = webpload_options.fail_on as i32;
11933        let fail_on_in_name = utils::new_c_string("fail-on")?;
11934
11935        let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11936        let revalidate_in_name = utils::new_c_string("revalidate")?;
11937
11938        let vips_op_response = bindings::vips_webpload(
11939            filename_in.as_ptr(),
11940            &mut out_out,
11941            page_in_name.as_ptr(),
11942            page_in,
11943            n_in_name.as_ptr(),
11944            n_in,
11945            scale_in_name.as_ptr(),
11946            scale_in,
11947            flags_in_name.as_ptr(),
11948            flags_in,
11949            memory_in_name.as_ptr(),
11950            memory_in,
11951            access_in_name.as_ptr(),
11952            access_in,
11953            fail_on_in_name.as_ptr(),
11954            fail_on_in,
11955            revalidate_in_name.as_ptr(),
11956            revalidate_in,
11957            NULL,
11958        );
11959        utils::result(
11960            vips_op_response,
11961            VipsImage { ctx: out_out },
11962            Error::WebploadError,
11963        )
11964    }
11965}
11966
11967/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
11968/// buffer: `&[u8]` -> Buffer to load from
11969/// returns `VipsImage` - Output image
11970pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11971    unsafe {
11972        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11973        let mut out_out: *mut bindings::VipsImage = null_mut();
11974
11975        let vips_op_response =
11976            bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11977        utils::result(
11978            vips_op_response,
11979            VipsImage { ctx: out_out },
11980            Error::WebploadBufferError,
11981        )
11982    }
11983}
11984
11985/// Options for webpload_buffer operation
11986#[derive(Clone, Debug)]
11987pub struct WebploadBufferOptions {
11988    /// page: `i32` -> First page to load
11989    /// min: 0, max: 100000, default: 0
11990    pub page: i32,
11991    /// n: `i32` -> Number of pages to load, -1 for all
11992    /// min: -1, max: 100000, default: 1
11993    pub n: i32,
11994    /// scale: `f64` -> Factor to scale by
11995    /// min: 0, max: 1024, default: 1
11996    pub scale: f64,
11997    /// flags: `ForeignFlags` -> Flags for this file
11998    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
11999    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12000    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12001    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12002    ///  `All` -> VIPS_FOREIGN_ALL = 7
12003    pub flags: ForeignFlags,
12004    /// memory: `bool` -> Force open via memory
12005    /// default: false
12006    pub memory: bool,
12007    /// access: `Access` -> Required access pattern for this file
12008    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12009    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12010    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12011    ///  `Last` -> VIPS_ACCESS_LAST = 3
12012    pub access: Access,
12013    /// fail_on: `FailOn` -> Error level to fail on
12014    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12015    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12016    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12017    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12018    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12019    pub fail_on: FailOn,
12020    /// revalidate: `bool` -> Don't use a cached result for this operation
12021    /// default: false
12022    pub revalidate: bool,
12023}
12024
12025impl std::default::Default for WebploadBufferOptions {
12026    fn default() -> Self {
12027        WebploadBufferOptions {
12028            page: i32::from(0),
12029            n: i32::from(1),
12030            scale: f64::from(1),
12031            flags: ForeignFlags::None,
12032            memory: false,
12033            access: Access::Random,
12034            fail_on: FailOn::None,
12035            revalidate: false,
12036        }
12037    }
12038}
12039
12040/// VipsForeignLoadWebpBuffer (webpload_buffer), load webp from buffer, priority=200, is_a_buffer, get_flags, get_flags_filename, header, load
12041/// buffer: `&[u8]` -> Buffer to load from
12042/// webpload_buffer_options: `&WebploadBufferOptions` -> optional arguments
12043/// returns `VipsImage` - Output image
12044pub fn webpload_buffer_with_opts(
12045    buffer: &[u8],
12046    webpload_buffer_options: &WebploadBufferOptions,
12047) -> Result<VipsImage> {
12048    unsafe {
12049        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12050        let mut out_out: *mut bindings::VipsImage = null_mut();
12051
12052        let page_in: i32 = webpload_buffer_options.page;
12053        let page_in_name = utils::new_c_string("page")?;
12054
12055        let n_in: i32 = webpload_buffer_options.n;
12056        let n_in_name = utils::new_c_string("n")?;
12057
12058        let scale_in: f64 = webpload_buffer_options.scale;
12059        let scale_in_name = utils::new_c_string("scale")?;
12060
12061        let flags_in: i32 = webpload_buffer_options.flags as i32;
12062        let flags_in_name = utils::new_c_string("flags")?;
12063
12064        let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
12065        let memory_in_name = utils::new_c_string("memory")?;
12066
12067        let access_in: i32 = webpload_buffer_options.access as i32;
12068        let access_in_name = utils::new_c_string("access")?;
12069
12070        let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
12071        let fail_on_in_name = utils::new_c_string("fail-on")?;
12072
12073        let revalidate_in: i32 = if webpload_buffer_options.revalidate {
12074            1
12075        } else {
12076            0
12077        };
12078        let revalidate_in_name = utils::new_c_string("revalidate")?;
12079
12080        let vips_op_response = bindings::vips_webpload_buffer(
12081            buffer_in,
12082            buffer.len() as u64,
12083            &mut out_out,
12084            page_in_name.as_ptr(),
12085            page_in,
12086            n_in_name.as_ptr(),
12087            n_in,
12088            scale_in_name.as_ptr(),
12089            scale_in,
12090            flags_in_name.as_ptr(),
12091            flags_in,
12092            memory_in_name.as_ptr(),
12093            memory_in,
12094            access_in_name.as_ptr(),
12095            access_in,
12096            fail_on_in_name.as_ptr(),
12097            fail_on_in,
12098            revalidate_in_name.as_ptr(),
12099            revalidate_in,
12100            NULL,
12101        );
12102        utils::result(
12103            vips_op_response,
12104            VipsImage { ctx: out_out },
12105            Error::WebploadBufferError,
12106        )
12107    }
12108}
12109
12110/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
12111/// source: `&VipsSource` -> Source to load from
12112/// returns `VipsImage` - Output image
12113pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
12114    unsafe {
12115        let source_in: *mut bindings::VipsSource = source.ctx;
12116        let mut out_out: *mut bindings::VipsImage = null_mut();
12117
12118        let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
12119        utils::result(
12120            vips_op_response,
12121            VipsImage { ctx: out_out },
12122            Error::WebploadSourceError,
12123        )
12124    }
12125}
12126
12127/// Options for webpload_source operation
12128#[derive(Clone, Debug)]
12129pub struct WebploadSourceOptions {
12130    /// page: `i32` -> First page to load
12131    /// min: 0, max: 100000, default: 0
12132    pub page: i32,
12133    /// n: `i32` -> Number of pages to load, -1 for all
12134    /// min: -1, max: 100000, default: 1
12135    pub n: i32,
12136    /// scale: `f64` -> Factor to scale by
12137    /// min: 0, max: 1024, default: 1
12138    pub scale: f64,
12139    /// flags: `ForeignFlags` -> Flags for this file
12140    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12141    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12142    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12143    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12144    ///  `All` -> VIPS_FOREIGN_ALL = 7
12145    pub flags: ForeignFlags,
12146    /// memory: `bool` -> Force open via memory
12147    /// default: false
12148    pub memory: bool,
12149    /// access: `Access` -> Required access pattern for this file
12150    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12151    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12152    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12153    ///  `Last` -> VIPS_ACCESS_LAST = 3
12154    pub access: Access,
12155    /// fail_on: `FailOn` -> Error level to fail on
12156    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12157    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12158    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12159    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12160    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12161    pub fail_on: FailOn,
12162    /// revalidate: `bool` -> Don't use a cached result for this operation
12163    /// default: false
12164    pub revalidate: bool,
12165}
12166
12167impl std::default::Default for WebploadSourceOptions {
12168    fn default() -> Self {
12169        WebploadSourceOptions {
12170            page: i32::from(0),
12171            n: i32::from(1),
12172            scale: f64::from(1),
12173            flags: ForeignFlags::None,
12174            memory: false,
12175            access: Access::Random,
12176            fail_on: FailOn::None,
12177            revalidate: false,
12178        }
12179    }
12180}
12181
12182/// VipsForeignLoadWebpSource (webpload_source), load webp from source, priority=200, is_a_source, get_flags, get_flags_filename, header, load
12183/// source: `&VipsSource` -> Source to load from
12184/// webpload_source_options: `&WebploadSourceOptions` -> optional arguments
12185/// returns `VipsImage` - Output image
12186pub fn webpload_source_with_opts(
12187    source: &VipsSource,
12188    webpload_source_options: &WebploadSourceOptions,
12189) -> Result<VipsImage> {
12190    unsafe {
12191        let source_in: *mut bindings::VipsSource = source.ctx;
12192        let mut out_out: *mut bindings::VipsImage = null_mut();
12193
12194        let page_in: i32 = webpload_source_options.page;
12195        let page_in_name = utils::new_c_string("page")?;
12196
12197        let n_in: i32 = webpload_source_options.n;
12198        let n_in_name = utils::new_c_string("n")?;
12199
12200        let scale_in: f64 = webpload_source_options.scale;
12201        let scale_in_name = utils::new_c_string("scale")?;
12202
12203        let flags_in: i32 = webpload_source_options.flags as i32;
12204        let flags_in_name = utils::new_c_string("flags")?;
12205
12206        let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
12207        let memory_in_name = utils::new_c_string("memory")?;
12208
12209        let access_in: i32 = webpload_source_options.access as i32;
12210        let access_in_name = utils::new_c_string("access")?;
12211
12212        let fail_on_in: i32 = webpload_source_options.fail_on as i32;
12213        let fail_on_in_name = utils::new_c_string("fail-on")?;
12214
12215        let revalidate_in: i32 = if webpload_source_options.revalidate {
12216            1
12217        } else {
12218            0
12219        };
12220        let revalidate_in_name = utils::new_c_string("revalidate")?;
12221
12222        let vips_op_response = bindings::vips_webpload_source(
12223            source_in,
12224            &mut out_out,
12225            page_in_name.as_ptr(),
12226            page_in,
12227            n_in_name.as_ptr(),
12228            n_in,
12229            scale_in_name.as_ptr(),
12230            scale_in,
12231            flags_in_name.as_ptr(),
12232            flags_in,
12233            memory_in_name.as_ptr(),
12234            memory_in,
12235            access_in_name.as_ptr(),
12236            access_in,
12237            fail_on_in_name.as_ptr(),
12238            fail_on_in,
12239            revalidate_in_name.as_ptr(),
12240            revalidate_in,
12241            NULL,
12242        );
12243        utils::result(
12244            vips_op_response,
12245            VipsImage { ctx: out_out },
12246            Error::WebploadSourceError,
12247        )
12248    }
12249}
12250
12251/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
12252/// filename: `&str` -> Filename to load from
12253/// returns `VipsImage` - Output image
12254pub fn tiffload(filename: &str) -> Result<VipsImage> {
12255    unsafe {
12256        let filename_in: CString = utils::new_c_string(filename)?;
12257        let mut out_out: *mut bindings::VipsImage = null_mut();
12258
12259        let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
12260        utils::result(
12261            vips_op_response,
12262            VipsImage { ctx: out_out },
12263            Error::TiffloadError,
12264        )
12265    }
12266}
12267
12268/// Options for tiffload operation
12269#[derive(Clone, Debug)]
12270pub struct TiffloadOptions {
12271    /// page: `i32` -> First page to load
12272    /// min: 0, max: 100000, default: 0
12273    pub page: i32,
12274    /// subifd: `i32` -> Subifd index
12275    /// min: -1, max: 100000, default: -1
12276    pub subifd: i32,
12277    /// n: `i32` -> Number of pages to load, -1 for all
12278    /// min: -1, max: 100000, default: 1
12279    pub n: i32,
12280    /// autorotate: `bool` -> Rotate image using orientation tag
12281    /// default: false
12282    pub autorotate: bool,
12283    /// flags: `ForeignFlags` -> Flags for this file
12284    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12285    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12286    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12287    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12288    ///  `All` -> VIPS_FOREIGN_ALL = 7
12289    pub flags: ForeignFlags,
12290    /// memory: `bool` -> Force open via memory
12291    /// default: false
12292    pub memory: bool,
12293    /// access: `Access` -> Required access pattern for this file
12294    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12295    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12296    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12297    ///  `Last` -> VIPS_ACCESS_LAST = 3
12298    pub access: Access,
12299    /// fail_on: `FailOn` -> Error level to fail on
12300    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12301    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12302    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12303    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12304    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12305    pub fail_on: FailOn,
12306    /// revalidate: `bool` -> Don't use a cached result for this operation
12307    /// default: false
12308    pub revalidate: bool,
12309}
12310
12311impl std::default::Default for TiffloadOptions {
12312    fn default() -> Self {
12313        TiffloadOptions {
12314            page: i32::from(0),
12315            subifd: i32::from(-1),
12316            n: i32::from(1),
12317            autorotate: false,
12318            flags: ForeignFlags::None,
12319            memory: false,
12320            access: Access::Random,
12321            fail_on: FailOn::None,
12322            revalidate: false,
12323        }
12324    }
12325}
12326
12327/// VipsForeignLoadTiffFile (tiffload), load tiff from file (.tif, .tiff), priority=50, is_a, get_flags, get_flags_filename, header, load
12328/// filename: `&str` -> Filename to load from
12329/// tiffload_options: `&TiffloadOptions` -> optional arguments
12330/// returns `VipsImage` - Output image
12331pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
12332    unsafe {
12333        let filename_in: CString = utils::new_c_string(filename)?;
12334        let mut out_out: *mut bindings::VipsImage = null_mut();
12335
12336        let page_in: i32 = tiffload_options.page;
12337        let page_in_name = utils::new_c_string("page")?;
12338
12339        let subifd_in: i32 = tiffload_options.subifd;
12340        let subifd_in_name = utils::new_c_string("subifd")?;
12341
12342        let n_in: i32 = tiffload_options.n;
12343        let n_in_name = utils::new_c_string("n")?;
12344
12345        let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
12346        let autorotate_in_name = utils::new_c_string("autorotate")?;
12347
12348        let flags_in: i32 = tiffload_options.flags as i32;
12349        let flags_in_name = utils::new_c_string("flags")?;
12350
12351        let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
12352        let memory_in_name = utils::new_c_string("memory")?;
12353
12354        let access_in: i32 = tiffload_options.access as i32;
12355        let access_in_name = utils::new_c_string("access")?;
12356
12357        let fail_on_in: i32 = tiffload_options.fail_on as i32;
12358        let fail_on_in_name = utils::new_c_string("fail-on")?;
12359
12360        let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
12361        let revalidate_in_name = utils::new_c_string("revalidate")?;
12362
12363        let vips_op_response = bindings::vips_tiffload(
12364            filename_in.as_ptr(),
12365            &mut out_out,
12366            page_in_name.as_ptr(),
12367            page_in,
12368            subifd_in_name.as_ptr(),
12369            subifd_in,
12370            n_in_name.as_ptr(),
12371            n_in,
12372            autorotate_in_name.as_ptr(),
12373            autorotate_in,
12374            flags_in_name.as_ptr(),
12375            flags_in,
12376            memory_in_name.as_ptr(),
12377            memory_in,
12378            access_in_name.as_ptr(),
12379            access_in,
12380            fail_on_in_name.as_ptr(),
12381            fail_on_in,
12382            revalidate_in_name.as_ptr(),
12383            revalidate_in,
12384            NULL,
12385        );
12386        utils::result(
12387            vips_op_response,
12388            VipsImage { ctx: out_out },
12389            Error::TiffloadError,
12390        )
12391    }
12392}
12393
12394/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
12395/// buffer: `&[u8]` -> Buffer to load from
12396/// returns `VipsImage` - Output image
12397pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12398    unsafe {
12399        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12400        let mut out_out: *mut bindings::VipsImage = null_mut();
12401
12402        let vips_op_response =
12403            bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12404        utils::result(
12405            vips_op_response,
12406            VipsImage { ctx: out_out },
12407            Error::TiffloadBufferError,
12408        )
12409    }
12410}
12411
12412/// Options for tiffload_buffer operation
12413#[derive(Clone, Debug)]
12414pub struct TiffloadBufferOptions {
12415    /// page: `i32` -> First page to load
12416    /// min: 0, max: 100000, default: 0
12417    pub page: i32,
12418    /// subifd: `i32` -> Subifd index
12419    /// min: -1, max: 100000, default: -1
12420    pub subifd: i32,
12421    /// n: `i32` -> Number of pages to load, -1 for all
12422    /// min: -1, max: 100000, default: 1
12423    pub n: i32,
12424    /// autorotate: `bool` -> Rotate image using orientation tag
12425    /// default: false
12426    pub autorotate: bool,
12427    /// flags: `ForeignFlags` -> Flags for this file
12428    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12429    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12430    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12431    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12432    ///  `All` -> VIPS_FOREIGN_ALL = 7
12433    pub flags: ForeignFlags,
12434    /// memory: `bool` -> Force open via memory
12435    /// default: false
12436    pub memory: bool,
12437    /// access: `Access` -> Required access pattern for this file
12438    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12439    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12440    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12441    ///  `Last` -> VIPS_ACCESS_LAST = 3
12442    pub access: Access,
12443    /// fail_on: `FailOn` -> Error level to fail on
12444    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12445    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12446    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12447    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12448    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12449    pub fail_on: FailOn,
12450    /// revalidate: `bool` -> Don't use a cached result for this operation
12451    /// default: false
12452    pub revalidate: bool,
12453}
12454
12455impl std::default::Default for TiffloadBufferOptions {
12456    fn default() -> Self {
12457        TiffloadBufferOptions {
12458            page: i32::from(0),
12459            subifd: i32::from(-1),
12460            n: i32::from(1),
12461            autorotate: false,
12462            flags: ForeignFlags::None,
12463            memory: false,
12464            access: Access::Random,
12465            fail_on: FailOn::None,
12466            revalidate: false,
12467        }
12468    }
12469}
12470
12471/// VipsForeignLoadTiffBuffer (tiffload_buffer), load tiff from buffer, priority=50, is_a_buffer, get_flags, get_flags_filename, header, load
12472/// buffer: `&[u8]` -> Buffer to load from
12473/// tiffload_buffer_options: `&TiffloadBufferOptions` -> optional arguments
12474/// returns `VipsImage` - Output image
12475pub fn tiffload_buffer_with_opts(
12476    buffer: &[u8],
12477    tiffload_buffer_options: &TiffloadBufferOptions,
12478) -> Result<VipsImage> {
12479    unsafe {
12480        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12481        let mut out_out: *mut bindings::VipsImage = null_mut();
12482
12483        let page_in: i32 = tiffload_buffer_options.page;
12484        let page_in_name = utils::new_c_string("page")?;
12485
12486        let subifd_in: i32 = tiffload_buffer_options.subifd;
12487        let subifd_in_name = utils::new_c_string("subifd")?;
12488
12489        let n_in: i32 = tiffload_buffer_options.n;
12490        let n_in_name = utils::new_c_string("n")?;
12491
12492        let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
12493            1
12494        } else {
12495            0
12496        };
12497        let autorotate_in_name = utils::new_c_string("autorotate")?;
12498
12499        let flags_in: i32 = tiffload_buffer_options.flags as i32;
12500        let flags_in_name = utils::new_c_string("flags")?;
12501
12502        let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
12503        let memory_in_name = utils::new_c_string("memory")?;
12504
12505        let access_in: i32 = tiffload_buffer_options.access as i32;
12506        let access_in_name = utils::new_c_string("access")?;
12507
12508        let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
12509        let fail_on_in_name = utils::new_c_string("fail-on")?;
12510
12511        let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
12512            1
12513        } else {
12514            0
12515        };
12516        let revalidate_in_name = utils::new_c_string("revalidate")?;
12517
12518        let vips_op_response = bindings::vips_tiffload_buffer(
12519            buffer_in,
12520            buffer.len() as u64,
12521            &mut out_out,
12522            page_in_name.as_ptr(),
12523            page_in,
12524            subifd_in_name.as_ptr(),
12525            subifd_in,
12526            n_in_name.as_ptr(),
12527            n_in,
12528            autorotate_in_name.as_ptr(),
12529            autorotate_in,
12530            flags_in_name.as_ptr(),
12531            flags_in,
12532            memory_in_name.as_ptr(),
12533            memory_in,
12534            access_in_name.as_ptr(),
12535            access_in,
12536            fail_on_in_name.as_ptr(),
12537            fail_on_in,
12538            revalidate_in_name.as_ptr(),
12539            revalidate_in,
12540            NULL,
12541        );
12542        utils::result(
12543            vips_op_response,
12544            VipsImage { ctx: out_out },
12545            Error::TiffloadBufferError,
12546        )
12547    }
12548}
12549
12550/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12551/// source: `&VipsSource` -> Source to load from
12552/// returns `VipsImage` - Output image
12553pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
12554    unsafe {
12555        let source_in: *mut bindings::VipsSource = source.ctx;
12556        let mut out_out: *mut bindings::VipsImage = null_mut();
12557
12558        let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
12559        utils::result(
12560            vips_op_response,
12561            VipsImage { ctx: out_out },
12562            Error::TiffloadSourceError,
12563        )
12564    }
12565}
12566
12567/// Options for tiffload_source operation
12568#[derive(Clone, Debug)]
12569pub struct TiffloadSourceOptions {
12570    /// page: `i32` -> First page to load
12571    /// min: 0, max: 100000, default: 0
12572    pub page: i32,
12573    /// subifd: `i32` -> Subifd index
12574    /// min: -1, max: 100000, default: -1
12575    pub subifd: i32,
12576    /// n: `i32` -> Number of pages to load, -1 for all
12577    /// min: -1, max: 100000, default: 1
12578    pub n: i32,
12579    /// autorotate: `bool` -> Rotate image using orientation tag
12580    /// default: false
12581    pub autorotate: bool,
12582    /// flags: `ForeignFlags` -> Flags for this file
12583    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12584    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12585    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12586    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12587    ///  `All` -> VIPS_FOREIGN_ALL = 7
12588    pub flags: ForeignFlags,
12589    /// memory: `bool` -> Force open via memory
12590    /// default: false
12591    pub memory: bool,
12592    /// access: `Access` -> Required access pattern for this file
12593    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12594    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12595    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12596    ///  `Last` -> VIPS_ACCESS_LAST = 3
12597    pub access: Access,
12598    /// fail_on: `FailOn` -> Error level to fail on
12599    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12600    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12601    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12602    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12603    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12604    pub fail_on: FailOn,
12605    /// revalidate: `bool` -> Don't use a cached result for this operation
12606    /// default: false
12607    pub revalidate: bool,
12608}
12609
12610impl std::default::Default for TiffloadSourceOptions {
12611    fn default() -> Self {
12612        TiffloadSourceOptions {
12613            page: i32::from(0),
12614            subifd: i32::from(-1),
12615            n: i32::from(1),
12616            autorotate: false,
12617            flags: ForeignFlags::None,
12618            memory: false,
12619            access: Access::Random,
12620            fail_on: FailOn::None,
12621            revalidate: false,
12622        }
12623    }
12624}
12625
12626/// VipsForeignLoadTiffSource (tiffload_source), load tiff from source, priority=50, is_a_source, get_flags, get_flags_filename, header, load
12627/// source: `&VipsSource` -> Source to load from
12628/// tiffload_source_options: `&TiffloadSourceOptions` -> optional arguments
12629/// returns `VipsImage` - Output image
12630pub fn tiffload_source_with_opts(
12631    source: &VipsSource,
12632    tiffload_source_options: &TiffloadSourceOptions,
12633) -> Result<VipsImage> {
12634    unsafe {
12635        let source_in: *mut bindings::VipsSource = source.ctx;
12636        let mut out_out: *mut bindings::VipsImage = null_mut();
12637
12638        let page_in: i32 = tiffload_source_options.page;
12639        let page_in_name = utils::new_c_string("page")?;
12640
12641        let subifd_in: i32 = tiffload_source_options.subifd;
12642        let subifd_in_name = utils::new_c_string("subifd")?;
12643
12644        let n_in: i32 = tiffload_source_options.n;
12645        let n_in_name = utils::new_c_string("n")?;
12646
12647        let autorotate_in: i32 = if tiffload_source_options.autorotate {
12648            1
12649        } else {
12650            0
12651        };
12652        let autorotate_in_name = utils::new_c_string("autorotate")?;
12653
12654        let flags_in: i32 = tiffload_source_options.flags as i32;
12655        let flags_in_name = utils::new_c_string("flags")?;
12656
12657        let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12658        let memory_in_name = utils::new_c_string("memory")?;
12659
12660        let access_in: i32 = tiffload_source_options.access as i32;
12661        let access_in_name = utils::new_c_string("access")?;
12662
12663        let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12664        let fail_on_in_name = utils::new_c_string("fail-on")?;
12665
12666        let revalidate_in: i32 = if tiffload_source_options.revalidate {
12667            1
12668        } else {
12669            0
12670        };
12671        let revalidate_in_name = utils::new_c_string("revalidate")?;
12672
12673        let vips_op_response = bindings::vips_tiffload_source(
12674            source_in,
12675            &mut out_out,
12676            page_in_name.as_ptr(),
12677            page_in,
12678            subifd_in_name.as_ptr(),
12679            subifd_in,
12680            n_in_name.as_ptr(),
12681            n_in,
12682            autorotate_in_name.as_ptr(),
12683            autorotate_in,
12684            flags_in_name.as_ptr(),
12685            flags_in,
12686            memory_in_name.as_ptr(),
12687            memory_in,
12688            access_in_name.as_ptr(),
12689            access_in,
12690            fail_on_in_name.as_ptr(),
12691            fail_on_in,
12692            revalidate_in_name.as_ptr(),
12693            revalidate_in,
12694            NULL,
12695        );
12696        utils::result(
12697            vips_op_response,
12698            VipsImage { ctx: out_out },
12699            Error::TiffloadSourceError,
12700        )
12701    }
12702}
12703
12704/// VipsForeignLoadFitsFile (fitsload), load a FITS image (.fits, .fit, .fts), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
12705/// filename: `&str` -> Filename to load from
12706/// returns `VipsImage` - Output image
12707pub fn fitsload(filename: &str) -> Result<VipsImage> {
12708    unsafe {
12709        let filename_in: CString = utils::new_c_string(filename)?;
12710        let mut out_out: *mut bindings::VipsImage = null_mut();
12711
12712        let vips_op_response = bindings::vips_fitsload(filename_in.as_ptr(), &mut out_out, NULL);
12713        utils::result(
12714            vips_op_response,
12715            VipsImage { ctx: out_out },
12716            Error::FitsloadError,
12717        )
12718    }
12719}
12720
12721/// Options for fitsload operation
12722#[derive(Clone, Debug)]
12723pub struct FitsloadOptions {
12724    /// flags: `ForeignFlags` -> Flags for this file
12725    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12726    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12727    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12728    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12729    ///  `All` -> VIPS_FOREIGN_ALL = 7
12730    pub flags: ForeignFlags,
12731    /// memory: `bool` -> Force open via memory
12732    /// default: false
12733    pub memory: bool,
12734    /// access: `Access` -> Required access pattern for this file
12735    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12736    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12737    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12738    ///  `Last` -> VIPS_ACCESS_LAST = 3
12739    pub access: Access,
12740    /// fail_on: `FailOn` -> Error level to fail on
12741    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12742    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12743    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12744    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12745    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12746    pub fail_on: FailOn,
12747    /// revalidate: `bool` -> Don't use a cached result for this operation
12748    /// default: false
12749    pub revalidate: bool,
12750}
12751
12752impl std::default::Default for FitsloadOptions {
12753    fn default() -> Self {
12754        FitsloadOptions {
12755            flags: ForeignFlags::None,
12756            memory: false,
12757            access: Access::Random,
12758            fail_on: FailOn::None,
12759            revalidate: false,
12760        }
12761    }
12762}
12763
12764/// VipsForeignLoadFitsFile (fitsload), load a FITS image (.fits, .fit, .fts), priority=-50, untrusted, is_a, get_flags, get_flags_filename, header, load
12765/// filename: `&str` -> Filename to load from
12766/// fitsload_options: `&FitsloadOptions` -> optional arguments
12767/// returns `VipsImage` - Output image
12768pub fn fitsload_with_opts(filename: &str, fitsload_options: &FitsloadOptions) -> Result<VipsImage> {
12769    unsafe {
12770        let filename_in: CString = utils::new_c_string(filename)?;
12771        let mut out_out: *mut bindings::VipsImage = null_mut();
12772
12773        let flags_in: i32 = fitsload_options.flags as i32;
12774        let flags_in_name = utils::new_c_string("flags")?;
12775
12776        let memory_in: i32 = if fitsload_options.memory { 1 } else { 0 };
12777        let memory_in_name = utils::new_c_string("memory")?;
12778
12779        let access_in: i32 = fitsload_options.access as i32;
12780        let access_in_name = utils::new_c_string("access")?;
12781
12782        let fail_on_in: i32 = fitsload_options.fail_on as i32;
12783        let fail_on_in_name = utils::new_c_string("fail-on")?;
12784
12785        let revalidate_in: i32 = if fitsload_options.revalidate { 1 } else { 0 };
12786        let revalidate_in_name = utils::new_c_string("revalidate")?;
12787
12788        let vips_op_response = bindings::vips_fitsload(
12789            filename_in.as_ptr(),
12790            &mut out_out,
12791            flags_in_name.as_ptr(),
12792            flags_in,
12793            memory_in_name.as_ptr(),
12794            memory_in,
12795            access_in_name.as_ptr(),
12796            access_in,
12797            fail_on_in_name.as_ptr(),
12798            fail_on_in,
12799            revalidate_in_name.as_ptr(),
12800            revalidate_in,
12801            NULL,
12802        );
12803        utils::result(
12804            vips_op_response,
12805            VipsImage { ctx: out_out },
12806            Error::FitsloadError,
12807        )
12808    }
12809}
12810
12811/// VipsForeignLoadOpenexr (openexrload), load an OpenEXR image (.exr), priority=200, untrusted, is_a, get_flags, get_flags_filename, header, load
12812/// filename: `&str` -> Filename to load from
12813/// returns `VipsImage` - Output image
12814pub fn openexrload(filename: &str) -> Result<VipsImage> {
12815    unsafe {
12816        let filename_in: CString = utils::new_c_string(filename)?;
12817        let mut out_out: *mut bindings::VipsImage = null_mut();
12818
12819        let vips_op_response = bindings::vips_openexrload(filename_in.as_ptr(), &mut out_out, NULL);
12820        utils::result(
12821            vips_op_response,
12822            VipsImage { ctx: out_out },
12823            Error::OpenexrloadError,
12824        )
12825    }
12826}
12827
12828/// Options for openexrload operation
12829#[derive(Clone, Debug)]
12830pub struct OpenexrloadOptions {
12831    /// flags: `ForeignFlags` -> Flags for this file
12832    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12833    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12834    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12835    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12836    ///  `All` -> VIPS_FOREIGN_ALL = 7
12837    pub flags: ForeignFlags,
12838    /// memory: `bool` -> Force open via memory
12839    /// default: false
12840    pub memory: bool,
12841    /// access: `Access` -> Required access pattern for this file
12842    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12843    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12844    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12845    ///  `Last` -> VIPS_ACCESS_LAST = 3
12846    pub access: Access,
12847    /// fail_on: `FailOn` -> Error level to fail on
12848    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12849    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12850    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12851    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12852    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12853    pub fail_on: FailOn,
12854    /// revalidate: `bool` -> Don't use a cached result for this operation
12855    /// default: false
12856    pub revalidate: bool,
12857}
12858
12859impl std::default::Default for OpenexrloadOptions {
12860    fn default() -> Self {
12861        OpenexrloadOptions {
12862            flags: ForeignFlags::None,
12863            memory: false,
12864            access: Access::Random,
12865            fail_on: FailOn::None,
12866            revalidate: false,
12867        }
12868    }
12869}
12870
12871/// VipsForeignLoadOpenexr (openexrload), load an OpenEXR image (.exr), priority=200, untrusted, is_a, get_flags, get_flags_filename, header, load
12872/// filename: `&str` -> Filename to load from
12873/// openexrload_options: `&OpenexrloadOptions` -> optional arguments
12874/// returns `VipsImage` - Output image
12875pub fn openexrload_with_opts(
12876    filename: &str,
12877    openexrload_options: &OpenexrloadOptions,
12878) -> Result<VipsImage> {
12879    unsafe {
12880        let filename_in: CString = utils::new_c_string(filename)?;
12881        let mut out_out: *mut bindings::VipsImage = null_mut();
12882
12883        let flags_in: i32 = openexrload_options.flags as i32;
12884        let flags_in_name = utils::new_c_string("flags")?;
12885
12886        let memory_in: i32 = if openexrload_options.memory { 1 } else { 0 };
12887        let memory_in_name = utils::new_c_string("memory")?;
12888
12889        let access_in: i32 = openexrload_options.access as i32;
12890        let access_in_name = utils::new_c_string("access")?;
12891
12892        let fail_on_in: i32 = openexrload_options.fail_on as i32;
12893        let fail_on_in_name = utils::new_c_string("fail-on")?;
12894
12895        let revalidate_in: i32 = if openexrload_options.revalidate { 1 } else { 0 };
12896        let revalidate_in_name = utils::new_c_string("revalidate")?;
12897
12898        let vips_op_response = bindings::vips_openexrload(
12899            filename_in.as_ptr(),
12900            &mut out_out,
12901            flags_in_name.as_ptr(),
12902            flags_in,
12903            memory_in_name.as_ptr(),
12904            memory_in,
12905            access_in_name.as_ptr(),
12906            access_in,
12907            fail_on_in_name.as_ptr(),
12908            fail_on_in,
12909            revalidate_in_name.as_ptr(),
12910            revalidate_in,
12911            NULL,
12912        );
12913        utils::result(
12914            vips_op_response,
12915            VipsImage { ctx: out_out },
12916            Error::OpenexrloadError,
12917        )
12918    }
12919}
12920
12921/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12922/// filename: `&str` -> Filename to load from
12923/// returns `VipsImage` - Output image
12924pub fn heifload(filename: &str) -> Result<VipsImage> {
12925    unsafe {
12926        let filename_in: CString = utils::new_c_string(filename)?;
12927        let mut out_out: *mut bindings::VipsImage = null_mut();
12928
12929        let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12930        utils::result(
12931            vips_op_response,
12932            VipsImage { ctx: out_out },
12933            Error::HeifloadError,
12934        )
12935    }
12936}
12937
12938/// Options for heifload operation
12939#[derive(Clone, Debug)]
12940pub struct HeifloadOptions {
12941    /// page: `i32` -> First page to load
12942    /// min: 0, max: 100000, default: 0
12943    pub page: i32,
12944    /// n: `i32` -> Number of pages to load, -1 for all
12945    /// min: -1, max: 100000, default: 1
12946    pub n: i32,
12947    /// thumbnail: `bool` -> Fetch thumbnail image
12948    /// default: false
12949    pub thumbnail: bool,
12950    /// unlimited: `bool` -> Remove all denial of service limits
12951    /// default: false
12952    pub unlimited: bool,
12953    /// flags: `ForeignFlags` -> Flags for this file
12954    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
12955    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
12956    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
12957    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
12958    ///  `All` -> VIPS_FOREIGN_ALL = 7
12959    pub flags: ForeignFlags,
12960    /// memory: `bool` -> Force open via memory
12961    /// default: false
12962    pub memory: bool,
12963    /// access: `Access` -> Required access pattern for this file
12964    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
12965    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
12966    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
12967    ///  `Last` -> VIPS_ACCESS_LAST = 3
12968    pub access: Access,
12969    /// fail_on: `FailOn` -> Error level to fail on
12970    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
12971    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
12972    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
12973    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
12974    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
12975    pub fail_on: FailOn,
12976    /// revalidate: `bool` -> Don't use a cached result for this operation
12977    /// default: false
12978    pub revalidate: bool,
12979}
12980
12981impl std::default::Default for HeifloadOptions {
12982    fn default() -> Self {
12983        HeifloadOptions {
12984            page: i32::from(0),
12985            n: i32::from(1),
12986            thumbnail: false,
12987            unlimited: false,
12988            flags: ForeignFlags::None,
12989            memory: false,
12990            access: Access::Random,
12991            fail_on: FailOn::None,
12992            revalidate: false,
12993        }
12994    }
12995}
12996
12997/// VipsForeignLoadHeifFile (heifload), load a HEIF image (.heic, .heif, .avif), priority=0, is_a, get_flags, header, load
12998/// filename: `&str` -> Filename to load from
12999/// heifload_options: `&HeifloadOptions` -> optional arguments
13000/// returns `VipsImage` - Output image
13001pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
13002    unsafe {
13003        let filename_in: CString = utils::new_c_string(filename)?;
13004        let mut out_out: *mut bindings::VipsImage = null_mut();
13005
13006        let page_in: i32 = heifload_options.page;
13007        let page_in_name = utils::new_c_string("page")?;
13008
13009        let n_in: i32 = heifload_options.n;
13010        let n_in_name = utils::new_c_string("n")?;
13011
13012        let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
13013        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13014
13015        let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
13016        let unlimited_in_name = utils::new_c_string("unlimited")?;
13017
13018        let flags_in: i32 = heifload_options.flags as i32;
13019        let flags_in_name = utils::new_c_string("flags")?;
13020
13021        let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
13022        let memory_in_name = utils::new_c_string("memory")?;
13023
13024        let access_in: i32 = heifload_options.access as i32;
13025        let access_in_name = utils::new_c_string("access")?;
13026
13027        let fail_on_in: i32 = heifload_options.fail_on as i32;
13028        let fail_on_in_name = utils::new_c_string("fail-on")?;
13029
13030        let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
13031        let revalidate_in_name = utils::new_c_string("revalidate")?;
13032
13033        let vips_op_response = bindings::vips_heifload(
13034            filename_in.as_ptr(),
13035            &mut out_out,
13036            page_in_name.as_ptr(),
13037            page_in,
13038            n_in_name.as_ptr(),
13039            n_in,
13040            thumbnail_in_name.as_ptr(),
13041            thumbnail_in,
13042            unlimited_in_name.as_ptr(),
13043            unlimited_in,
13044            flags_in_name.as_ptr(),
13045            flags_in,
13046            memory_in_name.as_ptr(),
13047            memory_in,
13048            access_in_name.as_ptr(),
13049            access_in,
13050            fail_on_in_name.as_ptr(),
13051            fail_on_in,
13052            revalidate_in_name.as_ptr(),
13053            revalidate_in,
13054            NULL,
13055        );
13056        utils::result(
13057            vips_op_response,
13058            VipsImage { ctx: out_out },
13059            Error::HeifloadError,
13060        )
13061    }
13062}
13063
13064/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
13065/// buffer: `&[u8]` -> Buffer to load from
13066/// returns `VipsImage` - Output image
13067pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13068    unsafe {
13069        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13070        let mut out_out: *mut bindings::VipsImage = null_mut();
13071
13072        let vips_op_response =
13073            bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13074        utils::result(
13075            vips_op_response,
13076            VipsImage { ctx: out_out },
13077            Error::HeifloadBufferError,
13078        )
13079    }
13080}
13081
13082/// Options for heifload_buffer operation
13083#[derive(Clone, Debug)]
13084pub struct HeifloadBufferOptions {
13085    /// page: `i32` -> First page to load
13086    /// min: 0, max: 100000, default: 0
13087    pub page: i32,
13088    /// n: `i32` -> Number of pages to load, -1 for all
13089    /// min: -1, max: 100000, default: 1
13090    pub n: i32,
13091    /// thumbnail: `bool` -> Fetch thumbnail image
13092    /// default: false
13093    pub thumbnail: bool,
13094    /// unlimited: `bool` -> Remove all denial of service limits
13095    /// default: false
13096    pub unlimited: bool,
13097    /// flags: `ForeignFlags` -> Flags for this file
13098    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13099    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13100    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13101    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13102    ///  `All` -> VIPS_FOREIGN_ALL = 7
13103    pub flags: ForeignFlags,
13104    /// memory: `bool` -> Force open via memory
13105    /// default: false
13106    pub memory: bool,
13107    /// access: `Access` -> Required access pattern for this file
13108    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13109    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13110    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13111    ///  `Last` -> VIPS_ACCESS_LAST = 3
13112    pub access: Access,
13113    /// fail_on: `FailOn` -> Error level to fail on
13114    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13115    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13116    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13117    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13118    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13119    pub fail_on: FailOn,
13120    /// revalidate: `bool` -> Don't use a cached result for this operation
13121    /// default: false
13122    pub revalidate: bool,
13123}
13124
13125impl std::default::Default for HeifloadBufferOptions {
13126    fn default() -> Self {
13127        HeifloadBufferOptions {
13128            page: i32::from(0),
13129            n: i32::from(1),
13130            thumbnail: false,
13131            unlimited: false,
13132            flags: ForeignFlags::None,
13133            memory: false,
13134            access: Access::Random,
13135            fail_on: FailOn::None,
13136            revalidate: false,
13137        }
13138    }
13139}
13140
13141/// VipsForeignLoadHeifBuffer (heifload_buffer), load a HEIF image, priority=0, is_a_buffer, get_flags, header, load
13142/// buffer: `&[u8]` -> Buffer to load from
13143/// heifload_buffer_options: `&HeifloadBufferOptions` -> optional arguments
13144/// returns `VipsImage` - Output image
13145pub fn heifload_buffer_with_opts(
13146    buffer: &[u8],
13147    heifload_buffer_options: &HeifloadBufferOptions,
13148) -> Result<VipsImage> {
13149    unsafe {
13150        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13151        let mut out_out: *mut bindings::VipsImage = null_mut();
13152
13153        let page_in: i32 = heifload_buffer_options.page;
13154        let page_in_name = utils::new_c_string("page")?;
13155
13156        let n_in: i32 = heifload_buffer_options.n;
13157        let n_in_name = utils::new_c_string("n")?;
13158
13159        let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
13160            1
13161        } else {
13162            0
13163        };
13164        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13165
13166        let unlimited_in: i32 = if heifload_buffer_options.unlimited {
13167            1
13168        } else {
13169            0
13170        };
13171        let unlimited_in_name = utils::new_c_string("unlimited")?;
13172
13173        let flags_in: i32 = heifload_buffer_options.flags as i32;
13174        let flags_in_name = utils::new_c_string("flags")?;
13175
13176        let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
13177        let memory_in_name = utils::new_c_string("memory")?;
13178
13179        let access_in: i32 = heifload_buffer_options.access as i32;
13180        let access_in_name = utils::new_c_string("access")?;
13181
13182        let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
13183        let fail_on_in_name = utils::new_c_string("fail-on")?;
13184
13185        let revalidate_in: i32 = if heifload_buffer_options.revalidate {
13186            1
13187        } else {
13188            0
13189        };
13190        let revalidate_in_name = utils::new_c_string("revalidate")?;
13191
13192        let vips_op_response = bindings::vips_heifload_buffer(
13193            buffer_in,
13194            buffer.len() as u64,
13195            &mut out_out,
13196            page_in_name.as_ptr(),
13197            page_in,
13198            n_in_name.as_ptr(),
13199            n_in,
13200            thumbnail_in_name.as_ptr(),
13201            thumbnail_in,
13202            unlimited_in_name.as_ptr(),
13203            unlimited_in,
13204            flags_in_name.as_ptr(),
13205            flags_in,
13206            memory_in_name.as_ptr(),
13207            memory_in,
13208            access_in_name.as_ptr(),
13209            access_in,
13210            fail_on_in_name.as_ptr(),
13211            fail_on_in,
13212            revalidate_in_name.as_ptr(),
13213            revalidate_in,
13214            NULL,
13215        );
13216        utils::result(
13217            vips_op_response,
13218            VipsImage { ctx: out_out },
13219            Error::HeifloadBufferError,
13220        )
13221    }
13222}
13223
13224/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
13225/// source: `&VipsSource` -> Source to load from
13226/// returns `VipsImage` - Output image
13227pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
13228    unsafe {
13229        let source_in: *mut bindings::VipsSource = source.ctx;
13230        let mut out_out: *mut bindings::VipsImage = null_mut();
13231
13232        let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
13233        utils::result(
13234            vips_op_response,
13235            VipsImage { ctx: out_out },
13236            Error::HeifloadSourceError,
13237        )
13238    }
13239}
13240
13241/// Options for heifload_source operation
13242#[derive(Clone, Debug)]
13243pub struct HeifloadSourceOptions {
13244    /// page: `i32` -> First page to load
13245    /// min: 0, max: 100000, default: 0
13246    pub page: i32,
13247    /// n: `i32` -> Number of pages to load, -1 for all
13248    /// min: -1, max: 100000, default: 1
13249    pub n: i32,
13250    /// thumbnail: `bool` -> Fetch thumbnail image
13251    /// default: false
13252    pub thumbnail: bool,
13253    /// unlimited: `bool` -> Remove all denial of service limits
13254    /// default: false
13255    pub unlimited: bool,
13256    /// flags: `ForeignFlags` -> Flags for this file
13257    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13258    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13259    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13260    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13261    ///  `All` -> VIPS_FOREIGN_ALL = 7
13262    pub flags: ForeignFlags,
13263    /// memory: `bool` -> Force open via memory
13264    /// default: false
13265    pub memory: bool,
13266    /// access: `Access` -> Required access pattern for this file
13267    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13268    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13269    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13270    ///  `Last` -> VIPS_ACCESS_LAST = 3
13271    pub access: Access,
13272    /// fail_on: `FailOn` -> Error level to fail on
13273    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13274    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13275    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13276    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13277    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13278    pub fail_on: FailOn,
13279    /// revalidate: `bool` -> Don't use a cached result for this operation
13280    /// default: false
13281    pub revalidate: bool,
13282}
13283
13284impl std::default::Default for HeifloadSourceOptions {
13285    fn default() -> Self {
13286        HeifloadSourceOptions {
13287            page: i32::from(0),
13288            n: i32::from(1),
13289            thumbnail: false,
13290            unlimited: false,
13291            flags: ForeignFlags::None,
13292            memory: false,
13293            access: Access::Random,
13294            fail_on: FailOn::None,
13295            revalidate: false,
13296        }
13297    }
13298}
13299
13300/// VipsForeignLoadHeifSource (heifload_source), load a HEIF image, priority=0, is_a_source, get_flags, header, load
13301/// source: `&VipsSource` -> Source to load from
13302/// heifload_source_options: `&HeifloadSourceOptions` -> optional arguments
13303/// returns `VipsImage` - Output image
13304pub fn heifload_source_with_opts(
13305    source: &VipsSource,
13306    heifload_source_options: &HeifloadSourceOptions,
13307) -> Result<VipsImage> {
13308    unsafe {
13309        let source_in: *mut bindings::VipsSource = source.ctx;
13310        let mut out_out: *mut bindings::VipsImage = null_mut();
13311
13312        let page_in: i32 = heifload_source_options.page;
13313        let page_in_name = utils::new_c_string("page")?;
13314
13315        let n_in: i32 = heifload_source_options.n;
13316        let n_in_name = utils::new_c_string("n")?;
13317
13318        let thumbnail_in: i32 = if heifload_source_options.thumbnail {
13319            1
13320        } else {
13321            0
13322        };
13323        let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13324
13325        let unlimited_in: i32 = if heifload_source_options.unlimited {
13326            1
13327        } else {
13328            0
13329        };
13330        let unlimited_in_name = utils::new_c_string("unlimited")?;
13331
13332        let flags_in: i32 = heifload_source_options.flags as i32;
13333        let flags_in_name = utils::new_c_string("flags")?;
13334
13335        let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
13336        let memory_in_name = utils::new_c_string("memory")?;
13337
13338        let access_in: i32 = heifload_source_options.access as i32;
13339        let access_in_name = utils::new_c_string("access")?;
13340
13341        let fail_on_in: i32 = heifload_source_options.fail_on as i32;
13342        let fail_on_in_name = utils::new_c_string("fail-on")?;
13343
13344        let revalidate_in: i32 = if heifload_source_options.revalidate {
13345            1
13346        } else {
13347            0
13348        };
13349        let revalidate_in_name = utils::new_c_string("revalidate")?;
13350
13351        let vips_op_response = bindings::vips_heifload_source(
13352            source_in,
13353            &mut out_out,
13354            page_in_name.as_ptr(),
13355            page_in,
13356            n_in_name.as_ptr(),
13357            n_in,
13358            thumbnail_in_name.as_ptr(),
13359            thumbnail_in,
13360            unlimited_in_name.as_ptr(),
13361            unlimited_in,
13362            flags_in_name.as_ptr(),
13363            flags_in,
13364            memory_in_name.as_ptr(),
13365            memory_in,
13366            access_in_name.as_ptr(),
13367            access_in,
13368            fail_on_in_name.as_ptr(),
13369            fail_on_in,
13370            revalidate_in_name.as_ptr(),
13371            revalidate_in,
13372            NULL,
13373        );
13374        utils::result(
13375            vips_op_response,
13376            VipsImage { ctx: out_out },
13377            Error::HeifloadSourceError,
13378        )
13379    }
13380}
13381
13382/// VipsForeignLoadMagick7File (magickload), load file with ImageMagick7, priority=-100, untrusted, is_a, get_flags, get_flags_filename, header
13383/// filename: `&str` -> Filename to load from
13384/// returns `VipsImage` - Output image
13385pub fn magickload(filename: &str) -> Result<VipsImage> {
13386    unsafe {
13387        let filename_in: CString = utils::new_c_string(filename)?;
13388        let mut out_out: *mut bindings::VipsImage = null_mut();
13389
13390        let vips_op_response = bindings::vips_magickload(filename_in.as_ptr(), &mut out_out, NULL);
13391        utils::result(
13392            vips_op_response,
13393            VipsImage { ctx: out_out },
13394            Error::MagickloadError,
13395        )
13396    }
13397}
13398
13399/// Options for magickload operation
13400#[derive(Clone, Debug)]
13401pub struct MagickloadOptions {
13402    /// density: `String` -> Canvas resolution for rendering vector formats like SVG
13403    pub density: String,
13404    /// page: `i32` -> First page to load
13405    /// min: 0, max: 100000, default: 0
13406    pub page: i32,
13407    /// n: `i32` -> Number of pages to load, -1 for all
13408    /// min: -1, max: 100000, default: 1
13409    pub n: i32,
13410    /// flags: `ForeignFlags` -> Flags for this file
13411    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13412    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13413    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13414    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13415    ///  `All` -> VIPS_FOREIGN_ALL = 7
13416    pub flags: ForeignFlags,
13417    /// memory: `bool` -> Force open via memory
13418    /// default: false
13419    pub memory: bool,
13420    /// access: `Access` -> Required access pattern for this file
13421    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13422    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13423    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13424    ///  `Last` -> VIPS_ACCESS_LAST = 3
13425    pub access: Access,
13426    /// fail_on: `FailOn` -> Error level to fail on
13427    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13428    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13429    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13430    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13431    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13432    pub fail_on: FailOn,
13433    /// revalidate: `bool` -> Don't use a cached result for this operation
13434    /// default: false
13435    pub revalidate: bool,
13436}
13437
13438impl std::default::Default for MagickloadOptions {
13439    fn default() -> Self {
13440        MagickloadOptions {
13441            density: String::new(),
13442            page: i32::from(0),
13443            n: i32::from(1),
13444            flags: ForeignFlags::None,
13445            memory: false,
13446            access: Access::Random,
13447            fail_on: FailOn::None,
13448            revalidate: false,
13449        }
13450    }
13451}
13452
13453/// VipsForeignLoadMagick7File (magickload), load file with ImageMagick7, priority=-100, untrusted, is_a, get_flags, get_flags_filename, header
13454/// filename: `&str` -> Filename to load from
13455/// magickload_options: `&MagickloadOptions` -> optional arguments
13456/// returns `VipsImage` - Output image
13457pub fn magickload_with_opts(
13458    filename: &str,
13459    magickload_options: &MagickloadOptions,
13460) -> Result<VipsImage> {
13461    unsafe {
13462        let filename_in: CString = utils::new_c_string(filename)?;
13463        let mut out_out: *mut bindings::VipsImage = null_mut();
13464
13465        let density_in: CString = utils::new_c_string(&magickload_options.density)?;
13466        let density_in_name = utils::new_c_string("density")?;
13467
13468        let page_in: i32 = magickload_options.page;
13469        let page_in_name = utils::new_c_string("page")?;
13470
13471        let n_in: i32 = magickload_options.n;
13472        let n_in_name = utils::new_c_string("n")?;
13473
13474        let flags_in: i32 = magickload_options.flags as i32;
13475        let flags_in_name = utils::new_c_string("flags")?;
13476
13477        let memory_in: i32 = if magickload_options.memory { 1 } else { 0 };
13478        let memory_in_name = utils::new_c_string("memory")?;
13479
13480        let access_in: i32 = magickload_options.access as i32;
13481        let access_in_name = utils::new_c_string("access")?;
13482
13483        let fail_on_in: i32 = magickload_options.fail_on as i32;
13484        let fail_on_in_name = utils::new_c_string("fail-on")?;
13485
13486        let revalidate_in: i32 = if magickload_options.revalidate { 1 } else { 0 };
13487        let revalidate_in_name = utils::new_c_string("revalidate")?;
13488
13489        let vips_op_response = bindings::vips_magickload(
13490            filename_in.as_ptr(),
13491            &mut out_out,
13492            density_in_name.as_ptr(),
13493            density_in.as_ptr(),
13494            page_in_name.as_ptr(),
13495            page_in,
13496            n_in_name.as_ptr(),
13497            n_in,
13498            flags_in_name.as_ptr(),
13499            flags_in,
13500            memory_in_name.as_ptr(),
13501            memory_in,
13502            access_in_name.as_ptr(),
13503            access_in,
13504            fail_on_in_name.as_ptr(),
13505            fail_on_in,
13506            revalidate_in_name.as_ptr(),
13507            revalidate_in,
13508            NULL,
13509        );
13510        utils::result(
13511            vips_op_response,
13512            VipsImage { ctx: out_out },
13513            Error::MagickloadError,
13514        )
13515    }
13516}
13517
13518/// VipsForeignLoadMagick7Buffer (magickload_buffer), load buffer with ImageMagick7, priority=-100, untrusted, is_a_buffer, get_flags, get_flags_filename, header
13519/// buffer: `&[u8]` -> Buffer to load from
13520/// returns `VipsImage` - Output image
13521pub fn magickload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13522    unsafe {
13523        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13524        let mut out_out: *mut bindings::VipsImage = null_mut();
13525
13526        let vips_op_response =
13527            bindings::vips_magickload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13528        utils::result(
13529            vips_op_response,
13530            VipsImage { ctx: out_out },
13531            Error::MagickloadBufferError,
13532        )
13533    }
13534}
13535
13536/// Options for magickload_buffer operation
13537#[derive(Clone, Debug)]
13538pub struct MagickloadBufferOptions {
13539    /// density: `String` -> Canvas resolution for rendering vector formats like SVG
13540    pub density: String,
13541    /// page: `i32` -> First page to load
13542    /// min: 0, max: 100000, default: 0
13543    pub page: i32,
13544    /// n: `i32` -> Number of pages to load, -1 for all
13545    /// min: -1, max: 100000, default: 1
13546    pub n: i32,
13547    /// flags: `ForeignFlags` -> Flags for this file
13548    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13549    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13550    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13551    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13552    ///  `All` -> VIPS_FOREIGN_ALL = 7
13553    pub flags: ForeignFlags,
13554    /// memory: `bool` -> Force open via memory
13555    /// default: false
13556    pub memory: bool,
13557    /// access: `Access` -> Required access pattern for this file
13558    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13559    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13560    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13561    ///  `Last` -> VIPS_ACCESS_LAST = 3
13562    pub access: Access,
13563    /// fail_on: `FailOn` -> Error level to fail on
13564    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13565    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13566    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13567    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13568    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13569    pub fail_on: FailOn,
13570    /// revalidate: `bool` -> Don't use a cached result for this operation
13571    /// default: false
13572    pub revalidate: bool,
13573}
13574
13575impl std::default::Default for MagickloadBufferOptions {
13576    fn default() -> Self {
13577        MagickloadBufferOptions {
13578            density: String::new(),
13579            page: i32::from(0),
13580            n: i32::from(1),
13581            flags: ForeignFlags::None,
13582            memory: false,
13583            access: Access::Random,
13584            fail_on: FailOn::None,
13585            revalidate: false,
13586        }
13587    }
13588}
13589
13590/// VipsForeignLoadMagick7Buffer (magickload_buffer), load buffer with ImageMagick7, priority=-100, untrusted, is_a_buffer, get_flags, get_flags_filename, header
13591/// buffer: `&[u8]` -> Buffer to load from
13592/// magickload_buffer_options: `&MagickloadBufferOptions` -> optional arguments
13593/// returns `VipsImage` - Output image
13594pub fn magickload_buffer_with_opts(
13595    buffer: &[u8],
13596    magickload_buffer_options: &MagickloadBufferOptions,
13597) -> Result<VipsImage> {
13598    unsafe {
13599        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13600        let mut out_out: *mut bindings::VipsImage = null_mut();
13601
13602        let density_in: CString = utils::new_c_string(&magickload_buffer_options.density)?;
13603        let density_in_name = utils::new_c_string("density")?;
13604
13605        let page_in: i32 = magickload_buffer_options.page;
13606        let page_in_name = utils::new_c_string("page")?;
13607
13608        let n_in: i32 = magickload_buffer_options.n;
13609        let n_in_name = utils::new_c_string("n")?;
13610
13611        let flags_in: i32 = magickload_buffer_options.flags as i32;
13612        let flags_in_name = utils::new_c_string("flags")?;
13613
13614        let memory_in: i32 = if magickload_buffer_options.memory {
13615            1
13616        } else {
13617            0
13618        };
13619        let memory_in_name = utils::new_c_string("memory")?;
13620
13621        let access_in: i32 = magickload_buffer_options.access as i32;
13622        let access_in_name = utils::new_c_string("access")?;
13623
13624        let fail_on_in: i32 = magickload_buffer_options.fail_on as i32;
13625        let fail_on_in_name = utils::new_c_string("fail-on")?;
13626
13627        let revalidate_in: i32 = if magickload_buffer_options.revalidate {
13628            1
13629        } else {
13630            0
13631        };
13632        let revalidate_in_name = utils::new_c_string("revalidate")?;
13633
13634        let vips_op_response = bindings::vips_magickload_buffer(
13635            buffer_in,
13636            buffer.len() as u64,
13637            &mut out_out,
13638            density_in_name.as_ptr(),
13639            density_in.as_ptr(),
13640            page_in_name.as_ptr(),
13641            page_in,
13642            n_in_name.as_ptr(),
13643            n_in,
13644            flags_in_name.as_ptr(),
13645            flags_in,
13646            memory_in_name.as_ptr(),
13647            memory_in,
13648            access_in_name.as_ptr(),
13649            access_in,
13650            fail_on_in_name.as_ptr(),
13651            fail_on_in,
13652            revalidate_in_name.as_ptr(),
13653            revalidate_in,
13654            NULL,
13655        );
13656        utils::result(
13657            vips_op_response,
13658            VipsImage { ctx: out_out },
13659            Error::MagickloadBufferError,
13660        )
13661    }
13662}
13663
13664/// VipsForeignLoadPdfFile (pdfload), load PDF from file (.pdf), priority=0, untrusted, is_a, get_flags, get_flags_filename, header, load
13665/// filename: `&str` -> Filename to load from
13666/// returns `VipsImage` - Output image
13667pub fn pdfload(filename: &str) -> Result<VipsImage> {
13668    unsafe {
13669        let filename_in: CString = utils::new_c_string(filename)?;
13670        let mut out_out: *mut bindings::VipsImage = null_mut();
13671
13672        let vips_op_response = bindings::vips_pdfload(filename_in.as_ptr(), &mut out_out, NULL);
13673        utils::result(
13674            vips_op_response,
13675            VipsImage { ctx: out_out },
13676            Error::PdfloadError,
13677        )
13678    }
13679}
13680
13681/// Options for pdfload operation
13682#[derive(Clone, Debug)]
13683pub struct PdfloadOptions {
13684    /// page: `i32` -> First page to load
13685    /// min: 0, max: 100000, default: 0
13686    pub page: i32,
13687    /// n: `i32` -> Number of pages to load, -1 for all
13688    /// min: -1, max: 100000, default: 1
13689    pub n: i32,
13690    /// dpi: `f64` -> DPI to render at
13691    /// min: 0.001, max: 100000, default: 72
13692    pub dpi: f64,
13693    /// scale: `f64` -> Factor to scale by
13694    /// min: 0.001, max: 100000, default: 1
13695    pub scale: f64,
13696    /// background: `Vec<f64>` -> Background colour
13697    pub background: Vec<f64>,
13698    /// password: `String` -> Password to decrypt with
13699    pub password: String,
13700    /// flags: `ForeignFlags` -> Flags for this file
13701    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13702    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13703    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13704    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13705    ///  `All` -> VIPS_FOREIGN_ALL = 7
13706    pub flags: ForeignFlags,
13707    /// memory: `bool` -> Force open via memory
13708    /// default: false
13709    pub memory: bool,
13710    /// access: `Access` -> Required access pattern for this file
13711    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13712    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13713    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13714    ///  `Last` -> VIPS_ACCESS_LAST = 3
13715    pub access: Access,
13716    /// fail_on: `FailOn` -> Error level to fail on
13717    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13718    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13719    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13720    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13721    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13722    pub fail_on: FailOn,
13723    /// revalidate: `bool` -> Don't use a cached result for this operation
13724    /// default: false
13725    pub revalidate: bool,
13726}
13727
13728impl std::default::Default for PdfloadOptions {
13729    fn default() -> Self {
13730        PdfloadOptions {
13731            page: i32::from(0),
13732            n: i32::from(1),
13733            dpi: f64::from(72),
13734            scale: f64::from(1),
13735            background: Vec::new(),
13736            password: String::new(),
13737            flags: ForeignFlags::None,
13738            memory: false,
13739            access: Access::Random,
13740            fail_on: FailOn::None,
13741            revalidate: false,
13742        }
13743    }
13744}
13745
13746/// VipsForeignLoadPdfFile (pdfload), load PDF from file (.pdf), priority=0, untrusted, is_a, get_flags, get_flags_filename, header, load
13747/// filename: `&str` -> Filename to load from
13748/// pdfload_options: `&PdfloadOptions` -> optional arguments
13749/// returns `VipsImage` - Output image
13750pub fn pdfload_with_opts(filename: &str, pdfload_options: &PdfloadOptions) -> Result<VipsImage> {
13751    unsafe {
13752        let filename_in: CString = utils::new_c_string(filename)?;
13753        let mut out_out: *mut bindings::VipsImage = null_mut();
13754
13755        let page_in: i32 = pdfload_options.page;
13756        let page_in_name = utils::new_c_string("page")?;
13757
13758        let n_in: i32 = pdfload_options.n;
13759        let n_in_name = utils::new_c_string("n")?;
13760
13761        let dpi_in: f64 = pdfload_options.dpi;
13762        let dpi_in_name = utils::new_c_string("dpi")?;
13763
13764        let scale_in: f64 = pdfload_options.scale;
13765        let scale_in_name = utils::new_c_string("scale")?;
13766
13767        let background_wrapper =
13768            utils::VipsArrayDoubleWrapper::from(&pdfload_options.background[..]);
13769        let background_in = background_wrapper.ctx;
13770        let background_in_name = utils::new_c_string("background")?;
13771
13772        let password_in: CString = utils::new_c_string(&pdfload_options.password)?;
13773        let password_in_name = utils::new_c_string("password")?;
13774
13775        let flags_in: i32 = pdfload_options.flags as i32;
13776        let flags_in_name = utils::new_c_string("flags")?;
13777
13778        let memory_in: i32 = if pdfload_options.memory { 1 } else { 0 };
13779        let memory_in_name = utils::new_c_string("memory")?;
13780
13781        let access_in: i32 = pdfload_options.access as i32;
13782        let access_in_name = utils::new_c_string("access")?;
13783
13784        let fail_on_in: i32 = pdfload_options.fail_on as i32;
13785        let fail_on_in_name = utils::new_c_string("fail-on")?;
13786
13787        let revalidate_in: i32 = if pdfload_options.revalidate { 1 } else { 0 };
13788        let revalidate_in_name = utils::new_c_string("revalidate")?;
13789
13790        let vips_op_response = bindings::vips_pdfload(
13791            filename_in.as_ptr(),
13792            &mut out_out,
13793            page_in_name.as_ptr(),
13794            page_in,
13795            n_in_name.as_ptr(),
13796            n_in,
13797            dpi_in_name.as_ptr(),
13798            dpi_in,
13799            scale_in_name.as_ptr(),
13800            scale_in,
13801            background_in_name.as_ptr(),
13802            background_in,
13803            password_in_name.as_ptr(),
13804            password_in.as_ptr(),
13805            flags_in_name.as_ptr(),
13806            flags_in,
13807            memory_in_name.as_ptr(),
13808            memory_in,
13809            access_in_name.as_ptr(),
13810            access_in,
13811            fail_on_in_name.as_ptr(),
13812            fail_on_in,
13813            revalidate_in_name.as_ptr(),
13814            revalidate_in,
13815            NULL,
13816        );
13817        utils::result(
13818            vips_op_response,
13819            VipsImage { ctx: out_out },
13820            Error::PdfloadError,
13821        )
13822    }
13823}
13824
13825/// VipsForeignLoadPdfBuffer (pdfload_buffer), load PDF from buffer, priority=0, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
13826/// buffer: `&[u8]` -> Buffer to load from
13827/// returns `VipsImage` - Output image
13828pub fn pdfload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13829    unsafe {
13830        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13831        let mut out_out: *mut bindings::VipsImage = null_mut();
13832
13833        let vips_op_response =
13834            bindings::vips_pdfload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13835        utils::result(
13836            vips_op_response,
13837            VipsImage { ctx: out_out },
13838            Error::PdfloadBufferError,
13839        )
13840    }
13841}
13842
13843/// Options for pdfload_buffer operation
13844#[derive(Clone, Debug)]
13845pub struct PdfloadBufferOptions {
13846    /// page: `i32` -> First page to load
13847    /// min: 0, max: 100000, default: 0
13848    pub page: i32,
13849    /// n: `i32` -> Number of pages to load, -1 for all
13850    /// min: -1, max: 100000, default: 1
13851    pub n: i32,
13852    /// dpi: `f64` -> DPI to render at
13853    /// min: 0.001, max: 100000, default: 72
13854    pub dpi: f64,
13855    /// scale: `f64` -> Factor to scale by
13856    /// min: 0.001, max: 100000, default: 1
13857    pub scale: f64,
13858    /// background: `Vec<f64>` -> Background colour
13859    pub background: Vec<f64>,
13860    /// password: `String` -> Password to decrypt with
13861    pub password: String,
13862    /// flags: `ForeignFlags` -> Flags for this file
13863    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
13864    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
13865    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
13866    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
13867    ///  `All` -> VIPS_FOREIGN_ALL = 7
13868    pub flags: ForeignFlags,
13869    /// memory: `bool` -> Force open via memory
13870    /// default: false
13871    pub memory: bool,
13872    /// access: `Access` -> Required access pattern for this file
13873    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
13874    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
13875    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
13876    ///  `Last` -> VIPS_ACCESS_LAST = 3
13877    pub access: Access,
13878    /// fail_on: `FailOn` -> Error level to fail on
13879    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
13880    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
13881    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
13882    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
13883    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
13884    pub fail_on: FailOn,
13885    /// revalidate: `bool` -> Don't use a cached result for this operation
13886    /// default: false
13887    pub revalidate: bool,
13888}
13889
13890impl std::default::Default for PdfloadBufferOptions {
13891    fn default() -> Self {
13892        PdfloadBufferOptions {
13893            page: i32::from(0),
13894            n: i32::from(1),
13895            dpi: f64::from(72),
13896            scale: f64::from(1),
13897            background: Vec::new(),
13898            password: String::new(),
13899            flags: ForeignFlags::None,
13900            memory: false,
13901            access: Access::Random,
13902            fail_on: FailOn::None,
13903            revalidate: false,
13904        }
13905    }
13906}
13907
13908/// VipsForeignLoadPdfBuffer (pdfload_buffer), load PDF from buffer, priority=0, untrusted, is_a_buffer, get_flags, get_flags_filename, header, load
13909/// buffer: `&[u8]` -> Buffer to load from
13910/// pdfload_buffer_options: `&PdfloadBufferOptions` -> optional arguments
13911/// returns `VipsImage` - Output image
13912pub fn pdfload_buffer_with_opts(
13913    buffer: &[u8],
13914    pdfload_buffer_options: &PdfloadBufferOptions,
13915) -> Result<VipsImage> {
13916    unsafe {
13917        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13918        let mut out_out: *mut bindings::VipsImage = null_mut();
13919
13920        let page_in: i32 = pdfload_buffer_options.page;
13921        let page_in_name = utils::new_c_string("page")?;
13922
13923        let n_in: i32 = pdfload_buffer_options.n;
13924        let n_in_name = utils::new_c_string("n")?;
13925
13926        let dpi_in: f64 = pdfload_buffer_options.dpi;
13927        let dpi_in_name = utils::new_c_string("dpi")?;
13928
13929        let scale_in: f64 = pdfload_buffer_options.scale;
13930        let scale_in_name = utils::new_c_string("scale")?;
13931
13932        let background_wrapper =
13933            utils::VipsArrayDoubleWrapper::from(&pdfload_buffer_options.background[..]);
13934        let background_in = background_wrapper.ctx;
13935        let background_in_name = utils::new_c_string("background")?;
13936
13937        let password_in: CString = utils::new_c_string(&pdfload_buffer_options.password)?;
13938        let password_in_name = utils::new_c_string("password")?;
13939
13940        let flags_in: i32 = pdfload_buffer_options.flags as i32;
13941        let flags_in_name = utils::new_c_string("flags")?;
13942
13943        let memory_in: i32 = if pdfload_buffer_options.memory { 1 } else { 0 };
13944        let memory_in_name = utils::new_c_string("memory")?;
13945
13946        let access_in: i32 = pdfload_buffer_options.access as i32;
13947        let access_in_name = utils::new_c_string("access")?;
13948
13949        let fail_on_in: i32 = pdfload_buffer_options.fail_on as i32;
13950        let fail_on_in_name = utils::new_c_string("fail-on")?;
13951
13952        let revalidate_in: i32 = if pdfload_buffer_options.revalidate {
13953            1
13954        } else {
13955            0
13956        };
13957        let revalidate_in_name = utils::new_c_string("revalidate")?;
13958
13959        let vips_op_response = bindings::vips_pdfload_buffer(
13960            buffer_in,
13961            buffer.len() as u64,
13962            &mut out_out,
13963            page_in_name.as_ptr(),
13964            page_in,
13965            n_in_name.as_ptr(),
13966            n_in,
13967            dpi_in_name.as_ptr(),
13968            dpi_in,
13969            scale_in_name.as_ptr(),
13970            scale_in,
13971            background_in_name.as_ptr(),
13972            background_in,
13973            password_in_name.as_ptr(),
13974            password_in.as_ptr(),
13975            flags_in_name.as_ptr(),
13976            flags_in,
13977            memory_in_name.as_ptr(),
13978            memory_in,
13979            access_in_name.as_ptr(),
13980            access_in,
13981            fail_on_in_name.as_ptr(),
13982            fail_on_in,
13983            revalidate_in_name.as_ptr(),
13984            revalidate_in,
13985            NULL,
13986        );
13987        utils::result(
13988            vips_op_response,
13989            VipsImage { ctx: out_out },
13990            Error::PdfloadBufferError,
13991        )
13992    }
13993}
13994
13995/// VipsForeignLoadPdfSource (pdfload_source), load PDF from source, priority=0, untrusted, is_a_source, get_flags, get_flags_filename, header, load
13996/// source: `&VipsSource` -> Source to load from
13997/// returns `VipsImage` - Output image
13998pub fn pdfload_source(source: &VipsSource) -> Result<VipsImage> {
13999    unsafe {
14000        let source_in: *mut bindings::VipsSource = source.ctx;
14001        let mut out_out: *mut bindings::VipsImage = null_mut();
14002
14003        let vips_op_response = bindings::vips_pdfload_source(source_in, &mut out_out, NULL);
14004        utils::result(
14005            vips_op_response,
14006            VipsImage { ctx: out_out },
14007            Error::PdfloadSourceError,
14008        )
14009    }
14010}
14011
14012/// Options for pdfload_source operation
14013#[derive(Clone, Debug)]
14014pub struct PdfloadSourceOptions {
14015    /// page: `i32` -> First page to load
14016    /// min: 0, max: 100000, default: 0
14017    pub page: i32,
14018    /// n: `i32` -> Number of pages to load, -1 for all
14019    /// min: -1, max: 100000, default: 1
14020    pub n: i32,
14021    /// dpi: `f64` -> DPI to render at
14022    /// min: 0.001, max: 100000, default: 72
14023    pub dpi: f64,
14024    /// scale: `f64` -> Factor to scale by
14025    /// min: 0.001, max: 100000, default: 1
14026    pub scale: f64,
14027    /// background: `Vec<f64>` -> Background colour
14028    pub background: Vec<f64>,
14029    /// password: `String` -> Password to decrypt with
14030    pub password: String,
14031    /// flags: `ForeignFlags` -> Flags for this file
14032    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14033    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14034    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14035    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14036    ///  `All` -> VIPS_FOREIGN_ALL = 7
14037    pub flags: ForeignFlags,
14038    /// memory: `bool` -> Force open via memory
14039    /// default: false
14040    pub memory: bool,
14041    /// access: `Access` -> Required access pattern for this file
14042    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14043    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14044    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14045    ///  `Last` -> VIPS_ACCESS_LAST = 3
14046    pub access: Access,
14047    /// fail_on: `FailOn` -> Error level to fail on
14048    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14049    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14050    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14051    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14052    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14053    pub fail_on: FailOn,
14054    /// revalidate: `bool` -> Don't use a cached result for this operation
14055    /// default: false
14056    pub revalidate: bool,
14057}
14058
14059impl std::default::Default for PdfloadSourceOptions {
14060    fn default() -> Self {
14061        PdfloadSourceOptions {
14062            page: i32::from(0),
14063            n: i32::from(1),
14064            dpi: f64::from(72),
14065            scale: f64::from(1),
14066            background: Vec::new(),
14067            password: String::new(),
14068            flags: ForeignFlags::None,
14069            memory: false,
14070            access: Access::Random,
14071            fail_on: FailOn::None,
14072            revalidate: false,
14073        }
14074    }
14075}
14076
14077/// VipsForeignLoadPdfSource (pdfload_source), load PDF from source, priority=0, untrusted, is_a_source, get_flags, get_flags_filename, header, load
14078/// source: `&VipsSource` -> Source to load from
14079/// pdfload_source_options: `&PdfloadSourceOptions` -> optional arguments
14080/// returns `VipsImage` - Output image
14081pub fn pdfload_source_with_opts(
14082    source: &VipsSource,
14083    pdfload_source_options: &PdfloadSourceOptions,
14084) -> Result<VipsImage> {
14085    unsafe {
14086        let source_in: *mut bindings::VipsSource = source.ctx;
14087        let mut out_out: *mut bindings::VipsImage = null_mut();
14088
14089        let page_in: i32 = pdfload_source_options.page;
14090        let page_in_name = utils::new_c_string("page")?;
14091
14092        let n_in: i32 = pdfload_source_options.n;
14093        let n_in_name = utils::new_c_string("n")?;
14094
14095        let dpi_in: f64 = pdfload_source_options.dpi;
14096        let dpi_in_name = utils::new_c_string("dpi")?;
14097
14098        let scale_in: f64 = pdfload_source_options.scale;
14099        let scale_in_name = utils::new_c_string("scale")?;
14100
14101        let background_wrapper =
14102            utils::VipsArrayDoubleWrapper::from(&pdfload_source_options.background[..]);
14103        let background_in = background_wrapper.ctx;
14104        let background_in_name = utils::new_c_string("background")?;
14105
14106        let password_in: CString = utils::new_c_string(&pdfload_source_options.password)?;
14107        let password_in_name = utils::new_c_string("password")?;
14108
14109        let flags_in: i32 = pdfload_source_options.flags as i32;
14110        let flags_in_name = utils::new_c_string("flags")?;
14111
14112        let memory_in: i32 = if pdfload_source_options.memory { 1 } else { 0 };
14113        let memory_in_name = utils::new_c_string("memory")?;
14114
14115        let access_in: i32 = pdfload_source_options.access as i32;
14116        let access_in_name = utils::new_c_string("access")?;
14117
14118        let fail_on_in: i32 = pdfload_source_options.fail_on as i32;
14119        let fail_on_in_name = utils::new_c_string("fail-on")?;
14120
14121        let revalidate_in: i32 = if pdfload_source_options.revalidate {
14122            1
14123        } else {
14124            0
14125        };
14126        let revalidate_in_name = utils::new_c_string("revalidate")?;
14127
14128        let vips_op_response = bindings::vips_pdfload_source(
14129            source_in,
14130            &mut out_out,
14131            page_in_name.as_ptr(),
14132            page_in,
14133            n_in_name.as_ptr(),
14134            n_in,
14135            dpi_in_name.as_ptr(),
14136            dpi_in,
14137            scale_in_name.as_ptr(),
14138            scale_in,
14139            background_in_name.as_ptr(),
14140            background_in,
14141            password_in_name.as_ptr(),
14142            password_in.as_ptr(),
14143            flags_in_name.as_ptr(),
14144            flags_in,
14145            memory_in_name.as_ptr(),
14146            memory_in,
14147            access_in_name.as_ptr(),
14148            access_in,
14149            fail_on_in_name.as_ptr(),
14150            fail_on_in,
14151            revalidate_in_name.as_ptr(),
14152            revalidate_in,
14153            NULL,
14154        );
14155        utils::result(
14156            vips_op_response,
14157            VipsImage { ctx: out_out },
14158            Error::PdfloadSourceError,
14159        )
14160    }
14161}
14162
14163/// VipsForeignLoadOpenslideFile (openslideload), load file with OpenSlide (.svs, .vms, .vmu, .ndpi, .scn, .mrxs, .svslide, .tif, .bif), priority=100, untrusted, is_a, get_flags, get_flags_filename, header, load
14164/// filename: `&str` -> Filename to load from
14165/// returns `VipsImage` - Output image
14166pub fn openslideload(filename: &str) -> Result<VipsImage> {
14167    unsafe {
14168        let filename_in: CString = utils::new_c_string(filename)?;
14169        let mut out_out: *mut bindings::VipsImage = null_mut();
14170
14171        let vips_op_response =
14172            bindings::vips_openslideload(filename_in.as_ptr(), &mut out_out, NULL);
14173        utils::result(
14174            vips_op_response,
14175            VipsImage { ctx: out_out },
14176            Error::OpenslideloadError,
14177        )
14178    }
14179}
14180
14181/// Options for openslideload operation
14182#[derive(Clone, Debug)]
14183pub struct OpenslideloadOptions {
14184    /// level: `i32` -> Load this level from the file
14185    /// min: 0, max: 100000, default: 0
14186    pub level: i32,
14187    /// autocrop: `bool` -> Crop to image bounds
14188    /// default: false
14189    pub autocrop: bool,
14190    /// associated: `String` -> Load this associated image
14191    pub associated: String,
14192    /// attach_associated: `bool` -> Attach all associated images
14193    /// default: false
14194    pub attach_associated: bool,
14195    /// rgb: `bool` -> Output RGB (not RGBA)
14196    /// default: false
14197    pub rgb: bool,
14198    /// flags: `ForeignFlags` -> Flags for this file
14199    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14200    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14201    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14202    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14203    ///  `All` -> VIPS_FOREIGN_ALL = 7
14204    pub flags: ForeignFlags,
14205    /// memory: `bool` -> Force open via memory
14206    /// default: false
14207    pub memory: bool,
14208    /// access: `Access` -> Required access pattern for this file
14209    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14210    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14211    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14212    ///  `Last` -> VIPS_ACCESS_LAST = 3
14213    pub access: Access,
14214    /// fail_on: `FailOn` -> Error level to fail on
14215    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14216    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14217    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14218    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14219    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14220    pub fail_on: FailOn,
14221    /// revalidate: `bool` -> Don't use a cached result for this operation
14222    /// default: false
14223    pub revalidate: bool,
14224}
14225
14226impl std::default::Default for OpenslideloadOptions {
14227    fn default() -> Self {
14228        OpenslideloadOptions {
14229            level: i32::from(0),
14230            autocrop: false,
14231            associated: String::new(),
14232            attach_associated: false,
14233            rgb: false,
14234            flags: ForeignFlags::None,
14235            memory: false,
14236            access: Access::Random,
14237            fail_on: FailOn::None,
14238            revalidate: false,
14239        }
14240    }
14241}
14242
14243/// VipsForeignLoadOpenslideFile (openslideload), load file with OpenSlide (.svs, .vms, .vmu, .ndpi, .scn, .mrxs, .svslide, .tif, .bif), priority=100, untrusted, is_a, get_flags, get_flags_filename, header, load
14244/// filename: `&str` -> Filename to load from
14245/// openslideload_options: `&OpenslideloadOptions` -> optional arguments
14246/// returns `VipsImage` - Output image
14247pub fn openslideload_with_opts(
14248    filename: &str,
14249    openslideload_options: &OpenslideloadOptions,
14250) -> Result<VipsImage> {
14251    unsafe {
14252        let filename_in: CString = utils::new_c_string(filename)?;
14253        let mut out_out: *mut bindings::VipsImage = null_mut();
14254
14255        let level_in: i32 = openslideload_options.level;
14256        let level_in_name = utils::new_c_string("level")?;
14257
14258        let autocrop_in: i32 = if openslideload_options.autocrop { 1 } else { 0 };
14259        let autocrop_in_name = utils::new_c_string("autocrop")?;
14260
14261        let associated_in: CString = utils::new_c_string(&openslideload_options.associated)?;
14262        let associated_in_name = utils::new_c_string("associated")?;
14263
14264        let attach_associated_in: i32 = if openslideload_options.attach_associated {
14265            1
14266        } else {
14267            0
14268        };
14269        let attach_associated_in_name = utils::new_c_string("attach-associated")?;
14270
14271        let rgb_in: i32 = if openslideload_options.rgb { 1 } else { 0 };
14272        let rgb_in_name = utils::new_c_string("rgb")?;
14273
14274        let flags_in: i32 = openslideload_options.flags as i32;
14275        let flags_in_name = utils::new_c_string("flags")?;
14276
14277        let memory_in: i32 = if openslideload_options.memory { 1 } else { 0 };
14278        let memory_in_name = utils::new_c_string("memory")?;
14279
14280        let access_in: i32 = openslideload_options.access as i32;
14281        let access_in_name = utils::new_c_string("access")?;
14282
14283        let fail_on_in: i32 = openslideload_options.fail_on as i32;
14284        let fail_on_in_name = utils::new_c_string("fail-on")?;
14285
14286        let revalidate_in: i32 = if openslideload_options.revalidate {
14287            1
14288        } else {
14289            0
14290        };
14291        let revalidate_in_name = utils::new_c_string("revalidate")?;
14292
14293        let vips_op_response = bindings::vips_openslideload(
14294            filename_in.as_ptr(),
14295            &mut out_out,
14296            level_in_name.as_ptr(),
14297            level_in,
14298            autocrop_in_name.as_ptr(),
14299            autocrop_in,
14300            associated_in_name.as_ptr(),
14301            associated_in.as_ptr(),
14302            attach_associated_in_name.as_ptr(),
14303            attach_associated_in,
14304            rgb_in_name.as_ptr(),
14305            rgb_in,
14306            flags_in_name.as_ptr(),
14307            flags_in,
14308            memory_in_name.as_ptr(),
14309            memory_in,
14310            access_in_name.as_ptr(),
14311            access_in,
14312            fail_on_in_name.as_ptr(),
14313            fail_on_in,
14314            revalidate_in_name.as_ptr(),
14315            revalidate_in,
14316            NULL,
14317        );
14318        utils::result(
14319            vips_op_response,
14320            VipsImage { ctx: out_out },
14321            Error::OpenslideloadError,
14322        )
14323    }
14324}
14325
14326/// VipsForeignLoadOpenslideSource (openslideload_source), load source with OpenSlide, priority=100, untrusted, is_a_source, get_flags, get_flags_filename, header, load
14327/// source: `&VipsSource` -> Source to load from
14328/// returns `VipsImage` - Output image
14329pub fn openslideload_source(source: &VipsSource) -> Result<VipsImage> {
14330    unsafe {
14331        let source_in: *mut bindings::VipsSource = source.ctx;
14332        let mut out_out: *mut bindings::VipsImage = null_mut();
14333
14334        let vips_op_response = bindings::vips_openslideload_source(source_in, &mut out_out, NULL);
14335        utils::result(
14336            vips_op_response,
14337            VipsImage { ctx: out_out },
14338            Error::OpenslideloadSourceError,
14339        )
14340    }
14341}
14342
14343/// Options for openslideload_source operation
14344#[derive(Clone, Debug)]
14345pub struct OpenslideloadSourceOptions {
14346    /// level: `i32` -> Load this level from the file
14347    /// min: 0, max: 100000, default: 0
14348    pub level: i32,
14349    /// autocrop: `bool` -> Crop to image bounds
14350    /// default: false
14351    pub autocrop: bool,
14352    /// associated: `String` -> Load this associated image
14353    pub associated: String,
14354    /// attach_associated: `bool` -> Attach all associated images
14355    /// default: false
14356    pub attach_associated: bool,
14357    /// rgb: `bool` -> Output RGB (not RGBA)
14358    /// default: false
14359    pub rgb: bool,
14360    /// flags: `ForeignFlags` -> Flags for this file
14361    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14362    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14363    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14364    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14365    ///  `All` -> VIPS_FOREIGN_ALL = 7
14366    pub flags: ForeignFlags,
14367    /// memory: `bool` -> Force open via memory
14368    /// default: false
14369    pub memory: bool,
14370    /// access: `Access` -> Required access pattern for this file
14371    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14372    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14373    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14374    ///  `Last` -> VIPS_ACCESS_LAST = 3
14375    pub access: Access,
14376    /// fail_on: `FailOn` -> Error level to fail on
14377    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14378    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14379    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14380    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14381    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14382    pub fail_on: FailOn,
14383    /// revalidate: `bool` -> Don't use a cached result for this operation
14384    /// default: false
14385    pub revalidate: bool,
14386}
14387
14388impl std::default::Default for OpenslideloadSourceOptions {
14389    fn default() -> Self {
14390        OpenslideloadSourceOptions {
14391            level: i32::from(0),
14392            autocrop: false,
14393            associated: String::new(),
14394            attach_associated: false,
14395            rgb: false,
14396            flags: ForeignFlags::None,
14397            memory: false,
14398            access: Access::Random,
14399            fail_on: FailOn::None,
14400            revalidate: false,
14401        }
14402    }
14403}
14404
14405/// VipsForeignLoadOpenslideSource (openslideload_source), load source with OpenSlide, priority=100, untrusted, is_a_source, get_flags, get_flags_filename, header, load
14406/// source: `&VipsSource` -> Source to load from
14407/// openslideload_source_options: `&OpenslideloadSourceOptions` -> optional arguments
14408/// returns `VipsImage` - Output image
14409pub fn openslideload_source_with_opts(
14410    source: &VipsSource,
14411    openslideload_source_options: &OpenslideloadSourceOptions,
14412) -> Result<VipsImage> {
14413    unsafe {
14414        let source_in: *mut bindings::VipsSource = source.ctx;
14415        let mut out_out: *mut bindings::VipsImage = null_mut();
14416
14417        let level_in: i32 = openslideload_source_options.level;
14418        let level_in_name = utils::new_c_string("level")?;
14419
14420        let autocrop_in: i32 = if openslideload_source_options.autocrop {
14421            1
14422        } else {
14423            0
14424        };
14425        let autocrop_in_name = utils::new_c_string("autocrop")?;
14426
14427        let associated_in: CString = utils::new_c_string(&openslideload_source_options.associated)?;
14428        let associated_in_name = utils::new_c_string("associated")?;
14429
14430        let attach_associated_in: i32 = if openslideload_source_options.attach_associated {
14431            1
14432        } else {
14433            0
14434        };
14435        let attach_associated_in_name = utils::new_c_string("attach-associated")?;
14436
14437        let rgb_in: i32 = if openslideload_source_options.rgb {
14438            1
14439        } else {
14440            0
14441        };
14442        let rgb_in_name = utils::new_c_string("rgb")?;
14443
14444        let flags_in: i32 = openslideload_source_options.flags as i32;
14445        let flags_in_name = utils::new_c_string("flags")?;
14446
14447        let memory_in: i32 = if openslideload_source_options.memory {
14448            1
14449        } else {
14450            0
14451        };
14452        let memory_in_name = utils::new_c_string("memory")?;
14453
14454        let access_in: i32 = openslideload_source_options.access as i32;
14455        let access_in_name = utils::new_c_string("access")?;
14456
14457        let fail_on_in: i32 = openslideload_source_options.fail_on as i32;
14458        let fail_on_in_name = utils::new_c_string("fail-on")?;
14459
14460        let revalidate_in: i32 = if openslideload_source_options.revalidate {
14461            1
14462        } else {
14463            0
14464        };
14465        let revalidate_in_name = utils::new_c_string("revalidate")?;
14466
14467        let vips_op_response = bindings::vips_openslideload_source(
14468            source_in,
14469            &mut out_out,
14470            level_in_name.as_ptr(),
14471            level_in,
14472            autocrop_in_name.as_ptr(),
14473            autocrop_in,
14474            associated_in_name.as_ptr(),
14475            associated_in.as_ptr(),
14476            attach_associated_in_name.as_ptr(),
14477            attach_associated_in,
14478            rgb_in_name.as_ptr(),
14479            rgb_in,
14480            flags_in_name.as_ptr(),
14481            flags_in,
14482            memory_in_name.as_ptr(),
14483            memory_in,
14484            access_in_name.as_ptr(),
14485            access_in,
14486            fail_on_in_name.as_ptr(),
14487            fail_on_in,
14488            revalidate_in_name.as_ptr(),
14489            revalidate_in,
14490            NULL,
14491        );
14492        utils::result(
14493            vips_op_response,
14494            VipsImage { ctx: out_out },
14495            Error::OpenslideloadSourceError,
14496        )
14497    }
14498}
14499
14500/// VipsForeignLoadJxlFile (jxlload), load JPEG-XL image (.jxl), priority=0, untrusted, is_a, get_flags, header, load
14501/// filename: `&str` -> Filename to load from
14502/// returns `VipsImage` - Output image
14503pub fn jxlload(filename: &str) -> Result<VipsImage> {
14504    unsafe {
14505        let filename_in: CString = utils::new_c_string(filename)?;
14506        let mut out_out: *mut bindings::VipsImage = null_mut();
14507
14508        let vips_op_response = bindings::vips_jxlload(filename_in.as_ptr(), &mut out_out, NULL);
14509        utils::result(
14510            vips_op_response,
14511            VipsImage { ctx: out_out },
14512            Error::JxlloadError,
14513        )
14514    }
14515}
14516
14517/// Options for jxlload operation
14518#[derive(Clone, Debug)]
14519pub struct JxlloadOptions {
14520    /// flags: `ForeignFlags` -> Flags for this file
14521    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14522    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14523    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14524    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14525    ///  `All` -> VIPS_FOREIGN_ALL = 7
14526    pub flags: ForeignFlags,
14527    /// memory: `bool` -> Force open via memory
14528    /// default: false
14529    pub memory: bool,
14530    /// access: `Access` -> Required access pattern for this file
14531    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14532    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14533    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14534    ///  `Last` -> VIPS_ACCESS_LAST = 3
14535    pub access: Access,
14536    /// fail_on: `FailOn` -> Error level to fail on
14537    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14538    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14539    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14540    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14541    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14542    pub fail_on: FailOn,
14543    /// revalidate: `bool` -> Don't use a cached result for this operation
14544    /// default: false
14545    pub revalidate: bool,
14546}
14547
14548impl std::default::Default for JxlloadOptions {
14549    fn default() -> Self {
14550        JxlloadOptions {
14551            flags: ForeignFlags::None,
14552            memory: false,
14553            access: Access::Random,
14554            fail_on: FailOn::None,
14555            revalidate: false,
14556        }
14557    }
14558}
14559
14560/// VipsForeignLoadJxlFile (jxlload), load JPEG-XL image (.jxl), priority=0, untrusted, is_a, get_flags, header, load
14561/// filename: `&str` -> Filename to load from
14562/// jxlload_options: `&JxlloadOptions` -> optional arguments
14563/// returns `VipsImage` - Output image
14564pub fn jxlload_with_opts(filename: &str, jxlload_options: &JxlloadOptions) -> Result<VipsImage> {
14565    unsafe {
14566        let filename_in: CString = utils::new_c_string(filename)?;
14567        let mut out_out: *mut bindings::VipsImage = null_mut();
14568
14569        let flags_in: i32 = jxlload_options.flags as i32;
14570        let flags_in_name = utils::new_c_string("flags")?;
14571
14572        let memory_in: i32 = if jxlload_options.memory { 1 } else { 0 };
14573        let memory_in_name = utils::new_c_string("memory")?;
14574
14575        let access_in: i32 = jxlload_options.access as i32;
14576        let access_in_name = utils::new_c_string("access")?;
14577
14578        let fail_on_in: i32 = jxlload_options.fail_on as i32;
14579        let fail_on_in_name = utils::new_c_string("fail-on")?;
14580
14581        let revalidate_in: i32 = if jxlload_options.revalidate { 1 } else { 0 };
14582        let revalidate_in_name = utils::new_c_string("revalidate")?;
14583
14584        let vips_op_response = bindings::vips_jxlload(
14585            filename_in.as_ptr(),
14586            &mut out_out,
14587            flags_in_name.as_ptr(),
14588            flags_in,
14589            memory_in_name.as_ptr(),
14590            memory_in,
14591            access_in_name.as_ptr(),
14592            access_in,
14593            fail_on_in_name.as_ptr(),
14594            fail_on_in,
14595            revalidate_in_name.as_ptr(),
14596            revalidate_in,
14597            NULL,
14598        );
14599        utils::result(
14600            vips_op_response,
14601            VipsImage { ctx: out_out },
14602            Error::JxlloadError,
14603        )
14604    }
14605}
14606
14607/// VipsForeignLoadJxlBuffer (jxlload_buffer), load JPEG-XL image, priority=0, untrusted, is_a_buffer, get_flags, header, load
14608/// buffer: `&[u8]` -> Buffer to load from
14609/// returns `VipsImage` - Output image
14610pub fn jxlload_buffer(buffer: &[u8]) -> Result<VipsImage> {
14611    unsafe {
14612        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
14613        let mut out_out: *mut bindings::VipsImage = null_mut();
14614
14615        let vips_op_response =
14616            bindings::vips_jxlload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
14617        utils::result(
14618            vips_op_response,
14619            VipsImage { ctx: out_out },
14620            Error::JxlloadBufferError,
14621        )
14622    }
14623}
14624
14625/// Options for jxlload_buffer operation
14626#[derive(Clone, Debug)]
14627pub struct JxlloadBufferOptions {
14628    /// flags: `ForeignFlags` -> Flags for this file
14629    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14630    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14631    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14632    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14633    ///  `All` -> VIPS_FOREIGN_ALL = 7
14634    pub flags: ForeignFlags,
14635    /// memory: `bool` -> Force open via memory
14636    /// default: false
14637    pub memory: bool,
14638    /// access: `Access` -> Required access pattern for this file
14639    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14640    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14641    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14642    ///  `Last` -> VIPS_ACCESS_LAST = 3
14643    pub access: Access,
14644    /// fail_on: `FailOn` -> Error level to fail on
14645    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14646    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14647    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14648    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14649    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14650    pub fail_on: FailOn,
14651    /// revalidate: `bool` -> Don't use a cached result for this operation
14652    /// default: false
14653    pub revalidate: bool,
14654}
14655
14656impl std::default::Default for JxlloadBufferOptions {
14657    fn default() -> Self {
14658        JxlloadBufferOptions {
14659            flags: ForeignFlags::None,
14660            memory: false,
14661            access: Access::Random,
14662            fail_on: FailOn::None,
14663            revalidate: false,
14664        }
14665    }
14666}
14667
14668/// VipsForeignLoadJxlBuffer (jxlload_buffer), load JPEG-XL image, priority=0, untrusted, is_a_buffer, get_flags, header, load
14669/// buffer: `&[u8]` -> Buffer to load from
14670/// jxlload_buffer_options: `&JxlloadBufferOptions` -> optional arguments
14671/// returns `VipsImage` - Output image
14672pub fn jxlload_buffer_with_opts(
14673    buffer: &[u8],
14674    jxlload_buffer_options: &JxlloadBufferOptions,
14675) -> Result<VipsImage> {
14676    unsafe {
14677        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
14678        let mut out_out: *mut bindings::VipsImage = null_mut();
14679
14680        let flags_in: i32 = jxlload_buffer_options.flags as i32;
14681        let flags_in_name = utils::new_c_string("flags")?;
14682
14683        let memory_in: i32 = if jxlload_buffer_options.memory { 1 } else { 0 };
14684        let memory_in_name = utils::new_c_string("memory")?;
14685
14686        let access_in: i32 = jxlload_buffer_options.access as i32;
14687        let access_in_name = utils::new_c_string("access")?;
14688
14689        let fail_on_in: i32 = jxlload_buffer_options.fail_on as i32;
14690        let fail_on_in_name = utils::new_c_string("fail-on")?;
14691
14692        let revalidate_in: i32 = if jxlload_buffer_options.revalidate {
14693            1
14694        } else {
14695            0
14696        };
14697        let revalidate_in_name = utils::new_c_string("revalidate")?;
14698
14699        let vips_op_response = bindings::vips_jxlload_buffer(
14700            buffer_in,
14701            buffer.len() as u64,
14702            &mut out_out,
14703            flags_in_name.as_ptr(),
14704            flags_in,
14705            memory_in_name.as_ptr(),
14706            memory_in,
14707            access_in_name.as_ptr(),
14708            access_in,
14709            fail_on_in_name.as_ptr(),
14710            fail_on_in,
14711            revalidate_in_name.as_ptr(),
14712            revalidate_in,
14713            NULL,
14714        );
14715        utils::result(
14716            vips_op_response,
14717            VipsImage { ctx: out_out },
14718            Error::JxlloadBufferError,
14719        )
14720    }
14721}
14722
14723/// VipsForeignLoadJxlSource (jxlload_source), load JPEG-XL image, priority=0, untrusted, is_a_source, get_flags, header, load
14724/// source: `&VipsSource` -> Source to load from
14725/// returns `VipsImage` - Output image
14726pub fn jxlload_source(source: &VipsSource) -> Result<VipsImage> {
14727    unsafe {
14728        let source_in: *mut bindings::VipsSource = source.ctx;
14729        let mut out_out: *mut bindings::VipsImage = null_mut();
14730
14731        let vips_op_response = bindings::vips_jxlload_source(source_in, &mut out_out, NULL);
14732        utils::result(
14733            vips_op_response,
14734            VipsImage { ctx: out_out },
14735            Error::JxlloadSourceError,
14736        )
14737    }
14738}
14739
14740/// Options for jxlload_source operation
14741#[derive(Clone, Debug)]
14742pub struct JxlloadSourceOptions {
14743    /// flags: `ForeignFlags` -> Flags for this file
14744    ///  `None` -> VIPS_FOREIGN_NONE = 0 [DEFAULT]
14745    ///  `Partial` -> VIPS_FOREIGN_PARTIAL = 1
14746    ///  `Bigendian` -> VIPS_FOREIGN_BIGENDIAN = 2
14747    ///  `Sequential` -> VIPS_FOREIGN_SEQUENTIAL = 4
14748    ///  `All` -> VIPS_FOREIGN_ALL = 7
14749    pub flags: ForeignFlags,
14750    /// memory: `bool` -> Force open via memory
14751    /// default: false
14752    pub memory: bool,
14753    /// access: `Access` -> Required access pattern for this file
14754    ///  `Random` -> VIPS_ACCESS_RANDOM = 0 [DEFAULT]
14755    ///  `Sequential` -> VIPS_ACCESS_SEQUENTIAL = 1
14756    ///  `SequentialUnbuffered` -> VIPS_ACCESS_SEQUENTIAL_UNBUFFERED = 2
14757    ///  `Last` -> VIPS_ACCESS_LAST = 3
14758    pub access: Access,
14759    /// fail_on: `FailOn` -> Error level to fail on
14760    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
14761    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
14762    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
14763    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
14764    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
14765    pub fail_on: FailOn,
14766    /// revalidate: `bool` -> Don't use a cached result for this operation
14767    /// default: false
14768    pub revalidate: bool,
14769}
14770
14771impl std::default::Default for JxlloadSourceOptions {
14772    fn default() -> Self {
14773        JxlloadSourceOptions {
14774            flags: ForeignFlags::None,
14775            memory: false,
14776            access: Access::Random,
14777            fail_on: FailOn::None,
14778            revalidate: false,
14779        }
14780    }
14781}
14782
14783/// VipsForeignLoadJxlSource (jxlload_source), load JPEG-XL image, priority=0, untrusted, is_a_source, get_flags, header, load
14784/// source: `&VipsSource` -> Source to load from
14785/// jxlload_source_options: `&JxlloadSourceOptions` -> optional arguments
14786/// returns `VipsImage` - Output image
14787pub fn jxlload_source_with_opts(
14788    source: &VipsSource,
14789    jxlload_source_options: &JxlloadSourceOptions,
14790) -> Result<VipsImage> {
14791    unsafe {
14792        let source_in: *mut bindings::VipsSource = source.ctx;
14793        let mut out_out: *mut bindings::VipsImage = null_mut();
14794
14795        let flags_in: i32 = jxlload_source_options.flags as i32;
14796        let flags_in_name = utils::new_c_string("flags")?;
14797
14798        let memory_in: i32 = if jxlload_source_options.memory { 1 } else { 0 };
14799        let memory_in_name = utils::new_c_string("memory")?;
14800
14801        let access_in: i32 = jxlload_source_options.access as i32;
14802        let access_in_name = utils::new_c_string("access")?;
14803
14804        let fail_on_in: i32 = jxlload_source_options.fail_on as i32;
14805        let fail_on_in_name = utils::new_c_string("fail-on")?;
14806
14807        let revalidate_in: i32 = if jxlload_source_options.revalidate {
14808            1
14809        } else {
14810            0
14811        };
14812        let revalidate_in_name = utils::new_c_string("revalidate")?;
14813
14814        let vips_op_response = bindings::vips_jxlload_source(
14815            source_in,
14816            &mut out_out,
14817            flags_in_name.as_ptr(),
14818            flags_in,
14819            memory_in_name.as_ptr(),
14820            memory_in,
14821            access_in_name.as_ptr(),
14822            access_in,
14823            fail_on_in_name.as_ptr(),
14824            fail_on_in,
14825            revalidate_in_name.as_ptr(),
14826            revalidate_in,
14827            NULL,
14828        );
14829        utils::result(
14830            vips_op_response,
14831            VipsImage { ctx: out_out },
14832            Error::JxlloadSourceError,
14833        )
14834    }
14835}
14836
14837/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
14838/// inp: `&VipsImage` -> Image to save
14839/// filename: `&str` -> Filename to save to
14840
14841pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
14842    unsafe {
14843        let inp_in: *mut bindings::VipsImage = inp.ctx;
14844        let filename_in: CString = utils::new_c_string(filename)?;
14845
14846        let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
14847        utils::result(vips_op_response, (), Error::CsvsaveError)
14848    }
14849}
14850
14851/// Options for csvsave operation
14852#[derive(Clone, Debug)]
14853pub struct CsvsaveOptions {
14854    /// separator: `String` -> Separator characters
14855    pub separator: String,
14856    /// keep: `ForeignKeep` -> Which metadata to retain
14857    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14858    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14859    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14860    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14861    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14862    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14863    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14864    pub keep: ForeignKeep,
14865    /// background: `Vec<f64>` -> Background value
14866    pub background: Vec<f64>,
14867    /// page_height: `i32` -> Set page height for multipage save
14868    /// min: 0, max: 10000000, default: 0
14869    pub page_height: i32,
14870    /// profile: `String` -> Filename of ICC profile to embed
14871    pub profile: String,
14872}
14873
14874impl std::default::Default for CsvsaveOptions {
14875    fn default() -> Self {
14876        CsvsaveOptions {
14877            separator: String::new(),
14878            keep: ForeignKeep::All,
14879            background: Vec::new(),
14880            page_height: i32::from(0),
14881            profile: String::from("sRGB"),
14882        }
14883    }
14884}
14885
14886/// VipsForeignSaveCsvFile (csvsave), save image to csv (.csv), priority=0, mono
14887/// inp: `&VipsImage` -> Image to save
14888/// filename: `&str` -> Filename to save to
14889/// csvsave_options: `&CsvsaveOptions` -> optional arguments
14890
14891pub fn csvsave_with_opts(
14892    inp: &VipsImage,
14893    filename: &str,
14894    csvsave_options: &CsvsaveOptions,
14895) -> Result<()> {
14896    unsafe {
14897        let inp_in: *mut bindings::VipsImage = inp.ctx;
14898        let filename_in: CString = utils::new_c_string(filename)?;
14899
14900        let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
14901        let separator_in_name = utils::new_c_string("separator")?;
14902
14903        let keep_in: i32 = csvsave_options.keep as i32;
14904        let keep_in_name = utils::new_c_string("keep")?;
14905
14906        let background_wrapper =
14907            utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
14908        let background_in = background_wrapper.ctx;
14909        let background_in_name = utils::new_c_string("background")?;
14910
14911        let page_height_in: i32 = csvsave_options.page_height;
14912        let page_height_in_name = utils::new_c_string("page-height")?;
14913
14914        let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
14915        let profile_in_name = utils::new_c_string("profile")?;
14916
14917        let vips_op_response = bindings::vips_csvsave(
14918            inp_in,
14919            filename_in.as_ptr(),
14920            separator_in_name.as_ptr(),
14921            separator_in.as_ptr(),
14922            keep_in_name.as_ptr(),
14923            keep_in,
14924            background_in_name.as_ptr(),
14925            background_in,
14926            page_height_in_name.as_ptr(),
14927            page_height_in,
14928            profile_in_name.as_ptr(),
14929            profile_in.as_ptr(),
14930            NULL,
14931        );
14932        utils::result(vips_op_response, (), Error::CsvsaveError)
14933    }
14934}
14935
14936/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
14937/// inp: `&VipsImage` -> Image to save
14938/// target: `&VipsTarget` -> Target to save to
14939
14940pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14941    unsafe {
14942        let inp_in: *mut bindings::VipsImage = inp.ctx;
14943        let target_in: *mut bindings::VipsTarget = target.ctx;
14944
14945        let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
14946        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
14947    }
14948}
14949
14950/// Options for csvsave_target operation
14951#[derive(Clone, Debug)]
14952pub struct CsvsaveTargetOptions {
14953    /// separator: `String` -> Separator characters
14954    pub separator: String,
14955    /// keep: `ForeignKeep` -> Which metadata to retain
14956    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
14957    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
14958    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
14959    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
14960    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
14961    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
14962    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
14963    pub keep: ForeignKeep,
14964    /// background: `Vec<f64>` -> Background value
14965    pub background: Vec<f64>,
14966    /// page_height: `i32` -> Set page height for multipage save
14967    /// min: 0, max: 10000000, default: 0
14968    pub page_height: i32,
14969    /// profile: `String` -> Filename of ICC profile to embed
14970    pub profile: String,
14971}
14972
14973impl std::default::Default for CsvsaveTargetOptions {
14974    fn default() -> Self {
14975        CsvsaveTargetOptions {
14976            separator: String::new(),
14977            keep: ForeignKeep::All,
14978            background: Vec::new(),
14979            page_height: i32::from(0),
14980            profile: String::from("sRGB"),
14981        }
14982    }
14983}
14984
14985/// VipsForeignSaveCsvTarget (csvsave_target), save image to csv (.csv), priority=0, mono
14986/// inp: `&VipsImage` -> Image to save
14987/// target: `&VipsTarget` -> Target to save to
14988/// csvsave_target_options: `&CsvsaveTargetOptions` -> optional arguments
14989
14990pub fn csvsave_target_with_opts(
14991    inp: &VipsImage,
14992    target: &VipsTarget,
14993    csvsave_target_options: &CsvsaveTargetOptions,
14994) -> Result<()> {
14995    unsafe {
14996        let inp_in: *mut bindings::VipsImage = inp.ctx;
14997        let target_in: *mut bindings::VipsTarget = target.ctx;
14998
14999        let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
15000        let separator_in_name = utils::new_c_string("separator")?;
15001
15002        let keep_in: i32 = csvsave_target_options.keep as i32;
15003        let keep_in_name = utils::new_c_string("keep")?;
15004
15005        let background_wrapper =
15006            utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
15007        let background_in = background_wrapper.ctx;
15008        let background_in_name = utils::new_c_string("background")?;
15009
15010        let page_height_in: i32 = csvsave_target_options.page_height;
15011        let page_height_in_name = utils::new_c_string("page-height")?;
15012
15013        let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
15014        let profile_in_name = utils::new_c_string("profile")?;
15015
15016        let vips_op_response = bindings::vips_csvsave_target(
15017            inp_in,
15018            target_in,
15019            separator_in_name.as_ptr(),
15020            separator_in.as_ptr(),
15021            keep_in_name.as_ptr(),
15022            keep_in,
15023            background_in_name.as_ptr(),
15024            background_in,
15025            page_height_in_name.as_ptr(),
15026            page_height_in,
15027            profile_in_name.as_ptr(),
15028            profile_in.as_ptr(),
15029            NULL,
15030        );
15031        utils::result(vips_op_response, (), Error::CsvsaveTargetError)
15032    }
15033}
15034
15035/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
15036/// inp: `&VipsImage` -> Image to save
15037/// filename: `&str` -> Filename to save to
15038
15039pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
15040    unsafe {
15041        let inp_in: *mut bindings::VipsImage = inp.ctx;
15042        let filename_in: CString = utils::new_c_string(filename)?;
15043
15044        let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
15045        utils::result(vips_op_response, (), Error::MatrixsaveError)
15046    }
15047}
15048
15049/// Options for matrixsave operation
15050#[derive(Clone, Debug)]
15051pub struct MatrixsaveOptions {
15052    /// keep: `ForeignKeep` -> Which metadata to retain
15053    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15054    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15055    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15056    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15057    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15058    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15059    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15060    pub keep: ForeignKeep,
15061    /// background: `Vec<f64>` -> Background value
15062    pub background: Vec<f64>,
15063    /// page_height: `i32` -> Set page height for multipage save
15064    /// min: 0, max: 10000000, default: 0
15065    pub page_height: i32,
15066    /// profile: `String` -> Filename of ICC profile to embed
15067    pub profile: String,
15068}
15069
15070impl std::default::Default for MatrixsaveOptions {
15071    fn default() -> Self {
15072        MatrixsaveOptions {
15073            keep: ForeignKeep::All,
15074            background: Vec::new(),
15075            page_height: i32::from(0),
15076            profile: String::from("sRGB"),
15077        }
15078    }
15079}
15080
15081/// VipsForeignSaveMatrixFile (matrixsave), save image to matrix (.mat), priority=0, mono
15082/// inp: `&VipsImage` -> Image to save
15083/// filename: `&str` -> Filename to save to
15084/// matrixsave_options: `&MatrixsaveOptions` -> optional arguments
15085
15086pub fn matrixsave_with_opts(
15087    inp: &VipsImage,
15088    filename: &str,
15089    matrixsave_options: &MatrixsaveOptions,
15090) -> Result<()> {
15091    unsafe {
15092        let inp_in: *mut bindings::VipsImage = inp.ctx;
15093        let filename_in: CString = utils::new_c_string(filename)?;
15094
15095        let keep_in: i32 = matrixsave_options.keep as i32;
15096        let keep_in_name = utils::new_c_string("keep")?;
15097
15098        let background_wrapper =
15099            utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
15100        let background_in = background_wrapper.ctx;
15101        let background_in_name = utils::new_c_string("background")?;
15102
15103        let page_height_in: i32 = matrixsave_options.page_height;
15104        let page_height_in_name = utils::new_c_string("page-height")?;
15105
15106        let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
15107        let profile_in_name = utils::new_c_string("profile")?;
15108
15109        let vips_op_response = bindings::vips_matrixsave(
15110            inp_in,
15111            filename_in.as_ptr(),
15112            keep_in_name.as_ptr(),
15113            keep_in,
15114            background_in_name.as_ptr(),
15115            background_in,
15116            page_height_in_name.as_ptr(),
15117            page_height_in,
15118            profile_in_name.as_ptr(),
15119            profile_in.as_ptr(),
15120            NULL,
15121        );
15122        utils::result(vips_op_response, (), Error::MatrixsaveError)
15123    }
15124}
15125
15126/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
15127/// inp: `&VipsImage` -> Image to save
15128/// target: `&VipsTarget` -> Target to save to
15129
15130pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15131    unsafe {
15132        let inp_in: *mut bindings::VipsImage = inp.ctx;
15133        let target_in: *mut bindings::VipsTarget = target.ctx;
15134
15135        let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
15136        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
15137    }
15138}
15139
15140/// Options for matrixsave_target operation
15141#[derive(Clone, Debug)]
15142pub struct MatrixsaveTargetOptions {
15143    /// keep: `ForeignKeep` -> Which metadata to retain
15144    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15145    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15146    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15147    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15148    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15149    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15150    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15151    pub keep: ForeignKeep,
15152    /// background: `Vec<f64>` -> Background value
15153    pub background: Vec<f64>,
15154    /// page_height: `i32` -> Set page height for multipage save
15155    /// min: 0, max: 10000000, default: 0
15156    pub page_height: i32,
15157    /// profile: `String` -> Filename of ICC profile to embed
15158    pub profile: String,
15159}
15160
15161impl std::default::Default for MatrixsaveTargetOptions {
15162    fn default() -> Self {
15163        MatrixsaveTargetOptions {
15164            keep: ForeignKeep::All,
15165            background: Vec::new(),
15166            page_height: i32::from(0),
15167            profile: String::from("sRGB"),
15168        }
15169    }
15170}
15171
15172/// VipsForeignSaveMatrixTarget (matrixsave_target), save image to matrix (.mat), priority=0, mono
15173/// inp: `&VipsImage` -> Image to save
15174/// target: `&VipsTarget` -> Target to save to
15175/// matrixsave_target_options: `&MatrixsaveTargetOptions` -> optional arguments
15176
15177pub fn matrixsave_target_with_opts(
15178    inp: &VipsImage,
15179    target: &VipsTarget,
15180    matrixsave_target_options: &MatrixsaveTargetOptions,
15181) -> Result<()> {
15182    unsafe {
15183        let inp_in: *mut bindings::VipsImage = inp.ctx;
15184        let target_in: *mut bindings::VipsTarget = target.ctx;
15185
15186        let keep_in: i32 = matrixsave_target_options.keep as i32;
15187        let keep_in_name = utils::new_c_string("keep")?;
15188
15189        let background_wrapper =
15190            utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
15191        let background_in = background_wrapper.ctx;
15192        let background_in_name = utils::new_c_string("background")?;
15193
15194        let page_height_in: i32 = matrixsave_target_options.page_height;
15195        let page_height_in_name = utils::new_c_string("page-height")?;
15196
15197        let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
15198        let profile_in_name = utils::new_c_string("profile")?;
15199
15200        let vips_op_response = bindings::vips_matrixsave_target(
15201            inp_in,
15202            target_in,
15203            keep_in_name.as_ptr(),
15204            keep_in,
15205            background_in_name.as_ptr(),
15206            background_in,
15207            page_height_in_name.as_ptr(),
15208            page_height_in,
15209            profile_in_name.as_ptr(),
15210            profile_in.as_ptr(),
15211            NULL,
15212        );
15213        utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
15214    }
15215}
15216
15217/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
15218/// inp: `&VipsImage` -> Image to save
15219
15220pub fn matrixprint(inp: &VipsImage) -> Result<()> {
15221    unsafe {
15222        let inp_in: *mut bindings::VipsImage = inp.ctx;
15223
15224        let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
15225        utils::result(vips_op_response, (), Error::MatrixprintError)
15226    }
15227}
15228
15229/// Options for matrixprint operation
15230#[derive(Clone, Debug)]
15231pub struct MatrixprintOptions {
15232    /// keep: `ForeignKeep` -> Which metadata to retain
15233    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15234    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15235    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15236    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15237    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15238    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15239    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15240    pub keep: ForeignKeep,
15241    /// background: `Vec<f64>` -> Background value
15242    pub background: Vec<f64>,
15243    /// page_height: `i32` -> Set page height for multipage save
15244    /// min: 0, max: 10000000, default: 0
15245    pub page_height: i32,
15246    /// profile: `String` -> Filename of ICC profile to embed
15247    pub profile: String,
15248}
15249
15250impl std::default::Default for MatrixprintOptions {
15251    fn default() -> Self {
15252        MatrixprintOptions {
15253            keep: ForeignKeep::All,
15254            background: Vec::new(),
15255            page_height: i32::from(0),
15256            profile: String::from("sRGB"),
15257        }
15258    }
15259}
15260
15261/// VipsForeignPrintMatrix (matrixprint), print matrix (.mat), priority=0, mono
15262/// inp: `&VipsImage` -> Image to save
15263/// matrixprint_options: `&MatrixprintOptions` -> optional arguments
15264
15265pub fn matrixprint_with_opts(
15266    inp: &VipsImage,
15267    matrixprint_options: &MatrixprintOptions,
15268) -> Result<()> {
15269    unsafe {
15270        let inp_in: *mut bindings::VipsImage = inp.ctx;
15271
15272        let keep_in: i32 = matrixprint_options.keep as i32;
15273        let keep_in_name = utils::new_c_string("keep")?;
15274
15275        let background_wrapper =
15276            utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
15277        let background_in = background_wrapper.ctx;
15278        let background_in_name = utils::new_c_string("background")?;
15279
15280        let page_height_in: i32 = matrixprint_options.page_height;
15281        let page_height_in_name = utils::new_c_string("page-height")?;
15282
15283        let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
15284        let profile_in_name = utils::new_c_string("profile")?;
15285
15286        let vips_op_response = bindings::vips_matrixprint(
15287            inp_in,
15288            keep_in_name.as_ptr(),
15289            keep_in,
15290            background_in_name.as_ptr(),
15291            background_in,
15292            page_height_in_name.as_ptr(),
15293            page_height_in,
15294            profile_in_name.as_ptr(),
15295            profile_in.as_ptr(),
15296            NULL,
15297        );
15298        utils::result(vips_op_response, (), Error::MatrixprintError)
15299    }
15300}
15301
15302/// VipsForeignSaveRaw (rawsave), save image to raw file (.raw), priority=0, any
15303/// inp: `&VipsImage` -> Image to save
15304/// filename: `&str` -> Filename to save to
15305
15306pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
15307    unsafe {
15308        let inp_in: *mut bindings::VipsImage = inp.ctx;
15309        let filename_in: CString = utils::new_c_string(filename)?;
15310
15311        let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
15312        utils::result(vips_op_response, (), Error::RawsaveError)
15313    }
15314}
15315
15316/// Options for rawsave operation
15317#[derive(Clone, Debug)]
15318pub struct RawsaveOptions {
15319    /// keep: `ForeignKeep` -> Which metadata to retain
15320    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15321    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15322    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15323    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15324    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15325    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15326    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15327    pub keep: ForeignKeep,
15328    /// background: `Vec<f64>` -> Background value
15329    pub background: Vec<f64>,
15330    /// page_height: `i32` -> Set page height for multipage save
15331    /// min: 0, max: 10000000, default: 0
15332    pub page_height: i32,
15333    /// profile: `String` -> Filename of ICC profile to embed
15334    pub profile: String,
15335}
15336
15337impl std::default::Default for RawsaveOptions {
15338    fn default() -> Self {
15339        RawsaveOptions {
15340            keep: ForeignKeep::All,
15341            background: Vec::new(),
15342            page_height: i32::from(0),
15343            profile: String::from("sRGB"),
15344        }
15345    }
15346}
15347
15348/// VipsForeignSaveRaw (rawsave), save image to raw file (.raw), priority=0, any
15349/// inp: `&VipsImage` -> Image to save
15350/// filename: `&str` -> Filename to save to
15351/// rawsave_options: `&RawsaveOptions` -> optional arguments
15352
15353pub fn rawsave_with_opts(
15354    inp: &VipsImage,
15355    filename: &str,
15356    rawsave_options: &RawsaveOptions,
15357) -> Result<()> {
15358    unsafe {
15359        let inp_in: *mut bindings::VipsImage = inp.ctx;
15360        let filename_in: CString = utils::new_c_string(filename)?;
15361
15362        let keep_in: i32 = rawsave_options.keep as i32;
15363        let keep_in_name = utils::new_c_string("keep")?;
15364
15365        let background_wrapper =
15366            utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
15367        let background_in = background_wrapper.ctx;
15368        let background_in_name = utils::new_c_string("background")?;
15369
15370        let page_height_in: i32 = rawsave_options.page_height;
15371        let page_height_in_name = utils::new_c_string("page-height")?;
15372
15373        let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
15374        let profile_in_name = utils::new_c_string("profile")?;
15375
15376        let vips_op_response = bindings::vips_rawsave(
15377            inp_in,
15378            filename_in.as_ptr(),
15379            keep_in_name.as_ptr(),
15380            keep_in,
15381            background_in_name.as_ptr(),
15382            background_in,
15383            page_height_in_name.as_ptr(),
15384            page_height_in,
15385            profile_in_name.as_ptr(),
15386            profile_in.as_ptr(),
15387            NULL,
15388        );
15389        utils::result(vips_op_response, (), Error::RawsaveError)
15390    }
15391}
15392
15393/// VipsForeignSaveRawFd (rawsave_fd), write raw image to file descriptor (.raw), priority=0, any
15394/// inp: `&VipsImage` -> Image to save
15395/// fd: `i32` -> File descriptor to write to
15396/// min: 0, max: 10000, default: 0
15397
15398pub fn rawsave_fd(inp: &VipsImage, fd: i32) -> Result<()> {
15399    unsafe {
15400        let inp_in: *mut bindings::VipsImage = inp.ctx;
15401        let fd_in: i32 = fd;
15402
15403        let vips_op_response = bindings::vips_rawsave_fd(inp_in, fd_in, NULL);
15404        utils::result(vips_op_response, (), Error::RawsaveFdError)
15405    }
15406}
15407
15408/// Options for rawsave_fd operation
15409#[derive(Clone, Debug)]
15410pub struct RawsaveFdOptions {
15411    /// keep: `ForeignKeep` -> Which metadata to retain
15412    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15413    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15414    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15415    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15416    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15417    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15418    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15419    pub keep: ForeignKeep,
15420    /// background: `Vec<f64>` -> Background value
15421    pub background: Vec<f64>,
15422    /// page_height: `i32` -> Set page height for multipage save
15423    /// min: 0, max: 10000000, default: 0
15424    pub page_height: i32,
15425    /// profile: `String` -> Filename of ICC profile to embed
15426    pub profile: String,
15427}
15428
15429impl std::default::Default for RawsaveFdOptions {
15430    fn default() -> Self {
15431        RawsaveFdOptions {
15432            keep: ForeignKeep::All,
15433            background: Vec::new(),
15434            page_height: i32::from(0),
15435            profile: String::from("sRGB"),
15436        }
15437    }
15438}
15439
15440/// VipsForeignSaveRawFd (rawsave_fd), write raw image to file descriptor (.raw), priority=0, any
15441/// inp: `&VipsImage` -> Image to save
15442/// fd: `i32` -> File descriptor to write to
15443/// min: 0, max: 10000, default: 0
15444/// rawsave_fd_options: `&RawsaveFdOptions` -> optional arguments
15445
15446pub fn rawsave_fd_with_opts(
15447    inp: &VipsImage,
15448    fd: i32,
15449    rawsave_fd_options: &RawsaveFdOptions,
15450) -> Result<()> {
15451    unsafe {
15452        let inp_in: *mut bindings::VipsImage = inp.ctx;
15453        let fd_in: i32 = fd;
15454
15455        let keep_in: i32 = rawsave_fd_options.keep as i32;
15456        let keep_in_name = utils::new_c_string("keep")?;
15457
15458        let background_wrapper =
15459            utils::VipsArrayDoubleWrapper::from(&rawsave_fd_options.background[..]);
15460        let background_in = background_wrapper.ctx;
15461        let background_in_name = utils::new_c_string("background")?;
15462
15463        let page_height_in: i32 = rawsave_fd_options.page_height;
15464        let page_height_in_name = utils::new_c_string("page-height")?;
15465
15466        let profile_in: CString = utils::new_c_string(&rawsave_fd_options.profile)?;
15467        let profile_in_name = utils::new_c_string("profile")?;
15468
15469        let vips_op_response = bindings::vips_rawsave_fd(
15470            inp_in,
15471            fd_in,
15472            keep_in_name.as_ptr(),
15473            keep_in,
15474            background_in_name.as_ptr(),
15475            background_in,
15476            page_height_in_name.as_ptr(),
15477            page_height_in,
15478            profile_in_name.as_ptr(),
15479            profile_in.as_ptr(),
15480            NULL,
15481        );
15482        utils::result(vips_op_response, (), Error::RawsaveFdError)
15483    }
15484}
15485
15486/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
15487/// inp: `&VipsImage` -> Image to save
15488/// filename: `&str` -> Filename to save to
15489
15490pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
15491    unsafe {
15492        let inp_in: *mut bindings::VipsImage = inp.ctx;
15493        let filename_in: CString = utils::new_c_string(filename)?;
15494
15495        let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
15496        utils::result(vips_op_response, (), Error::VipssaveError)
15497    }
15498}
15499
15500/// Options for vipssave operation
15501#[derive(Clone, Debug)]
15502pub struct VipssaveOptions {
15503    /// keep: `ForeignKeep` -> Which metadata to retain
15504    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15505    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15506    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15507    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15508    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15509    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15510    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15511    pub keep: ForeignKeep,
15512    /// background: `Vec<f64>` -> Background value
15513    pub background: Vec<f64>,
15514    /// page_height: `i32` -> Set page height for multipage save
15515    /// min: 0, max: 10000000, default: 0
15516    pub page_height: i32,
15517    /// profile: `String` -> Filename of ICC profile to embed
15518    pub profile: String,
15519}
15520
15521impl std::default::Default for VipssaveOptions {
15522    fn default() -> Self {
15523        VipssaveOptions {
15524            keep: ForeignKeep::All,
15525            background: Vec::new(),
15526            page_height: i32::from(0),
15527            profile: String::from("sRGB"),
15528        }
15529    }
15530}
15531
15532/// VipsForeignSaveVipsFile (vipssave), save image to file in vips format (.v, .vips), priority=0, any
15533/// inp: `&VipsImage` -> Image to save
15534/// filename: `&str` -> Filename to save to
15535/// vipssave_options: `&VipssaveOptions` -> optional arguments
15536
15537pub fn vipssave_with_opts(
15538    inp: &VipsImage,
15539    filename: &str,
15540    vipssave_options: &VipssaveOptions,
15541) -> Result<()> {
15542    unsafe {
15543        let inp_in: *mut bindings::VipsImage = inp.ctx;
15544        let filename_in: CString = utils::new_c_string(filename)?;
15545
15546        let keep_in: i32 = vipssave_options.keep as i32;
15547        let keep_in_name = utils::new_c_string("keep")?;
15548
15549        let background_wrapper =
15550            utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
15551        let background_in = background_wrapper.ctx;
15552        let background_in_name = utils::new_c_string("background")?;
15553
15554        let page_height_in: i32 = vipssave_options.page_height;
15555        let page_height_in_name = utils::new_c_string("page-height")?;
15556
15557        let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
15558        let profile_in_name = utils::new_c_string("profile")?;
15559
15560        let vips_op_response = bindings::vips_vipssave(
15561            inp_in,
15562            filename_in.as_ptr(),
15563            keep_in_name.as_ptr(),
15564            keep_in,
15565            background_in_name.as_ptr(),
15566            background_in,
15567            page_height_in_name.as_ptr(),
15568            page_height_in,
15569            profile_in_name.as_ptr(),
15570            profile_in.as_ptr(),
15571            NULL,
15572        );
15573        utils::result(vips_op_response, (), Error::VipssaveError)
15574    }
15575}
15576
15577/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
15578/// inp: `&VipsImage` -> Image to save
15579/// target: `&VipsTarget` -> Target to save to
15580
15581pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15582    unsafe {
15583        let inp_in: *mut bindings::VipsImage = inp.ctx;
15584        let target_in: *mut bindings::VipsTarget = target.ctx;
15585
15586        let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
15587        utils::result(vips_op_response, (), Error::VipssaveTargetError)
15588    }
15589}
15590
15591/// Options for vipssave_target operation
15592#[derive(Clone, Debug)]
15593pub struct VipssaveTargetOptions {
15594    /// keep: `ForeignKeep` -> Which metadata to retain
15595    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15596    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15597    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15598    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15599    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15600    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15601    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15602    pub keep: ForeignKeep,
15603    /// background: `Vec<f64>` -> Background value
15604    pub background: Vec<f64>,
15605    /// page_height: `i32` -> Set page height for multipage save
15606    /// min: 0, max: 10000000, default: 0
15607    pub page_height: i32,
15608    /// profile: `String` -> Filename of ICC profile to embed
15609    pub profile: String,
15610}
15611
15612impl std::default::Default for VipssaveTargetOptions {
15613    fn default() -> Self {
15614        VipssaveTargetOptions {
15615            keep: ForeignKeep::All,
15616            background: Vec::new(),
15617            page_height: i32::from(0),
15618            profile: String::from("sRGB"),
15619        }
15620    }
15621}
15622
15623/// VipsForeignSaveVipsTarget (vipssave_target), save image to target in vips format (.v, .vips), priority=0, any
15624/// inp: `&VipsImage` -> Image to save
15625/// target: `&VipsTarget` -> Target to save to
15626/// vipssave_target_options: `&VipssaveTargetOptions` -> optional arguments
15627
15628pub fn vipssave_target_with_opts(
15629    inp: &VipsImage,
15630    target: &VipsTarget,
15631    vipssave_target_options: &VipssaveTargetOptions,
15632) -> Result<()> {
15633    unsafe {
15634        let inp_in: *mut bindings::VipsImage = inp.ctx;
15635        let target_in: *mut bindings::VipsTarget = target.ctx;
15636
15637        let keep_in: i32 = vipssave_target_options.keep as i32;
15638        let keep_in_name = utils::new_c_string("keep")?;
15639
15640        let background_wrapper =
15641            utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
15642        let background_in = background_wrapper.ctx;
15643        let background_in_name = utils::new_c_string("background")?;
15644
15645        let page_height_in: i32 = vipssave_target_options.page_height;
15646        let page_height_in_name = utils::new_c_string("page-height")?;
15647
15648        let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
15649        let profile_in_name = utils::new_c_string("profile")?;
15650
15651        let vips_op_response = bindings::vips_vipssave_target(
15652            inp_in,
15653            target_in,
15654            keep_in_name.as_ptr(),
15655            keep_in,
15656            background_in_name.as_ptr(),
15657            background_in,
15658            page_height_in_name.as_ptr(),
15659            page_height_in,
15660            profile_in_name.as_ptr(),
15661            profile_in.as_ptr(),
15662            NULL,
15663        );
15664        utils::result(vips_op_response, (), Error::VipssaveTargetError)
15665    }
15666}
15667
15668/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, rgb
15669/// inp: `&VipsImage` -> Image to save
15670/// filename: `&str` -> Filename to save to
15671
15672pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
15673    unsafe {
15674        let inp_in: *mut bindings::VipsImage = inp.ctx;
15675        let filename_in: CString = utils::new_c_string(filename)?;
15676
15677        let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
15678        utils::result(vips_op_response, (), Error::PpmsaveError)
15679    }
15680}
15681
15682/// Options for ppmsave operation
15683#[derive(Clone, Debug)]
15684pub struct PpmsaveOptions {
15685    /// format: `ForeignPpmFormat` -> Format to save in
15686    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
15687    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
15688    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
15689    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
15690    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
15691    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
15692    pub format: ForeignPpmFormat,
15693    /// ascii: `bool` -> Save as ascii
15694    /// default: false
15695    pub ascii: bool,
15696    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
15697    /// min: 0, max: 1, default: 0
15698    pub bitdepth: i32,
15699    /// keep: `ForeignKeep` -> Which metadata to retain
15700    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15701    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15702    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15703    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15704    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15705    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15706    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15707    pub keep: ForeignKeep,
15708    /// background: `Vec<f64>` -> Background value
15709    pub background: Vec<f64>,
15710    /// page_height: `i32` -> Set page height for multipage save
15711    /// min: 0, max: 10000000, default: 0
15712    pub page_height: i32,
15713    /// profile: `String` -> Filename of ICC profile to embed
15714    pub profile: String,
15715}
15716
15717impl std::default::Default for PpmsaveOptions {
15718    fn default() -> Self {
15719        PpmsaveOptions {
15720            format: ForeignPpmFormat::Ppm,
15721            ascii: false,
15722            bitdepth: i32::from(0),
15723            keep: ForeignKeep::All,
15724            background: Vec::new(),
15725            page_height: i32::from(0),
15726            profile: String::from("sRGB"),
15727        }
15728    }
15729}
15730
15731/// VipsForeignSavePpmFile (ppmsave), save image to ppm file (.pbm, .pgm, .ppm, .pfm, .pnm), priority=0, rgb
15732/// inp: `&VipsImage` -> Image to save
15733/// filename: `&str` -> Filename to save to
15734/// ppmsave_options: `&PpmsaveOptions` -> optional arguments
15735
15736pub fn ppmsave_with_opts(
15737    inp: &VipsImage,
15738    filename: &str,
15739    ppmsave_options: &PpmsaveOptions,
15740) -> Result<()> {
15741    unsafe {
15742        let inp_in: *mut bindings::VipsImage = inp.ctx;
15743        let filename_in: CString = utils::new_c_string(filename)?;
15744
15745        let format_in: i32 = ppmsave_options.format as i32;
15746        let format_in_name = utils::new_c_string("format")?;
15747
15748        let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
15749        let ascii_in_name = utils::new_c_string("ascii")?;
15750
15751        let bitdepth_in: i32 = ppmsave_options.bitdepth;
15752        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15753
15754        let keep_in: i32 = ppmsave_options.keep as i32;
15755        let keep_in_name = utils::new_c_string("keep")?;
15756
15757        let background_wrapper =
15758            utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
15759        let background_in = background_wrapper.ctx;
15760        let background_in_name = utils::new_c_string("background")?;
15761
15762        let page_height_in: i32 = ppmsave_options.page_height;
15763        let page_height_in_name = utils::new_c_string("page-height")?;
15764
15765        let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
15766        let profile_in_name = utils::new_c_string("profile")?;
15767
15768        let vips_op_response = bindings::vips_ppmsave(
15769            inp_in,
15770            filename_in.as_ptr(),
15771            format_in_name.as_ptr(),
15772            format_in,
15773            ascii_in_name.as_ptr(),
15774            ascii_in,
15775            bitdepth_in_name.as_ptr(),
15776            bitdepth_in,
15777            keep_in_name.as_ptr(),
15778            keep_in,
15779            background_in_name.as_ptr(),
15780            background_in,
15781            page_height_in_name.as_ptr(),
15782            page_height_in,
15783            profile_in_name.as_ptr(),
15784            profile_in.as_ptr(),
15785            NULL,
15786        );
15787        utils::result(vips_op_response, (), Error::PpmsaveError)
15788    }
15789}
15790
15791/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, rgb
15792/// inp: `&VipsImage` -> Image to save
15793/// target: `&VipsTarget` -> Target to save to
15794
15795pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15796    unsafe {
15797        let inp_in: *mut bindings::VipsImage = inp.ctx;
15798        let target_in: *mut bindings::VipsTarget = target.ctx;
15799
15800        let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
15801        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
15802    }
15803}
15804
15805/// Options for ppmsave_target operation
15806#[derive(Clone, Debug)]
15807pub struct PpmsaveTargetOptions {
15808    /// format: `ForeignPpmFormat` -> Format to save in
15809    ///  `Pbm` -> VIPS_FOREIGN_PPM_FORMAT_PBM = 0
15810    ///  `Pgm` -> VIPS_FOREIGN_PPM_FORMAT_PGM = 1
15811    ///  `Ppm` -> VIPS_FOREIGN_PPM_FORMAT_PPM = 2 [DEFAULT]
15812    ///  `Pfm` -> VIPS_FOREIGN_PPM_FORMAT_PFM = 3
15813    ///  `Pnm` -> VIPS_FOREIGN_PPM_FORMAT_PNM = 4
15814    ///  `Last` -> VIPS_FOREIGN_PPM_FORMAT_LAST = 5
15815    pub format: ForeignPpmFormat,
15816    /// ascii: `bool` -> Save as ascii
15817    /// default: false
15818    pub ascii: bool,
15819    /// bitdepth: `i32` -> Set to 1 to write as a 1 bit image
15820    /// min: 0, max: 1, default: 0
15821    pub bitdepth: i32,
15822    /// keep: `ForeignKeep` -> Which metadata to retain
15823    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15824    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15825    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15826    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15827    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15828    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15829    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15830    pub keep: ForeignKeep,
15831    /// background: `Vec<f64>` -> Background value
15832    pub background: Vec<f64>,
15833    /// page_height: `i32` -> Set page height for multipage save
15834    /// min: 0, max: 10000000, default: 0
15835    pub page_height: i32,
15836    /// profile: `String` -> Filename of ICC profile to embed
15837    pub profile: String,
15838}
15839
15840impl std::default::Default for PpmsaveTargetOptions {
15841    fn default() -> Self {
15842        PpmsaveTargetOptions {
15843            format: ForeignPpmFormat::Ppm,
15844            ascii: false,
15845            bitdepth: i32::from(0),
15846            keep: ForeignKeep::All,
15847            background: Vec::new(),
15848            page_height: i32::from(0),
15849            profile: String::from("sRGB"),
15850        }
15851    }
15852}
15853
15854/// VipsForeignSavePpmTarget (ppmsave_target), save to ppm (.ppm), priority=0, rgb
15855/// inp: `&VipsImage` -> Image to save
15856/// target: `&VipsTarget` -> Target to save to
15857/// ppmsave_target_options: `&PpmsaveTargetOptions` -> optional arguments
15858
15859pub fn ppmsave_target_with_opts(
15860    inp: &VipsImage,
15861    target: &VipsTarget,
15862    ppmsave_target_options: &PpmsaveTargetOptions,
15863) -> Result<()> {
15864    unsafe {
15865        let inp_in: *mut bindings::VipsImage = inp.ctx;
15866        let target_in: *mut bindings::VipsTarget = target.ctx;
15867
15868        let format_in: i32 = ppmsave_target_options.format as i32;
15869        let format_in_name = utils::new_c_string("format")?;
15870
15871        let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
15872        let ascii_in_name = utils::new_c_string("ascii")?;
15873
15874        let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
15875        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15876
15877        let keep_in: i32 = ppmsave_target_options.keep as i32;
15878        let keep_in_name = utils::new_c_string("keep")?;
15879
15880        let background_wrapper =
15881            utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
15882        let background_in = background_wrapper.ctx;
15883        let background_in_name = utils::new_c_string("background")?;
15884
15885        let page_height_in: i32 = ppmsave_target_options.page_height;
15886        let page_height_in_name = utils::new_c_string("page-height")?;
15887
15888        let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
15889        let profile_in_name = utils::new_c_string("profile")?;
15890
15891        let vips_op_response = bindings::vips_ppmsave_target(
15892            inp_in,
15893            target_in,
15894            format_in_name.as_ptr(),
15895            format_in,
15896            ascii_in_name.as_ptr(),
15897            ascii_in,
15898            bitdepth_in_name.as_ptr(),
15899            bitdepth_in,
15900            keep_in_name.as_ptr(),
15901            keep_in,
15902            background_in_name.as_ptr(),
15903            background_in,
15904            page_height_in_name.as_ptr(),
15905            page_height_in,
15906            profile_in_name.as_ptr(),
15907            profile_in.as_ptr(),
15908            NULL,
15909        );
15910        utils::result(vips_op_response, (), Error::PpmsaveTargetError)
15911    }
15912}
15913
15914/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
15915/// inp: `&VipsImage` -> Image to save
15916/// filename: `&str` -> Filename to save to
15917
15918pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
15919    unsafe {
15920        let inp_in: *mut bindings::VipsImage = inp.ctx;
15921        let filename_in: CString = utils::new_c_string(filename)?;
15922
15923        let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
15924        utils::result(vips_op_response, (), Error::RadsaveError)
15925    }
15926}
15927
15928/// Options for radsave operation
15929#[derive(Clone, Debug)]
15930pub struct RadsaveOptions {
15931    /// keep: `ForeignKeep` -> Which metadata to retain
15932    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
15933    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
15934    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
15935    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
15936    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
15937    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
15938    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
15939    pub keep: ForeignKeep,
15940    /// background: `Vec<f64>` -> Background value
15941    pub background: Vec<f64>,
15942    /// page_height: `i32` -> Set page height for multipage save
15943    /// min: 0, max: 10000000, default: 0
15944    pub page_height: i32,
15945    /// profile: `String` -> Filename of ICC profile to embed
15946    pub profile: String,
15947}
15948
15949impl std::default::Default for RadsaveOptions {
15950    fn default() -> Self {
15951        RadsaveOptions {
15952            keep: ForeignKeep::All,
15953            background: Vec::new(),
15954            page_height: i32::from(0),
15955            profile: String::from("sRGB"),
15956        }
15957    }
15958}
15959
15960/// VipsForeignSaveRadFile (radsave), save image to Radiance file (.hdr), priority=0, rgb
15961/// inp: `&VipsImage` -> Image to save
15962/// filename: `&str` -> Filename to save to
15963/// radsave_options: `&RadsaveOptions` -> optional arguments
15964
15965pub fn radsave_with_opts(
15966    inp: &VipsImage,
15967    filename: &str,
15968    radsave_options: &RadsaveOptions,
15969) -> Result<()> {
15970    unsafe {
15971        let inp_in: *mut bindings::VipsImage = inp.ctx;
15972        let filename_in: CString = utils::new_c_string(filename)?;
15973
15974        let keep_in: i32 = radsave_options.keep as i32;
15975        let keep_in_name = utils::new_c_string("keep")?;
15976
15977        let background_wrapper =
15978            utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
15979        let background_in = background_wrapper.ctx;
15980        let background_in_name = utils::new_c_string("background")?;
15981
15982        let page_height_in: i32 = radsave_options.page_height;
15983        let page_height_in_name = utils::new_c_string("page-height")?;
15984
15985        let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
15986        let profile_in_name = utils::new_c_string("profile")?;
15987
15988        let vips_op_response = bindings::vips_radsave(
15989            inp_in,
15990            filename_in.as_ptr(),
15991            keep_in_name.as_ptr(),
15992            keep_in,
15993            background_in_name.as_ptr(),
15994            background_in,
15995            page_height_in_name.as_ptr(),
15996            page_height_in,
15997            profile_in_name.as_ptr(),
15998            profile_in.as_ptr(),
15999            NULL,
16000        );
16001        utils::result(vips_op_response, (), Error::RadsaveError)
16002    }
16003}
16004
16005/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
16006/// inp: `&VipsImage` -> Image to save
16007/// returns `Vec<u8>` - Buffer to save to
16008pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16009    unsafe {
16010        let inp_in: *mut bindings::VipsImage = inp.ctx;
16011        let mut buffer_buf_size: u64 = 0;
16012        let mut buffer_out: *mut c_void = null_mut();
16013
16014        let vips_op_response =
16015            bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16016        utils::result(
16017            vips_op_response,
16018            utils::new_byte_array(buffer_out, buffer_buf_size),
16019            Error::RadsaveBufferError,
16020        )
16021    }
16022}
16023
16024/// Options for radsave_buffer operation
16025#[derive(Clone, Debug)]
16026pub struct RadsaveBufferOptions {
16027    /// keep: `ForeignKeep` -> Which metadata to retain
16028    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16029    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16030    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16031    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16032    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16033    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16034    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16035    pub keep: ForeignKeep,
16036    /// background: `Vec<f64>` -> Background value
16037    pub background: Vec<f64>,
16038    /// page_height: `i32` -> Set page height for multipage save
16039    /// min: 0, max: 10000000, default: 0
16040    pub page_height: i32,
16041    /// profile: `String` -> Filename of ICC profile to embed
16042    pub profile: String,
16043}
16044
16045impl std::default::Default for RadsaveBufferOptions {
16046    fn default() -> Self {
16047        RadsaveBufferOptions {
16048            keep: ForeignKeep::All,
16049            background: Vec::new(),
16050            page_height: i32::from(0),
16051            profile: String::from("sRGB"),
16052        }
16053    }
16054}
16055
16056/// VipsForeignSaveRadBuffer (radsave_buffer), save image to Radiance buffer (.hdr), priority=0, rgb
16057/// inp: `&VipsImage` -> Image to save
16058/// radsave_buffer_options: `&RadsaveBufferOptions` -> optional arguments
16059/// returns `Vec<u8>` - Buffer to save to
16060pub fn radsave_buffer_with_opts(
16061    inp: &VipsImage,
16062    radsave_buffer_options: &RadsaveBufferOptions,
16063) -> Result<Vec<u8>> {
16064    unsafe {
16065        let inp_in: *mut bindings::VipsImage = inp.ctx;
16066        let mut buffer_buf_size: u64 = 0;
16067        let mut buffer_out: *mut c_void = null_mut();
16068
16069        let keep_in: i32 = radsave_buffer_options.keep as i32;
16070        let keep_in_name = utils::new_c_string("keep")?;
16071
16072        let background_wrapper =
16073            utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
16074        let background_in = background_wrapper.ctx;
16075        let background_in_name = utils::new_c_string("background")?;
16076
16077        let page_height_in: i32 = radsave_buffer_options.page_height;
16078        let page_height_in_name = utils::new_c_string("page-height")?;
16079
16080        let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
16081        let profile_in_name = utils::new_c_string("profile")?;
16082
16083        let vips_op_response = bindings::vips_radsave_buffer(
16084            inp_in,
16085            &mut buffer_out,
16086            &mut buffer_buf_size,
16087            keep_in_name.as_ptr(),
16088            keep_in,
16089            background_in_name.as_ptr(),
16090            background_in,
16091            page_height_in_name.as_ptr(),
16092            page_height_in,
16093            profile_in_name.as_ptr(),
16094            profile_in.as_ptr(),
16095            NULL,
16096        );
16097        utils::result(
16098            vips_op_response,
16099            utils::new_byte_array(buffer_out, buffer_buf_size),
16100            Error::RadsaveBufferError,
16101        )
16102    }
16103}
16104
16105/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
16106/// inp: `&VipsImage` -> Image to save
16107/// target: `&VipsTarget` -> Target to save to
16108
16109pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16110    unsafe {
16111        let inp_in: *mut bindings::VipsImage = inp.ctx;
16112        let target_in: *mut bindings::VipsTarget = target.ctx;
16113
16114        let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
16115        utils::result(vips_op_response, (), Error::RadsaveTargetError)
16116    }
16117}
16118
16119/// Options for radsave_target operation
16120#[derive(Clone, Debug)]
16121pub struct RadsaveTargetOptions {
16122    /// keep: `ForeignKeep` -> Which metadata to retain
16123    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16124    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16125    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16126    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16127    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16128    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16129    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16130    pub keep: ForeignKeep,
16131    /// background: `Vec<f64>` -> Background value
16132    pub background: Vec<f64>,
16133    /// page_height: `i32` -> Set page height for multipage save
16134    /// min: 0, max: 10000000, default: 0
16135    pub page_height: i32,
16136    /// profile: `String` -> Filename of ICC profile to embed
16137    pub profile: String,
16138}
16139
16140impl std::default::Default for RadsaveTargetOptions {
16141    fn default() -> Self {
16142        RadsaveTargetOptions {
16143            keep: ForeignKeep::All,
16144            background: Vec::new(),
16145            page_height: i32::from(0),
16146            profile: String::from("sRGB"),
16147        }
16148    }
16149}
16150
16151/// VipsForeignSaveRadTarget (radsave_target), save image to Radiance target (.hdr), priority=0, rgb
16152/// inp: `&VipsImage` -> Image to save
16153/// target: `&VipsTarget` -> Target to save to
16154/// radsave_target_options: `&RadsaveTargetOptions` -> optional arguments
16155
16156pub fn radsave_target_with_opts(
16157    inp: &VipsImage,
16158    target: &VipsTarget,
16159    radsave_target_options: &RadsaveTargetOptions,
16160) -> Result<()> {
16161    unsafe {
16162        let inp_in: *mut bindings::VipsImage = inp.ctx;
16163        let target_in: *mut bindings::VipsTarget = target.ctx;
16164
16165        let keep_in: i32 = radsave_target_options.keep as i32;
16166        let keep_in_name = utils::new_c_string("keep")?;
16167
16168        let background_wrapper =
16169            utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
16170        let background_in = background_wrapper.ctx;
16171        let background_in_name = utils::new_c_string("background")?;
16172
16173        let page_height_in: i32 = radsave_target_options.page_height;
16174        let page_height_in_name = utils::new_c_string("page-height")?;
16175
16176        let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
16177        let profile_in_name = utils::new_c_string("profile")?;
16178
16179        let vips_op_response = bindings::vips_radsave_target(
16180            inp_in,
16181            target_in,
16182            keep_in_name.as_ptr(),
16183            keep_in,
16184            background_in_name.as_ptr(),
16185            background_in,
16186            page_height_in_name.as_ptr(),
16187            page_height_in,
16188            profile_in_name.as_ptr(),
16189            profile_in.as_ptr(),
16190            NULL,
16191        );
16192        utils::result(vips_op_response, (), Error::RadsaveTargetError)
16193    }
16194}
16195
16196/// VipsForeignSaveJp2kFile (jp2ksave), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16197/// inp: `&VipsImage` -> Image to save
16198/// filename: `&str` -> Filename to load from
16199
16200pub fn jp_2ksave(inp: &VipsImage, filename: &str) -> Result<()> {
16201    unsafe {
16202        let inp_in: *mut bindings::VipsImage = inp.ctx;
16203        let filename_in: CString = utils::new_c_string(filename)?;
16204
16205        let vips_op_response = bindings::vips_jp2ksave(inp_in, filename_in.as_ptr(), NULL);
16206        utils::result(vips_op_response, (), Error::Jp2KsaveError)
16207    }
16208}
16209
16210/// Options for jp_2ksave operation
16211#[derive(Clone, Debug)]
16212pub struct Jp2KsaveOptions {
16213    /// tile_width: `i32` -> Tile width in pixels
16214    /// min: 1, max: 32768, default: 512
16215    pub tile_width: i32,
16216    /// tile_height: `i32` -> Tile height in pixels
16217    /// min: 1, max: 32768, default: 512
16218    pub tile_height: i32,
16219    /// lossless: `bool` -> Enable lossless compression
16220    /// default: false
16221    pub lossless: bool,
16222    /// q: `i32` -> Q factor
16223    /// min: 1, max: 100, default: 48
16224    pub q: i32,
16225    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
16226    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
16227    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
16228    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2 [DEFAULT]
16229    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
16230    pub subsample_mode: ForeignSubsample,
16231    /// keep: `ForeignKeep` -> Which metadata to retain
16232    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16233    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16234    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16235    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16236    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16237    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16238    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16239    pub keep: ForeignKeep,
16240    /// background: `Vec<f64>` -> Background value
16241    pub background: Vec<f64>,
16242    /// page_height: `i32` -> Set page height for multipage save
16243    /// min: 0, max: 10000000, default: 0
16244    pub page_height: i32,
16245    /// profile: `String` -> Filename of ICC profile to embed
16246    pub profile: String,
16247}
16248
16249impl std::default::Default for Jp2KsaveOptions {
16250    fn default() -> Self {
16251        Jp2KsaveOptions {
16252            tile_width: i32::from(512),
16253            tile_height: i32::from(512),
16254            lossless: false,
16255            q: i32::from(48),
16256            subsample_mode: ForeignSubsample::Off,
16257            keep: ForeignKeep::All,
16258            background: Vec::new(),
16259            page_height: i32::from(0),
16260            profile: String::from("sRGB"),
16261        }
16262    }
16263}
16264
16265/// VipsForeignSaveJp2kFile (jp2ksave), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16266/// inp: `&VipsImage` -> Image to save
16267/// filename: `&str` -> Filename to load from
16268/// jp_2ksave_options: `&Jp2KsaveOptions` -> optional arguments
16269
16270pub fn jp_2ksave_with_opts(
16271    inp: &VipsImage,
16272    filename: &str,
16273    jp_2ksave_options: &Jp2KsaveOptions,
16274) -> Result<()> {
16275    unsafe {
16276        let inp_in: *mut bindings::VipsImage = inp.ctx;
16277        let filename_in: CString = utils::new_c_string(filename)?;
16278
16279        let tile_width_in: i32 = jp_2ksave_options.tile_width;
16280        let tile_width_in_name = utils::new_c_string("tile-width")?;
16281
16282        let tile_height_in: i32 = jp_2ksave_options.tile_height;
16283        let tile_height_in_name = utils::new_c_string("tile-height")?;
16284
16285        let lossless_in: i32 = if jp_2ksave_options.lossless { 1 } else { 0 };
16286        let lossless_in_name = utils::new_c_string("lossless")?;
16287
16288        let q_in: i32 = jp_2ksave_options.q;
16289        let q_in_name = utils::new_c_string("Q")?;
16290
16291        let subsample_mode_in: i32 = jp_2ksave_options.subsample_mode as i32;
16292        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16293
16294        let keep_in: i32 = jp_2ksave_options.keep as i32;
16295        let keep_in_name = utils::new_c_string("keep")?;
16296
16297        let background_wrapper =
16298            utils::VipsArrayDoubleWrapper::from(&jp_2ksave_options.background[..]);
16299        let background_in = background_wrapper.ctx;
16300        let background_in_name = utils::new_c_string("background")?;
16301
16302        let page_height_in: i32 = jp_2ksave_options.page_height;
16303        let page_height_in_name = utils::new_c_string("page-height")?;
16304
16305        let profile_in: CString = utils::new_c_string(&jp_2ksave_options.profile)?;
16306        let profile_in_name = utils::new_c_string("profile")?;
16307
16308        let vips_op_response = bindings::vips_jp2ksave(
16309            inp_in,
16310            filename_in.as_ptr(),
16311            tile_width_in_name.as_ptr(),
16312            tile_width_in,
16313            tile_height_in_name.as_ptr(),
16314            tile_height_in,
16315            lossless_in_name.as_ptr(),
16316            lossless_in,
16317            q_in_name.as_ptr(),
16318            q_in,
16319            subsample_mode_in_name.as_ptr(),
16320            subsample_mode_in,
16321            keep_in_name.as_ptr(),
16322            keep_in,
16323            background_in_name.as_ptr(),
16324            background_in,
16325            page_height_in_name.as_ptr(),
16326            page_height_in,
16327            profile_in_name.as_ptr(),
16328            profile_in.as_ptr(),
16329            NULL,
16330        );
16331        utils::result(vips_op_response, (), Error::Jp2KsaveError)
16332    }
16333}
16334
16335/// VipsForeignSaveJp2kBuffer (jp2ksave_buffer), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16336/// inp: `&VipsImage` -> Image to save
16337/// returns `Vec<u8>` - Buffer to save to
16338pub fn jp_2ksave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16339    unsafe {
16340        let inp_in: *mut bindings::VipsImage = inp.ctx;
16341        let mut buffer_buf_size: u64 = 0;
16342        let mut buffer_out: *mut c_void = null_mut();
16343
16344        let vips_op_response =
16345            bindings::vips_jp2ksave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16346        utils::result(
16347            vips_op_response,
16348            utils::new_byte_array(buffer_out, buffer_buf_size),
16349            Error::Jp2KsaveBufferError,
16350        )
16351    }
16352}
16353
16354/// Options for jp_2ksave_buffer operation
16355#[derive(Clone, Debug)]
16356pub struct Jp2KsaveBufferOptions {
16357    /// tile_width: `i32` -> Tile width in pixels
16358    /// min: 1, max: 32768, default: 512
16359    pub tile_width: i32,
16360    /// tile_height: `i32` -> Tile height in pixels
16361    /// min: 1, max: 32768, default: 512
16362    pub tile_height: i32,
16363    /// lossless: `bool` -> Enable lossless compression
16364    /// default: false
16365    pub lossless: bool,
16366    /// q: `i32` -> Q factor
16367    /// min: 1, max: 100, default: 48
16368    pub q: i32,
16369    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
16370    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
16371    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
16372    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2 [DEFAULT]
16373    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
16374    pub subsample_mode: ForeignSubsample,
16375    /// keep: `ForeignKeep` -> Which metadata to retain
16376    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16377    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16378    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16379    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16380    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16381    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16382    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16383    pub keep: ForeignKeep,
16384    /// background: `Vec<f64>` -> Background value
16385    pub background: Vec<f64>,
16386    /// page_height: `i32` -> Set page height for multipage save
16387    /// min: 0, max: 10000000, default: 0
16388    pub page_height: i32,
16389    /// profile: `String` -> Filename of ICC profile to embed
16390    pub profile: String,
16391}
16392
16393impl std::default::Default for Jp2KsaveBufferOptions {
16394    fn default() -> Self {
16395        Jp2KsaveBufferOptions {
16396            tile_width: i32::from(512),
16397            tile_height: i32::from(512),
16398            lossless: false,
16399            q: i32::from(48),
16400            subsample_mode: ForeignSubsample::Off,
16401            keep: ForeignKeep::All,
16402            background: Vec::new(),
16403            page_height: i32::from(0),
16404            profile: String::from("sRGB"),
16405        }
16406    }
16407}
16408
16409/// VipsForeignSaveJp2kBuffer (jp2ksave_buffer), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16410/// inp: `&VipsImage` -> Image to save
16411/// jp_2ksave_buffer_options: `&Jp2KsaveBufferOptions` -> optional arguments
16412/// returns `Vec<u8>` - Buffer to save to
16413pub fn jp_2ksave_buffer_with_opts(
16414    inp: &VipsImage,
16415    jp_2ksave_buffer_options: &Jp2KsaveBufferOptions,
16416) -> Result<Vec<u8>> {
16417    unsafe {
16418        let inp_in: *mut bindings::VipsImage = inp.ctx;
16419        let mut buffer_buf_size: u64 = 0;
16420        let mut buffer_out: *mut c_void = null_mut();
16421
16422        let tile_width_in: i32 = jp_2ksave_buffer_options.tile_width;
16423        let tile_width_in_name = utils::new_c_string("tile-width")?;
16424
16425        let tile_height_in: i32 = jp_2ksave_buffer_options.tile_height;
16426        let tile_height_in_name = utils::new_c_string("tile-height")?;
16427
16428        let lossless_in: i32 = if jp_2ksave_buffer_options.lossless {
16429            1
16430        } else {
16431            0
16432        };
16433        let lossless_in_name = utils::new_c_string("lossless")?;
16434
16435        let q_in: i32 = jp_2ksave_buffer_options.q;
16436        let q_in_name = utils::new_c_string("Q")?;
16437
16438        let subsample_mode_in: i32 = jp_2ksave_buffer_options.subsample_mode as i32;
16439        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16440
16441        let keep_in: i32 = jp_2ksave_buffer_options.keep as i32;
16442        let keep_in_name = utils::new_c_string("keep")?;
16443
16444        let background_wrapper =
16445            utils::VipsArrayDoubleWrapper::from(&jp_2ksave_buffer_options.background[..]);
16446        let background_in = background_wrapper.ctx;
16447        let background_in_name = utils::new_c_string("background")?;
16448
16449        let page_height_in: i32 = jp_2ksave_buffer_options.page_height;
16450        let page_height_in_name = utils::new_c_string("page-height")?;
16451
16452        let profile_in: CString = utils::new_c_string(&jp_2ksave_buffer_options.profile)?;
16453        let profile_in_name = utils::new_c_string("profile")?;
16454
16455        let vips_op_response = bindings::vips_jp2ksave_buffer(
16456            inp_in,
16457            &mut buffer_out,
16458            &mut buffer_buf_size,
16459            tile_width_in_name.as_ptr(),
16460            tile_width_in,
16461            tile_height_in_name.as_ptr(),
16462            tile_height_in,
16463            lossless_in_name.as_ptr(),
16464            lossless_in,
16465            q_in_name.as_ptr(),
16466            q_in,
16467            subsample_mode_in_name.as_ptr(),
16468            subsample_mode_in,
16469            keep_in_name.as_ptr(),
16470            keep_in,
16471            background_in_name.as_ptr(),
16472            background_in,
16473            page_height_in_name.as_ptr(),
16474            page_height_in,
16475            profile_in_name.as_ptr(),
16476            profile_in.as_ptr(),
16477            NULL,
16478        );
16479        utils::result(
16480            vips_op_response,
16481            utils::new_byte_array(buffer_out, buffer_buf_size),
16482            Error::Jp2KsaveBufferError,
16483        )
16484    }
16485}
16486
16487/// VipsForeignSaveJp2kTarget (jp2ksave_target), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16488/// inp: `&VipsImage` -> Image to save
16489/// target: `&VipsTarget` -> Target to save to
16490
16491pub fn jp_2ksave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16492    unsafe {
16493        let inp_in: *mut bindings::VipsImage = inp.ctx;
16494        let target_in: *mut bindings::VipsTarget = target.ctx;
16495
16496        let vips_op_response = bindings::vips_jp2ksave_target(inp_in, target_in, NULL);
16497        utils::result(vips_op_response, (), Error::Jp2KsaveTargetError)
16498    }
16499}
16500
16501/// Options for jp_2ksave_target operation
16502#[derive(Clone, Debug)]
16503pub struct Jp2KsaveTargetOptions {
16504    /// tile_width: `i32` -> Tile width in pixels
16505    /// min: 1, max: 32768, default: 512
16506    pub tile_width: i32,
16507    /// tile_height: `i32` -> Tile height in pixels
16508    /// min: 1, max: 32768, default: 512
16509    pub tile_height: i32,
16510    /// lossless: `bool` -> Enable lossless compression
16511    /// default: false
16512    pub lossless: bool,
16513    /// q: `i32` -> Q factor
16514    /// min: 1, max: 100, default: 48
16515    pub q: i32,
16516    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
16517    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0
16518    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
16519    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2 [DEFAULT]
16520    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
16521    pub subsample_mode: ForeignSubsample,
16522    /// keep: `ForeignKeep` -> Which metadata to retain
16523    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16524    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16525    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16526    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16527    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16528    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16529    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16530    pub keep: ForeignKeep,
16531    /// background: `Vec<f64>` -> Background value
16532    pub background: Vec<f64>,
16533    /// page_height: `i32` -> Set page height for multipage save
16534    /// min: 0, max: 10000000, default: 0
16535    pub page_height: i32,
16536    /// profile: `String` -> Filename of ICC profile to embed
16537    pub profile: String,
16538}
16539
16540impl std::default::Default for Jp2KsaveTargetOptions {
16541    fn default() -> Self {
16542        Jp2KsaveTargetOptions {
16543            tile_width: i32::from(512),
16544            tile_height: i32::from(512),
16545            lossless: false,
16546            q: i32::from(48),
16547            subsample_mode: ForeignSubsample::Off,
16548            keep: ForeignKeep::All,
16549            background: Vec::new(),
16550            page_height: i32::from(0),
16551            profile: String::from("sRGB"),
16552        }
16553    }
16554}
16555
16556/// VipsForeignSaveJp2kTarget (jp2ksave_target), save image in JPEG2000 format (.j2k, .jp2, .jpt, .j2c, .jpc), priority=0, any
16557/// inp: `&VipsImage` -> Image to save
16558/// target: `&VipsTarget` -> Target to save to
16559/// jp_2ksave_target_options: `&Jp2KsaveTargetOptions` -> optional arguments
16560
16561pub fn jp_2ksave_target_with_opts(
16562    inp: &VipsImage,
16563    target: &VipsTarget,
16564    jp_2ksave_target_options: &Jp2KsaveTargetOptions,
16565) -> Result<()> {
16566    unsafe {
16567        let inp_in: *mut bindings::VipsImage = inp.ctx;
16568        let target_in: *mut bindings::VipsTarget = target.ctx;
16569
16570        let tile_width_in: i32 = jp_2ksave_target_options.tile_width;
16571        let tile_width_in_name = utils::new_c_string("tile-width")?;
16572
16573        let tile_height_in: i32 = jp_2ksave_target_options.tile_height;
16574        let tile_height_in_name = utils::new_c_string("tile-height")?;
16575
16576        let lossless_in: i32 = if jp_2ksave_target_options.lossless {
16577            1
16578        } else {
16579            0
16580        };
16581        let lossless_in_name = utils::new_c_string("lossless")?;
16582
16583        let q_in: i32 = jp_2ksave_target_options.q;
16584        let q_in_name = utils::new_c_string("Q")?;
16585
16586        let subsample_mode_in: i32 = jp_2ksave_target_options.subsample_mode as i32;
16587        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16588
16589        let keep_in: i32 = jp_2ksave_target_options.keep as i32;
16590        let keep_in_name = utils::new_c_string("keep")?;
16591
16592        let background_wrapper =
16593            utils::VipsArrayDoubleWrapper::from(&jp_2ksave_target_options.background[..]);
16594        let background_in = background_wrapper.ctx;
16595        let background_in_name = utils::new_c_string("background")?;
16596
16597        let page_height_in: i32 = jp_2ksave_target_options.page_height;
16598        let page_height_in_name = utils::new_c_string("page-height")?;
16599
16600        let profile_in: CString = utils::new_c_string(&jp_2ksave_target_options.profile)?;
16601        let profile_in_name = utils::new_c_string("profile")?;
16602
16603        let vips_op_response = bindings::vips_jp2ksave_target(
16604            inp_in,
16605            target_in,
16606            tile_width_in_name.as_ptr(),
16607            tile_width_in,
16608            tile_height_in_name.as_ptr(),
16609            tile_height_in,
16610            lossless_in_name.as_ptr(),
16611            lossless_in,
16612            q_in_name.as_ptr(),
16613            q_in,
16614            subsample_mode_in_name.as_ptr(),
16615            subsample_mode_in,
16616            keep_in_name.as_ptr(),
16617            keep_in,
16618            background_in_name.as_ptr(),
16619            background_in,
16620            page_height_in_name.as_ptr(),
16621            page_height_in,
16622            profile_in_name.as_ptr(),
16623            profile_in.as_ptr(),
16624            NULL,
16625        );
16626        utils::result(vips_op_response, (), Error::Jp2KsaveTargetError)
16627    }
16628}
16629
16630/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
16631/// inp: `&VipsImage` -> Image to save
16632/// filename: `&str` -> Filename to save to
16633
16634pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
16635    unsafe {
16636        let inp_in: *mut bindings::VipsImage = inp.ctx;
16637        let filename_in: CString = utils::new_c_string(filename)?;
16638
16639        let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
16640        utils::result(vips_op_response, (), Error::GifsaveError)
16641    }
16642}
16643
16644/// Options for gifsave operation
16645#[derive(Clone, Debug)]
16646pub struct GifsaveOptions {
16647    /// dither: `f64` -> Amount of dithering
16648    /// min: 0, max: 1, default: 1
16649    pub dither: f64,
16650    /// effort: `i32` -> Quantisation effort
16651    /// min: 1, max: 10, default: 7
16652    pub effort: i32,
16653    /// bitdepth: `i32` -> Number of bits per pixel
16654    /// min: 1, max: 8, default: 8
16655    pub bitdepth: i32,
16656    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
16657    /// min: 0, max: 32, default: 0
16658    pub interframe_maxerror: f64,
16659    /// reuse: `bool` -> Reuse palette from input
16660    /// default: false
16661    pub reuse: bool,
16662    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
16663    /// min: 0, max: 256, default: 3
16664    pub interpalette_maxerror: f64,
16665    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
16666    /// default: false
16667    pub interlace: bool,
16668    /// keep: `ForeignKeep` -> Which metadata to retain
16669    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16670    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16671    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16672    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16673    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16674    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16675    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16676    pub keep: ForeignKeep,
16677    /// background: `Vec<f64>` -> Background value
16678    pub background: Vec<f64>,
16679    /// page_height: `i32` -> Set page height for multipage save
16680    /// min: 0, max: 10000000, default: 0
16681    pub page_height: i32,
16682    /// profile: `String` -> Filename of ICC profile to embed
16683    pub profile: String,
16684}
16685
16686impl std::default::Default for GifsaveOptions {
16687    fn default() -> Self {
16688        GifsaveOptions {
16689            dither: f64::from(1),
16690            effort: i32::from(7),
16691            bitdepth: i32::from(8),
16692            interframe_maxerror: f64::from(0),
16693            reuse: false,
16694            interpalette_maxerror: f64::from(3),
16695            interlace: false,
16696            keep: ForeignKeep::All,
16697            background: Vec::new(),
16698            page_height: i32::from(0),
16699            profile: String::from("sRGB"),
16700        }
16701    }
16702}
16703
16704/// VipsForeignSaveCgifFile (gifsave), save as gif (.gif), priority=0, rgba-only
16705/// inp: `&VipsImage` -> Image to save
16706/// filename: `&str` -> Filename to save to
16707/// gifsave_options: `&GifsaveOptions` -> optional arguments
16708
16709pub fn gifsave_with_opts(
16710    inp: &VipsImage,
16711    filename: &str,
16712    gifsave_options: &GifsaveOptions,
16713) -> Result<()> {
16714    unsafe {
16715        let inp_in: *mut bindings::VipsImage = inp.ctx;
16716        let filename_in: CString = utils::new_c_string(filename)?;
16717
16718        let dither_in: f64 = gifsave_options.dither;
16719        let dither_in_name = utils::new_c_string("dither")?;
16720
16721        let effort_in: i32 = gifsave_options.effort;
16722        let effort_in_name = utils::new_c_string("effort")?;
16723
16724        let bitdepth_in: i32 = gifsave_options.bitdepth;
16725        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16726
16727        let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
16728        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
16729
16730        let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
16731        let reuse_in_name = utils::new_c_string("reuse")?;
16732
16733        let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
16734        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
16735
16736        let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
16737        let interlace_in_name = utils::new_c_string("interlace")?;
16738
16739        let keep_in: i32 = gifsave_options.keep as i32;
16740        let keep_in_name = utils::new_c_string("keep")?;
16741
16742        let background_wrapper =
16743            utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
16744        let background_in = background_wrapper.ctx;
16745        let background_in_name = utils::new_c_string("background")?;
16746
16747        let page_height_in: i32 = gifsave_options.page_height;
16748        let page_height_in_name = utils::new_c_string("page-height")?;
16749
16750        let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
16751        let profile_in_name = utils::new_c_string("profile")?;
16752
16753        let vips_op_response = bindings::vips_gifsave(
16754            inp_in,
16755            filename_in.as_ptr(),
16756            dither_in_name.as_ptr(),
16757            dither_in,
16758            effort_in_name.as_ptr(),
16759            effort_in,
16760            bitdepth_in_name.as_ptr(),
16761            bitdepth_in,
16762            interframe_maxerror_in_name.as_ptr(),
16763            interframe_maxerror_in,
16764            reuse_in_name.as_ptr(),
16765            reuse_in,
16766            interpalette_maxerror_in_name.as_ptr(),
16767            interpalette_maxerror_in,
16768            interlace_in_name.as_ptr(),
16769            interlace_in,
16770            keep_in_name.as_ptr(),
16771            keep_in,
16772            background_in_name.as_ptr(),
16773            background_in,
16774            page_height_in_name.as_ptr(),
16775            page_height_in,
16776            profile_in_name.as_ptr(),
16777            profile_in.as_ptr(),
16778            NULL,
16779        );
16780        utils::result(vips_op_response, (), Error::GifsaveError)
16781    }
16782}
16783
16784/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
16785/// inp: `&VipsImage` -> Image to save
16786/// returns `Vec<u8>` - Buffer to save to
16787pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16788    unsafe {
16789        let inp_in: *mut bindings::VipsImage = inp.ctx;
16790        let mut buffer_buf_size: u64 = 0;
16791        let mut buffer_out: *mut c_void = null_mut();
16792
16793        let vips_op_response =
16794            bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16795        utils::result(
16796            vips_op_response,
16797            utils::new_byte_array(buffer_out, buffer_buf_size),
16798            Error::GifsaveBufferError,
16799        )
16800    }
16801}
16802
16803/// Options for gifsave_buffer operation
16804#[derive(Clone, Debug)]
16805pub struct GifsaveBufferOptions {
16806    /// dither: `f64` -> Amount of dithering
16807    /// min: 0, max: 1, default: 1
16808    pub dither: f64,
16809    /// effort: `i32` -> Quantisation effort
16810    /// min: 1, max: 10, default: 7
16811    pub effort: i32,
16812    /// bitdepth: `i32` -> Number of bits per pixel
16813    /// min: 1, max: 8, default: 8
16814    pub bitdepth: i32,
16815    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
16816    /// min: 0, max: 32, default: 0
16817    pub interframe_maxerror: f64,
16818    /// reuse: `bool` -> Reuse palette from input
16819    /// default: false
16820    pub reuse: bool,
16821    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
16822    /// min: 0, max: 256, default: 3
16823    pub interpalette_maxerror: f64,
16824    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
16825    /// default: false
16826    pub interlace: bool,
16827    /// keep: `ForeignKeep` -> Which metadata to retain
16828    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16829    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16830    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16831    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16832    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16833    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16834    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16835    pub keep: ForeignKeep,
16836    /// background: `Vec<f64>` -> Background value
16837    pub background: Vec<f64>,
16838    /// page_height: `i32` -> Set page height for multipage save
16839    /// min: 0, max: 10000000, default: 0
16840    pub page_height: i32,
16841    /// profile: `String` -> Filename of ICC profile to embed
16842    pub profile: String,
16843}
16844
16845impl std::default::Default for GifsaveBufferOptions {
16846    fn default() -> Self {
16847        GifsaveBufferOptions {
16848            dither: f64::from(1),
16849            effort: i32::from(7),
16850            bitdepth: i32::from(8),
16851            interframe_maxerror: f64::from(0),
16852            reuse: false,
16853            interpalette_maxerror: f64::from(3),
16854            interlace: false,
16855            keep: ForeignKeep::All,
16856            background: Vec::new(),
16857            page_height: i32::from(0),
16858            profile: String::from("sRGB"),
16859        }
16860    }
16861}
16862
16863/// VipsForeignSaveCgifBuffer (gifsave_buffer), save as gif (.gif), priority=0, rgba-only
16864/// inp: `&VipsImage` -> Image to save
16865/// gifsave_buffer_options: `&GifsaveBufferOptions` -> optional arguments
16866/// returns `Vec<u8>` - Buffer to save to
16867pub fn gifsave_buffer_with_opts(
16868    inp: &VipsImage,
16869    gifsave_buffer_options: &GifsaveBufferOptions,
16870) -> Result<Vec<u8>> {
16871    unsafe {
16872        let inp_in: *mut bindings::VipsImage = inp.ctx;
16873        let mut buffer_buf_size: u64 = 0;
16874        let mut buffer_out: *mut c_void = null_mut();
16875
16876        let dither_in: f64 = gifsave_buffer_options.dither;
16877        let dither_in_name = utils::new_c_string("dither")?;
16878
16879        let effort_in: i32 = gifsave_buffer_options.effort;
16880        let effort_in_name = utils::new_c_string("effort")?;
16881
16882        let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
16883        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16884
16885        let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
16886        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
16887
16888        let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
16889        let reuse_in_name = utils::new_c_string("reuse")?;
16890
16891        let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
16892        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
16893
16894        let interlace_in: i32 = if gifsave_buffer_options.interlace {
16895            1
16896        } else {
16897            0
16898        };
16899        let interlace_in_name = utils::new_c_string("interlace")?;
16900
16901        let keep_in: i32 = gifsave_buffer_options.keep as i32;
16902        let keep_in_name = utils::new_c_string("keep")?;
16903
16904        let background_wrapper =
16905            utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
16906        let background_in = background_wrapper.ctx;
16907        let background_in_name = utils::new_c_string("background")?;
16908
16909        let page_height_in: i32 = gifsave_buffer_options.page_height;
16910        let page_height_in_name = utils::new_c_string("page-height")?;
16911
16912        let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
16913        let profile_in_name = utils::new_c_string("profile")?;
16914
16915        let vips_op_response = bindings::vips_gifsave_buffer(
16916            inp_in,
16917            &mut buffer_out,
16918            &mut buffer_buf_size,
16919            dither_in_name.as_ptr(),
16920            dither_in,
16921            effort_in_name.as_ptr(),
16922            effort_in,
16923            bitdepth_in_name.as_ptr(),
16924            bitdepth_in,
16925            interframe_maxerror_in_name.as_ptr(),
16926            interframe_maxerror_in,
16927            reuse_in_name.as_ptr(),
16928            reuse_in,
16929            interpalette_maxerror_in_name.as_ptr(),
16930            interpalette_maxerror_in,
16931            interlace_in_name.as_ptr(),
16932            interlace_in,
16933            keep_in_name.as_ptr(),
16934            keep_in,
16935            background_in_name.as_ptr(),
16936            background_in,
16937            page_height_in_name.as_ptr(),
16938            page_height_in,
16939            profile_in_name.as_ptr(),
16940            profile_in.as_ptr(),
16941            NULL,
16942        );
16943        utils::result(
16944            vips_op_response,
16945            utils::new_byte_array(buffer_out, buffer_buf_size),
16946            Error::GifsaveBufferError,
16947        )
16948    }
16949}
16950
16951/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
16952/// inp: `&VipsImage` -> Image to save
16953/// target: `&VipsTarget` -> Target to save to
16954
16955pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16956    unsafe {
16957        let inp_in: *mut bindings::VipsImage = inp.ctx;
16958        let target_in: *mut bindings::VipsTarget = target.ctx;
16959
16960        let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
16961        utils::result(vips_op_response, (), Error::GifsaveTargetError)
16962    }
16963}
16964
16965/// Options for gifsave_target operation
16966#[derive(Clone, Debug)]
16967pub struct GifsaveTargetOptions {
16968    /// dither: `f64` -> Amount of dithering
16969    /// min: 0, max: 1, default: 1
16970    pub dither: f64,
16971    /// effort: `i32` -> Quantisation effort
16972    /// min: 1, max: 10, default: 7
16973    pub effort: i32,
16974    /// bitdepth: `i32` -> Number of bits per pixel
16975    /// min: 1, max: 8, default: 8
16976    pub bitdepth: i32,
16977    /// interframe_maxerror: `f64` -> Maximum inter-frame error for transparency
16978    /// min: 0, max: 32, default: 0
16979    pub interframe_maxerror: f64,
16980    /// reuse: `bool` -> Reuse palette from input
16981    /// default: false
16982    pub reuse: bool,
16983    /// interpalette_maxerror: `f64` -> Maximum inter-palette error for palette reusage
16984    /// min: 0, max: 256, default: 3
16985    pub interpalette_maxerror: f64,
16986    /// interlace: `bool` -> Generate an interlaced (progressive) GIF
16987    /// default: false
16988    pub interlace: bool,
16989    /// keep: `ForeignKeep` -> Which metadata to retain
16990    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
16991    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
16992    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
16993    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
16994    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
16995    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
16996    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
16997    pub keep: ForeignKeep,
16998    /// background: `Vec<f64>` -> Background value
16999    pub background: Vec<f64>,
17000    /// page_height: `i32` -> Set page height for multipage save
17001    /// min: 0, max: 10000000, default: 0
17002    pub page_height: i32,
17003    /// profile: `String` -> Filename of ICC profile to embed
17004    pub profile: String,
17005}
17006
17007impl std::default::Default for GifsaveTargetOptions {
17008    fn default() -> Self {
17009        GifsaveTargetOptions {
17010            dither: f64::from(1),
17011            effort: i32::from(7),
17012            bitdepth: i32::from(8),
17013            interframe_maxerror: f64::from(0),
17014            reuse: false,
17015            interpalette_maxerror: f64::from(3),
17016            interlace: false,
17017            keep: ForeignKeep::All,
17018            background: Vec::new(),
17019            page_height: i32::from(0),
17020            profile: String::from("sRGB"),
17021        }
17022    }
17023}
17024
17025/// VipsForeignSaveCgifTarget (gifsave_target), save as gif (.gif), priority=0, rgba-only
17026/// inp: `&VipsImage` -> Image to save
17027/// target: `&VipsTarget` -> Target to save to
17028/// gifsave_target_options: `&GifsaveTargetOptions` -> optional arguments
17029
17030pub fn gifsave_target_with_opts(
17031    inp: &VipsImage,
17032    target: &VipsTarget,
17033    gifsave_target_options: &GifsaveTargetOptions,
17034) -> Result<()> {
17035    unsafe {
17036        let inp_in: *mut bindings::VipsImage = inp.ctx;
17037        let target_in: *mut bindings::VipsTarget = target.ctx;
17038
17039        let dither_in: f64 = gifsave_target_options.dither;
17040        let dither_in_name = utils::new_c_string("dither")?;
17041
17042        let effort_in: i32 = gifsave_target_options.effort;
17043        let effort_in_name = utils::new_c_string("effort")?;
17044
17045        let bitdepth_in: i32 = gifsave_target_options.bitdepth;
17046        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17047
17048        let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
17049        let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
17050
17051        let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
17052        let reuse_in_name = utils::new_c_string("reuse")?;
17053
17054        let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
17055        let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
17056
17057        let interlace_in: i32 = if gifsave_target_options.interlace {
17058            1
17059        } else {
17060            0
17061        };
17062        let interlace_in_name = utils::new_c_string("interlace")?;
17063
17064        let keep_in: i32 = gifsave_target_options.keep as i32;
17065        let keep_in_name = utils::new_c_string("keep")?;
17066
17067        let background_wrapper =
17068            utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
17069        let background_in = background_wrapper.ctx;
17070        let background_in_name = utils::new_c_string("background")?;
17071
17072        let page_height_in: i32 = gifsave_target_options.page_height;
17073        let page_height_in_name = utils::new_c_string("page-height")?;
17074
17075        let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
17076        let profile_in_name = utils::new_c_string("profile")?;
17077
17078        let vips_op_response = bindings::vips_gifsave_target(
17079            inp_in,
17080            target_in,
17081            dither_in_name.as_ptr(),
17082            dither_in,
17083            effort_in_name.as_ptr(),
17084            effort_in,
17085            bitdepth_in_name.as_ptr(),
17086            bitdepth_in,
17087            interframe_maxerror_in_name.as_ptr(),
17088            interframe_maxerror_in,
17089            reuse_in_name.as_ptr(),
17090            reuse_in,
17091            interpalette_maxerror_in_name.as_ptr(),
17092            interpalette_maxerror_in,
17093            interlace_in_name.as_ptr(),
17094            interlace_in,
17095            keep_in_name.as_ptr(),
17096            keep_in,
17097            background_in_name.as_ptr(),
17098            background_in,
17099            page_height_in_name.as_ptr(),
17100            page_height_in,
17101            profile_in_name.as_ptr(),
17102            profile_in.as_ptr(),
17103            NULL,
17104        );
17105        utils::result(vips_op_response, (), Error::GifsaveTargetError)
17106    }
17107}
17108
17109/// VipsForeignSaveDzFile (dzsave), save image to deepzoom file (.dz, .szi), priority=0, any
17110/// inp: `&VipsImage` -> Image to save
17111/// filename: `&str` -> Filename to save to
17112
17113pub fn dzsave(inp: &VipsImage, filename: &str) -> Result<()> {
17114    unsafe {
17115        let inp_in: *mut bindings::VipsImage = inp.ctx;
17116        let filename_in: CString = utils::new_c_string(filename)?;
17117
17118        let vips_op_response = bindings::vips_dzsave(inp_in, filename_in.as_ptr(), NULL);
17119        utils::result(vips_op_response, (), Error::DzsaveError)
17120    }
17121}
17122
17123/// Options for dzsave operation
17124#[derive(Clone, Debug)]
17125pub struct DzsaveOptions {
17126    /// imagename: `String` -> Image name
17127    pub imagename: String,
17128    /// layout: `ForeignDzLayout` -> Directory layout
17129    ///  `Dz` -> VIPS_FOREIGN_DZ_LAYOUT_DZ = 0 [DEFAULT]
17130    ///  `Zoomify` -> VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY = 1
17131    ///  `Google` -> VIPS_FOREIGN_DZ_LAYOUT_GOOGLE = 2
17132    ///  `Iiif` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF = 3
17133    ///  `Iiif3` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF3 = 4
17134    ///  `Last` -> VIPS_FOREIGN_DZ_LAYOUT_LAST = 5
17135    pub layout: ForeignDzLayout,
17136    /// suffix: `String` -> Filename suffix for tiles
17137    pub suffix: String,
17138    /// overlap: `i32` -> Tile overlap in pixels
17139    /// min: 0, max: 8192, default: 1
17140    pub overlap: i32,
17141    /// tile_size: `i32` -> Tile size in pixels
17142    /// min: 1, max: 8192, default: 254
17143    pub tile_size: i32,
17144    /// centre: `bool` -> Center image in tile
17145    /// default: false
17146    pub centre: bool,
17147    /// depth: `ForeignDzDepth` -> Pyramid depth
17148    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0 [DEFAULT]
17149    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
17150    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17151    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17152    pub depth: ForeignDzDepth,
17153    /// angle: `Angle` -> Rotate image during save
17154    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
17155    ///  `D90` -> VIPS_ANGLE_D90 = 1
17156    ///  `D180` -> VIPS_ANGLE_D180 = 2
17157    ///  `D270` -> VIPS_ANGLE_D270 = 3
17158    ///  `Last` -> VIPS_ANGLE_LAST = 4
17159    pub angle: Angle,
17160    /// container: `ForeignDzContainer` -> Pyramid container type
17161    ///  `F` -> VIPS_FOREIGN_DZ_CONTAINER_FS = 0 [DEFAULT]
17162    ///  `Zip` -> VIPS_FOREIGN_DZ_CONTAINER_ZIP = 1
17163    ///  `Szi` -> VIPS_FOREIGN_DZ_CONTAINER_SZI = 2
17164    ///  `Last` -> VIPS_FOREIGN_DZ_CONTAINER_LAST = 3
17165    pub container: ForeignDzContainer,
17166    /// compression: `i32` -> ZIP deflate compression level
17167    /// min: -1, max: 9, default: 0
17168    pub compression: i32,
17169    /// region_shrink: `RegionShrink` -> Method to shrink regions
17170    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17171    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17172    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17173    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17174    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17175    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17176    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17177    pub region_shrink: RegionShrink,
17178    /// skip_blanks: `i32` -> Skip tiles which are nearly equal to the background
17179    /// min: -1, max: 65535, default: -1
17180    pub skip_blanks: i32,
17181    /// id: `String` -> Resource ID
17182    pub id: String,
17183    /// q: `i32` -> Q factor
17184    /// min: 1, max: 100, default: 75
17185    pub q: i32,
17186    /// keep: `ForeignKeep` -> Which metadata to retain
17187    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17188    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17189    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17190    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17191    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17192    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17193    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17194    pub keep: ForeignKeep,
17195    /// background: `Vec<f64>` -> Background value
17196    pub background: Vec<f64>,
17197    /// page_height: `i32` -> Set page height for multipage save
17198    /// min: 0, max: 10000000, default: 0
17199    pub page_height: i32,
17200    /// profile: `String` -> Filename of ICC profile to embed
17201    pub profile: String,
17202}
17203
17204impl std::default::Default for DzsaveOptions {
17205    fn default() -> Self {
17206        DzsaveOptions {
17207            imagename: String::new(),
17208            layout: ForeignDzLayout::Dz,
17209            suffix: String::new(),
17210            overlap: i32::from(1),
17211            tile_size: i32::from(254),
17212            centre: false,
17213            depth: ForeignDzDepth::Onepixel,
17214            angle: Angle::D0,
17215            container: ForeignDzContainer::F,
17216            compression: i32::from(0),
17217            region_shrink: RegionShrink::Mean,
17218            skip_blanks: i32::from(-1),
17219            id: String::new(),
17220            q: i32::from(75),
17221            keep: ForeignKeep::All,
17222            background: Vec::new(),
17223            page_height: i32::from(0),
17224            profile: String::from("sRGB"),
17225        }
17226    }
17227}
17228
17229/// VipsForeignSaveDzFile (dzsave), save image to deepzoom file (.dz, .szi), priority=0, any
17230/// inp: `&VipsImage` -> Image to save
17231/// filename: `&str` -> Filename to save to
17232/// dzsave_options: `&DzsaveOptions` -> optional arguments
17233
17234pub fn dzsave_with_opts(
17235    inp: &VipsImage,
17236    filename: &str,
17237    dzsave_options: &DzsaveOptions,
17238) -> Result<()> {
17239    unsafe {
17240        let inp_in: *mut bindings::VipsImage = inp.ctx;
17241        let filename_in: CString = utils::new_c_string(filename)?;
17242
17243        let imagename_in: CString = utils::new_c_string(&dzsave_options.imagename)?;
17244        let imagename_in_name = utils::new_c_string("imagename")?;
17245
17246        let layout_in: i32 = dzsave_options.layout as i32;
17247        let layout_in_name = utils::new_c_string("layout")?;
17248
17249        let suffix_in: CString = utils::new_c_string(&dzsave_options.suffix)?;
17250        let suffix_in_name = utils::new_c_string("suffix")?;
17251
17252        let overlap_in: i32 = dzsave_options.overlap;
17253        let overlap_in_name = utils::new_c_string("overlap")?;
17254
17255        let tile_size_in: i32 = dzsave_options.tile_size;
17256        let tile_size_in_name = utils::new_c_string("tile-size")?;
17257
17258        let centre_in: i32 = if dzsave_options.centre { 1 } else { 0 };
17259        let centre_in_name = utils::new_c_string("centre")?;
17260
17261        let depth_in: i32 = dzsave_options.depth as i32;
17262        let depth_in_name = utils::new_c_string("depth")?;
17263
17264        let angle_in: i32 = dzsave_options.angle as i32;
17265        let angle_in_name = utils::new_c_string("angle")?;
17266
17267        let container_in: i32 = dzsave_options.container as i32;
17268        let container_in_name = utils::new_c_string("container")?;
17269
17270        let compression_in: i32 = dzsave_options.compression;
17271        let compression_in_name = utils::new_c_string("compression")?;
17272
17273        let region_shrink_in: i32 = dzsave_options.region_shrink as i32;
17274        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17275
17276        let skip_blanks_in: i32 = dzsave_options.skip_blanks;
17277        let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17278
17279        let id_in: CString = utils::new_c_string(&dzsave_options.id)?;
17280        let id_in_name = utils::new_c_string("id")?;
17281
17282        let q_in: i32 = dzsave_options.q;
17283        let q_in_name = utils::new_c_string("Q")?;
17284
17285        let keep_in: i32 = dzsave_options.keep as i32;
17286        let keep_in_name = utils::new_c_string("keep")?;
17287
17288        let background_wrapper =
17289            utils::VipsArrayDoubleWrapper::from(&dzsave_options.background[..]);
17290        let background_in = background_wrapper.ctx;
17291        let background_in_name = utils::new_c_string("background")?;
17292
17293        let page_height_in: i32 = dzsave_options.page_height;
17294        let page_height_in_name = utils::new_c_string("page-height")?;
17295
17296        let profile_in: CString = utils::new_c_string(&dzsave_options.profile)?;
17297        let profile_in_name = utils::new_c_string("profile")?;
17298
17299        let vips_op_response = bindings::vips_dzsave(
17300            inp_in,
17301            filename_in.as_ptr(),
17302            imagename_in_name.as_ptr(),
17303            imagename_in.as_ptr(),
17304            layout_in_name.as_ptr(),
17305            layout_in,
17306            suffix_in_name.as_ptr(),
17307            suffix_in.as_ptr(),
17308            overlap_in_name.as_ptr(),
17309            overlap_in,
17310            tile_size_in_name.as_ptr(),
17311            tile_size_in,
17312            centre_in_name.as_ptr(),
17313            centre_in,
17314            depth_in_name.as_ptr(),
17315            depth_in,
17316            angle_in_name.as_ptr(),
17317            angle_in,
17318            container_in_name.as_ptr(),
17319            container_in,
17320            compression_in_name.as_ptr(),
17321            compression_in,
17322            region_shrink_in_name.as_ptr(),
17323            region_shrink_in,
17324            skip_blanks_in_name.as_ptr(),
17325            skip_blanks_in,
17326            id_in_name.as_ptr(),
17327            id_in.as_ptr(),
17328            q_in_name.as_ptr(),
17329            q_in,
17330            keep_in_name.as_ptr(),
17331            keep_in,
17332            background_in_name.as_ptr(),
17333            background_in,
17334            page_height_in_name.as_ptr(),
17335            page_height_in,
17336            profile_in_name.as_ptr(),
17337            profile_in.as_ptr(),
17338            NULL,
17339        );
17340        utils::result(vips_op_response, (), Error::DzsaveError)
17341    }
17342}
17343
17344/// VipsForeignSaveDzBuffer (dzsave_buffer), save image to dz buffer (.dz, .szi), priority=0, any
17345/// inp: `&VipsImage` -> Image to save
17346/// returns `Vec<u8>` - Buffer to save to
17347pub fn dzsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17348    unsafe {
17349        let inp_in: *mut bindings::VipsImage = inp.ctx;
17350        let mut buffer_buf_size: u64 = 0;
17351        let mut buffer_out: *mut c_void = null_mut();
17352
17353        let vips_op_response =
17354            bindings::vips_dzsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17355        utils::result(
17356            vips_op_response,
17357            utils::new_byte_array(buffer_out, buffer_buf_size),
17358            Error::DzsaveBufferError,
17359        )
17360    }
17361}
17362
17363/// Options for dzsave_buffer operation
17364#[derive(Clone, Debug)]
17365pub struct DzsaveBufferOptions {
17366    /// imagename: `String` -> Image name
17367    pub imagename: String,
17368    /// layout: `ForeignDzLayout` -> Directory layout
17369    ///  `Dz` -> VIPS_FOREIGN_DZ_LAYOUT_DZ = 0 [DEFAULT]
17370    ///  `Zoomify` -> VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY = 1
17371    ///  `Google` -> VIPS_FOREIGN_DZ_LAYOUT_GOOGLE = 2
17372    ///  `Iiif` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF = 3
17373    ///  `Iiif3` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF3 = 4
17374    ///  `Last` -> VIPS_FOREIGN_DZ_LAYOUT_LAST = 5
17375    pub layout: ForeignDzLayout,
17376    /// suffix: `String` -> Filename suffix for tiles
17377    pub suffix: String,
17378    /// overlap: `i32` -> Tile overlap in pixels
17379    /// min: 0, max: 8192, default: 1
17380    pub overlap: i32,
17381    /// tile_size: `i32` -> Tile size in pixels
17382    /// min: 1, max: 8192, default: 254
17383    pub tile_size: i32,
17384    /// centre: `bool` -> Center image in tile
17385    /// default: false
17386    pub centre: bool,
17387    /// depth: `ForeignDzDepth` -> Pyramid depth
17388    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0 [DEFAULT]
17389    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
17390    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17391    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17392    pub depth: ForeignDzDepth,
17393    /// angle: `Angle` -> Rotate image during save
17394    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
17395    ///  `D90` -> VIPS_ANGLE_D90 = 1
17396    ///  `D180` -> VIPS_ANGLE_D180 = 2
17397    ///  `D270` -> VIPS_ANGLE_D270 = 3
17398    ///  `Last` -> VIPS_ANGLE_LAST = 4
17399    pub angle: Angle,
17400    /// container: `ForeignDzContainer` -> Pyramid container type
17401    ///  `F` -> VIPS_FOREIGN_DZ_CONTAINER_FS = 0 [DEFAULT]
17402    ///  `Zip` -> VIPS_FOREIGN_DZ_CONTAINER_ZIP = 1
17403    ///  `Szi` -> VIPS_FOREIGN_DZ_CONTAINER_SZI = 2
17404    ///  `Last` -> VIPS_FOREIGN_DZ_CONTAINER_LAST = 3
17405    pub container: ForeignDzContainer,
17406    /// compression: `i32` -> ZIP deflate compression level
17407    /// min: -1, max: 9, default: 0
17408    pub compression: i32,
17409    /// region_shrink: `RegionShrink` -> Method to shrink regions
17410    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17411    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17412    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17413    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17414    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17415    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17416    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17417    pub region_shrink: RegionShrink,
17418    /// skip_blanks: `i32` -> Skip tiles which are nearly equal to the background
17419    /// min: -1, max: 65535, default: -1
17420    pub skip_blanks: i32,
17421    /// id: `String` -> Resource ID
17422    pub id: String,
17423    /// q: `i32` -> Q factor
17424    /// min: 1, max: 100, default: 75
17425    pub q: i32,
17426    /// keep: `ForeignKeep` -> Which metadata to retain
17427    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17428    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17429    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17430    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17431    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17432    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17433    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17434    pub keep: ForeignKeep,
17435    /// background: `Vec<f64>` -> Background value
17436    pub background: Vec<f64>,
17437    /// page_height: `i32` -> Set page height for multipage save
17438    /// min: 0, max: 10000000, default: 0
17439    pub page_height: i32,
17440    /// profile: `String` -> Filename of ICC profile to embed
17441    pub profile: String,
17442}
17443
17444impl std::default::Default for DzsaveBufferOptions {
17445    fn default() -> Self {
17446        DzsaveBufferOptions {
17447            imagename: String::new(),
17448            layout: ForeignDzLayout::Dz,
17449            suffix: String::new(),
17450            overlap: i32::from(1),
17451            tile_size: i32::from(254),
17452            centre: false,
17453            depth: ForeignDzDepth::Onepixel,
17454            angle: Angle::D0,
17455            container: ForeignDzContainer::F,
17456            compression: i32::from(0),
17457            region_shrink: RegionShrink::Mean,
17458            skip_blanks: i32::from(-1),
17459            id: String::new(),
17460            q: i32::from(75),
17461            keep: ForeignKeep::All,
17462            background: Vec::new(),
17463            page_height: i32::from(0),
17464            profile: String::from("sRGB"),
17465        }
17466    }
17467}
17468
17469/// VipsForeignSaveDzBuffer (dzsave_buffer), save image to dz buffer (.dz, .szi), priority=0, any
17470/// inp: `&VipsImage` -> Image to save
17471/// dzsave_buffer_options: `&DzsaveBufferOptions` -> optional arguments
17472/// returns `Vec<u8>` - Buffer to save to
17473pub fn dzsave_buffer_with_opts(
17474    inp: &VipsImage,
17475    dzsave_buffer_options: &DzsaveBufferOptions,
17476) -> Result<Vec<u8>> {
17477    unsafe {
17478        let inp_in: *mut bindings::VipsImage = inp.ctx;
17479        let mut buffer_buf_size: u64 = 0;
17480        let mut buffer_out: *mut c_void = null_mut();
17481
17482        let imagename_in: CString = utils::new_c_string(&dzsave_buffer_options.imagename)?;
17483        let imagename_in_name = utils::new_c_string("imagename")?;
17484
17485        let layout_in: i32 = dzsave_buffer_options.layout as i32;
17486        let layout_in_name = utils::new_c_string("layout")?;
17487
17488        let suffix_in: CString = utils::new_c_string(&dzsave_buffer_options.suffix)?;
17489        let suffix_in_name = utils::new_c_string("suffix")?;
17490
17491        let overlap_in: i32 = dzsave_buffer_options.overlap;
17492        let overlap_in_name = utils::new_c_string("overlap")?;
17493
17494        let tile_size_in: i32 = dzsave_buffer_options.tile_size;
17495        let tile_size_in_name = utils::new_c_string("tile-size")?;
17496
17497        let centre_in: i32 = if dzsave_buffer_options.centre { 1 } else { 0 };
17498        let centre_in_name = utils::new_c_string("centre")?;
17499
17500        let depth_in: i32 = dzsave_buffer_options.depth as i32;
17501        let depth_in_name = utils::new_c_string("depth")?;
17502
17503        let angle_in: i32 = dzsave_buffer_options.angle as i32;
17504        let angle_in_name = utils::new_c_string("angle")?;
17505
17506        let container_in: i32 = dzsave_buffer_options.container as i32;
17507        let container_in_name = utils::new_c_string("container")?;
17508
17509        let compression_in: i32 = dzsave_buffer_options.compression;
17510        let compression_in_name = utils::new_c_string("compression")?;
17511
17512        let region_shrink_in: i32 = dzsave_buffer_options.region_shrink as i32;
17513        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17514
17515        let skip_blanks_in: i32 = dzsave_buffer_options.skip_blanks;
17516        let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17517
17518        let id_in: CString = utils::new_c_string(&dzsave_buffer_options.id)?;
17519        let id_in_name = utils::new_c_string("id")?;
17520
17521        let q_in: i32 = dzsave_buffer_options.q;
17522        let q_in_name = utils::new_c_string("Q")?;
17523
17524        let keep_in: i32 = dzsave_buffer_options.keep as i32;
17525        let keep_in_name = utils::new_c_string("keep")?;
17526
17527        let background_wrapper =
17528            utils::VipsArrayDoubleWrapper::from(&dzsave_buffer_options.background[..]);
17529        let background_in = background_wrapper.ctx;
17530        let background_in_name = utils::new_c_string("background")?;
17531
17532        let page_height_in: i32 = dzsave_buffer_options.page_height;
17533        let page_height_in_name = utils::new_c_string("page-height")?;
17534
17535        let profile_in: CString = utils::new_c_string(&dzsave_buffer_options.profile)?;
17536        let profile_in_name = utils::new_c_string("profile")?;
17537
17538        let vips_op_response = bindings::vips_dzsave_buffer(
17539            inp_in,
17540            &mut buffer_out,
17541            &mut buffer_buf_size,
17542            imagename_in_name.as_ptr(),
17543            imagename_in.as_ptr(),
17544            layout_in_name.as_ptr(),
17545            layout_in,
17546            suffix_in_name.as_ptr(),
17547            suffix_in.as_ptr(),
17548            overlap_in_name.as_ptr(),
17549            overlap_in,
17550            tile_size_in_name.as_ptr(),
17551            tile_size_in,
17552            centre_in_name.as_ptr(),
17553            centre_in,
17554            depth_in_name.as_ptr(),
17555            depth_in,
17556            angle_in_name.as_ptr(),
17557            angle_in,
17558            container_in_name.as_ptr(),
17559            container_in,
17560            compression_in_name.as_ptr(),
17561            compression_in,
17562            region_shrink_in_name.as_ptr(),
17563            region_shrink_in,
17564            skip_blanks_in_name.as_ptr(),
17565            skip_blanks_in,
17566            id_in_name.as_ptr(),
17567            id_in.as_ptr(),
17568            q_in_name.as_ptr(),
17569            q_in,
17570            keep_in_name.as_ptr(),
17571            keep_in,
17572            background_in_name.as_ptr(),
17573            background_in,
17574            page_height_in_name.as_ptr(),
17575            page_height_in,
17576            profile_in_name.as_ptr(),
17577            profile_in.as_ptr(),
17578            NULL,
17579        );
17580        utils::result(
17581            vips_op_response,
17582            utils::new_byte_array(buffer_out, buffer_buf_size),
17583            Error::DzsaveBufferError,
17584        )
17585    }
17586}
17587
17588/// VipsForeignSaveDzTarget (dzsave_target), save image to deepzoom target (.dz, .szi), priority=0, any
17589/// inp: `&VipsImage` -> Image to save
17590/// target: `&VipsTarget` -> Target to save to
17591
17592pub fn dzsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17593    unsafe {
17594        let inp_in: *mut bindings::VipsImage = inp.ctx;
17595        let target_in: *mut bindings::VipsTarget = target.ctx;
17596
17597        let vips_op_response = bindings::vips_dzsave_target(inp_in, target_in, NULL);
17598        utils::result(vips_op_response, (), Error::DzsaveTargetError)
17599    }
17600}
17601
17602/// Options for dzsave_target operation
17603#[derive(Clone, Debug)]
17604pub struct DzsaveTargetOptions {
17605    /// imagename: `String` -> Image name
17606    pub imagename: String,
17607    /// layout: `ForeignDzLayout` -> Directory layout
17608    ///  `Dz` -> VIPS_FOREIGN_DZ_LAYOUT_DZ = 0 [DEFAULT]
17609    ///  `Zoomify` -> VIPS_FOREIGN_DZ_LAYOUT_ZOOMIFY = 1
17610    ///  `Google` -> VIPS_FOREIGN_DZ_LAYOUT_GOOGLE = 2
17611    ///  `Iiif` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF = 3
17612    ///  `Iiif3` -> VIPS_FOREIGN_DZ_LAYOUT_IIIF3 = 4
17613    ///  `Last` -> VIPS_FOREIGN_DZ_LAYOUT_LAST = 5
17614    pub layout: ForeignDzLayout,
17615    /// suffix: `String` -> Filename suffix for tiles
17616    pub suffix: String,
17617    /// overlap: `i32` -> Tile overlap in pixels
17618    /// min: 0, max: 8192, default: 1
17619    pub overlap: i32,
17620    /// tile_size: `i32` -> Tile size in pixels
17621    /// min: 1, max: 8192, default: 254
17622    pub tile_size: i32,
17623    /// centre: `bool` -> Center image in tile
17624    /// default: false
17625    pub centre: bool,
17626    /// depth: `ForeignDzDepth` -> Pyramid depth
17627    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0 [DEFAULT]
17628    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1
17629    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
17630    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
17631    pub depth: ForeignDzDepth,
17632    /// angle: `Angle` -> Rotate image during save
17633    ///  `D0` -> VIPS_ANGLE_D0 = 0 [DEFAULT]
17634    ///  `D90` -> VIPS_ANGLE_D90 = 1
17635    ///  `D180` -> VIPS_ANGLE_D180 = 2
17636    ///  `D270` -> VIPS_ANGLE_D270 = 3
17637    ///  `Last` -> VIPS_ANGLE_LAST = 4
17638    pub angle: Angle,
17639    /// container: `ForeignDzContainer` -> Pyramid container type
17640    ///  `F` -> VIPS_FOREIGN_DZ_CONTAINER_FS = 0 [DEFAULT]
17641    ///  `Zip` -> VIPS_FOREIGN_DZ_CONTAINER_ZIP = 1
17642    ///  `Szi` -> VIPS_FOREIGN_DZ_CONTAINER_SZI = 2
17643    ///  `Last` -> VIPS_FOREIGN_DZ_CONTAINER_LAST = 3
17644    pub container: ForeignDzContainer,
17645    /// compression: `i32` -> ZIP deflate compression level
17646    /// min: -1, max: 9, default: 0
17647    pub compression: i32,
17648    /// region_shrink: `RegionShrink` -> Method to shrink regions
17649    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
17650    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
17651    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
17652    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
17653    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
17654    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
17655    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
17656    pub region_shrink: RegionShrink,
17657    /// skip_blanks: `i32` -> Skip tiles which are nearly equal to the background
17658    /// min: -1, max: 65535, default: -1
17659    pub skip_blanks: i32,
17660    /// id: `String` -> Resource ID
17661    pub id: String,
17662    /// q: `i32` -> Q factor
17663    /// min: 1, max: 100, default: 75
17664    pub q: i32,
17665    /// keep: `ForeignKeep` -> Which metadata to retain
17666    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17667    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17668    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17669    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17670    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17671    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17672    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17673    pub keep: ForeignKeep,
17674    /// background: `Vec<f64>` -> Background value
17675    pub background: Vec<f64>,
17676    /// page_height: `i32` -> Set page height for multipage save
17677    /// min: 0, max: 10000000, default: 0
17678    pub page_height: i32,
17679    /// profile: `String` -> Filename of ICC profile to embed
17680    pub profile: String,
17681}
17682
17683impl std::default::Default for DzsaveTargetOptions {
17684    fn default() -> Self {
17685        DzsaveTargetOptions {
17686            imagename: String::new(),
17687            layout: ForeignDzLayout::Dz,
17688            suffix: String::new(),
17689            overlap: i32::from(1),
17690            tile_size: i32::from(254),
17691            centre: false,
17692            depth: ForeignDzDepth::Onepixel,
17693            angle: Angle::D0,
17694            container: ForeignDzContainer::F,
17695            compression: i32::from(0),
17696            region_shrink: RegionShrink::Mean,
17697            skip_blanks: i32::from(-1),
17698            id: String::new(),
17699            q: i32::from(75),
17700            keep: ForeignKeep::All,
17701            background: Vec::new(),
17702            page_height: i32::from(0),
17703            profile: String::from("sRGB"),
17704        }
17705    }
17706}
17707
17708/// VipsForeignSaveDzTarget (dzsave_target), save image to deepzoom target (.dz, .szi), priority=0, any
17709/// inp: `&VipsImage` -> Image to save
17710/// target: `&VipsTarget` -> Target to save to
17711/// dzsave_target_options: `&DzsaveTargetOptions` -> optional arguments
17712
17713pub fn dzsave_target_with_opts(
17714    inp: &VipsImage,
17715    target: &VipsTarget,
17716    dzsave_target_options: &DzsaveTargetOptions,
17717) -> Result<()> {
17718    unsafe {
17719        let inp_in: *mut bindings::VipsImage = inp.ctx;
17720        let target_in: *mut bindings::VipsTarget = target.ctx;
17721
17722        let imagename_in: CString = utils::new_c_string(&dzsave_target_options.imagename)?;
17723        let imagename_in_name = utils::new_c_string("imagename")?;
17724
17725        let layout_in: i32 = dzsave_target_options.layout as i32;
17726        let layout_in_name = utils::new_c_string("layout")?;
17727
17728        let suffix_in: CString = utils::new_c_string(&dzsave_target_options.suffix)?;
17729        let suffix_in_name = utils::new_c_string("suffix")?;
17730
17731        let overlap_in: i32 = dzsave_target_options.overlap;
17732        let overlap_in_name = utils::new_c_string("overlap")?;
17733
17734        let tile_size_in: i32 = dzsave_target_options.tile_size;
17735        let tile_size_in_name = utils::new_c_string("tile-size")?;
17736
17737        let centre_in: i32 = if dzsave_target_options.centre { 1 } else { 0 };
17738        let centre_in_name = utils::new_c_string("centre")?;
17739
17740        let depth_in: i32 = dzsave_target_options.depth as i32;
17741        let depth_in_name = utils::new_c_string("depth")?;
17742
17743        let angle_in: i32 = dzsave_target_options.angle as i32;
17744        let angle_in_name = utils::new_c_string("angle")?;
17745
17746        let container_in: i32 = dzsave_target_options.container as i32;
17747        let container_in_name = utils::new_c_string("container")?;
17748
17749        let compression_in: i32 = dzsave_target_options.compression;
17750        let compression_in_name = utils::new_c_string("compression")?;
17751
17752        let region_shrink_in: i32 = dzsave_target_options.region_shrink as i32;
17753        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17754
17755        let skip_blanks_in: i32 = dzsave_target_options.skip_blanks;
17756        let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17757
17758        let id_in: CString = utils::new_c_string(&dzsave_target_options.id)?;
17759        let id_in_name = utils::new_c_string("id")?;
17760
17761        let q_in: i32 = dzsave_target_options.q;
17762        let q_in_name = utils::new_c_string("Q")?;
17763
17764        let keep_in: i32 = dzsave_target_options.keep as i32;
17765        let keep_in_name = utils::new_c_string("keep")?;
17766
17767        let background_wrapper =
17768            utils::VipsArrayDoubleWrapper::from(&dzsave_target_options.background[..]);
17769        let background_in = background_wrapper.ctx;
17770        let background_in_name = utils::new_c_string("background")?;
17771
17772        let page_height_in: i32 = dzsave_target_options.page_height;
17773        let page_height_in_name = utils::new_c_string("page-height")?;
17774
17775        let profile_in: CString = utils::new_c_string(&dzsave_target_options.profile)?;
17776        let profile_in_name = utils::new_c_string("profile")?;
17777
17778        let vips_op_response = bindings::vips_dzsave_target(
17779            inp_in,
17780            target_in,
17781            imagename_in_name.as_ptr(),
17782            imagename_in.as_ptr(),
17783            layout_in_name.as_ptr(),
17784            layout_in,
17785            suffix_in_name.as_ptr(),
17786            suffix_in.as_ptr(),
17787            overlap_in_name.as_ptr(),
17788            overlap_in,
17789            tile_size_in_name.as_ptr(),
17790            tile_size_in,
17791            centre_in_name.as_ptr(),
17792            centre_in,
17793            depth_in_name.as_ptr(),
17794            depth_in,
17795            angle_in_name.as_ptr(),
17796            angle_in,
17797            container_in_name.as_ptr(),
17798            container_in,
17799            compression_in_name.as_ptr(),
17800            compression_in,
17801            region_shrink_in_name.as_ptr(),
17802            region_shrink_in,
17803            skip_blanks_in_name.as_ptr(),
17804            skip_blanks_in,
17805            id_in_name.as_ptr(),
17806            id_in.as_ptr(),
17807            q_in_name.as_ptr(),
17808            q_in,
17809            keep_in_name.as_ptr(),
17810            keep_in,
17811            background_in_name.as_ptr(),
17812            background_in,
17813            page_height_in_name.as_ptr(),
17814            page_height_in,
17815            profile_in_name.as_ptr(),
17816            profile_in.as_ptr(),
17817            NULL,
17818        );
17819        utils::result(vips_op_response, (), Error::DzsaveTargetError)
17820    }
17821}
17822
17823/// VipsForeignSaveSpngFile (pngsave), save image to file as PNG (.png), priority=0, rgba
17824/// inp: `&VipsImage` -> Image to save
17825/// filename: `&str` -> Filename to save to
17826
17827pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
17828    unsafe {
17829        let inp_in: *mut bindings::VipsImage = inp.ctx;
17830        let filename_in: CString = utils::new_c_string(filename)?;
17831
17832        let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
17833        utils::result(vips_op_response, (), Error::PngsaveError)
17834    }
17835}
17836
17837/// Options for pngsave operation
17838#[derive(Clone, Debug)]
17839pub struct PngsaveOptions {
17840    /// compression: `i32` -> Compression factor
17841    /// min: 0, max: 9, default: 6
17842    pub compression: i32,
17843    /// interlace: `bool` -> Interlace image
17844    /// default: false
17845    pub interlace: bool,
17846    /// filter: `ForeignPngFilter` -> libspng row filter flag(s)
17847    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
17848    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
17849    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
17850    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
17851    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
17852    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
17853    pub filter: ForeignPngFilter,
17854    /// palette: `bool` -> Quantise to 8bpp palette
17855    /// default: false
17856    pub palette: bool,
17857    /// q: `i32` -> Quantisation quality
17858    /// min: 0, max: 100, default: 100
17859    pub q: i32,
17860    /// dither: `f64` -> Amount of dithering
17861    /// min: 0, max: 1, default: 1
17862    pub dither: f64,
17863    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
17864    /// min: 1, max: 16, default: 8
17865    pub bitdepth: i32,
17866    /// effort: `i32` -> Quantisation CPU effort
17867    /// min: 1, max: 10, default: 7
17868    pub effort: i32,
17869    /// keep: `ForeignKeep` -> Which metadata to retain
17870    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
17871    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
17872    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
17873    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
17874    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
17875    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
17876    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
17877    pub keep: ForeignKeep,
17878    /// background: `Vec<f64>` -> Background value
17879    pub background: Vec<f64>,
17880    /// page_height: `i32` -> Set page height for multipage save
17881    /// min: 0, max: 10000000, default: 0
17882    pub page_height: i32,
17883    /// profile: `String` -> Filename of ICC profile to embed
17884    pub profile: String,
17885}
17886
17887impl std::default::Default for PngsaveOptions {
17888    fn default() -> Self {
17889        PngsaveOptions {
17890            compression: i32::from(6),
17891            interlace: false,
17892            filter: ForeignPngFilter::None,
17893            palette: false,
17894            q: i32::from(100),
17895            dither: f64::from(1),
17896            bitdepth: i32::from(8),
17897            effort: i32::from(7),
17898            keep: ForeignKeep::All,
17899            background: Vec::new(),
17900            page_height: i32::from(0),
17901            profile: String::from("sRGB"),
17902        }
17903    }
17904}
17905
17906/// VipsForeignSaveSpngFile (pngsave), save image to file as PNG (.png), priority=0, rgba
17907/// inp: `&VipsImage` -> Image to save
17908/// filename: `&str` -> Filename to save to
17909/// pngsave_options: `&PngsaveOptions` -> optional arguments
17910
17911pub fn pngsave_with_opts(
17912    inp: &VipsImage,
17913    filename: &str,
17914    pngsave_options: &PngsaveOptions,
17915) -> Result<()> {
17916    unsafe {
17917        let inp_in: *mut bindings::VipsImage = inp.ctx;
17918        let filename_in: CString = utils::new_c_string(filename)?;
17919
17920        let compression_in: i32 = pngsave_options.compression;
17921        let compression_in_name = utils::new_c_string("compression")?;
17922
17923        let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
17924        let interlace_in_name = utils::new_c_string("interlace")?;
17925
17926        let filter_in: i32 = pngsave_options.filter as i32;
17927        let filter_in_name = utils::new_c_string("filter")?;
17928
17929        let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
17930        let palette_in_name = utils::new_c_string("palette")?;
17931
17932        let q_in: i32 = pngsave_options.q;
17933        let q_in_name = utils::new_c_string("Q")?;
17934
17935        let dither_in: f64 = pngsave_options.dither;
17936        let dither_in_name = utils::new_c_string("dither")?;
17937
17938        let bitdepth_in: i32 = pngsave_options.bitdepth;
17939        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17940
17941        let effort_in: i32 = pngsave_options.effort;
17942        let effort_in_name = utils::new_c_string("effort")?;
17943
17944        let keep_in: i32 = pngsave_options.keep as i32;
17945        let keep_in_name = utils::new_c_string("keep")?;
17946
17947        let background_wrapper =
17948            utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
17949        let background_in = background_wrapper.ctx;
17950        let background_in_name = utils::new_c_string("background")?;
17951
17952        let page_height_in: i32 = pngsave_options.page_height;
17953        let page_height_in_name = utils::new_c_string("page-height")?;
17954
17955        let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
17956        let profile_in_name = utils::new_c_string("profile")?;
17957
17958        let vips_op_response = bindings::vips_pngsave(
17959            inp_in,
17960            filename_in.as_ptr(),
17961            compression_in_name.as_ptr(),
17962            compression_in,
17963            interlace_in_name.as_ptr(),
17964            interlace_in,
17965            filter_in_name.as_ptr(),
17966            filter_in,
17967            palette_in_name.as_ptr(),
17968            palette_in,
17969            q_in_name.as_ptr(),
17970            q_in,
17971            dither_in_name.as_ptr(),
17972            dither_in,
17973            bitdepth_in_name.as_ptr(),
17974            bitdepth_in,
17975            effort_in_name.as_ptr(),
17976            effort_in,
17977            keep_in_name.as_ptr(),
17978            keep_in,
17979            background_in_name.as_ptr(),
17980            background_in,
17981            page_height_in_name.as_ptr(),
17982            page_height_in,
17983            profile_in_name.as_ptr(),
17984            profile_in.as_ptr(),
17985            NULL,
17986        );
17987        utils::result(vips_op_response, (), Error::PngsaveError)
17988    }
17989}
17990
17991/// VipsForeignSaveSpngBuffer (pngsave_buffer), save image to buffer as PNG (.png), priority=0, rgba
17992/// inp: `&VipsImage` -> Image to save
17993/// returns `Vec<u8>` - Buffer to save to
17994pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17995    unsafe {
17996        let inp_in: *mut bindings::VipsImage = inp.ctx;
17997        let mut buffer_buf_size: u64 = 0;
17998        let mut buffer_out: *mut c_void = null_mut();
17999
18000        let vips_op_response =
18001            bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18002        utils::result(
18003            vips_op_response,
18004            utils::new_byte_array(buffer_out, buffer_buf_size),
18005            Error::PngsaveBufferError,
18006        )
18007    }
18008}
18009
18010/// Options for pngsave_buffer operation
18011#[derive(Clone, Debug)]
18012pub struct PngsaveBufferOptions {
18013    /// compression: `i32` -> Compression factor
18014    /// min: 0, max: 9, default: 6
18015    pub compression: i32,
18016    /// interlace: `bool` -> Interlace image
18017    /// default: false
18018    pub interlace: bool,
18019    /// filter: `ForeignPngFilter` -> libspng row filter flag(s)
18020    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
18021    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
18022    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
18023    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
18024    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
18025    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
18026    pub filter: ForeignPngFilter,
18027    /// palette: `bool` -> Quantise to 8bpp palette
18028    /// default: false
18029    pub palette: bool,
18030    /// q: `i32` -> Quantisation quality
18031    /// min: 0, max: 100, default: 100
18032    pub q: i32,
18033    /// dither: `f64` -> Amount of dithering
18034    /// min: 0, max: 1, default: 1
18035    pub dither: f64,
18036    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
18037    /// min: 1, max: 16, default: 8
18038    pub bitdepth: i32,
18039    /// effort: `i32` -> Quantisation CPU effort
18040    /// min: 1, max: 10, default: 7
18041    pub effort: i32,
18042    /// keep: `ForeignKeep` -> Which metadata to retain
18043    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18044    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18045    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18046    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18047    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18048    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18049    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18050    pub keep: ForeignKeep,
18051    /// background: `Vec<f64>` -> Background value
18052    pub background: Vec<f64>,
18053    /// page_height: `i32` -> Set page height for multipage save
18054    /// min: 0, max: 10000000, default: 0
18055    pub page_height: i32,
18056    /// profile: `String` -> Filename of ICC profile to embed
18057    pub profile: String,
18058}
18059
18060impl std::default::Default for PngsaveBufferOptions {
18061    fn default() -> Self {
18062        PngsaveBufferOptions {
18063            compression: i32::from(6),
18064            interlace: false,
18065            filter: ForeignPngFilter::None,
18066            palette: false,
18067            q: i32::from(100),
18068            dither: f64::from(1),
18069            bitdepth: i32::from(8),
18070            effort: i32::from(7),
18071            keep: ForeignKeep::All,
18072            background: Vec::new(),
18073            page_height: i32::from(0),
18074            profile: String::from("sRGB"),
18075        }
18076    }
18077}
18078
18079/// VipsForeignSaveSpngBuffer (pngsave_buffer), save image to buffer as PNG (.png), priority=0, rgba
18080/// inp: `&VipsImage` -> Image to save
18081/// pngsave_buffer_options: `&PngsaveBufferOptions` -> optional arguments
18082/// returns `Vec<u8>` - Buffer to save to
18083pub fn pngsave_buffer_with_opts(
18084    inp: &VipsImage,
18085    pngsave_buffer_options: &PngsaveBufferOptions,
18086) -> Result<Vec<u8>> {
18087    unsafe {
18088        let inp_in: *mut bindings::VipsImage = inp.ctx;
18089        let mut buffer_buf_size: u64 = 0;
18090        let mut buffer_out: *mut c_void = null_mut();
18091
18092        let compression_in: i32 = pngsave_buffer_options.compression;
18093        let compression_in_name = utils::new_c_string("compression")?;
18094
18095        let interlace_in: i32 = if pngsave_buffer_options.interlace {
18096            1
18097        } else {
18098            0
18099        };
18100        let interlace_in_name = utils::new_c_string("interlace")?;
18101
18102        let filter_in: i32 = pngsave_buffer_options.filter as i32;
18103        let filter_in_name = utils::new_c_string("filter")?;
18104
18105        let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
18106        let palette_in_name = utils::new_c_string("palette")?;
18107
18108        let q_in: i32 = pngsave_buffer_options.q;
18109        let q_in_name = utils::new_c_string("Q")?;
18110
18111        let dither_in: f64 = pngsave_buffer_options.dither;
18112        let dither_in_name = utils::new_c_string("dither")?;
18113
18114        let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
18115        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18116
18117        let effort_in: i32 = pngsave_buffer_options.effort;
18118        let effort_in_name = utils::new_c_string("effort")?;
18119
18120        let keep_in: i32 = pngsave_buffer_options.keep as i32;
18121        let keep_in_name = utils::new_c_string("keep")?;
18122
18123        let background_wrapper =
18124            utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
18125        let background_in = background_wrapper.ctx;
18126        let background_in_name = utils::new_c_string("background")?;
18127
18128        let page_height_in: i32 = pngsave_buffer_options.page_height;
18129        let page_height_in_name = utils::new_c_string("page-height")?;
18130
18131        let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
18132        let profile_in_name = utils::new_c_string("profile")?;
18133
18134        let vips_op_response = bindings::vips_pngsave_buffer(
18135            inp_in,
18136            &mut buffer_out,
18137            &mut buffer_buf_size,
18138            compression_in_name.as_ptr(),
18139            compression_in,
18140            interlace_in_name.as_ptr(),
18141            interlace_in,
18142            filter_in_name.as_ptr(),
18143            filter_in,
18144            palette_in_name.as_ptr(),
18145            palette_in,
18146            q_in_name.as_ptr(),
18147            q_in,
18148            dither_in_name.as_ptr(),
18149            dither_in,
18150            bitdepth_in_name.as_ptr(),
18151            bitdepth_in,
18152            effort_in_name.as_ptr(),
18153            effort_in,
18154            keep_in_name.as_ptr(),
18155            keep_in,
18156            background_in_name.as_ptr(),
18157            background_in,
18158            page_height_in_name.as_ptr(),
18159            page_height_in,
18160            profile_in_name.as_ptr(),
18161            profile_in.as_ptr(),
18162            NULL,
18163        );
18164        utils::result(
18165            vips_op_response,
18166            utils::new_byte_array(buffer_out, buffer_buf_size),
18167            Error::PngsaveBufferError,
18168        )
18169    }
18170}
18171
18172/// VipsForeignSaveSpngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
18173/// inp: `&VipsImage` -> Image to save
18174/// target: `&VipsTarget` -> Target to save to
18175
18176pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18177    unsafe {
18178        let inp_in: *mut bindings::VipsImage = inp.ctx;
18179        let target_in: *mut bindings::VipsTarget = target.ctx;
18180
18181        let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
18182        utils::result(vips_op_response, (), Error::PngsaveTargetError)
18183    }
18184}
18185
18186/// Options for pngsave_target operation
18187#[derive(Clone, Debug)]
18188pub struct PngsaveTargetOptions {
18189    /// compression: `i32` -> Compression factor
18190    /// min: 0, max: 9, default: 6
18191    pub compression: i32,
18192    /// interlace: `bool` -> Interlace image
18193    /// default: false
18194    pub interlace: bool,
18195    /// filter: `ForeignPngFilter` -> libspng row filter flag(s)
18196    ///  `None` -> VIPS_FOREIGN_PNG_FILTER_NONE = 8 [DEFAULT]
18197    ///  `Sub` -> VIPS_FOREIGN_PNG_FILTER_SUB = 16
18198    ///  `Up` -> VIPS_FOREIGN_PNG_FILTER_UP = 32
18199    ///  `Avg` -> VIPS_FOREIGN_PNG_FILTER_AVG = 64
18200    ///  `Paeth` -> VIPS_FOREIGN_PNG_FILTER_PAETH = 128
18201    ///  `All` -> VIPS_FOREIGN_PNG_FILTER_ALL = 248
18202    pub filter: ForeignPngFilter,
18203    /// palette: `bool` -> Quantise to 8bpp palette
18204    /// default: false
18205    pub palette: bool,
18206    /// q: `i32` -> Quantisation quality
18207    /// min: 0, max: 100, default: 100
18208    pub q: i32,
18209    /// dither: `f64` -> Amount of dithering
18210    /// min: 0, max: 1, default: 1
18211    pub dither: f64,
18212    /// bitdepth: `i32` -> Write as a 1, 2, 4, 8 or 16 bit image
18213    /// min: 1, max: 16, default: 8
18214    pub bitdepth: i32,
18215    /// effort: `i32` -> Quantisation CPU effort
18216    /// min: 1, max: 10, default: 7
18217    pub effort: i32,
18218    /// keep: `ForeignKeep` -> Which metadata to retain
18219    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18220    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18221    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18222    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18223    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18224    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18225    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18226    pub keep: ForeignKeep,
18227    /// background: `Vec<f64>` -> Background value
18228    pub background: Vec<f64>,
18229    /// page_height: `i32` -> Set page height for multipage save
18230    /// min: 0, max: 10000000, default: 0
18231    pub page_height: i32,
18232    /// profile: `String` -> Filename of ICC profile to embed
18233    pub profile: String,
18234}
18235
18236impl std::default::Default for PngsaveTargetOptions {
18237    fn default() -> Self {
18238        PngsaveTargetOptions {
18239            compression: i32::from(6),
18240            interlace: false,
18241            filter: ForeignPngFilter::None,
18242            palette: false,
18243            q: i32::from(100),
18244            dither: f64::from(1),
18245            bitdepth: i32::from(8),
18246            effort: i32::from(7),
18247            keep: ForeignKeep::All,
18248            background: Vec::new(),
18249            page_height: i32::from(0),
18250            profile: String::from("sRGB"),
18251        }
18252    }
18253}
18254
18255/// VipsForeignSaveSpngTarget (pngsave_target), save image to target as PNG (.png), priority=0, rgba
18256/// inp: `&VipsImage` -> Image to save
18257/// target: `&VipsTarget` -> Target to save to
18258/// pngsave_target_options: `&PngsaveTargetOptions` -> optional arguments
18259
18260pub fn pngsave_target_with_opts(
18261    inp: &VipsImage,
18262    target: &VipsTarget,
18263    pngsave_target_options: &PngsaveTargetOptions,
18264) -> Result<()> {
18265    unsafe {
18266        let inp_in: *mut bindings::VipsImage = inp.ctx;
18267        let target_in: *mut bindings::VipsTarget = target.ctx;
18268
18269        let compression_in: i32 = pngsave_target_options.compression;
18270        let compression_in_name = utils::new_c_string("compression")?;
18271
18272        let interlace_in: i32 = if pngsave_target_options.interlace {
18273            1
18274        } else {
18275            0
18276        };
18277        let interlace_in_name = utils::new_c_string("interlace")?;
18278
18279        let filter_in: i32 = pngsave_target_options.filter as i32;
18280        let filter_in_name = utils::new_c_string("filter")?;
18281
18282        let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
18283        let palette_in_name = utils::new_c_string("palette")?;
18284
18285        let q_in: i32 = pngsave_target_options.q;
18286        let q_in_name = utils::new_c_string("Q")?;
18287
18288        let dither_in: f64 = pngsave_target_options.dither;
18289        let dither_in_name = utils::new_c_string("dither")?;
18290
18291        let bitdepth_in: i32 = pngsave_target_options.bitdepth;
18292        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18293
18294        let effort_in: i32 = pngsave_target_options.effort;
18295        let effort_in_name = utils::new_c_string("effort")?;
18296
18297        let keep_in: i32 = pngsave_target_options.keep as i32;
18298        let keep_in_name = utils::new_c_string("keep")?;
18299
18300        let background_wrapper =
18301            utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
18302        let background_in = background_wrapper.ctx;
18303        let background_in_name = utils::new_c_string("background")?;
18304
18305        let page_height_in: i32 = pngsave_target_options.page_height;
18306        let page_height_in_name = utils::new_c_string("page-height")?;
18307
18308        let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
18309        let profile_in_name = utils::new_c_string("profile")?;
18310
18311        let vips_op_response = bindings::vips_pngsave_target(
18312            inp_in,
18313            target_in,
18314            compression_in_name.as_ptr(),
18315            compression_in,
18316            interlace_in_name.as_ptr(),
18317            interlace_in,
18318            filter_in_name.as_ptr(),
18319            filter_in,
18320            palette_in_name.as_ptr(),
18321            palette_in,
18322            q_in_name.as_ptr(),
18323            q_in,
18324            dither_in_name.as_ptr(),
18325            dither_in,
18326            bitdepth_in_name.as_ptr(),
18327            bitdepth_in,
18328            effort_in_name.as_ptr(),
18329            effort_in,
18330            keep_in_name.as_ptr(),
18331            keep_in,
18332            background_in_name.as_ptr(),
18333            background_in,
18334            page_height_in_name.as_ptr(),
18335            page_height_in,
18336            profile_in_name.as_ptr(),
18337            profile_in.as_ptr(),
18338            NULL,
18339        );
18340        utils::result(vips_op_response, (), Error::PngsaveTargetError)
18341    }
18342}
18343
18344/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18345/// inp: `&VipsImage` -> Image to save
18346/// filename: `&str` -> Filename to save to
18347
18348pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
18349    unsafe {
18350        let inp_in: *mut bindings::VipsImage = inp.ctx;
18351        let filename_in: CString = utils::new_c_string(filename)?;
18352
18353        let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
18354        utils::result(vips_op_response, (), Error::JpegsaveError)
18355    }
18356}
18357
18358/// Options for jpegsave operation
18359#[derive(Clone, Debug)]
18360pub struct JpegsaveOptions {
18361    /// q: `i32` -> Q factor
18362    /// min: 1, max: 100, default: 75
18363    pub q: i32,
18364    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
18365    /// default: false
18366    pub optimize_coding: bool,
18367    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
18368    /// default: false
18369    pub interlace: bool,
18370    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
18371    /// default: false
18372    pub trellis_quant: bool,
18373    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
18374    /// default: false
18375    pub overshoot_deringing: bool,
18376    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
18377    /// default: false
18378    pub optimize_scans: bool,
18379    /// quant_table: `i32` -> Use predefined quantization table with given index
18380    /// min: 0, max: 8, default: 0
18381    pub quant_table: i32,
18382    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18383    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18384    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18385    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18386    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18387    pub subsample_mode: ForeignSubsample,
18388    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
18389    /// min: 0, max: 2147483647, default: 0
18390    pub restart_interval: i32,
18391    /// keep: `ForeignKeep` -> Which metadata to retain
18392    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18393    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18394    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18395    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18396    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18397    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18398    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18399    pub keep: ForeignKeep,
18400    /// background: `Vec<f64>` -> Background value
18401    pub background: Vec<f64>,
18402    /// page_height: `i32` -> Set page height for multipage save
18403    /// min: 0, max: 10000000, default: 0
18404    pub page_height: i32,
18405    /// profile: `String` -> Filename of ICC profile to embed
18406    pub profile: String,
18407}
18408
18409impl std::default::Default for JpegsaveOptions {
18410    fn default() -> Self {
18411        JpegsaveOptions {
18412            q: i32::from(75),
18413            optimize_coding: false,
18414            interlace: false,
18415            trellis_quant: false,
18416            overshoot_deringing: false,
18417            optimize_scans: false,
18418            quant_table: i32::from(0),
18419            subsample_mode: ForeignSubsample::Auto,
18420            restart_interval: i32::from(0),
18421            keep: ForeignKeep::All,
18422            background: Vec::new(),
18423            page_height: i32::from(0),
18424            profile: String::from("sRGB"),
18425        }
18426    }
18427}
18428
18429/// VipsForeignSaveJpegFile (jpegsave), save image to jpeg file (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18430/// inp: `&VipsImage` -> Image to save
18431/// filename: `&str` -> Filename to save to
18432/// jpegsave_options: `&JpegsaveOptions` -> optional arguments
18433
18434pub fn jpegsave_with_opts(
18435    inp: &VipsImage,
18436    filename: &str,
18437    jpegsave_options: &JpegsaveOptions,
18438) -> Result<()> {
18439    unsafe {
18440        let inp_in: *mut bindings::VipsImage = inp.ctx;
18441        let filename_in: CString = utils::new_c_string(filename)?;
18442
18443        let q_in: i32 = jpegsave_options.q;
18444        let q_in_name = utils::new_c_string("Q")?;
18445
18446        let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
18447            1
18448        } else {
18449            0
18450        };
18451        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18452
18453        let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
18454        let interlace_in_name = utils::new_c_string("interlace")?;
18455
18456        let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
18457        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18458
18459        let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
18460            1
18461        } else {
18462            0
18463        };
18464        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18465
18466        let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
18467            1
18468        } else {
18469            0
18470        };
18471        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18472
18473        let quant_table_in: i32 = jpegsave_options.quant_table;
18474        let quant_table_in_name = utils::new_c_string("quant-table")?;
18475
18476        let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
18477        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18478
18479        let restart_interval_in: i32 = jpegsave_options.restart_interval;
18480        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18481
18482        let keep_in: i32 = jpegsave_options.keep as i32;
18483        let keep_in_name = utils::new_c_string("keep")?;
18484
18485        let background_wrapper =
18486            utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
18487        let background_in = background_wrapper.ctx;
18488        let background_in_name = utils::new_c_string("background")?;
18489
18490        let page_height_in: i32 = jpegsave_options.page_height;
18491        let page_height_in_name = utils::new_c_string("page-height")?;
18492
18493        let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
18494        let profile_in_name = utils::new_c_string("profile")?;
18495
18496        let vips_op_response = bindings::vips_jpegsave(
18497            inp_in,
18498            filename_in.as_ptr(),
18499            q_in_name.as_ptr(),
18500            q_in,
18501            optimize_coding_in_name.as_ptr(),
18502            optimize_coding_in,
18503            interlace_in_name.as_ptr(),
18504            interlace_in,
18505            trellis_quant_in_name.as_ptr(),
18506            trellis_quant_in,
18507            overshoot_deringing_in_name.as_ptr(),
18508            overshoot_deringing_in,
18509            optimize_scans_in_name.as_ptr(),
18510            optimize_scans_in,
18511            quant_table_in_name.as_ptr(),
18512            quant_table_in,
18513            subsample_mode_in_name.as_ptr(),
18514            subsample_mode_in,
18515            restart_interval_in_name.as_ptr(),
18516            restart_interval_in,
18517            keep_in_name.as_ptr(),
18518            keep_in,
18519            background_in_name.as_ptr(),
18520            background_in,
18521            page_height_in_name.as_ptr(),
18522            page_height_in,
18523            profile_in_name.as_ptr(),
18524            profile_in.as_ptr(),
18525            NULL,
18526        );
18527        utils::result(vips_op_response, (), Error::JpegsaveError)
18528    }
18529}
18530
18531/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18532/// inp: `&VipsImage` -> Image to save
18533/// returns `Vec<u8>` - Buffer to save to
18534pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
18535    unsafe {
18536        let inp_in: *mut bindings::VipsImage = inp.ctx;
18537        let mut buffer_buf_size: u64 = 0;
18538        let mut buffer_out: *mut c_void = null_mut();
18539
18540        let vips_op_response =
18541            bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18542        utils::result(
18543            vips_op_response,
18544            utils::new_byte_array(buffer_out, buffer_buf_size),
18545            Error::JpegsaveBufferError,
18546        )
18547    }
18548}
18549
18550/// Options for jpegsave_buffer operation
18551#[derive(Clone, Debug)]
18552pub struct JpegsaveBufferOptions {
18553    /// q: `i32` -> Q factor
18554    /// min: 1, max: 100, default: 75
18555    pub q: i32,
18556    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
18557    /// default: false
18558    pub optimize_coding: bool,
18559    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
18560    /// default: false
18561    pub interlace: bool,
18562    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
18563    /// default: false
18564    pub trellis_quant: bool,
18565    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
18566    /// default: false
18567    pub overshoot_deringing: bool,
18568    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
18569    /// default: false
18570    pub optimize_scans: bool,
18571    /// quant_table: `i32` -> Use predefined quantization table with given index
18572    /// min: 0, max: 8, default: 0
18573    pub quant_table: i32,
18574    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18575    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18576    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18577    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18578    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18579    pub subsample_mode: ForeignSubsample,
18580    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
18581    /// min: 0, max: 2147483647, default: 0
18582    pub restart_interval: i32,
18583    /// keep: `ForeignKeep` -> Which metadata to retain
18584    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18585    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18586    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18587    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18588    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18589    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18590    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18591    pub keep: ForeignKeep,
18592    /// background: `Vec<f64>` -> Background value
18593    pub background: Vec<f64>,
18594    /// page_height: `i32` -> Set page height for multipage save
18595    /// min: 0, max: 10000000, default: 0
18596    pub page_height: i32,
18597    /// profile: `String` -> Filename of ICC profile to embed
18598    pub profile: String,
18599}
18600
18601impl std::default::Default for JpegsaveBufferOptions {
18602    fn default() -> Self {
18603        JpegsaveBufferOptions {
18604            q: i32::from(75),
18605            optimize_coding: false,
18606            interlace: false,
18607            trellis_quant: false,
18608            overshoot_deringing: false,
18609            optimize_scans: false,
18610            quant_table: i32::from(0),
18611            subsample_mode: ForeignSubsample::Auto,
18612            restart_interval: i32::from(0),
18613            keep: ForeignKeep::All,
18614            background: Vec::new(),
18615            page_height: i32::from(0),
18616            profile: String::from("sRGB"),
18617        }
18618    }
18619}
18620
18621/// VipsForeignSaveJpegBuffer (jpegsave_buffer), save image to jpeg buffer (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18622/// inp: `&VipsImage` -> Image to save
18623/// jpegsave_buffer_options: `&JpegsaveBufferOptions` -> optional arguments
18624/// returns `Vec<u8>` - Buffer to save to
18625pub fn jpegsave_buffer_with_opts(
18626    inp: &VipsImage,
18627    jpegsave_buffer_options: &JpegsaveBufferOptions,
18628) -> Result<Vec<u8>> {
18629    unsafe {
18630        let inp_in: *mut bindings::VipsImage = inp.ctx;
18631        let mut buffer_buf_size: u64 = 0;
18632        let mut buffer_out: *mut c_void = null_mut();
18633
18634        let q_in: i32 = jpegsave_buffer_options.q;
18635        let q_in_name = utils::new_c_string("Q")?;
18636
18637        let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
18638            1
18639        } else {
18640            0
18641        };
18642        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18643
18644        let interlace_in: i32 = if jpegsave_buffer_options.interlace {
18645            1
18646        } else {
18647            0
18648        };
18649        let interlace_in_name = utils::new_c_string("interlace")?;
18650
18651        let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
18652            1
18653        } else {
18654            0
18655        };
18656        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18657
18658        let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
18659            1
18660        } else {
18661            0
18662        };
18663        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18664
18665        let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
18666            1
18667        } else {
18668            0
18669        };
18670        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18671
18672        let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
18673        let quant_table_in_name = utils::new_c_string("quant-table")?;
18674
18675        let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
18676        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18677
18678        let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
18679        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18680
18681        let keep_in: i32 = jpegsave_buffer_options.keep as i32;
18682        let keep_in_name = utils::new_c_string("keep")?;
18683
18684        let background_wrapper =
18685            utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
18686        let background_in = background_wrapper.ctx;
18687        let background_in_name = utils::new_c_string("background")?;
18688
18689        let page_height_in: i32 = jpegsave_buffer_options.page_height;
18690        let page_height_in_name = utils::new_c_string("page-height")?;
18691
18692        let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
18693        let profile_in_name = utils::new_c_string("profile")?;
18694
18695        let vips_op_response = bindings::vips_jpegsave_buffer(
18696            inp_in,
18697            &mut buffer_out,
18698            &mut buffer_buf_size,
18699            q_in_name.as_ptr(),
18700            q_in,
18701            optimize_coding_in_name.as_ptr(),
18702            optimize_coding_in,
18703            interlace_in_name.as_ptr(),
18704            interlace_in,
18705            trellis_quant_in_name.as_ptr(),
18706            trellis_quant_in,
18707            overshoot_deringing_in_name.as_ptr(),
18708            overshoot_deringing_in,
18709            optimize_scans_in_name.as_ptr(),
18710            optimize_scans_in,
18711            quant_table_in_name.as_ptr(),
18712            quant_table_in,
18713            subsample_mode_in_name.as_ptr(),
18714            subsample_mode_in,
18715            restart_interval_in_name.as_ptr(),
18716            restart_interval_in,
18717            keep_in_name.as_ptr(),
18718            keep_in,
18719            background_in_name.as_ptr(),
18720            background_in,
18721            page_height_in_name.as_ptr(),
18722            page_height_in,
18723            profile_in_name.as_ptr(),
18724            profile_in.as_ptr(),
18725            NULL,
18726        );
18727        utils::result(
18728            vips_op_response,
18729            utils::new_byte_array(buffer_out, buffer_buf_size),
18730            Error::JpegsaveBufferError,
18731        )
18732    }
18733}
18734
18735/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18736/// inp: `&VipsImage` -> Image to save
18737/// target: `&VipsTarget` -> Target to save to
18738
18739pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18740    unsafe {
18741        let inp_in: *mut bindings::VipsImage = inp.ctx;
18742        let target_in: *mut bindings::VipsTarget = target.ctx;
18743
18744        let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
18745        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
18746    }
18747}
18748
18749/// Options for jpegsave_target operation
18750#[derive(Clone, Debug)]
18751pub struct JpegsaveTargetOptions {
18752    /// q: `i32` -> Q factor
18753    /// min: 1, max: 100, default: 75
18754    pub q: i32,
18755    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
18756    /// default: false
18757    pub optimize_coding: bool,
18758    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
18759    /// default: false
18760    pub interlace: bool,
18761    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
18762    /// default: false
18763    pub trellis_quant: bool,
18764    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
18765    /// default: false
18766    pub overshoot_deringing: bool,
18767    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
18768    /// default: false
18769    pub optimize_scans: bool,
18770    /// quant_table: `i32` -> Use predefined quantization table with given index
18771    /// min: 0, max: 8, default: 0
18772    pub quant_table: i32,
18773    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18774    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18775    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18776    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18777    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18778    pub subsample_mode: ForeignSubsample,
18779    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
18780    /// min: 0, max: 2147483647, default: 0
18781    pub restart_interval: i32,
18782    /// keep: `ForeignKeep` -> Which metadata to retain
18783    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18784    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18785    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18786    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18787    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18788    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18789    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18790    pub keep: ForeignKeep,
18791    /// background: `Vec<f64>` -> Background value
18792    pub background: Vec<f64>,
18793    /// page_height: `i32` -> Set page height for multipage save
18794    /// min: 0, max: 10000000, default: 0
18795    pub page_height: i32,
18796    /// profile: `String` -> Filename of ICC profile to embed
18797    pub profile: String,
18798}
18799
18800impl std::default::Default for JpegsaveTargetOptions {
18801    fn default() -> Self {
18802        JpegsaveTargetOptions {
18803            q: i32::from(75),
18804            optimize_coding: false,
18805            interlace: false,
18806            trellis_quant: false,
18807            overshoot_deringing: false,
18808            optimize_scans: false,
18809            quant_table: i32::from(0),
18810            subsample_mode: ForeignSubsample::Auto,
18811            restart_interval: i32::from(0),
18812            keep: ForeignKeep::All,
18813            background: Vec::new(),
18814            page_height: i32::from(0),
18815            profile: String::from("sRGB"),
18816        }
18817    }
18818}
18819
18820/// VipsForeignSaveJpegTarget (jpegsave_target), save image to jpeg target (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18821/// inp: `&VipsImage` -> Image to save
18822/// target: `&VipsTarget` -> Target to save to
18823/// jpegsave_target_options: `&JpegsaveTargetOptions` -> optional arguments
18824
18825pub fn jpegsave_target_with_opts(
18826    inp: &VipsImage,
18827    target: &VipsTarget,
18828    jpegsave_target_options: &JpegsaveTargetOptions,
18829) -> Result<()> {
18830    unsafe {
18831        let inp_in: *mut bindings::VipsImage = inp.ctx;
18832        let target_in: *mut bindings::VipsTarget = target.ctx;
18833
18834        let q_in: i32 = jpegsave_target_options.q;
18835        let q_in_name = utils::new_c_string("Q")?;
18836
18837        let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
18838            1
18839        } else {
18840            0
18841        };
18842        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18843
18844        let interlace_in: i32 = if jpegsave_target_options.interlace {
18845            1
18846        } else {
18847            0
18848        };
18849        let interlace_in_name = utils::new_c_string("interlace")?;
18850
18851        let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
18852            1
18853        } else {
18854            0
18855        };
18856        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18857
18858        let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
18859            1
18860        } else {
18861            0
18862        };
18863        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18864
18865        let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
18866            1
18867        } else {
18868            0
18869        };
18870        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18871
18872        let quant_table_in: i32 = jpegsave_target_options.quant_table;
18873        let quant_table_in_name = utils::new_c_string("quant-table")?;
18874
18875        let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
18876        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18877
18878        let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
18879        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18880
18881        let keep_in: i32 = jpegsave_target_options.keep as i32;
18882        let keep_in_name = utils::new_c_string("keep")?;
18883
18884        let background_wrapper =
18885            utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
18886        let background_in = background_wrapper.ctx;
18887        let background_in_name = utils::new_c_string("background")?;
18888
18889        let page_height_in: i32 = jpegsave_target_options.page_height;
18890        let page_height_in_name = utils::new_c_string("page-height")?;
18891
18892        let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
18893        let profile_in_name = utils::new_c_string("profile")?;
18894
18895        let vips_op_response = bindings::vips_jpegsave_target(
18896            inp_in,
18897            target_in,
18898            q_in_name.as_ptr(),
18899            q_in,
18900            optimize_coding_in_name.as_ptr(),
18901            optimize_coding_in,
18902            interlace_in_name.as_ptr(),
18903            interlace_in,
18904            trellis_quant_in_name.as_ptr(),
18905            trellis_quant_in,
18906            overshoot_deringing_in_name.as_ptr(),
18907            overshoot_deringing_in,
18908            optimize_scans_in_name.as_ptr(),
18909            optimize_scans_in,
18910            quant_table_in_name.as_ptr(),
18911            quant_table_in,
18912            subsample_mode_in_name.as_ptr(),
18913            subsample_mode_in,
18914            restart_interval_in_name.as_ptr(),
18915            restart_interval_in,
18916            keep_in_name.as_ptr(),
18917            keep_in,
18918            background_in_name.as_ptr(),
18919            background_in,
18920            page_height_in_name.as_ptr(),
18921            page_height_in,
18922            profile_in_name.as_ptr(),
18923            profile_in.as_ptr(),
18924            NULL,
18925        );
18926        utils::result(vips_op_response, (), Error::JpegsaveTargetError)
18927    }
18928}
18929
18930/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
18931/// inp: `&VipsImage` -> Image to save
18932
18933pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
18934    unsafe {
18935        let inp_in: *mut bindings::VipsImage = inp.ctx;
18936
18937        let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
18938        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
18939    }
18940}
18941
18942/// Options for jpegsave_mime operation
18943#[derive(Clone, Debug)]
18944pub struct JpegsaveMimeOptions {
18945    /// q: `i32` -> Q factor
18946    /// min: 1, max: 100, default: 75
18947    pub q: i32,
18948    /// optimize_coding: `bool` -> Compute optimal Huffman coding tables
18949    /// default: false
18950    pub optimize_coding: bool,
18951    /// interlace: `bool` -> Generate an interlaced (progressive) jpeg
18952    /// default: false
18953    pub interlace: bool,
18954    /// trellis_quant: `bool` -> Apply trellis quantisation to each 8x8 block
18955    /// default: false
18956    pub trellis_quant: bool,
18957    /// overshoot_deringing: `bool` -> Apply overshooting to samples with extreme values
18958    /// default: false
18959    pub overshoot_deringing: bool,
18960    /// optimize_scans: `bool` -> Split spectrum of DCT coefficients into separate scans
18961    /// default: false
18962    pub optimize_scans: bool,
18963    /// quant_table: `i32` -> Use predefined quantization table with given index
18964    /// min: 0, max: 8, default: 0
18965    pub quant_table: i32,
18966    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
18967    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
18968    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
18969    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
18970    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
18971    pub subsample_mode: ForeignSubsample,
18972    /// restart_interval: `i32` -> Add restart markers every specified number of mcu
18973    /// min: 0, max: 2147483647, default: 0
18974    pub restart_interval: i32,
18975    /// keep: `ForeignKeep` -> Which metadata to retain
18976    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
18977    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
18978    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
18979    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
18980    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
18981    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
18982    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
18983    pub keep: ForeignKeep,
18984    /// background: `Vec<f64>` -> Background value
18985    pub background: Vec<f64>,
18986    /// page_height: `i32` -> Set page height for multipage save
18987    /// min: 0, max: 10000000, default: 0
18988    pub page_height: i32,
18989    /// profile: `String` -> Filename of ICC profile to embed
18990    pub profile: String,
18991}
18992
18993impl std::default::Default for JpegsaveMimeOptions {
18994    fn default() -> Self {
18995        JpegsaveMimeOptions {
18996            q: i32::from(75),
18997            optimize_coding: false,
18998            interlace: false,
18999            trellis_quant: false,
19000            overshoot_deringing: false,
19001            optimize_scans: false,
19002            quant_table: i32::from(0),
19003            subsample_mode: ForeignSubsample::Auto,
19004            restart_interval: i32::from(0),
19005            keep: ForeignKeep::All,
19006            background: Vec::new(),
19007            page_height: i32::from(0),
19008            profile: String::from("sRGB"),
19009        }
19010    }
19011}
19012
19013/// VipsForeignSaveJpegMime (jpegsave_mime), save image to jpeg mime (.jpg, .jpeg, .jpe, .jfif), priority=0, rgb-cmyk
19014/// inp: `&VipsImage` -> Image to save
19015/// jpegsave_mime_options: `&JpegsaveMimeOptions` -> optional arguments
19016
19017pub fn jpegsave_mime_with_opts(
19018    inp: &VipsImage,
19019    jpegsave_mime_options: &JpegsaveMimeOptions,
19020) -> Result<()> {
19021    unsafe {
19022        let inp_in: *mut bindings::VipsImage = inp.ctx;
19023
19024        let q_in: i32 = jpegsave_mime_options.q;
19025        let q_in_name = utils::new_c_string("Q")?;
19026
19027        let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
19028            1
19029        } else {
19030            0
19031        };
19032        let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
19033
19034        let interlace_in: i32 = if jpegsave_mime_options.interlace {
19035            1
19036        } else {
19037            0
19038        };
19039        let interlace_in_name = utils::new_c_string("interlace")?;
19040
19041        let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
19042            1
19043        } else {
19044            0
19045        };
19046        let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
19047
19048        let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
19049            1
19050        } else {
19051            0
19052        };
19053        let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
19054
19055        let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
19056            1
19057        } else {
19058            0
19059        };
19060        let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
19061
19062        let quant_table_in: i32 = jpegsave_mime_options.quant_table;
19063        let quant_table_in_name = utils::new_c_string("quant-table")?;
19064
19065        let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
19066        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
19067
19068        let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
19069        let restart_interval_in_name = utils::new_c_string("restart-interval")?;
19070
19071        let keep_in: i32 = jpegsave_mime_options.keep as i32;
19072        let keep_in_name = utils::new_c_string("keep")?;
19073
19074        let background_wrapper =
19075            utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
19076        let background_in = background_wrapper.ctx;
19077        let background_in_name = utils::new_c_string("background")?;
19078
19079        let page_height_in: i32 = jpegsave_mime_options.page_height;
19080        let page_height_in_name = utils::new_c_string("page-height")?;
19081
19082        let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
19083        let profile_in_name = utils::new_c_string("profile")?;
19084
19085        let vips_op_response = bindings::vips_jpegsave_mime(
19086            inp_in,
19087            q_in_name.as_ptr(),
19088            q_in,
19089            optimize_coding_in_name.as_ptr(),
19090            optimize_coding_in,
19091            interlace_in_name.as_ptr(),
19092            interlace_in,
19093            trellis_quant_in_name.as_ptr(),
19094            trellis_quant_in,
19095            overshoot_deringing_in_name.as_ptr(),
19096            overshoot_deringing_in,
19097            optimize_scans_in_name.as_ptr(),
19098            optimize_scans_in,
19099            quant_table_in_name.as_ptr(),
19100            quant_table_in,
19101            subsample_mode_in_name.as_ptr(),
19102            subsample_mode_in,
19103            restart_interval_in_name.as_ptr(),
19104            restart_interval_in,
19105            keep_in_name.as_ptr(),
19106            keep_in,
19107            background_in_name.as_ptr(),
19108            background_in,
19109            page_height_in_name.as_ptr(),
19110            page_height_in,
19111            profile_in_name.as_ptr(),
19112            profile_in.as_ptr(),
19113            NULL,
19114        );
19115        utils::result(vips_op_response, (), Error::JpegsaveMimeError)
19116    }
19117}
19118
19119/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
19120/// inp: `&VipsImage` -> Image to save
19121/// filename: `&str` -> Filename to save to
19122
19123pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
19124    unsafe {
19125        let inp_in: *mut bindings::VipsImage = inp.ctx;
19126        let filename_in: CString = utils::new_c_string(filename)?;
19127
19128        let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
19129        utils::result(vips_op_response, (), Error::WebpsaveError)
19130    }
19131}
19132
19133/// Options for webpsave operation
19134#[derive(Clone, Debug)]
19135pub struct WebpsaveOptions {
19136    /// q: `i32` -> Q factor
19137    /// min: 0, max: 100, default: 75
19138    pub q: i32,
19139    /// lossless: `bool` -> Enable lossless compression
19140    /// default: false
19141    pub lossless: bool,
19142    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
19143    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
19144    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
19145    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
19146    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
19147    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
19148    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
19149    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
19150    pub preset: ForeignWebpPreset,
19151    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
19152    /// default: false
19153    pub smart_subsample: bool,
19154    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
19155    /// default: false
19156    pub near_lossless: bool,
19157    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
19158    /// min: 0, max: 100, default: 100
19159    pub alpha_q: i32,
19160    /// min_size: `bool` -> Optimise for minimum size
19161    /// default: false
19162    pub min_size: bool,
19163    /// kmin: `i32` -> Minimum number of frames between key frames
19164    /// min: 0, max: 2147483647, default: 2147483646
19165    pub kmin: i32,
19166    /// kmax: `i32` -> Maximum number of frames between key frames
19167    /// min: 0, max: 2147483647, default: 2147483647
19168    pub kmax: i32,
19169    /// effort: `i32` -> Level of CPU effort to reduce file size
19170    /// min: 0, max: 6, default: 4
19171    pub effort: i32,
19172    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
19173    /// default: false
19174    pub mixed: bool,
19175    /// keep: `ForeignKeep` -> Which metadata to retain
19176    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
19177    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
19178    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
19179    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
19180    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
19181    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
19182    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
19183    pub keep: ForeignKeep,
19184    /// background: `Vec<f64>` -> Background value
19185    pub background: Vec<f64>,
19186    /// page_height: `i32` -> Set page height for multipage save
19187    /// min: 0, max: 10000000, default: 0
19188    pub page_height: i32,
19189    /// profile: `String` -> Filename of ICC profile to embed
19190    pub profile: String,
19191}
19192
19193impl std::default::Default for WebpsaveOptions {
19194    fn default() -> Self {
19195        WebpsaveOptions {
19196            q: i32::from(75),
19197            lossless: false,
19198            preset: ForeignWebpPreset::Default,
19199            smart_subsample: false,
19200            near_lossless: false,
19201            alpha_q: i32::from(100),
19202            min_size: false,
19203            kmin: i32::from(2147483646),
19204            kmax: i32::from(2147483647),
19205            effort: i32::from(4),
19206            mixed: false,
19207            keep: ForeignKeep::All,
19208            background: Vec::new(),
19209            page_height: i32::from(0),
19210            profile: String::from("sRGB"),
19211        }
19212    }
19213}
19214
19215/// VipsForeignSaveWebpFile (webpsave), save as WebP (.webp), priority=0, rgba-only
19216/// inp: `&VipsImage` -> Image to save
19217/// filename: `&str` -> Filename to save to
19218/// webpsave_options: `&WebpsaveOptions` -> optional arguments
19219
19220pub fn webpsave_with_opts(
19221    inp: &VipsImage,
19222    filename: &str,
19223    webpsave_options: &WebpsaveOptions,
19224) -> Result<()> {
19225    unsafe {
19226        let inp_in: *mut bindings::VipsImage = inp.ctx;
19227        let filename_in: CString = utils::new_c_string(filename)?;
19228
19229        let q_in: i32 = webpsave_options.q;
19230        let q_in_name = utils::new_c_string("Q")?;
19231
19232        let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
19233        let lossless_in_name = utils::new_c_string("lossless")?;
19234
19235        let preset_in: i32 = webpsave_options.preset as i32;
19236        let preset_in_name = utils::new_c_string("preset")?;
19237
19238        let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
19239            1
19240        } else {
19241            0
19242        };
19243        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19244
19245        let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
19246        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19247
19248        let alpha_q_in: i32 = webpsave_options.alpha_q;
19249        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19250
19251        let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
19252        let min_size_in_name = utils::new_c_string("min-size")?;
19253
19254        let kmin_in: i32 = webpsave_options.kmin;
19255        let kmin_in_name = utils::new_c_string("kmin")?;
19256
19257        let kmax_in: i32 = webpsave_options.kmax;
19258        let kmax_in_name = utils::new_c_string("kmax")?;
19259
19260        let effort_in: i32 = webpsave_options.effort;
19261        let effort_in_name = utils::new_c_string("effort")?;
19262
19263        let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
19264        let mixed_in_name = utils::new_c_string("mixed")?;
19265
19266        let keep_in: i32 = webpsave_options.keep as i32;
19267        let keep_in_name = utils::new_c_string("keep")?;
19268
19269        let background_wrapper =
19270            utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
19271        let background_in = background_wrapper.ctx;
19272        let background_in_name = utils::new_c_string("background")?;
19273
19274        let page_height_in: i32 = webpsave_options.page_height;
19275        let page_height_in_name = utils::new_c_string("page-height")?;
19276
19277        let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
19278        let profile_in_name = utils::new_c_string("profile")?;
19279
19280        let vips_op_response = bindings::vips_webpsave(
19281            inp_in,
19282            filename_in.as_ptr(),
19283            q_in_name.as_ptr(),
19284            q_in,
19285            lossless_in_name.as_ptr(),
19286            lossless_in,
19287            preset_in_name.as_ptr(),
19288            preset_in,
19289            smart_subsample_in_name.as_ptr(),
19290            smart_subsample_in,
19291            near_lossless_in_name.as_ptr(),
19292            near_lossless_in,
19293            alpha_q_in_name.as_ptr(),
19294            alpha_q_in,
19295            min_size_in_name.as_ptr(),
19296            min_size_in,
19297            kmin_in_name.as_ptr(),
19298            kmin_in,
19299            kmax_in_name.as_ptr(),
19300            kmax_in,
19301            effort_in_name.as_ptr(),
19302            effort_in,
19303            mixed_in_name.as_ptr(),
19304            mixed_in,
19305            keep_in_name.as_ptr(),
19306            keep_in,
19307            background_in_name.as_ptr(),
19308            background_in,
19309            page_height_in_name.as_ptr(),
19310            page_height_in,
19311            profile_in_name.as_ptr(),
19312            profile_in.as_ptr(),
19313            NULL,
19314        );
19315        utils::result(vips_op_response, (), Error::WebpsaveError)
19316    }
19317}
19318
19319/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
19320/// inp: `&VipsImage` -> Image to save
19321/// returns `Vec<u8>` - Buffer to save to
19322pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
19323    unsafe {
19324        let inp_in: *mut bindings::VipsImage = inp.ctx;
19325        let mut buffer_buf_size: u64 = 0;
19326        let mut buffer_out: *mut c_void = null_mut();
19327
19328        let vips_op_response =
19329            bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
19330        utils::result(
19331            vips_op_response,
19332            utils::new_byte_array(buffer_out, buffer_buf_size),
19333            Error::WebpsaveBufferError,
19334        )
19335    }
19336}
19337
19338/// Options for webpsave_buffer operation
19339#[derive(Clone, Debug)]
19340pub struct WebpsaveBufferOptions {
19341    /// q: `i32` -> Q factor
19342    /// min: 0, max: 100, default: 75
19343    pub q: i32,
19344    /// lossless: `bool` -> Enable lossless compression
19345    /// default: false
19346    pub lossless: bool,
19347    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
19348    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
19349    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
19350    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
19351    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
19352    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
19353    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
19354    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
19355    pub preset: ForeignWebpPreset,
19356    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
19357    /// default: false
19358    pub smart_subsample: bool,
19359    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
19360    /// default: false
19361    pub near_lossless: bool,
19362    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
19363    /// min: 0, max: 100, default: 100
19364    pub alpha_q: i32,
19365    /// min_size: `bool` -> Optimise for minimum size
19366    /// default: false
19367    pub min_size: bool,
19368    /// kmin: `i32` -> Minimum number of frames between key frames
19369    /// min: 0, max: 2147483647, default: 2147483646
19370    pub kmin: i32,
19371    /// kmax: `i32` -> Maximum number of frames between key frames
19372    /// min: 0, max: 2147483647, default: 2147483647
19373    pub kmax: i32,
19374    /// effort: `i32` -> Level of CPU effort to reduce file size
19375    /// min: 0, max: 6, default: 4
19376    pub effort: i32,
19377    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
19378    /// default: false
19379    pub mixed: bool,
19380    /// keep: `ForeignKeep` -> Which metadata to retain
19381    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
19382    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
19383    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
19384    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
19385    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
19386    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
19387    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
19388    pub keep: ForeignKeep,
19389    /// background: `Vec<f64>` -> Background value
19390    pub background: Vec<f64>,
19391    /// page_height: `i32` -> Set page height for multipage save
19392    /// min: 0, max: 10000000, default: 0
19393    pub page_height: i32,
19394    /// profile: `String` -> Filename of ICC profile to embed
19395    pub profile: String,
19396}
19397
19398impl std::default::Default for WebpsaveBufferOptions {
19399    fn default() -> Self {
19400        WebpsaveBufferOptions {
19401            q: i32::from(75),
19402            lossless: false,
19403            preset: ForeignWebpPreset::Default,
19404            smart_subsample: false,
19405            near_lossless: false,
19406            alpha_q: i32::from(100),
19407            min_size: false,
19408            kmin: i32::from(2147483646),
19409            kmax: i32::from(2147483647),
19410            effort: i32::from(4),
19411            mixed: false,
19412            keep: ForeignKeep::All,
19413            background: Vec::new(),
19414            page_height: i32::from(0),
19415            profile: String::from("sRGB"),
19416        }
19417    }
19418}
19419
19420/// VipsForeignSaveWebpBuffer (webpsave_buffer), save as WebP (.webp), priority=0, rgba-only
19421/// inp: `&VipsImage` -> Image to save
19422/// webpsave_buffer_options: `&WebpsaveBufferOptions` -> optional arguments
19423/// returns `Vec<u8>` - Buffer to save to
19424pub fn webpsave_buffer_with_opts(
19425    inp: &VipsImage,
19426    webpsave_buffer_options: &WebpsaveBufferOptions,
19427) -> Result<Vec<u8>> {
19428    unsafe {
19429        let inp_in: *mut bindings::VipsImage = inp.ctx;
19430        let mut buffer_buf_size: u64 = 0;
19431        let mut buffer_out: *mut c_void = null_mut();
19432
19433        let q_in: i32 = webpsave_buffer_options.q;
19434        let q_in_name = utils::new_c_string("Q")?;
19435
19436        let lossless_in: i32 = if webpsave_buffer_options.lossless {
19437            1
19438        } else {
19439            0
19440        };
19441        let lossless_in_name = utils::new_c_string("lossless")?;
19442
19443        let preset_in: i32 = webpsave_buffer_options.preset as i32;
19444        let preset_in_name = utils::new_c_string("preset")?;
19445
19446        let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
19447            1
19448        } else {
19449            0
19450        };
19451        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19452
19453        let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
19454            1
19455        } else {
19456            0
19457        };
19458        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19459
19460        let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
19461        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19462
19463        let min_size_in: i32 = if webpsave_buffer_options.min_size {
19464            1
19465        } else {
19466            0
19467        };
19468        let min_size_in_name = utils::new_c_string("min-size")?;
19469
19470        let kmin_in: i32 = webpsave_buffer_options.kmin;
19471        let kmin_in_name = utils::new_c_string("kmin")?;
19472
19473        let kmax_in: i32 = webpsave_buffer_options.kmax;
19474        let kmax_in_name = utils::new_c_string("kmax")?;
19475
19476        let effort_in: i32 = webpsave_buffer_options.effort;
19477        let effort_in_name = utils::new_c_string("effort")?;
19478
19479        let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
19480        let mixed_in_name = utils::new_c_string("mixed")?;
19481
19482        let keep_in: i32 = webpsave_buffer_options.keep as i32;
19483        let keep_in_name = utils::new_c_string("keep")?;
19484
19485        let background_wrapper =
19486            utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
19487        let background_in = background_wrapper.ctx;
19488        let background_in_name = utils::new_c_string("background")?;
19489
19490        let page_height_in: i32 = webpsave_buffer_options.page_height;
19491        let page_height_in_name = utils::new_c_string("page-height")?;
19492
19493        let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
19494        let profile_in_name = utils::new_c_string("profile")?;
19495
19496        let vips_op_response = bindings::vips_webpsave_buffer(
19497            inp_in,
19498            &mut buffer_out,
19499            &mut buffer_buf_size,
19500            q_in_name.as_ptr(),
19501            q_in,
19502            lossless_in_name.as_ptr(),
19503            lossless_in,
19504            preset_in_name.as_ptr(),
19505            preset_in,
19506            smart_subsample_in_name.as_ptr(),
19507            smart_subsample_in,
19508            near_lossless_in_name.as_ptr(),
19509            near_lossless_in,
19510            alpha_q_in_name.as_ptr(),
19511            alpha_q_in,
19512            min_size_in_name.as_ptr(),
19513            min_size_in,
19514            kmin_in_name.as_ptr(),
19515            kmin_in,
19516            kmax_in_name.as_ptr(),
19517            kmax_in,
19518            effort_in_name.as_ptr(),
19519            effort_in,
19520            mixed_in_name.as_ptr(),
19521            mixed_in,
19522            keep_in_name.as_ptr(),
19523            keep_in,
19524            background_in_name.as_ptr(),
19525            background_in,
19526            page_height_in_name.as_ptr(),
19527            page_height_in,
19528            profile_in_name.as_ptr(),
19529            profile_in.as_ptr(),
19530            NULL,
19531        );
19532        utils::result(
19533            vips_op_response,
19534            utils::new_byte_array(buffer_out, buffer_buf_size),
19535            Error::WebpsaveBufferError,
19536        )
19537    }
19538}
19539
19540/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
19541/// inp: `&VipsImage` -> Image to save
19542/// target: `&VipsTarget` -> Target to save to
19543
19544pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
19545    unsafe {
19546        let inp_in: *mut bindings::VipsImage = inp.ctx;
19547        let target_in: *mut bindings::VipsTarget = target.ctx;
19548
19549        let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
19550        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
19551    }
19552}
19553
19554/// Options for webpsave_target operation
19555#[derive(Clone, Debug)]
19556pub struct WebpsaveTargetOptions {
19557    /// q: `i32` -> Q factor
19558    /// min: 0, max: 100, default: 75
19559    pub q: i32,
19560    /// lossless: `bool` -> Enable lossless compression
19561    /// default: false
19562    pub lossless: bool,
19563    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
19564    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
19565    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
19566    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
19567    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
19568    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
19569    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
19570    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
19571    pub preset: ForeignWebpPreset,
19572    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
19573    /// default: false
19574    pub smart_subsample: bool,
19575    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
19576    /// default: false
19577    pub near_lossless: bool,
19578    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
19579    /// min: 0, max: 100, default: 100
19580    pub alpha_q: i32,
19581    /// min_size: `bool` -> Optimise for minimum size
19582    /// default: false
19583    pub min_size: bool,
19584    /// kmin: `i32` -> Minimum number of frames between key frames
19585    /// min: 0, max: 2147483647, default: 2147483646
19586    pub kmin: i32,
19587    /// kmax: `i32` -> Maximum number of frames between key frames
19588    /// min: 0, max: 2147483647, default: 2147483647
19589    pub kmax: i32,
19590    /// effort: `i32` -> Level of CPU effort to reduce file size
19591    /// min: 0, max: 6, default: 4
19592    pub effort: i32,
19593    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
19594    /// default: false
19595    pub mixed: bool,
19596    /// keep: `ForeignKeep` -> Which metadata to retain
19597    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
19598    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
19599    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
19600    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
19601    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
19602    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
19603    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
19604    pub keep: ForeignKeep,
19605    /// background: `Vec<f64>` -> Background value
19606    pub background: Vec<f64>,
19607    /// page_height: `i32` -> Set page height for multipage save
19608    /// min: 0, max: 10000000, default: 0
19609    pub page_height: i32,
19610    /// profile: `String` -> Filename of ICC profile to embed
19611    pub profile: String,
19612}
19613
19614impl std::default::Default for WebpsaveTargetOptions {
19615    fn default() -> Self {
19616        WebpsaveTargetOptions {
19617            q: i32::from(75),
19618            lossless: false,
19619            preset: ForeignWebpPreset::Default,
19620            smart_subsample: false,
19621            near_lossless: false,
19622            alpha_q: i32::from(100),
19623            min_size: false,
19624            kmin: i32::from(2147483646),
19625            kmax: i32::from(2147483647),
19626            effort: i32::from(4),
19627            mixed: false,
19628            keep: ForeignKeep::All,
19629            background: Vec::new(),
19630            page_height: i32::from(0),
19631            profile: String::from("sRGB"),
19632        }
19633    }
19634}
19635
19636/// VipsForeignSaveWebpTarget (webpsave_target), save as WebP (.webp), priority=0, rgba-only
19637/// inp: `&VipsImage` -> Image to save
19638/// target: `&VipsTarget` -> Target to save to
19639/// webpsave_target_options: `&WebpsaveTargetOptions` -> optional arguments
19640
19641pub fn webpsave_target_with_opts(
19642    inp: &VipsImage,
19643    target: &VipsTarget,
19644    webpsave_target_options: &WebpsaveTargetOptions,
19645) -> Result<()> {
19646    unsafe {
19647        let inp_in: *mut bindings::VipsImage = inp.ctx;
19648        let target_in: *mut bindings::VipsTarget = target.ctx;
19649
19650        let q_in: i32 = webpsave_target_options.q;
19651        let q_in_name = utils::new_c_string("Q")?;
19652
19653        let lossless_in: i32 = if webpsave_target_options.lossless {
19654            1
19655        } else {
19656            0
19657        };
19658        let lossless_in_name = utils::new_c_string("lossless")?;
19659
19660        let preset_in: i32 = webpsave_target_options.preset as i32;
19661        let preset_in_name = utils::new_c_string("preset")?;
19662
19663        let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
19664            1
19665        } else {
19666            0
19667        };
19668        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19669
19670        let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
19671            1
19672        } else {
19673            0
19674        };
19675        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19676
19677        let alpha_q_in: i32 = webpsave_target_options.alpha_q;
19678        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19679
19680        let min_size_in: i32 = if webpsave_target_options.min_size {
19681            1
19682        } else {
19683            0
19684        };
19685        let min_size_in_name = utils::new_c_string("min-size")?;
19686
19687        let kmin_in: i32 = webpsave_target_options.kmin;
19688        let kmin_in_name = utils::new_c_string("kmin")?;
19689
19690        let kmax_in: i32 = webpsave_target_options.kmax;
19691        let kmax_in_name = utils::new_c_string("kmax")?;
19692
19693        let effort_in: i32 = webpsave_target_options.effort;
19694        let effort_in_name = utils::new_c_string("effort")?;
19695
19696        let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
19697        let mixed_in_name = utils::new_c_string("mixed")?;
19698
19699        let keep_in: i32 = webpsave_target_options.keep as i32;
19700        let keep_in_name = utils::new_c_string("keep")?;
19701
19702        let background_wrapper =
19703            utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
19704        let background_in = background_wrapper.ctx;
19705        let background_in_name = utils::new_c_string("background")?;
19706
19707        let page_height_in: i32 = webpsave_target_options.page_height;
19708        let page_height_in_name = utils::new_c_string("page-height")?;
19709
19710        let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
19711        let profile_in_name = utils::new_c_string("profile")?;
19712
19713        let vips_op_response = bindings::vips_webpsave_target(
19714            inp_in,
19715            target_in,
19716            q_in_name.as_ptr(),
19717            q_in,
19718            lossless_in_name.as_ptr(),
19719            lossless_in,
19720            preset_in_name.as_ptr(),
19721            preset_in,
19722            smart_subsample_in_name.as_ptr(),
19723            smart_subsample_in,
19724            near_lossless_in_name.as_ptr(),
19725            near_lossless_in,
19726            alpha_q_in_name.as_ptr(),
19727            alpha_q_in,
19728            min_size_in_name.as_ptr(),
19729            min_size_in,
19730            kmin_in_name.as_ptr(),
19731            kmin_in,
19732            kmax_in_name.as_ptr(),
19733            kmax_in,
19734            effort_in_name.as_ptr(),
19735            effort_in,
19736            mixed_in_name.as_ptr(),
19737            mixed_in,
19738            keep_in_name.as_ptr(),
19739            keep_in,
19740            background_in_name.as_ptr(),
19741            background_in,
19742            page_height_in_name.as_ptr(),
19743            page_height_in,
19744            profile_in_name.as_ptr(),
19745            profile_in.as_ptr(),
19746            NULL,
19747        );
19748        utils::result(vips_op_response, (), Error::WebpsaveTargetError)
19749    }
19750}
19751
19752/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
19753/// inp: `&VipsImage` -> Image to save
19754
19755pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
19756    unsafe {
19757        let inp_in: *mut bindings::VipsImage = inp.ctx;
19758
19759        let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
19760        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
19761    }
19762}
19763
19764/// Options for webpsave_mime operation
19765#[derive(Clone, Debug)]
19766pub struct WebpsaveMimeOptions {
19767    /// q: `i32` -> Q factor
19768    /// min: 0, max: 100, default: 75
19769    pub q: i32,
19770    /// lossless: `bool` -> Enable lossless compression
19771    /// default: false
19772    pub lossless: bool,
19773    /// preset: `ForeignWebpPreset` -> Preset for lossy compression
19774    ///  `Default` -> VIPS_FOREIGN_WEBP_PRESET_DEFAULT = 0 [DEFAULT]
19775    ///  `Picture` -> VIPS_FOREIGN_WEBP_PRESET_PICTURE = 1
19776    ///  `Photo` -> VIPS_FOREIGN_WEBP_PRESET_PHOTO = 2
19777    ///  `Drawing` -> VIPS_FOREIGN_WEBP_PRESET_DRAWING = 3
19778    ///  `Icon` -> VIPS_FOREIGN_WEBP_PRESET_ICON = 4
19779    ///  `Text` -> VIPS_FOREIGN_WEBP_PRESET_TEXT = 5
19780    ///  `Last` -> VIPS_FOREIGN_WEBP_PRESET_LAST = 6
19781    pub preset: ForeignWebpPreset,
19782    /// smart_subsample: `bool` -> Enable high quality chroma subsampling
19783    /// default: false
19784    pub smart_subsample: bool,
19785    /// near_lossless: `bool` -> Enable preprocessing in lossless mode (uses Q)
19786    /// default: false
19787    pub near_lossless: bool,
19788    /// alpha_q: `i32` -> Change alpha plane fidelity for lossy compression
19789    /// min: 0, max: 100, default: 100
19790    pub alpha_q: i32,
19791    /// min_size: `bool` -> Optimise for minimum size
19792    /// default: false
19793    pub min_size: bool,
19794    /// kmin: `i32` -> Minimum number of frames between key frames
19795    /// min: 0, max: 2147483647, default: 2147483646
19796    pub kmin: i32,
19797    /// kmax: `i32` -> Maximum number of frames between key frames
19798    /// min: 0, max: 2147483647, default: 2147483647
19799    pub kmax: i32,
19800    /// effort: `i32` -> Level of CPU effort to reduce file size
19801    /// min: 0, max: 6, default: 4
19802    pub effort: i32,
19803    /// mixed: `bool` -> Allow mixed encoding (might reduce file size)
19804    /// default: false
19805    pub mixed: bool,
19806    /// keep: `ForeignKeep` -> Which metadata to retain
19807    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
19808    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
19809    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
19810    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
19811    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
19812    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
19813    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
19814    pub keep: ForeignKeep,
19815    /// background: `Vec<f64>` -> Background value
19816    pub background: Vec<f64>,
19817    /// page_height: `i32` -> Set page height for multipage save
19818    /// min: 0, max: 10000000, default: 0
19819    pub page_height: i32,
19820    /// profile: `String` -> Filename of ICC profile to embed
19821    pub profile: String,
19822}
19823
19824impl std::default::Default for WebpsaveMimeOptions {
19825    fn default() -> Self {
19826        WebpsaveMimeOptions {
19827            q: i32::from(75),
19828            lossless: false,
19829            preset: ForeignWebpPreset::Default,
19830            smart_subsample: false,
19831            near_lossless: false,
19832            alpha_q: i32::from(100),
19833            min_size: false,
19834            kmin: i32::from(2147483646),
19835            kmax: i32::from(2147483647),
19836            effort: i32::from(4),
19837            mixed: false,
19838            keep: ForeignKeep::All,
19839            background: Vec::new(),
19840            page_height: i32::from(0),
19841            profile: String::from("sRGB"),
19842        }
19843    }
19844}
19845
19846/// VipsForeignSaveWebpMime (webpsave_mime), save image to webp mime (.webp), priority=0, rgba-only
19847/// inp: `&VipsImage` -> Image to save
19848/// webpsave_mime_options: `&WebpsaveMimeOptions` -> optional arguments
19849
19850pub fn webpsave_mime_with_opts(
19851    inp: &VipsImage,
19852    webpsave_mime_options: &WebpsaveMimeOptions,
19853) -> Result<()> {
19854    unsafe {
19855        let inp_in: *mut bindings::VipsImage = inp.ctx;
19856
19857        let q_in: i32 = webpsave_mime_options.q;
19858        let q_in_name = utils::new_c_string("Q")?;
19859
19860        let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
19861        let lossless_in_name = utils::new_c_string("lossless")?;
19862
19863        let preset_in: i32 = webpsave_mime_options.preset as i32;
19864        let preset_in_name = utils::new_c_string("preset")?;
19865
19866        let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
19867            1
19868        } else {
19869            0
19870        };
19871        let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19872
19873        let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
19874            1
19875        } else {
19876            0
19877        };
19878        let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19879
19880        let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
19881        let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19882
19883        let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
19884        let min_size_in_name = utils::new_c_string("min-size")?;
19885
19886        let kmin_in: i32 = webpsave_mime_options.kmin;
19887        let kmin_in_name = utils::new_c_string("kmin")?;
19888
19889        let kmax_in: i32 = webpsave_mime_options.kmax;
19890        let kmax_in_name = utils::new_c_string("kmax")?;
19891
19892        let effort_in: i32 = webpsave_mime_options.effort;
19893        let effort_in_name = utils::new_c_string("effort")?;
19894
19895        let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
19896        let mixed_in_name = utils::new_c_string("mixed")?;
19897
19898        let keep_in: i32 = webpsave_mime_options.keep as i32;
19899        let keep_in_name = utils::new_c_string("keep")?;
19900
19901        let background_wrapper =
19902            utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
19903        let background_in = background_wrapper.ctx;
19904        let background_in_name = utils::new_c_string("background")?;
19905
19906        let page_height_in: i32 = webpsave_mime_options.page_height;
19907        let page_height_in_name = utils::new_c_string("page-height")?;
19908
19909        let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
19910        let profile_in_name = utils::new_c_string("profile")?;
19911
19912        let vips_op_response = bindings::vips_webpsave_mime(
19913            inp_in,
19914            q_in_name.as_ptr(),
19915            q_in,
19916            lossless_in_name.as_ptr(),
19917            lossless_in,
19918            preset_in_name.as_ptr(),
19919            preset_in,
19920            smart_subsample_in_name.as_ptr(),
19921            smart_subsample_in,
19922            near_lossless_in_name.as_ptr(),
19923            near_lossless_in,
19924            alpha_q_in_name.as_ptr(),
19925            alpha_q_in,
19926            min_size_in_name.as_ptr(),
19927            min_size_in,
19928            kmin_in_name.as_ptr(),
19929            kmin_in,
19930            kmax_in_name.as_ptr(),
19931            kmax_in,
19932            effort_in_name.as_ptr(),
19933            effort_in,
19934            mixed_in_name.as_ptr(),
19935            mixed_in,
19936            keep_in_name.as_ptr(),
19937            keep_in,
19938            background_in_name.as_ptr(),
19939            background_in,
19940            page_height_in_name.as_ptr(),
19941            page_height_in,
19942            profile_in_name.as_ptr(),
19943            profile_in.as_ptr(),
19944            NULL,
19945        );
19946        utils::result(vips_op_response, (), Error::WebpsaveMimeError)
19947    }
19948}
19949
19950/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
19951/// inp: `&VipsImage` -> Image to save
19952/// filename: `&str` -> Filename to save to
19953
19954pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
19955    unsafe {
19956        let inp_in: *mut bindings::VipsImage = inp.ctx;
19957        let filename_in: CString = utils::new_c_string(filename)?;
19958
19959        let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
19960        utils::result(vips_op_response, (), Error::TiffsaveError)
19961    }
19962}
19963
19964/// Options for tiffsave operation
19965#[derive(Clone, Debug)]
19966pub struct TiffsaveOptions {
19967    /// compression: `ForeignTiffCompression` -> Compression for this file
19968    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
19969    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
19970    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
19971    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
19972    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
19973    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
19974    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
19975    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
19976    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
19977    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
19978    pub compression: ForeignTiffCompression,
19979    /// q: `i32` -> Q factor
19980    /// min: 1, max: 100, default: 75
19981    pub q: i32,
19982    /// predictor: `ForeignTiffPredictor` -> Compression prediction
19983    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
19984    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
19985    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
19986    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
19987    pub predictor: ForeignTiffPredictor,
19988    /// tile: `bool` -> Write a tiled tiff
19989    /// default: false
19990    pub tile: bool,
19991    /// tile_width: `i32` -> Tile width in pixels
19992    /// min: 1, max: 32768, default: 128
19993    pub tile_width: i32,
19994    /// tile_height: `i32` -> Tile height in pixels
19995    /// min: 1, max: 32768, default: 128
19996    pub tile_height: i32,
19997    /// pyramid: `bool` -> Write a pyramidal tiff
19998    /// default: false
19999    pub pyramid: bool,
20000    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
20001    /// default: false
20002    pub miniswhite: bool,
20003    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
20004    /// min: 0, max: 8, default: 0
20005    pub bitdepth: i32,
20006    /// resunit: `ForeignTiffResunit` -> Resolution unit
20007    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
20008    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
20009    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
20010    pub resunit: ForeignTiffResunit,
20011    /// xres: `f64` -> Horizontal resolution in pixels/mm
20012    /// min: 0.001, max: 1000000, default: 1
20013    pub xres: f64,
20014    /// yres: `f64` -> Vertical resolution in pixels/mm
20015    /// min: 0.001, max: 1000000, default: 1
20016    pub yres: f64,
20017    /// bigtiff: `bool` -> Write a bigtiff image
20018    /// default: false
20019    pub bigtiff: bool,
20020    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
20021    /// default: false
20022    pub properties: bool,
20023    /// region_shrink: `RegionShrink` -> Method to shrink regions
20024    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
20025    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
20026    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
20027    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
20028    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
20029    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
20030    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
20031    pub region_shrink: RegionShrink,
20032    /// level: `i32` -> ZSTD compression level
20033    /// min: 1, max: 22, default: 10
20034    pub level: i32,
20035    /// lossless: `bool` -> Enable WEBP lossless mode
20036    /// default: false
20037    pub lossless: bool,
20038    /// depth: `ForeignDzDepth` -> Pyramid depth
20039    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
20040    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
20041    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
20042    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
20043    pub depth: ForeignDzDepth,
20044    /// subifd: `bool` -> Save pyr layers as sub-IFDs
20045    /// default: false
20046    pub subifd: bool,
20047    /// premultiply: `bool` -> Save with premultiplied alpha
20048    /// default: false
20049    pub premultiply: bool,
20050    /// keep: `ForeignKeep` -> Which metadata to retain
20051    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
20052    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
20053    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
20054    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
20055    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
20056    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
20057    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
20058    pub keep: ForeignKeep,
20059    /// background: `Vec<f64>` -> Background value
20060    pub background: Vec<f64>,
20061    /// page_height: `i32` -> Set page height for multipage save
20062    /// min: 0, max: 10000000, default: 0
20063    pub page_height: i32,
20064    /// profile: `String` -> Filename of ICC profile to embed
20065    pub profile: String,
20066}
20067
20068impl std::default::Default for TiffsaveOptions {
20069    fn default() -> Self {
20070        TiffsaveOptions {
20071            compression: ForeignTiffCompression::None,
20072            q: i32::from(75),
20073            predictor: ForeignTiffPredictor::Horizontal,
20074            tile: false,
20075            tile_width: i32::from(128),
20076            tile_height: i32::from(128),
20077            pyramid: false,
20078            miniswhite: false,
20079            bitdepth: i32::from(0),
20080            resunit: ForeignTiffResunit::Cm,
20081            xres: f64::from(1),
20082            yres: f64::from(1),
20083            bigtiff: false,
20084            properties: false,
20085            region_shrink: RegionShrink::Mean,
20086            level: i32::from(10),
20087            lossless: false,
20088            depth: ForeignDzDepth::Onetile,
20089            subifd: false,
20090            premultiply: false,
20091            keep: ForeignKeep::All,
20092            background: Vec::new(),
20093            page_height: i32::from(0),
20094            profile: String::from("sRGB"),
20095        }
20096    }
20097}
20098
20099/// VipsForeignSaveTiffFile (tiffsave), save image to tiff file (.tif, .tiff), priority=0, any
20100/// inp: `&VipsImage` -> Image to save
20101/// filename: `&str` -> Filename to save to
20102/// tiffsave_options: `&TiffsaveOptions` -> optional arguments
20103
20104pub fn tiffsave_with_opts(
20105    inp: &VipsImage,
20106    filename: &str,
20107    tiffsave_options: &TiffsaveOptions,
20108) -> Result<()> {
20109    unsafe {
20110        let inp_in: *mut bindings::VipsImage = inp.ctx;
20111        let filename_in: CString = utils::new_c_string(filename)?;
20112
20113        let compression_in: i32 = tiffsave_options.compression as i32;
20114        let compression_in_name = utils::new_c_string("compression")?;
20115
20116        let q_in: i32 = tiffsave_options.q;
20117        let q_in_name = utils::new_c_string("Q")?;
20118
20119        let predictor_in: i32 = tiffsave_options.predictor as i32;
20120        let predictor_in_name = utils::new_c_string("predictor")?;
20121
20122        let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
20123        let tile_in_name = utils::new_c_string("tile")?;
20124
20125        let tile_width_in: i32 = tiffsave_options.tile_width;
20126        let tile_width_in_name = utils::new_c_string("tile-width")?;
20127
20128        let tile_height_in: i32 = tiffsave_options.tile_height;
20129        let tile_height_in_name = utils::new_c_string("tile-height")?;
20130
20131        let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
20132        let pyramid_in_name = utils::new_c_string("pyramid")?;
20133
20134        let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
20135        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20136
20137        let bitdepth_in: i32 = tiffsave_options.bitdepth;
20138        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20139
20140        let resunit_in: i32 = tiffsave_options.resunit as i32;
20141        let resunit_in_name = utils::new_c_string("resunit")?;
20142
20143        let xres_in: f64 = tiffsave_options.xres;
20144        let xres_in_name = utils::new_c_string("xres")?;
20145
20146        let yres_in: f64 = tiffsave_options.yres;
20147        let yres_in_name = utils::new_c_string("yres")?;
20148
20149        let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
20150        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20151
20152        let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
20153        let properties_in_name = utils::new_c_string("properties")?;
20154
20155        let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
20156        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20157
20158        let level_in: i32 = tiffsave_options.level;
20159        let level_in_name = utils::new_c_string("level")?;
20160
20161        let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
20162        let lossless_in_name = utils::new_c_string("lossless")?;
20163
20164        let depth_in: i32 = tiffsave_options.depth as i32;
20165        let depth_in_name = utils::new_c_string("depth")?;
20166
20167        let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
20168        let subifd_in_name = utils::new_c_string("subifd")?;
20169
20170        let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
20171        let premultiply_in_name = utils::new_c_string("premultiply")?;
20172
20173        let keep_in: i32 = tiffsave_options.keep as i32;
20174        let keep_in_name = utils::new_c_string("keep")?;
20175
20176        let background_wrapper =
20177            utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
20178        let background_in = background_wrapper.ctx;
20179        let background_in_name = utils::new_c_string("background")?;
20180
20181        let page_height_in: i32 = tiffsave_options.page_height;
20182        let page_height_in_name = utils::new_c_string("page-height")?;
20183
20184        let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
20185        let profile_in_name = utils::new_c_string("profile")?;
20186
20187        let vips_op_response = bindings::vips_tiffsave(
20188            inp_in,
20189            filename_in.as_ptr(),
20190            compression_in_name.as_ptr(),
20191            compression_in,
20192            q_in_name.as_ptr(),
20193            q_in,
20194            predictor_in_name.as_ptr(),
20195            predictor_in,
20196            tile_in_name.as_ptr(),
20197            tile_in,
20198            tile_width_in_name.as_ptr(),
20199            tile_width_in,
20200            tile_height_in_name.as_ptr(),
20201            tile_height_in,
20202            pyramid_in_name.as_ptr(),
20203            pyramid_in,
20204            miniswhite_in_name.as_ptr(),
20205            miniswhite_in,
20206            bitdepth_in_name.as_ptr(),
20207            bitdepth_in,
20208            resunit_in_name.as_ptr(),
20209            resunit_in,
20210            xres_in_name.as_ptr(),
20211            xres_in,
20212            yres_in_name.as_ptr(),
20213            yres_in,
20214            bigtiff_in_name.as_ptr(),
20215            bigtiff_in,
20216            properties_in_name.as_ptr(),
20217            properties_in,
20218            region_shrink_in_name.as_ptr(),
20219            region_shrink_in,
20220            level_in_name.as_ptr(),
20221            level_in,
20222            lossless_in_name.as_ptr(),
20223            lossless_in,
20224            depth_in_name.as_ptr(),
20225            depth_in,
20226            subifd_in_name.as_ptr(),
20227            subifd_in,
20228            premultiply_in_name.as_ptr(),
20229            premultiply_in,
20230            keep_in_name.as_ptr(),
20231            keep_in,
20232            background_in_name.as_ptr(),
20233            background_in,
20234            page_height_in_name.as_ptr(),
20235            page_height_in,
20236            profile_in_name.as_ptr(),
20237            profile_in.as_ptr(),
20238            NULL,
20239        );
20240        utils::result(vips_op_response, (), Error::TiffsaveError)
20241    }
20242}
20243
20244/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
20245/// inp: `&VipsImage` -> Image to save
20246/// returns `Vec<u8>` - Buffer to save to
20247pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
20248    unsafe {
20249        let inp_in: *mut bindings::VipsImage = inp.ctx;
20250        let mut buffer_buf_size: u64 = 0;
20251        let mut buffer_out: *mut c_void = null_mut();
20252
20253        let vips_op_response =
20254            bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
20255        utils::result(
20256            vips_op_response,
20257            utils::new_byte_array(buffer_out, buffer_buf_size),
20258            Error::TiffsaveBufferError,
20259        )
20260    }
20261}
20262
20263/// Options for tiffsave_buffer operation
20264#[derive(Clone, Debug)]
20265pub struct TiffsaveBufferOptions {
20266    /// compression: `ForeignTiffCompression` -> Compression for this file
20267    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
20268    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
20269    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
20270    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
20271    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
20272    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
20273    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
20274    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
20275    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
20276    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
20277    pub compression: ForeignTiffCompression,
20278    /// q: `i32` -> Q factor
20279    /// min: 1, max: 100, default: 75
20280    pub q: i32,
20281    /// predictor: `ForeignTiffPredictor` -> Compression prediction
20282    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
20283    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
20284    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
20285    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
20286    pub predictor: ForeignTiffPredictor,
20287    /// tile: `bool` -> Write a tiled tiff
20288    /// default: false
20289    pub tile: bool,
20290    /// tile_width: `i32` -> Tile width in pixels
20291    /// min: 1, max: 32768, default: 128
20292    pub tile_width: i32,
20293    /// tile_height: `i32` -> Tile height in pixels
20294    /// min: 1, max: 32768, default: 128
20295    pub tile_height: i32,
20296    /// pyramid: `bool` -> Write a pyramidal tiff
20297    /// default: false
20298    pub pyramid: bool,
20299    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
20300    /// default: false
20301    pub miniswhite: bool,
20302    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
20303    /// min: 0, max: 8, default: 0
20304    pub bitdepth: i32,
20305    /// resunit: `ForeignTiffResunit` -> Resolution unit
20306    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
20307    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
20308    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
20309    pub resunit: ForeignTiffResunit,
20310    /// xres: `f64` -> Horizontal resolution in pixels/mm
20311    /// min: 0.001, max: 1000000, default: 1
20312    pub xres: f64,
20313    /// yres: `f64` -> Vertical resolution in pixels/mm
20314    /// min: 0.001, max: 1000000, default: 1
20315    pub yres: f64,
20316    /// bigtiff: `bool` -> Write a bigtiff image
20317    /// default: false
20318    pub bigtiff: bool,
20319    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
20320    /// default: false
20321    pub properties: bool,
20322    /// region_shrink: `RegionShrink` -> Method to shrink regions
20323    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
20324    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
20325    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
20326    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
20327    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
20328    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
20329    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
20330    pub region_shrink: RegionShrink,
20331    /// level: `i32` -> ZSTD compression level
20332    /// min: 1, max: 22, default: 10
20333    pub level: i32,
20334    /// lossless: `bool` -> Enable WEBP lossless mode
20335    /// default: false
20336    pub lossless: bool,
20337    /// depth: `ForeignDzDepth` -> Pyramid depth
20338    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
20339    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
20340    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
20341    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
20342    pub depth: ForeignDzDepth,
20343    /// subifd: `bool` -> Save pyr layers as sub-IFDs
20344    /// default: false
20345    pub subifd: bool,
20346    /// premultiply: `bool` -> Save with premultiplied alpha
20347    /// default: false
20348    pub premultiply: bool,
20349    /// keep: `ForeignKeep` -> Which metadata to retain
20350    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
20351    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
20352    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
20353    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
20354    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
20355    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
20356    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
20357    pub keep: ForeignKeep,
20358    /// background: `Vec<f64>` -> Background value
20359    pub background: Vec<f64>,
20360    /// page_height: `i32` -> Set page height for multipage save
20361    /// min: 0, max: 10000000, default: 0
20362    pub page_height: i32,
20363    /// profile: `String` -> Filename of ICC profile to embed
20364    pub profile: String,
20365}
20366
20367impl std::default::Default for TiffsaveBufferOptions {
20368    fn default() -> Self {
20369        TiffsaveBufferOptions {
20370            compression: ForeignTiffCompression::None,
20371            q: i32::from(75),
20372            predictor: ForeignTiffPredictor::Horizontal,
20373            tile: false,
20374            tile_width: i32::from(128),
20375            tile_height: i32::from(128),
20376            pyramid: false,
20377            miniswhite: false,
20378            bitdepth: i32::from(0),
20379            resunit: ForeignTiffResunit::Cm,
20380            xres: f64::from(1),
20381            yres: f64::from(1),
20382            bigtiff: false,
20383            properties: false,
20384            region_shrink: RegionShrink::Mean,
20385            level: i32::from(10),
20386            lossless: false,
20387            depth: ForeignDzDepth::Onetile,
20388            subifd: false,
20389            premultiply: false,
20390            keep: ForeignKeep::All,
20391            background: Vec::new(),
20392            page_height: i32::from(0),
20393            profile: String::from("sRGB"),
20394        }
20395    }
20396}
20397
20398/// VipsForeignSaveTiffBuffer (tiffsave_buffer), save image to tiff buffer (.tif, .tiff), priority=0, any
20399/// inp: `&VipsImage` -> Image to save
20400/// tiffsave_buffer_options: `&TiffsaveBufferOptions` -> optional arguments
20401/// returns `Vec<u8>` - Buffer to save to
20402pub fn tiffsave_buffer_with_opts(
20403    inp: &VipsImage,
20404    tiffsave_buffer_options: &TiffsaveBufferOptions,
20405) -> Result<Vec<u8>> {
20406    unsafe {
20407        let inp_in: *mut bindings::VipsImage = inp.ctx;
20408        let mut buffer_buf_size: u64 = 0;
20409        let mut buffer_out: *mut c_void = null_mut();
20410
20411        let compression_in: i32 = tiffsave_buffer_options.compression as i32;
20412        let compression_in_name = utils::new_c_string("compression")?;
20413
20414        let q_in: i32 = tiffsave_buffer_options.q;
20415        let q_in_name = utils::new_c_string("Q")?;
20416
20417        let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
20418        let predictor_in_name = utils::new_c_string("predictor")?;
20419
20420        let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
20421        let tile_in_name = utils::new_c_string("tile")?;
20422
20423        let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
20424        let tile_width_in_name = utils::new_c_string("tile-width")?;
20425
20426        let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
20427        let tile_height_in_name = utils::new_c_string("tile-height")?;
20428
20429        let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
20430            1
20431        } else {
20432            0
20433        };
20434        let pyramid_in_name = utils::new_c_string("pyramid")?;
20435
20436        let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
20437            1
20438        } else {
20439            0
20440        };
20441        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20442
20443        let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
20444        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20445
20446        let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
20447        let resunit_in_name = utils::new_c_string("resunit")?;
20448
20449        let xres_in: f64 = tiffsave_buffer_options.xres;
20450        let xres_in_name = utils::new_c_string("xres")?;
20451
20452        let yres_in: f64 = tiffsave_buffer_options.yres;
20453        let yres_in_name = utils::new_c_string("yres")?;
20454
20455        let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
20456            1
20457        } else {
20458            0
20459        };
20460        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20461
20462        let properties_in: i32 = if tiffsave_buffer_options.properties {
20463            1
20464        } else {
20465            0
20466        };
20467        let properties_in_name = utils::new_c_string("properties")?;
20468
20469        let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
20470        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20471
20472        let level_in: i32 = tiffsave_buffer_options.level;
20473        let level_in_name = utils::new_c_string("level")?;
20474
20475        let lossless_in: i32 = if tiffsave_buffer_options.lossless {
20476            1
20477        } else {
20478            0
20479        };
20480        let lossless_in_name = utils::new_c_string("lossless")?;
20481
20482        let depth_in: i32 = tiffsave_buffer_options.depth as i32;
20483        let depth_in_name = utils::new_c_string("depth")?;
20484
20485        let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
20486        let subifd_in_name = utils::new_c_string("subifd")?;
20487
20488        let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
20489            1
20490        } else {
20491            0
20492        };
20493        let premultiply_in_name = utils::new_c_string("premultiply")?;
20494
20495        let keep_in: i32 = tiffsave_buffer_options.keep as i32;
20496        let keep_in_name = utils::new_c_string("keep")?;
20497
20498        let background_wrapper =
20499            utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
20500        let background_in = background_wrapper.ctx;
20501        let background_in_name = utils::new_c_string("background")?;
20502
20503        let page_height_in: i32 = tiffsave_buffer_options.page_height;
20504        let page_height_in_name = utils::new_c_string("page-height")?;
20505
20506        let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
20507        let profile_in_name = utils::new_c_string("profile")?;
20508
20509        let vips_op_response = bindings::vips_tiffsave_buffer(
20510            inp_in,
20511            &mut buffer_out,
20512            &mut buffer_buf_size,
20513            compression_in_name.as_ptr(),
20514            compression_in,
20515            q_in_name.as_ptr(),
20516            q_in,
20517            predictor_in_name.as_ptr(),
20518            predictor_in,
20519            tile_in_name.as_ptr(),
20520            tile_in,
20521            tile_width_in_name.as_ptr(),
20522            tile_width_in,
20523            tile_height_in_name.as_ptr(),
20524            tile_height_in,
20525            pyramid_in_name.as_ptr(),
20526            pyramid_in,
20527            miniswhite_in_name.as_ptr(),
20528            miniswhite_in,
20529            bitdepth_in_name.as_ptr(),
20530            bitdepth_in,
20531            resunit_in_name.as_ptr(),
20532            resunit_in,
20533            xres_in_name.as_ptr(),
20534            xres_in,
20535            yres_in_name.as_ptr(),
20536            yres_in,
20537            bigtiff_in_name.as_ptr(),
20538            bigtiff_in,
20539            properties_in_name.as_ptr(),
20540            properties_in,
20541            region_shrink_in_name.as_ptr(),
20542            region_shrink_in,
20543            level_in_name.as_ptr(),
20544            level_in,
20545            lossless_in_name.as_ptr(),
20546            lossless_in,
20547            depth_in_name.as_ptr(),
20548            depth_in,
20549            subifd_in_name.as_ptr(),
20550            subifd_in,
20551            premultiply_in_name.as_ptr(),
20552            premultiply_in,
20553            keep_in_name.as_ptr(),
20554            keep_in,
20555            background_in_name.as_ptr(),
20556            background_in,
20557            page_height_in_name.as_ptr(),
20558            page_height_in,
20559            profile_in_name.as_ptr(),
20560            profile_in.as_ptr(),
20561            NULL,
20562        );
20563        utils::result(
20564            vips_op_response,
20565            utils::new_byte_array(buffer_out, buffer_buf_size),
20566            Error::TiffsaveBufferError,
20567        )
20568    }
20569}
20570
20571/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
20572/// inp: `&VipsImage` -> Image to save
20573/// target: `&VipsTarget` -> Target to save to
20574
20575pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
20576    unsafe {
20577        let inp_in: *mut bindings::VipsImage = inp.ctx;
20578        let target_in: *mut bindings::VipsTarget = target.ctx;
20579
20580        let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
20581        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
20582    }
20583}
20584
20585/// Options for tiffsave_target operation
20586#[derive(Clone, Debug)]
20587pub struct TiffsaveTargetOptions {
20588    /// compression: `ForeignTiffCompression` -> Compression for this file
20589    ///  `None` -> VIPS_FOREIGN_TIFF_COMPRESSION_NONE = 0 [DEFAULT]
20590    ///  `Jpeg` -> VIPS_FOREIGN_TIFF_COMPRESSION_JPEG = 1
20591    ///  `Deflate` -> VIPS_FOREIGN_TIFF_COMPRESSION_DEFLATE = 2
20592    ///  `Packbit` -> VIPS_FOREIGN_TIFF_COMPRESSION_PACKBITS = 3
20593    ///  `Ccittfax4` -> VIPS_FOREIGN_TIFF_COMPRESSION_CCITTFAX4 = 4
20594    ///  `Lzw` -> VIPS_FOREIGN_TIFF_COMPRESSION_LZW = 5
20595    ///  `Webp` -> VIPS_FOREIGN_TIFF_COMPRESSION_WEBP = 6
20596    ///  `Zstd` -> VIPS_FOREIGN_TIFF_COMPRESSION_ZSTD = 7
20597    ///  `Jp2K` -> VIPS_FOREIGN_TIFF_COMPRESSION_JP2K = 8
20598    ///  `Last` -> VIPS_FOREIGN_TIFF_COMPRESSION_LAST = 9
20599    pub compression: ForeignTiffCompression,
20600    /// q: `i32` -> Q factor
20601    /// min: 1, max: 100, default: 75
20602    pub q: i32,
20603    /// predictor: `ForeignTiffPredictor` -> Compression prediction
20604    ///  `None` -> VIPS_FOREIGN_TIFF_PREDICTOR_NONE = 1
20605    ///  `Horizontal` -> VIPS_FOREIGN_TIFF_PREDICTOR_HORIZONTAL = 2 [DEFAULT]
20606    ///  `Float` -> VIPS_FOREIGN_TIFF_PREDICTOR_FLOAT = 3
20607    ///  `Last` -> VIPS_FOREIGN_TIFF_PREDICTOR_LAST = 4
20608    pub predictor: ForeignTiffPredictor,
20609    /// tile: `bool` -> Write a tiled tiff
20610    /// default: false
20611    pub tile: bool,
20612    /// tile_width: `i32` -> Tile width in pixels
20613    /// min: 1, max: 32768, default: 128
20614    pub tile_width: i32,
20615    /// tile_height: `i32` -> Tile height in pixels
20616    /// min: 1, max: 32768, default: 128
20617    pub tile_height: i32,
20618    /// pyramid: `bool` -> Write a pyramidal tiff
20619    /// default: false
20620    pub pyramid: bool,
20621    /// miniswhite: `bool` -> Use 0 for white in 1-bit images
20622    /// default: false
20623    pub miniswhite: bool,
20624    /// bitdepth: `i32` -> Write as a 1, 2, 4 or 8 bit image
20625    /// min: 0, max: 8, default: 0
20626    pub bitdepth: i32,
20627    /// resunit: `ForeignTiffResunit` -> Resolution unit
20628    ///  `Cm` -> VIPS_FOREIGN_TIFF_RESUNIT_CM = 0 [DEFAULT]
20629    ///  `Inch` -> VIPS_FOREIGN_TIFF_RESUNIT_INCH = 1
20630    ///  `Last` -> VIPS_FOREIGN_TIFF_RESUNIT_LAST = 2
20631    pub resunit: ForeignTiffResunit,
20632    /// xres: `f64` -> Horizontal resolution in pixels/mm
20633    /// min: 0.001, max: 1000000, default: 1
20634    pub xres: f64,
20635    /// yres: `f64` -> Vertical resolution in pixels/mm
20636    /// min: 0.001, max: 1000000, default: 1
20637    pub yres: f64,
20638    /// bigtiff: `bool` -> Write a bigtiff image
20639    /// default: false
20640    pub bigtiff: bool,
20641    /// properties: `bool` -> Write a properties document to IMAGEDESCRIPTION
20642    /// default: false
20643    pub properties: bool,
20644    /// region_shrink: `RegionShrink` -> Method to shrink regions
20645    ///  `Mean` -> VIPS_REGION_SHRINK_MEAN = 0 [DEFAULT]
20646    ///  `Median` -> VIPS_REGION_SHRINK_MEDIAN = 1
20647    ///  `Mode` -> VIPS_REGION_SHRINK_MODE = 2
20648    ///  `Max` -> VIPS_REGION_SHRINK_MAX = 3
20649    ///  `Min` -> VIPS_REGION_SHRINK_MIN = 4
20650    ///  `Nearest` -> VIPS_REGION_SHRINK_NEAREST = 5
20651    ///  `Last` -> VIPS_REGION_SHRINK_LAST = 6
20652    pub region_shrink: RegionShrink,
20653    /// level: `i32` -> ZSTD compression level
20654    /// min: 1, max: 22, default: 10
20655    pub level: i32,
20656    /// lossless: `bool` -> Enable WEBP lossless mode
20657    /// default: false
20658    pub lossless: bool,
20659    /// depth: `ForeignDzDepth` -> Pyramid depth
20660    ///  `Onepixel` -> VIPS_FOREIGN_DZ_DEPTH_ONEPIXEL = 0
20661    ///  `Onetile` -> VIPS_FOREIGN_DZ_DEPTH_ONETILE = 1 [DEFAULT]
20662    ///  `One` -> VIPS_FOREIGN_DZ_DEPTH_ONE = 2
20663    ///  `Last` -> VIPS_FOREIGN_DZ_DEPTH_LAST = 3
20664    pub depth: ForeignDzDepth,
20665    /// subifd: `bool` -> Save pyr layers as sub-IFDs
20666    /// default: false
20667    pub subifd: bool,
20668    /// premultiply: `bool` -> Save with premultiplied alpha
20669    /// default: false
20670    pub premultiply: bool,
20671    /// keep: `ForeignKeep` -> Which metadata to retain
20672    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
20673    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
20674    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
20675    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
20676    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
20677    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
20678    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
20679    pub keep: ForeignKeep,
20680    /// background: `Vec<f64>` -> Background value
20681    pub background: Vec<f64>,
20682    /// page_height: `i32` -> Set page height for multipage save
20683    /// min: 0, max: 10000000, default: 0
20684    pub page_height: i32,
20685    /// profile: `String` -> Filename of ICC profile to embed
20686    pub profile: String,
20687}
20688
20689impl std::default::Default for TiffsaveTargetOptions {
20690    fn default() -> Self {
20691        TiffsaveTargetOptions {
20692            compression: ForeignTiffCompression::None,
20693            q: i32::from(75),
20694            predictor: ForeignTiffPredictor::Horizontal,
20695            tile: false,
20696            tile_width: i32::from(128),
20697            tile_height: i32::from(128),
20698            pyramid: false,
20699            miniswhite: false,
20700            bitdepth: i32::from(0),
20701            resunit: ForeignTiffResunit::Cm,
20702            xres: f64::from(1),
20703            yres: f64::from(1),
20704            bigtiff: false,
20705            properties: false,
20706            region_shrink: RegionShrink::Mean,
20707            level: i32::from(10),
20708            lossless: false,
20709            depth: ForeignDzDepth::Onetile,
20710            subifd: false,
20711            premultiply: false,
20712            keep: ForeignKeep::All,
20713            background: Vec::new(),
20714            page_height: i32::from(0),
20715            profile: String::from("sRGB"),
20716        }
20717    }
20718}
20719
20720/// VipsForeignSaveTiffTarget (tiffsave_target), save image to tiff target (.tif, .tiff), priority=0, any
20721/// inp: `&VipsImage` -> Image to save
20722/// target: `&VipsTarget` -> Target to save to
20723/// tiffsave_target_options: `&TiffsaveTargetOptions` -> optional arguments
20724
20725pub fn tiffsave_target_with_opts(
20726    inp: &VipsImage,
20727    target: &VipsTarget,
20728    tiffsave_target_options: &TiffsaveTargetOptions,
20729) -> Result<()> {
20730    unsafe {
20731        let inp_in: *mut bindings::VipsImage = inp.ctx;
20732        let target_in: *mut bindings::VipsTarget = target.ctx;
20733
20734        let compression_in: i32 = tiffsave_target_options.compression as i32;
20735        let compression_in_name = utils::new_c_string("compression")?;
20736
20737        let q_in: i32 = tiffsave_target_options.q;
20738        let q_in_name = utils::new_c_string("Q")?;
20739
20740        let predictor_in: i32 = tiffsave_target_options.predictor as i32;
20741        let predictor_in_name = utils::new_c_string("predictor")?;
20742
20743        let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
20744        let tile_in_name = utils::new_c_string("tile")?;
20745
20746        let tile_width_in: i32 = tiffsave_target_options.tile_width;
20747        let tile_width_in_name = utils::new_c_string("tile-width")?;
20748
20749        let tile_height_in: i32 = tiffsave_target_options.tile_height;
20750        let tile_height_in_name = utils::new_c_string("tile-height")?;
20751
20752        let pyramid_in: i32 = if tiffsave_target_options.pyramid {
20753            1
20754        } else {
20755            0
20756        };
20757        let pyramid_in_name = utils::new_c_string("pyramid")?;
20758
20759        let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
20760            1
20761        } else {
20762            0
20763        };
20764        let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20765
20766        let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
20767        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20768
20769        let resunit_in: i32 = tiffsave_target_options.resunit as i32;
20770        let resunit_in_name = utils::new_c_string("resunit")?;
20771
20772        let xres_in: f64 = tiffsave_target_options.xres;
20773        let xres_in_name = utils::new_c_string("xres")?;
20774
20775        let yres_in: f64 = tiffsave_target_options.yres;
20776        let yres_in_name = utils::new_c_string("yres")?;
20777
20778        let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
20779            1
20780        } else {
20781            0
20782        };
20783        let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20784
20785        let properties_in: i32 = if tiffsave_target_options.properties {
20786            1
20787        } else {
20788            0
20789        };
20790        let properties_in_name = utils::new_c_string("properties")?;
20791
20792        let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
20793        let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20794
20795        let level_in: i32 = tiffsave_target_options.level;
20796        let level_in_name = utils::new_c_string("level")?;
20797
20798        let lossless_in: i32 = if tiffsave_target_options.lossless {
20799            1
20800        } else {
20801            0
20802        };
20803        let lossless_in_name = utils::new_c_string("lossless")?;
20804
20805        let depth_in: i32 = tiffsave_target_options.depth as i32;
20806        let depth_in_name = utils::new_c_string("depth")?;
20807
20808        let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
20809        let subifd_in_name = utils::new_c_string("subifd")?;
20810
20811        let premultiply_in: i32 = if tiffsave_target_options.premultiply {
20812            1
20813        } else {
20814            0
20815        };
20816        let premultiply_in_name = utils::new_c_string("premultiply")?;
20817
20818        let keep_in: i32 = tiffsave_target_options.keep as i32;
20819        let keep_in_name = utils::new_c_string("keep")?;
20820
20821        let background_wrapper =
20822            utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
20823        let background_in = background_wrapper.ctx;
20824        let background_in_name = utils::new_c_string("background")?;
20825
20826        let page_height_in: i32 = tiffsave_target_options.page_height;
20827        let page_height_in_name = utils::new_c_string("page-height")?;
20828
20829        let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
20830        let profile_in_name = utils::new_c_string("profile")?;
20831
20832        let vips_op_response = bindings::vips_tiffsave_target(
20833            inp_in,
20834            target_in,
20835            compression_in_name.as_ptr(),
20836            compression_in,
20837            q_in_name.as_ptr(),
20838            q_in,
20839            predictor_in_name.as_ptr(),
20840            predictor_in,
20841            tile_in_name.as_ptr(),
20842            tile_in,
20843            tile_width_in_name.as_ptr(),
20844            tile_width_in,
20845            tile_height_in_name.as_ptr(),
20846            tile_height_in,
20847            pyramid_in_name.as_ptr(),
20848            pyramid_in,
20849            miniswhite_in_name.as_ptr(),
20850            miniswhite_in,
20851            bitdepth_in_name.as_ptr(),
20852            bitdepth_in,
20853            resunit_in_name.as_ptr(),
20854            resunit_in,
20855            xres_in_name.as_ptr(),
20856            xres_in,
20857            yres_in_name.as_ptr(),
20858            yres_in,
20859            bigtiff_in_name.as_ptr(),
20860            bigtiff_in,
20861            properties_in_name.as_ptr(),
20862            properties_in,
20863            region_shrink_in_name.as_ptr(),
20864            region_shrink_in,
20865            level_in_name.as_ptr(),
20866            level_in,
20867            lossless_in_name.as_ptr(),
20868            lossless_in,
20869            depth_in_name.as_ptr(),
20870            depth_in,
20871            subifd_in_name.as_ptr(),
20872            subifd_in,
20873            premultiply_in_name.as_ptr(),
20874            premultiply_in,
20875            keep_in_name.as_ptr(),
20876            keep_in,
20877            background_in_name.as_ptr(),
20878            background_in,
20879            page_height_in_name.as_ptr(),
20880            page_height_in,
20881            profile_in_name.as_ptr(),
20882            profile_in.as_ptr(),
20883            NULL,
20884        );
20885        utils::result(vips_op_response, (), Error::TiffsaveTargetError)
20886    }
20887}
20888
20889/// VipsForeignSaveFits (fitssave), save image to fits file (.fits, .fit, .fts), priority=0, untrusted, any
20890/// inp: `&VipsImage` -> Image to save
20891/// filename: `&str` -> Filename to save to
20892
20893pub fn fitssave(inp: &VipsImage, filename: &str) -> Result<()> {
20894    unsafe {
20895        let inp_in: *mut bindings::VipsImage = inp.ctx;
20896        let filename_in: CString = utils::new_c_string(filename)?;
20897
20898        let vips_op_response = bindings::vips_fitssave(inp_in, filename_in.as_ptr(), NULL);
20899        utils::result(vips_op_response, (), Error::FitssaveError)
20900    }
20901}
20902
20903/// Options for fitssave operation
20904#[derive(Clone, Debug)]
20905pub struct FitssaveOptions {
20906    /// keep: `ForeignKeep` -> Which metadata to retain
20907    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
20908    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
20909    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
20910    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
20911    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
20912    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
20913    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
20914    pub keep: ForeignKeep,
20915    /// background: `Vec<f64>` -> Background value
20916    pub background: Vec<f64>,
20917    /// page_height: `i32` -> Set page height for multipage save
20918    /// min: 0, max: 10000000, default: 0
20919    pub page_height: i32,
20920    /// profile: `String` -> Filename of ICC profile to embed
20921    pub profile: String,
20922}
20923
20924impl std::default::Default for FitssaveOptions {
20925    fn default() -> Self {
20926        FitssaveOptions {
20927            keep: ForeignKeep::All,
20928            background: Vec::new(),
20929            page_height: i32::from(0),
20930            profile: String::from("sRGB"),
20931        }
20932    }
20933}
20934
20935/// VipsForeignSaveFits (fitssave), save image to fits file (.fits, .fit, .fts), priority=0, untrusted, any
20936/// inp: `&VipsImage` -> Image to save
20937/// filename: `&str` -> Filename to save to
20938/// fitssave_options: `&FitssaveOptions` -> optional arguments
20939
20940pub fn fitssave_with_opts(
20941    inp: &VipsImage,
20942    filename: &str,
20943    fitssave_options: &FitssaveOptions,
20944) -> Result<()> {
20945    unsafe {
20946        let inp_in: *mut bindings::VipsImage = inp.ctx;
20947        let filename_in: CString = utils::new_c_string(filename)?;
20948
20949        let keep_in: i32 = fitssave_options.keep as i32;
20950        let keep_in_name = utils::new_c_string("keep")?;
20951
20952        let background_wrapper =
20953            utils::VipsArrayDoubleWrapper::from(&fitssave_options.background[..]);
20954        let background_in = background_wrapper.ctx;
20955        let background_in_name = utils::new_c_string("background")?;
20956
20957        let page_height_in: i32 = fitssave_options.page_height;
20958        let page_height_in_name = utils::new_c_string("page-height")?;
20959
20960        let profile_in: CString = utils::new_c_string(&fitssave_options.profile)?;
20961        let profile_in_name = utils::new_c_string("profile")?;
20962
20963        let vips_op_response = bindings::vips_fitssave(
20964            inp_in,
20965            filename_in.as_ptr(),
20966            keep_in_name.as_ptr(),
20967            keep_in,
20968            background_in_name.as_ptr(),
20969            background_in,
20970            page_height_in_name.as_ptr(),
20971            page_height_in,
20972            profile_in_name.as_ptr(),
20973            profile_in.as_ptr(),
20974            NULL,
20975        );
20976        utils::result(vips_op_response, (), Error::FitssaveError)
20977    }
20978}
20979
20980/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
20981/// inp: `&VipsImage` -> Image to save
20982/// filename: `&str` -> Filename to save to
20983
20984pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
20985    unsafe {
20986        let inp_in: *mut bindings::VipsImage = inp.ctx;
20987        let filename_in: CString = utils::new_c_string(filename)?;
20988
20989        let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
20990        utils::result(vips_op_response, (), Error::HeifsaveError)
20991    }
20992}
20993
20994/// Options for heifsave operation
20995#[derive(Clone, Debug)]
20996pub struct HeifsaveOptions {
20997    /// q: `i32` -> Q factor
20998    /// min: 1, max: 100, default: 50
20999    pub q: i32,
21000    /// bitdepth: `i32` -> Number of bits per pixel
21001    /// min: 1, max: 16, default: 12
21002    pub bitdepth: i32,
21003    /// lossless: `bool` -> Enable lossless compression
21004    /// default: false
21005    pub lossless: bool,
21006    /// compression: `ForeignHeifCompression` -> Compression format
21007    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
21008    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
21009    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
21010    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
21011    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
21012    pub compression: ForeignHeifCompression,
21013    /// effort: `i32` -> CPU effort
21014    /// min: 0, max: 9, default: 4
21015    pub effort: i32,
21016    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
21017    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
21018    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
21019    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
21020    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
21021    pub subsample_mode: ForeignSubsample,
21022    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
21023    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
21024    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
21025    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
21026    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
21027    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
21028    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
21029    pub encoder: ForeignHeifEncoder,
21030    /// keep: `ForeignKeep` -> Which metadata to retain
21031    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21032    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21033    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21034    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21035    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21036    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21037    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21038    pub keep: ForeignKeep,
21039    /// background: `Vec<f64>` -> Background value
21040    pub background: Vec<f64>,
21041    /// page_height: `i32` -> Set page height for multipage save
21042    /// min: 0, max: 10000000, default: 0
21043    pub page_height: i32,
21044    /// profile: `String` -> Filename of ICC profile to embed
21045    pub profile: String,
21046}
21047
21048impl std::default::Default for HeifsaveOptions {
21049    fn default() -> Self {
21050        HeifsaveOptions {
21051            q: i32::from(50),
21052            bitdepth: i32::from(12),
21053            lossless: false,
21054            compression: ForeignHeifCompression::Hevc,
21055            effort: i32::from(4),
21056            subsample_mode: ForeignSubsample::Auto,
21057            encoder: ForeignHeifEncoder::Auto,
21058            keep: ForeignKeep::All,
21059            background: Vec::new(),
21060            page_height: i32::from(0),
21061            profile: String::from("sRGB"),
21062        }
21063    }
21064}
21065
21066/// VipsForeignSaveHeifFile (heifsave), save image in HEIF format (.heic, .heif, .avif), priority=0, rgba-only
21067/// inp: `&VipsImage` -> Image to save
21068/// filename: `&str` -> Filename to save to
21069/// heifsave_options: `&HeifsaveOptions` -> optional arguments
21070
21071pub fn heifsave_with_opts(
21072    inp: &VipsImage,
21073    filename: &str,
21074    heifsave_options: &HeifsaveOptions,
21075) -> Result<()> {
21076    unsafe {
21077        let inp_in: *mut bindings::VipsImage = inp.ctx;
21078        let filename_in: CString = utils::new_c_string(filename)?;
21079
21080        let q_in: i32 = heifsave_options.q;
21081        let q_in_name = utils::new_c_string("Q")?;
21082
21083        let bitdepth_in: i32 = heifsave_options.bitdepth;
21084        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21085
21086        let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
21087        let lossless_in_name = utils::new_c_string("lossless")?;
21088
21089        let compression_in: i32 = heifsave_options.compression as i32;
21090        let compression_in_name = utils::new_c_string("compression")?;
21091
21092        let effort_in: i32 = heifsave_options.effort;
21093        let effort_in_name = utils::new_c_string("effort")?;
21094
21095        let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
21096        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21097
21098        let encoder_in: i32 = heifsave_options.encoder as i32;
21099        let encoder_in_name = utils::new_c_string("encoder")?;
21100
21101        let keep_in: i32 = heifsave_options.keep as i32;
21102        let keep_in_name = utils::new_c_string("keep")?;
21103
21104        let background_wrapper =
21105            utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
21106        let background_in = background_wrapper.ctx;
21107        let background_in_name = utils::new_c_string("background")?;
21108
21109        let page_height_in: i32 = heifsave_options.page_height;
21110        let page_height_in_name = utils::new_c_string("page-height")?;
21111
21112        let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
21113        let profile_in_name = utils::new_c_string("profile")?;
21114
21115        let vips_op_response = bindings::vips_heifsave(
21116            inp_in,
21117            filename_in.as_ptr(),
21118            q_in_name.as_ptr(),
21119            q_in,
21120            bitdepth_in_name.as_ptr(),
21121            bitdepth_in,
21122            lossless_in_name.as_ptr(),
21123            lossless_in,
21124            compression_in_name.as_ptr(),
21125            compression_in,
21126            effort_in_name.as_ptr(),
21127            effort_in,
21128            subsample_mode_in_name.as_ptr(),
21129            subsample_mode_in,
21130            encoder_in_name.as_ptr(),
21131            encoder_in,
21132            keep_in_name.as_ptr(),
21133            keep_in,
21134            background_in_name.as_ptr(),
21135            background_in,
21136            page_height_in_name.as_ptr(),
21137            page_height_in,
21138            profile_in_name.as_ptr(),
21139            profile_in.as_ptr(),
21140            NULL,
21141        );
21142        utils::result(vips_op_response, (), Error::HeifsaveError)
21143    }
21144}
21145
21146/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
21147/// inp: `&VipsImage` -> Image to save
21148/// returns `Vec<u8>` - Buffer to save to
21149pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21150    unsafe {
21151        let inp_in: *mut bindings::VipsImage = inp.ctx;
21152        let mut buffer_buf_size: u64 = 0;
21153        let mut buffer_out: *mut c_void = null_mut();
21154
21155        let vips_op_response =
21156            bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21157        utils::result(
21158            vips_op_response,
21159            utils::new_byte_array(buffer_out, buffer_buf_size),
21160            Error::HeifsaveBufferError,
21161        )
21162    }
21163}
21164
21165/// Options for heifsave_buffer operation
21166#[derive(Clone, Debug)]
21167pub struct HeifsaveBufferOptions {
21168    /// q: `i32` -> Q factor
21169    /// min: 1, max: 100, default: 50
21170    pub q: i32,
21171    /// bitdepth: `i32` -> Number of bits per pixel
21172    /// min: 1, max: 16, default: 12
21173    pub bitdepth: i32,
21174    /// lossless: `bool` -> Enable lossless compression
21175    /// default: false
21176    pub lossless: bool,
21177    /// compression: `ForeignHeifCompression` -> Compression format
21178    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
21179    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
21180    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
21181    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
21182    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
21183    pub compression: ForeignHeifCompression,
21184    /// effort: `i32` -> CPU effort
21185    /// min: 0, max: 9, default: 4
21186    pub effort: i32,
21187    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
21188    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
21189    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
21190    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
21191    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
21192    pub subsample_mode: ForeignSubsample,
21193    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
21194    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
21195    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
21196    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
21197    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
21198    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
21199    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
21200    pub encoder: ForeignHeifEncoder,
21201    /// keep: `ForeignKeep` -> Which metadata to retain
21202    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21203    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21204    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21205    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21206    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21207    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21208    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21209    pub keep: ForeignKeep,
21210    /// background: `Vec<f64>` -> Background value
21211    pub background: Vec<f64>,
21212    /// page_height: `i32` -> Set page height for multipage save
21213    /// min: 0, max: 10000000, default: 0
21214    pub page_height: i32,
21215    /// profile: `String` -> Filename of ICC profile to embed
21216    pub profile: String,
21217}
21218
21219impl std::default::Default for HeifsaveBufferOptions {
21220    fn default() -> Self {
21221        HeifsaveBufferOptions {
21222            q: i32::from(50),
21223            bitdepth: i32::from(12),
21224            lossless: false,
21225            compression: ForeignHeifCompression::Hevc,
21226            effort: i32::from(4),
21227            subsample_mode: ForeignSubsample::Auto,
21228            encoder: ForeignHeifEncoder::Auto,
21229            keep: ForeignKeep::All,
21230            background: Vec::new(),
21231            page_height: i32::from(0),
21232            profile: String::from("sRGB"),
21233        }
21234    }
21235}
21236
21237/// VipsForeignSaveHeifBuffer (heifsave_buffer), save image in HEIF format (.heic, .heif), priority=0, rgba-only
21238/// inp: `&VipsImage` -> Image to save
21239/// heifsave_buffer_options: `&HeifsaveBufferOptions` -> optional arguments
21240/// returns `Vec<u8>` - Buffer to save to
21241pub fn heifsave_buffer_with_opts(
21242    inp: &VipsImage,
21243    heifsave_buffer_options: &HeifsaveBufferOptions,
21244) -> Result<Vec<u8>> {
21245    unsafe {
21246        let inp_in: *mut bindings::VipsImage = inp.ctx;
21247        let mut buffer_buf_size: u64 = 0;
21248        let mut buffer_out: *mut c_void = null_mut();
21249
21250        let q_in: i32 = heifsave_buffer_options.q;
21251        let q_in_name = utils::new_c_string("Q")?;
21252
21253        let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
21254        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21255
21256        let lossless_in: i32 = if heifsave_buffer_options.lossless {
21257            1
21258        } else {
21259            0
21260        };
21261        let lossless_in_name = utils::new_c_string("lossless")?;
21262
21263        let compression_in: i32 = heifsave_buffer_options.compression as i32;
21264        let compression_in_name = utils::new_c_string("compression")?;
21265
21266        let effort_in: i32 = heifsave_buffer_options.effort;
21267        let effort_in_name = utils::new_c_string("effort")?;
21268
21269        let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
21270        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21271
21272        let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
21273        let encoder_in_name = utils::new_c_string("encoder")?;
21274
21275        let keep_in: i32 = heifsave_buffer_options.keep as i32;
21276        let keep_in_name = utils::new_c_string("keep")?;
21277
21278        let background_wrapper =
21279            utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
21280        let background_in = background_wrapper.ctx;
21281        let background_in_name = utils::new_c_string("background")?;
21282
21283        let page_height_in: i32 = heifsave_buffer_options.page_height;
21284        let page_height_in_name = utils::new_c_string("page-height")?;
21285
21286        let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
21287        let profile_in_name = utils::new_c_string("profile")?;
21288
21289        let vips_op_response = bindings::vips_heifsave_buffer(
21290            inp_in,
21291            &mut buffer_out,
21292            &mut buffer_buf_size,
21293            q_in_name.as_ptr(),
21294            q_in,
21295            bitdepth_in_name.as_ptr(),
21296            bitdepth_in,
21297            lossless_in_name.as_ptr(),
21298            lossless_in,
21299            compression_in_name.as_ptr(),
21300            compression_in,
21301            effort_in_name.as_ptr(),
21302            effort_in,
21303            subsample_mode_in_name.as_ptr(),
21304            subsample_mode_in,
21305            encoder_in_name.as_ptr(),
21306            encoder_in,
21307            keep_in_name.as_ptr(),
21308            keep_in,
21309            background_in_name.as_ptr(),
21310            background_in,
21311            page_height_in_name.as_ptr(),
21312            page_height_in,
21313            profile_in_name.as_ptr(),
21314            profile_in.as_ptr(),
21315            NULL,
21316        );
21317        utils::result(
21318            vips_op_response,
21319            utils::new_byte_array(buffer_out, buffer_buf_size),
21320            Error::HeifsaveBufferError,
21321        )
21322    }
21323}
21324
21325/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
21326/// inp: `&VipsImage` -> Image to save
21327/// target: `&VipsTarget` -> Target to save to
21328
21329pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
21330    unsafe {
21331        let inp_in: *mut bindings::VipsImage = inp.ctx;
21332        let target_in: *mut bindings::VipsTarget = target.ctx;
21333
21334        let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
21335        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
21336    }
21337}
21338
21339/// Options for heifsave_target operation
21340#[derive(Clone, Debug)]
21341pub struct HeifsaveTargetOptions {
21342    /// q: `i32` -> Q factor
21343    /// min: 1, max: 100, default: 50
21344    pub q: i32,
21345    /// bitdepth: `i32` -> Number of bits per pixel
21346    /// min: 1, max: 16, default: 12
21347    pub bitdepth: i32,
21348    /// lossless: `bool` -> Enable lossless compression
21349    /// default: false
21350    pub lossless: bool,
21351    /// compression: `ForeignHeifCompression` -> Compression format
21352    ///  `Hevc` -> VIPS_FOREIGN_HEIF_COMPRESSION_HEVC = 1 [DEFAULT]
21353    ///  `Avc` -> VIPS_FOREIGN_HEIF_COMPRESSION_AVC = 2
21354    ///  `Jpeg` -> VIPS_FOREIGN_HEIF_COMPRESSION_JPEG = 3
21355    ///  `Av1` -> VIPS_FOREIGN_HEIF_COMPRESSION_AV1 = 4
21356    ///  `Last` -> VIPS_FOREIGN_HEIF_COMPRESSION_LAST = 5
21357    pub compression: ForeignHeifCompression,
21358    /// effort: `i32` -> CPU effort
21359    /// min: 0, max: 9, default: 4
21360    pub effort: i32,
21361    /// subsample_mode: `ForeignSubsample` -> Select chroma subsample operation mode
21362    ///  `Auto` -> VIPS_FOREIGN_SUBSAMPLE_AUTO = 0 [DEFAULT]
21363    ///  `On` -> VIPS_FOREIGN_SUBSAMPLE_ON = 1
21364    ///  `Off` -> VIPS_FOREIGN_SUBSAMPLE_OFF = 2
21365    ///  `Last` -> VIPS_FOREIGN_SUBSAMPLE_LAST = 3
21366    pub subsample_mode: ForeignSubsample,
21367    /// encoder: `ForeignHeifEncoder` -> Select encoder to use
21368    ///  `Auto` -> VIPS_FOREIGN_HEIF_ENCODER_AUTO = 0 [DEFAULT]
21369    ///  `Aom` -> VIPS_FOREIGN_HEIF_ENCODER_AOM = 1
21370    ///  `Rav1E` -> VIPS_FOREIGN_HEIF_ENCODER_RAV1E = 2
21371    ///  `Svt` -> VIPS_FOREIGN_HEIF_ENCODER_SVT = 3
21372    ///  `X265` -> VIPS_FOREIGN_HEIF_ENCODER_X265 = 4
21373    ///  `Last` -> VIPS_FOREIGN_HEIF_ENCODER_LAST = 5
21374    pub encoder: ForeignHeifEncoder,
21375    /// keep: `ForeignKeep` -> Which metadata to retain
21376    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21377    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21378    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21379    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21380    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21381    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21382    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21383    pub keep: ForeignKeep,
21384    /// background: `Vec<f64>` -> Background value
21385    pub background: Vec<f64>,
21386    /// page_height: `i32` -> Set page height for multipage save
21387    /// min: 0, max: 10000000, default: 0
21388    pub page_height: i32,
21389    /// profile: `String` -> Filename of ICC profile to embed
21390    pub profile: String,
21391}
21392
21393impl std::default::Default for HeifsaveTargetOptions {
21394    fn default() -> Self {
21395        HeifsaveTargetOptions {
21396            q: i32::from(50),
21397            bitdepth: i32::from(12),
21398            lossless: false,
21399            compression: ForeignHeifCompression::Hevc,
21400            effort: i32::from(4),
21401            subsample_mode: ForeignSubsample::Auto,
21402            encoder: ForeignHeifEncoder::Auto,
21403            keep: ForeignKeep::All,
21404            background: Vec::new(),
21405            page_height: i32::from(0),
21406            profile: String::from("sRGB"),
21407        }
21408    }
21409}
21410
21411/// VipsForeignSaveHeifTarget (heifsave_target), save image in HEIF format (.heic, .heif), priority=0, rgba-only
21412/// inp: `&VipsImage` -> Image to save
21413/// target: `&VipsTarget` -> Target to save to
21414/// heifsave_target_options: `&HeifsaveTargetOptions` -> optional arguments
21415
21416pub fn heifsave_target_with_opts(
21417    inp: &VipsImage,
21418    target: &VipsTarget,
21419    heifsave_target_options: &HeifsaveTargetOptions,
21420) -> Result<()> {
21421    unsafe {
21422        let inp_in: *mut bindings::VipsImage = inp.ctx;
21423        let target_in: *mut bindings::VipsTarget = target.ctx;
21424
21425        let q_in: i32 = heifsave_target_options.q;
21426        let q_in_name = utils::new_c_string("Q")?;
21427
21428        let bitdepth_in: i32 = heifsave_target_options.bitdepth;
21429        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21430
21431        let lossless_in: i32 = if heifsave_target_options.lossless {
21432            1
21433        } else {
21434            0
21435        };
21436        let lossless_in_name = utils::new_c_string("lossless")?;
21437
21438        let compression_in: i32 = heifsave_target_options.compression as i32;
21439        let compression_in_name = utils::new_c_string("compression")?;
21440
21441        let effort_in: i32 = heifsave_target_options.effort;
21442        let effort_in_name = utils::new_c_string("effort")?;
21443
21444        let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
21445        let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21446
21447        let encoder_in: i32 = heifsave_target_options.encoder as i32;
21448        let encoder_in_name = utils::new_c_string("encoder")?;
21449
21450        let keep_in: i32 = heifsave_target_options.keep as i32;
21451        let keep_in_name = utils::new_c_string("keep")?;
21452
21453        let background_wrapper =
21454            utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
21455        let background_in = background_wrapper.ctx;
21456        let background_in_name = utils::new_c_string("background")?;
21457
21458        let page_height_in: i32 = heifsave_target_options.page_height;
21459        let page_height_in_name = utils::new_c_string("page-height")?;
21460
21461        let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
21462        let profile_in_name = utils::new_c_string("profile")?;
21463
21464        let vips_op_response = bindings::vips_heifsave_target(
21465            inp_in,
21466            target_in,
21467            q_in_name.as_ptr(),
21468            q_in,
21469            bitdepth_in_name.as_ptr(),
21470            bitdepth_in,
21471            lossless_in_name.as_ptr(),
21472            lossless_in,
21473            compression_in_name.as_ptr(),
21474            compression_in,
21475            effort_in_name.as_ptr(),
21476            effort_in,
21477            subsample_mode_in_name.as_ptr(),
21478            subsample_mode_in,
21479            encoder_in_name.as_ptr(),
21480            encoder_in,
21481            keep_in_name.as_ptr(),
21482            keep_in,
21483            background_in_name.as_ptr(),
21484            background_in,
21485            page_height_in_name.as_ptr(),
21486            page_height_in,
21487            profile_in_name.as_ptr(),
21488            profile_in.as_ptr(),
21489            NULL,
21490        );
21491        utils::result(vips_op_response, (), Error::HeifsaveTargetError)
21492    }
21493}
21494
21495/// VipsForeignSaveMagickFile (magicksave), save file with ImageMagick (), priority=-100, untrusted, any
21496/// inp: `&VipsImage` -> Image to save
21497/// filename: `&str` -> Filename to save to
21498
21499pub fn magicksave(inp: &VipsImage, filename: &str) -> Result<()> {
21500    unsafe {
21501        let inp_in: *mut bindings::VipsImage = inp.ctx;
21502        let filename_in: CString = utils::new_c_string(filename)?;
21503
21504        let vips_op_response = bindings::vips_magicksave(inp_in, filename_in.as_ptr(), NULL);
21505        utils::result(vips_op_response, (), Error::MagicksaveError)
21506    }
21507}
21508
21509/// Options for magicksave operation
21510#[derive(Clone, Debug)]
21511pub struct MagicksaveOptions {
21512    /// format: `String` -> Format to save in
21513    pub format: String,
21514    /// quality: `i32` -> Quality to use
21515    /// min: 0, max: 100, default: 0
21516    pub quality: i32,
21517    /// optimize_gif_frames: `bool` -> Apply GIF frames optimization
21518    /// default: false
21519    pub optimize_gif_frames: bool,
21520    /// optimize_gif_transparency: `bool` -> Apply GIF transparency optimization
21521    /// default: false
21522    pub optimize_gif_transparency: bool,
21523    /// bitdepth: `i32` -> Number of bits per pixel
21524    /// min: 0, max: 8, default: 0
21525    pub bitdepth: i32,
21526    /// keep: `ForeignKeep` -> Which metadata to retain
21527    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21528    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21529    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21530    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21531    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21532    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21533    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21534    pub keep: ForeignKeep,
21535    /// background: `Vec<f64>` -> Background value
21536    pub background: Vec<f64>,
21537    /// page_height: `i32` -> Set page height for multipage save
21538    /// min: 0, max: 10000000, default: 0
21539    pub page_height: i32,
21540    /// profile: `String` -> Filename of ICC profile to embed
21541    pub profile: String,
21542}
21543
21544impl std::default::Default for MagicksaveOptions {
21545    fn default() -> Self {
21546        MagicksaveOptions {
21547            format: String::new(),
21548            quality: i32::from(0),
21549            optimize_gif_frames: false,
21550            optimize_gif_transparency: false,
21551            bitdepth: i32::from(0),
21552            keep: ForeignKeep::All,
21553            background: Vec::new(),
21554            page_height: i32::from(0),
21555            profile: String::from("sRGB"),
21556        }
21557    }
21558}
21559
21560/// VipsForeignSaveMagickFile (magicksave), save file with ImageMagick (), priority=-100, untrusted, any
21561/// inp: `&VipsImage` -> Image to save
21562/// filename: `&str` -> Filename to save to
21563/// magicksave_options: `&MagicksaveOptions` -> optional arguments
21564
21565pub fn magicksave_with_opts(
21566    inp: &VipsImage,
21567    filename: &str,
21568    magicksave_options: &MagicksaveOptions,
21569) -> Result<()> {
21570    unsafe {
21571        let inp_in: *mut bindings::VipsImage = inp.ctx;
21572        let filename_in: CString = utils::new_c_string(filename)?;
21573
21574        let format_in: CString = utils::new_c_string(&magicksave_options.format)?;
21575        let format_in_name = utils::new_c_string("format")?;
21576
21577        let quality_in: i32 = magicksave_options.quality;
21578        let quality_in_name = utils::new_c_string("quality")?;
21579
21580        let optimize_gif_frames_in: i32 = if magicksave_options.optimize_gif_frames {
21581            1
21582        } else {
21583            0
21584        };
21585        let optimize_gif_frames_in_name = utils::new_c_string("optimize-gif-frames")?;
21586
21587        let optimize_gif_transparency_in: i32 = if magicksave_options.optimize_gif_transparency {
21588            1
21589        } else {
21590            0
21591        };
21592        let optimize_gif_transparency_in_name = utils::new_c_string("optimize-gif-transparency")?;
21593
21594        let bitdepth_in: i32 = magicksave_options.bitdepth;
21595        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21596
21597        let keep_in: i32 = magicksave_options.keep as i32;
21598        let keep_in_name = utils::new_c_string("keep")?;
21599
21600        let background_wrapper =
21601            utils::VipsArrayDoubleWrapper::from(&magicksave_options.background[..]);
21602        let background_in = background_wrapper.ctx;
21603        let background_in_name = utils::new_c_string("background")?;
21604
21605        let page_height_in: i32 = magicksave_options.page_height;
21606        let page_height_in_name = utils::new_c_string("page-height")?;
21607
21608        let profile_in: CString = utils::new_c_string(&magicksave_options.profile)?;
21609        let profile_in_name = utils::new_c_string("profile")?;
21610
21611        let vips_op_response = bindings::vips_magicksave(
21612            inp_in,
21613            filename_in.as_ptr(),
21614            format_in_name.as_ptr(),
21615            format_in.as_ptr(),
21616            quality_in_name.as_ptr(),
21617            quality_in,
21618            optimize_gif_frames_in_name.as_ptr(),
21619            optimize_gif_frames_in,
21620            optimize_gif_transparency_in_name.as_ptr(),
21621            optimize_gif_transparency_in,
21622            bitdepth_in_name.as_ptr(),
21623            bitdepth_in,
21624            keep_in_name.as_ptr(),
21625            keep_in,
21626            background_in_name.as_ptr(),
21627            background_in,
21628            page_height_in_name.as_ptr(),
21629            page_height_in,
21630            profile_in_name.as_ptr(),
21631            profile_in.as_ptr(),
21632            NULL,
21633        );
21634        utils::result(vips_op_response, (), Error::MagicksaveError)
21635    }
21636}
21637
21638/// VipsForeignSaveMagickBuffer (magicksave_buffer), save image to magick buffer (), priority=-100, untrusted, any
21639/// inp: `&VipsImage` -> Image to save
21640/// returns `Vec<u8>` - Buffer to save to
21641pub fn magicksave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21642    unsafe {
21643        let inp_in: *mut bindings::VipsImage = inp.ctx;
21644        let mut buffer_buf_size: u64 = 0;
21645        let mut buffer_out: *mut c_void = null_mut();
21646
21647        let vips_op_response =
21648            bindings::vips_magicksave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21649        utils::result(
21650            vips_op_response,
21651            utils::new_byte_array(buffer_out, buffer_buf_size),
21652            Error::MagicksaveBufferError,
21653        )
21654    }
21655}
21656
21657/// Options for magicksave_buffer operation
21658#[derive(Clone, Debug)]
21659pub struct MagicksaveBufferOptions {
21660    /// format: `String` -> Format to save in
21661    pub format: String,
21662    /// quality: `i32` -> Quality to use
21663    /// min: 0, max: 100, default: 0
21664    pub quality: i32,
21665    /// optimize_gif_frames: `bool` -> Apply GIF frames optimization
21666    /// default: false
21667    pub optimize_gif_frames: bool,
21668    /// optimize_gif_transparency: `bool` -> Apply GIF transparency optimization
21669    /// default: false
21670    pub optimize_gif_transparency: bool,
21671    /// bitdepth: `i32` -> Number of bits per pixel
21672    /// min: 0, max: 8, default: 0
21673    pub bitdepth: i32,
21674    /// keep: `ForeignKeep` -> Which metadata to retain
21675    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21676    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21677    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21678    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21679    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21680    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21681    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21682    pub keep: ForeignKeep,
21683    /// background: `Vec<f64>` -> Background value
21684    pub background: Vec<f64>,
21685    /// page_height: `i32` -> Set page height for multipage save
21686    /// min: 0, max: 10000000, default: 0
21687    pub page_height: i32,
21688    /// profile: `String` -> Filename of ICC profile to embed
21689    pub profile: String,
21690}
21691
21692impl std::default::Default for MagicksaveBufferOptions {
21693    fn default() -> Self {
21694        MagicksaveBufferOptions {
21695            format: String::new(),
21696            quality: i32::from(0),
21697            optimize_gif_frames: false,
21698            optimize_gif_transparency: false,
21699            bitdepth: i32::from(0),
21700            keep: ForeignKeep::All,
21701            background: Vec::new(),
21702            page_height: i32::from(0),
21703            profile: String::from("sRGB"),
21704        }
21705    }
21706}
21707
21708/// VipsForeignSaveMagickBuffer (magicksave_buffer), save image to magick buffer (), priority=-100, untrusted, any
21709/// inp: `&VipsImage` -> Image to save
21710/// magicksave_buffer_options: `&MagicksaveBufferOptions` -> optional arguments
21711/// returns `Vec<u8>` - Buffer to save to
21712pub fn magicksave_buffer_with_opts(
21713    inp: &VipsImage,
21714    magicksave_buffer_options: &MagicksaveBufferOptions,
21715) -> Result<Vec<u8>> {
21716    unsafe {
21717        let inp_in: *mut bindings::VipsImage = inp.ctx;
21718        let mut buffer_buf_size: u64 = 0;
21719        let mut buffer_out: *mut c_void = null_mut();
21720
21721        let format_in: CString = utils::new_c_string(&magicksave_buffer_options.format)?;
21722        let format_in_name = utils::new_c_string("format")?;
21723
21724        let quality_in: i32 = magicksave_buffer_options.quality;
21725        let quality_in_name = utils::new_c_string("quality")?;
21726
21727        let optimize_gif_frames_in: i32 = if magicksave_buffer_options.optimize_gif_frames {
21728            1
21729        } else {
21730            0
21731        };
21732        let optimize_gif_frames_in_name = utils::new_c_string("optimize-gif-frames")?;
21733
21734        let optimize_gif_transparency_in: i32 =
21735            if magicksave_buffer_options.optimize_gif_transparency {
21736                1
21737            } else {
21738                0
21739            };
21740        let optimize_gif_transparency_in_name = utils::new_c_string("optimize-gif-transparency")?;
21741
21742        let bitdepth_in: i32 = magicksave_buffer_options.bitdepth;
21743        let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21744
21745        let keep_in: i32 = magicksave_buffer_options.keep as i32;
21746        let keep_in_name = utils::new_c_string("keep")?;
21747
21748        let background_wrapper =
21749            utils::VipsArrayDoubleWrapper::from(&magicksave_buffer_options.background[..]);
21750        let background_in = background_wrapper.ctx;
21751        let background_in_name = utils::new_c_string("background")?;
21752
21753        let page_height_in: i32 = magicksave_buffer_options.page_height;
21754        let page_height_in_name = utils::new_c_string("page-height")?;
21755
21756        let profile_in: CString = utils::new_c_string(&magicksave_buffer_options.profile)?;
21757        let profile_in_name = utils::new_c_string("profile")?;
21758
21759        let vips_op_response = bindings::vips_magicksave_buffer(
21760            inp_in,
21761            &mut buffer_out,
21762            &mut buffer_buf_size,
21763            format_in_name.as_ptr(),
21764            format_in.as_ptr(),
21765            quality_in_name.as_ptr(),
21766            quality_in,
21767            optimize_gif_frames_in_name.as_ptr(),
21768            optimize_gif_frames_in,
21769            optimize_gif_transparency_in_name.as_ptr(),
21770            optimize_gif_transparency_in,
21771            bitdepth_in_name.as_ptr(),
21772            bitdepth_in,
21773            keep_in_name.as_ptr(),
21774            keep_in,
21775            background_in_name.as_ptr(),
21776            background_in,
21777            page_height_in_name.as_ptr(),
21778            page_height_in,
21779            profile_in_name.as_ptr(),
21780            profile_in.as_ptr(),
21781            NULL,
21782        );
21783        utils::result(
21784            vips_op_response,
21785            utils::new_byte_array(buffer_out, buffer_buf_size),
21786            Error::MagicksaveBufferError,
21787        )
21788    }
21789}
21790
21791/// VipsForeignSaveJxlFile (jxlsave), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
21792/// inp: `&VipsImage` -> Image to save
21793/// filename: `&str` -> Filename to load from
21794
21795pub fn jxlsave(inp: &VipsImage, filename: &str) -> Result<()> {
21796    unsafe {
21797        let inp_in: *mut bindings::VipsImage = inp.ctx;
21798        let filename_in: CString = utils::new_c_string(filename)?;
21799
21800        let vips_op_response = bindings::vips_jxlsave(inp_in, filename_in.as_ptr(), NULL);
21801        utils::result(vips_op_response, (), Error::JxlsaveError)
21802    }
21803}
21804
21805/// Options for jxlsave operation
21806#[derive(Clone, Debug)]
21807pub struct JxlsaveOptions {
21808    /// tier: `i32` -> Decode speed tier
21809    /// min: 0, max: 4, default: 0
21810    pub tier: i32,
21811    /// distance: `f64` -> Target butteraugli distance
21812    /// min: 0, max: 25, default: 1
21813    pub distance: f64,
21814    /// effort: `i32` -> Encoding effort
21815    /// min: 1, max: 9, default: 7
21816    pub effort: i32,
21817    /// lossless: `bool` -> Enable lossless compression
21818    /// default: false
21819    pub lossless: bool,
21820    /// q: `i32` -> Quality factor
21821    /// min: 0, max: 100, default: 75
21822    pub q: i32,
21823    /// keep: `ForeignKeep` -> Which metadata to retain
21824    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21825    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21826    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21827    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21828    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21829    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21830    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21831    pub keep: ForeignKeep,
21832    /// background: `Vec<f64>` -> Background value
21833    pub background: Vec<f64>,
21834    /// page_height: `i32` -> Set page height for multipage save
21835    /// min: 0, max: 10000000, default: 0
21836    pub page_height: i32,
21837    /// profile: `String` -> Filename of ICC profile to embed
21838    pub profile: String,
21839}
21840
21841impl std::default::Default for JxlsaveOptions {
21842    fn default() -> Self {
21843        JxlsaveOptions {
21844            tier: i32::from(0),
21845            distance: f64::from(1),
21846            effort: i32::from(7),
21847            lossless: false,
21848            q: i32::from(75),
21849            keep: ForeignKeep::All,
21850            background: Vec::new(),
21851            page_height: i32::from(0),
21852            profile: String::from("sRGB"),
21853        }
21854    }
21855}
21856
21857/// VipsForeignSaveJxlFile (jxlsave), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
21858/// inp: `&VipsImage` -> Image to save
21859/// filename: `&str` -> Filename to load from
21860/// jxlsave_options: `&JxlsaveOptions` -> optional arguments
21861
21862pub fn jxlsave_with_opts(
21863    inp: &VipsImage,
21864    filename: &str,
21865    jxlsave_options: &JxlsaveOptions,
21866) -> Result<()> {
21867    unsafe {
21868        let inp_in: *mut bindings::VipsImage = inp.ctx;
21869        let filename_in: CString = utils::new_c_string(filename)?;
21870
21871        let tier_in: i32 = jxlsave_options.tier;
21872        let tier_in_name = utils::new_c_string("tier")?;
21873
21874        let distance_in: f64 = jxlsave_options.distance;
21875        let distance_in_name = utils::new_c_string("distance")?;
21876
21877        let effort_in: i32 = jxlsave_options.effort;
21878        let effort_in_name = utils::new_c_string("effort")?;
21879
21880        let lossless_in: i32 = if jxlsave_options.lossless { 1 } else { 0 };
21881        let lossless_in_name = utils::new_c_string("lossless")?;
21882
21883        let q_in: i32 = jxlsave_options.q;
21884        let q_in_name = utils::new_c_string("Q")?;
21885
21886        let keep_in: i32 = jxlsave_options.keep as i32;
21887        let keep_in_name = utils::new_c_string("keep")?;
21888
21889        let background_wrapper =
21890            utils::VipsArrayDoubleWrapper::from(&jxlsave_options.background[..]);
21891        let background_in = background_wrapper.ctx;
21892        let background_in_name = utils::new_c_string("background")?;
21893
21894        let page_height_in: i32 = jxlsave_options.page_height;
21895        let page_height_in_name = utils::new_c_string("page-height")?;
21896
21897        let profile_in: CString = utils::new_c_string(&jxlsave_options.profile)?;
21898        let profile_in_name = utils::new_c_string("profile")?;
21899
21900        let vips_op_response = bindings::vips_jxlsave(
21901            inp_in,
21902            filename_in.as_ptr(),
21903            tier_in_name.as_ptr(),
21904            tier_in,
21905            distance_in_name.as_ptr(),
21906            distance_in,
21907            effort_in_name.as_ptr(),
21908            effort_in,
21909            lossless_in_name.as_ptr(),
21910            lossless_in,
21911            q_in_name.as_ptr(),
21912            q_in,
21913            keep_in_name.as_ptr(),
21914            keep_in,
21915            background_in_name.as_ptr(),
21916            background_in,
21917            page_height_in_name.as_ptr(),
21918            page_height_in,
21919            profile_in_name.as_ptr(),
21920            profile_in.as_ptr(),
21921            NULL,
21922        );
21923        utils::result(vips_op_response, (), Error::JxlsaveError)
21924    }
21925}
21926
21927/// VipsForeignSaveJxlBuffer (jxlsave_buffer), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
21928/// inp: `&VipsImage` -> Image to save
21929/// returns `Vec<u8>` - Buffer to save to
21930pub fn jxlsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21931    unsafe {
21932        let inp_in: *mut bindings::VipsImage = inp.ctx;
21933        let mut buffer_buf_size: u64 = 0;
21934        let mut buffer_out: *mut c_void = null_mut();
21935
21936        let vips_op_response =
21937            bindings::vips_jxlsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21938        utils::result(
21939            vips_op_response,
21940            utils::new_byte_array(buffer_out, buffer_buf_size),
21941            Error::JxlsaveBufferError,
21942        )
21943    }
21944}
21945
21946/// Options for jxlsave_buffer operation
21947#[derive(Clone, Debug)]
21948pub struct JxlsaveBufferOptions {
21949    /// tier: `i32` -> Decode speed tier
21950    /// min: 0, max: 4, default: 0
21951    pub tier: i32,
21952    /// distance: `f64` -> Target butteraugli distance
21953    /// min: 0, max: 25, default: 1
21954    pub distance: f64,
21955    /// effort: `i32` -> Encoding effort
21956    /// min: 1, max: 9, default: 7
21957    pub effort: i32,
21958    /// lossless: `bool` -> Enable lossless compression
21959    /// default: false
21960    pub lossless: bool,
21961    /// q: `i32` -> Quality factor
21962    /// min: 0, max: 100, default: 75
21963    pub q: i32,
21964    /// keep: `ForeignKeep` -> Which metadata to retain
21965    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
21966    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
21967    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
21968    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
21969    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
21970    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
21971    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
21972    pub keep: ForeignKeep,
21973    /// background: `Vec<f64>` -> Background value
21974    pub background: Vec<f64>,
21975    /// page_height: `i32` -> Set page height for multipage save
21976    /// min: 0, max: 10000000, default: 0
21977    pub page_height: i32,
21978    /// profile: `String` -> Filename of ICC profile to embed
21979    pub profile: String,
21980}
21981
21982impl std::default::Default for JxlsaveBufferOptions {
21983    fn default() -> Self {
21984        JxlsaveBufferOptions {
21985            tier: i32::from(0),
21986            distance: f64::from(1),
21987            effort: i32::from(7),
21988            lossless: false,
21989            q: i32::from(75),
21990            keep: ForeignKeep::All,
21991            background: Vec::new(),
21992            page_height: i32::from(0),
21993            profile: String::from("sRGB"),
21994        }
21995    }
21996}
21997
21998/// VipsForeignSaveJxlBuffer (jxlsave_buffer), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
21999/// inp: `&VipsImage` -> Image to save
22000/// jxlsave_buffer_options: `&JxlsaveBufferOptions` -> optional arguments
22001/// returns `Vec<u8>` - Buffer to save to
22002pub fn jxlsave_buffer_with_opts(
22003    inp: &VipsImage,
22004    jxlsave_buffer_options: &JxlsaveBufferOptions,
22005) -> Result<Vec<u8>> {
22006    unsafe {
22007        let inp_in: *mut bindings::VipsImage = inp.ctx;
22008        let mut buffer_buf_size: u64 = 0;
22009        let mut buffer_out: *mut c_void = null_mut();
22010
22011        let tier_in: i32 = jxlsave_buffer_options.tier;
22012        let tier_in_name = utils::new_c_string("tier")?;
22013
22014        let distance_in: f64 = jxlsave_buffer_options.distance;
22015        let distance_in_name = utils::new_c_string("distance")?;
22016
22017        let effort_in: i32 = jxlsave_buffer_options.effort;
22018        let effort_in_name = utils::new_c_string("effort")?;
22019
22020        let lossless_in: i32 = if jxlsave_buffer_options.lossless {
22021            1
22022        } else {
22023            0
22024        };
22025        let lossless_in_name = utils::new_c_string("lossless")?;
22026
22027        let q_in: i32 = jxlsave_buffer_options.q;
22028        let q_in_name = utils::new_c_string("Q")?;
22029
22030        let keep_in: i32 = jxlsave_buffer_options.keep as i32;
22031        let keep_in_name = utils::new_c_string("keep")?;
22032
22033        let background_wrapper =
22034            utils::VipsArrayDoubleWrapper::from(&jxlsave_buffer_options.background[..]);
22035        let background_in = background_wrapper.ctx;
22036        let background_in_name = utils::new_c_string("background")?;
22037
22038        let page_height_in: i32 = jxlsave_buffer_options.page_height;
22039        let page_height_in_name = utils::new_c_string("page-height")?;
22040
22041        let profile_in: CString = utils::new_c_string(&jxlsave_buffer_options.profile)?;
22042        let profile_in_name = utils::new_c_string("profile")?;
22043
22044        let vips_op_response = bindings::vips_jxlsave_buffer(
22045            inp_in,
22046            &mut buffer_out,
22047            &mut buffer_buf_size,
22048            tier_in_name.as_ptr(),
22049            tier_in,
22050            distance_in_name.as_ptr(),
22051            distance_in,
22052            effort_in_name.as_ptr(),
22053            effort_in,
22054            lossless_in_name.as_ptr(),
22055            lossless_in,
22056            q_in_name.as_ptr(),
22057            q_in,
22058            keep_in_name.as_ptr(),
22059            keep_in,
22060            background_in_name.as_ptr(),
22061            background_in,
22062            page_height_in_name.as_ptr(),
22063            page_height_in,
22064            profile_in_name.as_ptr(),
22065            profile_in.as_ptr(),
22066            NULL,
22067        );
22068        utils::result(
22069            vips_op_response,
22070            utils::new_byte_array(buffer_out, buffer_buf_size),
22071            Error::JxlsaveBufferError,
22072        )
22073    }
22074}
22075
22076/// VipsForeignSaveJxlTarget (jxlsave_target), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
22077/// inp: `&VipsImage` -> Image to save
22078/// target: `&VipsTarget` -> Target to save to
22079
22080pub fn jxlsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
22081    unsafe {
22082        let inp_in: *mut bindings::VipsImage = inp.ctx;
22083        let target_in: *mut bindings::VipsTarget = target.ctx;
22084
22085        let vips_op_response = bindings::vips_jxlsave_target(inp_in, target_in, NULL);
22086        utils::result(vips_op_response, (), Error::JxlsaveTargetError)
22087    }
22088}
22089
22090/// Options for jxlsave_target operation
22091#[derive(Clone, Debug)]
22092pub struct JxlsaveTargetOptions {
22093    /// tier: `i32` -> Decode speed tier
22094    /// min: 0, max: 4, default: 0
22095    pub tier: i32,
22096    /// distance: `f64` -> Target butteraugli distance
22097    /// min: 0, max: 25, default: 1
22098    pub distance: f64,
22099    /// effort: `i32` -> Encoding effort
22100    /// min: 1, max: 9, default: 7
22101    pub effort: i32,
22102    /// lossless: `bool` -> Enable lossless compression
22103    /// default: false
22104    pub lossless: bool,
22105    /// q: `i32` -> Quality factor
22106    /// min: 0, max: 100, default: 75
22107    pub q: i32,
22108    /// keep: `ForeignKeep` -> Which metadata to retain
22109    ///  `None` -> VIPS_FOREIGN_KEEP_NONE = 0
22110    ///  `Exif` -> VIPS_FOREIGN_KEEP_EXIF = 1
22111    ///  `Xmp` -> VIPS_FOREIGN_KEEP_XMP = 2
22112    ///  `Iptc` -> VIPS_FOREIGN_KEEP_IPTC = 4
22113    ///  `Icc` -> VIPS_FOREIGN_KEEP_ICC = 8
22114    ///  `Other` -> VIPS_FOREIGN_KEEP_OTHER = 16
22115    ///  `All` -> VIPS_FOREIGN_KEEP_ALL = 31 [DEFAULT]
22116    pub keep: ForeignKeep,
22117    /// background: `Vec<f64>` -> Background value
22118    pub background: Vec<f64>,
22119    /// page_height: `i32` -> Set page height for multipage save
22120    /// min: 0, max: 10000000, default: 0
22121    pub page_height: i32,
22122    /// profile: `String` -> Filename of ICC profile to embed
22123    pub profile: String,
22124}
22125
22126impl std::default::Default for JxlsaveTargetOptions {
22127    fn default() -> Self {
22128        JxlsaveTargetOptions {
22129            tier: i32::from(0),
22130            distance: f64::from(1),
22131            effort: i32::from(7),
22132            lossless: false,
22133            q: i32::from(75),
22134            keep: ForeignKeep::All,
22135            background: Vec::new(),
22136            page_height: i32::from(0),
22137            profile: String::from("sRGB"),
22138        }
22139    }
22140}
22141
22142/// VipsForeignSaveJxlTarget (jxlsave_target), save image in JPEG-XL format (.jxl), priority=0, untrusted, any
22143/// inp: `&VipsImage` -> Image to save
22144/// target: `&VipsTarget` -> Target to save to
22145/// jxlsave_target_options: `&JxlsaveTargetOptions` -> optional arguments
22146
22147pub fn jxlsave_target_with_opts(
22148    inp: &VipsImage,
22149    target: &VipsTarget,
22150    jxlsave_target_options: &JxlsaveTargetOptions,
22151) -> Result<()> {
22152    unsafe {
22153        let inp_in: *mut bindings::VipsImage = inp.ctx;
22154        let target_in: *mut bindings::VipsTarget = target.ctx;
22155
22156        let tier_in: i32 = jxlsave_target_options.tier;
22157        let tier_in_name = utils::new_c_string("tier")?;
22158
22159        let distance_in: f64 = jxlsave_target_options.distance;
22160        let distance_in_name = utils::new_c_string("distance")?;
22161
22162        let effort_in: i32 = jxlsave_target_options.effort;
22163        let effort_in_name = utils::new_c_string("effort")?;
22164
22165        let lossless_in: i32 = if jxlsave_target_options.lossless {
22166            1
22167        } else {
22168            0
22169        };
22170        let lossless_in_name = utils::new_c_string("lossless")?;
22171
22172        let q_in: i32 = jxlsave_target_options.q;
22173        let q_in_name = utils::new_c_string("Q")?;
22174
22175        let keep_in: i32 = jxlsave_target_options.keep as i32;
22176        let keep_in_name = utils::new_c_string("keep")?;
22177
22178        let background_wrapper =
22179            utils::VipsArrayDoubleWrapper::from(&jxlsave_target_options.background[..]);
22180        let background_in = background_wrapper.ctx;
22181        let background_in_name = utils::new_c_string("background")?;
22182
22183        let page_height_in: i32 = jxlsave_target_options.page_height;
22184        let page_height_in_name = utils::new_c_string("page-height")?;
22185
22186        let profile_in: CString = utils::new_c_string(&jxlsave_target_options.profile)?;
22187        let profile_in_name = utils::new_c_string("profile")?;
22188
22189        let vips_op_response = bindings::vips_jxlsave_target(
22190            inp_in,
22191            target_in,
22192            tier_in_name.as_ptr(),
22193            tier_in,
22194            distance_in_name.as_ptr(),
22195            distance_in,
22196            effort_in_name.as_ptr(),
22197            effort_in,
22198            lossless_in_name.as_ptr(),
22199            lossless_in,
22200            q_in_name.as_ptr(),
22201            q_in,
22202            keep_in_name.as_ptr(),
22203            keep_in,
22204            background_in_name.as_ptr(),
22205            background_in,
22206            page_height_in_name.as_ptr(),
22207            page_height_in,
22208            profile_in_name.as_ptr(),
22209            profile_in.as_ptr(),
22210            NULL,
22211        );
22212        utils::result(vips_op_response, (), Error::JxlsaveTargetError)
22213    }
22214}
22215
22216/// VipsThumbnailFile (thumbnail), generate thumbnail from file
22217/// filename: `&str` -> Filename to read from
22218/// width: `i32` -> Size to this width
22219/// min: 1, max: 10000000, default: 1
22220/// returns `VipsImage` - Output image
22221pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
22222    unsafe {
22223        let filename_in: CString = utils::new_c_string(filename)?;
22224        let width_in: i32 = width;
22225        let mut out_out: *mut bindings::VipsImage = null_mut();
22226
22227        let vips_op_response =
22228            bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
22229        utils::result(
22230            vips_op_response,
22231            VipsImage { ctx: out_out },
22232            Error::ThumbnailError,
22233        )
22234    }
22235}
22236
22237/// Options for thumbnail operation
22238#[derive(Clone, Debug)]
22239pub struct ThumbnailOptions {
22240    /// height: `i32` -> Size to this height
22241    /// min: 1, max: 10000000, default: 1
22242    pub height: i32,
22243    /// size: `Size` -> Only upsize, only downsize, or both
22244    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
22245    ///  `Up` -> VIPS_SIZE_UP = 1
22246    ///  `Down` -> VIPS_SIZE_DOWN = 2
22247    ///  `Force` -> VIPS_SIZE_FORCE = 3
22248    ///  `Last` -> VIPS_SIZE_LAST = 4
22249    pub size: Size,
22250    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
22251    /// default: false
22252    pub no_rotate: bool,
22253    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
22254    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
22255    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
22256    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
22257    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
22258    ///  `Low` -> VIPS_INTERESTING_LOW = 4
22259    ///  `High` -> VIPS_INTERESTING_HIGH = 5
22260    ///  `All` -> VIPS_INTERESTING_ALL = 6
22261    ///  `Last` -> VIPS_INTERESTING_LAST = 7
22262    pub crop: Interesting,
22263    /// linear: `bool` -> Reduce in linear light
22264    /// default: false
22265    pub linear: bool,
22266    /// import_profile: `String` -> Fallback import profile
22267    pub import_profile: String,
22268    /// export_profile: `String` -> Fallback export profile
22269    pub export_profile: String,
22270    /// intent: `Intent` -> Rendering intent
22271    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
22272    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
22273    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
22274    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
22275    ///  `Last` -> VIPS_INTENT_LAST = 4
22276    pub intent: Intent,
22277    /// fail_on: `FailOn` -> Error level to fail on
22278    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
22279    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
22280    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
22281    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
22282    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
22283    pub fail_on: FailOn,
22284}
22285
22286impl std::default::Default for ThumbnailOptions {
22287    fn default() -> Self {
22288        ThumbnailOptions {
22289            height: i32::from(1),
22290            size: Size::Both,
22291            no_rotate: false,
22292            crop: Interesting::None,
22293            linear: false,
22294            import_profile: String::new(),
22295            export_profile: String::new(),
22296            intent: Intent::Relative,
22297            fail_on: FailOn::None,
22298        }
22299    }
22300}
22301
22302/// VipsThumbnailFile (thumbnail), generate thumbnail from file
22303/// filename: `&str` -> Filename to read from
22304/// width: `i32` -> Size to this width
22305/// min: 1, max: 10000000, default: 1
22306/// thumbnail_options: `&ThumbnailOptions` -> optional arguments
22307/// returns `VipsImage` - Output image
22308pub fn thumbnail_with_opts(
22309    filename: &str,
22310    width: i32,
22311    thumbnail_options: &ThumbnailOptions,
22312) -> Result<VipsImage> {
22313    unsafe {
22314        let filename_in: CString = utils::new_c_string(filename)?;
22315        let width_in: i32 = width;
22316        let mut out_out: *mut bindings::VipsImage = null_mut();
22317
22318        let height_in: i32 = thumbnail_options.height;
22319        let height_in_name = utils::new_c_string("height")?;
22320
22321        let size_in: i32 = thumbnail_options.size as i32;
22322        let size_in_name = utils::new_c_string("size")?;
22323
22324        let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
22325        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22326
22327        let crop_in: i32 = thumbnail_options.crop as i32;
22328        let crop_in_name = utils::new_c_string("crop")?;
22329
22330        let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
22331        let linear_in_name = utils::new_c_string("linear")?;
22332
22333        let import_profile_in: CString = utils::new_c_string(&thumbnail_options.import_profile)?;
22334        let import_profile_in_name = utils::new_c_string("import-profile")?;
22335
22336        let export_profile_in: CString = utils::new_c_string(&thumbnail_options.export_profile)?;
22337        let export_profile_in_name = utils::new_c_string("export-profile")?;
22338
22339        let intent_in: i32 = thumbnail_options.intent as i32;
22340        let intent_in_name = utils::new_c_string("intent")?;
22341
22342        let fail_on_in: i32 = thumbnail_options.fail_on as i32;
22343        let fail_on_in_name = utils::new_c_string("fail-on")?;
22344
22345        let vips_op_response = bindings::vips_thumbnail(
22346            filename_in.as_ptr(),
22347            &mut out_out,
22348            width_in,
22349            height_in_name.as_ptr(),
22350            height_in,
22351            size_in_name.as_ptr(),
22352            size_in,
22353            no_rotate_in_name.as_ptr(),
22354            no_rotate_in,
22355            crop_in_name.as_ptr(),
22356            crop_in,
22357            linear_in_name.as_ptr(),
22358            linear_in,
22359            import_profile_in_name.as_ptr(),
22360            import_profile_in.as_ptr(),
22361            export_profile_in_name.as_ptr(),
22362            export_profile_in.as_ptr(),
22363            intent_in_name.as_ptr(),
22364            intent_in,
22365            fail_on_in_name.as_ptr(),
22366            fail_on_in,
22367            NULL,
22368        );
22369        utils::result(
22370            vips_op_response,
22371            VipsImage { ctx: out_out },
22372            Error::ThumbnailError,
22373        )
22374    }
22375}
22376
22377/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
22378/// buffer: `&[u8]` -> Buffer to load from
22379/// width: `i32` -> Size to this width
22380/// min: 1, max: 10000000, default: 1
22381/// returns `VipsImage` - Output image
22382pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
22383    unsafe {
22384        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
22385        let width_in: i32 = width;
22386        let mut out_out: *mut bindings::VipsImage = null_mut();
22387
22388        let vips_op_response = bindings::vips_thumbnail_buffer(
22389            buffer_in,
22390            buffer.len() as u64,
22391            &mut out_out,
22392            width_in,
22393            NULL,
22394        );
22395        utils::result(
22396            vips_op_response,
22397            VipsImage { ctx: out_out },
22398            Error::ThumbnailBufferError,
22399        )
22400    }
22401}
22402
22403/// Options for thumbnail_buffer operation
22404#[derive(Clone, Debug)]
22405pub struct ThumbnailBufferOptions {
22406    /// option_string: `String` -> Options that are passed on to the underlying loader
22407    pub option_string: String,
22408    /// height: `i32` -> Size to this height
22409    /// min: 1, max: 10000000, default: 1
22410    pub height: i32,
22411    /// size: `Size` -> Only upsize, only downsize, or both
22412    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
22413    ///  `Up` -> VIPS_SIZE_UP = 1
22414    ///  `Down` -> VIPS_SIZE_DOWN = 2
22415    ///  `Force` -> VIPS_SIZE_FORCE = 3
22416    ///  `Last` -> VIPS_SIZE_LAST = 4
22417    pub size: Size,
22418    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
22419    /// default: false
22420    pub no_rotate: bool,
22421    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
22422    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
22423    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
22424    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
22425    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
22426    ///  `Low` -> VIPS_INTERESTING_LOW = 4
22427    ///  `High` -> VIPS_INTERESTING_HIGH = 5
22428    ///  `All` -> VIPS_INTERESTING_ALL = 6
22429    ///  `Last` -> VIPS_INTERESTING_LAST = 7
22430    pub crop: Interesting,
22431    /// linear: `bool` -> Reduce in linear light
22432    /// default: false
22433    pub linear: bool,
22434    /// import_profile: `String` -> Fallback import profile
22435    pub import_profile: String,
22436    /// export_profile: `String` -> Fallback export profile
22437    pub export_profile: String,
22438    /// intent: `Intent` -> Rendering intent
22439    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
22440    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
22441    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
22442    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
22443    ///  `Last` -> VIPS_INTENT_LAST = 4
22444    pub intent: Intent,
22445    /// fail_on: `FailOn` -> Error level to fail on
22446    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
22447    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
22448    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
22449    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
22450    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
22451    pub fail_on: FailOn,
22452}
22453
22454impl std::default::Default for ThumbnailBufferOptions {
22455    fn default() -> Self {
22456        ThumbnailBufferOptions {
22457            option_string: String::new(),
22458            height: i32::from(1),
22459            size: Size::Both,
22460            no_rotate: false,
22461            crop: Interesting::None,
22462            linear: false,
22463            import_profile: String::new(),
22464            export_profile: String::new(),
22465            intent: Intent::Relative,
22466            fail_on: FailOn::None,
22467        }
22468    }
22469}
22470
22471/// VipsThumbnailBuffer (thumbnail_buffer), generate thumbnail from buffer
22472/// buffer: `&[u8]` -> Buffer to load from
22473/// width: `i32` -> Size to this width
22474/// min: 1, max: 10000000, default: 1
22475/// thumbnail_buffer_options: `&ThumbnailBufferOptions` -> optional arguments
22476/// returns `VipsImage` - Output image
22477pub fn thumbnail_buffer_with_opts(
22478    buffer: &[u8],
22479    width: i32,
22480    thumbnail_buffer_options: &ThumbnailBufferOptions,
22481) -> Result<VipsImage> {
22482    unsafe {
22483        let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
22484        let width_in: i32 = width;
22485        let mut out_out: *mut bindings::VipsImage = null_mut();
22486
22487        let option_string_in: CString =
22488            utils::new_c_string(&thumbnail_buffer_options.option_string)?;
22489        let option_string_in_name = utils::new_c_string("option-string")?;
22490
22491        let height_in: i32 = thumbnail_buffer_options.height;
22492        let height_in_name = utils::new_c_string("height")?;
22493
22494        let size_in: i32 = thumbnail_buffer_options.size as i32;
22495        let size_in_name = utils::new_c_string("size")?;
22496
22497        let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
22498            1
22499        } else {
22500            0
22501        };
22502        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22503
22504        let crop_in: i32 = thumbnail_buffer_options.crop as i32;
22505        let crop_in_name = utils::new_c_string("crop")?;
22506
22507        let linear_in: i32 = if thumbnail_buffer_options.linear {
22508            1
22509        } else {
22510            0
22511        };
22512        let linear_in_name = utils::new_c_string("linear")?;
22513
22514        let import_profile_in: CString =
22515            utils::new_c_string(&thumbnail_buffer_options.import_profile)?;
22516        let import_profile_in_name = utils::new_c_string("import-profile")?;
22517
22518        let export_profile_in: CString =
22519            utils::new_c_string(&thumbnail_buffer_options.export_profile)?;
22520        let export_profile_in_name = utils::new_c_string("export-profile")?;
22521
22522        let intent_in: i32 = thumbnail_buffer_options.intent as i32;
22523        let intent_in_name = utils::new_c_string("intent")?;
22524
22525        let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
22526        let fail_on_in_name = utils::new_c_string("fail-on")?;
22527
22528        let vips_op_response = bindings::vips_thumbnail_buffer(
22529            buffer_in,
22530            buffer.len() as u64,
22531            &mut out_out,
22532            width_in,
22533            option_string_in_name.as_ptr(),
22534            option_string_in.as_ptr(),
22535            height_in_name.as_ptr(),
22536            height_in,
22537            size_in_name.as_ptr(),
22538            size_in,
22539            no_rotate_in_name.as_ptr(),
22540            no_rotate_in,
22541            crop_in_name.as_ptr(),
22542            crop_in,
22543            linear_in_name.as_ptr(),
22544            linear_in,
22545            import_profile_in_name.as_ptr(),
22546            import_profile_in.as_ptr(),
22547            export_profile_in_name.as_ptr(),
22548            export_profile_in.as_ptr(),
22549            intent_in_name.as_ptr(),
22550            intent_in,
22551            fail_on_in_name.as_ptr(),
22552            fail_on_in,
22553            NULL,
22554        );
22555        utils::result(
22556            vips_op_response,
22557            VipsImage { ctx: out_out },
22558            Error::ThumbnailBufferError,
22559        )
22560    }
22561}
22562
22563/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
22564/// inp: `&VipsImage` -> Input image argument
22565/// width: `i32` -> Size to this width
22566/// min: 1, max: 10000000, default: 1
22567/// returns `VipsImage` - Output image
22568pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
22569    unsafe {
22570        let inp_in: *mut bindings::VipsImage = inp.ctx;
22571        let width_in: i32 = width;
22572        let mut out_out: *mut bindings::VipsImage = null_mut();
22573
22574        let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
22575        utils::result(
22576            vips_op_response,
22577            VipsImage { ctx: out_out },
22578            Error::ThumbnailImageError,
22579        )
22580    }
22581}
22582
22583/// Options for thumbnail_image operation
22584#[derive(Clone, Debug)]
22585pub struct ThumbnailImageOptions {
22586    /// height: `i32` -> Size to this height
22587    /// min: 1, max: 10000000, default: 1
22588    pub height: i32,
22589    /// size: `Size` -> Only upsize, only downsize, or both
22590    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
22591    ///  `Up` -> VIPS_SIZE_UP = 1
22592    ///  `Down` -> VIPS_SIZE_DOWN = 2
22593    ///  `Force` -> VIPS_SIZE_FORCE = 3
22594    ///  `Last` -> VIPS_SIZE_LAST = 4
22595    pub size: Size,
22596    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
22597    /// default: false
22598    pub no_rotate: bool,
22599    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
22600    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
22601    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
22602    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
22603    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
22604    ///  `Low` -> VIPS_INTERESTING_LOW = 4
22605    ///  `High` -> VIPS_INTERESTING_HIGH = 5
22606    ///  `All` -> VIPS_INTERESTING_ALL = 6
22607    ///  `Last` -> VIPS_INTERESTING_LAST = 7
22608    pub crop: Interesting,
22609    /// linear: `bool` -> Reduce in linear light
22610    /// default: false
22611    pub linear: bool,
22612    /// import_profile: `String` -> Fallback import profile
22613    pub import_profile: String,
22614    /// export_profile: `String` -> Fallback export profile
22615    pub export_profile: String,
22616    /// intent: `Intent` -> Rendering intent
22617    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
22618    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
22619    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
22620    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
22621    ///  `Last` -> VIPS_INTENT_LAST = 4
22622    pub intent: Intent,
22623    /// fail_on: `FailOn` -> Error level to fail on
22624    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
22625    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
22626    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
22627    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
22628    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
22629    pub fail_on: FailOn,
22630}
22631
22632impl std::default::Default for ThumbnailImageOptions {
22633    fn default() -> Self {
22634        ThumbnailImageOptions {
22635            height: i32::from(1),
22636            size: Size::Both,
22637            no_rotate: false,
22638            crop: Interesting::None,
22639            linear: false,
22640            import_profile: String::new(),
22641            export_profile: String::new(),
22642            intent: Intent::Relative,
22643            fail_on: FailOn::None,
22644        }
22645    }
22646}
22647
22648/// VipsThumbnailImage (thumbnail_image), generate thumbnail from image
22649/// inp: `&VipsImage` -> Input image argument
22650/// width: `i32` -> Size to this width
22651/// min: 1, max: 10000000, default: 1
22652/// thumbnail_image_options: `&ThumbnailImageOptions` -> optional arguments
22653/// returns `VipsImage` - Output image
22654pub fn thumbnail_image_with_opts(
22655    inp: &VipsImage,
22656    width: i32,
22657    thumbnail_image_options: &ThumbnailImageOptions,
22658) -> Result<VipsImage> {
22659    unsafe {
22660        let inp_in: *mut bindings::VipsImage = inp.ctx;
22661        let width_in: i32 = width;
22662        let mut out_out: *mut bindings::VipsImage = null_mut();
22663
22664        let height_in: i32 = thumbnail_image_options.height;
22665        let height_in_name = utils::new_c_string("height")?;
22666
22667        let size_in: i32 = thumbnail_image_options.size as i32;
22668        let size_in_name = utils::new_c_string("size")?;
22669
22670        let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
22671            1
22672        } else {
22673            0
22674        };
22675        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22676
22677        let crop_in: i32 = thumbnail_image_options.crop as i32;
22678        let crop_in_name = utils::new_c_string("crop")?;
22679
22680        let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
22681        let linear_in_name = utils::new_c_string("linear")?;
22682
22683        let import_profile_in: CString =
22684            utils::new_c_string(&thumbnail_image_options.import_profile)?;
22685        let import_profile_in_name = utils::new_c_string("import-profile")?;
22686
22687        let export_profile_in: CString =
22688            utils::new_c_string(&thumbnail_image_options.export_profile)?;
22689        let export_profile_in_name = utils::new_c_string("export-profile")?;
22690
22691        let intent_in: i32 = thumbnail_image_options.intent as i32;
22692        let intent_in_name = utils::new_c_string("intent")?;
22693
22694        let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
22695        let fail_on_in_name = utils::new_c_string("fail-on")?;
22696
22697        let vips_op_response = bindings::vips_thumbnail_image(
22698            inp_in,
22699            &mut out_out,
22700            width_in,
22701            height_in_name.as_ptr(),
22702            height_in,
22703            size_in_name.as_ptr(),
22704            size_in,
22705            no_rotate_in_name.as_ptr(),
22706            no_rotate_in,
22707            crop_in_name.as_ptr(),
22708            crop_in,
22709            linear_in_name.as_ptr(),
22710            linear_in,
22711            import_profile_in_name.as_ptr(),
22712            import_profile_in.as_ptr(),
22713            export_profile_in_name.as_ptr(),
22714            export_profile_in.as_ptr(),
22715            intent_in_name.as_ptr(),
22716            intent_in,
22717            fail_on_in_name.as_ptr(),
22718            fail_on_in,
22719            NULL,
22720        );
22721        utils::result(
22722            vips_op_response,
22723            VipsImage { ctx: out_out },
22724            Error::ThumbnailImageError,
22725        )
22726    }
22727}
22728
22729/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
22730/// source: `&VipsSource` -> Source to load from
22731/// width: `i32` -> Size to this width
22732/// min: 1, max: 10000000, default: 1
22733/// returns `VipsImage` - Output image
22734pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
22735    unsafe {
22736        let source_in: *mut bindings::VipsSource = source.ctx;
22737        let width_in: i32 = width;
22738        let mut out_out: *mut bindings::VipsImage = null_mut();
22739
22740        let vips_op_response =
22741            bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
22742        utils::result(
22743            vips_op_response,
22744            VipsImage { ctx: out_out },
22745            Error::ThumbnailSourceError,
22746        )
22747    }
22748}
22749
22750/// Options for thumbnail_source operation
22751#[derive(Clone, Debug)]
22752pub struct ThumbnailSourceOptions {
22753    /// option_string: `String` -> Options that are passed on to the underlying loader
22754    pub option_string: String,
22755    /// height: `i32` -> Size to this height
22756    /// min: 1, max: 10000000, default: 1
22757    pub height: i32,
22758    /// size: `Size` -> Only upsize, only downsize, or both
22759    ///  `Both` -> VIPS_SIZE_BOTH = 0 [DEFAULT]
22760    ///  `Up` -> VIPS_SIZE_UP = 1
22761    ///  `Down` -> VIPS_SIZE_DOWN = 2
22762    ///  `Force` -> VIPS_SIZE_FORCE = 3
22763    ///  `Last` -> VIPS_SIZE_LAST = 4
22764    pub size: Size,
22765    /// no_rotate: `bool` -> Don't use orientation tags to rotate image upright
22766    /// default: false
22767    pub no_rotate: bool,
22768    /// crop: `Interesting` -> Reduce to fill target rectangle, then crop
22769    ///  `None` -> VIPS_INTERESTING_NONE = 0 [DEFAULT]
22770    ///  `Centre` -> VIPS_INTERESTING_CENTRE = 1
22771    ///  `Entropy` -> VIPS_INTERESTING_ENTROPY = 2
22772    ///  `Attention` -> VIPS_INTERESTING_ATTENTION = 3
22773    ///  `Low` -> VIPS_INTERESTING_LOW = 4
22774    ///  `High` -> VIPS_INTERESTING_HIGH = 5
22775    ///  `All` -> VIPS_INTERESTING_ALL = 6
22776    ///  `Last` -> VIPS_INTERESTING_LAST = 7
22777    pub crop: Interesting,
22778    /// linear: `bool` -> Reduce in linear light
22779    /// default: false
22780    pub linear: bool,
22781    /// import_profile: `String` -> Fallback import profile
22782    pub import_profile: String,
22783    /// export_profile: `String` -> Fallback export profile
22784    pub export_profile: String,
22785    /// intent: `Intent` -> Rendering intent
22786    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
22787    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
22788    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
22789    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
22790    ///  `Last` -> VIPS_INTENT_LAST = 4
22791    pub intent: Intent,
22792    /// fail_on: `FailOn` -> Error level to fail on
22793    ///  `None` -> VIPS_FAIL_ON_NONE = 0 [DEFAULT]
22794    ///  `Truncated` -> VIPS_FAIL_ON_TRUNCATED = 1
22795    ///  `Error` -> VIPS_FAIL_ON_ERROR = 2
22796    ///  `Warning` -> VIPS_FAIL_ON_WARNING = 3
22797    ///  `Last` -> VIPS_FAIL_ON_LAST = 4
22798    pub fail_on: FailOn,
22799}
22800
22801impl std::default::Default for ThumbnailSourceOptions {
22802    fn default() -> Self {
22803        ThumbnailSourceOptions {
22804            option_string: String::new(),
22805            height: i32::from(1),
22806            size: Size::Both,
22807            no_rotate: false,
22808            crop: Interesting::None,
22809            linear: false,
22810            import_profile: String::new(),
22811            export_profile: String::new(),
22812            intent: Intent::Relative,
22813            fail_on: FailOn::None,
22814        }
22815    }
22816}
22817
22818/// VipsThumbnailSource (thumbnail_source), generate thumbnail from source
22819/// source: `&VipsSource` -> Source to load from
22820/// width: `i32` -> Size to this width
22821/// min: 1, max: 10000000, default: 1
22822/// thumbnail_source_options: `&ThumbnailSourceOptions` -> optional arguments
22823/// returns `VipsImage` - Output image
22824pub fn thumbnail_source_with_opts(
22825    source: &VipsSource,
22826    width: i32,
22827    thumbnail_source_options: &ThumbnailSourceOptions,
22828) -> Result<VipsImage> {
22829    unsafe {
22830        let source_in: *mut bindings::VipsSource = source.ctx;
22831        let width_in: i32 = width;
22832        let mut out_out: *mut bindings::VipsImage = null_mut();
22833
22834        let option_string_in: CString =
22835            utils::new_c_string(&thumbnail_source_options.option_string)?;
22836        let option_string_in_name = utils::new_c_string("option-string")?;
22837
22838        let height_in: i32 = thumbnail_source_options.height;
22839        let height_in_name = utils::new_c_string("height")?;
22840
22841        let size_in: i32 = thumbnail_source_options.size as i32;
22842        let size_in_name = utils::new_c_string("size")?;
22843
22844        let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
22845            1
22846        } else {
22847            0
22848        };
22849        let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22850
22851        let crop_in: i32 = thumbnail_source_options.crop as i32;
22852        let crop_in_name = utils::new_c_string("crop")?;
22853
22854        let linear_in: i32 = if thumbnail_source_options.linear {
22855            1
22856        } else {
22857            0
22858        };
22859        let linear_in_name = utils::new_c_string("linear")?;
22860
22861        let import_profile_in: CString =
22862            utils::new_c_string(&thumbnail_source_options.import_profile)?;
22863        let import_profile_in_name = utils::new_c_string("import-profile")?;
22864
22865        let export_profile_in: CString =
22866            utils::new_c_string(&thumbnail_source_options.export_profile)?;
22867        let export_profile_in_name = utils::new_c_string("export-profile")?;
22868
22869        let intent_in: i32 = thumbnail_source_options.intent as i32;
22870        let intent_in_name = utils::new_c_string("intent")?;
22871
22872        let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
22873        let fail_on_in_name = utils::new_c_string("fail-on")?;
22874
22875        let vips_op_response = bindings::vips_thumbnail_source(
22876            source_in,
22877            &mut out_out,
22878            width_in,
22879            option_string_in_name.as_ptr(),
22880            option_string_in.as_ptr(),
22881            height_in_name.as_ptr(),
22882            height_in,
22883            size_in_name.as_ptr(),
22884            size_in,
22885            no_rotate_in_name.as_ptr(),
22886            no_rotate_in,
22887            crop_in_name.as_ptr(),
22888            crop_in,
22889            linear_in_name.as_ptr(),
22890            linear_in,
22891            import_profile_in_name.as_ptr(),
22892            import_profile_in.as_ptr(),
22893            export_profile_in_name.as_ptr(),
22894            export_profile_in.as_ptr(),
22895            intent_in_name.as_ptr(),
22896            intent_in,
22897            fail_on_in_name.as_ptr(),
22898            fail_on_in,
22899            NULL,
22900        );
22901        utils::result(
22902            vips_op_response,
22903            VipsImage { ctx: out_out },
22904            Error::ThumbnailSourceError,
22905        )
22906    }
22907}
22908
22909/// VipsMapim (mapim), resample with a map image
22910/// inp: `&VipsImage` -> Input image argument
22911/// index: `&VipsImage` -> Index pixels with this
22912/// returns `VipsImage` - Output image
22913pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
22914    unsafe {
22915        let inp_in: *mut bindings::VipsImage = inp.ctx;
22916        let index_in: *mut bindings::VipsImage = index.ctx;
22917        let mut out_out: *mut bindings::VipsImage = null_mut();
22918
22919        let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
22920        utils::result(
22921            vips_op_response,
22922            VipsImage { ctx: out_out },
22923            Error::MapimError,
22924        )
22925    }
22926}
22927
22928/// Options for mapim operation
22929#[derive(Clone, Debug)]
22930pub struct MapimOptions {
22931    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
22932    pub interpolate: VipsInterpolate,
22933    /// background: `Vec<f64>` -> Background value
22934    pub background: Vec<f64>,
22935    /// premultiplied: `bool` -> Images have premultiplied alpha
22936    /// default: false
22937    pub premultiplied: bool,
22938    /// extend: `Extend` -> How to generate the extra pixels
22939    ///  `Black` -> VIPS_EXTEND_BLACK = 0
22940    ///  `Copy` -> VIPS_EXTEND_COPY = 1
22941    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
22942    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
22943    ///  `White` -> VIPS_EXTEND_WHITE = 4
22944    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
22945    ///  `Last` -> VIPS_EXTEND_LAST = 6
22946    pub extend: Extend,
22947}
22948
22949impl std::default::Default for MapimOptions {
22950    fn default() -> Self {
22951        MapimOptions {
22952            interpolate: VipsInterpolate::new(),
22953            background: Vec::new(),
22954            premultiplied: false,
22955            extend: Extend::Background,
22956        }
22957    }
22958}
22959
22960/// VipsMapim (mapim), resample with a map image
22961/// inp: `&VipsImage` -> Input image argument
22962/// index: `&VipsImage` -> Index pixels with this
22963/// mapim_options: `&MapimOptions` -> optional arguments
22964/// returns `VipsImage` - Output image
22965pub fn mapim_with_opts(
22966    inp: &VipsImage,
22967    index: &VipsImage,
22968    mapim_options: &MapimOptions,
22969) -> Result<VipsImage> {
22970    unsafe {
22971        let inp_in: *mut bindings::VipsImage = inp.ctx;
22972        let index_in: *mut bindings::VipsImage = index.ctx;
22973        let mut out_out: *mut bindings::VipsImage = null_mut();
22974
22975        let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
22976        let interpolate_in_name = utils::new_c_string("interpolate")?;
22977
22978        let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
22979        let background_in = background_wrapper.ctx;
22980        let background_in_name = utils::new_c_string("background")?;
22981
22982        let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
22983        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
22984
22985        let extend_in: i32 = mapim_options.extend as i32;
22986        let extend_in_name = utils::new_c_string("extend")?;
22987
22988        let vips_op_response = bindings::vips_mapim(
22989            inp_in,
22990            &mut out_out,
22991            index_in,
22992            interpolate_in_name.as_ptr(),
22993            interpolate_in,
22994            background_in_name.as_ptr(),
22995            background_in,
22996            premultiplied_in_name.as_ptr(),
22997            premultiplied_in,
22998            extend_in_name.as_ptr(),
22999            extend_in,
23000            NULL,
23001        );
23002        utils::result(
23003            vips_op_response,
23004            VipsImage { ctx: out_out },
23005            Error::MapimError,
23006        )
23007    }
23008}
23009
23010/// VipsShrink (shrink), shrink an image
23011/// inp: `&VipsImage` -> Input image argument
23012/// hshrink: `f64` -> Horizontal shrink factor
23013/// min: 1, max: 1000000, default: 1
23014/// vshrink: `f64` -> Vertical shrink factor
23015/// min: 1, max: 1000000, default: 1
23016/// returns `VipsImage` - Output image
23017pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
23018    unsafe {
23019        let inp_in: *mut bindings::VipsImage = inp.ctx;
23020        let hshrink_in: f64 = hshrink;
23021        let vshrink_in: f64 = vshrink;
23022        let mut out_out: *mut bindings::VipsImage = null_mut();
23023
23024        let vips_op_response =
23025            bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
23026        utils::result(
23027            vips_op_response,
23028            VipsImage { ctx: out_out },
23029            Error::ShrinkError,
23030        )
23031    }
23032}
23033
23034/// Options for shrink operation
23035#[derive(Clone, Debug)]
23036pub struct ShrinkOptions {
23037    /// ceil: `bool` -> Round-up output dimensions
23038    /// default: false
23039    pub ceil: bool,
23040}
23041
23042impl std::default::Default for ShrinkOptions {
23043    fn default() -> Self {
23044        ShrinkOptions { ceil: false }
23045    }
23046}
23047
23048/// VipsShrink (shrink), shrink an image
23049/// inp: `&VipsImage` -> Input image argument
23050/// hshrink: `f64` -> Horizontal shrink factor
23051/// min: 1, max: 1000000, default: 1
23052/// vshrink: `f64` -> Vertical shrink factor
23053/// min: 1, max: 1000000, default: 1
23054/// shrink_options: `&ShrinkOptions` -> optional arguments
23055/// returns `VipsImage` - Output image
23056pub fn shrink_with_opts(
23057    inp: &VipsImage,
23058    hshrink: f64,
23059    vshrink: f64,
23060    shrink_options: &ShrinkOptions,
23061) -> Result<VipsImage> {
23062    unsafe {
23063        let inp_in: *mut bindings::VipsImage = inp.ctx;
23064        let hshrink_in: f64 = hshrink;
23065        let vshrink_in: f64 = vshrink;
23066        let mut out_out: *mut bindings::VipsImage = null_mut();
23067
23068        let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
23069        let ceil_in_name = utils::new_c_string("ceil")?;
23070
23071        let vips_op_response = bindings::vips_shrink(
23072            inp_in,
23073            &mut out_out,
23074            hshrink_in,
23075            vshrink_in,
23076            ceil_in_name.as_ptr(),
23077            ceil_in,
23078            NULL,
23079        );
23080        utils::result(
23081            vips_op_response,
23082            VipsImage { ctx: out_out },
23083            Error::ShrinkError,
23084        )
23085    }
23086}
23087
23088/// VipsShrinkh (shrinkh), shrink an image horizontally
23089/// inp: `&VipsImage` -> Input image argument
23090/// hshrink: `i32` -> Horizontal shrink factor
23091/// min: 1, max: 1000000, default: 1
23092/// returns `VipsImage` - Output image
23093pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
23094    unsafe {
23095        let inp_in: *mut bindings::VipsImage = inp.ctx;
23096        let hshrink_in: i32 = hshrink;
23097        let mut out_out: *mut bindings::VipsImage = null_mut();
23098
23099        let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
23100        utils::result(
23101            vips_op_response,
23102            VipsImage { ctx: out_out },
23103            Error::ShrinkhError,
23104        )
23105    }
23106}
23107
23108/// Options for shrinkh operation
23109#[derive(Clone, Debug)]
23110pub struct ShrinkhOptions {
23111    /// ceil: `bool` -> Round-up output dimensions
23112    /// default: false
23113    pub ceil: bool,
23114}
23115
23116impl std::default::Default for ShrinkhOptions {
23117    fn default() -> Self {
23118        ShrinkhOptions { ceil: false }
23119    }
23120}
23121
23122/// VipsShrinkh (shrinkh), shrink an image horizontally
23123/// inp: `&VipsImage` -> Input image argument
23124/// hshrink: `i32` -> Horizontal shrink factor
23125/// min: 1, max: 1000000, default: 1
23126/// shrinkh_options: `&ShrinkhOptions` -> optional arguments
23127/// returns `VipsImage` - Output image
23128pub fn shrinkh_with_opts(
23129    inp: &VipsImage,
23130    hshrink: i32,
23131    shrinkh_options: &ShrinkhOptions,
23132) -> Result<VipsImage> {
23133    unsafe {
23134        let inp_in: *mut bindings::VipsImage = inp.ctx;
23135        let hshrink_in: i32 = hshrink;
23136        let mut out_out: *mut bindings::VipsImage = null_mut();
23137
23138        let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
23139        let ceil_in_name = utils::new_c_string("ceil")?;
23140
23141        let vips_op_response = bindings::vips_shrinkh(
23142            inp_in,
23143            &mut out_out,
23144            hshrink_in,
23145            ceil_in_name.as_ptr(),
23146            ceil_in,
23147            NULL,
23148        );
23149        utils::result(
23150            vips_op_response,
23151            VipsImage { ctx: out_out },
23152            Error::ShrinkhError,
23153        )
23154    }
23155}
23156
23157/// VipsShrinkv (shrinkv), shrink an image vertically
23158/// inp: `&VipsImage` -> Input image argument
23159/// vshrink: `i32` -> Vertical shrink factor
23160/// min: 1, max: 1000000, default: 1
23161/// returns `VipsImage` - Output image
23162pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
23163    unsafe {
23164        let inp_in: *mut bindings::VipsImage = inp.ctx;
23165        let vshrink_in: i32 = vshrink;
23166        let mut out_out: *mut bindings::VipsImage = null_mut();
23167
23168        let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
23169        utils::result(
23170            vips_op_response,
23171            VipsImage { ctx: out_out },
23172            Error::ShrinkvError,
23173        )
23174    }
23175}
23176
23177/// Options for shrinkv operation
23178#[derive(Clone, Debug)]
23179pub struct ShrinkvOptions {
23180    /// ceil: `bool` -> Round-up output dimensions
23181    /// default: false
23182    pub ceil: bool,
23183}
23184
23185impl std::default::Default for ShrinkvOptions {
23186    fn default() -> Self {
23187        ShrinkvOptions { ceil: false }
23188    }
23189}
23190
23191/// VipsShrinkv (shrinkv), shrink an image vertically
23192/// inp: `&VipsImage` -> Input image argument
23193/// vshrink: `i32` -> Vertical shrink factor
23194/// min: 1, max: 1000000, default: 1
23195/// shrinkv_options: `&ShrinkvOptions` -> optional arguments
23196/// returns `VipsImage` - Output image
23197pub fn shrinkv_with_opts(
23198    inp: &VipsImage,
23199    vshrink: i32,
23200    shrinkv_options: &ShrinkvOptions,
23201) -> Result<VipsImage> {
23202    unsafe {
23203        let inp_in: *mut bindings::VipsImage = inp.ctx;
23204        let vshrink_in: i32 = vshrink;
23205        let mut out_out: *mut bindings::VipsImage = null_mut();
23206
23207        let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
23208        let ceil_in_name = utils::new_c_string("ceil")?;
23209
23210        let vips_op_response = bindings::vips_shrinkv(
23211            inp_in,
23212            &mut out_out,
23213            vshrink_in,
23214            ceil_in_name.as_ptr(),
23215            ceil_in,
23216            NULL,
23217        );
23218        utils::result(
23219            vips_op_response,
23220            VipsImage { ctx: out_out },
23221            Error::ShrinkvError,
23222        )
23223    }
23224}
23225
23226/// VipsReduceh (reduceh), shrink an image horizontally
23227/// inp: `&VipsImage` -> Input image argument
23228/// hshrink: `f64` -> Horizontal shrink factor
23229/// min: 1, max: 1000000, default: 1
23230/// returns `VipsImage` - Output image
23231pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
23232    unsafe {
23233        let inp_in: *mut bindings::VipsImage = inp.ctx;
23234        let hshrink_in: f64 = hshrink;
23235        let mut out_out: *mut bindings::VipsImage = null_mut();
23236
23237        let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
23238        utils::result(
23239            vips_op_response,
23240            VipsImage { ctx: out_out },
23241            Error::ReducehError,
23242        )
23243    }
23244}
23245
23246/// Options for reduceh operation
23247#[derive(Clone, Debug)]
23248pub struct ReducehOptions {
23249    /// kernel: `Kernel` -> Resampling kernel
23250    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
23251    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
23252    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
23253    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
23254    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
23255    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
23256    ///  `Last` -> VIPS_KERNEL_LAST = 6
23257    pub kernel: Kernel,
23258    /// gap: `f64` -> Reducing gap
23259    /// min: 0, max: 1000000, default: 0
23260    pub gap: f64,
23261}
23262
23263impl std::default::Default for ReducehOptions {
23264    fn default() -> Self {
23265        ReducehOptions {
23266            kernel: Kernel::Lanczos3,
23267            gap: f64::from(0),
23268        }
23269    }
23270}
23271
23272/// VipsReduceh (reduceh), shrink an image horizontally
23273/// inp: `&VipsImage` -> Input image argument
23274/// hshrink: `f64` -> Horizontal shrink factor
23275/// min: 1, max: 1000000, default: 1
23276/// reduceh_options: `&ReducehOptions` -> optional arguments
23277/// returns `VipsImage` - Output image
23278pub fn reduceh_with_opts(
23279    inp: &VipsImage,
23280    hshrink: f64,
23281    reduceh_options: &ReducehOptions,
23282) -> Result<VipsImage> {
23283    unsafe {
23284        let inp_in: *mut bindings::VipsImage = inp.ctx;
23285        let hshrink_in: f64 = hshrink;
23286        let mut out_out: *mut bindings::VipsImage = null_mut();
23287
23288        let kernel_in: i32 = reduceh_options.kernel as i32;
23289        let kernel_in_name = utils::new_c_string("kernel")?;
23290
23291        let gap_in: f64 = reduceh_options.gap;
23292        let gap_in_name = utils::new_c_string("gap")?;
23293
23294        let vips_op_response = bindings::vips_reduceh(
23295            inp_in,
23296            &mut out_out,
23297            hshrink_in,
23298            kernel_in_name.as_ptr(),
23299            kernel_in,
23300            gap_in_name.as_ptr(),
23301            gap_in,
23302            NULL,
23303        );
23304        utils::result(
23305            vips_op_response,
23306            VipsImage { ctx: out_out },
23307            Error::ReducehError,
23308        )
23309    }
23310}
23311
23312/// VipsReducev (reducev), shrink an image vertically
23313/// inp: `&VipsImage` -> Input image argument
23314/// vshrink: `f64` -> Vertical shrink factor
23315/// min: 1, max: 1000000, default: 1
23316/// returns `VipsImage` - Output image
23317pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
23318    unsafe {
23319        let inp_in: *mut bindings::VipsImage = inp.ctx;
23320        let vshrink_in: f64 = vshrink;
23321        let mut out_out: *mut bindings::VipsImage = null_mut();
23322
23323        let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
23324        utils::result(
23325            vips_op_response,
23326            VipsImage { ctx: out_out },
23327            Error::ReducevError,
23328        )
23329    }
23330}
23331
23332/// Options for reducev operation
23333#[derive(Clone, Debug)]
23334pub struct ReducevOptions {
23335    /// kernel: `Kernel` -> Resampling kernel
23336    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
23337    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
23338    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
23339    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
23340    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
23341    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
23342    ///  `Last` -> VIPS_KERNEL_LAST = 6
23343    pub kernel: Kernel,
23344    /// gap: `f64` -> Reducing gap
23345    /// min: 0, max: 1000000, default: 0
23346    pub gap: f64,
23347}
23348
23349impl std::default::Default for ReducevOptions {
23350    fn default() -> Self {
23351        ReducevOptions {
23352            kernel: Kernel::Lanczos3,
23353            gap: f64::from(0),
23354        }
23355    }
23356}
23357
23358/// VipsReducev (reducev), shrink an image vertically
23359/// inp: `&VipsImage` -> Input image argument
23360/// vshrink: `f64` -> Vertical shrink factor
23361/// min: 1, max: 1000000, default: 1
23362/// reducev_options: `&ReducevOptions` -> optional arguments
23363/// returns `VipsImage` - Output image
23364pub fn reducev_with_opts(
23365    inp: &VipsImage,
23366    vshrink: f64,
23367    reducev_options: &ReducevOptions,
23368) -> Result<VipsImage> {
23369    unsafe {
23370        let inp_in: *mut bindings::VipsImage = inp.ctx;
23371        let vshrink_in: f64 = vshrink;
23372        let mut out_out: *mut bindings::VipsImage = null_mut();
23373
23374        let kernel_in: i32 = reducev_options.kernel as i32;
23375        let kernel_in_name = utils::new_c_string("kernel")?;
23376
23377        let gap_in: f64 = reducev_options.gap;
23378        let gap_in_name = utils::new_c_string("gap")?;
23379
23380        let vips_op_response = bindings::vips_reducev(
23381            inp_in,
23382            &mut out_out,
23383            vshrink_in,
23384            kernel_in_name.as_ptr(),
23385            kernel_in,
23386            gap_in_name.as_ptr(),
23387            gap_in,
23388            NULL,
23389        );
23390        utils::result(
23391            vips_op_response,
23392            VipsImage { ctx: out_out },
23393            Error::ReducevError,
23394        )
23395    }
23396}
23397
23398/// VipsReduce (reduce), reduce an image
23399/// inp: `&VipsImage` -> Input image argument
23400/// hshrink: `f64` -> Horizontal shrink factor
23401/// min: 1, max: 1000000, default: 1
23402/// vshrink: `f64` -> Vertical shrink factor
23403/// min: 1, max: 1000000, default: 1
23404/// returns `VipsImage` - Output image
23405pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
23406    unsafe {
23407        let inp_in: *mut bindings::VipsImage = inp.ctx;
23408        let hshrink_in: f64 = hshrink;
23409        let vshrink_in: f64 = vshrink;
23410        let mut out_out: *mut bindings::VipsImage = null_mut();
23411
23412        let vips_op_response =
23413            bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
23414        utils::result(
23415            vips_op_response,
23416            VipsImage { ctx: out_out },
23417            Error::ReduceError,
23418        )
23419    }
23420}
23421
23422/// Options for reduce operation
23423#[derive(Clone, Debug)]
23424pub struct ReduceOptions {
23425    /// kernel: `Kernel` -> Resampling kernel
23426    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
23427    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
23428    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
23429    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
23430    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
23431    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
23432    ///  `Last` -> VIPS_KERNEL_LAST = 6
23433    pub kernel: Kernel,
23434    /// gap: `f64` -> Reducing gap
23435    /// min: 0, max: 1000000, default: 0
23436    pub gap: f64,
23437}
23438
23439impl std::default::Default for ReduceOptions {
23440    fn default() -> Self {
23441        ReduceOptions {
23442            kernel: Kernel::Lanczos3,
23443            gap: f64::from(0),
23444        }
23445    }
23446}
23447
23448/// VipsReduce (reduce), reduce an image
23449/// inp: `&VipsImage` -> Input image argument
23450/// hshrink: `f64` -> Horizontal shrink factor
23451/// min: 1, max: 1000000, default: 1
23452/// vshrink: `f64` -> Vertical shrink factor
23453/// min: 1, max: 1000000, default: 1
23454/// reduce_options: `&ReduceOptions` -> optional arguments
23455/// returns `VipsImage` - Output image
23456pub fn reduce_with_opts(
23457    inp: &VipsImage,
23458    hshrink: f64,
23459    vshrink: f64,
23460    reduce_options: &ReduceOptions,
23461) -> Result<VipsImage> {
23462    unsafe {
23463        let inp_in: *mut bindings::VipsImage = inp.ctx;
23464        let hshrink_in: f64 = hshrink;
23465        let vshrink_in: f64 = vshrink;
23466        let mut out_out: *mut bindings::VipsImage = null_mut();
23467
23468        let kernel_in: i32 = reduce_options.kernel as i32;
23469        let kernel_in_name = utils::new_c_string("kernel")?;
23470
23471        let gap_in: f64 = reduce_options.gap;
23472        let gap_in_name = utils::new_c_string("gap")?;
23473
23474        let vips_op_response = bindings::vips_reduce(
23475            inp_in,
23476            &mut out_out,
23477            hshrink_in,
23478            vshrink_in,
23479            kernel_in_name.as_ptr(),
23480            kernel_in,
23481            gap_in_name.as_ptr(),
23482            gap_in,
23483            NULL,
23484        );
23485        utils::result(
23486            vips_op_response,
23487            VipsImage { ctx: out_out },
23488            Error::ReduceError,
23489        )
23490    }
23491}
23492
23493/// VipsQuadratic (quadratic), resample an image with a quadratic transform
23494/// inp: `&VipsImage` -> Input image argument
23495/// coeff: `&VipsImage` -> Coefficient matrix
23496/// returns `VipsImage` - Output image
23497pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
23498    unsafe {
23499        let inp_in: *mut bindings::VipsImage = inp.ctx;
23500        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
23501        let mut out_out: *mut bindings::VipsImage = null_mut();
23502
23503        let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
23504        utils::result(
23505            vips_op_response,
23506            VipsImage { ctx: out_out },
23507            Error::QuadraticError,
23508        )
23509    }
23510}
23511
23512/// Options for quadratic operation
23513#[derive(Clone, Debug)]
23514pub struct QuadraticOptions {
23515    /// interpolate: `VipsInterpolate` -> Interpolate values with this
23516    pub interpolate: VipsInterpolate,
23517}
23518
23519impl std::default::Default for QuadraticOptions {
23520    fn default() -> Self {
23521        QuadraticOptions {
23522            interpolate: VipsInterpolate::new(),
23523        }
23524    }
23525}
23526
23527/// VipsQuadratic (quadratic), resample an image with a quadratic transform
23528/// inp: `&VipsImage` -> Input image argument
23529/// coeff: `&VipsImage` -> Coefficient matrix
23530/// quadratic_options: `&QuadraticOptions` -> optional arguments
23531/// returns `VipsImage` - Output image
23532pub fn quadratic_with_opts(
23533    inp: &VipsImage,
23534    coeff: &VipsImage,
23535    quadratic_options: &QuadraticOptions,
23536) -> Result<VipsImage> {
23537    unsafe {
23538        let inp_in: *mut bindings::VipsImage = inp.ctx;
23539        let coeff_in: *mut bindings::VipsImage = coeff.ctx;
23540        let mut out_out: *mut bindings::VipsImage = null_mut();
23541
23542        let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
23543        let interpolate_in_name = utils::new_c_string("interpolate")?;
23544
23545        let vips_op_response = bindings::vips_quadratic(
23546            inp_in,
23547            &mut out_out,
23548            coeff_in,
23549            interpolate_in_name.as_ptr(),
23550            interpolate_in,
23551            NULL,
23552        );
23553        utils::result(
23554            vips_op_response,
23555            VipsImage { ctx: out_out },
23556            Error::QuadraticError,
23557        )
23558    }
23559}
23560
23561/// VipsAffine (affine), affine transform of an image
23562/// inp: `&VipsImage` -> Input image argument
23563/// a: `f64` -> Transformation Matrix coefficient
23564/// min: -inf, max: inf, default: 0
23565/// b: `f64` -> Transformation Matrix coefficient
23566/// min: -inf, max: inf, default: 0
23567/// c: `f64` -> Transformation Matrix coefficient
23568/// min: -inf, max: inf, default: 0
23569/// d: `f64` -> Transformation Matrix coefficient
23570/// min: -inf, max: inf, default: 0
23571/// returns `VipsImage` - Output image
23572pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
23573    unsafe {
23574        let inp_in: *mut bindings::VipsImage = inp.ctx;
23575        let a_in: f64 = a;
23576        let b_in: f64 = b;
23577        let c_in: f64 = c;
23578        let d_in: f64 = d;
23579        let mut out_out: *mut bindings::VipsImage = null_mut();
23580
23581        let vips_op_response =
23582            bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
23583        utils::result(
23584            vips_op_response,
23585            VipsImage { ctx: out_out },
23586            Error::AffineError,
23587        )
23588    }
23589}
23590
23591/// Options for affine operation
23592#[derive(Clone, Debug)]
23593pub struct AffineOptions {
23594    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23595    pub interpolate: VipsInterpolate,
23596    /// oarea: `Vec<i32>` -> Area of output to generate
23597    pub oarea: Vec<i32>,
23598    /// odx: `f64` -> Horizontal output displacement
23599    /// min: -10000000, max: 10000000, default: 0
23600    pub odx: f64,
23601    /// ody: `f64` -> Vertical output displacement
23602    /// min: -10000000, max: 10000000, default: 0
23603    pub ody: f64,
23604    /// idx: `f64` -> Horizontal input displacement
23605    /// min: -10000000, max: 10000000, default: 0
23606    pub idx: f64,
23607    /// idy: `f64` -> Vertical input displacement
23608    /// min: -10000000, max: 10000000, default: 0
23609    pub idy: f64,
23610    /// background: `Vec<f64>` -> Background value
23611    pub background: Vec<f64>,
23612    /// premultiplied: `bool` -> Images have premultiplied alpha
23613    /// default: false
23614    pub premultiplied: bool,
23615    /// extend: `Extend` -> How to generate the extra pixels
23616    ///  `Black` -> VIPS_EXTEND_BLACK = 0
23617    ///  `Copy` -> VIPS_EXTEND_COPY = 1
23618    ///  `Repeat` -> VIPS_EXTEND_REPEAT = 2
23619    ///  `Mirror` -> VIPS_EXTEND_MIRROR = 3
23620    ///  `White` -> VIPS_EXTEND_WHITE = 4
23621    ///  `Background` -> VIPS_EXTEND_BACKGROUND = 5 [DEFAULT]
23622    ///  `Last` -> VIPS_EXTEND_LAST = 6
23623    pub extend: Extend,
23624}
23625
23626impl std::default::Default for AffineOptions {
23627    fn default() -> Self {
23628        AffineOptions {
23629            interpolate: VipsInterpolate::new(),
23630            oarea: Vec::new(),
23631            odx: f64::from(0),
23632            ody: f64::from(0),
23633            idx: f64::from(0),
23634            idy: f64::from(0),
23635            background: Vec::new(),
23636            premultiplied: false,
23637            extend: Extend::Background,
23638        }
23639    }
23640}
23641
23642/// VipsAffine (affine), affine transform of an image
23643/// inp: `&VipsImage` -> Input image argument
23644/// a: `f64` -> Transformation Matrix coefficient
23645/// min: -inf, max: inf, default: 0
23646/// b: `f64` -> Transformation Matrix coefficient
23647/// min: -inf, max: inf, default: 0
23648/// c: `f64` -> Transformation Matrix coefficient
23649/// min: -inf, max: inf, default: 0
23650/// d: `f64` -> Transformation Matrix coefficient
23651/// min: -inf, max: inf, default: 0
23652/// affine_options: `&AffineOptions` -> optional arguments
23653/// returns `VipsImage` - Output image
23654pub fn affine_with_opts(
23655    inp: &VipsImage,
23656    a: f64,
23657    b: f64,
23658    c: f64,
23659    d: f64,
23660    affine_options: &AffineOptions,
23661) -> Result<VipsImage> {
23662    unsafe {
23663        let inp_in: *mut bindings::VipsImage = inp.ctx;
23664        let a_in: f64 = a;
23665        let b_in: f64 = b;
23666        let c_in: f64 = c;
23667        let d_in: f64 = d;
23668        let mut out_out: *mut bindings::VipsImage = null_mut();
23669
23670        let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
23671        let interpolate_in_name = utils::new_c_string("interpolate")?;
23672
23673        let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
23674        let oarea_in = oarea_wrapper.ctx;
23675        let oarea_in_name = utils::new_c_string("oarea")?;
23676
23677        let odx_in: f64 = affine_options.odx;
23678        let odx_in_name = utils::new_c_string("odx")?;
23679
23680        let ody_in: f64 = affine_options.ody;
23681        let ody_in_name = utils::new_c_string("ody")?;
23682
23683        let idx_in: f64 = affine_options.idx;
23684        let idx_in_name = utils::new_c_string("idx")?;
23685
23686        let idy_in: f64 = affine_options.idy;
23687        let idy_in_name = utils::new_c_string("idy")?;
23688
23689        let background_wrapper =
23690            utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
23691        let background_in = background_wrapper.ctx;
23692        let background_in_name = utils::new_c_string("background")?;
23693
23694        let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
23695        let premultiplied_in_name = utils::new_c_string("premultiplied")?;
23696
23697        let extend_in: i32 = affine_options.extend as i32;
23698        let extend_in_name = utils::new_c_string("extend")?;
23699
23700        let vips_op_response = bindings::vips_affine(
23701            inp_in,
23702            &mut out_out,
23703            a_in,
23704            b_in,
23705            c_in,
23706            d_in,
23707            interpolate_in_name.as_ptr(),
23708            interpolate_in,
23709            oarea_in_name.as_ptr(),
23710            oarea_in,
23711            odx_in_name.as_ptr(),
23712            odx_in,
23713            ody_in_name.as_ptr(),
23714            ody_in,
23715            idx_in_name.as_ptr(),
23716            idx_in,
23717            idy_in_name.as_ptr(),
23718            idy_in,
23719            background_in_name.as_ptr(),
23720            background_in,
23721            premultiplied_in_name.as_ptr(),
23722            premultiplied_in,
23723            extend_in_name.as_ptr(),
23724            extend_in,
23725            NULL,
23726        );
23727        utils::result(
23728            vips_op_response,
23729            VipsImage { ctx: out_out },
23730            Error::AffineError,
23731        )
23732    }
23733}
23734
23735/// VipsSimilarity (similarity), similarity transform of an image
23736/// inp: `&VipsImage` -> Input image argument
23737/// returns `VipsImage` - Output image
23738pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
23739    unsafe {
23740        let inp_in: *mut bindings::VipsImage = inp.ctx;
23741        let mut out_out: *mut bindings::VipsImage = null_mut();
23742
23743        let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
23744        utils::result(
23745            vips_op_response,
23746            VipsImage { ctx: out_out },
23747            Error::SimilarityError,
23748        )
23749    }
23750}
23751
23752/// Options for similarity operation
23753#[derive(Clone, Debug)]
23754pub struct SimilarityOptions {
23755    /// scale: `f64` -> Scale by this factor
23756    /// min: 0, max: 10000000, default: 1
23757    pub scale: f64,
23758    /// angle: `f64` -> Rotate anticlockwise by this many degrees
23759    /// min: -10000000, max: 10000000, default: 0
23760    pub angle: f64,
23761    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23762    pub interpolate: VipsInterpolate,
23763    /// background: `Vec<f64>` -> Background value
23764    pub background: Vec<f64>,
23765    /// odx: `f64` -> Horizontal output displacement
23766    /// min: -10000000, max: 10000000, default: 0
23767    pub odx: f64,
23768    /// ody: `f64` -> Vertical output displacement
23769    /// min: -10000000, max: 10000000, default: 0
23770    pub ody: f64,
23771    /// idx: `f64` -> Horizontal input displacement
23772    /// min: -10000000, max: 10000000, default: 0
23773    pub idx: f64,
23774    /// idy: `f64` -> Vertical input displacement
23775    /// min: -10000000, max: 10000000, default: 0
23776    pub idy: f64,
23777}
23778
23779impl std::default::Default for SimilarityOptions {
23780    fn default() -> Self {
23781        SimilarityOptions {
23782            scale: f64::from(1),
23783            angle: f64::from(0),
23784            interpolate: VipsInterpolate::new(),
23785            background: Vec::new(),
23786            odx: f64::from(0),
23787            ody: f64::from(0),
23788            idx: f64::from(0),
23789            idy: f64::from(0),
23790        }
23791    }
23792}
23793
23794/// VipsSimilarity (similarity), similarity transform of an image
23795/// inp: `&VipsImage` -> Input image argument
23796/// similarity_options: `&SimilarityOptions` -> optional arguments
23797/// returns `VipsImage` - Output image
23798pub fn similarity_with_opts(
23799    inp: &VipsImage,
23800    similarity_options: &SimilarityOptions,
23801) -> Result<VipsImage> {
23802    unsafe {
23803        let inp_in: *mut bindings::VipsImage = inp.ctx;
23804        let mut out_out: *mut bindings::VipsImage = null_mut();
23805
23806        let scale_in: f64 = similarity_options.scale;
23807        let scale_in_name = utils::new_c_string("scale")?;
23808
23809        let angle_in: f64 = similarity_options.angle;
23810        let angle_in_name = utils::new_c_string("angle")?;
23811
23812        let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
23813        let interpolate_in_name = utils::new_c_string("interpolate")?;
23814
23815        let background_wrapper =
23816            utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
23817        let background_in = background_wrapper.ctx;
23818        let background_in_name = utils::new_c_string("background")?;
23819
23820        let odx_in: f64 = similarity_options.odx;
23821        let odx_in_name = utils::new_c_string("odx")?;
23822
23823        let ody_in: f64 = similarity_options.ody;
23824        let ody_in_name = utils::new_c_string("ody")?;
23825
23826        let idx_in: f64 = similarity_options.idx;
23827        let idx_in_name = utils::new_c_string("idx")?;
23828
23829        let idy_in: f64 = similarity_options.idy;
23830        let idy_in_name = utils::new_c_string("idy")?;
23831
23832        let vips_op_response = bindings::vips_similarity(
23833            inp_in,
23834            &mut out_out,
23835            scale_in_name.as_ptr(),
23836            scale_in,
23837            angle_in_name.as_ptr(),
23838            angle_in,
23839            interpolate_in_name.as_ptr(),
23840            interpolate_in,
23841            background_in_name.as_ptr(),
23842            background_in,
23843            odx_in_name.as_ptr(),
23844            odx_in,
23845            ody_in_name.as_ptr(),
23846            ody_in,
23847            idx_in_name.as_ptr(),
23848            idx_in,
23849            idy_in_name.as_ptr(),
23850            idy_in,
23851            NULL,
23852        );
23853        utils::result(
23854            vips_op_response,
23855            VipsImage { ctx: out_out },
23856            Error::SimilarityError,
23857        )
23858    }
23859}
23860
23861/// VipsRotate (rotate), rotate an image by a number of degrees
23862/// inp: `&VipsImage` -> Input image argument
23863/// angle: `f64` -> Rotate anticlockwise by this many degrees
23864/// min: -10000000, max: 10000000, default: 0
23865/// returns `VipsImage` - Output image
23866pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
23867    unsafe {
23868        let inp_in: *mut bindings::VipsImage = inp.ctx;
23869        let angle_in: f64 = angle;
23870        let mut out_out: *mut bindings::VipsImage = null_mut();
23871
23872        let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
23873        utils::result(
23874            vips_op_response,
23875            VipsImage { ctx: out_out },
23876            Error::RotateError,
23877        )
23878    }
23879}
23880
23881/// Options for rotate operation
23882#[derive(Clone, Debug)]
23883pub struct RotateOptions {
23884    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
23885    pub interpolate: VipsInterpolate,
23886    /// background: `Vec<f64>` -> Background value
23887    pub background: Vec<f64>,
23888    /// odx: `f64` -> Horizontal output displacement
23889    /// min: -10000000, max: 10000000, default: 0
23890    pub odx: f64,
23891    /// ody: `f64` -> Vertical output displacement
23892    /// min: -10000000, max: 10000000, default: 0
23893    pub ody: f64,
23894    /// idx: `f64` -> Horizontal input displacement
23895    /// min: -10000000, max: 10000000, default: 0
23896    pub idx: f64,
23897    /// idy: `f64` -> Vertical input displacement
23898    /// min: -10000000, max: 10000000, default: 0
23899    pub idy: f64,
23900}
23901
23902impl std::default::Default for RotateOptions {
23903    fn default() -> Self {
23904        RotateOptions {
23905            interpolate: VipsInterpolate::new(),
23906            background: Vec::new(),
23907            odx: f64::from(0),
23908            ody: f64::from(0),
23909            idx: f64::from(0),
23910            idy: f64::from(0),
23911        }
23912    }
23913}
23914
23915/// VipsRotate (rotate), rotate an image by a number of degrees
23916/// inp: `&VipsImage` -> Input image argument
23917/// angle: `f64` -> Rotate anticlockwise by this many degrees
23918/// min: -10000000, max: 10000000, default: 0
23919/// rotate_options: `&RotateOptions` -> optional arguments
23920/// returns `VipsImage` - Output image
23921pub fn rotate_with_opts(
23922    inp: &VipsImage,
23923    angle: f64,
23924    rotate_options: &RotateOptions,
23925) -> Result<VipsImage> {
23926    unsafe {
23927        let inp_in: *mut bindings::VipsImage = inp.ctx;
23928        let angle_in: f64 = angle;
23929        let mut out_out: *mut bindings::VipsImage = null_mut();
23930
23931        let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
23932        let interpolate_in_name = utils::new_c_string("interpolate")?;
23933
23934        let background_wrapper =
23935            utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
23936        let background_in = background_wrapper.ctx;
23937        let background_in_name = utils::new_c_string("background")?;
23938
23939        let odx_in: f64 = rotate_options.odx;
23940        let odx_in_name = utils::new_c_string("odx")?;
23941
23942        let ody_in: f64 = rotate_options.ody;
23943        let ody_in_name = utils::new_c_string("ody")?;
23944
23945        let idx_in: f64 = rotate_options.idx;
23946        let idx_in_name = utils::new_c_string("idx")?;
23947
23948        let idy_in: f64 = rotate_options.idy;
23949        let idy_in_name = utils::new_c_string("idy")?;
23950
23951        let vips_op_response = bindings::vips_rotate(
23952            inp_in,
23953            &mut out_out,
23954            angle_in,
23955            interpolate_in_name.as_ptr(),
23956            interpolate_in,
23957            background_in_name.as_ptr(),
23958            background_in,
23959            odx_in_name.as_ptr(),
23960            odx_in,
23961            ody_in_name.as_ptr(),
23962            ody_in,
23963            idx_in_name.as_ptr(),
23964            idx_in,
23965            idy_in_name.as_ptr(),
23966            idy_in,
23967            NULL,
23968        );
23969        utils::result(
23970            vips_op_response,
23971            VipsImage { ctx: out_out },
23972            Error::RotateError,
23973        )
23974    }
23975}
23976
23977/// VipsResize (resize), resize an image
23978/// inp: `&VipsImage` -> Input image argument
23979/// scale: `f64` -> Scale image by this factor
23980/// min: 0, max: 10000000, default: 0
23981/// returns `VipsImage` - Output image
23982pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
23983    unsafe {
23984        let inp_in: *mut bindings::VipsImage = inp.ctx;
23985        let scale_in: f64 = scale;
23986        let mut out_out: *mut bindings::VipsImage = null_mut();
23987
23988        let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
23989        utils::result(
23990            vips_op_response,
23991            VipsImage { ctx: out_out },
23992            Error::ResizeError,
23993        )
23994    }
23995}
23996
23997/// Options for resize operation
23998#[derive(Clone, Debug)]
23999pub struct ResizeOptions {
24000    /// kernel: `Kernel` -> Resampling kernel
24001    ///  `Nearest` -> VIPS_KERNEL_NEAREST = 0
24002    ///  `Linear` -> VIPS_KERNEL_LINEAR = 1
24003    ///  `Cubic` -> VIPS_KERNEL_CUBIC = 2
24004    ///  `Mitchell` -> VIPS_KERNEL_MITCHELL = 3
24005    ///  `Lanczos2` -> VIPS_KERNEL_LANCZOS2 = 4
24006    ///  `Lanczos3` -> VIPS_KERNEL_LANCZOS3 = 5 [DEFAULT]
24007    ///  `Last` -> VIPS_KERNEL_LAST = 6
24008    pub kernel: Kernel,
24009    /// gap: `f64` -> Reducing gap
24010    /// min: 0, max: 1000000, default: 2
24011    pub gap: f64,
24012    /// vscale: `f64` -> Vertical scale image by this factor
24013    /// min: 0, max: 10000000, default: 0
24014    pub vscale: f64,
24015}
24016
24017impl std::default::Default for ResizeOptions {
24018    fn default() -> Self {
24019        ResizeOptions {
24020            kernel: Kernel::Lanczos3,
24021            gap: f64::from(2),
24022            vscale: f64::from(0),
24023        }
24024    }
24025}
24026
24027/// VipsResize (resize), resize an image
24028/// inp: `&VipsImage` -> Input image argument
24029/// scale: `f64` -> Scale image by this factor
24030/// min: 0, max: 10000000, default: 0
24031/// resize_options: `&ResizeOptions` -> optional arguments
24032/// returns `VipsImage` - Output image
24033pub fn resize_with_opts(
24034    inp: &VipsImage,
24035    scale: f64,
24036    resize_options: &ResizeOptions,
24037) -> Result<VipsImage> {
24038    unsafe {
24039        let inp_in: *mut bindings::VipsImage = inp.ctx;
24040        let scale_in: f64 = scale;
24041        let mut out_out: *mut bindings::VipsImage = null_mut();
24042
24043        let kernel_in: i32 = resize_options.kernel as i32;
24044        let kernel_in_name = utils::new_c_string("kernel")?;
24045
24046        let gap_in: f64 = resize_options.gap;
24047        let gap_in_name = utils::new_c_string("gap")?;
24048
24049        let vscale_in: f64 = resize_options.vscale;
24050        let vscale_in_name = utils::new_c_string("vscale")?;
24051
24052        let vips_op_response = bindings::vips_resize(
24053            inp_in,
24054            &mut out_out,
24055            scale_in,
24056            kernel_in_name.as_ptr(),
24057            kernel_in,
24058            gap_in_name.as_ptr(),
24059            gap_in,
24060            vscale_in_name.as_ptr(),
24061            vscale_in,
24062            NULL,
24063        );
24064        utils::result(
24065            vips_op_response,
24066            VipsImage { ctx: out_out },
24067            Error::ResizeError,
24068        )
24069    }
24070}
24071
24072/// VipsColourspace (colourspace), convert to a new colorspace
24073/// inp: `&VipsImage` -> Input image
24074/// space: `Interpretation` -> Destination color space
24075///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
24076///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
24077///  `BW` -> VIPS_INTERPRETATION_B_W = 1
24078///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
24079///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
24080///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
24081///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
24082///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
24083///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
24084///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
24085///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
24086///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
24087///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
24088///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
24089///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
24090///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
24091///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
24092///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
24093///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
24094///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
24095///  `Last` -> VIPS_INTERPRETATION_LAST = 30
24096/// returns `VipsImage` - Output image
24097pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
24098    unsafe {
24099        let inp_in: *mut bindings::VipsImage = inp.ctx;
24100        let space_in: i32 = space as i32;
24101        let mut out_out: *mut bindings::VipsImage = null_mut();
24102
24103        let vips_op_response =
24104            bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
24105        utils::result(
24106            vips_op_response,
24107            VipsImage { ctx: out_out },
24108            Error::ColourspaceError,
24109        )
24110    }
24111}
24112
24113/// Options for colourspace operation
24114#[derive(Clone, Debug)]
24115pub struct ColourspaceOptions {
24116    /// source_space: `Interpretation` -> Source color space
24117    ///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
24118    ///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
24119    ///  `BW` -> VIPS_INTERPRETATION_B_W = 1
24120    ///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
24121    ///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
24122    ///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
24123    ///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
24124    ///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
24125    ///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
24126    ///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
24127    ///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
24128    ///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
24129    ///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
24130    ///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
24131    ///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
24132    ///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
24133    ///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
24134    ///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
24135    ///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
24136    ///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
24137    ///  `Last` -> VIPS_INTERPRETATION_LAST = 30
24138    pub source_space: Interpretation,
24139}
24140
24141impl std::default::Default for ColourspaceOptions {
24142    fn default() -> Self {
24143        ColourspaceOptions {
24144            source_space: Interpretation::Srgb,
24145        }
24146    }
24147}
24148
24149/// VipsColourspace (colourspace), convert to a new colorspace
24150/// inp: `&VipsImage` -> Input image
24151/// space: `Interpretation` -> Destination color space
24152///  `Error` -> VIPS_INTERPRETATION_ERROR = -1
24153///  `Multiband` -> VIPS_INTERPRETATION_MULTIBAND = 0
24154///  `BW` -> VIPS_INTERPRETATION_B_W = 1
24155///  `Histogram` -> VIPS_INTERPRETATION_HISTOGRAM = 10
24156///  `Xyz` -> VIPS_INTERPRETATION_XYZ = 12
24157///  `Lab` -> VIPS_INTERPRETATION_LAB = 13
24158///  `Cmyk` -> VIPS_INTERPRETATION_CMYK = 15
24159///  `Labq` -> VIPS_INTERPRETATION_LABQ = 16
24160///  `Rgb` -> VIPS_INTERPRETATION_RGB = 17
24161///  `Cmc` -> VIPS_INTERPRETATION_CMC = 18
24162///  `Lch` -> VIPS_INTERPRETATION_LCH = 19
24163///  `Lab` -> VIPS_INTERPRETATION_LABS = 21
24164///  `Srgb` -> VIPS_INTERPRETATION_sRGB = 22 [DEFAULT]
24165///  `Yxy` -> VIPS_INTERPRETATION_YXY = 23
24166///  `Fourier` -> VIPS_INTERPRETATION_FOURIER = 24
24167///  `Rgb16` -> VIPS_INTERPRETATION_RGB16 = 25
24168///  `Grey16` -> VIPS_INTERPRETATION_GREY16 = 26
24169///  `Matrix` -> VIPS_INTERPRETATION_MATRIX = 27
24170///  `Scrgb` -> VIPS_INTERPRETATION_scRGB = 28
24171///  `Hsv` -> VIPS_INTERPRETATION_HSV = 29
24172///  `Last` -> VIPS_INTERPRETATION_LAST = 30
24173/// colourspace_options: `&ColourspaceOptions` -> optional arguments
24174/// returns `VipsImage` - Output image
24175pub fn colourspace_with_opts(
24176    inp: &VipsImage,
24177    space: Interpretation,
24178    colourspace_options: &ColourspaceOptions,
24179) -> Result<VipsImage> {
24180    unsafe {
24181        let inp_in: *mut bindings::VipsImage = inp.ctx;
24182        let space_in: i32 = space as i32;
24183        let mut out_out: *mut bindings::VipsImage = null_mut();
24184
24185        let source_space_in: i32 = colourspace_options.source_space as i32;
24186        let source_space_in_name = utils::new_c_string("source-space")?;
24187
24188        let vips_op_response = bindings::vips_colourspace(
24189            inp_in,
24190            &mut out_out,
24191            space_in.try_into().unwrap(),
24192            source_space_in_name.as_ptr(),
24193            source_space_in,
24194            NULL,
24195        );
24196        utils::result(
24197            vips_op_response,
24198            VipsImage { ctx: out_out },
24199            Error::ColourspaceError,
24200        )
24201    }
24202}
24203
24204/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
24205/// inp: `&VipsImage` -> Input image
24206/// returns `VipsImage` - Output image
24207pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
24208    unsafe {
24209        let inp_in: *mut bindings::VipsImage = inp.ctx;
24210        let mut out_out: *mut bindings::VipsImage = null_mut();
24211
24212        let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
24213        utils::result(
24214            vips_op_response,
24215            VipsImage { ctx: out_out },
24216            Error::Lab2XyzError,
24217        )
24218    }
24219}
24220
24221/// Options for lab_2xyz operation
24222#[derive(Clone, Debug)]
24223pub struct Lab2XyzOptions {
24224    /// temp: `Vec<f64>` -> Color temperature
24225    pub temp: Vec<f64>,
24226}
24227
24228impl std::default::Default for Lab2XyzOptions {
24229    fn default() -> Self {
24230        Lab2XyzOptions { temp: Vec::new() }
24231    }
24232}
24233
24234/// VipsLab2XYZ (Lab2XYZ), transform CIELAB to XYZ
24235/// inp: `&VipsImage` -> Input image
24236/// lab_2xyz_options: `&Lab2XyzOptions` -> optional arguments
24237/// returns `VipsImage` - Output image
24238pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
24239    unsafe {
24240        let inp_in: *mut bindings::VipsImage = inp.ctx;
24241        let mut out_out: *mut bindings::VipsImage = null_mut();
24242
24243        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
24244        let temp_in = temp_wrapper.ctx;
24245        let temp_in_name = utils::new_c_string("temp")?;
24246
24247        let vips_op_response =
24248            bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
24249        utils::result(
24250            vips_op_response,
24251            VipsImage { ctx: out_out },
24252            Error::Lab2XyzError,
24253        )
24254    }
24255}
24256
24257/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
24258/// inp: `&VipsImage` -> Input image
24259/// returns `VipsImage` - Output image
24260pub fn xyz2_lab(inp: &VipsImage) -> 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 vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
24266        utils::result(
24267            vips_op_response,
24268            VipsImage { ctx: out_out },
24269            Error::Xyz2LabError,
24270        )
24271    }
24272}
24273
24274/// Options for xyz2_lab operation
24275#[derive(Clone, Debug)]
24276pub struct Xyz2LabOptions {
24277    /// temp: `Vec<f64>` -> Colour temperature
24278    pub temp: Vec<f64>,
24279}
24280
24281impl std::default::Default for Xyz2LabOptions {
24282    fn default() -> Self {
24283        Xyz2LabOptions { temp: Vec::new() }
24284    }
24285}
24286
24287/// VipsXYZ2Lab (XYZ2Lab), transform XYZ to Lab
24288/// inp: `&VipsImage` -> Input image
24289/// xyz2_lab_options: `&Xyz2LabOptions` -> optional arguments
24290/// returns `VipsImage` - Output image
24291pub fn xyz2_lab_with_opts(
24292    inp: &VipsImage,
24293    xyz_2_lab_options: &Xyz2LabOptions,
24294) -> Result<VipsImage> {
24295    unsafe {
24296        let inp_in: *mut bindings::VipsImage = inp.ctx;
24297        let mut out_out: *mut bindings::VipsImage = null_mut();
24298
24299        let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
24300        let temp_in = temp_wrapper.ctx;
24301        let temp_in_name = utils::new_c_string("temp")?;
24302
24303        let vips_op_response =
24304            bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
24305        utils::result(
24306            vips_op_response,
24307            VipsImage { ctx: out_out },
24308            Error::Xyz2LabError,
24309        )
24310    }
24311}
24312
24313/// VipsLab2LCh (Lab2LCh), transform Lab to LCh
24314/// inp: `&VipsImage` -> Input image
24315/// returns `VipsImage` - Output image
24316pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
24317    unsafe {
24318        let inp_in: *mut bindings::VipsImage = inp.ctx;
24319        let mut out_out: *mut bindings::VipsImage = null_mut();
24320
24321        let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
24322        utils::result(
24323            vips_op_response,
24324            VipsImage { ctx: out_out },
24325            Error::Lab2LChError,
24326        )
24327    }
24328}
24329
24330/// VipsLCh2Lab (LCh2Lab), transform LCh to Lab
24331/// inp: `&VipsImage` -> Input image
24332/// returns `VipsImage` - Output image
24333pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
24334    unsafe {
24335        let inp_in: *mut bindings::VipsImage = inp.ctx;
24336        let mut out_out: *mut bindings::VipsImage = null_mut();
24337
24338        let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
24339        utils::result(
24340            vips_op_response,
24341            VipsImage { ctx: out_out },
24342            Error::LCh2LabError,
24343        )
24344    }
24345}
24346
24347/// VipsLCh2CMC (LCh2CMC), transform LCh to CMC
24348/// inp: `&VipsImage` -> Input image
24349/// returns `VipsImage` - Output image
24350pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
24351    unsafe {
24352        let inp_in: *mut bindings::VipsImage = inp.ctx;
24353        let mut out_out: *mut bindings::VipsImage = null_mut();
24354
24355        let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
24356        utils::result(
24357            vips_op_response,
24358            VipsImage { ctx: out_out },
24359            Error::LCh2CmcError,
24360        )
24361    }
24362}
24363
24364/// VipsCMC2LCh (CMC2LCh), transform LCh to CMC
24365/// inp: `&VipsImage` -> Input image
24366/// returns `VipsImage` - Output image
24367pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
24368    unsafe {
24369        let inp_in: *mut bindings::VipsImage = inp.ctx;
24370        let mut out_out: *mut bindings::VipsImage = null_mut();
24371
24372        let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
24373        utils::result(
24374            vips_op_response,
24375            VipsImage { ctx: out_out },
24376            Error::Cmc2LChError,
24377        )
24378    }
24379}
24380
24381/// VipsXYZ2Yxy (XYZ2Yxy), transform XYZ to Yxy
24382/// inp: `&VipsImage` -> Input image
24383/// returns `VipsImage` - Output image
24384pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
24385    unsafe {
24386        let inp_in: *mut bindings::VipsImage = inp.ctx;
24387        let mut out_out: *mut bindings::VipsImage = null_mut();
24388
24389        let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
24390        utils::result(
24391            vips_op_response,
24392            VipsImage { ctx: out_out },
24393            Error::Xyz2YxyError,
24394        )
24395    }
24396}
24397
24398/// VipsYxy2XYZ (Yxy2XYZ), transform Yxy to XYZ
24399/// inp: `&VipsImage` -> Input image
24400/// returns `VipsImage` - Output image
24401pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
24402    unsafe {
24403        let inp_in: *mut bindings::VipsImage = inp.ctx;
24404        let mut out_out: *mut bindings::VipsImage = null_mut();
24405
24406        let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
24407        utils::result(
24408            vips_op_response,
24409            VipsImage { ctx: out_out },
24410            Error::Yxy2XyzError,
24411        )
24412    }
24413}
24414
24415/// VipsLabQ2Lab (LabQ2Lab), unpack a LabQ image to float Lab
24416/// inp: `&VipsImage` -> Input image
24417/// returns `VipsImage` - Output image
24418pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
24419    unsafe {
24420        let inp_in: *mut bindings::VipsImage = inp.ctx;
24421        let mut out_out: *mut bindings::VipsImage = null_mut();
24422
24423        let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
24424        utils::result(
24425            vips_op_response,
24426            VipsImage { ctx: out_out },
24427            Error::LabQ2LabError,
24428        )
24429    }
24430}
24431
24432/// VipsLab2LabQ (Lab2LabQ), transform float Lab to LabQ coding
24433/// inp: `&VipsImage` -> Input image
24434/// returns `VipsImage` - Output image
24435pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
24436    unsafe {
24437        let inp_in: *mut bindings::VipsImage = inp.ctx;
24438        let mut out_out: *mut bindings::VipsImage = null_mut();
24439
24440        let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
24441        utils::result(
24442            vips_op_response,
24443            VipsImage { ctx: out_out },
24444            Error::Lab2LabQError,
24445        )
24446    }
24447}
24448
24449/// VipsLabQ2LabS (LabQ2LabS), unpack a LabQ image to short Lab
24450/// inp: `&VipsImage` -> Input image
24451/// returns `VipsImage` - Output image
24452pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
24453    unsafe {
24454        let inp_in: *mut bindings::VipsImage = inp.ctx;
24455        let mut out_out: *mut bindings::VipsImage = null_mut();
24456
24457        let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
24458        utils::result(
24459            vips_op_response,
24460            VipsImage { ctx: out_out },
24461            Error::LabQ2LabSError,
24462        )
24463    }
24464}
24465
24466/// VipsLabS2LabQ (LabS2LabQ), transform short Lab to LabQ coding
24467/// inp: `&VipsImage` -> Input image
24468/// returns `VipsImage` - Output image
24469pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
24470    unsafe {
24471        let inp_in: *mut bindings::VipsImage = inp.ctx;
24472        let mut out_out: *mut bindings::VipsImage = null_mut();
24473
24474        let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
24475        utils::result(
24476            vips_op_response,
24477            VipsImage { ctx: out_out },
24478            Error::LabS2LabQError,
24479        )
24480    }
24481}
24482
24483/// VipsLabS2Lab (LabS2Lab), transform signed short Lab to float
24484/// inp: `&VipsImage` -> Input image
24485/// returns `VipsImage` - Output image
24486pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
24487    unsafe {
24488        let inp_in: *mut bindings::VipsImage = inp.ctx;
24489        let mut out_out: *mut bindings::VipsImage = null_mut();
24490
24491        let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
24492        utils::result(
24493            vips_op_response,
24494            VipsImage { ctx: out_out },
24495            Error::LabS2LabError,
24496        )
24497    }
24498}
24499
24500/// VipsLab2LabS (Lab2LabS), transform float Lab to signed short
24501/// inp: `&VipsImage` -> Input image
24502/// returns `VipsImage` - Output image
24503pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
24504    unsafe {
24505        let inp_in: *mut bindings::VipsImage = inp.ctx;
24506        let mut out_out: *mut bindings::VipsImage = null_mut();
24507
24508        let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
24509        utils::result(
24510            vips_op_response,
24511            VipsImage { ctx: out_out },
24512            Error::Lab2LabSError,
24513        )
24514    }
24515}
24516
24517/// VipsRad2float (rad2float), unpack Radiance coding to float RGB
24518/// inp: `&VipsImage` -> Input image
24519/// returns `VipsImage` - Output image
24520pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
24521    unsafe {
24522        let inp_in: *mut bindings::VipsImage = inp.ctx;
24523        let mut out_out: *mut bindings::VipsImage = null_mut();
24524
24525        let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
24526        utils::result(
24527            vips_op_response,
24528            VipsImage { ctx: out_out },
24529            Error::Rad2FloatError,
24530        )
24531    }
24532}
24533
24534/// VipsFloat2rad (float2rad), transform float RGB to Radiance coding
24535/// inp: `&VipsImage` -> Input image
24536/// returns `VipsImage` - Output image
24537pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
24538    unsafe {
24539        let inp_in: *mut bindings::VipsImage = inp.ctx;
24540        let mut out_out: *mut bindings::VipsImage = null_mut();
24541
24542        let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
24543        utils::result(
24544            vips_op_response,
24545            VipsImage { ctx: out_out },
24546            Error::Float2RadError,
24547        )
24548    }
24549}
24550
24551/// VipsLabQ2sRGB (LabQ2sRGB), convert a LabQ image to sRGB
24552/// inp: `&VipsImage` -> Input image
24553/// returns `VipsImage` - Output image
24554pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
24555    unsafe {
24556        let inp_in: *mut bindings::VipsImage = inp.ctx;
24557        let mut out_out: *mut bindings::VipsImage = null_mut();
24558
24559        let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
24560        utils::result(
24561            vips_op_response,
24562            VipsImage { ctx: out_out },
24563            Error::LabQ2SRgbError,
24564        )
24565    }
24566}
24567
24568/// VipssRGB2HSV (sRGB2HSV), transform sRGB to HSV
24569/// inp: `&VipsImage` -> Input image
24570/// returns `VipsImage` - Output image
24571pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
24572    unsafe {
24573        let inp_in: *mut bindings::VipsImage = inp.ctx;
24574        let mut out_out: *mut bindings::VipsImage = null_mut();
24575
24576        let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
24577        utils::result(
24578            vips_op_response,
24579            VipsImage { ctx: out_out },
24580            Error::SRgb2HsvError,
24581        )
24582    }
24583}
24584
24585/// VipsHSV2sRGB (HSV2sRGB), transform HSV to sRGB
24586/// inp: `&VipsImage` -> Input image
24587/// returns `VipsImage` - Output image
24588pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
24589    unsafe {
24590        let inp_in: *mut bindings::VipsImage = inp.ctx;
24591        let mut out_out: *mut bindings::VipsImage = null_mut();
24592
24593        let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
24594        utils::result(
24595            vips_op_response,
24596            VipsImage { ctx: out_out },
24597            Error::Hsv2SRgbError,
24598        )
24599    }
24600}
24601
24602/// VipsIccImport (icc_import), import from device with ICC profile
24603/// inp: `&VipsImage` -> Input image
24604/// returns `VipsImage` - Output image
24605pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
24606    unsafe {
24607        let inp_in: *mut bindings::VipsImage = inp.ctx;
24608        let mut out_out: *mut bindings::VipsImage = null_mut();
24609
24610        let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
24611        utils::result(
24612            vips_op_response,
24613            VipsImage { ctx: out_out },
24614            Error::IccImportError,
24615        )
24616    }
24617}
24618
24619/// Options for icc_import operation
24620#[derive(Clone, Debug)]
24621pub struct IccImportOptions {
24622    /// pcs: `PCS` -> Set Profile Connection Space
24623    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
24624    ///  `Xyz` -> VIPS_PCS_XYZ = 1
24625    ///  `Last` -> VIPS_PCS_LAST = 2
24626    pub pcs: PCS,
24627    /// intent: `Intent` -> Rendering intent
24628    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
24629    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
24630    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
24631    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
24632    ///  `Last` -> VIPS_INTENT_LAST = 4
24633    pub intent: Intent,
24634    /// black_point_compensation: `bool` -> Enable black point compensation
24635    /// default: false
24636    pub black_point_compensation: bool,
24637    /// embedded: `bool` -> Use embedded input profile, if available
24638    /// default: false
24639    pub embedded: bool,
24640    /// input_profile: `String` -> Filename to load input profile from
24641    pub input_profile: String,
24642}
24643
24644impl std::default::Default for IccImportOptions {
24645    fn default() -> Self {
24646        IccImportOptions {
24647            pcs: PCS::Lab,
24648            intent: Intent::Relative,
24649            black_point_compensation: false,
24650            embedded: false,
24651            input_profile: String::new(),
24652        }
24653    }
24654}
24655
24656/// VipsIccImport (icc_import), import from device with ICC profile
24657/// inp: `&VipsImage` -> Input image
24658/// icc_import_options: `&IccImportOptions` -> optional arguments
24659/// returns `VipsImage` - Output image
24660pub fn icc_import_with_opts(
24661    inp: &VipsImage,
24662    icc_import_options: &IccImportOptions,
24663) -> Result<VipsImage> {
24664    unsafe {
24665        let inp_in: *mut bindings::VipsImage = inp.ctx;
24666        let mut out_out: *mut bindings::VipsImage = null_mut();
24667
24668        let pcs_in: i32 = icc_import_options.pcs as i32;
24669        let pcs_in_name = utils::new_c_string("pcs")?;
24670
24671        let intent_in: i32 = icc_import_options.intent as i32;
24672        let intent_in_name = utils::new_c_string("intent")?;
24673
24674        let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
24675            1
24676        } else {
24677            0
24678        };
24679        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24680
24681        let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
24682        let embedded_in_name = utils::new_c_string("embedded")?;
24683
24684        let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
24685        let input_profile_in_name = utils::new_c_string("input-profile")?;
24686
24687        let vips_op_response = bindings::vips_icc_import(
24688            inp_in,
24689            &mut out_out,
24690            pcs_in_name.as_ptr(),
24691            pcs_in,
24692            intent_in_name.as_ptr(),
24693            intent_in,
24694            black_point_compensation_in_name.as_ptr(),
24695            black_point_compensation_in,
24696            embedded_in_name.as_ptr(),
24697            embedded_in,
24698            input_profile_in_name.as_ptr(),
24699            input_profile_in.as_ptr(),
24700            NULL,
24701        );
24702        utils::result(
24703            vips_op_response,
24704            VipsImage { ctx: out_out },
24705            Error::IccImportError,
24706        )
24707    }
24708}
24709
24710/// VipsIccExport (icc_export), output to device with ICC profile
24711/// inp: `&VipsImage` -> Input image
24712/// returns `VipsImage` - Output image
24713pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
24714    unsafe {
24715        let inp_in: *mut bindings::VipsImage = inp.ctx;
24716        let mut out_out: *mut bindings::VipsImage = null_mut();
24717
24718        let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
24719        utils::result(
24720            vips_op_response,
24721            VipsImage { ctx: out_out },
24722            Error::IccExportError,
24723        )
24724    }
24725}
24726
24727/// Options for icc_export operation
24728#[derive(Clone, Debug)]
24729pub struct IccExportOptions {
24730    /// pcs: `PCS` -> Set Profile Connection Space
24731    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
24732    ///  `Xyz` -> VIPS_PCS_XYZ = 1
24733    ///  `Last` -> VIPS_PCS_LAST = 2
24734    pub pcs: PCS,
24735    /// intent: `Intent` -> Rendering intent
24736    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
24737    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
24738    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
24739    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
24740    ///  `Last` -> VIPS_INTENT_LAST = 4
24741    pub intent: Intent,
24742    /// black_point_compensation: `bool` -> Enable black point compensation
24743    /// default: false
24744    pub black_point_compensation: bool,
24745    /// output_profile: `String` -> Filename to load output profile from
24746    pub output_profile: String,
24747    /// depth: `i32` -> Output device space depth in bits
24748    /// min: 8, max: 16, default: 8
24749    pub depth: i32,
24750}
24751
24752impl std::default::Default for IccExportOptions {
24753    fn default() -> Self {
24754        IccExportOptions {
24755            pcs: PCS::Lab,
24756            intent: Intent::Relative,
24757            black_point_compensation: false,
24758            output_profile: String::new(),
24759            depth: i32::from(8),
24760        }
24761    }
24762}
24763
24764/// VipsIccExport (icc_export), output to device with ICC profile
24765/// inp: `&VipsImage` -> Input image
24766/// icc_export_options: `&IccExportOptions` -> optional arguments
24767/// returns `VipsImage` - Output image
24768pub fn icc_export_with_opts(
24769    inp: &VipsImage,
24770    icc_export_options: &IccExportOptions,
24771) -> Result<VipsImage> {
24772    unsafe {
24773        let inp_in: *mut bindings::VipsImage = inp.ctx;
24774        let mut out_out: *mut bindings::VipsImage = null_mut();
24775
24776        let pcs_in: i32 = icc_export_options.pcs as i32;
24777        let pcs_in_name = utils::new_c_string("pcs")?;
24778
24779        let intent_in: i32 = icc_export_options.intent as i32;
24780        let intent_in_name = utils::new_c_string("intent")?;
24781
24782        let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
24783            1
24784        } else {
24785            0
24786        };
24787        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24788
24789        let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
24790        let output_profile_in_name = utils::new_c_string("output-profile")?;
24791
24792        let depth_in: i32 = icc_export_options.depth;
24793        let depth_in_name = utils::new_c_string("depth")?;
24794
24795        let vips_op_response = bindings::vips_icc_export(
24796            inp_in,
24797            &mut out_out,
24798            pcs_in_name.as_ptr(),
24799            pcs_in,
24800            intent_in_name.as_ptr(),
24801            intent_in,
24802            black_point_compensation_in_name.as_ptr(),
24803            black_point_compensation_in,
24804            output_profile_in_name.as_ptr(),
24805            output_profile_in.as_ptr(),
24806            depth_in_name.as_ptr(),
24807            depth_in,
24808            NULL,
24809        );
24810        utils::result(
24811            vips_op_response,
24812            VipsImage { ctx: out_out },
24813            Error::IccExportError,
24814        )
24815    }
24816}
24817
24818/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
24819/// inp: `&VipsImage` -> Input image
24820/// output_profile: `&str` -> Filename to load output profile from
24821/// returns `VipsImage` - Output image
24822pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
24823    unsafe {
24824        let inp_in: *mut bindings::VipsImage = inp.ctx;
24825        let output_profile_in: CString = utils::new_c_string(output_profile)?;
24826        let mut out_out: *mut bindings::VipsImage = null_mut();
24827
24828        let vips_op_response =
24829            bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
24830        utils::result(
24831            vips_op_response,
24832            VipsImage { ctx: out_out },
24833            Error::IccTransformError,
24834        )
24835    }
24836}
24837
24838/// Options for icc_transform operation
24839#[derive(Clone, Debug)]
24840pub struct IccTransformOptions {
24841    /// pcs: `PCS` -> Set Profile Connection Space
24842    ///  `Lab` -> VIPS_PCS_LAB = 0 [DEFAULT]
24843    ///  `Xyz` -> VIPS_PCS_XYZ = 1
24844    ///  `Last` -> VIPS_PCS_LAST = 2
24845    pub pcs: PCS,
24846    /// intent: `Intent` -> Rendering intent
24847    ///  `Perceptual` -> VIPS_INTENT_PERCEPTUAL = 0
24848    ///  `Relative` -> VIPS_INTENT_RELATIVE = 1 [DEFAULT]
24849    ///  `Saturation` -> VIPS_INTENT_SATURATION = 2
24850    ///  `Absolute` -> VIPS_INTENT_ABSOLUTE = 3
24851    ///  `Last` -> VIPS_INTENT_LAST = 4
24852    pub intent: Intent,
24853    /// black_point_compensation: `bool` -> Enable black point compensation
24854    /// default: false
24855    pub black_point_compensation: bool,
24856    /// embedded: `bool` -> Use embedded input profile, if available
24857    /// default: false
24858    pub embedded: bool,
24859    /// input_profile: `String` -> Filename to load input profile from
24860    pub input_profile: String,
24861    /// depth: `i32` -> Output device space depth in bits
24862    /// min: 8, max: 16, default: 8
24863    pub depth: i32,
24864}
24865
24866impl std::default::Default for IccTransformOptions {
24867    fn default() -> Self {
24868        IccTransformOptions {
24869            pcs: PCS::Lab,
24870            intent: Intent::Relative,
24871            black_point_compensation: false,
24872            embedded: false,
24873            input_profile: String::new(),
24874            depth: i32::from(8),
24875        }
24876    }
24877}
24878
24879/// VipsIccTransform (icc_transform), transform between devices with ICC profiles
24880/// inp: `&VipsImage` -> Input image
24881/// output_profile: `&str` -> Filename to load output profile from
24882/// icc_transform_options: `&IccTransformOptions` -> optional arguments
24883/// returns `VipsImage` - Output image
24884pub fn icc_transform_with_opts(
24885    inp: &VipsImage,
24886    output_profile: &str,
24887    icc_transform_options: &IccTransformOptions,
24888) -> Result<VipsImage> {
24889    unsafe {
24890        let inp_in: *mut bindings::VipsImage = inp.ctx;
24891        let output_profile_in: CString = utils::new_c_string(output_profile)?;
24892        let mut out_out: *mut bindings::VipsImage = null_mut();
24893
24894        let pcs_in: i32 = icc_transform_options.pcs as i32;
24895        let pcs_in_name = utils::new_c_string("pcs")?;
24896
24897        let intent_in: i32 = icc_transform_options.intent as i32;
24898        let intent_in_name = utils::new_c_string("intent")?;
24899
24900        let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
24901            1
24902        } else {
24903            0
24904        };
24905        let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24906
24907        let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
24908        let embedded_in_name = utils::new_c_string("embedded")?;
24909
24910        let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
24911        let input_profile_in_name = utils::new_c_string("input-profile")?;
24912
24913        let depth_in: i32 = icc_transform_options.depth;
24914        let depth_in_name = utils::new_c_string("depth")?;
24915
24916        let vips_op_response = bindings::vips_icc_transform(
24917            inp_in,
24918            &mut out_out,
24919            output_profile_in.as_ptr(),
24920            pcs_in_name.as_ptr(),
24921            pcs_in,
24922            intent_in_name.as_ptr(),
24923            intent_in,
24924            black_point_compensation_in_name.as_ptr(),
24925            black_point_compensation_in,
24926            embedded_in_name.as_ptr(),
24927            embedded_in,
24928            input_profile_in_name.as_ptr(),
24929            input_profile_in.as_ptr(),
24930            depth_in_name.as_ptr(),
24931            depth_in,
24932            NULL,
24933        );
24934        utils::result(
24935            vips_op_response,
24936            VipsImage { ctx: out_out },
24937            Error::IccTransformError,
24938        )
24939    }
24940}
24941
24942/// VipsdE76 (dE76), calculate dE76
24943/// left: `&VipsImage` -> Left-hand input image
24944/// right: `&VipsImage` -> Right-hand input image
24945/// returns `VipsImage` - Output image
24946pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24947    unsafe {
24948        let left_in: *mut bindings::VipsImage = left.ctx;
24949        let right_in: *mut bindings::VipsImage = right.ctx;
24950        let mut out_out: *mut bindings::VipsImage = null_mut();
24951
24952        let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
24953        utils::result(
24954            vips_op_response,
24955            VipsImage { ctx: out_out },
24956            Error::DE76Error,
24957        )
24958    }
24959}
24960
24961/// VipsdE00 (dE00), calculate dE00
24962/// left: `&VipsImage` -> Left-hand input image
24963/// right: `&VipsImage` -> Right-hand input image
24964/// returns `VipsImage` - Output image
24965pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24966    unsafe {
24967        let left_in: *mut bindings::VipsImage = left.ctx;
24968        let right_in: *mut bindings::VipsImage = right.ctx;
24969        let mut out_out: *mut bindings::VipsImage = null_mut();
24970
24971        let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
24972        utils::result(
24973            vips_op_response,
24974            VipsImage { ctx: out_out },
24975            Error::DE00Error,
24976        )
24977    }
24978}
24979
24980/// VipsdECMC (dECMC), calculate dECMC
24981/// left: `&VipsImage` -> Left-hand input image
24982/// right: `&VipsImage` -> Right-hand input image
24983/// returns `VipsImage` - Output image
24984pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24985    unsafe {
24986        let left_in: *mut bindings::VipsImage = left.ctx;
24987        let right_in: *mut bindings::VipsImage = right.ctx;
24988        let mut out_out: *mut bindings::VipsImage = null_mut();
24989
24990        let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
24991        utils::result(
24992            vips_op_response,
24993            VipsImage { ctx: out_out },
24994            Error::DEcmcError,
24995        )
24996    }
24997}
24998
24999/// VipssRGB2scRGB (sRGB2scRGB), convert an sRGB image to scRGB
25000/// inp: `&VipsImage` -> Input image
25001/// returns `VipsImage` - Output image
25002pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
25003    unsafe {
25004        let inp_in: *mut bindings::VipsImage = inp.ctx;
25005        let mut out_out: *mut bindings::VipsImage = null_mut();
25006
25007        let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
25008        utils::result(
25009            vips_op_response,
25010            VipsImage { ctx: out_out },
25011            Error::SRgb2ScRgbError,
25012        )
25013    }
25014}
25015
25016/// VipsscRGB2XYZ (scRGB2XYZ), transform scRGB to XYZ
25017/// inp: `&VipsImage` -> Input image
25018/// returns `VipsImage` - Output image
25019pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
25020    unsafe {
25021        let inp_in: *mut bindings::VipsImage = inp.ctx;
25022        let mut out_out: *mut bindings::VipsImage = null_mut();
25023
25024        let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
25025        utils::result(
25026            vips_op_response,
25027            VipsImage { ctx: out_out },
25028            Error::ScRgb2XyzError,
25029        )
25030    }
25031}
25032
25033/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
25034/// inp: `&VipsImage` -> Input image
25035/// returns `VipsImage` - Output image
25036pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
25037    unsafe {
25038        let inp_in: *mut bindings::VipsImage = inp.ctx;
25039        let mut out_out: *mut bindings::VipsImage = null_mut();
25040
25041        let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
25042        utils::result(
25043            vips_op_response,
25044            VipsImage { ctx: out_out },
25045            Error::ScRgb2BwError,
25046        )
25047    }
25048}
25049
25050/// Options for sc_rgb2bw operation
25051#[derive(Clone, Debug)]
25052pub struct ScRgb2BwOptions {
25053    /// depth: `i32` -> Output device space depth in bits
25054    /// min: 8, max: 16, default: 8
25055    pub depth: i32,
25056}
25057
25058impl std::default::Default for ScRgb2BwOptions {
25059    fn default() -> Self {
25060        ScRgb2BwOptions {
25061            depth: i32::from(8),
25062        }
25063    }
25064}
25065
25066/// VipsscRGB2BW (scRGB2BW), convert scRGB to BW
25067/// inp: `&VipsImage` -> Input image
25068/// sc_rgb2bw_options: `&ScRgb2BwOptions` -> optional arguments
25069/// returns `VipsImage` - Output image
25070pub fn sc_rgb2bw_with_opts(
25071    inp: &VipsImage,
25072    sc_rgb_2bw_options: &ScRgb2BwOptions,
25073) -> Result<VipsImage> {
25074    unsafe {
25075        let inp_in: *mut bindings::VipsImage = inp.ctx;
25076        let mut out_out: *mut bindings::VipsImage = null_mut();
25077
25078        let depth_in: i32 = sc_rgb_2bw_options.depth;
25079        let depth_in_name = utils::new_c_string("depth")?;
25080
25081        let vips_op_response =
25082            bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
25083        utils::result(
25084            vips_op_response,
25085            VipsImage { ctx: out_out },
25086            Error::ScRgb2BwError,
25087        )
25088    }
25089}
25090
25091/// VipsXYZ2scRGB (XYZ2scRGB), transform XYZ to scRGB
25092/// inp: `&VipsImage` -> Input image
25093/// returns `VipsImage` - Output image
25094pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
25095    unsafe {
25096        let inp_in: *mut bindings::VipsImage = inp.ctx;
25097        let mut out_out: *mut bindings::VipsImage = null_mut();
25098
25099        let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
25100        utils::result(
25101            vips_op_response,
25102            VipsImage { ctx: out_out },
25103            Error::Xyz2ScRgbError,
25104        )
25105    }
25106}
25107
25108/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
25109/// inp: `&VipsImage` -> Input image
25110/// returns `VipsImage` - Output image
25111pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
25112    unsafe {
25113        let inp_in: *mut bindings::VipsImage = inp.ctx;
25114        let mut out_out: *mut bindings::VipsImage = null_mut();
25115
25116        let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
25117        utils::result(
25118            vips_op_response,
25119            VipsImage { ctx: out_out },
25120            Error::ScRgb2SRgbError,
25121        )
25122    }
25123}
25124
25125/// Options for sc_rgb_2s_rgb operation
25126#[derive(Clone, Debug)]
25127pub struct ScRgb2SRgbOptions {
25128    /// depth: `i32` -> Output device space depth in bits
25129    /// min: 8, max: 16, default: 8
25130    pub depth: i32,
25131}
25132
25133impl std::default::Default for ScRgb2SRgbOptions {
25134    fn default() -> Self {
25135        ScRgb2SRgbOptions {
25136            depth: i32::from(8),
25137        }
25138    }
25139}
25140
25141/// VipsscRGB2sRGB (scRGB2sRGB), convert an scRGB image to sRGB
25142/// inp: `&VipsImage` -> Input image
25143/// sc_rgb_2s_rgb_options: `&ScRgb2SRgbOptions` -> optional arguments
25144/// returns `VipsImage` - Output image
25145pub fn sc_rgb_2s_rgb_with_opts(
25146    inp: &VipsImage,
25147    sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
25148) -> Result<VipsImage> {
25149    unsafe {
25150        let inp_in: *mut bindings::VipsImage = inp.ctx;
25151        let mut out_out: *mut bindings::VipsImage = null_mut();
25152
25153        let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
25154        let depth_in_name = utils::new_c_string("depth")?;
25155
25156        let vips_op_response =
25157            bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
25158        utils::result(
25159            vips_op_response,
25160            VipsImage { ctx: out_out },
25161            Error::ScRgb2SRgbError,
25162        )
25163    }
25164}
25165
25166/// VipsCMYK2XYZ (CMYK2XYZ), transform CMYK to XYZ
25167/// inp: `&VipsImage` -> Input image
25168/// returns `VipsImage` - Output image
25169pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
25170    unsafe {
25171        let inp_in: *mut bindings::VipsImage = inp.ctx;
25172        let mut out_out: *mut bindings::VipsImage = null_mut();
25173
25174        let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
25175        utils::result(
25176            vips_op_response,
25177            VipsImage { ctx: out_out },
25178            Error::Cmyk2XyzError,
25179        )
25180    }
25181}
25182
25183/// VipsXYZ2CMYK (XYZ2CMYK), transform XYZ to CMYK
25184/// inp: `&VipsImage` -> Input image
25185/// returns `VipsImage` - Output image
25186pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
25187    unsafe {
25188        let inp_in: *mut bindings::VipsImage = inp.ctx;
25189        let mut out_out: *mut bindings::VipsImage = null_mut();
25190
25191        let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
25192        utils::result(
25193            vips_op_response,
25194            VipsImage { ctx: out_out },
25195            Error::Xyz2CmykError,
25196        )
25197    }
25198}
25199
25200/// VipsProfileLoad (profile_load), load named ICC profile
25201/// name: `&str` -> Profile name
25202/// returns `Vec<u8>` - Loaded profile
25203pub fn profile_load(name: &str) -> Result<Vec<u8>> {
25204    unsafe {
25205        let name_in: CString = utils::new_c_string(name)?;
25206        let mut profile_out: *mut bindings::VipsBlob = null_mut();
25207
25208        let vips_op_response =
25209            bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
25210        utils::result(
25211            vips_op_response,
25212            VipsBlob { ctx: profile_out }.into(),
25213            Error::ProfileLoadError,
25214        )
25215    }
25216}
25217
25218/// VipsMaplut (maplut), map an image though a lut
25219/// inp: `&VipsImage` -> Input image
25220/// lut: `&VipsImage` -> Look-up table image
25221/// returns `VipsImage` - Output image
25222pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
25223    unsafe {
25224        let inp_in: *mut bindings::VipsImage = inp.ctx;
25225        let lut_in: *mut bindings::VipsImage = lut.ctx;
25226        let mut out_out: *mut bindings::VipsImage = null_mut();
25227
25228        let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
25229        utils::result(
25230            vips_op_response,
25231            VipsImage { ctx: out_out },
25232            Error::MaplutError,
25233        )
25234    }
25235}
25236
25237/// Options for maplut operation
25238#[derive(Clone, Debug)]
25239pub struct MaplutOptions {
25240    /// band: `i32` -> Apply one-band lut to this band of in
25241    /// min: -1, max: 10000, default: -1
25242    pub band: i32,
25243}
25244
25245impl std::default::Default for MaplutOptions {
25246    fn default() -> Self {
25247        MaplutOptions {
25248            band: i32::from(-1),
25249        }
25250    }
25251}
25252
25253/// VipsMaplut (maplut), map an image though a lut
25254/// inp: `&VipsImage` -> Input image
25255/// lut: `&VipsImage` -> Look-up table image
25256/// maplut_options: `&MaplutOptions` -> optional arguments
25257/// returns `VipsImage` - Output image
25258pub fn maplut_with_opts(
25259    inp: &VipsImage,
25260    lut: &VipsImage,
25261    maplut_options: &MaplutOptions,
25262) -> Result<VipsImage> {
25263    unsafe {
25264        let inp_in: *mut bindings::VipsImage = inp.ctx;
25265        let lut_in: *mut bindings::VipsImage = lut.ctx;
25266        let mut out_out: *mut bindings::VipsImage = null_mut();
25267
25268        let band_in: i32 = maplut_options.band;
25269        let band_in_name = utils::new_c_string("band")?;
25270
25271        let vips_op_response = bindings::vips_maplut(
25272            inp_in,
25273            &mut out_out,
25274            lut_in,
25275            band_in_name.as_ptr(),
25276            band_in,
25277            NULL,
25278        );
25279        utils::result(
25280            vips_op_response,
25281            VipsImage { ctx: out_out },
25282            Error::MaplutError,
25283        )
25284    }
25285}
25286
25287/// VipsPercent (percent), find threshold for percent of pixels
25288/// inp: `&VipsImage` -> Input image
25289/// percent: `f64` -> Percent of pixels
25290/// min: 0, max: 100, default: 50
25291/// returns `i32` - Threshold above which lie percent of pixels
25292pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
25293    unsafe {
25294        let inp_in: *mut bindings::VipsImage = inp.ctx;
25295        let percent_in: f64 = percent;
25296        let mut threshold_out: i32 = i32::from(0);
25297
25298        let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
25299        utils::result(vips_op_response, threshold_out, Error::PercentError)
25300    }
25301}
25302
25303/// VipsStdif (stdif), statistical difference
25304/// inp: `&VipsImage` -> Input image
25305/// width: `i32` -> Window width in pixels
25306/// min: 1, max: 256, default: 11
25307/// height: `i32` -> Window height in pixels
25308/// min: 1, max: 256, default: 11
25309/// returns `VipsImage` - Output image
25310pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
25311    unsafe {
25312        let inp_in: *mut bindings::VipsImage = inp.ctx;
25313        let width_in: i32 = width;
25314        let height_in: i32 = height;
25315        let mut out_out: *mut bindings::VipsImage = null_mut();
25316
25317        let vips_op_response =
25318            bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
25319        utils::result(
25320            vips_op_response,
25321            VipsImage { ctx: out_out },
25322            Error::StdifError,
25323        )
25324    }
25325}
25326
25327/// Options for stdif operation
25328#[derive(Clone, Debug)]
25329pub struct StdifOptions {
25330    /// s_0: `f64` -> New deviation
25331    /// min: -inf, max: inf, default: 50
25332    pub s_0: f64,
25333    /// b: `f64` -> Weight of new deviation
25334    /// min: 0, max: 2, default: 0.5
25335    pub b: f64,
25336    /// m_0: `f64` -> New mean
25337    /// min: -inf, max: inf, default: 128
25338    pub m_0: f64,
25339    /// a: `f64` -> Weight of new mean
25340    /// min: 0, max: 1, default: 0.5
25341    pub a: f64,
25342}
25343
25344impl std::default::Default for StdifOptions {
25345    fn default() -> Self {
25346        StdifOptions {
25347            s_0: f64::from(50),
25348            b: f64::from(0.5),
25349            m_0: f64::from(128),
25350            a: f64::from(0.5),
25351        }
25352    }
25353}
25354
25355/// VipsStdif (stdif), statistical difference
25356/// inp: `&VipsImage` -> Input image
25357/// width: `i32` -> Window width in pixels
25358/// min: 1, max: 256, default: 11
25359/// height: `i32` -> Window height in pixels
25360/// min: 1, max: 256, default: 11
25361/// stdif_options: `&StdifOptions` -> optional arguments
25362/// returns `VipsImage` - Output image
25363pub fn stdif_with_opts(
25364    inp: &VipsImage,
25365    width: i32,
25366    height: i32,
25367    stdif_options: &StdifOptions,
25368) -> Result<VipsImage> {
25369    unsafe {
25370        let inp_in: *mut bindings::VipsImage = inp.ctx;
25371        let width_in: i32 = width;
25372        let height_in: i32 = height;
25373        let mut out_out: *mut bindings::VipsImage = null_mut();
25374
25375        let s_0_in: f64 = stdif_options.s_0;
25376        let s_0_in_name = utils::new_c_string("s0")?;
25377
25378        let b_in: f64 = stdif_options.b;
25379        let b_in_name = utils::new_c_string("b")?;
25380
25381        let m_0_in: f64 = stdif_options.m_0;
25382        let m_0_in_name = utils::new_c_string("m0")?;
25383
25384        let a_in: f64 = stdif_options.a;
25385        let a_in_name = utils::new_c_string("a")?;
25386
25387        let vips_op_response = bindings::vips_stdif(
25388            inp_in,
25389            &mut out_out,
25390            width_in,
25391            height_in,
25392            s_0_in_name.as_ptr(),
25393            s_0_in,
25394            b_in_name.as_ptr(),
25395            b_in,
25396            m_0_in_name.as_ptr(),
25397            m_0_in,
25398            a_in_name.as_ptr(),
25399            a_in,
25400            NULL,
25401        );
25402        utils::result(
25403            vips_op_response,
25404            VipsImage { ctx: out_out },
25405            Error::StdifError,
25406        )
25407    }
25408}
25409
25410/// VipsHistCum (hist_cum), form cumulative histogram
25411/// inp: `&VipsImage` -> Input image
25412/// returns `VipsImage` - Output image
25413pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
25414    unsafe {
25415        let inp_in: *mut bindings::VipsImage = inp.ctx;
25416        let mut out_out: *mut bindings::VipsImage = null_mut();
25417
25418        let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
25419        utils::result(
25420            vips_op_response,
25421            VipsImage { ctx: out_out },
25422            Error::HistCumError,
25423        )
25424    }
25425}
25426
25427/// VipsHistMatch (hist_match), match two histograms
25428/// inp: `&VipsImage` -> Input histogram
25429/// refp: `&VipsImage` -> Reference histogram
25430/// returns `VipsImage` - Output image
25431pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
25432    unsafe {
25433        let inp_in: *mut bindings::VipsImage = inp.ctx;
25434        let refp_in: *mut bindings::VipsImage = refp.ctx;
25435        let mut out_out: *mut bindings::VipsImage = null_mut();
25436
25437        let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
25438        utils::result(
25439            vips_op_response,
25440            VipsImage { ctx: out_out },
25441            Error::HistMatchError,
25442        )
25443    }
25444}
25445
25446/// VipsHistNorm (hist_norm), normalise histogram
25447/// inp: `&VipsImage` -> Input image
25448/// returns `VipsImage` - Output image
25449pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
25450    unsafe {
25451        let inp_in: *mut bindings::VipsImage = inp.ctx;
25452        let mut out_out: *mut bindings::VipsImage = null_mut();
25453
25454        let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
25455        utils::result(
25456            vips_op_response,
25457            VipsImage { ctx: out_out },
25458            Error::HistNormError,
25459        )
25460    }
25461}
25462
25463/// VipsHistEqual (hist_equal), histogram equalisation
25464/// inp: `&VipsImage` -> Input image
25465/// returns `VipsImage` - Output image
25466pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
25467    unsafe {
25468        let inp_in: *mut bindings::VipsImage = inp.ctx;
25469        let mut out_out: *mut bindings::VipsImage = null_mut();
25470
25471        let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
25472        utils::result(
25473            vips_op_response,
25474            VipsImage { ctx: out_out },
25475            Error::HistEqualError,
25476        )
25477    }
25478}
25479
25480/// Options for hist_equal operation
25481#[derive(Clone, Debug)]
25482pub struct HistEqualOptions {
25483    /// band: `i32` -> Equalise with this band
25484    /// min: -1, max: 100000, default: -1
25485    pub band: i32,
25486}
25487
25488impl std::default::Default for HistEqualOptions {
25489    fn default() -> Self {
25490        HistEqualOptions {
25491            band: i32::from(-1),
25492        }
25493    }
25494}
25495
25496/// VipsHistEqual (hist_equal), histogram equalisation
25497/// inp: `&VipsImage` -> Input image
25498/// hist_equal_options: `&HistEqualOptions` -> optional arguments
25499/// returns `VipsImage` - Output image
25500pub fn hist_equal_with_opts(
25501    inp: &VipsImage,
25502    hist_equal_options: &HistEqualOptions,
25503) -> Result<VipsImage> {
25504    unsafe {
25505        let inp_in: *mut bindings::VipsImage = inp.ctx;
25506        let mut out_out: *mut bindings::VipsImage = null_mut();
25507
25508        let band_in: i32 = hist_equal_options.band;
25509        let band_in_name = utils::new_c_string("band")?;
25510
25511        let vips_op_response =
25512            bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
25513        utils::result(
25514            vips_op_response,
25515            VipsImage { ctx: out_out },
25516            Error::HistEqualError,
25517        )
25518    }
25519}
25520
25521/// VipsHistPlot (hist_plot), plot histogram
25522/// inp: `&VipsImage` -> Input image
25523/// returns `VipsImage` - Output image
25524pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
25525    unsafe {
25526        let inp_in: *mut bindings::VipsImage = inp.ctx;
25527        let mut out_out: *mut bindings::VipsImage = null_mut();
25528
25529        let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
25530        utils::result(
25531            vips_op_response,
25532            VipsImage { ctx: out_out },
25533            Error::HistPlotError,
25534        )
25535    }
25536}
25537
25538/// VipsHistLocal (hist_local), local histogram equalisation
25539/// inp: `&VipsImage` -> Input image
25540/// width: `i32` -> Window width in pixels
25541/// min: 1, max: 10000000, default: 1
25542/// height: `i32` -> Window height in pixels
25543/// min: 1, max: 10000000, default: 1
25544/// returns `VipsImage` - Output image
25545pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
25546    unsafe {
25547        let inp_in: *mut bindings::VipsImage = inp.ctx;
25548        let width_in: i32 = width;
25549        let height_in: i32 = height;
25550        let mut out_out: *mut bindings::VipsImage = null_mut();
25551
25552        let vips_op_response =
25553            bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
25554        utils::result(
25555            vips_op_response,
25556            VipsImage { ctx: out_out },
25557            Error::HistLocalError,
25558        )
25559    }
25560}
25561
25562/// Options for hist_local operation
25563#[derive(Clone, Debug)]
25564pub struct HistLocalOptions {
25565    /// max_slope: `i32` -> Maximum slope (CLAHE)
25566    /// min: 0, max: 100, default: 0
25567    pub max_slope: i32,
25568}
25569
25570impl std::default::Default for HistLocalOptions {
25571    fn default() -> Self {
25572        HistLocalOptions {
25573            max_slope: i32::from(0),
25574        }
25575    }
25576}
25577
25578/// VipsHistLocal (hist_local), local histogram equalisation
25579/// inp: `&VipsImage` -> Input image
25580/// width: `i32` -> Window width in pixels
25581/// min: 1, max: 10000000, default: 1
25582/// height: `i32` -> Window height in pixels
25583/// min: 1, max: 10000000, default: 1
25584/// hist_local_options: `&HistLocalOptions` -> optional arguments
25585/// returns `VipsImage` - Output image
25586pub fn hist_local_with_opts(
25587    inp: &VipsImage,
25588    width: i32,
25589    height: i32,
25590    hist_local_options: &HistLocalOptions,
25591) -> Result<VipsImage> {
25592    unsafe {
25593        let inp_in: *mut bindings::VipsImage = inp.ctx;
25594        let width_in: i32 = width;
25595        let height_in: i32 = height;
25596        let mut out_out: *mut bindings::VipsImage = null_mut();
25597
25598        let max_slope_in: i32 = hist_local_options.max_slope;
25599        let max_slope_in_name = utils::new_c_string("max-slope")?;
25600
25601        let vips_op_response = bindings::vips_hist_local(
25602            inp_in,
25603            &mut out_out,
25604            width_in,
25605            height_in,
25606            max_slope_in_name.as_ptr(),
25607            max_slope_in,
25608            NULL,
25609        );
25610        utils::result(
25611            vips_op_response,
25612            VipsImage { ctx: out_out },
25613            Error::HistLocalError,
25614        )
25615    }
25616}
25617
25618/// VipsHistIsmonotonic (hist_ismonotonic), test for monotonicity
25619/// inp: `&VipsImage` -> Input histogram image
25620/// returns `bool` - true if in is monotonic
25621pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
25622    unsafe {
25623        let inp_in: *mut bindings::VipsImage = inp.ctx;
25624        let mut monotonic_out: i32 = 0;
25625
25626        let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
25627        utils::result(
25628            vips_op_response,
25629            monotonic_out != 0,
25630            Error::HistIsmonotonicError,
25631        )
25632    }
25633}
25634
25635/// VipsHistEntropy (hist_entropy), estimate image entropy
25636/// inp: `&VipsImage` -> Input histogram image
25637/// returns `f64` - Output value
25638pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
25639    unsafe {
25640        let inp_in: *mut bindings::VipsImage = inp.ctx;
25641        let mut out_out: f64 = f64::from(0);
25642
25643        let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
25644        utils::result(vips_op_response, out_out, Error::HistEntropyError)
25645    }
25646}
25647
25648/// VipsConv (conv), convolution operation
25649/// inp: `&VipsImage` -> Input image argument
25650/// mask: `&VipsImage` -> Input matrix image
25651/// returns `VipsImage` - Output image
25652pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25653    unsafe {
25654        let inp_in: *mut bindings::VipsImage = inp.ctx;
25655        let mask_in: *mut bindings::VipsImage = mask.ctx;
25656        let mut out_out: *mut bindings::VipsImage = null_mut();
25657
25658        let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
25659        utils::result(
25660            vips_op_response,
25661            VipsImage { ctx: out_out },
25662            Error::ConvError,
25663        )
25664    }
25665}
25666
25667/// Options for conv operation
25668#[derive(Clone, Debug)]
25669pub struct ConvOptions {
25670    /// precision: `Precision` -> Convolve with this precision
25671    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
25672    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
25673    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
25674    ///  `Last` -> VIPS_PRECISION_LAST = 3
25675    pub precision: Precision,
25676    /// layers: `i32` -> Use this many layers in approximation
25677    /// min: 1, max: 1000, default: 5
25678    pub layers: i32,
25679    /// cluster: `i32` -> Cluster lines closer than this in approximation
25680    /// min: 1, max: 100, default: 1
25681    pub cluster: i32,
25682}
25683
25684impl std::default::Default for ConvOptions {
25685    fn default() -> Self {
25686        ConvOptions {
25687            precision: Precision::Float,
25688            layers: i32::from(5),
25689            cluster: i32::from(1),
25690        }
25691    }
25692}
25693
25694/// VipsConv (conv), convolution operation
25695/// inp: `&VipsImage` -> Input image argument
25696/// mask: `&VipsImage` -> Input matrix image
25697/// conv_options: `&ConvOptions` -> optional arguments
25698/// returns `VipsImage` - Output image
25699pub fn conv_with_opts(
25700    inp: &VipsImage,
25701    mask: &VipsImage,
25702    conv_options: &ConvOptions,
25703) -> Result<VipsImage> {
25704    unsafe {
25705        let inp_in: *mut bindings::VipsImage = inp.ctx;
25706        let mask_in: *mut bindings::VipsImage = mask.ctx;
25707        let mut out_out: *mut bindings::VipsImage = null_mut();
25708
25709        let precision_in: i32 = conv_options.precision as i32;
25710        let precision_in_name = utils::new_c_string("precision")?;
25711
25712        let layers_in: i32 = conv_options.layers;
25713        let layers_in_name = utils::new_c_string("layers")?;
25714
25715        let cluster_in: i32 = conv_options.cluster;
25716        let cluster_in_name = utils::new_c_string("cluster")?;
25717
25718        let vips_op_response = bindings::vips_conv(
25719            inp_in,
25720            &mut out_out,
25721            mask_in,
25722            precision_in_name.as_ptr(),
25723            precision_in,
25724            layers_in_name.as_ptr(),
25725            layers_in,
25726            cluster_in_name.as_ptr(),
25727            cluster_in,
25728            NULL,
25729        );
25730        utils::result(
25731            vips_op_response,
25732            VipsImage { ctx: out_out },
25733            Error::ConvError,
25734        )
25735    }
25736}
25737
25738/// VipsConva (conva), approximate integer convolution
25739/// inp: `&VipsImage` -> Input image argument
25740/// mask: `&VipsImage` -> Input matrix image
25741/// returns `VipsImage` - Output image
25742pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25743    unsafe {
25744        let inp_in: *mut bindings::VipsImage = inp.ctx;
25745        let mask_in: *mut bindings::VipsImage = mask.ctx;
25746        let mut out_out: *mut bindings::VipsImage = null_mut();
25747
25748        let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
25749        utils::result(
25750            vips_op_response,
25751            VipsImage { ctx: out_out },
25752            Error::ConvaError,
25753        )
25754    }
25755}
25756
25757/// Options for conva operation
25758#[derive(Clone, Debug)]
25759pub struct ConvaOptions {
25760    /// layers: `i32` -> Use this many layers in approximation
25761    /// min: 1, max: 1000, default: 5
25762    pub layers: i32,
25763    /// cluster: `i32` -> Cluster lines closer than this in approximation
25764    /// min: 1, max: 100, default: 1
25765    pub cluster: i32,
25766}
25767
25768impl std::default::Default for ConvaOptions {
25769    fn default() -> Self {
25770        ConvaOptions {
25771            layers: i32::from(5),
25772            cluster: i32::from(1),
25773        }
25774    }
25775}
25776
25777/// VipsConva (conva), approximate integer convolution
25778/// inp: `&VipsImage` -> Input image argument
25779/// mask: `&VipsImage` -> Input matrix image
25780/// conva_options: `&ConvaOptions` -> optional arguments
25781/// returns `VipsImage` - Output image
25782pub fn conva_with_opts(
25783    inp: &VipsImage,
25784    mask: &VipsImage,
25785    conva_options: &ConvaOptions,
25786) -> Result<VipsImage> {
25787    unsafe {
25788        let inp_in: *mut bindings::VipsImage = inp.ctx;
25789        let mask_in: *mut bindings::VipsImage = mask.ctx;
25790        let mut out_out: *mut bindings::VipsImage = null_mut();
25791
25792        let layers_in: i32 = conva_options.layers;
25793        let layers_in_name = utils::new_c_string("layers")?;
25794
25795        let cluster_in: i32 = conva_options.cluster;
25796        let cluster_in_name = utils::new_c_string("cluster")?;
25797
25798        let vips_op_response = bindings::vips_conva(
25799            inp_in,
25800            &mut out_out,
25801            mask_in,
25802            layers_in_name.as_ptr(),
25803            layers_in,
25804            cluster_in_name.as_ptr(),
25805            cluster_in,
25806            NULL,
25807        );
25808        utils::result(
25809            vips_op_response,
25810            VipsImage { ctx: out_out },
25811            Error::ConvaError,
25812        )
25813    }
25814}
25815
25816/// VipsConvf (convf), float convolution operation
25817/// inp: `&VipsImage` -> Input image argument
25818/// mask: `&VipsImage` -> Input matrix image
25819/// returns `VipsImage` - Output image
25820pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25821    unsafe {
25822        let inp_in: *mut bindings::VipsImage = inp.ctx;
25823        let mask_in: *mut bindings::VipsImage = mask.ctx;
25824        let mut out_out: *mut bindings::VipsImage = null_mut();
25825
25826        let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
25827        utils::result(
25828            vips_op_response,
25829            VipsImage { ctx: out_out },
25830            Error::ConvfError,
25831        )
25832    }
25833}
25834
25835/// VipsConvi (convi), int convolution operation
25836/// inp: `&VipsImage` -> Input image argument
25837/// mask: `&VipsImage` -> Input matrix image
25838/// returns `VipsImage` - Output image
25839pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25840    unsafe {
25841        let inp_in: *mut bindings::VipsImage = inp.ctx;
25842        let mask_in: *mut bindings::VipsImage = mask.ctx;
25843        let mut out_out: *mut bindings::VipsImage = null_mut();
25844
25845        let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
25846        utils::result(
25847            vips_op_response,
25848            VipsImage { ctx: out_out },
25849            Error::ConviError,
25850        )
25851    }
25852}
25853
25854/// VipsCompass (compass), convolve with rotating mask
25855/// inp: `&VipsImage` -> Input image argument
25856/// mask: `&VipsImage` -> Input matrix image
25857/// returns `VipsImage` - Output image
25858pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25859    unsafe {
25860        let inp_in: *mut bindings::VipsImage = inp.ctx;
25861        let mask_in: *mut bindings::VipsImage = mask.ctx;
25862        let mut out_out: *mut bindings::VipsImage = null_mut();
25863
25864        let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
25865        utils::result(
25866            vips_op_response,
25867            VipsImage { ctx: out_out },
25868            Error::CompassError,
25869        )
25870    }
25871}
25872
25873/// Options for compass operation
25874#[derive(Clone, Debug)]
25875pub struct CompassOptions {
25876    /// times: `i32` -> Rotate and convolve this many times
25877    /// min: 1, max: 1000, default: 2
25878    pub times: i32,
25879    /// angle: `Angle45` -> Rotate mask by this much between convolutions
25880    ///  `D0` -> VIPS_ANGLE45_D0 = 0
25881    ///  `D45` -> VIPS_ANGLE45_D45 = 1
25882    ///  `D90` -> VIPS_ANGLE45_D90 = 2 [DEFAULT]
25883    ///  `D135` -> VIPS_ANGLE45_D135 = 3
25884    ///  `D180` -> VIPS_ANGLE45_D180 = 4
25885    ///  `D225` -> VIPS_ANGLE45_D225 = 5
25886    ///  `D270` -> VIPS_ANGLE45_D270 = 6
25887    ///  `D315` -> VIPS_ANGLE45_D315 = 7
25888    ///  `Last` -> VIPS_ANGLE45_LAST = 8
25889    pub angle: Angle45,
25890    /// combine: `Combine` -> Combine convolution results like this
25891    ///  `Max` -> VIPS_COMBINE_MAX = 0 [DEFAULT]
25892    ///  `Sum` -> VIPS_COMBINE_SUM = 1
25893    ///  `Min` -> VIPS_COMBINE_MIN = 2
25894    ///  `Last` -> VIPS_COMBINE_LAST = 3
25895    pub combine: Combine,
25896    /// precision: `Precision` -> Convolve with this precision
25897    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
25898    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
25899    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
25900    ///  `Last` -> VIPS_PRECISION_LAST = 3
25901    pub precision: Precision,
25902    /// layers: `i32` -> Use this many layers in approximation
25903    /// min: 1, max: 1000, default: 5
25904    pub layers: i32,
25905    /// cluster: `i32` -> Cluster lines closer than this in approximation
25906    /// min: 1, max: 100, default: 1
25907    pub cluster: i32,
25908}
25909
25910impl std::default::Default for CompassOptions {
25911    fn default() -> Self {
25912        CompassOptions {
25913            times: i32::from(2),
25914            angle: Angle45::D90,
25915            combine: Combine::Max,
25916            precision: Precision::Float,
25917            layers: i32::from(5),
25918            cluster: i32::from(1),
25919        }
25920    }
25921}
25922
25923/// VipsCompass (compass), convolve with rotating mask
25924/// inp: `&VipsImage` -> Input image argument
25925/// mask: `&VipsImage` -> Input matrix image
25926/// compass_options: `&CompassOptions` -> optional arguments
25927/// returns `VipsImage` - Output image
25928pub fn compass_with_opts(
25929    inp: &VipsImage,
25930    mask: &VipsImage,
25931    compass_options: &CompassOptions,
25932) -> Result<VipsImage> {
25933    unsafe {
25934        let inp_in: *mut bindings::VipsImage = inp.ctx;
25935        let mask_in: *mut bindings::VipsImage = mask.ctx;
25936        let mut out_out: *mut bindings::VipsImage = null_mut();
25937
25938        let times_in: i32 = compass_options.times;
25939        let times_in_name = utils::new_c_string("times")?;
25940
25941        let angle_in: i32 = compass_options.angle as i32;
25942        let angle_in_name = utils::new_c_string("angle")?;
25943
25944        let combine_in: i32 = compass_options.combine as i32;
25945        let combine_in_name = utils::new_c_string("combine")?;
25946
25947        let precision_in: i32 = compass_options.precision as i32;
25948        let precision_in_name = utils::new_c_string("precision")?;
25949
25950        let layers_in: i32 = compass_options.layers;
25951        let layers_in_name = utils::new_c_string("layers")?;
25952
25953        let cluster_in: i32 = compass_options.cluster;
25954        let cluster_in_name = utils::new_c_string("cluster")?;
25955
25956        let vips_op_response = bindings::vips_compass(
25957            inp_in,
25958            &mut out_out,
25959            mask_in,
25960            times_in_name.as_ptr(),
25961            times_in,
25962            angle_in_name.as_ptr(),
25963            angle_in,
25964            combine_in_name.as_ptr(),
25965            combine_in,
25966            precision_in_name.as_ptr(),
25967            precision_in,
25968            layers_in_name.as_ptr(),
25969            layers_in,
25970            cluster_in_name.as_ptr(),
25971            cluster_in,
25972            NULL,
25973        );
25974        utils::result(
25975            vips_op_response,
25976            VipsImage { ctx: out_out },
25977            Error::CompassError,
25978        )
25979    }
25980}
25981
25982/// VipsConvsep (convsep), separable convolution operation
25983/// inp: `&VipsImage` -> Input image argument
25984/// mask: `&VipsImage` -> Input matrix image
25985/// returns `VipsImage` - Output image
25986pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25987    unsafe {
25988        let inp_in: *mut bindings::VipsImage = inp.ctx;
25989        let mask_in: *mut bindings::VipsImage = mask.ctx;
25990        let mut out_out: *mut bindings::VipsImage = null_mut();
25991
25992        let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
25993        utils::result(
25994            vips_op_response,
25995            VipsImage { ctx: out_out },
25996            Error::ConvsepError,
25997        )
25998    }
25999}
26000
26001/// Options for convsep operation
26002#[derive(Clone, Debug)]
26003pub struct ConvsepOptions {
26004    /// precision: `Precision` -> Convolve with this precision
26005    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
26006    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
26007    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
26008    ///  `Last` -> VIPS_PRECISION_LAST = 3
26009    pub precision: Precision,
26010    /// layers: `i32` -> Use this many layers in approximation
26011    /// min: 1, max: 1000, default: 5
26012    pub layers: i32,
26013    /// cluster: `i32` -> Cluster lines closer than this in approximation
26014    /// min: 1, max: 100, default: 1
26015    pub cluster: i32,
26016}
26017
26018impl std::default::Default for ConvsepOptions {
26019    fn default() -> Self {
26020        ConvsepOptions {
26021            precision: Precision::Float,
26022            layers: i32::from(5),
26023            cluster: i32::from(1),
26024        }
26025    }
26026}
26027
26028/// VipsConvsep (convsep), separable convolution operation
26029/// inp: `&VipsImage` -> Input image argument
26030/// mask: `&VipsImage` -> Input matrix image
26031/// convsep_options: `&ConvsepOptions` -> optional arguments
26032/// returns `VipsImage` - Output image
26033pub fn convsep_with_opts(
26034    inp: &VipsImage,
26035    mask: &VipsImage,
26036    convsep_options: &ConvsepOptions,
26037) -> Result<VipsImage> {
26038    unsafe {
26039        let inp_in: *mut bindings::VipsImage = inp.ctx;
26040        let mask_in: *mut bindings::VipsImage = mask.ctx;
26041        let mut out_out: *mut bindings::VipsImage = null_mut();
26042
26043        let precision_in: i32 = convsep_options.precision as i32;
26044        let precision_in_name = utils::new_c_string("precision")?;
26045
26046        let layers_in: i32 = convsep_options.layers;
26047        let layers_in_name = utils::new_c_string("layers")?;
26048
26049        let cluster_in: i32 = convsep_options.cluster;
26050        let cluster_in_name = utils::new_c_string("cluster")?;
26051
26052        let vips_op_response = bindings::vips_convsep(
26053            inp_in,
26054            &mut out_out,
26055            mask_in,
26056            precision_in_name.as_ptr(),
26057            precision_in,
26058            layers_in_name.as_ptr(),
26059            layers_in,
26060            cluster_in_name.as_ptr(),
26061            cluster_in,
26062            NULL,
26063        );
26064        utils::result(
26065            vips_op_response,
26066            VipsImage { ctx: out_out },
26067            Error::ConvsepError,
26068        )
26069    }
26070}
26071
26072/// VipsConvasep (convasep), approximate separable integer convolution
26073/// inp: `&VipsImage` -> Input image argument
26074/// mask: `&VipsImage` -> Input matrix image
26075/// returns `VipsImage` - Output image
26076pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
26077    unsafe {
26078        let inp_in: *mut bindings::VipsImage = inp.ctx;
26079        let mask_in: *mut bindings::VipsImage = mask.ctx;
26080        let mut out_out: *mut bindings::VipsImage = null_mut();
26081
26082        let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
26083        utils::result(
26084            vips_op_response,
26085            VipsImage { ctx: out_out },
26086            Error::ConvasepError,
26087        )
26088    }
26089}
26090
26091/// Options for convasep operation
26092#[derive(Clone, Debug)]
26093pub struct ConvasepOptions {
26094    /// layers: `i32` -> Use this many layers in approximation
26095    /// min: 1, max: 1000, default: 5
26096    pub layers: i32,
26097}
26098
26099impl std::default::Default for ConvasepOptions {
26100    fn default() -> Self {
26101        ConvasepOptions {
26102            layers: i32::from(5),
26103        }
26104    }
26105}
26106
26107/// VipsConvasep (convasep), approximate separable integer convolution
26108/// inp: `&VipsImage` -> Input image argument
26109/// mask: `&VipsImage` -> Input matrix image
26110/// convasep_options: `&ConvasepOptions` -> optional arguments
26111/// returns `VipsImage` - Output image
26112pub fn convasep_with_opts(
26113    inp: &VipsImage,
26114    mask: &VipsImage,
26115    convasep_options: &ConvasepOptions,
26116) -> Result<VipsImage> {
26117    unsafe {
26118        let inp_in: *mut bindings::VipsImage = inp.ctx;
26119        let mask_in: *mut bindings::VipsImage = mask.ctx;
26120        let mut out_out: *mut bindings::VipsImage = null_mut();
26121
26122        let layers_in: i32 = convasep_options.layers;
26123        let layers_in_name = utils::new_c_string("layers")?;
26124
26125        let vips_op_response = bindings::vips_convasep(
26126            inp_in,
26127            &mut out_out,
26128            mask_in,
26129            layers_in_name.as_ptr(),
26130            layers_in,
26131            NULL,
26132        );
26133        utils::result(
26134            vips_op_response,
26135            VipsImage { ctx: out_out },
26136            Error::ConvasepError,
26137        )
26138    }
26139}
26140
26141/// VipsFastcor (fastcor), fast correlation
26142/// inp: `&VipsImage` -> Input image argument
26143/// refp: `&VipsImage` -> Input reference image
26144/// returns `VipsImage` - Output image
26145pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
26146    unsafe {
26147        let inp_in: *mut bindings::VipsImage = inp.ctx;
26148        let refp_in: *mut bindings::VipsImage = refp.ctx;
26149        let mut out_out: *mut bindings::VipsImage = null_mut();
26150
26151        let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
26152        utils::result(
26153            vips_op_response,
26154            VipsImage { ctx: out_out },
26155            Error::FastcorError,
26156        )
26157    }
26158}
26159
26160/// VipsSpcor (spcor), spatial correlation
26161/// inp: `&VipsImage` -> Input image argument
26162/// refp: `&VipsImage` -> Input reference image
26163/// returns `VipsImage` - Output image
26164pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
26165    unsafe {
26166        let inp_in: *mut bindings::VipsImage = inp.ctx;
26167        let refp_in: *mut bindings::VipsImage = refp.ctx;
26168        let mut out_out: *mut bindings::VipsImage = null_mut();
26169
26170        let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
26171        utils::result(
26172            vips_op_response,
26173            VipsImage { ctx: out_out },
26174            Error::SpcorError,
26175        )
26176    }
26177}
26178
26179/// VipsSharpen (sharpen), unsharp masking for print
26180/// inp: `&VipsImage` -> Input image
26181/// returns `VipsImage` - Output image
26182pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
26183    unsafe {
26184        let inp_in: *mut bindings::VipsImage = inp.ctx;
26185        let mut out_out: *mut bindings::VipsImage = null_mut();
26186
26187        let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
26188        utils::result(
26189            vips_op_response,
26190            VipsImage { ctx: out_out },
26191            Error::SharpenError,
26192        )
26193    }
26194}
26195
26196/// Options for sharpen operation
26197#[derive(Clone, Debug)]
26198pub struct SharpenOptions {
26199    /// sigma: `f64` -> Sigma of Gaussian
26200    /// min: 0.000001, max: 10, default: 0.5
26201    pub sigma: f64,
26202    /// x_1: `f64` -> Flat/jaggy threshold
26203    /// min: 0, max: 1000000, default: 2
26204    pub x_1: f64,
26205    /// y_2: `f64` -> Maximum brightening
26206    /// min: 0, max: 1000000, default: 10
26207    pub y_2: f64,
26208    /// y_3: `f64` -> Maximum darkening
26209    /// min: 0, max: 1000000, default: 20
26210    pub y_3: f64,
26211    /// m_1: `f64` -> Slope for flat areas
26212    /// min: 0, max: 1000000, default: 0
26213    pub m_1: f64,
26214    /// m_2: `f64` -> Slope for jaggy areas
26215    /// min: 0, max: 1000000, default: 3
26216    pub m_2: f64,
26217}
26218
26219impl std::default::Default for SharpenOptions {
26220    fn default() -> Self {
26221        SharpenOptions {
26222            sigma: f64::from(0.5),
26223            x_1: f64::from(2),
26224            y_2: f64::from(10),
26225            y_3: f64::from(20),
26226            m_1: f64::from(0),
26227            m_2: f64::from(3),
26228        }
26229    }
26230}
26231
26232/// VipsSharpen (sharpen), unsharp masking for print
26233/// inp: `&VipsImage` -> Input image
26234/// sharpen_options: `&SharpenOptions` -> optional arguments
26235/// returns `VipsImage` - Output image
26236pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
26237    unsafe {
26238        let inp_in: *mut bindings::VipsImage = inp.ctx;
26239        let mut out_out: *mut bindings::VipsImage = null_mut();
26240
26241        let sigma_in: f64 = sharpen_options.sigma;
26242        let sigma_in_name = utils::new_c_string("sigma")?;
26243
26244        let x_1_in: f64 = sharpen_options.x_1;
26245        let x_1_in_name = utils::new_c_string("x1")?;
26246
26247        let y_2_in: f64 = sharpen_options.y_2;
26248        let y_2_in_name = utils::new_c_string("y2")?;
26249
26250        let y_3_in: f64 = sharpen_options.y_3;
26251        let y_3_in_name = utils::new_c_string("y3")?;
26252
26253        let m_1_in: f64 = sharpen_options.m_1;
26254        let m_1_in_name = utils::new_c_string("m1")?;
26255
26256        let m_2_in: f64 = sharpen_options.m_2;
26257        let m_2_in_name = utils::new_c_string("m2")?;
26258
26259        let vips_op_response = bindings::vips_sharpen(
26260            inp_in,
26261            &mut out_out,
26262            sigma_in_name.as_ptr(),
26263            sigma_in,
26264            x_1_in_name.as_ptr(),
26265            x_1_in,
26266            y_2_in_name.as_ptr(),
26267            y_2_in,
26268            y_3_in_name.as_ptr(),
26269            y_3_in,
26270            m_1_in_name.as_ptr(),
26271            m_1_in,
26272            m_2_in_name.as_ptr(),
26273            m_2_in,
26274            NULL,
26275        );
26276        utils::result(
26277            vips_op_response,
26278            VipsImage { ctx: out_out },
26279            Error::SharpenError,
26280        )
26281    }
26282}
26283
26284/// VipsGaussblur (gaussblur), gaussian blur
26285/// inp: `&VipsImage` -> Input image
26286/// sigma: `f64` -> Sigma of Gaussian
26287/// min: 0, max: 1000, default: 1.5
26288/// returns `VipsImage` - Output image
26289pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
26290    unsafe {
26291        let inp_in: *mut bindings::VipsImage = inp.ctx;
26292        let sigma_in: f64 = sigma;
26293        let mut out_out: *mut bindings::VipsImage = null_mut();
26294
26295        let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
26296        utils::result(
26297            vips_op_response,
26298            VipsImage { ctx: out_out },
26299            Error::GaussblurError,
26300        )
26301    }
26302}
26303
26304/// Options for gaussblur operation
26305#[derive(Clone, Debug)]
26306pub struct GaussblurOptions {
26307    /// min_ampl: `f64` -> Minimum amplitude of Gaussian
26308    /// min: 0.001, max: 1, default: 0.2
26309    pub min_ampl: f64,
26310    /// precision: `Precision` -> Convolve with this precision
26311    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0 [DEFAULT]
26312    ///  `Float` -> VIPS_PRECISION_FLOAT = 1
26313    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
26314    ///  `Last` -> VIPS_PRECISION_LAST = 3
26315    pub precision: Precision,
26316}
26317
26318impl std::default::Default for GaussblurOptions {
26319    fn default() -> Self {
26320        GaussblurOptions {
26321            min_ampl: f64::from(0.2),
26322            precision: Precision::Integer,
26323        }
26324    }
26325}
26326
26327/// VipsGaussblur (gaussblur), gaussian blur
26328/// inp: `&VipsImage` -> Input image
26329/// sigma: `f64` -> Sigma of Gaussian
26330/// min: 0, max: 1000, default: 1.5
26331/// gaussblur_options: `&GaussblurOptions` -> optional arguments
26332/// returns `VipsImage` - Output image
26333pub fn gaussblur_with_opts(
26334    inp: &VipsImage,
26335    sigma: f64,
26336    gaussblur_options: &GaussblurOptions,
26337) -> Result<VipsImage> {
26338    unsafe {
26339        let inp_in: *mut bindings::VipsImage = inp.ctx;
26340        let sigma_in: f64 = sigma;
26341        let mut out_out: *mut bindings::VipsImage = null_mut();
26342
26343        let min_ampl_in: f64 = gaussblur_options.min_ampl;
26344        let min_ampl_in_name = utils::new_c_string("min-ampl")?;
26345
26346        let precision_in: i32 = gaussblur_options.precision as i32;
26347        let precision_in_name = utils::new_c_string("precision")?;
26348
26349        let vips_op_response = bindings::vips_gaussblur(
26350            inp_in,
26351            &mut out_out,
26352            sigma_in,
26353            min_ampl_in_name.as_ptr(),
26354            min_ampl_in,
26355            precision_in_name.as_ptr(),
26356            precision_in,
26357            NULL,
26358        );
26359        utils::result(
26360            vips_op_response,
26361            VipsImage { ctx: out_out },
26362            Error::GaussblurError,
26363        )
26364    }
26365}
26366
26367/// VipsSobel (sobel), Sobel edge detector
26368/// inp: `&VipsImage` -> Input image
26369/// returns `VipsImage` - Output image
26370pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
26371    unsafe {
26372        let inp_in: *mut bindings::VipsImage = inp.ctx;
26373        let mut out_out: *mut bindings::VipsImage = null_mut();
26374
26375        let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
26376        utils::result(
26377            vips_op_response,
26378            VipsImage { ctx: out_out },
26379            Error::SobelError,
26380        )
26381    }
26382}
26383
26384/// VipsScharr (scharr), Scharr edge detector
26385/// inp: `&VipsImage` -> Input image
26386/// returns `VipsImage` - Output image
26387pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
26388    unsafe {
26389        let inp_in: *mut bindings::VipsImage = inp.ctx;
26390        let mut out_out: *mut bindings::VipsImage = null_mut();
26391
26392        let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
26393        utils::result(
26394            vips_op_response,
26395            VipsImage { ctx: out_out },
26396            Error::ScharrError,
26397        )
26398    }
26399}
26400
26401/// VipsPrewitt (prewitt), Prewitt edge detector
26402/// inp: `&VipsImage` -> Input image
26403/// returns `VipsImage` - Output image
26404pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
26405    unsafe {
26406        let inp_in: *mut bindings::VipsImage = inp.ctx;
26407        let mut out_out: *mut bindings::VipsImage = null_mut();
26408
26409        let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
26410        utils::result(
26411            vips_op_response,
26412            VipsImage { ctx: out_out },
26413            Error::PrewittError,
26414        )
26415    }
26416}
26417
26418/// VipsCanny (canny), Canny edge detector
26419/// inp: `&VipsImage` -> Input image
26420/// returns `VipsImage` - Output image
26421pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
26422    unsafe {
26423        let inp_in: *mut bindings::VipsImage = inp.ctx;
26424        let mut out_out: *mut bindings::VipsImage = null_mut();
26425
26426        let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
26427        utils::result(
26428            vips_op_response,
26429            VipsImage { ctx: out_out },
26430            Error::CannyError,
26431        )
26432    }
26433}
26434
26435/// Options for canny operation
26436#[derive(Clone, Debug)]
26437pub struct CannyOptions {
26438    /// sigma: `f64` -> Sigma of Gaussian
26439    /// min: 0.01, max: 1000, default: 1.4
26440    pub sigma: f64,
26441    /// precision: `Precision` -> Convolve with this precision
26442    ///  `Integer` -> VIPS_PRECISION_INTEGER = 0
26443    ///  `Float` -> VIPS_PRECISION_FLOAT = 1 [DEFAULT]
26444    ///  `Approximate` -> VIPS_PRECISION_APPROXIMATE = 2
26445    ///  `Last` -> VIPS_PRECISION_LAST = 3
26446    pub precision: Precision,
26447}
26448
26449impl std::default::Default for CannyOptions {
26450    fn default() -> Self {
26451        CannyOptions {
26452            sigma: f64::from(1.4),
26453            precision: Precision::Float,
26454        }
26455    }
26456}
26457
26458/// VipsCanny (canny), Canny edge detector
26459/// inp: `&VipsImage` -> Input image
26460/// canny_options: `&CannyOptions` -> optional arguments
26461/// returns `VipsImage` - Output image
26462pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
26463    unsafe {
26464        let inp_in: *mut bindings::VipsImage = inp.ctx;
26465        let mut out_out: *mut bindings::VipsImage = null_mut();
26466
26467        let sigma_in: f64 = canny_options.sigma;
26468        let sigma_in_name = utils::new_c_string("sigma")?;
26469
26470        let precision_in: i32 = canny_options.precision as i32;
26471        let precision_in_name = utils::new_c_string("precision")?;
26472
26473        let vips_op_response = bindings::vips_canny(
26474            inp_in,
26475            &mut out_out,
26476            sigma_in_name.as_ptr(),
26477            sigma_in,
26478            precision_in_name.as_ptr(),
26479            precision_in,
26480            NULL,
26481        );
26482        utils::result(
26483            vips_op_response,
26484            VipsImage { ctx: out_out },
26485            Error::CannyError,
26486        )
26487    }
26488}
26489
26490/// VipsFwfft (fwfft), forward FFT
26491/// inp: `&VipsImage` -> Input image
26492/// returns `VipsImage` - Output image
26493pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
26494    unsafe {
26495        let inp_in: *mut bindings::VipsImage = inp.ctx;
26496        let mut out_out: *mut bindings::VipsImage = null_mut();
26497
26498        let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
26499        utils::result(
26500            vips_op_response,
26501            VipsImage { ctx: out_out },
26502            Error::FwfftError,
26503        )
26504    }
26505}
26506
26507/// VipsInvfft (invfft), inverse FFT
26508/// inp: `&VipsImage` -> Input image
26509/// returns `VipsImage` - Output image
26510pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
26511    unsafe {
26512        let inp_in: *mut bindings::VipsImage = inp.ctx;
26513        let mut out_out: *mut bindings::VipsImage = null_mut();
26514
26515        let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
26516        utils::result(
26517            vips_op_response,
26518            VipsImage { ctx: out_out },
26519            Error::InvfftError,
26520        )
26521    }
26522}
26523
26524/// Options for invfft operation
26525#[derive(Clone, Debug)]
26526pub struct InvfftOptions {
26527    /// real: `bool` -> Output only the real part of the transform
26528    /// default: false
26529    pub real: bool,
26530}
26531
26532impl std::default::Default for InvfftOptions {
26533    fn default() -> Self {
26534        InvfftOptions { real: false }
26535    }
26536}
26537
26538/// VipsInvfft (invfft), inverse FFT
26539/// inp: `&VipsImage` -> Input image
26540/// invfft_options: `&InvfftOptions` -> optional arguments
26541/// returns `VipsImage` - Output image
26542pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
26543    unsafe {
26544        let inp_in: *mut bindings::VipsImage = inp.ctx;
26545        let mut out_out: *mut bindings::VipsImage = null_mut();
26546
26547        let real_in: i32 = if invfft_options.real { 1 } else { 0 };
26548        let real_in_name = utils::new_c_string("real")?;
26549
26550        let vips_op_response =
26551            bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
26552        utils::result(
26553            vips_op_response,
26554            VipsImage { ctx: out_out },
26555            Error::InvfftError,
26556        )
26557    }
26558}
26559
26560/// VipsFreqmult (freqmult), frequency-domain filtering
26561/// inp: `&VipsImage` -> Input image
26562/// mask: `&VipsImage` -> Input mask image
26563/// returns `VipsImage` - Output image
26564pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
26565    unsafe {
26566        let inp_in: *mut bindings::VipsImage = inp.ctx;
26567        let mask_in: *mut bindings::VipsImage = mask.ctx;
26568        let mut out_out: *mut bindings::VipsImage = null_mut();
26569
26570        let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
26571        utils::result(
26572            vips_op_response,
26573            VipsImage { ctx: out_out },
26574            Error::FreqmultError,
26575        )
26576    }
26577}
26578
26579/// VipsSpectrum (spectrum), make displayable power spectrum
26580/// inp: `&VipsImage` -> Input image
26581/// returns `VipsImage` - Output image
26582pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
26583    unsafe {
26584        let inp_in: *mut bindings::VipsImage = inp.ctx;
26585        let mut out_out: *mut bindings::VipsImage = null_mut();
26586
26587        let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
26588        utils::result(
26589            vips_op_response,
26590            VipsImage { ctx: out_out },
26591            Error::SpectrumError,
26592        )
26593    }
26594}
26595
26596/// VipsPhasecor (phasecor), calculate phase correlation
26597/// inp: `&VipsImage` -> Input image
26598/// in_2: `&VipsImage` -> Second input image
26599/// returns `VipsImage` - Output image
26600pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
26601    unsafe {
26602        let inp_in: *mut bindings::VipsImage = inp.ctx;
26603        let in_2_in: *mut bindings::VipsImage = in_2.ctx;
26604        let mut out_out: *mut bindings::VipsImage = null_mut();
26605
26606        let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
26607        utils::result(
26608            vips_op_response,
26609            VipsImage { ctx: out_out },
26610            Error::PhasecorError,
26611        )
26612    }
26613}
26614
26615/// VipsMorph (morph), morphology operation
26616/// inp: `&VipsImage` -> Input image argument
26617/// mask: `&VipsImage` -> Input matrix image
26618/// morph: `OperationMorphology` -> Morphological operation to perform
26619///  `Erode` -> VIPS_OPERATION_MORPHOLOGY_ERODE = 0 [DEFAULT]
26620///  `Dilate` -> VIPS_OPERATION_MORPHOLOGY_DILATE = 1
26621///  `Last` -> VIPS_OPERATION_MORPHOLOGY_LAST = 2
26622/// returns `VipsImage` - Output image
26623pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
26624    unsafe {
26625        let inp_in: *mut bindings::VipsImage = inp.ctx;
26626        let mask_in: *mut bindings::VipsImage = mask.ctx;
26627        let morph_in: i32 = morph as i32;
26628        let mut out_out: *mut bindings::VipsImage = null_mut();
26629
26630        let vips_op_response = bindings::vips_morph(
26631            inp_in,
26632            &mut out_out,
26633            mask_in,
26634            morph_in.try_into().unwrap(),
26635            NULL,
26636        );
26637        utils::result(
26638            vips_op_response,
26639            VipsImage { ctx: out_out },
26640            Error::MorphError,
26641        )
26642    }
26643}
26644
26645/// VipsRank (rank), rank filter
26646/// inp: `&VipsImage` -> Input image argument
26647/// width: `i32` -> Window width in pixels
26648/// min: 1, max: 100000, default: 11
26649/// height: `i32` -> Window height in pixels
26650/// min: 1, max: 100000, default: 11
26651/// index: `i32` -> Select pixel at index
26652/// min: 0, max: 100000000, default: 50
26653/// returns `VipsImage` - Output image
26654pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
26655    unsafe {
26656        let inp_in: *mut bindings::VipsImage = inp.ctx;
26657        let width_in: i32 = width;
26658        let height_in: i32 = height;
26659        let index_in: i32 = index;
26660        let mut out_out: *mut bindings::VipsImage = null_mut();
26661
26662        let vips_op_response =
26663            bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
26664        utils::result(
26665            vips_op_response,
26666            VipsImage { ctx: out_out },
26667            Error::RankError,
26668        )
26669    }
26670}
26671
26672/// VipsCountlines (countlines), count lines in an image
26673/// inp: `&VipsImage` -> Input image argument
26674/// direction: `Direction` -> Countlines left-right or up-down
26675///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
26676///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
26677///  `Last` -> VIPS_DIRECTION_LAST = 2
26678/// returns `f64` - Number of lines
26679pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
26680    unsafe {
26681        let inp_in: *mut bindings::VipsImage = inp.ctx;
26682        let direction_in: i32 = direction as i32;
26683        let mut nolines_out: f64 = f64::from(0);
26684
26685        let vips_op_response = bindings::vips_countlines(
26686            inp_in,
26687            &mut nolines_out,
26688            direction_in.try_into().unwrap(),
26689            NULL,
26690        );
26691        utils::result(vips_op_response, nolines_out, Error::CountlineError)
26692    }
26693}
26694
26695/// VipsLabelregions (labelregions), label regions in an image
26696/// inp: `&VipsImage` -> Input image argument
26697/// returns `VipsImage` - Mask of region labels
26698pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
26699    unsafe {
26700        let inp_in: *mut bindings::VipsImage = inp.ctx;
26701        let mut mask_out: *mut bindings::VipsImage = null_mut();
26702
26703        let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
26704        utils::result(
26705            vips_op_response,
26706            VipsImage { ctx: mask_out },
26707            Error::LabelregionError,
26708        )
26709    }
26710}
26711
26712/// Options for labelregions operation
26713#[derive(Clone, Debug)]
26714pub struct LabelregionOptions {
26715    /// segments: `i32` -> Number of discrete contiguous regions
26716    /// min: 0, max: 1000000000, default: 0
26717    pub segments: i32,
26718}
26719
26720impl std::default::Default for LabelregionOptions {
26721    fn default() -> Self {
26722        LabelregionOptions {
26723            segments: i32::from(0),
26724        }
26725    }
26726}
26727
26728/// VipsLabelregions (labelregions), label regions in an image
26729/// inp: `&VipsImage` -> Input image argument
26730/// labelregions_options: `&LabelregionOptions` -> optional arguments
26731/// returns `VipsImage` - Mask of region labels
26732pub fn labelregions_with_opts(
26733    inp: &VipsImage,
26734    labelregions_options: &LabelregionOptions,
26735) -> Result<VipsImage> {
26736    unsafe {
26737        let inp_in: *mut bindings::VipsImage = inp.ctx;
26738        let mut mask_out: *mut bindings::VipsImage = null_mut();
26739
26740        let segments_in: i32 = labelregions_options.segments;
26741        let segments_in_name = utils::new_c_string("segments")?;
26742
26743        let vips_op_response = bindings::vips_labelregions(
26744            inp_in,
26745            &mut mask_out,
26746            segments_in_name.as_ptr(),
26747            segments_in,
26748            NULL,
26749        );
26750        utils::result(
26751            vips_op_response,
26752            VipsImage { ctx: mask_out },
26753            Error::LabelregionError,
26754        )
26755    }
26756}
26757
26758/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
26759/// inp: `&VipsImage` -> Input image argument
26760/// returns `VipsImage` - Value of nearest non-zero pixel
26761pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
26762    unsafe {
26763        let inp_in: *mut bindings::VipsImage = inp.ctx;
26764        let mut out_out: *mut bindings::VipsImage = null_mut();
26765
26766        let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
26767        utils::result(
26768            vips_op_response,
26769            VipsImage { ctx: out_out },
26770            Error::FillNearestError,
26771        )
26772    }
26773}
26774
26775/// Options for fill_nearest operation
26776#[derive(Clone, Debug)]
26777pub struct FillNearestOptions {
26778    /// distance: `VipsImage` -> Distance to nearest non-zero pixel
26779    pub distance: VipsImage,
26780}
26781
26782impl std::default::Default for FillNearestOptions {
26783    fn default() -> Self {
26784        FillNearestOptions {
26785            distance: VipsImage::new(),
26786        }
26787    }
26788}
26789
26790/// VipsFillNearest (fill_nearest), fill image zeros with nearest non-zero pixel
26791/// inp: `&VipsImage` -> Input image argument
26792/// fill_nearest_options: `&FillNearestOptions` -> optional arguments
26793/// returns `VipsImage` - Value of nearest non-zero pixel
26794pub fn fill_nearest_with_opts(
26795    inp: &VipsImage,
26796    fill_nearest_options: &FillNearestOptions,
26797) -> Result<VipsImage> {
26798    unsafe {
26799        let inp_in: *mut bindings::VipsImage = inp.ctx;
26800        let mut out_out: *mut bindings::VipsImage = null_mut();
26801
26802        let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
26803        let distance_in_name = utils::new_c_string("distance")?;
26804
26805        let vips_op_response = bindings::vips_fill_nearest(
26806            inp_in,
26807            &mut out_out,
26808            distance_in_name.as_ptr(),
26809            distance_in,
26810            NULL,
26811        );
26812        utils::result(
26813            vips_op_response,
26814            VipsImage { ctx: out_out },
26815            Error::FillNearestError,
26816        )
26817    }
26818}
26819
26820/// VipsDrawRect (draw_rect), paint a rectangle on an image
26821/// image: `&VipsImage` -> Image to draw on
26822/// ink: `&mut [f64]` -> Color for pixels
26823/// left: `i32` -> Rect to fill
26824/// min: -1000000000, max: 1000000000, default: 0
26825/// top: `i32` -> Rect to fill
26826/// min: -1000000000, max: 1000000000, default: 0
26827/// width: `i32` -> Rect to fill
26828/// min: -1000000000, max: 1000000000, default: 0
26829/// height: `i32` -> Rect to fill
26830/// min: -1000000000, max: 1000000000, default: 0
26831
26832pub fn draw_rect(
26833    image: &VipsImage,
26834    ink: &mut [f64],
26835    left: i32,
26836    top: i32,
26837    width: i32,
26838    height: i32,
26839) -> Result<()> {
26840    unsafe {
26841        let image_in: *mut bindings::VipsImage = image.ctx;
26842        let ink_in: *mut f64 = ink.as_mut_ptr();
26843        let left_in: i32 = left;
26844        let top_in: i32 = top;
26845        let width_in: i32 = width;
26846        let height_in: i32 = height;
26847
26848        let vips_op_response = bindings::vips_draw_rect(
26849            image_in,
26850            ink_in,
26851            ink.len() as i32,
26852            left_in,
26853            top_in,
26854            width_in,
26855            height_in,
26856            NULL,
26857        );
26858        utils::result(vips_op_response, (), Error::DrawRectError)
26859    }
26860}
26861
26862/// Options for draw_rect operation
26863#[derive(Clone, Debug)]
26864pub struct DrawRectOptions {
26865    /// fill: `bool` -> Draw a solid object
26866    /// default: false
26867    pub fill: bool,
26868}
26869
26870impl std::default::Default for DrawRectOptions {
26871    fn default() -> Self {
26872        DrawRectOptions { fill: false }
26873    }
26874}
26875
26876/// VipsDrawRect (draw_rect), paint a rectangle on an image
26877/// image: `&VipsImage` -> Image to draw on
26878/// ink: `&mut [f64]` -> Color for pixels
26879/// left: `i32` -> Rect to fill
26880/// min: -1000000000, max: 1000000000, default: 0
26881/// top: `i32` -> Rect to fill
26882/// min: -1000000000, max: 1000000000, default: 0
26883/// width: `i32` -> Rect to fill
26884/// min: -1000000000, max: 1000000000, default: 0
26885/// height: `i32` -> Rect to fill
26886/// min: -1000000000, max: 1000000000, default: 0
26887/// draw_rect_options: `&DrawRectOptions` -> optional arguments
26888
26889pub fn draw_rect_with_opts(
26890    image: &VipsImage,
26891    ink: &mut [f64],
26892    left: i32,
26893    top: i32,
26894    width: i32,
26895    height: i32,
26896    draw_rect_options: &DrawRectOptions,
26897) -> Result<()> {
26898    unsafe {
26899        let image_in: *mut bindings::VipsImage = image.ctx;
26900        let ink_in: *mut f64 = ink.as_mut_ptr();
26901        let left_in: i32 = left;
26902        let top_in: i32 = top;
26903        let width_in: i32 = width;
26904        let height_in: i32 = height;
26905
26906        let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
26907        let fill_in_name = utils::new_c_string("fill")?;
26908
26909        let vips_op_response = bindings::vips_draw_rect(
26910            image_in,
26911            ink_in,
26912            ink.len() as i32,
26913            left_in,
26914            top_in,
26915            width_in,
26916            height_in,
26917            fill_in_name.as_ptr(),
26918            fill_in,
26919            NULL,
26920        );
26921        utils::result(vips_op_response, (), Error::DrawRectError)
26922    }
26923}
26924
26925/// VipsDrawMask (draw_mask), draw a mask on an image
26926/// image: `&VipsImage` -> Image to draw on
26927/// ink: `&mut [f64]` -> Color for pixels
26928/// mask: `&VipsImage` -> Mask of pixels to draw
26929/// x: `i32` -> Draw mask here
26930/// min: -1000000000, max: 1000000000, default: 0
26931/// y: `i32` -> Draw mask here
26932/// min: -1000000000, max: 1000000000, default: 0
26933
26934pub fn draw_mask(
26935    image: &VipsImage,
26936    ink: &mut [f64],
26937    mask: &VipsImage,
26938    x: i32,
26939    y: i32,
26940) -> Result<()> {
26941    unsafe {
26942        let image_in: *mut bindings::VipsImage = image.ctx;
26943        let ink_in: *mut f64 = ink.as_mut_ptr();
26944        let mask_in: *mut bindings::VipsImage = mask.ctx;
26945        let x_in: i32 = x;
26946        let y_in: i32 = y;
26947
26948        let vips_op_response = bindings::vips_draw_mask(
26949            image_in,
26950            ink_in,
26951            ink.len() as i32,
26952            mask_in,
26953            x_in,
26954            y_in,
26955            NULL,
26956        );
26957        utils::result(vips_op_response, (), Error::DrawMaskError)
26958    }
26959}
26960
26961/// VipsDrawLine (draw_line), draw a line on an image
26962/// image: `&VipsImage` -> Image to draw on
26963/// ink: `&mut [f64]` -> Color for pixels
26964/// x_1: `i32` -> Start of draw_line
26965/// min: -1000000000, max: 1000000000, default: 0
26966/// y_1: `i32` -> Start of draw_line
26967/// min: -1000000000, max: 1000000000, default: 0
26968/// x_2: `i32` -> End of draw_line
26969/// min: -1000000000, max: 1000000000, default: 0
26970/// y_2: `i32` -> End of draw_line
26971/// min: -1000000000, max: 1000000000, default: 0
26972
26973pub fn draw_line(
26974    image: &VipsImage,
26975    ink: &mut [f64],
26976    x_1: i32,
26977    y_1: i32,
26978    x_2: i32,
26979    y_2: i32,
26980) -> Result<()> {
26981    unsafe {
26982        let image_in: *mut bindings::VipsImage = image.ctx;
26983        let ink_in: *mut f64 = ink.as_mut_ptr();
26984        let x_1_in: i32 = x_1;
26985        let y_1_in: i32 = y_1;
26986        let x_2_in: i32 = x_2;
26987        let y_2_in: i32 = y_2;
26988
26989        let vips_op_response = bindings::vips_draw_line(
26990            image_in,
26991            ink_in,
26992            ink.len() as i32,
26993            x_1_in,
26994            y_1_in,
26995            x_2_in,
26996            y_2_in,
26997            NULL,
26998        );
26999        utils::result(vips_op_response, (), Error::DrawLineError)
27000    }
27001}
27002
27003/// VipsDrawCircle (draw_circle), draw a circle on an image
27004/// image: `&VipsImage` -> Image to draw on
27005/// ink: `&mut [f64]` -> Color for pixels
27006/// cx: `i32` -> Centre of draw_circle
27007/// min: -1000000000, max: 1000000000, default: 0
27008/// cy: `i32` -> Centre of draw_circle
27009/// min: -1000000000, max: 1000000000, default: 0
27010/// radius: `i32` -> Radius in pixels
27011/// min: 0, max: 1000000000, default: 0
27012
27013pub fn draw_circle(
27014    image: &VipsImage,
27015    ink: &mut [f64],
27016    cx: i32,
27017    cy: i32,
27018    radius: i32,
27019) -> Result<()> {
27020    unsafe {
27021        let image_in: *mut bindings::VipsImage = image.ctx;
27022        let ink_in: *mut f64 = ink.as_mut_ptr();
27023        let cx_in: i32 = cx;
27024        let cy_in: i32 = cy;
27025        let radius_in: i32 = radius;
27026
27027        let vips_op_response = bindings::vips_draw_circle(
27028            image_in,
27029            ink_in,
27030            ink.len() as i32,
27031            cx_in,
27032            cy_in,
27033            radius_in,
27034            NULL,
27035        );
27036        utils::result(vips_op_response, (), Error::DrawCircleError)
27037    }
27038}
27039
27040/// Options for draw_circle operation
27041#[derive(Clone, Debug)]
27042pub struct DrawCircleOptions {
27043    /// fill: `bool` -> Draw a solid object
27044    /// default: false
27045    pub fill: bool,
27046}
27047
27048impl std::default::Default for DrawCircleOptions {
27049    fn default() -> Self {
27050        DrawCircleOptions { fill: false }
27051    }
27052}
27053
27054/// VipsDrawCircle (draw_circle), draw a circle on an image
27055/// image: `&VipsImage` -> Image to draw on
27056/// ink: `&mut [f64]` -> Color for pixels
27057/// cx: `i32` -> Centre of draw_circle
27058/// min: -1000000000, max: 1000000000, default: 0
27059/// cy: `i32` -> Centre of draw_circle
27060/// min: -1000000000, max: 1000000000, default: 0
27061/// radius: `i32` -> Radius in pixels
27062/// min: 0, max: 1000000000, default: 0
27063/// draw_circle_options: `&DrawCircleOptions` -> optional arguments
27064
27065pub fn draw_circle_with_opts(
27066    image: &VipsImage,
27067    ink: &mut [f64],
27068    cx: i32,
27069    cy: i32,
27070    radius: i32,
27071    draw_circle_options: &DrawCircleOptions,
27072) -> Result<()> {
27073    unsafe {
27074        let image_in: *mut bindings::VipsImage = image.ctx;
27075        let ink_in: *mut f64 = ink.as_mut_ptr();
27076        let cx_in: i32 = cx;
27077        let cy_in: i32 = cy;
27078        let radius_in: i32 = radius;
27079
27080        let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
27081        let fill_in_name = utils::new_c_string("fill")?;
27082
27083        let vips_op_response = bindings::vips_draw_circle(
27084            image_in,
27085            ink_in,
27086            ink.len() as i32,
27087            cx_in,
27088            cy_in,
27089            radius_in,
27090            fill_in_name.as_ptr(),
27091            fill_in,
27092            NULL,
27093        );
27094        utils::result(vips_op_response, (), Error::DrawCircleError)
27095    }
27096}
27097
27098/// VipsDrawFlood (draw_flood), flood-fill an area
27099/// image: `&VipsImage` -> Image to draw on
27100/// ink: `&mut [f64]` -> Color for pixels
27101/// x: `i32` -> DrawFlood start point
27102/// min: 0, max: 1000000000, default: 0
27103/// y: `i32` -> DrawFlood start point
27104/// min: 0, max: 1000000000, default: 0
27105
27106pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
27107    unsafe {
27108        let image_in: *mut bindings::VipsImage = image.ctx;
27109        let ink_in: *mut f64 = ink.as_mut_ptr();
27110        let x_in: i32 = x;
27111        let y_in: i32 = y;
27112
27113        let vips_op_response =
27114            bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
27115        utils::result(vips_op_response, (), Error::DrawFloodError)
27116    }
27117}
27118
27119/// Options for draw_flood operation
27120#[derive(Clone, Debug)]
27121pub struct DrawFloodOptions {
27122    /// test: `VipsImage` -> Test pixels in this image
27123    pub test: VipsImage,
27124    /// equal: `bool` -> DrawFlood while equal to edge
27125    /// default: false
27126    pub equal: bool,
27127    /// left: `i32` -> Left edge of modified area
27128    /// min: 0, max: 1000000000, default: 0
27129    pub left: i32,
27130    /// top: `i32` -> Top edge of modified area
27131    /// min: 0, max: 1000000000, default: 0
27132    pub top: i32,
27133    /// width: `i32` -> Width of modified area
27134    /// min: 0, max: 1000000000, default: 0
27135    pub width: i32,
27136    /// height: `i32` -> Height of modified area
27137    /// min: 0, max: 1000000000, default: 0
27138    pub height: i32,
27139}
27140
27141impl std::default::Default for DrawFloodOptions {
27142    fn default() -> Self {
27143        DrawFloodOptions {
27144            test: VipsImage::new(),
27145            equal: false,
27146            left: i32::from(0),
27147            top: i32::from(0),
27148            width: i32::from(0),
27149            height: i32::from(0),
27150        }
27151    }
27152}
27153
27154/// VipsDrawFlood (draw_flood), flood-fill an area
27155/// image: `&VipsImage` -> Image to draw on
27156/// ink: `&mut [f64]` -> Color for pixels
27157/// x: `i32` -> DrawFlood start point
27158/// min: 0, max: 1000000000, default: 0
27159/// y: `i32` -> DrawFlood start point
27160/// min: 0, max: 1000000000, default: 0
27161/// draw_flood_options: `&DrawFloodOptions` -> optional arguments
27162
27163pub fn draw_flood_with_opts(
27164    image: &VipsImage,
27165    ink: &mut [f64],
27166    x: i32,
27167    y: i32,
27168    draw_flood_options: &DrawFloodOptions,
27169) -> Result<()> {
27170    unsafe {
27171        let image_in: *mut bindings::VipsImage = image.ctx;
27172        let ink_in: *mut f64 = ink.as_mut_ptr();
27173        let x_in: i32 = x;
27174        let y_in: i32 = y;
27175
27176        let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
27177        let test_in_name = utils::new_c_string("test")?;
27178
27179        let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
27180        let equal_in_name = utils::new_c_string("equal")?;
27181
27182        let left_in: i32 = draw_flood_options.left;
27183        let left_in_name = utils::new_c_string("left")?;
27184
27185        let top_in: i32 = draw_flood_options.top;
27186        let top_in_name = utils::new_c_string("top")?;
27187
27188        let width_in: i32 = draw_flood_options.width;
27189        let width_in_name = utils::new_c_string("width")?;
27190
27191        let height_in: i32 = draw_flood_options.height;
27192        let height_in_name = utils::new_c_string("height")?;
27193
27194        let vips_op_response = bindings::vips_draw_flood(
27195            image_in,
27196            ink_in,
27197            ink.len() as i32,
27198            x_in,
27199            y_in,
27200            test_in_name.as_ptr(),
27201            test_in,
27202            equal_in_name.as_ptr(),
27203            equal_in,
27204            left_in_name.as_ptr(),
27205            left_in,
27206            top_in_name.as_ptr(),
27207            top_in,
27208            width_in_name.as_ptr(),
27209            width_in,
27210            height_in_name.as_ptr(),
27211            height_in,
27212            NULL,
27213        );
27214        utils::result(vips_op_response, (), Error::DrawFloodError)
27215    }
27216}
27217
27218/// VipsDrawImage (draw_image), paint an image into another image
27219/// image: `&VipsImage` -> Image to draw on
27220/// sub: `&VipsImage` -> Sub-image to insert into main image
27221/// x: `i32` -> Draw image here
27222/// min: -1000000000, max: 1000000000, default: 0
27223/// y: `i32` -> Draw image here
27224/// min: -1000000000, max: 1000000000, default: 0
27225
27226pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
27227    unsafe {
27228        let image_in: *mut bindings::VipsImage = image.ctx;
27229        let sub_in: *mut bindings::VipsImage = sub.ctx;
27230        let x_in: i32 = x;
27231        let y_in: i32 = y;
27232
27233        let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
27234        utils::result(vips_op_response, (), Error::DrawImageError)
27235    }
27236}
27237
27238/// Options for draw_image operation
27239#[derive(Clone, Debug)]
27240pub struct DrawImageOptions {
27241    /// mode: `CombineMode` -> Combining mode
27242    ///  `Set` -> VIPS_COMBINE_MODE_SET = 0 [DEFAULT]
27243    ///  `Add` -> VIPS_COMBINE_MODE_ADD = 1
27244    ///  `Last` -> VIPS_COMBINE_MODE_LAST = 2
27245    pub mode: CombineMode,
27246}
27247
27248impl std::default::Default for DrawImageOptions {
27249    fn default() -> Self {
27250        DrawImageOptions {
27251            mode: CombineMode::Set,
27252        }
27253    }
27254}
27255
27256/// VipsDrawImage (draw_image), paint an image into another image
27257/// image: `&VipsImage` -> Image to draw on
27258/// sub: `&VipsImage` -> Sub-image to insert into main image
27259/// x: `i32` -> Draw image here
27260/// min: -1000000000, max: 1000000000, default: 0
27261/// y: `i32` -> Draw image here
27262/// min: -1000000000, max: 1000000000, default: 0
27263/// draw_image_options: `&DrawImageOptions` -> optional arguments
27264
27265pub fn draw_image_with_opts(
27266    image: &VipsImage,
27267    sub: &VipsImage,
27268    x: i32,
27269    y: i32,
27270    draw_image_options: &DrawImageOptions,
27271) -> Result<()> {
27272    unsafe {
27273        let image_in: *mut bindings::VipsImage = image.ctx;
27274        let sub_in: *mut bindings::VipsImage = sub.ctx;
27275        let x_in: i32 = x;
27276        let y_in: i32 = y;
27277
27278        let mode_in: i32 = draw_image_options.mode as i32;
27279        let mode_in_name = utils::new_c_string("mode")?;
27280
27281        let vips_op_response = bindings::vips_draw_image(
27282            image_in,
27283            sub_in,
27284            x_in,
27285            y_in,
27286            mode_in_name.as_ptr(),
27287            mode_in,
27288            NULL,
27289        );
27290        utils::result(vips_op_response, (), Error::DrawImageError)
27291    }
27292}
27293
27294/// VipsDrawSmudge (draw_smudge), blur a rectangle on an image
27295/// image: `&VipsImage` -> Image to draw on
27296/// left: `i32` -> Rect to fill
27297/// min: -1000000000, max: 1000000000, default: 0
27298/// top: `i32` -> Rect to fill
27299/// min: -1000000000, max: 1000000000, default: 0
27300/// width: `i32` -> Rect to fill
27301/// min: -1000000000, max: 1000000000, default: 0
27302/// height: `i32` -> Rect to fill
27303/// min: -1000000000, max: 1000000000, default: 0
27304
27305pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
27306    unsafe {
27307        let image_in: *mut bindings::VipsImage = image.ctx;
27308        let left_in: i32 = left;
27309        let top_in: i32 = top;
27310        let width_in: i32 = width;
27311        let height_in: i32 = height;
27312
27313        let vips_op_response =
27314            bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
27315        utils::result(vips_op_response, (), Error::DrawSmudgeError)
27316    }
27317}
27318
27319/// VipsMerge (merge), merge two images
27320/// refp: `&VipsImage` -> Reference image
27321/// sec: `&VipsImage` -> Secondary image
27322/// direction: `Direction` -> Horizontal or vertical merge
27323///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27324///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27325///  `Last` -> VIPS_DIRECTION_LAST = 2
27326/// dx: `i32` -> Horizontal displacement from sec to ref
27327/// min: -100000000, max: 1000000000, default: 1
27328/// dy: `i32` -> Vertical displacement from sec to ref
27329/// min: -100000000, max: 1000000000, default: 1
27330/// returns `VipsImage` - Output image
27331pub fn merge(
27332    refp: &VipsImage,
27333    sec: &VipsImage,
27334    direction: Direction,
27335    dx: i32,
27336    dy: i32,
27337) -> Result<VipsImage> {
27338    unsafe {
27339        let refp_in: *mut bindings::VipsImage = refp.ctx;
27340        let sec_in: *mut bindings::VipsImage = sec.ctx;
27341        let direction_in: i32 = direction as i32;
27342        let dx_in: i32 = dx;
27343        let dy_in: i32 = dy;
27344        let mut out_out: *mut bindings::VipsImage = null_mut();
27345
27346        let vips_op_response = bindings::vips_merge(
27347            refp_in,
27348            sec_in,
27349            &mut out_out,
27350            direction_in.try_into().unwrap(),
27351            dx_in,
27352            dy_in,
27353            NULL,
27354        );
27355        utils::result(
27356            vips_op_response,
27357            VipsImage { ctx: out_out },
27358            Error::MergeError,
27359        )
27360    }
27361}
27362
27363/// Options for merge operation
27364#[derive(Clone, Debug)]
27365pub struct MergeOptions {
27366    /// mblend: `i32` -> Maximum blend size
27367    /// min: 0, max: 10000, default: 10
27368    pub mblend: i32,
27369}
27370
27371impl std::default::Default for MergeOptions {
27372    fn default() -> Self {
27373        MergeOptions {
27374            mblend: i32::from(10),
27375        }
27376    }
27377}
27378
27379/// VipsMerge (merge), merge two images
27380/// refp: `&VipsImage` -> Reference image
27381/// sec: `&VipsImage` -> Secondary image
27382/// direction: `Direction` -> Horizontal or vertical merge
27383///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27384///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27385///  `Last` -> VIPS_DIRECTION_LAST = 2
27386/// dx: `i32` -> Horizontal displacement from sec to ref
27387/// min: -100000000, max: 1000000000, default: 1
27388/// dy: `i32` -> Vertical displacement from sec to ref
27389/// min: -100000000, max: 1000000000, default: 1
27390/// merge_options: `&MergeOptions` -> optional arguments
27391/// returns `VipsImage` - Output image
27392pub fn merge_with_opts(
27393    refp: &VipsImage,
27394    sec: &VipsImage,
27395    direction: Direction,
27396    dx: i32,
27397    dy: i32,
27398    merge_options: &MergeOptions,
27399) -> Result<VipsImage> {
27400    unsafe {
27401        let refp_in: *mut bindings::VipsImage = refp.ctx;
27402        let sec_in: *mut bindings::VipsImage = sec.ctx;
27403        let direction_in: i32 = direction as i32;
27404        let dx_in: i32 = dx;
27405        let dy_in: i32 = dy;
27406        let mut out_out: *mut bindings::VipsImage = null_mut();
27407
27408        let mblend_in: i32 = merge_options.mblend;
27409        let mblend_in_name = utils::new_c_string("mblend")?;
27410
27411        let vips_op_response = bindings::vips_merge(
27412            refp_in,
27413            sec_in,
27414            &mut out_out,
27415            direction_in.try_into().unwrap(),
27416            dx_in,
27417            dy_in,
27418            mblend_in_name.as_ptr(),
27419            mblend_in,
27420            NULL,
27421        );
27422        utils::result(
27423            vips_op_response,
27424            VipsImage { ctx: out_out },
27425            Error::MergeError,
27426        )
27427    }
27428}
27429
27430/// VipsMosaic (mosaic), mosaic two images
27431/// refp: `&VipsImage` -> Reference image
27432/// sec: `&VipsImage` -> Secondary image
27433/// direction: `Direction` -> Horizontal or vertical mosaic
27434///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27435///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27436///  `Last` -> VIPS_DIRECTION_LAST = 2
27437/// xref: `i32` -> Position of reference tie-point
27438/// min: 0, max: 1000000000, default: 1
27439/// yref: `i32` -> Position of reference tie-point
27440/// min: 0, max: 1000000000, default: 1
27441/// xsec: `i32` -> Position of secondary tie-point
27442/// min: 0, max: 1000000000, default: 1
27443/// ysec: `i32` -> Position of secondary tie-point
27444/// min: 0, max: 1000000000, default: 1
27445/// returns `VipsImage` - Output image
27446pub fn mosaic(
27447    refp: &VipsImage,
27448    sec: &VipsImage,
27449    direction: Direction,
27450    xref: i32,
27451    yref: i32,
27452    xsec: i32,
27453    ysec: i32,
27454) -> Result<VipsImage> {
27455    unsafe {
27456        let refp_in: *mut bindings::VipsImage = refp.ctx;
27457        let sec_in: *mut bindings::VipsImage = sec.ctx;
27458        let direction_in: i32 = direction as i32;
27459        let xref_in: i32 = xref;
27460        let yref_in: i32 = yref;
27461        let xsec_in: i32 = xsec;
27462        let ysec_in: i32 = ysec;
27463        let mut out_out: *mut bindings::VipsImage = null_mut();
27464
27465        let vips_op_response = bindings::vips_mosaic(
27466            refp_in,
27467            sec_in,
27468            &mut out_out,
27469            direction_in.try_into().unwrap(),
27470            xref_in,
27471            yref_in,
27472            xsec_in,
27473            ysec_in,
27474            NULL,
27475        );
27476        utils::result(
27477            vips_op_response,
27478            VipsImage { ctx: out_out },
27479            Error::MosaicError,
27480        )
27481    }
27482}
27483
27484/// Options for mosaic operation
27485#[derive(Clone, Debug)]
27486pub struct MosaicOptions {
27487    /// hwindow: `i32` -> Half window size
27488    /// min: 0, max: 1000000000, default: 5
27489    pub hwindow: i32,
27490    /// harea: `i32` -> Half area size
27491    /// min: 0, max: 1000000000, default: 15
27492    pub harea: i32,
27493    /// mblend: `i32` -> Maximum blend size
27494    /// min: 0, max: 10000, default: 10
27495    pub mblend: i32,
27496    /// bandno: `i32` -> Band to search for features on
27497    /// min: 0, max: 10000, default: 0
27498    pub bandno: i32,
27499    /// dx_0: `i32` -> Detected integer offset
27500    /// min: -10000000, max: 10000000, default: 0
27501    pub dx_0: i32,
27502    /// dy_0: `i32` -> Detected integer offset
27503    /// min: -10000000, max: 10000000, default: 0
27504    pub dy_0: i32,
27505    /// scale_1: `f64` -> Detected scale
27506    /// min: -10000000, max: 10000000, default: 1
27507    pub scale_1: f64,
27508    /// angle_1: `f64` -> Detected rotation
27509    /// min: -10000000, max: 10000000, default: 0
27510    pub angle_1: f64,
27511    /// dy_1: `f64` -> Detected first-order displacement
27512    /// min: -10000000, max: 10000000, default: 0
27513    pub dy_1: f64,
27514    /// dx_1: `f64` -> Detected first-order displacement
27515    /// min: -10000000, max: 10000000, default: 0
27516    pub dx_1: f64,
27517}
27518
27519impl std::default::Default for MosaicOptions {
27520    fn default() -> Self {
27521        MosaicOptions {
27522            hwindow: i32::from(5),
27523            harea: i32::from(15),
27524            mblend: i32::from(10),
27525            bandno: i32::from(0),
27526            dx_0: i32::from(0),
27527            dy_0: i32::from(0),
27528            scale_1: f64::from(1),
27529            angle_1: f64::from(0),
27530            dy_1: f64::from(0),
27531            dx_1: f64::from(0),
27532        }
27533    }
27534}
27535
27536/// VipsMosaic (mosaic), mosaic two images
27537/// refp: `&VipsImage` -> Reference image
27538/// sec: `&VipsImage` -> Secondary image
27539/// direction: `Direction` -> Horizontal or vertical mosaic
27540///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27541///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27542///  `Last` -> VIPS_DIRECTION_LAST = 2
27543/// xref: `i32` -> Position of reference tie-point
27544/// min: 0, max: 1000000000, default: 1
27545/// yref: `i32` -> Position of reference tie-point
27546/// min: 0, max: 1000000000, default: 1
27547/// xsec: `i32` -> Position of secondary tie-point
27548/// min: 0, max: 1000000000, default: 1
27549/// ysec: `i32` -> Position of secondary tie-point
27550/// min: 0, max: 1000000000, default: 1
27551/// mosaic_options: `&MosaicOptions` -> optional arguments
27552/// returns `VipsImage` - Output image
27553pub fn mosaic_with_opts(
27554    refp: &VipsImage,
27555    sec: &VipsImage,
27556    direction: Direction,
27557    xref: i32,
27558    yref: i32,
27559    xsec: i32,
27560    ysec: i32,
27561    mosaic_options: &MosaicOptions,
27562) -> Result<VipsImage> {
27563    unsafe {
27564        let refp_in: *mut bindings::VipsImage = refp.ctx;
27565        let sec_in: *mut bindings::VipsImage = sec.ctx;
27566        let direction_in: i32 = direction as i32;
27567        let xref_in: i32 = xref;
27568        let yref_in: i32 = yref;
27569        let xsec_in: i32 = xsec;
27570        let ysec_in: i32 = ysec;
27571        let mut out_out: *mut bindings::VipsImage = null_mut();
27572
27573        let hwindow_in: i32 = mosaic_options.hwindow;
27574        let hwindow_in_name = utils::new_c_string("hwindow")?;
27575
27576        let harea_in: i32 = mosaic_options.harea;
27577        let harea_in_name = utils::new_c_string("harea")?;
27578
27579        let mblend_in: i32 = mosaic_options.mblend;
27580        let mblend_in_name = utils::new_c_string("mblend")?;
27581
27582        let bandno_in: i32 = mosaic_options.bandno;
27583        let bandno_in_name = utils::new_c_string("bandno")?;
27584
27585        let dx_0_in: i32 = mosaic_options.dx_0;
27586        let dx_0_in_name = utils::new_c_string("dx0")?;
27587
27588        let dy_0_in: i32 = mosaic_options.dy_0;
27589        let dy_0_in_name = utils::new_c_string("dy0")?;
27590
27591        let scale_1_in: f64 = mosaic_options.scale_1;
27592        let scale_1_in_name = utils::new_c_string("scale1")?;
27593
27594        let angle_1_in: f64 = mosaic_options.angle_1;
27595        let angle_1_in_name = utils::new_c_string("angle1")?;
27596
27597        let dy_1_in: f64 = mosaic_options.dy_1;
27598        let dy_1_in_name = utils::new_c_string("dy1")?;
27599
27600        let dx_1_in: f64 = mosaic_options.dx_1;
27601        let dx_1_in_name = utils::new_c_string("dx1")?;
27602
27603        let vips_op_response = bindings::vips_mosaic(
27604            refp_in,
27605            sec_in,
27606            &mut out_out,
27607            direction_in.try_into().unwrap(),
27608            xref_in,
27609            yref_in,
27610            xsec_in,
27611            ysec_in,
27612            hwindow_in_name.as_ptr(),
27613            hwindow_in,
27614            harea_in_name.as_ptr(),
27615            harea_in,
27616            mblend_in_name.as_ptr(),
27617            mblend_in,
27618            bandno_in_name.as_ptr(),
27619            bandno_in,
27620            dx_0_in_name.as_ptr(),
27621            dx_0_in,
27622            dy_0_in_name.as_ptr(),
27623            dy_0_in,
27624            scale_1_in_name.as_ptr(),
27625            scale_1_in,
27626            angle_1_in_name.as_ptr(),
27627            angle_1_in,
27628            dy_1_in_name.as_ptr(),
27629            dy_1_in,
27630            dx_1_in_name.as_ptr(),
27631            dx_1_in,
27632            NULL,
27633        );
27634        utils::result(
27635            vips_op_response,
27636            VipsImage { ctx: out_out },
27637            Error::MosaicError,
27638        )
27639    }
27640}
27641
27642/// VipsMosaic1 (mosaic1), first-order mosaic of two images
27643/// refp: `&VipsImage` -> Reference image
27644/// sec: `&VipsImage` -> Secondary image
27645/// direction: `Direction` -> Horizontal or vertical mosaic
27646///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27647///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27648///  `Last` -> VIPS_DIRECTION_LAST = 2
27649/// xr_1: `i32` -> Position of first reference tie-point
27650/// min: -1000000000, max: 1000000000, default: 1
27651/// yr_1: `i32` -> Position of first reference tie-point
27652/// min: -1000000000, max: 1000000000, default: 1
27653/// xs_1: `i32` -> Position of first secondary tie-point
27654/// min: -1000000000, max: 1000000000, default: 1
27655/// ys_1: `i32` -> Position of first secondary tie-point
27656/// min: -1000000000, max: 1000000000, default: 1
27657/// xr_2: `i32` -> Position of second reference tie-point
27658/// min: -1000000000, max: 1000000000, default: 1
27659/// yr_2: `i32` -> Position of second reference tie-point
27660/// min: -1000000000, max: 1000000000, default: 1
27661/// xs_2: `i32` -> Position of second secondary tie-point
27662/// min: -1000000000, max: 1000000000, default: 1
27663/// ys_2: `i32` -> Position of second secondary tie-point
27664/// min: -1000000000, max: 1000000000, default: 1
27665/// returns `VipsImage` - Output image
27666pub fn mosaic_1(
27667    refp: &VipsImage,
27668    sec: &VipsImage,
27669    direction: Direction,
27670    xr_1: i32,
27671    yr_1: i32,
27672    xs_1: i32,
27673    ys_1: i32,
27674    xr_2: i32,
27675    yr_2: i32,
27676    xs_2: i32,
27677    ys_2: i32,
27678) -> Result<VipsImage> {
27679    unsafe {
27680        let refp_in: *mut bindings::VipsImage = refp.ctx;
27681        let sec_in: *mut bindings::VipsImage = sec.ctx;
27682        let direction_in: i32 = direction as i32;
27683        let xr_1_in: i32 = xr_1;
27684        let yr_1_in: i32 = yr_1;
27685        let xs_1_in: i32 = xs_1;
27686        let ys_1_in: i32 = ys_1;
27687        let xr_2_in: i32 = xr_2;
27688        let yr_2_in: i32 = yr_2;
27689        let xs_2_in: i32 = xs_2;
27690        let ys_2_in: i32 = ys_2;
27691        let mut out_out: *mut bindings::VipsImage = null_mut();
27692
27693        let vips_op_response = bindings::vips_mosaic1(
27694            refp_in,
27695            sec_in,
27696            &mut out_out,
27697            direction_in.try_into().unwrap(),
27698            xr_1_in,
27699            yr_1_in,
27700            xs_1_in,
27701            ys_1_in,
27702            xr_2_in,
27703            yr_2_in,
27704            xs_2_in,
27705            ys_2_in,
27706            NULL,
27707        );
27708        utils::result(
27709            vips_op_response,
27710            VipsImage { ctx: out_out },
27711            Error::Mosaic1Error,
27712        )
27713    }
27714}
27715
27716/// Options for mosaic_1 operation
27717#[derive(Clone, Debug)]
27718pub struct Mosaic1Options {
27719    /// hwindow: `i32` -> Half window size
27720    /// min: 0, max: 1000000000, default: 5
27721    pub hwindow: i32,
27722    /// harea: `i32` -> Half area size
27723    /// min: 0, max: 1000000000, default: 15
27724    pub harea: i32,
27725    /// search: `bool` -> Search to improve tie-points
27726    /// default: false
27727    pub search: bool,
27728    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
27729    pub interpolate: VipsInterpolate,
27730    /// mblend: `i32` -> Maximum blend size
27731    /// min: 0, max: 10000, default: 10
27732    pub mblend: i32,
27733}
27734
27735impl std::default::Default for Mosaic1Options {
27736    fn default() -> Self {
27737        Mosaic1Options {
27738            hwindow: i32::from(5),
27739            harea: i32::from(15),
27740            search: false,
27741            interpolate: VipsInterpolate::new(),
27742            mblend: i32::from(10),
27743        }
27744    }
27745}
27746
27747/// VipsMosaic1 (mosaic1), first-order mosaic of two images
27748/// refp: `&VipsImage` -> Reference image
27749/// sec: `&VipsImage` -> Secondary image
27750/// direction: `Direction` -> Horizontal or vertical mosaic
27751///  `Horizontal` -> VIPS_DIRECTION_HORIZONTAL = 0 [DEFAULT]
27752///  `Vertical` -> VIPS_DIRECTION_VERTICAL = 1
27753///  `Last` -> VIPS_DIRECTION_LAST = 2
27754/// xr_1: `i32` -> Position of first reference tie-point
27755/// min: -1000000000, max: 1000000000, default: 1
27756/// yr_1: `i32` -> Position of first reference tie-point
27757/// min: -1000000000, max: 1000000000, default: 1
27758/// xs_1: `i32` -> Position of first secondary tie-point
27759/// min: -1000000000, max: 1000000000, default: 1
27760/// ys_1: `i32` -> Position of first secondary tie-point
27761/// min: -1000000000, max: 1000000000, default: 1
27762/// xr_2: `i32` -> Position of second reference tie-point
27763/// min: -1000000000, max: 1000000000, default: 1
27764/// yr_2: `i32` -> Position of second reference tie-point
27765/// min: -1000000000, max: 1000000000, default: 1
27766/// xs_2: `i32` -> Position of second secondary tie-point
27767/// min: -1000000000, max: 1000000000, default: 1
27768/// ys_2: `i32` -> Position of second secondary tie-point
27769/// min: -1000000000, max: 1000000000, default: 1
27770/// mosaic_1_options: `&Mosaic1Options` -> optional arguments
27771/// returns `VipsImage` - Output image
27772pub fn mosaic_1_with_opts(
27773    refp: &VipsImage,
27774    sec: &VipsImage,
27775    direction: Direction,
27776    xr_1: i32,
27777    yr_1: i32,
27778    xs_1: i32,
27779    ys_1: i32,
27780    xr_2: i32,
27781    yr_2: i32,
27782    xs_2: i32,
27783    ys_2: i32,
27784    mosaic_1_options: &Mosaic1Options,
27785) -> Result<VipsImage> {
27786    unsafe {
27787        let refp_in: *mut bindings::VipsImage = refp.ctx;
27788        let sec_in: *mut bindings::VipsImage = sec.ctx;
27789        let direction_in: i32 = direction as i32;
27790        let xr_1_in: i32 = xr_1;
27791        let yr_1_in: i32 = yr_1;
27792        let xs_1_in: i32 = xs_1;
27793        let ys_1_in: i32 = ys_1;
27794        let xr_2_in: i32 = xr_2;
27795        let yr_2_in: i32 = yr_2;
27796        let xs_2_in: i32 = xs_2;
27797        let ys_2_in: i32 = ys_2;
27798        let mut out_out: *mut bindings::VipsImage = null_mut();
27799
27800        let hwindow_in: i32 = mosaic_1_options.hwindow;
27801        let hwindow_in_name = utils::new_c_string("hwindow")?;
27802
27803        let harea_in: i32 = mosaic_1_options.harea;
27804        let harea_in_name = utils::new_c_string("harea")?;
27805
27806        let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
27807        let search_in_name = utils::new_c_string("search")?;
27808
27809        let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
27810        let interpolate_in_name = utils::new_c_string("interpolate")?;
27811
27812        let mblend_in: i32 = mosaic_1_options.mblend;
27813        let mblend_in_name = utils::new_c_string("mblend")?;
27814
27815        let vips_op_response = bindings::vips_mosaic1(
27816            refp_in,
27817            sec_in,
27818            &mut out_out,
27819            direction_in.try_into().unwrap(),
27820            xr_1_in,
27821            yr_1_in,
27822            xs_1_in,
27823            ys_1_in,
27824            xr_2_in,
27825            yr_2_in,
27826            xs_2_in,
27827            ys_2_in,
27828            hwindow_in_name.as_ptr(),
27829            hwindow_in,
27830            harea_in_name.as_ptr(),
27831            harea_in,
27832            search_in_name.as_ptr(),
27833            search_in,
27834            interpolate_in_name.as_ptr(),
27835            interpolate_in,
27836            mblend_in_name.as_ptr(),
27837            mblend_in,
27838            NULL,
27839        );
27840        utils::result(
27841            vips_op_response,
27842            VipsImage { ctx: out_out },
27843            Error::Mosaic1Error,
27844        )
27845    }
27846}
27847
27848/// VipsMatrixinvert (matrixinvert), invert an matrix
27849/// inp: `&VipsImage` -> An square matrix
27850/// returns `VipsImage` - Output matrix
27851pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
27852    unsafe {
27853        let inp_in: *mut bindings::VipsImage = inp.ctx;
27854        let mut out_out: *mut bindings::VipsImage = null_mut();
27855
27856        let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
27857        utils::result(
27858            vips_op_response,
27859            VipsImage { ctx: out_out },
27860            Error::MatrixinvertError,
27861        )
27862    }
27863}
27864
27865/// VipsMatch (match), first-order match of two images
27866/// refp: `&VipsImage` -> Reference image
27867/// sec: `&VipsImage` -> Secondary image
27868/// xr_1: `i32` -> Position of first reference tie-point
27869/// min: -1000000000, max: 1000000000, default: 1
27870/// yr_1: `i32` -> Position of first reference tie-point
27871/// min: -1000000000, max: 1000000000, default: 1
27872/// xs_1: `i32` -> Position of first secondary tie-point
27873/// min: -1000000000, max: 1000000000, default: 1
27874/// ys_1: `i32` -> Position of first secondary tie-point
27875/// min: -1000000000, max: 1000000000, default: 1
27876/// xr_2: `i32` -> Position of second reference tie-point
27877/// min: -1000000000, max: 1000000000, default: 1
27878/// yr_2: `i32` -> Position of second reference tie-point
27879/// min: -1000000000, max: 1000000000, default: 1
27880/// xs_2: `i32` -> Position of second secondary tie-point
27881/// min: -1000000000, max: 1000000000, default: 1
27882/// ys_2: `i32` -> Position of second secondary tie-point
27883/// min: -1000000000, max: 1000000000, default: 1
27884/// returns `VipsImage` - Output image
27885pub fn matches(
27886    refp: &VipsImage,
27887    sec: &VipsImage,
27888    xr_1: i32,
27889    yr_1: i32,
27890    xs_1: i32,
27891    ys_1: i32,
27892    xr_2: i32,
27893    yr_2: i32,
27894    xs_2: i32,
27895    ys_2: i32,
27896) -> Result<VipsImage> {
27897    unsafe {
27898        let refp_in: *mut bindings::VipsImage = refp.ctx;
27899        let sec_in: *mut bindings::VipsImage = sec.ctx;
27900        let xr_1_in: i32 = xr_1;
27901        let yr_1_in: i32 = yr_1;
27902        let xs_1_in: i32 = xs_1;
27903        let ys_1_in: i32 = ys_1;
27904        let xr_2_in: i32 = xr_2;
27905        let yr_2_in: i32 = yr_2;
27906        let xs_2_in: i32 = xs_2;
27907        let ys_2_in: i32 = ys_2;
27908        let mut out_out: *mut bindings::VipsImage = null_mut();
27909
27910        let vips_op_response = bindings::vips_match(
27911            refp_in,
27912            sec_in,
27913            &mut out_out,
27914            xr_1_in,
27915            yr_1_in,
27916            xs_1_in,
27917            ys_1_in,
27918            xr_2_in,
27919            yr_2_in,
27920            xs_2_in,
27921            ys_2_in,
27922            NULL,
27923        );
27924        utils::result(
27925            vips_op_response,
27926            VipsImage { ctx: out_out },
27927            Error::MatchError,
27928        )
27929    }
27930}
27931
27932/// Options for matches operation
27933#[derive(Clone, Debug)]
27934pub struct MatchOptions {
27935    /// hwindow: `i32` -> Half window size
27936    /// min: 0, max: 1000000000, default: 1
27937    pub hwindow: i32,
27938    /// harea: `i32` -> Half area size
27939    /// min: 0, max: 1000000000, default: 1
27940    pub harea: i32,
27941    /// search: `bool` -> Search to improve tie-points
27942    /// default: false
27943    pub search: bool,
27944    /// interpolate: `VipsInterpolate` -> Interpolate pixels with this
27945    pub interpolate: VipsInterpolate,
27946}
27947
27948impl std::default::Default for MatchOptions {
27949    fn default() -> Self {
27950        MatchOptions {
27951            hwindow: i32::from(1),
27952            harea: i32::from(1),
27953            search: false,
27954            interpolate: VipsInterpolate::new(),
27955        }
27956    }
27957}
27958
27959/// VipsMatch (match), first-order match of two images
27960/// refp: `&VipsImage` -> Reference image
27961/// sec: `&VipsImage` -> Secondary image
27962/// xr_1: `i32` -> Position of first reference tie-point
27963/// min: -1000000000, max: 1000000000, default: 1
27964/// yr_1: `i32` -> Position of first reference tie-point
27965/// min: -1000000000, max: 1000000000, default: 1
27966/// xs_1: `i32` -> Position of first secondary tie-point
27967/// min: -1000000000, max: 1000000000, default: 1
27968/// ys_1: `i32` -> Position of first secondary tie-point
27969/// min: -1000000000, max: 1000000000, default: 1
27970/// xr_2: `i32` -> Position of second reference tie-point
27971/// min: -1000000000, max: 1000000000, default: 1
27972/// yr_2: `i32` -> Position of second reference tie-point
27973/// min: -1000000000, max: 1000000000, default: 1
27974/// xs_2: `i32` -> Position of second secondary tie-point
27975/// min: -1000000000, max: 1000000000, default: 1
27976/// ys_2: `i32` -> Position of second secondary tie-point
27977/// min: -1000000000, max: 1000000000, default: 1
27978/// matches_options: `&MatchOptions` -> optional arguments
27979/// returns `VipsImage` - Output image
27980pub fn matches_with_opts(
27981    refp: &VipsImage,
27982    sec: &VipsImage,
27983    xr_1: i32,
27984    yr_1: i32,
27985    xs_1: i32,
27986    ys_1: i32,
27987    xr_2: i32,
27988    yr_2: i32,
27989    xs_2: i32,
27990    ys_2: i32,
27991    matches_options: &MatchOptions,
27992) -> Result<VipsImage> {
27993    unsafe {
27994        let refp_in: *mut bindings::VipsImage = refp.ctx;
27995        let sec_in: *mut bindings::VipsImage = sec.ctx;
27996        let xr_1_in: i32 = xr_1;
27997        let yr_1_in: i32 = yr_1;
27998        let xs_1_in: i32 = xs_1;
27999        let ys_1_in: i32 = ys_1;
28000        let xr_2_in: i32 = xr_2;
28001        let yr_2_in: i32 = yr_2;
28002        let xs_2_in: i32 = xs_2;
28003        let ys_2_in: i32 = ys_2;
28004        let mut out_out: *mut bindings::VipsImage = null_mut();
28005
28006        let hwindow_in: i32 = matches_options.hwindow;
28007        let hwindow_in_name = utils::new_c_string("hwindow")?;
28008
28009        let harea_in: i32 = matches_options.harea;
28010        let harea_in_name = utils::new_c_string("harea")?;
28011
28012        let search_in: i32 = if matches_options.search { 1 } else { 0 };
28013        let search_in_name = utils::new_c_string("search")?;
28014
28015        let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
28016        let interpolate_in_name = utils::new_c_string("interpolate")?;
28017
28018        let vips_op_response = bindings::vips_match(
28019            refp_in,
28020            sec_in,
28021            &mut out_out,
28022            xr_1_in,
28023            yr_1_in,
28024            xs_1_in,
28025            ys_1_in,
28026            xr_2_in,
28027            yr_2_in,
28028            xs_2_in,
28029            ys_2_in,
28030            hwindow_in_name.as_ptr(),
28031            hwindow_in,
28032            harea_in_name.as_ptr(),
28033            harea_in,
28034            search_in_name.as_ptr(),
28035            search_in,
28036            interpolate_in_name.as_ptr(),
28037            interpolate_in,
28038            NULL,
28039        );
28040        utils::result(
28041            vips_op_response,
28042            VipsImage { ctx: out_out },
28043            Error::MatchError,
28044        )
28045    }
28046}
28047
28048/// VipsGlobalbalance (globalbalance), global balance an image mosaic
28049/// inp: `&VipsImage` -> Input image
28050/// returns `VipsImage` - Output image
28051pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
28052    unsafe {
28053        let inp_in: *mut bindings::VipsImage = inp.ctx;
28054        let mut out_out: *mut bindings::VipsImage = null_mut();
28055
28056        let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
28057        utils::result(
28058            vips_op_response,
28059            VipsImage { ctx: out_out },
28060            Error::GlobalbalanceError,
28061        )
28062    }
28063}
28064
28065/// Options for globalbalance operation
28066#[derive(Clone, Debug)]
28067pub struct GlobalbalanceOptions {
28068    /// gamma: `f64` -> Image gamma
28069    /// min: 0.00001, max: 10, default: 1.6
28070    pub gamma: f64,
28071    /// int_output: `bool` -> Integer output
28072    /// default: false
28073    pub int_output: bool,
28074}
28075
28076impl std::default::Default for GlobalbalanceOptions {
28077    fn default() -> Self {
28078        GlobalbalanceOptions {
28079            gamma: f64::from(1.6),
28080            int_output: false,
28081        }
28082    }
28083}
28084
28085/// VipsGlobalbalance (globalbalance), global balance an image mosaic
28086/// inp: `&VipsImage` -> Input image
28087/// globalbalance_options: `&GlobalbalanceOptions` -> optional arguments
28088/// returns `VipsImage` - Output image
28089pub fn globalbalance_with_opts(
28090    inp: &VipsImage,
28091    globalbalance_options: &GlobalbalanceOptions,
28092) -> Result<VipsImage> {
28093    unsafe {
28094        let inp_in: *mut bindings::VipsImage = inp.ctx;
28095        let mut out_out: *mut bindings::VipsImage = null_mut();
28096
28097        let gamma_in: f64 = globalbalance_options.gamma;
28098        let gamma_in_name = utils::new_c_string("gamma")?;
28099
28100        let int_output_in: i32 = if globalbalance_options.int_output {
28101            1
28102        } else {
28103            0
28104        };
28105        let int_output_in_name = utils::new_c_string("int-output")?;
28106
28107        let vips_op_response = bindings::vips_globalbalance(
28108            inp_in,
28109            &mut out_out,
28110            gamma_in_name.as_ptr(),
28111            gamma_in,
28112            int_output_in_name.as_ptr(),
28113            int_output_in,
28114            NULL,
28115        );
28116        utils::result(
28117            vips_op_response,
28118            VipsImage { ctx: out_out },
28119            Error::GlobalbalanceError,
28120        )
28121    }
28122}