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 Last = 4,
459}
460
461#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
462pub enum Interesting {
463 None = 0,
465 Centre = 1,
467 Entropy = 2,
469 Attention = 3,
471 Low = 4,
473 High = 5,
475 All = 6,
477 Last = 7,
479}
480
481#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
482pub enum Interpretation {
483 Error = -1,
485 Multiband = 0,
487 BW = 1,
489 Histogram = 10,
491 Xyz = 12,
493 Lab = 13,
495 Cmyk = 15,
497 Labq = 16,
499 Rgb = 17,
501 Cmc = 18,
503 Lch = 19,
505 Labs = 21,
507 Srgb = 22,
509 Yxy = 23,
511 Fourier = 24,
513 Rgb16 = 25,
515 Grey16 = 26,
517 Matrix = 27,
519 Scrgb = 28,
521 Hsv = 29,
523 Last = 30,
525}
526
527#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
528pub enum Kernel {
529 Nearest = 0,
531 Linear = 1,
533 Cubic = 2,
535 Mitchell = 3,
537 Lanczos2 = 4,
539 Lanczos3 = 5,
541 Last = 6,
543}
544
545#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
546pub enum OperationBoolean {
547 And = 0,
549 Or = 1,
551 Eor = 2,
553 Lshift = 3,
555 Rshift = 4,
557 Last = 5,
559}
560
561#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
562pub enum OperationComplex {
563 Polar = 0,
565 Rect = 1,
567 Conj = 2,
569 Last = 3,
571}
572
573#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
574pub enum OperationComplex2 {
575 CrossPhase = 0,
577 Last = 1,
579}
580
581#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
582pub enum OperationComplexget {
583 Real = 0,
585 Imag = 1,
587 Last = 2,
589}
590
591#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
592pub enum OperationMath {
593 Sin = 0,
595 Co = 1,
597 Tan = 2,
599 Asin = 3,
601 Aco = 4,
603 Atan = 5,
605 Log = 6,
607 Log10 = 7,
609 Exp = 8,
611 Exp10 = 9,
613 Sinh = 10,
615 Cosh = 11,
617 Tanh = 12,
619 Asinh = 13,
621 Acosh = 14,
623 Atanh = 15,
625 Last = 16,
627}
628
629#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
630pub enum OperationMath2 {
631 Pow = 0,
633 Wop = 1,
635 Atan2 = 2,
637 Last = 3,
639}
640
641#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
642pub enum OperationMorphology {
643 Erode = 0,
645 Dilate = 1,
647 Last = 2,
649}
650
651#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
652pub enum OperationRelational {
653 Equal = 0,
655 Noteq = 1,
657 Less = 2,
659 Lesseq = 3,
661 More = 4,
663 Moreeq = 5,
665 Last = 6,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum OperationRound {
671 Rint = 0,
673 Ceil = 1,
675 Floor = 2,
677 Last = 3,
679}
680
681#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
682pub enum PCS {
683 Lab = 0,
685 Xyz = 1,
687 Last = 2,
689}
690
691#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
692pub enum Precision {
693 Integer = 0,
695 Float = 1,
697 Approximate = 2,
699 Last = 3,
701}
702
703#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
704pub enum RegionShrink {
705 Mean = 0,
707 Median = 1,
709 Mode = 2,
711 Max = 3,
713 Min = 4,
715 Nearest = 5,
717 Last = 6,
719}
720
721#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
722pub enum Size {
723 Both = 0,
725 Up = 1,
727 Down = 2,
729 Force = 3,
731 Last = 4,
733}
734
735#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
736pub enum TextWrap {
737 Word = 0,
739 Char = 1,
741 WordChar = 2,
743 None = 3,
745 Last = 4,
747}
748
749pub fn system(cmd_format: &str) -> Result<()> {
753 unsafe {
754 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
755
756 let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
757 utils::result(vips_op_response, (), Error::SystemError)
758 }
759}
760
761#[derive(Clone, Debug)]
763pub struct SystemOptions {
764 pub inp: Vec<VipsImage>,
766 pub out: VipsImage,
768 pub log: String,
770 pub out_format: String,
772 pub in_format: String,
774}
775
776impl std::default::Default for SystemOptions {
777 fn default() -> Self {
778 SystemOptions {
779 inp: Vec::new(),
780 out: VipsImage::new(),
781 log: String::new(),
782 out_format: String::new(),
783 in_format: String::new(),
784 }
785 }
786}
787
788pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
793 unsafe {
794 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
795
796 let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
797 let inp_in = inp_wrapper.ctx;
798 let inp_in_name = utils::new_c_string("inp")?;
799
800 let out_in: *mut bindings::VipsImage = system_options.out.ctx;
801 let out_in_name = utils::new_c_string("out")?;
802
803 let log_in: CString = utils::new_c_string(&system_options.log)?;
804 let log_in_name = utils::new_c_string("log")?;
805
806 let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
807 let out_format_in_name = utils::new_c_string("out-format")?;
808
809 let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
810 let in_format_in_name = utils::new_c_string("in-format")?;
811
812 let vips_op_response = bindings::vips_system(
813 cmd_format_in.as_ptr(),
814 inp_in_name.as_ptr(),
815 inp_in,
816 out_in_name.as_ptr(),
817 out_in,
818 log_in_name.as_ptr(),
819 log_in.as_ptr(),
820 out_format_in_name.as_ptr(),
821 out_format_in.as_ptr(),
822 in_format_in_name.as_ptr(),
823 in_format_in.as_ptr(),
824 NULL,
825 );
826 utils::result(vips_op_response, (), Error::SystemError)
827 }
828}
829
830pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
835 unsafe {
836 let left_in: *mut bindings::VipsImage = left.ctx;
837 let right_in: *mut bindings::VipsImage = right.ctx;
838 let mut out_out: *mut bindings::VipsImage = null_mut();
839
840 let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
841 utils::result(
842 vips_op_response,
843 VipsImage { ctx: out_out },
844 Error::AddError,
845 )
846 }
847}
848
849pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
854 unsafe {
855 let left_in: *mut bindings::VipsImage = left.ctx;
856 let right_in: *mut bindings::VipsImage = right.ctx;
857 let mut out_out: *mut bindings::VipsImage = null_mut();
858
859 let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
860 utils::result(
861 vips_op_response,
862 VipsImage { ctx: out_out },
863 Error::SubtractError,
864 )
865 }
866}
867
868pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
873 unsafe {
874 let left_in: *mut bindings::VipsImage = left.ctx;
875 let right_in: *mut bindings::VipsImage = right.ctx;
876 let mut out_out: *mut bindings::VipsImage = null_mut();
877
878 let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
879 utils::result(
880 vips_op_response,
881 VipsImage { ctx: out_out },
882 Error::MultiplyError,
883 )
884 }
885}
886
887pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
892 unsafe {
893 let left_in: *mut bindings::VipsImage = left.ctx;
894 let right_in: *mut bindings::VipsImage = right.ctx;
895 let mut out_out: *mut bindings::VipsImage = null_mut();
896
897 let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
898 utils::result(
899 vips_op_response,
900 VipsImage { ctx: out_out },
901 Error::DivideError,
902 )
903 }
904}
905
906pub fn relational(
919 left: &VipsImage,
920 right: &VipsImage,
921 relational: OperationRelational,
922) -> Result<VipsImage> {
923 unsafe {
924 let left_in: *mut bindings::VipsImage = left.ctx;
925 let right_in: *mut bindings::VipsImage = right.ctx;
926 let relational_in: i32 = relational as i32;
927 let mut out_out: *mut bindings::VipsImage = null_mut();
928
929 let vips_op_response = bindings::vips_relational(
930 left_in,
931 right_in,
932 &mut out_out,
933 relational_in.try_into().unwrap(),
934 NULL,
935 );
936 utils::result(
937 vips_op_response,
938 VipsImage { ctx: out_out },
939 Error::RelationalError,
940 )
941 }
942}
943
944pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
949 unsafe {
950 let left_in: *mut bindings::VipsImage = left.ctx;
951 let right_in: *mut bindings::VipsImage = right.ctx;
952 let mut out_out: *mut bindings::VipsImage = null_mut();
953
954 let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
955 utils::result(
956 vips_op_response,
957 VipsImage { ctx: out_out },
958 Error::RemainderError,
959 )
960 }
961}
962
963pub fn boolean(
975 left: &VipsImage,
976 right: &VipsImage,
977 boolean: OperationBoolean,
978) -> Result<VipsImage> {
979 unsafe {
980 let left_in: *mut bindings::VipsImage = left.ctx;
981 let right_in: *mut bindings::VipsImage = right.ctx;
982 let boolean_in: i32 = boolean as i32;
983 let mut out_out: *mut bindings::VipsImage = null_mut();
984
985 let vips_op_response = bindings::vips_boolean(
986 left_in,
987 right_in,
988 &mut out_out,
989 boolean_in.try_into().unwrap(),
990 NULL,
991 );
992 utils::result(
993 vips_op_response,
994 VipsImage { ctx: out_out },
995 Error::BooleanError,
996 )
997 }
998}
999
1000pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1010 unsafe {
1011 let left_in: *mut bindings::VipsImage = left.ctx;
1012 let right_in: *mut bindings::VipsImage = right.ctx;
1013 let math_2_in: i32 = math_2 as i32;
1014 let mut out_out: *mut bindings::VipsImage = null_mut();
1015
1016 let vips_op_response = bindings::vips_math2(
1017 left_in,
1018 right_in,
1019 &mut out_out,
1020 math_2_in.try_into().unwrap(),
1021 NULL,
1022 );
1023 utils::result(
1024 vips_op_response,
1025 VipsImage { ctx: out_out },
1026 Error::Math2Error,
1027 )
1028 }
1029}
1030
1031pub fn complex_2(
1039 left: &VipsImage,
1040 right: &VipsImage,
1041 cmplx: OperationComplex2,
1042) -> Result<VipsImage> {
1043 unsafe {
1044 let left_in: *mut bindings::VipsImage = left.ctx;
1045 let right_in: *mut bindings::VipsImage = right.ctx;
1046 let cmplx_in: i32 = cmplx as i32;
1047 let mut out_out: *mut bindings::VipsImage = null_mut();
1048
1049 let vips_op_response = bindings::vips_complex2(
1050 left_in,
1051 right_in,
1052 &mut out_out,
1053 cmplx_in.try_into().unwrap(),
1054 NULL,
1055 );
1056 utils::result(
1057 vips_op_response,
1058 VipsImage { ctx: out_out },
1059 Error::Complex2Error,
1060 )
1061 }
1062}
1063
1064pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1069 unsafe {
1070 let left_in: *mut bindings::VipsImage = left.ctx;
1071 let right_in: *mut bindings::VipsImage = right.ctx;
1072 let mut out_out: *mut bindings::VipsImage = null_mut();
1073
1074 let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1075 utils::result(
1076 vips_op_response,
1077 VipsImage { ctx: out_out },
1078 Error::ComplexformError,
1079 )
1080 }
1081}
1082
1083pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1087 unsafe {
1088 let (inp_len, mut inp_in) = {
1089 let len = inp.len();
1090 let mut input = Vec::new();
1091 for img in inp {
1092 input.push(img.ctx)
1093 }
1094 (len as i32, input)
1095 };
1096 let mut out_out: *mut bindings::VipsImage = null_mut();
1097
1098 let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1099 utils::result(
1100 vips_op_response,
1101 VipsImage { ctx: out_out },
1102 Error::SumError,
1103 )
1104 }
1105}
1106
1107pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1111 unsafe {
1112 let inp_in: *mut bindings::VipsImage = inp.ctx;
1113 let mut out_out: *mut bindings::VipsImage = null_mut();
1114
1115 let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1116 utils::result(
1117 vips_op_response,
1118 VipsImage { ctx: out_out },
1119 Error::InvertError,
1120 )
1121 }
1122}
1123
1124pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1146 unsafe {
1147 let inp_in: *mut bindings::VipsImage = inp.ctx;
1148 let math_in: i32 = math as i32;
1149 let mut out_out: *mut bindings::VipsImage = null_mut();
1150
1151 let vips_op_response =
1152 bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1153 utils::result(
1154 vips_op_response,
1155 VipsImage { ctx: out_out },
1156 Error::MathError,
1157 )
1158 }
1159}
1160
1161pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1165 unsafe {
1166 let inp_in: *mut bindings::VipsImage = inp.ctx;
1167 let mut out_out: *mut bindings::VipsImage = null_mut();
1168
1169 let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1170 utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1171 }
1172}
1173
1174pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1178 unsafe {
1179 let inp_in: *mut bindings::VipsImage = inp.ctx;
1180 let mut out_out: *mut bindings::VipsImage = null_mut();
1181
1182 let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1183 utils::result(
1184 vips_op_response,
1185 VipsImage { ctx: out_out },
1186 Error::SignError,
1187 )
1188 }
1189}
1190
1191pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1200 unsafe {
1201 let inp_in: *mut bindings::VipsImage = inp.ctx;
1202 let round_in: i32 = round as i32;
1203 let mut out_out: *mut bindings::VipsImage = null_mut();
1204
1205 let vips_op_response =
1206 bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1207 utils::result(
1208 vips_op_response,
1209 VipsImage { ctx: out_out },
1210 Error::RoundError,
1211 )
1212 }
1213}
1214
1215pub fn relational_const(
1228 inp: &VipsImage,
1229 relational: OperationRelational,
1230 c: &mut [f64],
1231) -> Result<VipsImage> {
1232 unsafe {
1233 let inp_in: *mut bindings::VipsImage = inp.ctx;
1234 let relational_in: i32 = relational as i32;
1235 let c_in: *mut f64 = c.as_mut_ptr();
1236 let mut out_out: *mut bindings::VipsImage = null_mut();
1237
1238 let vips_op_response = bindings::vips_relational_const(
1239 inp_in,
1240 &mut out_out,
1241 relational_in.try_into().unwrap(),
1242 c_in,
1243 c.len() as i32,
1244 NULL,
1245 );
1246 utils::result(
1247 vips_op_response,
1248 VipsImage { ctx: out_out },
1249 Error::RelationalConstError,
1250 )
1251 }
1252}
1253
1254pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1259 unsafe {
1260 let inp_in: *mut bindings::VipsImage = inp.ctx;
1261 let c_in: *mut f64 = c.as_mut_ptr();
1262 let mut out_out: *mut bindings::VipsImage = null_mut();
1263
1264 let vips_op_response =
1265 bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1266 utils::result(
1267 vips_op_response,
1268 VipsImage { ctx: out_out },
1269 Error::RemainderConstError,
1270 )
1271 }
1272}
1273
1274pub fn boolean_const(
1286 inp: &VipsImage,
1287 boolean: OperationBoolean,
1288 c: &mut [f64],
1289) -> Result<VipsImage> {
1290 unsafe {
1291 let inp_in: *mut bindings::VipsImage = inp.ctx;
1292 let boolean_in: i32 = boolean as i32;
1293 let c_in: *mut f64 = c.as_mut_ptr();
1294 let mut out_out: *mut bindings::VipsImage = null_mut();
1295
1296 let vips_op_response = bindings::vips_boolean_const(
1297 inp_in,
1298 &mut out_out,
1299 boolean_in.try_into().unwrap(),
1300 c_in,
1301 c.len() as i32,
1302 NULL,
1303 );
1304 utils::result(
1305 vips_op_response,
1306 VipsImage { ctx: out_out },
1307 Error::BooleanConstError,
1308 )
1309 }
1310}
1311
1312pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1322 unsafe {
1323 let inp_in: *mut bindings::VipsImage = inp.ctx;
1324 let math_2_in: i32 = math_2 as i32;
1325 let c_in: *mut f64 = c.as_mut_ptr();
1326 let mut out_out: *mut bindings::VipsImage = null_mut();
1327
1328 let vips_op_response = bindings::vips_math2_const(
1329 inp_in,
1330 &mut out_out,
1331 math_2_in.try_into().unwrap(),
1332 c_in,
1333 c.len() as i32,
1334 NULL,
1335 );
1336 utils::result(
1337 vips_op_response,
1338 VipsImage { ctx: out_out },
1339 Error::Math2ConstError,
1340 )
1341 }
1342}
1343
1344pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1353 unsafe {
1354 let inp_in: *mut bindings::VipsImage = inp.ctx;
1355 let cmplx_in: i32 = cmplx as i32;
1356 let mut out_out: *mut bindings::VipsImage = null_mut();
1357
1358 let vips_op_response =
1359 bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1360 utils::result(
1361 vips_op_response,
1362 VipsImage { ctx: out_out },
1363 Error::ComplexError,
1364 )
1365 }
1366}
1367
1368pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1376 unsafe {
1377 let inp_in: *mut bindings::VipsImage = inp.ctx;
1378 let get_in: i32 = get as i32;
1379 let mut out_out: *mut bindings::VipsImage = null_mut();
1380
1381 let vips_op_response =
1382 bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1383 utils::result(
1384 vips_op_response,
1385 VipsImage { ctx: out_out },
1386 Error::ComplexgetError,
1387 )
1388 }
1389}
1390
1391pub fn avg(inp: &VipsImage) -> Result<f64> {
1395 unsafe {
1396 let inp_in: *mut bindings::VipsImage = inp.ctx;
1397 let mut out_out: f64 = f64::from(0);
1398
1399 let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1400 utils::result(vips_op_response, out_out, Error::AvgError)
1401 }
1402}
1403
1404pub fn min(inp: &VipsImage) -> Result<f64> {
1408 unsafe {
1409 let inp_in: *mut bindings::VipsImage = inp.ctx;
1410 let mut out_out: f64 = f64::from(0);
1411
1412 let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1413 utils::result(vips_op_response, out_out, Error::MinError)
1414 }
1415}
1416
1417#[derive(Clone, Debug)]
1419pub struct MinOptions {
1420 pub x: i32,
1423 pub y: i32,
1426 pub size: i32,
1429 pub out_array: Vec<f64>,
1431 pub x_array: Vec<i32>,
1433 pub y_array: Vec<i32>,
1435}
1436
1437impl std::default::Default for MinOptions {
1438 fn default() -> Self {
1439 MinOptions {
1440 x: i32::from(0),
1441 y: i32::from(0),
1442 size: i32::from(10),
1443 out_array: Vec::new(),
1444 x_array: Vec::new(),
1445 y_array: Vec::new(),
1446 }
1447 }
1448}
1449
1450pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1455 unsafe {
1456 let inp_in: *mut bindings::VipsImage = inp.ctx;
1457 let mut out_out: f64 = f64::from(0);
1458
1459 let x_in: i32 = min_options.x;
1460 let x_in_name = utils::new_c_string("x")?;
1461
1462 let y_in: i32 = min_options.y;
1463 let y_in_name = utils::new_c_string("y")?;
1464
1465 let size_in: i32 = min_options.size;
1466 let size_in_name = utils::new_c_string("size")?;
1467
1468 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1469 let out_array_in = out_array_wrapper.ctx;
1470 let out_array_in_name = utils::new_c_string("out-array")?;
1471
1472 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1473 let x_array_in = x_array_wrapper.ctx;
1474 let x_array_in_name = utils::new_c_string("x-array")?;
1475
1476 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1477 let y_array_in = y_array_wrapper.ctx;
1478 let y_array_in_name = utils::new_c_string("y-array")?;
1479
1480 let vips_op_response = bindings::vips_min(
1481 inp_in,
1482 &mut out_out,
1483 x_in_name.as_ptr(),
1484 x_in,
1485 y_in_name.as_ptr(),
1486 y_in,
1487 size_in_name.as_ptr(),
1488 size_in,
1489 out_array_in_name.as_ptr(),
1490 out_array_in,
1491 x_array_in_name.as_ptr(),
1492 x_array_in,
1493 y_array_in_name.as_ptr(),
1494 y_array_in,
1495 NULL,
1496 );
1497 utils::result(vips_op_response, out_out, Error::MinError)
1498 }
1499}
1500
1501pub fn max(inp: &VipsImage) -> Result<f64> {
1505 unsafe {
1506 let inp_in: *mut bindings::VipsImage = inp.ctx;
1507 let mut out_out: f64 = f64::from(0);
1508
1509 let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1510 utils::result(vips_op_response, out_out, Error::MaxError)
1511 }
1512}
1513
1514#[derive(Clone, Debug)]
1516pub struct MaxOptions {
1517 pub x: i32,
1520 pub y: i32,
1523 pub size: i32,
1526 pub out_array: Vec<f64>,
1528 pub x_array: Vec<i32>,
1530 pub y_array: Vec<i32>,
1532}
1533
1534impl std::default::Default for MaxOptions {
1535 fn default() -> Self {
1536 MaxOptions {
1537 x: i32::from(0),
1538 y: i32::from(0),
1539 size: i32::from(10),
1540 out_array: Vec::new(),
1541 x_array: Vec::new(),
1542 y_array: Vec::new(),
1543 }
1544 }
1545}
1546
1547pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1552 unsafe {
1553 let inp_in: *mut bindings::VipsImage = inp.ctx;
1554 let mut out_out: f64 = f64::from(0);
1555
1556 let x_in: i32 = max_options.x;
1557 let x_in_name = utils::new_c_string("x")?;
1558
1559 let y_in: i32 = max_options.y;
1560 let y_in_name = utils::new_c_string("y")?;
1561
1562 let size_in: i32 = max_options.size;
1563 let size_in_name = utils::new_c_string("size")?;
1564
1565 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1566 let out_array_in = out_array_wrapper.ctx;
1567 let out_array_in_name = utils::new_c_string("out-array")?;
1568
1569 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1570 let x_array_in = x_array_wrapper.ctx;
1571 let x_array_in_name = utils::new_c_string("x-array")?;
1572
1573 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1574 let y_array_in = y_array_wrapper.ctx;
1575 let y_array_in_name = utils::new_c_string("y-array")?;
1576
1577 let vips_op_response = bindings::vips_max(
1578 inp_in,
1579 &mut out_out,
1580 x_in_name.as_ptr(),
1581 x_in,
1582 y_in_name.as_ptr(),
1583 y_in,
1584 size_in_name.as_ptr(),
1585 size_in,
1586 out_array_in_name.as_ptr(),
1587 out_array_in,
1588 x_array_in_name.as_ptr(),
1589 x_array_in,
1590 y_array_in_name.as_ptr(),
1591 y_array_in,
1592 NULL,
1593 );
1594 utils::result(vips_op_response, out_out, Error::MaxError)
1595 }
1596}
1597
1598pub fn deviate(inp: &VipsImage) -> Result<f64> {
1602 unsafe {
1603 let inp_in: *mut bindings::VipsImage = inp.ctx;
1604 let mut out_out: f64 = f64::from(0);
1605
1606 let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1607 utils::result(vips_op_response, out_out, Error::DeviateError)
1608 }
1609}
1610
1611pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1615 unsafe {
1616 let inp_in: *mut bindings::VipsImage = inp.ctx;
1617 let mut out_out: *mut bindings::VipsImage = null_mut();
1618
1619 let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1620 utils::result(
1621 vips_op_response,
1622 VipsImage { ctx: out_out },
1623 Error::StatError,
1624 )
1625 }
1626}
1627
1628pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1632 unsafe {
1633 let inp_in: *mut bindings::VipsImage = inp.ctx;
1634 let mut out_out: *mut bindings::VipsImage = null_mut();
1635
1636 let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1637 utils::result(
1638 vips_op_response,
1639 VipsImage { ctx: out_out },
1640 Error::HistFindError,
1641 )
1642 }
1643}
1644
1645#[derive(Clone, Debug)]
1647pub struct HistFindOptions {
1648 pub band: i32,
1651}
1652
1653impl std::default::Default for HistFindOptions {
1654 fn default() -> Self {
1655 HistFindOptions {
1656 band: i32::from(-1),
1657 }
1658 }
1659}
1660
1661pub fn hist_find_with_opts(
1666 inp: &VipsImage,
1667 hist_find_options: &HistFindOptions,
1668) -> Result<VipsImage> {
1669 unsafe {
1670 let inp_in: *mut bindings::VipsImage = inp.ctx;
1671 let mut out_out: *mut bindings::VipsImage = null_mut();
1672
1673 let band_in: i32 = hist_find_options.band;
1674 let band_in_name = utils::new_c_string("band")?;
1675
1676 let vips_op_response =
1677 bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1678 utils::result(
1679 vips_op_response,
1680 VipsImage { ctx: out_out },
1681 Error::HistFindError,
1682 )
1683 }
1684}
1685
1686pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1690 unsafe {
1691 let inp_in: *mut bindings::VipsImage = inp.ctx;
1692 let mut out_out: *mut bindings::VipsImage = null_mut();
1693
1694 let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1695 utils::result(
1696 vips_op_response,
1697 VipsImage { ctx: out_out },
1698 Error::HistFindNdimError,
1699 )
1700 }
1701}
1702
1703#[derive(Clone, Debug)]
1705pub struct HistFindNdimOptions {
1706 pub bins: i32,
1709}
1710
1711impl std::default::Default for HistFindNdimOptions {
1712 fn default() -> Self {
1713 HistFindNdimOptions {
1714 bins: i32::from(10),
1715 }
1716 }
1717}
1718
1719pub fn hist_find_ndim_with_opts(
1724 inp: &VipsImage,
1725 hist_find_ndim_options: &HistFindNdimOptions,
1726) -> Result<VipsImage> {
1727 unsafe {
1728 let inp_in: *mut bindings::VipsImage = inp.ctx;
1729 let mut out_out: *mut bindings::VipsImage = null_mut();
1730
1731 let bins_in: i32 = hist_find_ndim_options.bins;
1732 let bins_in_name = utils::new_c_string("bins")?;
1733
1734 let vips_op_response = bindings::vips_hist_find_ndim(
1735 inp_in,
1736 &mut out_out,
1737 bins_in_name.as_ptr(),
1738 bins_in,
1739 NULL,
1740 );
1741 utils::result(
1742 vips_op_response,
1743 VipsImage { ctx: out_out },
1744 Error::HistFindNdimError,
1745 )
1746 }
1747}
1748
1749pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1754 unsafe {
1755 let inp_in: *mut bindings::VipsImage = inp.ctx;
1756 let index_in: *mut bindings::VipsImage = index.ctx;
1757 let mut out_out: *mut bindings::VipsImage = null_mut();
1758
1759 let vips_op_response =
1760 bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1761 utils::result(
1762 vips_op_response,
1763 VipsImage { ctx: out_out },
1764 Error::HistFindIndexedError,
1765 )
1766 }
1767}
1768
1769#[derive(Clone, Debug)]
1771pub struct HistFindIndexedOptions {
1772 pub combine: Combine,
1778}
1779
1780impl std::default::Default for HistFindIndexedOptions {
1781 fn default() -> Self {
1782 HistFindIndexedOptions {
1783 combine: Combine::Sum,
1784 }
1785 }
1786}
1787
1788pub fn hist_find_indexed_with_opts(
1794 inp: &VipsImage,
1795 index: &VipsImage,
1796 hist_find_indexed_options: &HistFindIndexedOptions,
1797) -> Result<VipsImage> {
1798 unsafe {
1799 let inp_in: *mut bindings::VipsImage = inp.ctx;
1800 let index_in: *mut bindings::VipsImage = index.ctx;
1801 let mut out_out: *mut bindings::VipsImage = null_mut();
1802
1803 let combine_in: i32 = hist_find_indexed_options.combine as i32;
1804 let combine_in_name = utils::new_c_string("combine")?;
1805
1806 let vips_op_response = bindings::vips_hist_find_indexed(
1807 inp_in,
1808 index_in,
1809 &mut out_out,
1810 combine_in_name.as_ptr(),
1811 combine_in,
1812 NULL,
1813 );
1814 utils::result(
1815 vips_op_response,
1816 VipsImage { ctx: out_out },
1817 Error::HistFindIndexedError,
1818 )
1819 }
1820}
1821
1822pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1826 unsafe {
1827 let inp_in: *mut bindings::VipsImage = inp.ctx;
1828 let mut out_out: *mut bindings::VipsImage = null_mut();
1829
1830 let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1831 utils::result(
1832 vips_op_response,
1833 VipsImage { ctx: out_out },
1834 Error::HoughLineError,
1835 )
1836 }
1837}
1838
1839#[derive(Clone, Debug)]
1841pub struct HoughLineOptions {
1842 pub width: i32,
1845 pub height: i32,
1848}
1849
1850impl std::default::Default for HoughLineOptions {
1851 fn default() -> Self {
1852 HoughLineOptions {
1853 width: i32::from(256),
1854 height: i32::from(256),
1855 }
1856 }
1857}
1858
1859pub fn hough_line_with_opts(
1864 inp: &VipsImage,
1865 hough_line_options: &HoughLineOptions,
1866) -> Result<VipsImage> {
1867 unsafe {
1868 let inp_in: *mut bindings::VipsImage = inp.ctx;
1869 let mut out_out: *mut bindings::VipsImage = null_mut();
1870
1871 let width_in: i32 = hough_line_options.width;
1872 let width_in_name = utils::new_c_string("width")?;
1873
1874 let height_in: i32 = hough_line_options.height;
1875 let height_in_name = utils::new_c_string("height")?;
1876
1877 let vips_op_response = bindings::vips_hough_line(
1878 inp_in,
1879 &mut out_out,
1880 width_in_name.as_ptr(),
1881 width_in,
1882 height_in_name.as_ptr(),
1883 height_in,
1884 NULL,
1885 );
1886 utils::result(
1887 vips_op_response,
1888 VipsImage { ctx: out_out },
1889 Error::HoughLineError,
1890 )
1891 }
1892}
1893
1894pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
1898 unsafe {
1899 let inp_in: *mut bindings::VipsImage = inp.ctx;
1900 let mut out_out: *mut bindings::VipsImage = null_mut();
1901
1902 let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
1903 utils::result(
1904 vips_op_response,
1905 VipsImage { ctx: out_out },
1906 Error::HoughCircleError,
1907 )
1908 }
1909}
1910
1911#[derive(Clone, Debug)]
1913pub struct HoughCircleOptions {
1914 pub scale: i32,
1917 pub min_radius: i32,
1920 pub max_radius: i32,
1923}
1924
1925impl std::default::Default for HoughCircleOptions {
1926 fn default() -> Self {
1927 HoughCircleOptions {
1928 scale: i32::from(3),
1929 min_radius: i32::from(10),
1930 max_radius: i32::from(20),
1931 }
1932 }
1933}
1934
1935pub fn hough_circle_with_opts(
1940 inp: &VipsImage,
1941 hough_circle_options: &HoughCircleOptions,
1942) -> Result<VipsImage> {
1943 unsafe {
1944 let inp_in: *mut bindings::VipsImage = inp.ctx;
1945 let mut out_out: *mut bindings::VipsImage = null_mut();
1946
1947 let scale_in: i32 = hough_circle_options.scale;
1948 let scale_in_name = utils::new_c_string("scale")?;
1949
1950 let min_radius_in: i32 = hough_circle_options.min_radius;
1951 let min_radius_in_name = utils::new_c_string("min-radius")?;
1952
1953 let max_radius_in: i32 = hough_circle_options.max_radius;
1954 let max_radius_in_name = utils::new_c_string("max-radius")?;
1955
1956 let vips_op_response = bindings::vips_hough_circle(
1957 inp_in,
1958 &mut out_out,
1959 scale_in_name.as_ptr(),
1960 scale_in,
1961 min_radius_in_name.as_ptr(),
1962 min_radius_in,
1963 max_radius_in_name.as_ptr(),
1964 max_radius_in,
1965 NULL,
1966 );
1967 utils::result(
1968 vips_op_response,
1969 VipsImage { ctx: out_out },
1970 Error::HoughCircleError,
1971 )
1972 }
1973}
1974
1975pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
1982 unsafe {
1983 let inp_in: *mut bindings::VipsImage = inp.ctx;
1984 let mut columns_out: *mut bindings::VipsImage = null_mut();
1985 let mut rows_out: *mut bindings::VipsImage = null_mut();
1986
1987 let vips_op_response =
1988 bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
1989 utils::result(
1990 vips_op_response,
1991 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
1992 Error::ProjectError,
1993 )
1994 }
1995}
1996
1997pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2004 unsafe {
2005 let inp_in: *mut bindings::VipsImage = inp.ctx;
2006 let mut columns_out: *mut bindings::VipsImage = null_mut();
2007 let mut rows_out: *mut bindings::VipsImage = null_mut();
2008
2009 let vips_op_response =
2010 bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2011 utils::result(
2012 vips_op_response,
2013 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2014 Error::ProfileError,
2015 )
2016 }
2017}
2018
2019pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2027 unsafe {
2028 let inp_in: *mut bindings::VipsImage = inp.ctx;
2029 let h_in: i32 = h;
2030 let v_in: i32 = v;
2031 let mut out_out: *mut bindings::VipsImage = null_mut();
2032
2033 let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2034 utils::result(
2035 vips_op_response,
2036 VipsImage { ctx: out_out },
2037 Error::MeasureError,
2038 )
2039 }
2040}
2041
2042#[derive(Clone, Debug)]
2044pub struct MeasureOptions {
2045 pub left: i32,
2048 pub top: i32,
2051 pub width: i32,
2054 pub height: i32,
2057}
2058
2059impl std::default::Default for MeasureOptions {
2060 fn default() -> Self {
2061 MeasureOptions {
2062 left: i32::from(0),
2063 top: i32::from(0),
2064 width: i32::from(1),
2065 height: i32::from(1),
2066 }
2067 }
2068}
2069
2070pub fn measure_with_opts(
2079 inp: &VipsImage,
2080 h: i32,
2081 v: i32,
2082 measure_options: &MeasureOptions,
2083) -> Result<VipsImage> {
2084 unsafe {
2085 let inp_in: *mut bindings::VipsImage = inp.ctx;
2086 let h_in: i32 = h;
2087 let v_in: i32 = v;
2088 let mut out_out: *mut bindings::VipsImage = null_mut();
2089
2090 let left_in: i32 = measure_options.left;
2091 let left_in_name = utils::new_c_string("left")?;
2092
2093 let top_in: i32 = measure_options.top;
2094 let top_in_name = utils::new_c_string("top")?;
2095
2096 let width_in: i32 = measure_options.width;
2097 let width_in_name = utils::new_c_string("width")?;
2098
2099 let height_in: i32 = measure_options.height;
2100 let height_in_name = utils::new_c_string("height")?;
2101
2102 let vips_op_response = bindings::vips_measure(
2103 inp_in,
2104 &mut out_out,
2105 h_in,
2106 v_in,
2107 left_in_name.as_ptr(),
2108 left_in,
2109 top_in_name.as_ptr(),
2110 top_in,
2111 width_in_name.as_ptr(),
2112 width_in,
2113 height_in_name.as_ptr(),
2114 height_in,
2115 NULL,
2116 );
2117 utils::result(
2118 vips_op_response,
2119 VipsImage { ctx: out_out },
2120 Error::MeasureError,
2121 )
2122 }
2123}
2124
2125pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2134 unsafe {
2135 let inp_in: *mut bindings::VipsImage = inp.ctx;
2136 let mut left_out: i32 = i32::from(1);
2137 let mut top_out: i32 = i32::from(0);
2138 let mut width_out: i32 = i32::from(1);
2139 let mut height_out: i32 = i32::from(1);
2140
2141 let vips_op_response = bindings::vips_find_trim(
2142 inp_in,
2143 &mut left_out,
2144 &mut top_out,
2145 &mut width_out,
2146 &mut height_out,
2147 NULL,
2148 );
2149 utils::result(
2150 vips_op_response,
2151 (left_out, top_out, width_out, height_out),
2152 Error::FindTrimError,
2153 )
2154 }
2155}
2156
2157#[derive(Clone, Debug)]
2159pub struct FindTrimOptions {
2160 pub threshold: f64,
2163 pub background: Vec<f64>,
2165 pub line_art: bool,
2168}
2169
2170impl std::default::Default for FindTrimOptions {
2171 fn default() -> Self {
2172 FindTrimOptions {
2173 threshold: f64::from(10),
2174 background: Vec::new(),
2175 line_art: false,
2176 }
2177 }
2178}
2179
2180pub fn find_trim_with_opts(
2190 inp: &VipsImage,
2191 find_trim_options: &FindTrimOptions,
2192) -> Result<(i32, i32, i32, i32)> {
2193 unsafe {
2194 let inp_in: *mut bindings::VipsImage = inp.ctx;
2195 let mut left_out: i32 = i32::from(1);
2196 let mut top_out: i32 = i32::from(0);
2197 let mut width_out: i32 = i32::from(1);
2198 let mut height_out: i32 = i32::from(1);
2199
2200 let threshold_in: f64 = find_trim_options.threshold;
2201 let threshold_in_name = utils::new_c_string("threshold")?;
2202
2203 let background_wrapper =
2204 utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2205 let background_in = background_wrapper.ctx;
2206 let background_in_name = utils::new_c_string("background")?;
2207
2208 let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2209 let line_art_in_name = utils::new_c_string("line-art")?;
2210
2211 let vips_op_response = bindings::vips_find_trim(
2212 inp_in,
2213 &mut left_out,
2214 &mut top_out,
2215 &mut width_out,
2216 &mut height_out,
2217 threshold_in_name.as_ptr(),
2218 threshold_in,
2219 background_in_name.as_ptr(),
2220 background_in,
2221 line_art_in_name.as_ptr(),
2222 line_art_in,
2223 NULL,
2224 );
2225 utils::result(
2226 vips_op_response,
2227 (left_out, top_out, width_out, height_out),
2228 Error::FindTrimError,
2229 )
2230 }
2231}
2232
2233pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2237 unsafe {
2238 let inp_in: *mut bindings::VipsImage = inp.ctx;
2239 let mut out_out: *mut bindings::VipsImage = null_mut();
2240
2241 let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2242 utils::result(
2243 vips_op_response,
2244 VipsImage { ctx: out_out },
2245 Error::CopyError,
2246 )
2247 }
2248}
2249
2250#[derive(Clone, Debug)]
2252pub struct CopyOptions {
2253 pub width: i32,
2256 pub height: i32,
2259 pub bands: i32,
2262 pub format: BandFormat,
2276 pub coding: Coding,
2283 pub interpretation: Interpretation,
2306 pub xres: f64,
2309 pub yres: f64,
2312 pub xoffset: i32,
2315 pub yoffset: i32,
2318}
2319
2320impl std::default::Default for CopyOptions {
2321 fn default() -> Self {
2322 CopyOptions {
2323 width: i32::from(0),
2324 height: i32::from(0),
2325 bands: i32::from(0),
2326 format: BandFormat::Uchar,
2327 coding: Coding::None,
2328 interpretation: Interpretation::Multiband,
2329 xres: f64::from(0),
2330 yres: f64::from(0),
2331 xoffset: i32::from(0),
2332 yoffset: i32::from(0),
2333 }
2334 }
2335}
2336
2337pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2342 unsafe {
2343 let inp_in: *mut bindings::VipsImage = inp.ctx;
2344 let mut out_out: *mut bindings::VipsImage = null_mut();
2345
2346 let width_in: i32 = copy_options.width;
2347 let width_in_name = utils::new_c_string("width")?;
2348
2349 let height_in: i32 = copy_options.height;
2350 let height_in_name = utils::new_c_string("height")?;
2351
2352 let bands_in: i32 = copy_options.bands;
2353 let bands_in_name = utils::new_c_string("bands")?;
2354
2355 let format_in: i32 = copy_options.format as i32;
2356 let format_in_name = utils::new_c_string("format")?;
2357
2358 let coding_in: i32 = copy_options.coding as i32;
2359 let coding_in_name = utils::new_c_string("coding")?;
2360
2361 let interpretation_in: i32 = copy_options.interpretation as i32;
2362 let interpretation_in_name = utils::new_c_string("interpretation")?;
2363
2364 let xres_in: f64 = copy_options.xres;
2365 let xres_in_name = utils::new_c_string("xres")?;
2366
2367 let yres_in: f64 = copy_options.yres;
2368 let yres_in_name = utils::new_c_string("yres")?;
2369
2370 let xoffset_in: i32 = copy_options.xoffset;
2371 let xoffset_in_name = utils::new_c_string("xoffset")?;
2372
2373 let yoffset_in: i32 = copy_options.yoffset;
2374 let yoffset_in_name = utils::new_c_string("yoffset")?;
2375
2376 let vips_op_response = bindings::vips_copy(
2377 inp_in,
2378 &mut out_out,
2379 width_in_name.as_ptr(),
2380 width_in,
2381 height_in_name.as_ptr(),
2382 height_in,
2383 bands_in_name.as_ptr(),
2384 bands_in,
2385 format_in_name.as_ptr(),
2386 format_in,
2387 coding_in_name.as_ptr(),
2388 coding_in,
2389 interpretation_in_name.as_ptr(),
2390 interpretation_in,
2391 xres_in_name.as_ptr(),
2392 xres_in,
2393 yres_in_name.as_ptr(),
2394 yres_in,
2395 xoffset_in_name.as_ptr(),
2396 xoffset_in,
2397 yoffset_in_name.as_ptr(),
2398 yoffset_in,
2399 NULL,
2400 );
2401 utils::result(
2402 vips_op_response,
2403 VipsImage { ctx: out_out },
2404 Error::CopyError,
2405 )
2406 }
2407}
2408
2409pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2413 unsafe {
2414 let inp_in: *mut bindings::VipsImage = inp.ctx;
2415 let mut out_out: *mut bindings::VipsImage = null_mut();
2416
2417 let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2418 utils::result(
2419 vips_op_response,
2420 VipsImage { ctx: out_out },
2421 Error::TilecacheError,
2422 )
2423 }
2424}
2425
2426#[derive(Clone, Debug)]
2428pub struct TilecacheOptions {
2429 pub tile_width: i32,
2432 pub tile_height: i32,
2435 pub max_tiles: i32,
2438 pub access: Access,
2444 pub threaded: bool,
2447 pub persistent: bool,
2450}
2451
2452impl std::default::Default for TilecacheOptions {
2453 fn default() -> Self {
2454 TilecacheOptions {
2455 tile_width: i32::from(128),
2456 tile_height: i32::from(128),
2457 max_tiles: i32::from(1000),
2458 access: Access::Random,
2459 threaded: false,
2460 persistent: false,
2461 }
2462 }
2463}
2464
2465pub fn tilecache_with_opts(
2470 inp: &VipsImage,
2471 tilecache_options: &TilecacheOptions,
2472) -> Result<VipsImage> {
2473 unsafe {
2474 let inp_in: *mut bindings::VipsImage = inp.ctx;
2475 let mut out_out: *mut bindings::VipsImage = null_mut();
2476
2477 let tile_width_in: i32 = tilecache_options.tile_width;
2478 let tile_width_in_name = utils::new_c_string("tile-width")?;
2479
2480 let tile_height_in: i32 = tilecache_options.tile_height;
2481 let tile_height_in_name = utils::new_c_string("tile-height")?;
2482
2483 let max_tiles_in: i32 = tilecache_options.max_tiles;
2484 let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2485
2486 let access_in: i32 = tilecache_options.access as i32;
2487 let access_in_name = utils::new_c_string("access")?;
2488
2489 let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2490 let threaded_in_name = utils::new_c_string("threaded")?;
2491
2492 let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2493 let persistent_in_name = utils::new_c_string("persistent")?;
2494
2495 let vips_op_response = bindings::vips_tilecache(
2496 inp_in,
2497 &mut out_out,
2498 tile_width_in_name.as_ptr(),
2499 tile_width_in,
2500 tile_height_in_name.as_ptr(),
2501 tile_height_in,
2502 max_tiles_in_name.as_ptr(),
2503 max_tiles_in,
2504 access_in_name.as_ptr(),
2505 access_in,
2506 threaded_in_name.as_ptr(),
2507 threaded_in,
2508 persistent_in_name.as_ptr(),
2509 persistent_in,
2510 NULL,
2511 );
2512 utils::result(
2513 vips_op_response,
2514 VipsImage { ctx: out_out },
2515 Error::TilecacheError,
2516 )
2517 }
2518}
2519
2520pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2524 unsafe {
2525 let inp_in: *mut bindings::VipsImage = inp.ctx;
2526 let mut out_out: *mut bindings::VipsImage = null_mut();
2527
2528 let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2529 utils::result(
2530 vips_op_response,
2531 VipsImage { ctx: out_out },
2532 Error::LinecacheError,
2533 )
2534 }
2535}
2536
2537#[derive(Clone, Debug)]
2539pub struct LinecacheOptions {
2540 pub tile_height: i32,
2543 pub access: Access,
2549 pub threaded: bool,
2552 pub persistent: bool,
2555}
2556
2557impl std::default::Default for LinecacheOptions {
2558 fn default() -> Self {
2559 LinecacheOptions {
2560 tile_height: i32::from(128),
2561 access: Access::Random,
2562 threaded: false,
2563 persistent: false,
2564 }
2565 }
2566}
2567
2568pub fn linecache_with_opts(
2573 inp: &VipsImage,
2574 linecache_options: &LinecacheOptions,
2575) -> Result<VipsImage> {
2576 unsafe {
2577 let inp_in: *mut bindings::VipsImage = inp.ctx;
2578 let mut out_out: *mut bindings::VipsImage = null_mut();
2579
2580 let tile_height_in: i32 = linecache_options.tile_height;
2581 let tile_height_in_name = utils::new_c_string("tile-height")?;
2582
2583 let access_in: i32 = linecache_options.access as i32;
2584 let access_in_name = utils::new_c_string("access")?;
2585
2586 let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2587 let threaded_in_name = utils::new_c_string("threaded")?;
2588
2589 let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2590 let persistent_in_name = utils::new_c_string("persistent")?;
2591
2592 let vips_op_response = bindings::vips_linecache(
2593 inp_in,
2594 &mut out_out,
2595 tile_height_in_name.as_ptr(),
2596 tile_height_in,
2597 access_in_name.as_ptr(),
2598 access_in,
2599 threaded_in_name.as_ptr(),
2600 threaded_in,
2601 persistent_in_name.as_ptr(),
2602 persistent_in,
2603 NULL,
2604 );
2605 utils::result(
2606 vips_op_response,
2607 VipsImage { ctx: out_out },
2608 Error::LinecacheError,
2609 )
2610 }
2611}
2612
2613pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2617 unsafe {
2618 let inp_in: *mut bindings::VipsImage = inp.ctx;
2619 let mut out_out: *mut bindings::VipsImage = null_mut();
2620
2621 let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2622 utils::result(
2623 vips_op_response,
2624 VipsImage { ctx: out_out },
2625 Error::SequentialError,
2626 )
2627 }
2628}
2629
2630#[derive(Clone, Debug)]
2632pub struct SequentialOptions {
2633 pub tile_height: i32,
2636}
2637
2638impl std::default::Default for SequentialOptions {
2639 fn default() -> Self {
2640 SequentialOptions {
2641 tile_height: i32::from(1),
2642 }
2643 }
2644}
2645
2646pub fn sequential_with_opts(
2651 inp: &VipsImage,
2652 sequential_options: &SequentialOptions,
2653) -> Result<VipsImage> {
2654 unsafe {
2655 let inp_in: *mut bindings::VipsImage = inp.ctx;
2656 let mut out_out: *mut bindings::VipsImage = null_mut();
2657
2658 let tile_height_in: i32 = sequential_options.tile_height;
2659 let tile_height_in_name = utils::new_c_string("tile-height")?;
2660
2661 let vips_op_response = bindings::vips_sequential(
2662 inp_in,
2663 &mut out_out,
2664 tile_height_in_name.as_ptr(),
2665 tile_height_in,
2666 NULL,
2667 );
2668 utils::result(
2669 vips_op_response,
2670 VipsImage { ctx: out_out },
2671 Error::SequentialError,
2672 )
2673 }
2674}
2675
2676pub fn cache(inp: &VipsImage) -> Result<VipsImage> {
2680 unsafe {
2681 let inp_in: *mut bindings::VipsImage = inp.ctx;
2682 let mut out_out: *mut bindings::VipsImage = null_mut();
2683
2684 let vips_op_response = bindings::vips_cache(inp_in, &mut out_out, NULL);
2685 utils::result(
2686 vips_op_response,
2687 VipsImage { ctx: out_out },
2688 Error::CacheError,
2689 )
2690 }
2691}
2692
2693#[derive(Clone, Debug)]
2695pub struct CacheOptions {
2696 pub max_tiles: i32,
2699 pub tile_height: i32,
2702 pub tile_width: i32,
2705}
2706
2707impl std::default::Default for CacheOptions {
2708 fn default() -> Self {
2709 CacheOptions {
2710 max_tiles: i32::from(1000),
2711 tile_height: i32::from(128),
2712 tile_width: i32::from(128),
2713 }
2714 }
2715}
2716
2717pub fn cache_with_opts(inp: &VipsImage, cache_options: &CacheOptions) -> Result<VipsImage> {
2722 unsafe {
2723 let inp_in: *mut bindings::VipsImage = inp.ctx;
2724 let mut out_out: *mut bindings::VipsImage = null_mut();
2725
2726 let max_tiles_in: i32 = cache_options.max_tiles;
2727 let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2728
2729 let tile_height_in: i32 = cache_options.tile_height;
2730 let tile_height_in_name = utils::new_c_string("tile-height")?;
2731
2732 let tile_width_in: i32 = cache_options.tile_width;
2733 let tile_width_in_name = utils::new_c_string("tile-width")?;
2734
2735 let vips_op_response = bindings::vips_cache(
2736 inp_in,
2737 &mut out_out,
2738 max_tiles_in_name.as_ptr(),
2739 max_tiles_in,
2740 tile_height_in_name.as_ptr(),
2741 tile_height_in,
2742 tile_width_in_name.as_ptr(),
2743 tile_width_in,
2744 NULL,
2745 );
2746 utils::result(
2747 vips_op_response,
2748 VipsImage { ctx: out_out },
2749 Error::CacheError,
2750 )
2751 }
2752}
2753
2754pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2766 unsafe {
2767 let inp_in: *mut bindings::VipsImage = inp.ctx;
2768 let x_in: i32 = x;
2769 let y_in: i32 = y;
2770 let width_in: i32 = width;
2771 let height_in: i32 = height;
2772 let mut out_out: *mut bindings::VipsImage = null_mut();
2773
2774 let vips_op_response =
2775 bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2776 utils::result(
2777 vips_op_response,
2778 VipsImage { ctx: out_out },
2779 Error::EmbedError,
2780 )
2781 }
2782}
2783
2784#[derive(Clone, Debug)]
2786pub struct EmbedOptions {
2787 pub extend: Extend,
2796 pub background: Vec<f64>,
2798}
2799
2800impl std::default::Default for EmbedOptions {
2801 fn default() -> Self {
2802 EmbedOptions {
2803 extend: Extend::Black,
2804 background: Vec::new(),
2805 }
2806 }
2807}
2808
2809pub fn embed_with_opts(
2822 inp: &VipsImage,
2823 x: i32,
2824 y: i32,
2825 width: i32,
2826 height: i32,
2827 embed_options: &EmbedOptions,
2828) -> Result<VipsImage> {
2829 unsafe {
2830 let inp_in: *mut bindings::VipsImage = inp.ctx;
2831 let x_in: i32 = x;
2832 let y_in: i32 = y;
2833 let width_in: i32 = width;
2834 let height_in: i32 = height;
2835 let mut out_out: *mut bindings::VipsImage = null_mut();
2836
2837 let extend_in: i32 = embed_options.extend as i32;
2838 let extend_in_name = utils::new_c_string("extend")?;
2839
2840 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2841 let background_in = background_wrapper.ctx;
2842 let background_in_name = utils::new_c_string("background")?;
2843
2844 let vips_op_response = bindings::vips_embed(
2845 inp_in,
2846 &mut out_out,
2847 x_in,
2848 y_in,
2849 width_in,
2850 height_in,
2851 extend_in_name.as_ptr(),
2852 extend_in,
2853 background_in_name.as_ptr(),
2854 background_in,
2855 NULL,
2856 );
2857 utils::result(
2858 vips_op_response,
2859 VipsImage { ctx: out_out },
2860 Error::EmbedError,
2861 )
2862 }
2863}
2864
2865pub fn gravity(
2884 inp: &VipsImage,
2885 direction: CompassDirection,
2886 width: i32,
2887 height: i32,
2888) -> Result<VipsImage> {
2889 unsafe {
2890 let inp_in: *mut bindings::VipsImage = inp.ctx;
2891 let direction_in: i32 = direction as i32;
2892 let width_in: i32 = width;
2893 let height_in: i32 = height;
2894 let mut out_out: *mut bindings::VipsImage = null_mut();
2895
2896 let vips_op_response = bindings::vips_gravity(
2897 inp_in,
2898 &mut out_out,
2899 direction_in.try_into().unwrap(),
2900 width_in,
2901 height_in,
2902 NULL,
2903 );
2904 utils::result(
2905 vips_op_response,
2906 VipsImage { ctx: out_out },
2907 Error::GravityError,
2908 )
2909 }
2910}
2911
2912#[derive(Clone, Debug)]
2914pub struct GravityOptions {
2915 pub extend: Extend,
2924 pub background: Vec<f64>,
2926}
2927
2928impl std::default::Default for GravityOptions {
2929 fn default() -> Self {
2930 GravityOptions {
2931 extend: Extend::Black,
2932 background: Vec::new(),
2933 }
2934 }
2935}
2936
2937pub fn gravity_with_opts(
2957 inp: &VipsImage,
2958 direction: CompassDirection,
2959 width: i32,
2960 height: i32,
2961 gravity_options: &GravityOptions,
2962) -> Result<VipsImage> {
2963 unsafe {
2964 let inp_in: *mut bindings::VipsImage = inp.ctx;
2965 let direction_in: i32 = direction as i32;
2966 let width_in: i32 = width;
2967 let height_in: i32 = height;
2968 let mut out_out: *mut bindings::VipsImage = null_mut();
2969
2970 let extend_in: i32 = gravity_options.extend as i32;
2971 let extend_in_name = utils::new_c_string("extend")?;
2972
2973 let background_wrapper =
2974 utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
2975 let background_in = background_wrapper.ctx;
2976 let background_in_name = utils::new_c_string("background")?;
2977
2978 let vips_op_response = bindings::vips_gravity(
2979 inp_in,
2980 &mut out_out,
2981 direction_in.try_into().unwrap(),
2982 width_in,
2983 height_in,
2984 extend_in_name.as_ptr(),
2985 extend_in,
2986 background_in_name.as_ptr(),
2987 background_in,
2988 NULL,
2989 );
2990 utils::result(
2991 vips_op_response,
2992 VipsImage { ctx: out_out },
2993 Error::GravityError,
2994 )
2995 }
2996}
2997
2998pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3006 unsafe {
3007 let inp_in: *mut bindings::VipsImage = inp.ctx;
3008 let direction_in: i32 = direction as i32;
3009 let mut out_out: *mut bindings::VipsImage = null_mut();
3010
3011 let vips_op_response =
3012 bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3013 utils::result(
3014 vips_op_response,
3015 VipsImage { ctx: out_out },
3016 Error::FlipError,
3017 )
3018 }
3019}
3020
3021pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3030 unsafe {
3031 let main_in: *mut bindings::VipsImage = main.ctx;
3032 let sub_in: *mut bindings::VipsImage = sub.ctx;
3033 let x_in: i32 = x;
3034 let y_in: i32 = y;
3035 let mut out_out: *mut bindings::VipsImage = null_mut();
3036
3037 let vips_op_response =
3038 bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3039 utils::result(
3040 vips_op_response,
3041 VipsImage { ctx: out_out },
3042 Error::InsertError,
3043 )
3044 }
3045}
3046
3047#[derive(Clone, Debug)]
3049pub struct InsertOptions {
3050 pub expand: bool,
3053 pub background: Vec<f64>,
3055}
3056
3057impl std::default::Default for InsertOptions {
3058 fn default() -> Self {
3059 InsertOptions {
3060 expand: false,
3061 background: Vec::new(),
3062 }
3063 }
3064}
3065
3066pub fn insert_with_opts(
3076 main: &VipsImage,
3077 sub: &VipsImage,
3078 x: i32,
3079 y: i32,
3080 insert_options: &InsertOptions,
3081) -> Result<VipsImage> {
3082 unsafe {
3083 let main_in: *mut bindings::VipsImage = main.ctx;
3084 let sub_in: *mut bindings::VipsImage = sub.ctx;
3085 let x_in: i32 = x;
3086 let y_in: i32 = y;
3087 let mut out_out: *mut bindings::VipsImage = null_mut();
3088
3089 let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3090 let expand_in_name = utils::new_c_string("expand")?;
3091
3092 let background_wrapper =
3093 utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3094 let background_in = background_wrapper.ctx;
3095 let background_in_name = utils::new_c_string("background")?;
3096
3097 let vips_op_response = bindings::vips_insert(
3098 main_in,
3099 sub_in,
3100 &mut out_out,
3101 x_in,
3102 y_in,
3103 expand_in_name.as_ptr(),
3104 expand_in,
3105 background_in_name.as_ptr(),
3106 background_in,
3107 NULL,
3108 );
3109 utils::result(
3110 vips_op_response,
3111 VipsImage { ctx: out_out },
3112 Error::InsertError,
3113 )
3114 }
3115}
3116
3117pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3126 unsafe {
3127 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3128 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3129 let direction_in: i32 = direction as i32;
3130 let mut out_out: *mut bindings::VipsImage = null_mut();
3131
3132 let vips_op_response = bindings::vips_join(
3133 in_1_in,
3134 in_2_in,
3135 &mut out_out,
3136 direction_in.try_into().unwrap(),
3137 NULL,
3138 );
3139 utils::result(
3140 vips_op_response,
3141 VipsImage { ctx: out_out },
3142 Error::JoinError,
3143 )
3144 }
3145}
3146
3147#[derive(Clone, Debug)]
3149pub struct JoinOptions {
3150 pub expand: bool,
3153 pub shim: i32,
3156 pub background: Vec<f64>,
3158 pub align: Align,
3164}
3165
3166impl std::default::Default for JoinOptions {
3167 fn default() -> Self {
3168 JoinOptions {
3169 expand: false,
3170 shim: i32::from(0),
3171 background: Vec::new(),
3172 align: Align::Low,
3173 }
3174 }
3175}
3176
3177pub fn join_with_opts(
3187 in_1: &VipsImage,
3188 in_2: &VipsImage,
3189 direction: Direction,
3190 join_options: &JoinOptions,
3191) -> Result<VipsImage> {
3192 unsafe {
3193 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3194 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3195 let direction_in: i32 = direction as i32;
3196 let mut out_out: *mut bindings::VipsImage = null_mut();
3197
3198 let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3199 let expand_in_name = utils::new_c_string("expand")?;
3200
3201 let shim_in: i32 = join_options.shim;
3202 let shim_in_name = utils::new_c_string("shim")?;
3203
3204 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3205 let background_in = background_wrapper.ctx;
3206 let background_in_name = utils::new_c_string("background")?;
3207
3208 let align_in: i32 = join_options.align as i32;
3209 let align_in_name = utils::new_c_string("align")?;
3210
3211 let vips_op_response = bindings::vips_join(
3212 in_1_in,
3213 in_2_in,
3214 &mut out_out,
3215 direction_in.try_into().unwrap(),
3216 expand_in_name.as_ptr(),
3217 expand_in,
3218 shim_in_name.as_ptr(),
3219 shim_in,
3220 background_in_name.as_ptr(),
3221 background_in,
3222 align_in_name.as_ptr(),
3223 align_in,
3224 NULL,
3225 );
3226 utils::result(
3227 vips_op_response,
3228 VipsImage { ctx: out_out },
3229 Error::JoinError,
3230 )
3231 }
3232}
3233
3234pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3238 unsafe {
3239 let (inp_len, mut inp_in) = {
3240 let len = inp.len();
3241 let mut input = Vec::new();
3242 for img in inp {
3243 input.push(img.ctx)
3244 }
3245 (len as i32, input)
3246 };
3247 let mut out_out: *mut bindings::VipsImage = null_mut();
3248
3249 let vips_op_response =
3250 bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3251 utils::result(
3252 vips_op_response,
3253 VipsImage { ctx: out_out },
3254 Error::ArrayjoinError,
3255 )
3256 }
3257}
3258
3259#[derive(Clone, Debug)]
3261pub struct ArrayjoinOptions {
3262 pub across: i32,
3265 pub shim: i32,
3268 pub background: Vec<f64>,
3270 pub halign: Align,
3276 pub valign: Align,
3282 pub hspacing: i32,
3285 pub vspacing: i32,
3288}
3289
3290impl std::default::Default for ArrayjoinOptions {
3291 fn default() -> Self {
3292 ArrayjoinOptions {
3293 across: i32::from(1),
3294 shim: i32::from(0),
3295 background: Vec::new(),
3296 halign: Align::Low,
3297 valign: Align::Low,
3298 hspacing: i32::from(1),
3299 vspacing: i32::from(1),
3300 }
3301 }
3302}
3303
3304pub fn arrayjoin_with_opts(
3309 inp: &mut [VipsImage],
3310 arrayjoin_options: &ArrayjoinOptions,
3311) -> Result<VipsImage> {
3312 unsafe {
3313 let (inp_len, mut inp_in) = {
3314 let len = inp.len();
3315 let mut input = Vec::new();
3316 for img in inp {
3317 input.push(img.ctx)
3318 }
3319 (len as i32, input)
3320 };
3321 let mut out_out: *mut bindings::VipsImage = null_mut();
3322
3323 let across_in: i32 = arrayjoin_options.across;
3324 let across_in_name = utils::new_c_string("across")?;
3325
3326 let shim_in: i32 = arrayjoin_options.shim;
3327 let shim_in_name = utils::new_c_string("shim")?;
3328
3329 let background_wrapper =
3330 utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3331 let background_in = background_wrapper.ctx;
3332 let background_in_name = utils::new_c_string("background")?;
3333
3334 let halign_in: i32 = arrayjoin_options.halign as i32;
3335 let halign_in_name = utils::new_c_string("halign")?;
3336
3337 let valign_in: i32 = arrayjoin_options.valign as i32;
3338 let valign_in_name = utils::new_c_string("valign")?;
3339
3340 let hspacing_in: i32 = arrayjoin_options.hspacing;
3341 let hspacing_in_name = utils::new_c_string("hspacing")?;
3342
3343 let vspacing_in: i32 = arrayjoin_options.vspacing;
3344 let vspacing_in_name = utils::new_c_string("vspacing")?;
3345
3346 let vips_op_response = bindings::vips_arrayjoin(
3347 inp_in.as_mut_ptr(),
3348 &mut out_out,
3349 inp_len,
3350 across_in_name.as_ptr(),
3351 across_in,
3352 shim_in_name.as_ptr(),
3353 shim_in,
3354 background_in_name.as_ptr(),
3355 background_in,
3356 halign_in_name.as_ptr(),
3357 halign_in,
3358 valign_in_name.as_ptr(),
3359 valign_in,
3360 hspacing_in_name.as_ptr(),
3361 hspacing_in,
3362 vspacing_in_name.as_ptr(),
3363 vspacing_in,
3364 NULL,
3365 );
3366 utils::result(
3367 vips_op_response,
3368 VipsImage { ctx: out_out },
3369 Error::ArrayjoinError,
3370 )
3371 }
3372}
3373
3374pub fn extract_area(
3386 input: &VipsImage,
3387 left: i32,
3388 top: i32,
3389 width: i32,
3390 height: i32,
3391) -> Result<VipsImage> {
3392 unsafe {
3393 let input_in: *mut bindings::VipsImage = input.ctx;
3394 let left_in: i32 = left;
3395 let top_in: i32 = top;
3396 let width_in: i32 = width;
3397 let height_in: i32 = height;
3398 let mut out_out: *mut bindings::VipsImage = null_mut();
3399
3400 let vips_op_response = bindings::vips_extract_area(
3401 input_in,
3402 &mut out_out,
3403 left_in,
3404 top_in,
3405 width_in,
3406 height_in,
3407 NULL,
3408 );
3409 utils::result(
3410 vips_op_response,
3411 VipsImage { ctx: out_out },
3412 Error::ExtractAreaError,
3413 )
3414 }
3415}
3416
3417pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3425 unsafe {
3426 let input_in: *mut bindings::VipsImage = input.ctx;
3427 let width_in: i32 = width;
3428 let height_in: i32 = height;
3429 let mut out_out: *mut bindings::VipsImage = null_mut();
3430
3431 let vips_op_response =
3432 bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3433 utils::result(
3434 vips_op_response,
3435 VipsImage { ctx: out_out },
3436 Error::SmartcropError,
3437 )
3438 }
3439}
3440
3441#[derive(Clone, Debug)]
3443pub struct SmartcropOptions {
3444 pub attention_x: i32,
3447 pub attention_y: i32,
3450 pub interesting: Interesting,
3460 pub premultiplied: bool,
3463}
3464
3465impl std::default::Default for SmartcropOptions {
3466 fn default() -> Self {
3467 SmartcropOptions {
3468 attention_x: i32::from(0),
3469 attention_y: i32::from(0),
3470 interesting: Interesting::Attention,
3471 premultiplied: false,
3472 }
3473 }
3474}
3475
3476pub fn smartcrop_with_opts(
3485 input: &VipsImage,
3486 width: i32,
3487 height: i32,
3488 smartcrop_options: &SmartcropOptions,
3489) -> Result<VipsImage> {
3490 unsafe {
3491 let input_in: *mut bindings::VipsImage = input.ctx;
3492 let width_in: i32 = width;
3493 let height_in: i32 = height;
3494 let mut out_out: *mut bindings::VipsImage = null_mut();
3495
3496 let attention_x_in: i32 = smartcrop_options.attention_x;
3497 let attention_x_in_name = utils::new_c_string("attention-x")?;
3498
3499 let attention_y_in: i32 = smartcrop_options.attention_y;
3500 let attention_y_in_name = utils::new_c_string("attention-y")?;
3501
3502 let interesting_in: i32 = smartcrop_options.interesting as i32;
3503 let interesting_in_name = utils::new_c_string("interesting")?;
3504
3505 let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3506 1
3507 } else {
3508 0
3509 };
3510 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3511
3512 let vips_op_response = bindings::vips_smartcrop(
3513 input_in,
3514 &mut out_out,
3515 width_in,
3516 height_in,
3517 attention_x_in_name.as_ptr(),
3518 attention_x_in,
3519 attention_y_in_name.as_ptr(),
3520 attention_y_in,
3521 interesting_in_name.as_ptr(),
3522 interesting_in,
3523 premultiplied_in_name.as_ptr(),
3524 premultiplied_in,
3525 NULL,
3526 );
3527 utils::result(
3528 vips_op_response,
3529 VipsImage { ctx: out_out },
3530 Error::SmartcropError,
3531 )
3532 }
3533}
3534
3535pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3541 unsafe {
3542 let inp_in: *mut bindings::VipsImage = inp.ctx;
3543 let band_in: i32 = band;
3544 let mut out_out: *mut bindings::VipsImage = null_mut();
3545
3546 let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3547 utils::result(
3548 vips_op_response,
3549 VipsImage { ctx: out_out },
3550 Error::ExtractBandError,
3551 )
3552 }
3553}
3554
3555#[derive(Clone, Debug)]
3557pub struct ExtractBandOptions {
3558 pub n: i32,
3561}
3562
3563impl std::default::Default for ExtractBandOptions {
3564 fn default() -> Self {
3565 ExtractBandOptions { n: i32::from(1) }
3566 }
3567}
3568
3569pub fn extract_band_with_opts(
3576 inp: &VipsImage,
3577 band: i32,
3578 extract_band_options: &ExtractBandOptions,
3579) -> Result<VipsImage> {
3580 unsafe {
3581 let inp_in: *mut bindings::VipsImage = inp.ctx;
3582 let band_in: i32 = band;
3583 let mut out_out: *mut bindings::VipsImage = null_mut();
3584
3585 let n_in: i32 = extract_band_options.n;
3586 let n_in_name = utils::new_c_string("n")?;
3587
3588 let vips_op_response = bindings::vips_extract_band(
3589 inp_in,
3590 &mut out_out,
3591 band_in,
3592 n_in_name.as_ptr(),
3593 n_in,
3594 NULL,
3595 );
3596 utils::result(
3597 vips_op_response,
3598 VipsImage { ctx: out_out },
3599 Error::ExtractBandError,
3600 )
3601 }
3602}
3603
3604pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3608 unsafe {
3609 let (inp_len, mut inp_in) = {
3610 let len = inp.len();
3611 let mut input = Vec::new();
3612 for img in inp {
3613 input.push(img.ctx)
3614 }
3615 (len as i32, input)
3616 };
3617 let mut out_out: *mut bindings::VipsImage = null_mut();
3618
3619 let vips_op_response =
3620 bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3621 utils::result(
3622 vips_op_response,
3623 VipsImage { ctx: out_out },
3624 Error::BandjoinError,
3625 )
3626 }
3627}
3628
3629pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3634 unsafe {
3635 let inp_in: *mut bindings::VipsImage = inp.ctx;
3636 let c_in: *mut f64 = c.as_mut_ptr();
3637 let mut out_out: *mut bindings::VipsImage = null_mut();
3638
3639 let vips_op_response =
3640 bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3641 utils::result(
3642 vips_op_response,
3643 VipsImage { ctx: out_out },
3644 Error::BandjoinConstError,
3645 )
3646 }
3647}
3648
3649pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3653 unsafe {
3654 let (inp_len, mut inp_in) = {
3655 let len = inp.len();
3656 let mut input = Vec::new();
3657 for img in inp {
3658 input.push(img.ctx)
3659 }
3660 (len as i32, input)
3661 };
3662 let mut out_out: *mut bindings::VipsImage = null_mut();
3663
3664 let vips_op_response =
3665 bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3666 utils::result(
3667 vips_op_response,
3668 VipsImage { ctx: out_out },
3669 Error::BandrankError,
3670 )
3671 }
3672}
3673
3674#[derive(Clone, Debug)]
3676pub struct BandrankOptions {
3677 pub index: i32,
3680}
3681
3682impl std::default::Default for BandrankOptions {
3683 fn default() -> Self {
3684 BandrankOptions {
3685 index: i32::from(-1),
3686 }
3687 }
3688}
3689
3690pub fn bandrank_with_opts(
3695 inp: &mut [VipsImage],
3696 bandrank_options: &BandrankOptions,
3697) -> Result<VipsImage> {
3698 unsafe {
3699 let (inp_len, mut inp_in) = {
3700 let len = inp.len();
3701 let mut input = Vec::new();
3702 for img in inp {
3703 input.push(img.ctx)
3704 }
3705 (len as i32, input)
3706 };
3707 let mut out_out: *mut bindings::VipsImage = null_mut();
3708
3709 let index_in: i32 = bandrank_options.index;
3710 let index_in_name = utils::new_c_string("index")?;
3711
3712 let vips_op_response = bindings::vips_bandrank(
3713 inp_in.as_mut_ptr(),
3714 &mut out_out,
3715 inp_len,
3716 index_in_name.as_ptr(),
3717 index_in,
3718 NULL,
3719 );
3720 utils::result(
3721 vips_op_response,
3722 VipsImage { ctx: out_out },
3723 Error::BandrankError,
3724 )
3725 }
3726}
3727
3728pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3732 unsafe {
3733 let inp_in: *mut bindings::VipsImage = inp.ctx;
3734 let mut out_out: *mut bindings::VipsImage = null_mut();
3735
3736 let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3737 utils::result(
3738 vips_op_response,
3739 VipsImage { ctx: out_out },
3740 Error::BandmeanError,
3741 )
3742 }
3743}
3744
3745pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3756 unsafe {
3757 let inp_in: *mut bindings::VipsImage = inp.ctx;
3758 let boolean_in: i32 = boolean as i32;
3759 let mut out_out: *mut bindings::VipsImage = null_mut();
3760
3761 let vips_op_response =
3762 bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3763 utils::result(
3764 vips_op_response,
3765 VipsImage { ctx: out_out },
3766 Error::BandboolError,
3767 )
3768 }
3769}
3770
3771pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3779 unsafe {
3780 let inp_in: *mut bindings::VipsImage = inp.ctx;
3781 let across_in: i32 = across;
3782 let down_in: i32 = down;
3783 let mut out_out: *mut bindings::VipsImage = null_mut();
3784
3785 let vips_op_response =
3786 bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3787 utils::result(
3788 vips_op_response,
3789 VipsImage { ctx: out_out },
3790 Error::ReplicateError,
3791 )
3792 }
3793}
3794
3795pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3812 unsafe {
3813 let inp_in: *mut bindings::VipsImage = inp.ctx;
3814 let format_in: i32 = format as i32;
3815 let mut out_out: *mut bindings::VipsImage = null_mut();
3816
3817 let vips_op_response =
3818 bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3819 utils::result(
3820 vips_op_response,
3821 VipsImage { ctx: out_out },
3822 Error::CastError,
3823 )
3824 }
3825}
3826
3827#[derive(Clone, Debug)]
3829pub struct CastOptions {
3830 pub shift: bool,
3833}
3834
3835impl std::default::Default for CastOptions {
3836 fn default() -> Self {
3837 CastOptions { shift: false }
3838 }
3839}
3840
3841pub fn cast_with_opts(
3859 inp: &VipsImage,
3860 format: BandFormat,
3861 cast_options: &CastOptions,
3862) -> Result<VipsImage> {
3863 unsafe {
3864 let inp_in: *mut bindings::VipsImage = inp.ctx;
3865 let format_in: i32 = format as i32;
3866 let mut out_out: *mut bindings::VipsImage = null_mut();
3867
3868 let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3869 let shift_in_name = utils::new_c_string("shift")?;
3870
3871 let vips_op_response = bindings::vips_cast(
3872 inp_in,
3873 &mut out_out,
3874 format_in.try_into().unwrap(),
3875 shift_in_name.as_ptr(),
3876 shift_in,
3877 NULL,
3878 );
3879 utils::result(
3880 vips_op_response,
3881 VipsImage { ctx: out_out },
3882 Error::CastError,
3883 )
3884 }
3885}
3886
3887pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3897 unsafe {
3898 let inp_in: *mut bindings::VipsImage = inp.ctx;
3899 let angle_in: i32 = angle as i32;
3900 let mut out_out: *mut bindings::VipsImage = null_mut();
3901
3902 let vips_op_response =
3903 bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3904 utils::result(
3905 vips_op_response,
3906 VipsImage { ctx: out_out },
3907 Error::RotError,
3908 )
3909 }
3910}
3911
3912pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3916 unsafe {
3917 let inp_in: *mut bindings::VipsImage = inp.ctx;
3918 let mut out_out: *mut bindings::VipsImage = null_mut();
3919
3920 let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3921 utils::result(
3922 vips_op_response,
3923 VipsImage { ctx: out_out },
3924 Error::Rot45Error,
3925 )
3926 }
3927}
3928
3929#[derive(Clone, Debug)]
3931pub struct Rot45Options {
3932 pub angle: Angle45,
3943}
3944
3945impl std::default::Default for Rot45Options {
3946 fn default() -> Self {
3947 Rot45Options {
3948 angle: Angle45::D45,
3949 }
3950 }
3951}
3952
3953pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
3958 unsafe {
3959 let inp_in: *mut bindings::VipsImage = inp.ctx;
3960 let mut out_out: *mut bindings::VipsImage = null_mut();
3961
3962 let angle_in: i32 = rot_45_options.angle as i32;
3963 let angle_in_name = utils::new_c_string("angle")?;
3964
3965 let vips_op_response =
3966 bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
3967 utils::result(
3968 vips_op_response,
3969 VipsImage { ctx: out_out },
3970 Error::Rot45Error,
3971 )
3972 }
3973}
3974
3975pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
3979 unsafe {
3980 let inp_in: *mut bindings::VipsImage = inp.ctx;
3981 let mut out_out: *mut bindings::VipsImage = null_mut();
3982
3983 let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
3984 utils::result(
3985 vips_op_response,
3986 VipsImage { ctx: out_out },
3987 Error::AutorotError,
3988 )
3989 }
3990}
3991
3992#[derive(Clone, Debug)]
3994pub struct AutorotOptions {
3995 pub angle: Angle,
4002 pub flip: bool,
4005}
4006
4007impl std::default::Default for AutorotOptions {
4008 fn default() -> Self {
4009 AutorotOptions {
4010 angle: Angle::D0,
4011 flip: false,
4012 }
4013 }
4014}
4015
4016pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4021 unsafe {
4022 let inp_in: *mut bindings::VipsImage = inp.ctx;
4023 let mut out_out: *mut bindings::VipsImage = null_mut();
4024
4025 let angle_in: i32 = autorot_options.angle as i32;
4026 let angle_in_name = utils::new_c_string("angle")?;
4027
4028 let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4029 let flip_in_name = utils::new_c_string("flip")?;
4030
4031 let vips_op_response = bindings::vips_autorot(
4032 inp_in,
4033 &mut out_out,
4034 angle_in_name.as_ptr(),
4035 angle_in,
4036 flip_in_name.as_ptr(),
4037 flip_in,
4038 NULL,
4039 );
4040 utils::result(
4041 vips_op_response,
4042 VipsImage { ctx: out_out },
4043 Error::AutorotError,
4044 )
4045 }
4046}
4047
4048pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4054 unsafe {
4055 let cond_in: *mut bindings::VipsImage = cond.ctx;
4056 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4057 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4058 let mut out_out: *mut bindings::VipsImage = null_mut();
4059
4060 let vips_op_response =
4061 bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4062 utils::result(
4063 vips_op_response,
4064 VipsImage { ctx: out_out },
4065 Error::IfthenelseError,
4066 )
4067 }
4068}
4069
4070#[derive(Clone, Debug)]
4072pub struct IfthenelseOptions {
4073 pub blend: bool,
4076}
4077
4078impl std::default::Default for IfthenelseOptions {
4079 fn default() -> Self {
4080 IfthenelseOptions { blend: false }
4081 }
4082}
4083
4084pub fn ifthenelse_with_opts(
4091 cond: &VipsImage,
4092 in_1: &VipsImage,
4093 in_2: &VipsImage,
4094 ifthenelse_options: &IfthenelseOptions,
4095) -> Result<VipsImage> {
4096 unsafe {
4097 let cond_in: *mut bindings::VipsImage = cond.ctx;
4098 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4099 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4100 let mut out_out: *mut bindings::VipsImage = null_mut();
4101
4102 let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4103 let blend_in_name = utils::new_c_string("blend")?;
4104
4105 let vips_op_response = bindings::vips_ifthenelse(
4106 cond_in,
4107 in_1_in,
4108 in_2_in,
4109 &mut out_out,
4110 blend_in_name.as_ptr(),
4111 blend_in,
4112 NULL,
4113 );
4114 utils::result(
4115 vips_op_response,
4116 VipsImage { ctx: out_out },
4117 Error::IfthenelseError,
4118 )
4119 }
4120}
4121
4122pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4127 unsafe {
4128 let inp_in: *mut bindings::VipsImage = inp.ctx;
4129 let m_in: *mut bindings::VipsImage = m.ctx;
4130 let mut out_out: *mut bindings::VipsImage = null_mut();
4131
4132 let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4133 utils::result(
4134 vips_op_response,
4135 VipsImage { ctx: out_out },
4136 Error::RecombError,
4137 )
4138 }
4139}
4140
4141pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4145 unsafe {
4146 let inp_in: *mut bindings::VipsImage = inp.ctx;
4147 let mut out_out: *mut bindings::VipsImage = null_mut();
4148
4149 let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4150 utils::result(
4151 vips_op_response,
4152 VipsImage { ctx: out_out },
4153 Error::BandfoldError,
4154 )
4155 }
4156}
4157
4158#[derive(Clone, Debug)]
4160pub struct BandfoldOptions {
4161 pub factor: i32,
4164}
4165
4166impl std::default::Default for BandfoldOptions {
4167 fn default() -> Self {
4168 BandfoldOptions {
4169 factor: i32::from(0),
4170 }
4171 }
4172}
4173
4174pub fn bandfold_with_opts(
4179 inp: &VipsImage,
4180 bandfold_options: &BandfoldOptions,
4181) -> Result<VipsImage> {
4182 unsafe {
4183 let inp_in: *mut bindings::VipsImage = inp.ctx;
4184 let mut out_out: *mut bindings::VipsImage = null_mut();
4185
4186 let factor_in: i32 = bandfold_options.factor;
4187 let factor_in_name = utils::new_c_string("factor")?;
4188
4189 let vips_op_response = bindings::vips_bandfold(
4190 inp_in,
4191 &mut out_out,
4192 factor_in_name.as_ptr(),
4193 factor_in,
4194 NULL,
4195 );
4196 utils::result(
4197 vips_op_response,
4198 VipsImage { ctx: out_out },
4199 Error::BandfoldError,
4200 )
4201 }
4202}
4203
4204pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4208 unsafe {
4209 let inp_in: *mut bindings::VipsImage = inp.ctx;
4210 let mut out_out: *mut bindings::VipsImage = null_mut();
4211
4212 let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4213 utils::result(
4214 vips_op_response,
4215 VipsImage { ctx: out_out },
4216 Error::BandunfoldError,
4217 )
4218 }
4219}
4220
4221#[derive(Clone, Debug)]
4223pub struct BandunfoldOptions {
4224 pub factor: i32,
4227}
4228
4229impl std::default::Default for BandunfoldOptions {
4230 fn default() -> Self {
4231 BandunfoldOptions {
4232 factor: i32::from(0),
4233 }
4234 }
4235}
4236
4237pub fn bandunfold_with_opts(
4242 inp: &VipsImage,
4243 bandunfold_options: &BandunfoldOptions,
4244) -> Result<VipsImage> {
4245 unsafe {
4246 let inp_in: *mut bindings::VipsImage = inp.ctx;
4247 let mut out_out: *mut bindings::VipsImage = null_mut();
4248
4249 let factor_in: i32 = bandunfold_options.factor;
4250 let factor_in_name = utils::new_c_string("factor")?;
4251
4252 let vips_op_response = bindings::vips_bandunfold(
4253 inp_in,
4254 &mut out_out,
4255 factor_in_name.as_ptr(),
4256 factor_in,
4257 NULL,
4258 );
4259 utils::result(
4260 vips_op_response,
4261 VipsImage { ctx: out_out },
4262 Error::BandunfoldError,
4263 )
4264 }
4265}
4266
4267pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4271 unsafe {
4272 let inp_in: *mut bindings::VipsImage = inp.ctx;
4273 let mut out_out: *mut bindings::VipsImage = null_mut();
4274
4275 let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4276 utils::result(
4277 vips_op_response,
4278 VipsImage { ctx: out_out },
4279 Error::FlattenError,
4280 )
4281 }
4282}
4283
4284#[derive(Clone, Debug)]
4286pub struct FlattenOptions {
4287 pub background: Vec<f64>,
4289 pub max_alpha: f64,
4292}
4293
4294impl std::default::Default for FlattenOptions {
4295 fn default() -> Self {
4296 FlattenOptions {
4297 background: Vec::new(),
4298 max_alpha: f64::from(255),
4299 }
4300 }
4301}
4302
4303pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4308 unsafe {
4309 let inp_in: *mut bindings::VipsImage = inp.ctx;
4310 let mut out_out: *mut bindings::VipsImage = null_mut();
4311
4312 let background_wrapper =
4313 utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4314 let background_in = background_wrapper.ctx;
4315 let background_in_name = utils::new_c_string("background")?;
4316
4317 let max_alpha_in: f64 = flatten_options.max_alpha;
4318 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4319
4320 let vips_op_response = bindings::vips_flatten(
4321 inp_in,
4322 &mut out_out,
4323 background_in_name.as_ptr(),
4324 background_in,
4325 max_alpha_in_name.as_ptr(),
4326 max_alpha_in,
4327 NULL,
4328 );
4329 utils::result(
4330 vips_op_response,
4331 VipsImage { ctx: out_out },
4332 Error::FlattenError,
4333 )
4334 }
4335}
4336
4337pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4341 unsafe {
4342 let inp_in: *mut bindings::VipsImage = inp.ctx;
4343 let mut out_out: *mut bindings::VipsImage = null_mut();
4344
4345 let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4346 utils::result(
4347 vips_op_response,
4348 VipsImage { ctx: out_out },
4349 Error::PremultiplyError,
4350 )
4351 }
4352}
4353
4354#[derive(Clone, Debug)]
4356pub struct PremultiplyOptions {
4357 pub max_alpha: f64,
4360}
4361
4362impl std::default::Default for PremultiplyOptions {
4363 fn default() -> Self {
4364 PremultiplyOptions {
4365 max_alpha: f64::from(255),
4366 }
4367 }
4368}
4369
4370pub fn premultiply_with_opts(
4375 inp: &VipsImage,
4376 premultiply_options: &PremultiplyOptions,
4377) -> Result<VipsImage> {
4378 unsafe {
4379 let inp_in: *mut bindings::VipsImage = inp.ctx;
4380 let mut out_out: *mut bindings::VipsImage = null_mut();
4381
4382 let max_alpha_in: f64 = premultiply_options.max_alpha;
4383 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4384
4385 let vips_op_response = bindings::vips_premultiply(
4386 inp_in,
4387 &mut out_out,
4388 max_alpha_in_name.as_ptr(),
4389 max_alpha_in,
4390 NULL,
4391 );
4392 utils::result(
4393 vips_op_response,
4394 VipsImage { ctx: out_out },
4395 Error::PremultiplyError,
4396 )
4397 }
4398}
4399
4400pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4404 unsafe {
4405 let inp_in: *mut bindings::VipsImage = inp.ctx;
4406 let mut out_out: *mut bindings::VipsImage = null_mut();
4407
4408 let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4409 utils::result(
4410 vips_op_response,
4411 VipsImage { ctx: out_out },
4412 Error::UnpremultiplyError,
4413 )
4414 }
4415}
4416
4417#[derive(Clone, Debug)]
4419pub struct UnpremultiplyOptions {
4420 pub max_alpha: f64,
4423 pub alpha_band: i32,
4426}
4427
4428impl std::default::Default for UnpremultiplyOptions {
4429 fn default() -> Self {
4430 UnpremultiplyOptions {
4431 max_alpha: f64::from(255),
4432 alpha_band: i32::from(3),
4433 }
4434 }
4435}
4436
4437pub fn unpremultiply_with_opts(
4442 inp: &VipsImage,
4443 unpremultiply_options: &UnpremultiplyOptions,
4444) -> Result<VipsImage> {
4445 unsafe {
4446 let inp_in: *mut bindings::VipsImage = inp.ctx;
4447 let mut out_out: *mut bindings::VipsImage = null_mut();
4448
4449 let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4450 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4451
4452 let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4453 let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4454
4455 let vips_op_response = bindings::vips_unpremultiply(
4456 inp_in,
4457 &mut out_out,
4458 max_alpha_in_name.as_ptr(),
4459 max_alpha_in,
4460 alpha_band_in_name.as_ptr(),
4461 alpha_band_in,
4462 NULL,
4463 );
4464 utils::result(
4465 vips_op_response,
4466 VipsImage { ctx: out_out },
4467 Error::UnpremultiplyError,
4468 )
4469 }
4470}
4471
4472pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4482 unsafe {
4483 let inp_in: *mut bindings::VipsImage = inp.ctx;
4484 let tile_height_in: i32 = tile_height;
4485 let across_in: i32 = across;
4486 let down_in: i32 = down;
4487 let mut out_out: *mut bindings::VipsImage = null_mut();
4488
4489 let vips_op_response = bindings::vips_grid(
4490 inp_in,
4491 &mut out_out,
4492 tile_height_in,
4493 across_in,
4494 down_in,
4495 NULL,
4496 );
4497 utils::result(
4498 vips_op_response,
4499 VipsImage { ctx: out_out },
4500 Error::GridError,
4501 )
4502 }
4503}
4504
4505pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4509 unsafe {
4510 let inp_in: *mut bindings::VipsImage = inp.ctx;
4511 let mut out_out: *mut bindings::VipsImage = null_mut();
4512
4513 let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4514 utils::result(
4515 vips_op_response,
4516 VipsImage { ctx: out_out },
4517 Error::Transpose3DError,
4518 )
4519 }
4520}
4521
4522#[derive(Clone, Debug)]
4524pub struct Transpose3DOptions {
4525 pub page_height: i32,
4528}
4529
4530impl std::default::Default for Transpose3DOptions {
4531 fn default() -> Self {
4532 Transpose3DOptions {
4533 page_height: i32::from(0),
4534 }
4535 }
4536}
4537
4538pub fn transpose_3d_with_opts(
4543 inp: &VipsImage,
4544 transpose_3d_options: &Transpose3DOptions,
4545) -> Result<VipsImage> {
4546 unsafe {
4547 let inp_in: *mut bindings::VipsImage = inp.ctx;
4548 let mut out_out: *mut bindings::VipsImage = null_mut();
4549
4550 let page_height_in: i32 = transpose_3d_options.page_height;
4551 let page_height_in_name = utils::new_c_string("page-height")?;
4552
4553 let vips_op_response = bindings::vips_transpose3d(
4554 inp_in,
4555 &mut out_out,
4556 page_height_in_name.as_ptr(),
4557 page_height_in,
4558 NULL,
4559 );
4560 utils::result(
4561 vips_op_response,
4562 VipsImage { ctx: out_out },
4563 Error::Transpose3DError,
4564 )
4565 }
4566}
4567
4568pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4572 unsafe {
4573 let inp_in: *mut bindings::VipsImage = inp.ctx;
4574 let mut out_out: *mut bindings::VipsImage = null_mut();
4575
4576 let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4577 utils::result(
4578 vips_op_response,
4579 VipsImage { ctx: out_out },
4580 Error::ScaleError,
4581 )
4582 }
4583}
4584
4585#[derive(Clone, Debug)]
4587pub struct ScaleOptions {
4588 pub exp: f64,
4591 pub log: bool,
4594}
4595
4596impl std::default::Default for ScaleOptions {
4597 fn default() -> Self {
4598 ScaleOptions {
4599 exp: f64::from(0.25),
4600 log: false,
4601 }
4602 }
4603}
4604
4605pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4610 unsafe {
4611 let inp_in: *mut bindings::VipsImage = inp.ctx;
4612 let mut out_out: *mut bindings::VipsImage = null_mut();
4613
4614 let exp_in: f64 = scale_options.exp;
4615 let exp_in_name = utils::new_c_string("exp")?;
4616
4617 let log_in: i32 = if scale_options.log { 1 } else { 0 };
4618 let log_in_name = utils::new_c_string("log")?;
4619
4620 let vips_op_response = bindings::vips_scale(
4621 inp_in,
4622 &mut out_out,
4623 exp_in_name.as_ptr(),
4624 exp_in,
4625 log_in_name.as_ptr(),
4626 log_in,
4627 NULL,
4628 );
4629 utils::result(
4630 vips_op_response,
4631 VipsImage { ctx: out_out },
4632 Error::ScaleError,
4633 )
4634 }
4635}
4636
4637pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4641 unsafe {
4642 let inp_in: *mut bindings::VipsImage = inp.ctx;
4643 let mut out_out: *mut bindings::VipsImage = null_mut();
4644
4645 let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4646 utils::result(
4647 vips_op_response,
4648 VipsImage { ctx: out_out },
4649 Error::WrapError,
4650 )
4651 }
4652}
4653
4654#[derive(Clone, Debug)]
4656pub struct WrapOptions {
4657 pub x: i32,
4660 pub y: i32,
4663}
4664
4665impl std::default::Default for WrapOptions {
4666 fn default() -> Self {
4667 WrapOptions {
4668 x: i32::from(0),
4669 y: i32::from(0),
4670 }
4671 }
4672}
4673
4674pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4679 unsafe {
4680 let inp_in: *mut bindings::VipsImage = inp.ctx;
4681 let mut out_out: *mut bindings::VipsImage = null_mut();
4682
4683 let x_in: i32 = wrap_options.x;
4684 let x_in_name = utils::new_c_string("x")?;
4685
4686 let y_in: i32 = wrap_options.y;
4687 let y_in_name = utils::new_c_string("y")?;
4688
4689 let vips_op_response = bindings::vips_wrap(
4690 inp_in,
4691 &mut out_out,
4692 x_in_name.as_ptr(),
4693 x_in,
4694 y_in_name.as_ptr(),
4695 y_in,
4696 NULL,
4697 );
4698 utils::result(
4699 vips_op_response,
4700 VipsImage { ctx: out_out },
4701 Error::WrapError,
4702 )
4703 }
4704}
4705
4706pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4714 unsafe {
4715 let input_in: *mut bindings::VipsImage = input.ctx;
4716 let xfac_in: i32 = xfac;
4717 let yfac_in: i32 = yfac;
4718 let mut out_out: *mut bindings::VipsImage = null_mut();
4719
4720 let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4721 utils::result(
4722 vips_op_response,
4723 VipsImage { ctx: out_out },
4724 Error::ZoomError,
4725 )
4726 }
4727}
4728
4729pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4737 unsafe {
4738 let input_in: *mut bindings::VipsImage = input.ctx;
4739 let xfac_in: i32 = xfac;
4740 let yfac_in: i32 = yfac;
4741 let mut out_out: *mut bindings::VipsImage = null_mut();
4742
4743 let vips_op_response =
4744 bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4745 utils::result(
4746 vips_op_response,
4747 VipsImage { ctx: out_out },
4748 Error::SubsampleError,
4749 )
4750 }
4751}
4752
4753#[derive(Clone, Debug)]
4755pub struct SubsampleOptions {
4756 pub point: bool,
4759}
4760
4761impl std::default::Default for SubsampleOptions {
4762 fn default() -> Self {
4763 SubsampleOptions { point: false }
4764 }
4765}
4766
4767pub fn subsample_with_opts(
4776 input: &VipsImage,
4777 xfac: i32,
4778 yfac: i32,
4779 subsample_options: &SubsampleOptions,
4780) -> Result<VipsImage> {
4781 unsafe {
4782 let input_in: *mut bindings::VipsImage = input.ctx;
4783 let xfac_in: i32 = xfac;
4784 let yfac_in: i32 = yfac;
4785 let mut out_out: *mut bindings::VipsImage = null_mut();
4786
4787 let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4788 let point_in_name = utils::new_c_string("point")?;
4789
4790 let vips_op_response = bindings::vips_subsample(
4791 input_in,
4792 &mut out_out,
4793 xfac_in,
4794 yfac_in,
4795 point_in_name.as_ptr(),
4796 point_in,
4797 NULL,
4798 );
4799 utils::result(
4800 vips_op_response,
4801 VipsImage { ctx: out_out },
4802 Error::SubsampleError,
4803 )
4804 }
4805}
4806
4807pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4811 unsafe {
4812 let inp_in: *mut bindings::VipsImage = inp.ctx;
4813 let mut out_out: *mut bindings::VipsImage = null_mut();
4814
4815 let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4816 utils::result(
4817 vips_op_response,
4818 VipsImage { ctx: out_out },
4819 Error::MsbError,
4820 )
4821 }
4822}
4823
4824#[derive(Clone, Debug)]
4826pub struct MsbOptions {
4827 pub band: i32,
4830}
4831
4832impl std::default::Default for MsbOptions {
4833 fn default() -> Self {
4834 MsbOptions { band: i32::from(0) }
4835 }
4836}
4837
4838pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4843 unsafe {
4844 let inp_in: *mut bindings::VipsImage = inp.ctx;
4845 let mut out_out: *mut bindings::VipsImage = null_mut();
4846
4847 let band_in: i32 = msb_options.band;
4848 let band_in_name = utils::new_c_string("band")?;
4849
4850 let vips_op_response =
4851 bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4852 utils::result(
4853 vips_op_response,
4854 VipsImage { ctx: out_out },
4855 Error::MsbError,
4856 )
4857 }
4858}
4859
4860pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4864 unsafe {
4865 let inp_in: *mut bindings::VipsImage = inp.ctx;
4866 let mut out_out: *mut bindings::VipsImage = null_mut();
4867
4868 let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4869 utils::result(
4870 vips_op_response,
4871 VipsImage { ctx: out_out },
4872 Error::ByteswapError,
4873 )
4874 }
4875}
4876
4877pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4881 unsafe {
4882 let inp_in: *mut bindings::VipsImage = inp.ctx;
4883 let mut out_out: *mut bindings::VipsImage = null_mut();
4884
4885 let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4886 utils::result(
4887 vips_op_response,
4888 VipsImage { ctx: out_out },
4889 Error::FalsecolourError,
4890 )
4891 }
4892}
4893
4894pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4898 unsafe {
4899 let inp_in: *mut bindings::VipsImage = inp.ctx;
4900 let mut out_out: *mut bindings::VipsImage = null_mut();
4901
4902 let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4903 utils::result(
4904 vips_op_response,
4905 VipsImage { ctx: out_out },
4906 Error::GammaError,
4907 )
4908 }
4909}
4910
4911#[derive(Clone, Debug)]
4913pub struct GammaOptions {
4914 pub exponent: f64,
4917}
4918
4919impl std::default::Default for GammaOptions {
4920 fn default() -> Self {
4921 GammaOptions {
4922 exponent: f64::from(2.4),
4923 }
4924 }
4925}
4926
4927pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4932 unsafe {
4933 let inp_in: *mut bindings::VipsImage = inp.ctx;
4934 let mut out_out: *mut bindings::VipsImage = null_mut();
4935
4936 let exponent_in: f64 = gamma_options.exponent;
4937 let exponent_in_name = utils::new_c_string("exponent")?;
4938
4939 let vips_op_response = bindings::vips_gamma(
4940 inp_in,
4941 &mut out_out,
4942 exponent_in_name.as_ptr(),
4943 exponent_in,
4944 NULL,
4945 );
4946 utils::result(
4947 vips_op_response,
4948 VipsImage { ctx: out_out },
4949 Error::GammaError,
4950 )
4951 }
4952}
4953
4954pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
4959 unsafe {
4960 let (inp_len, mut inp_in) = {
4961 let len = inp.len();
4962 let mut input = Vec::new();
4963 for img in inp {
4964 input.push(img.ctx)
4965 }
4966 (len as i32, input)
4967 };
4968 let mode_in: *mut i32 = mode.as_mut_ptr();
4969 let mut out_out: *mut bindings::VipsImage = null_mut();
4970
4971 let vips_op_response = bindings::vips_composite(
4972 inp_in.as_mut_ptr(),
4973 &mut out_out,
4974 inp_len,
4975 mode_in,
4976 mode.len() as i32,
4977 NULL,
4978 );
4979 utils::result(
4980 vips_op_response,
4981 VipsImage { ctx: out_out },
4982 Error::CompositeError,
4983 )
4984 }
4985}
4986
4987#[derive(Clone, Debug)]
4989pub struct CompositeOptions {
4990 pub x: Vec<i32>,
4992 pub y: Vec<i32>,
4994 pub compositing_space: Interpretation,
5017 pub premultiplied: bool,
5020}
5021
5022impl std::default::Default for CompositeOptions {
5023 fn default() -> Self {
5024 CompositeOptions {
5025 x: Vec::new(),
5026 y: Vec::new(),
5027 compositing_space: Interpretation::Srgb,
5028 premultiplied: false,
5029 }
5030 }
5031}
5032
5033pub fn composite_with_opts(
5039 inp: &mut [VipsImage],
5040 mode: &mut [i32],
5041 composite_options: &CompositeOptions,
5042) -> Result<VipsImage> {
5043 unsafe {
5044 let (inp_len, mut inp_in) = {
5045 let len = inp.len();
5046 let mut input = Vec::new();
5047 for img in inp {
5048 input.push(img.ctx)
5049 }
5050 (len as i32, input)
5051 };
5052 let mode_in: *mut i32 = mode.as_mut_ptr();
5053 let mut out_out: *mut bindings::VipsImage = null_mut();
5054
5055 let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5056 let x_in = x_wrapper.ctx;
5057 let x_in_name = utils::new_c_string("x")?;
5058
5059 let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5060 let y_in = y_wrapper.ctx;
5061 let y_in_name = utils::new_c_string("y")?;
5062
5063 let compositing_space_in: i32 = composite_options.compositing_space as i32;
5064 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5065
5066 let premultiplied_in: i32 = if composite_options.premultiplied {
5067 1
5068 } else {
5069 0
5070 };
5071 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5072
5073 let vips_op_response = bindings::vips_composite(
5074 inp_in.as_mut_ptr(),
5075 &mut out_out,
5076 inp_len,
5077 mode_in,
5078 mode.len() as i32,
5079 x_in_name.as_ptr(),
5080 x_in,
5081 y_in_name.as_ptr(),
5082 y_in,
5083 compositing_space_in_name.as_ptr(),
5084 compositing_space_in,
5085 premultiplied_in_name.as_ptr(),
5086 premultiplied_in,
5087 NULL,
5088 );
5089 utils::result(
5090 vips_op_response,
5091 VipsImage { ctx: out_out },
5092 Error::CompositeError,
5093 )
5094 }
5095}
5096
5097pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5129 unsafe {
5130 let base_in: *mut bindings::VipsImage = base.ctx;
5131 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5132 let mode_in: i32 = mode as i32;
5133 let mut out_out: *mut bindings::VipsImage = null_mut();
5134
5135 let vips_op_response = bindings::vips_composite2(
5136 base_in,
5137 overlay_in,
5138 &mut out_out,
5139 mode_in.try_into().unwrap(),
5140 NULL,
5141 );
5142 utils::result(
5143 vips_op_response,
5144 VipsImage { ctx: out_out },
5145 Error::Composite2Error,
5146 )
5147 }
5148}
5149
5150#[derive(Clone, Debug)]
5152pub struct Composite2Options {
5153 pub x: i32,
5156 pub y: i32,
5159 pub compositing_space: Interpretation,
5182 pub premultiplied: bool,
5185}
5186
5187impl std::default::Default for Composite2Options {
5188 fn default() -> Self {
5189 Composite2Options {
5190 x: i32::from(0),
5191 y: i32::from(0),
5192 compositing_space: Interpretation::Srgb,
5193 premultiplied: false,
5194 }
5195 }
5196}
5197
5198pub fn composite_2_with_opts(
5231 base: &VipsImage,
5232 overlay: &VipsImage,
5233 mode: BlendMode,
5234 composite_2_options: &Composite2Options,
5235) -> Result<VipsImage> {
5236 unsafe {
5237 let base_in: *mut bindings::VipsImage = base.ctx;
5238 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5239 let mode_in: i32 = mode as i32;
5240 let mut out_out: *mut bindings::VipsImage = null_mut();
5241
5242 let x_in: i32 = composite_2_options.x;
5243 let x_in_name = utils::new_c_string("x")?;
5244
5245 let y_in: i32 = composite_2_options.y;
5246 let y_in_name = utils::new_c_string("y")?;
5247
5248 let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5249 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5250
5251 let premultiplied_in: i32 = if composite_2_options.premultiplied {
5252 1
5253 } else {
5254 0
5255 };
5256 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5257
5258 let vips_op_response = bindings::vips_composite2(
5259 base_in,
5260 overlay_in,
5261 &mut out_out,
5262 mode_in.try_into().unwrap(),
5263 x_in_name.as_ptr(),
5264 x_in,
5265 y_in_name.as_ptr(),
5266 y_in,
5267 compositing_space_in_name.as_ptr(),
5268 compositing_space_in,
5269 premultiplied_in_name.as_ptr(),
5270 premultiplied_in,
5271 NULL,
5272 );
5273 utils::result(
5274 vips_op_response,
5275 VipsImage { ctx: out_out },
5276 Error::Composite2Error,
5277 )
5278 }
5279}
5280
5281pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5288 unsafe {
5289 let width_in: i32 = width;
5290 let height_in: i32 = height;
5291 let mut out_out: *mut bindings::VipsImage = null_mut();
5292
5293 let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5294 utils::result(
5295 vips_op_response,
5296 VipsImage { ctx: out_out },
5297 Error::BlackError,
5298 )
5299 }
5300}
5301
5302#[derive(Clone, Debug)]
5304pub struct BlackOptions {
5305 pub bands: i32,
5308}
5309
5310impl std::default::Default for BlackOptions {
5311 fn default() -> Self {
5312 BlackOptions {
5313 bands: i32::from(1),
5314 }
5315 }
5316}
5317
5318pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5326 unsafe {
5327 let width_in: i32 = width;
5328 let height_in: i32 = height;
5329 let mut out_out: *mut bindings::VipsImage = null_mut();
5330
5331 let bands_in: i32 = black_options.bands;
5332 let bands_in_name = utils::new_c_string("bands")?;
5333
5334 let vips_op_response = bindings::vips_black(
5335 &mut out_out,
5336 width_in,
5337 height_in,
5338 bands_in_name.as_ptr(),
5339 bands_in,
5340 NULL,
5341 );
5342 utils::result(
5343 vips_op_response,
5344 VipsImage { ctx: out_out },
5345 Error::BlackError,
5346 )
5347 }
5348}
5349
5350pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5357 unsafe {
5358 let width_in: i32 = width;
5359 let height_in: i32 = height;
5360 let mut out_out: *mut bindings::VipsImage = null_mut();
5361
5362 let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5363 utils::result(
5364 vips_op_response,
5365 VipsImage { ctx: out_out },
5366 Error::GaussnoiseError,
5367 )
5368 }
5369}
5370
5371#[derive(Clone, Debug)]
5373pub struct GaussnoiseOptions {
5374 pub sigma: f64,
5377 pub mean: f64,
5380 pub seed: i32,
5383}
5384
5385impl std::default::Default for GaussnoiseOptions {
5386 fn default() -> Self {
5387 GaussnoiseOptions {
5388 sigma: f64::from(30),
5389 mean: f64::from(128),
5390 seed: i32::from(0),
5391 }
5392 }
5393}
5394
5395pub fn gaussnoise_with_opts(
5403 width: i32,
5404 height: i32,
5405 gaussnoise_options: &GaussnoiseOptions,
5406) -> Result<VipsImage> {
5407 unsafe {
5408 let width_in: i32 = width;
5409 let height_in: i32 = height;
5410 let mut out_out: *mut bindings::VipsImage = null_mut();
5411
5412 let sigma_in: f64 = gaussnoise_options.sigma;
5413 let sigma_in_name = utils::new_c_string("sigma")?;
5414
5415 let mean_in: f64 = gaussnoise_options.mean;
5416 let mean_in_name = utils::new_c_string("mean")?;
5417
5418 let seed_in: i32 = gaussnoise_options.seed;
5419 let seed_in_name = utils::new_c_string("seed")?;
5420
5421 let vips_op_response = bindings::vips_gaussnoise(
5422 &mut out_out,
5423 width_in,
5424 height_in,
5425 sigma_in_name.as_ptr(),
5426 sigma_in,
5427 mean_in_name.as_ptr(),
5428 mean_in,
5429 seed_in_name.as_ptr(),
5430 seed_in,
5431 NULL,
5432 );
5433 utils::result(
5434 vips_op_response,
5435 VipsImage { ctx: out_out },
5436 Error::GaussnoiseError,
5437 )
5438 }
5439}
5440
5441pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5448 unsafe {
5449 let width_in: i32 = width;
5450 let height_in: i32 = height;
5451 let mut out_out: *mut bindings::VipsImage = null_mut();
5452
5453 let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5454 utils::result(
5455 vips_op_response,
5456 VipsImage { ctx: out_out },
5457 Error::XyzError,
5458 )
5459 }
5460}
5461
5462#[derive(Clone, Debug)]
5464pub struct XyzOptions {
5465 pub csize: i32,
5468 pub dsize: i32,
5471 pub esize: i32,
5474}
5475
5476impl std::default::Default for XyzOptions {
5477 fn default() -> Self {
5478 XyzOptions {
5479 csize: i32::from(1),
5480 dsize: i32::from(1),
5481 esize: i32::from(1),
5482 }
5483 }
5484}
5485
5486pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5494 unsafe {
5495 let width_in: i32 = width;
5496 let height_in: i32 = height;
5497 let mut out_out: *mut bindings::VipsImage = null_mut();
5498
5499 let csize_in: i32 = xyz_options.csize;
5500 let csize_in_name = utils::new_c_string("csize")?;
5501
5502 let dsize_in: i32 = xyz_options.dsize;
5503 let dsize_in_name = utils::new_c_string("dsize")?;
5504
5505 let esize_in: i32 = xyz_options.esize;
5506 let esize_in_name = utils::new_c_string("esize")?;
5507
5508 let vips_op_response = bindings::vips_xyz(
5509 &mut out_out,
5510 width_in,
5511 height_in,
5512 csize_in_name.as_ptr(),
5513 csize_in,
5514 dsize_in_name.as_ptr(),
5515 dsize_in,
5516 esize_in_name.as_ptr(),
5517 esize_in,
5518 NULL,
5519 );
5520 utils::result(
5521 vips_op_response,
5522 VipsImage { ctx: out_out },
5523 Error::XyzError,
5524 )
5525 }
5526}
5527
5528pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5535 unsafe {
5536 let sigma_in: f64 = sigma;
5537 let min_ampl_in: f64 = min_ampl;
5538 let mut out_out: *mut bindings::VipsImage = null_mut();
5539
5540 let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5541 utils::result(
5542 vips_op_response,
5543 VipsImage { ctx: out_out },
5544 Error::GaussmatError,
5545 )
5546 }
5547}
5548
5549#[derive(Clone, Debug)]
5551pub struct GaussmatOptions {
5552 pub separable: bool,
5555 pub precision: Precision,
5561}
5562
5563impl std::default::Default for GaussmatOptions {
5564 fn default() -> Self {
5565 GaussmatOptions {
5566 separable: false,
5567 precision: Precision::Integer,
5568 }
5569 }
5570}
5571
5572pub fn gaussmat_with_opts(
5580 sigma: f64,
5581 min_ampl: f64,
5582 gaussmat_options: &GaussmatOptions,
5583) -> Result<VipsImage> {
5584 unsafe {
5585 let sigma_in: f64 = sigma;
5586 let min_ampl_in: f64 = min_ampl;
5587 let mut out_out: *mut bindings::VipsImage = null_mut();
5588
5589 let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5590 let separable_in_name = utils::new_c_string("separable")?;
5591
5592 let precision_in: i32 = gaussmat_options.precision as i32;
5593 let precision_in_name = utils::new_c_string("precision")?;
5594
5595 let vips_op_response = bindings::vips_gaussmat(
5596 &mut out_out,
5597 sigma_in,
5598 min_ampl_in,
5599 separable_in_name.as_ptr(),
5600 separable_in,
5601 precision_in_name.as_ptr(),
5602 precision_in,
5603 NULL,
5604 );
5605 utils::result(
5606 vips_op_response,
5607 VipsImage { ctx: out_out },
5608 Error::GaussmatError,
5609 )
5610 }
5611}
5612
5613pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5620 unsafe {
5621 let sigma_in: f64 = sigma;
5622 let min_ampl_in: f64 = min_ampl;
5623 let mut out_out: *mut bindings::VipsImage = null_mut();
5624
5625 let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5626 utils::result(
5627 vips_op_response,
5628 VipsImage { ctx: out_out },
5629 Error::LogmatError,
5630 )
5631 }
5632}
5633
5634#[derive(Clone, Debug)]
5636pub struct LogmatOptions {
5637 pub separable: bool,
5640 pub precision: Precision,
5646}
5647
5648impl std::default::Default for LogmatOptions {
5649 fn default() -> Self {
5650 LogmatOptions {
5651 separable: false,
5652 precision: Precision::Integer,
5653 }
5654 }
5655}
5656
5657pub fn logmat_with_opts(
5665 sigma: f64,
5666 min_ampl: f64,
5667 logmat_options: &LogmatOptions,
5668) -> Result<VipsImage> {
5669 unsafe {
5670 let sigma_in: f64 = sigma;
5671 let min_ampl_in: f64 = min_ampl;
5672 let mut out_out: *mut bindings::VipsImage = null_mut();
5673
5674 let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5675 let separable_in_name = utils::new_c_string("separable")?;
5676
5677 let precision_in: i32 = logmat_options.precision as i32;
5678 let precision_in_name = utils::new_c_string("precision")?;
5679
5680 let vips_op_response = bindings::vips_logmat(
5681 &mut out_out,
5682 sigma_in,
5683 min_ampl_in,
5684 separable_in_name.as_ptr(),
5685 separable_in,
5686 precision_in_name.as_ptr(),
5687 precision_in,
5688 NULL,
5689 );
5690 utils::result(
5691 vips_op_response,
5692 VipsImage { ctx: out_out },
5693 Error::LogmatError,
5694 )
5695 }
5696}
5697
5698pub fn text(text: &str) -> Result<VipsImage> {
5702 unsafe {
5703 let text_in: CString = utils::new_c_string(text)?;
5704 let mut out_out: *mut bindings::VipsImage = null_mut();
5705
5706 let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5707 utils::result(
5708 vips_op_response,
5709 VipsImage { ctx: out_out },
5710 Error::TextError,
5711 )
5712 }
5713}
5714
5715#[derive(Clone, Debug)]
5717pub struct TextOptions {
5718 pub font: String,
5720 pub width: i32,
5723 pub height: i32,
5726 pub align: Align,
5732 pub justify: bool,
5735 pub dpi: i32,
5738 pub autofit_dpi: i32,
5741 pub spacing: i32,
5744 pub fontfile: String,
5746 pub rgba: bool,
5749 pub wrap: TextWrap,
5756}
5757
5758impl std::default::Default for TextOptions {
5759 fn default() -> Self {
5760 TextOptions {
5761 font: String::new(),
5762 width: i32::from(0),
5763 height: i32::from(0),
5764 align: Align::Low,
5765 justify: false,
5766 dpi: i32::from(72),
5767 autofit_dpi: i32::from(72),
5768 spacing: i32::from(0),
5769 fontfile: String::new(),
5770 rgba: false,
5771 wrap: TextWrap::Word,
5772 }
5773 }
5774}
5775
5776pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5781 unsafe {
5782 let text_in: CString = utils::new_c_string(text)?;
5783 let mut out_out: *mut bindings::VipsImage = null_mut();
5784
5785 let font_in: CString = utils::new_c_string(&text_options.font)?;
5786 let font_in_name = utils::new_c_string("font")?;
5787
5788 let width_in: i32 = text_options.width;
5789 let width_in_name = utils::new_c_string("width")?;
5790
5791 let height_in: i32 = text_options.height;
5792 let height_in_name = utils::new_c_string("height")?;
5793
5794 let align_in: i32 = text_options.align as i32;
5795 let align_in_name = utils::new_c_string("align")?;
5796
5797 let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5798 let justify_in_name = utils::new_c_string("justify")?;
5799
5800 let dpi_in: i32 = text_options.dpi;
5801 let dpi_in_name = utils::new_c_string("dpi")?;
5802
5803 let autofit_dpi_in: i32 = text_options.autofit_dpi;
5804 let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5805
5806 let spacing_in: i32 = text_options.spacing;
5807 let spacing_in_name = utils::new_c_string("spacing")?;
5808
5809 let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5810 let fontfile_in_name = utils::new_c_string("fontfile")?;
5811
5812 let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5813 let rgba_in_name = utils::new_c_string("rgba")?;
5814
5815 let wrap_in: i32 = text_options.wrap as i32;
5816 let wrap_in_name = utils::new_c_string("wrap")?;
5817
5818 let vips_op_response = bindings::vips_text(
5819 &mut out_out,
5820 text_in.as_ptr(),
5821 font_in_name.as_ptr(),
5822 font_in.as_ptr(),
5823 width_in_name.as_ptr(),
5824 width_in,
5825 height_in_name.as_ptr(),
5826 height_in,
5827 align_in_name.as_ptr(),
5828 align_in,
5829 justify_in_name.as_ptr(),
5830 justify_in,
5831 dpi_in_name.as_ptr(),
5832 dpi_in,
5833 autofit_dpi_in_name.as_ptr(),
5834 autofit_dpi_in,
5835 spacing_in_name.as_ptr(),
5836 spacing_in,
5837 fontfile_in_name.as_ptr(),
5838 fontfile_in.as_ptr(),
5839 rgba_in_name.as_ptr(),
5840 rgba_in,
5841 wrap_in_name.as_ptr(),
5842 wrap_in,
5843 NULL,
5844 );
5845 utils::result(
5846 vips_op_response,
5847 VipsImage { ctx: out_out },
5848 Error::TextError,
5849 )
5850 }
5851}
5852
5853pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
5860 unsafe {
5861 let width_in: i32 = width;
5862 let height_in: i32 = height;
5863 let mut out_out: *mut bindings::VipsImage = null_mut();
5864
5865 let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
5866 utils::result(
5867 vips_op_response,
5868 VipsImage { ctx: out_out },
5869 Error::EyeError,
5870 )
5871 }
5872}
5873
5874#[derive(Clone, Debug)]
5876pub struct EyeOptions {
5877 pub uchar: bool,
5880 pub factor: f64,
5883}
5884
5885impl std::default::Default for EyeOptions {
5886 fn default() -> Self {
5887 EyeOptions {
5888 uchar: false,
5889 factor: f64::from(0.5),
5890 }
5891 }
5892}
5893
5894pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
5902 unsafe {
5903 let width_in: i32 = width;
5904 let height_in: i32 = height;
5905 let mut out_out: *mut bindings::VipsImage = null_mut();
5906
5907 let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
5908 let uchar_in_name = utils::new_c_string("uchar")?;
5909
5910 let factor_in: f64 = eye_options.factor;
5911 let factor_in_name = utils::new_c_string("factor")?;
5912
5913 let vips_op_response = bindings::vips_eye(
5914 &mut out_out,
5915 width_in,
5916 height_in,
5917 uchar_in_name.as_ptr(),
5918 uchar_in,
5919 factor_in_name.as_ptr(),
5920 factor_in,
5921 NULL,
5922 );
5923 utils::result(
5924 vips_op_response,
5925 VipsImage { ctx: out_out },
5926 Error::EyeError,
5927 )
5928 }
5929}
5930
5931pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
5938 unsafe {
5939 let width_in: i32 = width;
5940 let height_in: i32 = height;
5941 let mut out_out: *mut bindings::VipsImage = null_mut();
5942
5943 let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
5944 utils::result(
5945 vips_op_response,
5946 VipsImage { ctx: out_out },
5947 Error::GreyError,
5948 )
5949 }
5950}
5951
5952#[derive(Clone, Debug)]
5954pub struct GreyOptions {
5955 pub uchar: bool,
5958}
5959
5960impl std::default::Default for GreyOptions {
5961 fn default() -> Self {
5962 GreyOptions { uchar: false }
5963 }
5964}
5965
5966pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
5974 unsafe {
5975 let width_in: i32 = width;
5976 let height_in: i32 = height;
5977 let mut out_out: *mut bindings::VipsImage = null_mut();
5978
5979 let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
5980 let uchar_in_name = utils::new_c_string("uchar")?;
5981
5982 let vips_op_response = bindings::vips_grey(
5983 &mut out_out,
5984 width_in,
5985 height_in,
5986 uchar_in_name.as_ptr(),
5987 uchar_in,
5988 NULL,
5989 );
5990 utils::result(
5991 vips_op_response,
5992 VipsImage { ctx: out_out },
5993 Error::GreyError,
5994 )
5995 }
5996}
5997
5998pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6005 unsafe {
6006 let width_in: i32 = width;
6007 let height_in: i32 = height;
6008 let mut out_out: *mut bindings::VipsImage = null_mut();
6009
6010 let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6011 utils::result(
6012 vips_op_response,
6013 VipsImage { ctx: out_out },
6014 Error::ZoneError,
6015 )
6016 }
6017}
6018
6019#[derive(Clone, Debug)]
6021pub struct ZoneOptions {
6022 pub uchar: bool,
6025}
6026
6027impl std::default::Default for ZoneOptions {
6028 fn default() -> Self {
6029 ZoneOptions { uchar: false }
6030 }
6031}
6032
6033pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6041 unsafe {
6042 let width_in: i32 = width;
6043 let height_in: i32 = height;
6044 let mut out_out: *mut bindings::VipsImage = null_mut();
6045
6046 let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6047 let uchar_in_name = utils::new_c_string("uchar")?;
6048
6049 let vips_op_response = bindings::vips_zone(
6050 &mut out_out,
6051 width_in,
6052 height_in,
6053 uchar_in_name.as_ptr(),
6054 uchar_in,
6055 NULL,
6056 );
6057 utils::result(
6058 vips_op_response,
6059 VipsImage { ctx: out_out },
6060 Error::ZoneError,
6061 )
6062 }
6063}
6064
6065pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6072 unsafe {
6073 let width_in: i32 = width;
6074 let height_in: i32 = height;
6075 let mut out_out: *mut bindings::VipsImage = null_mut();
6076
6077 let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6078 utils::result(
6079 vips_op_response,
6080 VipsImage { ctx: out_out },
6081 Error::SineError,
6082 )
6083 }
6084}
6085
6086#[derive(Clone, Debug)]
6088pub struct SineOptions {
6089 pub uchar: bool,
6092 pub hfreq: f64,
6095 pub vfreq: f64,
6098}
6099
6100impl std::default::Default for SineOptions {
6101 fn default() -> Self {
6102 SineOptions {
6103 uchar: false,
6104 hfreq: f64::from(0.5),
6105 vfreq: f64::from(0.5),
6106 }
6107 }
6108}
6109
6110pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6118 unsafe {
6119 let width_in: i32 = width;
6120 let height_in: i32 = height;
6121 let mut out_out: *mut bindings::VipsImage = null_mut();
6122
6123 let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6124 let uchar_in_name = utils::new_c_string("uchar")?;
6125
6126 let hfreq_in: f64 = sines_options.hfreq;
6127 let hfreq_in_name = utils::new_c_string("hfreq")?;
6128
6129 let vfreq_in: f64 = sines_options.vfreq;
6130 let vfreq_in_name = utils::new_c_string("vfreq")?;
6131
6132 let vips_op_response = bindings::vips_sines(
6133 &mut out_out,
6134 width_in,
6135 height_in,
6136 uchar_in_name.as_ptr(),
6137 uchar_in,
6138 hfreq_in_name.as_ptr(),
6139 hfreq_in,
6140 vfreq_in_name.as_ptr(),
6141 vfreq_in,
6142 NULL,
6143 );
6144 utils::result(
6145 vips_op_response,
6146 VipsImage { ctx: out_out },
6147 Error::SineError,
6148 )
6149 }
6150}
6151
6152pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6161 unsafe {
6162 let width_in: i32 = width;
6163 let height_in: i32 = height;
6164 let frequency_cutoff_in: f64 = frequency_cutoff;
6165 let mut out_out: *mut bindings::VipsImage = null_mut();
6166
6167 let vips_op_response =
6168 bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6169 utils::result(
6170 vips_op_response,
6171 VipsImage { ctx: out_out },
6172 Error::MaskIdealError,
6173 )
6174 }
6175}
6176
6177#[derive(Clone, Debug)]
6179pub struct MaskIdealOptions {
6180 pub uchar: bool,
6183 pub nodc: bool,
6186 pub reject: bool,
6189 pub optical: bool,
6192}
6193
6194impl std::default::Default for MaskIdealOptions {
6195 fn default() -> Self {
6196 MaskIdealOptions {
6197 uchar: false,
6198 nodc: false,
6199 reject: false,
6200 optical: false,
6201 }
6202 }
6203}
6204
6205pub fn mask_ideal_with_opts(
6215 width: i32,
6216 height: i32,
6217 frequency_cutoff: f64,
6218 mask_ideal_options: &MaskIdealOptions,
6219) -> Result<VipsImage> {
6220 unsafe {
6221 let width_in: i32 = width;
6222 let height_in: i32 = height;
6223 let frequency_cutoff_in: f64 = frequency_cutoff;
6224 let mut out_out: *mut bindings::VipsImage = null_mut();
6225
6226 let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6227 let uchar_in_name = utils::new_c_string("uchar")?;
6228
6229 let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6230 let nodc_in_name = utils::new_c_string("nodc")?;
6231
6232 let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6233 let reject_in_name = utils::new_c_string("reject")?;
6234
6235 let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6236 let optical_in_name = utils::new_c_string("optical")?;
6237
6238 let vips_op_response = bindings::vips_mask_ideal(
6239 &mut out_out,
6240 width_in,
6241 height_in,
6242 frequency_cutoff_in,
6243 uchar_in_name.as_ptr(),
6244 uchar_in,
6245 nodc_in_name.as_ptr(),
6246 nodc_in,
6247 reject_in_name.as_ptr(),
6248 reject_in,
6249 optical_in_name.as_ptr(),
6250 optical_in,
6251 NULL,
6252 );
6253 utils::result(
6254 vips_op_response,
6255 VipsImage { ctx: out_out },
6256 Error::MaskIdealError,
6257 )
6258 }
6259}
6260
6261pub fn mask_ideal_ring(
6272 width: i32,
6273 height: i32,
6274 frequency_cutoff: f64,
6275 ringwidth: f64,
6276) -> Result<VipsImage> {
6277 unsafe {
6278 let width_in: i32 = width;
6279 let height_in: i32 = height;
6280 let frequency_cutoff_in: f64 = frequency_cutoff;
6281 let ringwidth_in: f64 = ringwidth;
6282 let mut out_out: *mut bindings::VipsImage = null_mut();
6283
6284 let vips_op_response = bindings::vips_mask_ideal_ring(
6285 &mut out_out,
6286 width_in,
6287 height_in,
6288 frequency_cutoff_in,
6289 ringwidth_in,
6290 NULL,
6291 );
6292 utils::result(
6293 vips_op_response,
6294 VipsImage { ctx: out_out },
6295 Error::MaskIdealRingError,
6296 )
6297 }
6298}
6299
6300#[derive(Clone, Debug)]
6302pub struct MaskIdealRingOptions {
6303 pub uchar: bool,
6306 pub nodc: bool,
6309 pub reject: bool,
6312 pub optical: bool,
6315}
6316
6317impl std::default::Default for MaskIdealRingOptions {
6318 fn default() -> Self {
6319 MaskIdealRingOptions {
6320 uchar: false,
6321 nodc: false,
6322 reject: false,
6323 optical: false,
6324 }
6325 }
6326}
6327
6328pub fn mask_ideal_ring_with_opts(
6340 width: i32,
6341 height: i32,
6342 frequency_cutoff: f64,
6343 ringwidth: f64,
6344 mask_ideal_ring_options: &MaskIdealRingOptions,
6345) -> Result<VipsImage> {
6346 unsafe {
6347 let width_in: i32 = width;
6348 let height_in: i32 = height;
6349 let frequency_cutoff_in: f64 = frequency_cutoff;
6350 let ringwidth_in: f64 = ringwidth;
6351 let mut out_out: *mut bindings::VipsImage = null_mut();
6352
6353 let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6354 let uchar_in_name = utils::new_c_string("uchar")?;
6355
6356 let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6357 let nodc_in_name = utils::new_c_string("nodc")?;
6358
6359 let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6360 let reject_in_name = utils::new_c_string("reject")?;
6361
6362 let optical_in: i32 = if mask_ideal_ring_options.optical {
6363 1
6364 } else {
6365 0
6366 };
6367 let optical_in_name = utils::new_c_string("optical")?;
6368
6369 let vips_op_response = bindings::vips_mask_ideal_ring(
6370 &mut out_out,
6371 width_in,
6372 height_in,
6373 frequency_cutoff_in,
6374 ringwidth_in,
6375 uchar_in_name.as_ptr(),
6376 uchar_in,
6377 nodc_in_name.as_ptr(),
6378 nodc_in,
6379 reject_in_name.as_ptr(),
6380 reject_in,
6381 optical_in_name.as_ptr(),
6382 optical_in,
6383 NULL,
6384 );
6385 utils::result(
6386 vips_op_response,
6387 VipsImage { ctx: out_out },
6388 Error::MaskIdealRingError,
6389 )
6390 }
6391}
6392
6393pub fn mask_ideal_band(
6406 width: i32,
6407 height: i32,
6408 frequency_cutoff_x: f64,
6409 frequency_cutoff_y: f64,
6410 radius: f64,
6411) -> Result<VipsImage> {
6412 unsafe {
6413 let width_in: i32 = width;
6414 let height_in: i32 = height;
6415 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6416 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6417 let radius_in: f64 = radius;
6418 let mut out_out: *mut bindings::VipsImage = null_mut();
6419
6420 let vips_op_response = bindings::vips_mask_ideal_band(
6421 &mut out_out,
6422 width_in,
6423 height_in,
6424 frequency_cutoff_x_in,
6425 frequency_cutoff_y_in,
6426 radius_in,
6427 NULL,
6428 );
6429 utils::result(
6430 vips_op_response,
6431 VipsImage { ctx: out_out },
6432 Error::MaskIdealBandError,
6433 )
6434 }
6435}
6436
6437#[derive(Clone, Debug)]
6439pub struct MaskIdealBandOptions {
6440 pub uchar: bool,
6443 pub nodc: bool,
6446 pub reject: bool,
6449 pub optical: bool,
6452}
6453
6454impl std::default::Default for MaskIdealBandOptions {
6455 fn default() -> Self {
6456 MaskIdealBandOptions {
6457 uchar: false,
6458 nodc: false,
6459 reject: false,
6460 optical: false,
6461 }
6462 }
6463}
6464
6465pub fn mask_ideal_band_with_opts(
6479 width: i32,
6480 height: i32,
6481 frequency_cutoff_x: f64,
6482 frequency_cutoff_y: f64,
6483 radius: f64,
6484 mask_ideal_band_options: &MaskIdealBandOptions,
6485) -> Result<VipsImage> {
6486 unsafe {
6487 let width_in: i32 = width;
6488 let height_in: i32 = height;
6489 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6490 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6491 let radius_in: f64 = radius;
6492 let mut out_out: *mut bindings::VipsImage = null_mut();
6493
6494 let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6495 let uchar_in_name = utils::new_c_string("uchar")?;
6496
6497 let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6498 let nodc_in_name = utils::new_c_string("nodc")?;
6499
6500 let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6501 let reject_in_name = utils::new_c_string("reject")?;
6502
6503 let optical_in: i32 = if mask_ideal_band_options.optical {
6504 1
6505 } else {
6506 0
6507 };
6508 let optical_in_name = utils::new_c_string("optical")?;
6509
6510 let vips_op_response = bindings::vips_mask_ideal_band(
6511 &mut out_out,
6512 width_in,
6513 height_in,
6514 frequency_cutoff_x_in,
6515 frequency_cutoff_y_in,
6516 radius_in,
6517 uchar_in_name.as_ptr(),
6518 uchar_in,
6519 nodc_in_name.as_ptr(),
6520 nodc_in,
6521 reject_in_name.as_ptr(),
6522 reject_in,
6523 optical_in_name.as_ptr(),
6524 optical_in,
6525 NULL,
6526 );
6527 utils::result(
6528 vips_op_response,
6529 VipsImage { ctx: out_out },
6530 Error::MaskIdealBandError,
6531 )
6532 }
6533}
6534
6535pub fn mask_butterworth(
6548 width: i32,
6549 height: i32,
6550 order: f64,
6551 frequency_cutoff: f64,
6552 amplitude_cutoff: f64,
6553) -> Result<VipsImage> {
6554 unsafe {
6555 let width_in: i32 = width;
6556 let height_in: i32 = height;
6557 let order_in: f64 = order;
6558 let frequency_cutoff_in: f64 = frequency_cutoff;
6559 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6560 let mut out_out: *mut bindings::VipsImage = null_mut();
6561
6562 let vips_op_response = bindings::vips_mask_butterworth(
6563 &mut out_out,
6564 width_in,
6565 height_in,
6566 order_in,
6567 frequency_cutoff_in,
6568 amplitude_cutoff_in,
6569 NULL,
6570 );
6571 utils::result(
6572 vips_op_response,
6573 VipsImage { ctx: out_out },
6574 Error::MaskButterworthError,
6575 )
6576 }
6577}
6578
6579#[derive(Clone, Debug)]
6581pub struct MaskButterworthOptions {
6582 pub uchar: bool,
6585 pub nodc: bool,
6588 pub reject: bool,
6591 pub optical: bool,
6594}
6595
6596impl std::default::Default for MaskButterworthOptions {
6597 fn default() -> Self {
6598 MaskButterworthOptions {
6599 uchar: false,
6600 nodc: false,
6601 reject: false,
6602 optical: false,
6603 }
6604 }
6605}
6606
6607pub fn mask_butterworth_with_opts(
6621 width: i32,
6622 height: i32,
6623 order: f64,
6624 frequency_cutoff: f64,
6625 amplitude_cutoff: f64,
6626 mask_butterworth_options: &MaskButterworthOptions,
6627) -> Result<VipsImage> {
6628 unsafe {
6629 let width_in: i32 = width;
6630 let height_in: i32 = height;
6631 let order_in: f64 = order;
6632 let frequency_cutoff_in: f64 = frequency_cutoff;
6633 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6634 let mut out_out: *mut bindings::VipsImage = null_mut();
6635
6636 let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6637 let uchar_in_name = utils::new_c_string("uchar")?;
6638
6639 let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6640 let nodc_in_name = utils::new_c_string("nodc")?;
6641
6642 let reject_in: i32 = if mask_butterworth_options.reject {
6643 1
6644 } else {
6645 0
6646 };
6647 let reject_in_name = utils::new_c_string("reject")?;
6648
6649 let optical_in: i32 = if mask_butterworth_options.optical {
6650 1
6651 } else {
6652 0
6653 };
6654 let optical_in_name = utils::new_c_string("optical")?;
6655
6656 let vips_op_response = bindings::vips_mask_butterworth(
6657 &mut out_out,
6658 width_in,
6659 height_in,
6660 order_in,
6661 frequency_cutoff_in,
6662 amplitude_cutoff_in,
6663 uchar_in_name.as_ptr(),
6664 uchar_in,
6665 nodc_in_name.as_ptr(),
6666 nodc_in,
6667 reject_in_name.as_ptr(),
6668 reject_in,
6669 optical_in_name.as_ptr(),
6670 optical_in,
6671 NULL,
6672 );
6673 utils::result(
6674 vips_op_response,
6675 VipsImage { ctx: out_out },
6676 Error::MaskButterworthError,
6677 )
6678 }
6679}
6680
6681pub fn mask_butterworth_ring(
6696 width: i32,
6697 height: i32,
6698 order: f64,
6699 frequency_cutoff: f64,
6700 amplitude_cutoff: f64,
6701 ringwidth: f64,
6702) -> Result<VipsImage> {
6703 unsafe {
6704 let width_in: i32 = width;
6705 let height_in: i32 = height;
6706 let order_in: f64 = order;
6707 let frequency_cutoff_in: f64 = frequency_cutoff;
6708 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6709 let ringwidth_in: f64 = ringwidth;
6710 let mut out_out: *mut bindings::VipsImage = null_mut();
6711
6712 let vips_op_response = bindings::vips_mask_butterworth_ring(
6713 &mut out_out,
6714 width_in,
6715 height_in,
6716 order_in,
6717 frequency_cutoff_in,
6718 amplitude_cutoff_in,
6719 ringwidth_in,
6720 NULL,
6721 );
6722 utils::result(
6723 vips_op_response,
6724 VipsImage { ctx: out_out },
6725 Error::MaskButterworthRingError,
6726 )
6727 }
6728}
6729
6730#[derive(Clone, Debug)]
6732pub struct MaskButterworthRingOptions {
6733 pub uchar: bool,
6736 pub nodc: bool,
6739 pub reject: bool,
6742 pub optical: bool,
6745}
6746
6747impl std::default::Default for MaskButterworthRingOptions {
6748 fn default() -> Self {
6749 MaskButterworthRingOptions {
6750 uchar: false,
6751 nodc: false,
6752 reject: false,
6753 optical: false,
6754 }
6755 }
6756}
6757
6758pub fn mask_butterworth_ring_with_opts(
6774 width: i32,
6775 height: i32,
6776 order: f64,
6777 frequency_cutoff: f64,
6778 amplitude_cutoff: f64,
6779 ringwidth: f64,
6780 mask_butterworth_ring_options: &MaskButterworthRingOptions,
6781) -> Result<VipsImage> {
6782 unsafe {
6783 let width_in: i32 = width;
6784 let height_in: i32 = height;
6785 let order_in: f64 = order;
6786 let frequency_cutoff_in: f64 = frequency_cutoff;
6787 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6788 let ringwidth_in: f64 = ringwidth;
6789 let mut out_out: *mut bindings::VipsImage = null_mut();
6790
6791 let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6792 1
6793 } else {
6794 0
6795 };
6796 let uchar_in_name = utils::new_c_string("uchar")?;
6797
6798 let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6799 1
6800 } else {
6801 0
6802 };
6803 let nodc_in_name = utils::new_c_string("nodc")?;
6804
6805 let reject_in: i32 = if mask_butterworth_ring_options.reject {
6806 1
6807 } else {
6808 0
6809 };
6810 let reject_in_name = utils::new_c_string("reject")?;
6811
6812 let optical_in: i32 = if mask_butterworth_ring_options.optical {
6813 1
6814 } else {
6815 0
6816 };
6817 let optical_in_name = utils::new_c_string("optical")?;
6818
6819 let vips_op_response = bindings::vips_mask_butterworth_ring(
6820 &mut out_out,
6821 width_in,
6822 height_in,
6823 order_in,
6824 frequency_cutoff_in,
6825 amplitude_cutoff_in,
6826 ringwidth_in,
6827 uchar_in_name.as_ptr(),
6828 uchar_in,
6829 nodc_in_name.as_ptr(),
6830 nodc_in,
6831 reject_in_name.as_ptr(),
6832 reject_in,
6833 optical_in_name.as_ptr(),
6834 optical_in,
6835 NULL,
6836 );
6837 utils::result(
6838 vips_op_response,
6839 VipsImage { ctx: out_out },
6840 Error::MaskButterworthRingError,
6841 )
6842 }
6843}
6844
6845pub fn mask_butterworth_band(
6862 width: i32,
6863 height: i32,
6864 order: f64,
6865 frequency_cutoff_x: f64,
6866 frequency_cutoff_y: f64,
6867 radius: f64,
6868 amplitude_cutoff: f64,
6869) -> Result<VipsImage> {
6870 unsafe {
6871 let width_in: i32 = width;
6872 let height_in: i32 = height;
6873 let order_in: f64 = order;
6874 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6875 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6876 let radius_in: f64 = radius;
6877 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6878 let mut out_out: *mut bindings::VipsImage = null_mut();
6879
6880 let vips_op_response = bindings::vips_mask_butterworth_band(
6881 &mut out_out,
6882 width_in,
6883 height_in,
6884 order_in,
6885 frequency_cutoff_x_in,
6886 frequency_cutoff_y_in,
6887 radius_in,
6888 amplitude_cutoff_in,
6889 NULL,
6890 );
6891 utils::result(
6892 vips_op_response,
6893 VipsImage { ctx: out_out },
6894 Error::MaskButterworthBandError,
6895 )
6896 }
6897}
6898
6899#[derive(Clone, Debug)]
6901pub struct MaskButterworthBandOptions {
6902 pub uchar: bool,
6905 pub nodc: bool,
6908 pub reject: bool,
6911 pub optical: bool,
6914}
6915
6916impl std::default::Default for MaskButterworthBandOptions {
6917 fn default() -> Self {
6918 MaskButterworthBandOptions {
6919 uchar: false,
6920 nodc: false,
6921 reject: false,
6922 optical: false,
6923 }
6924 }
6925}
6926
6927pub fn mask_butterworth_band_with_opts(
6945 width: i32,
6946 height: i32,
6947 order: f64,
6948 frequency_cutoff_x: f64,
6949 frequency_cutoff_y: f64,
6950 radius: f64,
6951 amplitude_cutoff: f64,
6952 mask_butterworth_band_options: &MaskButterworthBandOptions,
6953) -> Result<VipsImage> {
6954 unsafe {
6955 let width_in: i32 = width;
6956 let height_in: i32 = height;
6957 let order_in: f64 = order;
6958 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6959 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6960 let radius_in: f64 = radius;
6961 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6962 let mut out_out: *mut bindings::VipsImage = null_mut();
6963
6964 let uchar_in: i32 = if mask_butterworth_band_options.uchar {
6965 1
6966 } else {
6967 0
6968 };
6969 let uchar_in_name = utils::new_c_string("uchar")?;
6970
6971 let nodc_in: i32 = if mask_butterworth_band_options.nodc {
6972 1
6973 } else {
6974 0
6975 };
6976 let nodc_in_name = utils::new_c_string("nodc")?;
6977
6978 let reject_in: i32 = if mask_butterworth_band_options.reject {
6979 1
6980 } else {
6981 0
6982 };
6983 let reject_in_name = utils::new_c_string("reject")?;
6984
6985 let optical_in: i32 = if mask_butterworth_band_options.optical {
6986 1
6987 } else {
6988 0
6989 };
6990 let optical_in_name = utils::new_c_string("optical")?;
6991
6992 let vips_op_response = bindings::vips_mask_butterworth_band(
6993 &mut out_out,
6994 width_in,
6995 height_in,
6996 order_in,
6997 frequency_cutoff_x_in,
6998 frequency_cutoff_y_in,
6999 radius_in,
7000 amplitude_cutoff_in,
7001 uchar_in_name.as_ptr(),
7002 uchar_in,
7003 nodc_in_name.as_ptr(),
7004 nodc_in,
7005 reject_in_name.as_ptr(),
7006 reject_in,
7007 optical_in_name.as_ptr(),
7008 optical_in,
7009 NULL,
7010 );
7011 utils::result(
7012 vips_op_response,
7013 VipsImage { ctx: out_out },
7014 Error::MaskButterworthBandError,
7015 )
7016 }
7017}
7018
7019pub fn mask_gaussian(
7030 width: i32,
7031 height: i32,
7032 frequency_cutoff: f64,
7033 amplitude_cutoff: f64,
7034) -> Result<VipsImage> {
7035 unsafe {
7036 let width_in: i32 = width;
7037 let height_in: i32 = height;
7038 let frequency_cutoff_in: f64 = frequency_cutoff;
7039 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7040 let mut out_out: *mut bindings::VipsImage = null_mut();
7041
7042 let vips_op_response = bindings::vips_mask_gaussian(
7043 &mut out_out,
7044 width_in,
7045 height_in,
7046 frequency_cutoff_in,
7047 amplitude_cutoff_in,
7048 NULL,
7049 );
7050 utils::result(
7051 vips_op_response,
7052 VipsImage { ctx: out_out },
7053 Error::MaskGaussianError,
7054 )
7055 }
7056}
7057
7058#[derive(Clone, Debug)]
7060pub struct MaskGaussianOptions {
7061 pub uchar: bool,
7064 pub nodc: bool,
7067 pub reject: bool,
7070 pub optical: bool,
7073}
7074
7075impl std::default::Default for MaskGaussianOptions {
7076 fn default() -> Self {
7077 MaskGaussianOptions {
7078 uchar: false,
7079 nodc: false,
7080 reject: false,
7081 optical: false,
7082 }
7083 }
7084}
7085
7086pub fn mask_gaussian_with_opts(
7098 width: i32,
7099 height: i32,
7100 frequency_cutoff: f64,
7101 amplitude_cutoff: f64,
7102 mask_gaussian_options: &MaskGaussianOptions,
7103) -> Result<VipsImage> {
7104 unsafe {
7105 let width_in: i32 = width;
7106 let height_in: i32 = height;
7107 let frequency_cutoff_in: f64 = frequency_cutoff;
7108 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7109 let mut out_out: *mut bindings::VipsImage = null_mut();
7110
7111 let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7112 let uchar_in_name = utils::new_c_string("uchar")?;
7113
7114 let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7115 let nodc_in_name = utils::new_c_string("nodc")?;
7116
7117 let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7118 let reject_in_name = utils::new_c_string("reject")?;
7119
7120 let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7121 let optical_in_name = utils::new_c_string("optical")?;
7122
7123 let vips_op_response = bindings::vips_mask_gaussian(
7124 &mut out_out,
7125 width_in,
7126 height_in,
7127 frequency_cutoff_in,
7128 amplitude_cutoff_in,
7129 uchar_in_name.as_ptr(),
7130 uchar_in,
7131 nodc_in_name.as_ptr(),
7132 nodc_in,
7133 reject_in_name.as_ptr(),
7134 reject_in,
7135 optical_in_name.as_ptr(),
7136 optical_in,
7137 NULL,
7138 );
7139 utils::result(
7140 vips_op_response,
7141 VipsImage { ctx: out_out },
7142 Error::MaskGaussianError,
7143 )
7144 }
7145}
7146
7147pub fn mask_gaussian_ring(
7160 width: i32,
7161 height: i32,
7162 frequency_cutoff: f64,
7163 amplitude_cutoff: f64,
7164 ringwidth: f64,
7165) -> Result<VipsImage> {
7166 unsafe {
7167 let width_in: i32 = width;
7168 let height_in: i32 = height;
7169 let frequency_cutoff_in: f64 = frequency_cutoff;
7170 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7171 let ringwidth_in: f64 = ringwidth;
7172 let mut out_out: *mut bindings::VipsImage = null_mut();
7173
7174 let vips_op_response = bindings::vips_mask_gaussian_ring(
7175 &mut out_out,
7176 width_in,
7177 height_in,
7178 frequency_cutoff_in,
7179 amplitude_cutoff_in,
7180 ringwidth_in,
7181 NULL,
7182 );
7183 utils::result(
7184 vips_op_response,
7185 VipsImage { ctx: out_out },
7186 Error::MaskGaussianRingError,
7187 )
7188 }
7189}
7190
7191#[derive(Clone, Debug)]
7193pub struct MaskGaussianRingOptions {
7194 pub uchar: bool,
7197 pub nodc: bool,
7200 pub reject: bool,
7203 pub optical: bool,
7206}
7207
7208impl std::default::Default for MaskGaussianRingOptions {
7209 fn default() -> Self {
7210 MaskGaussianRingOptions {
7211 uchar: false,
7212 nodc: false,
7213 reject: false,
7214 optical: false,
7215 }
7216 }
7217}
7218
7219pub fn mask_gaussian_ring_with_opts(
7233 width: i32,
7234 height: i32,
7235 frequency_cutoff: f64,
7236 amplitude_cutoff: f64,
7237 ringwidth: f64,
7238 mask_gaussian_ring_options: &MaskGaussianRingOptions,
7239) -> Result<VipsImage> {
7240 unsafe {
7241 let width_in: i32 = width;
7242 let height_in: i32 = height;
7243 let frequency_cutoff_in: f64 = frequency_cutoff;
7244 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7245 let ringwidth_in: f64 = ringwidth;
7246 let mut out_out: *mut bindings::VipsImage = null_mut();
7247
7248 let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7249 1
7250 } else {
7251 0
7252 };
7253 let uchar_in_name = utils::new_c_string("uchar")?;
7254
7255 let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7256 1
7257 } else {
7258 0
7259 };
7260 let nodc_in_name = utils::new_c_string("nodc")?;
7261
7262 let reject_in: i32 = if mask_gaussian_ring_options.reject {
7263 1
7264 } else {
7265 0
7266 };
7267 let reject_in_name = utils::new_c_string("reject")?;
7268
7269 let optical_in: i32 = if mask_gaussian_ring_options.optical {
7270 1
7271 } else {
7272 0
7273 };
7274 let optical_in_name = utils::new_c_string("optical")?;
7275
7276 let vips_op_response = bindings::vips_mask_gaussian_ring(
7277 &mut out_out,
7278 width_in,
7279 height_in,
7280 frequency_cutoff_in,
7281 amplitude_cutoff_in,
7282 ringwidth_in,
7283 uchar_in_name.as_ptr(),
7284 uchar_in,
7285 nodc_in_name.as_ptr(),
7286 nodc_in,
7287 reject_in_name.as_ptr(),
7288 reject_in,
7289 optical_in_name.as_ptr(),
7290 optical_in,
7291 NULL,
7292 );
7293 utils::result(
7294 vips_op_response,
7295 VipsImage { ctx: out_out },
7296 Error::MaskGaussianRingError,
7297 )
7298 }
7299}
7300
7301pub fn mask_gaussian_band(
7316 width: i32,
7317 height: i32,
7318 frequency_cutoff_x: f64,
7319 frequency_cutoff_y: f64,
7320 radius: f64,
7321 amplitude_cutoff: f64,
7322) -> Result<VipsImage> {
7323 unsafe {
7324 let width_in: i32 = width;
7325 let height_in: i32 = height;
7326 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7327 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7328 let radius_in: f64 = radius;
7329 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7330 let mut out_out: *mut bindings::VipsImage = null_mut();
7331
7332 let vips_op_response = bindings::vips_mask_gaussian_band(
7333 &mut out_out,
7334 width_in,
7335 height_in,
7336 frequency_cutoff_x_in,
7337 frequency_cutoff_y_in,
7338 radius_in,
7339 amplitude_cutoff_in,
7340 NULL,
7341 );
7342 utils::result(
7343 vips_op_response,
7344 VipsImage { ctx: out_out },
7345 Error::MaskGaussianBandError,
7346 )
7347 }
7348}
7349
7350#[derive(Clone, Debug)]
7352pub struct MaskGaussianBandOptions {
7353 pub uchar: bool,
7356 pub nodc: bool,
7359 pub reject: bool,
7362 pub optical: bool,
7365}
7366
7367impl std::default::Default for MaskGaussianBandOptions {
7368 fn default() -> Self {
7369 MaskGaussianBandOptions {
7370 uchar: false,
7371 nodc: false,
7372 reject: false,
7373 optical: false,
7374 }
7375 }
7376}
7377
7378pub fn mask_gaussian_band_with_opts(
7394 width: i32,
7395 height: i32,
7396 frequency_cutoff_x: f64,
7397 frequency_cutoff_y: f64,
7398 radius: f64,
7399 amplitude_cutoff: f64,
7400 mask_gaussian_band_options: &MaskGaussianBandOptions,
7401) -> Result<VipsImage> {
7402 unsafe {
7403 let width_in: i32 = width;
7404 let height_in: i32 = height;
7405 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7406 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7407 let radius_in: f64 = radius;
7408 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7409 let mut out_out: *mut bindings::VipsImage = null_mut();
7410
7411 let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7412 1
7413 } else {
7414 0
7415 };
7416 let uchar_in_name = utils::new_c_string("uchar")?;
7417
7418 let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7419 1
7420 } else {
7421 0
7422 };
7423 let nodc_in_name = utils::new_c_string("nodc")?;
7424
7425 let reject_in: i32 = if mask_gaussian_band_options.reject {
7426 1
7427 } else {
7428 0
7429 };
7430 let reject_in_name = utils::new_c_string("reject")?;
7431
7432 let optical_in: i32 = if mask_gaussian_band_options.optical {
7433 1
7434 } else {
7435 0
7436 };
7437 let optical_in_name = utils::new_c_string("optical")?;
7438
7439 let vips_op_response = bindings::vips_mask_gaussian_band(
7440 &mut out_out,
7441 width_in,
7442 height_in,
7443 frequency_cutoff_x_in,
7444 frequency_cutoff_y_in,
7445 radius_in,
7446 amplitude_cutoff_in,
7447 uchar_in_name.as_ptr(),
7448 uchar_in,
7449 nodc_in_name.as_ptr(),
7450 nodc_in,
7451 reject_in_name.as_ptr(),
7452 reject_in,
7453 optical_in_name.as_ptr(),
7454 optical_in,
7455 NULL,
7456 );
7457 utils::result(
7458 vips_op_response,
7459 VipsImage { ctx: out_out },
7460 Error::MaskGaussianBandError,
7461 )
7462 }
7463}
7464
7465pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7474 unsafe {
7475 let width_in: i32 = width;
7476 let height_in: i32 = height;
7477 let fractal_dimension_in: f64 = fractal_dimension;
7478 let mut out_out: *mut bindings::VipsImage = null_mut();
7479
7480 let vips_op_response = bindings::vips_mask_fractal(
7481 &mut out_out,
7482 width_in,
7483 height_in,
7484 fractal_dimension_in,
7485 NULL,
7486 );
7487 utils::result(
7488 vips_op_response,
7489 VipsImage { ctx: out_out },
7490 Error::MaskFractalError,
7491 )
7492 }
7493}
7494
7495#[derive(Clone, Debug)]
7497pub struct MaskFractalOptions {
7498 pub uchar: bool,
7501 pub nodc: bool,
7504 pub reject: bool,
7507 pub optical: bool,
7510}
7511
7512impl std::default::Default for MaskFractalOptions {
7513 fn default() -> Self {
7514 MaskFractalOptions {
7515 uchar: false,
7516 nodc: false,
7517 reject: false,
7518 optical: false,
7519 }
7520 }
7521}
7522
7523pub fn mask_fractal_with_opts(
7533 width: i32,
7534 height: i32,
7535 fractal_dimension: f64,
7536 mask_fractal_options: &MaskFractalOptions,
7537) -> Result<VipsImage> {
7538 unsafe {
7539 let width_in: i32 = width;
7540 let height_in: i32 = height;
7541 let fractal_dimension_in: f64 = fractal_dimension;
7542 let mut out_out: *mut bindings::VipsImage = null_mut();
7543
7544 let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7545 let uchar_in_name = utils::new_c_string("uchar")?;
7546
7547 let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7548 let nodc_in_name = utils::new_c_string("nodc")?;
7549
7550 let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7551 let reject_in_name = utils::new_c_string("reject")?;
7552
7553 let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7554 let optical_in_name = utils::new_c_string("optical")?;
7555
7556 let vips_op_response = bindings::vips_mask_fractal(
7557 &mut out_out,
7558 width_in,
7559 height_in,
7560 fractal_dimension_in,
7561 uchar_in_name.as_ptr(),
7562 uchar_in,
7563 nodc_in_name.as_ptr(),
7564 nodc_in,
7565 reject_in_name.as_ptr(),
7566 reject_in,
7567 optical_in_name.as_ptr(),
7568 optical_in,
7569 NULL,
7570 );
7571 utils::result(
7572 vips_op_response,
7573 VipsImage { ctx: out_out },
7574 Error::MaskFractalError,
7575 )
7576 }
7577}
7578
7579pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7583 unsafe {
7584 let inp_in: *mut bindings::VipsImage = inp.ctx;
7585 let mut out_out: *mut bindings::VipsImage = null_mut();
7586
7587 let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7588 utils::result(
7589 vips_op_response,
7590 VipsImage { ctx: out_out },
7591 Error::BuildlutError,
7592 )
7593 }
7594}
7595
7596pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7600 unsafe {
7601 let inp_in: *mut bindings::VipsImage = inp.ctx;
7602 let mut out_out: *mut bindings::VipsImage = null_mut();
7603
7604 let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7605 utils::result(
7606 vips_op_response,
7607 VipsImage { ctx: out_out },
7608 Error::InvertlutError,
7609 )
7610 }
7611}
7612
7613#[derive(Clone, Debug)]
7615pub struct InvertlutOptions {
7616 pub size: i32,
7619}
7620
7621impl std::default::Default for InvertlutOptions {
7622 fn default() -> Self {
7623 InvertlutOptions {
7624 size: i32::from(256),
7625 }
7626 }
7627}
7628
7629pub fn invertlut_with_opts(
7634 inp: &VipsImage,
7635 invertlut_options: &InvertlutOptions,
7636) -> Result<VipsImage> {
7637 unsafe {
7638 let inp_in: *mut bindings::VipsImage = inp.ctx;
7639 let mut out_out: *mut bindings::VipsImage = null_mut();
7640
7641 let size_in: i32 = invertlut_options.size;
7642 let size_in_name = utils::new_c_string("size")?;
7643
7644 let vips_op_response =
7645 bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7646 utils::result(
7647 vips_op_response,
7648 VipsImage { ctx: out_out },
7649 Error::InvertlutError,
7650 )
7651 }
7652}
7653
7654pub fn tonelut() -> Result<VipsImage> {
7658 unsafe {
7659 let mut out_out: *mut bindings::VipsImage = null_mut();
7660
7661 let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7662 utils::result(
7663 vips_op_response,
7664 VipsImage { ctx: out_out },
7665 Error::TonelutError,
7666 )
7667 }
7668}
7669
7670#[derive(Clone, Debug)]
7672pub struct TonelutOptions {
7673 pub in_max: i32,
7676 pub out_max: i32,
7679 pub lb: f64,
7682 pub lw: f64,
7685 pub ps: f64,
7688 pub pm: f64,
7691 pub ph: f64,
7694 pub s: f64,
7697 pub m: f64,
7700 pub h: f64,
7703}
7704
7705impl std::default::Default for TonelutOptions {
7706 fn default() -> Self {
7707 TonelutOptions {
7708 in_max: i32::from(32767),
7709 out_max: i32::from(32767),
7710 lb: f64::from(0),
7711 lw: f64::from(100),
7712 ps: f64::from(0.2),
7713 pm: f64::from(0.5),
7714 ph: f64::from(0.8),
7715 s: f64::from(0),
7716 m: f64::from(0),
7717 h: f64::from(0),
7718 }
7719 }
7720}
7721
7722pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7727 unsafe {
7728 let mut out_out: *mut bindings::VipsImage = null_mut();
7729
7730 let in_max_in: i32 = tonelut_options.in_max;
7731 let in_max_in_name = utils::new_c_string("in-max")?;
7732
7733 let out_max_in: i32 = tonelut_options.out_max;
7734 let out_max_in_name = utils::new_c_string("out-max")?;
7735
7736 let lb_in: f64 = tonelut_options.lb;
7737 let lb_in_name = utils::new_c_string("Lb")?;
7738
7739 let lw_in: f64 = tonelut_options.lw;
7740 let lw_in_name = utils::new_c_string("Lw")?;
7741
7742 let ps_in: f64 = tonelut_options.ps;
7743 let ps_in_name = utils::new_c_string("Ps")?;
7744
7745 let pm_in: f64 = tonelut_options.pm;
7746 let pm_in_name = utils::new_c_string("Pm")?;
7747
7748 let ph_in: f64 = tonelut_options.ph;
7749 let ph_in_name = utils::new_c_string("Ph")?;
7750
7751 let s_in: f64 = tonelut_options.s;
7752 let s_in_name = utils::new_c_string("S")?;
7753
7754 let m_in: f64 = tonelut_options.m;
7755 let m_in_name = utils::new_c_string("M")?;
7756
7757 let h_in: f64 = tonelut_options.h;
7758 let h_in_name = utils::new_c_string("H")?;
7759
7760 let vips_op_response = bindings::vips_tonelut(
7761 &mut out_out,
7762 in_max_in_name.as_ptr(),
7763 in_max_in,
7764 out_max_in_name.as_ptr(),
7765 out_max_in,
7766 lb_in_name.as_ptr(),
7767 lb_in,
7768 lw_in_name.as_ptr(),
7769 lw_in,
7770 ps_in_name.as_ptr(),
7771 ps_in,
7772 pm_in_name.as_ptr(),
7773 pm_in,
7774 ph_in_name.as_ptr(),
7775 ph_in,
7776 s_in_name.as_ptr(),
7777 s_in,
7778 m_in_name.as_ptr(),
7779 m_in,
7780 h_in_name.as_ptr(),
7781 h_in,
7782 NULL,
7783 );
7784 utils::result(
7785 vips_op_response,
7786 VipsImage { ctx: out_out },
7787 Error::TonelutError,
7788 )
7789 }
7790}
7791
7792pub fn identity() -> Result<VipsImage> {
7796 unsafe {
7797 let mut out_out: *mut bindings::VipsImage = null_mut();
7798
7799 let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7800 utils::result(
7801 vips_op_response,
7802 VipsImage { ctx: out_out },
7803 Error::IdentityError,
7804 )
7805 }
7806}
7807
7808#[derive(Clone, Debug)]
7810pub struct IdentityOptions {
7811 pub bands: i32,
7814 pub ushort: bool,
7817 pub size: i32,
7820}
7821
7822impl std::default::Default for IdentityOptions {
7823 fn default() -> Self {
7824 IdentityOptions {
7825 bands: i32::from(1),
7826 ushort: false,
7827 size: i32::from(65536),
7828 }
7829 }
7830}
7831
7832pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
7837 unsafe {
7838 let mut out_out: *mut bindings::VipsImage = null_mut();
7839
7840 let bands_in: i32 = identity_options.bands;
7841 let bands_in_name = utils::new_c_string("bands")?;
7842
7843 let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
7844 let ushort_in_name = utils::new_c_string("ushort")?;
7845
7846 let size_in: i32 = identity_options.size;
7847 let size_in_name = utils::new_c_string("size")?;
7848
7849 let vips_op_response = bindings::vips_identity(
7850 &mut out_out,
7851 bands_in_name.as_ptr(),
7852 bands_in,
7853 ushort_in_name.as_ptr(),
7854 ushort_in,
7855 size_in_name.as_ptr(),
7856 size_in,
7857 NULL,
7858 );
7859 utils::result(
7860 vips_op_response,
7861 VipsImage { ctx: out_out },
7862 Error::IdentityError,
7863 )
7864 }
7865}
7866
7867pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7876 unsafe {
7877 let width_in: i32 = width;
7878 let height_in: i32 = height;
7879 let fractal_dimension_in: f64 = fractal_dimension;
7880 let mut out_out: *mut bindings::VipsImage = null_mut();
7881
7882 let vips_op_response = bindings::vips_fractsurf(
7883 &mut out_out,
7884 width_in,
7885 height_in,
7886 fractal_dimension_in,
7887 NULL,
7888 );
7889 utils::result(
7890 vips_op_response,
7891 VipsImage { ctx: out_out },
7892 Error::FractsurfError,
7893 )
7894 }
7895}
7896
7897pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
7904 unsafe {
7905 let width_in: i32 = width;
7906 let height_in: i32 = height;
7907 let mut out_out: *mut bindings::VipsImage = null_mut();
7908
7909 let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
7910 utils::result(
7911 vips_op_response,
7912 VipsImage { ctx: out_out },
7913 Error::WorleyError,
7914 )
7915 }
7916}
7917
7918#[derive(Clone, Debug)]
7920pub struct WorleyOptions {
7921 pub cell_size: i32,
7924 pub seed: i32,
7927}
7928
7929impl std::default::Default for WorleyOptions {
7930 fn default() -> Self {
7931 WorleyOptions {
7932 cell_size: i32::from(256),
7933 seed: i32::from(0),
7934 }
7935 }
7936}
7937
7938pub fn worley_with_opts(
7946 width: i32,
7947 height: i32,
7948 worley_options: &WorleyOptions,
7949) -> Result<VipsImage> {
7950 unsafe {
7951 let width_in: i32 = width;
7952 let height_in: i32 = height;
7953 let mut out_out: *mut bindings::VipsImage = null_mut();
7954
7955 let cell_size_in: i32 = worley_options.cell_size;
7956 let cell_size_in_name = utils::new_c_string("cell-size")?;
7957
7958 let seed_in: i32 = worley_options.seed;
7959 let seed_in_name = utils::new_c_string("seed")?;
7960
7961 let vips_op_response = bindings::vips_worley(
7962 &mut out_out,
7963 width_in,
7964 height_in,
7965 cell_size_in_name.as_ptr(),
7966 cell_size_in,
7967 seed_in_name.as_ptr(),
7968 seed_in,
7969 NULL,
7970 );
7971 utils::result(
7972 vips_op_response,
7973 VipsImage { ctx: out_out },
7974 Error::WorleyError,
7975 )
7976 }
7977}
7978
7979pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
7986 unsafe {
7987 let width_in: i32 = width;
7988 let height_in: i32 = height;
7989 let mut out_out: *mut bindings::VipsImage = null_mut();
7990
7991 let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
7992 utils::result(
7993 vips_op_response,
7994 VipsImage { ctx: out_out },
7995 Error::PerlinError,
7996 )
7997 }
7998}
7999
8000#[derive(Clone, Debug)]
8002pub struct PerlinOptions {
8003 pub cell_size: i32,
8006 pub uchar: bool,
8009 pub seed: i32,
8012}
8013
8014impl std::default::Default for PerlinOptions {
8015 fn default() -> Self {
8016 PerlinOptions {
8017 cell_size: i32::from(256),
8018 uchar: false,
8019 seed: i32::from(0),
8020 }
8021 }
8022}
8023
8024pub fn perlin_with_opts(
8032 width: i32,
8033 height: i32,
8034 perlin_options: &PerlinOptions,
8035) -> Result<VipsImage> {
8036 unsafe {
8037 let width_in: i32 = width;
8038 let height_in: i32 = height;
8039 let mut out_out: *mut bindings::VipsImage = null_mut();
8040
8041 let cell_size_in: i32 = perlin_options.cell_size;
8042 let cell_size_in_name = utils::new_c_string("cell-size")?;
8043
8044 let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8045 let uchar_in_name = utils::new_c_string("uchar")?;
8046
8047 let seed_in: i32 = perlin_options.seed;
8048 let seed_in_name = utils::new_c_string("seed")?;
8049
8050 let vips_op_response = bindings::vips_perlin(
8051 &mut out_out,
8052 width_in,
8053 height_in,
8054 cell_size_in_name.as_ptr(),
8055 cell_size_in,
8056 uchar_in_name.as_ptr(),
8057 uchar_in,
8058 seed_in_name.as_ptr(),
8059 seed_in,
8060 NULL,
8061 );
8062 utils::result(
8063 vips_op_response,
8064 VipsImage { ctx: out_out },
8065 Error::PerlinError,
8066 )
8067 }
8068}
8069
8070pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8074 unsafe {
8075 let (tests_len, mut tests_in) = {
8076 let len = tests.len();
8077 let mut input = Vec::new();
8078 for img in tests {
8079 input.push(img.ctx)
8080 }
8081 (len as i32, input)
8082 };
8083 let mut out_out: *mut bindings::VipsImage = null_mut();
8084
8085 let vips_op_response =
8086 bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8087 utils::result(
8088 vips_op_response,
8089 VipsImage { ctx: out_out },
8090 Error::SwitchError,
8091 )
8092 }
8093}
8094
8095pub fn csvload(filename: &str) -> Result<VipsImage> {
8099 unsafe {
8100 let filename_in: CString = utils::new_c_string(filename)?;
8101 let mut out_out: *mut bindings::VipsImage = null_mut();
8102
8103 let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8104 utils::result(
8105 vips_op_response,
8106 VipsImage { ctx: out_out },
8107 Error::CsvloadError,
8108 )
8109 }
8110}
8111
8112#[derive(Clone, Debug)]
8114pub struct CsvloadOptions {
8115 pub skip: i32,
8118 pub lines: i32,
8121 pub whitespace: String,
8123 pub separator: String,
8125 pub flags: ForeignFlags,
8132 pub memory: bool,
8135 pub access: Access,
8141 pub fail_on: FailOn,
8148 pub revalidate: bool,
8151}
8152
8153impl std::default::Default for CsvloadOptions {
8154 fn default() -> Self {
8155 CsvloadOptions {
8156 skip: i32::from(0),
8157 lines: i32::from(0),
8158 whitespace: String::new(),
8159 separator: String::new(),
8160 flags: ForeignFlags::None,
8161 memory: false,
8162 access: Access::Random,
8163 fail_on: FailOn::None,
8164 revalidate: false,
8165 }
8166 }
8167}
8168
8169pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8174 unsafe {
8175 let filename_in: CString = utils::new_c_string(filename)?;
8176 let mut out_out: *mut bindings::VipsImage = null_mut();
8177
8178 let skip_in: i32 = csvload_options.skip;
8179 let skip_in_name = utils::new_c_string("skip")?;
8180
8181 let lines_in: i32 = csvload_options.lines;
8182 let lines_in_name = utils::new_c_string("lines")?;
8183
8184 let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8185 let whitespace_in_name = utils::new_c_string("whitespace")?;
8186
8187 let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8188 let separator_in_name = utils::new_c_string("separator")?;
8189
8190 let flags_in: i32 = csvload_options.flags as i32;
8191 let flags_in_name = utils::new_c_string("flags")?;
8192
8193 let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8194 let memory_in_name = utils::new_c_string("memory")?;
8195
8196 let access_in: i32 = csvload_options.access as i32;
8197 let access_in_name = utils::new_c_string("access")?;
8198
8199 let fail_on_in: i32 = csvload_options.fail_on as i32;
8200 let fail_on_in_name = utils::new_c_string("fail-on")?;
8201
8202 let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8203 let revalidate_in_name = utils::new_c_string("revalidate")?;
8204
8205 let vips_op_response = bindings::vips_csvload(
8206 filename_in.as_ptr(),
8207 &mut out_out,
8208 skip_in_name.as_ptr(),
8209 skip_in,
8210 lines_in_name.as_ptr(),
8211 lines_in,
8212 whitespace_in_name.as_ptr(),
8213 whitespace_in.as_ptr(),
8214 separator_in_name.as_ptr(),
8215 separator_in.as_ptr(),
8216 flags_in_name.as_ptr(),
8217 flags_in,
8218 memory_in_name.as_ptr(),
8219 memory_in,
8220 access_in_name.as_ptr(),
8221 access_in,
8222 fail_on_in_name.as_ptr(),
8223 fail_on_in,
8224 revalidate_in_name.as_ptr(),
8225 revalidate_in,
8226 NULL,
8227 );
8228 utils::result(
8229 vips_op_response,
8230 VipsImage { ctx: out_out },
8231 Error::CsvloadError,
8232 )
8233 }
8234}
8235
8236pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8240 unsafe {
8241 let source_in: *mut bindings::VipsSource = source.ctx;
8242 let mut out_out: *mut bindings::VipsImage = null_mut();
8243
8244 let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8245 utils::result(
8246 vips_op_response,
8247 VipsImage { ctx: out_out },
8248 Error::CsvloadSourceError,
8249 )
8250 }
8251}
8252
8253#[derive(Clone, Debug)]
8255pub struct CsvloadSourceOptions {
8256 pub skip: i32,
8259 pub lines: i32,
8262 pub whitespace: String,
8264 pub separator: String,
8266 pub flags: ForeignFlags,
8273 pub memory: bool,
8276 pub access: Access,
8282 pub fail_on: FailOn,
8289 pub revalidate: bool,
8292}
8293
8294impl std::default::Default for CsvloadSourceOptions {
8295 fn default() -> Self {
8296 CsvloadSourceOptions {
8297 skip: i32::from(0),
8298 lines: i32::from(0),
8299 whitespace: String::new(),
8300 separator: String::new(),
8301 flags: ForeignFlags::None,
8302 memory: false,
8303 access: Access::Random,
8304 fail_on: FailOn::None,
8305 revalidate: false,
8306 }
8307 }
8308}
8309
8310pub fn csvload_source_with_opts(
8315 source: &VipsSource,
8316 csvload_source_options: &CsvloadSourceOptions,
8317) -> Result<VipsImage> {
8318 unsafe {
8319 let source_in: *mut bindings::VipsSource = source.ctx;
8320 let mut out_out: *mut bindings::VipsImage = null_mut();
8321
8322 let skip_in: i32 = csvload_source_options.skip;
8323 let skip_in_name = utils::new_c_string("skip")?;
8324
8325 let lines_in: i32 = csvload_source_options.lines;
8326 let lines_in_name = utils::new_c_string("lines")?;
8327
8328 let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8329 let whitespace_in_name = utils::new_c_string("whitespace")?;
8330
8331 let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8332 let separator_in_name = utils::new_c_string("separator")?;
8333
8334 let flags_in: i32 = csvload_source_options.flags as i32;
8335 let flags_in_name = utils::new_c_string("flags")?;
8336
8337 let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8338 let memory_in_name = utils::new_c_string("memory")?;
8339
8340 let access_in: i32 = csvload_source_options.access as i32;
8341 let access_in_name = utils::new_c_string("access")?;
8342
8343 let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8344 let fail_on_in_name = utils::new_c_string("fail-on")?;
8345
8346 let revalidate_in: i32 = if csvload_source_options.revalidate {
8347 1
8348 } else {
8349 0
8350 };
8351 let revalidate_in_name = utils::new_c_string("revalidate")?;
8352
8353 let vips_op_response = bindings::vips_csvload_source(
8354 source_in,
8355 &mut out_out,
8356 skip_in_name.as_ptr(),
8357 skip_in,
8358 lines_in_name.as_ptr(),
8359 lines_in,
8360 whitespace_in_name.as_ptr(),
8361 whitespace_in.as_ptr(),
8362 separator_in_name.as_ptr(),
8363 separator_in.as_ptr(),
8364 flags_in_name.as_ptr(),
8365 flags_in,
8366 memory_in_name.as_ptr(),
8367 memory_in,
8368 access_in_name.as_ptr(),
8369 access_in,
8370 fail_on_in_name.as_ptr(),
8371 fail_on_in,
8372 revalidate_in_name.as_ptr(),
8373 revalidate_in,
8374 NULL,
8375 );
8376 utils::result(
8377 vips_op_response,
8378 VipsImage { ctx: out_out },
8379 Error::CsvloadSourceError,
8380 )
8381 }
8382}
8383
8384pub fn matrixload(filename: &str) -> Result<VipsImage> {
8388 unsafe {
8389 let filename_in: CString = utils::new_c_string(filename)?;
8390 let mut out_out: *mut bindings::VipsImage = null_mut();
8391
8392 let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8393 utils::result(
8394 vips_op_response,
8395 VipsImage { ctx: out_out },
8396 Error::MatrixloadError,
8397 )
8398 }
8399}
8400
8401#[derive(Clone, Debug)]
8403pub struct MatrixloadOptions {
8404 pub flags: ForeignFlags,
8411 pub memory: bool,
8414 pub access: Access,
8420 pub fail_on: FailOn,
8427 pub revalidate: bool,
8430}
8431
8432impl std::default::Default for MatrixloadOptions {
8433 fn default() -> Self {
8434 MatrixloadOptions {
8435 flags: ForeignFlags::None,
8436 memory: false,
8437 access: Access::Random,
8438 fail_on: FailOn::None,
8439 revalidate: false,
8440 }
8441 }
8442}
8443
8444pub fn matrixload_with_opts(
8449 filename: &str,
8450 matrixload_options: &MatrixloadOptions,
8451) -> Result<VipsImage> {
8452 unsafe {
8453 let filename_in: CString = utils::new_c_string(filename)?;
8454 let mut out_out: *mut bindings::VipsImage = null_mut();
8455
8456 let flags_in: i32 = matrixload_options.flags as i32;
8457 let flags_in_name = utils::new_c_string("flags")?;
8458
8459 let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8460 let memory_in_name = utils::new_c_string("memory")?;
8461
8462 let access_in: i32 = matrixload_options.access as i32;
8463 let access_in_name = utils::new_c_string("access")?;
8464
8465 let fail_on_in: i32 = matrixload_options.fail_on as i32;
8466 let fail_on_in_name = utils::new_c_string("fail-on")?;
8467
8468 let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8469 let revalidate_in_name = utils::new_c_string("revalidate")?;
8470
8471 let vips_op_response = bindings::vips_matrixload(
8472 filename_in.as_ptr(),
8473 &mut out_out,
8474 flags_in_name.as_ptr(),
8475 flags_in,
8476 memory_in_name.as_ptr(),
8477 memory_in,
8478 access_in_name.as_ptr(),
8479 access_in,
8480 fail_on_in_name.as_ptr(),
8481 fail_on_in,
8482 revalidate_in_name.as_ptr(),
8483 revalidate_in,
8484 NULL,
8485 );
8486 utils::result(
8487 vips_op_response,
8488 VipsImage { ctx: out_out },
8489 Error::MatrixloadError,
8490 )
8491 }
8492}
8493
8494pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8498 unsafe {
8499 let source_in: *mut bindings::VipsSource = source.ctx;
8500 let mut out_out: *mut bindings::VipsImage = null_mut();
8501
8502 let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8503 utils::result(
8504 vips_op_response,
8505 VipsImage { ctx: out_out },
8506 Error::MatrixloadSourceError,
8507 )
8508 }
8509}
8510
8511#[derive(Clone, Debug)]
8513pub struct MatrixloadSourceOptions {
8514 pub flags: ForeignFlags,
8521 pub memory: bool,
8524 pub access: Access,
8530 pub fail_on: FailOn,
8537 pub revalidate: bool,
8540}
8541
8542impl std::default::Default for MatrixloadSourceOptions {
8543 fn default() -> Self {
8544 MatrixloadSourceOptions {
8545 flags: ForeignFlags::None,
8546 memory: false,
8547 access: Access::Random,
8548 fail_on: FailOn::None,
8549 revalidate: false,
8550 }
8551 }
8552}
8553
8554pub fn matrixload_source_with_opts(
8559 source: &VipsSource,
8560 matrixload_source_options: &MatrixloadSourceOptions,
8561) -> Result<VipsImage> {
8562 unsafe {
8563 let source_in: *mut bindings::VipsSource = source.ctx;
8564 let mut out_out: *mut bindings::VipsImage = null_mut();
8565
8566 let flags_in: i32 = matrixload_source_options.flags as i32;
8567 let flags_in_name = utils::new_c_string("flags")?;
8568
8569 let memory_in: i32 = if matrixload_source_options.memory {
8570 1
8571 } else {
8572 0
8573 };
8574 let memory_in_name = utils::new_c_string("memory")?;
8575
8576 let access_in: i32 = matrixload_source_options.access as i32;
8577 let access_in_name = utils::new_c_string("access")?;
8578
8579 let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8580 let fail_on_in_name = utils::new_c_string("fail-on")?;
8581
8582 let revalidate_in: i32 = if matrixload_source_options.revalidate {
8583 1
8584 } else {
8585 0
8586 };
8587 let revalidate_in_name = utils::new_c_string("revalidate")?;
8588
8589 let vips_op_response = bindings::vips_matrixload_source(
8590 source_in,
8591 &mut out_out,
8592 flags_in_name.as_ptr(),
8593 flags_in,
8594 memory_in_name.as_ptr(),
8595 memory_in,
8596 access_in_name.as_ptr(),
8597 access_in,
8598 fail_on_in_name.as_ptr(),
8599 fail_on_in,
8600 revalidate_in_name.as_ptr(),
8601 revalidate_in,
8602 NULL,
8603 );
8604 utils::result(
8605 vips_op_response,
8606 VipsImage { ctx: out_out },
8607 Error::MatrixloadSourceError,
8608 )
8609 }
8610}
8611
8612pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8622 unsafe {
8623 let filename_in: CString = utils::new_c_string(filename)?;
8624 let width_in: i32 = width;
8625 let height_in: i32 = height;
8626 let bands_in: i32 = bands;
8627 let mut out_out: *mut bindings::VipsImage = null_mut();
8628
8629 let vips_op_response = bindings::vips_rawload(
8630 filename_in.as_ptr(),
8631 &mut out_out,
8632 width_in,
8633 height_in,
8634 bands_in,
8635 NULL,
8636 );
8637 utils::result(
8638 vips_op_response,
8639 VipsImage { ctx: out_out },
8640 Error::RawloadError,
8641 )
8642 }
8643}
8644
8645#[derive(Clone, Debug)]
8647pub struct RawloadOptions {
8648 pub offset: u64,
8651 pub format: BandFormat,
8665 pub interpretation: Interpretation,
8688 pub flags: ForeignFlags,
8695 pub memory: bool,
8698 pub access: Access,
8704 pub fail_on: FailOn,
8711 pub revalidate: bool,
8714}
8715
8716impl std::default::Default for RawloadOptions {
8717 fn default() -> Self {
8718 RawloadOptions {
8719 offset: 0,
8720 format: BandFormat::Uchar,
8721 interpretation: Interpretation::Multiband,
8722 flags: ForeignFlags::None,
8723 memory: false,
8724 access: Access::Random,
8725 fail_on: FailOn::None,
8726 revalidate: false,
8727 }
8728 }
8729}
8730
8731pub fn rawload_with_opts(
8742 filename: &str,
8743 width: i32,
8744 height: i32,
8745 bands: i32,
8746 rawload_options: &RawloadOptions,
8747) -> Result<VipsImage> {
8748 unsafe {
8749 let filename_in: CString = utils::new_c_string(filename)?;
8750 let width_in: i32 = width;
8751 let height_in: i32 = height;
8752 let bands_in: i32 = bands;
8753 let mut out_out: *mut bindings::VipsImage = null_mut();
8754
8755 let offset_in: u64 = rawload_options.offset;
8756 let offset_in_name = utils::new_c_string("offset")?;
8757
8758 let format_in: i32 = rawload_options.format as i32;
8759 let format_in_name = utils::new_c_string("format")?;
8760
8761 let interpretation_in: i32 = rawload_options.interpretation as i32;
8762 let interpretation_in_name = utils::new_c_string("interpretation")?;
8763
8764 let flags_in: i32 = rawload_options.flags as i32;
8765 let flags_in_name = utils::new_c_string("flags")?;
8766
8767 let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8768 let memory_in_name = utils::new_c_string("memory")?;
8769
8770 let access_in: i32 = rawload_options.access as i32;
8771 let access_in_name = utils::new_c_string("access")?;
8772
8773 let fail_on_in: i32 = rawload_options.fail_on as i32;
8774 let fail_on_in_name = utils::new_c_string("fail-on")?;
8775
8776 let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8777 let revalidate_in_name = utils::new_c_string("revalidate")?;
8778
8779 let vips_op_response = bindings::vips_rawload(
8780 filename_in.as_ptr(),
8781 &mut out_out,
8782 width_in,
8783 height_in,
8784 bands_in,
8785 offset_in_name.as_ptr(),
8786 offset_in,
8787 format_in_name.as_ptr(),
8788 format_in,
8789 interpretation_in_name.as_ptr(),
8790 interpretation_in,
8791 flags_in_name.as_ptr(),
8792 flags_in,
8793 memory_in_name.as_ptr(),
8794 memory_in,
8795 access_in_name.as_ptr(),
8796 access_in,
8797 fail_on_in_name.as_ptr(),
8798 fail_on_in,
8799 revalidate_in_name.as_ptr(),
8800 revalidate_in,
8801 NULL,
8802 );
8803 utils::result(
8804 vips_op_response,
8805 VipsImage { ctx: out_out },
8806 Error::RawloadError,
8807 )
8808 }
8809}
8810
8811pub fn vipsload(filename: &str) -> Result<VipsImage> {
8815 unsafe {
8816 let filename_in: CString = utils::new_c_string(filename)?;
8817 let mut out_out: *mut bindings::VipsImage = null_mut();
8818
8819 let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
8820 utils::result(
8821 vips_op_response,
8822 VipsImage { ctx: out_out },
8823 Error::VipsloadError,
8824 )
8825 }
8826}
8827
8828#[derive(Clone, Debug)]
8830pub struct VipsloadOptions {
8831 pub flags: ForeignFlags,
8838 pub memory: bool,
8841 pub access: Access,
8847 pub fail_on: FailOn,
8854 pub revalidate: bool,
8857}
8858
8859impl std::default::Default for VipsloadOptions {
8860 fn default() -> Self {
8861 VipsloadOptions {
8862 flags: ForeignFlags::None,
8863 memory: false,
8864 access: Access::Random,
8865 fail_on: FailOn::None,
8866 revalidate: false,
8867 }
8868 }
8869}
8870
8871pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
8876 unsafe {
8877 let filename_in: CString = utils::new_c_string(filename)?;
8878 let mut out_out: *mut bindings::VipsImage = null_mut();
8879
8880 let flags_in: i32 = vipsload_options.flags as i32;
8881 let flags_in_name = utils::new_c_string("flags")?;
8882
8883 let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
8884 let memory_in_name = utils::new_c_string("memory")?;
8885
8886 let access_in: i32 = vipsload_options.access as i32;
8887 let access_in_name = utils::new_c_string("access")?;
8888
8889 let fail_on_in: i32 = vipsload_options.fail_on as i32;
8890 let fail_on_in_name = utils::new_c_string("fail-on")?;
8891
8892 let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
8893 let revalidate_in_name = utils::new_c_string("revalidate")?;
8894
8895 let vips_op_response = bindings::vips_vipsload(
8896 filename_in.as_ptr(),
8897 &mut out_out,
8898 flags_in_name.as_ptr(),
8899 flags_in,
8900 memory_in_name.as_ptr(),
8901 memory_in,
8902 access_in_name.as_ptr(),
8903 access_in,
8904 fail_on_in_name.as_ptr(),
8905 fail_on_in,
8906 revalidate_in_name.as_ptr(),
8907 revalidate_in,
8908 NULL,
8909 );
8910 utils::result(
8911 vips_op_response,
8912 VipsImage { ctx: out_out },
8913 Error::VipsloadError,
8914 )
8915 }
8916}
8917
8918pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
8922 unsafe {
8923 let source_in: *mut bindings::VipsSource = source.ctx;
8924 let mut out_out: *mut bindings::VipsImage = null_mut();
8925
8926 let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
8927 utils::result(
8928 vips_op_response,
8929 VipsImage { ctx: out_out },
8930 Error::VipsloadSourceError,
8931 )
8932 }
8933}
8934
8935#[derive(Clone, Debug)]
8937pub struct VipsloadSourceOptions {
8938 pub flags: ForeignFlags,
8945 pub memory: bool,
8948 pub access: Access,
8954 pub fail_on: FailOn,
8961 pub revalidate: bool,
8964}
8965
8966impl std::default::Default for VipsloadSourceOptions {
8967 fn default() -> Self {
8968 VipsloadSourceOptions {
8969 flags: ForeignFlags::None,
8970 memory: false,
8971 access: Access::Random,
8972 fail_on: FailOn::None,
8973 revalidate: false,
8974 }
8975 }
8976}
8977
8978pub fn vipsload_source_with_opts(
8983 source: &VipsSource,
8984 vipsload_source_options: &VipsloadSourceOptions,
8985) -> Result<VipsImage> {
8986 unsafe {
8987 let source_in: *mut bindings::VipsSource = source.ctx;
8988 let mut out_out: *mut bindings::VipsImage = null_mut();
8989
8990 let flags_in: i32 = vipsload_source_options.flags as i32;
8991 let flags_in_name = utils::new_c_string("flags")?;
8992
8993 let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
8994 let memory_in_name = utils::new_c_string("memory")?;
8995
8996 let access_in: i32 = vipsload_source_options.access as i32;
8997 let access_in_name = utils::new_c_string("access")?;
8998
8999 let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9000 let fail_on_in_name = utils::new_c_string("fail-on")?;
9001
9002 let revalidate_in: i32 = if vipsload_source_options.revalidate {
9003 1
9004 } else {
9005 0
9006 };
9007 let revalidate_in_name = utils::new_c_string("revalidate")?;
9008
9009 let vips_op_response = bindings::vips_vipsload_source(
9010 source_in,
9011 &mut out_out,
9012 flags_in_name.as_ptr(),
9013 flags_in,
9014 memory_in_name.as_ptr(),
9015 memory_in,
9016 access_in_name.as_ptr(),
9017 access_in,
9018 fail_on_in_name.as_ptr(),
9019 fail_on_in,
9020 revalidate_in_name.as_ptr(),
9021 revalidate_in,
9022 NULL,
9023 );
9024 utils::result(
9025 vips_op_response,
9026 VipsImage { ctx: out_out },
9027 Error::VipsloadSourceError,
9028 )
9029 }
9030}
9031
9032pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9036 unsafe {
9037 let filename_in: CString = utils::new_c_string(filename)?;
9038 let mut out_out: *mut bindings::VipsImage = null_mut();
9039
9040 let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9041 utils::result(
9042 vips_op_response,
9043 VipsImage { ctx: out_out },
9044 Error::AnalyzeloadError,
9045 )
9046 }
9047}
9048
9049#[derive(Clone, Debug)]
9051pub struct AnalyzeloadOptions {
9052 pub flags: ForeignFlags,
9059 pub memory: bool,
9062 pub access: Access,
9068 pub fail_on: FailOn,
9075 pub revalidate: bool,
9078}
9079
9080impl std::default::Default for AnalyzeloadOptions {
9081 fn default() -> Self {
9082 AnalyzeloadOptions {
9083 flags: ForeignFlags::None,
9084 memory: false,
9085 access: Access::Random,
9086 fail_on: FailOn::None,
9087 revalidate: false,
9088 }
9089 }
9090}
9091
9092pub fn analyzeload_with_opts(
9097 filename: &str,
9098 analyzeload_options: &AnalyzeloadOptions,
9099) -> Result<VipsImage> {
9100 unsafe {
9101 let filename_in: CString = utils::new_c_string(filename)?;
9102 let mut out_out: *mut bindings::VipsImage = null_mut();
9103
9104 let flags_in: i32 = analyzeload_options.flags as i32;
9105 let flags_in_name = utils::new_c_string("flags")?;
9106
9107 let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9108 let memory_in_name = utils::new_c_string("memory")?;
9109
9110 let access_in: i32 = analyzeload_options.access as i32;
9111 let access_in_name = utils::new_c_string("access")?;
9112
9113 let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9114 let fail_on_in_name = utils::new_c_string("fail-on")?;
9115
9116 let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9117 let revalidate_in_name = utils::new_c_string("revalidate")?;
9118
9119 let vips_op_response = bindings::vips_analyzeload(
9120 filename_in.as_ptr(),
9121 &mut out_out,
9122 flags_in_name.as_ptr(),
9123 flags_in,
9124 memory_in_name.as_ptr(),
9125 memory_in,
9126 access_in_name.as_ptr(),
9127 access_in,
9128 fail_on_in_name.as_ptr(),
9129 fail_on_in,
9130 revalidate_in_name.as_ptr(),
9131 revalidate_in,
9132 NULL,
9133 );
9134 utils::result(
9135 vips_op_response,
9136 VipsImage { ctx: out_out },
9137 Error::AnalyzeloadError,
9138 )
9139 }
9140}
9141
9142pub fn ppmload(filename: &str) -> Result<VipsImage> {
9146 unsafe {
9147 let filename_in: CString = utils::new_c_string(filename)?;
9148 let mut out_out: *mut bindings::VipsImage = null_mut();
9149
9150 let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9151 utils::result(
9152 vips_op_response,
9153 VipsImage { ctx: out_out },
9154 Error::PpmloadError,
9155 )
9156 }
9157}
9158
9159#[derive(Clone, Debug)]
9161pub struct PpmloadOptions {
9162 pub flags: ForeignFlags,
9169 pub memory: bool,
9172 pub access: Access,
9178 pub fail_on: FailOn,
9185 pub revalidate: bool,
9188}
9189
9190impl std::default::Default for PpmloadOptions {
9191 fn default() -> Self {
9192 PpmloadOptions {
9193 flags: ForeignFlags::None,
9194 memory: false,
9195 access: Access::Random,
9196 fail_on: FailOn::None,
9197 revalidate: false,
9198 }
9199 }
9200}
9201
9202pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9207 unsafe {
9208 let filename_in: CString = utils::new_c_string(filename)?;
9209 let mut out_out: *mut bindings::VipsImage = null_mut();
9210
9211 let flags_in: i32 = ppmload_options.flags as i32;
9212 let flags_in_name = utils::new_c_string("flags")?;
9213
9214 let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9215 let memory_in_name = utils::new_c_string("memory")?;
9216
9217 let access_in: i32 = ppmload_options.access as i32;
9218 let access_in_name = utils::new_c_string("access")?;
9219
9220 let fail_on_in: i32 = ppmload_options.fail_on as i32;
9221 let fail_on_in_name = utils::new_c_string("fail-on")?;
9222
9223 let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9224 let revalidate_in_name = utils::new_c_string("revalidate")?;
9225
9226 let vips_op_response = bindings::vips_ppmload(
9227 filename_in.as_ptr(),
9228 &mut out_out,
9229 flags_in_name.as_ptr(),
9230 flags_in,
9231 memory_in_name.as_ptr(),
9232 memory_in,
9233 access_in_name.as_ptr(),
9234 access_in,
9235 fail_on_in_name.as_ptr(),
9236 fail_on_in,
9237 revalidate_in_name.as_ptr(),
9238 revalidate_in,
9239 NULL,
9240 );
9241 utils::result(
9242 vips_op_response,
9243 VipsImage { ctx: out_out },
9244 Error::PpmloadError,
9245 )
9246 }
9247}
9248
9249pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9253 unsafe {
9254 let source_in: *mut bindings::VipsSource = source.ctx;
9255 let mut out_out: *mut bindings::VipsImage = null_mut();
9256
9257 let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9258 utils::result(
9259 vips_op_response,
9260 VipsImage { ctx: out_out },
9261 Error::PpmloadSourceError,
9262 )
9263 }
9264}
9265
9266#[derive(Clone, Debug)]
9268pub struct PpmloadSourceOptions {
9269 pub flags: ForeignFlags,
9276 pub memory: bool,
9279 pub access: Access,
9285 pub fail_on: FailOn,
9292 pub revalidate: bool,
9295}
9296
9297impl std::default::Default for PpmloadSourceOptions {
9298 fn default() -> Self {
9299 PpmloadSourceOptions {
9300 flags: ForeignFlags::None,
9301 memory: false,
9302 access: Access::Random,
9303 fail_on: FailOn::None,
9304 revalidate: false,
9305 }
9306 }
9307}
9308
9309pub fn ppmload_source_with_opts(
9314 source: &VipsSource,
9315 ppmload_source_options: &PpmloadSourceOptions,
9316) -> Result<VipsImage> {
9317 unsafe {
9318 let source_in: *mut bindings::VipsSource = source.ctx;
9319 let mut out_out: *mut bindings::VipsImage = null_mut();
9320
9321 let flags_in: i32 = ppmload_source_options.flags as i32;
9322 let flags_in_name = utils::new_c_string("flags")?;
9323
9324 let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9325 let memory_in_name = utils::new_c_string("memory")?;
9326
9327 let access_in: i32 = ppmload_source_options.access as i32;
9328 let access_in_name = utils::new_c_string("access")?;
9329
9330 let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9331 let fail_on_in_name = utils::new_c_string("fail-on")?;
9332
9333 let revalidate_in: i32 = if ppmload_source_options.revalidate {
9334 1
9335 } else {
9336 0
9337 };
9338 let revalidate_in_name = utils::new_c_string("revalidate")?;
9339
9340 let vips_op_response = bindings::vips_ppmload_source(
9341 source_in,
9342 &mut out_out,
9343 flags_in_name.as_ptr(),
9344 flags_in,
9345 memory_in_name.as_ptr(),
9346 memory_in,
9347 access_in_name.as_ptr(),
9348 access_in,
9349 fail_on_in_name.as_ptr(),
9350 fail_on_in,
9351 revalidate_in_name.as_ptr(),
9352 revalidate_in,
9353 NULL,
9354 );
9355 utils::result(
9356 vips_op_response,
9357 VipsImage { ctx: out_out },
9358 Error::PpmloadSourceError,
9359 )
9360 }
9361}
9362
9363pub fn radload(filename: &str) -> Result<VipsImage> {
9367 unsafe {
9368 let filename_in: CString = utils::new_c_string(filename)?;
9369 let mut out_out: *mut bindings::VipsImage = null_mut();
9370
9371 let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9372 utils::result(
9373 vips_op_response,
9374 VipsImage { ctx: out_out },
9375 Error::RadloadError,
9376 )
9377 }
9378}
9379
9380#[derive(Clone, Debug)]
9382pub struct RadloadOptions {
9383 pub flags: ForeignFlags,
9390 pub memory: bool,
9393 pub access: Access,
9399 pub fail_on: FailOn,
9406 pub revalidate: bool,
9409}
9410
9411impl std::default::Default for RadloadOptions {
9412 fn default() -> Self {
9413 RadloadOptions {
9414 flags: ForeignFlags::None,
9415 memory: false,
9416 access: Access::Random,
9417 fail_on: FailOn::None,
9418 revalidate: false,
9419 }
9420 }
9421}
9422
9423pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9428 unsafe {
9429 let filename_in: CString = utils::new_c_string(filename)?;
9430 let mut out_out: *mut bindings::VipsImage = null_mut();
9431
9432 let flags_in: i32 = radload_options.flags as i32;
9433 let flags_in_name = utils::new_c_string("flags")?;
9434
9435 let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9436 let memory_in_name = utils::new_c_string("memory")?;
9437
9438 let access_in: i32 = radload_options.access as i32;
9439 let access_in_name = utils::new_c_string("access")?;
9440
9441 let fail_on_in: i32 = radload_options.fail_on as i32;
9442 let fail_on_in_name = utils::new_c_string("fail-on")?;
9443
9444 let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9445 let revalidate_in_name = utils::new_c_string("revalidate")?;
9446
9447 let vips_op_response = bindings::vips_radload(
9448 filename_in.as_ptr(),
9449 &mut out_out,
9450 flags_in_name.as_ptr(),
9451 flags_in,
9452 memory_in_name.as_ptr(),
9453 memory_in,
9454 access_in_name.as_ptr(),
9455 access_in,
9456 fail_on_in_name.as_ptr(),
9457 fail_on_in,
9458 revalidate_in_name.as_ptr(),
9459 revalidate_in,
9460 NULL,
9461 );
9462 utils::result(
9463 vips_op_response,
9464 VipsImage { ctx: out_out },
9465 Error::RadloadError,
9466 )
9467 }
9468}
9469
9470pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9474 unsafe {
9475 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9476 let mut out_out: *mut bindings::VipsImage = null_mut();
9477
9478 let vips_op_response =
9479 bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9480 utils::result(
9481 vips_op_response,
9482 VipsImage { ctx: out_out },
9483 Error::RadloadBufferError,
9484 )
9485 }
9486}
9487
9488#[derive(Clone, Debug)]
9490pub struct RadloadBufferOptions {
9491 pub flags: ForeignFlags,
9498 pub memory: bool,
9501 pub access: Access,
9507 pub fail_on: FailOn,
9514 pub revalidate: bool,
9517}
9518
9519impl std::default::Default for RadloadBufferOptions {
9520 fn default() -> Self {
9521 RadloadBufferOptions {
9522 flags: ForeignFlags::None,
9523 memory: false,
9524 access: Access::Random,
9525 fail_on: FailOn::None,
9526 revalidate: false,
9527 }
9528 }
9529}
9530
9531pub fn radload_buffer_with_opts(
9536 buffer: &[u8],
9537 radload_buffer_options: &RadloadBufferOptions,
9538) -> Result<VipsImage> {
9539 unsafe {
9540 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9541 let mut out_out: *mut bindings::VipsImage = null_mut();
9542
9543 let flags_in: i32 = radload_buffer_options.flags as i32;
9544 let flags_in_name = utils::new_c_string("flags")?;
9545
9546 let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9547 let memory_in_name = utils::new_c_string("memory")?;
9548
9549 let access_in: i32 = radload_buffer_options.access as i32;
9550 let access_in_name = utils::new_c_string("access")?;
9551
9552 let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9553 let fail_on_in_name = utils::new_c_string("fail-on")?;
9554
9555 let revalidate_in: i32 = if radload_buffer_options.revalidate {
9556 1
9557 } else {
9558 0
9559 };
9560 let revalidate_in_name = utils::new_c_string("revalidate")?;
9561
9562 let vips_op_response = bindings::vips_radload_buffer(
9563 buffer_in,
9564 buffer.len() as u64,
9565 &mut out_out,
9566 flags_in_name.as_ptr(),
9567 flags_in,
9568 memory_in_name.as_ptr(),
9569 memory_in,
9570 access_in_name.as_ptr(),
9571 access_in,
9572 fail_on_in_name.as_ptr(),
9573 fail_on_in,
9574 revalidate_in_name.as_ptr(),
9575 revalidate_in,
9576 NULL,
9577 );
9578 utils::result(
9579 vips_op_response,
9580 VipsImage { ctx: out_out },
9581 Error::RadloadBufferError,
9582 )
9583 }
9584}
9585
9586pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9590 unsafe {
9591 let source_in: *mut bindings::VipsSource = source.ctx;
9592 let mut out_out: *mut bindings::VipsImage = null_mut();
9593
9594 let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9595 utils::result(
9596 vips_op_response,
9597 VipsImage { ctx: out_out },
9598 Error::RadloadSourceError,
9599 )
9600 }
9601}
9602
9603#[derive(Clone, Debug)]
9605pub struct RadloadSourceOptions {
9606 pub flags: ForeignFlags,
9613 pub memory: bool,
9616 pub access: Access,
9622 pub fail_on: FailOn,
9629 pub revalidate: bool,
9632}
9633
9634impl std::default::Default for RadloadSourceOptions {
9635 fn default() -> Self {
9636 RadloadSourceOptions {
9637 flags: ForeignFlags::None,
9638 memory: false,
9639 access: Access::Random,
9640 fail_on: FailOn::None,
9641 revalidate: false,
9642 }
9643 }
9644}
9645
9646pub fn radload_source_with_opts(
9651 source: &VipsSource,
9652 radload_source_options: &RadloadSourceOptions,
9653) -> Result<VipsImage> {
9654 unsafe {
9655 let source_in: *mut bindings::VipsSource = source.ctx;
9656 let mut out_out: *mut bindings::VipsImage = null_mut();
9657
9658 let flags_in: i32 = radload_source_options.flags as i32;
9659 let flags_in_name = utils::new_c_string("flags")?;
9660
9661 let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9662 let memory_in_name = utils::new_c_string("memory")?;
9663
9664 let access_in: i32 = radload_source_options.access as i32;
9665 let access_in_name = utils::new_c_string("access")?;
9666
9667 let fail_on_in: i32 = radload_source_options.fail_on as i32;
9668 let fail_on_in_name = utils::new_c_string("fail-on")?;
9669
9670 let revalidate_in: i32 = if radload_source_options.revalidate {
9671 1
9672 } else {
9673 0
9674 };
9675 let revalidate_in_name = utils::new_c_string("revalidate")?;
9676
9677 let vips_op_response = bindings::vips_radload_source(
9678 source_in,
9679 &mut out_out,
9680 flags_in_name.as_ptr(),
9681 flags_in,
9682 memory_in_name.as_ptr(),
9683 memory_in,
9684 access_in_name.as_ptr(),
9685 access_in,
9686 fail_on_in_name.as_ptr(),
9687 fail_on_in,
9688 revalidate_in_name.as_ptr(),
9689 revalidate_in,
9690 NULL,
9691 );
9692 utils::result(
9693 vips_op_response,
9694 VipsImage { ctx: out_out },
9695 Error::RadloadSourceError,
9696 )
9697 }
9698}
9699
9700pub fn svgload(filename: &str) -> Result<VipsImage> {
9704 unsafe {
9705 let filename_in: CString = utils::new_c_string(filename)?;
9706 let mut out_out: *mut bindings::VipsImage = null_mut();
9707
9708 let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9709 utils::result(
9710 vips_op_response,
9711 VipsImage { ctx: out_out },
9712 Error::SvgloadError,
9713 )
9714 }
9715}
9716
9717#[derive(Clone, Debug)]
9719pub struct SvgloadOptions {
9720 pub dpi: f64,
9723 pub scale: f64,
9726 pub unlimited: bool,
9729 pub flags: ForeignFlags,
9736 pub memory: bool,
9739 pub access: Access,
9745 pub fail_on: FailOn,
9752 pub revalidate: bool,
9755}
9756
9757impl std::default::Default for SvgloadOptions {
9758 fn default() -> Self {
9759 SvgloadOptions {
9760 dpi: f64::from(72),
9761 scale: f64::from(1),
9762 unlimited: false,
9763 flags: ForeignFlags::None,
9764 memory: false,
9765 access: Access::Random,
9766 fail_on: FailOn::None,
9767 revalidate: false,
9768 }
9769 }
9770}
9771
9772pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9777 unsafe {
9778 let filename_in: CString = utils::new_c_string(filename)?;
9779 let mut out_out: *mut bindings::VipsImage = null_mut();
9780
9781 let dpi_in: f64 = svgload_options.dpi;
9782 let dpi_in_name = utils::new_c_string("dpi")?;
9783
9784 let scale_in: f64 = svgload_options.scale;
9785 let scale_in_name = utils::new_c_string("scale")?;
9786
9787 let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9788 let unlimited_in_name = utils::new_c_string("unlimited")?;
9789
9790 let flags_in: i32 = svgload_options.flags as i32;
9791 let flags_in_name = utils::new_c_string("flags")?;
9792
9793 let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9794 let memory_in_name = utils::new_c_string("memory")?;
9795
9796 let access_in: i32 = svgload_options.access as i32;
9797 let access_in_name = utils::new_c_string("access")?;
9798
9799 let fail_on_in: i32 = svgload_options.fail_on as i32;
9800 let fail_on_in_name = utils::new_c_string("fail-on")?;
9801
9802 let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9803 let revalidate_in_name = utils::new_c_string("revalidate")?;
9804
9805 let vips_op_response = bindings::vips_svgload(
9806 filename_in.as_ptr(),
9807 &mut out_out,
9808 dpi_in_name.as_ptr(),
9809 dpi_in,
9810 scale_in_name.as_ptr(),
9811 scale_in,
9812 unlimited_in_name.as_ptr(),
9813 unlimited_in,
9814 flags_in_name.as_ptr(),
9815 flags_in,
9816 memory_in_name.as_ptr(),
9817 memory_in,
9818 access_in_name.as_ptr(),
9819 access_in,
9820 fail_on_in_name.as_ptr(),
9821 fail_on_in,
9822 revalidate_in_name.as_ptr(),
9823 revalidate_in,
9824 NULL,
9825 );
9826 utils::result(
9827 vips_op_response,
9828 VipsImage { ctx: out_out },
9829 Error::SvgloadError,
9830 )
9831 }
9832}
9833
9834pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9838 unsafe {
9839 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9840 let mut out_out: *mut bindings::VipsImage = null_mut();
9841
9842 let vips_op_response =
9843 bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9844 utils::result(
9845 vips_op_response,
9846 VipsImage { ctx: out_out },
9847 Error::SvgloadBufferError,
9848 )
9849 }
9850}
9851
9852#[derive(Clone, Debug)]
9854pub struct SvgloadBufferOptions {
9855 pub dpi: f64,
9858 pub scale: f64,
9861 pub unlimited: bool,
9864 pub flags: ForeignFlags,
9871 pub memory: bool,
9874 pub access: Access,
9880 pub fail_on: FailOn,
9887 pub revalidate: bool,
9890}
9891
9892impl std::default::Default for SvgloadBufferOptions {
9893 fn default() -> Self {
9894 SvgloadBufferOptions {
9895 dpi: f64::from(72),
9896 scale: f64::from(1),
9897 unlimited: false,
9898 flags: ForeignFlags::None,
9899 memory: false,
9900 access: Access::Random,
9901 fail_on: FailOn::None,
9902 revalidate: false,
9903 }
9904 }
9905}
9906
9907pub fn svgload_buffer_with_opts(
9912 buffer: &[u8],
9913 svgload_buffer_options: &SvgloadBufferOptions,
9914) -> Result<VipsImage> {
9915 unsafe {
9916 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9917 let mut out_out: *mut bindings::VipsImage = null_mut();
9918
9919 let dpi_in: f64 = svgload_buffer_options.dpi;
9920 let dpi_in_name = utils::new_c_string("dpi")?;
9921
9922 let scale_in: f64 = svgload_buffer_options.scale;
9923 let scale_in_name = utils::new_c_string("scale")?;
9924
9925 let unlimited_in: i32 = if svgload_buffer_options.unlimited {
9926 1
9927 } else {
9928 0
9929 };
9930 let unlimited_in_name = utils::new_c_string("unlimited")?;
9931
9932 let flags_in: i32 = svgload_buffer_options.flags as i32;
9933 let flags_in_name = utils::new_c_string("flags")?;
9934
9935 let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
9936 let memory_in_name = utils::new_c_string("memory")?;
9937
9938 let access_in: i32 = svgload_buffer_options.access as i32;
9939 let access_in_name = utils::new_c_string("access")?;
9940
9941 let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
9942 let fail_on_in_name = utils::new_c_string("fail-on")?;
9943
9944 let revalidate_in: i32 = if svgload_buffer_options.revalidate {
9945 1
9946 } else {
9947 0
9948 };
9949 let revalidate_in_name = utils::new_c_string("revalidate")?;
9950
9951 let vips_op_response = bindings::vips_svgload_buffer(
9952 buffer_in,
9953 buffer.len() as u64,
9954 &mut out_out,
9955 dpi_in_name.as_ptr(),
9956 dpi_in,
9957 scale_in_name.as_ptr(),
9958 scale_in,
9959 unlimited_in_name.as_ptr(),
9960 unlimited_in,
9961 flags_in_name.as_ptr(),
9962 flags_in,
9963 memory_in_name.as_ptr(),
9964 memory_in,
9965 access_in_name.as_ptr(),
9966 access_in,
9967 fail_on_in_name.as_ptr(),
9968 fail_on_in,
9969 revalidate_in_name.as_ptr(),
9970 revalidate_in,
9971 NULL,
9972 );
9973 utils::result(
9974 vips_op_response,
9975 VipsImage { ctx: out_out },
9976 Error::SvgloadBufferError,
9977 )
9978 }
9979}
9980
9981pub fn gifload(filename: &str) -> Result<VipsImage> {
9985 unsafe {
9986 let filename_in: CString = utils::new_c_string(filename)?;
9987 let mut out_out: *mut bindings::VipsImage = null_mut();
9988
9989 let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
9990 utils::result(
9991 vips_op_response,
9992 VipsImage { ctx: out_out },
9993 Error::GifloadError,
9994 )
9995 }
9996}
9997
9998#[derive(Clone, Debug)]
10000pub struct GifloadOptions {
10001 pub n: i32,
10004 pub page: i32,
10007 pub flags: ForeignFlags,
10014 pub memory: bool,
10017 pub access: Access,
10023 pub fail_on: FailOn,
10030 pub revalidate: bool,
10033}
10034
10035impl std::default::Default for GifloadOptions {
10036 fn default() -> Self {
10037 GifloadOptions {
10038 n: i32::from(1),
10039 page: i32::from(0),
10040 flags: ForeignFlags::None,
10041 memory: false,
10042 access: Access::Random,
10043 fail_on: FailOn::None,
10044 revalidate: false,
10045 }
10046 }
10047}
10048
10049pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10054 unsafe {
10055 let filename_in: CString = utils::new_c_string(filename)?;
10056 let mut out_out: *mut bindings::VipsImage = null_mut();
10057
10058 let n_in: i32 = gifload_options.n;
10059 let n_in_name = utils::new_c_string("n")?;
10060
10061 let page_in: i32 = gifload_options.page;
10062 let page_in_name = utils::new_c_string("page")?;
10063
10064 let flags_in: i32 = gifload_options.flags as i32;
10065 let flags_in_name = utils::new_c_string("flags")?;
10066
10067 let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10068 let memory_in_name = utils::new_c_string("memory")?;
10069
10070 let access_in: i32 = gifload_options.access as i32;
10071 let access_in_name = utils::new_c_string("access")?;
10072
10073 let fail_on_in: i32 = gifload_options.fail_on as i32;
10074 let fail_on_in_name = utils::new_c_string("fail-on")?;
10075
10076 let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10077 let revalidate_in_name = utils::new_c_string("revalidate")?;
10078
10079 let vips_op_response = bindings::vips_gifload(
10080 filename_in.as_ptr(),
10081 &mut out_out,
10082 n_in_name.as_ptr(),
10083 n_in,
10084 page_in_name.as_ptr(),
10085 page_in,
10086 flags_in_name.as_ptr(),
10087 flags_in,
10088 memory_in_name.as_ptr(),
10089 memory_in,
10090 access_in_name.as_ptr(),
10091 access_in,
10092 fail_on_in_name.as_ptr(),
10093 fail_on_in,
10094 revalidate_in_name.as_ptr(),
10095 revalidate_in,
10096 NULL,
10097 );
10098 utils::result(
10099 vips_op_response,
10100 VipsImage { ctx: out_out },
10101 Error::GifloadError,
10102 )
10103 }
10104}
10105
10106pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10110 unsafe {
10111 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10112 let mut out_out: *mut bindings::VipsImage = null_mut();
10113
10114 let vips_op_response =
10115 bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10116 utils::result(
10117 vips_op_response,
10118 VipsImage { ctx: out_out },
10119 Error::GifloadBufferError,
10120 )
10121 }
10122}
10123
10124#[derive(Clone, Debug)]
10126pub struct GifloadBufferOptions {
10127 pub n: i32,
10130 pub page: i32,
10133 pub flags: ForeignFlags,
10140 pub memory: bool,
10143 pub access: Access,
10149 pub fail_on: FailOn,
10156 pub revalidate: bool,
10159}
10160
10161impl std::default::Default for GifloadBufferOptions {
10162 fn default() -> Self {
10163 GifloadBufferOptions {
10164 n: i32::from(1),
10165 page: i32::from(0),
10166 flags: ForeignFlags::None,
10167 memory: false,
10168 access: Access::Random,
10169 fail_on: FailOn::None,
10170 revalidate: false,
10171 }
10172 }
10173}
10174
10175pub fn gifload_buffer_with_opts(
10180 buffer: &[u8],
10181 gifload_buffer_options: &GifloadBufferOptions,
10182) -> Result<VipsImage> {
10183 unsafe {
10184 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10185 let mut out_out: *mut bindings::VipsImage = null_mut();
10186
10187 let n_in: i32 = gifload_buffer_options.n;
10188 let n_in_name = utils::new_c_string("n")?;
10189
10190 let page_in: i32 = gifload_buffer_options.page;
10191 let page_in_name = utils::new_c_string("page")?;
10192
10193 let flags_in: i32 = gifload_buffer_options.flags as i32;
10194 let flags_in_name = utils::new_c_string("flags")?;
10195
10196 let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10197 let memory_in_name = utils::new_c_string("memory")?;
10198
10199 let access_in: i32 = gifload_buffer_options.access as i32;
10200 let access_in_name = utils::new_c_string("access")?;
10201
10202 let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10203 let fail_on_in_name = utils::new_c_string("fail-on")?;
10204
10205 let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10206 1
10207 } else {
10208 0
10209 };
10210 let revalidate_in_name = utils::new_c_string("revalidate")?;
10211
10212 let vips_op_response = bindings::vips_gifload_buffer(
10213 buffer_in,
10214 buffer.len() as u64,
10215 &mut out_out,
10216 n_in_name.as_ptr(),
10217 n_in,
10218 page_in_name.as_ptr(),
10219 page_in,
10220 flags_in_name.as_ptr(),
10221 flags_in,
10222 memory_in_name.as_ptr(),
10223 memory_in,
10224 access_in_name.as_ptr(),
10225 access_in,
10226 fail_on_in_name.as_ptr(),
10227 fail_on_in,
10228 revalidate_in_name.as_ptr(),
10229 revalidate_in,
10230 NULL,
10231 );
10232 utils::result(
10233 vips_op_response,
10234 VipsImage { ctx: out_out },
10235 Error::GifloadBufferError,
10236 )
10237 }
10238}
10239
10240pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10244 unsafe {
10245 let source_in: *mut bindings::VipsSource = source.ctx;
10246 let mut out_out: *mut bindings::VipsImage = null_mut();
10247
10248 let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10249 utils::result(
10250 vips_op_response,
10251 VipsImage { ctx: out_out },
10252 Error::GifloadSourceError,
10253 )
10254 }
10255}
10256
10257#[derive(Clone, Debug)]
10259pub struct GifloadSourceOptions {
10260 pub n: i32,
10263 pub page: i32,
10266 pub flags: ForeignFlags,
10273 pub memory: bool,
10276 pub access: Access,
10282 pub fail_on: FailOn,
10289 pub revalidate: bool,
10292}
10293
10294impl std::default::Default for GifloadSourceOptions {
10295 fn default() -> Self {
10296 GifloadSourceOptions {
10297 n: i32::from(1),
10298 page: i32::from(0),
10299 flags: ForeignFlags::None,
10300 memory: false,
10301 access: Access::Random,
10302 fail_on: FailOn::None,
10303 revalidate: false,
10304 }
10305 }
10306}
10307
10308pub fn gifload_source_with_opts(
10313 source: &VipsSource,
10314 gifload_source_options: &GifloadSourceOptions,
10315) -> Result<VipsImage> {
10316 unsafe {
10317 let source_in: *mut bindings::VipsSource = source.ctx;
10318 let mut out_out: *mut bindings::VipsImage = null_mut();
10319
10320 let n_in: i32 = gifload_source_options.n;
10321 let n_in_name = utils::new_c_string("n")?;
10322
10323 let page_in: i32 = gifload_source_options.page;
10324 let page_in_name = utils::new_c_string("page")?;
10325
10326 let flags_in: i32 = gifload_source_options.flags as i32;
10327 let flags_in_name = utils::new_c_string("flags")?;
10328
10329 let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10330 let memory_in_name = utils::new_c_string("memory")?;
10331
10332 let access_in: i32 = gifload_source_options.access as i32;
10333 let access_in_name = utils::new_c_string("access")?;
10334
10335 let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10336 let fail_on_in_name = utils::new_c_string("fail-on")?;
10337
10338 let revalidate_in: i32 = if gifload_source_options.revalidate {
10339 1
10340 } else {
10341 0
10342 };
10343 let revalidate_in_name = utils::new_c_string("revalidate")?;
10344
10345 let vips_op_response = bindings::vips_gifload_source(
10346 source_in,
10347 &mut out_out,
10348 n_in_name.as_ptr(),
10349 n_in,
10350 page_in_name.as_ptr(),
10351 page_in,
10352 flags_in_name.as_ptr(),
10353 flags_in,
10354 memory_in_name.as_ptr(),
10355 memory_in,
10356 access_in_name.as_ptr(),
10357 access_in,
10358 fail_on_in_name.as_ptr(),
10359 fail_on_in,
10360 revalidate_in_name.as_ptr(),
10361 revalidate_in,
10362 NULL,
10363 );
10364 utils::result(
10365 vips_op_response,
10366 VipsImage { ctx: out_out },
10367 Error::GifloadSourceError,
10368 )
10369 }
10370}
10371
10372pub fn pngload(filename: &str) -> Result<VipsImage> {
10376 unsafe {
10377 let filename_in: CString = utils::new_c_string(filename)?;
10378 let mut out_out: *mut bindings::VipsImage = null_mut();
10379
10380 let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10381 utils::result(
10382 vips_op_response,
10383 VipsImage { ctx: out_out },
10384 Error::PngloadError,
10385 )
10386 }
10387}
10388
10389#[derive(Clone, Debug)]
10391pub struct PngloadOptions {
10392 pub unlimited: bool,
10395 pub flags: ForeignFlags,
10402 pub memory: bool,
10405 pub access: Access,
10411 pub fail_on: FailOn,
10418 pub revalidate: bool,
10421}
10422
10423impl std::default::Default for PngloadOptions {
10424 fn default() -> Self {
10425 PngloadOptions {
10426 unlimited: false,
10427 flags: ForeignFlags::None,
10428 memory: false,
10429 access: Access::Random,
10430 fail_on: FailOn::None,
10431 revalidate: false,
10432 }
10433 }
10434}
10435
10436pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10441 unsafe {
10442 let filename_in: CString = utils::new_c_string(filename)?;
10443 let mut out_out: *mut bindings::VipsImage = null_mut();
10444
10445 let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10446 let unlimited_in_name = utils::new_c_string("unlimited")?;
10447
10448 let flags_in: i32 = pngload_options.flags as i32;
10449 let flags_in_name = utils::new_c_string("flags")?;
10450
10451 let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
10452 let memory_in_name = utils::new_c_string("memory")?;
10453
10454 let access_in: i32 = pngload_options.access as i32;
10455 let access_in_name = utils::new_c_string("access")?;
10456
10457 let fail_on_in: i32 = pngload_options.fail_on as i32;
10458 let fail_on_in_name = utils::new_c_string("fail-on")?;
10459
10460 let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
10461 let revalidate_in_name = utils::new_c_string("revalidate")?;
10462
10463 let vips_op_response = bindings::vips_pngload(
10464 filename_in.as_ptr(),
10465 &mut out_out,
10466 unlimited_in_name.as_ptr(),
10467 unlimited_in,
10468 flags_in_name.as_ptr(),
10469 flags_in,
10470 memory_in_name.as_ptr(),
10471 memory_in,
10472 access_in_name.as_ptr(),
10473 access_in,
10474 fail_on_in_name.as_ptr(),
10475 fail_on_in,
10476 revalidate_in_name.as_ptr(),
10477 revalidate_in,
10478 NULL,
10479 );
10480 utils::result(
10481 vips_op_response,
10482 VipsImage { ctx: out_out },
10483 Error::PngloadError,
10484 )
10485 }
10486}
10487
10488pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10492 unsafe {
10493 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10494 let mut out_out: *mut bindings::VipsImage = null_mut();
10495
10496 let vips_op_response =
10497 bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10498 utils::result(
10499 vips_op_response,
10500 VipsImage { ctx: out_out },
10501 Error::PngloadBufferError,
10502 )
10503 }
10504}
10505
10506#[derive(Clone, Debug)]
10508pub struct PngloadBufferOptions {
10509 pub unlimited: bool,
10512 pub flags: ForeignFlags,
10519 pub memory: bool,
10522 pub access: Access,
10528 pub fail_on: FailOn,
10535 pub revalidate: bool,
10538}
10539
10540impl std::default::Default for PngloadBufferOptions {
10541 fn default() -> Self {
10542 PngloadBufferOptions {
10543 unlimited: false,
10544 flags: ForeignFlags::None,
10545 memory: false,
10546 access: Access::Random,
10547 fail_on: FailOn::None,
10548 revalidate: false,
10549 }
10550 }
10551}
10552
10553pub fn pngload_buffer_with_opts(
10558 buffer: &[u8],
10559 pngload_buffer_options: &PngloadBufferOptions,
10560) -> Result<VipsImage> {
10561 unsafe {
10562 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10563 let mut out_out: *mut bindings::VipsImage = null_mut();
10564
10565 let unlimited_in: i32 = if pngload_buffer_options.unlimited {
10566 1
10567 } else {
10568 0
10569 };
10570 let unlimited_in_name = utils::new_c_string("unlimited")?;
10571
10572 let flags_in: i32 = pngload_buffer_options.flags as i32;
10573 let flags_in_name = utils::new_c_string("flags")?;
10574
10575 let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
10576 let memory_in_name = utils::new_c_string("memory")?;
10577
10578 let access_in: i32 = pngload_buffer_options.access as i32;
10579 let access_in_name = utils::new_c_string("access")?;
10580
10581 let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
10582 let fail_on_in_name = utils::new_c_string("fail-on")?;
10583
10584 let revalidate_in: i32 = if pngload_buffer_options.revalidate {
10585 1
10586 } else {
10587 0
10588 };
10589 let revalidate_in_name = utils::new_c_string("revalidate")?;
10590
10591 let vips_op_response = bindings::vips_pngload_buffer(
10592 buffer_in,
10593 buffer.len() as u64,
10594 &mut out_out,
10595 unlimited_in_name.as_ptr(),
10596 unlimited_in,
10597 flags_in_name.as_ptr(),
10598 flags_in,
10599 memory_in_name.as_ptr(),
10600 memory_in,
10601 access_in_name.as_ptr(),
10602 access_in,
10603 fail_on_in_name.as_ptr(),
10604 fail_on_in,
10605 revalidate_in_name.as_ptr(),
10606 revalidate_in,
10607 NULL,
10608 );
10609 utils::result(
10610 vips_op_response,
10611 VipsImage { ctx: out_out },
10612 Error::PngloadBufferError,
10613 )
10614 }
10615}
10616
10617pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
10621 unsafe {
10622 let source_in: *mut bindings::VipsSource = source.ctx;
10623 let mut out_out: *mut bindings::VipsImage = null_mut();
10624
10625 let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
10626 utils::result(
10627 vips_op_response,
10628 VipsImage { ctx: out_out },
10629 Error::PngloadSourceError,
10630 )
10631 }
10632}
10633
10634#[derive(Clone, Debug)]
10636pub struct PngloadSourceOptions {
10637 pub unlimited: bool,
10640 pub flags: ForeignFlags,
10647 pub memory: bool,
10650 pub access: Access,
10656 pub fail_on: FailOn,
10663 pub revalidate: bool,
10666}
10667
10668impl std::default::Default for PngloadSourceOptions {
10669 fn default() -> Self {
10670 PngloadSourceOptions {
10671 unlimited: false,
10672 flags: ForeignFlags::None,
10673 memory: false,
10674 access: Access::Random,
10675 fail_on: FailOn::None,
10676 revalidate: false,
10677 }
10678 }
10679}
10680
10681pub fn pngload_source_with_opts(
10686 source: &VipsSource,
10687 pngload_source_options: &PngloadSourceOptions,
10688) -> Result<VipsImage> {
10689 unsafe {
10690 let source_in: *mut bindings::VipsSource = source.ctx;
10691 let mut out_out: *mut bindings::VipsImage = null_mut();
10692
10693 let unlimited_in: i32 = if pngload_source_options.unlimited {
10694 1
10695 } else {
10696 0
10697 };
10698 let unlimited_in_name = utils::new_c_string("unlimited")?;
10699
10700 let flags_in: i32 = pngload_source_options.flags as i32;
10701 let flags_in_name = utils::new_c_string("flags")?;
10702
10703 let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
10704 let memory_in_name = utils::new_c_string("memory")?;
10705
10706 let access_in: i32 = pngload_source_options.access as i32;
10707 let access_in_name = utils::new_c_string("access")?;
10708
10709 let fail_on_in: i32 = pngload_source_options.fail_on as i32;
10710 let fail_on_in_name = utils::new_c_string("fail-on")?;
10711
10712 let revalidate_in: i32 = if pngload_source_options.revalidate {
10713 1
10714 } else {
10715 0
10716 };
10717 let revalidate_in_name = utils::new_c_string("revalidate")?;
10718
10719 let vips_op_response = bindings::vips_pngload_source(
10720 source_in,
10721 &mut out_out,
10722 unlimited_in_name.as_ptr(),
10723 unlimited_in,
10724 flags_in_name.as_ptr(),
10725 flags_in,
10726 memory_in_name.as_ptr(),
10727 memory_in,
10728 access_in_name.as_ptr(),
10729 access_in,
10730 fail_on_in_name.as_ptr(),
10731 fail_on_in,
10732 revalidate_in_name.as_ptr(),
10733 revalidate_in,
10734 NULL,
10735 );
10736 utils::result(
10737 vips_op_response,
10738 VipsImage { ctx: out_out },
10739 Error::PngloadSourceError,
10740 )
10741 }
10742}
10743
10744pub fn jpegload(filename: &str) -> Result<VipsImage> {
10748 unsafe {
10749 let filename_in: CString = utils::new_c_string(filename)?;
10750 let mut out_out: *mut bindings::VipsImage = null_mut();
10751
10752 let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
10753 utils::result(
10754 vips_op_response,
10755 VipsImage { ctx: out_out },
10756 Error::JpegloadError,
10757 )
10758 }
10759}
10760
10761#[derive(Clone, Debug)]
10763pub struct JpegloadOptions {
10764 pub shrink: i32,
10767 pub autorotate: bool,
10770 pub unlimited: bool,
10773 pub flags: ForeignFlags,
10780 pub memory: bool,
10783 pub access: Access,
10789 pub fail_on: FailOn,
10796 pub revalidate: bool,
10799}
10800
10801impl std::default::Default for JpegloadOptions {
10802 fn default() -> Self {
10803 JpegloadOptions {
10804 shrink: i32::from(1),
10805 autorotate: false,
10806 unlimited: false,
10807 flags: ForeignFlags::None,
10808 memory: false,
10809 access: Access::Random,
10810 fail_on: FailOn::None,
10811 revalidate: false,
10812 }
10813 }
10814}
10815
10816pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
10821 unsafe {
10822 let filename_in: CString = utils::new_c_string(filename)?;
10823 let mut out_out: *mut bindings::VipsImage = null_mut();
10824
10825 let shrink_in: i32 = jpegload_options.shrink;
10826 let shrink_in_name = utils::new_c_string("shrink")?;
10827
10828 let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
10829 let autorotate_in_name = utils::new_c_string("autorotate")?;
10830
10831 let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
10832 let unlimited_in_name = utils::new_c_string("unlimited")?;
10833
10834 let flags_in: i32 = jpegload_options.flags as i32;
10835 let flags_in_name = utils::new_c_string("flags")?;
10836
10837 let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
10838 let memory_in_name = utils::new_c_string("memory")?;
10839
10840 let access_in: i32 = jpegload_options.access as i32;
10841 let access_in_name = utils::new_c_string("access")?;
10842
10843 let fail_on_in: i32 = jpegload_options.fail_on as i32;
10844 let fail_on_in_name = utils::new_c_string("fail-on")?;
10845
10846 let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
10847 let revalidate_in_name = utils::new_c_string("revalidate")?;
10848
10849 let vips_op_response = bindings::vips_jpegload(
10850 filename_in.as_ptr(),
10851 &mut out_out,
10852 shrink_in_name.as_ptr(),
10853 shrink_in,
10854 autorotate_in_name.as_ptr(),
10855 autorotate_in,
10856 unlimited_in_name.as_ptr(),
10857 unlimited_in,
10858 flags_in_name.as_ptr(),
10859 flags_in,
10860 memory_in_name.as_ptr(),
10861 memory_in,
10862 access_in_name.as_ptr(),
10863 access_in,
10864 fail_on_in_name.as_ptr(),
10865 fail_on_in,
10866 revalidate_in_name.as_ptr(),
10867 revalidate_in,
10868 NULL,
10869 );
10870 utils::result(
10871 vips_op_response,
10872 VipsImage { ctx: out_out },
10873 Error::JpegloadError,
10874 )
10875 }
10876}
10877
10878pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10882 unsafe {
10883 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10884 let mut out_out: *mut bindings::VipsImage = null_mut();
10885
10886 let vips_op_response =
10887 bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10888 utils::result(
10889 vips_op_response,
10890 VipsImage { ctx: out_out },
10891 Error::JpegloadBufferError,
10892 )
10893 }
10894}
10895
10896#[derive(Clone, Debug)]
10898pub struct JpegloadBufferOptions {
10899 pub shrink: i32,
10902 pub autorotate: bool,
10905 pub unlimited: bool,
10908 pub flags: ForeignFlags,
10915 pub memory: bool,
10918 pub access: Access,
10924 pub fail_on: FailOn,
10931 pub revalidate: bool,
10934}
10935
10936impl std::default::Default for JpegloadBufferOptions {
10937 fn default() -> Self {
10938 JpegloadBufferOptions {
10939 shrink: i32::from(1),
10940 autorotate: false,
10941 unlimited: false,
10942 flags: ForeignFlags::None,
10943 memory: false,
10944 access: Access::Random,
10945 fail_on: FailOn::None,
10946 revalidate: false,
10947 }
10948 }
10949}
10950
10951pub fn jpegload_buffer_with_opts(
10956 buffer: &[u8],
10957 jpegload_buffer_options: &JpegloadBufferOptions,
10958) -> Result<VipsImage> {
10959 unsafe {
10960 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10961 let mut out_out: *mut bindings::VipsImage = null_mut();
10962
10963 let shrink_in: i32 = jpegload_buffer_options.shrink;
10964 let shrink_in_name = utils::new_c_string("shrink")?;
10965
10966 let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
10967 1
10968 } else {
10969 0
10970 };
10971 let autorotate_in_name = utils::new_c_string("autorotate")?;
10972
10973 let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
10974 1
10975 } else {
10976 0
10977 };
10978 let unlimited_in_name = utils::new_c_string("unlimited")?;
10979
10980 let flags_in: i32 = jpegload_buffer_options.flags as i32;
10981 let flags_in_name = utils::new_c_string("flags")?;
10982
10983 let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
10984 let memory_in_name = utils::new_c_string("memory")?;
10985
10986 let access_in: i32 = jpegload_buffer_options.access as i32;
10987 let access_in_name = utils::new_c_string("access")?;
10988
10989 let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
10990 let fail_on_in_name = utils::new_c_string("fail-on")?;
10991
10992 let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
10993 1
10994 } else {
10995 0
10996 };
10997 let revalidate_in_name = utils::new_c_string("revalidate")?;
10998
10999 let vips_op_response = bindings::vips_jpegload_buffer(
11000 buffer_in,
11001 buffer.len() as u64,
11002 &mut out_out,
11003 shrink_in_name.as_ptr(),
11004 shrink_in,
11005 autorotate_in_name.as_ptr(),
11006 autorotate_in,
11007 unlimited_in_name.as_ptr(),
11008 unlimited_in,
11009 flags_in_name.as_ptr(),
11010 flags_in,
11011 memory_in_name.as_ptr(),
11012 memory_in,
11013 access_in_name.as_ptr(),
11014 access_in,
11015 fail_on_in_name.as_ptr(),
11016 fail_on_in,
11017 revalidate_in_name.as_ptr(),
11018 revalidate_in,
11019 NULL,
11020 );
11021 utils::result(
11022 vips_op_response,
11023 VipsImage { ctx: out_out },
11024 Error::JpegloadBufferError,
11025 )
11026 }
11027}
11028
11029pub fn webpload(filename: &str) -> Result<VipsImage> {
11033 unsafe {
11034 let filename_in: CString = utils::new_c_string(filename)?;
11035 let mut out_out: *mut bindings::VipsImage = null_mut();
11036
11037 let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11038 utils::result(
11039 vips_op_response,
11040 VipsImage { ctx: out_out },
11041 Error::WebploadError,
11042 )
11043 }
11044}
11045
11046#[derive(Clone, Debug)]
11048pub struct WebploadOptions {
11049 pub page: i32,
11052 pub n: i32,
11055 pub scale: f64,
11058 pub flags: ForeignFlags,
11065 pub memory: bool,
11068 pub access: Access,
11074 pub fail_on: FailOn,
11081 pub revalidate: bool,
11084}
11085
11086impl std::default::Default for WebploadOptions {
11087 fn default() -> Self {
11088 WebploadOptions {
11089 page: i32::from(0),
11090 n: i32::from(1),
11091 scale: f64::from(1),
11092 flags: ForeignFlags::None,
11093 memory: false,
11094 access: Access::Random,
11095 fail_on: FailOn::None,
11096 revalidate: false,
11097 }
11098 }
11099}
11100
11101pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11106 unsafe {
11107 let filename_in: CString = utils::new_c_string(filename)?;
11108 let mut out_out: *mut bindings::VipsImage = null_mut();
11109
11110 let page_in: i32 = webpload_options.page;
11111 let page_in_name = utils::new_c_string("page")?;
11112
11113 let n_in: i32 = webpload_options.n;
11114 let n_in_name = utils::new_c_string("n")?;
11115
11116 let scale_in: f64 = webpload_options.scale;
11117 let scale_in_name = utils::new_c_string("scale")?;
11118
11119 let flags_in: i32 = webpload_options.flags as i32;
11120 let flags_in_name = utils::new_c_string("flags")?;
11121
11122 let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11123 let memory_in_name = utils::new_c_string("memory")?;
11124
11125 let access_in: i32 = webpload_options.access as i32;
11126 let access_in_name = utils::new_c_string("access")?;
11127
11128 let fail_on_in: i32 = webpload_options.fail_on as i32;
11129 let fail_on_in_name = utils::new_c_string("fail-on")?;
11130
11131 let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11132 let revalidate_in_name = utils::new_c_string("revalidate")?;
11133
11134 let vips_op_response = bindings::vips_webpload(
11135 filename_in.as_ptr(),
11136 &mut out_out,
11137 page_in_name.as_ptr(),
11138 page_in,
11139 n_in_name.as_ptr(),
11140 n_in,
11141 scale_in_name.as_ptr(),
11142 scale_in,
11143 flags_in_name.as_ptr(),
11144 flags_in,
11145 memory_in_name.as_ptr(),
11146 memory_in,
11147 access_in_name.as_ptr(),
11148 access_in,
11149 fail_on_in_name.as_ptr(),
11150 fail_on_in,
11151 revalidate_in_name.as_ptr(),
11152 revalidate_in,
11153 NULL,
11154 );
11155 utils::result(
11156 vips_op_response,
11157 VipsImage { ctx: out_out },
11158 Error::WebploadError,
11159 )
11160 }
11161}
11162
11163pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11167 unsafe {
11168 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11169 let mut out_out: *mut bindings::VipsImage = null_mut();
11170
11171 let vips_op_response =
11172 bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11173 utils::result(
11174 vips_op_response,
11175 VipsImage { ctx: out_out },
11176 Error::WebploadBufferError,
11177 )
11178 }
11179}
11180
11181#[derive(Clone, Debug)]
11183pub struct WebploadBufferOptions {
11184 pub page: i32,
11187 pub n: i32,
11190 pub scale: f64,
11193 pub flags: ForeignFlags,
11200 pub memory: bool,
11203 pub access: Access,
11209 pub fail_on: FailOn,
11216 pub revalidate: bool,
11219}
11220
11221impl std::default::Default for WebploadBufferOptions {
11222 fn default() -> Self {
11223 WebploadBufferOptions {
11224 page: i32::from(0),
11225 n: i32::from(1),
11226 scale: f64::from(1),
11227 flags: ForeignFlags::None,
11228 memory: false,
11229 access: Access::Random,
11230 fail_on: FailOn::None,
11231 revalidate: false,
11232 }
11233 }
11234}
11235
11236pub fn webpload_buffer_with_opts(
11241 buffer: &[u8],
11242 webpload_buffer_options: &WebploadBufferOptions,
11243) -> Result<VipsImage> {
11244 unsafe {
11245 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11246 let mut out_out: *mut bindings::VipsImage = null_mut();
11247
11248 let page_in: i32 = webpload_buffer_options.page;
11249 let page_in_name = utils::new_c_string("page")?;
11250
11251 let n_in: i32 = webpload_buffer_options.n;
11252 let n_in_name = utils::new_c_string("n")?;
11253
11254 let scale_in: f64 = webpload_buffer_options.scale;
11255 let scale_in_name = utils::new_c_string("scale")?;
11256
11257 let flags_in: i32 = webpload_buffer_options.flags as i32;
11258 let flags_in_name = utils::new_c_string("flags")?;
11259
11260 let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
11261 let memory_in_name = utils::new_c_string("memory")?;
11262
11263 let access_in: i32 = webpload_buffer_options.access as i32;
11264 let access_in_name = utils::new_c_string("access")?;
11265
11266 let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
11267 let fail_on_in_name = utils::new_c_string("fail-on")?;
11268
11269 let revalidate_in: i32 = if webpload_buffer_options.revalidate {
11270 1
11271 } else {
11272 0
11273 };
11274 let revalidate_in_name = utils::new_c_string("revalidate")?;
11275
11276 let vips_op_response = bindings::vips_webpload_buffer(
11277 buffer_in,
11278 buffer.len() as u64,
11279 &mut out_out,
11280 page_in_name.as_ptr(),
11281 page_in,
11282 n_in_name.as_ptr(),
11283 n_in,
11284 scale_in_name.as_ptr(),
11285 scale_in,
11286 flags_in_name.as_ptr(),
11287 flags_in,
11288 memory_in_name.as_ptr(),
11289 memory_in,
11290 access_in_name.as_ptr(),
11291 access_in,
11292 fail_on_in_name.as_ptr(),
11293 fail_on_in,
11294 revalidate_in_name.as_ptr(),
11295 revalidate_in,
11296 NULL,
11297 );
11298 utils::result(
11299 vips_op_response,
11300 VipsImage { ctx: out_out },
11301 Error::WebploadBufferError,
11302 )
11303 }
11304}
11305
11306pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
11310 unsafe {
11311 let source_in: *mut bindings::VipsSource = source.ctx;
11312 let mut out_out: *mut bindings::VipsImage = null_mut();
11313
11314 let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
11315 utils::result(
11316 vips_op_response,
11317 VipsImage { ctx: out_out },
11318 Error::WebploadSourceError,
11319 )
11320 }
11321}
11322
11323#[derive(Clone, Debug)]
11325pub struct WebploadSourceOptions {
11326 pub page: i32,
11329 pub n: i32,
11332 pub scale: f64,
11335 pub flags: ForeignFlags,
11342 pub memory: bool,
11345 pub access: Access,
11351 pub fail_on: FailOn,
11358 pub revalidate: bool,
11361}
11362
11363impl std::default::Default for WebploadSourceOptions {
11364 fn default() -> Self {
11365 WebploadSourceOptions {
11366 page: i32::from(0),
11367 n: i32::from(1),
11368 scale: f64::from(1),
11369 flags: ForeignFlags::None,
11370 memory: false,
11371 access: Access::Random,
11372 fail_on: FailOn::None,
11373 revalidate: false,
11374 }
11375 }
11376}
11377
11378pub fn webpload_source_with_opts(
11383 source: &VipsSource,
11384 webpload_source_options: &WebploadSourceOptions,
11385) -> Result<VipsImage> {
11386 unsafe {
11387 let source_in: *mut bindings::VipsSource = source.ctx;
11388 let mut out_out: *mut bindings::VipsImage = null_mut();
11389
11390 let page_in: i32 = webpload_source_options.page;
11391 let page_in_name = utils::new_c_string("page")?;
11392
11393 let n_in: i32 = webpload_source_options.n;
11394 let n_in_name = utils::new_c_string("n")?;
11395
11396 let scale_in: f64 = webpload_source_options.scale;
11397 let scale_in_name = utils::new_c_string("scale")?;
11398
11399 let flags_in: i32 = webpload_source_options.flags as i32;
11400 let flags_in_name = utils::new_c_string("flags")?;
11401
11402 let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
11403 let memory_in_name = utils::new_c_string("memory")?;
11404
11405 let access_in: i32 = webpload_source_options.access as i32;
11406 let access_in_name = utils::new_c_string("access")?;
11407
11408 let fail_on_in: i32 = webpload_source_options.fail_on as i32;
11409 let fail_on_in_name = utils::new_c_string("fail-on")?;
11410
11411 let revalidate_in: i32 = if webpload_source_options.revalidate {
11412 1
11413 } else {
11414 0
11415 };
11416 let revalidate_in_name = utils::new_c_string("revalidate")?;
11417
11418 let vips_op_response = bindings::vips_webpload_source(
11419 source_in,
11420 &mut out_out,
11421 page_in_name.as_ptr(),
11422 page_in,
11423 n_in_name.as_ptr(),
11424 n_in,
11425 scale_in_name.as_ptr(),
11426 scale_in,
11427 flags_in_name.as_ptr(),
11428 flags_in,
11429 memory_in_name.as_ptr(),
11430 memory_in,
11431 access_in_name.as_ptr(),
11432 access_in,
11433 fail_on_in_name.as_ptr(),
11434 fail_on_in,
11435 revalidate_in_name.as_ptr(),
11436 revalidate_in,
11437 NULL,
11438 );
11439 utils::result(
11440 vips_op_response,
11441 VipsImage { ctx: out_out },
11442 Error::WebploadSourceError,
11443 )
11444 }
11445}
11446
11447pub fn tiffload(filename: &str) -> Result<VipsImage> {
11451 unsafe {
11452 let filename_in: CString = utils::new_c_string(filename)?;
11453 let mut out_out: *mut bindings::VipsImage = null_mut();
11454
11455 let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
11456 utils::result(
11457 vips_op_response,
11458 VipsImage { ctx: out_out },
11459 Error::TiffloadError,
11460 )
11461 }
11462}
11463
11464#[derive(Clone, Debug)]
11466pub struct TiffloadOptions {
11467 pub page: i32,
11470 pub subifd: i32,
11473 pub n: i32,
11476 pub autorotate: bool,
11479 pub flags: ForeignFlags,
11486 pub memory: bool,
11489 pub access: Access,
11495 pub fail_on: FailOn,
11502 pub revalidate: bool,
11505}
11506
11507impl std::default::Default for TiffloadOptions {
11508 fn default() -> Self {
11509 TiffloadOptions {
11510 page: i32::from(0),
11511 subifd: i32::from(-1),
11512 n: i32::from(1),
11513 autorotate: false,
11514 flags: ForeignFlags::None,
11515 memory: false,
11516 access: Access::Random,
11517 fail_on: FailOn::None,
11518 revalidate: false,
11519 }
11520 }
11521}
11522
11523pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
11528 unsafe {
11529 let filename_in: CString = utils::new_c_string(filename)?;
11530 let mut out_out: *mut bindings::VipsImage = null_mut();
11531
11532 let page_in: i32 = tiffload_options.page;
11533 let page_in_name = utils::new_c_string("page")?;
11534
11535 let subifd_in: i32 = tiffload_options.subifd;
11536 let subifd_in_name = utils::new_c_string("subifd")?;
11537
11538 let n_in: i32 = tiffload_options.n;
11539 let n_in_name = utils::new_c_string("n")?;
11540
11541 let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
11542 let autorotate_in_name = utils::new_c_string("autorotate")?;
11543
11544 let flags_in: i32 = tiffload_options.flags as i32;
11545 let flags_in_name = utils::new_c_string("flags")?;
11546
11547 let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
11548 let memory_in_name = utils::new_c_string("memory")?;
11549
11550 let access_in: i32 = tiffload_options.access as i32;
11551 let access_in_name = utils::new_c_string("access")?;
11552
11553 let fail_on_in: i32 = tiffload_options.fail_on as i32;
11554 let fail_on_in_name = utils::new_c_string("fail-on")?;
11555
11556 let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
11557 let revalidate_in_name = utils::new_c_string("revalidate")?;
11558
11559 let vips_op_response = bindings::vips_tiffload(
11560 filename_in.as_ptr(),
11561 &mut out_out,
11562 page_in_name.as_ptr(),
11563 page_in,
11564 subifd_in_name.as_ptr(),
11565 subifd_in,
11566 n_in_name.as_ptr(),
11567 n_in,
11568 autorotate_in_name.as_ptr(),
11569 autorotate_in,
11570 flags_in_name.as_ptr(),
11571 flags_in,
11572 memory_in_name.as_ptr(),
11573 memory_in,
11574 access_in_name.as_ptr(),
11575 access_in,
11576 fail_on_in_name.as_ptr(),
11577 fail_on_in,
11578 revalidate_in_name.as_ptr(),
11579 revalidate_in,
11580 NULL,
11581 );
11582 utils::result(
11583 vips_op_response,
11584 VipsImage { ctx: out_out },
11585 Error::TiffloadError,
11586 )
11587 }
11588}
11589
11590pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11594 unsafe {
11595 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11596 let mut out_out: *mut bindings::VipsImage = null_mut();
11597
11598 let vips_op_response =
11599 bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11600 utils::result(
11601 vips_op_response,
11602 VipsImage { ctx: out_out },
11603 Error::TiffloadBufferError,
11604 )
11605 }
11606}
11607
11608#[derive(Clone, Debug)]
11610pub struct TiffloadBufferOptions {
11611 pub page: i32,
11614 pub subifd: i32,
11617 pub n: i32,
11620 pub autorotate: bool,
11623 pub flags: ForeignFlags,
11630 pub memory: bool,
11633 pub access: Access,
11639 pub fail_on: FailOn,
11646 pub revalidate: bool,
11649}
11650
11651impl std::default::Default for TiffloadBufferOptions {
11652 fn default() -> Self {
11653 TiffloadBufferOptions {
11654 page: i32::from(0),
11655 subifd: i32::from(-1),
11656 n: i32::from(1),
11657 autorotate: false,
11658 flags: ForeignFlags::None,
11659 memory: false,
11660 access: Access::Random,
11661 fail_on: FailOn::None,
11662 revalidate: false,
11663 }
11664 }
11665}
11666
11667pub fn tiffload_buffer_with_opts(
11672 buffer: &[u8],
11673 tiffload_buffer_options: &TiffloadBufferOptions,
11674) -> Result<VipsImage> {
11675 unsafe {
11676 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11677 let mut out_out: *mut bindings::VipsImage = null_mut();
11678
11679 let page_in: i32 = tiffload_buffer_options.page;
11680 let page_in_name = utils::new_c_string("page")?;
11681
11682 let subifd_in: i32 = tiffload_buffer_options.subifd;
11683 let subifd_in_name = utils::new_c_string("subifd")?;
11684
11685 let n_in: i32 = tiffload_buffer_options.n;
11686 let n_in_name = utils::new_c_string("n")?;
11687
11688 let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
11689 1
11690 } else {
11691 0
11692 };
11693 let autorotate_in_name = utils::new_c_string("autorotate")?;
11694
11695 let flags_in: i32 = tiffload_buffer_options.flags as i32;
11696 let flags_in_name = utils::new_c_string("flags")?;
11697
11698 let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
11699 let memory_in_name = utils::new_c_string("memory")?;
11700
11701 let access_in: i32 = tiffload_buffer_options.access as i32;
11702 let access_in_name = utils::new_c_string("access")?;
11703
11704 let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
11705 let fail_on_in_name = utils::new_c_string("fail-on")?;
11706
11707 let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
11708 1
11709 } else {
11710 0
11711 };
11712 let revalidate_in_name = utils::new_c_string("revalidate")?;
11713
11714 let vips_op_response = bindings::vips_tiffload_buffer(
11715 buffer_in,
11716 buffer.len() as u64,
11717 &mut out_out,
11718 page_in_name.as_ptr(),
11719 page_in,
11720 subifd_in_name.as_ptr(),
11721 subifd_in,
11722 n_in_name.as_ptr(),
11723 n_in,
11724 autorotate_in_name.as_ptr(),
11725 autorotate_in,
11726 flags_in_name.as_ptr(),
11727 flags_in,
11728 memory_in_name.as_ptr(),
11729 memory_in,
11730 access_in_name.as_ptr(),
11731 access_in,
11732 fail_on_in_name.as_ptr(),
11733 fail_on_in,
11734 revalidate_in_name.as_ptr(),
11735 revalidate_in,
11736 NULL,
11737 );
11738 utils::result(
11739 vips_op_response,
11740 VipsImage { ctx: out_out },
11741 Error::TiffloadBufferError,
11742 )
11743 }
11744}
11745
11746pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
11750 unsafe {
11751 let source_in: *mut bindings::VipsSource = source.ctx;
11752 let mut out_out: *mut bindings::VipsImage = null_mut();
11753
11754 let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
11755 utils::result(
11756 vips_op_response,
11757 VipsImage { ctx: out_out },
11758 Error::TiffloadSourceError,
11759 )
11760 }
11761}
11762
11763#[derive(Clone, Debug)]
11765pub struct TiffloadSourceOptions {
11766 pub page: i32,
11769 pub subifd: i32,
11772 pub n: i32,
11775 pub autorotate: bool,
11778 pub flags: ForeignFlags,
11785 pub memory: bool,
11788 pub access: Access,
11794 pub fail_on: FailOn,
11801 pub revalidate: bool,
11804}
11805
11806impl std::default::Default for TiffloadSourceOptions {
11807 fn default() -> Self {
11808 TiffloadSourceOptions {
11809 page: i32::from(0),
11810 subifd: i32::from(-1),
11811 n: i32::from(1),
11812 autorotate: false,
11813 flags: ForeignFlags::None,
11814 memory: false,
11815 access: Access::Random,
11816 fail_on: FailOn::None,
11817 revalidate: false,
11818 }
11819 }
11820}
11821
11822pub fn tiffload_source_with_opts(
11827 source: &VipsSource,
11828 tiffload_source_options: &TiffloadSourceOptions,
11829) -> Result<VipsImage> {
11830 unsafe {
11831 let source_in: *mut bindings::VipsSource = source.ctx;
11832 let mut out_out: *mut bindings::VipsImage = null_mut();
11833
11834 let page_in: i32 = tiffload_source_options.page;
11835 let page_in_name = utils::new_c_string("page")?;
11836
11837 let subifd_in: i32 = tiffload_source_options.subifd;
11838 let subifd_in_name = utils::new_c_string("subifd")?;
11839
11840 let n_in: i32 = tiffload_source_options.n;
11841 let n_in_name = utils::new_c_string("n")?;
11842
11843 let autorotate_in: i32 = if tiffload_source_options.autorotate {
11844 1
11845 } else {
11846 0
11847 };
11848 let autorotate_in_name = utils::new_c_string("autorotate")?;
11849
11850 let flags_in: i32 = tiffload_source_options.flags as i32;
11851 let flags_in_name = utils::new_c_string("flags")?;
11852
11853 let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
11854 let memory_in_name = utils::new_c_string("memory")?;
11855
11856 let access_in: i32 = tiffload_source_options.access as i32;
11857 let access_in_name = utils::new_c_string("access")?;
11858
11859 let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
11860 let fail_on_in_name = utils::new_c_string("fail-on")?;
11861
11862 let revalidate_in: i32 = if tiffload_source_options.revalidate {
11863 1
11864 } else {
11865 0
11866 };
11867 let revalidate_in_name = utils::new_c_string("revalidate")?;
11868
11869 let vips_op_response = bindings::vips_tiffload_source(
11870 source_in,
11871 &mut out_out,
11872 page_in_name.as_ptr(),
11873 page_in,
11874 subifd_in_name.as_ptr(),
11875 subifd_in,
11876 n_in_name.as_ptr(),
11877 n_in,
11878 autorotate_in_name.as_ptr(),
11879 autorotate_in,
11880 flags_in_name.as_ptr(),
11881 flags_in,
11882 memory_in_name.as_ptr(),
11883 memory_in,
11884 access_in_name.as_ptr(),
11885 access_in,
11886 fail_on_in_name.as_ptr(),
11887 fail_on_in,
11888 revalidate_in_name.as_ptr(),
11889 revalidate_in,
11890 NULL,
11891 );
11892 utils::result(
11893 vips_op_response,
11894 VipsImage { ctx: out_out },
11895 Error::TiffloadSourceError,
11896 )
11897 }
11898}
11899
11900pub fn heifload(filename: &str) -> Result<VipsImage> {
11904 unsafe {
11905 let filename_in: CString = utils::new_c_string(filename)?;
11906 let mut out_out: *mut bindings::VipsImage = null_mut();
11907
11908 let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
11909 utils::result(
11910 vips_op_response,
11911 VipsImage { ctx: out_out },
11912 Error::HeifloadError,
11913 )
11914 }
11915}
11916
11917#[derive(Clone, Debug)]
11919pub struct HeifloadOptions {
11920 pub page: i32,
11923 pub n: i32,
11926 pub thumbnail: bool,
11929 pub unlimited: bool,
11932 pub flags: ForeignFlags,
11939 pub memory: bool,
11942 pub access: Access,
11948 pub fail_on: FailOn,
11955 pub revalidate: bool,
11958}
11959
11960impl std::default::Default for HeifloadOptions {
11961 fn default() -> Self {
11962 HeifloadOptions {
11963 page: i32::from(0),
11964 n: i32::from(1),
11965 thumbnail: false,
11966 unlimited: false,
11967 flags: ForeignFlags::None,
11968 memory: false,
11969 access: Access::Random,
11970 fail_on: FailOn::None,
11971 revalidate: false,
11972 }
11973 }
11974}
11975
11976pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
11981 unsafe {
11982 let filename_in: CString = utils::new_c_string(filename)?;
11983 let mut out_out: *mut bindings::VipsImage = null_mut();
11984
11985 let page_in: i32 = heifload_options.page;
11986 let page_in_name = utils::new_c_string("page")?;
11987
11988 let n_in: i32 = heifload_options.n;
11989 let n_in_name = utils::new_c_string("n")?;
11990
11991 let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
11992 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
11993
11994 let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
11995 let unlimited_in_name = utils::new_c_string("unlimited")?;
11996
11997 let flags_in: i32 = heifload_options.flags as i32;
11998 let flags_in_name = utils::new_c_string("flags")?;
11999
12000 let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
12001 let memory_in_name = utils::new_c_string("memory")?;
12002
12003 let access_in: i32 = heifload_options.access as i32;
12004 let access_in_name = utils::new_c_string("access")?;
12005
12006 let fail_on_in: i32 = heifload_options.fail_on as i32;
12007 let fail_on_in_name = utils::new_c_string("fail-on")?;
12008
12009 let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
12010 let revalidate_in_name = utils::new_c_string("revalidate")?;
12011
12012 let vips_op_response = bindings::vips_heifload(
12013 filename_in.as_ptr(),
12014 &mut out_out,
12015 page_in_name.as_ptr(),
12016 page_in,
12017 n_in_name.as_ptr(),
12018 n_in,
12019 thumbnail_in_name.as_ptr(),
12020 thumbnail_in,
12021 unlimited_in_name.as_ptr(),
12022 unlimited_in,
12023 flags_in_name.as_ptr(),
12024 flags_in,
12025 memory_in_name.as_ptr(),
12026 memory_in,
12027 access_in_name.as_ptr(),
12028 access_in,
12029 fail_on_in_name.as_ptr(),
12030 fail_on_in,
12031 revalidate_in_name.as_ptr(),
12032 revalidate_in,
12033 NULL,
12034 );
12035 utils::result(
12036 vips_op_response,
12037 VipsImage { ctx: out_out },
12038 Error::HeifloadError,
12039 )
12040 }
12041}
12042
12043pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12047 unsafe {
12048 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12049 let mut out_out: *mut bindings::VipsImage = null_mut();
12050
12051 let vips_op_response =
12052 bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12053 utils::result(
12054 vips_op_response,
12055 VipsImage { ctx: out_out },
12056 Error::HeifloadBufferError,
12057 )
12058 }
12059}
12060
12061#[derive(Clone, Debug)]
12063pub struct HeifloadBufferOptions {
12064 pub page: i32,
12067 pub n: i32,
12070 pub thumbnail: bool,
12073 pub unlimited: bool,
12076 pub flags: ForeignFlags,
12083 pub memory: bool,
12086 pub access: Access,
12092 pub fail_on: FailOn,
12099 pub revalidate: bool,
12102}
12103
12104impl std::default::Default for HeifloadBufferOptions {
12105 fn default() -> Self {
12106 HeifloadBufferOptions {
12107 page: i32::from(0),
12108 n: i32::from(1),
12109 thumbnail: false,
12110 unlimited: false,
12111 flags: ForeignFlags::None,
12112 memory: false,
12113 access: Access::Random,
12114 fail_on: FailOn::None,
12115 revalidate: false,
12116 }
12117 }
12118}
12119
12120pub fn heifload_buffer_with_opts(
12125 buffer: &[u8],
12126 heifload_buffer_options: &HeifloadBufferOptions,
12127) -> Result<VipsImage> {
12128 unsafe {
12129 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12130 let mut out_out: *mut bindings::VipsImage = null_mut();
12131
12132 let page_in: i32 = heifload_buffer_options.page;
12133 let page_in_name = utils::new_c_string("page")?;
12134
12135 let n_in: i32 = heifload_buffer_options.n;
12136 let n_in_name = utils::new_c_string("n")?;
12137
12138 let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
12139 1
12140 } else {
12141 0
12142 };
12143 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12144
12145 let unlimited_in: i32 = if heifload_buffer_options.unlimited {
12146 1
12147 } else {
12148 0
12149 };
12150 let unlimited_in_name = utils::new_c_string("unlimited")?;
12151
12152 let flags_in: i32 = heifload_buffer_options.flags as i32;
12153 let flags_in_name = utils::new_c_string("flags")?;
12154
12155 let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
12156 let memory_in_name = utils::new_c_string("memory")?;
12157
12158 let access_in: i32 = heifload_buffer_options.access as i32;
12159 let access_in_name = utils::new_c_string("access")?;
12160
12161 let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
12162 let fail_on_in_name = utils::new_c_string("fail-on")?;
12163
12164 let revalidate_in: i32 = if heifload_buffer_options.revalidate {
12165 1
12166 } else {
12167 0
12168 };
12169 let revalidate_in_name = utils::new_c_string("revalidate")?;
12170
12171 let vips_op_response = bindings::vips_heifload_buffer(
12172 buffer_in,
12173 buffer.len() as u64,
12174 &mut out_out,
12175 page_in_name.as_ptr(),
12176 page_in,
12177 n_in_name.as_ptr(),
12178 n_in,
12179 thumbnail_in_name.as_ptr(),
12180 thumbnail_in,
12181 unlimited_in_name.as_ptr(),
12182 unlimited_in,
12183 flags_in_name.as_ptr(),
12184 flags_in,
12185 memory_in_name.as_ptr(),
12186 memory_in,
12187 access_in_name.as_ptr(),
12188 access_in,
12189 fail_on_in_name.as_ptr(),
12190 fail_on_in,
12191 revalidate_in_name.as_ptr(),
12192 revalidate_in,
12193 NULL,
12194 );
12195 utils::result(
12196 vips_op_response,
12197 VipsImage { ctx: out_out },
12198 Error::HeifloadBufferError,
12199 )
12200 }
12201}
12202
12203pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
12207 unsafe {
12208 let source_in: *mut bindings::VipsSource = source.ctx;
12209 let mut out_out: *mut bindings::VipsImage = null_mut();
12210
12211 let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
12212 utils::result(
12213 vips_op_response,
12214 VipsImage { ctx: out_out },
12215 Error::HeifloadSourceError,
12216 )
12217 }
12218}
12219
12220#[derive(Clone, Debug)]
12222pub struct HeifloadSourceOptions {
12223 pub page: i32,
12226 pub n: i32,
12229 pub thumbnail: bool,
12232 pub unlimited: bool,
12235 pub flags: ForeignFlags,
12242 pub memory: bool,
12245 pub access: Access,
12251 pub fail_on: FailOn,
12258 pub revalidate: bool,
12261}
12262
12263impl std::default::Default for HeifloadSourceOptions {
12264 fn default() -> Self {
12265 HeifloadSourceOptions {
12266 page: i32::from(0),
12267 n: i32::from(1),
12268 thumbnail: false,
12269 unlimited: false,
12270 flags: ForeignFlags::None,
12271 memory: false,
12272 access: Access::Random,
12273 fail_on: FailOn::None,
12274 revalidate: false,
12275 }
12276 }
12277}
12278
12279pub fn heifload_source_with_opts(
12284 source: &VipsSource,
12285 heifload_source_options: &HeifloadSourceOptions,
12286) -> Result<VipsImage> {
12287 unsafe {
12288 let source_in: *mut bindings::VipsSource = source.ctx;
12289 let mut out_out: *mut bindings::VipsImage = null_mut();
12290
12291 let page_in: i32 = heifload_source_options.page;
12292 let page_in_name = utils::new_c_string("page")?;
12293
12294 let n_in: i32 = heifload_source_options.n;
12295 let n_in_name = utils::new_c_string("n")?;
12296
12297 let thumbnail_in: i32 = if heifload_source_options.thumbnail {
12298 1
12299 } else {
12300 0
12301 };
12302 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
12303
12304 let unlimited_in: i32 = if heifload_source_options.unlimited {
12305 1
12306 } else {
12307 0
12308 };
12309 let unlimited_in_name = utils::new_c_string("unlimited")?;
12310
12311 let flags_in: i32 = heifload_source_options.flags as i32;
12312 let flags_in_name = utils::new_c_string("flags")?;
12313
12314 let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
12315 let memory_in_name = utils::new_c_string("memory")?;
12316
12317 let access_in: i32 = heifload_source_options.access as i32;
12318 let access_in_name = utils::new_c_string("access")?;
12319
12320 let fail_on_in: i32 = heifload_source_options.fail_on as i32;
12321 let fail_on_in_name = utils::new_c_string("fail-on")?;
12322
12323 let revalidate_in: i32 = if heifload_source_options.revalidate {
12324 1
12325 } else {
12326 0
12327 };
12328 let revalidate_in_name = utils::new_c_string("revalidate")?;
12329
12330 let vips_op_response = bindings::vips_heifload_source(
12331 source_in,
12332 &mut out_out,
12333 page_in_name.as_ptr(),
12334 page_in,
12335 n_in_name.as_ptr(),
12336 n_in,
12337 thumbnail_in_name.as_ptr(),
12338 thumbnail_in,
12339 unlimited_in_name.as_ptr(),
12340 unlimited_in,
12341 flags_in_name.as_ptr(),
12342 flags_in,
12343 memory_in_name.as_ptr(),
12344 memory_in,
12345 access_in_name.as_ptr(),
12346 access_in,
12347 fail_on_in_name.as_ptr(),
12348 fail_on_in,
12349 revalidate_in_name.as_ptr(),
12350 revalidate_in,
12351 NULL,
12352 );
12353 utils::result(
12354 vips_op_response,
12355 VipsImage { ctx: out_out },
12356 Error::HeifloadSourceError,
12357 )
12358 }
12359}
12360
12361pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
12366 unsafe {
12367 let inp_in: *mut bindings::VipsImage = inp.ctx;
12368 let filename_in: CString = utils::new_c_string(filename)?;
12369
12370 let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
12371 utils::result(vips_op_response, (), Error::CsvsaveError)
12372 }
12373}
12374
12375#[derive(Clone, Debug)]
12377pub struct CsvsaveOptions {
12378 pub separator: String,
12380 pub keep: ForeignKeep,
12389 pub background: Vec<f64>,
12391 pub page_height: i32,
12394 pub profile: String,
12396}
12397
12398impl std::default::Default for CsvsaveOptions {
12399 fn default() -> Self {
12400 CsvsaveOptions {
12401 separator: String::new(),
12402 keep: ForeignKeep::All,
12403 background: Vec::new(),
12404 page_height: i32::from(0),
12405 profile: String::from("sRGB"),
12406 }
12407 }
12408}
12409
12410pub fn csvsave_with_opts(
12416 inp: &VipsImage,
12417 filename: &str,
12418 csvsave_options: &CsvsaveOptions,
12419) -> Result<()> {
12420 unsafe {
12421 let inp_in: *mut bindings::VipsImage = inp.ctx;
12422 let filename_in: CString = utils::new_c_string(filename)?;
12423
12424 let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
12425 let separator_in_name = utils::new_c_string("separator")?;
12426
12427 let keep_in: i32 = csvsave_options.keep as i32;
12428 let keep_in_name = utils::new_c_string("keep")?;
12429
12430 let background_wrapper =
12431 utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
12432 let background_in = background_wrapper.ctx;
12433 let background_in_name = utils::new_c_string("background")?;
12434
12435 let page_height_in: i32 = csvsave_options.page_height;
12436 let page_height_in_name = utils::new_c_string("page-height")?;
12437
12438 let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
12439 let profile_in_name = utils::new_c_string("profile")?;
12440
12441 let vips_op_response = bindings::vips_csvsave(
12442 inp_in,
12443 filename_in.as_ptr(),
12444 separator_in_name.as_ptr(),
12445 separator_in.as_ptr(),
12446 keep_in_name.as_ptr(),
12447 keep_in,
12448 background_in_name.as_ptr(),
12449 background_in,
12450 page_height_in_name.as_ptr(),
12451 page_height_in,
12452 profile_in_name.as_ptr(),
12453 profile_in.as_ptr(),
12454 NULL,
12455 );
12456 utils::result(vips_op_response, (), Error::CsvsaveError)
12457 }
12458}
12459
12460pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12465 unsafe {
12466 let inp_in: *mut bindings::VipsImage = inp.ctx;
12467 let target_in: *mut bindings::VipsTarget = target.ctx;
12468
12469 let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
12470 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12471 }
12472}
12473
12474#[derive(Clone, Debug)]
12476pub struct CsvsaveTargetOptions {
12477 pub separator: String,
12479 pub keep: ForeignKeep,
12488 pub background: Vec<f64>,
12490 pub page_height: i32,
12493 pub profile: String,
12495}
12496
12497impl std::default::Default for CsvsaveTargetOptions {
12498 fn default() -> Self {
12499 CsvsaveTargetOptions {
12500 separator: String::new(),
12501 keep: ForeignKeep::All,
12502 background: Vec::new(),
12503 page_height: i32::from(0),
12504 profile: String::from("sRGB"),
12505 }
12506 }
12507}
12508
12509pub fn csvsave_target_with_opts(
12515 inp: &VipsImage,
12516 target: &VipsTarget,
12517 csvsave_target_options: &CsvsaveTargetOptions,
12518) -> Result<()> {
12519 unsafe {
12520 let inp_in: *mut bindings::VipsImage = inp.ctx;
12521 let target_in: *mut bindings::VipsTarget = target.ctx;
12522
12523 let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
12524 let separator_in_name = utils::new_c_string("separator")?;
12525
12526 let keep_in: i32 = csvsave_target_options.keep as i32;
12527 let keep_in_name = utils::new_c_string("keep")?;
12528
12529 let background_wrapper =
12530 utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
12531 let background_in = background_wrapper.ctx;
12532 let background_in_name = utils::new_c_string("background")?;
12533
12534 let page_height_in: i32 = csvsave_target_options.page_height;
12535 let page_height_in_name = utils::new_c_string("page-height")?;
12536
12537 let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
12538 let profile_in_name = utils::new_c_string("profile")?;
12539
12540 let vips_op_response = bindings::vips_csvsave_target(
12541 inp_in,
12542 target_in,
12543 separator_in_name.as_ptr(),
12544 separator_in.as_ptr(),
12545 keep_in_name.as_ptr(),
12546 keep_in,
12547 background_in_name.as_ptr(),
12548 background_in,
12549 page_height_in_name.as_ptr(),
12550 page_height_in,
12551 profile_in_name.as_ptr(),
12552 profile_in.as_ptr(),
12553 NULL,
12554 );
12555 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
12556 }
12557}
12558
12559pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
12564 unsafe {
12565 let inp_in: *mut bindings::VipsImage = inp.ctx;
12566 let filename_in: CString = utils::new_c_string(filename)?;
12567
12568 let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
12569 utils::result(vips_op_response, (), Error::MatrixsaveError)
12570 }
12571}
12572
12573#[derive(Clone, Debug)]
12575pub struct MatrixsaveOptions {
12576 pub keep: ForeignKeep,
12585 pub background: Vec<f64>,
12587 pub page_height: i32,
12590 pub profile: String,
12592}
12593
12594impl std::default::Default for MatrixsaveOptions {
12595 fn default() -> Self {
12596 MatrixsaveOptions {
12597 keep: ForeignKeep::All,
12598 background: Vec::new(),
12599 page_height: i32::from(0),
12600 profile: String::from("sRGB"),
12601 }
12602 }
12603}
12604
12605pub fn matrixsave_with_opts(
12611 inp: &VipsImage,
12612 filename: &str,
12613 matrixsave_options: &MatrixsaveOptions,
12614) -> Result<()> {
12615 unsafe {
12616 let inp_in: *mut bindings::VipsImage = inp.ctx;
12617 let filename_in: CString = utils::new_c_string(filename)?;
12618
12619 let keep_in: i32 = matrixsave_options.keep as i32;
12620 let keep_in_name = utils::new_c_string("keep")?;
12621
12622 let background_wrapper =
12623 utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
12624 let background_in = background_wrapper.ctx;
12625 let background_in_name = utils::new_c_string("background")?;
12626
12627 let page_height_in: i32 = matrixsave_options.page_height;
12628 let page_height_in_name = utils::new_c_string("page-height")?;
12629
12630 let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
12631 let profile_in_name = utils::new_c_string("profile")?;
12632
12633 let vips_op_response = bindings::vips_matrixsave(
12634 inp_in,
12635 filename_in.as_ptr(),
12636 keep_in_name.as_ptr(),
12637 keep_in,
12638 background_in_name.as_ptr(),
12639 background_in,
12640 page_height_in_name.as_ptr(),
12641 page_height_in,
12642 profile_in_name.as_ptr(),
12643 profile_in.as_ptr(),
12644 NULL,
12645 );
12646 utils::result(vips_op_response, (), Error::MatrixsaveError)
12647 }
12648}
12649
12650pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
12655 unsafe {
12656 let inp_in: *mut bindings::VipsImage = inp.ctx;
12657 let target_in: *mut bindings::VipsTarget = target.ctx;
12658
12659 let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
12660 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12661 }
12662}
12663
12664#[derive(Clone, Debug)]
12666pub struct MatrixsaveTargetOptions {
12667 pub keep: ForeignKeep,
12676 pub background: Vec<f64>,
12678 pub page_height: i32,
12681 pub profile: String,
12683}
12684
12685impl std::default::Default for MatrixsaveTargetOptions {
12686 fn default() -> Self {
12687 MatrixsaveTargetOptions {
12688 keep: ForeignKeep::All,
12689 background: Vec::new(),
12690 page_height: i32::from(0),
12691 profile: String::from("sRGB"),
12692 }
12693 }
12694}
12695
12696pub fn matrixsave_target_with_opts(
12702 inp: &VipsImage,
12703 target: &VipsTarget,
12704 matrixsave_target_options: &MatrixsaveTargetOptions,
12705) -> Result<()> {
12706 unsafe {
12707 let inp_in: *mut bindings::VipsImage = inp.ctx;
12708 let target_in: *mut bindings::VipsTarget = target.ctx;
12709
12710 let keep_in: i32 = matrixsave_target_options.keep as i32;
12711 let keep_in_name = utils::new_c_string("keep")?;
12712
12713 let background_wrapper =
12714 utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
12715 let background_in = background_wrapper.ctx;
12716 let background_in_name = utils::new_c_string("background")?;
12717
12718 let page_height_in: i32 = matrixsave_target_options.page_height;
12719 let page_height_in_name = utils::new_c_string("page-height")?;
12720
12721 let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
12722 let profile_in_name = utils::new_c_string("profile")?;
12723
12724 let vips_op_response = bindings::vips_matrixsave_target(
12725 inp_in,
12726 target_in,
12727 keep_in_name.as_ptr(),
12728 keep_in,
12729 background_in_name.as_ptr(),
12730 background_in,
12731 page_height_in_name.as_ptr(),
12732 page_height_in,
12733 profile_in_name.as_ptr(),
12734 profile_in.as_ptr(),
12735 NULL,
12736 );
12737 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
12738 }
12739}
12740
12741pub fn matrixprint(inp: &VipsImage) -> Result<()> {
12745 unsafe {
12746 let inp_in: *mut bindings::VipsImage = inp.ctx;
12747
12748 let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
12749 utils::result(vips_op_response, (), Error::MatrixprintError)
12750 }
12751}
12752
12753#[derive(Clone, Debug)]
12755pub struct MatrixprintOptions {
12756 pub keep: ForeignKeep,
12765 pub background: Vec<f64>,
12767 pub page_height: i32,
12770 pub profile: String,
12772}
12773
12774impl std::default::Default for MatrixprintOptions {
12775 fn default() -> Self {
12776 MatrixprintOptions {
12777 keep: ForeignKeep::All,
12778 background: Vec::new(),
12779 page_height: i32::from(0),
12780 profile: String::from("sRGB"),
12781 }
12782 }
12783}
12784
12785pub fn matrixprint_with_opts(
12790 inp: &VipsImage,
12791 matrixprint_options: &MatrixprintOptions,
12792) -> Result<()> {
12793 unsafe {
12794 let inp_in: *mut bindings::VipsImage = inp.ctx;
12795
12796 let keep_in: i32 = matrixprint_options.keep as i32;
12797 let keep_in_name = utils::new_c_string("keep")?;
12798
12799 let background_wrapper =
12800 utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
12801 let background_in = background_wrapper.ctx;
12802 let background_in_name = utils::new_c_string("background")?;
12803
12804 let page_height_in: i32 = matrixprint_options.page_height;
12805 let page_height_in_name = utils::new_c_string("page-height")?;
12806
12807 let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
12808 let profile_in_name = utils::new_c_string("profile")?;
12809
12810 let vips_op_response = bindings::vips_matrixprint(
12811 inp_in,
12812 keep_in_name.as_ptr(),
12813 keep_in,
12814 background_in_name.as_ptr(),
12815 background_in,
12816 page_height_in_name.as_ptr(),
12817 page_height_in,
12818 profile_in_name.as_ptr(),
12819 profile_in.as_ptr(),
12820 NULL,
12821 );
12822 utils::result(vips_op_response, (), Error::MatrixprintError)
12823 }
12824}
12825
12826pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
12831 unsafe {
12832 let inp_in: *mut bindings::VipsImage = inp.ctx;
12833 let filename_in: CString = utils::new_c_string(filename)?;
12834
12835 let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
12836 utils::result(vips_op_response, (), Error::RawsaveError)
12837 }
12838}
12839
12840#[derive(Clone, Debug)]
12842pub struct RawsaveOptions {
12843 pub keep: ForeignKeep,
12852 pub background: Vec<f64>,
12854 pub page_height: i32,
12857 pub profile: String,
12859}
12860
12861impl std::default::Default for RawsaveOptions {
12862 fn default() -> Self {
12863 RawsaveOptions {
12864 keep: ForeignKeep::All,
12865 background: Vec::new(),
12866 page_height: i32::from(0),
12867 profile: String::from("sRGB"),
12868 }
12869 }
12870}
12871
12872pub fn rawsave_with_opts(
12878 inp: &VipsImage,
12879 filename: &str,
12880 rawsave_options: &RawsaveOptions,
12881) -> Result<()> {
12882 unsafe {
12883 let inp_in: *mut bindings::VipsImage = inp.ctx;
12884 let filename_in: CString = utils::new_c_string(filename)?;
12885
12886 let keep_in: i32 = rawsave_options.keep as i32;
12887 let keep_in_name = utils::new_c_string("keep")?;
12888
12889 let background_wrapper =
12890 utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
12891 let background_in = background_wrapper.ctx;
12892 let background_in_name = utils::new_c_string("background")?;
12893
12894 let page_height_in: i32 = rawsave_options.page_height;
12895 let page_height_in_name = utils::new_c_string("page-height")?;
12896
12897 let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
12898 let profile_in_name = utils::new_c_string("profile")?;
12899
12900 let vips_op_response = bindings::vips_rawsave(
12901 inp_in,
12902 filename_in.as_ptr(),
12903 keep_in_name.as_ptr(),
12904 keep_in,
12905 background_in_name.as_ptr(),
12906 background_in,
12907 page_height_in_name.as_ptr(),
12908 page_height_in,
12909 profile_in_name.as_ptr(),
12910 profile_in.as_ptr(),
12911 NULL,
12912 );
12913 utils::result(vips_op_response, (), Error::RawsaveError)
12914 }
12915}
12916
12917pub fn rawsave_fd(inp: &VipsImage, fd: i32) -> Result<()> {
12923 unsafe {
12924 let inp_in: *mut bindings::VipsImage = inp.ctx;
12925 let fd_in: i32 = fd;
12926
12927 let vips_op_response = bindings::vips_rawsave_fd(inp_in, fd_in, NULL);
12928 utils::result(vips_op_response, (), Error::RawsaveFdError)
12929 }
12930}
12931
12932#[derive(Clone, Debug)]
12934pub struct RawsaveFdOptions {
12935 pub keep: ForeignKeep,
12944 pub background: Vec<f64>,
12946 pub page_height: i32,
12949 pub profile: String,
12951}
12952
12953impl std::default::Default for RawsaveFdOptions {
12954 fn default() -> Self {
12955 RawsaveFdOptions {
12956 keep: ForeignKeep::All,
12957 background: Vec::new(),
12958 page_height: i32::from(0),
12959 profile: String::from("sRGB"),
12960 }
12961 }
12962}
12963
12964pub fn rawsave_fd_with_opts(
12971 inp: &VipsImage,
12972 fd: i32,
12973 rawsave_fd_options: &RawsaveFdOptions,
12974) -> Result<()> {
12975 unsafe {
12976 let inp_in: *mut bindings::VipsImage = inp.ctx;
12977 let fd_in: i32 = fd;
12978
12979 let keep_in: i32 = rawsave_fd_options.keep as i32;
12980 let keep_in_name = utils::new_c_string("keep")?;
12981
12982 let background_wrapper =
12983 utils::VipsArrayDoubleWrapper::from(&rawsave_fd_options.background[..]);
12984 let background_in = background_wrapper.ctx;
12985 let background_in_name = utils::new_c_string("background")?;
12986
12987 let page_height_in: i32 = rawsave_fd_options.page_height;
12988 let page_height_in_name = utils::new_c_string("page-height")?;
12989
12990 let profile_in: CString = utils::new_c_string(&rawsave_fd_options.profile)?;
12991 let profile_in_name = utils::new_c_string("profile")?;
12992
12993 let vips_op_response = bindings::vips_rawsave_fd(
12994 inp_in,
12995 fd_in,
12996 keep_in_name.as_ptr(),
12997 keep_in,
12998 background_in_name.as_ptr(),
12999 background_in,
13000 page_height_in_name.as_ptr(),
13001 page_height_in,
13002 profile_in_name.as_ptr(),
13003 profile_in.as_ptr(),
13004 NULL,
13005 );
13006 utils::result(vips_op_response, (), Error::RawsaveFdError)
13007 }
13008}
13009
13010pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
13015 unsafe {
13016 let inp_in: *mut bindings::VipsImage = inp.ctx;
13017 let filename_in: CString = utils::new_c_string(filename)?;
13018
13019 let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
13020 utils::result(vips_op_response, (), Error::VipssaveError)
13021 }
13022}
13023
13024#[derive(Clone, Debug)]
13026pub struct VipssaveOptions {
13027 pub keep: ForeignKeep,
13036 pub background: Vec<f64>,
13038 pub page_height: i32,
13041 pub profile: String,
13043}
13044
13045impl std::default::Default for VipssaveOptions {
13046 fn default() -> Self {
13047 VipssaveOptions {
13048 keep: ForeignKeep::All,
13049 background: Vec::new(),
13050 page_height: i32::from(0),
13051 profile: String::from("sRGB"),
13052 }
13053 }
13054}
13055
13056pub fn vipssave_with_opts(
13062 inp: &VipsImage,
13063 filename: &str,
13064 vipssave_options: &VipssaveOptions,
13065) -> Result<()> {
13066 unsafe {
13067 let inp_in: *mut bindings::VipsImage = inp.ctx;
13068 let filename_in: CString = utils::new_c_string(filename)?;
13069
13070 let keep_in: i32 = vipssave_options.keep as i32;
13071 let keep_in_name = utils::new_c_string("keep")?;
13072
13073 let background_wrapper =
13074 utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
13075 let background_in = background_wrapper.ctx;
13076 let background_in_name = utils::new_c_string("background")?;
13077
13078 let page_height_in: i32 = vipssave_options.page_height;
13079 let page_height_in_name = utils::new_c_string("page-height")?;
13080
13081 let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
13082 let profile_in_name = utils::new_c_string("profile")?;
13083
13084 let vips_op_response = bindings::vips_vipssave(
13085 inp_in,
13086 filename_in.as_ptr(),
13087 keep_in_name.as_ptr(),
13088 keep_in,
13089 background_in_name.as_ptr(),
13090 background_in,
13091 page_height_in_name.as_ptr(),
13092 page_height_in,
13093 profile_in_name.as_ptr(),
13094 profile_in.as_ptr(),
13095 NULL,
13096 );
13097 utils::result(vips_op_response, (), Error::VipssaveError)
13098 }
13099}
13100
13101pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13106 unsafe {
13107 let inp_in: *mut bindings::VipsImage = inp.ctx;
13108 let target_in: *mut bindings::VipsTarget = target.ctx;
13109
13110 let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
13111 utils::result(vips_op_response, (), Error::VipssaveTargetError)
13112 }
13113}
13114
13115#[derive(Clone, Debug)]
13117pub struct VipssaveTargetOptions {
13118 pub keep: ForeignKeep,
13127 pub background: Vec<f64>,
13129 pub page_height: i32,
13132 pub profile: String,
13134}
13135
13136impl std::default::Default for VipssaveTargetOptions {
13137 fn default() -> Self {
13138 VipssaveTargetOptions {
13139 keep: ForeignKeep::All,
13140 background: Vec::new(),
13141 page_height: i32::from(0),
13142 profile: String::from("sRGB"),
13143 }
13144 }
13145}
13146
13147pub fn vipssave_target_with_opts(
13153 inp: &VipsImage,
13154 target: &VipsTarget,
13155 vipssave_target_options: &VipssaveTargetOptions,
13156) -> Result<()> {
13157 unsafe {
13158 let inp_in: *mut bindings::VipsImage = inp.ctx;
13159 let target_in: *mut bindings::VipsTarget = target.ctx;
13160
13161 let keep_in: i32 = vipssave_target_options.keep as i32;
13162 let keep_in_name = utils::new_c_string("keep")?;
13163
13164 let background_wrapper =
13165 utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
13166 let background_in = background_wrapper.ctx;
13167 let background_in_name = utils::new_c_string("background")?;
13168
13169 let page_height_in: i32 = vipssave_target_options.page_height;
13170 let page_height_in_name = utils::new_c_string("page-height")?;
13171
13172 let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
13173 let profile_in_name = utils::new_c_string("profile")?;
13174
13175 let vips_op_response = bindings::vips_vipssave_target(
13176 inp_in,
13177 target_in,
13178 keep_in_name.as_ptr(),
13179 keep_in,
13180 background_in_name.as_ptr(),
13181 background_in,
13182 page_height_in_name.as_ptr(),
13183 page_height_in,
13184 profile_in_name.as_ptr(),
13185 profile_in.as_ptr(),
13186 NULL,
13187 );
13188 utils::result(vips_op_response, (), Error::VipssaveTargetError)
13189 }
13190}
13191
13192pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
13197 unsafe {
13198 let inp_in: *mut bindings::VipsImage = inp.ctx;
13199 let filename_in: CString = utils::new_c_string(filename)?;
13200
13201 let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
13202 utils::result(vips_op_response, (), Error::PpmsaveError)
13203 }
13204}
13205
13206#[derive(Clone, Debug)]
13208pub struct PpmsaveOptions {
13209 pub format: ForeignPpmFormat,
13217 pub ascii: bool,
13220 pub bitdepth: i32,
13223 pub keep: ForeignKeep,
13232 pub background: Vec<f64>,
13234 pub page_height: i32,
13237 pub profile: String,
13239}
13240
13241impl std::default::Default for PpmsaveOptions {
13242 fn default() -> Self {
13243 PpmsaveOptions {
13244 format: ForeignPpmFormat::Ppm,
13245 ascii: false,
13246 bitdepth: i32::from(0),
13247 keep: ForeignKeep::All,
13248 background: Vec::new(),
13249 page_height: i32::from(0),
13250 profile: String::from("sRGB"),
13251 }
13252 }
13253}
13254
13255pub fn ppmsave_with_opts(
13261 inp: &VipsImage,
13262 filename: &str,
13263 ppmsave_options: &PpmsaveOptions,
13264) -> Result<()> {
13265 unsafe {
13266 let inp_in: *mut bindings::VipsImage = inp.ctx;
13267 let filename_in: CString = utils::new_c_string(filename)?;
13268
13269 let format_in: i32 = ppmsave_options.format as i32;
13270 let format_in_name = utils::new_c_string("format")?;
13271
13272 let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
13273 let ascii_in_name = utils::new_c_string("ascii")?;
13274
13275 let bitdepth_in: i32 = ppmsave_options.bitdepth;
13276 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13277
13278 let keep_in: i32 = ppmsave_options.keep as i32;
13279 let keep_in_name = utils::new_c_string("keep")?;
13280
13281 let background_wrapper =
13282 utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
13283 let background_in = background_wrapper.ctx;
13284 let background_in_name = utils::new_c_string("background")?;
13285
13286 let page_height_in: i32 = ppmsave_options.page_height;
13287 let page_height_in_name = utils::new_c_string("page-height")?;
13288
13289 let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
13290 let profile_in_name = utils::new_c_string("profile")?;
13291
13292 let vips_op_response = bindings::vips_ppmsave(
13293 inp_in,
13294 filename_in.as_ptr(),
13295 format_in_name.as_ptr(),
13296 format_in,
13297 ascii_in_name.as_ptr(),
13298 ascii_in,
13299 bitdepth_in_name.as_ptr(),
13300 bitdepth_in,
13301 keep_in_name.as_ptr(),
13302 keep_in,
13303 background_in_name.as_ptr(),
13304 background_in,
13305 page_height_in_name.as_ptr(),
13306 page_height_in,
13307 profile_in_name.as_ptr(),
13308 profile_in.as_ptr(),
13309 NULL,
13310 );
13311 utils::result(vips_op_response, (), Error::PpmsaveError)
13312 }
13313}
13314
13315pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13320 unsafe {
13321 let inp_in: *mut bindings::VipsImage = inp.ctx;
13322 let target_in: *mut bindings::VipsTarget = target.ctx;
13323
13324 let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
13325 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13326 }
13327}
13328
13329#[derive(Clone, Debug)]
13331pub struct PpmsaveTargetOptions {
13332 pub format: ForeignPpmFormat,
13340 pub ascii: bool,
13343 pub bitdepth: i32,
13346 pub keep: ForeignKeep,
13355 pub background: Vec<f64>,
13357 pub page_height: i32,
13360 pub profile: String,
13362}
13363
13364impl std::default::Default for PpmsaveTargetOptions {
13365 fn default() -> Self {
13366 PpmsaveTargetOptions {
13367 format: ForeignPpmFormat::Ppm,
13368 ascii: false,
13369 bitdepth: i32::from(0),
13370 keep: ForeignKeep::All,
13371 background: Vec::new(),
13372 page_height: i32::from(0),
13373 profile: String::from("sRGB"),
13374 }
13375 }
13376}
13377
13378pub fn ppmsave_target_with_opts(
13384 inp: &VipsImage,
13385 target: &VipsTarget,
13386 ppmsave_target_options: &PpmsaveTargetOptions,
13387) -> Result<()> {
13388 unsafe {
13389 let inp_in: *mut bindings::VipsImage = inp.ctx;
13390 let target_in: *mut bindings::VipsTarget = target.ctx;
13391
13392 let format_in: i32 = ppmsave_target_options.format as i32;
13393 let format_in_name = utils::new_c_string("format")?;
13394
13395 let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
13396 let ascii_in_name = utils::new_c_string("ascii")?;
13397
13398 let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
13399 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13400
13401 let keep_in: i32 = ppmsave_target_options.keep as i32;
13402 let keep_in_name = utils::new_c_string("keep")?;
13403
13404 let background_wrapper =
13405 utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
13406 let background_in = background_wrapper.ctx;
13407 let background_in_name = utils::new_c_string("background")?;
13408
13409 let page_height_in: i32 = ppmsave_target_options.page_height;
13410 let page_height_in_name = utils::new_c_string("page-height")?;
13411
13412 let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
13413 let profile_in_name = utils::new_c_string("profile")?;
13414
13415 let vips_op_response = bindings::vips_ppmsave_target(
13416 inp_in,
13417 target_in,
13418 format_in_name.as_ptr(),
13419 format_in,
13420 ascii_in_name.as_ptr(),
13421 ascii_in,
13422 bitdepth_in_name.as_ptr(),
13423 bitdepth_in,
13424 keep_in_name.as_ptr(),
13425 keep_in,
13426 background_in_name.as_ptr(),
13427 background_in,
13428 page_height_in_name.as_ptr(),
13429 page_height_in,
13430 profile_in_name.as_ptr(),
13431 profile_in.as_ptr(),
13432 NULL,
13433 );
13434 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
13435 }
13436}
13437
13438pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
13443 unsafe {
13444 let inp_in: *mut bindings::VipsImage = inp.ctx;
13445 let filename_in: CString = utils::new_c_string(filename)?;
13446
13447 let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
13448 utils::result(vips_op_response, (), Error::RadsaveError)
13449 }
13450}
13451
13452#[derive(Clone, Debug)]
13454pub struct RadsaveOptions {
13455 pub keep: ForeignKeep,
13464 pub background: Vec<f64>,
13466 pub page_height: i32,
13469 pub profile: String,
13471}
13472
13473impl std::default::Default for RadsaveOptions {
13474 fn default() -> Self {
13475 RadsaveOptions {
13476 keep: ForeignKeep::All,
13477 background: Vec::new(),
13478 page_height: i32::from(0),
13479 profile: String::from("sRGB"),
13480 }
13481 }
13482}
13483
13484pub fn radsave_with_opts(
13490 inp: &VipsImage,
13491 filename: &str,
13492 radsave_options: &RadsaveOptions,
13493) -> Result<()> {
13494 unsafe {
13495 let inp_in: *mut bindings::VipsImage = inp.ctx;
13496 let filename_in: CString = utils::new_c_string(filename)?;
13497
13498 let keep_in: i32 = radsave_options.keep as i32;
13499 let keep_in_name = utils::new_c_string("keep")?;
13500
13501 let background_wrapper =
13502 utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
13503 let background_in = background_wrapper.ctx;
13504 let background_in_name = utils::new_c_string("background")?;
13505
13506 let page_height_in: i32 = radsave_options.page_height;
13507 let page_height_in_name = utils::new_c_string("page-height")?;
13508
13509 let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
13510 let profile_in_name = utils::new_c_string("profile")?;
13511
13512 let vips_op_response = bindings::vips_radsave(
13513 inp_in,
13514 filename_in.as_ptr(),
13515 keep_in_name.as_ptr(),
13516 keep_in,
13517 background_in_name.as_ptr(),
13518 background_in,
13519 page_height_in_name.as_ptr(),
13520 page_height_in,
13521 profile_in_name.as_ptr(),
13522 profile_in.as_ptr(),
13523 NULL,
13524 );
13525 utils::result(vips_op_response, (), Error::RadsaveError)
13526 }
13527}
13528
13529pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13533 unsafe {
13534 let inp_in: *mut bindings::VipsImage = inp.ctx;
13535 let mut buffer_buf_size: u64 = 0;
13536 let mut buffer_out: *mut c_void = null_mut();
13537
13538 let vips_op_response =
13539 bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13540 utils::result(
13541 vips_op_response,
13542 utils::new_byte_array(buffer_out, buffer_buf_size),
13543 Error::RadsaveBufferError,
13544 )
13545 }
13546}
13547
13548#[derive(Clone, Debug)]
13550pub struct RadsaveBufferOptions {
13551 pub keep: ForeignKeep,
13560 pub background: Vec<f64>,
13562 pub page_height: i32,
13565 pub profile: String,
13567}
13568
13569impl std::default::Default for RadsaveBufferOptions {
13570 fn default() -> Self {
13571 RadsaveBufferOptions {
13572 keep: ForeignKeep::All,
13573 background: Vec::new(),
13574 page_height: i32::from(0),
13575 profile: String::from("sRGB"),
13576 }
13577 }
13578}
13579
13580pub fn radsave_buffer_with_opts(
13585 inp: &VipsImage,
13586 radsave_buffer_options: &RadsaveBufferOptions,
13587) -> Result<Vec<u8>> {
13588 unsafe {
13589 let inp_in: *mut bindings::VipsImage = inp.ctx;
13590 let mut buffer_buf_size: u64 = 0;
13591 let mut buffer_out: *mut c_void = null_mut();
13592
13593 let keep_in: i32 = radsave_buffer_options.keep as i32;
13594 let keep_in_name = utils::new_c_string("keep")?;
13595
13596 let background_wrapper =
13597 utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
13598 let background_in = background_wrapper.ctx;
13599 let background_in_name = utils::new_c_string("background")?;
13600
13601 let page_height_in: i32 = radsave_buffer_options.page_height;
13602 let page_height_in_name = utils::new_c_string("page-height")?;
13603
13604 let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
13605 let profile_in_name = utils::new_c_string("profile")?;
13606
13607 let vips_op_response = bindings::vips_radsave_buffer(
13608 inp_in,
13609 &mut buffer_out,
13610 &mut buffer_buf_size,
13611 keep_in_name.as_ptr(),
13612 keep_in,
13613 background_in_name.as_ptr(),
13614 background_in,
13615 page_height_in_name.as_ptr(),
13616 page_height_in,
13617 profile_in_name.as_ptr(),
13618 profile_in.as_ptr(),
13619 NULL,
13620 );
13621 utils::result(
13622 vips_op_response,
13623 utils::new_byte_array(buffer_out, buffer_buf_size),
13624 Error::RadsaveBufferError,
13625 )
13626 }
13627}
13628
13629pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
13634 unsafe {
13635 let inp_in: *mut bindings::VipsImage = inp.ctx;
13636 let target_in: *mut bindings::VipsTarget = target.ctx;
13637
13638 let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
13639 utils::result(vips_op_response, (), Error::RadsaveTargetError)
13640 }
13641}
13642
13643#[derive(Clone, Debug)]
13645pub struct RadsaveTargetOptions {
13646 pub keep: ForeignKeep,
13655 pub background: Vec<f64>,
13657 pub page_height: i32,
13660 pub profile: String,
13662}
13663
13664impl std::default::Default for RadsaveTargetOptions {
13665 fn default() -> Self {
13666 RadsaveTargetOptions {
13667 keep: ForeignKeep::All,
13668 background: Vec::new(),
13669 page_height: i32::from(0),
13670 profile: String::from("sRGB"),
13671 }
13672 }
13673}
13674
13675pub fn radsave_target_with_opts(
13681 inp: &VipsImage,
13682 target: &VipsTarget,
13683 radsave_target_options: &RadsaveTargetOptions,
13684) -> Result<()> {
13685 unsafe {
13686 let inp_in: *mut bindings::VipsImage = inp.ctx;
13687 let target_in: *mut bindings::VipsTarget = target.ctx;
13688
13689 let keep_in: i32 = radsave_target_options.keep as i32;
13690 let keep_in_name = utils::new_c_string("keep")?;
13691
13692 let background_wrapper =
13693 utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
13694 let background_in = background_wrapper.ctx;
13695 let background_in_name = utils::new_c_string("background")?;
13696
13697 let page_height_in: i32 = radsave_target_options.page_height;
13698 let page_height_in_name = utils::new_c_string("page-height")?;
13699
13700 let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
13701 let profile_in_name = utils::new_c_string("profile")?;
13702
13703 let vips_op_response = bindings::vips_radsave_target(
13704 inp_in,
13705 target_in,
13706 keep_in_name.as_ptr(),
13707 keep_in,
13708 background_in_name.as_ptr(),
13709 background_in,
13710 page_height_in_name.as_ptr(),
13711 page_height_in,
13712 profile_in_name.as_ptr(),
13713 profile_in.as_ptr(),
13714 NULL,
13715 );
13716 utils::result(vips_op_response, (), Error::RadsaveTargetError)
13717 }
13718}
13719
13720pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
13725 unsafe {
13726 let inp_in: *mut bindings::VipsImage = inp.ctx;
13727 let filename_in: CString = utils::new_c_string(filename)?;
13728
13729 let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
13730 utils::result(vips_op_response, (), Error::GifsaveError)
13731 }
13732}
13733
13734#[derive(Clone, Debug)]
13736pub struct GifsaveOptions {
13737 pub dither: f64,
13740 pub effort: i32,
13743 pub bitdepth: i32,
13746 pub interframe_maxerror: f64,
13749 pub reuse: bool,
13752 pub interpalette_maxerror: f64,
13755 pub interlace: bool,
13758 pub keep: ForeignKeep,
13767 pub background: Vec<f64>,
13769 pub page_height: i32,
13772 pub profile: String,
13774}
13775
13776impl std::default::Default for GifsaveOptions {
13777 fn default() -> Self {
13778 GifsaveOptions {
13779 dither: f64::from(1),
13780 effort: i32::from(7),
13781 bitdepth: i32::from(8),
13782 interframe_maxerror: f64::from(0),
13783 reuse: false,
13784 interpalette_maxerror: f64::from(3),
13785 interlace: false,
13786 keep: ForeignKeep::All,
13787 background: Vec::new(),
13788 page_height: i32::from(0),
13789 profile: String::from("sRGB"),
13790 }
13791 }
13792}
13793
13794pub fn gifsave_with_opts(
13800 inp: &VipsImage,
13801 filename: &str,
13802 gifsave_options: &GifsaveOptions,
13803) -> Result<()> {
13804 unsafe {
13805 let inp_in: *mut bindings::VipsImage = inp.ctx;
13806 let filename_in: CString = utils::new_c_string(filename)?;
13807
13808 let dither_in: f64 = gifsave_options.dither;
13809 let dither_in_name = utils::new_c_string("dither")?;
13810
13811 let effort_in: i32 = gifsave_options.effort;
13812 let effort_in_name = utils::new_c_string("effort")?;
13813
13814 let bitdepth_in: i32 = gifsave_options.bitdepth;
13815 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13816
13817 let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
13818 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
13819
13820 let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
13821 let reuse_in_name = utils::new_c_string("reuse")?;
13822
13823 let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
13824 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
13825
13826 let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
13827 let interlace_in_name = utils::new_c_string("interlace")?;
13828
13829 let keep_in: i32 = gifsave_options.keep as i32;
13830 let keep_in_name = utils::new_c_string("keep")?;
13831
13832 let background_wrapper =
13833 utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
13834 let background_in = background_wrapper.ctx;
13835 let background_in_name = utils::new_c_string("background")?;
13836
13837 let page_height_in: i32 = gifsave_options.page_height;
13838 let page_height_in_name = utils::new_c_string("page-height")?;
13839
13840 let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
13841 let profile_in_name = utils::new_c_string("profile")?;
13842
13843 let vips_op_response = bindings::vips_gifsave(
13844 inp_in,
13845 filename_in.as_ptr(),
13846 dither_in_name.as_ptr(),
13847 dither_in,
13848 effort_in_name.as_ptr(),
13849 effort_in,
13850 bitdepth_in_name.as_ptr(),
13851 bitdepth_in,
13852 interframe_maxerror_in_name.as_ptr(),
13853 interframe_maxerror_in,
13854 reuse_in_name.as_ptr(),
13855 reuse_in,
13856 interpalette_maxerror_in_name.as_ptr(),
13857 interpalette_maxerror_in,
13858 interlace_in_name.as_ptr(),
13859 interlace_in,
13860 keep_in_name.as_ptr(),
13861 keep_in,
13862 background_in_name.as_ptr(),
13863 background_in,
13864 page_height_in_name.as_ptr(),
13865 page_height_in,
13866 profile_in_name.as_ptr(),
13867 profile_in.as_ptr(),
13868 NULL,
13869 );
13870 utils::result(vips_op_response, (), Error::GifsaveError)
13871 }
13872}
13873
13874pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
13878 unsafe {
13879 let inp_in: *mut bindings::VipsImage = inp.ctx;
13880 let mut buffer_buf_size: u64 = 0;
13881 let mut buffer_out: *mut c_void = null_mut();
13882
13883 let vips_op_response =
13884 bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
13885 utils::result(
13886 vips_op_response,
13887 utils::new_byte_array(buffer_out, buffer_buf_size),
13888 Error::GifsaveBufferError,
13889 )
13890 }
13891}
13892
13893#[derive(Clone, Debug)]
13895pub struct GifsaveBufferOptions {
13896 pub dither: f64,
13899 pub effort: i32,
13902 pub bitdepth: i32,
13905 pub interframe_maxerror: f64,
13908 pub reuse: bool,
13911 pub interpalette_maxerror: f64,
13914 pub interlace: bool,
13917 pub keep: ForeignKeep,
13926 pub background: Vec<f64>,
13928 pub page_height: i32,
13931 pub profile: String,
13933}
13934
13935impl std::default::Default for GifsaveBufferOptions {
13936 fn default() -> Self {
13937 GifsaveBufferOptions {
13938 dither: f64::from(1),
13939 effort: i32::from(7),
13940 bitdepth: i32::from(8),
13941 interframe_maxerror: f64::from(0),
13942 reuse: false,
13943 interpalette_maxerror: f64::from(3),
13944 interlace: false,
13945 keep: ForeignKeep::All,
13946 background: Vec::new(),
13947 page_height: i32::from(0),
13948 profile: String::from("sRGB"),
13949 }
13950 }
13951}
13952
13953pub fn gifsave_buffer_with_opts(
13958 inp: &VipsImage,
13959 gifsave_buffer_options: &GifsaveBufferOptions,
13960) -> Result<Vec<u8>> {
13961 unsafe {
13962 let inp_in: *mut bindings::VipsImage = inp.ctx;
13963 let mut buffer_buf_size: u64 = 0;
13964 let mut buffer_out: *mut c_void = null_mut();
13965
13966 let dither_in: f64 = gifsave_buffer_options.dither;
13967 let dither_in_name = utils::new_c_string("dither")?;
13968
13969 let effort_in: i32 = gifsave_buffer_options.effort;
13970 let effort_in_name = utils::new_c_string("effort")?;
13971
13972 let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
13973 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
13974
13975 let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
13976 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
13977
13978 let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
13979 let reuse_in_name = utils::new_c_string("reuse")?;
13980
13981 let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
13982 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
13983
13984 let interlace_in: i32 = if gifsave_buffer_options.interlace {
13985 1
13986 } else {
13987 0
13988 };
13989 let interlace_in_name = utils::new_c_string("interlace")?;
13990
13991 let keep_in: i32 = gifsave_buffer_options.keep as i32;
13992 let keep_in_name = utils::new_c_string("keep")?;
13993
13994 let background_wrapper =
13995 utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
13996 let background_in = background_wrapper.ctx;
13997 let background_in_name = utils::new_c_string("background")?;
13998
13999 let page_height_in: i32 = gifsave_buffer_options.page_height;
14000 let page_height_in_name = utils::new_c_string("page-height")?;
14001
14002 let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
14003 let profile_in_name = utils::new_c_string("profile")?;
14004
14005 let vips_op_response = bindings::vips_gifsave_buffer(
14006 inp_in,
14007 &mut buffer_out,
14008 &mut buffer_buf_size,
14009 dither_in_name.as_ptr(),
14010 dither_in,
14011 effort_in_name.as_ptr(),
14012 effort_in,
14013 bitdepth_in_name.as_ptr(),
14014 bitdepth_in,
14015 interframe_maxerror_in_name.as_ptr(),
14016 interframe_maxerror_in,
14017 reuse_in_name.as_ptr(),
14018 reuse_in,
14019 interpalette_maxerror_in_name.as_ptr(),
14020 interpalette_maxerror_in,
14021 interlace_in_name.as_ptr(),
14022 interlace_in,
14023 keep_in_name.as_ptr(),
14024 keep_in,
14025 background_in_name.as_ptr(),
14026 background_in,
14027 page_height_in_name.as_ptr(),
14028 page_height_in,
14029 profile_in_name.as_ptr(),
14030 profile_in.as_ptr(),
14031 NULL,
14032 );
14033 utils::result(
14034 vips_op_response,
14035 utils::new_byte_array(buffer_out, buffer_buf_size),
14036 Error::GifsaveBufferError,
14037 )
14038 }
14039}
14040
14041pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14046 unsafe {
14047 let inp_in: *mut bindings::VipsImage = inp.ctx;
14048 let target_in: *mut bindings::VipsTarget = target.ctx;
14049
14050 let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
14051 utils::result(vips_op_response, (), Error::GifsaveTargetError)
14052 }
14053}
14054
14055#[derive(Clone, Debug)]
14057pub struct GifsaveTargetOptions {
14058 pub dither: f64,
14061 pub effort: i32,
14064 pub bitdepth: i32,
14067 pub interframe_maxerror: f64,
14070 pub reuse: bool,
14073 pub interpalette_maxerror: f64,
14076 pub interlace: bool,
14079 pub keep: ForeignKeep,
14088 pub background: Vec<f64>,
14090 pub page_height: i32,
14093 pub profile: String,
14095}
14096
14097impl std::default::Default for GifsaveTargetOptions {
14098 fn default() -> Self {
14099 GifsaveTargetOptions {
14100 dither: f64::from(1),
14101 effort: i32::from(7),
14102 bitdepth: i32::from(8),
14103 interframe_maxerror: f64::from(0),
14104 reuse: false,
14105 interpalette_maxerror: f64::from(3),
14106 interlace: false,
14107 keep: ForeignKeep::All,
14108 background: Vec::new(),
14109 page_height: i32::from(0),
14110 profile: String::from("sRGB"),
14111 }
14112 }
14113}
14114
14115pub fn gifsave_target_with_opts(
14121 inp: &VipsImage,
14122 target: &VipsTarget,
14123 gifsave_target_options: &GifsaveTargetOptions,
14124) -> Result<()> {
14125 unsafe {
14126 let inp_in: *mut bindings::VipsImage = inp.ctx;
14127 let target_in: *mut bindings::VipsTarget = target.ctx;
14128
14129 let dither_in: f64 = gifsave_target_options.dither;
14130 let dither_in_name = utils::new_c_string("dither")?;
14131
14132 let effort_in: i32 = gifsave_target_options.effort;
14133 let effort_in_name = utils::new_c_string("effort")?;
14134
14135 let bitdepth_in: i32 = gifsave_target_options.bitdepth;
14136 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14137
14138 let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
14139 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
14140
14141 let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
14142 let reuse_in_name = utils::new_c_string("reuse")?;
14143
14144 let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
14145 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
14146
14147 let interlace_in: i32 = if gifsave_target_options.interlace {
14148 1
14149 } else {
14150 0
14151 };
14152 let interlace_in_name = utils::new_c_string("interlace")?;
14153
14154 let keep_in: i32 = gifsave_target_options.keep as i32;
14155 let keep_in_name = utils::new_c_string("keep")?;
14156
14157 let background_wrapper =
14158 utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
14159 let background_in = background_wrapper.ctx;
14160 let background_in_name = utils::new_c_string("background")?;
14161
14162 let page_height_in: i32 = gifsave_target_options.page_height;
14163 let page_height_in_name = utils::new_c_string("page-height")?;
14164
14165 let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
14166 let profile_in_name = utils::new_c_string("profile")?;
14167
14168 let vips_op_response = bindings::vips_gifsave_target(
14169 inp_in,
14170 target_in,
14171 dither_in_name.as_ptr(),
14172 dither_in,
14173 effort_in_name.as_ptr(),
14174 effort_in,
14175 bitdepth_in_name.as_ptr(),
14176 bitdepth_in,
14177 interframe_maxerror_in_name.as_ptr(),
14178 interframe_maxerror_in,
14179 reuse_in_name.as_ptr(),
14180 reuse_in,
14181 interpalette_maxerror_in_name.as_ptr(),
14182 interpalette_maxerror_in,
14183 interlace_in_name.as_ptr(),
14184 interlace_in,
14185 keep_in_name.as_ptr(),
14186 keep_in,
14187 background_in_name.as_ptr(),
14188 background_in,
14189 page_height_in_name.as_ptr(),
14190 page_height_in,
14191 profile_in_name.as_ptr(),
14192 profile_in.as_ptr(),
14193 NULL,
14194 );
14195 utils::result(vips_op_response, (), Error::GifsaveTargetError)
14196 }
14197}
14198
14199pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
14204 unsafe {
14205 let inp_in: *mut bindings::VipsImage = inp.ctx;
14206 let filename_in: CString = utils::new_c_string(filename)?;
14207
14208 let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
14209 utils::result(vips_op_response, (), Error::PngsaveError)
14210 }
14211}
14212
14213#[derive(Clone, Debug)]
14215pub struct PngsaveOptions {
14216 pub compression: i32,
14219 pub interlace: bool,
14222 pub filter: ForeignPngFilter,
14230 pub palette: bool,
14233 pub q: i32,
14236 pub dither: f64,
14239 pub bitdepth: i32,
14242 pub effort: i32,
14245 pub keep: ForeignKeep,
14254 pub background: Vec<f64>,
14256 pub page_height: i32,
14259 pub profile: String,
14261}
14262
14263impl std::default::Default for PngsaveOptions {
14264 fn default() -> Self {
14265 PngsaveOptions {
14266 compression: i32::from(6),
14267 interlace: false,
14268 filter: ForeignPngFilter::None,
14269 palette: false,
14270 q: i32::from(100),
14271 dither: f64::from(1),
14272 bitdepth: i32::from(8),
14273 effort: i32::from(7),
14274 keep: ForeignKeep::All,
14275 background: Vec::new(),
14276 page_height: i32::from(0),
14277 profile: String::from("sRGB"),
14278 }
14279 }
14280}
14281
14282pub fn pngsave_with_opts(
14288 inp: &VipsImage,
14289 filename: &str,
14290 pngsave_options: &PngsaveOptions,
14291) -> Result<()> {
14292 unsafe {
14293 let inp_in: *mut bindings::VipsImage = inp.ctx;
14294 let filename_in: CString = utils::new_c_string(filename)?;
14295
14296 let compression_in: i32 = pngsave_options.compression;
14297 let compression_in_name = utils::new_c_string("compression")?;
14298
14299 let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
14300 let interlace_in_name = utils::new_c_string("interlace")?;
14301
14302 let filter_in: i32 = pngsave_options.filter as i32;
14303 let filter_in_name = utils::new_c_string("filter")?;
14304
14305 let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
14306 let palette_in_name = utils::new_c_string("palette")?;
14307
14308 let q_in: i32 = pngsave_options.q;
14309 let q_in_name = utils::new_c_string("Q")?;
14310
14311 let dither_in: f64 = pngsave_options.dither;
14312 let dither_in_name = utils::new_c_string("dither")?;
14313
14314 let bitdepth_in: i32 = pngsave_options.bitdepth;
14315 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14316
14317 let effort_in: i32 = pngsave_options.effort;
14318 let effort_in_name = utils::new_c_string("effort")?;
14319
14320 let keep_in: i32 = pngsave_options.keep as i32;
14321 let keep_in_name = utils::new_c_string("keep")?;
14322
14323 let background_wrapper =
14324 utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
14325 let background_in = background_wrapper.ctx;
14326 let background_in_name = utils::new_c_string("background")?;
14327
14328 let page_height_in: i32 = pngsave_options.page_height;
14329 let page_height_in_name = utils::new_c_string("page-height")?;
14330
14331 let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
14332 let profile_in_name = utils::new_c_string("profile")?;
14333
14334 let vips_op_response = bindings::vips_pngsave(
14335 inp_in,
14336 filename_in.as_ptr(),
14337 compression_in_name.as_ptr(),
14338 compression_in,
14339 interlace_in_name.as_ptr(),
14340 interlace_in,
14341 filter_in_name.as_ptr(),
14342 filter_in,
14343 palette_in_name.as_ptr(),
14344 palette_in,
14345 q_in_name.as_ptr(),
14346 q_in,
14347 dither_in_name.as_ptr(),
14348 dither_in,
14349 bitdepth_in_name.as_ptr(),
14350 bitdepth_in,
14351 effort_in_name.as_ptr(),
14352 effort_in,
14353 keep_in_name.as_ptr(),
14354 keep_in,
14355 background_in_name.as_ptr(),
14356 background_in,
14357 page_height_in_name.as_ptr(),
14358 page_height_in,
14359 profile_in_name.as_ptr(),
14360 profile_in.as_ptr(),
14361 NULL,
14362 );
14363 utils::result(vips_op_response, (), Error::PngsaveError)
14364 }
14365}
14366
14367pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14371 unsafe {
14372 let inp_in: *mut bindings::VipsImage = inp.ctx;
14373 let mut buffer_buf_size: u64 = 0;
14374 let mut buffer_out: *mut c_void = null_mut();
14375
14376 let vips_op_response =
14377 bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14378 utils::result(
14379 vips_op_response,
14380 utils::new_byte_array(buffer_out, buffer_buf_size),
14381 Error::PngsaveBufferError,
14382 )
14383 }
14384}
14385
14386#[derive(Clone, Debug)]
14388pub struct PngsaveBufferOptions {
14389 pub compression: i32,
14392 pub interlace: bool,
14395 pub filter: ForeignPngFilter,
14403 pub palette: bool,
14406 pub q: i32,
14409 pub dither: f64,
14412 pub bitdepth: i32,
14415 pub effort: i32,
14418 pub keep: ForeignKeep,
14427 pub background: Vec<f64>,
14429 pub page_height: i32,
14432 pub profile: String,
14434}
14435
14436impl std::default::Default for PngsaveBufferOptions {
14437 fn default() -> Self {
14438 PngsaveBufferOptions {
14439 compression: i32::from(6),
14440 interlace: false,
14441 filter: ForeignPngFilter::None,
14442 palette: false,
14443 q: i32::from(100),
14444 dither: f64::from(1),
14445 bitdepth: i32::from(8),
14446 effort: i32::from(7),
14447 keep: ForeignKeep::All,
14448 background: Vec::new(),
14449 page_height: i32::from(0),
14450 profile: String::from("sRGB"),
14451 }
14452 }
14453}
14454
14455pub fn pngsave_buffer_with_opts(
14460 inp: &VipsImage,
14461 pngsave_buffer_options: &PngsaveBufferOptions,
14462) -> Result<Vec<u8>> {
14463 unsafe {
14464 let inp_in: *mut bindings::VipsImage = inp.ctx;
14465 let mut buffer_buf_size: u64 = 0;
14466 let mut buffer_out: *mut c_void = null_mut();
14467
14468 let compression_in: i32 = pngsave_buffer_options.compression;
14469 let compression_in_name = utils::new_c_string("compression")?;
14470
14471 let interlace_in: i32 = if pngsave_buffer_options.interlace {
14472 1
14473 } else {
14474 0
14475 };
14476 let interlace_in_name = utils::new_c_string("interlace")?;
14477
14478 let filter_in: i32 = pngsave_buffer_options.filter as i32;
14479 let filter_in_name = utils::new_c_string("filter")?;
14480
14481 let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
14482 let palette_in_name = utils::new_c_string("palette")?;
14483
14484 let q_in: i32 = pngsave_buffer_options.q;
14485 let q_in_name = utils::new_c_string("Q")?;
14486
14487 let dither_in: f64 = pngsave_buffer_options.dither;
14488 let dither_in_name = utils::new_c_string("dither")?;
14489
14490 let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
14491 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14492
14493 let effort_in: i32 = pngsave_buffer_options.effort;
14494 let effort_in_name = utils::new_c_string("effort")?;
14495
14496 let keep_in: i32 = pngsave_buffer_options.keep as i32;
14497 let keep_in_name = utils::new_c_string("keep")?;
14498
14499 let background_wrapper =
14500 utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
14501 let background_in = background_wrapper.ctx;
14502 let background_in_name = utils::new_c_string("background")?;
14503
14504 let page_height_in: i32 = pngsave_buffer_options.page_height;
14505 let page_height_in_name = utils::new_c_string("page-height")?;
14506
14507 let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
14508 let profile_in_name = utils::new_c_string("profile")?;
14509
14510 let vips_op_response = bindings::vips_pngsave_buffer(
14511 inp_in,
14512 &mut buffer_out,
14513 &mut buffer_buf_size,
14514 compression_in_name.as_ptr(),
14515 compression_in,
14516 interlace_in_name.as_ptr(),
14517 interlace_in,
14518 filter_in_name.as_ptr(),
14519 filter_in,
14520 palette_in_name.as_ptr(),
14521 palette_in,
14522 q_in_name.as_ptr(),
14523 q_in,
14524 dither_in_name.as_ptr(),
14525 dither_in,
14526 bitdepth_in_name.as_ptr(),
14527 bitdepth_in,
14528 effort_in_name.as_ptr(),
14529 effort_in,
14530 keep_in_name.as_ptr(),
14531 keep_in,
14532 background_in_name.as_ptr(),
14533 background_in,
14534 page_height_in_name.as_ptr(),
14535 page_height_in,
14536 profile_in_name.as_ptr(),
14537 profile_in.as_ptr(),
14538 NULL,
14539 );
14540 utils::result(
14541 vips_op_response,
14542 utils::new_byte_array(buffer_out, buffer_buf_size),
14543 Error::PngsaveBufferError,
14544 )
14545 }
14546}
14547
14548pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14553 unsafe {
14554 let inp_in: *mut bindings::VipsImage = inp.ctx;
14555 let target_in: *mut bindings::VipsTarget = target.ctx;
14556
14557 let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
14558 utils::result(vips_op_response, (), Error::PngsaveTargetError)
14559 }
14560}
14561
14562#[derive(Clone, Debug)]
14564pub struct PngsaveTargetOptions {
14565 pub compression: i32,
14568 pub interlace: bool,
14571 pub filter: ForeignPngFilter,
14579 pub palette: bool,
14582 pub q: i32,
14585 pub dither: f64,
14588 pub bitdepth: i32,
14591 pub effort: i32,
14594 pub keep: ForeignKeep,
14603 pub background: Vec<f64>,
14605 pub page_height: i32,
14608 pub profile: String,
14610}
14611
14612impl std::default::Default for PngsaveTargetOptions {
14613 fn default() -> Self {
14614 PngsaveTargetOptions {
14615 compression: i32::from(6),
14616 interlace: false,
14617 filter: ForeignPngFilter::None,
14618 palette: false,
14619 q: i32::from(100),
14620 dither: f64::from(1),
14621 bitdepth: i32::from(8),
14622 effort: i32::from(7),
14623 keep: ForeignKeep::All,
14624 background: Vec::new(),
14625 page_height: i32::from(0),
14626 profile: String::from("sRGB"),
14627 }
14628 }
14629}
14630
14631pub fn pngsave_target_with_opts(
14637 inp: &VipsImage,
14638 target: &VipsTarget,
14639 pngsave_target_options: &PngsaveTargetOptions,
14640) -> Result<()> {
14641 unsafe {
14642 let inp_in: *mut bindings::VipsImage = inp.ctx;
14643 let target_in: *mut bindings::VipsTarget = target.ctx;
14644
14645 let compression_in: i32 = pngsave_target_options.compression;
14646 let compression_in_name = utils::new_c_string("compression")?;
14647
14648 let interlace_in: i32 = if pngsave_target_options.interlace {
14649 1
14650 } else {
14651 0
14652 };
14653 let interlace_in_name = utils::new_c_string("interlace")?;
14654
14655 let filter_in: i32 = pngsave_target_options.filter as i32;
14656 let filter_in_name = utils::new_c_string("filter")?;
14657
14658 let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
14659 let palette_in_name = utils::new_c_string("palette")?;
14660
14661 let q_in: i32 = pngsave_target_options.q;
14662 let q_in_name = utils::new_c_string("Q")?;
14663
14664 let dither_in: f64 = pngsave_target_options.dither;
14665 let dither_in_name = utils::new_c_string("dither")?;
14666
14667 let bitdepth_in: i32 = pngsave_target_options.bitdepth;
14668 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
14669
14670 let effort_in: i32 = pngsave_target_options.effort;
14671 let effort_in_name = utils::new_c_string("effort")?;
14672
14673 let keep_in: i32 = pngsave_target_options.keep as i32;
14674 let keep_in_name = utils::new_c_string("keep")?;
14675
14676 let background_wrapper =
14677 utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
14678 let background_in = background_wrapper.ctx;
14679 let background_in_name = utils::new_c_string("background")?;
14680
14681 let page_height_in: i32 = pngsave_target_options.page_height;
14682 let page_height_in_name = utils::new_c_string("page-height")?;
14683
14684 let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
14685 let profile_in_name = utils::new_c_string("profile")?;
14686
14687 let vips_op_response = bindings::vips_pngsave_target(
14688 inp_in,
14689 target_in,
14690 compression_in_name.as_ptr(),
14691 compression_in,
14692 interlace_in_name.as_ptr(),
14693 interlace_in,
14694 filter_in_name.as_ptr(),
14695 filter_in,
14696 palette_in_name.as_ptr(),
14697 palette_in,
14698 q_in_name.as_ptr(),
14699 q_in,
14700 dither_in_name.as_ptr(),
14701 dither_in,
14702 bitdepth_in_name.as_ptr(),
14703 bitdepth_in,
14704 effort_in_name.as_ptr(),
14705 effort_in,
14706 keep_in_name.as_ptr(),
14707 keep_in,
14708 background_in_name.as_ptr(),
14709 background_in,
14710 page_height_in_name.as_ptr(),
14711 page_height_in,
14712 profile_in_name.as_ptr(),
14713 profile_in.as_ptr(),
14714 NULL,
14715 );
14716 utils::result(vips_op_response, (), Error::PngsaveTargetError)
14717 }
14718}
14719
14720pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
14725 unsafe {
14726 let inp_in: *mut bindings::VipsImage = inp.ctx;
14727 let filename_in: CString = utils::new_c_string(filename)?;
14728
14729 let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
14730 utils::result(vips_op_response, (), Error::JpegsaveError)
14731 }
14732}
14733
14734#[derive(Clone, Debug)]
14736pub struct JpegsaveOptions {
14737 pub q: i32,
14740 pub optimize_coding: bool,
14743 pub interlace: bool,
14746 pub trellis_quant: bool,
14749 pub overshoot_deringing: bool,
14752 pub optimize_scans: bool,
14755 pub quant_table: i32,
14758 pub subsample_mode: ForeignSubsample,
14764 pub restart_interval: i32,
14767 pub keep: ForeignKeep,
14776 pub background: Vec<f64>,
14778 pub page_height: i32,
14781 pub profile: String,
14783}
14784
14785impl std::default::Default for JpegsaveOptions {
14786 fn default() -> Self {
14787 JpegsaveOptions {
14788 q: i32::from(75),
14789 optimize_coding: false,
14790 interlace: false,
14791 trellis_quant: false,
14792 overshoot_deringing: false,
14793 optimize_scans: false,
14794 quant_table: i32::from(0),
14795 subsample_mode: ForeignSubsample::Auto,
14796 restart_interval: i32::from(0),
14797 keep: ForeignKeep::All,
14798 background: Vec::new(),
14799 page_height: i32::from(0),
14800 profile: String::from("sRGB"),
14801 }
14802 }
14803}
14804
14805pub fn jpegsave_with_opts(
14811 inp: &VipsImage,
14812 filename: &str,
14813 jpegsave_options: &JpegsaveOptions,
14814) -> Result<()> {
14815 unsafe {
14816 let inp_in: *mut bindings::VipsImage = inp.ctx;
14817 let filename_in: CString = utils::new_c_string(filename)?;
14818
14819 let q_in: i32 = jpegsave_options.q;
14820 let q_in_name = utils::new_c_string("Q")?;
14821
14822 let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
14823 1
14824 } else {
14825 0
14826 };
14827 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
14828
14829 let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
14830 let interlace_in_name = utils::new_c_string("interlace")?;
14831
14832 let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
14833 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
14834
14835 let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
14836 1
14837 } else {
14838 0
14839 };
14840 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
14841
14842 let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
14843 1
14844 } else {
14845 0
14846 };
14847 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
14848
14849 let quant_table_in: i32 = jpegsave_options.quant_table;
14850 let quant_table_in_name = utils::new_c_string("quant-table")?;
14851
14852 let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
14853 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
14854
14855 let restart_interval_in: i32 = jpegsave_options.restart_interval;
14856 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
14857
14858 let keep_in: i32 = jpegsave_options.keep as i32;
14859 let keep_in_name = utils::new_c_string("keep")?;
14860
14861 let background_wrapper =
14862 utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
14863 let background_in = background_wrapper.ctx;
14864 let background_in_name = utils::new_c_string("background")?;
14865
14866 let page_height_in: i32 = jpegsave_options.page_height;
14867 let page_height_in_name = utils::new_c_string("page-height")?;
14868
14869 let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
14870 let profile_in_name = utils::new_c_string("profile")?;
14871
14872 let vips_op_response = bindings::vips_jpegsave(
14873 inp_in,
14874 filename_in.as_ptr(),
14875 q_in_name.as_ptr(),
14876 q_in,
14877 optimize_coding_in_name.as_ptr(),
14878 optimize_coding_in,
14879 interlace_in_name.as_ptr(),
14880 interlace_in,
14881 trellis_quant_in_name.as_ptr(),
14882 trellis_quant_in,
14883 overshoot_deringing_in_name.as_ptr(),
14884 overshoot_deringing_in,
14885 optimize_scans_in_name.as_ptr(),
14886 optimize_scans_in,
14887 quant_table_in_name.as_ptr(),
14888 quant_table_in,
14889 subsample_mode_in_name.as_ptr(),
14890 subsample_mode_in,
14891 restart_interval_in_name.as_ptr(),
14892 restart_interval_in,
14893 keep_in_name.as_ptr(),
14894 keep_in,
14895 background_in_name.as_ptr(),
14896 background_in,
14897 page_height_in_name.as_ptr(),
14898 page_height_in,
14899 profile_in_name.as_ptr(),
14900 profile_in.as_ptr(),
14901 NULL,
14902 );
14903 utils::result(vips_op_response, (), Error::JpegsaveError)
14904 }
14905}
14906
14907pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
14911 unsafe {
14912 let inp_in: *mut bindings::VipsImage = inp.ctx;
14913 let mut buffer_buf_size: u64 = 0;
14914 let mut buffer_out: *mut c_void = null_mut();
14915
14916 let vips_op_response =
14917 bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
14918 utils::result(
14919 vips_op_response,
14920 utils::new_byte_array(buffer_out, buffer_buf_size),
14921 Error::JpegsaveBufferError,
14922 )
14923 }
14924}
14925
14926#[derive(Clone, Debug)]
14928pub struct JpegsaveBufferOptions {
14929 pub q: i32,
14932 pub optimize_coding: bool,
14935 pub interlace: bool,
14938 pub trellis_quant: bool,
14941 pub overshoot_deringing: bool,
14944 pub optimize_scans: bool,
14947 pub quant_table: i32,
14950 pub subsample_mode: ForeignSubsample,
14956 pub restart_interval: i32,
14959 pub keep: ForeignKeep,
14968 pub background: Vec<f64>,
14970 pub page_height: i32,
14973 pub profile: String,
14975}
14976
14977impl std::default::Default for JpegsaveBufferOptions {
14978 fn default() -> Self {
14979 JpegsaveBufferOptions {
14980 q: i32::from(75),
14981 optimize_coding: false,
14982 interlace: false,
14983 trellis_quant: false,
14984 overshoot_deringing: false,
14985 optimize_scans: false,
14986 quant_table: i32::from(0),
14987 subsample_mode: ForeignSubsample::Auto,
14988 restart_interval: i32::from(0),
14989 keep: ForeignKeep::All,
14990 background: Vec::new(),
14991 page_height: i32::from(0),
14992 profile: String::from("sRGB"),
14993 }
14994 }
14995}
14996
14997pub fn jpegsave_buffer_with_opts(
15002 inp: &VipsImage,
15003 jpegsave_buffer_options: &JpegsaveBufferOptions,
15004) -> Result<Vec<u8>> {
15005 unsafe {
15006 let inp_in: *mut bindings::VipsImage = inp.ctx;
15007 let mut buffer_buf_size: u64 = 0;
15008 let mut buffer_out: *mut c_void = null_mut();
15009
15010 let q_in: i32 = jpegsave_buffer_options.q;
15011 let q_in_name = utils::new_c_string("Q")?;
15012
15013 let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
15014 1
15015 } else {
15016 0
15017 };
15018 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15019
15020 let interlace_in: i32 = if jpegsave_buffer_options.interlace {
15021 1
15022 } else {
15023 0
15024 };
15025 let interlace_in_name = utils::new_c_string("interlace")?;
15026
15027 let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
15028 1
15029 } else {
15030 0
15031 };
15032 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15033
15034 let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
15035 1
15036 } else {
15037 0
15038 };
15039 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15040
15041 let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
15042 1
15043 } else {
15044 0
15045 };
15046 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15047
15048 let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
15049 let quant_table_in_name = utils::new_c_string("quant-table")?;
15050
15051 let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
15052 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15053
15054 let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
15055 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15056
15057 let keep_in: i32 = jpegsave_buffer_options.keep as i32;
15058 let keep_in_name = utils::new_c_string("keep")?;
15059
15060 let background_wrapper =
15061 utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
15062 let background_in = background_wrapper.ctx;
15063 let background_in_name = utils::new_c_string("background")?;
15064
15065 let page_height_in: i32 = jpegsave_buffer_options.page_height;
15066 let page_height_in_name = utils::new_c_string("page-height")?;
15067
15068 let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
15069 let profile_in_name = utils::new_c_string("profile")?;
15070
15071 let vips_op_response = bindings::vips_jpegsave_buffer(
15072 inp_in,
15073 &mut buffer_out,
15074 &mut buffer_buf_size,
15075 q_in_name.as_ptr(),
15076 q_in,
15077 optimize_coding_in_name.as_ptr(),
15078 optimize_coding_in,
15079 interlace_in_name.as_ptr(),
15080 interlace_in,
15081 trellis_quant_in_name.as_ptr(),
15082 trellis_quant_in,
15083 overshoot_deringing_in_name.as_ptr(),
15084 overshoot_deringing_in,
15085 optimize_scans_in_name.as_ptr(),
15086 optimize_scans_in,
15087 quant_table_in_name.as_ptr(),
15088 quant_table_in,
15089 subsample_mode_in_name.as_ptr(),
15090 subsample_mode_in,
15091 restart_interval_in_name.as_ptr(),
15092 restart_interval_in,
15093 keep_in_name.as_ptr(),
15094 keep_in,
15095 background_in_name.as_ptr(),
15096 background_in,
15097 page_height_in_name.as_ptr(),
15098 page_height_in,
15099 profile_in_name.as_ptr(),
15100 profile_in.as_ptr(),
15101 NULL,
15102 );
15103 utils::result(
15104 vips_op_response,
15105 utils::new_byte_array(buffer_out, buffer_buf_size),
15106 Error::JpegsaveBufferError,
15107 )
15108 }
15109}
15110
15111pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15116 unsafe {
15117 let inp_in: *mut bindings::VipsImage = inp.ctx;
15118 let target_in: *mut bindings::VipsTarget = target.ctx;
15119
15120 let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
15121 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15122 }
15123}
15124
15125#[derive(Clone, Debug)]
15127pub struct JpegsaveTargetOptions {
15128 pub q: i32,
15131 pub optimize_coding: bool,
15134 pub interlace: bool,
15137 pub trellis_quant: bool,
15140 pub overshoot_deringing: bool,
15143 pub optimize_scans: bool,
15146 pub quant_table: i32,
15149 pub subsample_mode: ForeignSubsample,
15155 pub restart_interval: i32,
15158 pub keep: ForeignKeep,
15167 pub background: Vec<f64>,
15169 pub page_height: i32,
15172 pub profile: String,
15174}
15175
15176impl std::default::Default for JpegsaveTargetOptions {
15177 fn default() -> Self {
15178 JpegsaveTargetOptions {
15179 q: i32::from(75),
15180 optimize_coding: false,
15181 interlace: false,
15182 trellis_quant: false,
15183 overshoot_deringing: false,
15184 optimize_scans: false,
15185 quant_table: i32::from(0),
15186 subsample_mode: ForeignSubsample::Auto,
15187 restart_interval: i32::from(0),
15188 keep: ForeignKeep::All,
15189 background: Vec::new(),
15190 page_height: i32::from(0),
15191 profile: String::from("sRGB"),
15192 }
15193 }
15194}
15195
15196pub fn jpegsave_target_with_opts(
15202 inp: &VipsImage,
15203 target: &VipsTarget,
15204 jpegsave_target_options: &JpegsaveTargetOptions,
15205) -> Result<()> {
15206 unsafe {
15207 let inp_in: *mut bindings::VipsImage = inp.ctx;
15208 let target_in: *mut bindings::VipsTarget = target.ctx;
15209
15210 let q_in: i32 = jpegsave_target_options.q;
15211 let q_in_name = utils::new_c_string("Q")?;
15212
15213 let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
15214 1
15215 } else {
15216 0
15217 };
15218 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15219
15220 let interlace_in: i32 = if jpegsave_target_options.interlace {
15221 1
15222 } else {
15223 0
15224 };
15225 let interlace_in_name = utils::new_c_string("interlace")?;
15226
15227 let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
15228 1
15229 } else {
15230 0
15231 };
15232 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15233
15234 let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
15235 1
15236 } else {
15237 0
15238 };
15239 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15240
15241 let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
15242 1
15243 } else {
15244 0
15245 };
15246 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15247
15248 let quant_table_in: i32 = jpegsave_target_options.quant_table;
15249 let quant_table_in_name = utils::new_c_string("quant-table")?;
15250
15251 let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
15252 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15253
15254 let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
15255 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15256
15257 let keep_in: i32 = jpegsave_target_options.keep as i32;
15258 let keep_in_name = utils::new_c_string("keep")?;
15259
15260 let background_wrapper =
15261 utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
15262 let background_in = background_wrapper.ctx;
15263 let background_in_name = utils::new_c_string("background")?;
15264
15265 let page_height_in: i32 = jpegsave_target_options.page_height;
15266 let page_height_in_name = utils::new_c_string("page-height")?;
15267
15268 let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
15269 let profile_in_name = utils::new_c_string("profile")?;
15270
15271 let vips_op_response = bindings::vips_jpegsave_target(
15272 inp_in,
15273 target_in,
15274 q_in_name.as_ptr(),
15275 q_in,
15276 optimize_coding_in_name.as_ptr(),
15277 optimize_coding_in,
15278 interlace_in_name.as_ptr(),
15279 interlace_in,
15280 trellis_quant_in_name.as_ptr(),
15281 trellis_quant_in,
15282 overshoot_deringing_in_name.as_ptr(),
15283 overshoot_deringing_in,
15284 optimize_scans_in_name.as_ptr(),
15285 optimize_scans_in,
15286 quant_table_in_name.as_ptr(),
15287 quant_table_in,
15288 subsample_mode_in_name.as_ptr(),
15289 subsample_mode_in,
15290 restart_interval_in_name.as_ptr(),
15291 restart_interval_in,
15292 keep_in_name.as_ptr(),
15293 keep_in,
15294 background_in_name.as_ptr(),
15295 background_in,
15296 page_height_in_name.as_ptr(),
15297 page_height_in,
15298 profile_in_name.as_ptr(),
15299 profile_in.as_ptr(),
15300 NULL,
15301 );
15302 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
15303 }
15304}
15305
15306pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
15310 unsafe {
15311 let inp_in: *mut bindings::VipsImage = inp.ctx;
15312
15313 let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
15314 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15315 }
15316}
15317
15318#[derive(Clone, Debug)]
15320pub struct JpegsaveMimeOptions {
15321 pub q: i32,
15324 pub optimize_coding: bool,
15327 pub interlace: bool,
15330 pub trellis_quant: bool,
15333 pub overshoot_deringing: bool,
15336 pub optimize_scans: bool,
15339 pub quant_table: i32,
15342 pub subsample_mode: ForeignSubsample,
15348 pub restart_interval: i32,
15351 pub keep: ForeignKeep,
15360 pub background: Vec<f64>,
15362 pub page_height: i32,
15365 pub profile: String,
15367}
15368
15369impl std::default::Default for JpegsaveMimeOptions {
15370 fn default() -> Self {
15371 JpegsaveMimeOptions {
15372 q: i32::from(75),
15373 optimize_coding: false,
15374 interlace: false,
15375 trellis_quant: false,
15376 overshoot_deringing: false,
15377 optimize_scans: false,
15378 quant_table: i32::from(0),
15379 subsample_mode: ForeignSubsample::Auto,
15380 restart_interval: i32::from(0),
15381 keep: ForeignKeep::All,
15382 background: Vec::new(),
15383 page_height: i32::from(0),
15384 profile: String::from("sRGB"),
15385 }
15386 }
15387}
15388
15389pub fn jpegsave_mime_with_opts(
15394 inp: &VipsImage,
15395 jpegsave_mime_options: &JpegsaveMimeOptions,
15396) -> Result<()> {
15397 unsafe {
15398 let inp_in: *mut bindings::VipsImage = inp.ctx;
15399
15400 let q_in: i32 = jpegsave_mime_options.q;
15401 let q_in_name = utils::new_c_string("Q")?;
15402
15403 let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
15404 1
15405 } else {
15406 0
15407 };
15408 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
15409
15410 let interlace_in: i32 = if jpegsave_mime_options.interlace {
15411 1
15412 } else {
15413 0
15414 };
15415 let interlace_in_name = utils::new_c_string("interlace")?;
15416
15417 let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
15418 1
15419 } else {
15420 0
15421 };
15422 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
15423
15424 let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
15425 1
15426 } else {
15427 0
15428 };
15429 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
15430
15431 let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
15432 1
15433 } else {
15434 0
15435 };
15436 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
15437
15438 let quant_table_in: i32 = jpegsave_mime_options.quant_table;
15439 let quant_table_in_name = utils::new_c_string("quant-table")?;
15440
15441 let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
15442 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
15443
15444 let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
15445 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
15446
15447 let keep_in: i32 = jpegsave_mime_options.keep as i32;
15448 let keep_in_name = utils::new_c_string("keep")?;
15449
15450 let background_wrapper =
15451 utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
15452 let background_in = background_wrapper.ctx;
15453 let background_in_name = utils::new_c_string("background")?;
15454
15455 let page_height_in: i32 = jpegsave_mime_options.page_height;
15456 let page_height_in_name = utils::new_c_string("page-height")?;
15457
15458 let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
15459 let profile_in_name = utils::new_c_string("profile")?;
15460
15461 let vips_op_response = bindings::vips_jpegsave_mime(
15462 inp_in,
15463 q_in_name.as_ptr(),
15464 q_in,
15465 optimize_coding_in_name.as_ptr(),
15466 optimize_coding_in,
15467 interlace_in_name.as_ptr(),
15468 interlace_in,
15469 trellis_quant_in_name.as_ptr(),
15470 trellis_quant_in,
15471 overshoot_deringing_in_name.as_ptr(),
15472 overshoot_deringing_in,
15473 optimize_scans_in_name.as_ptr(),
15474 optimize_scans_in,
15475 quant_table_in_name.as_ptr(),
15476 quant_table_in,
15477 subsample_mode_in_name.as_ptr(),
15478 subsample_mode_in,
15479 restart_interval_in_name.as_ptr(),
15480 restart_interval_in,
15481 keep_in_name.as_ptr(),
15482 keep_in,
15483 background_in_name.as_ptr(),
15484 background_in,
15485 page_height_in_name.as_ptr(),
15486 page_height_in,
15487 profile_in_name.as_ptr(),
15488 profile_in.as_ptr(),
15489 NULL,
15490 );
15491 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
15492 }
15493}
15494
15495pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
15500 unsafe {
15501 let inp_in: *mut bindings::VipsImage = inp.ctx;
15502 let filename_in: CString = utils::new_c_string(filename)?;
15503
15504 let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
15505 utils::result(vips_op_response, (), Error::WebpsaveError)
15506 }
15507}
15508
15509#[derive(Clone, Debug)]
15511pub struct WebpsaveOptions {
15512 pub q: i32,
15515 pub lossless: bool,
15518 pub preset: ForeignWebpPreset,
15527 pub smart_subsample: bool,
15530 pub near_lossless: bool,
15533 pub alpha_q: i32,
15536 pub min_size: bool,
15539 pub kmin: i32,
15542 pub kmax: i32,
15545 pub effort: i32,
15548 pub mixed: bool,
15551 pub keep: ForeignKeep,
15560 pub background: Vec<f64>,
15562 pub page_height: i32,
15565 pub profile: String,
15567}
15568
15569impl std::default::Default for WebpsaveOptions {
15570 fn default() -> Self {
15571 WebpsaveOptions {
15572 q: i32::from(75),
15573 lossless: false,
15574 preset: ForeignWebpPreset::Default,
15575 smart_subsample: false,
15576 near_lossless: false,
15577 alpha_q: i32::from(100),
15578 min_size: false,
15579 kmin: i32::from(2147483646),
15580 kmax: i32::from(2147483647),
15581 effort: i32::from(4),
15582 mixed: false,
15583 keep: ForeignKeep::All,
15584 background: Vec::new(),
15585 page_height: i32::from(0),
15586 profile: String::from("sRGB"),
15587 }
15588 }
15589}
15590
15591pub fn webpsave_with_opts(
15597 inp: &VipsImage,
15598 filename: &str,
15599 webpsave_options: &WebpsaveOptions,
15600) -> Result<()> {
15601 unsafe {
15602 let inp_in: *mut bindings::VipsImage = inp.ctx;
15603 let filename_in: CString = utils::new_c_string(filename)?;
15604
15605 let q_in: i32 = webpsave_options.q;
15606 let q_in_name = utils::new_c_string("Q")?;
15607
15608 let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
15609 let lossless_in_name = utils::new_c_string("lossless")?;
15610
15611 let preset_in: i32 = webpsave_options.preset as i32;
15612 let preset_in_name = utils::new_c_string("preset")?;
15613
15614 let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
15615 1
15616 } else {
15617 0
15618 };
15619 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
15620
15621 let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
15622 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
15623
15624 let alpha_q_in: i32 = webpsave_options.alpha_q;
15625 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
15626
15627 let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
15628 let min_size_in_name = utils::new_c_string("min-size")?;
15629
15630 let kmin_in: i32 = webpsave_options.kmin;
15631 let kmin_in_name = utils::new_c_string("kmin")?;
15632
15633 let kmax_in: i32 = webpsave_options.kmax;
15634 let kmax_in_name = utils::new_c_string("kmax")?;
15635
15636 let effort_in: i32 = webpsave_options.effort;
15637 let effort_in_name = utils::new_c_string("effort")?;
15638
15639 let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
15640 let mixed_in_name = utils::new_c_string("mixed")?;
15641
15642 let keep_in: i32 = webpsave_options.keep as i32;
15643 let keep_in_name = utils::new_c_string("keep")?;
15644
15645 let background_wrapper =
15646 utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
15647 let background_in = background_wrapper.ctx;
15648 let background_in_name = utils::new_c_string("background")?;
15649
15650 let page_height_in: i32 = webpsave_options.page_height;
15651 let page_height_in_name = utils::new_c_string("page-height")?;
15652
15653 let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
15654 let profile_in_name = utils::new_c_string("profile")?;
15655
15656 let vips_op_response = bindings::vips_webpsave(
15657 inp_in,
15658 filename_in.as_ptr(),
15659 q_in_name.as_ptr(),
15660 q_in,
15661 lossless_in_name.as_ptr(),
15662 lossless_in,
15663 preset_in_name.as_ptr(),
15664 preset_in,
15665 smart_subsample_in_name.as_ptr(),
15666 smart_subsample_in,
15667 near_lossless_in_name.as_ptr(),
15668 near_lossless_in,
15669 alpha_q_in_name.as_ptr(),
15670 alpha_q_in,
15671 min_size_in_name.as_ptr(),
15672 min_size_in,
15673 kmin_in_name.as_ptr(),
15674 kmin_in,
15675 kmax_in_name.as_ptr(),
15676 kmax_in,
15677 effort_in_name.as_ptr(),
15678 effort_in,
15679 mixed_in_name.as_ptr(),
15680 mixed_in,
15681 keep_in_name.as_ptr(),
15682 keep_in,
15683 background_in_name.as_ptr(),
15684 background_in,
15685 page_height_in_name.as_ptr(),
15686 page_height_in,
15687 profile_in_name.as_ptr(),
15688 profile_in.as_ptr(),
15689 NULL,
15690 );
15691 utils::result(vips_op_response, (), Error::WebpsaveError)
15692 }
15693}
15694
15695pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
15699 unsafe {
15700 let inp_in: *mut bindings::VipsImage = inp.ctx;
15701 let mut buffer_buf_size: u64 = 0;
15702 let mut buffer_out: *mut c_void = null_mut();
15703
15704 let vips_op_response =
15705 bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
15706 utils::result(
15707 vips_op_response,
15708 utils::new_byte_array(buffer_out, buffer_buf_size),
15709 Error::WebpsaveBufferError,
15710 )
15711 }
15712}
15713
15714#[derive(Clone, Debug)]
15716pub struct WebpsaveBufferOptions {
15717 pub q: i32,
15720 pub lossless: bool,
15723 pub preset: ForeignWebpPreset,
15732 pub smart_subsample: bool,
15735 pub near_lossless: bool,
15738 pub alpha_q: i32,
15741 pub min_size: bool,
15744 pub kmin: i32,
15747 pub kmax: i32,
15750 pub effort: i32,
15753 pub mixed: bool,
15756 pub keep: ForeignKeep,
15765 pub background: Vec<f64>,
15767 pub page_height: i32,
15770 pub profile: String,
15772}
15773
15774impl std::default::Default for WebpsaveBufferOptions {
15775 fn default() -> Self {
15776 WebpsaveBufferOptions {
15777 q: i32::from(75),
15778 lossless: false,
15779 preset: ForeignWebpPreset::Default,
15780 smart_subsample: false,
15781 near_lossless: false,
15782 alpha_q: i32::from(100),
15783 min_size: false,
15784 kmin: i32::from(2147483646),
15785 kmax: i32::from(2147483647),
15786 effort: i32::from(4),
15787 mixed: false,
15788 keep: ForeignKeep::All,
15789 background: Vec::new(),
15790 page_height: i32::from(0),
15791 profile: String::from("sRGB"),
15792 }
15793 }
15794}
15795
15796pub fn webpsave_buffer_with_opts(
15801 inp: &VipsImage,
15802 webpsave_buffer_options: &WebpsaveBufferOptions,
15803) -> Result<Vec<u8>> {
15804 unsafe {
15805 let inp_in: *mut bindings::VipsImage = inp.ctx;
15806 let mut buffer_buf_size: u64 = 0;
15807 let mut buffer_out: *mut c_void = null_mut();
15808
15809 let q_in: i32 = webpsave_buffer_options.q;
15810 let q_in_name = utils::new_c_string("Q")?;
15811
15812 let lossless_in: i32 = if webpsave_buffer_options.lossless {
15813 1
15814 } else {
15815 0
15816 };
15817 let lossless_in_name = utils::new_c_string("lossless")?;
15818
15819 let preset_in: i32 = webpsave_buffer_options.preset as i32;
15820 let preset_in_name = utils::new_c_string("preset")?;
15821
15822 let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
15823 1
15824 } else {
15825 0
15826 };
15827 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
15828
15829 let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
15830 1
15831 } else {
15832 0
15833 };
15834 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
15835
15836 let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
15837 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
15838
15839 let min_size_in: i32 = if webpsave_buffer_options.min_size {
15840 1
15841 } else {
15842 0
15843 };
15844 let min_size_in_name = utils::new_c_string("min-size")?;
15845
15846 let kmin_in: i32 = webpsave_buffer_options.kmin;
15847 let kmin_in_name = utils::new_c_string("kmin")?;
15848
15849 let kmax_in: i32 = webpsave_buffer_options.kmax;
15850 let kmax_in_name = utils::new_c_string("kmax")?;
15851
15852 let effort_in: i32 = webpsave_buffer_options.effort;
15853 let effort_in_name = utils::new_c_string("effort")?;
15854
15855 let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
15856 let mixed_in_name = utils::new_c_string("mixed")?;
15857
15858 let keep_in: i32 = webpsave_buffer_options.keep as i32;
15859 let keep_in_name = utils::new_c_string("keep")?;
15860
15861 let background_wrapper =
15862 utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
15863 let background_in = background_wrapper.ctx;
15864 let background_in_name = utils::new_c_string("background")?;
15865
15866 let page_height_in: i32 = webpsave_buffer_options.page_height;
15867 let page_height_in_name = utils::new_c_string("page-height")?;
15868
15869 let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
15870 let profile_in_name = utils::new_c_string("profile")?;
15871
15872 let vips_op_response = bindings::vips_webpsave_buffer(
15873 inp_in,
15874 &mut buffer_out,
15875 &mut buffer_buf_size,
15876 q_in_name.as_ptr(),
15877 q_in,
15878 lossless_in_name.as_ptr(),
15879 lossless_in,
15880 preset_in_name.as_ptr(),
15881 preset_in,
15882 smart_subsample_in_name.as_ptr(),
15883 smart_subsample_in,
15884 near_lossless_in_name.as_ptr(),
15885 near_lossless_in,
15886 alpha_q_in_name.as_ptr(),
15887 alpha_q_in,
15888 min_size_in_name.as_ptr(),
15889 min_size_in,
15890 kmin_in_name.as_ptr(),
15891 kmin_in,
15892 kmax_in_name.as_ptr(),
15893 kmax_in,
15894 effort_in_name.as_ptr(),
15895 effort_in,
15896 mixed_in_name.as_ptr(),
15897 mixed_in,
15898 keep_in_name.as_ptr(),
15899 keep_in,
15900 background_in_name.as_ptr(),
15901 background_in,
15902 page_height_in_name.as_ptr(),
15903 page_height_in,
15904 profile_in_name.as_ptr(),
15905 profile_in.as_ptr(),
15906 NULL,
15907 );
15908 utils::result(
15909 vips_op_response,
15910 utils::new_byte_array(buffer_out, buffer_buf_size),
15911 Error::WebpsaveBufferError,
15912 )
15913 }
15914}
15915
15916pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15921 unsafe {
15922 let inp_in: *mut bindings::VipsImage = inp.ctx;
15923 let target_in: *mut bindings::VipsTarget = target.ctx;
15924
15925 let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
15926 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
15927 }
15928}
15929
15930#[derive(Clone, Debug)]
15932pub struct WebpsaveTargetOptions {
15933 pub q: i32,
15936 pub lossless: bool,
15939 pub preset: ForeignWebpPreset,
15948 pub smart_subsample: bool,
15951 pub near_lossless: bool,
15954 pub alpha_q: i32,
15957 pub min_size: bool,
15960 pub kmin: i32,
15963 pub kmax: i32,
15966 pub effort: i32,
15969 pub mixed: bool,
15972 pub keep: ForeignKeep,
15981 pub background: Vec<f64>,
15983 pub page_height: i32,
15986 pub profile: String,
15988}
15989
15990impl std::default::Default for WebpsaveTargetOptions {
15991 fn default() -> Self {
15992 WebpsaveTargetOptions {
15993 q: i32::from(75),
15994 lossless: false,
15995 preset: ForeignWebpPreset::Default,
15996 smart_subsample: false,
15997 near_lossless: false,
15998 alpha_q: i32::from(100),
15999 min_size: false,
16000 kmin: i32::from(2147483646),
16001 kmax: i32::from(2147483647),
16002 effort: i32::from(4),
16003 mixed: false,
16004 keep: ForeignKeep::All,
16005 background: Vec::new(),
16006 page_height: i32::from(0),
16007 profile: String::from("sRGB"),
16008 }
16009 }
16010}
16011
16012pub fn webpsave_target_with_opts(
16018 inp: &VipsImage,
16019 target: &VipsTarget,
16020 webpsave_target_options: &WebpsaveTargetOptions,
16021) -> Result<()> {
16022 unsafe {
16023 let inp_in: *mut bindings::VipsImage = inp.ctx;
16024 let target_in: *mut bindings::VipsTarget = target.ctx;
16025
16026 let q_in: i32 = webpsave_target_options.q;
16027 let q_in_name = utils::new_c_string("Q")?;
16028
16029 let lossless_in: i32 = if webpsave_target_options.lossless {
16030 1
16031 } else {
16032 0
16033 };
16034 let lossless_in_name = utils::new_c_string("lossless")?;
16035
16036 let preset_in: i32 = webpsave_target_options.preset as i32;
16037 let preset_in_name = utils::new_c_string("preset")?;
16038
16039 let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
16040 1
16041 } else {
16042 0
16043 };
16044 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16045
16046 let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
16047 1
16048 } else {
16049 0
16050 };
16051 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16052
16053 let alpha_q_in: i32 = webpsave_target_options.alpha_q;
16054 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16055
16056 let min_size_in: i32 = if webpsave_target_options.min_size {
16057 1
16058 } else {
16059 0
16060 };
16061 let min_size_in_name = utils::new_c_string("min-size")?;
16062
16063 let kmin_in: i32 = webpsave_target_options.kmin;
16064 let kmin_in_name = utils::new_c_string("kmin")?;
16065
16066 let kmax_in: i32 = webpsave_target_options.kmax;
16067 let kmax_in_name = utils::new_c_string("kmax")?;
16068
16069 let effort_in: i32 = webpsave_target_options.effort;
16070 let effort_in_name = utils::new_c_string("effort")?;
16071
16072 let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
16073 let mixed_in_name = utils::new_c_string("mixed")?;
16074
16075 let keep_in: i32 = webpsave_target_options.keep as i32;
16076 let keep_in_name = utils::new_c_string("keep")?;
16077
16078 let background_wrapper =
16079 utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
16080 let background_in = background_wrapper.ctx;
16081 let background_in_name = utils::new_c_string("background")?;
16082
16083 let page_height_in: i32 = webpsave_target_options.page_height;
16084 let page_height_in_name = utils::new_c_string("page-height")?;
16085
16086 let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
16087 let profile_in_name = utils::new_c_string("profile")?;
16088
16089 let vips_op_response = bindings::vips_webpsave_target(
16090 inp_in,
16091 target_in,
16092 q_in_name.as_ptr(),
16093 q_in,
16094 lossless_in_name.as_ptr(),
16095 lossless_in,
16096 preset_in_name.as_ptr(),
16097 preset_in,
16098 smart_subsample_in_name.as_ptr(),
16099 smart_subsample_in,
16100 near_lossless_in_name.as_ptr(),
16101 near_lossless_in,
16102 alpha_q_in_name.as_ptr(),
16103 alpha_q_in,
16104 min_size_in_name.as_ptr(),
16105 min_size_in,
16106 kmin_in_name.as_ptr(),
16107 kmin_in,
16108 kmax_in_name.as_ptr(),
16109 kmax_in,
16110 effort_in_name.as_ptr(),
16111 effort_in,
16112 mixed_in_name.as_ptr(),
16113 mixed_in,
16114 keep_in_name.as_ptr(),
16115 keep_in,
16116 background_in_name.as_ptr(),
16117 background_in,
16118 page_height_in_name.as_ptr(),
16119 page_height_in,
16120 profile_in_name.as_ptr(),
16121 profile_in.as_ptr(),
16122 NULL,
16123 );
16124 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
16125 }
16126}
16127
16128pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
16132 unsafe {
16133 let inp_in: *mut bindings::VipsImage = inp.ctx;
16134
16135 let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
16136 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16137 }
16138}
16139
16140#[derive(Clone, Debug)]
16142pub struct WebpsaveMimeOptions {
16143 pub q: i32,
16146 pub lossless: bool,
16149 pub preset: ForeignWebpPreset,
16158 pub smart_subsample: bool,
16161 pub near_lossless: bool,
16164 pub alpha_q: i32,
16167 pub min_size: bool,
16170 pub kmin: i32,
16173 pub kmax: i32,
16176 pub effort: i32,
16179 pub mixed: bool,
16182 pub keep: ForeignKeep,
16191 pub background: Vec<f64>,
16193 pub page_height: i32,
16196 pub profile: String,
16198}
16199
16200impl std::default::Default for WebpsaveMimeOptions {
16201 fn default() -> Self {
16202 WebpsaveMimeOptions {
16203 q: i32::from(75),
16204 lossless: false,
16205 preset: ForeignWebpPreset::Default,
16206 smart_subsample: false,
16207 near_lossless: false,
16208 alpha_q: i32::from(100),
16209 min_size: false,
16210 kmin: i32::from(2147483646),
16211 kmax: i32::from(2147483647),
16212 effort: i32::from(4),
16213 mixed: false,
16214 keep: ForeignKeep::All,
16215 background: Vec::new(),
16216 page_height: i32::from(0),
16217 profile: String::from("sRGB"),
16218 }
16219 }
16220}
16221
16222pub fn webpsave_mime_with_opts(
16227 inp: &VipsImage,
16228 webpsave_mime_options: &WebpsaveMimeOptions,
16229) -> Result<()> {
16230 unsafe {
16231 let inp_in: *mut bindings::VipsImage = inp.ctx;
16232
16233 let q_in: i32 = webpsave_mime_options.q;
16234 let q_in_name = utils::new_c_string("Q")?;
16235
16236 let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
16237 let lossless_in_name = utils::new_c_string("lossless")?;
16238
16239 let preset_in: i32 = webpsave_mime_options.preset as i32;
16240 let preset_in_name = utils::new_c_string("preset")?;
16241
16242 let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
16243 1
16244 } else {
16245 0
16246 };
16247 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
16248
16249 let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
16250 1
16251 } else {
16252 0
16253 };
16254 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
16255
16256 let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
16257 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
16258
16259 let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
16260 let min_size_in_name = utils::new_c_string("min-size")?;
16261
16262 let kmin_in: i32 = webpsave_mime_options.kmin;
16263 let kmin_in_name = utils::new_c_string("kmin")?;
16264
16265 let kmax_in: i32 = webpsave_mime_options.kmax;
16266 let kmax_in_name = utils::new_c_string("kmax")?;
16267
16268 let effort_in: i32 = webpsave_mime_options.effort;
16269 let effort_in_name = utils::new_c_string("effort")?;
16270
16271 let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
16272 let mixed_in_name = utils::new_c_string("mixed")?;
16273
16274 let keep_in: i32 = webpsave_mime_options.keep as i32;
16275 let keep_in_name = utils::new_c_string("keep")?;
16276
16277 let background_wrapper =
16278 utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
16279 let background_in = background_wrapper.ctx;
16280 let background_in_name = utils::new_c_string("background")?;
16281
16282 let page_height_in: i32 = webpsave_mime_options.page_height;
16283 let page_height_in_name = utils::new_c_string("page-height")?;
16284
16285 let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
16286 let profile_in_name = utils::new_c_string("profile")?;
16287
16288 let vips_op_response = bindings::vips_webpsave_mime(
16289 inp_in,
16290 q_in_name.as_ptr(),
16291 q_in,
16292 lossless_in_name.as_ptr(),
16293 lossless_in,
16294 preset_in_name.as_ptr(),
16295 preset_in,
16296 smart_subsample_in_name.as_ptr(),
16297 smart_subsample_in,
16298 near_lossless_in_name.as_ptr(),
16299 near_lossless_in,
16300 alpha_q_in_name.as_ptr(),
16301 alpha_q_in,
16302 min_size_in_name.as_ptr(),
16303 min_size_in,
16304 kmin_in_name.as_ptr(),
16305 kmin_in,
16306 kmax_in_name.as_ptr(),
16307 kmax_in,
16308 effort_in_name.as_ptr(),
16309 effort_in,
16310 mixed_in_name.as_ptr(),
16311 mixed_in,
16312 keep_in_name.as_ptr(),
16313 keep_in,
16314 background_in_name.as_ptr(),
16315 background_in,
16316 page_height_in_name.as_ptr(),
16317 page_height_in,
16318 profile_in_name.as_ptr(),
16319 profile_in.as_ptr(),
16320 NULL,
16321 );
16322 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
16323 }
16324}
16325
16326pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
16331 unsafe {
16332 let inp_in: *mut bindings::VipsImage = inp.ctx;
16333 let filename_in: CString = utils::new_c_string(filename)?;
16334
16335 let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
16336 utils::result(vips_op_response, (), Error::TiffsaveError)
16337 }
16338}
16339
16340#[derive(Clone, Debug)]
16342pub struct TiffsaveOptions {
16343 pub compression: ForeignTiffCompression,
16355 pub q: i32,
16358 pub predictor: ForeignTiffPredictor,
16364 pub tile: bool,
16367 pub tile_width: i32,
16370 pub tile_height: i32,
16373 pub pyramid: bool,
16376 pub miniswhite: bool,
16379 pub bitdepth: i32,
16382 pub resunit: ForeignTiffResunit,
16387 pub xres: f64,
16390 pub yres: f64,
16393 pub bigtiff: bool,
16396 pub properties: bool,
16399 pub region_shrink: RegionShrink,
16408 pub level: i32,
16411 pub lossless: bool,
16414 pub depth: ForeignDzDepth,
16420 pub subifd: bool,
16423 pub premultiply: bool,
16426 pub keep: ForeignKeep,
16435 pub background: Vec<f64>,
16437 pub page_height: i32,
16440 pub profile: String,
16442}
16443
16444impl std::default::Default for TiffsaveOptions {
16445 fn default() -> Self {
16446 TiffsaveOptions {
16447 compression: ForeignTiffCompression::None,
16448 q: i32::from(75),
16449 predictor: ForeignTiffPredictor::Horizontal,
16450 tile: false,
16451 tile_width: i32::from(128),
16452 tile_height: i32::from(128),
16453 pyramid: false,
16454 miniswhite: false,
16455 bitdepth: i32::from(0),
16456 resunit: ForeignTiffResunit::Cm,
16457 xres: f64::from(1),
16458 yres: f64::from(1),
16459 bigtiff: false,
16460 properties: false,
16461 region_shrink: RegionShrink::Mean,
16462 level: i32::from(10),
16463 lossless: false,
16464 depth: ForeignDzDepth::Onetile,
16465 subifd: false,
16466 premultiply: false,
16467 keep: ForeignKeep::All,
16468 background: Vec::new(),
16469 page_height: i32::from(0),
16470 profile: String::from("sRGB"),
16471 }
16472 }
16473}
16474
16475pub fn tiffsave_with_opts(
16481 inp: &VipsImage,
16482 filename: &str,
16483 tiffsave_options: &TiffsaveOptions,
16484) -> Result<()> {
16485 unsafe {
16486 let inp_in: *mut bindings::VipsImage = inp.ctx;
16487 let filename_in: CString = utils::new_c_string(filename)?;
16488
16489 let compression_in: i32 = tiffsave_options.compression as i32;
16490 let compression_in_name = utils::new_c_string("compression")?;
16491
16492 let q_in: i32 = tiffsave_options.q;
16493 let q_in_name = utils::new_c_string("Q")?;
16494
16495 let predictor_in: i32 = tiffsave_options.predictor as i32;
16496 let predictor_in_name = utils::new_c_string("predictor")?;
16497
16498 let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
16499 let tile_in_name = utils::new_c_string("tile")?;
16500
16501 let tile_width_in: i32 = tiffsave_options.tile_width;
16502 let tile_width_in_name = utils::new_c_string("tile-width")?;
16503
16504 let tile_height_in: i32 = tiffsave_options.tile_height;
16505 let tile_height_in_name = utils::new_c_string("tile-height")?;
16506
16507 let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
16508 let pyramid_in_name = utils::new_c_string("pyramid")?;
16509
16510 let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
16511 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
16512
16513 let bitdepth_in: i32 = tiffsave_options.bitdepth;
16514 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16515
16516 let resunit_in: i32 = tiffsave_options.resunit as i32;
16517 let resunit_in_name = utils::new_c_string("resunit")?;
16518
16519 let xres_in: f64 = tiffsave_options.xres;
16520 let xres_in_name = utils::new_c_string("xres")?;
16521
16522 let yres_in: f64 = tiffsave_options.yres;
16523 let yres_in_name = utils::new_c_string("yres")?;
16524
16525 let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
16526 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
16527
16528 let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
16529 let properties_in_name = utils::new_c_string("properties")?;
16530
16531 let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
16532 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
16533
16534 let level_in: i32 = tiffsave_options.level;
16535 let level_in_name = utils::new_c_string("level")?;
16536
16537 let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
16538 let lossless_in_name = utils::new_c_string("lossless")?;
16539
16540 let depth_in: i32 = tiffsave_options.depth as i32;
16541 let depth_in_name = utils::new_c_string("depth")?;
16542
16543 let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
16544 let subifd_in_name = utils::new_c_string("subifd")?;
16545
16546 let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
16547 let premultiply_in_name = utils::new_c_string("premultiply")?;
16548
16549 let keep_in: i32 = tiffsave_options.keep as i32;
16550 let keep_in_name = utils::new_c_string("keep")?;
16551
16552 let background_wrapper =
16553 utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
16554 let background_in = background_wrapper.ctx;
16555 let background_in_name = utils::new_c_string("background")?;
16556
16557 let page_height_in: i32 = tiffsave_options.page_height;
16558 let page_height_in_name = utils::new_c_string("page-height")?;
16559
16560 let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
16561 let profile_in_name = utils::new_c_string("profile")?;
16562
16563 let vips_op_response = bindings::vips_tiffsave(
16564 inp_in,
16565 filename_in.as_ptr(),
16566 compression_in_name.as_ptr(),
16567 compression_in,
16568 q_in_name.as_ptr(),
16569 q_in,
16570 predictor_in_name.as_ptr(),
16571 predictor_in,
16572 tile_in_name.as_ptr(),
16573 tile_in,
16574 tile_width_in_name.as_ptr(),
16575 tile_width_in,
16576 tile_height_in_name.as_ptr(),
16577 tile_height_in,
16578 pyramid_in_name.as_ptr(),
16579 pyramid_in,
16580 miniswhite_in_name.as_ptr(),
16581 miniswhite_in,
16582 bitdepth_in_name.as_ptr(),
16583 bitdepth_in,
16584 resunit_in_name.as_ptr(),
16585 resunit_in,
16586 xres_in_name.as_ptr(),
16587 xres_in,
16588 yres_in_name.as_ptr(),
16589 yres_in,
16590 bigtiff_in_name.as_ptr(),
16591 bigtiff_in,
16592 properties_in_name.as_ptr(),
16593 properties_in,
16594 region_shrink_in_name.as_ptr(),
16595 region_shrink_in,
16596 level_in_name.as_ptr(),
16597 level_in,
16598 lossless_in_name.as_ptr(),
16599 lossless_in,
16600 depth_in_name.as_ptr(),
16601 depth_in,
16602 subifd_in_name.as_ptr(),
16603 subifd_in,
16604 premultiply_in_name.as_ptr(),
16605 premultiply_in,
16606 keep_in_name.as_ptr(),
16607 keep_in,
16608 background_in_name.as_ptr(),
16609 background_in,
16610 page_height_in_name.as_ptr(),
16611 page_height_in,
16612 profile_in_name.as_ptr(),
16613 profile_in.as_ptr(),
16614 NULL,
16615 );
16616 utils::result(vips_op_response, (), Error::TiffsaveError)
16617 }
16618}
16619
16620pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16624 unsafe {
16625 let inp_in: *mut bindings::VipsImage = inp.ctx;
16626 let mut buffer_buf_size: u64 = 0;
16627 let mut buffer_out: *mut c_void = null_mut();
16628
16629 let vips_op_response =
16630 bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16631 utils::result(
16632 vips_op_response,
16633 utils::new_byte_array(buffer_out, buffer_buf_size),
16634 Error::TiffsaveBufferError,
16635 )
16636 }
16637}
16638
16639#[derive(Clone, Debug)]
16641pub struct TiffsaveBufferOptions {
16642 pub compression: ForeignTiffCompression,
16654 pub q: i32,
16657 pub predictor: ForeignTiffPredictor,
16663 pub tile: bool,
16666 pub tile_width: i32,
16669 pub tile_height: i32,
16672 pub pyramid: bool,
16675 pub miniswhite: bool,
16678 pub bitdepth: i32,
16681 pub resunit: ForeignTiffResunit,
16686 pub xres: f64,
16689 pub yres: f64,
16692 pub bigtiff: bool,
16695 pub properties: bool,
16698 pub region_shrink: RegionShrink,
16707 pub level: i32,
16710 pub lossless: bool,
16713 pub depth: ForeignDzDepth,
16719 pub subifd: bool,
16722 pub premultiply: bool,
16725 pub keep: ForeignKeep,
16734 pub background: Vec<f64>,
16736 pub page_height: i32,
16739 pub profile: String,
16741}
16742
16743impl std::default::Default for TiffsaveBufferOptions {
16744 fn default() -> Self {
16745 TiffsaveBufferOptions {
16746 compression: ForeignTiffCompression::None,
16747 q: i32::from(75),
16748 predictor: ForeignTiffPredictor::Horizontal,
16749 tile: false,
16750 tile_width: i32::from(128),
16751 tile_height: i32::from(128),
16752 pyramid: false,
16753 miniswhite: false,
16754 bitdepth: i32::from(0),
16755 resunit: ForeignTiffResunit::Cm,
16756 xres: f64::from(1),
16757 yres: f64::from(1),
16758 bigtiff: false,
16759 properties: false,
16760 region_shrink: RegionShrink::Mean,
16761 level: i32::from(10),
16762 lossless: false,
16763 depth: ForeignDzDepth::Onetile,
16764 subifd: false,
16765 premultiply: false,
16766 keep: ForeignKeep::All,
16767 background: Vec::new(),
16768 page_height: i32::from(0),
16769 profile: String::from("sRGB"),
16770 }
16771 }
16772}
16773
16774pub fn tiffsave_buffer_with_opts(
16779 inp: &VipsImage,
16780 tiffsave_buffer_options: &TiffsaveBufferOptions,
16781) -> Result<Vec<u8>> {
16782 unsafe {
16783 let inp_in: *mut bindings::VipsImage = inp.ctx;
16784 let mut buffer_buf_size: u64 = 0;
16785 let mut buffer_out: *mut c_void = null_mut();
16786
16787 let compression_in: i32 = tiffsave_buffer_options.compression as i32;
16788 let compression_in_name = utils::new_c_string("compression")?;
16789
16790 let q_in: i32 = tiffsave_buffer_options.q;
16791 let q_in_name = utils::new_c_string("Q")?;
16792
16793 let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
16794 let predictor_in_name = utils::new_c_string("predictor")?;
16795
16796 let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
16797 let tile_in_name = utils::new_c_string("tile")?;
16798
16799 let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
16800 let tile_width_in_name = utils::new_c_string("tile-width")?;
16801
16802 let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
16803 let tile_height_in_name = utils::new_c_string("tile-height")?;
16804
16805 let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
16806 1
16807 } else {
16808 0
16809 };
16810 let pyramid_in_name = utils::new_c_string("pyramid")?;
16811
16812 let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
16813 1
16814 } else {
16815 0
16816 };
16817 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
16818
16819 let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
16820 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16821
16822 let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
16823 let resunit_in_name = utils::new_c_string("resunit")?;
16824
16825 let xres_in: f64 = tiffsave_buffer_options.xres;
16826 let xres_in_name = utils::new_c_string("xres")?;
16827
16828 let yres_in: f64 = tiffsave_buffer_options.yres;
16829 let yres_in_name = utils::new_c_string("yres")?;
16830
16831 let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
16832 1
16833 } else {
16834 0
16835 };
16836 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
16837
16838 let properties_in: i32 = if tiffsave_buffer_options.properties {
16839 1
16840 } else {
16841 0
16842 };
16843 let properties_in_name = utils::new_c_string("properties")?;
16844
16845 let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
16846 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
16847
16848 let level_in: i32 = tiffsave_buffer_options.level;
16849 let level_in_name = utils::new_c_string("level")?;
16850
16851 let lossless_in: i32 = if tiffsave_buffer_options.lossless {
16852 1
16853 } else {
16854 0
16855 };
16856 let lossless_in_name = utils::new_c_string("lossless")?;
16857
16858 let depth_in: i32 = tiffsave_buffer_options.depth as i32;
16859 let depth_in_name = utils::new_c_string("depth")?;
16860
16861 let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
16862 let subifd_in_name = utils::new_c_string("subifd")?;
16863
16864 let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
16865 1
16866 } else {
16867 0
16868 };
16869 let premultiply_in_name = utils::new_c_string("premultiply")?;
16870
16871 let keep_in: i32 = tiffsave_buffer_options.keep as i32;
16872 let keep_in_name = utils::new_c_string("keep")?;
16873
16874 let background_wrapper =
16875 utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
16876 let background_in = background_wrapper.ctx;
16877 let background_in_name = utils::new_c_string("background")?;
16878
16879 let page_height_in: i32 = tiffsave_buffer_options.page_height;
16880 let page_height_in_name = utils::new_c_string("page-height")?;
16881
16882 let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
16883 let profile_in_name = utils::new_c_string("profile")?;
16884
16885 let vips_op_response = bindings::vips_tiffsave_buffer(
16886 inp_in,
16887 &mut buffer_out,
16888 &mut buffer_buf_size,
16889 compression_in_name.as_ptr(),
16890 compression_in,
16891 q_in_name.as_ptr(),
16892 q_in,
16893 predictor_in_name.as_ptr(),
16894 predictor_in,
16895 tile_in_name.as_ptr(),
16896 tile_in,
16897 tile_width_in_name.as_ptr(),
16898 tile_width_in,
16899 tile_height_in_name.as_ptr(),
16900 tile_height_in,
16901 pyramid_in_name.as_ptr(),
16902 pyramid_in,
16903 miniswhite_in_name.as_ptr(),
16904 miniswhite_in,
16905 bitdepth_in_name.as_ptr(),
16906 bitdepth_in,
16907 resunit_in_name.as_ptr(),
16908 resunit_in,
16909 xres_in_name.as_ptr(),
16910 xres_in,
16911 yres_in_name.as_ptr(),
16912 yres_in,
16913 bigtiff_in_name.as_ptr(),
16914 bigtiff_in,
16915 properties_in_name.as_ptr(),
16916 properties_in,
16917 region_shrink_in_name.as_ptr(),
16918 region_shrink_in,
16919 level_in_name.as_ptr(),
16920 level_in,
16921 lossless_in_name.as_ptr(),
16922 lossless_in,
16923 depth_in_name.as_ptr(),
16924 depth_in,
16925 subifd_in_name.as_ptr(),
16926 subifd_in,
16927 premultiply_in_name.as_ptr(),
16928 premultiply_in,
16929 keep_in_name.as_ptr(),
16930 keep_in,
16931 background_in_name.as_ptr(),
16932 background_in,
16933 page_height_in_name.as_ptr(),
16934 page_height_in,
16935 profile_in_name.as_ptr(),
16936 profile_in.as_ptr(),
16937 NULL,
16938 );
16939 utils::result(
16940 vips_op_response,
16941 utils::new_byte_array(buffer_out, buffer_buf_size),
16942 Error::TiffsaveBufferError,
16943 )
16944 }
16945}
16946
16947pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16952 unsafe {
16953 let inp_in: *mut bindings::VipsImage = inp.ctx;
16954 let target_in: *mut bindings::VipsTarget = target.ctx;
16955
16956 let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
16957 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
16958 }
16959}
16960
16961#[derive(Clone, Debug)]
16963pub struct TiffsaveTargetOptions {
16964 pub compression: ForeignTiffCompression,
16976 pub q: i32,
16979 pub predictor: ForeignTiffPredictor,
16985 pub tile: bool,
16988 pub tile_width: i32,
16991 pub tile_height: i32,
16994 pub pyramid: bool,
16997 pub miniswhite: bool,
17000 pub bitdepth: i32,
17003 pub resunit: ForeignTiffResunit,
17008 pub xres: f64,
17011 pub yres: f64,
17014 pub bigtiff: bool,
17017 pub properties: bool,
17020 pub region_shrink: RegionShrink,
17029 pub level: i32,
17032 pub lossless: bool,
17035 pub depth: ForeignDzDepth,
17041 pub subifd: bool,
17044 pub premultiply: bool,
17047 pub keep: ForeignKeep,
17056 pub background: Vec<f64>,
17058 pub page_height: i32,
17061 pub profile: String,
17063}
17064
17065impl std::default::Default for TiffsaveTargetOptions {
17066 fn default() -> Self {
17067 TiffsaveTargetOptions {
17068 compression: ForeignTiffCompression::None,
17069 q: i32::from(75),
17070 predictor: ForeignTiffPredictor::Horizontal,
17071 tile: false,
17072 tile_width: i32::from(128),
17073 tile_height: i32::from(128),
17074 pyramid: false,
17075 miniswhite: false,
17076 bitdepth: i32::from(0),
17077 resunit: ForeignTiffResunit::Cm,
17078 xres: f64::from(1),
17079 yres: f64::from(1),
17080 bigtiff: false,
17081 properties: false,
17082 region_shrink: RegionShrink::Mean,
17083 level: i32::from(10),
17084 lossless: false,
17085 depth: ForeignDzDepth::Onetile,
17086 subifd: false,
17087 premultiply: false,
17088 keep: ForeignKeep::All,
17089 background: Vec::new(),
17090 page_height: i32::from(0),
17091 profile: String::from("sRGB"),
17092 }
17093 }
17094}
17095
17096pub fn tiffsave_target_with_opts(
17102 inp: &VipsImage,
17103 target: &VipsTarget,
17104 tiffsave_target_options: &TiffsaveTargetOptions,
17105) -> Result<()> {
17106 unsafe {
17107 let inp_in: *mut bindings::VipsImage = inp.ctx;
17108 let target_in: *mut bindings::VipsTarget = target.ctx;
17109
17110 let compression_in: i32 = tiffsave_target_options.compression as i32;
17111 let compression_in_name = utils::new_c_string("compression")?;
17112
17113 let q_in: i32 = tiffsave_target_options.q;
17114 let q_in_name = utils::new_c_string("Q")?;
17115
17116 let predictor_in: i32 = tiffsave_target_options.predictor as i32;
17117 let predictor_in_name = utils::new_c_string("predictor")?;
17118
17119 let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
17120 let tile_in_name = utils::new_c_string("tile")?;
17121
17122 let tile_width_in: i32 = tiffsave_target_options.tile_width;
17123 let tile_width_in_name = utils::new_c_string("tile-width")?;
17124
17125 let tile_height_in: i32 = tiffsave_target_options.tile_height;
17126 let tile_height_in_name = utils::new_c_string("tile-height")?;
17127
17128 let pyramid_in: i32 = if tiffsave_target_options.pyramid {
17129 1
17130 } else {
17131 0
17132 };
17133 let pyramid_in_name = utils::new_c_string("pyramid")?;
17134
17135 let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
17136 1
17137 } else {
17138 0
17139 };
17140 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
17141
17142 let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
17143 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17144
17145 let resunit_in: i32 = tiffsave_target_options.resunit as i32;
17146 let resunit_in_name = utils::new_c_string("resunit")?;
17147
17148 let xres_in: f64 = tiffsave_target_options.xres;
17149 let xres_in_name = utils::new_c_string("xres")?;
17150
17151 let yres_in: f64 = tiffsave_target_options.yres;
17152 let yres_in_name = utils::new_c_string("yres")?;
17153
17154 let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
17155 1
17156 } else {
17157 0
17158 };
17159 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
17160
17161 let properties_in: i32 = if tiffsave_target_options.properties {
17162 1
17163 } else {
17164 0
17165 };
17166 let properties_in_name = utils::new_c_string("properties")?;
17167
17168 let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
17169 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17170
17171 let level_in: i32 = tiffsave_target_options.level;
17172 let level_in_name = utils::new_c_string("level")?;
17173
17174 let lossless_in: i32 = if tiffsave_target_options.lossless {
17175 1
17176 } else {
17177 0
17178 };
17179 let lossless_in_name = utils::new_c_string("lossless")?;
17180
17181 let depth_in: i32 = tiffsave_target_options.depth as i32;
17182 let depth_in_name = utils::new_c_string("depth")?;
17183
17184 let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
17185 let subifd_in_name = utils::new_c_string("subifd")?;
17186
17187 let premultiply_in: i32 = if tiffsave_target_options.premultiply {
17188 1
17189 } else {
17190 0
17191 };
17192 let premultiply_in_name = utils::new_c_string("premultiply")?;
17193
17194 let keep_in: i32 = tiffsave_target_options.keep as i32;
17195 let keep_in_name = utils::new_c_string("keep")?;
17196
17197 let background_wrapper =
17198 utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
17199 let background_in = background_wrapper.ctx;
17200 let background_in_name = utils::new_c_string("background")?;
17201
17202 let page_height_in: i32 = tiffsave_target_options.page_height;
17203 let page_height_in_name = utils::new_c_string("page-height")?;
17204
17205 let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
17206 let profile_in_name = utils::new_c_string("profile")?;
17207
17208 let vips_op_response = bindings::vips_tiffsave_target(
17209 inp_in,
17210 target_in,
17211 compression_in_name.as_ptr(),
17212 compression_in,
17213 q_in_name.as_ptr(),
17214 q_in,
17215 predictor_in_name.as_ptr(),
17216 predictor_in,
17217 tile_in_name.as_ptr(),
17218 tile_in,
17219 tile_width_in_name.as_ptr(),
17220 tile_width_in,
17221 tile_height_in_name.as_ptr(),
17222 tile_height_in,
17223 pyramid_in_name.as_ptr(),
17224 pyramid_in,
17225 miniswhite_in_name.as_ptr(),
17226 miniswhite_in,
17227 bitdepth_in_name.as_ptr(),
17228 bitdepth_in,
17229 resunit_in_name.as_ptr(),
17230 resunit_in,
17231 xres_in_name.as_ptr(),
17232 xres_in,
17233 yres_in_name.as_ptr(),
17234 yres_in,
17235 bigtiff_in_name.as_ptr(),
17236 bigtiff_in,
17237 properties_in_name.as_ptr(),
17238 properties_in,
17239 region_shrink_in_name.as_ptr(),
17240 region_shrink_in,
17241 level_in_name.as_ptr(),
17242 level_in,
17243 lossless_in_name.as_ptr(),
17244 lossless_in,
17245 depth_in_name.as_ptr(),
17246 depth_in,
17247 subifd_in_name.as_ptr(),
17248 subifd_in,
17249 premultiply_in_name.as_ptr(),
17250 premultiply_in,
17251 keep_in_name.as_ptr(),
17252 keep_in,
17253 background_in_name.as_ptr(),
17254 background_in,
17255 page_height_in_name.as_ptr(),
17256 page_height_in,
17257 profile_in_name.as_ptr(),
17258 profile_in.as_ptr(),
17259 NULL,
17260 );
17261 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
17262 }
17263}
17264
17265pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
17270 unsafe {
17271 let inp_in: *mut bindings::VipsImage = inp.ctx;
17272 let filename_in: CString = utils::new_c_string(filename)?;
17273
17274 let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
17275 utils::result(vips_op_response, (), Error::HeifsaveError)
17276 }
17277}
17278
17279#[derive(Clone, Debug)]
17281pub struct HeifsaveOptions {
17282 pub q: i32,
17285 pub bitdepth: i32,
17288 pub lossless: bool,
17291 pub compression: ForeignHeifCompression,
17298 pub effort: i32,
17301 pub subsample_mode: ForeignSubsample,
17307 pub encoder: ForeignHeifEncoder,
17315 pub keep: ForeignKeep,
17324 pub background: Vec<f64>,
17326 pub page_height: i32,
17329 pub profile: String,
17331}
17332
17333impl std::default::Default for HeifsaveOptions {
17334 fn default() -> Self {
17335 HeifsaveOptions {
17336 q: i32::from(50),
17337 bitdepth: i32::from(12),
17338 lossless: false,
17339 compression: ForeignHeifCompression::Hevc,
17340 effort: i32::from(4),
17341 subsample_mode: ForeignSubsample::Auto,
17342 encoder: ForeignHeifEncoder::Auto,
17343 keep: ForeignKeep::All,
17344 background: Vec::new(),
17345 page_height: i32::from(0),
17346 profile: String::from("sRGB"),
17347 }
17348 }
17349}
17350
17351pub fn heifsave_with_opts(
17357 inp: &VipsImage,
17358 filename: &str,
17359 heifsave_options: &HeifsaveOptions,
17360) -> Result<()> {
17361 unsafe {
17362 let inp_in: *mut bindings::VipsImage = inp.ctx;
17363 let filename_in: CString = utils::new_c_string(filename)?;
17364
17365 let q_in: i32 = heifsave_options.q;
17366 let q_in_name = utils::new_c_string("Q")?;
17367
17368 let bitdepth_in: i32 = heifsave_options.bitdepth;
17369 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17370
17371 let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
17372 let lossless_in_name = utils::new_c_string("lossless")?;
17373
17374 let compression_in: i32 = heifsave_options.compression as i32;
17375 let compression_in_name = utils::new_c_string("compression")?;
17376
17377 let effort_in: i32 = heifsave_options.effort;
17378 let effort_in_name = utils::new_c_string("effort")?;
17379
17380 let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
17381 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17382
17383 let encoder_in: i32 = heifsave_options.encoder as i32;
17384 let encoder_in_name = utils::new_c_string("encoder")?;
17385
17386 let keep_in: i32 = heifsave_options.keep as i32;
17387 let keep_in_name = utils::new_c_string("keep")?;
17388
17389 let background_wrapper =
17390 utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
17391 let background_in = background_wrapper.ctx;
17392 let background_in_name = utils::new_c_string("background")?;
17393
17394 let page_height_in: i32 = heifsave_options.page_height;
17395 let page_height_in_name = utils::new_c_string("page-height")?;
17396
17397 let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
17398 let profile_in_name = utils::new_c_string("profile")?;
17399
17400 let vips_op_response = bindings::vips_heifsave(
17401 inp_in,
17402 filename_in.as_ptr(),
17403 q_in_name.as_ptr(),
17404 q_in,
17405 bitdepth_in_name.as_ptr(),
17406 bitdepth_in,
17407 lossless_in_name.as_ptr(),
17408 lossless_in,
17409 compression_in_name.as_ptr(),
17410 compression_in,
17411 effort_in_name.as_ptr(),
17412 effort_in,
17413 subsample_mode_in_name.as_ptr(),
17414 subsample_mode_in,
17415 encoder_in_name.as_ptr(),
17416 encoder_in,
17417 keep_in_name.as_ptr(),
17418 keep_in,
17419 background_in_name.as_ptr(),
17420 background_in,
17421 page_height_in_name.as_ptr(),
17422 page_height_in,
17423 profile_in_name.as_ptr(),
17424 profile_in.as_ptr(),
17425 NULL,
17426 );
17427 utils::result(vips_op_response, (), Error::HeifsaveError)
17428 }
17429}
17430
17431pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17435 unsafe {
17436 let inp_in: *mut bindings::VipsImage = inp.ctx;
17437 let mut buffer_buf_size: u64 = 0;
17438 let mut buffer_out: *mut c_void = null_mut();
17439
17440 let vips_op_response =
17441 bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17442 utils::result(
17443 vips_op_response,
17444 utils::new_byte_array(buffer_out, buffer_buf_size),
17445 Error::HeifsaveBufferError,
17446 )
17447 }
17448}
17449
17450#[derive(Clone, Debug)]
17452pub struct HeifsaveBufferOptions {
17453 pub q: i32,
17456 pub bitdepth: i32,
17459 pub lossless: bool,
17462 pub compression: ForeignHeifCompression,
17469 pub effort: i32,
17472 pub subsample_mode: ForeignSubsample,
17478 pub encoder: ForeignHeifEncoder,
17486 pub keep: ForeignKeep,
17495 pub background: Vec<f64>,
17497 pub page_height: i32,
17500 pub profile: String,
17502}
17503
17504impl std::default::Default for HeifsaveBufferOptions {
17505 fn default() -> Self {
17506 HeifsaveBufferOptions {
17507 q: i32::from(50),
17508 bitdepth: i32::from(12),
17509 lossless: false,
17510 compression: ForeignHeifCompression::Hevc,
17511 effort: i32::from(4),
17512 subsample_mode: ForeignSubsample::Auto,
17513 encoder: ForeignHeifEncoder::Auto,
17514 keep: ForeignKeep::All,
17515 background: Vec::new(),
17516 page_height: i32::from(0),
17517 profile: String::from("sRGB"),
17518 }
17519 }
17520}
17521
17522pub fn heifsave_buffer_with_opts(
17527 inp: &VipsImage,
17528 heifsave_buffer_options: &HeifsaveBufferOptions,
17529) -> Result<Vec<u8>> {
17530 unsafe {
17531 let inp_in: *mut bindings::VipsImage = inp.ctx;
17532 let mut buffer_buf_size: u64 = 0;
17533 let mut buffer_out: *mut c_void = null_mut();
17534
17535 let q_in: i32 = heifsave_buffer_options.q;
17536 let q_in_name = utils::new_c_string("Q")?;
17537
17538 let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
17539 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17540
17541 let lossless_in: i32 = if heifsave_buffer_options.lossless {
17542 1
17543 } else {
17544 0
17545 };
17546 let lossless_in_name = utils::new_c_string("lossless")?;
17547
17548 let compression_in: i32 = heifsave_buffer_options.compression as i32;
17549 let compression_in_name = utils::new_c_string("compression")?;
17550
17551 let effort_in: i32 = heifsave_buffer_options.effort;
17552 let effort_in_name = utils::new_c_string("effort")?;
17553
17554 let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
17555 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17556
17557 let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
17558 let encoder_in_name = utils::new_c_string("encoder")?;
17559
17560 let keep_in: i32 = heifsave_buffer_options.keep as i32;
17561 let keep_in_name = utils::new_c_string("keep")?;
17562
17563 let background_wrapper =
17564 utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
17565 let background_in = background_wrapper.ctx;
17566 let background_in_name = utils::new_c_string("background")?;
17567
17568 let page_height_in: i32 = heifsave_buffer_options.page_height;
17569 let page_height_in_name = utils::new_c_string("page-height")?;
17570
17571 let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
17572 let profile_in_name = utils::new_c_string("profile")?;
17573
17574 let vips_op_response = bindings::vips_heifsave_buffer(
17575 inp_in,
17576 &mut buffer_out,
17577 &mut buffer_buf_size,
17578 q_in_name.as_ptr(),
17579 q_in,
17580 bitdepth_in_name.as_ptr(),
17581 bitdepth_in,
17582 lossless_in_name.as_ptr(),
17583 lossless_in,
17584 compression_in_name.as_ptr(),
17585 compression_in,
17586 effort_in_name.as_ptr(),
17587 effort_in,
17588 subsample_mode_in_name.as_ptr(),
17589 subsample_mode_in,
17590 encoder_in_name.as_ptr(),
17591 encoder_in,
17592 keep_in_name.as_ptr(),
17593 keep_in,
17594 background_in_name.as_ptr(),
17595 background_in,
17596 page_height_in_name.as_ptr(),
17597 page_height_in,
17598 profile_in_name.as_ptr(),
17599 profile_in.as_ptr(),
17600 NULL,
17601 );
17602 utils::result(
17603 vips_op_response,
17604 utils::new_byte_array(buffer_out, buffer_buf_size),
17605 Error::HeifsaveBufferError,
17606 )
17607 }
17608}
17609
17610pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17615 unsafe {
17616 let inp_in: *mut bindings::VipsImage = inp.ctx;
17617 let target_in: *mut bindings::VipsTarget = target.ctx;
17618
17619 let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
17620 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
17621 }
17622}
17623
17624#[derive(Clone, Debug)]
17626pub struct HeifsaveTargetOptions {
17627 pub q: i32,
17630 pub bitdepth: i32,
17633 pub lossless: bool,
17636 pub compression: ForeignHeifCompression,
17643 pub effort: i32,
17646 pub subsample_mode: ForeignSubsample,
17652 pub encoder: ForeignHeifEncoder,
17660 pub keep: ForeignKeep,
17669 pub background: Vec<f64>,
17671 pub page_height: i32,
17674 pub profile: String,
17676}
17677
17678impl std::default::Default for HeifsaveTargetOptions {
17679 fn default() -> Self {
17680 HeifsaveTargetOptions {
17681 q: i32::from(50),
17682 bitdepth: i32::from(12),
17683 lossless: false,
17684 compression: ForeignHeifCompression::Hevc,
17685 effort: i32::from(4),
17686 subsample_mode: ForeignSubsample::Auto,
17687 encoder: ForeignHeifEncoder::Auto,
17688 keep: ForeignKeep::All,
17689 background: Vec::new(),
17690 page_height: i32::from(0),
17691 profile: String::from("sRGB"),
17692 }
17693 }
17694}
17695
17696pub fn heifsave_target_with_opts(
17702 inp: &VipsImage,
17703 target: &VipsTarget,
17704 heifsave_target_options: &HeifsaveTargetOptions,
17705) -> Result<()> {
17706 unsafe {
17707 let inp_in: *mut bindings::VipsImage = inp.ctx;
17708 let target_in: *mut bindings::VipsTarget = target.ctx;
17709
17710 let q_in: i32 = heifsave_target_options.q;
17711 let q_in_name = utils::new_c_string("Q")?;
17712
17713 let bitdepth_in: i32 = heifsave_target_options.bitdepth;
17714 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17715
17716 let lossless_in: i32 = if heifsave_target_options.lossless {
17717 1
17718 } else {
17719 0
17720 };
17721 let lossless_in_name = utils::new_c_string("lossless")?;
17722
17723 let compression_in: i32 = heifsave_target_options.compression as i32;
17724 let compression_in_name = utils::new_c_string("compression")?;
17725
17726 let effort_in: i32 = heifsave_target_options.effort;
17727 let effort_in_name = utils::new_c_string("effort")?;
17728
17729 let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
17730 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
17731
17732 let encoder_in: i32 = heifsave_target_options.encoder as i32;
17733 let encoder_in_name = utils::new_c_string("encoder")?;
17734
17735 let keep_in: i32 = heifsave_target_options.keep as i32;
17736 let keep_in_name = utils::new_c_string("keep")?;
17737
17738 let background_wrapper =
17739 utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
17740 let background_in = background_wrapper.ctx;
17741 let background_in_name = utils::new_c_string("background")?;
17742
17743 let page_height_in: i32 = heifsave_target_options.page_height;
17744 let page_height_in_name = utils::new_c_string("page-height")?;
17745
17746 let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
17747 let profile_in_name = utils::new_c_string("profile")?;
17748
17749 let vips_op_response = bindings::vips_heifsave_target(
17750 inp_in,
17751 target_in,
17752 q_in_name.as_ptr(),
17753 q_in,
17754 bitdepth_in_name.as_ptr(),
17755 bitdepth_in,
17756 lossless_in_name.as_ptr(),
17757 lossless_in,
17758 compression_in_name.as_ptr(),
17759 compression_in,
17760 effort_in_name.as_ptr(),
17761 effort_in,
17762 subsample_mode_in_name.as_ptr(),
17763 subsample_mode_in,
17764 encoder_in_name.as_ptr(),
17765 encoder_in,
17766 keep_in_name.as_ptr(),
17767 keep_in,
17768 background_in_name.as_ptr(),
17769 background_in,
17770 page_height_in_name.as_ptr(),
17771 page_height_in,
17772 profile_in_name.as_ptr(),
17773 profile_in.as_ptr(),
17774 NULL,
17775 );
17776 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
17777 }
17778}
17779
17780pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
17786 unsafe {
17787 let filename_in: CString = utils::new_c_string(filename)?;
17788 let width_in: i32 = width;
17789 let mut out_out: *mut bindings::VipsImage = null_mut();
17790
17791 let vips_op_response =
17792 bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
17793 utils::result(
17794 vips_op_response,
17795 VipsImage { ctx: out_out },
17796 Error::ThumbnailError,
17797 )
17798 }
17799}
17800
17801#[derive(Clone, Debug)]
17803pub struct ThumbnailOptions {
17804 pub height: i32,
17807 pub size: Size,
17814 pub no_rotate: bool,
17817 pub crop: Interesting,
17827 pub linear: bool,
17830 pub import_profile: String,
17832 pub export_profile: String,
17834 pub intent: Intent,
17841 pub fail_on: FailOn,
17848}
17849
17850impl std::default::Default for ThumbnailOptions {
17851 fn default() -> Self {
17852 ThumbnailOptions {
17853 height: i32::from(1),
17854 size: Size::Both,
17855 no_rotate: false,
17856 crop: Interesting::None,
17857 linear: false,
17858 import_profile: String::new(),
17859 export_profile: String::new(),
17860 intent: Intent::Relative,
17861 fail_on: FailOn::None,
17862 }
17863 }
17864}
17865
17866pub fn thumbnail_with_opts(
17873 filename: &str,
17874 width: i32,
17875 thumbnail_options: &ThumbnailOptions,
17876) -> Result<VipsImage> {
17877 unsafe {
17878 let filename_in: CString = utils::new_c_string(filename)?;
17879 let width_in: i32 = width;
17880 let mut out_out: *mut bindings::VipsImage = null_mut();
17881
17882 let height_in: i32 = thumbnail_options.height;
17883 let height_in_name = utils::new_c_string("height")?;
17884
17885 let size_in: i32 = thumbnail_options.size as i32;
17886 let size_in_name = utils::new_c_string("size")?;
17887
17888 let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
17889 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
17890
17891 let crop_in: i32 = thumbnail_options.crop as i32;
17892 let crop_in_name = utils::new_c_string("crop")?;
17893
17894 let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
17895 let linear_in_name = utils::new_c_string("linear")?;
17896
17897 let import_profile_in: CString = utils::new_c_string(&thumbnail_options.import_profile)?;
17898 let import_profile_in_name = utils::new_c_string("import-profile")?;
17899
17900 let export_profile_in: CString = utils::new_c_string(&thumbnail_options.export_profile)?;
17901 let export_profile_in_name = utils::new_c_string("export-profile")?;
17902
17903 let intent_in: i32 = thumbnail_options.intent as i32;
17904 let intent_in_name = utils::new_c_string("intent")?;
17905
17906 let fail_on_in: i32 = thumbnail_options.fail_on as i32;
17907 let fail_on_in_name = utils::new_c_string("fail-on")?;
17908
17909 let vips_op_response = bindings::vips_thumbnail(
17910 filename_in.as_ptr(),
17911 &mut out_out,
17912 width_in,
17913 height_in_name.as_ptr(),
17914 height_in,
17915 size_in_name.as_ptr(),
17916 size_in,
17917 no_rotate_in_name.as_ptr(),
17918 no_rotate_in,
17919 crop_in_name.as_ptr(),
17920 crop_in,
17921 linear_in_name.as_ptr(),
17922 linear_in,
17923 import_profile_in_name.as_ptr(),
17924 import_profile_in.as_ptr(),
17925 export_profile_in_name.as_ptr(),
17926 export_profile_in.as_ptr(),
17927 intent_in_name.as_ptr(),
17928 intent_in,
17929 fail_on_in_name.as_ptr(),
17930 fail_on_in,
17931 NULL,
17932 );
17933 utils::result(
17934 vips_op_response,
17935 VipsImage { ctx: out_out },
17936 Error::ThumbnailError,
17937 )
17938 }
17939}
17940
17941pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
17947 unsafe {
17948 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
17949 let width_in: i32 = width;
17950 let mut out_out: *mut bindings::VipsImage = null_mut();
17951
17952 let vips_op_response = bindings::vips_thumbnail_buffer(
17953 buffer_in,
17954 buffer.len() as u64,
17955 &mut out_out,
17956 width_in,
17957 NULL,
17958 );
17959 utils::result(
17960 vips_op_response,
17961 VipsImage { ctx: out_out },
17962 Error::ThumbnailBufferError,
17963 )
17964 }
17965}
17966
17967#[derive(Clone, Debug)]
17969pub struct ThumbnailBufferOptions {
17970 pub option_string: String,
17972 pub height: i32,
17975 pub size: Size,
17982 pub no_rotate: bool,
17985 pub crop: Interesting,
17995 pub linear: bool,
17998 pub import_profile: String,
18000 pub export_profile: String,
18002 pub intent: Intent,
18009 pub fail_on: FailOn,
18016}
18017
18018impl std::default::Default for ThumbnailBufferOptions {
18019 fn default() -> Self {
18020 ThumbnailBufferOptions {
18021 option_string: String::new(),
18022 height: i32::from(1),
18023 size: Size::Both,
18024 no_rotate: false,
18025 crop: Interesting::None,
18026 linear: false,
18027 import_profile: String::new(),
18028 export_profile: String::new(),
18029 intent: Intent::Relative,
18030 fail_on: FailOn::None,
18031 }
18032 }
18033}
18034
18035pub fn thumbnail_buffer_with_opts(
18042 buffer: &[u8],
18043 width: i32,
18044 thumbnail_buffer_options: &ThumbnailBufferOptions,
18045) -> Result<VipsImage> {
18046 unsafe {
18047 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
18048 let width_in: i32 = width;
18049 let mut out_out: *mut bindings::VipsImage = null_mut();
18050
18051 let option_string_in: CString =
18052 utils::new_c_string(&thumbnail_buffer_options.option_string)?;
18053 let option_string_in_name = utils::new_c_string("option-string")?;
18054
18055 let height_in: i32 = thumbnail_buffer_options.height;
18056 let height_in_name = utils::new_c_string("height")?;
18057
18058 let size_in: i32 = thumbnail_buffer_options.size as i32;
18059 let size_in_name = utils::new_c_string("size")?;
18060
18061 let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
18062 1
18063 } else {
18064 0
18065 };
18066 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18067
18068 let crop_in: i32 = thumbnail_buffer_options.crop as i32;
18069 let crop_in_name = utils::new_c_string("crop")?;
18070
18071 let linear_in: i32 = if thumbnail_buffer_options.linear {
18072 1
18073 } else {
18074 0
18075 };
18076 let linear_in_name = utils::new_c_string("linear")?;
18077
18078 let import_profile_in: CString =
18079 utils::new_c_string(&thumbnail_buffer_options.import_profile)?;
18080 let import_profile_in_name = utils::new_c_string("import-profile")?;
18081
18082 let export_profile_in: CString =
18083 utils::new_c_string(&thumbnail_buffer_options.export_profile)?;
18084 let export_profile_in_name = utils::new_c_string("export-profile")?;
18085
18086 let intent_in: i32 = thumbnail_buffer_options.intent as i32;
18087 let intent_in_name = utils::new_c_string("intent")?;
18088
18089 let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
18090 let fail_on_in_name = utils::new_c_string("fail-on")?;
18091
18092 let vips_op_response = bindings::vips_thumbnail_buffer(
18093 buffer_in,
18094 buffer.len() as u64,
18095 &mut out_out,
18096 width_in,
18097 option_string_in_name.as_ptr(),
18098 option_string_in.as_ptr(),
18099 height_in_name.as_ptr(),
18100 height_in,
18101 size_in_name.as_ptr(),
18102 size_in,
18103 no_rotate_in_name.as_ptr(),
18104 no_rotate_in,
18105 crop_in_name.as_ptr(),
18106 crop_in,
18107 linear_in_name.as_ptr(),
18108 linear_in,
18109 import_profile_in_name.as_ptr(),
18110 import_profile_in.as_ptr(),
18111 export_profile_in_name.as_ptr(),
18112 export_profile_in.as_ptr(),
18113 intent_in_name.as_ptr(),
18114 intent_in,
18115 fail_on_in_name.as_ptr(),
18116 fail_on_in,
18117 NULL,
18118 );
18119 utils::result(
18120 vips_op_response,
18121 VipsImage { ctx: out_out },
18122 Error::ThumbnailBufferError,
18123 )
18124 }
18125}
18126
18127pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
18133 unsafe {
18134 let inp_in: *mut bindings::VipsImage = inp.ctx;
18135 let width_in: i32 = width;
18136 let mut out_out: *mut bindings::VipsImage = null_mut();
18137
18138 let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
18139 utils::result(
18140 vips_op_response,
18141 VipsImage { ctx: out_out },
18142 Error::ThumbnailImageError,
18143 )
18144 }
18145}
18146
18147#[derive(Clone, Debug)]
18149pub struct ThumbnailImageOptions {
18150 pub height: i32,
18153 pub size: Size,
18160 pub no_rotate: bool,
18163 pub crop: Interesting,
18173 pub linear: bool,
18176 pub import_profile: String,
18178 pub export_profile: String,
18180 pub intent: Intent,
18187 pub fail_on: FailOn,
18194}
18195
18196impl std::default::Default for ThumbnailImageOptions {
18197 fn default() -> Self {
18198 ThumbnailImageOptions {
18199 height: i32::from(1),
18200 size: Size::Both,
18201 no_rotate: false,
18202 crop: Interesting::None,
18203 linear: false,
18204 import_profile: String::new(),
18205 export_profile: String::new(),
18206 intent: Intent::Relative,
18207 fail_on: FailOn::None,
18208 }
18209 }
18210}
18211
18212pub fn thumbnail_image_with_opts(
18219 inp: &VipsImage,
18220 width: i32,
18221 thumbnail_image_options: &ThumbnailImageOptions,
18222) -> Result<VipsImage> {
18223 unsafe {
18224 let inp_in: *mut bindings::VipsImage = inp.ctx;
18225 let width_in: i32 = width;
18226 let mut out_out: *mut bindings::VipsImage = null_mut();
18227
18228 let height_in: i32 = thumbnail_image_options.height;
18229 let height_in_name = utils::new_c_string("height")?;
18230
18231 let size_in: i32 = thumbnail_image_options.size as i32;
18232 let size_in_name = utils::new_c_string("size")?;
18233
18234 let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
18235 1
18236 } else {
18237 0
18238 };
18239 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18240
18241 let crop_in: i32 = thumbnail_image_options.crop as i32;
18242 let crop_in_name = utils::new_c_string("crop")?;
18243
18244 let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
18245 let linear_in_name = utils::new_c_string("linear")?;
18246
18247 let import_profile_in: CString =
18248 utils::new_c_string(&thumbnail_image_options.import_profile)?;
18249 let import_profile_in_name = utils::new_c_string("import-profile")?;
18250
18251 let export_profile_in: CString =
18252 utils::new_c_string(&thumbnail_image_options.export_profile)?;
18253 let export_profile_in_name = utils::new_c_string("export-profile")?;
18254
18255 let intent_in: i32 = thumbnail_image_options.intent as i32;
18256 let intent_in_name = utils::new_c_string("intent")?;
18257
18258 let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
18259 let fail_on_in_name = utils::new_c_string("fail-on")?;
18260
18261 let vips_op_response = bindings::vips_thumbnail_image(
18262 inp_in,
18263 &mut out_out,
18264 width_in,
18265 height_in_name.as_ptr(),
18266 height_in,
18267 size_in_name.as_ptr(),
18268 size_in,
18269 no_rotate_in_name.as_ptr(),
18270 no_rotate_in,
18271 crop_in_name.as_ptr(),
18272 crop_in,
18273 linear_in_name.as_ptr(),
18274 linear_in,
18275 import_profile_in_name.as_ptr(),
18276 import_profile_in.as_ptr(),
18277 export_profile_in_name.as_ptr(),
18278 export_profile_in.as_ptr(),
18279 intent_in_name.as_ptr(),
18280 intent_in,
18281 fail_on_in_name.as_ptr(),
18282 fail_on_in,
18283 NULL,
18284 );
18285 utils::result(
18286 vips_op_response,
18287 VipsImage { ctx: out_out },
18288 Error::ThumbnailImageError,
18289 )
18290 }
18291}
18292
18293pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
18299 unsafe {
18300 let source_in: *mut bindings::VipsSource = source.ctx;
18301 let width_in: i32 = width;
18302 let mut out_out: *mut bindings::VipsImage = null_mut();
18303
18304 let vips_op_response =
18305 bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
18306 utils::result(
18307 vips_op_response,
18308 VipsImage { ctx: out_out },
18309 Error::ThumbnailSourceError,
18310 )
18311 }
18312}
18313
18314#[derive(Clone, Debug)]
18316pub struct ThumbnailSourceOptions {
18317 pub option_string: String,
18319 pub height: i32,
18322 pub size: Size,
18329 pub no_rotate: bool,
18332 pub crop: Interesting,
18342 pub linear: bool,
18345 pub import_profile: String,
18347 pub export_profile: String,
18349 pub intent: Intent,
18356 pub fail_on: FailOn,
18363}
18364
18365impl std::default::Default for ThumbnailSourceOptions {
18366 fn default() -> Self {
18367 ThumbnailSourceOptions {
18368 option_string: String::new(),
18369 height: i32::from(1),
18370 size: Size::Both,
18371 no_rotate: false,
18372 crop: Interesting::None,
18373 linear: false,
18374 import_profile: String::new(),
18375 export_profile: String::new(),
18376 intent: Intent::Relative,
18377 fail_on: FailOn::None,
18378 }
18379 }
18380}
18381
18382pub fn thumbnail_source_with_opts(
18389 source: &VipsSource,
18390 width: i32,
18391 thumbnail_source_options: &ThumbnailSourceOptions,
18392) -> Result<VipsImage> {
18393 unsafe {
18394 let source_in: *mut bindings::VipsSource = source.ctx;
18395 let width_in: i32 = width;
18396 let mut out_out: *mut bindings::VipsImage = null_mut();
18397
18398 let option_string_in: CString =
18399 utils::new_c_string(&thumbnail_source_options.option_string)?;
18400 let option_string_in_name = utils::new_c_string("option-string")?;
18401
18402 let height_in: i32 = thumbnail_source_options.height;
18403 let height_in_name = utils::new_c_string("height")?;
18404
18405 let size_in: i32 = thumbnail_source_options.size as i32;
18406 let size_in_name = utils::new_c_string("size")?;
18407
18408 let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
18409 1
18410 } else {
18411 0
18412 };
18413 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
18414
18415 let crop_in: i32 = thumbnail_source_options.crop as i32;
18416 let crop_in_name = utils::new_c_string("crop")?;
18417
18418 let linear_in: i32 = if thumbnail_source_options.linear {
18419 1
18420 } else {
18421 0
18422 };
18423 let linear_in_name = utils::new_c_string("linear")?;
18424
18425 let import_profile_in: CString =
18426 utils::new_c_string(&thumbnail_source_options.import_profile)?;
18427 let import_profile_in_name = utils::new_c_string("import-profile")?;
18428
18429 let export_profile_in: CString =
18430 utils::new_c_string(&thumbnail_source_options.export_profile)?;
18431 let export_profile_in_name = utils::new_c_string("export-profile")?;
18432
18433 let intent_in: i32 = thumbnail_source_options.intent as i32;
18434 let intent_in_name = utils::new_c_string("intent")?;
18435
18436 let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
18437 let fail_on_in_name = utils::new_c_string("fail-on")?;
18438
18439 let vips_op_response = bindings::vips_thumbnail_source(
18440 source_in,
18441 &mut out_out,
18442 width_in,
18443 option_string_in_name.as_ptr(),
18444 option_string_in.as_ptr(),
18445 height_in_name.as_ptr(),
18446 height_in,
18447 size_in_name.as_ptr(),
18448 size_in,
18449 no_rotate_in_name.as_ptr(),
18450 no_rotate_in,
18451 crop_in_name.as_ptr(),
18452 crop_in,
18453 linear_in_name.as_ptr(),
18454 linear_in,
18455 import_profile_in_name.as_ptr(),
18456 import_profile_in.as_ptr(),
18457 export_profile_in_name.as_ptr(),
18458 export_profile_in.as_ptr(),
18459 intent_in_name.as_ptr(),
18460 intent_in,
18461 fail_on_in_name.as_ptr(),
18462 fail_on_in,
18463 NULL,
18464 );
18465 utils::result(
18466 vips_op_response,
18467 VipsImage { ctx: out_out },
18468 Error::ThumbnailSourceError,
18469 )
18470 }
18471}
18472
18473pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
18478 unsafe {
18479 let inp_in: *mut bindings::VipsImage = inp.ctx;
18480 let index_in: *mut bindings::VipsImage = index.ctx;
18481 let mut out_out: *mut bindings::VipsImage = null_mut();
18482
18483 let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
18484 utils::result(
18485 vips_op_response,
18486 VipsImage { ctx: out_out },
18487 Error::MapimError,
18488 )
18489 }
18490}
18491
18492#[derive(Clone, Debug)]
18494pub struct MapimOptions {
18495 pub interpolate: VipsInterpolate,
18497 pub background: Vec<f64>,
18499 pub premultiplied: bool,
18502 pub extend: Extend,
18511}
18512
18513impl std::default::Default for MapimOptions {
18514 fn default() -> Self {
18515 MapimOptions {
18516 interpolate: VipsInterpolate::new(),
18517 background: Vec::new(),
18518 premultiplied: false,
18519 extend: Extend::Background,
18520 }
18521 }
18522}
18523
18524pub fn mapim_with_opts(
18530 inp: &VipsImage,
18531 index: &VipsImage,
18532 mapim_options: &MapimOptions,
18533) -> Result<VipsImage> {
18534 unsafe {
18535 let inp_in: *mut bindings::VipsImage = inp.ctx;
18536 let index_in: *mut bindings::VipsImage = index.ctx;
18537 let mut out_out: *mut bindings::VipsImage = null_mut();
18538
18539 let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
18540 let interpolate_in_name = utils::new_c_string("interpolate")?;
18541
18542 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
18543 let background_in = background_wrapper.ctx;
18544 let background_in_name = utils::new_c_string("background")?;
18545
18546 let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
18547 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
18548
18549 let extend_in: i32 = mapim_options.extend as i32;
18550 let extend_in_name = utils::new_c_string("extend")?;
18551
18552 let vips_op_response = bindings::vips_mapim(
18553 inp_in,
18554 &mut out_out,
18555 index_in,
18556 interpolate_in_name.as_ptr(),
18557 interpolate_in,
18558 background_in_name.as_ptr(),
18559 background_in,
18560 premultiplied_in_name.as_ptr(),
18561 premultiplied_in,
18562 extend_in_name.as_ptr(),
18563 extend_in,
18564 NULL,
18565 );
18566 utils::result(
18567 vips_op_response,
18568 VipsImage { ctx: out_out },
18569 Error::MapimError,
18570 )
18571 }
18572}
18573
18574pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
18582 unsafe {
18583 let inp_in: *mut bindings::VipsImage = inp.ctx;
18584 let hshrink_in: f64 = hshrink;
18585 let vshrink_in: f64 = vshrink;
18586 let mut out_out: *mut bindings::VipsImage = null_mut();
18587
18588 let vips_op_response =
18589 bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
18590 utils::result(
18591 vips_op_response,
18592 VipsImage { ctx: out_out },
18593 Error::ShrinkError,
18594 )
18595 }
18596}
18597
18598#[derive(Clone, Debug)]
18600pub struct ShrinkOptions {
18601 pub ceil: bool,
18604}
18605
18606impl std::default::Default for ShrinkOptions {
18607 fn default() -> Self {
18608 ShrinkOptions { ceil: false }
18609 }
18610}
18611
18612pub fn shrink_with_opts(
18621 inp: &VipsImage,
18622 hshrink: f64,
18623 vshrink: f64,
18624 shrink_options: &ShrinkOptions,
18625) -> Result<VipsImage> {
18626 unsafe {
18627 let inp_in: *mut bindings::VipsImage = inp.ctx;
18628 let hshrink_in: f64 = hshrink;
18629 let vshrink_in: f64 = vshrink;
18630 let mut out_out: *mut bindings::VipsImage = null_mut();
18631
18632 let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
18633 let ceil_in_name = utils::new_c_string("ceil")?;
18634
18635 let vips_op_response = bindings::vips_shrink(
18636 inp_in,
18637 &mut out_out,
18638 hshrink_in,
18639 vshrink_in,
18640 ceil_in_name.as_ptr(),
18641 ceil_in,
18642 NULL,
18643 );
18644 utils::result(
18645 vips_op_response,
18646 VipsImage { ctx: out_out },
18647 Error::ShrinkError,
18648 )
18649 }
18650}
18651
18652pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
18658 unsafe {
18659 let inp_in: *mut bindings::VipsImage = inp.ctx;
18660 let hshrink_in: i32 = hshrink;
18661 let mut out_out: *mut bindings::VipsImage = null_mut();
18662
18663 let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
18664 utils::result(
18665 vips_op_response,
18666 VipsImage { ctx: out_out },
18667 Error::ShrinkhError,
18668 )
18669 }
18670}
18671
18672#[derive(Clone, Debug)]
18674pub struct ShrinkhOptions {
18675 pub ceil: bool,
18678}
18679
18680impl std::default::Default for ShrinkhOptions {
18681 fn default() -> Self {
18682 ShrinkhOptions { ceil: false }
18683 }
18684}
18685
18686pub fn shrinkh_with_opts(
18693 inp: &VipsImage,
18694 hshrink: i32,
18695 shrinkh_options: &ShrinkhOptions,
18696) -> Result<VipsImage> {
18697 unsafe {
18698 let inp_in: *mut bindings::VipsImage = inp.ctx;
18699 let hshrink_in: i32 = hshrink;
18700 let mut out_out: *mut bindings::VipsImage = null_mut();
18701
18702 let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
18703 let ceil_in_name = utils::new_c_string("ceil")?;
18704
18705 let vips_op_response = bindings::vips_shrinkh(
18706 inp_in,
18707 &mut out_out,
18708 hshrink_in,
18709 ceil_in_name.as_ptr(),
18710 ceil_in,
18711 NULL,
18712 );
18713 utils::result(
18714 vips_op_response,
18715 VipsImage { ctx: out_out },
18716 Error::ShrinkhError,
18717 )
18718 }
18719}
18720
18721pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
18727 unsafe {
18728 let inp_in: *mut bindings::VipsImage = inp.ctx;
18729 let vshrink_in: i32 = vshrink;
18730 let mut out_out: *mut bindings::VipsImage = null_mut();
18731
18732 let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
18733 utils::result(
18734 vips_op_response,
18735 VipsImage { ctx: out_out },
18736 Error::ShrinkvError,
18737 )
18738 }
18739}
18740
18741#[derive(Clone, Debug)]
18743pub struct ShrinkvOptions {
18744 pub ceil: bool,
18747}
18748
18749impl std::default::Default for ShrinkvOptions {
18750 fn default() -> Self {
18751 ShrinkvOptions { ceil: false }
18752 }
18753}
18754
18755pub fn shrinkv_with_opts(
18762 inp: &VipsImage,
18763 vshrink: i32,
18764 shrinkv_options: &ShrinkvOptions,
18765) -> Result<VipsImage> {
18766 unsafe {
18767 let inp_in: *mut bindings::VipsImage = inp.ctx;
18768 let vshrink_in: i32 = vshrink;
18769 let mut out_out: *mut bindings::VipsImage = null_mut();
18770
18771 let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
18772 let ceil_in_name = utils::new_c_string("ceil")?;
18773
18774 let vips_op_response = bindings::vips_shrinkv(
18775 inp_in,
18776 &mut out_out,
18777 vshrink_in,
18778 ceil_in_name.as_ptr(),
18779 ceil_in,
18780 NULL,
18781 );
18782 utils::result(
18783 vips_op_response,
18784 VipsImage { ctx: out_out },
18785 Error::ShrinkvError,
18786 )
18787 }
18788}
18789
18790pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
18796 unsafe {
18797 let inp_in: *mut bindings::VipsImage = inp.ctx;
18798 let hshrink_in: f64 = hshrink;
18799 let mut out_out: *mut bindings::VipsImage = null_mut();
18800
18801 let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
18802 utils::result(
18803 vips_op_response,
18804 VipsImage { ctx: out_out },
18805 Error::ReducehError,
18806 )
18807 }
18808}
18809
18810#[derive(Clone, Debug)]
18812pub struct ReducehOptions {
18813 pub kernel: Kernel,
18822 pub gap: f64,
18825}
18826
18827impl std::default::Default for ReducehOptions {
18828 fn default() -> Self {
18829 ReducehOptions {
18830 kernel: Kernel::Lanczos3,
18831 gap: f64::from(0),
18832 }
18833 }
18834}
18835
18836pub fn reduceh_with_opts(
18843 inp: &VipsImage,
18844 hshrink: f64,
18845 reduceh_options: &ReducehOptions,
18846) -> Result<VipsImage> {
18847 unsafe {
18848 let inp_in: *mut bindings::VipsImage = inp.ctx;
18849 let hshrink_in: f64 = hshrink;
18850 let mut out_out: *mut bindings::VipsImage = null_mut();
18851
18852 let kernel_in: i32 = reduceh_options.kernel as i32;
18853 let kernel_in_name = utils::new_c_string("kernel")?;
18854
18855 let gap_in: f64 = reduceh_options.gap;
18856 let gap_in_name = utils::new_c_string("gap")?;
18857
18858 let vips_op_response = bindings::vips_reduceh(
18859 inp_in,
18860 &mut out_out,
18861 hshrink_in,
18862 kernel_in_name.as_ptr(),
18863 kernel_in,
18864 gap_in_name.as_ptr(),
18865 gap_in,
18866 NULL,
18867 );
18868 utils::result(
18869 vips_op_response,
18870 VipsImage { ctx: out_out },
18871 Error::ReducehError,
18872 )
18873 }
18874}
18875
18876pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
18882 unsafe {
18883 let inp_in: *mut bindings::VipsImage = inp.ctx;
18884 let vshrink_in: f64 = vshrink;
18885 let mut out_out: *mut bindings::VipsImage = null_mut();
18886
18887 let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
18888 utils::result(
18889 vips_op_response,
18890 VipsImage { ctx: out_out },
18891 Error::ReducevError,
18892 )
18893 }
18894}
18895
18896#[derive(Clone, Debug)]
18898pub struct ReducevOptions {
18899 pub kernel: Kernel,
18908 pub gap: f64,
18911}
18912
18913impl std::default::Default for ReducevOptions {
18914 fn default() -> Self {
18915 ReducevOptions {
18916 kernel: Kernel::Lanczos3,
18917 gap: f64::from(0),
18918 }
18919 }
18920}
18921
18922pub fn reducev_with_opts(
18929 inp: &VipsImage,
18930 vshrink: f64,
18931 reducev_options: &ReducevOptions,
18932) -> Result<VipsImage> {
18933 unsafe {
18934 let inp_in: *mut bindings::VipsImage = inp.ctx;
18935 let vshrink_in: f64 = vshrink;
18936 let mut out_out: *mut bindings::VipsImage = null_mut();
18937
18938 let kernel_in: i32 = reducev_options.kernel as i32;
18939 let kernel_in_name = utils::new_c_string("kernel")?;
18940
18941 let gap_in: f64 = reducev_options.gap;
18942 let gap_in_name = utils::new_c_string("gap")?;
18943
18944 let vips_op_response = bindings::vips_reducev(
18945 inp_in,
18946 &mut out_out,
18947 vshrink_in,
18948 kernel_in_name.as_ptr(),
18949 kernel_in,
18950 gap_in_name.as_ptr(),
18951 gap_in,
18952 NULL,
18953 );
18954 utils::result(
18955 vips_op_response,
18956 VipsImage { ctx: out_out },
18957 Error::ReducevError,
18958 )
18959 }
18960}
18961
18962pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
18970 unsafe {
18971 let inp_in: *mut bindings::VipsImage = inp.ctx;
18972 let hshrink_in: f64 = hshrink;
18973 let vshrink_in: f64 = vshrink;
18974 let mut out_out: *mut bindings::VipsImage = null_mut();
18975
18976 let vips_op_response =
18977 bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
18978 utils::result(
18979 vips_op_response,
18980 VipsImage { ctx: out_out },
18981 Error::ReduceError,
18982 )
18983 }
18984}
18985
18986#[derive(Clone, Debug)]
18988pub struct ReduceOptions {
18989 pub kernel: Kernel,
18998 pub gap: f64,
19001}
19002
19003impl std::default::Default for ReduceOptions {
19004 fn default() -> Self {
19005 ReduceOptions {
19006 kernel: Kernel::Lanczos3,
19007 gap: f64::from(0),
19008 }
19009 }
19010}
19011
19012pub fn reduce_with_opts(
19021 inp: &VipsImage,
19022 hshrink: f64,
19023 vshrink: f64,
19024 reduce_options: &ReduceOptions,
19025) -> Result<VipsImage> {
19026 unsafe {
19027 let inp_in: *mut bindings::VipsImage = inp.ctx;
19028 let hshrink_in: f64 = hshrink;
19029 let vshrink_in: f64 = vshrink;
19030 let mut out_out: *mut bindings::VipsImage = null_mut();
19031
19032 let kernel_in: i32 = reduce_options.kernel as i32;
19033 let kernel_in_name = utils::new_c_string("kernel")?;
19034
19035 let gap_in: f64 = reduce_options.gap;
19036 let gap_in_name = utils::new_c_string("gap")?;
19037
19038 let vips_op_response = bindings::vips_reduce(
19039 inp_in,
19040 &mut out_out,
19041 hshrink_in,
19042 vshrink_in,
19043 kernel_in_name.as_ptr(),
19044 kernel_in,
19045 gap_in_name.as_ptr(),
19046 gap_in,
19047 NULL,
19048 );
19049 utils::result(
19050 vips_op_response,
19051 VipsImage { ctx: out_out },
19052 Error::ReduceError,
19053 )
19054 }
19055}
19056
19057pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
19062 unsafe {
19063 let inp_in: *mut bindings::VipsImage = inp.ctx;
19064 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19065 let mut out_out: *mut bindings::VipsImage = null_mut();
19066
19067 let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
19068 utils::result(
19069 vips_op_response,
19070 VipsImage { ctx: out_out },
19071 Error::QuadraticError,
19072 )
19073 }
19074}
19075
19076#[derive(Clone, Debug)]
19078pub struct QuadraticOptions {
19079 pub interpolate: VipsInterpolate,
19081}
19082
19083impl std::default::Default for QuadraticOptions {
19084 fn default() -> Self {
19085 QuadraticOptions {
19086 interpolate: VipsInterpolate::new(),
19087 }
19088 }
19089}
19090
19091pub fn quadratic_with_opts(
19097 inp: &VipsImage,
19098 coeff: &VipsImage,
19099 quadratic_options: &QuadraticOptions,
19100) -> Result<VipsImage> {
19101 unsafe {
19102 let inp_in: *mut bindings::VipsImage = inp.ctx;
19103 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
19104 let mut out_out: *mut bindings::VipsImage = null_mut();
19105
19106 let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
19107 let interpolate_in_name = utils::new_c_string("interpolate")?;
19108
19109 let vips_op_response = bindings::vips_quadratic(
19110 inp_in,
19111 &mut out_out,
19112 coeff_in,
19113 interpolate_in_name.as_ptr(),
19114 interpolate_in,
19115 NULL,
19116 );
19117 utils::result(
19118 vips_op_response,
19119 VipsImage { ctx: out_out },
19120 Error::QuadraticError,
19121 )
19122 }
19123}
19124
19125pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
19137 unsafe {
19138 let inp_in: *mut bindings::VipsImage = inp.ctx;
19139 let a_in: f64 = a;
19140 let b_in: f64 = b;
19141 let c_in: f64 = c;
19142 let d_in: f64 = d;
19143 let mut out_out: *mut bindings::VipsImage = null_mut();
19144
19145 let vips_op_response =
19146 bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
19147 utils::result(
19148 vips_op_response,
19149 VipsImage { ctx: out_out },
19150 Error::AffineError,
19151 )
19152 }
19153}
19154
19155#[derive(Clone, Debug)]
19157pub struct AffineOptions {
19158 pub interpolate: VipsInterpolate,
19160 pub oarea: Vec<i32>,
19162 pub odx: f64,
19165 pub ody: f64,
19168 pub idx: f64,
19171 pub idy: f64,
19174 pub background: Vec<f64>,
19176 pub premultiplied: bool,
19179 pub extend: Extend,
19188}
19189
19190impl std::default::Default for AffineOptions {
19191 fn default() -> Self {
19192 AffineOptions {
19193 interpolate: VipsInterpolate::new(),
19194 oarea: Vec::new(),
19195 odx: f64::from(0),
19196 ody: f64::from(0),
19197 idx: f64::from(0),
19198 idy: f64::from(0),
19199 background: Vec::new(),
19200 premultiplied: false,
19201 extend: Extend::Background,
19202 }
19203 }
19204}
19205
19206pub fn affine_with_opts(
19219 inp: &VipsImage,
19220 a: f64,
19221 b: f64,
19222 c: f64,
19223 d: f64,
19224 affine_options: &AffineOptions,
19225) -> Result<VipsImage> {
19226 unsafe {
19227 let inp_in: *mut bindings::VipsImage = inp.ctx;
19228 let a_in: f64 = a;
19229 let b_in: f64 = b;
19230 let c_in: f64 = c;
19231 let d_in: f64 = d;
19232 let mut out_out: *mut bindings::VipsImage = null_mut();
19233
19234 let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
19235 let interpolate_in_name = utils::new_c_string("interpolate")?;
19236
19237 let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
19238 let oarea_in = oarea_wrapper.ctx;
19239 let oarea_in_name = utils::new_c_string("oarea")?;
19240
19241 let odx_in: f64 = affine_options.odx;
19242 let odx_in_name = utils::new_c_string("odx")?;
19243
19244 let ody_in: f64 = affine_options.ody;
19245 let ody_in_name = utils::new_c_string("ody")?;
19246
19247 let idx_in: f64 = affine_options.idx;
19248 let idx_in_name = utils::new_c_string("idx")?;
19249
19250 let idy_in: f64 = affine_options.idy;
19251 let idy_in_name = utils::new_c_string("idy")?;
19252
19253 let background_wrapper =
19254 utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
19255 let background_in = background_wrapper.ctx;
19256 let background_in_name = utils::new_c_string("background")?;
19257
19258 let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
19259 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
19260
19261 let extend_in: i32 = affine_options.extend as i32;
19262 let extend_in_name = utils::new_c_string("extend")?;
19263
19264 let vips_op_response = bindings::vips_affine(
19265 inp_in,
19266 &mut out_out,
19267 a_in,
19268 b_in,
19269 c_in,
19270 d_in,
19271 interpolate_in_name.as_ptr(),
19272 interpolate_in,
19273 oarea_in_name.as_ptr(),
19274 oarea_in,
19275 odx_in_name.as_ptr(),
19276 odx_in,
19277 ody_in_name.as_ptr(),
19278 ody_in,
19279 idx_in_name.as_ptr(),
19280 idx_in,
19281 idy_in_name.as_ptr(),
19282 idy_in,
19283 background_in_name.as_ptr(),
19284 background_in,
19285 premultiplied_in_name.as_ptr(),
19286 premultiplied_in,
19287 extend_in_name.as_ptr(),
19288 extend_in,
19289 NULL,
19290 );
19291 utils::result(
19292 vips_op_response,
19293 VipsImage { ctx: out_out },
19294 Error::AffineError,
19295 )
19296 }
19297}
19298
19299pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
19303 unsafe {
19304 let inp_in: *mut bindings::VipsImage = inp.ctx;
19305 let mut out_out: *mut bindings::VipsImage = null_mut();
19306
19307 let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
19308 utils::result(
19309 vips_op_response,
19310 VipsImage { ctx: out_out },
19311 Error::SimilarityError,
19312 )
19313 }
19314}
19315
19316#[derive(Clone, Debug)]
19318pub struct SimilarityOptions {
19319 pub scale: f64,
19322 pub angle: f64,
19325 pub interpolate: VipsInterpolate,
19327 pub background: Vec<f64>,
19329 pub odx: f64,
19332 pub ody: f64,
19335 pub idx: f64,
19338 pub idy: f64,
19341}
19342
19343impl std::default::Default for SimilarityOptions {
19344 fn default() -> Self {
19345 SimilarityOptions {
19346 scale: f64::from(1),
19347 angle: f64::from(0),
19348 interpolate: VipsInterpolate::new(),
19349 background: Vec::new(),
19350 odx: f64::from(0),
19351 ody: f64::from(0),
19352 idx: f64::from(0),
19353 idy: f64::from(0),
19354 }
19355 }
19356}
19357
19358pub fn similarity_with_opts(
19363 inp: &VipsImage,
19364 similarity_options: &SimilarityOptions,
19365) -> Result<VipsImage> {
19366 unsafe {
19367 let inp_in: *mut bindings::VipsImage = inp.ctx;
19368 let mut out_out: *mut bindings::VipsImage = null_mut();
19369
19370 let scale_in: f64 = similarity_options.scale;
19371 let scale_in_name = utils::new_c_string("scale")?;
19372
19373 let angle_in: f64 = similarity_options.angle;
19374 let angle_in_name = utils::new_c_string("angle")?;
19375
19376 let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
19377 let interpolate_in_name = utils::new_c_string("interpolate")?;
19378
19379 let background_wrapper =
19380 utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
19381 let background_in = background_wrapper.ctx;
19382 let background_in_name = utils::new_c_string("background")?;
19383
19384 let odx_in: f64 = similarity_options.odx;
19385 let odx_in_name = utils::new_c_string("odx")?;
19386
19387 let ody_in: f64 = similarity_options.ody;
19388 let ody_in_name = utils::new_c_string("ody")?;
19389
19390 let idx_in: f64 = similarity_options.idx;
19391 let idx_in_name = utils::new_c_string("idx")?;
19392
19393 let idy_in: f64 = similarity_options.idy;
19394 let idy_in_name = utils::new_c_string("idy")?;
19395
19396 let vips_op_response = bindings::vips_similarity(
19397 inp_in,
19398 &mut out_out,
19399 scale_in_name.as_ptr(),
19400 scale_in,
19401 angle_in_name.as_ptr(),
19402 angle_in,
19403 interpolate_in_name.as_ptr(),
19404 interpolate_in,
19405 background_in_name.as_ptr(),
19406 background_in,
19407 odx_in_name.as_ptr(),
19408 odx_in,
19409 ody_in_name.as_ptr(),
19410 ody_in,
19411 idx_in_name.as_ptr(),
19412 idx_in,
19413 idy_in_name.as_ptr(),
19414 idy_in,
19415 NULL,
19416 );
19417 utils::result(
19418 vips_op_response,
19419 VipsImage { ctx: out_out },
19420 Error::SimilarityError,
19421 )
19422 }
19423}
19424
19425pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
19431 unsafe {
19432 let inp_in: *mut bindings::VipsImage = inp.ctx;
19433 let angle_in: f64 = angle;
19434 let mut out_out: *mut bindings::VipsImage = null_mut();
19435
19436 let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
19437 utils::result(
19438 vips_op_response,
19439 VipsImage { ctx: out_out },
19440 Error::RotateError,
19441 )
19442 }
19443}
19444
19445#[derive(Clone, Debug)]
19447pub struct RotateOptions {
19448 pub interpolate: VipsInterpolate,
19450 pub background: Vec<f64>,
19452 pub odx: f64,
19455 pub ody: f64,
19458 pub idx: f64,
19461 pub idy: f64,
19464}
19465
19466impl std::default::Default for RotateOptions {
19467 fn default() -> Self {
19468 RotateOptions {
19469 interpolate: VipsInterpolate::new(),
19470 background: Vec::new(),
19471 odx: f64::from(0),
19472 ody: f64::from(0),
19473 idx: f64::from(0),
19474 idy: f64::from(0),
19475 }
19476 }
19477}
19478
19479pub fn rotate_with_opts(
19486 inp: &VipsImage,
19487 angle: f64,
19488 rotate_options: &RotateOptions,
19489) -> Result<VipsImage> {
19490 unsafe {
19491 let inp_in: *mut bindings::VipsImage = inp.ctx;
19492 let angle_in: f64 = angle;
19493 let mut out_out: *mut bindings::VipsImage = null_mut();
19494
19495 let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
19496 let interpolate_in_name = utils::new_c_string("interpolate")?;
19497
19498 let background_wrapper =
19499 utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
19500 let background_in = background_wrapper.ctx;
19501 let background_in_name = utils::new_c_string("background")?;
19502
19503 let odx_in: f64 = rotate_options.odx;
19504 let odx_in_name = utils::new_c_string("odx")?;
19505
19506 let ody_in: f64 = rotate_options.ody;
19507 let ody_in_name = utils::new_c_string("ody")?;
19508
19509 let idx_in: f64 = rotate_options.idx;
19510 let idx_in_name = utils::new_c_string("idx")?;
19511
19512 let idy_in: f64 = rotate_options.idy;
19513 let idy_in_name = utils::new_c_string("idy")?;
19514
19515 let vips_op_response = bindings::vips_rotate(
19516 inp_in,
19517 &mut out_out,
19518 angle_in,
19519 interpolate_in_name.as_ptr(),
19520 interpolate_in,
19521 background_in_name.as_ptr(),
19522 background_in,
19523 odx_in_name.as_ptr(),
19524 odx_in,
19525 ody_in_name.as_ptr(),
19526 ody_in,
19527 idx_in_name.as_ptr(),
19528 idx_in,
19529 idy_in_name.as_ptr(),
19530 idy_in,
19531 NULL,
19532 );
19533 utils::result(
19534 vips_op_response,
19535 VipsImage { ctx: out_out },
19536 Error::RotateError,
19537 )
19538 }
19539}
19540
19541pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
19547 unsafe {
19548 let inp_in: *mut bindings::VipsImage = inp.ctx;
19549 let scale_in: f64 = scale;
19550 let mut out_out: *mut bindings::VipsImage = null_mut();
19551
19552 let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
19553 utils::result(
19554 vips_op_response,
19555 VipsImage { ctx: out_out },
19556 Error::ResizeError,
19557 )
19558 }
19559}
19560
19561#[derive(Clone, Debug)]
19563pub struct ResizeOptions {
19564 pub kernel: Kernel,
19573 pub gap: f64,
19576 pub vscale: f64,
19579}
19580
19581impl std::default::Default for ResizeOptions {
19582 fn default() -> Self {
19583 ResizeOptions {
19584 kernel: Kernel::Lanczos3,
19585 gap: f64::from(2),
19586 vscale: f64::from(0),
19587 }
19588 }
19589}
19590
19591pub fn resize_with_opts(
19598 inp: &VipsImage,
19599 scale: f64,
19600 resize_options: &ResizeOptions,
19601) -> Result<VipsImage> {
19602 unsafe {
19603 let inp_in: *mut bindings::VipsImage = inp.ctx;
19604 let scale_in: f64 = scale;
19605 let mut out_out: *mut bindings::VipsImage = null_mut();
19606
19607 let kernel_in: i32 = resize_options.kernel as i32;
19608 let kernel_in_name = utils::new_c_string("kernel")?;
19609
19610 let gap_in: f64 = resize_options.gap;
19611 let gap_in_name = utils::new_c_string("gap")?;
19612
19613 let vscale_in: f64 = resize_options.vscale;
19614 let vscale_in_name = utils::new_c_string("vscale")?;
19615
19616 let vips_op_response = bindings::vips_resize(
19617 inp_in,
19618 &mut out_out,
19619 scale_in,
19620 kernel_in_name.as_ptr(),
19621 kernel_in,
19622 gap_in_name.as_ptr(),
19623 gap_in,
19624 vscale_in_name.as_ptr(),
19625 vscale_in,
19626 NULL,
19627 );
19628 utils::result(
19629 vips_op_response,
19630 VipsImage { ctx: out_out },
19631 Error::ResizeError,
19632 )
19633 }
19634}
19635
19636pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
19662 unsafe {
19663 let inp_in: *mut bindings::VipsImage = inp.ctx;
19664 let space_in: i32 = space as i32;
19665 let mut out_out: *mut bindings::VipsImage = null_mut();
19666
19667 let vips_op_response =
19668 bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
19669 utils::result(
19670 vips_op_response,
19671 VipsImage { ctx: out_out },
19672 Error::ColourspaceError,
19673 )
19674 }
19675}
19676
19677#[derive(Clone, Debug)]
19679pub struct ColourspaceOptions {
19680 pub source_space: Interpretation,
19703}
19704
19705impl std::default::Default for ColourspaceOptions {
19706 fn default() -> Self {
19707 ColourspaceOptions {
19708 source_space: Interpretation::Srgb,
19709 }
19710 }
19711}
19712
19713pub fn colourspace_with_opts(
19740 inp: &VipsImage,
19741 space: Interpretation,
19742 colourspace_options: &ColourspaceOptions,
19743) -> Result<VipsImage> {
19744 unsafe {
19745 let inp_in: *mut bindings::VipsImage = inp.ctx;
19746 let space_in: i32 = space as i32;
19747 let mut out_out: *mut bindings::VipsImage = null_mut();
19748
19749 let source_space_in: i32 = colourspace_options.source_space as i32;
19750 let source_space_in_name = utils::new_c_string("source-space")?;
19751
19752 let vips_op_response = bindings::vips_colourspace(
19753 inp_in,
19754 &mut out_out,
19755 space_in.try_into().unwrap(),
19756 source_space_in_name.as_ptr(),
19757 source_space_in,
19758 NULL,
19759 );
19760 utils::result(
19761 vips_op_response,
19762 VipsImage { ctx: out_out },
19763 Error::ColourspaceError,
19764 )
19765 }
19766}
19767
19768pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
19772 unsafe {
19773 let inp_in: *mut bindings::VipsImage = inp.ctx;
19774 let mut out_out: *mut bindings::VipsImage = null_mut();
19775
19776 let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
19777 utils::result(
19778 vips_op_response,
19779 VipsImage { ctx: out_out },
19780 Error::Lab2XyzError,
19781 )
19782 }
19783}
19784
19785#[derive(Clone, Debug)]
19787pub struct Lab2XyzOptions {
19788 pub temp: Vec<f64>,
19790}
19791
19792impl std::default::Default for Lab2XyzOptions {
19793 fn default() -> Self {
19794 Lab2XyzOptions { temp: Vec::new() }
19795 }
19796}
19797
19798pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
19803 unsafe {
19804 let inp_in: *mut bindings::VipsImage = inp.ctx;
19805 let mut out_out: *mut bindings::VipsImage = null_mut();
19806
19807 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
19808 let temp_in = temp_wrapper.ctx;
19809 let temp_in_name = utils::new_c_string("temp")?;
19810
19811 let vips_op_response =
19812 bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
19813 utils::result(
19814 vips_op_response,
19815 VipsImage { ctx: out_out },
19816 Error::Lab2XyzError,
19817 )
19818 }
19819}
19820
19821pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
19825 unsafe {
19826 let inp_in: *mut bindings::VipsImage = inp.ctx;
19827 let mut out_out: *mut bindings::VipsImage = null_mut();
19828
19829 let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
19830 utils::result(
19831 vips_op_response,
19832 VipsImage { ctx: out_out },
19833 Error::Xyz2LabError,
19834 )
19835 }
19836}
19837
19838#[derive(Clone, Debug)]
19840pub struct Xyz2LabOptions {
19841 pub temp: Vec<f64>,
19843}
19844
19845impl std::default::Default for Xyz2LabOptions {
19846 fn default() -> Self {
19847 Xyz2LabOptions { temp: Vec::new() }
19848 }
19849}
19850
19851pub fn xyz2_lab_with_opts(
19856 inp: &VipsImage,
19857 xyz_2_lab_options: &Xyz2LabOptions,
19858) -> Result<VipsImage> {
19859 unsafe {
19860 let inp_in: *mut bindings::VipsImage = inp.ctx;
19861 let mut out_out: *mut bindings::VipsImage = null_mut();
19862
19863 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
19864 let temp_in = temp_wrapper.ctx;
19865 let temp_in_name = utils::new_c_string("temp")?;
19866
19867 let vips_op_response =
19868 bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
19869 utils::result(
19870 vips_op_response,
19871 VipsImage { ctx: out_out },
19872 Error::Xyz2LabError,
19873 )
19874 }
19875}
19876
19877pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
19881 unsafe {
19882 let inp_in: *mut bindings::VipsImage = inp.ctx;
19883 let mut out_out: *mut bindings::VipsImage = null_mut();
19884
19885 let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
19886 utils::result(
19887 vips_op_response,
19888 VipsImage { ctx: out_out },
19889 Error::Lab2LChError,
19890 )
19891 }
19892}
19893
19894pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
19898 unsafe {
19899 let inp_in: *mut bindings::VipsImage = inp.ctx;
19900 let mut out_out: *mut bindings::VipsImage = null_mut();
19901
19902 let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
19903 utils::result(
19904 vips_op_response,
19905 VipsImage { ctx: out_out },
19906 Error::LCh2LabError,
19907 )
19908 }
19909}
19910
19911pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
19915 unsafe {
19916 let inp_in: *mut bindings::VipsImage = inp.ctx;
19917 let mut out_out: *mut bindings::VipsImage = null_mut();
19918
19919 let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
19920 utils::result(
19921 vips_op_response,
19922 VipsImage { ctx: out_out },
19923 Error::LCh2CmcError,
19924 )
19925 }
19926}
19927
19928pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
19932 unsafe {
19933 let inp_in: *mut bindings::VipsImage = inp.ctx;
19934 let mut out_out: *mut bindings::VipsImage = null_mut();
19935
19936 let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
19937 utils::result(
19938 vips_op_response,
19939 VipsImage { ctx: out_out },
19940 Error::Cmc2LChError,
19941 )
19942 }
19943}
19944
19945pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
19949 unsafe {
19950 let inp_in: *mut bindings::VipsImage = inp.ctx;
19951 let mut out_out: *mut bindings::VipsImage = null_mut();
19952
19953 let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
19954 utils::result(
19955 vips_op_response,
19956 VipsImage { ctx: out_out },
19957 Error::Xyz2YxyError,
19958 )
19959 }
19960}
19961
19962pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
19966 unsafe {
19967 let inp_in: *mut bindings::VipsImage = inp.ctx;
19968 let mut out_out: *mut bindings::VipsImage = null_mut();
19969
19970 let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
19971 utils::result(
19972 vips_op_response,
19973 VipsImage { ctx: out_out },
19974 Error::Yxy2XyzError,
19975 )
19976 }
19977}
19978
19979pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
19983 unsafe {
19984 let inp_in: *mut bindings::VipsImage = inp.ctx;
19985 let mut out_out: *mut bindings::VipsImage = null_mut();
19986
19987 let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
19988 utils::result(
19989 vips_op_response,
19990 VipsImage { ctx: out_out },
19991 Error::LabQ2LabError,
19992 )
19993 }
19994}
19995
19996pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20000 unsafe {
20001 let inp_in: *mut bindings::VipsImage = inp.ctx;
20002 let mut out_out: *mut bindings::VipsImage = null_mut();
20003
20004 let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
20005 utils::result(
20006 vips_op_response,
20007 VipsImage { ctx: out_out },
20008 Error::Lab2LabQError,
20009 )
20010 }
20011}
20012
20013pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20017 unsafe {
20018 let inp_in: *mut bindings::VipsImage = inp.ctx;
20019 let mut out_out: *mut bindings::VipsImage = null_mut();
20020
20021 let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
20022 utils::result(
20023 vips_op_response,
20024 VipsImage { ctx: out_out },
20025 Error::LabQ2LabSError,
20026 )
20027 }
20028}
20029
20030pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
20034 unsafe {
20035 let inp_in: *mut bindings::VipsImage = inp.ctx;
20036 let mut out_out: *mut bindings::VipsImage = null_mut();
20037
20038 let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
20039 utils::result(
20040 vips_op_response,
20041 VipsImage { ctx: out_out },
20042 Error::LabS2LabQError,
20043 )
20044 }
20045}
20046
20047pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
20051 unsafe {
20052 let inp_in: *mut bindings::VipsImage = inp.ctx;
20053 let mut out_out: *mut bindings::VipsImage = null_mut();
20054
20055 let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
20056 utils::result(
20057 vips_op_response,
20058 VipsImage { ctx: out_out },
20059 Error::LabS2LabError,
20060 )
20061 }
20062}
20063
20064pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
20068 unsafe {
20069 let inp_in: *mut bindings::VipsImage = inp.ctx;
20070 let mut out_out: *mut bindings::VipsImage = null_mut();
20071
20072 let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
20073 utils::result(
20074 vips_op_response,
20075 VipsImage { ctx: out_out },
20076 Error::Lab2LabSError,
20077 )
20078 }
20079}
20080
20081pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
20085 unsafe {
20086 let inp_in: *mut bindings::VipsImage = inp.ctx;
20087 let mut out_out: *mut bindings::VipsImage = null_mut();
20088
20089 let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
20090 utils::result(
20091 vips_op_response,
20092 VipsImage { ctx: out_out },
20093 Error::Rad2FloatError,
20094 )
20095 }
20096}
20097
20098pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
20102 unsafe {
20103 let inp_in: *mut bindings::VipsImage = inp.ctx;
20104 let mut out_out: *mut bindings::VipsImage = null_mut();
20105
20106 let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
20107 utils::result(
20108 vips_op_response,
20109 VipsImage { ctx: out_out },
20110 Error::Float2RadError,
20111 )
20112 }
20113}
20114
20115pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20119 unsafe {
20120 let inp_in: *mut bindings::VipsImage = inp.ctx;
20121 let mut out_out: *mut bindings::VipsImage = null_mut();
20122
20123 let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
20124 utils::result(
20125 vips_op_response,
20126 VipsImage { ctx: out_out },
20127 Error::LabQ2SRgbError,
20128 )
20129 }
20130}
20131
20132pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
20136 unsafe {
20137 let inp_in: *mut bindings::VipsImage = inp.ctx;
20138 let mut out_out: *mut bindings::VipsImage = null_mut();
20139
20140 let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
20141 utils::result(
20142 vips_op_response,
20143 VipsImage { ctx: out_out },
20144 Error::SRgb2HsvError,
20145 )
20146 }
20147}
20148
20149pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20153 unsafe {
20154 let inp_in: *mut bindings::VipsImage = inp.ctx;
20155 let mut out_out: *mut bindings::VipsImage = null_mut();
20156
20157 let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
20158 utils::result(
20159 vips_op_response,
20160 VipsImage { ctx: out_out },
20161 Error::Hsv2SRgbError,
20162 )
20163 }
20164}
20165
20166pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
20170 unsafe {
20171 let inp_in: *mut bindings::VipsImage = inp.ctx;
20172 let mut out_out: *mut bindings::VipsImage = null_mut();
20173
20174 let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
20175 utils::result(
20176 vips_op_response,
20177 VipsImage { ctx: out_out },
20178 Error::IccImportError,
20179 )
20180 }
20181}
20182
20183#[derive(Clone, Debug)]
20185pub struct IccImportOptions {
20186 pub pcs: PCS,
20191 pub intent: Intent,
20198 pub black_point_compensation: bool,
20201 pub embedded: bool,
20204 pub input_profile: String,
20206}
20207
20208impl std::default::Default for IccImportOptions {
20209 fn default() -> Self {
20210 IccImportOptions {
20211 pcs: PCS::Lab,
20212 intent: Intent::Relative,
20213 black_point_compensation: false,
20214 embedded: false,
20215 input_profile: String::new(),
20216 }
20217 }
20218}
20219
20220pub fn icc_import_with_opts(
20225 inp: &VipsImage,
20226 icc_import_options: &IccImportOptions,
20227) -> Result<VipsImage> {
20228 unsafe {
20229 let inp_in: *mut bindings::VipsImage = inp.ctx;
20230 let mut out_out: *mut bindings::VipsImage = null_mut();
20231
20232 let pcs_in: i32 = icc_import_options.pcs as i32;
20233 let pcs_in_name = utils::new_c_string("pcs")?;
20234
20235 let intent_in: i32 = icc_import_options.intent as i32;
20236 let intent_in_name = utils::new_c_string("intent")?;
20237
20238 let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
20239 1
20240 } else {
20241 0
20242 };
20243 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20244
20245 let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
20246 let embedded_in_name = utils::new_c_string("embedded")?;
20247
20248 let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
20249 let input_profile_in_name = utils::new_c_string("input-profile")?;
20250
20251 let vips_op_response = bindings::vips_icc_import(
20252 inp_in,
20253 &mut out_out,
20254 pcs_in_name.as_ptr(),
20255 pcs_in,
20256 intent_in_name.as_ptr(),
20257 intent_in,
20258 black_point_compensation_in_name.as_ptr(),
20259 black_point_compensation_in,
20260 embedded_in_name.as_ptr(),
20261 embedded_in,
20262 input_profile_in_name.as_ptr(),
20263 input_profile_in.as_ptr(),
20264 NULL,
20265 );
20266 utils::result(
20267 vips_op_response,
20268 VipsImage { ctx: out_out },
20269 Error::IccImportError,
20270 )
20271 }
20272}
20273
20274pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
20278 unsafe {
20279 let inp_in: *mut bindings::VipsImage = inp.ctx;
20280 let mut out_out: *mut bindings::VipsImage = null_mut();
20281
20282 let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
20283 utils::result(
20284 vips_op_response,
20285 VipsImage { ctx: out_out },
20286 Error::IccExportError,
20287 )
20288 }
20289}
20290
20291#[derive(Clone, Debug)]
20293pub struct IccExportOptions {
20294 pub pcs: PCS,
20299 pub intent: Intent,
20306 pub black_point_compensation: bool,
20309 pub output_profile: String,
20311 pub depth: i32,
20314}
20315
20316impl std::default::Default for IccExportOptions {
20317 fn default() -> Self {
20318 IccExportOptions {
20319 pcs: PCS::Lab,
20320 intent: Intent::Relative,
20321 black_point_compensation: false,
20322 output_profile: String::new(),
20323 depth: i32::from(8),
20324 }
20325 }
20326}
20327
20328pub fn icc_export_with_opts(
20333 inp: &VipsImage,
20334 icc_export_options: &IccExportOptions,
20335) -> Result<VipsImage> {
20336 unsafe {
20337 let inp_in: *mut bindings::VipsImage = inp.ctx;
20338 let mut out_out: *mut bindings::VipsImage = null_mut();
20339
20340 let pcs_in: i32 = icc_export_options.pcs as i32;
20341 let pcs_in_name = utils::new_c_string("pcs")?;
20342
20343 let intent_in: i32 = icc_export_options.intent as i32;
20344 let intent_in_name = utils::new_c_string("intent")?;
20345
20346 let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
20347 1
20348 } else {
20349 0
20350 };
20351 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20352
20353 let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
20354 let output_profile_in_name = utils::new_c_string("output-profile")?;
20355
20356 let depth_in: i32 = icc_export_options.depth;
20357 let depth_in_name = utils::new_c_string("depth")?;
20358
20359 let vips_op_response = bindings::vips_icc_export(
20360 inp_in,
20361 &mut out_out,
20362 pcs_in_name.as_ptr(),
20363 pcs_in,
20364 intent_in_name.as_ptr(),
20365 intent_in,
20366 black_point_compensation_in_name.as_ptr(),
20367 black_point_compensation_in,
20368 output_profile_in_name.as_ptr(),
20369 output_profile_in.as_ptr(),
20370 depth_in_name.as_ptr(),
20371 depth_in,
20372 NULL,
20373 );
20374 utils::result(
20375 vips_op_response,
20376 VipsImage { ctx: out_out },
20377 Error::IccExportError,
20378 )
20379 }
20380}
20381
20382pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
20387 unsafe {
20388 let inp_in: *mut bindings::VipsImage = inp.ctx;
20389 let output_profile_in: CString = utils::new_c_string(output_profile)?;
20390 let mut out_out: *mut bindings::VipsImage = null_mut();
20391
20392 let vips_op_response =
20393 bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
20394 utils::result(
20395 vips_op_response,
20396 VipsImage { ctx: out_out },
20397 Error::IccTransformError,
20398 )
20399 }
20400}
20401
20402#[derive(Clone, Debug)]
20404pub struct IccTransformOptions {
20405 pub pcs: PCS,
20410 pub intent: Intent,
20417 pub black_point_compensation: bool,
20420 pub embedded: bool,
20423 pub input_profile: String,
20425 pub depth: i32,
20428}
20429
20430impl std::default::Default for IccTransformOptions {
20431 fn default() -> Self {
20432 IccTransformOptions {
20433 pcs: PCS::Lab,
20434 intent: Intent::Relative,
20435 black_point_compensation: false,
20436 embedded: false,
20437 input_profile: String::new(),
20438 depth: i32::from(8),
20439 }
20440 }
20441}
20442
20443pub fn icc_transform_with_opts(
20449 inp: &VipsImage,
20450 output_profile: &str,
20451 icc_transform_options: &IccTransformOptions,
20452) -> Result<VipsImage> {
20453 unsafe {
20454 let inp_in: *mut bindings::VipsImage = inp.ctx;
20455 let output_profile_in: CString = utils::new_c_string(output_profile)?;
20456 let mut out_out: *mut bindings::VipsImage = null_mut();
20457
20458 let pcs_in: i32 = icc_transform_options.pcs as i32;
20459 let pcs_in_name = utils::new_c_string("pcs")?;
20460
20461 let intent_in: i32 = icc_transform_options.intent as i32;
20462 let intent_in_name = utils::new_c_string("intent")?;
20463
20464 let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
20465 1
20466 } else {
20467 0
20468 };
20469 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
20470
20471 let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
20472 let embedded_in_name = utils::new_c_string("embedded")?;
20473
20474 let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
20475 let input_profile_in_name = utils::new_c_string("input-profile")?;
20476
20477 let depth_in: i32 = icc_transform_options.depth;
20478 let depth_in_name = utils::new_c_string("depth")?;
20479
20480 let vips_op_response = bindings::vips_icc_transform(
20481 inp_in,
20482 &mut out_out,
20483 output_profile_in.as_ptr(),
20484 pcs_in_name.as_ptr(),
20485 pcs_in,
20486 intent_in_name.as_ptr(),
20487 intent_in,
20488 black_point_compensation_in_name.as_ptr(),
20489 black_point_compensation_in,
20490 embedded_in_name.as_ptr(),
20491 embedded_in,
20492 input_profile_in_name.as_ptr(),
20493 input_profile_in.as_ptr(),
20494 depth_in_name.as_ptr(),
20495 depth_in,
20496 NULL,
20497 );
20498 utils::result(
20499 vips_op_response,
20500 VipsImage { ctx: out_out },
20501 Error::IccTransformError,
20502 )
20503 }
20504}
20505
20506pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20511 unsafe {
20512 let left_in: *mut bindings::VipsImage = left.ctx;
20513 let right_in: *mut bindings::VipsImage = right.ctx;
20514 let mut out_out: *mut bindings::VipsImage = null_mut();
20515
20516 let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
20517 utils::result(
20518 vips_op_response,
20519 VipsImage { ctx: out_out },
20520 Error::DE76Error,
20521 )
20522 }
20523}
20524
20525pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20530 unsafe {
20531 let left_in: *mut bindings::VipsImage = left.ctx;
20532 let right_in: *mut bindings::VipsImage = right.ctx;
20533 let mut out_out: *mut bindings::VipsImage = null_mut();
20534
20535 let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
20536 utils::result(
20537 vips_op_response,
20538 VipsImage { ctx: out_out },
20539 Error::DE00Error,
20540 )
20541 }
20542}
20543
20544pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
20549 unsafe {
20550 let left_in: *mut bindings::VipsImage = left.ctx;
20551 let right_in: *mut bindings::VipsImage = right.ctx;
20552 let mut out_out: *mut bindings::VipsImage = null_mut();
20553
20554 let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
20555 utils::result(
20556 vips_op_response,
20557 VipsImage { ctx: out_out },
20558 Error::DEcmcError,
20559 )
20560 }
20561}
20562
20563pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20567 unsafe {
20568 let inp_in: *mut bindings::VipsImage = inp.ctx;
20569 let mut out_out: *mut bindings::VipsImage = null_mut();
20570
20571 let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
20572 utils::result(
20573 vips_op_response,
20574 VipsImage { ctx: out_out },
20575 Error::SRgb2ScRgbError,
20576 )
20577 }
20578}
20579
20580pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
20584 unsafe {
20585 let inp_in: *mut bindings::VipsImage = inp.ctx;
20586 let mut out_out: *mut bindings::VipsImage = null_mut();
20587
20588 let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
20589 utils::result(
20590 vips_op_response,
20591 VipsImage { ctx: out_out },
20592 Error::ScRgb2XyzError,
20593 )
20594 }
20595}
20596
20597pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
20601 unsafe {
20602 let inp_in: *mut bindings::VipsImage = inp.ctx;
20603 let mut out_out: *mut bindings::VipsImage = null_mut();
20604
20605 let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
20606 utils::result(
20607 vips_op_response,
20608 VipsImage { ctx: out_out },
20609 Error::ScRgb2BwError,
20610 )
20611 }
20612}
20613
20614#[derive(Clone, Debug)]
20616pub struct ScRgb2BwOptions {
20617 pub depth: i32,
20620}
20621
20622impl std::default::Default for ScRgb2BwOptions {
20623 fn default() -> Self {
20624 ScRgb2BwOptions {
20625 depth: i32::from(8),
20626 }
20627 }
20628}
20629
20630pub fn sc_rgb2bw_with_opts(
20635 inp: &VipsImage,
20636 sc_rgb_2bw_options: &ScRgb2BwOptions,
20637) -> Result<VipsImage> {
20638 unsafe {
20639 let inp_in: *mut bindings::VipsImage = inp.ctx;
20640 let mut out_out: *mut bindings::VipsImage = null_mut();
20641
20642 let depth_in: i32 = sc_rgb_2bw_options.depth;
20643 let depth_in_name = utils::new_c_string("depth")?;
20644
20645 let vips_op_response =
20646 bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20647 utils::result(
20648 vips_op_response,
20649 VipsImage { ctx: out_out },
20650 Error::ScRgb2BwError,
20651 )
20652 }
20653}
20654
20655pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
20659 unsafe {
20660 let inp_in: *mut bindings::VipsImage = inp.ctx;
20661 let mut out_out: *mut bindings::VipsImage = null_mut();
20662
20663 let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
20664 utils::result(
20665 vips_op_response,
20666 VipsImage { ctx: out_out },
20667 Error::Xyz2ScRgbError,
20668 )
20669 }
20670}
20671
20672pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
20676 unsafe {
20677 let inp_in: *mut bindings::VipsImage = inp.ctx;
20678 let mut out_out: *mut bindings::VipsImage = null_mut();
20679
20680 let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
20681 utils::result(
20682 vips_op_response,
20683 VipsImage { ctx: out_out },
20684 Error::ScRgb2SRgbError,
20685 )
20686 }
20687}
20688
20689#[derive(Clone, Debug)]
20691pub struct ScRgb2SRgbOptions {
20692 pub depth: i32,
20695}
20696
20697impl std::default::Default for ScRgb2SRgbOptions {
20698 fn default() -> Self {
20699 ScRgb2SRgbOptions {
20700 depth: i32::from(8),
20701 }
20702 }
20703}
20704
20705pub fn sc_rgb_2s_rgb_with_opts(
20710 inp: &VipsImage,
20711 sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
20712) -> Result<VipsImage> {
20713 unsafe {
20714 let inp_in: *mut bindings::VipsImage = inp.ctx;
20715 let mut out_out: *mut bindings::VipsImage = null_mut();
20716
20717 let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
20718 let depth_in_name = utils::new_c_string("depth")?;
20719
20720 let vips_op_response =
20721 bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
20722 utils::result(
20723 vips_op_response,
20724 VipsImage { ctx: out_out },
20725 Error::ScRgb2SRgbError,
20726 )
20727 }
20728}
20729
20730pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
20734 unsafe {
20735 let inp_in: *mut bindings::VipsImage = inp.ctx;
20736 let mut out_out: *mut bindings::VipsImage = null_mut();
20737
20738 let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
20739 utils::result(
20740 vips_op_response,
20741 VipsImage { ctx: out_out },
20742 Error::Cmyk2XyzError,
20743 )
20744 }
20745}
20746
20747pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
20751 unsafe {
20752 let inp_in: *mut bindings::VipsImage = inp.ctx;
20753 let mut out_out: *mut bindings::VipsImage = null_mut();
20754
20755 let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
20756 utils::result(
20757 vips_op_response,
20758 VipsImage { ctx: out_out },
20759 Error::Xyz2CmykError,
20760 )
20761 }
20762}
20763
20764pub fn profile_load(name: &str) -> Result<Vec<u8>> {
20768 unsafe {
20769 let name_in: CString = utils::new_c_string(name)?;
20770 let mut profile_out: *mut bindings::VipsBlob = null_mut();
20771
20772 let vips_op_response =
20773 bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
20774 utils::result(
20775 vips_op_response,
20776 VipsBlob { ctx: profile_out }.into(),
20777 Error::ProfileLoadError,
20778 )
20779 }
20780}
20781
20782pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
20787 unsafe {
20788 let inp_in: *mut bindings::VipsImage = inp.ctx;
20789 let lut_in: *mut bindings::VipsImage = lut.ctx;
20790 let mut out_out: *mut bindings::VipsImage = null_mut();
20791
20792 let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
20793 utils::result(
20794 vips_op_response,
20795 VipsImage { ctx: out_out },
20796 Error::MaplutError,
20797 )
20798 }
20799}
20800
20801#[derive(Clone, Debug)]
20803pub struct MaplutOptions {
20804 pub band: i32,
20807}
20808
20809impl std::default::Default for MaplutOptions {
20810 fn default() -> Self {
20811 MaplutOptions {
20812 band: i32::from(-1),
20813 }
20814 }
20815}
20816
20817pub fn maplut_with_opts(
20823 inp: &VipsImage,
20824 lut: &VipsImage,
20825 maplut_options: &MaplutOptions,
20826) -> Result<VipsImage> {
20827 unsafe {
20828 let inp_in: *mut bindings::VipsImage = inp.ctx;
20829 let lut_in: *mut bindings::VipsImage = lut.ctx;
20830 let mut out_out: *mut bindings::VipsImage = null_mut();
20831
20832 let band_in: i32 = maplut_options.band;
20833 let band_in_name = utils::new_c_string("band")?;
20834
20835 let vips_op_response = bindings::vips_maplut(
20836 inp_in,
20837 &mut out_out,
20838 lut_in,
20839 band_in_name.as_ptr(),
20840 band_in,
20841 NULL,
20842 );
20843 utils::result(
20844 vips_op_response,
20845 VipsImage { ctx: out_out },
20846 Error::MaplutError,
20847 )
20848 }
20849}
20850
20851pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
20857 unsafe {
20858 let inp_in: *mut bindings::VipsImage = inp.ctx;
20859 let percent_in: f64 = percent;
20860 let mut threshold_out: i32 = i32::from(0);
20861
20862 let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
20863 utils::result(vips_op_response, threshold_out, Error::PercentError)
20864 }
20865}
20866
20867pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
20875 unsafe {
20876 let inp_in: *mut bindings::VipsImage = inp.ctx;
20877 let width_in: i32 = width;
20878 let height_in: i32 = height;
20879 let mut out_out: *mut bindings::VipsImage = null_mut();
20880
20881 let vips_op_response =
20882 bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
20883 utils::result(
20884 vips_op_response,
20885 VipsImage { ctx: out_out },
20886 Error::StdifError,
20887 )
20888 }
20889}
20890
20891#[derive(Clone, Debug)]
20893pub struct StdifOptions {
20894 pub s_0: f64,
20897 pub b: f64,
20900 pub m_0: f64,
20903 pub a: f64,
20906}
20907
20908impl std::default::Default for StdifOptions {
20909 fn default() -> Self {
20910 StdifOptions {
20911 s_0: f64::from(50),
20912 b: f64::from(0.5),
20913 m_0: f64::from(128),
20914 a: f64::from(0.5),
20915 }
20916 }
20917}
20918
20919pub fn stdif_with_opts(
20928 inp: &VipsImage,
20929 width: i32,
20930 height: i32,
20931 stdif_options: &StdifOptions,
20932) -> Result<VipsImage> {
20933 unsafe {
20934 let inp_in: *mut bindings::VipsImage = inp.ctx;
20935 let width_in: i32 = width;
20936 let height_in: i32 = height;
20937 let mut out_out: *mut bindings::VipsImage = null_mut();
20938
20939 let s_0_in: f64 = stdif_options.s_0;
20940 let s_0_in_name = utils::new_c_string("s0")?;
20941
20942 let b_in: f64 = stdif_options.b;
20943 let b_in_name = utils::new_c_string("b")?;
20944
20945 let m_0_in: f64 = stdif_options.m_0;
20946 let m_0_in_name = utils::new_c_string("m0")?;
20947
20948 let a_in: f64 = stdif_options.a;
20949 let a_in_name = utils::new_c_string("a")?;
20950
20951 let vips_op_response = bindings::vips_stdif(
20952 inp_in,
20953 &mut out_out,
20954 width_in,
20955 height_in,
20956 s_0_in_name.as_ptr(),
20957 s_0_in,
20958 b_in_name.as_ptr(),
20959 b_in,
20960 m_0_in_name.as_ptr(),
20961 m_0_in,
20962 a_in_name.as_ptr(),
20963 a_in,
20964 NULL,
20965 );
20966 utils::result(
20967 vips_op_response,
20968 VipsImage { ctx: out_out },
20969 Error::StdifError,
20970 )
20971 }
20972}
20973
20974pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
20978 unsafe {
20979 let inp_in: *mut bindings::VipsImage = inp.ctx;
20980 let mut out_out: *mut bindings::VipsImage = null_mut();
20981
20982 let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
20983 utils::result(
20984 vips_op_response,
20985 VipsImage { ctx: out_out },
20986 Error::HistCumError,
20987 )
20988 }
20989}
20990
20991pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
20996 unsafe {
20997 let inp_in: *mut bindings::VipsImage = inp.ctx;
20998 let refp_in: *mut bindings::VipsImage = refp.ctx;
20999 let mut out_out: *mut bindings::VipsImage = null_mut();
21000
21001 let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
21002 utils::result(
21003 vips_op_response,
21004 VipsImage { ctx: out_out },
21005 Error::HistMatchError,
21006 )
21007 }
21008}
21009
21010pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
21014 unsafe {
21015 let inp_in: *mut bindings::VipsImage = inp.ctx;
21016 let mut out_out: *mut bindings::VipsImage = null_mut();
21017
21018 let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
21019 utils::result(
21020 vips_op_response,
21021 VipsImage { ctx: out_out },
21022 Error::HistNormError,
21023 )
21024 }
21025}
21026
21027pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
21031 unsafe {
21032 let inp_in: *mut bindings::VipsImage = inp.ctx;
21033 let mut out_out: *mut bindings::VipsImage = null_mut();
21034
21035 let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
21036 utils::result(
21037 vips_op_response,
21038 VipsImage { ctx: out_out },
21039 Error::HistEqualError,
21040 )
21041 }
21042}
21043
21044#[derive(Clone, Debug)]
21046pub struct HistEqualOptions {
21047 pub band: i32,
21050}
21051
21052impl std::default::Default for HistEqualOptions {
21053 fn default() -> Self {
21054 HistEqualOptions {
21055 band: i32::from(-1),
21056 }
21057 }
21058}
21059
21060pub fn hist_equal_with_opts(
21065 inp: &VipsImage,
21066 hist_equal_options: &HistEqualOptions,
21067) -> Result<VipsImage> {
21068 unsafe {
21069 let inp_in: *mut bindings::VipsImage = inp.ctx;
21070 let mut out_out: *mut bindings::VipsImage = null_mut();
21071
21072 let band_in: i32 = hist_equal_options.band;
21073 let band_in_name = utils::new_c_string("band")?;
21074
21075 let vips_op_response =
21076 bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
21077 utils::result(
21078 vips_op_response,
21079 VipsImage { ctx: out_out },
21080 Error::HistEqualError,
21081 )
21082 }
21083}
21084
21085pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
21089 unsafe {
21090 let inp_in: *mut bindings::VipsImage = inp.ctx;
21091 let mut out_out: *mut bindings::VipsImage = null_mut();
21092
21093 let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
21094 utils::result(
21095 vips_op_response,
21096 VipsImage { ctx: out_out },
21097 Error::HistPlotError,
21098 )
21099 }
21100}
21101
21102pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
21110 unsafe {
21111 let inp_in: *mut bindings::VipsImage = inp.ctx;
21112 let width_in: i32 = width;
21113 let height_in: i32 = height;
21114 let mut out_out: *mut bindings::VipsImage = null_mut();
21115
21116 let vips_op_response =
21117 bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
21118 utils::result(
21119 vips_op_response,
21120 VipsImage { ctx: out_out },
21121 Error::HistLocalError,
21122 )
21123 }
21124}
21125
21126#[derive(Clone, Debug)]
21128pub struct HistLocalOptions {
21129 pub max_slope: i32,
21132}
21133
21134impl std::default::Default for HistLocalOptions {
21135 fn default() -> Self {
21136 HistLocalOptions {
21137 max_slope: i32::from(0),
21138 }
21139 }
21140}
21141
21142pub fn hist_local_with_opts(
21151 inp: &VipsImage,
21152 width: i32,
21153 height: i32,
21154 hist_local_options: &HistLocalOptions,
21155) -> Result<VipsImage> {
21156 unsafe {
21157 let inp_in: *mut bindings::VipsImage = inp.ctx;
21158 let width_in: i32 = width;
21159 let height_in: i32 = height;
21160 let mut out_out: *mut bindings::VipsImage = null_mut();
21161
21162 let max_slope_in: i32 = hist_local_options.max_slope;
21163 let max_slope_in_name = utils::new_c_string("max-slope")?;
21164
21165 let vips_op_response = bindings::vips_hist_local(
21166 inp_in,
21167 &mut out_out,
21168 width_in,
21169 height_in,
21170 max_slope_in_name.as_ptr(),
21171 max_slope_in,
21172 NULL,
21173 );
21174 utils::result(
21175 vips_op_response,
21176 VipsImage { ctx: out_out },
21177 Error::HistLocalError,
21178 )
21179 }
21180}
21181
21182pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
21186 unsafe {
21187 let inp_in: *mut bindings::VipsImage = inp.ctx;
21188 let mut monotonic_out: i32 = 0;
21189
21190 let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
21191 utils::result(
21192 vips_op_response,
21193 monotonic_out != 0,
21194 Error::HistIsmonotonicError,
21195 )
21196 }
21197}
21198
21199pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
21203 unsafe {
21204 let inp_in: *mut bindings::VipsImage = inp.ctx;
21205 let mut out_out: f64 = f64::from(0);
21206
21207 let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
21208 utils::result(vips_op_response, out_out, Error::HistEntropyError)
21209 }
21210}
21211
21212pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21217 unsafe {
21218 let inp_in: *mut bindings::VipsImage = inp.ctx;
21219 let mask_in: *mut bindings::VipsImage = mask.ctx;
21220 let mut out_out: *mut bindings::VipsImage = null_mut();
21221
21222 let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
21223 utils::result(
21224 vips_op_response,
21225 VipsImage { ctx: out_out },
21226 Error::ConvError,
21227 )
21228 }
21229}
21230
21231#[derive(Clone, Debug)]
21233pub struct ConvOptions {
21234 pub precision: Precision,
21240 pub layers: i32,
21243 pub cluster: i32,
21246}
21247
21248impl std::default::Default for ConvOptions {
21249 fn default() -> Self {
21250 ConvOptions {
21251 precision: Precision::Float,
21252 layers: i32::from(5),
21253 cluster: i32::from(1),
21254 }
21255 }
21256}
21257
21258pub fn conv_with_opts(
21264 inp: &VipsImage,
21265 mask: &VipsImage,
21266 conv_options: &ConvOptions,
21267) -> Result<VipsImage> {
21268 unsafe {
21269 let inp_in: *mut bindings::VipsImage = inp.ctx;
21270 let mask_in: *mut bindings::VipsImage = mask.ctx;
21271 let mut out_out: *mut bindings::VipsImage = null_mut();
21272
21273 let precision_in: i32 = conv_options.precision as i32;
21274 let precision_in_name = utils::new_c_string("precision")?;
21275
21276 let layers_in: i32 = conv_options.layers;
21277 let layers_in_name = utils::new_c_string("layers")?;
21278
21279 let cluster_in: i32 = conv_options.cluster;
21280 let cluster_in_name = utils::new_c_string("cluster")?;
21281
21282 let vips_op_response = bindings::vips_conv(
21283 inp_in,
21284 &mut out_out,
21285 mask_in,
21286 precision_in_name.as_ptr(),
21287 precision_in,
21288 layers_in_name.as_ptr(),
21289 layers_in,
21290 cluster_in_name.as_ptr(),
21291 cluster_in,
21292 NULL,
21293 );
21294 utils::result(
21295 vips_op_response,
21296 VipsImage { ctx: out_out },
21297 Error::ConvError,
21298 )
21299 }
21300}
21301
21302pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21307 unsafe {
21308 let inp_in: *mut bindings::VipsImage = inp.ctx;
21309 let mask_in: *mut bindings::VipsImage = mask.ctx;
21310 let mut out_out: *mut bindings::VipsImage = null_mut();
21311
21312 let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
21313 utils::result(
21314 vips_op_response,
21315 VipsImage { ctx: out_out },
21316 Error::ConvaError,
21317 )
21318 }
21319}
21320
21321#[derive(Clone, Debug)]
21323pub struct ConvaOptions {
21324 pub layers: i32,
21327 pub cluster: i32,
21330}
21331
21332impl std::default::Default for ConvaOptions {
21333 fn default() -> Self {
21334 ConvaOptions {
21335 layers: i32::from(5),
21336 cluster: i32::from(1),
21337 }
21338 }
21339}
21340
21341pub fn conva_with_opts(
21347 inp: &VipsImage,
21348 mask: &VipsImage,
21349 conva_options: &ConvaOptions,
21350) -> Result<VipsImage> {
21351 unsafe {
21352 let inp_in: *mut bindings::VipsImage = inp.ctx;
21353 let mask_in: *mut bindings::VipsImage = mask.ctx;
21354 let mut out_out: *mut bindings::VipsImage = null_mut();
21355
21356 let layers_in: i32 = conva_options.layers;
21357 let layers_in_name = utils::new_c_string("layers")?;
21358
21359 let cluster_in: i32 = conva_options.cluster;
21360 let cluster_in_name = utils::new_c_string("cluster")?;
21361
21362 let vips_op_response = bindings::vips_conva(
21363 inp_in,
21364 &mut out_out,
21365 mask_in,
21366 layers_in_name.as_ptr(),
21367 layers_in,
21368 cluster_in_name.as_ptr(),
21369 cluster_in,
21370 NULL,
21371 );
21372 utils::result(
21373 vips_op_response,
21374 VipsImage { ctx: out_out },
21375 Error::ConvaError,
21376 )
21377 }
21378}
21379
21380pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21385 unsafe {
21386 let inp_in: *mut bindings::VipsImage = inp.ctx;
21387 let mask_in: *mut bindings::VipsImage = mask.ctx;
21388 let mut out_out: *mut bindings::VipsImage = null_mut();
21389
21390 let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
21391 utils::result(
21392 vips_op_response,
21393 VipsImage { ctx: out_out },
21394 Error::ConvfError,
21395 )
21396 }
21397}
21398
21399pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21404 unsafe {
21405 let inp_in: *mut bindings::VipsImage = inp.ctx;
21406 let mask_in: *mut bindings::VipsImage = mask.ctx;
21407 let mut out_out: *mut bindings::VipsImage = null_mut();
21408
21409 let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
21410 utils::result(
21411 vips_op_response,
21412 VipsImage { ctx: out_out },
21413 Error::ConviError,
21414 )
21415 }
21416}
21417
21418pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21423 unsafe {
21424 let inp_in: *mut bindings::VipsImage = inp.ctx;
21425 let mask_in: *mut bindings::VipsImage = mask.ctx;
21426 let mut out_out: *mut bindings::VipsImage = null_mut();
21427
21428 let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
21429 utils::result(
21430 vips_op_response,
21431 VipsImage { ctx: out_out },
21432 Error::CompassError,
21433 )
21434 }
21435}
21436
21437#[derive(Clone, Debug)]
21439pub struct CompassOptions {
21440 pub times: i32,
21443 pub angle: Angle45,
21454 pub combine: Combine,
21460 pub precision: Precision,
21466 pub layers: i32,
21469 pub cluster: i32,
21472}
21473
21474impl std::default::Default for CompassOptions {
21475 fn default() -> Self {
21476 CompassOptions {
21477 times: i32::from(2),
21478 angle: Angle45::D90,
21479 combine: Combine::Max,
21480 precision: Precision::Float,
21481 layers: i32::from(5),
21482 cluster: i32::from(1),
21483 }
21484 }
21485}
21486
21487pub fn compass_with_opts(
21493 inp: &VipsImage,
21494 mask: &VipsImage,
21495 compass_options: &CompassOptions,
21496) -> Result<VipsImage> {
21497 unsafe {
21498 let inp_in: *mut bindings::VipsImage = inp.ctx;
21499 let mask_in: *mut bindings::VipsImage = mask.ctx;
21500 let mut out_out: *mut bindings::VipsImage = null_mut();
21501
21502 let times_in: i32 = compass_options.times;
21503 let times_in_name = utils::new_c_string("times")?;
21504
21505 let angle_in: i32 = compass_options.angle as i32;
21506 let angle_in_name = utils::new_c_string("angle")?;
21507
21508 let combine_in: i32 = compass_options.combine as i32;
21509 let combine_in_name = utils::new_c_string("combine")?;
21510
21511 let precision_in: i32 = compass_options.precision as i32;
21512 let precision_in_name = utils::new_c_string("precision")?;
21513
21514 let layers_in: i32 = compass_options.layers;
21515 let layers_in_name = utils::new_c_string("layers")?;
21516
21517 let cluster_in: i32 = compass_options.cluster;
21518 let cluster_in_name = utils::new_c_string("cluster")?;
21519
21520 let vips_op_response = bindings::vips_compass(
21521 inp_in,
21522 &mut out_out,
21523 mask_in,
21524 times_in_name.as_ptr(),
21525 times_in,
21526 angle_in_name.as_ptr(),
21527 angle_in,
21528 combine_in_name.as_ptr(),
21529 combine_in,
21530 precision_in_name.as_ptr(),
21531 precision_in,
21532 layers_in_name.as_ptr(),
21533 layers_in,
21534 cluster_in_name.as_ptr(),
21535 cluster_in,
21536 NULL,
21537 );
21538 utils::result(
21539 vips_op_response,
21540 VipsImage { ctx: out_out },
21541 Error::CompassError,
21542 )
21543 }
21544}
21545
21546pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21551 unsafe {
21552 let inp_in: *mut bindings::VipsImage = inp.ctx;
21553 let mask_in: *mut bindings::VipsImage = mask.ctx;
21554 let mut out_out: *mut bindings::VipsImage = null_mut();
21555
21556 let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
21557 utils::result(
21558 vips_op_response,
21559 VipsImage { ctx: out_out },
21560 Error::ConvsepError,
21561 )
21562 }
21563}
21564
21565#[derive(Clone, Debug)]
21567pub struct ConvsepOptions {
21568 pub precision: Precision,
21574 pub layers: i32,
21577 pub cluster: i32,
21580}
21581
21582impl std::default::Default for ConvsepOptions {
21583 fn default() -> Self {
21584 ConvsepOptions {
21585 precision: Precision::Float,
21586 layers: i32::from(5),
21587 cluster: i32::from(1),
21588 }
21589 }
21590}
21591
21592pub fn convsep_with_opts(
21598 inp: &VipsImage,
21599 mask: &VipsImage,
21600 convsep_options: &ConvsepOptions,
21601) -> Result<VipsImage> {
21602 unsafe {
21603 let inp_in: *mut bindings::VipsImage = inp.ctx;
21604 let mask_in: *mut bindings::VipsImage = mask.ctx;
21605 let mut out_out: *mut bindings::VipsImage = null_mut();
21606
21607 let precision_in: i32 = convsep_options.precision as i32;
21608 let precision_in_name = utils::new_c_string("precision")?;
21609
21610 let layers_in: i32 = convsep_options.layers;
21611 let layers_in_name = utils::new_c_string("layers")?;
21612
21613 let cluster_in: i32 = convsep_options.cluster;
21614 let cluster_in_name = utils::new_c_string("cluster")?;
21615
21616 let vips_op_response = bindings::vips_convsep(
21617 inp_in,
21618 &mut out_out,
21619 mask_in,
21620 precision_in_name.as_ptr(),
21621 precision_in,
21622 layers_in_name.as_ptr(),
21623 layers_in,
21624 cluster_in_name.as_ptr(),
21625 cluster_in,
21626 NULL,
21627 );
21628 utils::result(
21629 vips_op_response,
21630 VipsImage { ctx: out_out },
21631 Error::ConvsepError,
21632 )
21633 }
21634}
21635
21636pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
21641 unsafe {
21642 let inp_in: *mut bindings::VipsImage = inp.ctx;
21643 let mask_in: *mut bindings::VipsImage = mask.ctx;
21644 let mut out_out: *mut bindings::VipsImage = null_mut();
21645
21646 let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
21647 utils::result(
21648 vips_op_response,
21649 VipsImage { ctx: out_out },
21650 Error::ConvasepError,
21651 )
21652 }
21653}
21654
21655#[derive(Clone, Debug)]
21657pub struct ConvasepOptions {
21658 pub layers: i32,
21661}
21662
21663impl std::default::Default for ConvasepOptions {
21664 fn default() -> Self {
21665 ConvasepOptions {
21666 layers: i32::from(5),
21667 }
21668 }
21669}
21670
21671pub fn convasep_with_opts(
21677 inp: &VipsImage,
21678 mask: &VipsImage,
21679 convasep_options: &ConvasepOptions,
21680) -> Result<VipsImage> {
21681 unsafe {
21682 let inp_in: *mut bindings::VipsImage = inp.ctx;
21683 let mask_in: *mut bindings::VipsImage = mask.ctx;
21684 let mut out_out: *mut bindings::VipsImage = null_mut();
21685
21686 let layers_in: i32 = convasep_options.layers;
21687 let layers_in_name = utils::new_c_string("layers")?;
21688
21689 let vips_op_response = bindings::vips_convasep(
21690 inp_in,
21691 &mut out_out,
21692 mask_in,
21693 layers_in_name.as_ptr(),
21694 layers_in,
21695 NULL,
21696 );
21697 utils::result(
21698 vips_op_response,
21699 VipsImage { ctx: out_out },
21700 Error::ConvasepError,
21701 )
21702 }
21703}
21704
21705pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21710 unsafe {
21711 let inp_in: *mut bindings::VipsImage = inp.ctx;
21712 let refp_in: *mut bindings::VipsImage = refp.ctx;
21713 let mut out_out: *mut bindings::VipsImage = null_mut();
21714
21715 let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
21716 utils::result(
21717 vips_op_response,
21718 VipsImage { ctx: out_out },
21719 Error::FastcorError,
21720 )
21721 }
21722}
21723
21724pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
21729 unsafe {
21730 let inp_in: *mut bindings::VipsImage = inp.ctx;
21731 let refp_in: *mut bindings::VipsImage = refp.ctx;
21732 let mut out_out: *mut bindings::VipsImage = null_mut();
21733
21734 let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
21735 utils::result(
21736 vips_op_response,
21737 VipsImage { ctx: out_out },
21738 Error::SpcorError,
21739 )
21740 }
21741}
21742
21743pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
21747 unsafe {
21748 let inp_in: *mut bindings::VipsImage = inp.ctx;
21749 let mut out_out: *mut bindings::VipsImage = null_mut();
21750
21751 let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
21752 utils::result(
21753 vips_op_response,
21754 VipsImage { ctx: out_out },
21755 Error::SharpenError,
21756 )
21757 }
21758}
21759
21760#[derive(Clone, Debug)]
21762pub struct SharpenOptions {
21763 pub sigma: f64,
21766 pub x_1: f64,
21769 pub y_2: f64,
21772 pub y_3: f64,
21775 pub m_1: f64,
21778 pub m_2: f64,
21781}
21782
21783impl std::default::Default for SharpenOptions {
21784 fn default() -> Self {
21785 SharpenOptions {
21786 sigma: f64::from(0.5),
21787 x_1: f64::from(2),
21788 y_2: f64::from(10),
21789 y_3: f64::from(20),
21790 m_1: f64::from(0),
21791 m_2: f64::from(3),
21792 }
21793 }
21794}
21795
21796pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
21801 unsafe {
21802 let inp_in: *mut bindings::VipsImage = inp.ctx;
21803 let mut out_out: *mut bindings::VipsImage = null_mut();
21804
21805 let sigma_in: f64 = sharpen_options.sigma;
21806 let sigma_in_name = utils::new_c_string("sigma")?;
21807
21808 let x_1_in: f64 = sharpen_options.x_1;
21809 let x_1_in_name = utils::new_c_string("x1")?;
21810
21811 let y_2_in: f64 = sharpen_options.y_2;
21812 let y_2_in_name = utils::new_c_string("y2")?;
21813
21814 let y_3_in: f64 = sharpen_options.y_3;
21815 let y_3_in_name = utils::new_c_string("y3")?;
21816
21817 let m_1_in: f64 = sharpen_options.m_1;
21818 let m_1_in_name = utils::new_c_string("m1")?;
21819
21820 let m_2_in: f64 = sharpen_options.m_2;
21821 let m_2_in_name = utils::new_c_string("m2")?;
21822
21823 let vips_op_response = bindings::vips_sharpen(
21824 inp_in,
21825 &mut out_out,
21826 sigma_in_name.as_ptr(),
21827 sigma_in,
21828 x_1_in_name.as_ptr(),
21829 x_1_in,
21830 y_2_in_name.as_ptr(),
21831 y_2_in,
21832 y_3_in_name.as_ptr(),
21833 y_3_in,
21834 m_1_in_name.as_ptr(),
21835 m_1_in,
21836 m_2_in_name.as_ptr(),
21837 m_2_in,
21838 NULL,
21839 );
21840 utils::result(
21841 vips_op_response,
21842 VipsImage { ctx: out_out },
21843 Error::SharpenError,
21844 )
21845 }
21846}
21847
21848pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
21854 unsafe {
21855 let inp_in: *mut bindings::VipsImage = inp.ctx;
21856 let sigma_in: f64 = sigma;
21857 let mut out_out: *mut bindings::VipsImage = null_mut();
21858
21859 let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
21860 utils::result(
21861 vips_op_response,
21862 VipsImage { ctx: out_out },
21863 Error::GaussblurError,
21864 )
21865 }
21866}
21867
21868#[derive(Clone, Debug)]
21870pub struct GaussblurOptions {
21871 pub min_ampl: f64,
21874 pub precision: Precision,
21880}
21881
21882impl std::default::Default for GaussblurOptions {
21883 fn default() -> Self {
21884 GaussblurOptions {
21885 min_ampl: f64::from(0.2),
21886 precision: Precision::Integer,
21887 }
21888 }
21889}
21890
21891pub fn gaussblur_with_opts(
21898 inp: &VipsImage,
21899 sigma: f64,
21900 gaussblur_options: &GaussblurOptions,
21901) -> Result<VipsImage> {
21902 unsafe {
21903 let inp_in: *mut bindings::VipsImage = inp.ctx;
21904 let sigma_in: f64 = sigma;
21905 let mut out_out: *mut bindings::VipsImage = null_mut();
21906
21907 let min_ampl_in: f64 = gaussblur_options.min_ampl;
21908 let min_ampl_in_name = utils::new_c_string("min-ampl")?;
21909
21910 let precision_in: i32 = gaussblur_options.precision as i32;
21911 let precision_in_name = utils::new_c_string("precision")?;
21912
21913 let vips_op_response = bindings::vips_gaussblur(
21914 inp_in,
21915 &mut out_out,
21916 sigma_in,
21917 min_ampl_in_name.as_ptr(),
21918 min_ampl_in,
21919 precision_in_name.as_ptr(),
21920 precision_in,
21921 NULL,
21922 );
21923 utils::result(
21924 vips_op_response,
21925 VipsImage { ctx: out_out },
21926 Error::GaussblurError,
21927 )
21928 }
21929}
21930
21931pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
21935 unsafe {
21936 let inp_in: *mut bindings::VipsImage = inp.ctx;
21937 let mut out_out: *mut bindings::VipsImage = null_mut();
21938
21939 let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
21940 utils::result(
21941 vips_op_response,
21942 VipsImage { ctx: out_out },
21943 Error::SobelError,
21944 )
21945 }
21946}
21947
21948pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
21952 unsafe {
21953 let inp_in: *mut bindings::VipsImage = inp.ctx;
21954 let mut out_out: *mut bindings::VipsImage = null_mut();
21955
21956 let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
21957 utils::result(
21958 vips_op_response,
21959 VipsImage { ctx: out_out },
21960 Error::ScharrError,
21961 )
21962 }
21963}
21964
21965pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
21969 unsafe {
21970 let inp_in: *mut bindings::VipsImage = inp.ctx;
21971 let mut out_out: *mut bindings::VipsImage = null_mut();
21972
21973 let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
21974 utils::result(
21975 vips_op_response,
21976 VipsImage { ctx: out_out },
21977 Error::PrewittError,
21978 )
21979 }
21980}
21981
21982pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
21986 unsafe {
21987 let inp_in: *mut bindings::VipsImage = inp.ctx;
21988 let mut out_out: *mut bindings::VipsImage = null_mut();
21989
21990 let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
21991 utils::result(
21992 vips_op_response,
21993 VipsImage { ctx: out_out },
21994 Error::CannyError,
21995 )
21996 }
21997}
21998
21999#[derive(Clone, Debug)]
22001pub struct CannyOptions {
22002 pub sigma: f64,
22005 pub precision: Precision,
22011}
22012
22013impl std::default::Default for CannyOptions {
22014 fn default() -> Self {
22015 CannyOptions {
22016 sigma: f64::from(1.4),
22017 precision: Precision::Float,
22018 }
22019 }
22020}
22021
22022pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
22027 unsafe {
22028 let inp_in: *mut bindings::VipsImage = inp.ctx;
22029 let mut out_out: *mut bindings::VipsImage = null_mut();
22030
22031 let sigma_in: f64 = canny_options.sigma;
22032 let sigma_in_name = utils::new_c_string("sigma")?;
22033
22034 let precision_in: i32 = canny_options.precision as i32;
22035 let precision_in_name = utils::new_c_string("precision")?;
22036
22037 let vips_op_response = bindings::vips_canny(
22038 inp_in,
22039 &mut out_out,
22040 sigma_in_name.as_ptr(),
22041 sigma_in,
22042 precision_in_name.as_ptr(),
22043 precision_in,
22044 NULL,
22045 );
22046 utils::result(
22047 vips_op_response,
22048 VipsImage { ctx: out_out },
22049 Error::CannyError,
22050 )
22051 }
22052}
22053
22054pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
22058 unsafe {
22059 let inp_in: *mut bindings::VipsImage = inp.ctx;
22060 let mut out_out: *mut bindings::VipsImage = null_mut();
22061
22062 let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
22063 utils::result(
22064 vips_op_response,
22065 VipsImage { ctx: out_out },
22066 Error::FwfftError,
22067 )
22068 }
22069}
22070
22071pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
22075 unsafe {
22076 let inp_in: *mut bindings::VipsImage = inp.ctx;
22077 let mut out_out: *mut bindings::VipsImage = null_mut();
22078
22079 let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
22080 utils::result(
22081 vips_op_response,
22082 VipsImage { ctx: out_out },
22083 Error::InvfftError,
22084 )
22085 }
22086}
22087
22088#[derive(Clone, Debug)]
22090pub struct InvfftOptions {
22091 pub real: bool,
22094}
22095
22096impl std::default::Default for InvfftOptions {
22097 fn default() -> Self {
22098 InvfftOptions { real: false }
22099 }
22100}
22101
22102pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
22107 unsafe {
22108 let inp_in: *mut bindings::VipsImage = inp.ctx;
22109 let mut out_out: *mut bindings::VipsImage = null_mut();
22110
22111 let real_in: i32 = if invfft_options.real { 1 } else { 0 };
22112 let real_in_name = utils::new_c_string("real")?;
22113
22114 let vips_op_response =
22115 bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
22116 utils::result(
22117 vips_op_response,
22118 VipsImage { ctx: out_out },
22119 Error::InvfftError,
22120 )
22121 }
22122}
22123
22124pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
22129 unsafe {
22130 let inp_in: *mut bindings::VipsImage = inp.ctx;
22131 let mask_in: *mut bindings::VipsImage = mask.ctx;
22132 let mut out_out: *mut bindings::VipsImage = null_mut();
22133
22134 let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
22135 utils::result(
22136 vips_op_response,
22137 VipsImage { ctx: out_out },
22138 Error::FreqmultError,
22139 )
22140 }
22141}
22142
22143pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
22147 unsafe {
22148 let inp_in: *mut bindings::VipsImage = inp.ctx;
22149 let mut out_out: *mut bindings::VipsImage = null_mut();
22150
22151 let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
22152 utils::result(
22153 vips_op_response,
22154 VipsImage { ctx: out_out },
22155 Error::SpectrumError,
22156 )
22157 }
22158}
22159
22160pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
22165 unsafe {
22166 let inp_in: *mut bindings::VipsImage = inp.ctx;
22167 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
22168 let mut out_out: *mut bindings::VipsImage = null_mut();
22169
22170 let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
22171 utils::result(
22172 vips_op_response,
22173 VipsImage { ctx: out_out },
22174 Error::PhasecorError,
22175 )
22176 }
22177}
22178
22179pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
22188 unsafe {
22189 let inp_in: *mut bindings::VipsImage = inp.ctx;
22190 let mask_in: *mut bindings::VipsImage = mask.ctx;
22191 let morph_in: i32 = morph as i32;
22192 let mut out_out: *mut bindings::VipsImage = null_mut();
22193
22194 let vips_op_response = bindings::vips_morph(
22195 inp_in,
22196 &mut out_out,
22197 mask_in,
22198 morph_in.try_into().unwrap(),
22199 NULL,
22200 );
22201 utils::result(
22202 vips_op_response,
22203 VipsImage { ctx: out_out },
22204 Error::MorphError,
22205 )
22206 }
22207}
22208
22209pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
22219 unsafe {
22220 let inp_in: *mut bindings::VipsImage = inp.ctx;
22221 let width_in: i32 = width;
22222 let height_in: i32 = height;
22223 let index_in: i32 = index;
22224 let mut out_out: *mut bindings::VipsImage = null_mut();
22225
22226 let vips_op_response =
22227 bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
22228 utils::result(
22229 vips_op_response,
22230 VipsImage { ctx: out_out },
22231 Error::RankError,
22232 )
22233 }
22234}
22235
22236pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
22244 unsafe {
22245 let inp_in: *mut bindings::VipsImage = inp.ctx;
22246 let direction_in: i32 = direction as i32;
22247 let mut nolines_out: f64 = f64::from(0);
22248
22249 let vips_op_response = bindings::vips_countlines(
22250 inp_in,
22251 &mut nolines_out,
22252 direction_in.try_into().unwrap(),
22253 NULL,
22254 );
22255 utils::result(vips_op_response, nolines_out, Error::CountlineError)
22256 }
22257}
22258
22259pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
22263 unsafe {
22264 let inp_in: *mut bindings::VipsImage = inp.ctx;
22265 let mut mask_out: *mut bindings::VipsImage = null_mut();
22266
22267 let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
22268 utils::result(
22269 vips_op_response,
22270 VipsImage { ctx: mask_out },
22271 Error::LabelregionError,
22272 )
22273 }
22274}
22275
22276#[derive(Clone, Debug)]
22278pub struct LabelregionOptions {
22279 pub segments: i32,
22282}
22283
22284impl std::default::Default for LabelregionOptions {
22285 fn default() -> Self {
22286 LabelregionOptions {
22287 segments: i32::from(0),
22288 }
22289 }
22290}
22291
22292pub fn labelregions_with_opts(
22297 inp: &VipsImage,
22298 labelregions_options: &LabelregionOptions,
22299) -> Result<VipsImage> {
22300 unsafe {
22301 let inp_in: *mut bindings::VipsImage = inp.ctx;
22302 let mut mask_out: *mut bindings::VipsImage = null_mut();
22303
22304 let segments_in: i32 = labelregions_options.segments;
22305 let segments_in_name = utils::new_c_string("segments")?;
22306
22307 let vips_op_response = bindings::vips_labelregions(
22308 inp_in,
22309 &mut mask_out,
22310 segments_in_name.as_ptr(),
22311 segments_in,
22312 NULL,
22313 );
22314 utils::result(
22315 vips_op_response,
22316 VipsImage { ctx: mask_out },
22317 Error::LabelregionError,
22318 )
22319 }
22320}
22321
22322pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
22326 unsafe {
22327 let inp_in: *mut bindings::VipsImage = inp.ctx;
22328 let mut out_out: *mut bindings::VipsImage = null_mut();
22329
22330 let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
22331 utils::result(
22332 vips_op_response,
22333 VipsImage { ctx: out_out },
22334 Error::FillNearestError,
22335 )
22336 }
22337}
22338
22339#[derive(Clone, Debug)]
22341pub struct FillNearestOptions {
22342 pub distance: VipsImage,
22344}
22345
22346impl std::default::Default for FillNearestOptions {
22347 fn default() -> Self {
22348 FillNearestOptions {
22349 distance: VipsImage::new(),
22350 }
22351 }
22352}
22353
22354pub fn fill_nearest_with_opts(
22359 inp: &VipsImage,
22360 fill_nearest_options: &FillNearestOptions,
22361) -> Result<VipsImage> {
22362 unsafe {
22363 let inp_in: *mut bindings::VipsImage = inp.ctx;
22364 let mut out_out: *mut bindings::VipsImage = null_mut();
22365
22366 let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
22367 let distance_in_name = utils::new_c_string("distance")?;
22368
22369 let vips_op_response = bindings::vips_fill_nearest(
22370 inp_in,
22371 &mut out_out,
22372 distance_in_name.as_ptr(),
22373 distance_in,
22374 NULL,
22375 );
22376 utils::result(
22377 vips_op_response,
22378 VipsImage { ctx: out_out },
22379 Error::FillNearestError,
22380 )
22381 }
22382}
22383
22384pub fn draw_rect(
22397 image: &VipsImage,
22398 ink: &mut [f64],
22399 left: i32,
22400 top: i32,
22401 width: i32,
22402 height: i32,
22403) -> Result<()> {
22404 unsafe {
22405 let image_in: *mut bindings::VipsImage = image.ctx;
22406 let ink_in: *mut f64 = ink.as_mut_ptr();
22407 let left_in: i32 = left;
22408 let top_in: i32 = top;
22409 let width_in: i32 = width;
22410 let height_in: i32 = height;
22411
22412 let vips_op_response = bindings::vips_draw_rect(
22413 image_in,
22414 ink_in,
22415 ink.len() as i32,
22416 left_in,
22417 top_in,
22418 width_in,
22419 height_in,
22420 NULL,
22421 );
22422 utils::result(vips_op_response, (), Error::DrawRectError)
22423 }
22424}
22425
22426#[derive(Clone, Debug)]
22428pub struct DrawRectOptions {
22429 pub fill: bool,
22432}
22433
22434impl std::default::Default for DrawRectOptions {
22435 fn default() -> Self {
22436 DrawRectOptions { fill: false }
22437 }
22438}
22439
22440pub fn draw_rect_with_opts(
22454 image: &VipsImage,
22455 ink: &mut [f64],
22456 left: i32,
22457 top: i32,
22458 width: i32,
22459 height: i32,
22460 draw_rect_options: &DrawRectOptions,
22461) -> Result<()> {
22462 unsafe {
22463 let image_in: *mut bindings::VipsImage = image.ctx;
22464 let ink_in: *mut f64 = ink.as_mut_ptr();
22465 let left_in: i32 = left;
22466 let top_in: i32 = top;
22467 let width_in: i32 = width;
22468 let height_in: i32 = height;
22469
22470 let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
22471 let fill_in_name = utils::new_c_string("fill")?;
22472
22473 let vips_op_response = bindings::vips_draw_rect(
22474 image_in,
22475 ink_in,
22476 ink.len() as i32,
22477 left_in,
22478 top_in,
22479 width_in,
22480 height_in,
22481 fill_in_name.as_ptr(),
22482 fill_in,
22483 NULL,
22484 );
22485 utils::result(vips_op_response, (), Error::DrawRectError)
22486 }
22487}
22488
22489pub fn draw_mask(
22499 image: &VipsImage,
22500 ink: &mut [f64],
22501 mask: &VipsImage,
22502 x: i32,
22503 y: i32,
22504) -> Result<()> {
22505 unsafe {
22506 let image_in: *mut bindings::VipsImage = image.ctx;
22507 let ink_in: *mut f64 = ink.as_mut_ptr();
22508 let mask_in: *mut bindings::VipsImage = mask.ctx;
22509 let x_in: i32 = x;
22510 let y_in: i32 = y;
22511
22512 let vips_op_response = bindings::vips_draw_mask(
22513 image_in,
22514 ink_in,
22515 ink.len() as i32,
22516 mask_in,
22517 x_in,
22518 y_in,
22519 NULL,
22520 );
22521 utils::result(vips_op_response, (), Error::DrawMaskError)
22522 }
22523}
22524
22525pub fn draw_line(
22538 image: &VipsImage,
22539 ink: &mut [f64],
22540 x_1: i32,
22541 y_1: i32,
22542 x_2: i32,
22543 y_2: i32,
22544) -> Result<()> {
22545 unsafe {
22546 let image_in: *mut bindings::VipsImage = image.ctx;
22547 let ink_in: *mut f64 = ink.as_mut_ptr();
22548 let x_1_in: i32 = x_1;
22549 let y_1_in: i32 = y_1;
22550 let x_2_in: i32 = x_2;
22551 let y_2_in: i32 = y_2;
22552
22553 let vips_op_response = bindings::vips_draw_line(
22554 image_in,
22555 ink_in,
22556 ink.len() as i32,
22557 x_1_in,
22558 y_1_in,
22559 x_2_in,
22560 y_2_in,
22561 NULL,
22562 );
22563 utils::result(vips_op_response, (), Error::DrawLineError)
22564 }
22565}
22566
22567pub fn draw_circle(
22578 image: &VipsImage,
22579 ink: &mut [f64],
22580 cx: i32,
22581 cy: i32,
22582 radius: i32,
22583) -> Result<()> {
22584 unsafe {
22585 let image_in: *mut bindings::VipsImage = image.ctx;
22586 let ink_in: *mut f64 = ink.as_mut_ptr();
22587 let cx_in: i32 = cx;
22588 let cy_in: i32 = cy;
22589 let radius_in: i32 = radius;
22590
22591 let vips_op_response = bindings::vips_draw_circle(
22592 image_in,
22593 ink_in,
22594 ink.len() as i32,
22595 cx_in,
22596 cy_in,
22597 radius_in,
22598 NULL,
22599 );
22600 utils::result(vips_op_response, (), Error::DrawCircleError)
22601 }
22602}
22603
22604#[derive(Clone, Debug)]
22606pub struct DrawCircleOptions {
22607 pub fill: bool,
22610}
22611
22612impl std::default::Default for DrawCircleOptions {
22613 fn default() -> Self {
22614 DrawCircleOptions { fill: false }
22615 }
22616}
22617
22618pub fn draw_circle_with_opts(
22630 image: &VipsImage,
22631 ink: &mut [f64],
22632 cx: i32,
22633 cy: i32,
22634 radius: i32,
22635 draw_circle_options: &DrawCircleOptions,
22636) -> Result<()> {
22637 unsafe {
22638 let image_in: *mut bindings::VipsImage = image.ctx;
22639 let ink_in: *mut f64 = ink.as_mut_ptr();
22640 let cx_in: i32 = cx;
22641 let cy_in: i32 = cy;
22642 let radius_in: i32 = radius;
22643
22644 let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
22645 let fill_in_name = utils::new_c_string("fill")?;
22646
22647 let vips_op_response = bindings::vips_draw_circle(
22648 image_in,
22649 ink_in,
22650 ink.len() as i32,
22651 cx_in,
22652 cy_in,
22653 radius_in,
22654 fill_in_name.as_ptr(),
22655 fill_in,
22656 NULL,
22657 );
22658 utils::result(vips_op_response, (), Error::DrawCircleError)
22659 }
22660}
22661
22662pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
22671 unsafe {
22672 let image_in: *mut bindings::VipsImage = image.ctx;
22673 let ink_in: *mut f64 = ink.as_mut_ptr();
22674 let x_in: i32 = x;
22675 let y_in: i32 = y;
22676
22677 let vips_op_response =
22678 bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
22679 utils::result(vips_op_response, (), Error::DrawFloodError)
22680 }
22681}
22682
22683#[derive(Clone, Debug)]
22685pub struct DrawFloodOptions {
22686 pub test: VipsImage,
22688 pub equal: bool,
22691 pub left: i32,
22694 pub top: i32,
22697 pub width: i32,
22700 pub height: i32,
22703}
22704
22705impl std::default::Default for DrawFloodOptions {
22706 fn default() -> Self {
22707 DrawFloodOptions {
22708 test: VipsImage::new(),
22709 equal: false,
22710 left: i32::from(0),
22711 top: i32::from(0),
22712 width: i32::from(0),
22713 height: i32::from(0),
22714 }
22715 }
22716}
22717
22718pub fn draw_flood_with_opts(
22728 image: &VipsImage,
22729 ink: &mut [f64],
22730 x: i32,
22731 y: i32,
22732 draw_flood_options: &DrawFloodOptions,
22733) -> Result<()> {
22734 unsafe {
22735 let image_in: *mut bindings::VipsImage = image.ctx;
22736 let ink_in: *mut f64 = ink.as_mut_ptr();
22737 let x_in: i32 = x;
22738 let y_in: i32 = y;
22739
22740 let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
22741 let test_in_name = utils::new_c_string("test")?;
22742
22743 let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
22744 let equal_in_name = utils::new_c_string("equal")?;
22745
22746 let left_in: i32 = draw_flood_options.left;
22747 let left_in_name = utils::new_c_string("left")?;
22748
22749 let top_in: i32 = draw_flood_options.top;
22750 let top_in_name = utils::new_c_string("top")?;
22751
22752 let width_in: i32 = draw_flood_options.width;
22753 let width_in_name = utils::new_c_string("width")?;
22754
22755 let height_in: i32 = draw_flood_options.height;
22756 let height_in_name = utils::new_c_string("height")?;
22757
22758 let vips_op_response = bindings::vips_draw_flood(
22759 image_in,
22760 ink_in,
22761 ink.len() as i32,
22762 x_in,
22763 y_in,
22764 test_in_name.as_ptr(),
22765 test_in,
22766 equal_in_name.as_ptr(),
22767 equal_in,
22768 left_in_name.as_ptr(),
22769 left_in,
22770 top_in_name.as_ptr(),
22771 top_in,
22772 width_in_name.as_ptr(),
22773 width_in,
22774 height_in_name.as_ptr(),
22775 height_in,
22776 NULL,
22777 );
22778 utils::result(vips_op_response, (), Error::DrawFloodError)
22779 }
22780}
22781
22782pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
22791 unsafe {
22792 let image_in: *mut bindings::VipsImage = image.ctx;
22793 let sub_in: *mut bindings::VipsImage = sub.ctx;
22794 let x_in: i32 = x;
22795 let y_in: i32 = y;
22796
22797 let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
22798 utils::result(vips_op_response, (), Error::DrawImageError)
22799 }
22800}
22801
22802#[derive(Clone, Debug)]
22804pub struct DrawImageOptions {
22805 pub mode: CombineMode,
22810}
22811
22812impl std::default::Default for DrawImageOptions {
22813 fn default() -> Self {
22814 DrawImageOptions {
22815 mode: CombineMode::Set,
22816 }
22817 }
22818}
22819
22820pub fn draw_image_with_opts(
22830 image: &VipsImage,
22831 sub: &VipsImage,
22832 x: i32,
22833 y: i32,
22834 draw_image_options: &DrawImageOptions,
22835) -> Result<()> {
22836 unsafe {
22837 let image_in: *mut bindings::VipsImage = image.ctx;
22838 let sub_in: *mut bindings::VipsImage = sub.ctx;
22839 let x_in: i32 = x;
22840 let y_in: i32 = y;
22841
22842 let mode_in: i32 = draw_image_options.mode as i32;
22843 let mode_in_name = utils::new_c_string("mode")?;
22844
22845 let vips_op_response = bindings::vips_draw_image(
22846 image_in,
22847 sub_in,
22848 x_in,
22849 y_in,
22850 mode_in_name.as_ptr(),
22851 mode_in,
22852 NULL,
22853 );
22854 utils::result(vips_op_response, (), Error::DrawImageError)
22855 }
22856}
22857
22858pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
22870 unsafe {
22871 let image_in: *mut bindings::VipsImage = image.ctx;
22872 let left_in: i32 = left;
22873 let top_in: i32 = top;
22874 let width_in: i32 = width;
22875 let height_in: i32 = height;
22876
22877 let vips_op_response =
22878 bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
22879 utils::result(vips_op_response, (), Error::DrawSmudgeError)
22880 }
22881}
22882
22883pub fn merge(
22896 refp: &VipsImage,
22897 sec: &VipsImage,
22898 direction: Direction,
22899 dx: i32,
22900 dy: i32,
22901) -> Result<VipsImage> {
22902 unsafe {
22903 let refp_in: *mut bindings::VipsImage = refp.ctx;
22904 let sec_in: *mut bindings::VipsImage = sec.ctx;
22905 let direction_in: i32 = direction as i32;
22906 let dx_in: i32 = dx;
22907 let dy_in: i32 = dy;
22908 let mut out_out: *mut bindings::VipsImage = null_mut();
22909
22910 let vips_op_response = bindings::vips_merge(
22911 refp_in,
22912 sec_in,
22913 &mut out_out,
22914 direction_in.try_into().unwrap(),
22915 dx_in,
22916 dy_in,
22917 NULL,
22918 );
22919 utils::result(
22920 vips_op_response,
22921 VipsImage { ctx: out_out },
22922 Error::MergeError,
22923 )
22924 }
22925}
22926
22927#[derive(Clone, Debug)]
22929pub struct MergeOptions {
22930 pub mblend: i32,
22933}
22934
22935impl std::default::Default for MergeOptions {
22936 fn default() -> Self {
22937 MergeOptions {
22938 mblend: i32::from(10),
22939 }
22940 }
22941}
22942
22943pub fn merge_with_opts(
22957 refp: &VipsImage,
22958 sec: &VipsImage,
22959 direction: Direction,
22960 dx: i32,
22961 dy: i32,
22962 merge_options: &MergeOptions,
22963) -> Result<VipsImage> {
22964 unsafe {
22965 let refp_in: *mut bindings::VipsImage = refp.ctx;
22966 let sec_in: *mut bindings::VipsImage = sec.ctx;
22967 let direction_in: i32 = direction as i32;
22968 let dx_in: i32 = dx;
22969 let dy_in: i32 = dy;
22970 let mut out_out: *mut bindings::VipsImage = null_mut();
22971
22972 let mblend_in: i32 = merge_options.mblend;
22973 let mblend_in_name = utils::new_c_string("mblend")?;
22974
22975 let vips_op_response = bindings::vips_merge(
22976 refp_in,
22977 sec_in,
22978 &mut out_out,
22979 direction_in.try_into().unwrap(),
22980 dx_in,
22981 dy_in,
22982 mblend_in_name.as_ptr(),
22983 mblend_in,
22984 NULL,
22985 );
22986 utils::result(
22987 vips_op_response,
22988 VipsImage { ctx: out_out },
22989 Error::MergeError,
22990 )
22991 }
22992}
22993
22994pub fn mosaic(
23011 refp: &VipsImage,
23012 sec: &VipsImage,
23013 direction: Direction,
23014 xref: i32,
23015 yref: i32,
23016 xsec: i32,
23017 ysec: i32,
23018) -> Result<VipsImage> {
23019 unsafe {
23020 let refp_in: *mut bindings::VipsImage = refp.ctx;
23021 let sec_in: *mut bindings::VipsImage = sec.ctx;
23022 let direction_in: i32 = direction as i32;
23023 let xref_in: i32 = xref;
23024 let yref_in: i32 = yref;
23025 let xsec_in: i32 = xsec;
23026 let ysec_in: i32 = ysec;
23027 let mut out_out: *mut bindings::VipsImage = null_mut();
23028
23029 let vips_op_response = bindings::vips_mosaic(
23030 refp_in,
23031 sec_in,
23032 &mut out_out,
23033 direction_in.try_into().unwrap(),
23034 xref_in,
23035 yref_in,
23036 xsec_in,
23037 ysec_in,
23038 NULL,
23039 );
23040 utils::result(
23041 vips_op_response,
23042 VipsImage { ctx: out_out },
23043 Error::MosaicError,
23044 )
23045 }
23046}
23047
23048#[derive(Clone, Debug)]
23050pub struct MosaicOptions {
23051 pub hwindow: i32,
23054 pub harea: i32,
23057 pub mblend: i32,
23060 pub bandno: i32,
23063 pub dx_0: i32,
23066 pub dy_0: i32,
23069 pub scale_1: f64,
23072 pub angle_1: f64,
23075 pub dy_1: f64,
23078 pub dx_1: f64,
23081}
23082
23083impl std::default::Default for MosaicOptions {
23084 fn default() -> Self {
23085 MosaicOptions {
23086 hwindow: i32::from(5),
23087 harea: i32::from(15),
23088 mblend: i32::from(10),
23089 bandno: i32::from(0),
23090 dx_0: i32::from(0),
23091 dy_0: i32::from(0),
23092 scale_1: f64::from(1),
23093 angle_1: f64::from(0),
23094 dy_1: f64::from(0),
23095 dx_1: f64::from(0),
23096 }
23097 }
23098}
23099
23100pub fn mosaic_with_opts(
23118 refp: &VipsImage,
23119 sec: &VipsImage,
23120 direction: Direction,
23121 xref: i32,
23122 yref: i32,
23123 xsec: i32,
23124 ysec: i32,
23125 mosaic_options: &MosaicOptions,
23126) -> Result<VipsImage> {
23127 unsafe {
23128 let refp_in: *mut bindings::VipsImage = refp.ctx;
23129 let sec_in: *mut bindings::VipsImage = sec.ctx;
23130 let direction_in: i32 = direction as i32;
23131 let xref_in: i32 = xref;
23132 let yref_in: i32 = yref;
23133 let xsec_in: i32 = xsec;
23134 let ysec_in: i32 = ysec;
23135 let mut out_out: *mut bindings::VipsImage = null_mut();
23136
23137 let hwindow_in: i32 = mosaic_options.hwindow;
23138 let hwindow_in_name = utils::new_c_string("hwindow")?;
23139
23140 let harea_in: i32 = mosaic_options.harea;
23141 let harea_in_name = utils::new_c_string("harea")?;
23142
23143 let mblend_in: i32 = mosaic_options.mblend;
23144 let mblend_in_name = utils::new_c_string("mblend")?;
23145
23146 let bandno_in: i32 = mosaic_options.bandno;
23147 let bandno_in_name = utils::new_c_string("bandno")?;
23148
23149 let dx_0_in: i32 = mosaic_options.dx_0;
23150 let dx_0_in_name = utils::new_c_string("dx0")?;
23151
23152 let dy_0_in: i32 = mosaic_options.dy_0;
23153 let dy_0_in_name = utils::new_c_string("dy0")?;
23154
23155 let scale_1_in: f64 = mosaic_options.scale_1;
23156 let scale_1_in_name = utils::new_c_string("scale1")?;
23157
23158 let angle_1_in: f64 = mosaic_options.angle_1;
23159 let angle_1_in_name = utils::new_c_string("angle1")?;
23160
23161 let dy_1_in: f64 = mosaic_options.dy_1;
23162 let dy_1_in_name = utils::new_c_string("dy1")?;
23163
23164 let dx_1_in: f64 = mosaic_options.dx_1;
23165 let dx_1_in_name = utils::new_c_string("dx1")?;
23166
23167 let vips_op_response = bindings::vips_mosaic(
23168 refp_in,
23169 sec_in,
23170 &mut out_out,
23171 direction_in.try_into().unwrap(),
23172 xref_in,
23173 yref_in,
23174 xsec_in,
23175 ysec_in,
23176 hwindow_in_name.as_ptr(),
23177 hwindow_in,
23178 harea_in_name.as_ptr(),
23179 harea_in,
23180 mblend_in_name.as_ptr(),
23181 mblend_in,
23182 bandno_in_name.as_ptr(),
23183 bandno_in,
23184 dx_0_in_name.as_ptr(),
23185 dx_0_in,
23186 dy_0_in_name.as_ptr(),
23187 dy_0_in,
23188 scale_1_in_name.as_ptr(),
23189 scale_1_in,
23190 angle_1_in_name.as_ptr(),
23191 angle_1_in,
23192 dy_1_in_name.as_ptr(),
23193 dy_1_in,
23194 dx_1_in_name.as_ptr(),
23195 dx_1_in,
23196 NULL,
23197 );
23198 utils::result(
23199 vips_op_response,
23200 VipsImage { ctx: out_out },
23201 Error::MosaicError,
23202 )
23203 }
23204}
23205
23206pub fn mosaic_1(
23231 refp: &VipsImage,
23232 sec: &VipsImage,
23233 direction: Direction,
23234 xr_1: i32,
23235 yr_1: i32,
23236 xs_1: i32,
23237 ys_1: i32,
23238 xr_2: i32,
23239 yr_2: i32,
23240 xs_2: i32,
23241 ys_2: i32,
23242) -> Result<VipsImage> {
23243 unsafe {
23244 let refp_in: *mut bindings::VipsImage = refp.ctx;
23245 let sec_in: *mut bindings::VipsImage = sec.ctx;
23246 let direction_in: i32 = direction as i32;
23247 let xr_1_in: i32 = xr_1;
23248 let yr_1_in: i32 = yr_1;
23249 let xs_1_in: i32 = xs_1;
23250 let ys_1_in: i32 = ys_1;
23251 let xr_2_in: i32 = xr_2;
23252 let yr_2_in: i32 = yr_2;
23253 let xs_2_in: i32 = xs_2;
23254 let ys_2_in: i32 = ys_2;
23255 let mut out_out: *mut bindings::VipsImage = null_mut();
23256
23257 let vips_op_response = bindings::vips_mosaic1(
23258 refp_in,
23259 sec_in,
23260 &mut out_out,
23261 direction_in.try_into().unwrap(),
23262 xr_1_in,
23263 yr_1_in,
23264 xs_1_in,
23265 ys_1_in,
23266 xr_2_in,
23267 yr_2_in,
23268 xs_2_in,
23269 ys_2_in,
23270 NULL,
23271 );
23272 utils::result(
23273 vips_op_response,
23274 VipsImage { ctx: out_out },
23275 Error::Mosaic1Error,
23276 )
23277 }
23278}
23279
23280#[derive(Clone, Debug)]
23282pub struct Mosaic1Options {
23283 pub hwindow: i32,
23286 pub harea: i32,
23289 pub search: bool,
23292 pub interpolate: VipsInterpolate,
23294 pub mblend: i32,
23297}
23298
23299impl std::default::Default for Mosaic1Options {
23300 fn default() -> Self {
23301 Mosaic1Options {
23302 hwindow: i32::from(5),
23303 harea: i32::from(15),
23304 search: false,
23305 interpolate: VipsInterpolate::new(),
23306 mblend: i32::from(10),
23307 }
23308 }
23309}
23310
23311pub fn mosaic_1_with_opts(
23337 refp: &VipsImage,
23338 sec: &VipsImage,
23339 direction: Direction,
23340 xr_1: i32,
23341 yr_1: i32,
23342 xs_1: i32,
23343 ys_1: i32,
23344 xr_2: i32,
23345 yr_2: i32,
23346 xs_2: i32,
23347 ys_2: i32,
23348 mosaic_1_options: &Mosaic1Options,
23349) -> Result<VipsImage> {
23350 unsafe {
23351 let refp_in: *mut bindings::VipsImage = refp.ctx;
23352 let sec_in: *mut bindings::VipsImage = sec.ctx;
23353 let direction_in: i32 = direction as i32;
23354 let xr_1_in: i32 = xr_1;
23355 let yr_1_in: i32 = yr_1;
23356 let xs_1_in: i32 = xs_1;
23357 let ys_1_in: i32 = ys_1;
23358 let xr_2_in: i32 = xr_2;
23359 let yr_2_in: i32 = yr_2;
23360 let xs_2_in: i32 = xs_2;
23361 let ys_2_in: i32 = ys_2;
23362 let mut out_out: *mut bindings::VipsImage = null_mut();
23363
23364 let hwindow_in: i32 = mosaic_1_options.hwindow;
23365 let hwindow_in_name = utils::new_c_string("hwindow")?;
23366
23367 let harea_in: i32 = mosaic_1_options.harea;
23368 let harea_in_name = utils::new_c_string("harea")?;
23369
23370 let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
23371 let search_in_name = utils::new_c_string("search")?;
23372
23373 let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
23374 let interpolate_in_name = utils::new_c_string("interpolate")?;
23375
23376 let mblend_in: i32 = mosaic_1_options.mblend;
23377 let mblend_in_name = utils::new_c_string("mblend")?;
23378
23379 let vips_op_response = bindings::vips_mosaic1(
23380 refp_in,
23381 sec_in,
23382 &mut out_out,
23383 direction_in.try_into().unwrap(),
23384 xr_1_in,
23385 yr_1_in,
23386 xs_1_in,
23387 ys_1_in,
23388 xr_2_in,
23389 yr_2_in,
23390 xs_2_in,
23391 ys_2_in,
23392 hwindow_in_name.as_ptr(),
23393 hwindow_in,
23394 harea_in_name.as_ptr(),
23395 harea_in,
23396 search_in_name.as_ptr(),
23397 search_in,
23398 interpolate_in_name.as_ptr(),
23399 interpolate_in,
23400 mblend_in_name.as_ptr(),
23401 mblend_in,
23402 NULL,
23403 );
23404 utils::result(
23405 vips_op_response,
23406 VipsImage { ctx: out_out },
23407 Error::Mosaic1Error,
23408 )
23409 }
23410}
23411
23412pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
23416 unsafe {
23417 let inp_in: *mut bindings::VipsImage = inp.ctx;
23418 let mut out_out: *mut bindings::VipsImage = null_mut();
23419
23420 let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
23421 utils::result(
23422 vips_op_response,
23423 VipsImage { ctx: out_out },
23424 Error::MatrixinvertError,
23425 )
23426 }
23427}
23428
23429pub fn matches(
23450 refp: &VipsImage,
23451 sec: &VipsImage,
23452 xr_1: i32,
23453 yr_1: i32,
23454 xs_1: i32,
23455 ys_1: i32,
23456 xr_2: i32,
23457 yr_2: i32,
23458 xs_2: i32,
23459 ys_2: i32,
23460) -> Result<VipsImage> {
23461 unsafe {
23462 let refp_in: *mut bindings::VipsImage = refp.ctx;
23463 let sec_in: *mut bindings::VipsImage = sec.ctx;
23464 let xr_1_in: i32 = xr_1;
23465 let yr_1_in: i32 = yr_1;
23466 let xs_1_in: i32 = xs_1;
23467 let ys_1_in: i32 = ys_1;
23468 let xr_2_in: i32 = xr_2;
23469 let yr_2_in: i32 = yr_2;
23470 let xs_2_in: i32 = xs_2;
23471 let ys_2_in: i32 = ys_2;
23472 let mut out_out: *mut bindings::VipsImage = null_mut();
23473
23474 let vips_op_response = bindings::vips_match(
23475 refp_in,
23476 sec_in,
23477 &mut out_out,
23478 xr_1_in,
23479 yr_1_in,
23480 xs_1_in,
23481 ys_1_in,
23482 xr_2_in,
23483 yr_2_in,
23484 xs_2_in,
23485 ys_2_in,
23486 NULL,
23487 );
23488 utils::result(
23489 vips_op_response,
23490 VipsImage { ctx: out_out },
23491 Error::MatchError,
23492 )
23493 }
23494}
23495
23496#[derive(Clone, Debug)]
23498pub struct MatchOptions {
23499 pub hwindow: i32,
23502 pub harea: i32,
23505 pub search: bool,
23508 pub interpolate: VipsInterpolate,
23510}
23511
23512impl std::default::Default for MatchOptions {
23513 fn default() -> Self {
23514 MatchOptions {
23515 hwindow: i32::from(1),
23516 harea: i32::from(1),
23517 search: false,
23518 interpolate: VipsInterpolate::new(),
23519 }
23520 }
23521}
23522
23523pub fn matches_with_opts(
23545 refp: &VipsImage,
23546 sec: &VipsImage,
23547 xr_1: i32,
23548 yr_1: i32,
23549 xs_1: i32,
23550 ys_1: i32,
23551 xr_2: i32,
23552 yr_2: i32,
23553 xs_2: i32,
23554 ys_2: i32,
23555 matches_options: &MatchOptions,
23556) -> Result<VipsImage> {
23557 unsafe {
23558 let refp_in: *mut bindings::VipsImage = refp.ctx;
23559 let sec_in: *mut bindings::VipsImage = sec.ctx;
23560 let xr_1_in: i32 = xr_1;
23561 let yr_1_in: i32 = yr_1;
23562 let xs_1_in: i32 = xs_1;
23563 let ys_1_in: i32 = ys_1;
23564 let xr_2_in: i32 = xr_2;
23565 let yr_2_in: i32 = yr_2;
23566 let xs_2_in: i32 = xs_2;
23567 let ys_2_in: i32 = ys_2;
23568 let mut out_out: *mut bindings::VipsImage = null_mut();
23569
23570 let hwindow_in: i32 = matches_options.hwindow;
23571 let hwindow_in_name = utils::new_c_string("hwindow")?;
23572
23573 let harea_in: i32 = matches_options.harea;
23574 let harea_in_name = utils::new_c_string("harea")?;
23575
23576 let search_in: i32 = if matches_options.search { 1 } else { 0 };
23577 let search_in_name = utils::new_c_string("search")?;
23578
23579 let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
23580 let interpolate_in_name = utils::new_c_string("interpolate")?;
23581
23582 let vips_op_response = bindings::vips_match(
23583 refp_in,
23584 sec_in,
23585 &mut out_out,
23586 xr_1_in,
23587 yr_1_in,
23588 xs_1_in,
23589 ys_1_in,
23590 xr_2_in,
23591 yr_2_in,
23592 xs_2_in,
23593 ys_2_in,
23594 hwindow_in_name.as_ptr(),
23595 hwindow_in,
23596 harea_in_name.as_ptr(),
23597 harea_in,
23598 search_in_name.as_ptr(),
23599 search_in,
23600 interpolate_in_name.as_ptr(),
23601 interpolate_in,
23602 NULL,
23603 );
23604 utils::result(
23605 vips_op_response,
23606 VipsImage { ctx: out_out },
23607 Error::MatchError,
23608 )
23609 }
23610}
23611
23612pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
23616 unsafe {
23617 let inp_in: *mut bindings::VipsImage = inp.ctx;
23618 let mut out_out: *mut bindings::VipsImage = null_mut();
23619
23620 let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
23621 utils::result(
23622 vips_op_response,
23623 VipsImage { ctx: out_out },
23624 Error::GlobalbalanceError,
23625 )
23626 }
23627}
23628
23629#[derive(Clone, Debug)]
23631pub struct GlobalbalanceOptions {
23632 pub gamma: f64,
23635 pub int_output: bool,
23638}
23639
23640impl std::default::Default for GlobalbalanceOptions {
23641 fn default() -> Self {
23642 GlobalbalanceOptions {
23643 gamma: f64::from(1.6),
23644 int_output: false,
23645 }
23646 }
23647}
23648
23649pub fn globalbalance_with_opts(
23654 inp: &VipsImage,
23655 globalbalance_options: &GlobalbalanceOptions,
23656) -> Result<VipsImage> {
23657 unsafe {
23658 let inp_in: *mut bindings::VipsImage = inp.ctx;
23659 let mut out_out: *mut bindings::VipsImage = null_mut();
23660
23661 let gamma_in: f64 = globalbalance_options.gamma;
23662 let gamma_in_name = utils::new_c_string("gamma")?;
23663
23664 let int_output_in: i32 = if globalbalance_options.int_output {
23665 1
23666 } else {
23667 0
23668 };
23669 let int_output_in_name = utils::new_c_string("int-output")?;
23670
23671 let vips_op_response = bindings::vips_globalbalance(
23672 inp_in,
23673 &mut out_out,
23674 gamma_in_name.as_ptr(),
23675 gamma_in,
23676 int_output_in_name.as_ptr(),
23677 int_output_in,
23678 NULL,
23679 );
23680 utils::result(
23681 vips_op_response,
23682 VipsImage { ctx: out_out },
23683 Error::GlobalbalanceError,
23684 )
23685 }
23686}