1use 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 = 0,
23 Sequential = 1,
25 SequentialUnbuffered = 2,
27 Last = 3,
29}
30
31#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
32pub enum Align {
33 Low = 0,
35 Centre = 1,
37 High = 2,
39 Last = 3,
41}
42
43#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
44pub enum Angle {
45 D0 = 0,
47 D90 = 1,
49 D180 = 2,
51 D270 = 3,
53 Last = 4,
55}
56
57#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
58pub enum Angle45 {
59 D0 = 0,
61 D45 = 1,
63 D90 = 2,
65 D135 = 3,
67 D180 = 4,
69 D225 = 5,
71 D270 = 6,
73 D315 = 7,
75 Last = 8,
77}
78
79#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
80pub enum BandFormat {
81 Notset = -1,
83 Uchar = 0,
85 Char = 1,
87 Ushort = 2,
89 Short = 3,
91 Uint = 4,
93 Int = 5,
95 Float = 6,
97 Complex = 7,
99 Double = 8,
101 Dpcomplex = 9,
103 Last = 10,
105}
106
107#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
108pub enum BlendMode {
109 Clear = 0,
111 Source = 1,
113 Over = 2,
115 In = 3,
117 Out = 4,
119 Atop = 5,
121 Dest = 6,
123 DestOver = 7,
125 DestIn = 8,
127 DestOut = 9,
129 DestAtop = 10,
131 Xor = 11,
133 Add = 12,
135 Saturate = 13,
137 Multiply = 14,
139 Screen = 15,
141 Overlay = 16,
143 Darken = 17,
145 Lighten = 18,
147 ColourDodge = 19,
149 ColourBurn = 20,
151 HardLight = 21,
153 SoftLight = 22,
155 Difference = 23,
157 Exclusion = 24,
159 Last = 25,
161}
162
163#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
164pub enum Coding {
165 Error = -1,
167 None = 0,
169 Labq = 2,
171 Rad = 6,
173 Last = 7,
175}
176
177#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
178pub enum Combine {
179 Max = 0,
181 Sum = 1,
183 Min = 2,
185 Last = 3,
187}
188
189#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
190pub enum CombineMode {
191 Set = 0,
193 Add = 1,
195 Last = 2,
197}
198
199#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
200pub enum CompassDirection {
201 Centre = 0,
203 North = 1,
205 East = 2,
207 South = 3,
209 West = 4,
211 NorthEast = 5,
213 SouthEast = 6,
215 SouthWest = 7,
217 NorthWest = 8,
219 Last = 9,
221}
222
223#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
224pub enum Direction {
225 Horizontal = 0,
227 Vertical = 1,
229 Last = 2,
231}
232
233#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
234pub enum Extend {
235 Black = 0,
237 Copy = 1,
239 Repeat = 2,
241 Mirror = 3,
243 White = 4,
245 Background = 5,
247 Last = 6,
249}
250
251#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
252pub enum FailOn {
253 None = 0,
255 Truncated = 1,
257 Error = 2,
259 Warning = 3,
261 Last = 4,
263}
264
265#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
266pub enum ForeignDzDepth {
267 Onepixel = 0,
269 Onetile = 1,
271 One = 2,
273 Last = 3,
275}
276
277#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
278pub enum ForeignFlags {
279 None = 0,
281 Partial = 1,
283 Bigendian = 2,
285 Sequential = 4,
287 All = 7,
289}
290
291#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
292pub enum ForeignHeifCompression {
293 Hevc = 1,
295 Avc = 2,
297 Jpeg = 3,
299 Av1 = 4,
301 Last = 5,
303}
304
305#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
306pub enum ForeignHeifEncoder {
307 Auto = 0,
309 Aom = 1,
311 Rav1E = 2,
313 Svt = 3,
315 X265 = 4,
317 Last = 5,
319}
320
321#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
322pub enum ForeignKeep {
323 None = 0,
325 Exif = 1,
327 Xmp = 2,
329 Iptc = 4,
331 Icc = 8,
333 Other = 16,
335 All = 31,
337}
338
339#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
340pub enum ForeignPngFilter {
341 None = 8,
343 Sub = 16,
345 Up = 32,
347 Avg = 64,
349 Paeth = 128,
351 All = 248,
353}
354
355#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
356pub enum ForeignPpmFormat {
357 Pbm = 0,
359 Pgm = 1,
361 Ppm = 2,
363 Pfm = 3,
365 Pnm = 4,
367 Last = 5,
369}
370
371#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
372pub enum ForeignSubsample {
373 Auto = 0,
375 On = 1,
377 Off = 2,
379 Last = 3,
381}
382
383#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
384pub enum ForeignTiffCompression {
385 None = 0,
387 Jpeg = 1,
389 Deflate = 2,
391 Packbit = 3,
393 Ccittfax4 = 4,
395 Lzw = 5,
397 Webp = 6,
399 Zstd = 7,
401 Jp2K = 8,
403 Last = 9,
405}
406
407#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
408pub enum ForeignTiffPredictor {
409 None = 1,
411 Horizontal = 2,
413 Float = 3,
415 Last = 4,
417}
418
419#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
420pub enum ForeignTiffResunit {
421 Cm = 0,
423 Inch = 1,
425 Last = 2,
427}
428
429#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
430pub enum ForeignWebpPreset {
431 Default = 0,
433 Picture = 1,
435 Photo = 2,
437 Drawing = 3,
439 Icon = 4,
441 Text = 5,
443 Last = 6,
445}
446
447#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
448pub enum Intent {
449 Perceptual = 0,
451 Relative = 1,
453 Saturation = 2,
455 Absolute = 3,
457 Auto = 32,
459 Last = 33,
461}
462
463#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
464pub enum Interesting {
465 None = 0,
467 Centre = 1,
469 Entropy = 2,
471 Attention = 3,
473 Low = 4,
475 High = 5,
477 All = 6,
479 Last = 7,
481}
482
483#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
484pub enum Interpretation {
485 Error = -1,
487 Multiband = 0,
489 BW = 1,
491 Histogram = 10,
493 Xyz = 12,
495 Lab = 13,
497 Cmyk = 15,
499 Labq = 16,
501 Rgb = 17,
503 Cmc = 18,
505 Lch = 19,
507 Labs = 21,
509 Srgb = 22,
511 Yxy = 23,
513 Fourier = 24,
515 Rgb16 = 25,
517 Grey16 = 26,
519 Matrix = 27,
521 Scrgb = 28,
523 Hsv = 29,
525 Last = 30,
527}
528
529#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
530pub enum Kernel {
531 Nearest = 0,
533 Linear = 1,
535 Cubic = 2,
537 Mitchell = 3,
539 Lanczos2 = 4,
541 Lanczos3 = 5,
543 Mks2013 = 6,
545 Mks2021 = 7,
547 Last = 8,
549}
550
551#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
552pub enum OperationBoolean {
553 And = 0,
555 Or = 1,
557 Eor = 2,
559 Lshift = 3,
561 Rshift = 4,
563 Last = 5,
565}
566
567#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
568pub enum OperationComplex {
569 Polar = 0,
571 Rect = 1,
573 Conj = 2,
575 Last = 3,
577}
578
579#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
580pub enum OperationComplex2 {
581 CrossPhase = 0,
583 Last = 1,
585}
586
587#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
588pub enum OperationComplexget {
589 Real = 0,
591 Imag = 1,
593 Last = 2,
595}
596
597#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
598pub enum OperationMath {
599 Sin = 0,
601 Co = 1,
603 Tan = 2,
605 Asin = 3,
607 Aco = 4,
609 Atan = 5,
611 Log = 6,
613 Log10 = 7,
615 Exp = 8,
617 Exp10 = 9,
619 Sinh = 10,
621 Cosh = 11,
623 Tanh = 12,
625 Asinh = 13,
627 Acosh = 14,
629 Atanh = 15,
631 Last = 16,
633}
634
635#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
636pub enum OperationMath2 {
637 Pow = 0,
639 Wop = 1,
641 Atan2 = 2,
643 Last = 3,
645}
646
647#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
648pub enum OperationMorphology {
649 Erode = 0,
651 Dilate = 1,
653 Last = 2,
655}
656
657#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
658pub enum OperationRelational {
659 Equal = 0,
661 Noteq = 1,
663 Less = 2,
665 Lesseq = 3,
667 More = 4,
669 Moreeq = 5,
671 Last = 6,
673}
674
675#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
676pub enum OperationRound {
677 Rint = 0,
679 Ceil = 1,
681 Floor = 2,
683 Last = 3,
685}
686
687#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
688pub enum PCS {
689 Lab = 0,
691 Xyz = 1,
693 Last = 2,
695}
696
697#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
698pub enum Precision {
699 Integer = 0,
701 Float = 1,
703 Approximate = 2,
705 Last = 3,
707}
708
709#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
710pub enum RegionShrink {
711 Mean = 0,
713 Median = 1,
715 Mode = 2,
717 Max = 3,
719 Min = 4,
721 Nearest = 5,
723 Last = 6,
725}
726
727#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
728pub enum SdfShape {
729 Circle = 0,
731 Box = 1,
733 RoundedBox = 2,
735 Line = 3,
737 Last = 4,
739}
740
741#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
742pub enum Size {
743 Both = 0,
745 Up = 1,
747 Down = 2,
749 Force = 3,
751 Last = 4,
753}
754
755#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
756pub enum TextWrap {
757 Word = 0,
759 Char = 1,
761 WordChar = 2,
763 None = 3,
765 Last = 4,
767}
768
769pub fn system(cmd_format: &str) -> Result<()> {
773 unsafe {
774 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
775
776 let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
777 utils::result(vips_op_response, (), Error::SystemError)
778 }
779}
780
781#[derive(Clone, Debug)]
783pub struct SystemOptions {
784 pub inp: Vec<VipsImage>,
786 pub out: VipsImage,
788 pub log: String,
790 pub out_format: String,
792 pub in_format: String,
794}
795
796impl std::default::Default for SystemOptions {
797 fn default() -> Self {
798 SystemOptions {
799 inp: Vec::new(),
800 out: VipsImage::new(),
801 log: String::new(),
802 out_format: String::new(),
803 in_format: String::new(),
804 }
805 }
806}
807
808pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
813 unsafe {
814 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
815
816 let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
817 let inp_in = inp_wrapper.ctx;
818 let inp_in_name = utils::new_c_string("inp")?;
819
820 let out_in: *mut bindings::VipsImage = system_options.out.ctx;
821 let out_in_name = utils::new_c_string("out")?;
822
823 let log_in: CString = utils::new_c_string(&system_options.log)?;
824 let log_in_name = utils::new_c_string("log")?;
825
826 let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
827 let out_format_in_name = utils::new_c_string("out-format")?;
828
829 let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
830 let in_format_in_name = utils::new_c_string("in-format")?;
831
832 let vips_op_response = bindings::vips_system(
833 cmd_format_in.as_ptr(),
834 inp_in_name.as_ptr(),
835 inp_in,
836 out_in_name.as_ptr(),
837 out_in,
838 log_in_name.as_ptr(),
839 log_in.as_ptr(),
840 out_format_in_name.as_ptr(),
841 out_format_in.as_ptr(),
842 in_format_in_name.as_ptr(),
843 in_format_in.as_ptr(),
844 NULL,
845 );
846 utils::result(vips_op_response, (), Error::SystemError)
847 }
848}
849
850pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
855 unsafe {
856 let left_in: *mut bindings::VipsImage = left.ctx;
857 let right_in: *mut bindings::VipsImage = right.ctx;
858 let mut out_out: *mut bindings::VipsImage = null_mut();
859
860 let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
861 utils::result(
862 vips_op_response,
863 VipsImage { ctx: out_out },
864 Error::AddError,
865 )
866 }
867}
868
869pub fn minpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
874 unsafe {
875 let left_in: *mut bindings::VipsImage = left.ctx;
876 let right_in: *mut bindings::VipsImage = right.ctx;
877 let mut out_out: *mut bindings::VipsImage = null_mut();
878
879 let vips_op_response = bindings::vips_minpair(left_in, right_in, &mut out_out, NULL);
880 utils::result(
881 vips_op_response,
882 VipsImage { ctx: out_out },
883 Error::MinpairError,
884 )
885 }
886}
887
888pub fn maxpair(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
893 unsafe {
894 let left_in: *mut bindings::VipsImage = left.ctx;
895 let right_in: *mut bindings::VipsImage = right.ctx;
896 let mut out_out: *mut bindings::VipsImage = null_mut();
897
898 let vips_op_response = bindings::vips_maxpair(left_in, right_in, &mut out_out, NULL);
899 utils::result(
900 vips_op_response,
901 VipsImage { ctx: out_out },
902 Error::MaxpairError,
903 )
904 }
905}
906
907pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
912 unsafe {
913 let left_in: *mut bindings::VipsImage = left.ctx;
914 let right_in: *mut bindings::VipsImage = right.ctx;
915 let mut out_out: *mut bindings::VipsImage = null_mut();
916
917 let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
918 utils::result(
919 vips_op_response,
920 VipsImage { ctx: out_out },
921 Error::SubtractError,
922 )
923 }
924}
925
926pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
931 unsafe {
932 let left_in: *mut bindings::VipsImage = left.ctx;
933 let right_in: *mut bindings::VipsImage = right.ctx;
934 let mut out_out: *mut bindings::VipsImage = null_mut();
935
936 let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
937 utils::result(
938 vips_op_response,
939 VipsImage { ctx: out_out },
940 Error::MultiplyError,
941 )
942 }
943}
944
945pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
950 unsafe {
951 let left_in: *mut bindings::VipsImage = left.ctx;
952 let right_in: *mut bindings::VipsImage = right.ctx;
953 let mut out_out: *mut bindings::VipsImage = null_mut();
954
955 let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
956 utils::result(
957 vips_op_response,
958 VipsImage { ctx: out_out },
959 Error::DivideError,
960 )
961 }
962}
963
964pub fn relational(
977 left: &VipsImage,
978 right: &VipsImage,
979 relational: OperationRelational,
980) -> Result<VipsImage> {
981 unsafe {
982 let left_in: *mut bindings::VipsImage = left.ctx;
983 let right_in: *mut bindings::VipsImage = right.ctx;
984 let relational_in: i32 = relational as i32;
985 let mut out_out: *mut bindings::VipsImage = null_mut();
986
987 let vips_op_response = bindings::vips_relational(
988 left_in,
989 right_in,
990 &mut out_out,
991 relational_in.try_into().unwrap(),
992 NULL,
993 );
994 utils::result(
995 vips_op_response,
996 VipsImage { ctx: out_out },
997 Error::RelationalError,
998 )
999 }
1000}
1001
1002pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1007 unsafe {
1008 let left_in: *mut bindings::VipsImage = left.ctx;
1009 let right_in: *mut bindings::VipsImage = right.ctx;
1010 let mut out_out: *mut bindings::VipsImage = null_mut();
1011
1012 let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
1013 utils::result(
1014 vips_op_response,
1015 VipsImage { ctx: out_out },
1016 Error::RemainderError,
1017 )
1018 }
1019}
1020
1021pub fn boolean(
1033 left: &VipsImage,
1034 right: &VipsImage,
1035 boolean: OperationBoolean,
1036) -> Result<VipsImage> {
1037 unsafe {
1038 let left_in: *mut bindings::VipsImage = left.ctx;
1039 let right_in: *mut bindings::VipsImage = right.ctx;
1040 let boolean_in: i32 = boolean as i32;
1041 let mut out_out: *mut bindings::VipsImage = null_mut();
1042
1043 let vips_op_response = bindings::vips_boolean(
1044 left_in,
1045 right_in,
1046 &mut out_out,
1047 boolean_in.try_into().unwrap(),
1048 NULL,
1049 );
1050 utils::result(
1051 vips_op_response,
1052 VipsImage { ctx: out_out },
1053 Error::BooleanError,
1054 )
1055 }
1056}
1057
1058pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1068 unsafe {
1069 let left_in: *mut bindings::VipsImage = left.ctx;
1070 let right_in: *mut bindings::VipsImage = right.ctx;
1071 let math_2_in: i32 = math_2 as i32;
1072 let mut out_out: *mut bindings::VipsImage = null_mut();
1073
1074 let vips_op_response = bindings::vips_math2(
1075 left_in,
1076 right_in,
1077 &mut out_out,
1078 math_2_in.try_into().unwrap(),
1079 NULL,
1080 );
1081 utils::result(
1082 vips_op_response,
1083 VipsImage { ctx: out_out },
1084 Error::Math2Error,
1085 )
1086 }
1087}
1088
1089pub fn complex_2(
1097 left: &VipsImage,
1098 right: &VipsImage,
1099 cmplx: OperationComplex2,
1100) -> Result<VipsImage> {
1101 unsafe {
1102 let left_in: *mut bindings::VipsImage = left.ctx;
1103 let right_in: *mut bindings::VipsImage = right.ctx;
1104 let cmplx_in: i32 = cmplx as i32;
1105 let mut out_out: *mut bindings::VipsImage = null_mut();
1106
1107 let vips_op_response = bindings::vips_complex2(
1108 left_in,
1109 right_in,
1110 &mut out_out,
1111 cmplx_in.try_into().unwrap(),
1112 NULL,
1113 );
1114 utils::result(
1115 vips_op_response,
1116 VipsImage { ctx: out_out },
1117 Error::Complex2Error,
1118 )
1119 }
1120}
1121
1122pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1127 unsafe {
1128 let left_in: *mut bindings::VipsImage = left.ctx;
1129 let right_in: *mut bindings::VipsImage = right.ctx;
1130 let mut out_out: *mut bindings::VipsImage = null_mut();
1131
1132 let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1133 utils::result(
1134 vips_op_response,
1135 VipsImage { ctx: out_out },
1136 Error::ComplexformError,
1137 )
1138 }
1139}
1140
1141pub fn clamp(inp: &VipsImage) -> Result<VipsImage> {
1145 unsafe {
1146 let inp_in: *mut bindings::VipsImage = inp.ctx;
1147 let mut out_out: *mut bindings::VipsImage = null_mut();
1148
1149 let vips_op_response = bindings::vips_clamp(inp_in, &mut out_out, NULL);
1150 utils::result(
1151 vips_op_response,
1152 VipsImage { ctx: out_out },
1153 Error::ClampError,
1154 )
1155 }
1156}
1157
1158#[derive(Clone, Debug)]
1160pub struct ClampOptions {
1161 pub min: f64,
1164 pub max: f64,
1167}
1168
1169impl std::default::Default for ClampOptions {
1170 fn default() -> Self {
1171 ClampOptions {
1172 min: f64::from(0),
1173 max: f64::from(1),
1174 }
1175 }
1176}
1177
1178pub fn clamp_with_opts(inp: &VipsImage, clamp_options: &ClampOptions) -> Result<VipsImage> {
1183 unsafe {
1184 let inp_in: *mut bindings::VipsImage = inp.ctx;
1185 let mut out_out: *mut bindings::VipsImage = null_mut();
1186
1187 let min_in: f64 = clamp_options.min;
1188 let min_in_name = utils::new_c_string("min")?;
1189
1190 let max_in: f64 = clamp_options.max;
1191 let max_in_name = utils::new_c_string("max")?;
1192
1193 let vips_op_response = bindings::vips_clamp(
1194 inp_in,
1195 &mut out_out,
1196 min_in_name.as_ptr(),
1197 min_in,
1198 max_in_name.as_ptr(),
1199 max_in,
1200 NULL,
1201 );
1202 utils::result(
1203 vips_op_response,
1204 VipsImage { ctx: out_out },
1205 Error::ClampError,
1206 )
1207 }
1208}
1209
1210pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1214 unsafe {
1215 let inp_in: *mut bindings::VipsImage = inp.ctx;
1216 let mut out_out: *mut bindings::VipsImage = null_mut();
1217
1218 let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1219 utils::result(
1220 vips_op_response,
1221 VipsImage { ctx: out_out },
1222 Error::InvertError,
1223 )
1224 }
1225}
1226
1227pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1249 unsafe {
1250 let inp_in: *mut bindings::VipsImage = inp.ctx;
1251 let math_in: i32 = math as i32;
1252 let mut out_out: *mut bindings::VipsImage = null_mut();
1253
1254 let vips_op_response =
1255 bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1256 utils::result(
1257 vips_op_response,
1258 VipsImage { ctx: out_out },
1259 Error::MathError,
1260 )
1261 }
1262}
1263
1264pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1268 unsafe {
1269 let inp_in: *mut bindings::VipsImage = inp.ctx;
1270 let mut out_out: *mut bindings::VipsImage = null_mut();
1271
1272 let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1273 utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1274 }
1275}
1276
1277pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1281 unsafe {
1282 let inp_in: *mut bindings::VipsImage = inp.ctx;
1283 let mut out_out: *mut bindings::VipsImage = null_mut();
1284
1285 let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1286 utils::result(
1287 vips_op_response,
1288 VipsImage { ctx: out_out },
1289 Error::SignError,
1290 )
1291 }
1292}
1293
1294pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1303 unsafe {
1304 let inp_in: *mut bindings::VipsImage = inp.ctx;
1305 let round_in: i32 = round as i32;
1306 let mut out_out: *mut bindings::VipsImage = null_mut();
1307
1308 let vips_op_response =
1309 bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1310 utils::result(
1311 vips_op_response,
1312 VipsImage { ctx: out_out },
1313 Error::RoundError,
1314 )
1315 }
1316}
1317
1318pub fn relational_const(
1331 inp: &VipsImage,
1332 relational: OperationRelational,
1333 c: &mut [f64],
1334) -> Result<VipsImage> {
1335 unsafe {
1336 let inp_in: *mut bindings::VipsImage = inp.ctx;
1337 let relational_in: i32 = relational as i32;
1338 let c_in: *mut f64 = c.as_mut_ptr();
1339 let mut out_out: *mut bindings::VipsImage = null_mut();
1340
1341 let vips_op_response = bindings::vips_relational_const(
1342 inp_in,
1343 &mut out_out,
1344 relational_in.try_into().unwrap(),
1345 c_in,
1346 c.len() as i32,
1347 NULL,
1348 );
1349 utils::result(
1350 vips_op_response,
1351 VipsImage { ctx: out_out },
1352 Error::RelationalConstError,
1353 )
1354 }
1355}
1356
1357pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1362 unsafe {
1363 let inp_in: *mut bindings::VipsImage = inp.ctx;
1364 let c_in: *mut f64 = c.as_mut_ptr();
1365 let mut out_out: *mut bindings::VipsImage = null_mut();
1366
1367 let vips_op_response =
1368 bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1369 utils::result(
1370 vips_op_response,
1371 VipsImage { ctx: out_out },
1372 Error::RemainderConstError,
1373 )
1374 }
1375}
1376
1377pub fn boolean_const(
1389 inp: &VipsImage,
1390 boolean: OperationBoolean,
1391 c: &mut [f64],
1392) -> Result<VipsImage> {
1393 unsafe {
1394 let inp_in: *mut bindings::VipsImage = inp.ctx;
1395 let boolean_in: i32 = boolean as i32;
1396 let c_in: *mut f64 = c.as_mut_ptr();
1397 let mut out_out: *mut bindings::VipsImage = null_mut();
1398
1399 let vips_op_response = bindings::vips_boolean_const(
1400 inp_in,
1401 &mut out_out,
1402 boolean_in.try_into().unwrap(),
1403 c_in,
1404 c.len() as i32,
1405 NULL,
1406 );
1407 utils::result(
1408 vips_op_response,
1409 VipsImage { ctx: out_out },
1410 Error::BooleanConstError,
1411 )
1412 }
1413}
1414
1415pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1425 unsafe {
1426 let inp_in: *mut bindings::VipsImage = inp.ctx;
1427 let math_2_in: i32 = math_2 as i32;
1428 let c_in: *mut f64 = c.as_mut_ptr();
1429 let mut out_out: *mut bindings::VipsImage = null_mut();
1430
1431 let vips_op_response = bindings::vips_math2_const(
1432 inp_in,
1433 &mut out_out,
1434 math_2_in.try_into().unwrap(),
1435 c_in,
1436 c.len() as i32,
1437 NULL,
1438 );
1439 utils::result(
1440 vips_op_response,
1441 VipsImage { ctx: out_out },
1442 Error::Math2ConstError,
1443 )
1444 }
1445}
1446
1447pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1456 unsafe {
1457 let inp_in: *mut bindings::VipsImage = inp.ctx;
1458 let cmplx_in: i32 = cmplx as i32;
1459 let mut out_out: *mut bindings::VipsImage = null_mut();
1460
1461 let vips_op_response =
1462 bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1463 utils::result(
1464 vips_op_response,
1465 VipsImage { ctx: out_out },
1466 Error::ComplexError,
1467 )
1468 }
1469}
1470
1471pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1479 unsafe {
1480 let inp_in: *mut bindings::VipsImage = inp.ctx;
1481 let get_in: i32 = get as i32;
1482 let mut out_out: *mut bindings::VipsImage = null_mut();
1483
1484 let vips_op_response =
1485 bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1486 utils::result(
1487 vips_op_response,
1488 VipsImage { ctx: out_out },
1489 Error::ComplexgetError,
1490 )
1491 }
1492}
1493
1494pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1498 unsafe {
1499 let (inp_len, mut inp_in) = {
1500 let len = inp.len();
1501 let mut input = Vec::new();
1502 for img in inp {
1503 input.push(img.ctx)
1504 }
1505 (len as i32, input)
1506 };
1507 let mut out_out: *mut bindings::VipsImage = null_mut();
1508
1509 let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1510 utils::result(
1511 vips_op_response,
1512 VipsImage { ctx: out_out },
1513 Error::SumError,
1514 )
1515 }
1516}
1517
1518pub fn avg(inp: &VipsImage) -> Result<f64> {
1522 unsafe {
1523 let inp_in: *mut bindings::VipsImage = inp.ctx;
1524 let mut out_out: f64 = f64::from(0);
1525
1526 let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1527 utils::result(vips_op_response, out_out, Error::AvgError)
1528 }
1529}
1530
1531pub fn min(inp: &VipsImage) -> Result<f64> {
1535 unsafe {
1536 let inp_in: *mut bindings::VipsImage = inp.ctx;
1537 let mut out_out: f64 = f64::from(0);
1538
1539 let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1540 utils::result(vips_op_response, out_out, Error::MinError)
1541 }
1542}
1543
1544#[derive(Clone, Debug)]
1546pub struct MinOptions {
1547 pub x: i32,
1550 pub y: i32,
1553 pub size: i32,
1556 pub out_array: Vec<f64>,
1558 pub x_array: Vec<i32>,
1560 pub y_array: Vec<i32>,
1562}
1563
1564impl std::default::Default for MinOptions {
1565 fn default() -> Self {
1566 MinOptions {
1567 x: i32::from(0),
1568 y: i32::from(0),
1569 size: i32::from(1),
1570 out_array: Vec::new(),
1571 x_array: Vec::new(),
1572 y_array: Vec::new(),
1573 }
1574 }
1575}
1576
1577pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1582 unsafe {
1583 let inp_in: *mut bindings::VipsImage = inp.ctx;
1584 let mut out_out: f64 = f64::from(0);
1585
1586 let x_in: i32 = min_options.x;
1587 let x_in_name = utils::new_c_string("x")?;
1588
1589 let y_in: i32 = min_options.y;
1590 let y_in_name = utils::new_c_string("y")?;
1591
1592 let size_in: i32 = min_options.size;
1593 let size_in_name = utils::new_c_string("size")?;
1594
1595 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1596 let out_array_in = out_array_wrapper.ctx;
1597 let out_array_in_name = utils::new_c_string("out-array")?;
1598
1599 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1600 let x_array_in = x_array_wrapper.ctx;
1601 let x_array_in_name = utils::new_c_string("x-array")?;
1602
1603 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1604 let y_array_in = y_array_wrapper.ctx;
1605 let y_array_in_name = utils::new_c_string("y-array")?;
1606
1607 let vips_op_response = bindings::vips_min(
1608 inp_in,
1609 &mut out_out,
1610 x_in_name.as_ptr(),
1611 x_in,
1612 y_in_name.as_ptr(),
1613 y_in,
1614 size_in_name.as_ptr(),
1615 size_in,
1616 out_array_in_name.as_ptr(),
1617 out_array_in,
1618 x_array_in_name.as_ptr(),
1619 x_array_in,
1620 y_array_in_name.as_ptr(),
1621 y_array_in,
1622 NULL,
1623 );
1624 utils::result(vips_op_response, out_out, Error::MinError)
1625 }
1626}
1627
1628pub fn max(inp: &VipsImage) -> Result<f64> {
1632 unsafe {
1633 let inp_in: *mut bindings::VipsImage = inp.ctx;
1634 let mut out_out: f64 = f64::from(0);
1635
1636 let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1637 utils::result(vips_op_response, out_out, Error::MaxError)
1638 }
1639}
1640
1641#[derive(Clone, Debug)]
1643pub struct MaxOptions {
1644 pub x: i32,
1647 pub y: i32,
1650 pub size: i32,
1653 pub out_array: Vec<f64>,
1655 pub x_array: Vec<i32>,
1657 pub y_array: Vec<i32>,
1659}
1660
1661impl std::default::Default for MaxOptions {
1662 fn default() -> Self {
1663 MaxOptions {
1664 x: i32::from(0),
1665 y: i32::from(0),
1666 size: i32::from(1),
1667 out_array: Vec::new(),
1668 x_array: Vec::new(),
1669 y_array: Vec::new(),
1670 }
1671 }
1672}
1673
1674pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1679 unsafe {
1680 let inp_in: *mut bindings::VipsImage = inp.ctx;
1681 let mut out_out: f64 = f64::from(0);
1682
1683 let x_in: i32 = max_options.x;
1684 let x_in_name = utils::new_c_string("x")?;
1685
1686 let y_in: i32 = max_options.y;
1687 let y_in_name = utils::new_c_string("y")?;
1688
1689 let size_in: i32 = max_options.size;
1690 let size_in_name = utils::new_c_string("size")?;
1691
1692 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1693 let out_array_in = out_array_wrapper.ctx;
1694 let out_array_in_name = utils::new_c_string("out-array")?;
1695
1696 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1697 let x_array_in = x_array_wrapper.ctx;
1698 let x_array_in_name = utils::new_c_string("x-array")?;
1699
1700 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1701 let y_array_in = y_array_wrapper.ctx;
1702 let y_array_in_name = utils::new_c_string("y-array")?;
1703
1704 let vips_op_response = bindings::vips_max(
1705 inp_in,
1706 &mut out_out,
1707 x_in_name.as_ptr(),
1708 x_in,
1709 y_in_name.as_ptr(),
1710 y_in,
1711 size_in_name.as_ptr(),
1712 size_in,
1713 out_array_in_name.as_ptr(),
1714 out_array_in,
1715 x_array_in_name.as_ptr(),
1716 x_array_in,
1717 y_array_in_name.as_ptr(),
1718 y_array_in,
1719 NULL,
1720 );
1721 utils::result(vips_op_response, out_out, Error::MaxError)
1722 }
1723}
1724
1725pub fn deviate(inp: &VipsImage) -> Result<f64> {
1729 unsafe {
1730 let inp_in: *mut bindings::VipsImage = inp.ctx;
1731 let mut out_out: f64 = f64::from(0);
1732
1733 let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1734 utils::result(vips_op_response, out_out, Error::DeviateError)
1735 }
1736}
1737
1738pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1742 unsafe {
1743 let inp_in: *mut bindings::VipsImage = inp.ctx;
1744 let mut out_out: *mut bindings::VipsImage = null_mut();
1745
1746 let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1747 utils::result(
1748 vips_op_response,
1749 VipsImage { ctx: out_out },
1750 Error::StatError,
1751 )
1752 }
1753}
1754
1755pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1759 unsafe {
1760 let inp_in: *mut bindings::VipsImage = inp.ctx;
1761 let mut out_out: *mut bindings::VipsImage = null_mut();
1762
1763 let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1764 utils::result(
1765 vips_op_response,
1766 VipsImage { ctx: out_out },
1767 Error::HistFindError,
1768 )
1769 }
1770}
1771
1772#[derive(Clone, Debug)]
1774pub struct HistFindOptions {
1775 pub band: i32,
1778}
1779
1780impl std::default::Default for HistFindOptions {
1781 fn default() -> Self {
1782 HistFindOptions {
1783 band: i32::from(-1),
1784 }
1785 }
1786}
1787
1788pub fn hist_find_with_opts(
1793 inp: &VipsImage,
1794 hist_find_options: &HistFindOptions,
1795) -> Result<VipsImage> {
1796 unsafe {
1797 let inp_in: *mut bindings::VipsImage = inp.ctx;
1798 let mut out_out: *mut bindings::VipsImage = null_mut();
1799
1800 let band_in: i32 = hist_find_options.band;
1801 let band_in_name = utils::new_c_string("band")?;
1802
1803 let vips_op_response =
1804 bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1805 utils::result(
1806 vips_op_response,
1807 VipsImage { ctx: out_out },
1808 Error::HistFindError,
1809 )
1810 }
1811}
1812
1813pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1817 unsafe {
1818 let inp_in: *mut bindings::VipsImage = inp.ctx;
1819 let mut out_out: *mut bindings::VipsImage = null_mut();
1820
1821 let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1822 utils::result(
1823 vips_op_response,
1824 VipsImage { ctx: out_out },
1825 Error::HistFindNdimError,
1826 )
1827 }
1828}
1829
1830#[derive(Clone, Debug)]
1832pub struct HistFindNdimOptions {
1833 pub bins: i32,
1836}
1837
1838impl std::default::Default for HistFindNdimOptions {
1839 fn default() -> Self {
1840 HistFindNdimOptions {
1841 bins: i32::from(10),
1842 }
1843 }
1844}
1845
1846pub fn hist_find_ndim_with_opts(
1851 inp: &VipsImage,
1852 hist_find_ndim_options: &HistFindNdimOptions,
1853) -> Result<VipsImage> {
1854 unsafe {
1855 let inp_in: *mut bindings::VipsImage = inp.ctx;
1856 let mut out_out: *mut bindings::VipsImage = null_mut();
1857
1858 let bins_in: i32 = hist_find_ndim_options.bins;
1859 let bins_in_name = utils::new_c_string("bins")?;
1860
1861 let vips_op_response = bindings::vips_hist_find_ndim(
1862 inp_in,
1863 &mut out_out,
1864 bins_in_name.as_ptr(),
1865 bins_in,
1866 NULL,
1867 );
1868 utils::result(
1869 vips_op_response,
1870 VipsImage { ctx: out_out },
1871 Error::HistFindNdimError,
1872 )
1873 }
1874}
1875
1876pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1881 unsafe {
1882 let inp_in: *mut bindings::VipsImage = inp.ctx;
1883 let index_in: *mut bindings::VipsImage = index.ctx;
1884 let mut out_out: *mut bindings::VipsImage = null_mut();
1885
1886 let vips_op_response =
1887 bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1888 utils::result(
1889 vips_op_response,
1890 VipsImage { ctx: out_out },
1891 Error::HistFindIndexedError,
1892 )
1893 }
1894}
1895
1896#[derive(Clone, Debug)]
1898pub struct HistFindIndexedOptions {
1899 pub combine: Combine,
1905}
1906
1907impl std::default::Default for HistFindIndexedOptions {
1908 fn default() -> Self {
1909 HistFindIndexedOptions {
1910 combine: Combine::Sum,
1911 }
1912 }
1913}
1914
1915pub fn hist_find_indexed_with_opts(
1921 inp: &VipsImage,
1922 index: &VipsImage,
1923 hist_find_indexed_options: &HistFindIndexedOptions,
1924) -> Result<VipsImage> {
1925 unsafe {
1926 let inp_in: *mut bindings::VipsImage = inp.ctx;
1927 let index_in: *mut bindings::VipsImage = index.ctx;
1928 let mut out_out: *mut bindings::VipsImage = null_mut();
1929
1930 let combine_in: i32 = hist_find_indexed_options.combine as i32;
1931 let combine_in_name = utils::new_c_string("combine")?;
1932
1933 let vips_op_response = bindings::vips_hist_find_indexed(
1934 inp_in,
1935 index_in,
1936 &mut out_out,
1937 combine_in_name.as_ptr(),
1938 combine_in,
1939 NULL,
1940 );
1941 utils::result(
1942 vips_op_response,
1943 VipsImage { ctx: out_out },
1944 Error::HistFindIndexedError,
1945 )
1946 }
1947}
1948
1949pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1953 unsafe {
1954 let inp_in: *mut bindings::VipsImage = inp.ctx;
1955 let mut out_out: *mut bindings::VipsImage = null_mut();
1956
1957 let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1958 utils::result(
1959 vips_op_response,
1960 VipsImage { ctx: out_out },
1961 Error::HoughLineError,
1962 )
1963 }
1964}
1965
1966#[derive(Clone, Debug)]
1968pub struct HoughLineOptions {
1969 pub width: i32,
1972 pub height: i32,
1975}
1976
1977impl std::default::Default for HoughLineOptions {
1978 fn default() -> Self {
1979 HoughLineOptions {
1980 width: i32::from(256),
1981 height: i32::from(256),
1982 }
1983 }
1984}
1985
1986pub fn hough_line_with_opts(
1991 inp: &VipsImage,
1992 hough_line_options: &HoughLineOptions,
1993) -> Result<VipsImage> {
1994 unsafe {
1995 let inp_in: *mut bindings::VipsImage = inp.ctx;
1996 let mut out_out: *mut bindings::VipsImage = null_mut();
1997
1998 let width_in: i32 = hough_line_options.width;
1999 let width_in_name = utils::new_c_string("width")?;
2000
2001 let height_in: i32 = hough_line_options.height;
2002 let height_in_name = utils::new_c_string("height")?;
2003
2004 let vips_op_response = bindings::vips_hough_line(
2005 inp_in,
2006 &mut out_out,
2007 width_in_name.as_ptr(),
2008 width_in,
2009 height_in_name.as_ptr(),
2010 height_in,
2011 NULL,
2012 );
2013 utils::result(
2014 vips_op_response,
2015 VipsImage { ctx: out_out },
2016 Error::HoughLineError,
2017 )
2018 }
2019}
2020
2021pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
2025 unsafe {
2026 let inp_in: *mut bindings::VipsImage = inp.ctx;
2027 let mut out_out: *mut bindings::VipsImage = null_mut();
2028
2029 let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
2030 utils::result(
2031 vips_op_response,
2032 VipsImage { ctx: out_out },
2033 Error::HoughCircleError,
2034 )
2035 }
2036}
2037
2038#[derive(Clone, Debug)]
2040pub struct HoughCircleOptions {
2041 pub scale: i32,
2044 pub min_radius: i32,
2047 pub max_radius: i32,
2050}
2051
2052impl std::default::Default for HoughCircleOptions {
2053 fn default() -> Self {
2054 HoughCircleOptions {
2055 scale: i32::from(1),
2056 min_radius: i32::from(10),
2057 max_radius: i32::from(20),
2058 }
2059 }
2060}
2061
2062pub fn hough_circle_with_opts(
2067 inp: &VipsImage,
2068 hough_circle_options: &HoughCircleOptions,
2069) -> Result<VipsImage> {
2070 unsafe {
2071 let inp_in: *mut bindings::VipsImage = inp.ctx;
2072 let mut out_out: *mut bindings::VipsImage = null_mut();
2073
2074 let scale_in: i32 = hough_circle_options.scale;
2075 let scale_in_name = utils::new_c_string("scale")?;
2076
2077 let min_radius_in: i32 = hough_circle_options.min_radius;
2078 let min_radius_in_name = utils::new_c_string("min-radius")?;
2079
2080 let max_radius_in: i32 = hough_circle_options.max_radius;
2081 let max_radius_in_name = utils::new_c_string("max-radius")?;
2082
2083 let vips_op_response = bindings::vips_hough_circle(
2084 inp_in,
2085 &mut out_out,
2086 scale_in_name.as_ptr(),
2087 scale_in,
2088 min_radius_in_name.as_ptr(),
2089 min_radius_in,
2090 max_radius_in_name.as_ptr(),
2091 max_radius_in,
2092 NULL,
2093 );
2094 utils::result(
2095 vips_op_response,
2096 VipsImage { ctx: out_out },
2097 Error::HoughCircleError,
2098 )
2099 }
2100}
2101
2102pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2109 unsafe {
2110 let inp_in: *mut bindings::VipsImage = inp.ctx;
2111 let mut columns_out: *mut bindings::VipsImage = null_mut();
2112 let mut rows_out: *mut bindings::VipsImage = null_mut();
2113
2114 let vips_op_response =
2115 bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2116 utils::result(
2117 vips_op_response,
2118 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2119 Error::ProjectError,
2120 )
2121 }
2122}
2123
2124pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2131 unsafe {
2132 let inp_in: *mut bindings::VipsImage = inp.ctx;
2133 let mut columns_out: *mut bindings::VipsImage = null_mut();
2134 let mut rows_out: *mut bindings::VipsImage = null_mut();
2135
2136 let vips_op_response =
2137 bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2138 utils::result(
2139 vips_op_response,
2140 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2141 Error::ProfileError,
2142 )
2143 }
2144}
2145
2146pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2154 unsafe {
2155 let inp_in: *mut bindings::VipsImage = inp.ctx;
2156 let h_in: i32 = h;
2157 let v_in: i32 = v;
2158 let mut out_out: *mut bindings::VipsImage = null_mut();
2159
2160 let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2161 utils::result(
2162 vips_op_response,
2163 VipsImage { ctx: out_out },
2164 Error::MeasureError,
2165 )
2166 }
2167}
2168
2169#[derive(Clone, Debug)]
2171pub struct MeasureOptions {
2172 pub left: i32,
2175 pub top: i32,
2178 pub width: i32,
2181 pub height: i32,
2184}
2185
2186impl std::default::Default for MeasureOptions {
2187 fn default() -> Self {
2188 MeasureOptions {
2189 left: i32::from(0),
2190 top: i32::from(0),
2191 width: i32::from(1),
2192 height: i32::from(1),
2193 }
2194 }
2195}
2196
2197pub fn measure_with_opts(
2206 inp: &VipsImage,
2207 h: i32,
2208 v: i32,
2209 measure_options: &MeasureOptions,
2210) -> Result<VipsImage> {
2211 unsafe {
2212 let inp_in: *mut bindings::VipsImage = inp.ctx;
2213 let h_in: i32 = h;
2214 let v_in: i32 = v;
2215 let mut out_out: *mut bindings::VipsImage = null_mut();
2216
2217 let left_in: i32 = measure_options.left;
2218 let left_in_name = utils::new_c_string("left")?;
2219
2220 let top_in: i32 = measure_options.top;
2221 let top_in_name = utils::new_c_string("top")?;
2222
2223 let width_in: i32 = measure_options.width;
2224 let width_in_name = utils::new_c_string("width")?;
2225
2226 let height_in: i32 = measure_options.height;
2227 let height_in_name = utils::new_c_string("height")?;
2228
2229 let vips_op_response = bindings::vips_measure(
2230 inp_in,
2231 &mut out_out,
2232 h_in,
2233 v_in,
2234 left_in_name.as_ptr(),
2235 left_in,
2236 top_in_name.as_ptr(),
2237 top_in,
2238 width_in_name.as_ptr(),
2239 width_in,
2240 height_in_name.as_ptr(),
2241 height_in,
2242 NULL,
2243 );
2244 utils::result(
2245 vips_op_response,
2246 VipsImage { ctx: out_out },
2247 Error::MeasureError,
2248 )
2249 }
2250}
2251
2252pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2261 unsafe {
2262 let inp_in: *mut bindings::VipsImage = inp.ctx;
2263 let mut left_out: i32 = i32::from(1);
2264 let mut top_out: i32 = i32::from(0);
2265 let mut width_out: i32 = i32::from(1);
2266 let mut height_out: i32 = i32::from(1);
2267
2268 let vips_op_response = bindings::vips_find_trim(
2269 inp_in,
2270 &mut left_out,
2271 &mut top_out,
2272 &mut width_out,
2273 &mut height_out,
2274 NULL,
2275 );
2276 utils::result(
2277 vips_op_response,
2278 (left_out, top_out, width_out, height_out),
2279 Error::FindTrimError,
2280 )
2281 }
2282}
2283
2284#[derive(Clone, Debug)]
2286pub struct FindTrimOptions {
2287 pub threshold: f64,
2290 pub background: Vec<f64>,
2292 pub line_art: bool,
2295}
2296
2297impl std::default::Default for FindTrimOptions {
2298 fn default() -> Self {
2299 FindTrimOptions {
2300 threshold: f64::from(10),
2301 background: Vec::new(),
2302 line_art: false,
2303 }
2304 }
2305}
2306
2307pub fn find_trim_with_opts(
2317 inp: &VipsImage,
2318 find_trim_options: &FindTrimOptions,
2319) -> Result<(i32, i32, i32, i32)> {
2320 unsafe {
2321 let inp_in: *mut bindings::VipsImage = inp.ctx;
2322 let mut left_out: i32 = i32::from(1);
2323 let mut top_out: i32 = i32::from(0);
2324 let mut width_out: i32 = i32::from(1);
2325 let mut height_out: i32 = i32::from(1);
2326
2327 let threshold_in: f64 = find_trim_options.threshold;
2328 let threshold_in_name = utils::new_c_string("threshold")?;
2329
2330 let background_wrapper =
2331 utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2332 let background_in = background_wrapper.ctx;
2333 let background_in_name = utils::new_c_string("background")?;
2334
2335 let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2336 let line_art_in_name = utils::new_c_string("line-art")?;
2337
2338 let vips_op_response = bindings::vips_find_trim(
2339 inp_in,
2340 &mut left_out,
2341 &mut top_out,
2342 &mut width_out,
2343 &mut height_out,
2344 threshold_in_name.as_ptr(),
2345 threshold_in,
2346 background_in_name.as_ptr(),
2347 background_in,
2348 line_art_in_name.as_ptr(),
2349 line_art_in,
2350 NULL,
2351 );
2352 utils::result(
2353 vips_op_response,
2354 (left_out, top_out, width_out, height_out),
2355 Error::FindTrimError,
2356 )
2357 }
2358}
2359
2360pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2364 unsafe {
2365 let inp_in: *mut bindings::VipsImage = inp.ctx;
2366 let mut out_out: *mut bindings::VipsImage = null_mut();
2367
2368 let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2369 utils::result(
2370 vips_op_response,
2371 VipsImage { ctx: out_out },
2372 Error::CopyError,
2373 )
2374 }
2375}
2376
2377#[derive(Clone, Debug)]
2379pub struct CopyOptions {
2380 pub width: i32,
2383 pub height: i32,
2386 pub bands: i32,
2389 pub format: BandFormat,
2403 pub coding: Coding,
2410 pub interpretation: Interpretation,
2433 pub xres: f64,
2436 pub yres: f64,
2439 pub xoffset: i32,
2442 pub yoffset: i32,
2445}
2446
2447impl std::default::Default for CopyOptions {
2448 fn default() -> Self {
2449 CopyOptions {
2450 width: i32::from(0),
2451 height: i32::from(0),
2452 bands: i32::from(0),
2453 format: BandFormat::Uchar,
2454 coding: Coding::None,
2455 interpretation: Interpretation::Multiband,
2456 xres: f64::from(0),
2457 yres: f64::from(0),
2458 xoffset: i32::from(0),
2459 yoffset: i32::from(0),
2460 }
2461 }
2462}
2463
2464pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2469 unsafe {
2470 let inp_in: *mut bindings::VipsImage = inp.ctx;
2471 let mut out_out: *mut bindings::VipsImage = null_mut();
2472
2473 let width_in: i32 = copy_options.width;
2474 let width_in_name = utils::new_c_string("width")?;
2475
2476 let height_in: i32 = copy_options.height;
2477 let height_in_name = utils::new_c_string("height")?;
2478
2479 let bands_in: i32 = copy_options.bands;
2480 let bands_in_name = utils::new_c_string("bands")?;
2481
2482 let format_in: i32 = copy_options.format as i32;
2483 let format_in_name = utils::new_c_string("format")?;
2484
2485 let coding_in: i32 = copy_options.coding as i32;
2486 let coding_in_name = utils::new_c_string("coding")?;
2487
2488 let interpretation_in: i32 = copy_options.interpretation as i32;
2489 let interpretation_in_name = utils::new_c_string("interpretation")?;
2490
2491 let xres_in: f64 = copy_options.xres;
2492 let xres_in_name = utils::new_c_string("xres")?;
2493
2494 let yres_in: f64 = copy_options.yres;
2495 let yres_in_name = utils::new_c_string("yres")?;
2496
2497 let xoffset_in: i32 = copy_options.xoffset;
2498 let xoffset_in_name = utils::new_c_string("xoffset")?;
2499
2500 let yoffset_in: i32 = copy_options.yoffset;
2501 let yoffset_in_name = utils::new_c_string("yoffset")?;
2502
2503 let vips_op_response = bindings::vips_copy(
2504 inp_in,
2505 &mut out_out,
2506 width_in_name.as_ptr(),
2507 width_in,
2508 height_in_name.as_ptr(),
2509 height_in,
2510 bands_in_name.as_ptr(),
2511 bands_in,
2512 format_in_name.as_ptr(),
2513 format_in,
2514 coding_in_name.as_ptr(),
2515 coding_in,
2516 interpretation_in_name.as_ptr(),
2517 interpretation_in,
2518 xres_in_name.as_ptr(),
2519 xres_in,
2520 yres_in_name.as_ptr(),
2521 yres_in,
2522 xoffset_in_name.as_ptr(),
2523 xoffset_in,
2524 yoffset_in_name.as_ptr(),
2525 yoffset_in,
2526 NULL,
2527 );
2528 utils::result(
2529 vips_op_response,
2530 VipsImage { ctx: out_out },
2531 Error::CopyError,
2532 )
2533 }
2534}
2535
2536pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2540 unsafe {
2541 let inp_in: *mut bindings::VipsImage = inp.ctx;
2542 let mut out_out: *mut bindings::VipsImage = null_mut();
2543
2544 let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2545 utils::result(
2546 vips_op_response,
2547 VipsImage { ctx: out_out },
2548 Error::TilecacheError,
2549 )
2550 }
2551}
2552
2553#[derive(Clone, Debug)]
2555pub struct TilecacheOptions {
2556 pub tile_width: i32,
2559 pub tile_height: i32,
2562 pub max_tiles: i32,
2565 pub access: Access,
2571 pub threaded: bool,
2574 pub persistent: bool,
2577}
2578
2579impl std::default::Default for TilecacheOptions {
2580 fn default() -> Self {
2581 TilecacheOptions {
2582 tile_width: i32::from(128),
2583 tile_height: i32::from(128),
2584 max_tiles: i32::from(1000),
2585 access: Access::Random,
2586 threaded: false,
2587 persistent: false,
2588 }
2589 }
2590}
2591
2592pub fn tilecache_with_opts(
2597 inp: &VipsImage,
2598 tilecache_options: &TilecacheOptions,
2599) -> Result<VipsImage> {
2600 unsafe {
2601 let inp_in: *mut bindings::VipsImage = inp.ctx;
2602 let mut out_out: *mut bindings::VipsImage = null_mut();
2603
2604 let tile_width_in: i32 = tilecache_options.tile_width;
2605 let tile_width_in_name = utils::new_c_string("tile-width")?;
2606
2607 let tile_height_in: i32 = tilecache_options.tile_height;
2608 let tile_height_in_name = utils::new_c_string("tile-height")?;
2609
2610 let max_tiles_in: i32 = tilecache_options.max_tiles;
2611 let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2612
2613 let access_in: i32 = tilecache_options.access as i32;
2614 let access_in_name = utils::new_c_string("access")?;
2615
2616 let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2617 let threaded_in_name = utils::new_c_string("threaded")?;
2618
2619 let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2620 let persistent_in_name = utils::new_c_string("persistent")?;
2621
2622 let vips_op_response = bindings::vips_tilecache(
2623 inp_in,
2624 &mut out_out,
2625 tile_width_in_name.as_ptr(),
2626 tile_width_in,
2627 tile_height_in_name.as_ptr(),
2628 tile_height_in,
2629 max_tiles_in_name.as_ptr(),
2630 max_tiles_in,
2631 access_in_name.as_ptr(),
2632 access_in,
2633 threaded_in_name.as_ptr(),
2634 threaded_in,
2635 persistent_in_name.as_ptr(),
2636 persistent_in,
2637 NULL,
2638 );
2639 utils::result(
2640 vips_op_response,
2641 VipsImage { ctx: out_out },
2642 Error::TilecacheError,
2643 )
2644 }
2645}
2646
2647pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2651 unsafe {
2652 let inp_in: *mut bindings::VipsImage = inp.ctx;
2653 let mut out_out: *mut bindings::VipsImage = null_mut();
2654
2655 let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2656 utils::result(
2657 vips_op_response,
2658 VipsImage { ctx: out_out },
2659 Error::LinecacheError,
2660 )
2661 }
2662}
2663
2664#[derive(Clone, Debug)]
2666pub struct LinecacheOptions {
2667 pub tile_height: i32,
2670 pub access: Access,
2676 pub threaded: bool,
2679 pub persistent: bool,
2682}
2683
2684impl std::default::Default for LinecacheOptions {
2685 fn default() -> Self {
2686 LinecacheOptions {
2687 tile_height: i32::from(128),
2688 access: Access::Random,
2689 threaded: false,
2690 persistent: false,
2691 }
2692 }
2693}
2694
2695pub fn linecache_with_opts(
2700 inp: &VipsImage,
2701 linecache_options: &LinecacheOptions,
2702) -> Result<VipsImage> {
2703 unsafe {
2704 let inp_in: *mut bindings::VipsImage = inp.ctx;
2705 let mut out_out: *mut bindings::VipsImage = null_mut();
2706
2707 let tile_height_in: i32 = linecache_options.tile_height;
2708 let tile_height_in_name = utils::new_c_string("tile-height")?;
2709
2710 let access_in: i32 = linecache_options.access as i32;
2711 let access_in_name = utils::new_c_string("access")?;
2712
2713 let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2714 let threaded_in_name = utils::new_c_string("threaded")?;
2715
2716 let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2717 let persistent_in_name = utils::new_c_string("persistent")?;
2718
2719 let vips_op_response = bindings::vips_linecache(
2720 inp_in,
2721 &mut out_out,
2722 tile_height_in_name.as_ptr(),
2723 tile_height_in,
2724 access_in_name.as_ptr(),
2725 access_in,
2726 threaded_in_name.as_ptr(),
2727 threaded_in,
2728 persistent_in_name.as_ptr(),
2729 persistent_in,
2730 NULL,
2731 );
2732 utils::result(
2733 vips_op_response,
2734 VipsImage { ctx: out_out },
2735 Error::LinecacheError,
2736 )
2737 }
2738}
2739
2740pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2744 unsafe {
2745 let inp_in: *mut bindings::VipsImage = inp.ctx;
2746 let mut out_out: *mut bindings::VipsImage = null_mut();
2747
2748 let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2749 utils::result(
2750 vips_op_response,
2751 VipsImage { ctx: out_out },
2752 Error::SequentialError,
2753 )
2754 }
2755}
2756
2757#[derive(Clone, Debug)]
2759pub struct SequentialOptions {
2760 pub tile_height: i32,
2763}
2764
2765impl std::default::Default for SequentialOptions {
2766 fn default() -> Self {
2767 SequentialOptions {
2768 tile_height: i32::from(1),
2769 }
2770 }
2771}
2772
2773pub fn sequential_with_opts(
2778 inp: &VipsImage,
2779 sequential_options: &SequentialOptions,
2780) -> Result<VipsImage> {
2781 unsafe {
2782 let inp_in: *mut bindings::VipsImage = inp.ctx;
2783 let mut out_out: *mut bindings::VipsImage = null_mut();
2784
2785 let tile_height_in: i32 = sequential_options.tile_height;
2786 let tile_height_in_name = utils::new_c_string("tile-height")?;
2787
2788 let vips_op_response = bindings::vips_sequential(
2789 inp_in,
2790 &mut out_out,
2791 tile_height_in_name.as_ptr(),
2792 tile_height_in,
2793 NULL,
2794 );
2795 utils::result(
2796 vips_op_response,
2797 VipsImage { ctx: out_out },
2798 Error::SequentialError,
2799 )
2800 }
2801}
2802
2803pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2815 unsafe {
2816 let inp_in: *mut bindings::VipsImage = inp.ctx;
2817 let x_in: i32 = x;
2818 let y_in: i32 = y;
2819 let width_in: i32 = width;
2820 let height_in: i32 = height;
2821 let mut out_out: *mut bindings::VipsImage = null_mut();
2822
2823 let vips_op_response =
2824 bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2825 utils::result(
2826 vips_op_response,
2827 VipsImage { ctx: out_out },
2828 Error::EmbedError,
2829 )
2830 }
2831}
2832
2833#[derive(Clone, Debug)]
2835pub struct EmbedOptions {
2836 pub extend: Extend,
2845 pub background: Vec<f64>,
2847}
2848
2849impl std::default::Default for EmbedOptions {
2850 fn default() -> Self {
2851 EmbedOptions {
2852 extend: Extend::Black,
2853 background: Vec::new(),
2854 }
2855 }
2856}
2857
2858pub fn embed_with_opts(
2871 inp: &VipsImage,
2872 x: i32,
2873 y: i32,
2874 width: i32,
2875 height: i32,
2876 embed_options: &EmbedOptions,
2877) -> Result<VipsImage> {
2878 unsafe {
2879 let inp_in: *mut bindings::VipsImage = inp.ctx;
2880 let x_in: i32 = x;
2881 let y_in: i32 = y;
2882 let width_in: i32 = width;
2883 let height_in: i32 = height;
2884 let mut out_out: *mut bindings::VipsImage = null_mut();
2885
2886 let extend_in: i32 = embed_options.extend as i32;
2887 let extend_in_name = utils::new_c_string("extend")?;
2888
2889 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2890 let background_in = background_wrapper.ctx;
2891 let background_in_name = utils::new_c_string("background")?;
2892
2893 let vips_op_response = bindings::vips_embed(
2894 inp_in,
2895 &mut out_out,
2896 x_in,
2897 y_in,
2898 width_in,
2899 height_in,
2900 extend_in_name.as_ptr(),
2901 extend_in,
2902 background_in_name.as_ptr(),
2903 background_in,
2904 NULL,
2905 );
2906 utils::result(
2907 vips_op_response,
2908 VipsImage { ctx: out_out },
2909 Error::EmbedError,
2910 )
2911 }
2912}
2913
2914pub fn gravity(
2933 inp: &VipsImage,
2934 direction: CompassDirection,
2935 width: i32,
2936 height: i32,
2937) -> Result<VipsImage> {
2938 unsafe {
2939 let inp_in: *mut bindings::VipsImage = inp.ctx;
2940 let direction_in: i32 = direction as i32;
2941 let width_in: i32 = width;
2942 let height_in: i32 = height;
2943 let mut out_out: *mut bindings::VipsImage = null_mut();
2944
2945 let vips_op_response = bindings::vips_gravity(
2946 inp_in,
2947 &mut out_out,
2948 direction_in.try_into().unwrap(),
2949 width_in,
2950 height_in,
2951 NULL,
2952 );
2953 utils::result(
2954 vips_op_response,
2955 VipsImage { ctx: out_out },
2956 Error::GravityError,
2957 )
2958 }
2959}
2960
2961#[derive(Clone, Debug)]
2963pub struct GravityOptions {
2964 pub extend: Extend,
2973 pub background: Vec<f64>,
2975}
2976
2977impl std::default::Default for GravityOptions {
2978 fn default() -> Self {
2979 GravityOptions {
2980 extend: Extend::Black,
2981 background: Vec::new(),
2982 }
2983 }
2984}
2985
2986pub fn gravity_with_opts(
3006 inp: &VipsImage,
3007 direction: CompassDirection,
3008 width: i32,
3009 height: i32,
3010 gravity_options: &GravityOptions,
3011) -> Result<VipsImage> {
3012 unsafe {
3013 let inp_in: *mut bindings::VipsImage = inp.ctx;
3014 let direction_in: i32 = direction as i32;
3015 let width_in: i32 = width;
3016 let height_in: i32 = height;
3017 let mut out_out: *mut bindings::VipsImage = null_mut();
3018
3019 let extend_in: i32 = gravity_options.extend as i32;
3020 let extend_in_name = utils::new_c_string("extend")?;
3021
3022 let background_wrapper =
3023 utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
3024 let background_in = background_wrapper.ctx;
3025 let background_in_name = utils::new_c_string("background")?;
3026
3027 let vips_op_response = bindings::vips_gravity(
3028 inp_in,
3029 &mut out_out,
3030 direction_in.try_into().unwrap(),
3031 width_in,
3032 height_in,
3033 extend_in_name.as_ptr(),
3034 extend_in,
3035 background_in_name.as_ptr(),
3036 background_in,
3037 NULL,
3038 );
3039 utils::result(
3040 vips_op_response,
3041 VipsImage { ctx: out_out },
3042 Error::GravityError,
3043 )
3044 }
3045}
3046
3047pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3055 unsafe {
3056 let inp_in: *mut bindings::VipsImage = inp.ctx;
3057 let direction_in: i32 = direction as i32;
3058 let mut out_out: *mut bindings::VipsImage = null_mut();
3059
3060 let vips_op_response =
3061 bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3062 utils::result(
3063 vips_op_response,
3064 VipsImage { ctx: out_out },
3065 Error::FlipError,
3066 )
3067 }
3068}
3069
3070pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3079 unsafe {
3080 let main_in: *mut bindings::VipsImage = main.ctx;
3081 let sub_in: *mut bindings::VipsImage = sub.ctx;
3082 let x_in: i32 = x;
3083 let y_in: i32 = y;
3084 let mut out_out: *mut bindings::VipsImage = null_mut();
3085
3086 let vips_op_response =
3087 bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3088 utils::result(
3089 vips_op_response,
3090 VipsImage { ctx: out_out },
3091 Error::InsertError,
3092 )
3093 }
3094}
3095
3096#[derive(Clone, Debug)]
3098pub struct InsertOptions {
3099 pub expand: bool,
3102 pub background: Vec<f64>,
3104}
3105
3106impl std::default::Default for InsertOptions {
3107 fn default() -> Self {
3108 InsertOptions {
3109 expand: false,
3110 background: Vec::new(),
3111 }
3112 }
3113}
3114
3115pub fn insert_with_opts(
3125 main: &VipsImage,
3126 sub: &VipsImage,
3127 x: i32,
3128 y: i32,
3129 insert_options: &InsertOptions,
3130) -> Result<VipsImage> {
3131 unsafe {
3132 let main_in: *mut bindings::VipsImage = main.ctx;
3133 let sub_in: *mut bindings::VipsImage = sub.ctx;
3134 let x_in: i32 = x;
3135 let y_in: i32 = y;
3136 let mut out_out: *mut bindings::VipsImage = null_mut();
3137
3138 let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3139 let expand_in_name = utils::new_c_string("expand")?;
3140
3141 let background_wrapper =
3142 utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3143 let background_in = background_wrapper.ctx;
3144 let background_in_name = utils::new_c_string("background")?;
3145
3146 let vips_op_response = bindings::vips_insert(
3147 main_in,
3148 sub_in,
3149 &mut out_out,
3150 x_in,
3151 y_in,
3152 expand_in_name.as_ptr(),
3153 expand_in,
3154 background_in_name.as_ptr(),
3155 background_in,
3156 NULL,
3157 );
3158 utils::result(
3159 vips_op_response,
3160 VipsImage { ctx: out_out },
3161 Error::InsertError,
3162 )
3163 }
3164}
3165
3166pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3175 unsafe {
3176 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3177 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3178 let direction_in: i32 = direction as i32;
3179 let mut out_out: *mut bindings::VipsImage = null_mut();
3180
3181 let vips_op_response = bindings::vips_join(
3182 in_1_in,
3183 in_2_in,
3184 &mut out_out,
3185 direction_in.try_into().unwrap(),
3186 NULL,
3187 );
3188 utils::result(
3189 vips_op_response,
3190 VipsImage { ctx: out_out },
3191 Error::JoinError,
3192 )
3193 }
3194}
3195
3196#[derive(Clone, Debug)]
3198pub struct JoinOptions {
3199 pub expand: bool,
3202 pub shim: i32,
3205 pub background: Vec<f64>,
3207 pub align: Align,
3213}
3214
3215impl std::default::Default for JoinOptions {
3216 fn default() -> Self {
3217 JoinOptions {
3218 expand: false,
3219 shim: i32::from(0),
3220 background: Vec::new(),
3221 align: Align::Low,
3222 }
3223 }
3224}
3225
3226pub fn join_with_opts(
3236 in_1: &VipsImage,
3237 in_2: &VipsImage,
3238 direction: Direction,
3239 join_options: &JoinOptions,
3240) -> Result<VipsImage> {
3241 unsafe {
3242 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3243 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3244 let direction_in: i32 = direction as i32;
3245 let mut out_out: *mut bindings::VipsImage = null_mut();
3246
3247 let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3248 let expand_in_name = utils::new_c_string("expand")?;
3249
3250 let shim_in: i32 = join_options.shim;
3251 let shim_in_name = utils::new_c_string("shim")?;
3252
3253 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3254 let background_in = background_wrapper.ctx;
3255 let background_in_name = utils::new_c_string("background")?;
3256
3257 let align_in: i32 = join_options.align as i32;
3258 let align_in_name = utils::new_c_string("align")?;
3259
3260 let vips_op_response = bindings::vips_join(
3261 in_1_in,
3262 in_2_in,
3263 &mut out_out,
3264 direction_in.try_into().unwrap(),
3265 expand_in_name.as_ptr(),
3266 expand_in,
3267 shim_in_name.as_ptr(),
3268 shim_in,
3269 background_in_name.as_ptr(),
3270 background_in,
3271 align_in_name.as_ptr(),
3272 align_in,
3273 NULL,
3274 );
3275 utils::result(
3276 vips_op_response,
3277 VipsImage { ctx: out_out },
3278 Error::JoinError,
3279 )
3280 }
3281}
3282
3283pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3287 unsafe {
3288 let (inp_len, mut inp_in) = {
3289 let len = inp.len();
3290 let mut input = Vec::new();
3291 for img in inp {
3292 input.push(img.ctx)
3293 }
3294 (len as i32, input)
3295 };
3296 let mut out_out: *mut bindings::VipsImage = null_mut();
3297
3298 let vips_op_response =
3299 bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3300 utils::result(
3301 vips_op_response,
3302 VipsImage { ctx: out_out },
3303 Error::ArrayjoinError,
3304 )
3305 }
3306}
3307
3308#[derive(Clone, Debug)]
3310pub struct ArrayjoinOptions {
3311 pub across: i32,
3314 pub shim: i32,
3317 pub background: Vec<f64>,
3319 pub halign: Align,
3325 pub valign: Align,
3331 pub hspacing: i32,
3334 pub vspacing: i32,
3337}
3338
3339impl std::default::Default for ArrayjoinOptions {
3340 fn default() -> Self {
3341 ArrayjoinOptions {
3342 across: i32::from(1),
3343 shim: i32::from(0),
3344 background: Vec::new(),
3345 halign: Align::Low,
3346 valign: Align::Low,
3347 hspacing: i32::from(1),
3348 vspacing: i32::from(1),
3349 }
3350 }
3351}
3352
3353pub fn arrayjoin_with_opts(
3358 inp: &mut [VipsImage],
3359 arrayjoin_options: &ArrayjoinOptions,
3360) -> Result<VipsImage> {
3361 unsafe {
3362 let (inp_len, mut inp_in) = {
3363 let len = inp.len();
3364 let mut input = Vec::new();
3365 for img in inp {
3366 input.push(img.ctx)
3367 }
3368 (len as i32, input)
3369 };
3370 let mut out_out: *mut bindings::VipsImage = null_mut();
3371
3372 let across_in: i32 = arrayjoin_options.across;
3373 let across_in_name = utils::new_c_string("across")?;
3374
3375 let shim_in: i32 = arrayjoin_options.shim;
3376 let shim_in_name = utils::new_c_string("shim")?;
3377
3378 let background_wrapper =
3379 utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3380 let background_in = background_wrapper.ctx;
3381 let background_in_name = utils::new_c_string("background")?;
3382
3383 let halign_in: i32 = arrayjoin_options.halign as i32;
3384 let halign_in_name = utils::new_c_string("halign")?;
3385
3386 let valign_in: i32 = arrayjoin_options.valign as i32;
3387 let valign_in_name = utils::new_c_string("valign")?;
3388
3389 let hspacing_in: i32 = arrayjoin_options.hspacing;
3390 let hspacing_in_name = utils::new_c_string("hspacing")?;
3391
3392 let vspacing_in: i32 = arrayjoin_options.vspacing;
3393 let vspacing_in_name = utils::new_c_string("vspacing")?;
3394
3395 let vips_op_response = bindings::vips_arrayjoin(
3396 inp_in.as_mut_ptr(),
3397 &mut out_out,
3398 inp_len,
3399 across_in_name.as_ptr(),
3400 across_in,
3401 shim_in_name.as_ptr(),
3402 shim_in,
3403 background_in_name.as_ptr(),
3404 background_in,
3405 halign_in_name.as_ptr(),
3406 halign_in,
3407 valign_in_name.as_ptr(),
3408 valign_in,
3409 hspacing_in_name.as_ptr(),
3410 hspacing_in,
3411 vspacing_in_name.as_ptr(),
3412 vspacing_in,
3413 NULL,
3414 );
3415 utils::result(
3416 vips_op_response,
3417 VipsImage { ctx: out_out },
3418 Error::ArrayjoinError,
3419 )
3420 }
3421}
3422
3423pub fn extract_area(
3435 input: &VipsImage,
3436 left: i32,
3437 top: i32,
3438 width: i32,
3439 height: i32,
3440) -> Result<VipsImage> {
3441 unsafe {
3442 let input_in: *mut bindings::VipsImage = input.ctx;
3443 let left_in: i32 = left;
3444 let top_in: i32 = top;
3445 let width_in: i32 = width;
3446 let height_in: i32 = height;
3447 let mut out_out: *mut bindings::VipsImage = null_mut();
3448
3449 let vips_op_response = bindings::vips_extract_area(
3450 input_in,
3451 &mut out_out,
3452 left_in,
3453 top_in,
3454 width_in,
3455 height_in,
3456 NULL,
3457 );
3458 utils::result(
3459 vips_op_response,
3460 VipsImage { ctx: out_out },
3461 Error::ExtractAreaError,
3462 )
3463 }
3464}
3465
3466pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3474 unsafe {
3475 let input_in: *mut bindings::VipsImage = input.ctx;
3476 let width_in: i32 = width;
3477 let height_in: i32 = height;
3478 let mut out_out: *mut bindings::VipsImage = null_mut();
3479
3480 let vips_op_response =
3481 bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3482 utils::result(
3483 vips_op_response,
3484 VipsImage { ctx: out_out },
3485 Error::SmartcropError,
3486 )
3487 }
3488}
3489
3490#[derive(Clone, Debug)]
3492pub struct SmartcropOptions {
3493 pub attention_x: i32,
3496 pub attention_y: i32,
3499 pub interesting: Interesting,
3509 pub premultiplied: bool,
3512}
3513
3514impl std::default::Default for SmartcropOptions {
3515 fn default() -> Self {
3516 SmartcropOptions {
3517 attention_x: i32::from(0),
3518 attention_y: i32::from(0),
3519 interesting: Interesting::Attention,
3520 premultiplied: false,
3521 }
3522 }
3523}
3524
3525pub fn smartcrop_with_opts(
3534 input: &VipsImage,
3535 width: i32,
3536 height: i32,
3537 smartcrop_options: &SmartcropOptions,
3538) -> Result<VipsImage> {
3539 unsafe {
3540 let input_in: *mut bindings::VipsImage = input.ctx;
3541 let width_in: i32 = width;
3542 let height_in: i32 = height;
3543 let mut out_out: *mut bindings::VipsImage = null_mut();
3544
3545 let attention_x_in: i32 = smartcrop_options.attention_x;
3546 let attention_x_in_name = utils::new_c_string("attention-x")?;
3547
3548 let attention_y_in: i32 = smartcrop_options.attention_y;
3549 let attention_y_in_name = utils::new_c_string("attention-y")?;
3550
3551 let interesting_in: i32 = smartcrop_options.interesting as i32;
3552 let interesting_in_name = utils::new_c_string("interesting")?;
3553
3554 let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3555 1
3556 } else {
3557 0
3558 };
3559 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3560
3561 let vips_op_response = bindings::vips_smartcrop(
3562 input_in,
3563 &mut out_out,
3564 width_in,
3565 height_in,
3566 attention_x_in_name.as_ptr(),
3567 attention_x_in,
3568 attention_y_in_name.as_ptr(),
3569 attention_y_in,
3570 interesting_in_name.as_ptr(),
3571 interesting_in,
3572 premultiplied_in_name.as_ptr(),
3573 premultiplied_in,
3574 NULL,
3575 );
3576 utils::result(
3577 vips_op_response,
3578 VipsImage { ctx: out_out },
3579 Error::SmartcropError,
3580 )
3581 }
3582}
3583
3584pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3590 unsafe {
3591 let inp_in: *mut bindings::VipsImage = inp.ctx;
3592 let band_in: i32 = band;
3593 let mut out_out: *mut bindings::VipsImage = null_mut();
3594
3595 let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3596 utils::result(
3597 vips_op_response,
3598 VipsImage { ctx: out_out },
3599 Error::ExtractBandError,
3600 )
3601 }
3602}
3603
3604#[derive(Clone, Debug)]
3606pub struct ExtractBandOptions {
3607 pub n: i32,
3610}
3611
3612impl std::default::Default for ExtractBandOptions {
3613 fn default() -> Self {
3614 ExtractBandOptions { n: i32::from(1) }
3615 }
3616}
3617
3618pub fn extract_band_with_opts(
3625 inp: &VipsImage,
3626 band: i32,
3627 extract_band_options: &ExtractBandOptions,
3628) -> Result<VipsImage> {
3629 unsafe {
3630 let inp_in: *mut bindings::VipsImage = inp.ctx;
3631 let band_in: i32 = band;
3632 let mut out_out: *mut bindings::VipsImage = null_mut();
3633
3634 let n_in: i32 = extract_band_options.n;
3635 let n_in_name = utils::new_c_string("n")?;
3636
3637 let vips_op_response = bindings::vips_extract_band(
3638 inp_in,
3639 &mut out_out,
3640 band_in,
3641 n_in_name.as_ptr(),
3642 n_in,
3643 NULL,
3644 );
3645 utils::result(
3646 vips_op_response,
3647 VipsImage { ctx: out_out },
3648 Error::ExtractBandError,
3649 )
3650 }
3651}
3652
3653pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3657 unsafe {
3658 let (inp_len, mut inp_in) = {
3659 let len = inp.len();
3660 let mut input = Vec::new();
3661 for img in inp {
3662 input.push(img.ctx)
3663 }
3664 (len as i32, input)
3665 };
3666 let mut out_out: *mut bindings::VipsImage = null_mut();
3667
3668 let vips_op_response =
3669 bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3670 utils::result(
3671 vips_op_response,
3672 VipsImage { ctx: out_out },
3673 Error::BandjoinError,
3674 )
3675 }
3676}
3677
3678pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3683 unsafe {
3684 let inp_in: *mut bindings::VipsImage = inp.ctx;
3685 let c_in: *mut f64 = c.as_mut_ptr();
3686 let mut out_out: *mut bindings::VipsImage = null_mut();
3687
3688 let vips_op_response =
3689 bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3690 utils::result(
3691 vips_op_response,
3692 VipsImage { ctx: out_out },
3693 Error::BandjoinConstError,
3694 )
3695 }
3696}
3697
3698pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3702 unsafe {
3703 let (inp_len, mut inp_in) = {
3704 let len = inp.len();
3705 let mut input = Vec::new();
3706 for img in inp {
3707 input.push(img.ctx)
3708 }
3709 (len as i32, input)
3710 };
3711 let mut out_out: *mut bindings::VipsImage = null_mut();
3712
3713 let vips_op_response =
3714 bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3715 utils::result(
3716 vips_op_response,
3717 VipsImage { ctx: out_out },
3718 Error::BandrankError,
3719 )
3720 }
3721}
3722
3723#[derive(Clone, Debug)]
3725pub struct BandrankOptions {
3726 pub index: i32,
3729}
3730
3731impl std::default::Default for BandrankOptions {
3732 fn default() -> Self {
3733 BandrankOptions {
3734 index: i32::from(-1),
3735 }
3736 }
3737}
3738
3739pub fn bandrank_with_opts(
3744 inp: &mut [VipsImage],
3745 bandrank_options: &BandrankOptions,
3746) -> Result<VipsImage> {
3747 unsafe {
3748 let (inp_len, mut inp_in) = {
3749 let len = inp.len();
3750 let mut input = Vec::new();
3751 for img in inp {
3752 input.push(img.ctx)
3753 }
3754 (len as i32, input)
3755 };
3756 let mut out_out: *mut bindings::VipsImage = null_mut();
3757
3758 let index_in: i32 = bandrank_options.index;
3759 let index_in_name = utils::new_c_string("index")?;
3760
3761 let vips_op_response = bindings::vips_bandrank(
3762 inp_in.as_mut_ptr(),
3763 &mut out_out,
3764 inp_len,
3765 index_in_name.as_ptr(),
3766 index_in,
3767 NULL,
3768 );
3769 utils::result(
3770 vips_op_response,
3771 VipsImage { ctx: out_out },
3772 Error::BandrankError,
3773 )
3774 }
3775}
3776
3777pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3781 unsafe {
3782 let inp_in: *mut bindings::VipsImage = inp.ctx;
3783 let mut out_out: *mut bindings::VipsImage = null_mut();
3784
3785 let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3786 utils::result(
3787 vips_op_response,
3788 VipsImage { ctx: out_out },
3789 Error::BandmeanError,
3790 )
3791 }
3792}
3793
3794pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3805 unsafe {
3806 let inp_in: *mut bindings::VipsImage = inp.ctx;
3807 let boolean_in: i32 = boolean as i32;
3808 let mut out_out: *mut bindings::VipsImage = null_mut();
3809
3810 let vips_op_response =
3811 bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3812 utils::result(
3813 vips_op_response,
3814 VipsImage { ctx: out_out },
3815 Error::BandboolError,
3816 )
3817 }
3818}
3819
3820pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3828 unsafe {
3829 let inp_in: *mut bindings::VipsImage = inp.ctx;
3830 let across_in: i32 = across;
3831 let down_in: i32 = down;
3832 let mut out_out: *mut bindings::VipsImage = null_mut();
3833
3834 let vips_op_response =
3835 bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3836 utils::result(
3837 vips_op_response,
3838 VipsImage { ctx: out_out },
3839 Error::ReplicateError,
3840 )
3841 }
3842}
3843
3844pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3861 unsafe {
3862 let inp_in: *mut bindings::VipsImage = inp.ctx;
3863 let format_in: i32 = format as i32;
3864 let mut out_out: *mut bindings::VipsImage = null_mut();
3865
3866 let vips_op_response =
3867 bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3868 utils::result(
3869 vips_op_response,
3870 VipsImage { ctx: out_out },
3871 Error::CastError,
3872 )
3873 }
3874}
3875
3876#[derive(Clone, Debug)]
3878pub struct CastOptions {
3879 pub shift: bool,
3882}
3883
3884impl std::default::Default for CastOptions {
3885 fn default() -> Self {
3886 CastOptions { shift: false }
3887 }
3888}
3889
3890pub fn cast_with_opts(
3908 inp: &VipsImage,
3909 format: BandFormat,
3910 cast_options: &CastOptions,
3911) -> Result<VipsImage> {
3912 unsafe {
3913 let inp_in: *mut bindings::VipsImage = inp.ctx;
3914 let format_in: i32 = format as i32;
3915 let mut out_out: *mut bindings::VipsImage = null_mut();
3916
3917 let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3918 let shift_in_name = utils::new_c_string("shift")?;
3919
3920 let vips_op_response = bindings::vips_cast(
3921 inp_in,
3922 &mut out_out,
3923 format_in.try_into().unwrap(),
3924 shift_in_name.as_ptr(),
3925 shift_in,
3926 NULL,
3927 );
3928 utils::result(
3929 vips_op_response,
3930 VipsImage { ctx: out_out },
3931 Error::CastError,
3932 )
3933 }
3934}
3935
3936pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3946 unsafe {
3947 let inp_in: *mut bindings::VipsImage = inp.ctx;
3948 let angle_in: i32 = angle as i32;
3949 let mut out_out: *mut bindings::VipsImage = null_mut();
3950
3951 let vips_op_response =
3952 bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3953 utils::result(
3954 vips_op_response,
3955 VipsImage { ctx: out_out },
3956 Error::RotError,
3957 )
3958 }
3959}
3960
3961pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3965 unsafe {
3966 let inp_in: *mut bindings::VipsImage = inp.ctx;
3967 let mut out_out: *mut bindings::VipsImage = null_mut();
3968
3969 let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3970 utils::result(
3971 vips_op_response,
3972 VipsImage { ctx: out_out },
3973 Error::Rot45Error,
3974 )
3975 }
3976}
3977
3978#[derive(Clone, Debug)]
3980pub struct Rot45Options {
3981 pub angle: Angle45,
3992}
3993
3994impl std::default::Default for Rot45Options {
3995 fn default() -> Self {
3996 Rot45Options {
3997 angle: Angle45::D45,
3998 }
3999 }
4000}
4001
4002pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
4007 unsafe {
4008 let inp_in: *mut bindings::VipsImage = inp.ctx;
4009 let mut out_out: *mut bindings::VipsImage = null_mut();
4010
4011 let angle_in: i32 = rot_45_options.angle as i32;
4012 let angle_in_name = utils::new_c_string("angle")?;
4013
4014 let vips_op_response =
4015 bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
4016 utils::result(
4017 vips_op_response,
4018 VipsImage { ctx: out_out },
4019 Error::Rot45Error,
4020 )
4021 }
4022}
4023
4024pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
4028 unsafe {
4029 let inp_in: *mut bindings::VipsImage = inp.ctx;
4030 let mut out_out: *mut bindings::VipsImage = null_mut();
4031
4032 let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
4033 utils::result(
4034 vips_op_response,
4035 VipsImage { ctx: out_out },
4036 Error::AutorotError,
4037 )
4038 }
4039}
4040
4041#[derive(Clone, Debug)]
4043pub struct AutorotOptions {
4044 pub angle: Angle,
4051 pub flip: bool,
4054}
4055
4056impl std::default::Default for AutorotOptions {
4057 fn default() -> Self {
4058 AutorotOptions {
4059 angle: Angle::D0,
4060 flip: false,
4061 }
4062 }
4063}
4064
4065pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4070 unsafe {
4071 let inp_in: *mut bindings::VipsImage = inp.ctx;
4072 let mut out_out: *mut bindings::VipsImage = null_mut();
4073
4074 let angle_in: i32 = autorot_options.angle as i32;
4075 let angle_in_name = utils::new_c_string("angle")?;
4076
4077 let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4078 let flip_in_name = utils::new_c_string("flip")?;
4079
4080 let vips_op_response = bindings::vips_autorot(
4081 inp_in,
4082 &mut out_out,
4083 angle_in_name.as_ptr(),
4084 angle_in,
4085 flip_in_name.as_ptr(),
4086 flip_in,
4087 NULL,
4088 );
4089 utils::result(
4090 vips_op_response,
4091 VipsImage { ctx: out_out },
4092 Error::AutorotError,
4093 )
4094 }
4095}
4096
4097pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4103 unsafe {
4104 let cond_in: *mut bindings::VipsImage = cond.ctx;
4105 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4106 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4107 let mut out_out: *mut bindings::VipsImage = null_mut();
4108
4109 let vips_op_response =
4110 bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4111 utils::result(
4112 vips_op_response,
4113 VipsImage { ctx: out_out },
4114 Error::IfthenelseError,
4115 )
4116 }
4117}
4118
4119#[derive(Clone, Debug)]
4121pub struct IfthenelseOptions {
4122 pub blend: bool,
4125}
4126
4127impl std::default::Default for IfthenelseOptions {
4128 fn default() -> Self {
4129 IfthenelseOptions { blend: false }
4130 }
4131}
4132
4133pub fn ifthenelse_with_opts(
4140 cond: &VipsImage,
4141 in_1: &VipsImage,
4142 in_2: &VipsImage,
4143 ifthenelse_options: &IfthenelseOptions,
4144) -> Result<VipsImage> {
4145 unsafe {
4146 let cond_in: *mut bindings::VipsImage = cond.ctx;
4147 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4148 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4149 let mut out_out: *mut bindings::VipsImage = null_mut();
4150
4151 let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4152 let blend_in_name = utils::new_c_string("blend")?;
4153
4154 let vips_op_response = bindings::vips_ifthenelse(
4155 cond_in,
4156 in_1_in,
4157 in_2_in,
4158 &mut out_out,
4159 blend_in_name.as_ptr(),
4160 blend_in,
4161 NULL,
4162 );
4163 utils::result(
4164 vips_op_response,
4165 VipsImage { ctx: out_out },
4166 Error::IfthenelseError,
4167 )
4168 }
4169}
4170
4171pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4176 unsafe {
4177 let inp_in: *mut bindings::VipsImage = inp.ctx;
4178 let m_in: *mut bindings::VipsImage = m.ctx;
4179 let mut out_out: *mut bindings::VipsImage = null_mut();
4180
4181 let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4182 utils::result(
4183 vips_op_response,
4184 VipsImage { ctx: out_out },
4185 Error::RecombError,
4186 )
4187 }
4188}
4189
4190pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4194 unsafe {
4195 let inp_in: *mut bindings::VipsImage = inp.ctx;
4196 let mut out_out: *mut bindings::VipsImage = null_mut();
4197
4198 let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4199 utils::result(
4200 vips_op_response,
4201 VipsImage { ctx: out_out },
4202 Error::BandfoldError,
4203 )
4204 }
4205}
4206
4207#[derive(Clone, Debug)]
4209pub struct BandfoldOptions {
4210 pub factor: i32,
4213}
4214
4215impl std::default::Default for BandfoldOptions {
4216 fn default() -> Self {
4217 BandfoldOptions {
4218 factor: i32::from(0),
4219 }
4220 }
4221}
4222
4223pub fn bandfold_with_opts(
4228 inp: &VipsImage,
4229 bandfold_options: &BandfoldOptions,
4230) -> Result<VipsImage> {
4231 unsafe {
4232 let inp_in: *mut bindings::VipsImage = inp.ctx;
4233 let mut out_out: *mut bindings::VipsImage = null_mut();
4234
4235 let factor_in: i32 = bandfold_options.factor;
4236 let factor_in_name = utils::new_c_string("factor")?;
4237
4238 let vips_op_response = bindings::vips_bandfold(
4239 inp_in,
4240 &mut out_out,
4241 factor_in_name.as_ptr(),
4242 factor_in,
4243 NULL,
4244 );
4245 utils::result(
4246 vips_op_response,
4247 VipsImage { ctx: out_out },
4248 Error::BandfoldError,
4249 )
4250 }
4251}
4252
4253pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4257 unsafe {
4258 let inp_in: *mut bindings::VipsImage = inp.ctx;
4259 let mut out_out: *mut bindings::VipsImage = null_mut();
4260
4261 let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4262 utils::result(
4263 vips_op_response,
4264 VipsImage { ctx: out_out },
4265 Error::BandunfoldError,
4266 )
4267 }
4268}
4269
4270#[derive(Clone, Debug)]
4272pub struct BandunfoldOptions {
4273 pub factor: i32,
4276}
4277
4278impl std::default::Default for BandunfoldOptions {
4279 fn default() -> Self {
4280 BandunfoldOptions {
4281 factor: i32::from(0),
4282 }
4283 }
4284}
4285
4286pub fn bandunfold_with_opts(
4291 inp: &VipsImage,
4292 bandunfold_options: &BandunfoldOptions,
4293) -> Result<VipsImage> {
4294 unsafe {
4295 let inp_in: *mut bindings::VipsImage = inp.ctx;
4296 let mut out_out: *mut bindings::VipsImage = null_mut();
4297
4298 let factor_in: i32 = bandunfold_options.factor;
4299 let factor_in_name = utils::new_c_string("factor")?;
4300
4301 let vips_op_response = bindings::vips_bandunfold(
4302 inp_in,
4303 &mut out_out,
4304 factor_in_name.as_ptr(),
4305 factor_in,
4306 NULL,
4307 );
4308 utils::result(
4309 vips_op_response,
4310 VipsImage { ctx: out_out },
4311 Error::BandunfoldError,
4312 )
4313 }
4314}
4315
4316pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4320 unsafe {
4321 let inp_in: *mut bindings::VipsImage = inp.ctx;
4322 let mut out_out: *mut bindings::VipsImage = null_mut();
4323
4324 let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4325 utils::result(
4326 vips_op_response,
4327 VipsImage { ctx: out_out },
4328 Error::FlattenError,
4329 )
4330 }
4331}
4332
4333#[derive(Clone, Debug)]
4335pub struct FlattenOptions {
4336 pub background: Vec<f64>,
4338 pub max_alpha: f64,
4341}
4342
4343impl std::default::Default for FlattenOptions {
4344 fn default() -> Self {
4345 FlattenOptions {
4346 background: Vec::new(),
4347 max_alpha: f64::from(255),
4348 }
4349 }
4350}
4351
4352pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4357 unsafe {
4358 let inp_in: *mut bindings::VipsImage = inp.ctx;
4359 let mut out_out: *mut bindings::VipsImage = null_mut();
4360
4361 let background_wrapper =
4362 utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4363 let background_in = background_wrapper.ctx;
4364 let background_in_name = utils::new_c_string("background")?;
4365
4366 let max_alpha_in: f64 = flatten_options.max_alpha;
4367 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4368
4369 let vips_op_response = bindings::vips_flatten(
4370 inp_in,
4371 &mut out_out,
4372 background_in_name.as_ptr(),
4373 background_in,
4374 max_alpha_in_name.as_ptr(),
4375 max_alpha_in,
4376 NULL,
4377 );
4378 utils::result(
4379 vips_op_response,
4380 VipsImage { ctx: out_out },
4381 Error::FlattenError,
4382 )
4383 }
4384}
4385
4386pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4390 unsafe {
4391 let inp_in: *mut bindings::VipsImage = inp.ctx;
4392 let mut out_out: *mut bindings::VipsImage = null_mut();
4393
4394 let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4395 utils::result(
4396 vips_op_response,
4397 VipsImage { ctx: out_out },
4398 Error::PremultiplyError,
4399 )
4400 }
4401}
4402
4403#[derive(Clone, Debug)]
4405pub struct PremultiplyOptions {
4406 pub max_alpha: f64,
4409}
4410
4411impl std::default::Default for PremultiplyOptions {
4412 fn default() -> Self {
4413 PremultiplyOptions {
4414 max_alpha: f64::from(255),
4415 }
4416 }
4417}
4418
4419pub fn premultiply_with_opts(
4424 inp: &VipsImage,
4425 premultiply_options: &PremultiplyOptions,
4426) -> Result<VipsImage> {
4427 unsafe {
4428 let inp_in: *mut bindings::VipsImage = inp.ctx;
4429 let mut out_out: *mut bindings::VipsImage = null_mut();
4430
4431 let max_alpha_in: f64 = premultiply_options.max_alpha;
4432 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4433
4434 let vips_op_response = bindings::vips_premultiply(
4435 inp_in,
4436 &mut out_out,
4437 max_alpha_in_name.as_ptr(),
4438 max_alpha_in,
4439 NULL,
4440 );
4441 utils::result(
4442 vips_op_response,
4443 VipsImage { ctx: out_out },
4444 Error::PremultiplyError,
4445 )
4446 }
4447}
4448
4449pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4453 unsafe {
4454 let inp_in: *mut bindings::VipsImage = inp.ctx;
4455 let mut out_out: *mut bindings::VipsImage = null_mut();
4456
4457 let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4458 utils::result(
4459 vips_op_response,
4460 VipsImage { ctx: out_out },
4461 Error::UnpremultiplyError,
4462 )
4463 }
4464}
4465
4466#[derive(Clone, Debug)]
4468pub struct UnpremultiplyOptions {
4469 pub max_alpha: f64,
4472 pub alpha_band: i32,
4475}
4476
4477impl std::default::Default for UnpremultiplyOptions {
4478 fn default() -> Self {
4479 UnpremultiplyOptions {
4480 max_alpha: f64::from(255),
4481 alpha_band: i32::from(3),
4482 }
4483 }
4484}
4485
4486pub fn unpremultiply_with_opts(
4491 inp: &VipsImage,
4492 unpremultiply_options: &UnpremultiplyOptions,
4493) -> Result<VipsImage> {
4494 unsafe {
4495 let inp_in: *mut bindings::VipsImage = inp.ctx;
4496 let mut out_out: *mut bindings::VipsImage = null_mut();
4497
4498 let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4499 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4500
4501 let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4502 let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4503
4504 let vips_op_response = bindings::vips_unpremultiply(
4505 inp_in,
4506 &mut out_out,
4507 max_alpha_in_name.as_ptr(),
4508 max_alpha_in,
4509 alpha_band_in_name.as_ptr(),
4510 alpha_band_in,
4511 NULL,
4512 );
4513 utils::result(
4514 vips_op_response,
4515 VipsImage { ctx: out_out },
4516 Error::UnpremultiplyError,
4517 )
4518 }
4519}
4520
4521pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4531 unsafe {
4532 let inp_in: *mut bindings::VipsImage = inp.ctx;
4533 let tile_height_in: i32 = tile_height;
4534 let across_in: i32 = across;
4535 let down_in: i32 = down;
4536 let mut out_out: *mut bindings::VipsImage = null_mut();
4537
4538 let vips_op_response = bindings::vips_grid(
4539 inp_in,
4540 &mut out_out,
4541 tile_height_in,
4542 across_in,
4543 down_in,
4544 NULL,
4545 );
4546 utils::result(
4547 vips_op_response,
4548 VipsImage { ctx: out_out },
4549 Error::GridError,
4550 )
4551 }
4552}
4553
4554pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4558 unsafe {
4559 let inp_in: *mut bindings::VipsImage = inp.ctx;
4560 let mut out_out: *mut bindings::VipsImage = null_mut();
4561
4562 let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4563 utils::result(
4564 vips_op_response,
4565 VipsImage { ctx: out_out },
4566 Error::Transpose3DError,
4567 )
4568 }
4569}
4570
4571#[derive(Clone, Debug)]
4573pub struct Transpose3DOptions {
4574 pub page_height: i32,
4577}
4578
4579impl std::default::Default for Transpose3DOptions {
4580 fn default() -> Self {
4581 Transpose3DOptions {
4582 page_height: i32::from(0),
4583 }
4584 }
4585}
4586
4587pub fn transpose_3d_with_opts(
4592 inp: &VipsImage,
4593 transpose_3d_options: &Transpose3DOptions,
4594) -> Result<VipsImage> {
4595 unsafe {
4596 let inp_in: *mut bindings::VipsImage = inp.ctx;
4597 let mut out_out: *mut bindings::VipsImage = null_mut();
4598
4599 let page_height_in: i32 = transpose_3d_options.page_height;
4600 let page_height_in_name = utils::new_c_string("page-height")?;
4601
4602 let vips_op_response = bindings::vips_transpose3d(
4603 inp_in,
4604 &mut out_out,
4605 page_height_in_name.as_ptr(),
4606 page_height_in,
4607 NULL,
4608 );
4609 utils::result(
4610 vips_op_response,
4611 VipsImage { ctx: out_out },
4612 Error::Transpose3DError,
4613 )
4614 }
4615}
4616
4617pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4621 unsafe {
4622 let inp_in: *mut bindings::VipsImage = inp.ctx;
4623 let mut out_out: *mut bindings::VipsImage = null_mut();
4624
4625 let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4626 utils::result(
4627 vips_op_response,
4628 VipsImage { ctx: out_out },
4629 Error::ScaleError,
4630 )
4631 }
4632}
4633
4634#[derive(Clone, Debug)]
4636pub struct ScaleOptions {
4637 pub exp: f64,
4640 pub log: bool,
4643}
4644
4645impl std::default::Default for ScaleOptions {
4646 fn default() -> Self {
4647 ScaleOptions {
4648 exp: f64::from(0.25),
4649 log: false,
4650 }
4651 }
4652}
4653
4654pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4659 unsafe {
4660 let inp_in: *mut bindings::VipsImage = inp.ctx;
4661 let mut out_out: *mut bindings::VipsImage = null_mut();
4662
4663 let exp_in: f64 = scale_options.exp;
4664 let exp_in_name = utils::new_c_string("exp")?;
4665
4666 let log_in: i32 = if scale_options.log { 1 } else { 0 };
4667 let log_in_name = utils::new_c_string("log")?;
4668
4669 let vips_op_response = bindings::vips_scale(
4670 inp_in,
4671 &mut out_out,
4672 exp_in_name.as_ptr(),
4673 exp_in,
4674 log_in_name.as_ptr(),
4675 log_in,
4676 NULL,
4677 );
4678 utils::result(
4679 vips_op_response,
4680 VipsImage { ctx: out_out },
4681 Error::ScaleError,
4682 )
4683 }
4684}
4685
4686pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4690 unsafe {
4691 let inp_in: *mut bindings::VipsImage = inp.ctx;
4692 let mut out_out: *mut bindings::VipsImage = null_mut();
4693
4694 let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4695 utils::result(
4696 vips_op_response,
4697 VipsImage { ctx: out_out },
4698 Error::WrapError,
4699 )
4700 }
4701}
4702
4703#[derive(Clone, Debug)]
4705pub struct WrapOptions {
4706 pub x: i32,
4709 pub y: i32,
4712}
4713
4714impl std::default::Default for WrapOptions {
4715 fn default() -> Self {
4716 WrapOptions {
4717 x: i32::from(0),
4718 y: i32::from(0),
4719 }
4720 }
4721}
4722
4723pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4728 unsafe {
4729 let inp_in: *mut bindings::VipsImage = inp.ctx;
4730 let mut out_out: *mut bindings::VipsImage = null_mut();
4731
4732 let x_in: i32 = wrap_options.x;
4733 let x_in_name = utils::new_c_string("x")?;
4734
4735 let y_in: i32 = wrap_options.y;
4736 let y_in_name = utils::new_c_string("y")?;
4737
4738 let vips_op_response = bindings::vips_wrap(
4739 inp_in,
4740 &mut out_out,
4741 x_in_name.as_ptr(),
4742 x_in,
4743 y_in_name.as_ptr(),
4744 y_in,
4745 NULL,
4746 );
4747 utils::result(
4748 vips_op_response,
4749 VipsImage { ctx: out_out },
4750 Error::WrapError,
4751 )
4752 }
4753}
4754
4755pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4763 unsafe {
4764 let input_in: *mut bindings::VipsImage = input.ctx;
4765 let xfac_in: i32 = xfac;
4766 let yfac_in: i32 = yfac;
4767 let mut out_out: *mut bindings::VipsImage = null_mut();
4768
4769 let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4770 utils::result(
4771 vips_op_response,
4772 VipsImage { ctx: out_out },
4773 Error::ZoomError,
4774 )
4775 }
4776}
4777
4778pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4786 unsafe {
4787 let input_in: *mut bindings::VipsImage = input.ctx;
4788 let xfac_in: i32 = xfac;
4789 let yfac_in: i32 = yfac;
4790 let mut out_out: *mut bindings::VipsImage = null_mut();
4791
4792 let vips_op_response =
4793 bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4794 utils::result(
4795 vips_op_response,
4796 VipsImage { ctx: out_out },
4797 Error::SubsampleError,
4798 )
4799 }
4800}
4801
4802#[derive(Clone, Debug)]
4804pub struct SubsampleOptions {
4805 pub point: bool,
4808}
4809
4810impl std::default::Default for SubsampleOptions {
4811 fn default() -> Self {
4812 SubsampleOptions { point: false }
4813 }
4814}
4815
4816pub fn subsample_with_opts(
4825 input: &VipsImage,
4826 xfac: i32,
4827 yfac: i32,
4828 subsample_options: &SubsampleOptions,
4829) -> Result<VipsImage> {
4830 unsafe {
4831 let input_in: *mut bindings::VipsImage = input.ctx;
4832 let xfac_in: i32 = xfac;
4833 let yfac_in: i32 = yfac;
4834 let mut out_out: *mut bindings::VipsImage = null_mut();
4835
4836 let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4837 let point_in_name = utils::new_c_string("point")?;
4838
4839 let vips_op_response = bindings::vips_subsample(
4840 input_in,
4841 &mut out_out,
4842 xfac_in,
4843 yfac_in,
4844 point_in_name.as_ptr(),
4845 point_in,
4846 NULL,
4847 );
4848 utils::result(
4849 vips_op_response,
4850 VipsImage { ctx: out_out },
4851 Error::SubsampleError,
4852 )
4853 }
4854}
4855
4856pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4860 unsafe {
4861 let inp_in: *mut bindings::VipsImage = inp.ctx;
4862 let mut out_out: *mut bindings::VipsImage = null_mut();
4863
4864 let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4865 utils::result(
4866 vips_op_response,
4867 VipsImage { ctx: out_out },
4868 Error::MsbError,
4869 )
4870 }
4871}
4872
4873#[derive(Clone, Debug)]
4875pub struct MsbOptions {
4876 pub band: i32,
4879}
4880
4881impl std::default::Default for MsbOptions {
4882 fn default() -> Self {
4883 MsbOptions {
4884 band: i32::from(-1),
4885 }
4886 }
4887}
4888
4889pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4894 unsafe {
4895 let inp_in: *mut bindings::VipsImage = inp.ctx;
4896 let mut out_out: *mut bindings::VipsImage = null_mut();
4897
4898 let band_in: i32 = msb_options.band;
4899 let band_in_name = utils::new_c_string("band")?;
4900
4901 let vips_op_response =
4902 bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4903 utils::result(
4904 vips_op_response,
4905 VipsImage { ctx: out_out },
4906 Error::MsbError,
4907 )
4908 }
4909}
4910
4911pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4915 unsafe {
4916 let inp_in: *mut bindings::VipsImage = inp.ctx;
4917 let mut out_out: *mut bindings::VipsImage = null_mut();
4918
4919 let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4920 utils::result(
4921 vips_op_response,
4922 VipsImage { ctx: out_out },
4923 Error::ByteswapError,
4924 )
4925 }
4926}
4927
4928pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4932 unsafe {
4933 let inp_in: *mut bindings::VipsImage = inp.ctx;
4934 let mut out_out: *mut bindings::VipsImage = null_mut();
4935
4936 let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4937 utils::result(
4938 vips_op_response,
4939 VipsImage { ctx: out_out },
4940 Error::FalsecolourError,
4941 )
4942 }
4943}
4944
4945pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4949 unsafe {
4950 let inp_in: *mut bindings::VipsImage = inp.ctx;
4951 let mut out_out: *mut bindings::VipsImage = null_mut();
4952
4953 let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4954 utils::result(
4955 vips_op_response,
4956 VipsImage { ctx: out_out },
4957 Error::GammaError,
4958 )
4959 }
4960}
4961
4962#[derive(Clone, Debug)]
4964pub struct GammaOptions {
4965 pub exponent: f64,
4968}
4969
4970impl std::default::Default for GammaOptions {
4971 fn default() -> Self {
4972 GammaOptions {
4973 exponent: f64::from(0.416667),
4974 }
4975 }
4976}
4977
4978pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4983 unsafe {
4984 let inp_in: *mut bindings::VipsImage = inp.ctx;
4985 let mut out_out: *mut bindings::VipsImage = null_mut();
4986
4987 let exponent_in: f64 = gamma_options.exponent;
4988 let exponent_in_name = utils::new_c_string("exponent")?;
4989
4990 let vips_op_response = bindings::vips_gamma(
4991 inp_in,
4992 &mut out_out,
4993 exponent_in_name.as_ptr(),
4994 exponent_in,
4995 NULL,
4996 );
4997 utils::result(
4998 vips_op_response,
4999 VipsImage { ctx: out_out },
5000 Error::GammaError,
5001 )
5002 }
5003}
5004
5005pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
5010 unsafe {
5011 let (inp_len, mut inp_in) = {
5012 let len = inp.len();
5013 let mut input = Vec::new();
5014 for img in inp {
5015 input.push(img.ctx)
5016 }
5017 (len as i32, input)
5018 };
5019 let mode_in: *mut i32 = mode.as_mut_ptr();
5020 let mut out_out: *mut bindings::VipsImage = null_mut();
5021
5022 let vips_op_response = bindings::vips_composite(
5023 inp_in.as_mut_ptr(),
5024 &mut out_out,
5025 inp_len,
5026 mode_in,
5027 mode.len() as i32,
5028 NULL,
5029 );
5030 utils::result(
5031 vips_op_response,
5032 VipsImage { ctx: out_out },
5033 Error::CompositeError,
5034 )
5035 }
5036}
5037
5038#[derive(Clone, Debug)]
5040pub struct CompositeOptions {
5041 pub x: Vec<i32>,
5043 pub y: Vec<i32>,
5045 pub compositing_space: Interpretation,
5068 pub premultiplied: bool,
5071}
5072
5073impl std::default::Default for CompositeOptions {
5074 fn default() -> Self {
5075 CompositeOptions {
5076 x: Vec::new(),
5077 y: Vec::new(),
5078 compositing_space: Interpretation::Srgb,
5079 premultiplied: false,
5080 }
5081 }
5082}
5083
5084pub fn composite_with_opts(
5090 inp: &mut [VipsImage],
5091 mode: &mut [i32],
5092 composite_options: &CompositeOptions,
5093) -> Result<VipsImage> {
5094 unsafe {
5095 let (inp_len, mut inp_in) = {
5096 let len = inp.len();
5097 let mut input = Vec::new();
5098 for img in inp {
5099 input.push(img.ctx)
5100 }
5101 (len as i32, input)
5102 };
5103 let mode_in: *mut i32 = mode.as_mut_ptr();
5104 let mut out_out: *mut bindings::VipsImage = null_mut();
5105
5106 let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5107 let x_in = x_wrapper.ctx;
5108 let x_in_name = utils::new_c_string("x")?;
5109
5110 let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5111 let y_in = y_wrapper.ctx;
5112 let y_in_name = utils::new_c_string("y")?;
5113
5114 let compositing_space_in: i32 = composite_options.compositing_space as i32;
5115 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5116
5117 let premultiplied_in: i32 = if composite_options.premultiplied {
5118 1
5119 } else {
5120 0
5121 };
5122 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5123
5124 let vips_op_response = bindings::vips_composite(
5125 inp_in.as_mut_ptr(),
5126 &mut out_out,
5127 inp_len,
5128 mode_in,
5129 mode.len() as i32,
5130 x_in_name.as_ptr(),
5131 x_in,
5132 y_in_name.as_ptr(),
5133 y_in,
5134 compositing_space_in_name.as_ptr(),
5135 compositing_space_in,
5136 premultiplied_in_name.as_ptr(),
5137 premultiplied_in,
5138 NULL,
5139 );
5140 utils::result(
5141 vips_op_response,
5142 VipsImage { ctx: out_out },
5143 Error::CompositeError,
5144 )
5145 }
5146}
5147
5148pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5180 unsafe {
5181 let base_in: *mut bindings::VipsImage = base.ctx;
5182 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5183 let mode_in: i32 = mode as i32;
5184 let mut out_out: *mut bindings::VipsImage = null_mut();
5185
5186 let vips_op_response = bindings::vips_composite2(
5187 base_in,
5188 overlay_in,
5189 &mut out_out,
5190 mode_in.try_into().unwrap(),
5191 NULL,
5192 );
5193 utils::result(
5194 vips_op_response,
5195 VipsImage { ctx: out_out },
5196 Error::Composite2Error,
5197 )
5198 }
5199}
5200
5201#[derive(Clone, Debug)]
5203pub struct Composite2Options {
5204 pub x: i32,
5207 pub y: i32,
5210 pub compositing_space: Interpretation,
5233 pub premultiplied: bool,
5236}
5237
5238impl std::default::Default for Composite2Options {
5239 fn default() -> Self {
5240 Composite2Options {
5241 x: i32::from(0),
5242 y: i32::from(0),
5243 compositing_space: Interpretation::Srgb,
5244 premultiplied: false,
5245 }
5246 }
5247}
5248
5249pub fn composite_2_with_opts(
5282 base: &VipsImage,
5283 overlay: &VipsImage,
5284 mode: BlendMode,
5285 composite_2_options: &Composite2Options,
5286) -> Result<VipsImage> {
5287 unsafe {
5288 let base_in: *mut bindings::VipsImage = base.ctx;
5289 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5290 let mode_in: i32 = mode as i32;
5291 let mut out_out: *mut bindings::VipsImage = null_mut();
5292
5293 let x_in: i32 = composite_2_options.x;
5294 let x_in_name = utils::new_c_string("x")?;
5295
5296 let y_in: i32 = composite_2_options.y;
5297 let y_in_name = utils::new_c_string("y")?;
5298
5299 let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5300 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5301
5302 let premultiplied_in: i32 = if composite_2_options.premultiplied {
5303 1
5304 } else {
5305 0
5306 };
5307 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5308
5309 let vips_op_response = bindings::vips_composite2(
5310 base_in,
5311 overlay_in,
5312 &mut out_out,
5313 mode_in.try_into().unwrap(),
5314 x_in_name.as_ptr(),
5315 x_in,
5316 y_in_name.as_ptr(),
5317 y_in,
5318 compositing_space_in_name.as_ptr(),
5319 compositing_space_in,
5320 premultiplied_in_name.as_ptr(),
5321 premultiplied_in,
5322 NULL,
5323 );
5324 utils::result(
5325 vips_op_response,
5326 VipsImage { ctx: out_out },
5327 Error::Composite2Error,
5328 )
5329 }
5330}
5331
5332pub fn addalpha(inp: &VipsImage) -> Result<VipsImage> {
5336 unsafe {
5337 let inp_in: *mut bindings::VipsImage = inp.ctx;
5338 let mut out_out: *mut bindings::VipsImage = null_mut();
5339
5340 let vips_op_response = bindings::vips_addalpha(inp_in, &mut out_out, NULL);
5341 utils::result(
5342 vips_op_response,
5343 VipsImage { ctx: out_out },
5344 Error::AddalphaError,
5345 )
5346 }
5347}
5348
5349pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5356 unsafe {
5357 let width_in: i32 = width;
5358 let height_in: i32 = height;
5359 let mut out_out: *mut bindings::VipsImage = null_mut();
5360
5361 let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5362 utils::result(
5363 vips_op_response,
5364 VipsImage { ctx: out_out },
5365 Error::BlackError,
5366 )
5367 }
5368}
5369
5370#[derive(Clone, Debug)]
5372pub struct BlackOptions {
5373 pub bands: i32,
5376}
5377
5378impl std::default::Default for BlackOptions {
5379 fn default() -> Self {
5380 BlackOptions {
5381 bands: i32::from(1),
5382 }
5383 }
5384}
5385
5386pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5394 unsafe {
5395 let width_in: i32 = width;
5396 let height_in: i32 = height;
5397 let mut out_out: *mut bindings::VipsImage = null_mut();
5398
5399 let bands_in: i32 = black_options.bands;
5400 let bands_in_name = utils::new_c_string("bands")?;
5401
5402 let vips_op_response = bindings::vips_black(
5403 &mut out_out,
5404 width_in,
5405 height_in,
5406 bands_in_name.as_ptr(),
5407 bands_in,
5408 NULL,
5409 );
5410 utils::result(
5411 vips_op_response,
5412 VipsImage { ctx: out_out },
5413 Error::BlackError,
5414 )
5415 }
5416}
5417
5418pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5425 unsafe {
5426 let width_in: i32 = width;
5427 let height_in: i32 = height;
5428 let mut out_out: *mut bindings::VipsImage = null_mut();
5429
5430 let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5431 utils::result(
5432 vips_op_response,
5433 VipsImage { ctx: out_out },
5434 Error::GaussnoiseError,
5435 )
5436 }
5437}
5438
5439#[derive(Clone, Debug)]
5441pub struct GaussnoiseOptions {
5442 pub sigma: f64,
5445 pub mean: f64,
5448 pub seed: i32,
5451}
5452
5453impl std::default::Default for GaussnoiseOptions {
5454 fn default() -> Self {
5455 GaussnoiseOptions {
5456 sigma: f64::from(30),
5457 mean: f64::from(128),
5458 seed: i32::from(0),
5459 }
5460 }
5461}
5462
5463pub fn gaussnoise_with_opts(
5471 width: i32,
5472 height: i32,
5473 gaussnoise_options: &GaussnoiseOptions,
5474) -> Result<VipsImage> {
5475 unsafe {
5476 let width_in: i32 = width;
5477 let height_in: i32 = height;
5478 let mut out_out: *mut bindings::VipsImage = null_mut();
5479
5480 let sigma_in: f64 = gaussnoise_options.sigma;
5481 let sigma_in_name = utils::new_c_string("sigma")?;
5482
5483 let mean_in: f64 = gaussnoise_options.mean;
5484 let mean_in_name = utils::new_c_string("mean")?;
5485
5486 let seed_in: i32 = gaussnoise_options.seed;
5487 let seed_in_name = utils::new_c_string("seed")?;
5488
5489 let vips_op_response = bindings::vips_gaussnoise(
5490 &mut out_out,
5491 width_in,
5492 height_in,
5493 sigma_in_name.as_ptr(),
5494 sigma_in,
5495 mean_in_name.as_ptr(),
5496 mean_in,
5497 seed_in_name.as_ptr(),
5498 seed_in,
5499 NULL,
5500 );
5501 utils::result(
5502 vips_op_response,
5503 VipsImage { ctx: out_out },
5504 Error::GaussnoiseError,
5505 )
5506 }
5507}
5508
5509pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5516 unsafe {
5517 let width_in: i32 = width;
5518 let height_in: i32 = height;
5519 let mut out_out: *mut bindings::VipsImage = null_mut();
5520
5521 let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5522 utils::result(
5523 vips_op_response,
5524 VipsImage { ctx: out_out },
5525 Error::XyzError,
5526 )
5527 }
5528}
5529
5530#[derive(Clone, Debug)]
5532pub struct XyzOptions {
5533 pub csize: i32,
5536 pub dsize: i32,
5539 pub esize: i32,
5542}
5543
5544impl std::default::Default for XyzOptions {
5545 fn default() -> Self {
5546 XyzOptions {
5547 csize: i32::from(1),
5548 dsize: i32::from(1),
5549 esize: i32::from(1),
5550 }
5551 }
5552}
5553
5554pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5562 unsafe {
5563 let width_in: i32 = width;
5564 let height_in: i32 = height;
5565 let mut out_out: *mut bindings::VipsImage = null_mut();
5566
5567 let csize_in: i32 = xyz_options.csize;
5568 let csize_in_name = utils::new_c_string("csize")?;
5569
5570 let dsize_in: i32 = xyz_options.dsize;
5571 let dsize_in_name = utils::new_c_string("dsize")?;
5572
5573 let esize_in: i32 = xyz_options.esize;
5574 let esize_in_name = utils::new_c_string("esize")?;
5575
5576 let vips_op_response = bindings::vips_xyz(
5577 &mut out_out,
5578 width_in,
5579 height_in,
5580 csize_in_name.as_ptr(),
5581 csize_in,
5582 dsize_in_name.as_ptr(),
5583 dsize_in,
5584 esize_in_name.as_ptr(),
5585 esize_in,
5586 NULL,
5587 );
5588 utils::result(
5589 vips_op_response,
5590 VipsImage { ctx: out_out },
5591 Error::XyzError,
5592 )
5593 }
5594}
5595
5596pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5603 unsafe {
5604 let sigma_in: f64 = sigma;
5605 let min_ampl_in: f64 = min_ampl;
5606 let mut out_out: *mut bindings::VipsImage = null_mut();
5607
5608 let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5609 utils::result(
5610 vips_op_response,
5611 VipsImage { ctx: out_out },
5612 Error::GaussmatError,
5613 )
5614 }
5615}
5616
5617#[derive(Clone, Debug)]
5619pub struct GaussmatOptions {
5620 pub separable: bool,
5623 pub precision: Precision,
5629}
5630
5631impl std::default::Default for GaussmatOptions {
5632 fn default() -> Self {
5633 GaussmatOptions {
5634 separable: false,
5635 precision: Precision::Integer,
5636 }
5637 }
5638}
5639
5640pub fn gaussmat_with_opts(
5648 sigma: f64,
5649 min_ampl: f64,
5650 gaussmat_options: &GaussmatOptions,
5651) -> Result<VipsImage> {
5652 unsafe {
5653 let sigma_in: f64 = sigma;
5654 let min_ampl_in: f64 = min_ampl;
5655 let mut out_out: *mut bindings::VipsImage = null_mut();
5656
5657 let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5658 let separable_in_name = utils::new_c_string("separable")?;
5659
5660 let precision_in: i32 = gaussmat_options.precision as i32;
5661 let precision_in_name = utils::new_c_string("precision")?;
5662
5663 let vips_op_response = bindings::vips_gaussmat(
5664 &mut out_out,
5665 sigma_in,
5666 min_ampl_in,
5667 separable_in_name.as_ptr(),
5668 separable_in,
5669 precision_in_name.as_ptr(),
5670 precision_in,
5671 NULL,
5672 );
5673 utils::result(
5674 vips_op_response,
5675 VipsImage { ctx: out_out },
5676 Error::GaussmatError,
5677 )
5678 }
5679}
5680
5681pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5688 unsafe {
5689 let sigma_in: f64 = sigma;
5690 let min_ampl_in: f64 = min_ampl;
5691 let mut out_out: *mut bindings::VipsImage = null_mut();
5692
5693 let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5694 utils::result(
5695 vips_op_response,
5696 VipsImage { ctx: out_out },
5697 Error::LogmatError,
5698 )
5699 }
5700}
5701
5702#[derive(Clone, Debug)]
5704pub struct LogmatOptions {
5705 pub separable: bool,
5708 pub precision: Precision,
5714}
5715
5716impl std::default::Default for LogmatOptions {
5717 fn default() -> Self {
5718 LogmatOptions {
5719 separable: false,
5720 precision: Precision::Integer,
5721 }
5722 }
5723}
5724
5725pub fn logmat_with_opts(
5733 sigma: f64,
5734 min_ampl: f64,
5735 logmat_options: &LogmatOptions,
5736) -> Result<VipsImage> {
5737 unsafe {
5738 let sigma_in: f64 = sigma;
5739 let min_ampl_in: f64 = min_ampl;
5740 let mut out_out: *mut bindings::VipsImage = null_mut();
5741
5742 let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5743 let separable_in_name = utils::new_c_string("separable")?;
5744
5745 let precision_in: i32 = logmat_options.precision as i32;
5746 let precision_in_name = utils::new_c_string("precision")?;
5747
5748 let vips_op_response = bindings::vips_logmat(
5749 &mut out_out,
5750 sigma_in,
5751 min_ampl_in,
5752 separable_in_name.as_ptr(),
5753 separable_in,
5754 precision_in_name.as_ptr(),
5755 precision_in,
5756 NULL,
5757 );
5758 utils::result(
5759 vips_op_response,
5760 VipsImage { ctx: out_out },
5761 Error::LogmatError,
5762 )
5763 }
5764}
5765
5766pub fn text(text: &str) -> Result<VipsImage> {
5770 unsafe {
5771 let text_in: CString = utils::new_c_string(text)?;
5772 let mut out_out: *mut bindings::VipsImage = null_mut();
5773
5774 let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5775 utils::result(
5776 vips_op_response,
5777 VipsImage { ctx: out_out },
5778 Error::TextError,
5779 )
5780 }
5781}
5782
5783#[derive(Clone, Debug)]
5785pub struct TextOptions {
5786 pub font: String,
5788 pub width: i32,
5791 pub height: i32,
5794 pub align: Align,
5800 pub justify: bool,
5803 pub dpi: i32,
5806 pub autofit_dpi: i32,
5809 pub spacing: i32,
5812 pub fontfile: String,
5814 pub rgba: bool,
5817 pub wrap: TextWrap,
5824}
5825
5826impl std::default::Default for TextOptions {
5827 fn default() -> Self {
5828 TextOptions {
5829 font: String::new(),
5830 width: i32::from(0),
5831 height: i32::from(0),
5832 align: Align::Low,
5833 justify: false,
5834 dpi: i32::from(72),
5835 autofit_dpi: i32::from(72),
5836 spacing: i32::from(0),
5837 fontfile: String::new(),
5838 rgba: false,
5839 wrap: TextWrap::Word,
5840 }
5841 }
5842}
5843
5844pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5849 unsafe {
5850 let text_in: CString = utils::new_c_string(text)?;
5851 let mut out_out: *mut bindings::VipsImage = null_mut();
5852
5853 let font_in: CString = utils::new_c_string(&text_options.font)?;
5854 let font_in_name = utils::new_c_string("font")?;
5855
5856 let width_in: i32 = text_options.width;
5857 let width_in_name = utils::new_c_string("width")?;
5858
5859 let height_in: i32 = text_options.height;
5860 let height_in_name = utils::new_c_string("height")?;
5861
5862 let align_in: i32 = text_options.align as i32;
5863 let align_in_name = utils::new_c_string("align")?;
5864
5865 let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5866 let justify_in_name = utils::new_c_string("justify")?;
5867
5868 let dpi_in: i32 = text_options.dpi;
5869 let dpi_in_name = utils::new_c_string("dpi")?;
5870
5871 let autofit_dpi_in: i32 = text_options.autofit_dpi;
5872 let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5873
5874 let spacing_in: i32 = text_options.spacing;
5875 let spacing_in_name = utils::new_c_string("spacing")?;
5876
5877 let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5878 let fontfile_in_name = utils::new_c_string("fontfile")?;
5879
5880 let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5881 let rgba_in_name = utils::new_c_string("rgba")?;
5882
5883 let wrap_in: i32 = text_options.wrap as i32;
5884 let wrap_in_name = utils::new_c_string("wrap")?;
5885
5886 let vips_op_response = bindings::vips_text(
5887 &mut out_out,
5888 text_in.as_ptr(),
5889 font_in_name.as_ptr(),
5890 font_in.as_ptr(),
5891 width_in_name.as_ptr(),
5892 width_in,
5893 height_in_name.as_ptr(),
5894 height_in,
5895 align_in_name.as_ptr(),
5896 align_in,
5897 justify_in_name.as_ptr(),
5898 justify_in,
5899 dpi_in_name.as_ptr(),
5900 dpi_in,
5901 autofit_dpi_in_name.as_ptr(),
5902 autofit_dpi_in,
5903 spacing_in_name.as_ptr(),
5904 spacing_in,
5905 fontfile_in_name.as_ptr(),
5906 fontfile_in.as_ptr(),
5907 rgba_in_name.as_ptr(),
5908 rgba_in,
5909 wrap_in_name.as_ptr(),
5910 wrap_in,
5911 NULL,
5912 );
5913 utils::result(
5914 vips_op_response,
5915 VipsImage { ctx: out_out },
5916 Error::TextError,
5917 )
5918 }
5919}
5920
5921pub fn sdf(width: i32, height: i32, shape: SdfShape) -> Result<VipsImage> {
5934 unsafe {
5935 let width_in: i32 = width;
5936 let height_in: i32 = height;
5937 let shape_in: i32 = shape as i32;
5938 let mut out_out: *mut bindings::VipsImage = null_mut();
5939
5940 let vips_op_response = bindings::vips_sdf(
5941 &mut out_out,
5942 width_in,
5943 height_in,
5944 shape_in.try_into().unwrap(),
5945 NULL,
5946 );
5947 utils::result(
5948 vips_op_response,
5949 VipsImage { ctx: out_out },
5950 Error::SdfError,
5951 )
5952 }
5953}
5954
5955#[derive(Clone, Debug)]
5957pub struct SdfOptions {
5958 pub r: f64,
5961 pub a: Vec<f64>,
5963 pub b: Vec<f64>,
5965 pub corners: Vec<f64>,
5967}
5968
5969impl std::default::Default for SdfOptions {
5970 fn default() -> Self {
5971 SdfOptions {
5972 r: f64::from(50),
5973 a: Vec::new(),
5974 b: Vec::new(),
5975 corners: Vec::new(),
5976 }
5977 }
5978}
5979
5980pub fn sdf_with_opts(
5994 width: i32,
5995 height: i32,
5996 shape: SdfShape,
5997 sdf_options: &SdfOptions,
5998) -> Result<VipsImage> {
5999 unsafe {
6000 let width_in: i32 = width;
6001 let height_in: i32 = height;
6002 let shape_in: i32 = shape as i32;
6003 let mut out_out: *mut bindings::VipsImage = null_mut();
6004
6005 let r_in: f64 = sdf_options.r;
6006 let r_in_name = utils::new_c_string("r")?;
6007
6008 let a_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.a[..]);
6009 let a_in = a_wrapper.ctx;
6010 let a_in_name = utils::new_c_string("a")?;
6011
6012 let b_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.b[..]);
6013 let b_in = b_wrapper.ctx;
6014 let b_in_name = utils::new_c_string("b")?;
6015
6016 let corners_wrapper = utils::VipsArrayDoubleWrapper::from(&sdf_options.corners[..]);
6017 let corners_in = corners_wrapper.ctx;
6018 let corners_in_name = utils::new_c_string("corners")?;
6019
6020 let vips_op_response = bindings::vips_sdf(
6021 &mut out_out,
6022 width_in,
6023 height_in,
6024 shape_in.try_into().unwrap(),
6025 r_in_name.as_ptr(),
6026 r_in,
6027 a_in_name.as_ptr(),
6028 a_in,
6029 b_in_name.as_ptr(),
6030 b_in,
6031 corners_in_name.as_ptr(),
6032 corners_in,
6033 NULL,
6034 );
6035 utils::result(
6036 vips_op_response,
6037 VipsImage { ctx: out_out },
6038 Error::SdfError,
6039 )
6040 }
6041}
6042
6043pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
6050 unsafe {
6051 let width_in: i32 = width;
6052 let height_in: i32 = height;
6053 let mut out_out: *mut bindings::VipsImage = null_mut();
6054
6055 let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
6056 utils::result(
6057 vips_op_response,
6058 VipsImage { ctx: out_out },
6059 Error::EyeError,
6060 )
6061 }
6062}
6063
6064#[derive(Clone, Debug)]
6066pub struct EyeOptions {
6067 pub uchar: bool,
6070 pub factor: f64,
6073}
6074
6075impl std::default::Default for EyeOptions {
6076 fn default() -> Self {
6077 EyeOptions {
6078 uchar: false,
6079 factor: f64::from(0.5),
6080 }
6081 }
6082}
6083
6084pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
6092 unsafe {
6093 let width_in: i32 = width;
6094 let height_in: i32 = height;
6095 let mut out_out: *mut bindings::VipsImage = null_mut();
6096
6097 let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
6098 let uchar_in_name = utils::new_c_string("uchar")?;
6099
6100 let factor_in: f64 = eye_options.factor;
6101 let factor_in_name = utils::new_c_string("factor")?;
6102
6103 let vips_op_response = bindings::vips_eye(
6104 &mut out_out,
6105 width_in,
6106 height_in,
6107 uchar_in_name.as_ptr(),
6108 uchar_in,
6109 factor_in_name.as_ptr(),
6110 factor_in,
6111 NULL,
6112 );
6113 utils::result(
6114 vips_op_response,
6115 VipsImage { ctx: out_out },
6116 Error::EyeError,
6117 )
6118 }
6119}
6120
6121pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
6128 unsafe {
6129 let width_in: i32 = width;
6130 let height_in: i32 = height;
6131 let mut out_out: *mut bindings::VipsImage = null_mut();
6132
6133 let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
6134 utils::result(
6135 vips_op_response,
6136 VipsImage { ctx: out_out },
6137 Error::GreyError,
6138 )
6139 }
6140}
6141
6142#[derive(Clone, Debug)]
6144pub struct GreyOptions {
6145 pub uchar: bool,
6148}
6149
6150impl std::default::Default for GreyOptions {
6151 fn default() -> Self {
6152 GreyOptions { uchar: false }
6153 }
6154}
6155
6156pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6164 unsafe {
6165 let width_in: i32 = width;
6166 let height_in: i32 = height;
6167 let mut out_out: *mut bindings::VipsImage = null_mut();
6168
6169 let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6170 let uchar_in_name = utils::new_c_string("uchar")?;
6171
6172 let vips_op_response = bindings::vips_grey(
6173 &mut out_out,
6174 width_in,
6175 height_in,
6176 uchar_in_name.as_ptr(),
6177 uchar_in,
6178 NULL,
6179 );
6180 utils::result(
6181 vips_op_response,
6182 VipsImage { ctx: out_out },
6183 Error::GreyError,
6184 )
6185 }
6186}
6187
6188pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6195 unsafe {
6196 let width_in: i32 = width;
6197 let height_in: i32 = height;
6198 let mut out_out: *mut bindings::VipsImage = null_mut();
6199
6200 let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6201 utils::result(
6202 vips_op_response,
6203 VipsImage { ctx: out_out },
6204 Error::ZoneError,
6205 )
6206 }
6207}
6208
6209#[derive(Clone, Debug)]
6211pub struct ZoneOptions {
6212 pub uchar: bool,
6215}
6216
6217impl std::default::Default for ZoneOptions {
6218 fn default() -> Self {
6219 ZoneOptions { uchar: false }
6220 }
6221}
6222
6223pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6231 unsafe {
6232 let width_in: i32 = width;
6233 let height_in: i32 = height;
6234 let mut out_out: *mut bindings::VipsImage = null_mut();
6235
6236 let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6237 let uchar_in_name = utils::new_c_string("uchar")?;
6238
6239 let vips_op_response = bindings::vips_zone(
6240 &mut out_out,
6241 width_in,
6242 height_in,
6243 uchar_in_name.as_ptr(),
6244 uchar_in,
6245 NULL,
6246 );
6247 utils::result(
6248 vips_op_response,
6249 VipsImage { ctx: out_out },
6250 Error::ZoneError,
6251 )
6252 }
6253}
6254
6255pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6262 unsafe {
6263 let width_in: i32 = width;
6264 let height_in: i32 = height;
6265 let mut out_out: *mut bindings::VipsImage = null_mut();
6266
6267 let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6268 utils::result(
6269 vips_op_response,
6270 VipsImage { ctx: out_out },
6271 Error::SineError,
6272 )
6273 }
6274}
6275
6276#[derive(Clone, Debug)]
6278pub struct SineOptions {
6279 pub uchar: bool,
6282 pub hfreq: f64,
6285 pub vfreq: f64,
6288}
6289
6290impl std::default::Default for SineOptions {
6291 fn default() -> Self {
6292 SineOptions {
6293 uchar: false,
6294 hfreq: f64::from(0.5),
6295 vfreq: f64::from(0.5),
6296 }
6297 }
6298}
6299
6300pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6308 unsafe {
6309 let width_in: i32 = width;
6310 let height_in: i32 = height;
6311 let mut out_out: *mut bindings::VipsImage = null_mut();
6312
6313 let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6314 let uchar_in_name = utils::new_c_string("uchar")?;
6315
6316 let hfreq_in: f64 = sines_options.hfreq;
6317 let hfreq_in_name = utils::new_c_string("hfreq")?;
6318
6319 let vfreq_in: f64 = sines_options.vfreq;
6320 let vfreq_in_name = utils::new_c_string("vfreq")?;
6321
6322 let vips_op_response = bindings::vips_sines(
6323 &mut out_out,
6324 width_in,
6325 height_in,
6326 uchar_in_name.as_ptr(),
6327 uchar_in,
6328 hfreq_in_name.as_ptr(),
6329 hfreq_in,
6330 vfreq_in_name.as_ptr(),
6331 vfreq_in,
6332 NULL,
6333 );
6334 utils::result(
6335 vips_op_response,
6336 VipsImage { ctx: out_out },
6337 Error::SineError,
6338 )
6339 }
6340}
6341
6342pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6351 unsafe {
6352 let width_in: i32 = width;
6353 let height_in: i32 = height;
6354 let frequency_cutoff_in: f64 = frequency_cutoff;
6355 let mut out_out: *mut bindings::VipsImage = null_mut();
6356
6357 let vips_op_response =
6358 bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6359 utils::result(
6360 vips_op_response,
6361 VipsImage { ctx: out_out },
6362 Error::MaskIdealError,
6363 )
6364 }
6365}
6366
6367#[derive(Clone, Debug)]
6369pub struct MaskIdealOptions {
6370 pub uchar: bool,
6373 pub nodc: bool,
6376 pub reject: bool,
6379 pub optical: bool,
6382}
6383
6384impl std::default::Default for MaskIdealOptions {
6385 fn default() -> Self {
6386 MaskIdealOptions {
6387 uchar: false,
6388 nodc: false,
6389 reject: false,
6390 optical: false,
6391 }
6392 }
6393}
6394
6395pub fn mask_ideal_with_opts(
6405 width: i32,
6406 height: i32,
6407 frequency_cutoff: f64,
6408 mask_ideal_options: &MaskIdealOptions,
6409) -> Result<VipsImage> {
6410 unsafe {
6411 let width_in: i32 = width;
6412 let height_in: i32 = height;
6413 let frequency_cutoff_in: f64 = frequency_cutoff;
6414 let mut out_out: *mut bindings::VipsImage = null_mut();
6415
6416 let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6417 let uchar_in_name = utils::new_c_string("uchar")?;
6418
6419 let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6420 let nodc_in_name = utils::new_c_string("nodc")?;
6421
6422 let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6423 let reject_in_name = utils::new_c_string("reject")?;
6424
6425 let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6426 let optical_in_name = utils::new_c_string("optical")?;
6427
6428 let vips_op_response = bindings::vips_mask_ideal(
6429 &mut out_out,
6430 width_in,
6431 height_in,
6432 frequency_cutoff_in,
6433 uchar_in_name.as_ptr(),
6434 uchar_in,
6435 nodc_in_name.as_ptr(),
6436 nodc_in,
6437 reject_in_name.as_ptr(),
6438 reject_in,
6439 optical_in_name.as_ptr(),
6440 optical_in,
6441 NULL,
6442 );
6443 utils::result(
6444 vips_op_response,
6445 VipsImage { ctx: out_out },
6446 Error::MaskIdealError,
6447 )
6448 }
6449}
6450
6451pub fn mask_ideal_ring(
6462 width: i32,
6463 height: i32,
6464 frequency_cutoff: f64,
6465 ringwidth: f64,
6466) -> Result<VipsImage> {
6467 unsafe {
6468 let width_in: i32 = width;
6469 let height_in: i32 = height;
6470 let frequency_cutoff_in: f64 = frequency_cutoff;
6471 let ringwidth_in: f64 = ringwidth;
6472 let mut out_out: *mut bindings::VipsImage = null_mut();
6473
6474 let vips_op_response = bindings::vips_mask_ideal_ring(
6475 &mut out_out,
6476 width_in,
6477 height_in,
6478 frequency_cutoff_in,
6479 ringwidth_in,
6480 NULL,
6481 );
6482 utils::result(
6483 vips_op_response,
6484 VipsImage { ctx: out_out },
6485 Error::MaskIdealRingError,
6486 )
6487 }
6488}
6489
6490#[derive(Clone, Debug)]
6492pub struct MaskIdealRingOptions {
6493 pub uchar: bool,
6496 pub nodc: bool,
6499 pub reject: bool,
6502 pub optical: bool,
6505}
6506
6507impl std::default::Default for MaskIdealRingOptions {
6508 fn default() -> Self {
6509 MaskIdealRingOptions {
6510 uchar: false,
6511 nodc: false,
6512 reject: false,
6513 optical: false,
6514 }
6515 }
6516}
6517
6518pub fn mask_ideal_ring_with_opts(
6530 width: i32,
6531 height: i32,
6532 frequency_cutoff: f64,
6533 ringwidth: f64,
6534 mask_ideal_ring_options: &MaskIdealRingOptions,
6535) -> Result<VipsImage> {
6536 unsafe {
6537 let width_in: i32 = width;
6538 let height_in: i32 = height;
6539 let frequency_cutoff_in: f64 = frequency_cutoff;
6540 let ringwidth_in: f64 = ringwidth;
6541 let mut out_out: *mut bindings::VipsImage = null_mut();
6542
6543 let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6544 let uchar_in_name = utils::new_c_string("uchar")?;
6545
6546 let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6547 let nodc_in_name = utils::new_c_string("nodc")?;
6548
6549 let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6550 let reject_in_name = utils::new_c_string("reject")?;
6551
6552 let optical_in: i32 = if mask_ideal_ring_options.optical {
6553 1
6554 } else {
6555 0
6556 };
6557 let optical_in_name = utils::new_c_string("optical")?;
6558
6559 let vips_op_response = bindings::vips_mask_ideal_ring(
6560 &mut out_out,
6561 width_in,
6562 height_in,
6563 frequency_cutoff_in,
6564 ringwidth_in,
6565 uchar_in_name.as_ptr(),
6566 uchar_in,
6567 nodc_in_name.as_ptr(),
6568 nodc_in,
6569 reject_in_name.as_ptr(),
6570 reject_in,
6571 optical_in_name.as_ptr(),
6572 optical_in,
6573 NULL,
6574 );
6575 utils::result(
6576 vips_op_response,
6577 VipsImage { ctx: out_out },
6578 Error::MaskIdealRingError,
6579 )
6580 }
6581}
6582
6583pub fn mask_ideal_band(
6596 width: i32,
6597 height: i32,
6598 frequency_cutoff_x: f64,
6599 frequency_cutoff_y: f64,
6600 radius: f64,
6601) -> Result<VipsImage> {
6602 unsafe {
6603 let width_in: i32 = width;
6604 let height_in: i32 = height;
6605 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6606 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6607 let radius_in: f64 = radius;
6608 let mut out_out: *mut bindings::VipsImage = null_mut();
6609
6610 let vips_op_response = bindings::vips_mask_ideal_band(
6611 &mut out_out,
6612 width_in,
6613 height_in,
6614 frequency_cutoff_x_in,
6615 frequency_cutoff_y_in,
6616 radius_in,
6617 NULL,
6618 );
6619 utils::result(
6620 vips_op_response,
6621 VipsImage { ctx: out_out },
6622 Error::MaskIdealBandError,
6623 )
6624 }
6625}
6626
6627#[derive(Clone, Debug)]
6629pub struct MaskIdealBandOptions {
6630 pub uchar: bool,
6633 pub nodc: bool,
6636 pub reject: bool,
6639 pub optical: bool,
6642}
6643
6644impl std::default::Default for MaskIdealBandOptions {
6645 fn default() -> Self {
6646 MaskIdealBandOptions {
6647 uchar: false,
6648 nodc: false,
6649 reject: false,
6650 optical: false,
6651 }
6652 }
6653}
6654
6655pub fn mask_ideal_band_with_opts(
6669 width: i32,
6670 height: i32,
6671 frequency_cutoff_x: f64,
6672 frequency_cutoff_y: f64,
6673 radius: f64,
6674 mask_ideal_band_options: &MaskIdealBandOptions,
6675) -> Result<VipsImage> {
6676 unsafe {
6677 let width_in: i32 = width;
6678 let height_in: i32 = height;
6679 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6680 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6681 let radius_in: f64 = radius;
6682 let mut out_out: *mut bindings::VipsImage = null_mut();
6683
6684 let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6685 let uchar_in_name = utils::new_c_string("uchar")?;
6686
6687 let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6688 let nodc_in_name = utils::new_c_string("nodc")?;
6689
6690 let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6691 let reject_in_name = utils::new_c_string("reject")?;
6692
6693 let optical_in: i32 = if mask_ideal_band_options.optical {
6694 1
6695 } else {
6696 0
6697 };
6698 let optical_in_name = utils::new_c_string("optical")?;
6699
6700 let vips_op_response = bindings::vips_mask_ideal_band(
6701 &mut out_out,
6702 width_in,
6703 height_in,
6704 frequency_cutoff_x_in,
6705 frequency_cutoff_y_in,
6706 radius_in,
6707 uchar_in_name.as_ptr(),
6708 uchar_in,
6709 nodc_in_name.as_ptr(),
6710 nodc_in,
6711 reject_in_name.as_ptr(),
6712 reject_in,
6713 optical_in_name.as_ptr(),
6714 optical_in,
6715 NULL,
6716 );
6717 utils::result(
6718 vips_op_response,
6719 VipsImage { ctx: out_out },
6720 Error::MaskIdealBandError,
6721 )
6722 }
6723}
6724
6725pub fn mask_butterworth(
6738 width: i32,
6739 height: i32,
6740 order: f64,
6741 frequency_cutoff: f64,
6742 amplitude_cutoff: f64,
6743) -> Result<VipsImage> {
6744 unsafe {
6745 let width_in: i32 = width;
6746 let height_in: i32 = height;
6747 let order_in: f64 = order;
6748 let frequency_cutoff_in: f64 = frequency_cutoff;
6749 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6750 let mut out_out: *mut bindings::VipsImage = null_mut();
6751
6752 let vips_op_response = bindings::vips_mask_butterworth(
6753 &mut out_out,
6754 width_in,
6755 height_in,
6756 order_in,
6757 frequency_cutoff_in,
6758 amplitude_cutoff_in,
6759 NULL,
6760 );
6761 utils::result(
6762 vips_op_response,
6763 VipsImage { ctx: out_out },
6764 Error::MaskButterworthError,
6765 )
6766 }
6767}
6768
6769#[derive(Clone, Debug)]
6771pub struct MaskButterworthOptions {
6772 pub uchar: bool,
6775 pub nodc: bool,
6778 pub reject: bool,
6781 pub optical: bool,
6784}
6785
6786impl std::default::Default for MaskButterworthOptions {
6787 fn default() -> Self {
6788 MaskButterworthOptions {
6789 uchar: false,
6790 nodc: false,
6791 reject: false,
6792 optical: false,
6793 }
6794 }
6795}
6796
6797pub fn mask_butterworth_with_opts(
6811 width: i32,
6812 height: i32,
6813 order: f64,
6814 frequency_cutoff: f64,
6815 amplitude_cutoff: f64,
6816 mask_butterworth_options: &MaskButterworthOptions,
6817) -> Result<VipsImage> {
6818 unsafe {
6819 let width_in: i32 = width;
6820 let height_in: i32 = height;
6821 let order_in: f64 = order;
6822 let frequency_cutoff_in: f64 = frequency_cutoff;
6823 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6824 let mut out_out: *mut bindings::VipsImage = null_mut();
6825
6826 let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6827 let uchar_in_name = utils::new_c_string("uchar")?;
6828
6829 let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6830 let nodc_in_name = utils::new_c_string("nodc")?;
6831
6832 let reject_in: i32 = if mask_butterworth_options.reject {
6833 1
6834 } else {
6835 0
6836 };
6837 let reject_in_name = utils::new_c_string("reject")?;
6838
6839 let optical_in: i32 = if mask_butterworth_options.optical {
6840 1
6841 } else {
6842 0
6843 };
6844 let optical_in_name = utils::new_c_string("optical")?;
6845
6846 let vips_op_response = bindings::vips_mask_butterworth(
6847 &mut out_out,
6848 width_in,
6849 height_in,
6850 order_in,
6851 frequency_cutoff_in,
6852 amplitude_cutoff_in,
6853 uchar_in_name.as_ptr(),
6854 uchar_in,
6855 nodc_in_name.as_ptr(),
6856 nodc_in,
6857 reject_in_name.as_ptr(),
6858 reject_in,
6859 optical_in_name.as_ptr(),
6860 optical_in,
6861 NULL,
6862 );
6863 utils::result(
6864 vips_op_response,
6865 VipsImage { ctx: out_out },
6866 Error::MaskButterworthError,
6867 )
6868 }
6869}
6870
6871pub fn mask_butterworth_ring(
6886 width: i32,
6887 height: i32,
6888 order: f64,
6889 frequency_cutoff: f64,
6890 amplitude_cutoff: f64,
6891 ringwidth: f64,
6892) -> Result<VipsImage> {
6893 unsafe {
6894 let width_in: i32 = width;
6895 let height_in: i32 = height;
6896 let order_in: f64 = order;
6897 let frequency_cutoff_in: f64 = frequency_cutoff;
6898 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6899 let ringwidth_in: f64 = ringwidth;
6900 let mut out_out: *mut bindings::VipsImage = null_mut();
6901
6902 let vips_op_response = bindings::vips_mask_butterworth_ring(
6903 &mut out_out,
6904 width_in,
6905 height_in,
6906 order_in,
6907 frequency_cutoff_in,
6908 amplitude_cutoff_in,
6909 ringwidth_in,
6910 NULL,
6911 );
6912 utils::result(
6913 vips_op_response,
6914 VipsImage { ctx: out_out },
6915 Error::MaskButterworthRingError,
6916 )
6917 }
6918}
6919
6920#[derive(Clone, Debug)]
6922pub struct MaskButterworthRingOptions {
6923 pub uchar: bool,
6926 pub nodc: bool,
6929 pub reject: bool,
6932 pub optical: bool,
6935}
6936
6937impl std::default::Default for MaskButterworthRingOptions {
6938 fn default() -> Self {
6939 MaskButterworthRingOptions {
6940 uchar: false,
6941 nodc: false,
6942 reject: false,
6943 optical: false,
6944 }
6945 }
6946}
6947
6948pub fn mask_butterworth_ring_with_opts(
6964 width: i32,
6965 height: i32,
6966 order: f64,
6967 frequency_cutoff: f64,
6968 amplitude_cutoff: f64,
6969 ringwidth: f64,
6970 mask_butterworth_ring_options: &MaskButterworthRingOptions,
6971) -> Result<VipsImage> {
6972 unsafe {
6973 let width_in: i32 = width;
6974 let height_in: i32 = height;
6975 let order_in: f64 = order;
6976 let frequency_cutoff_in: f64 = frequency_cutoff;
6977 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6978 let ringwidth_in: f64 = ringwidth;
6979 let mut out_out: *mut bindings::VipsImage = null_mut();
6980
6981 let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6982 1
6983 } else {
6984 0
6985 };
6986 let uchar_in_name = utils::new_c_string("uchar")?;
6987
6988 let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6989 1
6990 } else {
6991 0
6992 };
6993 let nodc_in_name = utils::new_c_string("nodc")?;
6994
6995 let reject_in: i32 = if mask_butterworth_ring_options.reject {
6996 1
6997 } else {
6998 0
6999 };
7000 let reject_in_name = utils::new_c_string("reject")?;
7001
7002 let optical_in: i32 = if mask_butterworth_ring_options.optical {
7003 1
7004 } else {
7005 0
7006 };
7007 let optical_in_name = utils::new_c_string("optical")?;
7008
7009 let vips_op_response = bindings::vips_mask_butterworth_ring(
7010 &mut out_out,
7011 width_in,
7012 height_in,
7013 order_in,
7014 frequency_cutoff_in,
7015 amplitude_cutoff_in,
7016 ringwidth_in,
7017 uchar_in_name.as_ptr(),
7018 uchar_in,
7019 nodc_in_name.as_ptr(),
7020 nodc_in,
7021 reject_in_name.as_ptr(),
7022 reject_in,
7023 optical_in_name.as_ptr(),
7024 optical_in,
7025 NULL,
7026 );
7027 utils::result(
7028 vips_op_response,
7029 VipsImage { ctx: out_out },
7030 Error::MaskButterworthRingError,
7031 )
7032 }
7033}
7034
7035pub fn mask_butterworth_band(
7052 width: i32,
7053 height: i32,
7054 order: f64,
7055 frequency_cutoff_x: f64,
7056 frequency_cutoff_y: f64,
7057 radius: f64,
7058 amplitude_cutoff: f64,
7059) -> Result<VipsImage> {
7060 unsafe {
7061 let width_in: i32 = width;
7062 let height_in: i32 = height;
7063 let order_in: f64 = order;
7064 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7065 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7066 let radius_in: f64 = radius;
7067 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7068 let mut out_out: *mut bindings::VipsImage = null_mut();
7069
7070 let vips_op_response = bindings::vips_mask_butterworth_band(
7071 &mut out_out,
7072 width_in,
7073 height_in,
7074 order_in,
7075 frequency_cutoff_x_in,
7076 frequency_cutoff_y_in,
7077 radius_in,
7078 amplitude_cutoff_in,
7079 NULL,
7080 );
7081 utils::result(
7082 vips_op_response,
7083 VipsImage { ctx: out_out },
7084 Error::MaskButterworthBandError,
7085 )
7086 }
7087}
7088
7089#[derive(Clone, Debug)]
7091pub struct MaskButterworthBandOptions {
7092 pub uchar: bool,
7095 pub nodc: bool,
7098 pub reject: bool,
7101 pub optical: bool,
7104}
7105
7106impl std::default::Default for MaskButterworthBandOptions {
7107 fn default() -> Self {
7108 MaskButterworthBandOptions {
7109 uchar: false,
7110 nodc: false,
7111 reject: false,
7112 optical: false,
7113 }
7114 }
7115}
7116
7117pub fn mask_butterworth_band_with_opts(
7135 width: i32,
7136 height: i32,
7137 order: f64,
7138 frequency_cutoff_x: f64,
7139 frequency_cutoff_y: f64,
7140 radius: f64,
7141 amplitude_cutoff: f64,
7142 mask_butterworth_band_options: &MaskButterworthBandOptions,
7143) -> Result<VipsImage> {
7144 unsafe {
7145 let width_in: i32 = width;
7146 let height_in: i32 = height;
7147 let order_in: f64 = order;
7148 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7149 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7150 let radius_in: f64 = radius;
7151 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7152 let mut out_out: *mut bindings::VipsImage = null_mut();
7153
7154 let uchar_in: i32 = if mask_butterworth_band_options.uchar {
7155 1
7156 } else {
7157 0
7158 };
7159 let uchar_in_name = utils::new_c_string("uchar")?;
7160
7161 let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7162 1
7163 } else {
7164 0
7165 };
7166 let nodc_in_name = utils::new_c_string("nodc")?;
7167
7168 let reject_in: i32 = if mask_butterworth_band_options.reject {
7169 1
7170 } else {
7171 0
7172 };
7173 let reject_in_name = utils::new_c_string("reject")?;
7174
7175 let optical_in: i32 = if mask_butterworth_band_options.optical {
7176 1
7177 } else {
7178 0
7179 };
7180 let optical_in_name = utils::new_c_string("optical")?;
7181
7182 let vips_op_response = bindings::vips_mask_butterworth_band(
7183 &mut out_out,
7184 width_in,
7185 height_in,
7186 order_in,
7187 frequency_cutoff_x_in,
7188 frequency_cutoff_y_in,
7189 radius_in,
7190 amplitude_cutoff_in,
7191 uchar_in_name.as_ptr(),
7192 uchar_in,
7193 nodc_in_name.as_ptr(),
7194 nodc_in,
7195 reject_in_name.as_ptr(),
7196 reject_in,
7197 optical_in_name.as_ptr(),
7198 optical_in,
7199 NULL,
7200 );
7201 utils::result(
7202 vips_op_response,
7203 VipsImage { ctx: out_out },
7204 Error::MaskButterworthBandError,
7205 )
7206 }
7207}
7208
7209pub fn mask_gaussian(
7220 width: i32,
7221 height: i32,
7222 frequency_cutoff: f64,
7223 amplitude_cutoff: f64,
7224) -> Result<VipsImage> {
7225 unsafe {
7226 let width_in: i32 = width;
7227 let height_in: i32 = height;
7228 let frequency_cutoff_in: f64 = frequency_cutoff;
7229 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7230 let mut out_out: *mut bindings::VipsImage = null_mut();
7231
7232 let vips_op_response = bindings::vips_mask_gaussian(
7233 &mut out_out,
7234 width_in,
7235 height_in,
7236 frequency_cutoff_in,
7237 amplitude_cutoff_in,
7238 NULL,
7239 );
7240 utils::result(
7241 vips_op_response,
7242 VipsImage { ctx: out_out },
7243 Error::MaskGaussianError,
7244 )
7245 }
7246}
7247
7248#[derive(Clone, Debug)]
7250pub struct MaskGaussianOptions {
7251 pub uchar: bool,
7254 pub nodc: bool,
7257 pub reject: bool,
7260 pub optical: bool,
7263}
7264
7265impl std::default::Default for MaskGaussianOptions {
7266 fn default() -> Self {
7267 MaskGaussianOptions {
7268 uchar: false,
7269 nodc: false,
7270 reject: false,
7271 optical: false,
7272 }
7273 }
7274}
7275
7276pub fn mask_gaussian_with_opts(
7288 width: i32,
7289 height: i32,
7290 frequency_cutoff: f64,
7291 amplitude_cutoff: f64,
7292 mask_gaussian_options: &MaskGaussianOptions,
7293) -> Result<VipsImage> {
7294 unsafe {
7295 let width_in: i32 = width;
7296 let height_in: i32 = height;
7297 let frequency_cutoff_in: f64 = frequency_cutoff;
7298 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7299 let mut out_out: *mut bindings::VipsImage = null_mut();
7300
7301 let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7302 let uchar_in_name = utils::new_c_string("uchar")?;
7303
7304 let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7305 let nodc_in_name = utils::new_c_string("nodc")?;
7306
7307 let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7308 let reject_in_name = utils::new_c_string("reject")?;
7309
7310 let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7311 let optical_in_name = utils::new_c_string("optical")?;
7312
7313 let vips_op_response = bindings::vips_mask_gaussian(
7314 &mut out_out,
7315 width_in,
7316 height_in,
7317 frequency_cutoff_in,
7318 amplitude_cutoff_in,
7319 uchar_in_name.as_ptr(),
7320 uchar_in,
7321 nodc_in_name.as_ptr(),
7322 nodc_in,
7323 reject_in_name.as_ptr(),
7324 reject_in,
7325 optical_in_name.as_ptr(),
7326 optical_in,
7327 NULL,
7328 );
7329 utils::result(
7330 vips_op_response,
7331 VipsImage { ctx: out_out },
7332 Error::MaskGaussianError,
7333 )
7334 }
7335}
7336
7337pub fn mask_gaussian_ring(
7350 width: i32,
7351 height: i32,
7352 frequency_cutoff: f64,
7353 amplitude_cutoff: f64,
7354 ringwidth: f64,
7355) -> Result<VipsImage> {
7356 unsafe {
7357 let width_in: i32 = width;
7358 let height_in: i32 = height;
7359 let frequency_cutoff_in: f64 = frequency_cutoff;
7360 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7361 let ringwidth_in: f64 = ringwidth;
7362 let mut out_out: *mut bindings::VipsImage = null_mut();
7363
7364 let vips_op_response = bindings::vips_mask_gaussian_ring(
7365 &mut out_out,
7366 width_in,
7367 height_in,
7368 frequency_cutoff_in,
7369 amplitude_cutoff_in,
7370 ringwidth_in,
7371 NULL,
7372 );
7373 utils::result(
7374 vips_op_response,
7375 VipsImage { ctx: out_out },
7376 Error::MaskGaussianRingError,
7377 )
7378 }
7379}
7380
7381#[derive(Clone, Debug)]
7383pub struct MaskGaussianRingOptions {
7384 pub uchar: bool,
7387 pub nodc: bool,
7390 pub reject: bool,
7393 pub optical: bool,
7396}
7397
7398impl std::default::Default for MaskGaussianRingOptions {
7399 fn default() -> Self {
7400 MaskGaussianRingOptions {
7401 uchar: false,
7402 nodc: false,
7403 reject: false,
7404 optical: false,
7405 }
7406 }
7407}
7408
7409pub fn mask_gaussian_ring_with_opts(
7423 width: i32,
7424 height: i32,
7425 frequency_cutoff: f64,
7426 amplitude_cutoff: f64,
7427 ringwidth: f64,
7428 mask_gaussian_ring_options: &MaskGaussianRingOptions,
7429) -> Result<VipsImage> {
7430 unsafe {
7431 let width_in: i32 = width;
7432 let height_in: i32 = height;
7433 let frequency_cutoff_in: f64 = frequency_cutoff;
7434 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7435 let ringwidth_in: f64 = ringwidth;
7436 let mut out_out: *mut bindings::VipsImage = null_mut();
7437
7438 let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7439 1
7440 } else {
7441 0
7442 };
7443 let uchar_in_name = utils::new_c_string("uchar")?;
7444
7445 let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7446 1
7447 } else {
7448 0
7449 };
7450 let nodc_in_name = utils::new_c_string("nodc")?;
7451
7452 let reject_in: i32 = if mask_gaussian_ring_options.reject {
7453 1
7454 } else {
7455 0
7456 };
7457 let reject_in_name = utils::new_c_string("reject")?;
7458
7459 let optical_in: i32 = if mask_gaussian_ring_options.optical {
7460 1
7461 } else {
7462 0
7463 };
7464 let optical_in_name = utils::new_c_string("optical")?;
7465
7466 let vips_op_response = bindings::vips_mask_gaussian_ring(
7467 &mut out_out,
7468 width_in,
7469 height_in,
7470 frequency_cutoff_in,
7471 amplitude_cutoff_in,
7472 ringwidth_in,
7473 uchar_in_name.as_ptr(),
7474 uchar_in,
7475 nodc_in_name.as_ptr(),
7476 nodc_in,
7477 reject_in_name.as_ptr(),
7478 reject_in,
7479 optical_in_name.as_ptr(),
7480 optical_in,
7481 NULL,
7482 );
7483 utils::result(
7484 vips_op_response,
7485 VipsImage { ctx: out_out },
7486 Error::MaskGaussianRingError,
7487 )
7488 }
7489}
7490
7491pub fn mask_gaussian_band(
7506 width: i32,
7507 height: i32,
7508 frequency_cutoff_x: f64,
7509 frequency_cutoff_y: f64,
7510 radius: f64,
7511 amplitude_cutoff: f64,
7512) -> Result<VipsImage> {
7513 unsafe {
7514 let width_in: i32 = width;
7515 let height_in: i32 = height;
7516 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7517 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7518 let radius_in: f64 = radius;
7519 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7520 let mut out_out: *mut bindings::VipsImage = null_mut();
7521
7522 let vips_op_response = bindings::vips_mask_gaussian_band(
7523 &mut out_out,
7524 width_in,
7525 height_in,
7526 frequency_cutoff_x_in,
7527 frequency_cutoff_y_in,
7528 radius_in,
7529 amplitude_cutoff_in,
7530 NULL,
7531 );
7532 utils::result(
7533 vips_op_response,
7534 VipsImage { ctx: out_out },
7535 Error::MaskGaussianBandError,
7536 )
7537 }
7538}
7539
7540#[derive(Clone, Debug)]
7542pub struct MaskGaussianBandOptions {
7543 pub uchar: bool,
7546 pub nodc: bool,
7549 pub reject: bool,
7552 pub optical: bool,
7555}
7556
7557impl std::default::Default for MaskGaussianBandOptions {
7558 fn default() -> Self {
7559 MaskGaussianBandOptions {
7560 uchar: false,
7561 nodc: false,
7562 reject: false,
7563 optical: false,
7564 }
7565 }
7566}
7567
7568pub fn mask_gaussian_band_with_opts(
7584 width: i32,
7585 height: i32,
7586 frequency_cutoff_x: f64,
7587 frequency_cutoff_y: f64,
7588 radius: f64,
7589 amplitude_cutoff: f64,
7590 mask_gaussian_band_options: &MaskGaussianBandOptions,
7591) -> Result<VipsImage> {
7592 unsafe {
7593 let width_in: i32 = width;
7594 let height_in: i32 = height;
7595 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7596 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7597 let radius_in: f64 = radius;
7598 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7599 let mut out_out: *mut bindings::VipsImage = null_mut();
7600
7601 let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7602 1
7603 } else {
7604 0
7605 };
7606 let uchar_in_name = utils::new_c_string("uchar")?;
7607
7608 let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7609 1
7610 } else {
7611 0
7612 };
7613 let nodc_in_name = utils::new_c_string("nodc")?;
7614
7615 let reject_in: i32 = if mask_gaussian_band_options.reject {
7616 1
7617 } else {
7618 0
7619 };
7620 let reject_in_name = utils::new_c_string("reject")?;
7621
7622 let optical_in: i32 = if mask_gaussian_band_options.optical {
7623 1
7624 } else {
7625 0
7626 };
7627 let optical_in_name = utils::new_c_string("optical")?;
7628
7629 let vips_op_response = bindings::vips_mask_gaussian_band(
7630 &mut out_out,
7631 width_in,
7632 height_in,
7633 frequency_cutoff_x_in,
7634 frequency_cutoff_y_in,
7635 radius_in,
7636 amplitude_cutoff_in,
7637 uchar_in_name.as_ptr(),
7638 uchar_in,
7639 nodc_in_name.as_ptr(),
7640 nodc_in,
7641 reject_in_name.as_ptr(),
7642 reject_in,
7643 optical_in_name.as_ptr(),
7644 optical_in,
7645 NULL,
7646 );
7647 utils::result(
7648 vips_op_response,
7649 VipsImage { ctx: out_out },
7650 Error::MaskGaussianBandError,
7651 )
7652 }
7653}
7654
7655pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7664 unsafe {
7665 let width_in: i32 = width;
7666 let height_in: i32 = height;
7667 let fractal_dimension_in: f64 = fractal_dimension;
7668 let mut out_out: *mut bindings::VipsImage = null_mut();
7669
7670 let vips_op_response = bindings::vips_mask_fractal(
7671 &mut out_out,
7672 width_in,
7673 height_in,
7674 fractal_dimension_in,
7675 NULL,
7676 );
7677 utils::result(
7678 vips_op_response,
7679 VipsImage { ctx: out_out },
7680 Error::MaskFractalError,
7681 )
7682 }
7683}
7684
7685#[derive(Clone, Debug)]
7687pub struct MaskFractalOptions {
7688 pub uchar: bool,
7691 pub nodc: bool,
7694 pub reject: bool,
7697 pub optical: bool,
7700}
7701
7702impl std::default::Default for MaskFractalOptions {
7703 fn default() -> Self {
7704 MaskFractalOptions {
7705 uchar: false,
7706 nodc: false,
7707 reject: false,
7708 optical: false,
7709 }
7710 }
7711}
7712
7713pub fn mask_fractal_with_opts(
7723 width: i32,
7724 height: i32,
7725 fractal_dimension: f64,
7726 mask_fractal_options: &MaskFractalOptions,
7727) -> Result<VipsImage> {
7728 unsafe {
7729 let width_in: i32 = width;
7730 let height_in: i32 = height;
7731 let fractal_dimension_in: f64 = fractal_dimension;
7732 let mut out_out: *mut bindings::VipsImage = null_mut();
7733
7734 let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7735 let uchar_in_name = utils::new_c_string("uchar")?;
7736
7737 let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7738 let nodc_in_name = utils::new_c_string("nodc")?;
7739
7740 let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7741 let reject_in_name = utils::new_c_string("reject")?;
7742
7743 let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7744 let optical_in_name = utils::new_c_string("optical")?;
7745
7746 let vips_op_response = bindings::vips_mask_fractal(
7747 &mut out_out,
7748 width_in,
7749 height_in,
7750 fractal_dimension_in,
7751 uchar_in_name.as_ptr(),
7752 uchar_in,
7753 nodc_in_name.as_ptr(),
7754 nodc_in,
7755 reject_in_name.as_ptr(),
7756 reject_in,
7757 optical_in_name.as_ptr(),
7758 optical_in,
7759 NULL,
7760 );
7761 utils::result(
7762 vips_op_response,
7763 VipsImage { ctx: out_out },
7764 Error::MaskFractalError,
7765 )
7766 }
7767}
7768
7769pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7773 unsafe {
7774 let inp_in: *mut bindings::VipsImage = inp.ctx;
7775 let mut out_out: *mut bindings::VipsImage = null_mut();
7776
7777 let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7778 utils::result(
7779 vips_op_response,
7780 VipsImage { ctx: out_out },
7781 Error::BuildlutError,
7782 )
7783 }
7784}
7785
7786pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7790 unsafe {
7791 let inp_in: *mut bindings::VipsImage = inp.ctx;
7792 let mut out_out: *mut bindings::VipsImage = null_mut();
7793
7794 let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7795 utils::result(
7796 vips_op_response,
7797 VipsImage { ctx: out_out },
7798 Error::InvertlutError,
7799 )
7800 }
7801}
7802
7803#[derive(Clone, Debug)]
7805pub struct InvertlutOptions {
7806 pub size: i32,
7809}
7810
7811impl std::default::Default for InvertlutOptions {
7812 fn default() -> Self {
7813 InvertlutOptions {
7814 size: i32::from(256),
7815 }
7816 }
7817}
7818
7819pub fn invertlut_with_opts(
7824 inp: &VipsImage,
7825 invertlut_options: &InvertlutOptions,
7826) -> Result<VipsImage> {
7827 unsafe {
7828 let inp_in: *mut bindings::VipsImage = inp.ctx;
7829 let mut out_out: *mut bindings::VipsImage = null_mut();
7830
7831 let size_in: i32 = invertlut_options.size;
7832 let size_in_name = utils::new_c_string("size")?;
7833
7834 let vips_op_response =
7835 bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7836 utils::result(
7837 vips_op_response,
7838 VipsImage { ctx: out_out },
7839 Error::InvertlutError,
7840 )
7841 }
7842}
7843
7844pub fn tonelut() -> Result<VipsImage> {
7848 unsafe {
7849 let mut out_out: *mut bindings::VipsImage = null_mut();
7850
7851 let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7852 utils::result(
7853 vips_op_response,
7854 VipsImage { ctx: out_out },
7855 Error::TonelutError,
7856 )
7857 }
7858}
7859
7860#[derive(Clone, Debug)]
7862pub struct TonelutOptions {
7863 pub in_max: i32,
7866 pub out_max: i32,
7869 pub lb: f64,
7872 pub lw: f64,
7875 pub ps: f64,
7878 pub pm: f64,
7881 pub ph: f64,
7884 pub s: f64,
7887 pub m: f64,
7890 pub h: f64,
7893}
7894
7895impl std::default::Default for TonelutOptions {
7896 fn default() -> Self {
7897 TonelutOptions {
7898 in_max: i32::from(32767),
7899 out_max: i32::from(32767),
7900 lb: f64::from(0),
7901 lw: f64::from(100),
7902 ps: f64::from(0.2),
7903 pm: f64::from(0.5),
7904 ph: f64::from(0.8),
7905 s: f64::from(0),
7906 m: f64::from(0),
7907 h: f64::from(0),
7908 }
7909 }
7910}
7911
7912pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7917 unsafe {
7918 let mut out_out: *mut bindings::VipsImage = null_mut();
7919
7920 let in_max_in: i32 = tonelut_options.in_max;
7921 let in_max_in_name = utils::new_c_string("in-max")?;
7922
7923 let out_max_in: i32 = tonelut_options.out_max;
7924 let out_max_in_name = utils::new_c_string("out-max")?;
7925
7926 let lb_in: f64 = tonelut_options.lb;
7927 let lb_in_name = utils::new_c_string("Lb")?;
7928
7929 let lw_in: f64 = tonelut_options.lw;
7930 let lw_in_name = utils::new_c_string("Lw")?;
7931
7932 let ps_in: f64 = tonelut_options.ps;
7933 let ps_in_name = utils::new_c_string("Ps")?;
7934
7935 let pm_in: f64 = tonelut_options.pm;
7936 let pm_in_name = utils::new_c_string("Pm")?;
7937
7938 let ph_in: f64 = tonelut_options.ph;
7939 let ph_in_name = utils::new_c_string("Ph")?;
7940
7941 let s_in: f64 = tonelut_options.s;
7942 let s_in_name = utils::new_c_string("S")?;
7943
7944 let m_in: f64 = tonelut_options.m;
7945 let m_in_name = utils::new_c_string("M")?;
7946
7947 let h_in: f64 = tonelut_options.h;
7948 let h_in_name = utils::new_c_string("H")?;
7949
7950 let vips_op_response = bindings::vips_tonelut(
7951 &mut out_out,
7952 in_max_in_name.as_ptr(),
7953 in_max_in,
7954 out_max_in_name.as_ptr(),
7955 out_max_in,
7956 lb_in_name.as_ptr(),
7957 lb_in,
7958 lw_in_name.as_ptr(),
7959 lw_in,
7960 ps_in_name.as_ptr(),
7961 ps_in,
7962 pm_in_name.as_ptr(),
7963 pm_in,
7964 ph_in_name.as_ptr(),
7965 ph_in,
7966 s_in_name.as_ptr(),
7967 s_in,
7968 m_in_name.as_ptr(),
7969 m_in,
7970 h_in_name.as_ptr(),
7971 h_in,
7972 NULL,
7973 );
7974 utils::result(
7975 vips_op_response,
7976 VipsImage { ctx: out_out },
7977 Error::TonelutError,
7978 )
7979 }
7980}
7981
7982pub fn identity() -> Result<VipsImage> {
7986 unsafe {
7987 let mut out_out: *mut bindings::VipsImage = null_mut();
7988
7989 let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7990 utils::result(
7991 vips_op_response,
7992 VipsImage { ctx: out_out },
7993 Error::IdentityError,
7994 )
7995 }
7996}
7997
7998#[derive(Clone, Debug)]
8000pub struct IdentityOptions {
8001 pub bands: i32,
8004 pub ushort: bool,
8007 pub size: i32,
8010}
8011
8012impl std::default::Default for IdentityOptions {
8013 fn default() -> Self {
8014 IdentityOptions {
8015 bands: i32::from(1),
8016 ushort: false,
8017 size: i32::from(65536),
8018 }
8019 }
8020}
8021
8022pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
8027 unsafe {
8028 let mut out_out: *mut bindings::VipsImage = null_mut();
8029
8030 let bands_in: i32 = identity_options.bands;
8031 let bands_in_name = utils::new_c_string("bands")?;
8032
8033 let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
8034 let ushort_in_name = utils::new_c_string("ushort")?;
8035
8036 let size_in: i32 = identity_options.size;
8037 let size_in_name = utils::new_c_string("size")?;
8038
8039 let vips_op_response = bindings::vips_identity(
8040 &mut out_out,
8041 bands_in_name.as_ptr(),
8042 bands_in,
8043 ushort_in_name.as_ptr(),
8044 ushort_in,
8045 size_in_name.as_ptr(),
8046 size_in,
8047 NULL,
8048 );
8049 utils::result(
8050 vips_op_response,
8051 VipsImage { ctx: out_out },
8052 Error::IdentityError,
8053 )
8054 }
8055}
8056
8057pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
8066 unsafe {
8067 let width_in: i32 = width;
8068 let height_in: i32 = height;
8069 let fractal_dimension_in: f64 = fractal_dimension;
8070 let mut out_out: *mut bindings::VipsImage = null_mut();
8071
8072 let vips_op_response = bindings::vips_fractsurf(
8073 &mut out_out,
8074 width_in,
8075 height_in,
8076 fractal_dimension_in,
8077 NULL,
8078 );
8079 utils::result(
8080 vips_op_response,
8081 VipsImage { ctx: out_out },
8082 Error::FractsurfError,
8083 )
8084 }
8085}
8086
8087pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
8094 unsafe {
8095 let width_in: i32 = width;
8096 let height_in: i32 = height;
8097 let mut out_out: *mut bindings::VipsImage = null_mut();
8098
8099 let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
8100 utils::result(
8101 vips_op_response,
8102 VipsImage { ctx: out_out },
8103 Error::WorleyError,
8104 )
8105 }
8106}
8107
8108#[derive(Clone, Debug)]
8110pub struct WorleyOptions {
8111 pub cell_size: i32,
8114 pub seed: i32,
8117}
8118
8119impl std::default::Default for WorleyOptions {
8120 fn default() -> Self {
8121 WorleyOptions {
8122 cell_size: i32::from(256),
8123 seed: i32::from(0),
8124 }
8125 }
8126}
8127
8128pub fn worley_with_opts(
8136 width: i32,
8137 height: i32,
8138 worley_options: &WorleyOptions,
8139) -> Result<VipsImage> {
8140 unsafe {
8141 let width_in: i32 = width;
8142 let height_in: i32 = height;
8143 let mut out_out: *mut bindings::VipsImage = null_mut();
8144
8145 let cell_size_in: i32 = worley_options.cell_size;
8146 let cell_size_in_name = utils::new_c_string("cell-size")?;
8147
8148 let seed_in: i32 = worley_options.seed;
8149 let seed_in_name = utils::new_c_string("seed")?;
8150
8151 let vips_op_response = bindings::vips_worley(
8152 &mut out_out,
8153 width_in,
8154 height_in,
8155 cell_size_in_name.as_ptr(),
8156 cell_size_in,
8157 seed_in_name.as_ptr(),
8158 seed_in,
8159 NULL,
8160 );
8161 utils::result(
8162 vips_op_response,
8163 VipsImage { ctx: out_out },
8164 Error::WorleyError,
8165 )
8166 }
8167}
8168
8169pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8176 unsafe {
8177 let width_in: i32 = width;
8178 let height_in: i32 = height;
8179 let mut out_out: *mut bindings::VipsImage = null_mut();
8180
8181 let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8182 utils::result(
8183 vips_op_response,
8184 VipsImage { ctx: out_out },
8185 Error::PerlinError,
8186 )
8187 }
8188}
8189
8190#[derive(Clone, Debug)]
8192pub struct PerlinOptions {
8193 pub cell_size: i32,
8196 pub uchar: bool,
8199 pub seed: i32,
8202}
8203
8204impl std::default::Default for PerlinOptions {
8205 fn default() -> Self {
8206 PerlinOptions {
8207 cell_size: i32::from(256),
8208 uchar: false,
8209 seed: i32::from(0),
8210 }
8211 }
8212}
8213
8214pub fn perlin_with_opts(
8222 width: i32,
8223 height: i32,
8224 perlin_options: &PerlinOptions,
8225) -> Result<VipsImage> {
8226 unsafe {
8227 let width_in: i32 = width;
8228 let height_in: i32 = height;
8229 let mut out_out: *mut bindings::VipsImage = null_mut();
8230
8231 let cell_size_in: i32 = perlin_options.cell_size;
8232 let cell_size_in_name = utils::new_c_string("cell-size")?;
8233
8234 let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8235 let uchar_in_name = utils::new_c_string("uchar")?;
8236
8237 let seed_in: i32 = perlin_options.seed;
8238 let seed_in_name = utils::new_c_string("seed")?;
8239
8240 let vips_op_response = bindings::vips_perlin(
8241 &mut out_out,
8242 width_in,
8243 height_in,
8244 cell_size_in_name.as_ptr(),
8245 cell_size_in,
8246 uchar_in_name.as_ptr(),
8247 uchar_in,
8248 seed_in_name.as_ptr(),
8249 seed_in,
8250 NULL,
8251 );
8252 utils::result(
8253 vips_op_response,
8254 VipsImage { ctx: out_out },
8255 Error::PerlinError,
8256 )
8257 }
8258}
8259
8260pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8264 unsafe {
8265 let (tests_len, mut tests_in) = {
8266 let len = tests.len();
8267 let mut input = Vec::new();
8268 for img in tests {
8269 input.push(img.ctx)
8270 }
8271 (len as i32, input)
8272 };
8273 let mut out_out: *mut bindings::VipsImage = null_mut();
8274
8275 let vips_op_response =
8276 bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8277 utils::result(
8278 vips_op_response,
8279 VipsImage { ctx: out_out },
8280 Error::SwitchError,
8281 )
8282 }
8283}
8284
8285pub fn csvload(filename: &str) -> Result<VipsImage> {
8289 unsafe {
8290 let filename_in: CString = utils::new_c_string(filename)?;
8291 let mut out_out: *mut bindings::VipsImage = null_mut();
8292
8293 let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8294 utils::result(
8295 vips_op_response,
8296 VipsImage { ctx: out_out },
8297 Error::CsvloadError,
8298 )
8299 }
8300}
8301
8302#[derive(Clone, Debug)]
8304pub struct CsvloadOptions {
8305 pub skip: i32,
8308 pub lines: i32,
8311 pub whitespace: String,
8313 pub separator: String,
8315 pub flags: ForeignFlags,
8322 pub memory: bool,
8325 pub access: Access,
8331 pub fail_on: FailOn,
8338 pub revalidate: bool,
8341}
8342
8343impl std::default::Default for CsvloadOptions {
8344 fn default() -> Self {
8345 CsvloadOptions {
8346 skip: i32::from(0),
8347 lines: i32::from(-1),
8348 whitespace: String::new(),
8349 separator: String::new(),
8350 flags: ForeignFlags::None,
8351 memory: false,
8352 access: Access::Random,
8353 fail_on: FailOn::None,
8354 revalidate: false,
8355 }
8356 }
8357}
8358
8359pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8364 unsafe {
8365 let filename_in: CString = utils::new_c_string(filename)?;
8366 let mut out_out: *mut bindings::VipsImage = null_mut();
8367
8368 let skip_in: i32 = csvload_options.skip;
8369 let skip_in_name = utils::new_c_string("skip")?;
8370
8371 let lines_in: i32 = csvload_options.lines;
8372 let lines_in_name = utils::new_c_string("lines")?;
8373
8374 let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8375 let whitespace_in_name = utils::new_c_string("whitespace")?;
8376
8377 let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8378 let separator_in_name = utils::new_c_string("separator")?;
8379
8380 let flags_in: i32 = csvload_options.flags as i32;
8381 let flags_in_name = utils::new_c_string("flags")?;
8382
8383 let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8384 let memory_in_name = utils::new_c_string("memory")?;
8385
8386 let access_in: i32 = csvload_options.access as i32;
8387 let access_in_name = utils::new_c_string("access")?;
8388
8389 let fail_on_in: i32 = csvload_options.fail_on as i32;
8390 let fail_on_in_name = utils::new_c_string("fail-on")?;
8391
8392 let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8393 let revalidate_in_name = utils::new_c_string("revalidate")?;
8394
8395 let vips_op_response = bindings::vips_csvload(
8396 filename_in.as_ptr(),
8397 &mut out_out,
8398 skip_in_name.as_ptr(),
8399 skip_in,
8400 lines_in_name.as_ptr(),
8401 lines_in,
8402 whitespace_in_name.as_ptr(),
8403 whitespace_in.as_ptr(),
8404 separator_in_name.as_ptr(),
8405 separator_in.as_ptr(),
8406 flags_in_name.as_ptr(),
8407 flags_in,
8408 memory_in_name.as_ptr(),
8409 memory_in,
8410 access_in_name.as_ptr(),
8411 access_in,
8412 fail_on_in_name.as_ptr(),
8413 fail_on_in,
8414 revalidate_in_name.as_ptr(),
8415 revalidate_in,
8416 NULL,
8417 );
8418 utils::result(
8419 vips_op_response,
8420 VipsImage { ctx: out_out },
8421 Error::CsvloadError,
8422 )
8423 }
8424}
8425
8426pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8430 unsafe {
8431 let source_in: *mut bindings::VipsSource = source.ctx;
8432 let mut out_out: *mut bindings::VipsImage = null_mut();
8433
8434 let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8435 utils::result(
8436 vips_op_response,
8437 VipsImage { ctx: out_out },
8438 Error::CsvloadSourceError,
8439 )
8440 }
8441}
8442
8443#[derive(Clone, Debug)]
8445pub struct CsvloadSourceOptions {
8446 pub skip: i32,
8449 pub lines: i32,
8452 pub whitespace: String,
8454 pub separator: String,
8456 pub flags: ForeignFlags,
8463 pub memory: bool,
8466 pub access: Access,
8472 pub fail_on: FailOn,
8479 pub revalidate: bool,
8482}
8483
8484impl std::default::Default for CsvloadSourceOptions {
8485 fn default() -> Self {
8486 CsvloadSourceOptions {
8487 skip: i32::from(0),
8488 lines: i32::from(-1),
8489 whitespace: String::new(),
8490 separator: String::new(),
8491 flags: ForeignFlags::None,
8492 memory: false,
8493 access: Access::Random,
8494 fail_on: FailOn::None,
8495 revalidate: false,
8496 }
8497 }
8498}
8499
8500pub fn csvload_source_with_opts(
8505 source: &VipsSource,
8506 csvload_source_options: &CsvloadSourceOptions,
8507) -> Result<VipsImage> {
8508 unsafe {
8509 let source_in: *mut bindings::VipsSource = source.ctx;
8510 let mut out_out: *mut bindings::VipsImage = null_mut();
8511
8512 let skip_in: i32 = csvload_source_options.skip;
8513 let skip_in_name = utils::new_c_string("skip")?;
8514
8515 let lines_in: i32 = csvload_source_options.lines;
8516 let lines_in_name = utils::new_c_string("lines")?;
8517
8518 let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8519 let whitespace_in_name = utils::new_c_string("whitespace")?;
8520
8521 let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8522 let separator_in_name = utils::new_c_string("separator")?;
8523
8524 let flags_in: i32 = csvload_source_options.flags as i32;
8525 let flags_in_name = utils::new_c_string("flags")?;
8526
8527 let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8528 let memory_in_name = utils::new_c_string("memory")?;
8529
8530 let access_in: i32 = csvload_source_options.access as i32;
8531 let access_in_name = utils::new_c_string("access")?;
8532
8533 let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8534 let fail_on_in_name = utils::new_c_string("fail-on")?;
8535
8536 let revalidate_in: i32 = if csvload_source_options.revalidate {
8537 1
8538 } else {
8539 0
8540 };
8541 let revalidate_in_name = utils::new_c_string("revalidate")?;
8542
8543 let vips_op_response = bindings::vips_csvload_source(
8544 source_in,
8545 &mut out_out,
8546 skip_in_name.as_ptr(),
8547 skip_in,
8548 lines_in_name.as_ptr(),
8549 lines_in,
8550 whitespace_in_name.as_ptr(),
8551 whitespace_in.as_ptr(),
8552 separator_in_name.as_ptr(),
8553 separator_in.as_ptr(),
8554 flags_in_name.as_ptr(),
8555 flags_in,
8556 memory_in_name.as_ptr(),
8557 memory_in,
8558 access_in_name.as_ptr(),
8559 access_in,
8560 fail_on_in_name.as_ptr(),
8561 fail_on_in,
8562 revalidate_in_name.as_ptr(),
8563 revalidate_in,
8564 NULL,
8565 );
8566 utils::result(
8567 vips_op_response,
8568 VipsImage { ctx: out_out },
8569 Error::CsvloadSourceError,
8570 )
8571 }
8572}
8573
8574pub fn matrixload(filename: &str) -> Result<VipsImage> {
8578 unsafe {
8579 let filename_in: CString = utils::new_c_string(filename)?;
8580 let mut out_out: *mut bindings::VipsImage = null_mut();
8581
8582 let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8583 utils::result(
8584 vips_op_response,
8585 VipsImage { ctx: out_out },
8586 Error::MatrixloadError,
8587 )
8588 }
8589}
8590
8591#[derive(Clone, Debug)]
8593pub struct MatrixloadOptions {
8594 pub flags: ForeignFlags,
8601 pub memory: bool,
8604 pub access: Access,
8610 pub fail_on: FailOn,
8617 pub revalidate: bool,
8620}
8621
8622impl std::default::Default for MatrixloadOptions {
8623 fn default() -> Self {
8624 MatrixloadOptions {
8625 flags: ForeignFlags::None,
8626 memory: false,
8627 access: Access::Random,
8628 fail_on: FailOn::None,
8629 revalidate: false,
8630 }
8631 }
8632}
8633
8634pub fn matrixload_with_opts(
8639 filename: &str,
8640 matrixload_options: &MatrixloadOptions,
8641) -> Result<VipsImage> {
8642 unsafe {
8643 let filename_in: CString = utils::new_c_string(filename)?;
8644 let mut out_out: *mut bindings::VipsImage = null_mut();
8645
8646 let flags_in: i32 = matrixload_options.flags as i32;
8647 let flags_in_name = utils::new_c_string("flags")?;
8648
8649 let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8650 let memory_in_name = utils::new_c_string("memory")?;
8651
8652 let access_in: i32 = matrixload_options.access as i32;
8653 let access_in_name = utils::new_c_string("access")?;
8654
8655 let fail_on_in: i32 = matrixload_options.fail_on as i32;
8656 let fail_on_in_name = utils::new_c_string("fail-on")?;
8657
8658 let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8659 let revalidate_in_name = utils::new_c_string("revalidate")?;
8660
8661 let vips_op_response = bindings::vips_matrixload(
8662 filename_in.as_ptr(),
8663 &mut out_out,
8664 flags_in_name.as_ptr(),
8665 flags_in,
8666 memory_in_name.as_ptr(),
8667 memory_in,
8668 access_in_name.as_ptr(),
8669 access_in,
8670 fail_on_in_name.as_ptr(),
8671 fail_on_in,
8672 revalidate_in_name.as_ptr(),
8673 revalidate_in,
8674 NULL,
8675 );
8676 utils::result(
8677 vips_op_response,
8678 VipsImage { ctx: out_out },
8679 Error::MatrixloadError,
8680 )
8681 }
8682}
8683
8684pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8688 unsafe {
8689 let source_in: *mut bindings::VipsSource = source.ctx;
8690 let mut out_out: *mut bindings::VipsImage = null_mut();
8691
8692 let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8693 utils::result(
8694 vips_op_response,
8695 VipsImage { ctx: out_out },
8696 Error::MatrixloadSourceError,
8697 )
8698 }
8699}
8700
8701#[derive(Clone, Debug)]
8703pub struct MatrixloadSourceOptions {
8704 pub flags: ForeignFlags,
8711 pub memory: bool,
8714 pub access: Access,
8720 pub fail_on: FailOn,
8727 pub revalidate: bool,
8730}
8731
8732impl std::default::Default for MatrixloadSourceOptions {
8733 fn default() -> Self {
8734 MatrixloadSourceOptions {
8735 flags: ForeignFlags::None,
8736 memory: false,
8737 access: Access::Random,
8738 fail_on: FailOn::None,
8739 revalidate: false,
8740 }
8741 }
8742}
8743
8744pub fn matrixload_source_with_opts(
8749 source: &VipsSource,
8750 matrixload_source_options: &MatrixloadSourceOptions,
8751) -> Result<VipsImage> {
8752 unsafe {
8753 let source_in: *mut bindings::VipsSource = source.ctx;
8754 let mut out_out: *mut bindings::VipsImage = null_mut();
8755
8756 let flags_in: i32 = matrixload_source_options.flags as i32;
8757 let flags_in_name = utils::new_c_string("flags")?;
8758
8759 let memory_in: i32 = if matrixload_source_options.memory {
8760 1
8761 } else {
8762 0
8763 };
8764 let memory_in_name = utils::new_c_string("memory")?;
8765
8766 let access_in: i32 = matrixload_source_options.access as i32;
8767 let access_in_name = utils::new_c_string("access")?;
8768
8769 let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8770 let fail_on_in_name = utils::new_c_string("fail-on")?;
8771
8772 let revalidate_in: i32 = if matrixload_source_options.revalidate {
8773 1
8774 } else {
8775 0
8776 };
8777 let revalidate_in_name = utils::new_c_string("revalidate")?;
8778
8779 let vips_op_response = bindings::vips_matrixload_source(
8780 source_in,
8781 &mut out_out,
8782 flags_in_name.as_ptr(),
8783 flags_in,
8784 memory_in_name.as_ptr(),
8785 memory_in,
8786 access_in_name.as_ptr(),
8787 access_in,
8788 fail_on_in_name.as_ptr(),
8789 fail_on_in,
8790 revalidate_in_name.as_ptr(),
8791 revalidate_in,
8792 NULL,
8793 );
8794 utils::result(
8795 vips_op_response,
8796 VipsImage { ctx: out_out },
8797 Error::MatrixloadSourceError,
8798 )
8799 }
8800}
8801
8802pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8812 unsafe {
8813 let filename_in: CString = utils::new_c_string(filename)?;
8814 let width_in: i32 = width;
8815 let height_in: i32 = height;
8816 let bands_in: i32 = bands;
8817 let mut out_out: *mut bindings::VipsImage = null_mut();
8818
8819 let vips_op_response = bindings::vips_rawload(
8820 filename_in.as_ptr(),
8821 &mut out_out,
8822 width_in,
8823 height_in,
8824 bands_in,
8825 NULL,
8826 );
8827 utils::result(
8828 vips_op_response,
8829 VipsImage { ctx: out_out },
8830 Error::RawloadError,
8831 )
8832 }
8833}
8834
8835#[derive(Clone, Debug)]
8837pub struct RawloadOptions {
8838 pub offset: u64,
8841 pub format: BandFormat,
8855 pub interpretation: Interpretation,
8878 pub flags: ForeignFlags,
8885 pub memory: bool,
8888 pub access: Access,
8894 pub fail_on: FailOn,
8901 pub revalidate: bool,
8904}
8905
8906impl std::default::Default for RawloadOptions {
8907 fn default() -> Self {
8908 RawloadOptions {
8909 offset: 0,
8910 format: BandFormat::Uchar,
8911 interpretation: Interpretation::Multiband,
8912 flags: ForeignFlags::None,
8913 memory: false,
8914 access: Access::Random,
8915 fail_on: FailOn::None,
8916 revalidate: false,
8917 }
8918 }
8919}
8920
8921pub fn rawload_with_opts(
8932 filename: &str,
8933 width: i32,
8934 height: i32,
8935 bands: i32,
8936 rawload_options: &RawloadOptions,
8937) -> Result<VipsImage> {
8938 unsafe {
8939 let filename_in: CString = utils::new_c_string(filename)?;
8940 let width_in: i32 = width;
8941 let height_in: i32 = height;
8942 let bands_in: i32 = bands;
8943 let mut out_out: *mut bindings::VipsImage = null_mut();
8944
8945 let offset_in: u64 = rawload_options.offset;
8946 let offset_in_name = utils::new_c_string("offset")?;
8947
8948 let format_in: i32 = rawload_options.format as i32;
8949 let format_in_name = utils::new_c_string("format")?;
8950
8951 let interpretation_in: i32 = rawload_options.interpretation as i32;
8952 let interpretation_in_name = utils::new_c_string("interpretation")?;
8953
8954 let flags_in: i32 = rawload_options.flags as i32;
8955 let flags_in_name = utils::new_c_string("flags")?;
8956
8957 let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8958 let memory_in_name = utils::new_c_string("memory")?;
8959
8960 let access_in: i32 = rawload_options.access as i32;
8961 let access_in_name = utils::new_c_string("access")?;
8962
8963 let fail_on_in: i32 = rawload_options.fail_on as i32;
8964 let fail_on_in_name = utils::new_c_string("fail-on")?;
8965
8966 let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8967 let revalidate_in_name = utils::new_c_string("revalidate")?;
8968
8969 let vips_op_response = bindings::vips_rawload(
8970 filename_in.as_ptr(),
8971 &mut out_out,
8972 width_in,
8973 height_in,
8974 bands_in,
8975 offset_in_name.as_ptr(),
8976 offset_in,
8977 format_in_name.as_ptr(),
8978 format_in,
8979 interpretation_in_name.as_ptr(),
8980 interpretation_in,
8981 flags_in_name.as_ptr(),
8982 flags_in,
8983 memory_in_name.as_ptr(),
8984 memory_in,
8985 access_in_name.as_ptr(),
8986 access_in,
8987 fail_on_in_name.as_ptr(),
8988 fail_on_in,
8989 revalidate_in_name.as_ptr(),
8990 revalidate_in,
8991 NULL,
8992 );
8993 utils::result(
8994 vips_op_response,
8995 VipsImage { ctx: out_out },
8996 Error::RawloadError,
8997 )
8998 }
8999}
9000
9001pub fn vipsload(filename: &str) -> Result<VipsImage> {
9005 unsafe {
9006 let filename_in: CString = utils::new_c_string(filename)?;
9007 let mut out_out: *mut bindings::VipsImage = null_mut();
9008
9009 let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
9010 utils::result(
9011 vips_op_response,
9012 VipsImage { ctx: out_out },
9013 Error::VipsloadError,
9014 )
9015 }
9016}
9017
9018#[derive(Clone, Debug)]
9020pub struct VipsloadOptions {
9021 pub flags: ForeignFlags,
9028 pub memory: bool,
9031 pub access: Access,
9037 pub fail_on: FailOn,
9044 pub revalidate: bool,
9047}
9048
9049impl std::default::Default for VipsloadOptions {
9050 fn default() -> Self {
9051 VipsloadOptions {
9052 flags: ForeignFlags::None,
9053 memory: false,
9054 access: Access::Random,
9055 fail_on: FailOn::None,
9056 revalidate: false,
9057 }
9058 }
9059}
9060
9061pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
9066 unsafe {
9067 let filename_in: CString = utils::new_c_string(filename)?;
9068 let mut out_out: *mut bindings::VipsImage = null_mut();
9069
9070 let flags_in: i32 = vipsload_options.flags as i32;
9071 let flags_in_name = utils::new_c_string("flags")?;
9072
9073 let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
9074 let memory_in_name = utils::new_c_string("memory")?;
9075
9076 let access_in: i32 = vipsload_options.access as i32;
9077 let access_in_name = utils::new_c_string("access")?;
9078
9079 let fail_on_in: i32 = vipsload_options.fail_on as i32;
9080 let fail_on_in_name = utils::new_c_string("fail-on")?;
9081
9082 let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
9083 let revalidate_in_name = utils::new_c_string("revalidate")?;
9084
9085 let vips_op_response = bindings::vips_vipsload(
9086 filename_in.as_ptr(),
9087 &mut out_out,
9088 flags_in_name.as_ptr(),
9089 flags_in,
9090 memory_in_name.as_ptr(),
9091 memory_in,
9092 access_in_name.as_ptr(),
9093 access_in,
9094 fail_on_in_name.as_ptr(),
9095 fail_on_in,
9096 revalidate_in_name.as_ptr(),
9097 revalidate_in,
9098 NULL,
9099 );
9100 utils::result(
9101 vips_op_response,
9102 VipsImage { ctx: out_out },
9103 Error::VipsloadError,
9104 )
9105 }
9106}
9107
9108pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
9112 unsafe {
9113 let source_in: *mut bindings::VipsSource = source.ctx;
9114 let mut out_out: *mut bindings::VipsImage = null_mut();
9115
9116 let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
9117 utils::result(
9118 vips_op_response,
9119 VipsImage { ctx: out_out },
9120 Error::VipsloadSourceError,
9121 )
9122 }
9123}
9124
9125#[derive(Clone, Debug)]
9127pub struct VipsloadSourceOptions {
9128 pub flags: ForeignFlags,
9135 pub memory: bool,
9138 pub access: Access,
9144 pub fail_on: FailOn,
9151 pub revalidate: bool,
9154}
9155
9156impl std::default::Default for VipsloadSourceOptions {
9157 fn default() -> Self {
9158 VipsloadSourceOptions {
9159 flags: ForeignFlags::None,
9160 memory: false,
9161 access: Access::Random,
9162 fail_on: FailOn::None,
9163 revalidate: false,
9164 }
9165 }
9166}
9167
9168pub fn vipsload_source_with_opts(
9173 source: &VipsSource,
9174 vipsload_source_options: &VipsloadSourceOptions,
9175) -> Result<VipsImage> {
9176 unsafe {
9177 let source_in: *mut bindings::VipsSource = source.ctx;
9178 let mut out_out: *mut bindings::VipsImage = null_mut();
9179
9180 let flags_in: i32 = vipsload_source_options.flags as i32;
9181 let flags_in_name = utils::new_c_string("flags")?;
9182
9183 let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9184 let memory_in_name = utils::new_c_string("memory")?;
9185
9186 let access_in: i32 = vipsload_source_options.access as i32;
9187 let access_in_name = utils::new_c_string("access")?;
9188
9189 let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9190 let fail_on_in_name = utils::new_c_string("fail-on")?;
9191
9192 let revalidate_in: i32 = if vipsload_source_options.revalidate {
9193 1
9194 } else {
9195 0
9196 };
9197 let revalidate_in_name = utils::new_c_string("revalidate")?;
9198
9199 let vips_op_response = bindings::vips_vipsload_source(
9200 source_in,
9201 &mut out_out,
9202 flags_in_name.as_ptr(),
9203 flags_in,
9204 memory_in_name.as_ptr(),
9205 memory_in,
9206 access_in_name.as_ptr(),
9207 access_in,
9208 fail_on_in_name.as_ptr(),
9209 fail_on_in,
9210 revalidate_in_name.as_ptr(),
9211 revalidate_in,
9212 NULL,
9213 );
9214 utils::result(
9215 vips_op_response,
9216 VipsImage { ctx: out_out },
9217 Error::VipsloadSourceError,
9218 )
9219 }
9220}
9221
9222pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9226 unsafe {
9227 let filename_in: CString = utils::new_c_string(filename)?;
9228 let mut out_out: *mut bindings::VipsImage = null_mut();
9229
9230 let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9231 utils::result(
9232 vips_op_response,
9233 VipsImage { ctx: out_out },
9234 Error::AnalyzeloadError,
9235 )
9236 }
9237}
9238
9239#[derive(Clone, Debug)]
9241pub struct AnalyzeloadOptions {
9242 pub flags: ForeignFlags,
9249 pub memory: bool,
9252 pub access: Access,
9258 pub fail_on: FailOn,
9265 pub revalidate: bool,
9268}
9269
9270impl std::default::Default for AnalyzeloadOptions {
9271 fn default() -> Self {
9272 AnalyzeloadOptions {
9273 flags: ForeignFlags::None,
9274 memory: false,
9275 access: Access::Random,
9276 fail_on: FailOn::None,
9277 revalidate: false,
9278 }
9279 }
9280}
9281
9282pub fn analyzeload_with_opts(
9287 filename: &str,
9288 analyzeload_options: &AnalyzeloadOptions,
9289) -> Result<VipsImage> {
9290 unsafe {
9291 let filename_in: CString = utils::new_c_string(filename)?;
9292 let mut out_out: *mut bindings::VipsImage = null_mut();
9293
9294 let flags_in: i32 = analyzeload_options.flags as i32;
9295 let flags_in_name = utils::new_c_string("flags")?;
9296
9297 let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9298 let memory_in_name = utils::new_c_string("memory")?;
9299
9300 let access_in: i32 = analyzeload_options.access as i32;
9301 let access_in_name = utils::new_c_string("access")?;
9302
9303 let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9304 let fail_on_in_name = utils::new_c_string("fail-on")?;
9305
9306 let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9307 let revalidate_in_name = utils::new_c_string("revalidate")?;
9308
9309 let vips_op_response = bindings::vips_analyzeload(
9310 filename_in.as_ptr(),
9311 &mut out_out,
9312 flags_in_name.as_ptr(),
9313 flags_in,
9314 memory_in_name.as_ptr(),
9315 memory_in,
9316 access_in_name.as_ptr(),
9317 access_in,
9318 fail_on_in_name.as_ptr(),
9319 fail_on_in,
9320 revalidate_in_name.as_ptr(),
9321 revalidate_in,
9322 NULL,
9323 );
9324 utils::result(
9325 vips_op_response,
9326 VipsImage { ctx: out_out },
9327 Error::AnalyzeloadError,
9328 )
9329 }
9330}
9331
9332pub fn ppmload(filename: &str) -> Result<VipsImage> {
9336 unsafe {
9337 let filename_in: CString = utils::new_c_string(filename)?;
9338 let mut out_out: *mut bindings::VipsImage = null_mut();
9339
9340 let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9341 utils::result(
9342 vips_op_response,
9343 VipsImage { ctx: out_out },
9344 Error::PpmloadError,
9345 )
9346 }
9347}
9348
9349#[derive(Clone, Debug)]
9351pub struct PpmloadOptions {
9352 pub flags: ForeignFlags,
9359 pub memory: bool,
9362 pub access: Access,
9368 pub fail_on: FailOn,
9375 pub revalidate: bool,
9378}
9379
9380impl std::default::Default for PpmloadOptions {
9381 fn default() -> Self {
9382 PpmloadOptions {
9383 flags: ForeignFlags::None,
9384 memory: false,
9385 access: Access::Random,
9386 fail_on: FailOn::None,
9387 revalidate: false,
9388 }
9389 }
9390}
9391
9392pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9397 unsafe {
9398 let filename_in: CString = utils::new_c_string(filename)?;
9399 let mut out_out: *mut bindings::VipsImage = null_mut();
9400
9401 let flags_in: i32 = ppmload_options.flags as i32;
9402 let flags_in_name = utils::new_c_string("flags")?;
9403
9404 let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9405 let memory_in_name = utils::new_c_string("memory")?;
9406
9407 let access_in: i32 = ppmload_options.access as i32;
9408 let access_in_name = utils::new_c_string("access")?;
9409
9410 let fail_on_in: i32 = ppmload_options.fail_on as i32;
9411 let fail_on_in_name = utils::new_c_string("fail-on")?;
9412
9413 let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9414 let revalidate_in_name = utils::new_c_string("revalidate")?;
9415
9416 let vips_op_response = bindings::vips_ppmload(
9417 filename_in.as_ptr(),
9418 &mut out_out,
9419 flags_in_name.as_ptr(),
9420 flags_in,
9421 memory_in_name.as_ptr(),
9422 memory_in,
9423 access_in_name.as_ptr(),
9424 access_in,
9425 fail_on_in_name.as_ptr(),
9426 fail_on_in,
9427 revalidate_in_name.as_ptr(),
9428 revalidate_in,
9429 NULL,
9430 );
9431 utils::result(
9432 vips_op_response,
9433 VipsImage { ctx: out_out },
9434 Error::PpmloadError,
9435 )
9436 }
9437}
9438
9439pub fn ppmload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9443 unsafe {
9444 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9445 let mut out_out: *mut bindings::VipsImage = null_mut();
9446
9447 let vips_op_response =
9448 bindings::vips_ppmload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9449 utils::result(
9450 vips_op_response,
9451 VipsImage { ctx: out_out },
9452 Error::PpmloadBufferError,
9453 )
9454 }
9455}
9456
9457#[derive(Clone, Debug)]
9459pub struct PpmloadBufferOptions {
9460 pub flags: ForeignFlags,
9467 pub memory: bool,
9470 pub access: Access,
9476 pub fail_on: FailOn,
9483 pub revalidate: bool,
9486}
9487
9488impl std::default::Default for PpmloadBufferOptions {
9489 fn default() -> Self {
9490 PpmloadBufferOptions {
9491 flags: ForeignFlags::None,
9492 memory: false,
9493 access: Access::Random,
9494 fail_on: FailOn::None,
9495 revalidate: false,
9496 }
9497 }
9498}
9499
9500pub fn ppmload_buffer_with_opts(
9505 buffer: &[u8],
9506 ppmload_buffer_options: &PpmloadBufferOptions,
9507) -> Result<VipsImage> {
9508 unsafe {
9509 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9510 let mut out_out: *mut bindings::VipsImage = null_mut();
9511
9512 let flags_in: i32 = ppmload_buffer_options.flags as i32;
9513 let flags_in_name = utils::new_c_string("flags")?;
9514
9515 let memory_in: i32 = if ppmload_buffer_options.memory { 1 } else { 0 };
9516 let memory_in_name = utils::new_c_string("memory")?;
9517
9518 let access_in: i32 = ppmload_buffer_options.access as i32;
9519 let access_in_name = utils::new_c_string("access")?;
9520
9521 let fail_on_in: i32 = ppmload_buffer_options.fail_on as i32;
9522 let fail_on_in_name = utils::new_c_string("fail-on")?;
9523
9524 let revalidate_in: i32 = if ppmload_buffer_options.revalidate {
9525 1
9526 } else {
9527 0
9528 };
9529 let revalidate_in_name = utils::new_c_string("revalidate")?;
9530
9531 let vips_op_response = bindings::vips_ppmload_buffer(
9532 buffer_in,
9533 buffer.len() as u64,
9534 &mut out_out,
9535 flags_in_name.as_ptr(),
9536 flags_in,
9537 memory_in_name.as_ptr(),
9538 memory_in,
9539 access_in_name.as_ptr(),
9540 access_in,
9541 fail_on_in_name.as_ptr(),
9542 fail_on_in,
9543 revalidate_in_name.as_ptr(),
9544 revalidate_in,
9545 NULL,
9546 );
9547 utils::result(
9548 vips_op_response,
9549 VipsImage { ctx: out_out },
9550 Error::PpmloadBufferError,
9551 )
9552 }
9553}
9554
9555pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9559 unsafe {
9560 let source_in: *mut bindings::VipsSource = source.ctx;
9561 let mut out_out: *mut bindings::VipsImage = null_mut();
9562
9563 let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9564 utils::result(
9565 vips_op_response,
9566 VipsImage { ctx: out_out },
9567 Error::PpmloadSourceError,
9568 )
9569 }
9570}
9571
9572#[derive(Clone, Debug)]
9574pub struct PpmloadSourceOptions {
9575 pub flags: ForeignFlags,
9582 pub memory: bool,
9585 pub access: Access,
9591 pub fail_on: FailOn,
9598 pub revalidate: bool,
9601}
9602
9603impl std::default::Default for PpmloadSourceOptions {
9604 fn default() -> Self {
9605 PpmloadSourceOptions {
9606 flags: ForeignFlags::None,
9607 memory: false,
9608 access: Access::Random,
9609 fail_on: FailOn::None,
9610 revalidate: false,
9611 }
9612 }
9613}
9614
9615pub fn ppmload_source_with_opts(
9620 source: &VipsSource,
9621 ppmload_source_options: &PpmloadSourceOptions,
9622) -> Result<VipsImage> {
9623 unsafe {
9624 let source_in: *mut bindings::VipsSource = source.ctx;
9625 let mut out_out: *mut bindings::VipsImage = null_mut();
9626
9627 let flags_in: i32 = ppmload_source_options.flags as i32;
9628 let flags_in_name = utils::new_c_string("flags")?;
9629
9630 let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9631 let memory_in_name = utils::new_c_string("memory")?;
9632
9633 let access_in: i32 = ppmload_source_options.access as i32;
9634 let access_in_name = utils::new_c_string("access")?;
9635
9636 let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9637 let fail_on_in_name = utils::new_c_string("fail-on")?;
9638
9639 let revalidate_in: i32 = if ppmload_source_options.revalidate {
9640 1
9641 } else {
9642 0
9643 };
9644 let revalidate_in_name = utils::new_c_string("revalidate")?;
9645
9646 let vips_op_response = bindings::vips_ppmload_source(
9647 source_in,
9648 &mut out_out,
9649 flags_in_name.as_ptr(),
9650 flags_in,
9651 memory_in_name.as_ptr(),
9652 memory_in,
9653 access_in_name.as_ptr(),
9654 access_in,
9655 fail_on_in_name.as_ptr(),
9656 fail_on_in,
9657 revalidate_in_name.as_ptr(),
9658 revalidate_in,
9659 NULL,
9660 );
9661 utils::result(
9662 vips_op_response,
9663 VipsImage { ctx: out_out },
9664 Error::PpmloadSourceError,
9665 )
9666 }
9667}
9668
9669pub fn radload(filename: &str) -> Result<VipsImage> {
9673 unsafe {
9674 let filename_in: CString = utils::new_c_string(filename)?;
9675 let mut out_out: *mut bindings::VipsImage = null_mut();
9676
9677 let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9678 utils::result(
9679 vips_op_response,
9680 VipsImage { ctx: out_out },
9681 Error::RadloadError,
9682 )
9683 }
9684}
9685
9686#[derive(Clone, Debug)]
9688pub struct RadloadOptions {
9689 pub flags: ForeignFlags,
9696 pub memory: bool,
9699 pub access: Access,
9705 pub fail_on: FailOn,
9712 pub revalidate: bool,
9715}
9716
9717impl std::default::Default for RadloadOptions {
9718 fn default() -> Self {
9719 RadloadOptions {
9720 flags: ForeignFlags::None,
9721 memory: false,
9722 access: Access::Random,
9723 fail_on: FailOn::None,
9724 revalidate: false,
9725 }
9726 }
9727}
9728
9729pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9734 unsafe {
9735 let filename_in: CString = utils::new_c_string(filename)?;
9736 let mut out_out: *mut bindings::VipsImage = null_mut();
9737
9738 let flags_in: i32 = radload_options.flags as i32;
9739 let flags_in_name = utils::new_c_string("flags")?;
9740
9741 let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9742 let memory_in_name = utils::new_c_string("memory")?;
9743
9744 let access_in: i32 = radload_options.access as i32;
9745 let access_in_name = utils::new_c_string("access")?;
9746
9747 let fail_on_in: i32 = radload_options.fail_on as i32;
9748 let fail_on_in_name = utils::new_c_string("fail-on")?;
9749
9750 let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9751 let revalidate_in_name = utils::new_c_string("revalidate")?;
9752
9753 let vips_op_response = bindings::vips_radload(
9754 filename_in.as_ptr(),
9755 &mut out_out,
9756 flags_in_name.as_ptr(),
9757 flags_in,
9758 memory_in_name.as_ptr(),
9759 memory_in,
9760 access_in_name.as_ptr(),
9761 access_in,
9762 fail_on_in_name.as_ptr(),
9763 fail_on_in,
9764 revalidate_in_name.as_ptr(),
9765 revalidate_in,
9766 NULL,
9767 );
9768 utils::result(
9769 vips_op_response,
9770 VipsImage { ctx: out_out },
9771 Error::RadloadError,
9772 )
9773 }
9774}
9775
9776pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9780 unsafe {
9781 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9782 let mut out_out: *mut bindings::VipsImage = null_mut();
9783
9784 let vips_op_response =
9785 bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9786 utils::result(
9787 vips_op_response,
9788 VipsImage { ctx: out_out },
9789 Error::RadloadBufferError,
9790 )
9791 }
9792}
9793
9794#[derive(Clone, Debug)]
9796pub struct RadloadBufferOptions {
9797 pub flags: ForeignFlags,
9804 pub memory: bool,
9807 pub access: Access,
9813 pub fail_on: FailOn,
9820 pub revalidate: bool,
9823}
9824
9825impl std::default::Default for RadloadBufferOptions {
9826 fn default() -> Self {
9827 RadloadBufferOptions {
9828 flags: ForeignFlags::None,
9829 memory: false,
9830 access: Access::Random,
9831 fail_on: FailOn::None,
9832 revalidate: false,
9833 }
9834 }
9835}
9836
9837pub fn radload_buffer_with_opts(
9842 buffer: &[u8],
9843 radload_buffer_options: &RadloadBufferOptions,
9844) -> Result<VipsImage> {
9845 unsafe {
9846 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9847 let mut out_out: *mut bindings::VipsImage = null_mut();
9848
9849 let flags_in: i32 = radload_buffer_options.flags as i32;
9850 let flags_in_name = utils::new_c_string("flags")?;
9851
9852 let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9853 let memory_in_name = utils::new_c_string("memory")?;
9854
9855 let access_in: i32 = radload_buffer_options.access as i32;
9856 let access_in_name = utils::new_c_string("access")?;
9857
9858 let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9859 let fail_on_in_name = utils::new_c_string("fail-on")?;
9860
9861 let revalidate_in: i32 = if radload_buffer_options.revalidate {
9862 1
9863 } else {
9864 0
9865 };
9866 let revalidate_in_name = utils::new_c_string("revalidate")?;
9867
9868 let vips_op_response = bindings::vips_radload_buffer(
9869 buffer_in,
9870 buffer.len() as u64,
9871 &mut out_out,
9872 flags_in_name.as_ptr(),
9873 flags_in,
9874 memory_in_name.as_ptr(),
9875 memory_in,
9876 access_in_name.as_ptr(),
9877 access_in,
9878 fail_on_in_name.as_ptr(),
9879 fail_on_in,
9880 revalidate_in_name.as_ptr(),
9881 revalidate_in,
9882 NULL,
9883 );
9884 utils::result(
9885 vips_op_response,
9886 VipsImage { ctx: out_out },
9887 Error::RadloadBufferError,
9888 )
9889 }
9890}
9891
9892pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9896 unsafe {
9897 let source_in: *mut bindings::VipsSource = source.ctx;
9898 let mut out_out: *mut bindings::VipsImage = null_mut();
9899
9900 let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9901 utils::result(
9902 vips_op_response,
9903 VipsImage { ctx: out_out },
9904 Error::RadloadSourceError,
9905 )
9906 }
9907}
9908
9909#[derive(Clone, Debug)]
9911pub struct RadloadSourceOptions {
9912 pub flags: ForeignFlags,
9919 pub memory: bool,
9922 pub access: Access,
9928 pub fail_on: FailOn,
9935 pub revalidate: bool,
9938}
9939
9940impl std::default::Default for RadloadSourceOptions {
9941 fn default() -> Self {
9942 RadloadSourceOptions {
9943 flags: ForeignFlags::None,
9944 memory: false,
9945 access: Access::Random,
9946 fail_on: FailOn::None,
9947 revalidate: false,
9948 }
9949 }
9950}
9951
9952pub fn radload_source_with_opts(
9957 source: &VipsSource,
9958 radload_source_options: &RadloadSourceOptions,
9959) -> Result<VipsImage> {
9960 unsafe {
9961 let source_in: *mut bindings::VipsSource = source.ctx;
9962 let mut out_out: *mut bindings::VipsImage = null_mut();
9963
9964 let flags_in: i32 = radload_source_options.flags as i32;
9965 let flags_in_name = utils::new_c_string("flags")?;
9966
9967 let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9968 let memory_in_name = utils::new_c_string("memory")?;
9969
9970 let access_in: i32 = radload_source_options.access as i32;
9971 let access_in_name = utils::new_c_string("access")?;
9972
9973 let fail_on_in: i32 = radload_source_options.fail_on as i32;
9974 let fail_on_in_name = utils::new_c_string("fail-on")?;
9975
9976 let revalidate_in: i32 = if radload_source_options.revalidate {
9977 1
9978 } else {
9979 0
9980 };
9981 let revalidate_in_name = utils::new_c_string("revalidate")?;
9982
9983 let vips_op_response = bindings::vips_radload_source(
9984 source_in,
9985 &mut out_out,
9986 flags_in_name.as_ptr(),
9987 flags_in,
9988 memory_in_name.as_ptr(),
9989 memory_in,
9990 access_in_name.as_ptr(),
9991 access_in,
9992 fail_on_in_name.as_ptr(),
9993 fail_on_in,
9994 revalidate_in_name.as_ptr(),
9995 revalidate_in,
9996 NULL,
9997 );
9998 utils::result(
9999 vips_op_response,
10000 VipsImage { ctx: out_out },
10001 Error::RadloadSourceError,
10002 )
10003 }
10004}
10005
10006pub fn svgload(filename: &str) -> Result<VipsImage> {
10010 unsafe {
10011 let filename_in: CString = utils::new_c_string(filename)?;
10012 let mut out_out: *mut bindings::VipsImage = null_mut();
10013
10014 let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
10015 utils::result(
10016 vips_op_response,
10017 VipsImage { ctx: out_out },
10018 Error::SvgloadError,
10019 )
10020 }
10021}
10022
10023#[derive(Clone, Debug)]
10025pub struct SvgloadOptions {
10026 pub dpi: f64,
10029 pub scale: f64,
10032 pub unlimited: bool,
10035 pub stylesheet: String,
10037 pub high_bitdepth: bool,
10040 pub flags: ForeignFlags,
10047 pub memory: bool,
10050 pub access: Access,
10056 pub fail_on: FailOn,
10063 pub revalidate: bool,
10066}
10067
10068impl std::default::Default for SvgloadOptions {
10069 fn default() -> Self {
10070 SvgloadOptions {
10071 dpi: f64::from(72),
10072 scale: f64::from(1),
10073 unlimited: false,
10074 stylesheet: String::new(),
10075 high_bitdepth: false,
10076 flags: ForeignFlags::None,
10077 memory: false,
10078 access: Access::Random,
10079 fail_on: FailOn::None,
10080 revalidate: false,
10081 }
10082 }
10083}
10084
10085pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
10090 unsafe {
10091 let filename_in: CString = utils::new_c_string(filename)?;
10092 let mut out_out: *mut bindings::VipsImage = null_mut();
10093
10094 let dpi_in: f64 = svgload_options.dpi;
10095 let dpi_in_name = utils::new_c_string("dpi")?;
10096
10097 let scale_in: f64 = svgload_options.scale;
10098 let scale_in_name = utils::new_c_string("scale")?;
10099
10100 let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
10101 let unlimited_in_name = utils::new_c_string("unlimited")?;
10102
10103 let stylesheet_in: CString = utils::new_c_string(&svgload_options.stylesheet)?;
10104 let stylesheet_in_name = utils::new_c_string("stylesheet")?;
10105
10106 let high_bitdepth_in: i32 = if svgload_options.high_bitdepth { 1 } else { 0 };
10107 let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
10108
10109 let flags_in: i32 = svgload_options.flags as i32;
10110 let flags_in_name = utils::new_c_string("flags")?;
10111
10112 let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
10113 let memory_in_name = utils::new_c_string("memory")?;
10114
10115 let access_in: i32 = svgload_options.access as i32;
10116 let access_in_name = utils::new_c_string("access")?;
10117
10118 let fail_on_in: i32 = svgload_options.fail_on as i32;
10119 let fail_on_in_name = utils::new_c_string("fail-on")?;
10120
10121 let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
10122 let revalidate_in_name = utils::new_c_string("revalidate")?;
10123
10124 let vips_op_response = bindings::vips_svgload(
10125 filename_in.as_ptr(),
10126 &mut out_out,
10127 dpi_in_name.as_ptr(),
10128 dpi_in,
10129 scale_in_name.as_ptr(),
10130 scale_in,
10131 unlimited_in_name.as_ptr(),
10132 unlimited_in,
10133 stylesheet_in_name.as_ptr(),
10134 stylesheet_in.as_ptr(),
10135 high_bitdepth_in_name.as_ptr(),
10136 high_bitdepth_in,
10137 flags_in_name.as_ptr(),
10138 flags_in,
10139 memory_in_name.as_ptr(),
10140 memory_in,
10141 access_in_name.as_ptr(),
10142 access_in,
10143 fail_on_in_name.as_ptr(),
10144 fail_on_in,
10145 revalidate_in_name.as_ptr(),
10146 revalidate_in,
10147 NULL,
10148 );
10149 utils::result(
10150 vips_op_response,
10151 VipsImage { ctx: out_out },
10152 Error::SvgloadError,
10153 )
10154 }
10155}
10156
10157pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10161 unsafe {
10162 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10163 let mut out_out: *mut bindings::VipsImage = null_mut();
10164
10165 let vips_op_response =
10166 bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10167 utils::result(
10168 vips_op_response,
10169 VipsImage { ctx: out_out },
10170 Error::SvgloadBufferError,
10171 )
10172 }
10173}
10174
10175#[derive(Clone, Debug)]
10177pub struct SvgloadBufferOptions {
10178 pub dpi: f64,
10181 pub scale: f64,
10184 pub unlimited: bool,
10187 pub stylesheet: String,
10189 pub high_bitdepth: bool,
10192 pub flags: ForeignFlags,
10199 pub memory: bool,
10202 pub access: Access,
10208 pub fail_on: FailOn,
10215 pub revalidate: bool,
10218}
10219
10220impl std::default::Default for SvgloadBufferOptions {
10221 fn default() -> Self {
10222 SvgloadBufferOptions {
10223 dpi: f64::from(72),
10224 scale: f64::from(1),
10225 unlimited: false,
10226 stylesheet: String::new(),
10227 high_bitdepth: false,
10228 flags: ForeignFlags::None,
10229 memory: false,
10230 access: Access::Random,
10231 fail_on: FailOn::None,
10232 revalidate: false,
10233 }
10234 }
10235}
10236
10237pub fn svgload_buffer_with_opts(
10242 buffer: &[u8],
10243 svgload_buffer_options: &SvgloadBufferOptions,
10244) -> Result<VipsImage> {
10245 unsafe {
10246 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10247 let mut out_out: *mut bindings::VipsImage = null_mut();
10248
10249 let dpi_in: f64 = svgload_buffer_options.dpi;
10250 let dpi_in_name = utils::new_c_string("dpi")?;
10251
10252 let scale_in: f64 = svgload_buffer_options.scale;
10253 let scale_in_name = utils::new_c_string("scale")?;
10254
10255 let unlimited_in: i32 = if svgload_buffer_options.unlimited {
10256 1
10257 } else {
10258 0
10259 };
10260 let unlimited_in_name = utils::new_c_string("unlimited")?;
10261
10262 let stylesheet_in: CString = utils::new_c_string(&svgload_buffer_options.stylesheet)?;
10263 let stylesheet_in_name = utils::new_c_string("stylesheet")?;
10264
10265 let high_bitdepth_in: i32 = if svgload_buffer_options.high_bitdepth {
10266 1
10267 } else {
10268 0
10269 };
10270 let high_bitdepth_in_name = utils::new_c_string("high-bitdepth")?;
10271
10272 let flags_in: i32 = svgload_buffer_options.flags as i32;
10273 let flags_in_name = utils::new_c_string("flags")?;
10274
10275 let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
10276 let memory_in_name = utils::new_c_string("memory")?;
10277
10278 let access_in: i32 = svgload_buffer_options.access as i32;
10279 let access_in_name = utils::new_c_string("access")?;
10280
10281 let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
10282 let fail_on_in_name = utils::new_c_string("fail-on")?;
10283
10284 let revalidate_in: i32 = if svgload_buffer_options.revalidate {
10285 1
10286 } else {
10287 0
10288 };
10289 let revalidate_in_name = utils::new_c_string("revalidate")?;
10290
10291 let vips_op_response = bindings::vips_svgload_buffer(
10292 buffer_in,
10293 buffer.len() as u64,
10294 &mut out_out,
10295 dpi_in_name.as_ptr(),
10296 dpi_in,
10297 scale_in_name.as_ptr(),
10298 scale_in,
10299 unlimited_in_name.as_ptr(),
10300 unlimited_in,
10301 stylesheet_in_name.as_ptr(),
10302 stylesheet_in.as_ptr(),
10303 high_bitdepth_in_name.as_ptr(),
10304 high_bitdepth_in,
10305 flags_in_name.as_ptr(),
10306 flags_in,
10307 memory_in_name.as_ptr(),
10308 memory_in,
10309 access_in_name.as_ptr(),
10310 access_in,
10311 fail_on_in_name.as_ptr(),
10312 fail_on_in,
10313 revalidate_in_name.as_ptr(),
10314 revalidate_in,
10315 NULL,
10316 );
10317 utils::result(
10318 vips_op_response,
10319 VipsImage { ctx: out_out },
10320 Error::SvgloadBufferError,
10321 )
10322 }
10323}
10324
10325pub fn gifload(filename: &str) -> Result<VipsImage> {
10329 unsafe {
10330 let filename_in: CString = utils::new_c_string(filename)?;
10331 let mut out_out: *mut bindings::VipsImage = null_mut();
10332
10333 let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10334 utils::result(
10335 vips_op_response,
10336 VipsImage { ctx: out_out },
10337 Error::GifloadError,
10338 )
10339 }
10340}
10341
10342#[derive(Clone, Debug)]
10344pub struct GifloadOptions {
10345 pub n: i32,
10348 pub page: i32,
10351 pub flags: ForeignFlags,
10358 pub memory: bool,
10361 pub access: Access,
10367 pub fail_on: FailOn,
10374 pub revalidate: bool,
10377}
10378
10379impl std::default::Default for GifloadOptions {
10380 fn default() -> Self {
10381 GifloadOptions {
10382 n: i32::from(1),
10383 page: i32::from(0),
10384 flags: ForeignFlags::None,
10385 memory: false,
10386 access: Access::Random,
10387 fail_on: FailOn::None,
10388 revalidate: false,
10389 }
10390 }
10391}
10392
10393pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10398 unsafe {
10399 let filename_in: CString = utils::new_c_string(filename)?;
10400 let mut out_out: *mut bindings::VipsImage = null_mut();
10401
10402 let n_in: i32 = gifload_options.n;
10403 let n_in_name = utils::new_c_string("n")?;
10404
10405 let page_in: i32 = gifload_options.page;
10406 let page_in_name = utils::new_c_string("page")?;
10407
10408 let flags_in: i32 = gifload_options.flags as i32;
10409 let flags_in_name = utils::new_c_string("flags")?;
10410
10411 let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10412 let memory_in_name = utils::new_c_string("memory")?;
10413
10414 let access_in: i32 = gifload_options.access as i32;
10415 let access_in_name = utils::new_c_string("access")?;
10416
10417 let fail_on_in: i32 = gifload_options.fail_on as i32;
10418 let fail_on_in_name = utils::new_c_string("fail-on")?;
10419
10420 let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10421 let revalidate_in_name = utils::new_c_string("revalidate")?;
10422
10423 let vips_op_response = bindings::vips_gifload(
10424 filename_in.as_ptr(),
10425 &mut out_out,
10426 n_in_name.as_ptr(),
10427 n_in,
10428 page_in_name.as_ptr(),
10429 page_in,
10430 flags_in_name.as_ptr(),
10431 flags_in,
10432 memory_in_name.as_ptr(),
10433 memory_in,
10434 access_in_name.as_ptr(),
10435 access_in,
10436 fail_on_in_name.as_ptr(),
10437 fail_on_in,
10438 revalidate_in_name.as_ptr(),
10439 revalidate_in,
10440 NULL,
10441 );
10442 utils::result(
10443 vips_op_response,
10444 VipsImage { ctx: out_out },
10445 Error::GifloadError,
10446 )
10447 }
10448}
10449
10450pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10454 unsafe {
10455 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10456 let mut out_out: *mut bindings::VipsImage = null_mut();
10457
10458 let vips_op_response =
10459 bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10460 utils::result(
10461 vips_op_response,
10462 VipsImage { ctx: out_out },
10463 Error::GifloadBufferError,
10464 )
10465 }
10466}
10467
10468#[derive(Clone, Debug)]
10470pub struct GifloadBufferOptions {
10471 pub n: i32,
10474 pub page: i32,
10477 pub flags: ForeignFlags,
10484 pub memory: bool,
10487 pub access: Access,
10493 pub fail_on: FailOn,
10500 pub revalidate: bool,
10503}
10504
10505impl std::default::Default for GifloadBufferOptions {
10506 fn default() -> Self {
10507 GifloadBufferOptions {
10508 n: i32::from(1),
10509 page: i32::from(0),
10510 flags: ForeignFlags::None,
10511 memory: false,
10512 access: Access::Random,
10513 fail_on: FailOn::None,
10514 revalidate: false,
10515 }
10516 }
10517}
10518
10519pub fn gifload_buffer_with_opts(
10524 buffer: &[u8],
10525 gifload_buffer_options: &GifloadBufferOptions,
10526) -> Result<VipsImage> {
10527 unsafe {
10528 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10529 let mut out_out: *mut bindings::VipsImage = null_mut();
10530
10531 let n_in: i32 = gifload_buffer_options.n;
10532 let n_in_name = utils::new_c_string("n")?;
10533
10534 let page_in: i32 = gifload_buffer_options.page;
10535 let page_in_name = utils::new_c_string("page")?;
10536
10537 let flags_in: i32 = gifload_buffer_options.flags as i32;
10538 let flags_in_name = utils::new_c_string("flags")?;
10539
10540 let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10541 let memory_in_name = utils::new_c_string("memory")?;
10542
10543 let access_in: i32 = gifload_buffer_options.access as i32;
10544 let access_in_name = utils::new_c_string("access")?;
10545
10546 let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10547 let fail_on_in_name = utils::new_c_string("fail-on")?;
10548
10549 let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10550 1
10551 } else {
10552 0
10553 };
10554 let revalidate_in_name = utils::new_c_string("revalidate")?;
10555
10556 let vips_op_response = bindings::vips_gifload_buffer(
10557 buffer_in,
10558 buffer.len() as u64,
10559 &mut out_out,
10560 n_in_name.as_ptr(),
10561 n_in,
10562 page_in_name.as_ptr(),
10563 page_in,
10564 flags_in_name.as_ptr(),
10565 flags_in,
10566 memory_in_name.as_ptr(),
10567 memory_in,
10568 access_in_name.as_ptr(),
10569 access_in,
10570 fail_on_in_name.as_ptr(),
10571 fail_on_in,
10572 revalidate_in_name.as_ptr(),
10573 revalidate_in,
10574 NULL,
10575 );
10576 utils::result(
10577 vips_op_response,
10578 VipsImage { ctx: out_out },
10579 Error::GifloadBufferError,
10580 )
10581 }
10582}
10583
10584pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10588 unsafe {
10589 let source_in: *mut bindings::VipsSource = source.ctx;
10590 let mut out_out: *mut bindings::VipsImage = null_mut();
10591
10592 let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10593 utils::result(
10594 vips_op_response,
10595 VipsImage { ctx: out_out },
10596 Error::GifloadSourceError,
10597 )
10598 }
10599}
10600
10601#[derive(Clone, Debug)]
10603pub struct GifloadSourceOptions {
10604 pub n: i32,
10607 pub page: i32,
10610 pub flags: ForeignFlags,
10617 pub memory: bool,
10620 pub access: Access,
10626 pub fail_on: FailOn,
10633 pub revalidate: bool,
10636}
10637
10638impl std::default::Default for GifloadSourceOptions {
10639 fn default() -> Self {
10640 GifloadSourceOptions {
10641 n: i32::from(1),
10642 page: i32::from(0),
10643 flags: ForeignFlags::None,
10644 memory: false,
10645 access: Access::Random,
10646 fail_on: FailOn::None,
10647 revalidate: false,
10648 }
10649 }
10650}
10651
10652pub fn gifload_source_with_opts(
10657 source: &VipsSource,
10658 gifload_source_options: &GifloadSourceOptions,
10659) -> Result<VipsImage> {
10660 unsafe {
10661 let source_in: *mut bindings::VipsSource = source.ctx;
10662 let mut out_out: *mut bindings::VipsImage = null_mut();
10663
10664 let n_in: i32 = gifload_source_options.n;
10665 let n_in_name = utils::new_c_string("n")?;
10666
10667 let page_in: i32 = gifload_source_options.page;
10668 let page_in_name = utils::new_c_string("page")?;
10669
10670 let flags_in: i32 = gifload_source_options.flags as i32;
10671 let flags_in_name = utils::new_c_string("flags")?;
10672
10673 let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10674 let memory_in_name = utils::new_c_string("memory")?;
10675
10676 let access_in: i32 = gifload_source_options.access as i32;
10677 let access_in_name = utils::new_c_string("access")?;
10678
10679 let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10680 let fail_on_in_name = utils::new_c_string("fail-on")?;
10681
10682 let revalidate_in: i32 = if gifload_source_options.revalidate {
10683 1
10684 } else {
10685 0
10686 };
10687 let revalidate_in_name = utils::new_c_string("revalidate")?;
10688
10689 let vips_op_response = bindings::vips_gifload_source(
10690 source_in,
10691 &mut out_out,
10692 n_in_name.as_ptr(),
10693 n_in,
10694 page_in_name.as_ptr(),
10695 page_in,
10696 flags_in_name.as_ptr(),
10697 flags_in,
10698 memory_in_name.as_ptr(),
10699 memory_in,
10700 access_in_name.as_ptr(),
10701 access_in,
10702 fail_on_in_name.as_ptr(),
10703 fail_on_in,
10704 revalidate_in_name.as_ptr(),
10705 revalidate_in,
10706 NULL,
10707 );
10708 utils::result(
10709 vips_op_response,
10710 VipsImage { ctx: out_out },
10711 Error::GifloadSourceError,
10712 )
10713 }
10714}
10715
10716pub fn pngload(filename: &str) -> Result<VipsImage> {
10720 unsafe {
10721 let filename_in: CString = utils::new_c_string(filename)?;
10722 let mut out_out: *mut bindings::VipsImage = null_mut();
10723
10724 let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10725 utils::result(
10726 vips_op_response,
10727 VipsImage { ctx: out_out },
10728 Error::PngloadError,
10729 )
10730 }
10731}
10732
10733#[derive(Clone, Debug)]
10735pub struct PngloadOptions {
10736 pub unlimited: bool,
10739 pub flags: ForeignFlags,
10746 pub memory: bool,
10749 pub access: Access,
10755 pub fail_on: FailOn,
10762 pub revalidate: bool,
10765}
10766
10767impl std::default::Default for PngloadOptions {
10768 fn default() -> Self {
10769 PngloadOptions {
10770 unlimited: false,
10771 flags: ForeignFlags::None,
10772 memory: false,
10773 access: Access::Random,
10774 fail_on: FailOn::None,
10775 revalidate: false,
10776 }
10777 }
10778}
10779
10780pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10785 unsafe {
10786 let filename_in: CString = utils::new_c_string(filename)?;
10787 let mut out_out: *mut bindings::VipsImage = null_mut();
10788
10789 let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10790 let unlimited_in_name = utils::new_c_string("unlimited")?;
10791
10792 let flags_in: i32 = pngload_options.flags as i32;
10793 let flags_in_name = utils::new_c_string("flags")?;
10794
10795 let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10796 let memory_in_name = utils::new_c_string("memory")?;
10797
10798 let access_in: i32 = pngload_options.access as i32;
10799 let access_in_name = utils::new_c_string("access")?;
10800
10801 let fail_on_in: i32 = pngload_options.fail_on as i32;
10802 let fail_on_in_name = utils::new_c_string("fail-on")?;
10803
10804 let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10805 let revalidate_in_name = utils::new_c_string("revalidate")?;
10806
10807 let vips_op_response = bindings::vips_pngload(
10808 filename_in.as_ptr(),
10809 &mut out_out,
10810 unlimited_in_name.as_ptr(),
10811 unlimited_in,
10812 flags_in_name.as_ptr(),
10813 flags_in,
10814 memory_in_name.as_ptr(),
10815 memory_in,
10816 access_in_name.as_ptr(),
10817 access_in,
10818 fail_on_in_name.as_ptr(),
10819 fail_on_in,
10820 revalidate_in_name.as_ptr(),
10821 revalidate_in,
10822 NULL,
10823 );
10824 utils::result(
10825 vips_op_response,
10826 VipsImage { ctx: out_out },
10827 Error::PngloadError,
10828 )
10829 }
10830}
10831
10832pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10836 unsafe {
10837 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10838 let mut out_out: *mut bindings::VipsImage = null_mut();
10839
10840 let vips_op_response =
10841 bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10842 utils::result(
10843 vips_op_response,
10844 VipsImage { ctx: out_out },
10845 Error::PngloadBufferError,
10846 )
10847 }
10848}
10849
10850#[derive(Clone, Debug)]
10852pub struct PngloadBufferOptions {
10853 pub unlimited: bool,
10856 pub flags: ForeignFlags,
10863 pub memory: bool,
10866 pub access: Access,
10872 pub fail_on: FailOn,
10879 pub revalidate: bool,
10882}
10883
10884impl std::default::Default for PngloadBufferOptions {
10885 fn default() -> Self {
10886 PngloadBufferOptions {
10887 unlimited: false,
10888 flags: ForeignFlags::None,
10889 memory: false,
10890 access: Access::Random,
10891 fail_on: FailOn::None,
10892 revalidate: false,
10893 }
10894 }
10895}
10896
10897pub fn pngload_buffer_with_opts(
10902 buffer: &[u8],
10903 pngload_buffer_options: &PngloadBufferOptions,
10904) -> Result<VipsImage> {
10905 unsafe {
10906 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10907 let mut out_out: *mut bindings::VipsImage = null_mut();
10908
10909 let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10910 1
10911 } else {
10912 0
10913 };
10914 let unlimited_in_name = utils::new_c_string("unlimited")?;
10915
10916 let flags_in: i32 = pngload_buffer_options.flags as i32;
10917 let flags_in_name = utils::new_c_string("flags")?;
10918
10919 let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10920 let memory_in_name = utils::new_c_string("memory")?;
10921
10922 let access_in: i32 = pngload_buffer_options.access as i32;
10923 let access_in_name = utils::new_c_string("access")?;
10924
10925 let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10926 let fail_on_in_name = utils::new_c_string("fail-on")?;
10927
10928 let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10929 1
10930 } else {
10931 0
10932 };
10933 let revalidate_in_name = utils::new_c_string("revalidate")?;
10934
10935 let vips_op_response = bindings::vips_pngload_buffer(
10936 buffer_in,
10937 buffer.len() as u64,
10938 &mut out_out,
10939 unlimited_in_name.as_ptr(),
10940 unlimited_in,
10941 flags_in_name.as_ptr(),
10942 flags_in,
10943 memory_in_name.as_ptr(),
10944 memory_in,
10945 access_in_name.as_ptr(),
10946 access_in,
10947 fail_on_in_name.as_ptr(),
10948 fail_on_in,
10949 revalidate_in_name.as_ptr(),
10950 revalidate_in,
10951 NULL,
10952 );
10953 utils::result(
10954 vips_op_response,
10955 VipsImage { ctx: out_out },
10956 Error::PngloadBufferError,
10957 )
10958 }
10959}
10960
10961pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10965 unsafe {
10966 let source_in: *mut bindings::VipsSource = source.ctx;
10967 let mut out_out: *mut bindings::VipsImage = null_mut();
10968
10969 let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10970 utils::result(
10971 vips_op_response,
10972 VipsImage { ctx: out_out },
10973 Error::PngloadSourceError,
10974 )
10975 }
10976}
10977
10978#[derive(Clone, Debug)]
10980pub struct PngloadSourceOptions {
10981 pub unlimited: bool,
10984 pub flags: ForeignFlags,
10991 pub memory: bool,
10994 pub access: Access,
11000 pub fail_on: FailOn,
11007 pub revalidate: bool,
11010}
11011
11012impl std::default::Default for PngloadSourceOptions {
11013 fn default() -> Self {
11014 PngloadSourceOptions {
11015 unlimited: false,
11016 flags: ForeignFlags::None,
11017 memory: false,
11018 access: Access::Random,
11019 fail_on: FailOn::None,
11020 revalidate: false,
11021 }
11022 }
11023}
11024
11025pub fn pngload_source_with_opts(
11030 source: &VipsSource,
11031 pngload_source_options: &PngloadSourceOptions,
11032) -> Result<VipsImage> {
11033 unsafe {
11034 let source_in: *mut bindings::VipsSource = source.ctx;
11035 let mut out_out: *mut bindings::VipsImage = null_mut();
11036
11037 let unlimited_in: i32 = if pngload_source_options.unlimited {
11038 1
11039 } else {
11040 0
11041 };
11042 let unlimited_in_name = utils::new_c_string("unlimited")?;
11043
11044 let flags_in: i32 = pngload_source_options.flags as i32;
11045 let flags_in_name = utils::new_c_string("flags")?;
11046
11047 let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
11048 let memory_in_name = utils::new_c_string("memory")?;
11049
11050 let access_in: i32 = pngload_source_options.access as i32;
11051 let access_in_name = utils::new_c_string("access")?;
11052
11053 let fail_on_in: i32 = pngload_source_options.fail_on as i32;
11054 let fail_on_in_name = utils::new_c_string("fail-on")?;
11055
11056 let revalidate_in: i32 = if pngload_source_options.revalidate {
11057 1
11058 } else {
11059 0
11060 };
11061 let revalidate_in_name = utils::new_c_string("revalidate")?;
11062
11063 let vips_op_response = bindings::vips_pngload_source(
11064 source_in,
11065 &mut out_out,
11066 unlimited_in_name.as_ptr(),
11067 unlimited_in,
11068 flags_in_name.as_ptr(),
11069 flags_in,
11070 memory_in_name.as_ptr(),
11071 memory_in,
11072 access_in_name.as_ptr(),
11073 access_in,
11074 fail_on_in_name.as_ptr(),
11075 fail_on_in,
11076 revalidate_in_name.as_ptr(),
11077 revalidate_in,
11078 NULL,
11079 );
11080 utils::result(
11081 vips_op_response,
11082 VipsImage { ctx: out_out },
11083 Error::PngloadSourceError,
11084 )
11085 }
11086}
11087
11088pub fn jpegload(filename: &str) -> Result<VipsImage> {
11092 unsafe {
11093 let filename_in: CString = utils::new_c_string(filename)?;
11094 let mut out_out: *mut bindings::VipsImage = null_mut();
11095
11096 let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
11097 utils::result(
11098 vips_op_response,
11099 VipsImage { ctx: out_out },
11100 Error::JpegloadError,
11101 )
11102 }
11103}
11104
11105#[derive(Clone, Debug)]
11107pub struct JpegloadOptions {
11108 pub shrink: i32,
11111 pub autorotate: bool,
11114 pub unlimited: bool,
11117 pub flags: ForeignFlags,
11124 pub memory: bool,
11127 pub access: Access,
11133 pub fail_on: FailOn,
11140 pub revalidate: bool,
11143}
11144
11145impl std::default::Default for JpegloadOptions {
11146 fn default() -> Self {
11147 JpegloadOptions {
11148 shrink: i32::from(1),
11149 autorotate: false,
11150 unlimited: false,
11151 flags: ForeignFlags::None,
11152 memory: false,
11153 access: Access::Random,
11154 fail_on: FailOn::None,
11155 revalidate: false,
11156 }
11157 }
11158}
11159
11160pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11165 unsafe {
11166 let filename_in: CString = utils::new_c_string(filename)?;
11167 let mut out_out: *mut bindings::VipsImage = null_mut();
11168
11169 let shrink_in: i32 = jpegload_options.shrink;
11170 let shrink_in_name = utils::new_c_string("shrink")?;
11171
11172 let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11173 let autorotate_in_name = utils::new_c_string("autorotate")?;
11174
11175 let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11176 let unlimited_in_name = utils::new_c_string("unlimited")?;
11177
11178 let flags_in: i32 = jpegload_options.flags as i32;
11179 let flags_in_name = utils::new_c_string("flags")?;
11180
11181 let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11182 let memory_in_name = utils::new_c_string("memory")?;
11183
11184 let access_in: i32 = jpegload_options.access as i32;
11185 let access_in_name = utils::new_c_string("access")?;
11186
11187 let fail_on_in: i32 = jpegload_options.fail_on as i32;
11188 let fail_on_in_name = utils::new_c_string("fail-on")?;
11189
11190 let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11191 let revalidate_in_name = utils::new_c_string("revalidate")?;
11192
11193 let vips_op_response = bindings::vips_jpegload(
11194 filename_in.as_ptr(),
11195 &mut out_out,
11196 shrink_in_name.as_ptr(),
11197 shrink_in,
11198 autorotate_in_name.as_ptr(),
11199 autorotate_in,
11200 unlimited_in_name.as_ptr(),
11201 unlimited_in,
11202 flags_in_name.as_ptr(),
11203 flags_in,
11204 memory_in_name.as_ptr(),
11205 memory_in,
11206 access_in_name.as_ptr(),
11207 access_in,
11208 fail_on_in_name.as_ptr(),
11209 fail_on_in,
11210 revalidate_in_name.as_ptr(),
11211 revalidate_in,
11212 NULL,
11213 );
11214 utils::result(
11215 vips_op_response,
11216 VipsImage { ctx: out_out },
11217 Error::JpegloadError,
11218 )
11219 }
11220}
11221
11222pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11226 unsafe {
11227 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11228 let mut out_out: *mut bindings::VipsImage = null_mut();
11229
11230 let vips_op_response =
11231 bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11232 utils::result(
11233 vips_op_response,
11234 VipsImage { ctx: out_out },
11235 Error::JpegloadBufferError,
11236 )
11237 }
11238}
11239
11240#[derive(Clone, Debug)]
11242pub struct JpegloadBufferOptions {
11243 pub shrink: i32,
11246 pub autorotate: bool,
11249 pub unlimited: bool,
11252 pub flags: ForeignFlags,
11259 pub memory: bool,
11262 pub access: Access,
11268 pub fail_on: FailOn,
11275 pub revalidate: bool,
11278}
11279
11280impl std::default::Default for JpegloadBufferOptions {
11281 fn default() -> Self {
11282 JpegloadBufferOptions {
11283 shrink: i32::from(1),
11284 autorotate: false,
11285 unlimited: false,
11286 flags: ForeignFlags::None,
11287 memory: false,
11288 access: Access::Random,
11289 fail_on: FailOn::None,
11290 revalidate: false,
11291 }
11292 }
11293}
11294
11295pub fn jpegload_buffer_with_opts(
11300 buffer: &[u8],
11301 jpegload_buffer_options: &JpegloadBufferOptions,
11302) -> Result<VipsImage> {
11303 unsafe {
11304 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11305 let mut out_out: *mut bindings::VipsImage = null_mut();
11306
11307 let shrink_in: i32 = jpegload_buffer_options.shrink;
11308 let shrink_in_name = utils::new_c_string("shrink")?;
11309
11310 let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11311 1
11312 } else {
11313 0
11314 };
11315 let autorotate_in_name = utils::new_c_string("autorotate")?;
11316
11317 let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11318 1
11319 } else {
11320 0
11321 };
11322 let unlimited_in_name = utils::new_c_string("unlimited")?;
11323
11324 let flags_in: i32 = jpegload_buffer_options.flags as i32;
11325 let flags_in_name = utils::new_c_string("flags")?;
11326
11327 let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11328 let memory_in_name = utils::new_c_string("memory")?;
11329
11330 let access_in: i32 = jpegload_buffer_options.access as i32;
11331 let access_in_name = utils::new_c_string("access")?;
11332
11333 let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11334 let fail_on_in_name = utils::new_c_string("fail-on")?;
11335
11336 let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11337 1
11338 } else {
11339 0
11340 };
11341 let revalidate_in_name = utils::new_c_string("revalidate")?;
11342
11343 let vips_op_response = bindings::vips_jpegload_buffer(
11344 buffer_in,
11345 buffer.len() as u64,
11346 &mut out_out,
11347 shrink_in_name.as_ptr(),
11348 shrink_in,
11349 autorotate_in_name.as_ptr(),
11350 autorotate_in,
11351 unlimited_in_name.as_ptr(),
11352 unlimited_in,
11353 flags_in_name.as_ptr(),
11354 flags_in,
11355 memory_in_name.as_ptr(),
11356 memory_in,
11357 access_in_name.as_ptr(),
11358 access_in,
11359 fail_on_in_name.as_ptr(),
11360 fail_on_in,
11361 revalidate_in_name.as_ptr(),
11362 revalidate_in,
11363 NULL,
11364 );
11365 utils::result(
11366 vips_op_response,
11367 VipsImage { ctx: out_out },
11368 Error::JpegloadBufferError,
11369 )
11370 }
11371}
11372
11373pub fn webpload(filename: &str) -> Result<VipsImage> {
11377 unsafe {
11378 let filename_in: CString = utils::new_c_string(filename)?;
11379 let mut out_out: *mut bindings::VipsImage = null_mut();
11380
11381 let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11382 utils::result(
11383 vips_op_response,
11384 VipsImage { ctx: out_out },
11385 Error::WebploadError,
11386 )
11387 }
11388}
11389
11390#[derive(Clone, Debug)]
11392pub struct WebploadOptions {
11393 pub page: i32,
11396 pub n: i32,
11399 pub scale: f64,
11402 pub flags: ForeignFlags,
11409 pub memory: bool,
11412 pub access: Access,
11418 pub fail_on: FailOn,
11425 pub revalidate: bool,
11428}
11429
11430impl std::default::Default for WebploadOptions {
11431 fn default() -> Self {
11432 WebploadOptions {
11433 page: i32::from(0),
11434 n: i32::from(1),
11435 scale: f64::from(1),
11436 flags: ForeignFlags::None,
11437 memory: false,
11438 access: Access::Random,
11439 fail_on: FailOn::None,
11440 revalidate: false,
11441 }
11442 }
11443}
11444
11445pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11450 unsafe {
11451 let filename_in: CString = utils::new_c_string(filename)?;
11452 let mut out_out: *mut bindings::VipsImage = null_mut();
11453
11454 let page_in: i32 = webpload_options.page;
11455 let page_in_name = utils::new_c_string("page")?;
11456
11457 let n_in: i32 = webpload_options.n;
11458 let n_in_name = utils::new_c_string("n")?;
11459
11460 let scale_in: f64 = webpload_options.scale;
11461 let scale_in_name = utils::new_c_string("scale")?;
11462
11463 let flags_in: i32 = webpload_options.flags as i32;
11464 let flags_in_name = utils::new_c_string("flags")?;
11465
11466 let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11467 let memory_in_name = utils::new_c_string("memory")?;
11468
11469 let access_in: i32 = webpload_options.access as i32;
11470 let access_in_name = utils::new_c_string("access")?;
11471
11472 let fail_on_in: i32 = webpload_options.fail_on as i32;
11473 let fail_on_in_name = utils::new_c_string("fail-on")?;
11474
11475 let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11476 let revalidate_in_name = utils::new_c_string("revalidate")?;
11477
11478 let vips_op_response = bindings::vips_webpload(
11479 filename_in.as_ptr(),
11480 &mut out_out,
11481 page_in_name.as_ptr(),
11482 page_in,
11483 n_in_name.as_ptr(),
11484 n_in,
11485 scale_in_name.as_ptr(),
11486 scale_in,
11487 flags_in_name.as_ptr(),
11488 flags_in,
11489 memory_in_name.as_ptr(),
11490 memory_in,
11491 access_in_name.as_ptr(),
11492 access_in,
11493 fail_on_in_name.as_ptr(),
11494 fail_on_in,
11495 revalidate_in_name.as_ptr(),
11496 revalidate_in,
11497 NULL,
11498 );
11499 utils::result(
11500 vips_op_response,
11501 VipsImage { ctx: out_out },
11502 Error::WebploadError,
11503 )
11504 }
11505}
11506
11507pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11511 unsafe {
11512 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11513 let mut out_out: *mut bindings::VipsImage = null_mut();
11514
11515 let vips_op_response =
11516 bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11517 utils::result(
11518 vips_op_response,
11519 VipsImage { ctx: out_out },
11520 Error::WebploadBufferError,
11521 )
11522 }
11523}
11524
11525#[derive(Clone, Debug)]
11527pub struct WebploadBufferOptions {
11528 pub page: i32,
11531 pub n: i32,
11534 pub scale: f64,
11537 pub flags: ForeignFlags,
11544 pub memory: bool,
11547 pub access: Access,
11553 pub fail_on: FailOn,
11560 pub revalidate: bool,
11563}
11564
11565impl std::default::Default for WebploadBufferOptions {
11566 fn default() -> Self {
11567 WebploadBufferOptions {
11568 page: i32::from(0),
11569 n: i32::from(1),
11570 scale: f64::from(1),
11571 flags: ForeignFlags::None,
11572 memory: false,
11573 access: Access::Random,
11574 fail_on: FailOn::None,
11575 revalidate: false,
11576 }
11577 }
11578}
11579
11580pub fn webpload_buffer_with_opts(
11585 buffer: &[u8],
11586 webpload_buffer_options: &WebploadBufferOptions,
11587) -> Result<VipsImage> {
11588 unsafe {
11589 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11590 let mut out_out: *mut bindings::VipsImage = null_mut();
11591
11592 let page_in: i32 = webpload_buffer_options.page;
11593 let page_in_name = utils::new_c_string("page")?;
11594
11595 let n_in: i32 = webpload_buffer_options.n;
11596 let n_in_name = utils::new_c_string("n")?;
11597
11598 let scale_in: f64 = webpload_buffer_options.scale;
11599 let scale_in_name = utils::new_c_string("scale")?;
11600
11601 let flags_in: i32 = webpload_buffer_options.flags as i32;
11602 let flags_in_name = utils::new_c_string("flags")?;
11603
11604 let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11605 let memory_in_name = utils::new_c_string("memory")?;
11606
11607 let access_in: i32 = webpload_buffer_options.access as i32;
11608 let access_in_name = utils::new_c_string("access")?;
11609
11610 let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11611 let fail_on_in_name = utils::new_c_string("fail-on")?;
11612
11613 let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11614 1
11615 } else {
11616 0
11617 };
11618 let revalidate_in_name = utils::new_c_string("revalidate")?;
11619
11620 let vips_op_response = bindings::vips_webpload_buffer(
11621 buffer_in,
11622 buffer.len() as u64,
11623 &mut out_out,
11624 page_in_name.as_ptr(),
11625 page_in,
11626 n_in_name.as_ptr(),
11627 n_in,
11628 scale_in_name.as_ptr(),
11629 scale_in,
11630 flags_in_name.as_ptr(),
11631 flags_in,
11632 memory_in_name.as_ptr(),
11633 memory_in,
11634 access_in_name.as_ptr(),
11635 access_in,
11636 fail_on_in_name.as_ptr(),
11637 fail_on_in,
11638 revalidate_in_name.as_ptr(),
11639 revalidate_in,
11640 NULL,
11641 );
11642 utils::result(
11643 vips_op_response,
11644 VipsImage { ctx: out_out },
11645 Error::WebploadBufferError,
11646 )
11647 }
11648}
11649
11650pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11654 unsafe {
11655 let source_in: *mut bindings::VipsSource = source.ctx;
11656 let mut out_out: *mut bindings::VipsImage = null_mut();
11657
11658 let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11659 utils::result(
11660 vips_op_response,
11661 VipsImage { ctx: out_out },
11662 Error::WebploadSourceError,
11663 )
11664 }
11665}
11666
11667#[derive(Clone, Debug)]
11669pub struct WebploadSourceOptions {
11670 pub page: i32,
11673 pub n: i32,
11676 pub scale: f64,
11679 pub flags: ForeignFlags,
11686 pub memory: bool,
11689 pub access: Access,
11695 pub fail_on: FailOn,
11702 pub revalidate: bool,
11705}
11706
11707impl std::default::Default for WebploadSourceOptions {
11708 fn default() -> Self {
11709 WebploadSourceOptions {
11710 page: i32::from(0),
11711 n: i32::from(1),
11712 scale: f64::from(1),
11713 flags: ForeignFlags::None,
11714 memory: false,
11715 access: Access::Random,
11716 fail_on: FailOn::None,
11717 revalidate: false,
11718 }
11719 }
11720}
11721
11722pub fn webpload_source_with_opts(
11727 source: &VipsSource,
11728 webpload_source_options: &WebploadSourceOptions,
11729) -> Result<VipsImage> {
11730 unsafe {
11731 let source_in: *mut bindings::VipsSource = source.ctx;
11732 let mut out_out: *mut bindings::VipsImage = null_mut();
11733
11734 let page_in: i32 = webpload_source_options.page;
11735 let page_in_name = utils::new_c_string("page")?;
11736
11737 let n_in: i32 = webpload_source_options.n;
11738 let n_in_name = utils::new_c_string("n")?;
11739
11740 let scale_in: f64 = webpload_source_options.scale;
11741 let scale_in_name = utils::new_c_string("scale")?;
11742
11743 let flags_in: i32 = webpload_source_options.flags as i32;
11744 let flags_in_name = utils::new_c_string("flags")?;
11745
11746 let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11747 let memory_in_name = utils::new_c_string("memory")?;
11748
11749 let access_in: i32 = webpload_source_options.access as i32;
11750 let access_in_name = utils::new_c_string("access")?;
11751
11752 let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11753 let fail_on_in_name = utils::new_c_string("fail-on")?;
11754
11755 let revalidate_in: i32 = if webpload_source_options.revalidate {
11756 1
11757 } else {
11758 0
11759 };
11760 let revalidate_in_name = utils::new_c_string("revalidate")?;
11761
11762 let vips_op_response = bindings::vips_webpload_source(
11763 source_in,
11764 &mut out_out,
11765 page_in_name.as_ptr(),
11766 page_in,
11767 n_in_name.as_ptr(),
11768 n_in,
11769 scale_in_name.as_ptr(),
11770 scale_in,
11771 flags_in_name.as_ptr(),
11772 flags_in,
11773 memory_in_name.as_ptr(),
11774 memory_in,
11775 access_in_name.as_ptr(),
11776 access_in,
11777 fail_on_in_name.as_ptr(),
11778 fail_on_in,
11779 revalidate_in_name.as_ptr(),
11780 revalidate_in,
11781 NULL,
11782 );
11783 utils::result(
11784 vips_op_response,
11785 VipsImage { ctx: out_out },
11786 Error::WebploadSourceError,
11787 )
11788 }
11789}
11790
11791pub fn tiffload(filename: &str) -> Result<VipsImage> {
11795 unsafe {
11796 let filename_in: CString = utils::new_c_string(filename)?;
11797 let mut out_out: *mut bindings::VipsImage = null_mut();
11798
11799 let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11800 utils::result(
11801 vips_op_response,
11802 VipsImage { ctx: out_out },
11803 Error::TiffloadError,
11804 )
11805 }
11806}
11807
11808#[derive(Clone, Debug)]
11810pub struct TiffloadOptions {
11811 pub page: i32,
11814 pub n: i32,
11817 pub autorotate: bool,
11820 pub subifd: i32,
11823 pub unlimited: bool,
11826 pub flags: ForeignFlags,
11833 pub memory: bool,
11836 pub access: Access,
11842 pub fail_on: FailOn,
11849 pub revalidate: bool,
11852}
11853
11854impl std::default::Default for TiffloadOptions {
11855 fn default() -> Self {
11856 TiffloadOptions {
11857 page: i32::from(0),
11858 n: i32::from(1),
11859 autorotate: false,
11860 subifd: i32::from(-1),
11861 unlimited: false,
11862 flags: ForeignFlags::None,
11863 memory: false,
11864 access: Access::Random,
11865 fail_on: FailOn::None,
11866 revalidate: false,
11867 }
11868 }
11869}
11870
11871pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11876 unsafe {
11877 let filename_in: CString = utils::new_c_string(filename)?;
11878 let mut out_out: *mut bindings::VipsImage = null_mut();
11879
11880 let page_in: i32 = tiffload_options.page;
11881 let page_in_name = utils::new_c_string("page")?;
11882
11883 let n_in: i32 = tiffload_options.n;
11884 let n_in_name = utils::new_c_string("n")?;
11885
11886 let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11887 let autorotate_in_name = utils::new_c_string("autorotate")?;
11888
11889 let subifd_in: i32 = tiffload_options.subifd;
11890 let subifd_in_name = utils::new_c_string("subifd")?;
11891
11892 let unlimited_in: i32 = if tiffload_options.unlimited { 1 } else { 0 };
11893 let unlimited_in_name = utils::new_c_string("unlimited")?;
11894
11895 let flags_in: i32 = tiffload_options.flags as i32;
11896 let flags_in_name = utils::new_c_string("flags")?;
11897
11898 let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11899 let memory_in_name = utils::new_c_string("memory")?;
11900
11901 let access_in: i32 = tiffload_options.access as i32;
11902 let access_in_name = utils::new_c_string("access")?;
11903
11904 let fail_on_in: i32 = tiffload_options.fail_on as i32;
11905 let fail_on_in_name = utils::new_c_string("fail-on")?;
11906
11907 let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11908 let revalidate_in_name = utils::new_c_string("revalidate")?;
11909
11910 let vips_op_response = bindings::vips_tiffload(
11911 filename_in.as_ptr(),
11912 &mut out_out,
11913 page_in_name.as_ptr(),
11914 page_in,
11915 n_in_name.as_ptr(),
11916 n_in,
11917 autorotate_in_name.as_ptr(),
11918 autorotate_in,
11919 subifd_in_name.as_ptr(),
11920 subifd_in,
11921 unlimited_in_name.as_ptr(),
11922 unlimited_in,
11923 flags_in_name.as_ptr(),
11924 flags_in,
11925 memory_in_name.as_ptr(),
11926 memory_in,
11927 access_in_name.as_ptr(),
11928 access_in,
11929 fail_on_in_name.as_ptr(),
11930 fail_on_in,
11931 revalidate_in_name.as_ptr(),
11932 revalidate_in,
11933 NULL,
11934 );
11935 utils::result(
11936 vips_op_response,
11937 VipsImage { ctx: out_out },
11938 Error::TiffloadError,
11939 )
11940 }
11941}
11942
11943pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11947 unsafe {
11948 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11949 let mut out_out: *mut bindings::VipsImage = null_mut();
11950
11951 let vips_op_response =
11952 bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11953 utils::result(
11954 vips_op_response,
11955 VipsImage { ctx: out_out },
11956 Error::TiffloadBufferError,
11957 )
11958 }
11959}
11960
11961#[derive(Clone, Debug)]
11963pub struct TiffloadBufferOptions {
11964 pub page: i32,
11967 pub n: i32,
11970 pub autorotate: bool,
11973 pub subifd: i32,
11976 pub unlimited: bool,
11979 pub flags: ForeignFlags,
11986 pub memory: bool,
11989 pub access: Access,
11995 pub fail_on: FailOn,
12002 pub revalidate: bool,
12005}
12006
12007impl std::default::Default for TiffloadBufferOptions {
12008 fn default() -> Self {
12009 TiffloadBufferOptions {
12010 page: i32::from(0),
12011 n: i32::from(1),
12012 autorotate: false,
12013 subifd: i32::from(-1),
12014 unlimited: false,
12015 flags: ForeignFlags::None,
12016 memory: false,
12017 access: Access::Random,
12018 fail_on: FailOn::None,
12019 revalidate: false,
12020 }
12021 }
12022}
12023
12024pub fn tiffload_buffer_with_opts(
12029 buffer: &[u8],
12030 tiffload_buffer_options: &TiffloadBufferOptions,
12031) -> Result<VipsImage> {
12032 unsafe {
12033 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12034 let mut out_out: *mut bindings::VipsImage = null_mut();
12035
12036 let page_in: i32 = tiffload_buffer_options.page;
12037 let page_in_name = utils::new_c_string("page")?;
12038
12039 let n_in: i32 = tiffload_buffer_options.n;
12040 let n_in_name = utils::new_c_string("n")?;
12041
12042 let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
12043 1
12044 } else {
12045 0
12046 };
12047 let autorotate_in_name = utils::new_c_string("autorotate")?;
12048
12049 let subifd_in: i32 = tiffload_buffer_options.subifd;
12050 let subifd_in_name = utils::new_c_string("subifd")?;
12051
12052 let unlimited_in: i32 = if tiffload_buffer_options.unlimited {
12053 1
12054 } else {
12055 0
12056 };
12057 let unlimited_in_name = utils::new_c_string("unlimited")?;
12058
12059 let flags_in: i32 = tiffload_buffer_options.flags as i32;
12060 let flags_in_name = utils::new_c_string("flags")?;
12061
12062 let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
12063 let memory_in_name = utils::new_c_string("memory")?;
12064
12065 let access_in: i32 = tiffload_buffer_options.access as i32;
12066 let access_in_name = utils::new_c_string("access")?;
12067
12068 let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
12069 let fail_on_in_name = utils::new_c_string("fail-on")?;
12070
12071 let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
12072 1
12073 } else {
12074 0
12075 };
12076 let revalidate_in_name = utils::new_c_string("revalidate")?;
12077
12078 let vips_op_response = bindings::vips_tiffload_buffer(
12079 buffer_in,
12080 buffer.len() as u64,
12081 &mut out_out,
12082 page_in_name.as_ptr(),
12083 page_in,
12084 n_in_name.as_ptr(),
12085 n_in,
12086 autorotate_in_name.as_ptr(),
12087 autorotate_in,
12088 subifd_in_name.as_ptr(),
12089 subifd_in,
12090 unlimited_in_name.as_ptr(),
12091 unlimited_in,
12092 flags_in_name.as_ptr(),
12093 flags_in,
12094 memory_in_name.as_ptr(),
12095 memory_in,
12096 access_in_name.as_ptr(),
12097 access_in,
12098 fail_on_in_name.as_ptr(),
12099 fail_on_in,
12100 revalidate_in_name.as_ptr(),
12101 revalidate_in,
12102 NULL,
12103 );
12104 utils::result(
12105 vips_op_response,
12106 VipsImage { ctx: out_out },
12107 Error::TiffloadBufferError,
12108 )
12109 }
12110}
12111
12112pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
12116 unsafe {
12117 let source_in: *mut bindings::VipsSource = source.ctx;
12118 let mut out_out: *mut bindings::VipsImage = null_mut();
12119
12120 let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
12121 utils::result(
12122 vips_op_response,
12123 VipsImage { ctx: out_out },
12124 Error::TiffloadSourceError,
12125 )
12126 }
12127}
12128
12129#[derive(Clone, Debug)]
12131pub struct TiffloadSourceOptions {
12132 pub page: i32,
12135 pub n: i32,
12138 pub autorotate: bool,
12141 pub subifd: i32,
12144 pub unlimited: bool,
12147 pub flags: ForeignFlags,
12154 pub memory: bool,
12157 pub access: Access,
12163 pub fail_on: FailOn,
12170 pub revalidate: bool,
12173}
12174
12175impl std::default::Default for TiffloadSourceOptions {
12176 fn default() -> Self {
12177 TiffloadSourceOptions {
12178 page: i32::from(0),
12179 n: i32::from(1),
12180 autorotate: false,
12181 subifd: i32::from(-1),
12182 unlimited: false,
12183 flags: ForeignFlags::None,
12184 memory: false,
12185 access: Access::Random,
12186 fail_on: FailOn::None,
12187 revalidate: false,
12188 }
12189 }
12190}
12191
12192pub fn tiffload_source_with_opts(
12197 source: &VipsSource,
12198 tiffload_source_options: &TiffloadSourceOptions,
12199) -> Result<VipsImage> {
12200 unsafe {
12201 let source_in: *mut bindings::VipsSource = source.ctx;
12202 let mut out_out: *mut bindings::VipsImage = null_mut();
12203
12204 let page_in: i32 = tiffload_source_options.page;
12205 let page_in_name = utils::new_c_string("page")?;
12206
12207 let n_in: i32 = tiffload_source_options.n;
12208 let n_in_name = utils::new_c_string("n")?;
12209
12210 let autorotate_in: i32 = if tiffload_source_options.autorotate {
12211 1
12212 } else {
12213 0
12214 };
12215 let autorotate_in_name = utils::new_c_string("autorotate")?;
12216
12217 let subifd_in: i32 = tiffload_source_options.subifd;
12218 let subifd_in_name = utils::new_c_string("subifd")?;
12219
12220 let unlimited_in: i32 = if tiffload_source_options.unlimited {
12221 1
12222 } else {
12223 0
12224 };
12225 let unlimited_in_name = utils::new_c_string("unlimited")?;
12226
12227 let flags_in: i32 = tiffload_source_options.flags as i32;
12228 let flags_in_name = utils::new_c_string("flags")?;
12229
12230 let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12231 let memory_in_name = utils::new_c_string("memory")?;
12232
12233 let access_in: i32 = tiffload_source_options.access as i32;
12234 let access_in_name = utils::new_c_string("access")?;
12235
12236 let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12237 let fail_on_in_name = utils::new_c_string("fail-on")?;
12238
12239 let revalidate_in: i32 = if tiffload_source_options.revalidate {
12240 1
12241 } else {
12242 0
12243 };
12244 let revalidate_in_name = utils::new_c_string("revalidate")?;
12245
12246 let vips_op_response = bindings::vips_tiffload_source(
12247 source_in,
12248 &mut out_out,
12249 page_in_name.as_ptr(),
12250 page_in,
12251 n_in_name.as_ptr(),
12252 n_in,
12253 autorotate_in_name.as_ptr(),
12254 autorotate_in,
12255 subifd_in_name.as_ptr(),
12256 subifd_in,
12257 unlimited_in_name.as_ptr(),
12258 unlimited_in,
12259 flags_in_name.as_ptr(),
12260 flags_in,
12261 memory_in_name.as_ptr(),
12262 memory_in,
12263 access_in_name.as_ptr(),
12264 access_in,
12265 fail_on_in_name.as_ptr(),
12266 fail_on_in,
12267 revalidate_in_name.as_ptr(),
12268 revalidate_in,
12269 NULL,
12270 );
12271 utils::result(
12272 vips_op_response,
12273 VipsImage { ctx: out_out },
12274 Error::TiffloadSourceError,
12275 )
12276 }
12277}
12278
12279pub fn heifload(filename: &str) -> Result<VipsImage> {
12283 unsafe {
12284 let filename_in: CString = utils::new_c_string(filename)?;
12285 let mut out_out: *mut bindings::VipsImage = null_mut();
12286
12287 let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12288 utils::result(
12289 vips_op_response,
12290 VipsImage { ctx: out_out },
12291 Error::HeifloadError,
12292 )
12293 }
12294}
12295
12296#[derive(Clone, Debug)]
12298pub struct HeifloadOptions {
12299 pub page: i32,
12302 pub n: i32,
12305 pub thumbnail: bool,
12308 pub unlimited: bool,
12311 pub flags: ForeignFlags,
12318 pub memory: bool,
12321 pub access: Access,
12327 pub fail_on: FailOn,
12334 pub revalidate: bool,
12337}
12338
12339impl std::default::Default for HeifloadOptions {
12340 fn default() -> Self {
12341 HeifloadOptions {
12342 page: i32::from(0),
12343 n: i32::from(1),
12344 thumbnail: false,
12345 unlimited: false,
12346 flags: ForeignFlags::None,
12347 memory: false,
12348 access: Access::Random,
12349 fail_on: FailOn::None,
12350 revalidate: false,
12351 }
12352 }
12353}
12354
12355pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
12360 unsafe {
12361 let filename_in: CString = utils::new_c_string(filename)?;
12362 let mut out_out: *mut bindings::VipsImage = null_mut();
12363
12364 let page_in: i32 = heifload_options.page;
12365 let page_in_name = utils::new_c_string("page")?;
12366
12367 let n_in: i32 = heifload_options.n;
12368 let n_in_name = utils::new_c_string("n")?;
12369
12370 let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
12371 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12372
12373 let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
12374 let unlimited_in_name = utils::new_c_string("unlimited")?;
12375
12376 let flags_in: i32 = heifload_options.flags as i32;
12377 let flags_in_name = utils::new_c_string("flags")?;
12378
12379 let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12380 let memory_in_name = utils::new_c_string("memory")?;
12381
12382 let access_in: i32 = heifload_options.access as i32;
12383 let access_in_name = utils::new_c_string("access")?;
12384
12385 let fail_on_in: i32 = heifload_options.fail_on as i32;
12386 let fail_on_in_name = utils::new_c_string("fail-on")?;
12387
12388 let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12389 let revalidate_in_name = utils::new_c_string("revalidate")?;
12390
12391 let vips_op_response = bindings::vips_heifload(
12392 filename_in.as_ptr(),
12393 &mut out_out,
12394 page_in_name.as_ptr(),
12395 page_in,
12396 n_in_name.as_ptr(),
12397 n_in,
12398 thumbnail_in_name.as_ptr(),
12399 thumbnail_in,
12400 unlimited_in_name.as_ptr(),
12401 unlimited_in,
12402 flags_in_name.as_ptr(),
12403 flags_in,
12404 memory_in_name.as_ptr(),
12405 memory_in,
12406 access_in_name.as_ptr(),
12407 access_in,
12408 fail_on_in_name.as_ptr(),
12409 fail_on_in,
12410 revalidate_in_name.as_ptr(),
12411 revalidate_in,
12412 NULL,
12413 );
12414 utils::result(
12415 vips_op_response,
12416 VipsImage { ctx: out_out },
12417 Error::HeifloadError,
12418 )
12419 }
12420}
12421
12422pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12426 unsafe {
12427 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12428 let mut out_out: *mut bindings::VipsImage = null_mut();
12429
12430 let vips_op_response =
12431 bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12432 utils::result(
12433 vips_op_response,
12434 VipsImage { ctx: out_out },
12435 Error::HeifloadBufferError,
12436 )
12437 }
12438}
12439
12440#[derive(Clone, Debug)]
12442pub struct HeifloadBufferOptions {
12443 pub page: i32,
12446 pub n: i32,
12449 pub thumbnail: bool,
12452 pub unlimited: bool,
12455 pub flags: ForeignFlags,
12462 pub memory: bool,
12465 pub access: Access,
12471 pub fail_on: FailOn,
12478 pub revalidate: bool,
12481}
12482
12483impl std::default::Default for HeifloadBufferOptions {
12484 fn default() -> Self {
12485 HeifloadBufferOptions {
12486 page: i32::from(0),
12487 n: i32::from(1),
12488 thumbnail: false,
12489 unlimited: false,
12490 flags: ForeignFlags::None,
12491 memory: false,
12492 access: Access::Random,
12493 fail_on: FailOn::None,
12494 revalidate: false,
12495 }
12496 }
12497}
12498
12499pub fn heifload_buffer_with_opts(
12504 buffer: &[u8],
12505 heifload_buffer_options: &HeifloadBufferOptions,
12506) -> Result<VipsImage> {
12507 unsafe {
12508 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12509 let mut out_out: *mut bindings::VipsImage = null_mut();
12510
12511 let page_in: i32 = heifload_buffer_options.page;
12512 let page_in_name = utils::new_c_string("page")?;
12513
12514 let n_in: i32 = heifload_buffer_options.n;
12515 let n_in_name = utils::new_c_string("n")?;
12516
12517 let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12518 1
12519 } else {
12520 0
12521 };
12522 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12523
12524 let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12525 1
12526 } else {
12527 0
12528 };
12529 let unlimited_in_name = utils::new_c_string("unlimited")?;
12530
12531 let flags_in: i32 = heifload_buffer_options.flags as i32;
12532 let flags_in_name = utils::new_c_string("flags")?;
12533
12534 let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12535 let memory_in_name = utils::new_c_string("memory")?;
12536
12537 let access_in: i32 = heifload_buffer_options.access as i32;
12538 let access_in_name = utils::new_c_string("access")?;
12539
12540 let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12541 let fail_on_in_name = utils::new_c_string("fail-on")?;
12542
12543 let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12544 1
12545 } else {
12546 0
12547 };
12548 let revalidate_in_name = utils::new_c_string("revalidate")?;
12549
12550 let vips_op_response = bindings::vips_heifload_buffer(
12551 buffer_in,
12552 buffer.len() as u64,
12553 &mut out_out,
12554 page_in_name.as_ptr(),
12555 page_in,
12556 n_in_name.as_ptr(),
12557 n_in,
12558 thumbnail_in_name.as_ptr(),
12559 thumbnail_in,
12560 unlimited_in_name.as_ptr(),
12561 unlimited_in,
12562 flags_in_name.as_ptr(),
12563 flags_in,
12564 memory_in_name.as_ptr(),
12565 memory_in,
12566 access_in_name.as_ptr(),
12567 access_in,
12568 fail_on_in_name.as_ptr(),
12569 fail_on_in,
12570 revalidate_in_name.as_ptr(),
12571 revalidate_in,
12572 NULL,
12573 );
12574 utils::result(
12575 vips_op_response,
12576 VipsImage { ctx: out_out },
12577 Error::HeifloadBufferError,
12578 )
12579 }
12580}
12581
12582pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12586 unsafe {
12587 let source_in: *mut bindings::VipsSource = source.ctx;
12588 let mut out_out: *mut bindings::VipsImage = null_mut();
12589
12590 let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12591 utils::result(
12592 vips_op_response,
12593 VipsImage { ctx: out_out },
12594 Error::HeifloadSourceError,
12595 )
12596 }
12597}
12598
12599#[derive(Clone, Debug)]
12601pub struct HeifloadSourceOptions {
12602 pub page: i32,
12605 pub n: i32,
12608 pub thumbnail: bool,
12611 pub unlimited: bool,
12614 pub flags: ForeignFlags,
12621 pub memory: bool,
12624 pub access: Access,
12630 pub fail_on: FailOn,
12637 pub revalidate: bool,
12640}
12641
12642impl std::default::Default for HeifloadSourceOptions {
12643 fn default() -> Self {
12644 HeifloadSourceOptions {
12645 page: i32::from(0),
12646 n: i32::from(1),
12647 thumbnail: false,
12648 unlimited: false,
12649 flags: ForeignFlags::None,
12650 memory: false,
12651 access: Access::Random,
12652 fail_on: FailOn::None,
12653 revalidate: false,
12654 }
12655 }
12656}
12657
12658pub fn heifload_source_with_opts(
12663 source: &VipsSource,
12664 heifload_source_options: &HeifloadSourceOptions,
12665) -> Result<VipsImage> {
12666 unsafe {
12667 let source_in: *mut bindings::VipsSource = source.ctx;
12668 let mut out_out: *mut bindings::VipsImage = null_mut();
12669
12670 let page_in: i32 = heifload_source_options.page;
12671 let page_in_name = utils::new_c_string("page")?;
12672
12673 let n_in: i32 = heifload_source_options.n;
12674 let n_in_name = utils::new_c_string("n")?;
12675
12676 let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12677 1
12678 } else {
12679 0
12680 };
12681 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12682
12683 let unlimited_in: i32 = if heifload_source_options.unlimited {
12684 1
12685 } else {
12686 0
12687 };
12688 let unlimited_in_name = utils::new_c_string("unlimited")?;
12689
12690 let flags_in: i32 = heifload_source_options.flags as i32;
12691 let flags_in_name = utils::new_c_string("flags")?;
12692
12693 let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12694 let memory_in_name = utils::new_c_string("memory")?;
12695
12696 let access_in: i32 = heifload_source_options.access as i32;
12697 let access_in_name = utils::new_c_string("access")?;
12698
12699 let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12700 let fail_on_in_name = utils::new_c_string("fail-on")?;
12701
12702 let revalidate_in: i32 = if heifload_source_options.revalidate {
12703 1
12704 } else {
12705 0
12706 };
12707 let revalidate_in_name = utils::new_c_string("revalidate")?;
12708
12709 let vips_op_response = bindings::vips_heifload_source(
12710 source_in,
12711 &mut out_out,
12712 page_in_name.as_ptr(),
12713 page_in,
12714 n_in_name.as_ptr(),
12715 n_in,
12716 thumbnail_in_name.as_ptr(),
12717 thumbnail_in,
12718 unlimited_in_name.as_ptr(),
12719 unlimited_in,
12720 flags_in_name.as_ptr(),
12721 flags_in,
12722 memory_in_name.as_ptr(),
12723 memory_in,
12724 access_in_name.as_ptr(),
12725 access_in,
12726 fail_on_in_name.as_ptr(),
12727 fail_on_in,
12728 revalidate_in_name.as_ptr(),
12729 revalidate_in,
12730 NULL,
12731 );
12732 utils::result(
12733 vips_op_response,
12734 VipsImage { ctx: out_out },
12735 Error::HeifloadSourceError,
12736 )
12737 }
12738}
12739
12740pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12745 unsafe {
12746 let inp_in: *mut bindings::VipsImage = inp.ctx;
12747 let filename_in: CString = utils::new_c_string(filename)?;
12748
12749 let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12750 utils::result(vips_op_response, (), Error::CsvsaveError)
12751 }
12752}
12753
12754#[derive(Clone, Debug)]
12756pub struct CsvsaveOptions {
12757 pub separator: String,
12759 pub keep: ForeignKeep,
12768 pub background: Vec<f64>,
12770 pub page_height: i32,
12773 pub profile: String,
12775}
12776
12777impl std::default::Default for CsvsaveOptions {
12778 fn default() -> Self {
12779 CsvsaveOptions {
12780 separator: String::new(),
12781 keep: ForeignKeep::All,
12782 background: Vec::new(),
12783 page_height: i32::from(0),
12784 profile: String::from("sRGB"),
12785 }
12786 }
12787}
12788
12789pub fn csvsave_with_opts(
12795 inp: &VipsImage,
12796 filename: &str,
12797 csvsave_options: &CsvsaveOptions,
12798) -> Result<()> {
12799 unsafe {
12800 let inp_in: *mut bindings::VipsImage = inp.ctx;
12801 let filename_in: CString = utils::new_c_string(filename)?;
12802
12803 let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12804 let separator_in_name = utils::new_c_string("separator")?;
12805
12806 let keep_in: i32 = csvsave_options.keep as i32;
12807 let keep_in_name = utils::new_c_string("keep")?;
12808
12809 let background_wrapper =
12810 utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12811 let background_in = background_wrapper.ctx;
12812 let background_in_name = utils::new_c_string("background")?;
12813
12814 let page_height_in: i32 = csvsave_options.page_height;
12815 let page_height_in_name = utils::new_c_string("page-height")?;
12816
12817 let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12818 let profile_in_name = utils::new_c_string("profile")?;
12819
12820 let vips_op_response = bindings::vips_csvsave(
12821 inp_in,
12822 filename_in.as_ptr(),
12823 separator_in_name.as_ptr(),
12824 separator_in.as_ptr(),
12825 keep_in_name.as_ptr(),
12826 keep_in,
12827 background_in_name.as_ptr(),
12828 background_in,
12829 page_height_in_name.as_ptr(),
12830 page_height_in,
12831 profile_in_name.as_ptr(),
12832 profile_in.as_ptr(),
12833 NULL,
12834 );
12835 utils::result(vips_op_response, (), Error::CsvsaveError)
12836 }
12837}
12838
12839pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12844 unsafe {
12845 let inp_in: *mut bindings::VipsImage = inp.ctx;
12846 let target_in: *mut bindings::VipsTarget = target.ctx;
12847
12848 let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12849 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12850 }
12851}
12852
12853#[derive(Clone, Debug)]
12855pub struct CsvsaveTargetOptions {
12856 pub separator: String,
12858 pub keep: ForeignKeep,
12867 pub background: Vec<f64>,
12869 pub page_height: i32,
12872 pub profile: String,
12874}
12875
12876impl std::default::Default for CsvsaveTargetOptions {
12877 fn default() -> Self {
12878 CsvsaveTargetOptions {
12879 separator: String::new(),
12880 keep: ForeignKeep::All,
12881 background: Vec::new(),
12882 page_height: i32::from(0),
12883 profile: String::from("sRGB"),
12884 }
12885 }
12886}
12887
12888pub fn csvsave_target_with_opts(
12894 inp: &VipsImage,
12895 target: &VipsTarget,
12896 csvsave_target_options: &CsvsaveTargetOptions,
12897) -> Result<()> {
12898 unsafe {
12899 let inp_in: *mut bindings::VipsImage = inp.ctx;
12900 let target_in: *mut bindings::VipsTarget = target.ctx;
12901
12902 let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12903 let separator_in_name = utils::new_c_string("separator")?;
12904
12905 let keep_in: i32 = csvsave_target_options.keep as i32;
12906 let keep_in_name = utils::new_c_string("keep")?;
12907
12908 let background_wrapper =
12909 utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12910 let background_in = background_wrapper.ctx;
12911 let background_in_name = utils::new_c_string("background")?;
12912
12913 let page_height_in: i32 = csvsave_target_options.page_height;
12914 let page_height_in_name = utils::new_c_string("page-height")?;
12915
12916 let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12917 let profile_in_name = utils::new_c_string("profile")?;
12918
12919 let vips_op_response = bindings::vips_csvsave_target(
12920 inp_in,
12921 target_in,
12922 separator_in_name.as_ptr(),
12923 separator_in.as_ptr(),
12924 keep_in_name.as_ptr(),
12925 keep_in,
12926 background_in_name.as_ptr(),
12927 background_in,
12928 page_height_in_name.as_ptr(),
12929 page_height_in,
12930 profile_in_name.as_ptr(),
12931 profile_in.as_ptr(),
12932 NULL,
12933 );
12934 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12935 }
12936}
12937
12938pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12943 unsafe {
12944 let inp_in: *mut bindings::VipsImage = inp.ctx;
12945 let filename_in: CString = utils::new_c_string(filename)?;
12946
12947 let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12948 utils::result(vips_op_response, (), Error::MatrixsaveError)
12949 }
12950}
12951
12952#[derive(Clone, Debug)]
12954pub struct MatrixsaveOptions {
12955 pub keep: ForeignKeep,
12964 pub background: Vec<f64>,
12966 pub page_height: i32,
12969 pub profile: String,
12971}
12972
12973impl std::default::Default for MatrixsaveOptions {
12974 fn default() -> Self {
12975 MatrixsaveOptions {
12976 keep: ForeignKeep::All,
12977 background: Vec::new(),
12978 page_height: i32::from(0),
12979 profile: String::from("sRGB"),
12980 }
12981 }
12982}
12983
12984pub fn matrixsave_with_opts(
12990 inp: &VipsImage,
12991 filename: &str,
12992 matrixsave_options: &MatrixsaveOptions,
12993) -> Result<()> {
12994 unsafe {
12995 let inp_in: *mut bindings::VipsImage = inp.ctx;
12996 let filename_in: CString = utils::new_c_string(filename)?;
12997
12998 let keep_in: i32 = matrixsave_options.keep as i32;
12999 let keep_in_name = utils::new_c_string("keep")?;
13000
13001 let background_wrapper =
13002 utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
13003 let background_in = background_wrapper.ctx;
13004 let background_in_name = utils::new_c_string("background")?;
13005
13006 let page_height_in: i32 = matrixsave_options.page_height;
13007 let page_height_in_name = utils::new_c_string("page-height")?;
13008
13009 let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
13010 let profile_in_name = utils::new_c_string("profile")?;
13011
13012 let vips_op_response = bindings::vips_matrixsave(
13013 inp_in,
13014 filename_in.as_ptr(),
13015 keep_in_name.as_ptr(),
13016 keep_in,
13017 background_in_name.as_ptr(),
13018 background_in,
13019 page_height_in_name.as_ptr(),
13020 page_height_in,
13021 profile_in_name.as_ptr(),
13022 profile_in.as_ptr(),
13023 NULL,
13024 );
13025 utils::result(vips_op_response, (), Error::MatrixsaveError)
13026 }
13027}
13028
13029pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13034 unsafe {
13035 let inp_in: *mut bindings::VipsImage = inp.ctx;
13036 let target_in: *mut bindings::VipsTarget = target.ctx;
13037
13038 let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
13039 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
13040 }
13041}
13042
13043#[derive(Clone, Debug)]
13045pub struct MatrixsaveTargetOptions {
13046 pub keep: ForeignKeep,
13055 pub background: Vec<f64>,
13057 pub page_height: i32,
13060 pub profile: String,
13062}
13063
13064impl std::default::Default for MatrixsaveTargetOptions {
13065 fn default() -> Self {
13066 MatrixsaveTargetOptions {
13067 keep: ForeignKeep::All,
13068 background: Vec::new(),
13069 page_height: i32::from(0),
13070 profile: String::from("sRGB"),
13071 }
13072 }
13073}
13074
13075pub fn matrixsave_target_with_opts(
13081 inp: &VipsImage,
13082 target: &VipsTarget,
13083 matrixsave_target_options: &MatrixsaveTargetOptions,
13084) -> Result<()> {
13085 unsafe {
13086 let inp_in: *mut bindings::VipsImage = inp.ctx;
13087 let target_in: *mut bindings::VipsTarget = target.ctx;
13088
13089 let keep_in: i32 = matrixsave_target_options.keep as i32;
13090 let keep_in_name = utils::new_c_string("keep")?;
13091
13092 let background_wrapper =
13093 utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
13094 let background_in = background_wrapper.ctx;
13095 let background_in_name = utils::new_c_string("background")?;
13096
13097 let page_height_in: i32 = matrixsave_target_options.page_height;
13098 let page_height_in_name = utils::new_c_string("page-height")?;
13099
13100 let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
13101 let profile_in_name = utils::new_c_string("profile")?;
13102
13103 let vips_op_response = bindings::vips_matrixsave_target(
13104 inp_in,
13105 target_in,
13106 keep_in_name.as_ptr(),
13107 keep_in,
13108 background_in_name.as_ptr(),
13109 background_in,
13110 page_height_in_name.as_ptr(),
13111 page_height_in,
13112 profile_in_name.as_ptr(),
13113 profile_in.as_ptr(),
13114 NULL,
13115 );
13116 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
13117 }
13118}
13119
13120pub fn matrixprint(inp: &VipsImage) -> Result<()> {
13124 unsafe {
13125 let inp_in: *mut bindings::VipsImage = inp.ctx;
13126
13127 let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
13128 utils::result(vips_op_response, (), Error::MatrixprintError)
13129 }
13130}
13131
13132#[derive(Clone, Debug)]
13134pub struct MatrixprintOptions {
13135 pub keep: ForeignKeep,
13144 pub background: Vec<f64>,
13146 pub page_height: i32,
13149 pub profile: String,
13151}
13152
13153impl std::default::Default for MatrixprintOptions {
13154 fn default() -> Self {
13155 MatrixprintOptions {
13156 keep: ForeignKeep::All,
13157 background: Vec::new(),
13158 page_height: i32::from(0),
13159 profile: String::from("sRGB"),
13160 }
13161 }
13162}
13163
13164pub fn matrixprint_with_opts(
13169 inp: &VipsImage,
13170 matrixprint_options: &MatrixprintOptions,
13171) -> Result<()> {
13172 unsafe {
13173 let inp_in: *mut bindings::VipsImage = inp.ctx;
13174
13175 let keep_in: i32 = matrixprint_options.keep as i32;
13176 let keep_in_name = utils::new_c_string("keep")?;
13177
13178 let background_wrapper =
13179 utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
13180 let background_in = background_wrapper.ctx;
13181 let background_in_name = utils::new_c_string("background")?;
13182
13183 let page_height_in: i32 = matrixprint_options.page_height;
13184 let page_height_in_name = utils::new_c_string("page-height")?;
13185
13186 let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
13187 let profile_in_name = utils::new_c_string("profile")?;
13188
13189 let vips_op_response = bindings::vips_matrixprint(
13190 inp_in,
13191 keep_in_name.as_ptr(),
13192 keep_in,
13193 background_in_name.as_ptr(),
13194 background_in,
13195 page_height_in_name.as_ptr(),
13196 page_height_in,
13197 profile_in_name.as_ptr(),
13198 profile_in.as_ptr(),
13199 NULL,
13200 );
13201 utils::result(vips_op_response, (), Error::MatrixprintError)
13202 }
13203}
13204
13205pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
13210 unsafe {
13211 let inp_in: *mut bindings::VipsImage = inp.ctx;
13212 let filename_in: CString = utils::new_c_string(filename)?;
13213
13214 let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
13215 utils::result(vips_op_response, (), Error::RawsaveError)
13216 }
13217}
13218
13219#[derive(Clone, Debug)]
13221pub struct RawsaveOptions {
13222 pub keep: ForeignKeep,
13231 pub background: Vec<f64>,
13233 pub page_height: i32,
13236 pub profile: String,
13238}
13239
13240impl std::default::Default for RawsaveOptions {
13241 fn default() -> Self {
13242 RawsaveOptions {
13243 keep: ForeignKeep::All,
13244 background: Vec::new(),
13245 page_height: i32::from(0),
13246 profile: String::from("sRGB"),
13247 }
13248 }
13249}
13250
13251pub fn rawsave_with_opts(
13257 inp: &VipsImage,
13258 filename: &str,
13259 rawsave_options: &RawsaveOptions,
13260) -> Result<()> {
13261 unsafe {
13262 let inp_in: *mut bindings::VipsImage = inp.ctx;
13263 let filename_in: CString = utils::new_c_string(filename)?;
13264
13265 let keep_in: i32 = rawsave_options.keep as i32;
13266 let keep_in_name = utils::new_c_string("keep")?;
13267
13268 let background_wrapper =
13269 utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
13270 let background_in = background_wrapper.ctx;
13271 let background_in_name = utils::new_c_string("background")?;
13272
13273 let page_height_in: i32 = rawsave_options.page_height;
13274 let page_height_in_name = utils::new_c_string("page-height")?;
13275
13276 let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
13277 let profile_in_name = utils::new_c_string("profile")?;
13278
13279 let vips_op_response = bindings::vips_rawsave(
13280 inp_in,
13281 filename_in.as_ptr(),
13282 keep_in_name.as_ptr(),
13283 keep_in,
13284 background_in_name.as_ptr(),
13285 background_in,
13286 page_height_in_name.as_ptr(),
13287 page_height_in,
13288 profile_in_name.as_ptr(),
13289 profile_in.as_ptr(),
13290 NULL,
13291 );
13292 utils::result(vips_op_response, (), Error::RawsaveError)
13293 }
13294}
13295
13296pub fn rawsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13300 unsafe {
13301 let inp_in: *mut bindings::VipsImage = inp.ctx;
13302 let mut buffer_buf_size: u64 = 0;
13303 let mut buffer_out: *mut c_void = null_mut();
13304
13305 let vips_op_response =
13306 bindings::vips_rawsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13307 utils::result(
13308 vips_op_response,
13309 utils::new_byte_array(buffer_out, buffer_buf_size),
13310 Error::RawsaveBufferError,
13311 )
13312 }
13313}
13314
13315#[derive(Clone, Debug)]
13317pub struct RawsaveBufferOptions {
13318 pub keep: ForeignKeep,
13327 pub background: Vec<f64>,
13329 pub page_height: i32,
13332 pub profile: String,
13334}
13335
13336impl std::default::Default for RawsaveBufferOptions {
13337 fn default() -> Self {
13338 RawsaveBufferOptions {
13339 keep: ForeignKeep::All,
13340 background: Vec::new(),
13341 page_height: i32::from(0),
13342 profile: String::from("sRGB"),
13343 }
13344 }
13345}
13346
13347pub fn rawsave_buffer_with_opts(
13352 inp: &VipsImage,
13353 rawsave_buffer_options: &RawsaveBufferOptions,
13354) -> Result<Vec<u8>> {
13355 unsafe {
13356 let inp_in: *mut bindings::VipsImage = inp.ctx;
13357 let mut buffer_buf_size: u64 = 0;
13358 let mut buffer_out: *mut c_void = null_mut();
13359
13360 let keep_in: i32 = rawsave_buffer_options.keep as i32;
13361 let keep_in_name = utils::new_c_string("keep")?;
13362
13363 let background_wrapper =
13364 utils::VipsArrayDoubleWrapper::from(&rawsave_buffer_options.background[..]);
13365 let background_in = background_wrapper.ctx;
13366 let background_in_name = utils::new_c_string("background")?;
13367
13368 let page_height_in: i32 = rawsave_buffer_options.page_height;
13369 let page_height_in_name = utils::new_c_string("page-height")?;
13370
13371 let profile_in: CString = utils::new_c_string(&rawsave_buffer_options.profile)?;
13372 let profile_in_name = utils::new_c_string("profile")?;
13373
13374 let vips_op_response = bindings::vips_rawsave_buffer(
13375 inp_in,
13376 &mut buffer_out,
13377 &mut buffer_buf_size,
13378 keep_in_name.as_ptr(),
13379 keep_in,
13380 background_in_name.as_ptr(),
13381 background_in,
13382 page_height_in_name.as_ptr(),
13383 page_height_in,
13384 profile_in_name.as_ptr(),
13385 profile_in.as_ptr(),
13386 NULL,
13387 );
13388 utils::result(
13389 vips_op_response,
13390 utils::new_byte_array(buffer_out, buffer_buf_size),
13391 Error::RawsaveBufferError,
13392 )
13393 }
13394}
13395
13396pub fn rawsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13401 unsafe {
13402 let inp_in: *mut bindings::VipsImage = inp.ctx;
13403 let target_in: *mut bindings::VipsTarget = target.ctx;
13404
13405 let vips_op_response = bindings::vips_rawsave_target(inp_in, target_in, NULL);
13406 utils::result(vips_op_response, (), Error::RawsaveTargetError)
13407 }
13408}
13409
13410#[derive(Clone, Debug)]
13412pub struct RawsaveTargetOptions {
13413 pub keep: ForeignKeep,
13422 pub background: Vec<f64>,
13424 pub page_height: i32,
13427 pub profile: String,
13429}
13430
13431impl std::default::Default for RawsaveTargetOptions {
13432 fn default() -> Self {
13433 RawsaveTargetOptions {
13434 keep: ForeignKeep::All,
13435 background: Vec::new(),
13436 page_height: i32::from(0),
13437 profile: String::from("sRGB"),
13438 }
13439 }
13440}
13441
13442pub fn rawsave_target_with_opts(
13448 inp: &VipsImage,
13449 target: &VipsTarget,
13450 rawsave_target_options: &RawsaveTargetOptions,
13451) -> Result<()> {
13452 unsafe {
13453 let inp_in: *mut bindings::VipsImage = inp.ctx;
13454 let target_in: *mut bindings::VipsTarget = target.ctx;
13455
13456 let keep_in: i32 = rawsave_target_options.keep as i32;
13457 let keep_in_name = utils::new_c_string("keep")?;
13458
13459 let background_wrapper =
13460 utils::VipsArrayDoubleWrapper::from(&rawsave_target_options.background[..]);
13461 let background_in = background_wrapper.ctx;
13462 let background_in_name = utils::new_c_string("background")?;
13463
13464 let page_height_in: i32 = rawsave_target_options.page_height;
13465 let page_height_in_name = utils::new_c_string("page-height")?;
13466
13467 let profile_in: CString = utils::new_c_string(&rawsave_target_options.profile)?;
13468 let profile_in_name = utils::new_c_string("profile")?;
13469
13470 let vips_op_response = bindings::vips_rawsave_target(
13471 inp_in,
13472 target_in,
13473 keep_in_name.as_ptr(),
13474 keep_in,
13475 background_in_name.as_ptr(),
13476 background_in,
13477 page_height_in_name.as_ptr(),
13478 page_height_in,
13479 profile_in_name.as_ptr(),
13480 profile_in.as_ptr(),
13481 NULL,
13482 );
13483 utils::result(vips_op_response, (), Error::RawsaveTargetError)
13484 }
13485}
13486
13487pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13492 unsafe {
13493 let inp_in: *mut bindings::VipsImage = inp.ctx;
13494 let filename_in: CString = utils::new_c_string(filename)?;
13495
13496 let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13497 utils::result(vips_op_response, (), Error::VipssaveError)
13498 }
13499}
13500
13501#[derive(Clone, Debug)]
13503pub struct VipssaveOptions {
13504 pub keep: ForeignKeep,
13513 pub background: Vec<f64>,
13515 pub page_height: i32,
13518 pub profile: String,
13520}
13521
13522impl std::default::Default for VipssaveOptions {
13523 fn default() -> Self {
13524 VipssaveOptions {
13525 keep: ForeignKeep::All,
13526 background: Vec::new(),
13527 page_height: i32::from(0),
13528 profile: String::from("sRGB"),
13529 }
13530 }
13531}
13532
13533pub fn vipssave_with_opts(
13539 inp: &VipsImage,
13540 filename: &str,
13541 vipssave_options: &VipssaveOptions,
13542) -> Result<()> {
13543 unsafe {
13544 let inp_in: *mut bindings::VipsImage = inp.ctx;
13545 let filename_in: CString = utils::new_c_string(filename)?;
13546
13547 let keep_in: i32 = vipssave_options.keep as i32;
13548 let keep_in_name = utils::new_c_string("keep")?;
13549
13550 let background_wrapper =
13551 utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13552 let background_in = background_wrapper.ctx;
13553 let background_in_name = utils::new_c_string("background")?;
13554
13555 let page_height_in: i32 = vipssave_options.page_height;
13556 let page_height_in_name = utils::new_c_string("page-height")?;
13557
13558 let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13559 let profile_in_name = utils::new_c_string("profile")?;
13560
13561 let vips_op_response = bindings::vips_vipssave(
13562 inp_in,
13563 filename_in.as_ptr(),
13564 keep_in_name.as_ptr(),
13565 keep_in,
13566 background_in_name.as_ptr(),
13567 background_in,
13568 page_height_in_name.as_ptr(),
13569 page_height_in,
13570 profile_in_name.as_ptr(),
13571 profile_in.as_ptr(),
13572 NULL,
13573 );
13574 utils::result(vips_op_response, (), Error::VipssaveError)
13575 }
13576}
13577
13578pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13583 unsafe {
13584 let inp_in: *mut bindings::VipsImage = inp.ctx;
13585 let target_in: *mut bindings::VipsTarget = target.ctx;
13586
13587 let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13588 utils::result(vips_op_response, (), Error::VipssaveTargetError)
13589 }
13590}
13591
13592#[derive(Clone, Debug)]
13594pub struct VipssaveTargetOptions {
13595 pub keep: ForeignKeep,
13604 pub background: Vec<f64>,
13606 pub page_height: i32,
13609 pub profile: String,
13611}
13612
13613impl std::default::Default for VipssaveTargetOptions {
13614 fn default() -> Self {
13615 VipssaveTargetOptions {
13616 keep: ForeignKeep::All,
13617 background: Vec::new(),
13618 page_height: i32::from(0),
13619 profile: String::from("sRGB"),
13620 }
13621 }
13622}
13623
13624pub fn vipssave_target_with_opts(
13630 inp: &VipsImage,
13631 target: &VipsTarget,
13632 vipssave_target_options: &VipssaveTargetOptions,
13633) -> Result<()> {
13634 unsafe {
13635 let inp_in: *mut bindings::VipsImage = inp.ctx;
13636 let target_in: *mut bindings::VipsTarget = target.ctx;
13637
13638 let keep_in: i32 = vipssave_target_options.keep as i32;
13639 let keep_in_name = utils::new_c_string("keep")?;
13640
13641 let background_wrapper =
13642 utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13643 let background_in = background_wrapper.ctx;
13644 let background_in_name = utils::new_c_string("background")?;
13645
13646 let page_height_in: i32 = vipssave_target_options.page_height;
13647 let page_height_in_name = utils::new_c_string("page-height")?;
13648
13649 let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13650 let profile_in_name = utils::new_c_string("profile")?;
13651
13652 let vips_op_response = bindings::vips_vipssave_target(
13653 inp_in,
13654 target_in,
13655 keep_in_name.as_ptr(),
13656 keep_in,
13657 background_in_name.as_ptr(),
13658 background_in,
13659 page_height_in_name.as_ptr(),
13660 page_height_in,
13661 profile_in_name.as_ptr(),
13662 profile_in.as_ptr(),
13663 NULL,
13664 );
13665 utils::result(vips_op_response, (), Error::VipssaveTargetError)
13666 }
13667}
13668
13669pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13674 unsafe {
13675 let inp_in: *mut bindings::VipsImage = inp.ctx;
13676 let filename_in: CString = utils::new_c_string(filename)?;
13677
13678 let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13679 utils::result(vips_op_response, (), Error::PpmsaveError)
13680 }
13681}
13682
13683#[derive(Clone, Debug)]
13685pub struct PpmsaveOptions {
13686 pub format: ForeignPpmFormat,
13694 pub ascii: bool,
13697 pub bitdepth: i32,
13700 pub keep: ForeignKeep,
13709 pub background: Vec<f64>,
13711 pub page_height: i32,
13714 pub profile: String,
13716}
13717
13718impl std::default::Default for PpmsaveOptions {
13719 fn default() -> Self {
13720 PpmsaveOptions {
13721 format: ForeignPpmFormat::Ppm,
13722 ascii: false,
13723 bitdepth: i32::from(0),
13724 keep: ForeignKeep::All,
13725 background: Vec::new(),
13726 page_height: i32::from(0),
13727 profile: String::from("sRGB"),
13728 }
13729 }
13730}
13731
13732pub fn ppmsave_with_opts(
13738 inp: &VipsImage,
13739 filename: &str,
13740 ppmsave_options: &PpmsaveOptions,
13741) -> Result<()> {
13742 unsafe {
13743 let inp_in: *mut bindings::VipsImage = inp.ctx;
13744 let filename_in: CString = utils::new_c_string(filename)?;
13745
13746 let format_in: i32 = ppmsave_options.format as i32;
13747 let format_in_name = utils::new_c_string("format")?;
13748
13749 let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13750 let ascii_in_name = utils::new_c_string("ascii")?;
13751
13752 let bitdepth_in: i32 = ppmsave_options.bitdepth;
13753 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13754
13755 let keep_in: i32 = ppmsave_options.keep as i32;
13756 let keep_in_name = utils::new_c_string("keep")?;
13757
13758 let background_wrapper =
13759 utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13760 let background_in = background_wrapper.ctx;
13761 let background_in_name = utils::new_c_string("background")?;
13762
13763 let page_height_in: i32 = ppmsave_options.page_height;
13764 let page_height_in_name = utils::new_c_string("page-height")?;
13765
13766 let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13767 let profile_in_name = utils::new_c_string("profile")?;
13768
13769 let vips_op_response = bindings::vips_ppmsave(
13770 inp_in,
13771 filename_in.as_ptr(),
13772 format_in_name.as_ptr(),
13773 format_in,
13774 ascii_in_name.as_ptr(),
13775 ascii_in,
13776 bitdepth_in_name.as_ptr(),
13777 bitdepth_in,
13778 keep_in_name.as_ptr(),
13779 keep_in,
13780 background_in_name.as_ptr(),
13781 background_in,
13782 page_height_in_name.as_ptr(),
13783 page_height_in,
13784 profile_in_name.as_ptr(),
13785 profile_in.as_ptr(),
13786 NULL,
13787 );
13788 utils::result(vips_op_response, (), Error::PpmsaveError)
13789 }
13790}
13791
13792pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13797 unsafe {
13798 let inp_in: *mut bindings::VipsImage = inp.ctx;
13799 let target_in: *mut bindings::VipsTarget = target.ctx;
13800
13801 let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13802 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13803 }
13804}
13805
13806#[derive(Clone, Debug)]
13808pub struct PpmsaveTargetOptions {
13809 pub format: ForeignPpmFormat,
13817 pub ascii: bool,
13820 pub bitdepth: i32,
13823 pub keep: ForeignKeep,
13832 pub background: Vec<f64>,
13834 pub page_height: i32,
13837 pub profile: String,
13839}
13840
13841impl std::default::Default for PpmsaveTargetOptions {
13842 fn default() -> Self {
13843 PpmsaveTargetOptions {
13844 format: ForeignPpmFormat::Ppm,
13845 ascii: false,
13846 bitdepth: i32::from(0),
13847 keep: ForeignKeep::All,
13848 background: Vec::new(),
13849 page_height: i32::from(0),
13850 profile: String::from("sRGB"),
13851 }
13852 }
13853}
13854
13855pub fn ppmsave_target_with_opts(
13861 inp: &VipsImage,
13862 target: &VipsTarget,
13863 ppmsave_target_options: &PpmsaveTargetOptions,
13864) -> Result<()> {
13865 unsafe {
13866 let inp_in: *mut bindings::VipsImage = inp.ctx;
13867 let target_in: *mut bindings::VipsTarget = target.ctx;
13868
13869 let format_in: i32 = ppmsave_target_options.format as i32;
13870 let format_in_name = utils::new_c_string("format")?;
13871
13872 let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13873 let ascii_in_name = utils::new_c_string("ascii")?;
13874
13875 let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13876 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13877
13878 let keep_in: i32 = ppmsave_target_options.keep as i32;
13879 let keep_in_name = utils::new_c_string("keep")?;
13880
13881 let background_wrapper =
13882 utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13883 let background_in = background_wrapper.ctx;
13884 let background_in_name = utils::new_c_string("background")?;
13885
13886 let page_height_in: i32 = ppmsave_target_options.page_height;
13887 let page_height_in_name = utils::new_c_string("page-height")?;
13888
13889 let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13890 let profile_in_name = utils::new_c_string("profile")?;
13891
13892 let vips_op_response = bindings::vips_ppmsave_target(
13893 inp_in,
13894 target_in,
13895 format_in_name.as_ptr(),
13896 format_in,
13897 ascii_in_name.as_ptr(),
13898 ascii_in,
13899 bitdepth_in_name.as_ptr(),
13900 bitdepth_in,
13901 keep_in_name.as_ptr(),
13902 keep_in,
13903 background_in_name.as_ptr(),
13904 background_in,
13905 page_height_in_name.as_ptr(),
13906 page_height_in,
13907 profile_in_name.as_ptr(),
13908 profile_in.as_ptr(),
13909 NULL,
13910 );
13911 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13912 }
13913}
13914
13915pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13920 unsafe {
13921 let inp_in: *mut bindings::VipsImage = inp.ctx;
13922 let filename_in: CString = utils::new_c_string(filename)?;
13923
13924 let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13925 utils::result(vips_op_response, (), Error::RadsaveError)
13926 }
13927}
13928
13929#[derive(Clone, Debug)]
13931pub struct RadsaveOptions {
13932 pub keep: ForeignKeep,
13941 pub background: Vec<f64>,
13943 pub page_height: i32,
13946 pub profile: String,
13948}
13949
13950impl std::default::Default for RadsaveOptions {
13951 fn default() -> Self {
13952 RadsaveOptions {
13953 keep: ForeignKeep::All,
13954 background: Vec::new(),
13955 page_height: i32::from(0),
13956 profile: String::from("sRGB"),
13957 }
13958 }
13959}
13960
13961pub fn radsave_with_opts(
13967 inp: &VipsImage,
13968 filename: &str,
13969 radsave_options: &RadsaveOptions,
13970) -> Result<()> {
13971 unsafe {
13972 let inp_in: *mut bindings::VipsImage = inp.ctx;
13973 let filename_in: CString = utils::new_c_string(filename)?;
13974
13975 let keep_in: i32 = radsave_options.keep as i32;
13976 let keep_in_name = utils::new_c_string("keep")?;
13977
13978 let background_wrapper =
13979 utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13980 let background_in = background_wrapper.ctx;
13981 let background_in_name = utils::new_c_string("background")?;
13982
13983 let page_height_in: i32 = radsave_options.page_height;
13984 let page_height_in_name = utils::new_c_string("page-height")?;
13985
13986 let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13987 let profile_in_name = utils::new_c_string("profile")?;
13988
13989 let vips_op_response = bindings::vips_radsave(
13990 inp_in,
13991 filename_in.as_ptr(),
13992 keep_in_name.as_ptr(),
13993 keep_in,
13994 background_in_name.as_ptr(),
13995 background_in,
13996 page_height_in_name.as_ptr(),
13997 page_height_in,
13998 profile_in_name.as_ptr(),
13999 profile_in.as_ptr(),
14000 NULL,
14001 );
14002 utils::result(vips_op_response, (), Error::RadsaveError)
14003 }
14004}
14005
14006pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14010 unsafe {
14011 let inp_in: *mut bindings::VipsImage = inp.ctx;
14012 let mut buffer_buf_size: u64 = 0;
14013 let mut buffer_out: *mut c_void = null_mut();
14014
14015 let vips_op_response =
14016 bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14017 utils::result(
14018 vips_op_response,
14019 utils::new_byte_array(buffer_out, buffer_buf_size),
14020 Error::RadsaveBufferError,
14021 )
14022 }
14023}
14024
14025#[derive(Clone, Debug)]
14027pub struct RadsaveBufferOptions {
14028 pub keep: ForeignKeep,
14037 pub background: Vec<f64>,
14039 pub page_height: i32,
14042 pub profile: String,
14044}
14045
14046impl std::default::Default for RadsaveBufferOptions {
14047 fn default() -> Self {
14048 RadsaveBufferOptions {
14049 keep: ForeignKeep::All,
14050 background: Vec::new(),
14051 page_height: i32::from(0),
14052 profile: String::from("sRGB"),
14053 }
14054 }
14055}
14056
14057pub fn radsave_buffer_with_opts(
14062 inp: &VipsImage,
14063 radsave_buffer_options: &RadsaveBufferOptions,
14064) -> Result<Vec<u8>> {
14065 unsafe {
14066 let inp_in: *mut bindings::VipsImage = inp.ctx;
14067 let mut buffer_buf_size: u64 = 0;
14068 let mut buffer_out: *mut c_void = null_mut();
14069
14070 let keep_in: i32 = radsave_buffer_options.keep as i32;
14071 let keep_in_name = utils::new_c_string("keep")?;
14072
14073 let background_wrapper =
14074 utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
14075 let background_in = background_wrapper.ctx;
14076 let background_in_name = utils::new_c_string("background")?;
14077
14078 let page_height_in: i32 = radsave_buffer_options.page_height;
14079 let page_height_in_name = utils::new_c_string("page-height")?;
14080
14081 let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
14082 let profile_in_name = utils::new_c_string("profile")?;
14083
14084 let vips_op_response = bindings::vips_radsave_buffer(
14085 inp_in,
14086 &mut buffer_out,
14087 &mut buffer_buf_size,
14088 keep_in_name.as_ptr(),
14089 keep_in,
14090 background_in_name.as_ptr(),
14091 background_in,
14092 page_height_in_name.as_ptr(),
14093 page_height_in,
14094 profile_in_name.as_ptr(),
14095 profile_in.as_ptr(),
14096 NULL,
14097 );
14098 utils::result(
14099 vips_op_response,
14100 utils::new_byte_array(buffer_out, buffer_buf_size),
14101 Error::RadsaveBufferError,
14102 )
14103 }
14104}
14105
14106pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14111 unsafe {
14112 let inp_in: *mut bindings::VipsImage = inp.ctx;
14113 let target_in: *mut bindings::VipsTarget = target.ctx;
14114
14115 let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
14116 utils::result(vips_op_response, (), Error::RadsaveTargetError)
14117 }
14118}
14119
14120#[derive(Clone, Debug)]
14122pub struct RadsaveTargetOptions {
14123 pub keep: ForeignKeep,
14132 pub background: Vec<f64>,
14134 pub page_height: i32,
14137 pub profile: String,
14139}
14140
14141impl std::default::Default for RadsaveTargetOptions {
14142 fn default() -> Self {
14143 RadsaveTargetOptions {
14144 keep: ForeignKeep::All,
14145 background: Vec::new(),
14146 page_height: i32::from(0),
14147 profile: String::from("sRGB"),
14148 }
14149 }
14150}
14151
14152pub fn radsave_target_with_opts(
14158 inp: &VipsImage,
14159 target: &VipsTarget,
14160 radsave_target_options: &RadsaveTargetOptions,
14161) -> Result<()> {
14162 unsafe {
14163 let inp_in: *mut bindings::VipsImage = inp.ctx;
14164 let target_in: *mut bindings::VipsTarget = target.ctx;
14165
14166 let keep_in: i32 = radsave_target_options.keep as i32;
14167 let keep_in_name = utils::new_c_string("keep")?;
14168
14169 let background_wrapper =
14170 utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
14171 let background_in = background_wrapper.ctx;
14172 let background_in_name = utils::new_c_string("background")?;
14173
14174 let page_height_in: i32 = radsave_target_options.page_height;
14175 let page_height_in_name = utils::new_c_string("page-height")?;
14176
14177 let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
14178 let profile_in_name = utils::new_c_string("profile")?;
14179
14180 let vips_op_response = bindings::vips_radsave_target(
14181 inp_in,
14182 target_in,
14183 keep_in_name.as_ptr(),
14184 keep_in,
14185 background_in_name.as_ptr(),
14186 background_in,
14187 page_height_in_name.as_ptr(),
14188 page_height_in,
14189 profile_in_name.as_ptr(),
14190 profile_in.as_ptr(),
14191 NULL,
14192 );
14193 utils::result(vips_op_response, (), Error::RadsaveTargetError)
14194 }
14195}
14196
14197pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
14202 unsafe {
14203 let inp_in: *mut bindings::VipsImage = inp.ctx;
14204 let filename_in: CString = utils::new_c_string(filename)?;
14205
14206 let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
14207 utils::result(vips_op_response, (), Error::GifsaveError)
14208 }
14209}
14210
14211#[derive(Clone, Debug)]
14213pub struct GifsaveOptions {
14214 pub dither: f64,
14217 pub effort: i32,
14220 pub bitdepth: i32,
14223 pub interframe_maxerror: f64,
14226 pub reuse: bool,
14229 pub interpalette_maxerror: f64,
14232 pub interlace: bool,
14235 pub keep_duplicate_frames: bool,
14238 pub keep: ForeignKeep,
14247 pub background: Vec<f64>,
14249 pub page_height: i32,
14252 pub profile: String,
14254}
14255
14256impl std::default::Default for GifsaveOptions {
14257 fn default() -> Self {
14258 GifsaveOptions {
14259 dither: f64::from(1),
14260 effort: i32::from(7),
14261 bitdepth: i32::from(8),
14262 interframe_maxerror: f64::from(0),
14263 reuse: false,
14264 interpalette_maxerror: f64::from(3),
14265 interlace: false,
14266 keep_duplicate_frames: false,
14267 keep: ForeignKeep::All,
14268 background: Vec::new(),
14269 page_height: i32::from(0),
14270 profile: String::from("sRGB"),
14271 }
14272 }
14273}
14274
14275pub fn gifsave_with_opts(
14281 inp: &VipsImage,
14282 filename: &str,
14283 gifsave_options: &GifsaveOptions,
14284) -> Result<()> {
14285 unsafe {
14286 let inp_in: *mut bindings::VipsImage = inp.ctx;
14287 let filename_in: CString = utils::new_c_string(filename)?;
14288
14289 let dither_in: f64 = gifsave_options.dither;
14290 let dither_in_name = utils::new_c_string("dither")?;
14291
14292 let effort_in: i32 = gifsave_options.effort;
14293 let effort_in_name = utils::new_c_string("effort")?;
14294
14295 let bitdepth_in: i32 = gifsave_options.bitdepth;
14296 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14297
14298 let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
14299 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14300
14301 let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
14302 let reuse_in_name = utils::new_c_string("reuse")?;
14303
14304 let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
14305 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14306
14307 let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
14308 let interlace_in_name = utils::new_c_string("interlace")?;
14309
14310 let keep_duplicate_frames_in: i32 = if gifsave_options.keep_duplicate_frames {
14311 1
14312 } else {
14313 0
14314 };
14315 let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14316
14317 let keep_in: i32 = gifsave_options.keep as i32;
14318 let keep_in_name = utils::new_c_string("keep")?;
14319
14320 let background_wrapper =
14321 utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
14322 let background_in = background_wrapper.ctx;
14323 let background_in_name = utils::new_c_string("background")?;
14324
14325 let page_height_in: i32 = gifsave_options.page_height;
14326 let page_height_in_name = utils::new_c_string("page-height")?;
14327
14328 let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
14329 let profile_in_name = utils::new_c_string("profile")?;
14330
14331 let vips_op_response = bindings::vips_gifsave(
14332 inp_in,
14333 filename_in.as_ptr(),
14334 dither_in_name.as_ptr(),
14335 dither_in,
14336 effort_in_name.as_ptr(),
14337 effort_in,
14338 bitdepth_in_name.as_ptr(),
14339 bitdepth_in,
14340 interframe_maxerror_in_name.as_ptr(),
14341 interframe_maxerror_in,
14342 reuse_in_name.as_ptr(),
14343 reuse_in,
14344 interpalette_maxerror_in_name.as_ptr(),
14345 interpalette_maxerror_in,
14346 interlace_in_name.as_ptr(),
14347 interlace_in,
14348 keep_duplicate_frames_in_name.as_ptr(),
14349 keep_duplicate_frames_in,
14350 keep_in_name.as_ptr(),
14351 keep_in,
14352 background_in_name.as_ptr(),
14353 background_in,
14354 page_height_in_name.as_ptr(),
14355 page_height_in,
14356 profile_in_name.as_ptr(),
14357 profile_in.as_ptr(),
14358 NULL,
14359 );
14360 utils::result(vips_op_response, (), Error::GifsaveError)
14361 }
14362}
14363
14364pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14368 unsafe {
14369 let inp_in: *mut bindings::VipsImage = inp.ctx;
14370 let mut buffer_buf_size: u64 = 0;
14371 let mut buffer_out: *mut c_void = null_mut();
14372
14373 let vips_op_response =
14374 bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14375 utils::result(
14376 vips_op_response,
14377 utils::new_byte_array(buffer_out, buffer_buf_size),
14378 Error::GifsaveBufferError,
14379 )
14380 }
14381}
14382
14383#[derive(Clone, Debug)]
14385pub struct GifsaveBufferOptions {
14386 pub dither: f64,
14389 pub effort: i32,
14392 pub bitdepth: i32,
14395 pub interframe_maxerror: f64,
14398 pub reuse: bool,
14401 pub interpalette_maxerror: f64,
14404 pub interlace: bool,
14407 pub keep_duplicate_frames: bool,
14410 pub keep: ForeignKeep,
14419 pub background: Vec<f64>,
14421 pub page_height: i32,
14424 pub profile: String,
14426}
14427
14428impl std::default::Default for GifsaveBufferOptions {
14429 fn default() -> Self {
14430 GifsaveBufferOptions {
14431 dither: f64::from(1),
14432 effort: i32::from(7),
14433 bitdepth: i32::from(8),
14434 interframe_maxerror: f64::from(0),
14435 reuse: false,
14436 interpalette_maxerror: f64::from(3),
14437 interlace: false,
14438 keep_duplicate_frames: false,
14439 keep: ForeignKeep::All,
14440 background: Vec::new(),
14441 page_height: i32::from(0),
14442 profile: String::from("sRGB"),
14443 }
14444 }
14445}
14446
14447pub fn gifsave_buffer_with_opts(
14452 inp: &VipsImage,
14453 gifsave_buffer_options: &GifsaveBufferOptions,
14454) -> Result<Vec<u8>> {
14455 unsafe {
14456 let inp_in: *mut bindings::VipsImage = inp.ctx;
14457 let mut buffer_buf_size: u64 = 0;
14458 let mut buffer_out: *mut c_void = null_mut();
14459
14460 let dither_in: f64 = gifsave_buffer_options.dither;
14461 let dither_in_name = utils::new_c_string("dither")?;
14462
14463 let effort_in: i32 = gifsave_buffer_options.effort;
14464 let effort_in_name = utils::new_c_string("effort")?;
14465
14466 let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
14467 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14468
14469 let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
14470 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14471
14472 let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
14473 let reuse_in_name = utils::new_c_string("reuse")?;
14474
14475 let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
14476 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14477
14478 let interlace_in: i32 = if gifsave_buffer_options.interlace {
14479 1
14480 } else {
14481 0
14482 };
14483 let interlace_in_name = utils::new_c_string("interlace")?;
14484
14485 let keep_duplicate_frames_in: i32 = if gifsave_buffer_options.keep_duplicate_frames {
14486 1
14487 } else {
14488 0
14489 };
14490 let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14491
14492 let keep_in: i32 = gifsave_buffer_options.keep as i32;
14493 let keep_in_name = utils::new_c_string("keep")?;
14494
14495 let background_wrapper =
14496 utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
14497 let background_in = background_wrapper.ctx;
14498 let background_in_name = utils::new_c_string("background")?;
14499
14500 let page_height_in: i32 = gifsave_buffer_options.page_height;
14501 let page_height_in_name = utils::new_c_string("page-height")?;
14502
14503 let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14504 let profile_in_name = utils::new_c_string("profile")?;
14505
14506 let vips_op_response = bindings::vips_gifsave_buffer(
14507 inp_in,
14508 &mut buffer_out,
14509 &mut buffer_buf_size,
14510 dither_in_name.as_ptr(),
14511 dither_in,
14512 effort_in_name.as_ptr(),
14513 effort_in,
14514 bitdepth_in_name.as_ptr(),
14515 bitdepth_in,
14516 interframe_maxerror_in_name.as_ptr(),
14517 interframe_maxerror_in,
14518 reuse_in_name.as_ptr(),
14519 reuse_in,
14520 interpalette_maxerror_in_name.as_ptr(),
14521 interpalette_maxerror_in,
14522 interlace_in_name.as_ptr(),
14523 interlace_in,
14524 keep_duplicate_frames_in_name.as_ptr(),
14525 keep_duplicate_frames_in,
14526 keep_in_name.as_ptr(),
14527 keep_in,
14528 background_in_name.as_ptr(),
14529 background_in,
14530 page_height_in_name.as_ptr(),
14531 page_height_in,
14532 profile_in_name.as_ptr(),
14533 profile_in.as_ptr(),
14534 NULL,
14535 );
14536 utils::result(
14537 vips_op_response,
14538 utils::new_byte_array(buffer_out, buffer_buf_size),
14539 Error::GifsaveBufferError,
14540 )
14541 }
14542}
14543
14544pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14549 unsafe {
14550 let inp_in: *mut bindings::VipsImage = inp.ctx;
14551 let target_in: *mut bindings::VipsTarget = target.ctx;
14552
14553 let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14554 utils::result(vips_op_response, (), Error::GifsaveTargetError)
14555 }
14556}
14557
14558#[derive(Clone, Debug)]
14560pub struct GifsaveTargetOptions {
14561 pub dither: f64,
14564 pub effort: i32,
14567 pub bitdepth: i32,
14570 pub interframe_maxerror: f64,
14573 pub reuse: bool,
14576 pub interpalette_maxerror: f64,
14579 pub interlace: bool,
14582 pub keep_duplicate_frames: bool,
14585 pub keep: ForeignKeep,
14594 pub background: Vec<f64>,
14596 pub page_height: i32,
14599 pub profile: String,
14601}
14602
14603impl std::default::Default for GifsaveTargetOptions {
14604 fn default() -> Self {
14605 GifsaveTargetOptions {
14606 dither: f64::from(1),
14607 effort: i32::from(7),
14608 bitdepth: i32::from(8),
14609 interframe_maxerror: f64::from(0),
14610 reuse: false,
14611 interpalette_maxerror: f64::from(3),
14612 interlace: false,
14613 keep_duplicate_frames: false,
14614 keep: ForeignKeep::All,
14615 background: Vec::new(),
14616 page_height: i32::from(0),
14617 profile: String::from("sRGB"),
14618 }
14619 }
14620}
14621
14622pub fn gifsave_target_with_opts(
14628 inp: &VipsImage,
14629 target: &VipsTarget,
14630 gifsave_target_options: &GifsaveTargetOptions,
14631) -> Result<()> {
14632 unsafe {
14633 let inp_in: *mut bindings::VipsImage = inp.ctx;
14634 let target_in: *mut bindings::VipsTarget = target.ctx;
14635
14636 let dither_in: f64 = gifsave_target_options.dither;
14637 let dither_in_name = utils::new_c_string("dither")?;
14638
14639 let effort_in: i32 = gifsave_target_options.effort;
14640 let effort_in_name = utils::new_c_string("effort")?;
14641
14642 let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14643 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14644
14645 let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14646 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14647
14648 let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14649 let reuse_in_name = utils::new_c_string("reuse")?;
14650
14651 let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14652 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14653
14654 let interlace_in: i32 = if gifsave_target_options.interlace {
14655 1
14656 } else {
14657 0
14658 };
14659 let interlace_in_name = utils::new_c_string("interlace")?;
14660
14661 let keep_duplicate_frames_in: i32 = if gifsave_target_options.keep_duplicate_frames {
14662 1
14663 } else {
14664 0
14665 };
14666 let keep_duplicate_frames_in_name = utils::new_c_string("keep-duplicate-frames")?;
14667
14668 let keep_in: i32 = gifsave_target_options.keep as i32;
14669 let keep_in_name = utils::new_c_string("keep")?;
14670
14671 let background_wrapper =
14672 utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14673 let background_in = background_wrapper.ctx;
14674 let background_in_name = utils::new_c_string("background")?;
14675
14676 let page_height_in: i32 = gifsave_target_options.page_height;
14677 let page_height_in_name = utils::new_c_string("page-height")?;
14678
14679 let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14680 let profile_in_name = utils::new_c_string("profile")?;
14681
14682 let vips_op_response = bindings::vips_gifsave_target(
14683 inp_in,
14684 target_in,
14685 dither_in_name.as_ptr(),
14686 dither_in,
14687 effort_in_name.as_ptr(),
14688 effort_in,
14689 bitdepth_in_name.as_ptr(),
14690 bitdepth_in,
14691 interframe_maxerror_in_name.as_ptr(),
14692 interframe_maxerror_in,
14693 reuse_in_name.as_ptr(),
14694 reuse_in,
14695 interpalette_maxerror_in_name.as_ptr(),
14696 interpalette_maxerror_in,
14697 interlace_in_name.as_ptr(),
14698 interlace_in,
14699 keep_duplicate_frames_in_name.as_ptr(),
14700 keep_duplicate_frames_in,
14701 keep_in_name.as_ptr(),
14702 keep_in,
14703 background_in_name.as_ptr(),
14704 background_in,
14705 page_height_in_name.as_ptr(),
14706 page_height_in,
14707 profile_in_name.as_ptr(),
14708 profile_in.as_ptr(),
14709 NULL,
14710 );
14711 utils::result(vips_op_response, (), Error::GifsaveTargetError)
14712 }
14713}
14714
14715pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14720 unsafe {
14721 let inp_in: *mut bindings::VipsImage = inp.ctx;
14722 let filename_in: CString = utils::new_c_string(filename)?;
14723
14724 let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14725 utils::result(vips_op_response, (), Error::PngsaveError)
14726 }
14727}
14728
14729#[derive(Clone, Debug)]
14731pub struct PngsaveOptions {
14732 pub compression: i32,
14735 pub interlace: bool,
14738 pub filter: ForeignPngFilter,
14746 pub palette: bool,
14749 pub q: i32,
14752 pub dither: f64,
14755 pub bitdepth: i32,
14758 pub effort: i32,
14761 pub keep: ForeignKeep,
14770 pub background: Vec<f64>,
14772 pub page_height: i32,
14775 pub profile: String,
14777}
14778
14779impl std::default::Default for PngsaveOptions {
14780 fn default() -> Self {
14781 PngsaveOptions {
14782 compression: i32::from(6),
14783 interlace: false,
14784 filter: ForeignPngFilter::None,
14785 palette: false,
14786 q: i32::from(100),
14787 dither: f64::from(1),
14788 bitdepth: i32::from(8),
14789 effort: i32::from(7),
14790 keep: ForeignKeep::All,
14791 background: Vec::new(),
14792 page_height: i32::from(0),
14793 profile: String::from("sRGB"),
14794 }
14795 }
14796}
14797
14798pub fn pngsave_with_opts(
14804 inp: &VipsImage,
14805 filename: &str,
14806 pngsave_options: &PngsaveOptions,
14807) -> Result<()> {
14808 unsafe {
14809 let inp_in: *mut bindings::VipsImage = inp.ctx;
14810 let filename_in: CString = utils::new_c_string(filename)?;
14811
14812 let compression_in: i32 = pngsave_options.compression;
14813 let compression_in_name = utils::new_c_string("compression")?;
14814
14815 let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14816 let interlace_in_name = utils::new_c_string("interlace")?;
14817
14818 let filter_in: i32 = pngsave_options.filter as i32;
14819 let filter_in_name = utils::new_c_string("filter")?;
14820
14821 let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14822 let palette_in_name = utils::new_c_string("palette")?;
14823
14824 let q_in: i32 = pngsave_options.q;
14825 let q_in_name = utils::new_c_string("Q")?;
14826
14827 let dither_in: f64 = pngsave_options.dither;
14828 let dither_in_name = utils::new_c_string("dither")?;
14829
14830 let bitdepth_in: i32 = pngsave_options.bitdepth;
14831 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14832
14833 let effort_in: i32 = pngsave_options.effort;
14834 let effort_in_name = utils::new_c_string("effort")?;
14835
14836 let keep_in: i32 = pngsave_options.keep as i32;
14837 let keep_in_name = utils::new_c_string("keep")?;
14838
14839 let background_wrapper =
14840 utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14841 let background_in = background_wrapper.ctx;
14842 let background_in_name = utils::new_c_string("background")?;
14843
14844 let page_height_in: i32 = pngsave_options.page_height;
14845 let page_height_in_name = utils::new_c_string("page-height")?;
14846
14847 let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14848 let profile_in_name = utils::new_c_string("profile")?;
14849
14850 let vips_op_response = bindings::vips_pngsave(
14851 inp_in,
14852 filename_in.as_ptr(),
14853 compression_in_name.as_ptr(),
14854 compression_in,
14855 interlace_in_name.as_ptr(),
14856 interlace_in,
14857 filter_in_name.as_ptr(),
14858 filter_in,
14859 palette_in_name.as_ptr(),
14860 palette_in,
14861 q_in_name.as_ptr(),
14862 q_in,
14863 dither_in_name.as_ptr(),
14864 dither_in,
14865 bitdepth_in_name.as_ptr(),
14866 bitdepth_in,
14867 effort_in_name.as_ptr(),
14868 effort_in,
14869 keep_in_name.as_ptr(),
14870 keep_in,
14871 background_in_name.as_ptr(),
14872 background_in,
14873 page_height_in_name.as_ptr(),
14874 page_height_in,
14875 profile_in_name.as_ptr(),
14876 profile_in.as_ptr(),
14877 NULL,
14878 );
14879 utils::result(vips_op_response, (), Error::PngsaveError)
14880 }
14881}
14882
14883pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14887 unsafe {
14888 let inp_in: *mut bindings::VipsImage = inp.ctx;
14889 let mut buffer_buf_size: u64 = 0;
14890 let mut buffer_out: *mut c_void = null_mut();
14891
14892 let vips_op_response =
14893 bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14894 utils::result(
14895 vips_op_response,
14896 utils::new_byte_array(buffer_out, buffer_buf_size),
14897 Error::PngsaveBufferError,
14898 )
14899 }
14900}
14901
14902#[derive(Clone, Debug)]
14904pub struct PngsaveBufferOptions {
14905 pub compression: i32,
14908 pub interlace: bool,
14911 pub filter: ForeignPngFilter,
14919 pub palette: bool,
14922 pub q: i32,
14925 pub dither: f64,
14928 pub bitdepth: i32,
14931 pub effort: i32,
14934 pub keep: ForeignKeep,
14943 pub background: Vec<f64>,
14945 pub page_height: i32,
14948 pub profile: String,
14950}
14951
14952impl std::default::Default for PngsaveBufferOptions {
14953 fn default() -> Self {
14954 PngsaveBufferOptions {
14955 compression: i32::from(6),
14956 interlace: false,
14957 filter: ForeignPngFilter::None,
14958 palette: false,
14959 q: i32::from(100),
14960 dither: f64::from(1),
14961 bitdepth: i32::from(8),
14962 effort: i32::from(7),
14963 keep: ForeignKeep::All,
14964 background: Vec::new(),
14965 page_height: i32::from(0),
14966 profile: String::from("sRGB"),
14967 }
14968 }
14969}
14970
14971pub fn pngsave_buffer_with_opts(
14976 inp: &VipsImage,
14977 pngsave_buffer_options: &PngsaveBufferOptions,
14978) -> Result<Vec<u8>> {
14979 unsafe {
14980 let inp_in: *mut bindings::VipsImage = inp.ctx;
14981 let mut buffer_buf_size: u64 = 0;
14982 let mut buffer_out: *mut c_void = null_mut();
14983
14984 let compression_in: i32 = pngsave_buffer_options.compression;
14985 let compression_in_name = utils::new_c_string("compression")?;
14986
14987 let interlace_in: i32 = if pngsave_buffer_options.interlace {
14988 1
14989 } else {
14990 0
14991 };
14992 let interlace_in_name = utils::new_c_string("interlace")?;
14993
14994 let filter_in: i32 = pngsave_buffer_options.filter as i32;
14995 let filter_in_name = utils::new_c_string("filter")?;
14996
14997 let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14998 let palette_in_name = utils::new_c_string("palette")?;
14999
15000 let q_in: i32 = pngsave_buffer_options.q;
15001 let q_in_name = utils::new_c_string("Q")?;
15002
15003 let dither_in: f64 = pngsave_buffer_options.dither;
15004 let dither_in_name = utils::new_c_string("dither")?;
15005
15006 let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
15007 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15008
15009 let effort_in: i32 = pngsave_buffer_options.effort;
15010 let effort_in_name = utils::new_c_string("effort")?;
15011
15012 let keep_in: i32 = pngsave_buffer_options.keep as i32;
15013 let keep_in_name = utils::new_c_string("keep")?;
15014
15015 let background_wrapper =
15016 utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
15017 let background_in = background_wrapper.ctx;
15018 let background_in_name = utils::new_c_string("background")?;
15019
15020 let page_height_in: i32 = pngsave_buffer_options.page_height;
15021 let page_height_in_name = utils::new_c_string("page-height")?;
15022
15023 let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
15024 let profile_in_name = utils::new_c_string("profile")?;
15025
15026 let vips_op_response = bindings::vips_pngsave_buffer(
15027 inp_in,
15028 &mut buffer_out,
15029 &mut buffer_buf_size,
15030 compression_in_name.as_ptr(),
15031 compression_in,
15032 interlace_in_name.as_ptr(),
15033 interlace_in,
15034 filter_in_name.as_ptr(),
15035 filter_in,
15036 palette_in_name.as_ptr(),
15037 palette_in,
15038 q_in_name.as_ptr(),
15039 q_in,
15040 dither_in_name.as_ptr(),
15041 dither_in,
15042 bitdepth_in_name.as_ptr(),
15043 bitdepth_in,
15044 effort_in_name.as_ptr(),
15045 effort_in,
15046 keep_in_name.as_ptr(),
15047 keep_in,
15048 background_in_name.as_ptr(),
15049 background_in,
15050 page_height_in_name.as_ptr(),
15051 page_height_in,
15052 profile_in_name.as_ptr(),
15053 profile_in.as_ptr(),
15054 NULL,
15055 );
15056 utils::result(
15057 vips_op_response,
15058 utils::new_byte_array(buffer_out, buffer_buf_size),
15059 Error::PngsaveBufferError,
15060 )
15061 }
15062}
15063
15064pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15069 unsafe {
15070 let inp_in: *mut bindings::VipsImage = inp.ctx;
15071 let target_in: *mut bindings::VipsTarget = target.ctx;
15072
15073 let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
15074 utils::result(vips_op_response, (), Error::PngsaveTargetError)
15075 }
15076}
15077
15078#[derive(Clone, Debug)]
15080pub struct PngsaveTargetOptions {
15081 pub compression: i32,
15084 pub interlace: bool,
15087 pub filter: ForeignPngFilter,
15095 pub palette: bool,
15098 pub q: i32,
15101 pub dither: f64,
15104 pub bitdepth: i32,
15107 pub effort: i32,
15110 pub keep: ForeignKeep,
15119 pub background: Vec<f64>,
15121 pub page_height: i32,
15124 pub profile: String,
15126}
15127
15128impl std::default::Default for PngsaveTargetOptions {
15129 fn default() -> Self {
15130 PngsaveTargetOptions {
15131 compression: i32::from(6),
15132 interlace: false,
15133 filter: ForeignPngFilter::None,
15134 palette: false,
15135 q: i32::from(100),
15136 dither: f64::from(1),
15137 bitdepth: i32::from(8),
15138 effort: i32::from(7),
15139 keep: ForeignKeep::All,
15140 background: Vec::new(),
15141 page_height: i32::from(0),
15142 profile: String::from("sRGB"),
15143 }
15144 }
15145}
15146
15147pub fn pngsave_target_with_opts(
15153 inp: &VipsImage,
15154 target: &VipsTarget,
15155 pngsave_target_options: &PngsaveTargetOptions,
15156) -> Result<()> {
15157 unsafe {
15158 let inp_in: *mut bindings::VipsImage = inp.ctx;
15159 let target_in: *mut bindings::VipsTarget = target.ctx;
15160
15161 let compression_in: i32 = pngsave_target_options.compression;
15162 let compression_in_name = utils::new_c_string("compression")?;
15163
15164 let interlace_in: i32 = if pngsave_target_options.interlace {
15165 1
15166 } else {
15167 0
15168 };
15169 let interlace_in_name = utils::new_c_string("interlace")?;
15170
15171 let filter_in: i32 = pngsave_target_options.filter as i32;
15172 let filter_in_name = utils::new_c_string("filter")?;
15173
15174 let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
15175 let palette_in_name = utils::new_c_string("palette")?;
15176
15177 let q_in: i32 = pngsave_target_options.q;
15178 let q_in_name = utils::new_c_string("Q")?;
15179
15180 let dither_in: f64 = pngsave_target_options.dither;
15181 let dither_in_name = utils::new_c_string("dither")?;
15182
15183 let bitdepth_in: i32 = pngsave_target_options.bitdepth;
15184 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15185
15186 let effort_in: i32 = pngsave_target_options.effort;
15187 let effort_in_name = utils::new_c_string("effort")?;
15188
15189 let keep_in: i32 = pngsave_target_options.keep as i32;
15190 let keep_in_name = utils::new_c_string("keep")?;
15191
15192 let background_wrapper =
15193 utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
15194 let background_in = background_wrapper.ctx;
15195 let background_in_name = utils::new_c_string("background")?;
15196
15197 let page_height_in: i32 = pngsave_target_options.page_height;
15198 let page_height_in_name = utils::new_c_string("page-height")?;
15199
15200 let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
15201 let profile_in_name = utils::new_c_string("profile")?;
15202
15203 let vips_op_response = bindings::vips_pngsave_target(
15204 inp_in,
15205 target_in,
15206 compression_in_name.as_ptr(),
15207 compression_in,
15208 interlace_in_name.as_ptr(),
15209 interlace_in,
15210 filter_in_name.as_ptr(),
15211 filter_in,
15212 palette_in_name.as_ptr(),
15213 palette_in,
15214 q_in_name.as_ptr(),
15215 q_in,
15216 dither_in_name.as_ptr(),
15217 dither_in,
15218 bitdepth_in_name.as_ptr(),
15219 bitdepth_in,
15220 effort_in_name.as_ptr(),
15221 effort_in,
15222 keep_in_name.as_ptr(),
15223 keep_in,
15224 background_in_name.as_ptr(),
15225 background_in,
15226 page_height_in_name.as_ptr(),
15227 page_height_in,
15228 profile_in_name.as_ptr(),
15229 profile_in.as_ptr(),
15230 NULL,
15231 );
15232 utils::result(vips_op_response, (), Error::PngsaveTargetError)
15233 }
15234}
15235
15236pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
15241 unsafe {
15242 let inp_in: *mut bindings::VipsImage = inp.ctx;
15243 let filename_in: CString = utils::new_c_string(filename)?;
15244
15245 let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
15246 utils::result(vips_op_response, (), Error::JpegsaveError)
15247 }
15248}
15249
15250#[derive(Clone, Debug)]
15252pub struct JpegsaveOptions {
15253 pub q: i32,
15256 pub optimize_coding: bool,
15259 pub interlace: bool,
15262 pub trellis_quant: bool,
15265 pub overshoot_deringing: bool,
15268 pub optimize_scans: bool,
15271 pub quant_table: i32,
15274 pub subsample_mode: ForeignSubsample,
15280 pub restart_interval: i32,
15283 pub keep: ForeignKeep,
15292 pub background: Vec<f64>,
15294 pub page_height: i32,
15297 pub profile: String,
15299}
15300
15301impl std::default::Default for JpegsaveOptions {
15302 fn default() -> Self {
15303 JpegsaveOptions {
15304 q: i32::from(75),
15305 optimize_coding: false,
15306 interlace: false,
15307 trellis_quant: false,
15308 overshoot_deringing: false,
15309 optimize_scans: false,
15310 quant_table: i32::from(0),
15311 subsample_mode: ForeignSubsample::Auto,
15312 restart_interval: i32::from(0),
15313 keep: ForeignKeep::All,
15314 background: Vec::new(),
15315 page_height: i32::from(0),
15316 profile: String::from("sRGB"),
15317 }
15318 }
15319}
15320
15321pub fn jpegsave_with_opts(
15327 inp: &VipsImage,
15328 filename: &str,
15329 jpegsave_options: &JpegsaveOptions,
15330) -> Result<()> {
15331 unsafe {
15332 let inp_in: *mut bindings::VipsImage = inp.ctx;
15333 let filename_in: CString = utils::new_c_string(filename)?;
15334
15335 let q_in: i32 = jpegsave_options.q;
15336 let q_in_name = utils::new_c_string("Q")?;
15337
15338 let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
15339 1
15340 } else {
15341 0
15342 };
15343 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15344
15345 let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
15346 let interlace_in_name = utils::new_c_string("interlace")?;
15347
15348 let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
15349 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15350
15351 let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
15352 1
15353 } else {
15354 0
15355 };
15356 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15357
15358 let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
15359 1
15360 } else {
15361 0
15362 };
15363 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15364
15365 let quant_table_in: i32 = jpegsave_options.quant_table;
15366 let quant_table_in_name = utils::new_c_string("quant-table")?;
15367
15368 let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
15369 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15370
15371 let restart_interval_in: i32 = jpegsave_options.restart_interval;
15372 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15373
15374 let keep_in: i32 = jpegsave_options.keep as i32;
15375 let keep_in_name = utils::new_c_string("keep")?;
15376
15377 let background_wrapper =
15378 utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
15379 let background_in = background_wrapper.ctx;
15380 let background_in_name = utils::new_c_string("background")?;
15381
15382 let page_height_in: i32 = jpegsave_options.page_height;
15383 let page_height_in_name = utils::new_c_string("page-height")?;
15384
15385 let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
15386 let profile_in_name = utils::new_c_string("profile")?;
15387
15388 let vips_op_response = bindings::vips_jpegsave(
15389 inp_in,
15390 filename_in.as_ptr(),
15391 q_in_name.as_ptr(),
15392 q_in,
15393 optimize_coding_in_name.as_ptr(),
15394 optimize_coding_in,
15395 interlace_in_name.as_ptr(),
15396 interlace_in,
15397 trellis_quant_in_name.as_ptr(),
15398 trellis_quant_in,
15399 overshoot_deringing_in_name.as_ptr(),
15400 overshoot_deringing_in,
15401 optimize_scans_in_name.as_ptr(),
15402 optimize_scans_in,
15403 quant_table_in_name.as_ptr(),
15404 quant_table_in,
15405 subsample_mode_in_name.as_ptr(),
15406 subsample_mode_in,
15407 restart_interval_in_name.as_ptr(),
15408 restart_interval_in,
15409 keep_in_name.as_ptr(),
15410 keep_in,
15411 background_in_name.as_ptr(),
15412 background_in,
15413 page_height_in_name.as_ptr(),
15414 page_height_in,
15415 profile_in_name.as_ptr(),
15416 profile_in.as_ptr(),
15417 NULL,
15418 );
15419 utils::result(vips_op_response, (), Error::JpegsaveError)
15420 }
15421}
15422
15423pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15427 unsafe {
15428 let inp_in: *mut bindings::VipsImage = inp.ctx;
15429 let mut buffer_buf_size: u64 = 0;
15430 let mut buffer_out: *mut c_void = null_mut();
15431
15432 let vips_op_response =
15433 bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15434 utils::result(
15435 vips_op_response,
15436 utils::new_byte_array(buffer_out, buffer_buf_size),
15437 Error::JpegsaveBufferError,
15438 )
15439 }
15440}
15441
15442#[derive(Clone, Debug)]
15444pub struct JpegsaveBufferOptions {
15445 pub q: i32,
15448 pub optimize_coding: bool,
15451 pub interlace: bool,
15454 pub trellis_quant: bool,
15457 pub overshoot_deringing: bool,
15460 pub optimize_scans: bool,
15463 pub quant_table: i32,
15466 pub subsample_mode: ForeignSubsample,
15472 pub restart_interval: i32,
15475 pub keep: ForeignKeep,
15484 pub background: Vec<f64>,
15486 pub page_height: i32,
15489 pub profile: String,
15491}
15492
15493impl std::default::Default for JpegsaveBufferOptions {
15494 fn default() -> Self {
15495 JpegsaveBufferOptions {
15496 q: i32::from(75),
15497 optimize_coding: false,
15498 interlace: false,
15499 trellis_quant: false,
15500 overshoot_deringing: false,
15501 optimize_scans: false,
15502 quant_table: i32::from(0),
15503 subsample_mode: ForeignSubsample::Auto,
15504 restart_interval: i32::from(0),
15505 keep: ForeignKeep::All,
15506 background: Vec::new(),
15507 page_height: i32::from(0),
15508 profile: String::from("sRGB"),
15509 }
15510 }
15511}
15512
15513pub fn jpegsave_buffer_with_opts(
15518 inp: &VipsImage,
15519 jpegsave_buffer_options: &JpegsaveBufferOptions,
15520) -> Result<Vec<u8>> {
15521 unsafe {
15522 let inp_in: *mut bindings::VipsImage = inp.ctx;
15523 let mut buffer_buf_size: u64 = 0;
15524 let mut buffer_out: *mut c_void = null_mut();
15525
15526 let q_in: i32 = jpegsave_buffer_options.q;
15527 let q_in_name = utils::new_c_string("Q")?;
15528
15529 let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15530 1
15531 } else {
15532 0
15533 };
15534 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15535
15536 let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15537 1
15538 } else {
15539 0
15540 };
15541 let interlace_in_name = utils::new_c_string("interlace")?;
15542
15543 let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15544 1
15545 } else {
15546 0
15547 };
15548 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15549
15550 let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15551 1
15552 } else {
15553 0
15554 };
15555 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15556
15557 let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15558 1
15559 } else {
15560 0
15561 };
15562 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15563
15564 let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15565 let quant_table_in_name = utils::new_c_string("quant-table")?;
15566
15567 let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15568 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15569
15570 let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15571 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15572
15573 let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15574 let keep_in_name = utils::new_c_string("keep")?;
15575
15576 let background_wrapper =
15577 utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15578 let background_in = background_wrapper.ctx;
15579 let background_in_name = utils::new_c_string("background")?;
15580
15581 let page_height_in: i32 = jpegsave_buffer_options.page_height;
15582 let page_height_in_name = utils::new_c_string("page-height")?;
15583
15584 let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15585 let profile_in_name = utils::new_c_string("profile")?;
15586
15587 let vips_op_response = bindings::vips_jpegsave_buffer(
15588 inp_in,
15589 &mut buffer_out,
15590 &mut buffer_buf_size,
15591 q_in_name.as_ptr(),
15592 q_in,
15593 optimize_coding_in_name.as_ptr(),
15594 optimize_coding_in,
15595 interlace_in_name.as_ptr(),
15596 interlace_in,
15597 trellis_quant_in_name.as_ptr(),
15598 trellis_quant_in,
15599 overshoot_deringing_in_name.as_ptr(),
15600 overshoot_deringing_in,
15601 optimize_scans_in_name.as_ptr(),
15602 optimize_scans_in,
15603 quant_table_in_name.as_ptr(),
15604 quant_table_in,
15605 subsample_mode_in_name.as_ptr(),
15606 subsample_mode_in,
15607 restart_interval_in_name.as_ptr(),
15608 restart_interval_in,
15609 keep_in_name.as_ptr(),
15610 keep_in,
15611 background_in_name.as_ptr(),
15612 background_in,
15613 page_height_in_name.as_ptr(),
15614 page_height_in,
15615 profile_in_name.as_ptr(),
15616 profile_in.as_ptr(),
15617 NULL,
15618 );
15619 utils::result(
15620 vips_op_response,
15621 utils::new_byte_array(buffer_out, buffer_buf_size),
15622 Error::JpegsaveBufferError,
15623 )
15624 }
15625}
15626
15627pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15632 unsafe {
15633 let inp_in: *mut bindings::VipsImage = inp.ctx;
15634 let target_in: *mut bindings::VipsTarget = target.ctx;
15635
15636 let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15637 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15638 }
15639}
15640
15641#[derive(Clone, Debug)]
15643pub struct JpegsaveTargetOptions {
15644 pub q: i32,
15647 pub optimize_coding: bool,
15650 pub interlace: bool,
15653 pub trellis_quant: bool,
15656 pub overshoot_deringing: bool,
15659 pub optimize_scans: bool,
15662 pub quant_table: i32,
15665 pub subsample_mode: ForeignSubsample,
15671 pub restart_interval: i32,
15674 pub keep: ForeignKeep,
15683 pub background: Vec<f64>,
15685 pub page_height: i32,
15688 pub profile: String,
15690}
15691
15692impl std::default::Default for JpegsaveTargetOptions {
15693 fn default() -> Self {
15694 JpegsaveTargetOptions {
15695 q: i32::from(75),
15696 optimize_coding: false,
15697 interlace: false,
15698 trellis_quant: false,
15699 overshoot_deringing: false,
15700 optimize_scans: false,
15701 quant_table: i32::from(0),
15702 subsample_mode: ForeignSubsample::Auto,
15703 restart_interval: i32::from(0),
15704 keep: ForeignKeep::All,
15705 background: Vec::new(),
15706 page_height: i32::from(0),
15707 profile: String::from("sRGB"),
15708 }
15709 }
15710}
15711
15712pub fn jpegsave_target_with_opts(
15718 inp: &VipsImage,
15719 target: &VipsTarget,
15720 jpegsave_target_options: &JpegsaveTargetOptions,
15721) -> Result<()> {
15722 unsafe {
15723 let inp_in: *mut bindings::VipsImage = inp.ctx;
15724 let target_in: *mut bindings::VipsTarget = target.ctx;
15725
15726 let q_in: i32 = jpegsave_target_options.q;
15727 let q_in_name = utils::new_c_string("Q")?;
15728
15729 let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15730 1
15731 } else {
15732 0
15733 };
15734 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15735
15736 let interlace_in: i32 = if jpegsave_target_options.interlace {
15737 1
15738 } else {
15739 0
15740 };
15741 let interlace_in_name = utils::new_c_string("interlace")?;
15742
15743 let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15744 1
15745 } else {
15746 0
15747 };
15748 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15749
15750 let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15751 1
15752 } else {
15753 0
15754 };
15755 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15756
15757 let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15758 1
15759 } else {
15760 0
15761 };
15762 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15763
15764 let quant_table_in: i32 = jpegsave_target_options.quant_table;
15765 let quant_table_in_name = utils::new_c_string("quant-table")?;
15766
15767 let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15768 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15769
15770 let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15771 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15772
15773 let keep_in: i32 = jpegsave_target_options.keep as i32;
15774 let keep_in_name = utils::new_c_string("keep")?;
15775
15776 let background_wrapper =
15777 utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15778 let background_in = background_wrapper.ctx;
15779 let background_in_name = utils::new_c_string("background")?;
15780
15781 let page_height_in: i32 = jpegsave_target_options.page_height;
15782 let page_height_in_name = utils::new_c_string("page-height")?;
15783
15784 let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15785 let profile_in_name = utils::new_c_string("profile")?;
15786
15787 let vips_op_response = bindings::vips_jpegsave_target(
15788 inp_in,
15789 target_in,
15790 q_in_name.as_ptr(),
15791 q_in,
15792 optimize_coding_in_name.as_ptr(),
15793 optimize_coding_in,
15794 interlace_in_name.as_ptr(),
15795 interlace_in,
15796 trellis_quant_in_name.as_ptr(),
15797 trellis_quant_in,
15798 overshoot_deringing_in_name.as_ptr(),
15799 overshoot_deringing_in,
15800 optimize_scans_in_name.as_ptr(),
15801 optimize_scans_in,
15802 quant_table_in_name.as_ptr(),
15803 quant_table_in,
15804 subsample_mode_in_name.as_ptr(),
15805 subsample_mode_in,
15806 restart_interval_in_name.as_ptr(),
15807 restart_interval_in,
15808 keep_in_name.as_ptr(),
15809 keep_in,
15810 background_in_name.as_ptr(),
15811 background_in,
15812 page_height_in_name.as_ptr(),
15813 page_height_in,
15814 profile_in_name.as_ptr(),
15815 profile_in.as_ptr(),
15816 NULL,
15817 );
15818 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15819 }
15820}
15821
15822pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15826 unsafe {
15827 let inp_in: *mut bindings::VipsImage = inp.ctx;
15828
15829 let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15830 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15831 }
15832}
15833
15834#[derive(Clone, Debug)]
15836pub struct JpegsaveMimeOptions {
15837 pub q: i32,
15840 pub optimize_coding: bool,
15843 pub interlace: bool,
15846 pub trellis_quant: bool,
15849 pub overshoot_deringing: bool,
15852 pub optimize_scans: bool,
15855 pub quant_table: i32,
15858 pub subsample_mode: ForeignSubsample,
15864 pub restart_interval: i32,
15867 pub keep: ForeignKeep,
15876 pub background: Vec<f64>,
15878 pub page_height: i32,
15881 pub profile: String,
15883}
15884
15885impl std::default::Default for JpegsaveMimeOptions {
15886 fn default() -> Self {
15887 JpegsaveMimeOptions {
15888 q: i32::from(75),
15889 optimize_coding: false,
15890 interlace: false,
15891 trellis_quant: false,
15892 overshoot_deringing: false,
15893 optimize_scans: false,
15894 quant_table: i32::from(0),
15895 subsample_mode: ForeignSubsample::Auto,
15896 restart_interval: i32::from(0),
15897 keep: ForeignKeep::All,
15898 background: Vec::new(),
15899 page_height: i32::from(0),
15900 profile: String::from("sRGB"),
15901 }
15902 }
15903}
15904
15905pub fn jpegsave_mime_with_opts(
15910 inp: &VipsImage,
15911 jpegsave_mime_options: &JpegsaveMimeOptions,
15912) -> Result<()> {
15913 unsafe {
15914 let inp_in: *mut bindings::VipsImage = inp.ctx;
15915
15916 let q_in: i32 = jpegsave_mime_options.q;
15917 let q_in_name = utils::new_c_string("Q")?;
15918
15919 let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15920 1
15921 } else {
15922 0
15923 };
15924 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15925
15926 let interlace_in: i32 = if jpegsave_mime_options.interlace {
15927 1
15928 } else {
15929 0
15930 };
15931 let interlace_in_name = utils::new_c_string("interlace")?;
15932
15933 let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15934 1
15935 } else {
15936 0
15937 };
15938 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15939
15940 let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15941 1
15942 } else {
15943 0
15944 };
15945 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15946
15947 let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15948 1
15949 } else {
15950 0
15951 };
15952 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15953
15954 let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15955 let quant_table_in_name = utils::new_c_string("quant-table")?;
15956
15957 let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15958 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15959
15960 let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15961 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15962
15963 let keep_in: i32 = jpegsave_mime_options.keep as i32;
15964 let keep_in_name = utils::new_c_string("keep")?;
15965
15966 let background_wrapper =
15967 utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15968 let background_in = background_wrapper.ctx;
15969 let background_in_name = utils::new_c_string("background")?;
15970
15971 let page_height_in: i32 = jpegsave_mime_options.page_height;
15972 let page_height_in_name = utils::new_c_string("page-height")?;
15973
15974 let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15975 let profile_in_name = utils::new_c_string("profile")?;
15976
15977 let vips_op_response = bindings::vips_jpegsave_mime(
15978 inp_in,
15979 q_in_name.as_ptr(),
15980 q_in,
15981 optimize_coding_in_name.as_ptr(),
15982 optimize_coding_in,
15983 interlace_in_name.as_ptr(),
15984 interlace_in,
15985 trellis_quant_in_name.as_ptr(),
15986 trellis_quant_in,
15987 overshoot_deringing_in_name.as_ptr(),
15988 overshoot_deringing_in,
15989 optimize_scans_in_name.as_ptr(),
15990 optimize_scans_in,
15991 quant_table_in_name.as_ptr(),
15992 quant_table_in,
15993 subsample_mode_in_name.as_ptr(),
15994 subsample_mode_in,
15995 restart_interval_in_name.as_ptr(),
15996 restart_interval_in,
15997 keep_in_name.as_ptr(),
15998 keep_in,
15999 background_in_name.as_ptr(),
16000 background_in,
16001 page_height_in_name.as_ptr(),
16002 page_height_in,
16003 profile_in_name.as_ptr(),
16004 profile_in.as_ptr(),
16005 NULL,
16006 );
16007 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
16008 }
16009}
16010
16011pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
16016 unsafe {
16017 let inp_in: *mut bindings::VipsImage = inp.ctx;
16018 let filename_in: CString = utils::new_c_string(filename)?;
16019
16020 let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
16021 utils::result(vips_op_response, (), Error::WebpsaveError)
16022 }
16023}
16024
16025#[derive(Clone, Debug)]
16027pub struct WebpsaveOptions {
16028 pub q: i32,
16031 pub lossless: bool,
16034 pub preset: ForeignWebpPreset,
16043 pub smart_subsample: bool,
16046 pub near_lossless: bool,
16049 pub alpha_q: i32,
16052 pub min_size: bool,
16055 pub kmin: i32,
16058 pub kmax: i32,
16061 pub effort: i32,
16064 pub target_size: i32,
16067 pub mixed: bool,
16070 pub smart_deblock: bool,
16073 pub passes: i32,
16076 pub keep: ForeignKeep,
16085 pub background: Vec<f64>,
16087 pub page_height: i32,
16090 pub profile: String,
16092}
16093
16094impl std::default::Default for WebpsaveOptions {
16095 fn default() -> Self {
16096 WebpsaveOptions {
16097 q: i32::from(75),
16098 lossless: false,
16099 preset: ForeignWebpPreset::Default,
16100 smart_subsample: false,
16101 near_lossless: false,
16102 alpha_q: i32::from(100),
16103 min_size: false,
16104 kmin: i32::from(2147483646),
16105 kmax: i32::from(2147483647),
16106 effort: i32::from(4),
16107 target_size: i32::from(0),
16108 mixed: false,
16109 smart_deblock: false,
16110 passes: i32::from(1),
16111 keep: ForeignKeep::All,
16112 background: Vec::new(),
16113 page_height: i32::from(0),
16114 profile: String::from("sRGB"),
16115 }
16116 }
16117}
16118
16119pub fn webpsave_with_opts(
16125 inp: &VipsImage,
16126 filename: &str,
16127 webpsave_options: &WebpsaveOptions,
16128) -> Result<()> {
16129 unsafe {
16130 let inp_in: *mut bindings::VipsImage = inp.ctx;
16131 let filename_in: CString = utils::new_c_string(filename)?;
16132
16133 let q_in: i32 = webpsave_options.q;
16134 let q_in_name = utils::new_c_string("Q")?;
16135
16136 let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
16137 let lossless_in_name = utils::new_c_string("lossless")?;
16138
16139 let preset_in: i32 = webpsave_options.preset as i32;
16140 let preset_in_name = utils::new_c_string("preset")?;
16141
16142 let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
16143 1
16144 } else {
16145 0
16146 };
16147 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16148
16149 let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
16150 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16151
16152 let alpha_q_in: i32 = webpsave_options.alpha_q;
16153 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16154
16155 let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
16156 let min_size_in_name = utils::new_c_string("min-size")?;
16157
16158 let kmin_in: i32 = webpsave_options.kmin;
16159 let kmin_in_name = utils::new_c_string("kmin")?;
16160
16161 let kmax_in: i32 = webpsave_options.kmax;
16162 let kmax_in_name = utils::new_c_string("kmax")?;
16163
16164 let effort_in: i32 = webpsave_options.effort;
16165 let effort_in_name = utils::new_c_string("effort")?;
16166
16167 let target_size_in: i32 = webpsave_options.target_size;
16168 let target_size_in_name = utils::new_c_string("target-size")?;
16169
16170 let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
16171 let mixed_in_name = utils::new_c_string("mixed")?;
16172
16173 let smart_deblock_in: i32 = if webpsave_options.smart_deblock { 1 } else { 0 };
16174 let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16175
16176 let passes_in: i32 = webpsave_options.passes;
16177 let passes_in_name = utils::new_c_string("passes")?;
16178
16179 let keep_in: i32 = webpsave_options.keep as i32;
16180 let keep_in_name = utils::new_c_string("keep")?;
16181
16182 let background_wrapper =
16183 utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
16184 let background_in = background_wrapper.ctx;
16185 let background_in_name = utils::new_c_string("background")?;
16186
16187 let page_height_in: i32 = webpsave_options.page_height;
16188 let page_height_in_name = utils::new_c_string("page-height")?;
16189
16190 let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
16191 let profile_in_name = utils::new_c_string("profile")?;
16192
16193 let vips_op_response = bindings::vips_webpsave(
16194 inp_in,
16195 filename_in.as_ptr(),
16196 q_in_name.as_ptr(),
16197 q_in,
16198 lossless_in_name.as_ptr(),
16199 lossless_in,
16200 preset_in_name.as_ptr(),
16201 preset_in,
16202 smart_subsample_in_name.as_ptr(),
16203 smart_subsample_in,
16204 near_lossless_in_name.as_ptr(),
16205 near_lossless_in,
16206 alpha_q_in_name.as_ptr(),
16207 alpha_q_in,
16208 min_size_in_name.as_ptr(),
16209 min_size_in,
16210 kmin_in_name.as_ptr(),
16211 kmin_in,
16212 kmax_in_name.as_ptr(),
16213 kmax_in,
16214 effort_in_name.as_ptr(),
16215 effort_in,
16216 target_size_in_name.as_ptr(),
16217 target_size_in,
16218 mixed_in_name.as_ptr(),
16219 mixed_in,
16220 smart_deblock_in_name.as_ptr(),
16221 smart_deblock_in,
16222 passes_in_name.as_ptr(),
16223 passes_in,
16224 keep_in_name.as_ptr(),
16225 keep_in,
16226 background_in_name.as_ptr(),
16227 background_in,
16228 page_height_in_name.as_ptr(),
16229 page_height_in,
16230 profile_in_name.as_ptr(),
16231 profile_in.as_ptr(),
16232 NULL,
16233 );
16234 utils::result(vips_op_response, (), Error::WebpsaveError)
16235 }
16236}
16237
16238pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16242 unsafe {
16243 let inp_in: *mut bindings::VipsImage = inp.ctx;
16244 let mut buffer_buf_size: u64 = 0;
16245 let mut buffer_out: *mut c_void = null_mut();
16246
16247 let vips_op_response =
16248 bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16249 utils::result(
16250 vips_op_response,
16251 utils::new_byte_array(buffer_out, buffer_buf_size),
16252 Error::WebpsaveBufferError,
16253 )
16254 }
16255}
16256
16257#[derive(Clone, Debug)]
16259pub struct WebpsaveBufferOptions {
16260 pub q: i32,
16263 pub lossless: bool,
16266 pub preset: ForeignWebpPreset,
16275 pub smart_subsample: bool,
16278 pub near_lossless: bool,
16281 pub alpha_q: i32,
16284 pub min_size: bool,
16287 pub kmin: i32,
16290 pub kmax: i32,
16293 pub effort: i32,
16296 pub target_size: i32,
16299 pub mixed: bool,
16302 pub smart_deblock: bool,
16305 pub passes: i32,
16308 pub keep: ForeignKeep,
16317 pub background: Vec<f64>,
16319 pub page_height: i32,
16322 pub profile: String,
16324}
16325
16326impl std::default::Default for WebpsaveBufferOptions {
16327 fn default() -> Self {
16328 WebpsaveBufferOptions {
16329 q: i32::from(75),
16330 lossless: false,
16331 preset: ForeignWebpPreset::Default,
16332 smart_subsample: false,
16333 near_lossless: false,
16334 alpha_q: i32::from(100),
16335 min_size: false,
16336 kmin: i32::from(2147483646),
16337 kmax: i32::from(2147483647),
16338 effort: i32::from(4),
16339 target_size: i32::from(0),
16340 mixed: false,
16341 smart_deblock: false,
16342 passes: i32::from(1),
16343 keep: ForeignKeep::All,
16344 background: Vec::new(),
16345 page_height: i32::from(0),
16346 profile: String::from("sRGB"),
16347 }
16348 }
16349}
16350
16351pub fn webpsave_buffer_with_opts(
16356 inp: &VipsImage,
16357 webpsave_buffer_options: &WebpsaveBufferOptions,
16358) -> Result<Vec<u8>> {
16359 unsafe {
16360 let inp_in: *mut bindings::VipsImage = inp.ctx;
16361 let mut buffer_buf_size: u64 = 0;
16362 let mut buffer_out: *mut c_void = null_mut();
16363
16364 let q_in: i32 = webpsave_buffer_options.q;
16365 let q_in_name = utils::new_c_string("Q")?;
16366
16367 let lossless_in: i32 = if webpsave_buffer_options.lossless {
16368 1
16369 } else {
16370 0
16371 };
16372 let lossless_in_name = utils::new_c_string("lossless")?;
16373
16374 let preset_in: i32 = webpsave_buffer_options.preset as i32;
16375 let preset_in_name = utils::new_c_string("preset")?;
16376
16377 let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
16378 1
16379 } else {
16380 0
16381 };
16382 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16383
16384 let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
16385 1
16386 } else {
16387 0
16388 };
16389 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16390
16391 let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
16392 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16393
16394 let min_size_in: i32 = if webpsave_buffer_options.min_size {
16395 1
16396 } else {
16397 0
16398 };
16399 let min_size_in_name = utils::new_c_string("min-size")?;
16400
16401 let kmin_in: i32 = webpsave_buffer_options.kmin;
16402 let kmin_in_name = utils::new_c_string("kmin")?;
16403
16404 let kmax_in: i32 = webpsave_buffer_options.kmax;
16405 let kmax_in_name = utils::new_c_string("kmax")?;
16406
16407 let effort_in: i32 = webpsave_buffer_options.effort;
16408 let effort_in_name = utils::new_c_string("effort")?;
16409
16410 let target_size_in: i32 = webpsave_buffer_options.target_size;
16411 let target_size_in_name = utils::new_c_string("target-size")?;
16412
16413 let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
16414 let mixed_in_name = utils::new_c_string("mixed")?;
16415
16416 let smart_deblock_in: i32 = if webpsave_buffer_options.smart_deblock {
16417 1
16418 } else {
16419 0
16420 };
16421 let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16422
16423 let passes_in: i32 = webpsave_buffer_options.passes;
16424 let passes_in_name = utils::new_c_string("passes")?;
16425
16426 let keep_in: i32 = webpsave_buffer_options.keep as i32;
16427 let keep_in_name = utils::new_c_string("keep")?;
16428
16429 let background_wrapper =
16430 utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
16431 let background_in = background_wrapper.ctx;
16432 let background_in_name = utils::new_c_string("background")?;
16433
16434 let page_height_in: i32 = webpsave_buffer_options.page_height;
16435 let page_height_in_name = utils::new_c_string("page-height")?;
16436
16437 let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
16438 let profile_in_name = utils::new_c_string("profile")?;
16439
16440 let vips_op_response = bindings::vips_webpsave_buffer(
16441 inp_in,
16442 &mut buffer_out,
16443 &mut buffer_buf_size,
16444 q_in_name.as_ptr(),
16445 q_in,
16446 lossless_in_name.as_ptr(),
16447 lossless_in,
16448 preset_in_name.as_ptr(),
16449 preset_in,
16450 smart_subsample_in_name.as_ptr(),
16451 smart_subsample_in,
16452 near_lossless_in_name.as_ptr(),
16453 near_lossless_in,
16454 alpha_q_in_name.as_ptr(),
16455 alpha_q_in,
16456 min_size_in_name.as_ptr(),
16457 min_size_in,
16458 kmin_in_name.as_ptr(),
16459 kmin_in,
16460 kmax_in_name.as_ptr(),
16461 kmax_in,
16462 effort_in_name.as_ptr(),
16463 effort_in,
16464 target_size_in_name.as_ptr(),
16465 target_size_in,
16466 mixed_in_name.as_ptr(),
16467 mixed_in,
16468 smart_deblock_in_name.as_ptr(),
16469 smart_deblock_in,
16470 passes_in_name.as_ptr(),
16471 passes_in,
16472 keep_in_name.as_ptr(),
16473 keep_in,
16474 background_in_name.as_ptr(),
16475 background_in,
16476 page_height_in_name.as_ptr(),
16477 page_height_in,
16478 profile_in_name.as_ptr(),
16479 profile_in.as_ptr(),
16480 NULL,
16481 );
16482 utils::result(
16483 vips_op_response,
16484 utils::new_byte_array(buffer_out, buffer_buf_size),
16485 Error::WebpsaveBufferError,
16486 )
16487 }
16488}
16489
16490pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16495 unsafe {
16496 let inp_in: *mut bindings::VipsImage = inp.ctx;
16497 let target_in: *mut bindings::VipsTarget = target.ctx;
16498
16499 let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
16500 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16501 }
16502}
16503
16504#[derive(Clone, Debug)]
16506pub struct WebpsaveTargetOptions {
16507 pub q: i32,
16510 pub lossless: bool,
16513 pub preset: ForeignWebpPreset,
16522 pub smart_subsample: bool,
16525 pub near_lossless: bool,
16528 pub alpha_q: i32,
16531 pub min_size: bool,
16534 pub kmin: i32,
16537 pub kmax: i32,
16540 pub effort: i32,
16543 pub target_size: i32,
16546 pub mixed: bool,
16549 pub smart_deblock: bool,
16552 pub passes: i32,
16555 pub keep: ForeignKeep,
16564 pub background: Vec<f64>,
16566 pub page_height: i32,
16569 pub profile: String,
16571}
16572
16573impl std::default::Default for WebpsaveTargetOptions {
16574 fn default() -> Self {
16575 WebpsaveTargetOptions {
16576 q: i32::from(75),
16577 lossless: false,
16578 preset: ForeignWebpPreset::Default,
16579 smart_subsample: false,
16580 near_lossless: false,
16581 alpha_q: i32::from(100),
16582 min_size: false,
16583 kmin: i32::from(2147483646),
16584 kmax: i32::from(2147483647),
16585 effort: i32::from(4),
16586 target_size: i32::from(0),
16587 mixed: false,
16588 smart_deblock: false,
16589 passes: i32::from(1),
16590 keep: ForeignKeep::All,
16591 background: Vec::new(),
16592 page_height: i32::from(0),
16593 profile: String::from("sRGB"),
16594 }
16595 }
16596}
16597
16598pub fn webpsave_target_with_opts(
16604 inp: &VipsImage,
16605 target: &VipsTarget,
16606 webpsave_target_options: &WebpsaveTargetOptions,
16607) -> Result<()> {
16608 unsafe {
16609 let inp_in: *mut bindings::VipsImage = inp.ctx;
16610 let target_in: *mut bindings::VipsTarget = target.ctx;
16611
16612 let q_in: i32 = webpsave_target_options.q;
16613 let q_in_name = utils::new_c_string("Q")?;
16614
16615 let lossless_in: i32 = if webpsave_target_options.lossless {
16616 1
16617 } else {
16618 0
16619 };
16620 let lossless_in_name = utils::new_c_string("lossless")?;
16621
16622 let preset_in: i32 = webpsave_target_options.preset as i32;
16623 let preset_in_name = utils::new_c_string("preset")?;
16624
16625 let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16626 1
16627 } else {
16628 0
16629 };
16630 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16631
16632 let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16633 1
16634 } else {
16635 0
16636 };
16637 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16638
16639 let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16640 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16641
16642 let min_size_in: i32 = if webpsave_target_options.min_size {
16643 1
16644 } else {
16645 0
16646 };
16647 let min_size_in_name = utils::new_c_string("min-size")?;
16648
16649 let kmin_in: i32 = webpsave_target_options.kmin;
16650 let kmin_in_name = utils::new_c_string("kmin")?;
16651
16652 let kmax_in: i32 = webpsave_target_options.kmax;
16653 let kmax_in_name = utils::new_c_string("kmax")?;
16654
16655 let effort_in: i32 = webpsave_target_options.effort;
16656 let effort_in_name = utils::new_c_string("effort")?;
16657
16658 let target_size_in: i32 = webpsave_target_options.target_size;
16659 let target_size_in_name = utils::new_c_string("target-size")?;
16660
16661 let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16662 let mixed_in_name = utils::new_c_string("mixed")?;
16663
16664 let smart_deblock_in: i32 = if webpsave_target_options.smart_deblock {
16665 1
16666 } else {
16667 0
16668 };
16669 let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16670
16671 let passes_in: i32 = webpsave_target_options.passes;
16672 let passes_in_name = utils::new_c_string("passes")?;
16673
16674 let keep_in: i32 = webpsave_target_options.keep as i32;
16675 let keep_in_name = utils::new_c_string("keep")?;
16676
16677 let background_wrapper =
16678 utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16679 let background_in = background_wrapper.ctx;
16680 let background_in_name = utils::new_c_string("background")?;
16681
16682 let page_height_in: i32 = webpsave_target_options.page_height;
16683 let page_height_in_name = utils::new_c_string("page-height")?;
16684
16685 let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16686 let profile_in_name = utils::new_c_string("profile")?;
16687
16688 let vips_op_response = bindings::vips_webpsave_target(
16689 inp_in,
16690 target_in,
16691 q_in_name.as_ptr(),
16692 q_in,
16693 lossless_in_name.as_ptr(),
16694 lossless_in,
16695 preset_in_name.as_ptr(),
16696 preset_in,
16697 smart_subsample_in_name.as_ptr(),
16698 smart_subsample_in,
16699 near_lossless_in_name.as_ptr(),
16700 near_lossless_in,
16701 alpha_q_in_name.as_ptr(),
16702 alpha_q_in,
16703 min_size_in_name.as_ptr(),
16704 min_size_in,
16705 kmin_in_name.as_ptr(),
16706 kmin_in,
16707 kmax_in_name.as_ptr(),
16708 kmax_in,
16709 effort_in_name.as_ptr(),
16710 effort_in,
16711 target_size_in_name.as_ptr(),
16712 target_size_in,
16713 mixed_in_name.as_ptr(),
16714 mixed_in,
16715 smart_deblock_in_name.as_ptr(),
16716 smart_deblock_in,
16717 passes_in_name.as_ptr(),
16718 passes_in,
16719 keep_in_name.as_ptr(),
16720 keep_in,
16721 background_in_name.as_ptr(),
16722 background_in,
16723 page_height_in_name.as_ptr(),
16724 page_height_in,
16725 profile_in_name.as_ptr(),
16726 profile_in.as_ptr(),
16727 NULL,
16728 );
16729 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16730 }
16731}
16732
16733pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16737 unsafe {
16738 let inp_in: *mut bindings::VipsImage = inp.ctx;
16739
16740 let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16741 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16742 }
16743}
16744
16745#[derive(Clone, Debug)]
16747pub struct WebpsaveMimeOptions {
16748 pub q: i32,
16751 pub lossless: bool,
16754 pub preset: ForeignWebpPreset,
16763 pub smart_subsample: bool,
16766 pub near_lossless: bool,
16769 pub alpha_q: i32,
16772 pub min_size: bool,
16775 pub kmin: i32,
16778 pub kmax: i32,
16781 pub effort: i32,
16784 pub target_size: i32,
16787 pub mixed: bool,
16790 pub smart_deblock: bool,
16793 pub passes: i32,
16796 pub keep: ForeignKeep,
16805 pub background: Vec<f64>,
16807 pub page_height: i32,
16810 pub profile: String,
16812}
16813
16814impl std::default::Default for WebpsaveMimeOptions {
16815 fn default() -> Self {
16816 WebpsaveMimeOptions {
16817 q: i32::from(75),
16818 lossless: false,
16819 preset: ForeignWebpPreset::Default,
16820 smart_subsample: false,
16821 near_lossless: false,
16822 alpha_q: i32::from(100),
16823 min_size: false,
16824 kmin: i32::from(2147483646),
16825 kmax: i32::from(2147483647),
16826 effort: i32::from(4),
16827 target_size: i32::from(0),
16828 mixed: false,
16829 smart_deblock: false,
16830 passes: i32::from(1),
16831 keep: ForeignKeep::All,
16832 background: Vec::new(),
16833 page_height: i32::from(0),
16834 profile: String::from("sRGB"),
16835 }
16836 }
16837}
16838
16839pub fn webpsave_mime_with_opts(
16844 inp: &VipsImage,
16845 webpsave_mime_options: &WebpsaveMimeOptions,
16846) -> Result<()> {
16847 unsafe {
16848 let inp_in: *mut bindings::VipsImage = inp.ctx;
16849
16850 let q_in: i32 = webpsave_mime_options.q;
16851 let q_in_name = utils::new_c_string("Q")?;
16852
16853 let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16854 let lossless_in_name = utils::new_c_string("lossless")?;
16855
16856 let preset_in: i32 = webpsave_mime_options.preset as i32;
16857 let preset_in_name = utils::new_c_string("preset")?;
16858
16859 let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16860 1
16861 } else {
16862 0
16863 };
16864 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16865
16866 let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16867 1
16868 } else {
16869 0
16870 };
16871 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16872
16873 let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16874 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16875
16876 let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16877 let min_size_in_name = utils::new_c_string("min-size")?;
16878
16879 let kmin_in: i32 = webpsave_mime_options.kmin;
16880 let kmin_in_name = utils::new_c_string("kmin")?;
16881
16882 let kmax_in: i32 = webpsave_mime_options.kmax;
16883 let kmax_in_name = utils::new_c_string("kmax")?;
16884
16885 let effort_in: i32 = webpsave_mime_options.effort;
16886 let effort_in_name = utils::new_c_string("effort")?;
16887
16888 let target_size_in: i32 = webpsave_mime_options.target_size;
16889 let target_size_in_name = utils::new_c_string("target-size")?;
16890
16891 let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16892 let mixed_in_name = utils::new_c_string("mixed")?;
16893
16894 let smart_deblock_in: i32 = if webpsave_mime_options.smart_deblock {
16895 1
16896 } else {
16897 0
16898 };
16899 let smart_deblock_in_name = utils::new_c_string("smart-deblock")?;
16900
16901 let passes_in: i32 = webpsave_mime_options.passes;
16902 let passes_in_name = utils::new_c_string("passes")?;
16903
16904 let keep_in: i32 = webpsave_mime_options.keep as i32;
16905 let keep_in_name = utils::new_c_string("keep")?;
16906
16907 let background_wrapper =
16908 utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16909 let background_in = background_wrapper.ctx;
16910 let background_in_name = utils::new_c_string("background")?;
16911
16912 let page_height_in: i32 = webpsave_mime_options.page_height;
16913 let page_height_in_name = utils::new_c_string("page-height")?;
16914
16915 let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16916 let profile_in_name = utils::new_c_string("profile")?;
16917
16918 let vips_op_response = bindings::vips_webpsave_mime(
16919 inp_in,
16920 q_in_name.as_ptr(),
16921 q_in,
16922 lossless_in_name.as_ptr(),
16923 lossless_in,
16924 preset_in_name.as_ptr(),
16925 preset_in,
16926 smart_subsample_in_name.as_ptr(),
16927 smart_subsample_in,
16928 near_lossless_in_name.as_ptr(),
16929 near_lossless_in,
16930 alpha_q_in_name.as_ptr(),
16931 alpha_q_in,
16932 min_size_in_name.as_ptr(),
16933 min_size_in,
16934 kmin_in_name.as_ptr(),
16935 kmin_in,
16936 kmax_in_name.as_ptr(),
16937 kmax_in,
16938 effort_in_name.as_ptr(),
16939 effort_in,
16940 target_size_in_name.as_ptr(),
16941 target_size_in,
16942 mixed_in_name.as_ptr(),
16943 mixed_in,
16944 smart_deblock_in_name.as_ptr(),
16945 smart_deblock_in,
16946 passes_in_name.as_ptr(),
16947 passes_in,
16948 keep_in_name.as_ptr(),
16949 keep_in,
16950 background_in_name.as_ptr(),
16951 background_in,
16952 page_height_in_name.as_ptr(),
16953 page_height_in,
16954 profile_in_name.as_ptr(),
16955 profile_in.as_ptr(),
16956 NULL,
16957 );
16958 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16959 }
16960}
16961
16962pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16967 unsafe {
16968 let inp_in: *mut bindings::VipsImage = inp.ctx;
16969 let filename_in: CString = utils::new_c_string(filename)?;
16970
16971 let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16972 utils::result(vips_op_response, (), Error::TiffsaveError)
16973 }
16974}
16975
16976#[derive(Clone, Debug)]
16978pub struct TiffsaveOptions {
16979 pub compression: ForeignTiffCompression,
16991 pub q: i32,
16994 pub predictor: ForeignTiffPredictor,
17000 pub tile: bool,
17003 pub tile_width: i32,
17006 pub tile_height: i32,
17009 pub pyramid: bool,
17012 pub miniswhite: bool,
17015 pub bitdepth: i32,
17018 pub resunit: ForeignTiffResunit,
17023 pub xres: f64,
17026 pub yres: f64,
17029 pub bigtiff: bool,
17032 pub properties: bool,
17035 pub region_shrink: RegionShrink,
17044 pub level: i32,
17047 pub lossless: bool,
17050 pub depth: ForeignDzDepth,
17056 pub subifd: bool,
17059 pub premultiply: bool,
17062 pub keep: ForeignKeep,
17071 pub background: Vec<f64>,
17073 pub page_height: i32,
17076 pub profile: String,
17078}
17079
17080impl std::default::Default for TiffsaveOptions {
17081 fn default() -> Self {
17082 TiffsaveOptions {
17083 compression: ForeignTiffCompression::None,
17084 q: i32::from(75),
17085 predictor: ForeignTiffPredictor::Horizontal,
17086 tile: false,
17087 tile_width: i32::from(128),
17088 tile_height: i32::from(128),
17089 pyramid: false,
17090 miniswhite: false,
17091 bitdepth: i32::from(0),
17092 resunit: ForeignTiffResunit::Cm,
17093 xres: f64::from(1),
17094 yres: f64::from(1),
17095 bigtiff: false,
17096 properties: false,
17097 region_shrink: RegionShrink::Mean,
17098 level: i32::from(0),
17099 lossless: false,
17100 depth: ForeignDzDepth::Onetile,
17101 subifd: false,
17102 premultiply: false,
17103 keep: ForeignKeep::All,
17104 background: Vec::new(),
17105 page_height: i32::from(0),
17106 profile: String::from("sRGB"),
17107 }
17108 }
17109}
17110
17111pub fn tiffsave_with_opts(
17117 inp: &VipsImage,
17118 filename: &str,
17119 tiffsave_options: &TiffsaveOptions,
17120) -> Result<()> {
17121 unsafe {
17122 let inp_in: *mut bindings::VipsImage = inp.ctx;
17123 let filename_in: CString = utils::new_c_string(filename)?;
17124
17125 let compression_in: i32 = tiffsave_options.compression as i32;
17126 let compression_in_name = utils::new_c_string("compression")?;
17127
17128 let q_in: i32 = tiffsave_options.q;
17129 let q_in_name = utils::new_c_string("Q")?;
17130
17131 let predictor_in: i32 = tiffsave_options.predictor as i32;
17132 let predictor_in_name = utils::new_c_string("predictor")?;
17133
17134 let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
17135 let tile_in_name = utils::new_c_string("tile")?;
17136
17137 let tile_width_in: i32 = tiffsave_options.tile_width;
17138 let tile_width_in_name = utils::new_c_string("tile-width")?;
17139
17140 let tile_height_in: i32 = tiffsave_options.tile_height;
17141 let tile_height_in_name = utils::new_c_string("tile-height")?;
17142
17143 let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
17144 let pyramid_in_name = utils::new_c_string("pyramid")?;
17145
17146 let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
17147 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17148
17149 let bitdepth_in: i32 = tiffsave_options.bitdepth;
17150 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17151
17152 let resunit_in: i32 = tiffsave_options.resunit as i32;
17153 let resunit_in_name = utils::new_c_string("resunit")?;
17154
17155 let xres_in: f64 = tiffsave_options.xres;
17156 let xres_in_name = utils::new_c_string("xres")?;
17157
17158 let yres_in: f64 = tiffsave_options.yres;
17159 let yres_in_name = utils::new_c_string("yres")?;
17160
17161 let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
17162 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17163
17164 let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
17165 let properties_in_name = utils::new_c_string("properties")?;
17166
17167 let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
17168 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17169
17170 let level_in: i32 = tiffsave_options.level;
17171 let level_in_name = utils::new_c_string("level")?;
17172
17173 let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
17174 let lossless_in_name = utils::new_c_string("lossless")?;
17175
17176 let depth_in: i32 = tiffsave_options.depth as i32;
17177 let depth_in_name = utils::new_c_string("depth")?;
17178
17179 let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
17180 let subifd_in_name = utils::new_c_string("subifd")?;
17181
17182 let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
17183 let premultiply_in_name = utils::new_c_string("premultiply")?;
17184
17185 let keep_in: i32 = tiffsave_options.keep as i32;
17186 let keep_in_name = utils::new_c_string("keep")?;
17187
17188 let background_wrapper =
17189 utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
17190 let background_in = background_wrapper.ctx;
17191 let background_in_name = utils::new_c_string("background")?;
17192
17193 let page_height_in: i32 = tiffsave_options.page_height;
17194 let page_height_in_name = utils::new_c_string("page-height")?;
17195
17196 let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
17197 let profile_in_name = utils::new_c_string("profile")?;
17198
17199 let vips_op_response = bindings::vips_tiffsave(
17200 inp_in,
17201 filename_in.as_ptr(),
17202 compression_in_name.as_ptr(),
17203 compression_in,
17204 q_in_name.as_ptr(),
17205 q_in,
17206 predictor_in_name.as_ptr(),
17207 predictor_in,
17208 tile_in_name.as_ptr(),
17209 tile_in,
17210 tile_width_in_name.as_ptr(),
17211 tile_width_in,
17212 tile_height_in_name.as_ptr(),
17213 tile_height_in,
17214 pyramid_in_name.as_ptr(),
17215 pyramid_in,
17216 miniswhite_in_name.as_ptr(),
17217 miniswhite_in,
17218 bitdepth_in_name.as_ptr(),
17219 bitdepth_in,
17220 resunit_in_name.as_ptr(),
17221 resunit_in,
17222 xres_in_name.as_ptr(),
17223 xres_in,
17224 yres_in_name.as_ptr(),
17225 yres_in,
17226 bigtiff_in_name.as_ptr(),
17227 bigtiff_in,
17228 properties_in_name.as_ptr(),
17229 properties_in,
17230 region_shrink_in_name.as_ptr(),
17231 region_shrink_in,
17232 level_in_name.as_ptr(),
17233 level_in,
17234 lossless_in_name.as_ptr(),
17235 lossless_in,
17236 depth_in_name.as_ptr(),
17237 depth_in,
17238 subifd_in_name.as_ptr(),
17239 subifd_in,
17240 premultiply_in_name.as_ptr(),
17241 premultiply_in,
17242 keep_in_name.as_ptr(),
17243 keep_in,
17244 background_in_name.as_ptr(),
17245 background_in,
17246 page_height_in_name.as_ptr(),
17247 page_height_in,
17248 profile_in_name.as_ptr(),
17249 profile_in.as_ptr(),
17250 NULL,
17251 );
17252 utils::result(vips_op_response, (), Error::TiffsaveError)
17253 }
17254}
17255
17256pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17260 unsafe {
17261 let inp_in: *mut bindings::VipsImage = inp.ctx;
17262 let mut buffer_buf_size: u64 = 0;
17263 let mut buffer_out: *mut c_void = null_mut();
17264
17265 let vips_op_response =
17266 bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17267 utils::result(
17268 vips_op_response,
17269 utils::new_byte_array(buffer_out, buffer_buf_size),
17270 Error::TiffsaveBufferError,
17271 )
17272 }
17273}
17274
17275#[derive(Clone, Debug)]
17277pub struct TiffsaveBufferOptions {
17278 pub compression: ForeignTiffCompression,
17290 pub q: i32,
17293 pub predictor: ForeignTiffPredictor,
17299 pub tile: bool,
17302 pub tile_width: i32,
17305 pub tile_height: i32,
17308 pub pyramid: bool,
17311 pub miniswhite: bool,
17314 pub bitdepth: i32,
17317 pub resunit: ForeignTiffResunit,
17322 pub xres: f64,
17325 pub yres: f64,
17328 pub bigtiff: bool,
17331 pub properties: bool,
17334 pub region_shrink: RegionShrink,
17343 pub level: i32,
17346 pub lossless: bool,
17349 pub depth: ForeignDzDepth,
17355 pub subifd: bool,
17358 pub premultiply: bool,
17361 pub keep: ForeignKeep,
17370 pub background: Vec<f64>,
17372 pub page_height: i32,
17375 pub profile: String,
17377}
17378
17379impl std::default::Default for TiffsaveBufferOptions {
17380 fn default() -> Self {
17381 TiffsaveBufferOptions {
17382 compression: ForeignTiffCompression::None,
17383 q: i32::from(75),
17384 predictor: ForeignTiffPredictor::Horizontal,
17385 tile: false,
17386 tile_width: i32::from(128),
17387 tile_height: i32::from(128),
17388 pyramid: false,
17389 miniswhite: false,
17390 bitdepth: i32::from(0),
17391 resunit: ForeignTiffResunit::Cm,
17392 xres: f64::from(1),
17393 yres: f64::from(1),
17394 bigtiff: false,
17395 properties: false,
17396 region_shrink: RegionShrink::Mean,
17397 level: i32::from(0),
17398 lossless: false,
17399 depth: ForeignDzDepth::Onetile,
17400 subifd: false,
17401 premultiply: false,
17402 keep: ForeignKeep::All,
17403 background: Vec::new(),
17404 page_height: i32::from(0),
17405 profile: String::from("sRGB"),
17406 }
17407 }
17408}
17409
17410pub fn tiffsave_buffer_with_opts(
17415 inp: &VipsImage,
17416 tiffsave_buffer_options: &TiffsaveBufferOptions,
17417) -> Result<Vec<u8>> {
17418 unsafe {
17419 let inp_in: *mut bindings::VipsImage = inp.ctx;
17420 let mut buffer_buf_size: u64 = 0;
17421 let mut buffer_out: *mut c_void = null_mut();
17422
17423 let compression_in: i32 = tiffsave_buffer_options.compression as i32;
17424 let compression_in_name = utils::new_c_string("compression")?;
17425
17426 let q_in: i32 = tiffsave_buffer_options.q;
17427 let q_in_name = utils::new_c_string("Q")?;
17428
17429 let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
17430 let predictor_in_name = utils::new_c_string("predictor")?;
17431
17432 let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
17433 let tile_in_name = utils::new_c_string("tile")?;
17434
17435 let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
17436 let tile_width_in_name = utils::new_c_string("tile-width")?;
17437
17438 let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
17439 let tile_height_in_name = utils::new_c_string("tile-height")?;
17440
17441 let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
17442 1
17443 } else {
17444 0
17445 };
17446 let pyramid_in_name = utils::new_c_string("pyramid")?;
17447
17448 let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
17449 1
17450 } else {
17451 0
17452 };
17453 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17454
17455 let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
17456 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17457
17458 let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
17459 let resunit_in_name = utils::new_c_string("resunit")?;
17460
17461 let xres_in: f64 = tiffsave_buffer_options.xres;
17462 let xres_in_name = utils::new_c_string("xres")?;
17463
17464 let yres_in: f64 = tiffsave_buffer_options.yres;
17465 let yres_in_name = utils::new_c_string("yres")?;
17466
17467 let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
17468 1
17469 } else {
17470 0
17471 };
17472 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17473
17474 let properties_in: i32 = if tiffsave_buffer_options.properties {
17475 1
17476 } else {
17477 0
17478 };
17479 let properties_in_name = utils::new_c_string("properties")?;
17480
17481 let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
17482 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17483
17484 let level_in: i32 = tiffsave_buffer_options.level;
17485 let level_in_name = utils::new_c_string("level")?;
17486
17487 let lossless_in: i32 = if tiffsave_buffer_options.lossless {
17488 1
17489 } else {
17490 0
17491 };
17492 let lossless_in_name = utils::new_c_string("lossless")?;
17493
17494 let depth_in: i32 = tiffsave_buffer_options.depth as i32;
17495 let depth_in_name = utils::new_c_string("depth")?;
17496
17497 let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
17498 let subifd_in_name = utils::new_c_string("subifd")?;
17499
17500 let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
17501 1
17502 } else {
17503 0
17504 };
17505 let premultiply_in_name = utils::new_c_string("premultiply")?;
17506
17507 let keep_in: i32 = tiffsave_buffer_options.keep as i32;
17508 let keep_in_name = utils::new_c_string("keep")?;
17509
17510 let background_wrapper =
17511 utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
17512 let background_in = background_wrapper.ctx;
17513 let background_in_name = utils::new_c_string("background")?;
17514
17515 let page_height_in: i32 = tiffsave_buffer_options.page_height;
17516 let page_height_in_name = utils::new_c_string("page-height")?;
17517
17518 let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
17519 let profile_in_name = utils::new_c_string("profile")?;
17520
17521 let vips_op_response = bindings::vips_tiffsave_buffer(
17522 inp_in,
17523 &mut buffer_out,
17524 &mut buffer_buf_size,
17525 compression_in_name.as_ptr(),
17526 compression_in,
17527 q_in_name.as_ptr(),
17528 q_in,
17529 predictor_in_name.as_ptr(),
17530 predictor_in,
17531 tile_in_name.as_ptr(),
17532 tile_in,
17533 tile_width_in_name.as_ptr(),
17534 tile_width_in,
17535 tile_height_in_name.as_ptr(),
17536 tile_height_in,
17537 pyramid_in_name.as_ptr(),
17538 pyramid_in,
17539 miniswhite_in_name.as_ptr(),
17540 miniswhite_in,
17541 bitdepth_in_name.as_ptr(),
17542 bitdepth_in,
17543 resunit_in_name.as_ptr(),
17544 resunit_in,
17545 xres_in_name.as_ptr(),
17546 xres_in,
17547 yres_in_name.as_ptr(),
17548 yres_in,
17549 bigtiff_in_name.as_ptr(),
17550 bigtiff_in,
17551 properties_in_name.as_ptr(),
17552 properties_in,
17553 region_shrink_in_name.as_ptr(),
17554 region_shrink_in,
17555 level_in_name.as_ptr(),
17556 level_in,
17557 lossless_in_name.as_ptr(),
17558 lossless_in,
17559 depth_in_name.as_ptr(),
17560 depth_in,
17561 subifd_in_name.as_ptr(),
17562 subifd_in,
17563 premultiply_in_name.as_ptr(),
17564 premultiply_in,
17565 keep_in_name.as_ptr(),
17566 keep_in,
17567 background_in_name.as_ptr(),
17568 background_in,
17569 page_height_in_name.as_ptr(),
17570 page_height_in,
17571 profile_in_name.as_ptr(),
17572 profile_in.as_ptr(),
17573 NULL,
17574 );
17575 utils::result(
17576 vips_op_response,
17577 utils::new_byte_array(buffer_out, buffer_buf_size),
17578 Error::TiffsaveBufferError,
17579 )
17580 }
17581}
17582
17583pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17588 unsafe {
17589 let inp_in: *mut bindings::VipsImage = inp.ctx;
17590 let target_in: *mut bindings::VipsTarget = target.ctx;
17591
17592 let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
17593 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17594 }
17595}
17596
17597#[derive(Clone, Debug)]
17599pub struct TiffsaveTargetOptions {
17600 pub compression: ForeignTiffCompression,
17612 pub q: i32,
17615 pub predictor: ForeignTiffPredictor,
17621 pub tile: bool,
17624 pub tile_width: i32,
17627 pub tile_height: i32,
17630 pub pyramid: bool,
17633 pub miniswhite: bool,
17636 pub bitdepth: i32,
17639 pub resunit: ForeignTiffResunit,
17644 pub xres: f64,
17647 pub yres: f64,
17650 pub bigtiff: bool,
17653 pub properties: bool,
17656 pub region_shrink: RegionShrink,
17665 pub level: i32,
17668 pub lossless: bool,
17671 pub depth: ForeignDzDepth,
17677 pub subifd: bool,
17680 pub premultiply: bool,
17683 pub keep: ForeignKeep,
17692 pub background: Vec<f64>,
17694 pub page_height: i32,
17697 pub profile: String,
17699}
17700
17701impl std::default::Default for TiffsaveTargetOptions {
17702 fn default() -> Self {
17703 TiffsaveTargetOptions {
17704 compression: ForeignTiffCompression::None,
17705 q: i32::from(75),
17706 predictor: ForeignTiffPredictor::Horizontal,
17707 tile: false,
17708 tile_width: i32::from(128),
17709 tile_height: i32::from(128),
17710 pyramid: false,
17711 miniswhite: false,
17712 bitdepth: i32::from(0),
17713 resunit: ForeignTiffResunit::Cm,
17714 xres: f64::from(1),
17715 yres: f64::from(1),
17716 bigtiff: false,
17717 properties: false,
17718 region_shrink: RegionShrink::Mean,
17719 level: i32::from(0),
17720 lossless: false,
17721 depth: ForeignDzDepth::Onetile,
17722 subifd: false,
17723 premultiply: false,
17724 keep: ForeignKeep::All,
17725 background: Vec::new(),
17726 page_height: i32::from(0),
17727 profile: String::from("sRGB"),
17728 }
17729 }
17730}
17731
17732pub fn tiffsave_target_with_opts(
17738 inp: &VipsImage,
17739 target: &VipsTarget,
17740 tiffsave_target_options: &TiffsaveTargetOptions,
17741) -> Result<()> {
17742 unsafe {
17743 let inp_in: *mut bindings::VipsImage = inp.ctx;
17744 let target_in: *mut bindings::VipsTarget = target.ctx;
17745
17746 let compression_in: i32 = tiffsave_target_options.compression as i32;
17747 let compression_in_name = utils::new_c_string("compression")?;
17748
17749 let q_in: i32 = tiffsave_target_options.q;
17750 let q_in_name = utils::new_c_string("Q")?;
17751
17752 let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17753 let predictor_in_name = utils::new_c_string("predictor")?;
17754
17755 let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17756 let tile_in_name = utils::new_c_string("tile")?;
17757
17758 let tile_width_in: i32 = tiffsave_target_options.tile_width;
17759 let tile_width_in_name = utils::new_c_string("tile-width")?;
17760
17761 let tile_height_in: i32 = tiffsave_target_options.tile_height;
17762 let tile_height_in_name = utils::new_c_string("tile-height")?;
17763
17764 let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17765 1
17766 } else {
17767 0
17768 };
17769 let pyramid_in_name = utils::new_c_string("pyramid")?;
17770
17771 let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17772 1
17773 } else {
17774 0
17775 };
17776 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17777
17778 let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17779 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17780
17781 let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17782 let resunit_in_name = utils::new_c_string("resunit")?;
17783
17784 let xres_in: f64 = tiffsave_target_options.xres;
17785 let xres_in_name = utils::new_c_string("xres")?;
17786
17787 let yres_in: f64 = tiffsave_target_options.yres;
17788 let yres_in_name = utils::new_c_string("yres")?;
17789
17790 let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17791 1
17792 } else {
17793 0
17794 };
17795 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17796
17797 let properties_in: i32 = if tiffsave_target_options.properties {
17798 1
17799 } else {
17800 0
17801 };
17802 let properties_in_name = utils::new_c_string("properties")?;
17803
17804 let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17805 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17806
17807 let level_in: i32 = tiffsave_target_options.level;
17808 let level_in_name = utils::new_c_string("level")?;
17809
17810 let lossless_in: i32 = if tiffsave_target_options.lossless {
17811 1
17812 } else {
17813 0
17814 };
17815 let lossless_in_name = utils::new_c_string("lossless")?;
17816
17817 let depth_in: i32 = tiffsave_target_options.depth as i32;
17818 let depth_in_name = utils::new_c_string("depth")?;
17819
17820 let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17821 let subifd_in_name = utils::new_c_string("subifd")?;
17822
17823 let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17824 1
17825 } else {
17826 0
17827 };
17828 let premultiply_in_name = utils::new_c_string("premultiply")?;
17829
17830 let keep_in: i32 = tiffsave_target_options.keep as i32;
17831 let keep_in_name = utils::new_c_string("keep")?;
17832
17833 let background_wrapper =
17834 utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17835 let background_in = background_wrapper.ctx;
17836 let background_in_name = utils::new_c_string("background")?;
17837
17838 let page_height_in: i32 = tiffsave_target_options.page_height;
17839 let page_height_in_name = utils::new_c_string("page-height")?;
17840
17841 let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17842 let profile_in_name = utils::new_c_string("profile")?;
17843
17844 let vips_op_response = bindings::vips_tiffsave_target(
17845 inp_in,
17846 target_in,
17847 compression_in_name.as_ptr(),
17848 compression_in,
17849 q_in_name.as_ptr(),
17850 q_in,
17851 predictor_in_name.as_ptr(),
17852 predictor_in,
17853 tile_in_name.as_ptr(),
17854 tile_in,
17855 tile_width_in_name.as_ptr(),
17856 tile_width_in,
17857 tile_height_in_name.as_ptr(),
17858 tile_height_in,
17859 pyramid_in_name.as_ptr(),
17860 pyramid_in,
17861 miniswhite_in_name.as_ptr(),
17862 miniswhite_in,
17863 bitdepth_in_name.as_ptr(),
17864 bitdepth_in,
17865 resunit_in_name.as_ptr(),
17866 resunit_in,
17867 xres_in_name.as_ptr(),
17868 xres_in,
17869 yres_in_name.as_ptr(),
17870 yres_in,
17871 bigtiff_in_name.as_ptr(),
17872 bigtiff_in,
17873 properties_in_name.as_ptr(),
17874 properties_in,
17875 region_shrink_in_name.as_ptr(),
17876 region_shrink_in,
17877 level_in_name.as_ptr(),
17878 level_in,
17879 lossless_in_name.as_ptr(),
17880 lossless_in,
17881 depth_in_name.as_ptr(),
17882 depth_in,
17883 subifd_in_name.as_ptr(),
17884 subifd_in,
17885 premultiply_in_name.as_ptr(),
17886 premultiply_in,
17887 keep_in_name.as_ptr(),
17888 keep_in,
17889 background_in_name.as_ptr(),
17890 background_in,
17891 page_height_in_name.as_ptr(),
17892 page_height_in,
17893 profile_in_name.as_ptr(),
17894 profile_in.as_ptr(),
17895 NULL,
17896 );
17897 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17898 }
17899}
17900
17901pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17906 unsafe {
17907 let inp_in: *mut bindings::VipsImage = inp.ctx;
17908 let filename_in: CString = utils::new_c_string(filename)?;
17909
17910 let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17911 utils::result(vips_op_response, (), Error::HeifsaveError)
17912 }
17913}
17914
17915#[derive(Clone, Debug)]
17917pub struct HeifsaveOptions {
17918 pub q: i32,
17921 pub bitdepth: i32,
17924 pub lossless: bool,
17927 pub compression: ForeignHeifCompression,
17934 pub effort: i32,
17937 pub subsample_mode: ForeignSubsample,
17943 pub encoder: ForeignHeifEncoder,
17951 pub keep: ForeignKeep,
17960 pub background: Vec<f64>,
17962 pub page_height: i32,
17965 pub profile: String,
17967}
17968
17969impl std::default::Default for HeifsaveOptions {
17970 fn default() -> Self {
17971 HeifsaveOptions {
17972 q: i32::from(50),
17973 bitdepth: i32::from(12),
17974 lossless: false,
17975 compression: ForeignHeifCompression::Hevc,
17976 effort: i32::from(4),
17977 subsample_mode: ForeignSubsample::Auto,
17978 encoder: ForeignHeifEncoder::Auto,
17979 keep: ForeignKeep::All,
17980 background: Vec::new(),
17981 page_height: i32::from(0),
17982 profile: String::from("sRGB"),
17983 }
17984 }
17985}
17986
17987pub fn heifsave_with_opts(
17993 inp: &VipsImage,
17994 filename: &str,
17995 heifsave_options: &HeifsaveOptions,
17996) -> Result<()> {
17997 unsafe {
17998 let inp_in: *mut bindings::VipsImage = inp.ctx;
17999 let filename_in: CString = utils::new_c_string(filename)?;
18000
18001 let q_in: i32 = heifsave_options.q;
18002 let q_in_name = utils::new_c_string("Q")?;
18003
18004 let bitdepth_in: i32 = heifsave_options.bitdepth;
18005 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18006
18007 let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
18008 let lossless_in_name = utils::new_c_string("lossless")?;
18009
18010 let compression_in: i32 = heifsave_options.compression as i32;
18011 let compression_in_name = utils::new_c_string("compression")?;
18012
18013 let effort_in: i32 = heifsave_options.effort;
18014 let effort_in_name = utils::new_c_string("effort")?;
18015
18016 let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
18017 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18018
18019 let encoder_in: i32 = heifsave_options.encoder as i32;
18020 let encoder_in_name = utils::new_c_string("encoder")?;
18021
18022 let keep_in: i32 = heifsave_options.keep as i32;
18023 let keep_in_name = utils::new_c_string("keep")?;
18024
18025 let background_wrapper =
18026 utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
18027 let background_in = background_wrapper.ctx;
18028 let background_in_name = utils::new_c_string("background")?;
18029
18030 let page_height_in: i32 = heifsave_options.page_height;
18031 let page_height_in_name = utils::new_c_string("page-height")?;
18032
18033 let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
18034 let profile_in_name = utils::new_c_string("profile")?;
18035
18036 let vips_op_response = bindings::vips_heifsave(
18037 inp_in,
18038 filename_in.as_ptr(),
18039 q_in_name.as_ptr(),
18040 q_in,
18041 bitdepth_in_name.as_ptr(),
18042 bitdepth_in,
18043 lossless_in_name.as_ptr(),
18044 lossless_in,
18045 compression_in_name.as_ptr(),
18046 compression_in,
18047 effort_in_name.as_ptr(),
18048 effort_in,
18049 subsample_mode_in_name.as_ptr(),
18050 subsample_mode_in,
18051 encoder_in_name.as_ptr(),
18052 encoder_in,
18053 keep_in_name.as_ptr(),
18054 keep_in,
18055 background_in_name.as_ptr(),
18056 background_in,
18057 page_height_in_name.as_ptr(),
18058 page_height_in,
18059 profile_in_name.as_ptr(),
18060 profile_in.as_ptr(),
18061 NULL,
18062 );
18063 utils::result(vips_op_response, (), Error::HeifsaveError)
18064 }
18065}
18066
18067pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
18071 unsafe {
18072 let inp_in: *mut bindings::VipsImage = inp.ctx;
18073 let mut buffer_buf_size: u64 = 0;
18074 let mut buffer_out: *mut c_void = null_mut();
18075
18076 let vips_op_response =
18077 bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18078 utils::result(
18079 vips_op_response,
18080 utils::new_byte_array(buffer_out, buffer_buf_size),
18081 Error::HeifsaveBufferError,
18082 )
18083 }
18084}
18085
18086#[derive(Clone, Debug)]
18088pub struct HeifsaveBufferOptions {
18089 pub q: i32,
18092 pub bitdepth: i32,
18095 pub lossless: bool,
18098 pub compression: ForeignHeifCompression,
18105 pub effort: i32,
18108 pub subsample_mode: ForeignSubsample,
18114 pub encoder: ForeignHeifEncoder,
18122 pub keep: ForeignKeep,
18131 pub background: Vec<f64>,
18133 pub page_height: i32,
18136 pub profile: String,
18138}
18139
18140impl std::default::Default for HeifsaveBufferOptions {
18141 fn default() -> Self {
18142 HeifsaveBufferOptions {
18143 q: i32::from(50),
18144 bitdepth: i32::from(12),
18145 lossless: false,
18146 compression: ForeignHeifCompression::Hevc,
18147 effort: i32::from(4),
18148 subsample_mode: ForeignSubsample::Auto,
18149 encoder: ForeignHeifEncoder::Auto,
18150 keep: ForeignKeep::All,
18151 background: Vec::new(),
18152 page_height: i32::from(0),
18153 profile: String::from("sRGB"),
18154 }
18155 }
18156}
18157
18158pub fn heifsave_buffer_with_opts(
18163 inp: &VipsImage,
18164 heifsave_buffer_options: &HeifsaveBufferOptions,
18165) -> Result<Vec<u8>> {
18166 unsafe {
18167 let inp_in: *mut bindings::VipsImage = inp.ctx;
18168 let mut buffer_buf_size: u64 = 0;
18169 let mut buffer_out: *mut c_void = null_mut();
18170
18171 let q_in: i32 = heifsave_buffer_options.q;
18172 let q_in_name = utils::new_c_string("Q")?;
18173
18174 let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
18175 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18176
18177 let lossless_in: i32 = if heifsave_buffer_options.lossless {
18178 1
18179 } else {
18180 0
18181 };
18182 let lossless_in_name = utils::new_c_string("lossless")?;
18183
18184 let compression_in: i32 = heifsave_buffer_options.compression as i32;
18185 let compression_in_name = utils::new_c_string("compression")?;
18186
18187 let effort_in: i32 = heifsave_buffer_options.effort;
18188 let effort_in_name = utils::new_c_string("effort")?;
18189
18190 let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
18191 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18192
18193 let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
18194 let encoder_in_name = utils::new_c_string("encoder")?;
18195
18196 let keep_in: i32 = heifsave_buffer_options.keep as i32;
18197 let keep_in_name = utils::new_c_string("keep")?;
18198
18199 let background_wrapper =
18200 utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
18201 let background_in = background_wrapper.ctx;
18202 let background_in_name = utils::new_c_string("background")?;
18203
18204 let page_height_in: i32 = heifsave_buffer_options.page_height;
18205 let page_height_in_name = utils::new_c_string("page-height")?;
18206
18207 let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
18208 let profile_in_name = utils::new_c_string("profile")?;
18209
18210 let vips_op_response = bindings::vips_heifsave_buffer(
18211 inp_in,
18212 &mut buffer_out,
18213 &mut buffer_buf_size,
18214 q_in_name.as_ptr(),
18215 q_in,
18216 bitdepth_in_name.as_ptr(),
18217 bitdepth_in,
18218 lossless_in_name.as_ptr(),
18219 lossless_in,
18220 compression_in_name.as_ptr(),
18221 compression_in,
18222 effort_in_name.as_ptr(),
18223 effort_in,
18224 subsample_mode_in_name.as_ptr(),
18225 subsample_mode_in,
18226 encoder_in_name.as_ptr(),
18227 encoder_in,
18228 keep_in_name.as_ptr(),
18229 keep_in,
18230 background_in_name.as_ptr(),
18231 background_in,
18232 page_height_in_name.as_ptr(),
18233 page_height_in,
18234 profile_in_name.as_ptr(),
18235 profile_in.as_ptr(),
18236 NULL,
18237 );
18238 utils::result(
18239 vips_op_response,
18240 utils::new_byte_array(buffer_out, buffer_buf_size),
18241 Error::HeifsaveBufferError,
18242 )
18243 }
18244}
18245
18246pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18251 unsafe {
18252 let inp_in: *mut bindings::VipsImage = inp.ctx;
18253 let target_in: *mut bindings::VipsTarget = target.ctx;
18254
18255 let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
18256 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18257 }
18258}
18259
18260#[derive(Clone, Debug)]
18262pub struct HeifsaveTargetOptions {
18263 pub q: i32,
18266 pub bitdepth: i32,
18269 pub lossless: bool,
18272 pub compression: ForeignHeifCompression,
18279 pub effort: i32,
18282 pub subsample_mode: ForeignSubsample,
18288 pub encoder: ForeignHeifEncoder,
18296 pub keep: ForeignKeep,
18305 pub background: Vec<f64>,
18307 pub page_height: i32,
18310 pub profile: String,
18312}
18313
18314impl std::default::Default for HeifsaveTargetOptions {
18315 fn default() -> Self {
18316 HeifsaveTargetOptions {
18317 q: i32::from(50),
18318 bitdepth: i32::from(12),
18319 lossless: false,
18320 compression: ForeignHeifCompression::Hevc,
18321 effort: i32::from(4),
18322 subsample_mode: ForeignSubsample::Auto,
18323 encoder: ForeignHeifEncoder::Auto,
18324 keep: ForeignKeep::All,
18325 background: Vec::new(),
18326 page_height: i32::from(0),
18327 profile: String::from("sRGB"),
18328 }
18329 }
18330}
18331
18332pub fn heifsave_target_with_opts(
18338 inp: &VipsImage,
18339 target: &VipsTarget,
18340 heifsave_target_options: &HeifsaveTargetOptions,
18341) -> Result<()> {
18342 unsafe {
18343 let inp_in: *mut bindings::VipsImage = inp.ctx;
18344 let target_in: *mut bindings::VipsTarget = target.ctx;
18345
18346 let q_in: i32 = heifsave_target_options.q;
18347 let q_in_name = utils::new_c_string("Q")?;
18348
18349 let bitdepth_in: i32 = heifsave_target_options.bitdepth;
18350 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18351
18352 let lossless_in: i32 = if heifsave_target_options.lossless {
18353 1
18354 } else {
18355 0
18356 };
18357 let lossless_in_name = utils::new_c_string("lossless")?;
18358
18359 let compression_in: i32 = heifsave_target_options.compression as i32;
18360 let compression_in_name = utils::new_c_string("compression")?;
18361
18362 let effort_in: i32 = heifsave_target_options.effort;
18363 let effort_in_name = utils::new_c_string("effort")?;
18364
18365 let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
18366 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18367
18368 let encoder_in: i32 = heifsave_target_options.encoder as i32;
18369 let encoder_in_name = utils::new_c_string("encoder")?;
18370
18371 let keep_in: i32 = heifsave_target_options.keep as i32;
18372 let keep_in_name = utils::new_c_string("keep")?;
18373
18374 let background_wrapper =
18375 utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
18376 let background_in = background_wrapper.ctx;
18377 let background_in_name = utils::new_c_string("background")?;
18378
18379 let page_height_in: i32 = heifsave_target_options.page_height;
18380 let page_height_in_name = utils::new_c_string("page-height")?;
18381
18382 let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
18383 let profile_in_name = utils::new_c_string("profile")?;
18384
18385 let vips_op_response = bindings::vips_heifsave_target(
18386 inp_in,
18387 target_in,
18388 q_in_name.as_ptr(),
18389 q_in,
18390 bitdepth_in_name.as_ptr(),
18391 bitdepth_in,
18392 lossless_in_name.as_ptr(),
18393 lossless_in,
18394 compression_in_name.as_ptr(),
18395 compression_in,
18396 effort_in_name.as_ptr(),
18397 effort_in,
18398 subsample_mode_in_name.as_ptr(),
18399 subsample_mode_in,
18400 encoder_in_name.as_ptr(),
18401 encoder_in,
18402 keep_in_name.as_ptr(),
18403 keep_in,
18404 background_in_name.as_ptr(),
18405 background_in,
18406 page_height_in_name.as_ptr(),
18407 page_height_in,
18408 profile_in_name.as_ptr(),
18409 profile_in.as_ptr(),
18410 NULL,
18411 );
18412 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
18413 }
18414}
18415
18416pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
18422 unsafe {
18423 let filename_in: CString = utils::new_c_string(filename)?;
18424 let width_in: i32 = width;
18425 let mut out_out: *mut bindings::VipsImage = null_mut();
18426
18427 let vips_op_response =
18428 bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
18429 utils::result(
18430 vips_op_response,
18431 VipsImage { ctx: out_out },
18432 Error::ThumbnailError,
18433 )
18434 }
18435}
18436
18437#[derive(Clone, Debug)]
18439pub struct ThumbnailOptions {
18440 pub height: i32,
18443 pub size: Size,
18450 pub no_rotate: bool,
18453 pub crop: Interesting,
18463 pub linear: bool,
18466 pub input_profile: String,
18468 pub output_profile: String,
18470 pub intent: Intent,
18478 pub fail_on: FailOn,
18485}
18486
18487impl std::default::Default for ThumbnailOptions {
18488 fn default() -> Self {
18489 ThumbnailOptions {
18490 height: i32::from(1),
18491 size: Size::Both,
18492 no_rotate: false,
18493 crop: Interesting::None,
18494 linear: false,
18495 input_profile: String::new(),
18496 output_profile: String::new(),
18497 intent: Intent::Relative,
18498 fail_on: FailOn::None,
18499 }
18500 }
18501}
18502
18503pub fn thumbnail_with_opts(
18510 filename: &str,
18511 width: i32,
18512 thumbnail_options: &ThumbnailOptions,
18513) -> Result<VipsImage> {
18514 unsafe {
18515 let filename_in: CString = utils::new_c_string(filename)?;
18516 let width_in: i32 = width;
18517 let mut out_out: *mut bindings::VipsImage = null_mut();
18518
18519 let height_in: i32 = thumbnail_options.height;
18520 let height_in_name = utils::new_c_string("height")?;
18521
18522 let size_in: i32 = thumbnail_options.size as i32;
18523 let size_in_name = utils::new_c_string("size")?;
18524
18525 let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
18526 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18527
18528 let crop_in: i32 = thumbnail_options.crop as i32;
18529 let crop_in_name = utils::new_c_string("crop")?;
18530
18531 let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
18532 let linear_in_name = utils::new_c_string("linear")?;
18533
18534 let input_profile_in: CString = utils::new_c_string(&thumbnail_options.input_profile)?;
18535 let input_profile_in_name = utils::new_c_string("input-profile")?;
18536
18537 let output_profile_in: CString = utils::new_c_string(&thumbnail_options.output_profile)?;
18538 let output_profile_in_name = utils::new_c_string("output-profile")?;
18539
18540 let intent_in: i32 = thumbnail_options.intent as i32;
18541 let intent_in_name = utils::new_c_string("intent")?;
18542
18543 let fail_on_in: i32 = thumbnail_options.fail_on as i32;
18544 let fail_on_in_name = utils::new_c_string("fail-on")?;
18545
18546 let vips_op_response = bindings::vips_thumbnail(
18547 filename_in.as_ptr(),
18548 &mut out_out,
18549 width_in,
18550 height_in_name.as_ptr(),
18551 height_in,
18552 size_in_name.as_ptr(),
18553 size_in,
18554 no_rotate_in_name.as_ptr(),
18555 no_rotate_in,
18556 crop_in_name.as_ptr(),
18557 crop_in,
18558 linear_in_name.as_ptr(),
18559 linear_in,
18560 input_profile_in_name.as_ptr(),
18561 input_profile_in.as_ptr(),
18562 output_profile_in_name.as_ptr(),
18563 output_profile_in.as_ptr(),
18564 intent_in_name.as_ptr(),
18565 intent_in,
18566 fail_on_in_name.as_ptr(),
18567 fail_on_in,
18568 NULL,
18569 );
18570 utils::result(
18571 vips_op_response,
18572 VipsImage { ctx: out_out },
18573 Error::ThumbnailError,
18574 )
18575 }
18576}
18577
18578pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
18584 unsafe {
18585 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18586 let width_in: i32 = width;
18587 let mut out_out: *mut bindings::VipsImage = null_mut();
18588
18589 let vips_op_response = bindings::vips_thumbnail_buffer(
18590 buffer_in,
18591 buffer.len() as u64,
18592 &mut out_out,
18593 width_in,
18594 NULL,
18595 );
18596 utils::result(
18597 vips_op_response,
18598 VipsImage { ctx: out_out },
18599 Error::ThumbnailBufferError,
18600 )
18601 }
18602}
18603
18604#[derive(Clone, Debug)]
18606pub struct ThumbnailBufferOptions {
18607 pub option_string: String,
18609 pub height: i32,
18612 pub size: Size,
18619 pub no_rotate: bool,
18622 pub crop: Interesting,
18632 pub linear: bool,
18635 pub input_profile: String,
18637 pub output_profile: String,
18639 pub intent: Intent,
18647 pub fail_on: FailOn,
18654}
18655
18656impl std::default::Default for ThumbnailBufferOptions {
18657 fn default() -> Self {
18658 ThumbnailBufferOptions {
18659 option_string: String::new(),
18660 height: i32::from(1),
18661 size: Size::Both,
18662 no_rotate: false,
18663 crop: Interesting::None,
18664 linear: false,
18665 input_profile: String::new(),
18666 output_profile: String::new(),
18667 intent: Intent::Relative,
18668 fail_on: FailOn::None,
18669 }
18670 }
18671}
18672
18673pub fn thumbnail_buffer_with_opts(
18680 buffer: &[u8],
18681 width: i32,
18682 thumbnail_buffer_options: &ThumbnailBufferOptions,
18683) -> Result<VipsImage> {
18684 unsafe {
18685 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18686 let width_in: i32 = width;
18687 let mut out_out: *mut bindings::VipsImage = null_mut();
18688
18689 let option_string_in: CString =
18690 utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18691 let option_string_in_name = utils::new_c_string("option-string")?;
18692
18693 let height_in: i32 = thumbnail_buffer_options.height;
18694 let height_in_name = utils::new_c_string("height")?;
18695
18696 let size_in: i32 = thumbnail_buffer_options.size as i32;
18697 let size_in_name = utils::new_c_string("size")?;
18698
18699 let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18700 1
18701 } else {
18702 0
18703 };
18704 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18705
18706 let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18707 let crop_in_name = utils::new_c_string("crop")?;
18708
18709 let linear_in: i32 = if thumbnail_buffer_options.linear {
18710 1
18711 } else {
18712 0
18713 };
18714 let linear_in_name = utils::new_c_string("linear")?;
18715
18716 let input_profile_in: CString =
18717 utils::new_c_string(&thumbnail_buffer_options.input_profile)?;
18718 let input_profile_in_name = utils::new_c_string("input-profile")?;
18719
18720 let output_profile_in: CString =
18721 utils::new_c_string(&thumbnail_buffer_options.output_profile)?;
18722 let output_profile_in_name = utils::new_c_string("output-profile")?;
18723
18724 let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18725 let intent_in_name = utils::new_c_string("intent")?;
18726
18727 let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18728 let fail_on_in_name = utils::new_c_string("fail-on")?;
18729
18730 let vips_op_response = bindings::vips_thumbnail_buffer(
18731 buffer_in,
18732 buffer.len() as u64,
18733 &mut out_out,
18734 width_in,
18735 option_string_in_name.as_ptr(),
18736 option_string_in.as_ptr(),
18737 height_in_name.as_ptr(),
18738 height_in,
18739 size_in_name.as_ptr(),
18740 size_in,
18741 no_rotate_in_name.as_ptr(),
18742 no_rotate_in,
18743 crop_in_name.as_ptr(),
18744 crop_in,
18745 linear_in_name.as_ptr(),
18746 linear_in,
18747 input_profile_in_name.as_ptr(),
18748 input_profile_in.as_ptr(),
18749 output_profile_in_name.as_ptr(),
18750 output_profile_in.as_ptr(),
18751 intent_in_name.as_ptr(),
18752 intent_in,
18753 fail_on_in_name.as_ptr(),
18754 fail_on_in,
18755 NULL,
18756 );
18757 utils::result(
18758 vips_op_response,
18759 VipsImage { ctx: out_out },
18760 Error::ThumbnailBufferError,
18761 )
18762 }
18763}
18764
18765pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18771 unsafe {
18772 let inp_in: *mut bindings::VipsImage = inp.ctx;
18773 let width_in: i32 = width;
18774 let mut out_out: *mut bindings::VipsImage = null_mut();
18775
18776 let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18777 utils::result(
18778 vips_op_response,
18779 VipsImage { ctx: out_out },
18780 Error::ThumbnailImageError,
18781 )
18782 }
18783}
18784
18785#[derive(Clone, Debug)]
18787pub struct ThumbnailImageOptions {
18788 pub height: i32,
18791 pub size: Size,
18798 pub no_rotate: bool,
18801 pub crop: Interesting,
18811 pub linear: bool,
18814 pub input_profile: String,
18816 pub output_profile: String,
18818 pub intent: Intent,
18826 pub fail_on: FailOn,
18833}
18834
18835impl std::default::Default for ThumbnailImageOptions {
18836 fn default() -> Self {
18837 ThumbnailImageOptions {
18838 height: i32::from(1),
18839 size: Size::Both,
18840 no_rotate: false,
18841 crop: Interesting::None,
18842 linear: false,
18843 input_profile: String::new(),
18844 output_profile: String::new(),
18845 intent: Intent::Relative,
18846 fail_on: FailOn::None,
18847 }
18848 }
18849}
18850
18851pub fn thumbnail_image_with_opts(
18858 inp: &VipsImage,
18859 width: i32,
18860 thumbnail_image_options: &ThumbnailImageOptions,
18861) -> Result<VipsImage> {
18862 unsafe {
18863 let inp_in: *mut bindings::VipsImage = inp.ctx;
18864 let width_in: i32 = width;
18865 let mut out_out: *mut bindings::VipsImage = null_mut();
18866
18867 let height_in: i32 = thumbnail_image_options.height;
18868 let height_in_name = utils::new_c_string("height")?;
18869
18870 let size_in: i32 = thumbnail_image_options.size as i32;
18871 let size_in_name = utils::new_c_string("size")?;
18872
18873 let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18874 1
18875 } else {
18876 0
18877 };
18878 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18879
18880 let crop_in: i32 = thumbnail_image_options.crop as i32;
18881 let crop_in_name = utils::new_c_string("crop")?;
18882
18883 let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18884 let linear_in_name = utils::new_c_string("linear")?;
18885
18886 let input_profile_in: CString =
18887 utils::new_c_string(&thumbnail_image_options.input_profile)?;
18888 let input_profile_in_name = utils::new_c_string("input-profile")?;
18889
18890 let output_profile_in: CString =
18891 utils::new_c_string(&thumbnail_image_options.output_profile)?;
18892 let output_profile_in_name = utils::new_c_string("output-profile")?;
18893
18894 let intent_in: i32 = thumbnail_image_options.intent as i32;
18895 let intent_in_name = utils::new_c_string("intent")?;
18896
18897 let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18898 let fail_on_in_name = utils::new_c_string("fail-on")?;
18899
18900 let vips_op_response = bindings::vips_thumbnail_image(
18901 inp_in,
18902 &mut out_out,
18903 width_in,
18904 height_in_name.as_ptr(),
18905 height_in,
18906 size_in_name.as_ptr(),
18907 size_in,
18908 no_rotate_in_name.as_ptr(),
18909 no_rotate_in,
18910 crop_in_name.as_ptr(),
18911 crop_in,
18912 linear_in_name.as_ptr(),
18913 linear_in,
18914 input_profile_in_name.as_ptr(),
18915 input_profile_in.as_ptr(),
18916 output_profile_in_name.as_ptr(),
18917 output_profile_in.as_ptr(),
18918 intent_in_name.as_ptr(),
18919 intent_in,
18920 fail_on_in_name.as_ptr(),
18921 fail_on_in,
18922 NULL,
18923 );
18924 utils::result(
18925 vips_op_response,
18926 VipsImage { ctx: out_out },
18927 Error::ThumbnailImageError,
18928 )
18929 }
18930}
18931
18932pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18938 unsafe {
18939 let source_in: *mut bindings::VipsSource = source.ctx;
18940 let width_in: i32 = width;
18941 let mut out_out: *mut bindings::VipsImage = null_mut();
18942
18943 let vips_op_response =
18944 bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18945 utils::result(
18946 vips_op_response,
18947 VipsImage { ctx: out_out },
18948 Error::ThumbnailSourceError,
18949 )
18950 }
18951}
18952
18953#[derive(Clone, Debug)]
18955pub struct ThumbnailSourceOptions {
18956 pub option_string: String,
18958 pub height: i32,
18961 pub size: Size,
18968 pub no_rotate: bool,
18971 pub crop: Interesting,
18981 pub linear: bool,
18984 pub input_profile: String,
18986 pub output_profile: String,
18988 pub intent: Intent,
18996 pub fail_on: FailOn,
19003}
19004
19005impl std::default::Default for ThumbnailSourceOptions {
19006 fn default() -> Self {
19007 ThumbnailSourceOptions {
19008 option_string: String::new(),
19009 height: i32::from(1),
19010 size: Size::Both,
19011 no_rotate: false,
19012 crop: Interesting::None,
19013 linear: false,
19014 input_profile: String::new(),
19015 output_profile: String::new(),
19016 intent: Intent::Relative,
19017 fail_on: FailOn::None,
19018 }
19019 }
19020}
19021
19022pub fn thumbnail_source_with_opts(
19029 source: &VipsSource,
19030 width: i32,
19031 thumbnail_source_options: &ThumbnailSourceOptions,
19032) -> Result<VipsImage> {
19033 unsafe {
19034 let source_in: *mut bindings::VipsSource = source.ctx;
19035 let width_in: i32 = width;
19036 let mut out_out: *mut bindings::VipsImage = null_mut();
19037
19038 let option_string_in: CString =
19039 utils::new_c_string(&thumbnail_source_options.option_string)?;
19040 let option_string_in_name = utils::new_c_string("option-string")?;
19041
19042 let height_in: i32 = thumbnail_source_options.height;
19043 let height_in_name = utils::new_c_string("height")?;
19044
19045 let size_in: i32 = thumbnail_source_options.size as i32;
19046 let size_in_name = utils::new_c_string("size")?;
19047
19048 let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
19049 1
19050 } else {
19051 0
19052 };
19053 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
19054
19055 let crop_in: i32 = thumbnail_source_options.crop as i32;
19056 let crop_in_name = utils::new_c_string("crop")?;
19057
19058 let linear_in: i32 = if thumbnail_source_options.linear {
19059 1
19060 } else {
19061 0
19062 };
19063 let linear_in_name = utils::new_c_string("linear")?;
19064
19065 let input_profile_in: CString =
19066 utils::new_c_string(&thumbnail_source_options.input_profile)?;
19067 let input_profile_in_name = utils::new_c_string("input-profile")?;
19068
19069 let output_profile_in: CString =
19070 utils::new_c_string(&thumbnail_source_options.output_profile)?;
19071 let output_profile_in_name = utils::new_c_string("output-profile")?;
19072
19073 let intent_in: i32 = thumbnail_source_options.intent as i32;
19074 let intent_in_name = utils::new_c_string("intent")?;
19075
19076 let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
19077 let fail_on_in_name = utils::new_c_string("fail-on")?;
19078
19079 let vips_op_response = bindings::vips_thumbnail_source(
19080 source_in,
19081 &mut out_out,
19082 width_in,
19083 option_string_in_name.as_ptr(),
19084 option_string_in.as_ptr(),
19085 height_in_name.as_ptr(),
19086 height_in,
19087 size_in_name.as_ptr(),
19088 size_in,
19089 no_rotate_in_name.as_ptr(),
19090 no_rotate_in,
19091 crop_in_name.as_ptr(),
19092 crop_in,
19093 linear_in_name.as_ptr(),
19094 linear_in,
19095 input_profile_in_name.as_ptr(),
19096 input_profile_in.as_ptr(),
19097 output_profile_in_name.as_ptr(),
19098 output_profile_in.as_ptr(),
19099 intent_in_name.as_ptr(),
19100 intent_in,
19101 fail_on_in_name.as_ptr(),
19102 fail_on_in,
19103 NULL,
19104 );
19105 utils::result(
19106 vips_op_response,
19107 VipsImage { ctx: out_out },
19108 Error::ThumbnailSourceError,
19109 )
19110 }
19111}
19112
19113pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
19118 unsafe {
19119 let inp_in: *mut bindings::VipsImage = inp.ctx;
19120 let index_in: *mut bindings::VipsImage = index.ctx;
19121 let mut out_out: *mut bindings::VipsImage = null_mut();
19122
19123 let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
19124 utils::result(
19125 vips_op_response,
19126 VipsImage { ctx: out_out },
19127 Error::MapimError,
19128 )
19129 }
19130}
19131
19132#[derive(Clone, Debug)]
19134pub struct MapimOptions {
19135 pub interpolate: VipsInterpolate,
19137 pub background: Vec<f64>,
19139 pub premultiplied: bool,
19142 pub extend: Extend,
19151}
19152
19153impl std::default::Default for MapimOptions {
19154 fn default() -> Self {
19155 MapimOptions {
19156 interpolate: VipsInterpolate::new(),
19157 background: Vec::new(),
19158 premultiplied: false,
19159 extend: Extend::Background,
19160 }
19161 }
19162}
19163
19164pub fn mapim_with_opts(
19170 inp: &VipsImage,
19171 index: &VipsImage,
19172 mapim_options: &MapimOptions,
19173) -> Result<VipsImage> {
19174 unsafe {
19175 let inp_in: *mut bindings::VipsImage = inp.ctx;
19176 let index_in: *mut bindings::VipsImage = index.ctx;
19177 let mut out_out: *mut bindings::VipsImage = null_mut();
19178
19179 let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
19180 let interpolate_in_name = utils::new_c_string("interpolate")?;
19181
19182 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
19183 let background_in = background_wrapper.ctx;
19184 let background_in_name = utils::new_c_string("background")?;
19185
19186 let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
19187 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19188
19189 let extend_in: i32 = mapim_options.extend as i32;
19190 let extend_in_name = utils::new_c_string("extend")?;
19191
19192 let vips_op_response = bindings::vips_mapim(
19193 inp_in,
19194 &mut out_out,
19195 index_in,
19196 interpolate_in_name.as_ptr(),
19197 interpolate_in,
19198 background_in_name.as_ptr(),
19199 background_in,
19200 premultiplied_in_name.as_ptr(),
19201 premultiplied_in,
19202 extend_in_name.as_ptr(),
19203 extend_in,
19204 NULL,
19205 );
19206 utils::result(
19207 vips_op_response,
19208 VipsImage { ctx: out_out },
19209 Error::MapimError,
19210 )
19211 }
19212}
19213
19214pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19222 unsafe {
19223 let inp_in: *mut bindings::VipsImage = inp.ctx;
19224 let hshrink_in: f64 = hshrink;
19225 let vshrink_in: f64 = vshrink;
19226 let mut out_out: *mut bindings::VipsImage = null_mut();
19227
19228 let vips_op_response =
19229 bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19230 utils::result(
19231 vips_op_response,
19232 VipsImage { ctx: out_out },
19233 Error::ShrinkError,
19234 )
19235 }
19236}
19237
19238#[derive(Clone, Debug)]
19240pub struct ShrinkOptions {
19241 pub ceil: bool,
19244}
19245
19246impl std::default::Default for ShrinkOptions {
19247 fn default() -> Self {
19248 ShrinkOptions { ceil: false }
19249 }
19250}
19251
19252pub fn shrink_with_opts(
19261 inp: &VipsImage,
19262 hshrink: f64,
19263 vshrink: f64,
19264 shrink_options: &ShrinkOptions,
19265) -> Result<VipsImage> {
19266 unsafe {
19267 let inp_in: *mut bindings::VipsImage = inp.ctx;
19268 let hshrink_in: f64 = hshrink;
19269 let vshrink_in: f64 = vshrink;
19270 let mut out_out: *mut bindings::VipsImage = null_mut();
19271
19272 let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
19273 let ceil_in_name = utils::new_c_string("ceil")?;
19274
19275 let vips_op_response = bindings::vips_shrink(
19276 inp_in,
19277 &mut out_out,
19278 hshrink_in,
19279 vshrink_in,
19280 ceil_in_name.as_ptr(),
19281 ceil_in,
19282 NULL,
19283 );
19284 utils::result(
19285 vips_op_response,
19286 VipsImage { ctx: out_out },
19287 Error::ShrinkError,
19288 )
19289 }
19290}
19291
19292pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
19298 unsafe {
19299 let inp_in: *mut bindings::VipsImage = inp.ctx;
19300 let hshrink_in: i32 = hshrink;
19301 let mut out_out: *mut bindings::VipsImage = null_mut();
19302
19303 let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
19304 utils::result(
19305 vips_op_response,
19306 VipsImage { ctx: out_out },
19307 Error::ShrinkhError,
19308 )
19309 }
19310}
19311
19312#[derive(Clone, Debug)]
19314pub struct ShrinkhOptions {
19315 pub ceil: bool,
19318}
19319
19320impl std::default::Default for ShrinkhOptions {
19321 fn default() -> Self {
19322 ShrinkhOptions { ceil: false }
19323 }
19324}
19325
19326pub fn shrinkh_with_opts(
19333 inp: &VipsImage,
19334 hshrink: i32,
19335 shrinkh_options: &ShrinkhOptions,
19336) -> Result<VipsImage> {
19337 unsafe {
19338 let inp_in: *mut bindings::VipsImage = inp.ctx;
19339 let hshrink_in: i32 = hshrink;
19340 let mut out_out: *mut bindings::VipsImage = null_mut();
19341
19342 let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
19343 let ceil_in_name = utils::new_c_string("ceil")?;
19344
19345 let vips_op_response = bindings::vips_shrinkh(
19346 inp_in,
19347 &mut out_out,
19348 hshrink_in,
19349 ceil_in_name.as_ptr(),
19350 ceil_in,
19351 NULL,
19352 );
19353 utils::result(
19354 vips_op_response,
19355 VipsImage { ctx: out_out },
19356 Error::ShrinkhError,
19357 )
19358 }
19359}
19360
19361pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
19367 unsafe {
19368 let inp_in: *mut bindings::VipsImage = inp.ctx;
19369 let vshrink_in: i32 = vshrink;
19370 let mut out_out: *mut bindings::VipsImage = null_mut();
19371
19372 let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
19373 utils::result(
19374 vips_op_response,
19375 VipsImage { ctx: out_out },
19376 Error::ShrinkvError,
19377 )
19378 }
19379}
19380
19381#[derive(Clone, Debug)]
19383pub struct ShrinkvOptions {
19384 pub ceil: bool,
19387}
19388
19389impl std::default::Default for ShrinkvOptions {
19390 fn default() -> Self {
19391 ShrinkvOptions { ceil: false }
19392 }
19393}
19394
19395pub fn shrinkv_with_opts(
19402 inp: &VipsImage,
19403 vshrink: i32,
19404 shrinkv_options: &ShrinkvOptions,
19405) -> Result<VipsImage> {
19406 unsafe {
19407 let inp_in: *mut bindings::VipsImage = inp.ctx;
19408 let vshrink_in: i32 = vshrink;
19409 let mut out_out: *mut bindings::VipsImage = null_mut();
19410
19411 let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
19412 let ceil_in_name = utils::new_c_string("ceil")?;
19413
19414 let vips_op_response = bindings::vips_shrinkv(
19415 inp_in,
19416 &mut out_out,
19417 vshrink_in,
19418 ceil_in_name.as_ptr(),
19419 ceil_in,
19420 NULL,
19421 );
19422 utils::result(
19423 vips_op_response,
19424 VipsImage { ctx: out_out },
19425 Error::ShrinkvError,
19426 )
19427 }
19428}
19429
19430pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
19436 unsafe {
19437 let inp_in: *mut bindings::VipsImage = inp.ctx;
19438 let hshrink_in: f64 = hshrink;
19439 let mut out_out: *mut bindings::VipsImage = null_mut();
19440
19441 let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
19442 utils::result(
19443 vips_op_response,
19444 VipsImage { ctx: out_out },
19445 Error::ReducehError,
19446 )
19447 }
19448}
19449
19450#[derive(Clone, Debug)]
19452pub struct ReducehOptions {
19453 pub kernel: Kernel,
19464 pub gap: f64,
19467}
19468
19469impl std::default::Default for ReducehOptions {
19470 fn default() -> Self {
19471 ReducehOptions {
19472 kernel: Kernel::Lanczos3,
19473 gap: f64::from(0),
19474 }
19475 }
19476}
19477
19478pub fn reduceh_with_opts(
19485 inp: &VipsImage,
19486 hshrink: f64,
19487 reduceh_options: &ReducehOptions,
19488) -> Result<VipsImage> {
19489 unsafe {
19490 let inp_in: *mut bindings::VipsImage = inp.ctx;
19491 let hshrink_in: f64 = hshrink;
19492 let mut out_out: *mut bindings::VipsImage = null_mut();
19493
19494 let kernel_in: i32 = reduceh_options.kernel as i32;
19495 let kernel_in_name = utils::new_c_string("kernel")?;
19496
19497 let gap_in: f64 = reduceh_options.gap;
19498 let gap_in_name = utils::new_c_string("gap")?;
19499
19500 let vips_op_response = bindings::vips_reduceh(
19501 inp_in,
19502 &mut out_out,
19503 hshrink_in,
19504 kernel_in_name.as_ptr(),
19505 kernel_in,
19506 gap_in_name.as_ptr(),
19507 gap_in,
19508 NULL,
19509 );
19510 utils::result(
19511 vips_op_response,
19512 VipsImage { ctx: out_out },
19513 Error::ReducehError,
19514 )
19515 }
19516}
19517
19518pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
19524 unsafe {
19525 let inp_in: *mut bindings::VipsImage = inp.ctx;
19526 let vshrink_in: f64 = vshrink;
19527 let mut out_out: *mut bindings::VipsImage = null_mut();
19528
19529 let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
19530 utils::result(
19531 vips_op_response,
19532 VipsImage { ctx: out_out },
19533 Error::ReducevError,
19534 )
19535 }
19536}
19537
19538#[derive(Clone, Debug)]
19540pub struct ReducevOptions {
19541 pub kernel: Kernel,
19552 pub gap: f64,
19555}
19556
19557impl std::default::Default for ReducevOptions {
19558 fn default() -> Self {
19559 ReducevOptions {
19560 kernel: Kernel::Lanczos3,
19561 gap: f64::from(0),
19562 }
19563 }
19564}
19565
19566pub fn reducev_with_opts(
19573 inp: &VipsImage,
19574 vshrink: f64,
19575 reducev_options: &ReducevOptions,
19576) -> Result<VipsImage> {
19577 unsafe {
19578 let inp_in: *mut bindings::VipsImage = inp.ctx;
19579 let vshrink_in: f64 = vshrink;
19580 let mut out_out: *mut bindings::VipsImage = null_mut();
19581
19582 let kernel_in: i32 = reducev_options.kernel as i32;
19583 let kernel_in_name = utils::new_c_string("kernel")?;
19584
19585 let gap_in: f64 = reducev_options.gap;
19586 let gap_in_name = utils::new_c_string("gap")?;
19587
19588 let vips_op_response = bindings::vips_reducev(
19589 inp_in,
19590 &mut out_out,
19591 vshrink_in,
19592 kernel_in_name.as_ptr(),
19593 kernel_in,
19594 gap_in_name.as_ptr(),
19595 gap_in,
19596 NULL,
19597 );
19598 utils::result(
19599 vips_op_response,
19600 VipsImage { ctx: out_out },
19601 Error::ReducevError,
19602 )
19603 }
19604}
19605
19606pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
19614 unsafe {
19615 let inp_in: *mut bindings::VipsImage = inp.ctx;
19616 let hshrink_in: f64 = hshrink;
19617 let vshrink_in: f64 = vshrink;
19618 let mut out_out: *mut bindings::VipsImage = null_mut();
19619
19620 let vips_op_response =
19621 bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
19622 utils::result(
19623 vips_op_response,
19624 VipsImage { ctx: out_out },
19625 Error::ReduceError,
19626 )
19627 }
19628}
19629
19630#[derive(Clone, Debug)]
19632pub struct ReduceOptions {
19633 pub kernel: Kernel,
19644 pub gap: f64,
19647}
19648
19649impl std::default::Default for ReduceOptions {
19650 fn default() -> Self {
19651 ReduceOptions {
19652 kernel: Kernel::Lanczos3,
19653 gap: f64::from(0),
19654 }
19655 }
19656}
19657
19658pub fn reduce_with_opts(
19667 inp: &VipsImage,
19668 hshrink: f64,
19669 vshrink: f64,
19670 reduce_options: &ReduceOptions,
19671) -> Result<VipsImage> {
19672 unsafe {
19673 let inp_in: *mut bindings::VipsImage = inp.ctx;
19674 let hshrink_in: f64 = hshrink;
19675 let vshrink_in: f64 = vshrink;
19676 let mut out_out: *mut bindings::VipsImage = null_mut();
19677
19678 let kernel_in: i32 = reduce_options.kernel as i32;
19679 let kernel_in_name = utils::new_c_string("kernel")?;
19680
19681 let gap_in: f64 = reduce_options.gap;
19682 let gap_in_name = utils::new_c_string("gap")?;
19683
19684 let vips_op_response = bindings::vips_reduce(
19685 inp_in,
19686 &mut out_out,
19687 hshrink_in,
19688 vshrink_in,
19689 kernel_in_name.as_ptr(),
19690 kernel_in,
19691 gap_in_name.as_ptr(),
19692 gap_in,
19693 NULL,
19694 );
19695 utils::result(
19696 vips_op_response,
19697 VipsImage { ctx: out_out },
19698 Error::ReduceError,
19699 )
19700 }
19701}
19702
19703pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19708 unsafe {
19709 let inp_in: *mut bindings::VipsImage = inp.ctx;
19710 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19711 let mut out_out: *mut bindings::VipsImage = null_mut();
19712
19713 let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19714 utils::result(
19715 vips_op_response,
19716 VipsImage { ctx: out_out },
19717 Error::QuadraticError,
19718 )
19719 }
19720}
19721
19722#[derive(Clone, Debug)]
19724pub struct QuadraticOptions {
19725 pub interpolate: VipsInterpolate,
19727}
19728
19729impl std::default::Default for QuadraticOptions {
19730 fn default() -> Self {
19731 QuadraticOptions {
19732 interpolate: VipsInterpolate::new(),
19733 }
19734 }
19735}
19736
19737pub fn quadratic_with_opts(
19743 inp: &VipsImage,
19744 coeff: &VipsImage,
19745 quadratic_options: &QuadraticOptions,
19746) -> Result<VipsImage> {
19747 unsafe {
19748 let inp_in: *mut bindings::VipsImage = inp.ctx;
19749 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19750 let mut out_out: *mut bindings::VipsImage = null_mut();
19751
19752 let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19753 let interpolate_in_name = utils::new_c_string("interpolate")?;
19754
19755 let vips_op_response = bindings::vips_quadratic(
19756 inp_in,
19757 &mut out_out,
19758 coeff_in,
19759 interpolate_in_name.as_ptr(),
19760 interpolate_in,
19761 NULL,
19762 );
19763 utils::result(
19764 vips_op_response,
19765 VipsImage { ctx: out_out },
19766 Error::QuadraticError,
19767 )
19768 }
19769}
19770
19771pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19783 unsafe {
19784 let inp_in: *mut bindings::VipsImage = inp.ctx;
19785 let a_in: f64 = a;
19786 let b_in: f64 = b;
19787 let c_in: f64 = c;
19788 let d_in: f64 = d;
19789 let mut out_out: *mut bindings::VipsImage = null_mut();
19790
19791 let vips_op_response =
19792 bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19793 utils::result(
19794 vips_op_response,
19795 VipsImage { ctx: out_out },
19796 Error::AffineError,
19797 )
19798 }
19799}
19800
19801#[derive(Clone, Debug)]
19803pub struct AffineOptions {
19804 pub interpolate: VipsInterpolate,
19806 pub oarea: Vec<i32>,
19808 pub odx: f64,
19811 pub ody: f64,
19814 pub idx: f64,
19817 pub idy: f64,
19820 pub background: Vec<f64>,
19822 pub premultiplied: bool,
19825 pub extend: Extend,
19834}
19835
19836impl std::default::Default for AffineOptions {
19837 fn default() -> Self {
19838 AffineOptions {
19839 interpolate: VipsInterpolate::new(),
19840 oarea: Vec::new(),
19841 odx: f64::from(0),
19842 ody: f64::from(0),
19843 idx: f64::from(0),
19844 idy: f64::from(0),
19845 background: Vec::new(),
19846 premultiplied: false,
19847 extend: Extend::Background,
19848 }
19849 }
19850}
19851
19852pub fn affine_with_opts(
19865 inp: &VipsImage,
19866 a: f64,
19867 b: f64,
19868 c: f64,
19869 d: f64,
19870 affine_options: &AffineOptions,
19871) -> Result<VipsImage> {
19872 unsafe {
19873 let inp_in: *mut bindings::VipsImage = inp.ctx;
19874 let a_in: f64 = a;
19875 let b_in: f64 = b;
19876 let c_in: f64 = c;
19877 let d_in: f64 = d;
19878 let mut out_out: *mut bindings::VipsImage = null_mut();
19879
19880 let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19881 let interpolate_in_name = utils::new_c_string("interpolate")?;
19882
19883 let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19884 let oarea_in = oarea_wrapper.ctx;
19885 let oarea_in_name = utils::new_c_string("oarea")?;
19886
19887 let odx_in: f64 = affine_options.odx;
19888 let odx_in_name = utils::new_c_string("odx")?;
19889
19890 let ody_in: f64 = affine_options.ody;
19891 let ody_in_name = utils::new_c_string("ody")?;
19892
19893 let idx_in: f64 = affine_options.idx;
19894 let idx_in_name = utils::new_c_string("idx")?;
19895
19896 let idy_in: f64 = affine_options.idy;
19897 let idy_in_name = utils::new_c_string("idy")?;
19898
19899 let background_wrapper =
19900 utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19901 let background_in = background_wrapper.ctx;
19902 let background_in_name = utils::new_c_string("background")?;
19903
19904 let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19905 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19906
19907 let extend_in: i32 = affine_options.extend as i32;
19908 let extend_in_name = utils::new_c_string("extend")?;
19909
19910 let vips_op_response = bindings::vips_affine(
19911 inp_in,
19912 &mut out_out,
19913 a_in,
19914 b_in,
19915 c_in,
19916 d_in,
19917 interpolate_in_name.as_ptr(),
19918 interpolate_in,
19919 oarea_in_name.as_ptr(),
19920 oarea_in,
19921 odx_in_name.as_ptr(),
19922 odx_in,
19923 ody_in_name.as_ptr(),
19924 ody_in,
19925 idx_in_name.as_ptr(),
19926 idx_in,
19927 idy_in_name.as_ptr(),
19928 idy_in,
19929 background_in_name.as_ptr(),
19930 background_in,
19931 premultiplied_in_name.as_ptr(),
19932 premultiplied_in,
19933 extend_in_name.as_ptr(),
19934 extend_in,
19935 NULL,
19936 );
19937 utils::result(
19938 vips_op_response,
19939 VipsImage { ctx: out_out },
19940 Error::AffineError,
19941 )
19942 }
19943}
19944
19945pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19949 unsafe {
19950 let inp_in: *mut bindings::VipsImage = inp.ctx;
19951 let mut out_out: *mut bindings::VipsImage = null_mut();
19952
19953 let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19954 utils::result(
19955 vips_op_response,
19956 VipsImage { ctx: out_out },
19957 Error::SimilarityError,
19958 )
19959 }
19960}
19961
19962#[derive(Clone, Debug)]
19964pub struct SimilarityOptions {
19965 pub scale: f64,
19968 pub angle: f64,
19971 pub interpolate: VipsInterpolate,
19973 pub background: Vec<f64>,
19975 pub odx: f64,
19978 pub ody: f64,
19981 pub idx: f64,
19984 pub idy: f64,
19987}
19988
19989impl std::default::Default for SimilarityOptions {
19990 fn default() -> Self {
19991 SimilarityOptions {
19992 scale: f64::from(1),
19993 angle: f64::from(0),
19994 interpolate: VipsInterpolate::new(),
19995 background: Vec::new(),
19996 odx: f64::from(0),
19997 ody: f64::from(0),
19998 idx: f64::from(0),
19999 idy: f64::from(0),
20000 }
20001 }
20002}
20003
20004pub fn similarity_with_opts(
20009 inp: &VipsImage,
20010 similarity_options: &SimilarityOptions,
20011) -> Result<VipsImage> {
20012 unsafe {
20013 let inp_in: *mut bindings::VipsImage = inp.ctx;
20014 let mut out_out: *mut bindings::VipsImage = null_mut();
20015
20016 let scale_in: f64 = similarity_options.scale;
20017 let scale_in_name = utils::new_c_string("scale")?;
20018
20019 let angle_in: f64 = similarity_options.angle;
20020 let angle_in_name = utils::new_c_string("angle")?;
20021
20022 let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
20023 let interpolate_in_name = utils::new_c_string("interpolate")?;
20024
20025 let background_wrapper =
20026 utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
20027 let background_in = background_wrapper.ctx;
20028 let background_in_name = utils::new_c_string("background")?;
20029
20030 let odx_in: f64 = similarity_options.odx;
20031 let odx_in_name = utils::new_c_string("odx")?;
20032
20033 let ody_in: f64 = similarity_options.ody;
20034 let ody_in_name = utils::new_c_string("ody")?;
20035
20036 let idx_in: f64 = similarity_options.idx;
20037 let idx_in_name = utils::new_c_string("idx")?;
20038
20039 let idy_in: f64 = similarity_options.idy;
20040 let idy_in_name = utils::new_c_string("idy")?;
20041
20042 let vips_op_response = bindings::vips_similarity(
20043 inp_in,
20044 &mut out_out,
20045 scale_in_name.as_ptr(),
20046 scale_in,
20047 angle_in_name.as_ptr(),
20048 angle_in,
20049 interpolate_in_name.as_ptr(),
20050 interpolate_in,
20051 background_in_name.as_ptr(),
20052 background_in,
20053 odx_in_name.as_ptr(),
20054 odx_in,
20055 ody_in_name.as_ptr(),
20056 ody_in,
20057 idx_in_name.as_ptr(),
20058 idx_in,
20059 idy_in_name.as_ptr(),
20060 idy_in,
20061 NULL,
20062 );
20063 utils::result(
20064 vips_op_response,
20065 VipsImage { ctx: out_out },
20066 Error::SimilarityError,
20067 )
20068 }
20069}
20070
20071pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
20077 unsafe {
20078 let inp_in: *mut bindings::VipsImage = inp.ctx;
20079 let angle_in: f64 = angle;
20080 let mut out_out: *mut bindings::VipsImage = null_mut();
20081
20082 let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
20083 utils::result(
20084 vips_op_response,
20085 VipsImage { ctx: out_out },
20086 Error::RotateError,
20087 )
20088 }
20089}
20090
20091#[derive(Clone, Debug)]
20093pub struct RotateOptions {
20094 pub interpolate: VipsInterpolate,
20096 pub background: Vec<f64>,
20098 pub odx: f64,
20101 pub ody: f64,
20104 pub idx: f64,
20107 pub idy: f64,
20110}
20111
20112impl std::default::Default for RotateOptions {
20113 fn default() -> Self {
20114 RotateOptions {
20115 interpolate: VipsInterpolate::new(),
20116 background: Vec::new(),
20117 odx: f64::from(0),
20118 ody: f64::from(0),
20119 idx: f64::from(0),
20120 idy: f64::from(0),
20121 }
20122 }
20123}
20124
20125pub fn rotate_with_opts(
20132 inp: &VipsImage,
20133 angle: f64,
20134 rotate_options: &RotateOptions,
20135) -> Result<VipsImage> {
20136 unsafe {
20137 let inp_in: *mut bindings::VipsImage = inp.ctx;
20138 let angle_in: f64 = angle;
20139 let mut out_out: *mut bindings::VipsImage = null_mut();
20140
20141 let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
20142 let interpolate_in_name = utils::new_c_string("interpolate")?;
20143
20144 let background_wrapper =
20145 utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
20146 let background_in = background_wrapper.ctx;
20147 let background_in_name = utils::new_c_string("background")?;
20148
20149 let odx_in: f64 = rotate_options.odx;
20150 let odx_in_name = utils::new_c_string("odx")?;
20151
20152 let ody_in: f64 = rotate_options.ody;
20153 let ody_in_name = utils::new_c_string("ody")?;
20154
20155 let idx_in: f64 = rotate_options.idx;
20156 let idx_in_name = utils::new_c_string("idx")?;
20157
20158 let idy_in: f64 = rotate_options.idy;
20159 let idy_in_name = utils::new_c_string("idy")?;
20160
20161 let vips_op_response = bindings::vips_rotate(
20162 inp_in,
20163 &mut out_out,
20164 angle_in,
20165 interpolate_in_name.as_ptr(),
20166 interpolate_in,
20167 background_in_name.as_ptr(),
20168 background_in,
20169 odx_in_name.as_ptr(),
20170 odx_in,
20171 ody_in_name.as_ptr(),
20172 ody_in,
20173 idx_in_name.as_ptr(),
20174 idx_in,
20175 idy_in_name.as_ptr(),
20176 idy_in,
20177 NULL,
20178 );
20179 utils::result(
20180 vips_op_response,
20181 VipsImage { ctx: out_out },
20182 Error::RotateError,
20183 )
20184 }
20185}
20186
20187pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
20193 unsafe {
20194 let inp_in: *mut bindings::VipsImage = inp.ctx;
20195 let scale_in: f64 = scale;
20196 let mut out_out: *mut bindings::VipsImage = null_mut();
20197
20198 let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
20199 utils::result(
20200 vips_op_response,
20201 VipsImage { ctx: out_out },
20202 Error::ResizeError,
20203 )
20204 }
20205}
20206
20207#[derive(Clone, Debug)]
20209pub struct ResizeOptions {
20210 pub kernel: Kernel,
20221 pub gap: f64,
20224 pub vscale: f64,
20227}
20228
20229impl std::default::Default for ResizeOptions {
20230 fn default() -> Self {
20231 ResizeOptions {
20232 kernel: Kernel::Lanczos3,
20233 gap: f64::from(2),
20234 vscale: f64::from(0),
20235 }
20236 }
20237}
20238
20239pub fn resize_with_opts(
20246 inp: &VipsImage,
20247 scale: f64,
20248 resize_options: &ResizeOptions,
20249) -> Result<VipsImage> {
20250 unsafe {
20251 let inp_in: *mut bindings::VipsImage = inp.ctx;
20252 let scale_in: f64 = scale;
20253 let mut out_out: *mut bindings::VipsImage = null_mut();
20254
20255 let kernel_in: i32 = resize_options.kernel as i32;
20256 let kernel_in_name = utils::new_c_string("kernel")?;
20257
20258 let gap_in: f64 = resize_options.gap;
20259 let gap_in_name = utils::new_c_string("gap")?;
20260
20261 let vscale_in: f64 = resize_options.vscale;
20262 let vscale_in_name = utils::new_c_string("vscale")?;
20263
20264 let vips_op_response = bindings::vips_resize(
20265 inp_in,
20266 &mut out_out,
20267 scale_in,
20268 kernel_in_name.as_ptr(),
20269 kernel_in,
20270 gap_in_name.as_ptr(),
20271 gap_in,
20272 vscale_in_name.as_ptr(),
20273 vscale_in,
20274 NULL,
20275 );
20276 utils::result(
20277 vips_op_response,
20278 VipsImage { ctx: out_out },
20279 Error::ResizeError,
20280 )
20281 }
20282}
20283
20284pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
20310 unsafe {
20311 let inp_in: *mut bindings::VipsImage = inp.ctx;
20312 let space_in: i32 = space as i32;
20313 let mut out_out: *mut bindings::VipsImage = null_mut();
20314
20315 let vips_op_response =
20316 bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
20317 utils::result(
20318 vips_op_response,
20319 VipsImage { ctx: out_out },
20320 Error::ColourspaceError,
20321 )
20322 }
20323}
20324
20325#[derive(Clone, Debug)]
20327pub struct ColourspaceOptions {
20328 pub source_space: Interpretation,
20351}
20352
20353impl std::default::Default for ColourspaceOptions {
20354 fn default() -> Self {
20355 ColourspaceOptions {
20356 source_space: Interpretation::Srgb,
20357 }
20358 }
20359}
20360
20361pub fn colourspace_with_opts(
20388 inp: &VipsImage,
20389 space: Interpretation,
20390 colourspace_options: &ColourspaceOptions,
20391) -> Result<VipsImage> {
20392 unsafe {
20393 let inp_in: *mut bindings::VipsImage = inp.ctx;
20394 let space_in: i32 = space as i32;
20395 let mut out_out: *mut bindings::VipsImage = null_mut();
20396
20397 let source_space_in: i32 = colourspace_options.source_space as i32;
20398 let source_space_in_name = utils::new_c_string("source-space")?;
20399
20400 let vips_op_response = bindings::vips_colourspace(
20401 inp_in,
20402 &mut out_out,
20403 space_in.try_into().unwrap(),
20404 source_space_in_name.as_ptr(),
20405 source_space_in,
20406 NULL,
20407 );
20408 utils::result(
20409 vips_op_response,
20410 VipsImage { ctx: out_out },
20411 Error::ColourspaceError,
20412 )
20413 }
20414}
20415
20416pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20420 unsafe {
20421 let inp_in: *mut bindings::VipsImage = inp.ctx;
20422 let mut out_out: *mut bindings::VipsImage = null_mut();
20423
20424 let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
20425 utils::result(
20426 vips_op_response,
20427 VipsImage { ctx: out_out },
20428 Error::Lab2XyzError,
20429 )
20430 }
20431}
20432
20433#[derive(Clone, Debug)]
20435pub struct Lab2XyzOptions {
20436 pub temp: Vec<f64>,
20438}
20439
20440impl std::default::Default for Lab2XyzOptions {
20441 fn default() -> Self {
20442 Lab2XyzOptions { temp: Vec::new() }
20443 }
20444}
20445
20446pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
20451 unsafe {
20452 let inp_in: *mut bindings::VipsImage = inp.ctx;
20453 let mut out_out: *mut bindings::VipsImage = null_mut();
20454
20455 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
20456 let temp_in = temp_wrapper.ctx;
20457 let temp_in_name = utils::new_c_string("temp")?;
20458
20459 let vips_op_response =
20460 bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20461 utils::result(
20462 vips_op_response,
20463 VipsImage { ctx: out_out },
20464 Error::Lab2XyzError,
20465 )
20466 }
20467}
20468
20469pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
20473 unsafe {
20474 let inp_in: *mut bindings::VipsImage = inp.ctx;
20475 let mut out_out: *mut bindings::VipsImage = null_mut();
20476
20477 let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
20478 utils::result(
20479 vips_op_response,
20480 VipsImage { ctx: out_out },
20481 Error::Xyz2LabError,
20482 )
20483 }
20484}
20485
20486#[derive(Clone, Debug)]
20488pub struct Xyz2LabOptions {
20489 pub temp: Vec<f64>,
20491}
20492
20493impl std::default::Default for Xyz2LabOptions {
20494 fn default() -> Self {
20495 Xyz2LabOptions { temp: Vec::new() }
20496 }
20497}
20498
20499pub fn xyz2_lab_with_opts(
20504 inp: &VipsImage,
20505 xyz_2_lab_options: &Xyz2LabOptions,
20506) -> Result<VipsImage> {
20507 unsafe {
20508 let inp_in: *mut bindings::VipsImage = inp.ctx;
20509 let mut out_out: *mut bindings::VipsImage = null_mut();
20510
20511 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
20512 let temp_in = temp_wrapper.ctx;
20513 let temp_in_name = utils::new_c_string("temp")?;
20514
20515 let vips_op_response =
20516 bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
20517 utils::result(
20518 vips_op_response,
20519 VipsImage { ctx: out_out },
20520 Error::Xyz2LabError,
20521 )
20522 }
20523}
20524
20525pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20529 unsafe {
20530 let inp_in: *mut bindings::VipsImage = inp.ctx;
20531 let mut out_out: *mut bindings::VipsImage = null_mut();
20532
20533 let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
20534 utils::result(
20535 vips_op_response,
20536 VipsImage { ctx: out_out },
20537 Error::Lab2LChError,
20538 )
20539 }
20540}
20541
20542pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
20546 unsafe {
20547 let inp_in: *mut bindings::VipsImage = inp.ctx;
20548 let mut out_out: *mut bindings::VipsImage = null_mut();
20549
20550 let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
20551 utils::result(
20552 vips_op_response,
20553 VipsImage { ctx: out_out },
20554 Error::LCh2LabError,
20555 )
20556 }
20557}
20558
20559pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
20563 unsafe {
20564 let inp_in: *mut bindings::VipsImage = inp.ctx;
20565 let mut out_out: *mut bindings::VipsImage = null_mut();
20566
20567 let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
20568 utils::result(
20569 vips_op_response,
20570 VipsImage { ctx: out_out },
20571 Error::LCh2CmcError,
20572 )
20573 }
20574}
20575
20576pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
20580 unsafe {
20581 let inp_in: *mut bindings::VipsImage = inp.ctx;
20582 let mut out_out: *mut bindings::VipsImage = null_mut();
20583
20584 let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
20585 utils::result(
20586 vips_op_response,
20587 VipsImage { ctx: out_out },
20588 Error::Cmc2LChError,
20589 )
20590 }
20591}
20592
20593pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
20597 unsafe {
20598 let inp_in: *mut bindings::VipsImage = inp.ctx;
20599 let mut out_out: *mut bindings::VipsImage = null_mut();
20600
20601 let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
20602 utils::result(
20603 vips_op_response,
20604 VipsImage { ctx: out_out },
20605 Error::Xyz2YxyError,
20606 )
20607 }
20608}
20609
20610pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
20614 unsafe {
20615 let inp_in: *mut bindings::VipsImage = inp.ctx;
20616 let mut out_out: *mut bindings::VipsImage = null_mut();
20617
20618 let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
20619 utils::result(
20620 vips_op_response,
20621 VipsImage { ctx: out_out },
20622 Error::Yxy2XyzError,
20623 )
20624 }
20625}
20626
20627pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20631 unsafe {
20632 let inp_in: *mut bindings::VipsImage = inp.ctx;
20633 let mut out_out: *mut bindings::VipsImage = null_mut();
20634
20635 let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20636 utils::result(
20637 vips_op_response,
20638 VipsImage { ctx: out_out },
20639 Error::ScRgb2XyzError,
20640 )
20641 }
20642}
20643
20644pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20648 unsafe {
20649 let inp_in: *mut bindings::VipsImage = inp.ctx;
20650 let mut out_out: *mut bindings::VipsImage = null_mut();
20651
20652 let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
20653 utils::result(
20654 vips_op_response,
20655 VipsImage { ctx: out_out },
20656 Error::Xyz2ScRgbError,
20657 )
20658 }
20659}
20660
20661pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
20665 unsafe {
20666 let inp_in: *mut bindings::VipsImage = inp.ctx;
20667 let mut out_out: *mut bindings::VipsImage = null_mut();
20668
20669 let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
20670 utils::result(
20671 vips_op_response,
20672 VipsImage { ctx: out_out },
20673 Error::LabQ2LabError,
20674 )
20675 }
20676}
20677
20678pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20682 unsafe {
20683 let inp_in: *mut bindings::VipsImage = inp.ctx;
20684 let mut out_out: *mut bindings::VipsImage = null_mut();
20685
20686 let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20687 utils::result(
20688 vips_op_response,
20689 VipsImage { ctx: out_out },
20690 Error::Lab2LabQError,
20691 )
20692 }
20693}
20694
20695pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20699 unsafe {
20700 let inp_in: *mut bindings::VipsImage = inp.ctx;
20701 let mut out_out: *mut bindings::VipsImage = null_mut();
20702
20703 let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20704 utils::result(
20705 vips_op_response,
20706 VipsImage { ctx: out_out },
20707 Error::LabQ2LabSError,
20708 )
20709 }
20710}
20711
20712pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20716 unsafe {
20717 let inp_in: *mut bindings::VipsImage = inp.ctx;
20718 let mut out_out: *mut bindings::VipsImage = null_mut();
20719
20720 let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20721 utils::result(
20722 vips_op_response,
20723 VipsImage { ctx: out_out },
20724 Error::LabS2LabQError,
20725 )
20726 }
20727}
20728
20729pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20733 unsafe {
20734 let inp_in: *mut bindings::VipsImage = inp.ctx;
20735 let mut out_out: *mut bindings::VipsImage = null_mut();
20736
20737 let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20738 utils::result(
20739 vips_op_response,
20740 VipsImage { ctx: out_out },
20741 Error::LabS2LabError,
20742 )
20743 }
20744}
20745
20746pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20750 unsafe {
20751 let inp_in: *mut bindings::VipsImage = inp.ctx;
20752 let mut out_out: *mut bindings::VipsImage = null_mut();
20753
20754 let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20755 utils::result(
20756 vips_op_response,
20757 VipsImage { ctx: out_out },
20758 Error::Lab2LabSError,
20759 )
20760 }
20761}
20762
20763pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20767 unsafe {
20768 let inp_in: *mut bindings::VipsImage = inp.ctx;
20769 let mut out_out: *mut bindings::VipsImage = null_mut();
20770
20771 let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20772 utils::result(
20773 vips_op_response,
20774 VipsImage { ctx: out_out },
20775 Error::Rad2FloatError,
20776 )
20777 }
20778}
20779
20780pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20784 unsafe {
20785 let inp_in: *mut bindings::VipsImage = inp.ctx;
20786 let mut out_out: *mut bindings::VipsImage = null_mut();
20787
20788 let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20789 utils::result(
20790 vips_op_response,
20791 VipsImage { ctx: out_out },
20792 Error::Float2RadError,
20793 )
20794 }
20795}
20796
20797pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20801 unsafe {
20802 let inp_in: *mut bindings::VipsImage = inp.ctx;
20803 let mut out_out: *mut bindings::VipsImage = null_mut();
20804
20805 let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20806 utils::result(
20807 vips_op_response,
20808 VipsImage { ctx: out_out },
20809 Error::LabQ2SRgbError,
20810 )
20811 }
20812}
20813
20814pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20818 unsafe {
20819 let inp_in: *mut bindings::VipsImage = inp.ctx;
20820 let mut out_out: *mut bindings::VipsImage = null_mut();
20821
20822 let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20823 utils::result(
20824 vips_op_response,
20825 VipsImage { ctx: out_out },
20826 Error::SRgb2ScRgbError,
20827 )
20828 }
20829}
20830
20831pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
20835 unsafe {
20836 let inp_in: *mut bindings::VipsImage = inp.ctx;
20837 let mut out_out: *mut bindings::VipsImage = null_mut();
20838
20839 let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
20840 utils::result(
20841 vips_op_response,
20842 VipsImage { ctx: out_out },
20843 Error::ScRgb2BwError,
20844 )
20845 }
20846}
20847
20848#[derive(Clone, Debug)]
20850pub struct ScRgb2BwOptions {
20851 pub depth: i32,
20854}
20855
20856impl std::default::Default for ScRgb2BwOptions {
20857 fn default() -> Self {
20858 ScRgb2BwOptions {
20859 depth: i32::from(8),
20860 }
20861 }
20862}
20863
20864pub fn sc_rgb2bw_with_opts(
20869 inp: &VipsImage,
20870 sc_rgb_2bw_options: &ScRgb2BwOptions,
20871) -> Result<VipsImage> {
20872 unsafe {
20873 let inp_in: *mut bindings::VipsImage = inp.ctx;
20874 let mut out_out: *mut bindings::VipsImage = null_mut();
20875
20876 let depth_in: i32 = sc_rgb_2bw_options.depth;
20877 let depth_in_name = utils::new_c_string("depth")?;
20878
20879 let vips_op_response =
20880 bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20881 utils::result(
20882 vips_op_response,
20883 VipsImage { ctx: out_out },
20884 Error::ScRgb2BwError,
20885 )
20886 }
20887}
20888
20889pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20893 unsafe {
20894 let inp_in: *mut bindings::VipsImage = inp.ctx;
20895 let mut out_out: *mut bindings::VipsImage = null_mut();
20896
20897 let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20898 utils::result(
20899 vips_op_response,
20900 VipsImage { ctx: out_out },
20901 Error::SRgb2HsvError,
20902 )
20903 }
20904}
20905
20906pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20910 unsafe {
20911 let inp_in: *mut bindings::VipsImage = inp.ctx;
20912 let mut out_out: *mut bindings::VipsImage = null_mut();
20913
20914 let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20915 utils::result(
20916 vips_op_response,
20917 VipsImage { ctx: out_out },
20918 Error::Hsv2SRgbError,
20919 )
20920 }
20921}
20922
20923pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20927 unsafe {
20928 let inp_in: *mut bindings::VipsImage = inp.ctx;
20929 let mut out_out: *mut bindings::VipsImage = null_mut();
20930
20931 let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
20932 utils::result(
20933 vips_op_response,
20934 VipsImage { ctx: out_out },
20935 Error::ScRgb2SRgbError,
20936 )
20937 }
20938}
20939
20940#[derive(Clone, Debug)]
20942pub struct ScRgb2SRgbOptions {
20943 pub depth: i32,
20946}
20947
20948impl std::default::Default for ScRgb2SRgbOptions {
20949 fn default() -> Self {
20950 ScRgb2SRgbOptions {
20951 depth: i32::from(8),
20952 }
20953 }
20954}
20955
20956pub fn sc_rgb_2s_rgb_with_opts(
20961 inp: &VipsImage,
20962 sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
20963) -> Result<VipsImage> {
20964 unsafe {
20965 let inp_in: *mut bindings::VipsImage = inp.ctx;
20966 let mut out_out: *mut bindings::VipsImage = null_mut();
20967
20968 let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
20969 let depth_in_name = utils::new_c_string("depth")?;
20970
20971 let vips_op_response =
20972 bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20973 utils::result(
20974 vips_op_response,
20975 VipsImage { ctx: out_out },
20976 Error::ScRgb2SRgbError,
20977 )
20978 }
20979}
20980
20981pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20985 unsafe {
20986 let inp_in: *mut bindings::VipsImage = inp.ctx;
20987 let mut out_out: *mut bindings::VipsImage = null_mut();
20988
20989 let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20990 utils::result(
20991 vips_op_response,
20992 VipsImage { ctx: out_out },
20993 Error::IccImportError,
20994 )
20995 }
20996}
20997
20998#[derive(Clone, Debug)]
21000pub struct IccImportOptions {
21001 pub pcs: PCS,
21006 pub intent: Intent,
21014 pub black_point_compensation: bool,
21017 pub embedded: bool,
21020 pub input_profile: String,
21022}
21023
21024impl std::default::Default for IccImportOptions {
21025 fn default() -> Self {
21026 IccImportOptions {
21027 pcs: PCS::Lab,
21028 intent: Intent::Relative,
21029 black_point_compensation: false,
21030 embedded: false,
21031 input_profile: String::new(),
21032 }
21033 }
21034}
21035
21036pub fn icc_import_with_opts(
21041 inp: &VipsImage,
21042 icc_import_options: &IccImportOptions,
21043) -> Result<VipsImage> {
21044 unsafe {
21045 let inp_in: *mut bindings::VipsImage = inp.ctx;
21046 let mut out_out: *mut bindings::VipsImage = null_mut();
21047
21048 let pcs_in: i32 = icc_import_options.pcs as i32;
21049 let pcs_in_name = utils::new_c_string("pcs")?;
21050
21051 let intent_in: i32 = icc_import_options.intent as i32;
21052 let intent_in_name = utils::new_c_string("intent")?;
21053
21054 let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
21055 1
21056 } else {
21057 0
21058 };
21059 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21060
21061 let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
21062 let embedded_in_name = utils::new_c_string("embedded")?;
21063
21064 let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
21065 let input_profile_in_name = utils::new_c_string("input-profile")?;
21066
21067 let vips_op_response = bindings::vips_icc_import(
21068 inp_in,
21069 &mut out_out,
21070 pcs_in_name.as_ptr(),
21071 pcs_in,
21072 intent_in_name.as_ptr(),
21073 intent_in,
21074 black_point_compensation_in_name.as_ptr(),
21075 black_point_compensation_in,
21076 embedded_in_name.as_ptr(),
21077 embedded_in,
21078 input_profile_in_name.as_ptr(),
21079 input_profile_in.as_ptr(),
21080 NULL,
21081 );
21082 utils::result(
21083 vips_op_response,
21084 VipsImage { ctx: out_out },
21085 Error::IccImportError,
21086 )
21087 }
21088}
21089
21090pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
21094 unsafe {
21095 let inp_in: *mut bindings::VipsImage = inp.ctx;
21096 let mut out_out: *mut bindings::VipsImage = null_mut();
21097
21098 let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
21099 utils::result(
21100 vips_op_response,
21101 VipsImage { ctx: out_out },
21102 Error::IccExportError,
21103 )
21104 }
21105}
21106
21107#[derive(Clone, Debug)]
21109pub struct IccExportOptions {
21110 pub pcs: PCS,
21115 pub intent: Intent,
21123 pub black_point_compensation: bool,
21126 pub output_profile: String,
21128 pub depth: i32,
21131}
21132
21133impl std::default::Default for IccExportOptions {
21134 fn default() -> Self {
21135 IccExportOptions {
21136 pcs: PCS::Lab,
21137 intent: Intent::Relative,
21138 black_point_compensation: false,
21139 output_profile: String::new(),
21140 depth: i32::from(8),
21141 }
21142 }
21143}
21144
21145pub fn icc_export_with_opts(
21150 inp: &VipsImage,
21151 icc_export_options: &IccExportOptions,
21152) -> Result<VipsImage> {
21153 unsafe {
21154 let inp_in: *mut bindings::VipsImage = inp.ctx;
21155 let mut out_out: *mut bindings::VipsImage = null_mut();
21156
21157 let pcs_in: i32 = icc_export_options.pcs as i32;
21158 let pcs_in_name = utils::new_c_string("pcs")?;
21159
21160 let intent_in: i32 = icc_export_options.intent as i32;
21161 let intent_in_name = utils::new_c_string("intent")?;
21162
21163 let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
21164 1
21165 } else {
21166 0
21167 };
21168 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21169
21170 let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
21171 let output_profile_in_name = utils::new_c_string("output-profile")?;
21172
21173 let depth_in: i32 = icc_export_options.depth;
21174 let depth_in_name = utils::new_c_string("depth")?;
21175
21176 let vips_op_response = bindings::vips_icc_export(
21177 inp_in,
21178 &mut out_out,
21179 pcs_in_name.as_ptr(),
21180 pcs_in,
21181 intent_in_name.as_ptr(),
21182 intent_in,
21183 black_point_compensation_in_name.as_ptr(),
21184 black_point_compensation_in,
21185 output_profile_in_name.as_ptr(),
21186 output_profile_in.as_ptr(),
21187 depth_in_name.as_ptr(),
21188 depth_in,
21189 NULL,
21190 );
21191 utils::result(
21192 vips_op_response,
21193 VipsImage { ctx: out_out },
21194 Error::IccExportError,
21195 )
21196 }
21197}
21198
21199pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
21204 unsafe {
21205 let inp_in: *mut bindings::VipsImage = inp.ctx;
21206 let output_profile_in: CString = utils::new_c_string(output_profile)?;
21207 let mut out_out: *mut bindings::VipsImage = null_mut();
21208
21209 let vips_op_response =
21210 bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
21211 utils::result(
21212 vips_op_response,
21213 VipsImage { ctx: out_out },
21214 Error::IccTransformError,
21215 )
21216 }
21217}
21218
21219#[derive(Clone, Debug)]
21221pub struct IccTransformOptions {
21222 pub pcs: PCS,
21227 pub intent: Intent,
21235 pub black_point_compensation: bool,
21238 pub embedded: bool,
21241 pub input_profile: String,
21243 pub depth: i32,
21246}
21247
21248impl std::default::Default for IccTransformOptions {
21249 fn default() -> Self {
21250 IccTransformOptions {
21251 pcs: PCS::Lab,
21252 intent: Intent::Relative,
21253 black_point_compensation: false,
21254 embedded: false,
21255 input_profile: String::new(),
21256 depth: i32::from(8),
21257 }
21258 }
21259}
21260
21261pub fn icc_transform_with_opts(
21267 inp: &VipsImage,
21268 output_profile: &str,
21269 icc_transform_options: &IccTransformOptions,
21270) -> Result<VipsImage> {
21271 unsafe {
21272 let inp_in: *mut bindings::VipsImage = inp.ctx;
21273 let output_profile_in: CString = utils::new_c_string(output_profile)?;
21274 let mut out_out: *mut bindings::VipsImage = null_mut();
21275
21276 let pcs_in: i32 = icc_transform_options.pcs as i32;
21277 let pcs_in_name = utils::new_c_string("pcs")?;
21278
21279 let intent_in: i32 = icc_transform_options.intent as i32;
21280 let intent_in_name = utils::new_c_string("intent")?;
21281
21282 let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
21283 1
21284 } else {
21285 0
21286 };
21287 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
21288
21289 let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
21290 let embedded_in_name = utils::new_c_string("embedded")?;
21291
21292 let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
21293 let input_profile_in_name = utils::new_c_string("input-profile")?;
21294
21295 let depth_in: i32 = icc_transform_options.depth;
21296 let depth_in_name = utils::new_c_string("depth")?;
21297
21298 let vips_op_response = bindings::vips_icc_transform(
21299 inp_in,
21300 &mut out_out,
21301 output_profile_in.as_ptr(),
21302 pcs_in_name.as_ptr(),
21303 pcs_in,
21304 intent_in_name.as_ptr(),
21305 intent_in,
21306 black_point_compensation_in_name.as_ptr(),
21307 black_point_compensation_in,
21308 embedded_in_name.as_ptr(),
21309 embedded_in,
21310 input_profile_in_name.as_ptr(),
21311 input_profile_in.as_ptr(),
21312 depth_in_name.as_ptr(),
21313 depth_in,
21314 NULL,
21315 );
21316 utils::result(
21317 vips_op_response,
21318 VipsImage { ctx: out_out },
21319 Error::IccTransformError,
21320 )
21321 }
21322}
21323
21324pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21329 unsafe {
21330 let left_in: *mut bindings::VipsImage = left.ctx;
21331 let right_in: *mut bindings::VipsImage = right.ctx;
21332 let mut out_out: *mut bindings::VipsImage = null_mut();
21333
21334 let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
21335 utils::result(
21336 vips_op_response,
21337 VipsImage { ctx: out_out },
21338 Error::DE76Error,
21339 )
21340 }
21341}
21342
21343pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21348 unsafe {
21349 let left_in: *mut bindings::VipsImage = left.ctx;
21350 let right_in: *mut bindings::VipsImage = right.ctx;
21351 let mut out_out: *mut bindings::VipsImage = null_mut();
21352
21353 let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
21354 utils::result(
21355 vips_op_response,
21356 VipsImage { ctx: out_out },
21357 Error::DE00Error,
21358 )
21359 }
21360}
21361
21362pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
21367 unsafe {
21368 let left_in: *mut bindings::VipsImage = left.ctx;
21369 let right_in: *mut bindings::VipsImage = right.ctx;
21370 let mut out_out: *mut bindings::VipsImage = null_mut();
21371
21372 let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
21373 utils::result(
21374 vips_op_response,
21375 VipsImage { ctx: out_out },
21376 Error::DEcmcError,
21377 )
21378 }
21379}
21380
21381pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
21385 unsafe {
21386 let inp_in: *mut bindings::VipsImage = inp.ctx;
21387 let mut out_out: *mut bindings::VipsImage = null_mut();
21388
21389 let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
21390 utils::result(
21391 vips_op_response,
21392 VipsImage { ctx: out_out },
21393 Error::Cmyk2XyzError,
21394 )
21395 }
21396}
21397
21398pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
21402 unsafe {
21403 let inp_in: *mut bindings::VipsImage = inp.ctx;
21404 let mut out_out: *mut bindings::VipsImage = null_mut();
21405
21406 let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
21407 utils::result(
21408 vips_op_response,
21409 VipsImage { ctx: out_out },
21410 Error::Xyz2CmykError,
21411 )
21412 }
21413}
21414
21415pub fn profile_load(name: &str) -> Result<Vec<u8>> {
21419 unsafe {
21420 let name_in: CString = utils::new_c_string(name)?;
21421 let mut profile_out: *mut bindings::VipsBlob = null_mut();
21422
21423 let vips_op_response =
21424 bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
21425 utils::result(
21426 vips_op_response,
21427 VipsBlob { ctx: profile_out }.into(),
21428 Error::ProfileLoadError,
21429 )
21430 }
21431}
21432
21433pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
21438 unsafe {
21439 let inp_in: *mut bindings::VipsImage = inp.ctx;
21440 let lut_in: *mut bindings::VipsImage = lut.ctx;
21441 let mut out_out: *mut bindings::VipsImage = null_mut();
21442
21443 let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
21444 utils::result(
21445 vips_op_response,
21446 VipsImage { ctx: out_out },
21447 Error::MaplutError,
21448 )
21449 }
21450}
21451
21452#[derive(Clone, Debug)]
21454pub struct MaplutOptions {
21455 pub band: i32,
21458}
21459
21460impl std::default::Default for MaplutOptions {
21461 fn default() -> Self {
21462 MaplutOptions {
21463 band: i32::from(-1),
21464 }
21465 }
21466}
21467
21468pub fn maplut_with_opts(
21474 inp: &VipsImage,
21475 lut: &VipsImage,
21476 maplut_options: &MaplutOptions,
21477) -> Result<VipsImage> {
21478 unsafe {
21479 let inp_in: *mut bindings::VipsImage = inp.ctx;
21480 let lut_in: *mut bindings::VipsImage = lut.ctx;
21481 let mut out_out: *mut bindings::VipsImage = null_mut();
21482
21483 let band_in: i32 = maplut_options.band;
21484 let band_in_name = utils::new_c_string("band")?;
21485
21486 let vips_op_response = bindings::vips_maplut(
21487 inp_in,
21488 &mut out_out,
21489 lut_in,
21490 band_in_name.as_ptr(),
21491 band_in,
21492 NULL,
21493 );
21494 utils::result(
21495 vips_op_response,
21496 VipsImage { ctx: out_out },
21497 Error::MaplutError,
21498 )
21499 }
21500}
21501
21502pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
21508 unsafe {
21509 let inp_in: *mut bindings::VipsImage = inp.ctx;
21510 let percent_in: f64 = percent;
21511 let mut threshold_out: i32 = i32::from(0);
21512
21513 let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
21514 utils::result(vips_op_response, threshold_out, Error::PercentError)
21515 }
21516}
21517
21518pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21526 unsafe {
21527 let inp_in: *mut bindings::VipsImage = inp.ctx;
21528 let width_in: i32 = width;
21529 let height_in: i32 = height;
21530 let mut out_out: *mut bindings::VipsImage = null_mut();
21531
21532 let vips_op_response =
21533 bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
21534 utils::result(
21535 vips_op_response,
21536 VipsImage { ctx: out_out },
21537 Error::StdifError,
21538 )
21539 }
21540}
21541
21542#[derive(Clone, Debug)]
21544pub struct StdifOptions {
21545 pub s_0: f64,
21548 pub b: f64,
21551 pub m_0: f64,
21554 pub a: f64,
21557}
21558
21559impl std::default::Default for StdifOptions {
21560 fn default() -> Self {
21561 StdifOptions {
21562 s_0: f64::from(50),
21563 b: f64::from(0.5),
21564 m_0: f64::from(128),
21565 a: f64::from(0.5),
21566 }
21567 }
21568}
21569
21570pub fn stdif_with_opts(
21579 inp: &VipsImage,
21580 width: i32,
21581 height: i32,
21582 stdif_options: &StdifOptions,
21583) -> Result<VipsImage> {
21584 unsafe {
21585 let inp_in: *mut bindings::VipsImage = inp.ctx;
21586 let width_in: i32 = width;
21587 let height_in: i32 = height;
21588 let mut out_out: *mut bindings::VipsImage = null_mut();
21589
21590 let s_0_in: f64 = stdif_options.s_0;
21591 let s_0_in_name = utils::new_c_string("s0")?;
21592
21593 let b_in: f64 = stdif_options.b;
21594 let b_in_name = utils::new_c_string("b")?;
21595
21596 let m_0_in: f64 = stdif_options.m_0;
21597 let m_0_in_name = utils::new_c_string("m0")?;
21598
21599 let a_in: f64 = stdif_options.a;
21600 let a_in_name = utils::new_c_string("a")?;
21601
21602 let vips_op_response = bindings::vips_stdif(
21603 inp_in,
21604 &mut out_out,
21605 width_in,
21606 height_in,
21607 s_0_in_name.as_ptr(),
21608 s_0_in,
21609 b_in_name.as_ptr(),
21610 b_in,
21611 m_0_in_name.as_ptr(),
21612 m_0_in,
21613 a_in_name.as_ptr(),
21614 a_in,
21615 NULL,
21616 );
21617 utils::result(
21618 vips_op_response,
21619 VipsImage { ctx: out_out },
21620 Error::StdifError,
21621 )
21622 }
21623}
21624
21625pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
21629 unsafe {
21630 let inp_in: *mut bindings::VipsImage = inp.ctx;
21631 let mut out_out: *mut bindings::VipsImage = null_mut();
21632
21633 let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
21634 utils::result(
21635 vips_op_response,
21636 VipsImage { ctx: out_out },
21637 Error::HistCumError,
21638 )
21639 }
21640}
21641
21642pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21647 unsafe {
21648 let inp_in: *mut bindings::VipsImage = inp.ctx;
21649 let refp_in: *mut bindings::VipsImage = refp.ctx;
21650 let mut out_out: *mut bindings::VipsImage = null_mut();
21651
21652 let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21653 utils::result(
21654 vips_op_response,
21655 VipsImage { ctx: out_out },
21656 Error::HistMatchError,
21657 )
21658 }
21659}
21660
21661pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21665 unsafe {
21666 let inp_in: *mut bindings::VipsImage = inp.ctx;
21667 let mut out_out: *mut bindings::VipsImage = null_mut();
21668
21669 let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21670 utils::result(
21671 vips_op_response,
21672 VipsImage { ctx: out_out },
21673 Error::HistNormError,
21674 )
21675 }
21676}
21677
21678pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21682 unsafe {
21683 let inp_in: *mut bindings::VipsImage = inp.ctx;
21684 let mut out_out: *mut bindings::VipsImage = null_mut();
21685
21686 let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21687 utils::result(
21688 vips_op_response,
21689 VipsImage { ctx: out_out },
21690 Error::HistEqualError,
21691 )
21692 }
21693}
21694
21695#[derive(Clone, Debug)]
21697pub struct HistEqualOptions {
21698 pub band: i32,
21701}
21702
21703impl std::default::Default for HistEqualOptions {
21704 fn default() -> Self {
21705 HistEqualOptions {
21706 band: i32::from(-1),
21707 }
21708 }
21709}
21710
21711pub fn hist_equal_with_opts(
21716 inp: &VipsImage,
21717 hist_equal_options: &HistEqualOptions,
21718) -> Result<VipsImage> {
21719 unsafe {
21720 let inp_in: *mut bindings::VipsImage = inp.ctx;
21721 let mut out_out: *mut bindings::VipsImage = null_mut();
21722
21723 let band_in: i32 = hist_equal_options.band;
21724 let band_in_name = utils::new_c_string("band")?;
21725
21726 let vips_op_response =
21727 bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21728 utils::result(
21729 vips_op_response,
21730 VipsImage { ctx: out_out },
21731 Error::HistEqualError,
21732 )
21733 }
21734}
21735
21736pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21740 unsafe {
21741 let inp_in: *mut bindings::VipsImage = inp.ctx;
21742 let mut out_out: *mut bindings::VipsImage = null_mut();
21743
21744 let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21745 utils::result(
21746 vips_op_response,
21747 VipsImage { ctx: out_out },
21748 Error::HistPlotError,
21749 )
21750 }
21751}
21752
21753pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21761 unsafe {
21762 let inp_in: *mut bindings::VipsImage = inp.ctx;
21763 let width_in: i32 = width;
21764 let height_in: i32 = height;
21765 let mut out_out: *mut bindings::VipsImage = null_mut();
21766
21767 let vips_op_response =
21768 bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21769 utils::result(
21770 vips_op_response,
21771 VipsImage { ctx: out_out },
21772 Error::HistLocalError,
21773 )
21774 }
21775}
21776
21777#[derive(Clone, Debug)]
21779pub struct HistLocalOptions {
21780 pub max_slope: i32,
21783}
21784
21785impl std::default::Default for HistLocalOptions {
21786 fn default() -> Self {
21787 HistLocalOptions {
21788 max_slope: i32::from(0),
21789 }
21790 }
21791}
21792
21793pub fn hist_local_with_opts(
21802 inp: &VipsImage,
21803 width: i32,
21804 height: i32,
21805 hist_local_options: &HistLocalOptions,
21806) -> Result<VipsImage> {
21807 unsafe {
21808 let inp_in: *mut bindings::VipsImage = inp.ctx;
21809 let width_in: i32 = width;
21810 let height_in: i32 = height;
21811 let mut out_out: *mut bindings::VipsImage = null_mut();
21812
21813 let max_slope_in: i32 = hist_local_options.max_slope;
21814 let max_slope_in_name = utils::new_c_string("max-slope")?;
21815
21816 let vips_op_response = bindings::vips_hist_local(
21817 inp_in,
21818 &mut out_out,
21819 width_in,
21820 height_in,
21821 max_slope_in_name.as_ptr(),
21822 max_slope_in,
21823 NULL,
21824 );
21825 utils::result(
21826 vips_op_response,
21827 VipsImage { ctx: out_out },
21828 Error::HistLocalError,
21829 )
21830 }
21831}
21832
21833pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21837 unsafe {
21838 let inp_in: *mut bindings::VipsImage = inp.ctx;
21839 let mut monotonic_out: i32 = 0;
21840
21841 let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21842 utils::result(
21843 vips_op_response,
21844 monotonic_out != 0,
21845 Error::HistIsmonotonicError,
21846 )
21847 }
21848}
21849
21850pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21854 unsafe {
21855 let inp_in: *mut bindings::VipsImage = inp.ctx;
21856 let mut out_out: f64 = f64::from(0);
21857
21858 let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21859 utils::result(vips_op_response, out_out, Error::HistEntropyError)
21860 }
21861}
21862
21863pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21868 unsafe {
21869 let inp_in: *mut bindings::VipsImage = inp.ctx;
21870 let mask_in: *mut bindings::VipsImage = mask.ctx;
21871 let mut out_out: *mut bindings::VipsImage = null_mut();
21872
21873 let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21874 utils::result(
21875 vips_op_response,
21876 VipsImage { ctx: out_out },
21877 Error::ConvError,
21878 )
21879 }
21880}
21881
21882#[derive(Clone, Debug)]
21884pub struct ConvOptions {
21885 pub precision: Precision,
21891 pub layers: i32,
21894 pub cluster: i32,
21897}
21898
21899impl std::default::Default for ConvOptions {
21900 fn default() -> Self {
21901 ConvOptions {
21902 precision: Precision::Float,
21903 layers: i32::from(5),
21904 cluster: i32::from(1),
21905 }
21906 }
21907}
21908
21909pub fn conv_with_opts(
21915 inp: &VipsImage,
21916 mask: &VipsImage,
21917 conv_options: &ConvOptions,
21918) -> Result<VipsImage> {
21919 unsafe {
21920 let inp_in: *mut bindings::VipsImage = inp.ctx;
21921 let mask_in: *mut bindings::VipsImage = mask.ctx;
21922 let mut out_out: *mut bindings::VipsImage = null_mut();
21923
21924 let precision_in: i32 = conv_options.precision as i32;
21925 let precision_in_name = utils::new_c_string("precision")?;
21926
21927 let layers_in: i32 = conv_options.layers;
21928 let layers_in_name = utils::new_c_string("layers")?;
21929
21930 let cluster_in: i32 = conv_options.cluster;
21931 let cluster_in_name = utils::new_c_string("cluster")?;
21932
21933 let vips_op_response = bindings::vips_conv(
21934 inp_in,
21935 &mut out_out,
21936 mask_in,
21937 precision_in_name.as_ptr(),
21938 precision_in,
21939 layers_in_name.as_ptr(),
21940 layers_in,
21941 cluster_in_name.as_ptr(),
21942 cluster_in,
21943 NULL,
21944 );
21945 utils::result(
21946 vips_op_response,
21947 VipsImage { ctx: out_out },
21948 Error::ConvError,
21949 )
21950 }
21951}
21952
21953pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21958 unsafe {
21959 let inp_in: *mut bindings::VipsImage = inp.ctx;
21960 let mask_in: *mut bindings::VipsImage = mask.ctx;
21961 let mut out_out: *mut bindings::VipsImage = null_mut();
21962
21963 let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21964 utils::result(
21965 vips_op_response,
21966 VipsImage { ctx: out_out },
21967 Error::ConvaError,
21968 )
21969 }
21970}
21971
21972#[derive(Clone, Debug)]
21974pub struct ConvaOptions {
21975 pub layers: i32,
21978 pub cluster: i32,
21981}
21982
21983impl std::default::Default for ConvaOptions {
21984 fn default() -> Self {
21985 ConvaOptions {
21986 layers: i32::from(5),
21987 cluster: i32::from(1),
21988 }
21989 }
21990}
21991
21992pub fn conva_with_opts(
21998 inp: &VipsImage,
21999 mask: &VipsImage,
22000 conva_options: &ConvaOptions,
22001) -> Result<VipsImage> {
22002 unsafe {
22003 let inp_in: *mut bindings::VipsImage = inp.ctx;
22004 let mask_in: *mut bindings::VipsImage = mask.ctx;
22005 let mut out_out: *mut bindings::VipsImage = null_mut();
22006
22007 let layers_in: i32 = conva_options.layers;
22008 let layers_in_name = utils::new_c_string("layers")?;
22009
22010 let cluster_in: i32 = conva_options.cluster;
22011 let cluster_in_name = utils::new_c_string("cluster")?;
22012
22013 let vips_op_response = bindings::vips_conva(
22014 inp_in,
22015 &mut out_out,
22016 mask_in,
22017 layers_in_name.as_ptr(),
22018 layers_in,
22019 cluster_in_name.as_ptr(),
22020 cluster_in,
22021 NULL,
22022 );
22023 utils::result(
22024 vips_op_response,
22025 VipsImage { ctx: out_out },
22026 Error::ConvaError,
22027 )
22028 }
22029}
22030
22031pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22036 unsafe {
22037 let inp_in: *mut bindings::VipsImage = inp.ctx;
22038 let mask_in: *mut bindings::VipsImage = mask.ctx;
22039 let mut out_out: *mut bindings::VipsImage = null_mut();
22040
22041 let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
22042 utils::result(
22043 vips_op_response,
22044 VipsImage { ctx: out_out },
22045 Error::ConvfError,
22046 )
22047 }
22048}
22049
22050pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22055 unsafe {
22056 let inp_in: *mut bindings::VipsImage = inp.ctx;
22057 let mask_in: *mut bindings::VipsImage = mask.ctx;
22058 let mut out_out: *mut bindings::VipsImage = null_mut();
22059
22060 let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
22061 utils::result(
22062 vips_op_response,
22063 VipsImage { ctx: out_out },
22064 Error::ConviError,
22065 )
22066 }
22067}
22068
22069pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22074 unsafe {
22075 let inp_in: *mut bindings::VipsImage = inp.ctx;
22076 let mask_in: *mut bindings::VipsImage = mask.ctx;
22077 let mut out_out: *mut bindings::VipsImage = null_mut();
22078
22079 let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
22080 utils::result(
22081 vips_op_response,
22082 VipsImage { ctx: out_out },
22083 Error::CompassError,
22084 )
22085 }
22086}
22087
22088#[derive(Clone, Debug)]
22090pub struct CompassOptions {
22091 pub times: i32,
22094 pub angle: Angle45,
22105 pub combine: Combine,
22111 pub precision: Precision,
22117 pub layers: i32,
22120 pub cluster: i32,
22123}
22124
22125impl std::default::Default for CompassOptions {
22126 fn default() -> Self {
22127 CompassOptions {
22128 times: i32::from(2),
22129 angle: Angle45::D90,
22130 combine: Combine::Max,
22131 precision: Precision::Float,
22132 layers: i32::from(5),
22133 cluster: i32::from(1),
22134 }
22135 }
22136}
22137
22138pub fn compass_with_opts(
22144 inp: &VipsImage,
22145 mask: &VipsImage,
22146 compass_options: &CompassOptions,
22147) -> Result<VipsImage> {
22148 unsafe {
22149 let inp_in: *mut bindings::VipsImage = inp.ctx;
22150 let mask_in: *mut bindings::VipsImage = mask.ctx;
22151 let mut out_out: *mut bindings::VipsImage = null_mut();
22152
22153 let times_in: i32 = compass_options.times;
22154 let times_in_name = utils::new_c_string("times")?;
22155
22156 let angle_in: i32 = compass_options.angle as i32;
22157 let angle_in_name = utils::new_c_string("angle")?;
22158
22159 let combine_in: i32 = compass_options.combine as i32;
22160 let combine_in_name = utils::new_c_string("combine")?;
22161
22162 let precision_in: i32 = compass_options.precision as i32;
22163 let precision_in_name = utils::new_c_string("precision")?;
22164
22165 let layers_in: i32 = compass_options.layers;
22166 let layers_in_name = utils::new_c_string("layers")?;
22167
22168 let cluster_in: i32 = compass_options.cluster;
22169 let cluster_in_name = utils::new_c_string("cluster")?;
22170
22171 let vips_op_response = bindings::vips_compass(
22172 inp_in,
22173 &mut out_out,
22174 mask_in,
22175 times_in_name.as_ptr(),
22176 times_in,
22177 angle_in_name.as_ptr(),
22178 angle_in,
22179 combine_in_name.as_ptr(),
22180 combine_in,
22181 precision_in_name.as_ptr(),
22182 precision_in,
22183 layers_in_name.as_ptr(),
22184 layers_in,
22185 cluster_in_name.as_ptr(),
22186 cluster_in,
22187 NULL,
22188 );
22189 utils::result(
22190 vips_op_response,
22191 VipsImage { ctx: out_out },
22192 Error::CompassError,
22193 )
22194 }
22195}
22196
22197pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22202 unsafe {
22203 let inp_in: *mut bindings::VipsImage = inp.ctx;
22204 let mask_in: *mut bindings::VipsImage = mask.ctx;
22205 let mut out_out: *mut bindings::VipsImage = null_mut();
22206
22207 let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
22208 utils::result(
22209 vips_op_response,
22210 VipsImage { ctx: out_out },
22211 Error::ConvsepError,
22212 )
22213 }
22214}
22215
22216#[derive(Clone, Debug)]
22218pub struct ConvsepOptions {
22219 pub precision: Precision,
22225 pub layers: i32,
22228 pub cluster: i32,
22231}
22232
22233impl std::default::Default for ConvsepOptions {
22234 fn default() -> Self {
22235 ConvsepOptions {
22236 precision: Precision::Float,
22237 layers: i32::from(5),
22238 cluster: i32::from(1),
22239 }
22240 }
22241}
22242
22243pub fn convsep_with_opts(
22249 inp: &VipsImage,
22250 mask: &VipsImage,
22251 convsep_options: &ConvsepOptions,
22252) -> Result<VipsImage> {
22253 unsafe {
22254 let inp_in: *mut bindings::VipsImage = inp.ctx;
22255 let mask_in: *mut bindings::VipsImage = mask.ctx;
22256 let mut out_out: *mut bindings::VipsImage = null_mut();
22257
22258 let precision_in: i32 = convsep_options.precision as i32;
22259 let precision_in_name = utils::new_c_string("precision")?;
22260
22261 let layers_in: i32 = convsep_options.layers;
22262 let layers_in_name = utils::new_c_string("layers")?;
22263
22264 let cluster_in: i32 = convsep_options.cluster;
22265 let cluster_in_name = utils::new_c_string("cluster")?;
22266
22267 let vips_op_response = bindings::vips_convsep(
22268 inp_in,
22269 &mut out_out,
22270 mask_in,
22271 precision_in_name.as_ptr(),
22272 precision_in,
22273 layers_in_name.as_ptr(),
22274 layers_in,
22275 cluster_in_name.as_ptr(),
22276 cluster_in,
22277 NULL,
22278 );
22279 utils::result(
22280 vips_op_response,
22281 VipsImage { ctx: out_out },
22282 Error::ConvsepError,
22283 )
22284 }
22285}
22286
22287pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22292 unsafe {
22293 let inp_in: *mut bindings::VipsImage = inp.ctx;
22294 let mask_in: *mut bindings::VipsImage = mask.ctx;
22295 let mut out_out: *mut bindings::VipsImage = null_mut();
22296
22297 let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
22298 utils::result(
22299 vips_op_response,
22300 VipsImage { ctx: out_out },
22301 Error::ConvasepError,
22302 )
22303 }
22304}
22305
22306#[derive(Clone, Debug)]
22308pub struct ConvasepOptions {
22309 pub layers: i32,
22312}
22313
22314impl std::default::Default for ConvasepOptions {
22315 fn default() -> Self {
22316 ConvasepOptions {
22317 layers: i32::from(5),
22318 }
22319 }
22320}
22321
22322pub fn convasep_with_opts(
22328 inp: &VipsImage,
22329 mask: &VipsImage,
22330 convasep_options: &ConvasepOptions,
22331) -> Result<VipsImage> {
22332 unsafe {
22333 let inp_in: *mut bindings::VipsImage = inp.ctx;
22334 let mask_in: *mut bindings::VipsImage = mask.ctx;
22335 let mut out_out: *mut bindings::VipsImage = null_mut();
22336
22337 let layers_in: i32 = convasep_options.layers;
22338 let layers_in_name = utils::new_c_string("layers")?;
22339
22340 let vips_op_response = bindings::vips_convasep(
22341 inp_in,
22342 &mut out_out,
22343 mask_in,
22344 layers_in_name.as_ptr(),
22345 layers_in,
22346 NULL,
22347 );
22348 utils::result(
22349 vips_op_response,
22350 VipsImage { ctx: out_out },
22351 Error::ConvasepError,
22352 )
22353 }
22354}
22355
22356pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22361 unsafe {
22362 let inp_in: *mut bindings::VipsImage = inp.ctx;
22363 let refp_in: *mut bindings::VipsImage = refp.ctx;
22364 let mut out_out: *mut bindings::VipsImage = null_mut();
22365
22366 let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
22367 utils::result(
22368 vips_op_response,
22369 VipsImage { ctx: out_out },
22370 Error::FastcorError,
22371 )
22372 }
22373}
22374
22375pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
22380 unsafe {
22381 let inp_in: *mut bindings::VipsImage = inp.ctx;
22382 let refp_in: *mut bindings::VipsImage = refp.ctx;
22383 let mut out_out: *mut bindings::VipsImage = null_mut();
22384
22385 let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
22386 utils::result(
22387 vips_op_response,
22388 VipsImage { ctx: out_out },
22389 Error::SpcorError,
22390 )
22391 }
22392}
22393
22394pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
22398 unsafe {
22399 let inp_in: *mut bindings::VipsImage = inp.ctx;
22400 let mut out_out: *mut bindings::VipsImage = null_mut();
22401
22402 let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
22403 utils::result(
22404 vips_op_response,
22405 VipsImage { ctx: out_out },
22406 Error::SharpenError,
22407 )
22408 }
22409}
22410
22411#[derive(Clone, Debug)]
22413pub struct SharpenOptions {
22414 pub sigma: f64,
22417 pub x_1: f64,
22420 pub y_2: f64,
22423 pub y_3: f64,
22426 pub m_1: f64,
22429 pub m_2: f64,
22432}
22433
22434impl std::default::Default for SharpenOptions {
22435 fn default() -> Self {
22436 SharpenOptions {
22437 sigma: f64::from(0.5),
22438 x_1: f64::from(2),
22439 y_2: f64::from(10),
22440 y_3: f64::from(20),
22441 m_1: f64::from(0),
22442 m_2: f64::from(3),
22443 }
22444 }
22445}
22446
22447pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
22452 unsafe {
22453 let inp_in: *mut bindings::VipsImage = inp.ctx;
22454 let mut out_out: *mut bindings::VipsImage = null_mut();
22455
22456 let sigma_in: f64 = sharpen_options.sigma;
22457 let sigma_in_name = utils::new_c_string("sigma")?;
22458
22459 let x_1_in: f64 = sharpen_options.x_1;
22460 let x_1_in_name = utils::new_c_string("x1")?;
22461
22462 let y_2_in: f64 = sharpen_options.y_2;
22463 let y_2_in_name = utils::new_c_string("y2")?;
22464
22465 let y_3_in: f64 = sharpen_options.y_3;
22466 let y_3_in_name = utils::new_c_string("y3")?;
22467
22468 let m_1_in: f64 = sharpen_options.m_1;
22469 let m_1_in_name = utils::new_c_string("m1")?;
22470
22471 let m_2_in: f64 = sharpen_options.m_2;
22472 let m_2_in_name = utils::new_c_string("m2")?;
22473
22474 let vips_op_response = bindings::vips_sharpen(
22475 inp_in,
22476 &mut out_out,
22477 sigma_in_name.as_ptr(),
22478 sigma_in,
22479 x_1_in_name.as_ptr(),
22480 x_1_in,
22481 y_2_in_name.as_ptr(),
22482 y_2_in,
22483 y_3_in_name.as_ptr(),
22484 y_3_in,
22485 m_1_in_name.as_ptr(),
22486 m_1_in,
22487 m_2_in_name.as_ptr(),
22488 m_2_in,
22489 NULL,
22490 );
22491 utils::result(
22492 vips_op_response,
22493 VipsImage { ctx: out_out },
22494 Error::SharpenError,
22495 )
22496 }
22497}
22498
22499pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
22505 unsafe {
22506 let inp_in: *mut bindings::VipsImage = inp.ctx;
22507 let sigma_in: f64 = sigma;
22508 let mut out_out: *mut bindings::VipsImage = null_mut();
22509
22510 let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
22511 utils::result(
22512 vips_op_response,
22513 VipsImage { ctx: out_out },
22514 Error::GaussblurError,
22515 )
22516 }
22517}
22518
22519#[derive(Clone, Debug)]
22521pub struct GaussblurOptions {
22522 pub min_ampl: f64,
22525 pub precision: Precision,
22531}
22532
22533impl std::default::Default for GaussblurOptions {
22534 fn default() -> Self {
22535 GaussblurOptions {
22536 min_ampl: f64::from(0.2),
22537 precision: Precision::Integer,
22538 }
22539 }
22540}
22541
22542pub fn gaussblur_with_opts(
22549 inp: &VipsImage,
22550 sigma: f64,
22551 gaussblur_options: &GaussblurOptions,
22552) -> Result<VipsImage> {
22553 unsafe {
22554 let inp_in: *mut bindings::VipsImage = inp.ctx;
22555 let sigma_in: f64 = sigma;
22556 let mut out_out: *mut bindings::VipsImage = null_mut();
22557
22558 let min_ampl_in: f64 = gaussblur_options.min_ampl;
22559 let min_ampl_in_name = utils::new_c_string("min-ampl")?;
22560
22561 let precision_in: i32 = gaussblur_options.precision as i32;
22562 let precision_in_name = utils::new_c_string("precision")?;
22563
22564 let vips_op_response = bindings::vips_gaussblur(
22565 inp_in,
22566 &mut out_out,
22567 sigma_in,
22568 min_ampl_in_name.as_ptr(),
22569 min_ampl_in,
22570 precision_in_name.as_ptr(),
22571 precision_in,
22572 NULL,
22573 );
22574 utils::result(
22575 vips_op_response,
22576 VipsImage { ctx: out_out },
22577 Error::GaussblurError,
22578 )
22579 }
22580}
22581
22582pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
22586 unsafe {
22587 let inp_in: *mut bindings::VipsImage = inp.ctx;
22588 let mut out_out: *mut bindings::VipsImage = null_mut();
22589
22590 let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
22591 utils::result(
22592 vips_op_response,
22593 VipsImage { ctx: out_out },
22594 Error::SobelError,
22595 )
22596 }
22597}
22598
22599pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
22603 unsafe {
22604 let inp_in: *mut bindings::VipsImage = inp.ctx;
22605 let mut out_out: *mut bindings::VipsImage = null_mut();
22606
22607 let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
22608 utils::result(
22609 vips_op_response,
22610 VipsImage { ctx: out_out },
22611 Error::ScharrError,
22612 )
22613 }
22614}
22615
22616pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
22620 unsafe {
22621 let inp_in: *mut bindings::VipsImage = inp.ctx;
22622 let mut out_out: *mut bindings::VipsImage = null_mut();
22623
22624 let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
22625 utils::result(
22626 vips_op_response,
22627 VipsImage { ctx: out_out },
22628 Error::PrewittError,
22629 )
22630 }
22631}
22632
22633pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
22637 unsafe {
22638 let inp_in: *mut bindings::VipsImage = inp.ctx;
22639 let mut out_out: *mut bindings::VipsImage = null_mut();
22640
22641 let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
22642 utils::result(
22643 vips_op_response,
22644 VipsImage { ctx: out_out },
22645 Error::CannyError,
22646 )
22647 }
22648}
22649
22650#[derive(Clone, Debug)]
22652pub struct CannyOptions {
22653 pub sigma: f64,
22656 pub precision: Precision,
22662}
22663
22664impl std::default::Default for CannyOptions {
22665 fn default() -> Self {
22666 CannyOptions {
22667 sigma: f64::from(1.4),
22668 precision: Precision::Float,
22669 }
22670 }
22671}
22672
22673pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22678 unsafe {
22679 let inp_in: *mut bindings::VipsImage = inp.ctx;
22680 let mut out_out: *mut bindings::VipsImage = null_mut();
22681
22682 let sigma_in: f64 = canny_options.sigma;
22683 let sigma_in_name = utils::new_c_string("sigma")?;
22684
22685 let precision_in: i32 = canny_options.precision as i32;
22686 let precision_in_name = utils::new_c_string("precision")?;
22687
22688 let vips_op_response = bindings::vips_canny(
22689 inp_in,
22690 &mut out_out,
22691 sigma_in_name.as_ptr(),
22692 sigma_in,
22693 precision_in_name.as_ptr(),
22694 precision_in,
22695 NULL,
22696 );
22697 utils::result(
22698 vips_op_response,
22699 VipsImage { ctx: out_out },
22700 Error::CannyError,
22701 )
22702 }
22703}
22704
22705pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22709 unsafe {
22710 let inp_in: *mut bindings::VipsImage = inp.ctx;
22711 let mut out_out: *mut bindings::VipsImage = null_mut();
22712
22713 let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22714 utils::result(
22715 vips_op_response,
22716 VipsImage { ctx: out_out },
22717 Error::FwfftError,
22718 )
22719 }
22720}
22721
22722pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
22726 unsafe {
22727 let inp_in: *mut bindings::VipsImage = inp.ctx;
22728 let mut out_out: *mut bindings::VipsImage = null_mut();
22729
22730 let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
22731 utils::result(
22732 vips_op_response,
22733 VipsImage { ctx: out_out },
22734 Error::InvfftError,
22735 )
22736 }
22737}
22738
22739#[derive(Clone, Debug)]
22741pub struct InvfftOptions {
22742 pub real: bool,
22745}
22746
22747impl std::default::Default for InvfftOptions {
22748 fn default() -> Self {
22749 InvfftOptions { real: false }
22750 }
22751}
22752
22753pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22758 unsafe {
22759 let inp_in: *mut bindings::VipsImage = inp.ctx;
22760 let mut out_out: *mut bindings::VipsImage = null_mut();
22761
22762 let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22763 let real_in_name = utils::new_c_string("real")?;
22764
22765 let vips_op_response =
22766 bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22767 utils::result(
22768 vips_op_response,
22769 VipsImage { ctx: out_out },
22770 Error::InvfftError,
22771 )
22772 }
22773}
22774
22775pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22780 unsafe {
22781 let inp_in: *mut bindings::VipsImage = inp.ctx;
22782 let mask_in: *mut bindings::VipsImage = mask.ctx;
22783 let mut out_out: *mut bindings::VipsImage = null_mut();
22784
22785 let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22786 utils::result(
22787 vips_op_response,
22788 VipsImage { ctx: out_out },
22789 Error::FreqmultError,
22790 )
22791 }
22792}
22793
22794pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22798 unsafe {
22799 let inp_in: *mut bindings::VipsImage = inp.ctx;
22800 let mut out_out: *mut bindings::VipsImage = null_mut();
22801
22802 let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22803 utils::result(
22804 vips_op_response,
22805 VipsImage { ctx: out_out },
22806 Error::SpectrumError,
22807 )
22808 }
22809}
22810
22811pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22816 unsafe {
22817 let inp_in: *mut bindings::VipsImage = inp.ctx;
22818 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22819 let mut out_out: *mut bindings::VipsImage = null_mut();
22820
22821 let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22822 utils::result(
22823 vips_op_response,
22824 VipsImage { ctx: out_out },
22825 Error::PhasecorError,
22826 )
22827 }
22828}
22829
22830pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22839 unsafe {
22840 let inp_in: *mut bindings::VipsImage = inp.ctx;
22841 let mask_in: *mut bindings::VipsImage = mask.ctx;
22842 let morph_in: i32 = morph as i32;
22843 let mut out_out: *mut bindings::VipsImage = null_mut();
22844
22845 let vips_op_response = bindings::vips_morph(
22846 inp_in,
22847 &mut out_out,
22848 mask_in,
22849 morph_in.try_into().unwrap(),
22850 NULL,
22851 );
22852 utils::result(
22853 vips_op_response,
22854 VipsImage { ctx: out_out },
22855 Error::MorphError,
22856 )
22857 }
22858}
22859
22860pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22870 unsafe {
22871 let inp_in: *mut bindings::VipsImage = inp.ctx;
22872 let width_in: i32 = width;
22873 let height_in: i32 = height;
22874 let index_in: i32 = index;
22875 let mut out_out: *mut bindings::VipsImage = null_mut();
22876
22877 let vips_op_response =
22878 bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22879 utils::result(
22880 vips_op_response,
22881 VipsImage { ctx: out_out },
22882 Error::RankError,
22883 )
22884 }
22885}
22886
22887pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22895 unsafe {
22896 let inp_in: *mut bindings::VipsImage = inp.ctx;
22897 let direction_in: i32 = direction as i32;
22898 let mut nolines_out: f64 = f64::from(0);
22899
22900 let vips_op_response = bindings::vips_countlines(
22901 inp_in,
22902 &mut nolines_out,
22903 direction_in.try_into().unwrap(),
22904 NULL,
22905 );
22906 utils::result(vips_op_response, nolines_out, Error::CountlineError)
22907 }
22908}
22909
22910pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22914 unsafe {
22915 let inp_in: *mut bindings::VipsImage = inp.ctx;
22916 let mut mask_out: *mut bindings::VipsImage = null_mut();
22917
22918 let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22919 utils::result(
22920 vips_op_response,
22921 VipsImage { ctx: mask_out },
22922 Error::LabelregionError,
22923 )
22924 }
22925}
22926
22927#[derive(Clone, Debug)]
22929pub struct LabelregionOptions {
22930 pub segments: i32,
22933}
22934
22935impl std::default::Default for LabelregionOptions {
22936 fn default() -> Self {
22937 LabelregionOptions {
22938 segments: i32::from(0),
22939 }
22940 }
22941}
22942
22943pub fn labelregions_with_opts(
22948 inp: &VipsImage,
22949 labelregions_options: &LabelregionOptions,
22950) -> Result<VipsImage> {
22951 unsafe {
22952 let inp_in: *mut bindings::VipsImage = inp.ctx;
22953 let mut mask_out: *mut bindings::VipsImage = null_mut();
22954
22955 let segments_in: i32 = labelregions_options.segments;
22956 let segments_in_name = utils::new_c_string("segments")?;
22957
22958 let vips_op_response = bindings::vips_labelregions(
22959 inp_in,
22960 &mut mask_out,
22961 segments_in_name.as_ptr(),
22962 segments_in,
22963 NULL,
22964 );
22965 utils::result(
22966 vips_op_response,
22967 VipsImage { ctx: mask_out },
22968 Error::LabelregionError,
22969 )
22970 }
22971}
22972
22973pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22977 unsafe {
22978 let inp_in: *mut bindings::VipsImage = inp.ctx;
22979 let mut out_out: *mut bindings::VipsImage = null_mut();
22980
22981 let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22982 utils::result(
22983 vips_op_response,
22984 VipsImage { ctx: out_out },
22985 Error::FillNearestError,
22986 )
22987 }
22988}
22989
22990#[derive(Clone, Debug)]
22992pub struct FillNearestOptions {
22993 pub distance: VipsImage,
22995}
22996
22997impl std::default::Default for FillNearestOptions {
22998 fn default() -> Self {
22999 FillNearestOptions {
23000 distance: VipsImage::new(),
23001 }
23002 }
23003}
23004
23005pub fn fill_nearest_with_opts(
23010 inp: &VipsImage,
23011 fill_nearest_options: &FillNearestOptions,
23012) -> Result<VipsImage> {
23013 unsafe {
23014 let inp_in: *mut bindings::VipsImage = inp.ctx;
23015 let mut out_out: *mut bindings::VipsImage = null_mut();
23016
23017 let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
23018 let distance_in_name = utils::new_c_string("distance")?;
23019
23020 let vips_op_response = bindings::vips_fill_nearest(
23021 inp_in,
23022 &mut out_out,
23023 distance_in_name.as_ptr(),
23024 distance_in,
23025 NULL,
23026 );
23027 utils::result(
23028 vips_op_response,
23029 VipsImage { ctx: out_out },
23030 Error::FillNearestError,
23031 )
23032 }
23033}
23034
23035pub fn draw_rect(
23048 image: &VipsImage,
23049 ink: &mut [f64],
23050 left: i32,
23051 top: i32,
23052 width: i32,
23053 height: i32,
23054) -> Result<()> {
23055 unsafe {
23056 let image_in: *mut bindings::VipsImage = image.ctx;
23057 let ink_in: *mut f64 = ink.as_mut_ptr();
23058 let left_in: i32 = left;
23059 let top_in: i32 = top;
23060 let width_in: i32 = width;
23061 let height_in: i32 = height;
23062
23063 let vips_op_response = bindings::vips_draw_rect(
23064 image_in,
23065 ink_in,
23066 ink.len() as i32,
23067 left_in,
23068 top_in,
23069 width_in,
23070 height_in,
23071 NULL,
23072 );
23073 utils::result(vips_op_response, (), Error::DrawRectError)
23074 }
23075}
23076
23077#[derive(Clone, Debug)]
23079pub struct DrawRectOptions {
23080 pub fill: bool,
23083}
23084
23085impl std::default::Default for DrawRectOptions {
23086 fn default() -> Self {
23087 DrawRectOptions { fill: false }
23088 }
23089}
23090
23091pub fn draw_rect_with_opts(
23105 image: &VipsImage,
23106 ink: &mut [f64],
23107 left: i32,
23108 top: i32,
23109 width: i32,
23110 height: i32,
23111 draw_rect_options: &DrawRectOptions,
23112) -> Result<()> {
23113 unsafe {
23114 let image_in: *mut bindings::VipsImage = image.ctx;
23115 let ink_in: *mut f64 = ink.as_mut_ptr();
23116 let left_in: i32 = left;
23117 let top_in: i32 = top;
23118 let width_in: i32 = width;
23119 let height_in: i32 = height;
23120
23121 let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
23122 let fill_in_name = utils::new_c_string("fill")?;
23123
23124 let vips_op_response = bindings::vips_draw_rect(
23125 image_in,
23126 ink_in,
23127 ink.len() as i32,
23128 left_in,
23129 top_in,
23130 width_in,
23131 height_in,
23132 fill_in_name.as_ptr(),
23133 fill_in,
23134 NULL,
23135 );
23136 utils::result(vips_op_response, (), Error::DrawRectError)
23137 }
23138}
23139
23140pub fn draw_mask(
23150 image: &VipsImage,
23151 ink: &mut [f64],
23152 mask: &VipsImage,
23153 x: i32,
23154 y: i32,
23155) -> Result<()> {
23156 unsafe {
23157 let image_in: *mut bindings::VipsImage = image.ctx;
23158 let ink_in: *mut f64 = ink.as_mut_ptr();
23159 let mask_in: *mut bindings::VipsImage = mask.ctx;
23160 let x_in: i32 = x;
23161 let y_in: i32 = y;
23162
23163 let vips_op_response = bindings::vips_draw_mask(
23164 image_in,
23165 ink_in,
23166 ink.len() as i32,
23167 mask_in,
23168 x_in,
23169 y_in,
23170 NULL,
23171 );
23172 utils::result(vips_op_response, (), Error::DrawMaskError)
23173 }
23174}
23175
23176pub fn draw_line(
23189 image: &VipsImage,
23190 ink: &mut [f64],
23191 x_1: i32,
23192 y_1: i32,
23193 x_2: i32,
23194 y_2: i32,
23195) -> Result<()> {
23196 unsafe {
23197 let image_in: *mut bindings::VipsImage = image.ctx;
23198 let ink_in: *mut f64 = ink.as_mut_ptr();
23199 let x_1_in: i32 = x_1;
23200 let y_1_in: i32 = y_1;
23201 let x_2_in: i32 = x_2;
23202 let y_2_in: i32 = y_2;
23203
23204 let vips_op_response = bindings::vips_draw_line(
23205 image_in,
23206 ink_in,
23207 ink.len() as i32,
23208 x_1_in,
23209 y_1_in,
23210 x_2_in,
23211 y_2_in,
23212 NULL,
23213 );
23214 utils::result(vips_op_response, (), Error::DrawLineError)
23215 }
23216}
23217
23218pub fn draw_circle(
23229 image: &VipsImage,
23230 ink: &mut [f64],
23231 cx: i32,
23232 cy: i32,
23233 radius: i32,
23234) -> Result<()> {
23235 unsafe {
23236 let image_in: *mut bindings::VipsImage = image.ctx;
23237 let ink_in: *mut f64 = ink.as_mut_ptr();
23238 let cx_in: i32 = cx;
23239 let cy_in: i32 = cy;
23240 let radius_in: i32 = radius;
23241
23242 let vips_op_response = bindings::vips_draw_circle(
23243 image_in,
23244 ink_in,
23245 ink.len() as i32,
23246 cx_in,
23247 cy_in,
23248 radius_in,
23249 NULL,
23250 );
23251 utils::result(vips_op_response, (), Error::DrawCircleError)
23252 }
23253}
23254
23255#[derive(Clone, Debug)]
23257pub struct DrawCircleOptions {
23258 pub fill: bool,
23261}
23262
23263impl std::default::Default for DrawCircleOptions {
23264 fn default() -> Self {
23265 DrawCircleOptions { fill: false }
23266 }
23267}
23268
23269pub fn draw_circle_with_opts(
23281 image: &VipsImage,
23282 ink: &mut [f64],
23283 cx: i32,
23284 cy: i32,
23285 radius: i32,
23286 draw_circle_options: &DrawCircleOptions,
23287) -> Result<()> {
23288 unsafe {
23289 let image_in: *mut bindings::VipsImage = image.ctx;
23290 let ink_in: *mut f64 = ink.as_mut_ptr();
23291 let cx_in: i32 = cx;
23292 let cy_in: i32 = cy;
23293 let radius_in: i32 = radius;
23294
23295 let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
23296 let fill_in_name = utils::new_c_string("fill")?;
23297
23298 let vips_op_response = bindings::vips_draw_circle(
23299 image_in,
23300 ink_in,
23301 ink.len() as i32,
23302 cx_in,
23303 cy_in,
23304 radius_in,
23305 fill_in_name.as_ptr(),
23306 fill_in,
23307 NULL,
23308 );
23309 utils::result(vips_op_response, (), Error::DrawCircleError)
23310 }
23311}
23312
23313pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
23322 unsafe {
23323 let image_in: *mut bindings::VipsImage = image.ctx;
23324 let ink_in: *mut f64 = ink.as_mut_ptr();
23325 let x_in: i32 = x;
23326 let y_in: i32 = y;
23327
23328 let vips_op_response =
23329 bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
23330 utils::result(vips_op_response, (), Error::DrawFloodError)
23331 }
23332}
23333
23334#[derive(Clone, Debug)]
23336pub struct DrawFloodOptions {
23337 pub test: VipsImage,
23339 pub equal: bool,
23342 pub left: i32,
23345 pub top: i32,
23348 pub width: i32,
23351 pub height: i32,
23354}
23355
23356impl std::default::Default for DrawFloodOptions {
23357 fn default() -> Self {
23358 DrawFloodOptions {
23359 test: VipsImage::new(),
23360 equal: false,
23361 left: i32::from(0),
23362 top: i32::from(0),
23363 width: i32::from(0),
23364 height: i32::from(0),
23365 }
23366 }
23367}
23368
23369pub fn draw_flood_with_opts(
23379 image: &VipsImage,
23380 ink: &mut [f64],
23381 x: i32,
23382 y: i32,
23383 draw_flood_options: &DrawFloodOptions,
23384) -> Result<()> {
23385 unsafe {
23386 let image_in: *mut bindings::VipsImage = image.ctx;
23387 let ink_in: *mut f64 = ink.as_mut_ptr();
23388 let x_in: i32 = x;
23389 let y_in: i32 = y;
23390
23391 let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
23392 let test_in_name = utils::new_c_string("test")?;
23393
23394 let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
23395 let equal_in_name = utils::new_c_string("equal")?;
23396
23397 let left_in: i32 = draw_flood_options.left;
23398 let left_in_name = utils::new_c_string("left")?;
23399
23400 let top_in: i32 = draw_flood_options.top;
23401 let top_in_name = utils::new_c_string("top")?;
23402
23403 let width_in: i32 = draw_flood_options.width;
23404 let width_in_name = utils::new_c_string("width")?;
23405
23406 let height_in: i32 = draw_flood_options.height;
23407 let height_in_name = utils::new_c_string("height")?;
23408
23409 let vips_op_response = bindings::vips_draw_flood(
23410 image_in,
23411 ink_in,
23412 ink.len() as i32,
23413 x_in,
23414 y_in,
23415 test_in_name.as_ptr(),
23416 test_in,
23417 equal_in_name.as_ptr(),
23418 equal_in,
23419 left_in_name.as_ptr(),
23420 left_in,
23421 top_in_name.as_ptr(),
23422 top_in,
23423 width_in_name.as_ptr(),
23424 width_in,
23425 height_in_name.as_ptr(),
23426 height_in,
23427 NULL,
23428 );
23429 utils::result(vips_op_response, (), Error::DrawFloodError)
23430 }
23431}
23432
23433pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
23442 unsafe {
23443 let image_in: *mut bindings::VipsImage = image.ctx;
23444 let sub_in: *mut bindings::VipsImage = sub.ctx;
23445 let x_in: i32 = x;
23446 let y_in: i32 = y;
23447
23448 let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
23449 utils::result(vips_op_response, (), Error::DrawImageError)
23450 }
23451}
23452
23453#[derive(Clone, Debug)]
23455pub struct DrawImageOptions {
23456 pub mode: CombineMode,
23461}
23462
23463impl std::default::Default for DrawImageOptions {
23464 fn default() -> Self {
23465 DrawImageOptions {
23466 mode: CombineMode::Set,
23467 }
23468 }
23469}
23470
23471pub fn draw_image_with_opts(
23481 image: &VipsImage,
23482 sub: &VipsImage,
23483 x: i32,
23484 y: i32,
23485 draw_image_options: &DrawImageOptions,
23486) -> Result<()> {
23487 unsafe {
23488 let image_in: *mut bindings::VipsImage = image.ctx;
23489 let sub_in: *mut bindings::VipsImage = sub.ctx;
23490 let x_in: i32 = x;
23491 let y_in: i32 = y;
23492
23493 let mode_in: i32 = draw_image_options.mode as i32;
23494 let mode_in_name = utils::new_c_string("mode")?;
23495
23496 let vips_op_response = bindings::vips_draw_image(
23497 image_in,
23498 sub_in,
23499 x_in,
23500 y_in,
23501 mode_in_name.as_ptr(),
23502 mode_in,
23503 NULL,
23504 );
23505 utils::result(vips_op_response, (), Error::DrawImageError)
23506 }
23507}
23508
23509pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
23521 unsafe {
23522 let image_in: *mut bindings::VipsImage = image.ctx;
23523 let left_in: i32 = left;
23524 let top_in: i32 = top;
23525 let width_in: i32 = width;
23526 let height_in: i32 = height;
23527
23528 let vips_op_response =
23529 bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
23530 utils::result(vips_op_response, (), Error::DrawSmudgeError)
23531 }
23532}
23533
23534pub fn merge(
23547 refp: &VipsImage,
23548 sec: &VipsImage,
23549 direction: Direction,
23550 dx: i32,
23551 dy: i32,
23552) -> Result<VipsImage> {
23553 unsafe {
23554 let refp_in: *mut bindings::VipsImage = refp.ctx;
23555 let sec_in: *mut bindings::VipsImage = sec.ctx;
23556 let direction_in: i32 = direction as i32;
23557 let dx_in: i32 = dx;
23558 let dy_in: i32 = dy;
23559 let mut out_out: *mut bindings::VipsImage = null_mut();
23560
23561 let vips_op_response = bindings::vips_merge(
23562 refp_in,
23563 sec_in,
23564 &mut out_out,
23565 direction_in.try_into().unwrap(),
23566 dx_in,
23567 dy_in,
23568 NULL,
23569 );
23570 utils::result(
23571 vips_op_response,
23572 VipsImage { ctx: out_out },
23573 Error::MergeError,
23574 )
23575 }
23576}
23577
23578#[derive(Clone, Debug)]
23580pub struct MergeOptions {
23581 pub mblend: i32,
23584}
23585
23586impl std::default::Default for MergeOptions {
23587 fn default() -> Self {
23588 MergeOptions {
23589 mblend: i32::from(10),
23590 }
23591 }
23592}
23593
23594pub fn merge_with_opts(
23608 refp: &VipsImage,
23609 sec: &VipsImage,
23610 direction: Direction,
23611 dx: i32,
23612 dy: i32,
23613 merge_options: &MergeOptions,
23614) -> Result<VipsImage> {
23615 unsafe {
23616 let refp_in: *mut bindings::VipsImage = refp.ctx;
23617 let sec_in: *mut bindings::VipsImage = sec.ctx;
23618 let direction_in: i32 = direction as i32;
23619 let dx_in: i32 = dx;
23620 let dy_in: i32 = dy;
23621 let mut out_out: *mut bindings::VipsImage = null_mut();
23622
23623 let mblend_in: i32 = merge_options.mblend;
23624 let mblend_in_name = utils::new_c_string("mblend")?;
23625
23626 let vips_op_response = bindings::vips_merge(
23627 refp_in,
23628 sec_in,
23629 &mut out_out,
23630 direction_in.try_into().unwrap(),
23631 dx_in,
23632 dy_in,
23633 mblend_in_name.as_ptr(),
23634 mblend_in,
23635 NULL,
23636 );
23637 utils::result(
23638 vips_op_response,
23639 VipsImage { ctx: out_out },
23640 Error::MergeError,
23641 )
23642 }
23643}
23644
23645pub fn mosaic(
23662 refp: &VipsImage,
23663 sec: &VipsImage,
23664 direction: Direction,
23665 xref: i32,
23666 yref: i32,
23667 xsec: i32,
23668 ysec: i32,
23669) -> Result<VipsImage> {
23670 unsafe {
23671 let refp_in: *mut bindings::VipsImage = refp.ctx;
23672 let sec_in: *mut bindings::VipsImage = sec.ctx;
23673 let direction_in: i32 = direction as i32;
23674 let xref_in: i32 = xref;
23675 let yref_in: i32 = yref;
23676 let xsec_in: i32 = xsec;
23677 let ysec_in: i32 = ysec;
23678 let mut out_out: *mut bindings::VipsImage = null_mut();
23679
23680 let vips_op_response = bindings::vips_mosaic(
23681 refp_in,
23682 sec_in,
23683 &mut out_out,
23684 direction_in.try_into().unwrap(),
23685 xref_in,
23686 yref_in,
23687 xsec_in,
23688 ysec_in,
23689 NULL,
23690 );
23691 utils::result(
23692 vips_op_response,
23693 VipsImage { ctx: out_out },
23694 Error::MosaicError,
23695 )
23696 }
23697}
23698
23699#[derive(Clone, Debug)]
23701pub struct MosaicOptions {
23702 pub hwindow: i32,
23705 pub harea: i32,
23708 pub mblend: i32,
23711 pub bandno: i32,
23714 pub dx_0: i32,
23717 pub dy_0: i32,
23720 pub scale_1: f64,
23723 pub angle_1: f64,
23726 pub dy_1: f64,
23729 pub dx_1: f64,
23732}
23733
23734impl std::default::Default for MosaicOptions {
23735 fn default() -> Self {
23736 MosaicOptions {
23737 hwindow: i32::from(5),
23738 harea: i32::from(15),
23739 mblend: i32::from(10),
23740 bandno: i32::from(0),
23741 dx_0: i32::from(0),
23742 dy_0: i32::from(0),
23743 scale_1: f64::from(1),
23744 angle_1: f64::from(0),
23745 dy_1: f64::from(0),
23746 dx_1: f64::from(0),
23747 }
23748 }
23749}
23750
23751pub fn mosaic_with_opts(
23769 refp: &VipsImage,
23770 sec: &VipsImage,
23771 direction: Direction,
23772 xref: i32,
23773 yref: i32,
23774 xsec: i32,
23775 ysec: i32,
23776 mosaic_options: &MosaicOptions,
23777) -> Result<VipsImage> {
23778 unsafe {
23779 let refp_in: *mut bindings::VipsImage = refp.ctx;
23780 let sec_in: *mut bindings::VipsImage = sec.ctx;
23781 let direction_in: i32 = direction as i32;
23782 let xref_in: i32 = xref;
23783 let yref_in: i32 = yref;
23784 let xsec_in: i32 = xsec;
23785 let ysec_in: i32 = ysec;
23786 let mut out_out: *mut bindings::VipsImage = null_mut();
23787
23788 let hwindow_in: i32 = mosaic_options.hwindow;
23789 let hwindow_in_name = utils::new_c_string("hwindow")?;
23790
23791 let harea_in: i32 = mosaic_options.harea;
23792 let harea_in_name = utils::new_c_string("harea")?;
23793
23794 let mblend_in: i32 = mosaic_options.mblend;
23795 let mblend_in_name = utils::new_c_string("mblend")?;
23796
23797 let bandno_in: i32 = mosaic_options.bandno;
23798 let bandno_in_name = utils::new_c_string("bandno")?;
23799
23800 let dx_0_in: i32 = mosaic_options.dx_0;
23801 let dx_0_in_name = utils::new_c_string("dx0")?;
23802
23803 let dy_0_in: i32 = mosaic_options.dy_0;
23804 let dy_0_in_name = utils::new_c_string("dy0")?;
23805
23806 let scale_1_in: f64 = mosaic_options.scale_1;
23807 let scale_1_in_name = utils::new_c_string("scale1")?;
23808
23809 let angle_1_in: f64 = mosaic_options.angle_1;
23810 let angle_1_in_name = utils::new_c_string("angle1")?;
23811
23812 let dy_1_in: f64 = mosaic_options.dy_1;
23813 let dy_1_in_name = utils::new_c_string("dy1")?;
23814
23815 let dx_1_in: f64 = mosaic_options.dx_1;
23816 let dx_1_in_name = utils::new_c_string("dx1")?;
23817
23818 let vips_op_response = bindings::vips_mosaic(
23819 refp_in,
23820 sec_in,
23821 &mut out_out,
23822 direction_in.try_into().unwrap(),
23823 xref_in,
23824 yref_in,
23825 xsec_in,
23826 ysec_in,
23827 hwindow_in_name.as_ptr(),
23828 hwindow_in,
23829 harea_in_name.as_ptr(),
23830 harea_in,
23831 mblend_in_name.as_ptr(),
23832 mblend_in,
23833 bandno_in_name.as_ptr(),
23834 bandno_in,
23835 dx_0_in_name.as_ptr(),
23836 dx_0_in,
23837 dy_0_in_name.as_ptr(),
23838 dy_0_in,
23839 scale_1_in_name.as_ptr(),
23840 scale_1_in,
23841 angle_1_in_name.as_ptr(),
23842 angle_1_in,
23843 dy_1_in_name.as_ptr(),
23844 dy_1_in,
23845 dx_1_in_name.as_ptr(),
23846 dx_1_in,
23847 NULL,
23848 );
23849 utils::result(
23850 vips_op_response,
23851 VipsImage { ctx: out_out },
23852 Error::MosaicError,
23853 )
23854 }
23855}
23856
23857pub fn mosaic_1(
23882 refp: &VipsImage,
23883 sec: &VipsImage,
23884 direction: Direction,
23885 xr_1: i32,
23886 yr_1: i32,
23887 xs_1: i32,
23888 ys_1: i32,
23889 xr_2: i32,
23890 yr_2: i32,
23891 xs_2: i32,
23892 ys_2: i32,
23893) -> Result<VipsImage> {
23894 unsafe {
23895 let refp_in: *mut bindings::VipsImage = refp.ctx;
23896 let sec_in: *mut bindings::VipsImage = sec.ctx;
23897 let direction_in: i32 = direction as i32;
23898 let xr_1_in: i32 = xr_1;
23899 let yr_1_in: i32 = yr_1;
23900 let xs_1_in: i32 = xs_1;
23901 let ys_1_in: i32 = ys_1;
23902 let xr_2_in: i32 = xr_2;
23903 let yr_2_in: i32 = yr_2;
23904 let xs_2_in: i32 = xs_2;
23905 let ys_2_in: i32 = ys_2;
23906 let mut out_out: *mut bindings::VipsImage = null_mut();
23907
23908 let vips_op_response = bindings::vips_mosaic1(
23909 refp_in,
23910 sec_in,
23911 &mut out_out,
23912 direction_in.try_into().unwrap(),
23913 xr_1_in,
23914 yr_1_in,
23915 xs_1_in,
23916 ys_1_in,
23917 xr_2_in,
23918 yr_2_in,
23919 xs_2_in,
23920 ys_2_in,
23921 NULL,
23922 );
23923 utils::result(
23924 vips_op_response,
23925 VipsImage { ctx: out_out },
23926 Error::Mosaic1Error,
23927 )
23928 }
23929}
23930
23931#[derive(Clone, Debug)]
23933pub struct Mosaic1Options {
23934 pub hwindow: i32,
23937 pub harea: i32,
23940 pub search: bool,
23943 pub interpolate: VipsInterpolate,
23945 pub mblend: i32,
23948}
23949
23950impl std::default::Default for Mosaic1Options {
23951 fn default() -> Self {
23952 Mosaic1Options {
23953 hwindow: i32::from(5),
23954 harea: i32::from(15),
23955 search: false,
23956 interpolate: VipsInterpolate::new(),
23957 mblend: i32::from(10),
23958 }
23959 }
23960}
23961
23962pub fn mosaic_1_with_opts(
23988 refp: &VipsImage,
23989 sec: &VipsImage,
23990 direction: Direction,
23991 xr_1: i32,
23992 yr_1: i32,
23993 xs_1: i32,
23994 ys_1: i32,
23995 xr_2: i32,
23996 yr_2: i32,
23997 xs_2: i32,
23998 ys_2: i32,
23999 mosaic_1_options: &Mosaic1Options,
24000) -> Result<VipsImage> {
24001 unsafe {
24002 let refp_in: *mut bindings::VipsImage = refp.ctx;
24003 let sec_in: *mut bindings::VipsImage = sec.ctx;
24004 let direction_in: i32 = direction as i32;
24005 let xr_1_in: i32 = xr_1;
24006 let yr_1_in: i32 = yr_1;
24007 let xs_1_in: i32 = xs_1;
24008 let ys_1_in: i32 = ys_1;
24009 let xr_2_in: i32 = xr_2;
24010 let yr_2_in: i32 = yr_2;
24011 let xs_2_in: i32 = xs_2;
24012 let ys_2_in: i32 = ys_2;
24013 let mut out_out: *mut bindings::VipsImage = null_mut();
24014
24015 let hwindow_in: i32 = mosaic_1_options.hwindow;
24016 let hwindow_in_name = utils::new_c_string("hwindow")?;
24017
24018 let harea_in: i32 = mosaic_1_options.harea;
24019 let harea_in_name = utils::new_c_string("harea")?;
24020
24021 let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
24022 let search_in_name = utils::new_c_string("search")?;
24023
24024 let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
24025 let interpolate_in_name = utils::new_c_string("interpolate")?;
24026
24027 let mblend_in: i32 = mosaic_1_options.mblend;
24028 let mblend_in_name = utils::new_c_string("mblend")?;
24029
24030 let vips_op_response = bindings::vips_mosaic1(
24031 refp_in,
24032 sec_in,
24033 &mut out_out,
24034 direction_in.try_into().unwrap(),
24035 xr_1_in,
24036 yr_1_in,
24037 xs_1_in,
24038 ys_1_in,
24039 xr_2_in,
24040 yr_2_in,
24041 xs_2_in,
24042 ys_2_in,
24043 hwindow_in_name.as_ptr(),
24044 hwindow_in,
24045 harea_in_name.as_ptr(),
24046 harea_in,
24047 search_in_name.as_ptr(),
24048 search_in,
24049 interpolate_in_name.as_ptr(),
24050 interpolate_in,
24051 mblend_in_name.as_ptr(),
24052 mblend_in,
24053 NULL,
24054 );
24055 utils::result(
24056 vips_op_response,
24057 VipsImage { ctx: out_out },
24058 Error::Mosaic1Error,
24059 )
24060 }
24061}
24062
24063pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
24067 unsafe {
24068 let inp_in: *mut bindings::VipsImage = inp.ctx;
24069 let mut out_out: *mut bindings::VipsImage = null_mut();
24070
24071 let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
24072 utils::result(
24073 vips_op_response,
24074 VipsImage { ctx: out_out },
24075 Error::MatrixinvertError,
24076 )
24077 }
24078}
24079
24080pub fn matrixmultiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24085 unsafe {
24086 let left_in: *mut bindings::VipsImage = left.ctx;
24087 let right_in: *mut bindings::VipsImage = right.ctx;
24088 let mut out_out: *mut bindings::VipsImage = null_mut();
24089
24090 let vips_op_response = bindings::vips_matrixmultiply(left_in, right_in, &mut out_out, NULL);
24091 utils::result(
24092 vips_op_response,
24093 VipsImage { ctx: out_out },
24094 Error::MatrixmultiplyError,
24095 )
24096 }
24097}
24098
24099pub fn matches(
24120 refp: &VipsImage,
24121 sec: &VipsImage,
24122 xr_1: i32,
24123 yr_1: i32,
24124 xs_1: i32,
24125 ys_1: i32,
24126 xr_2: i32,
24127 yr_2: i32,
24128 xs_2: i32,
24129 ys_2: i32,
24130) -> Result<VipsImage> {
24131 unsafe {
24132 let refp_in: *mut bindings::VipsImage = refp.ctx;
24133 let sec_in: *mut bindings::VipsImage = sec.ctx;
24134 let xr_1_in: i32 = xr_1;
24135 let yr_1_in: i32 = yr_1;
24136 let xs_1_in: i32 = xs_1;
24137 let ys_1_in: i32 = ys_1;
24138 let xr_2_in: i32 = xr_2;
24139 let yr_2_in: i32 = yr_2;
24140 let xs_2_in: i32 = xs_2;
24141 let ys_2_in: i32 = ys_2;
24142 let mut out_out: *mut bindings::VipsImage = null_mut();
24143
24144 let vips_op_response = bindings::vips_match(
24145 refp_in,
24146 sec_in,
24147 &mut out_out,
24148 xr_1_in,
24149 yr_1_in,
24150 xs_1_in,
24151 ys_1_in,
24152 xr_2_in,
24153 yr_2_in,
24154 xs_2_in,
24155 ys_2_in,
24156 NULL,
24157 );
24158 utils::result(
24159 vips_op_response,
24160 VipsImage { ctx: out_out },
24161 Error::MatchError,
24162 )
24163 }
24164}
24165
24166#[derive(Clone, Debug)]
24168pub struct MatchOptions {
24169 pub hwindow: i32,
24172 pub harea: i32,
24175 pub search: bool,
24178 pub interpolate: VipsInterpolate,
24180}
24181
24182impl std::default::Default for MatchOptions {
24183 fn default() -> Self {
24184 MatchOptions {
24185 hwindow: i32::from(5),
24186 harea: i32::from(15),
24187 search: false,
24188 interpolate: VipsInterpolate::new(),
24189 }
24190 }
24191}
24192
24193pub fn matches_with_opts(
24215 refp: &VipsImage,
24216 sec: &VipsImage,
24217 xr_1: i32,
24218 yr_1: i32,
24219 xs_1: i32,
24220 ys_1: i32,
24221 xr_2: i32,
24222 yr_2: i32,
24223 xs_2: i32,
24224 ys_2: i32,
24225 matches_options: &MatchOptions,
24226) -> Result<VipsImage> {
24227 unsafe {
24228 let refp_in: *mut bindings::VipsImage = refp.ctx;
24229 let sec_in: *mut bindings::VipsImage = sec.ctx;
24230 let xr_1_in: i32 = xr_1;
24231 let yr_1_in: i32 = yr_1;
24232 let xs_1_in: i32 = xs_1;
24233 let ys_1_in: i32 = ys_1;
24234 let xr_2_in: i32 = xr_2;
24235 let yr_2_in: i32 = yr_2;
24236 let xs_2_in: i32 = xs_2;
24237 let ys_2_in: i32 = ys_2;
24238 let mut out_out: *mut bindings::VipsImage = null_mut();
24239
24240 let hwindow_in: i32 = matches_options.hwindow;
24241 let hwindow_in_name = utils::new_c_string("hwindow")?;
24242
24243 let harea_in: i32 = matches_options.harea;
24244 let harea_in_name = utils::new_c_string("harea")?;
24245
24246 let search_in: i32 = if matches_options.search { 1 } else { 0 };
24247 let search_in_name = utils::new_c_string("search")?;
24248
24249 let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
24250 let interpolate_in_name = utils::new_c_string("interpolate")?;
24251
24252 let vips_op_response = bindings::vips_match(
24253 refp_in,
24254 sec_in,
24255 &mut out_out,
24256 xr_1_in,
24257 yr_1_in,
24258 xs_1_in,
24259 ys_1_in,
24260 xr_2_in,
24261 yr_2_in,
24262 xs_2_in,
24263 ys_2_in,
24264 hwindow_in_name.as_ptr(),
24265 hwindow_in,
24266 harea_in_name.as_ptr(),
24267 harea_in,
24268 search_in_name.as_ptr(),
24269 search_in,
24270 interpolate_in_name.as_ptr(),
24271 interpolate_in,
24272 NULL,
24273 );
24274 utils::result(
24275 vips_op_response,
24276 VipsImage { ctx: out_out },
24277 Error::MatchError,
24278 )
24279 }
24280}
24281
24282pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
24286 unsafe {
24287 let inp_in: *mut bindings::VipsImage = inp.ctx;
24288 let mut out_out: *mut bindings::VipsImage = null_mut();
24289
24290 let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
24291 utils::result(
24292 vips_op_response,
24293 VipsImage { ctx: out_out },
24294 Error::GlobalbalanceError,
24295 )
24296 }
24297}
24298
24299#[derive(Clone, Debug)]
24301pub struct GlobalbalanceOptions {
24302 pub gamma: f64,
24305 pub int_output: bool,
24308}
24309
24310impl std::default::Default for GlobalbalanceOptions {
24311 fn default() -> Self {
24312 GlobalbalanceOptions {
24313 gamma: f64::from(1.6),
24314 int_output: false,
24315 }
24316 }
24317}
24318
24319pub fn globalbalance_with_opts(
24324 inp: &VipsImage,
24325 globalbalance_options: &GlobalbalanceOptions,
24326) -> Result<VipsImage> {
24327 unsafe {
24328 let inp_in: *mut bindings::VipsImage = inp.ctx;
24329 let mut out_out: *mut bindings::VipsImage = null_mut();
24330
24331 let gamma_in: f64 = globalbalance_options.gamma;
24332 let gamma_in_name = utils::new_c_string("gamma")?;
24333
24334 let int_output_in: i32 = if globalbalance_options.int_output {
24335 1
24336 } else {
24337 0
24338 };
24339 let int_output_in_name = utils::new_c_string("int-output")?;
24340
24341 let vips_op_response = bindings::vips_globalbalance(
24342 inp_in,
24343 &mut out_out,
24344 gamma_in_name.as_ptr(),
24345 gamma_in,
24346 int_output_in_name.as_ptr(),
24347 int_output_in,
24348 NULL,
24349 );
24350 utils::result(
24351 vips_op_response,
24352 VipsImage { ctx: out_out },
24353 Error::GlobalbalanceError,
24354 )
24355 }
24356}
24357
24358pub fn remosaic(inp: &VipsImage, old_str: &str, new_str: &str) -> Result<VipsImage> {
24364 unsafe {
24365 let inp_in: *mut bindings::VipsImage = inp.ctx;
24366 let old_str_in: CString = utils::new_c_string(old_str)?;
24367 let new_str_in: CString = utils::new_c_string(new_str)?;
24368 let mut out_out: *mut bindings::VipsImage = null_mut();
24369
24370 let vips_op_response = bindings::vips_remosaic(
24371 inp_in,
24372 &mut out_out,
24373 old_str_in.as_ptr(),
24374 new_str_in.as_ptr(),
24375 NULL,
24376 );
24377 utils::result(
24378 vips_op_response,
24379 VipsImage { ctx: out_out },
24380 Error::RemosaicError,
24381 )
24382 }
24383}