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 ForeignDzContainer {
267 F = 0,
269 Zip = 1,
271 Szi = 2,
273 Last = 3,
275}
276
277#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
278pub enum ForeignDzDepth {
279 Onepixel = 0,
281 Onetile = 1,
283 One = 2,
285 Last = 3,
287}
288
289#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
290pub enum ForeignDzLayout {
291 Dz = 0,
293 Zoomify = 1,
295 Google = 2,
297 Iiif = 3,
299 Iiif3 = 4,
301 Last = 5,
303}
304
305#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
306pub enum ForeignFlags {
307 None = 0,
309 Partial = 1,
311 Bigendian = 2,
313 Sequential = 4,
315 All = 7,
317}
318
319#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
320pub enum ForeignHeifCompression {
321 Hevc = 1,
323 Avc = 2,
325 Jpeg = 3,
327 Av1 = 4,
329 Last = 5,
331}
332
333#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
334pub enum ForeignHeifEncoder {
335 Auto = 0,
337 Aom = 1,
339 Rav1E = 2,
341 Svt = 3,
343 X265 = 4,
345 Last = 5,
347}
348
349#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
350pub enum ForeignKeep {
351 None = 0,
353 Exif = 1,
355 Xmp = 2,
357 Iptc = 4,
359 Icc = 8,
361 Other = 16,
363 All = 31,
365}
366
367#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
368pub enum ForeignPngFilter {
369 None = 8,
371 Sub = 16,
373 Up = 32,
375 Avg = 64,
377 Paeth = 128,
379 All = 248,
381}
382
383#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
384pub enum ForeignPpmFormat {
385 Pbm = 0,
387 Pgm = 1,
389 Ppm = 2,
391 Pfm = 3,
393 Pnm = 4,
395 Last = 5,
397}
398
399#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
400pub enum ForeignSubsample {
401 Auto = 0,
403 On = 1,
405 Off = 2,
407 Last = 3,
409}
410
411#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
412pub enum ForeignTiffCompression {
413 None = 0,
415 Jpeg = 1,
417 Deflate = 2,
419 Packbit = 3,
421 Ccittfax4 = 4,
423 Lzw = 5,
425 Webp = 6,
427 Zstd = 7,
429 Jp2K = 8,
431 Last = 9,
433}
434
435#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
436pub enum ForeignTiffPredictor {
437 None = 1,
439 Horizontal = 2,
441 Float = 3,
443 Last = 4,
445}
446
447#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
448pub enum ForeignTiffResunit {
449 Cm = 0,
451 Inch = 1,
453 Last = 2,
455}
456
457#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
458pub enum ForeignWebpPreset {
459 Default = 0,
461 Picture = 1,
463 Photo = 2,
465 Drawing = 3,
467 Icon = 4,
469 Text = 5,
471 Last = 6,
473}
474
475#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
476pub enum Intent {
477 Perceptual = 0,
479 Relative = 1,
481 Saturation = 2,
483 Absolute = 3,
485 Last = 4,
487}
488
489#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
490pub enum Interesting {
491 None = 0,
493 Centre = 1,
495 Entropy = 2,
497 Attention = 3,
499 Low = 4,
501 High = 5,
503 All = 6,
505 Last = 7,
507}
508
509#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
510pub enum Interpretation {
511 Error = -1,
513 Multiband = 0,
515 BW = 1,
517 Histogram = 10,
519 Xyz = 12,
521 Lab = 13,
523 Cmyk = 15,
525 Labq = 16,
527 Rgb = 17,
529 Cmc = 18,
531 Lch = 19,
533 Labs = 21,
535 Srgb = 22,
537 Yxy = 23,
539 Fourier = 24,
541 Rgb16 = 25,
543 Grey16 = 26,
545 Matrix = 27,
547 Scrgb = 28,
549 Hsv = 29,
551 Last = 30,
553}
554
555#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
556pub enum Kernel {
557 Nearest = 0,
559 Linear = 1,
561 Cubic = 2,
563 Mitchell = 3,
565 Lanczos2 = 4,
567 Lanczos3 = 5,
569 Last = 6,
571}
572
573#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
574pub enum OperationBoolean {
575 And = 0,
577 Or = 1,
579 Eor = 2,
581 Lshift = 3,
583 Rshift = 4,
585 Last = 5,
587}
588
589#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
590pub enum OperationComplex {
591 Polar = 0,
593 Rect = 1,
595 Conj = 2,
597 Last = 3,
599}
600
601#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
602pub enum OperationComplex2 {
603 CrossPhase = 0,
605 Last = 1,
607}
608
609#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
610pub enum OperationComplexget {
611 Real = 0,
613 Imag = 1,
615 Last = 2,
617}
618
619#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
620pub enum OperationMath {
621 Sin = 0,
623 Co = 1,
625 Tan = 2,
627 Asin = 3,
629 Aco = 4,
631 Atan = 5,
633 Log = 6,
635 Log10 = 7,
637 Exp = 8,
639 Exp10 = 9,
641 Sinh = 10,
643 Cosh = 11,
645 Tanh = 12,
647 Asinh = 13,
649 Acosh = 14,
651 Atanh = 15,
653 Last = 16,
655}
656
657#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
658pub enum OperationMath2 {
659 Pow = 0,
661 Wop = 1,
663 Atan2 = 2,
665 Last = 3,
667}
668
669#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
670pub enum OperationMorphology {
671 Erode = 0,
673 Dilate = 1,
675 Last = 2,
677}
678
679#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
680pub enum OperationRelational {
681 Equal = 0,
683 Noteq = 1,
685 Less = 2,
687 Lesseq = 3,
689 More = 4,
691 Moreeq = 5,
693 Last = 6,
695}
696
697#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
698pub enum OperationRound {
699 Rint = 0,
701 Ceil = 1,
703 Floor = 2,
705 Last = 3,
707}
708
709#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
710pub enum PCS {
711 Lab = 0,
713 Xyz = 1,
715 Last = 2,
717}
718
719#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
720pub enum Precision {
721 Integer = 0,
723 Float = 1,
725 Approximate = 2,
727 Last = 3,
729}
730
731#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
732pub enum RegionShrink {
733 Mean = 0,
735 Median = 1,
737 Mode = 2,
739 Max = 3,
741 Min = 4,
743 Nearest = 5,
745 Last = 6,
747}
748
749#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
750pub enum Size {
751 Both = 0,
753 Up = 1,
755 Down = 2,
757 Force = 3,
759 Last = 4,
761}
762
763#[derive(Copy, Clone, Debug, FromPrimitive, ToPrimitive)]
764pub enum TextWrap {
765 Word = 0,
767 Char = 1,
769 WordChar = 2,
771 None = 3,
773 Last = 4,
775}
776
777pub fn system(cmd_format: &str) -> Result<()> {
781 unsafe {
782 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
783
784 let vips_op_response = bindings::vips_system(cmd_format_in.as_ptr(), NULL);
785 utils::result(vips_op_response, (), Error::SystemError)
786 }
787}
788
789#[derive(Clone, Debug)]
791pub struct SystemOptions {
792 pub inp: Vec<VipsImage>,
794 pub out: VipsImage,
796 pub log: String,
798 pub out_format: String,
800 pub in_format: String,
802}
803
804impl std::default::Default for SystemOptions {
805 fn default() -> Self {
806 SystemOptions {
807 inp: Vec::new(),
808 out: VipsImage::new(),
809 log: String::new(),
810 out_format: String::new(),
811 in_format: String::new(),
812 }
813 }
814}
815
816pub fn system_with_opts(cmd_format: &str, system_options: &SystemOptions) -> Result<()> {
821 unsafe {
822 let cmd_format_in: CString = utils::new_c_string(cmd_format)?;
823
824 let inp_wrapper = utils::VipsArrayImageWrapper::from(&system_options.inp[..]);
825 let inp_in = inp_wrapper.ctx;
826 let inp_in_name = utils::new_c_string("inp")?;
827
828 let out_in: *mut bindings::VipsImage = system_options.out.ctx;
829 let out_in_name = utils::new_c_string("out")?;
830
831 let log_in: CString = utils::new_c_string(&system_options.log)?;
832 let log_in_name = utils::new_c_string("log")?;
833
834 let out_format_in: CString = utils::new_c_string(&system_options.out_format)?;
835 let out_format_in_name = utils::new_c_string("out-format")?;
836
837 let in_format_in: CString = utils::new_c_string(&system_options.in_format)?;
838 let in_format_in_name = utils::new_c_string("in-format")?;
839
840 let vips_op_response = bindings::vips_system(
841 cmd_format_in.as_ptr(),
842 inp_in_name.as_ptr(),
843 inp_in,
844 out_in_name.as_ptr(),
845 out_in,
846 log_in_name.as_ptr(),
847 log_in.as_ptr(),
848 out_format_in_name.as_ptr(),
849 out_format_in.as_ptr(),
850 in_format_in_name.as_ptr(),
851 in_format_in.as_ptr(),
852 NULL,
853 );
854 utils::result(vips_op_response, (), Error::SystemError)
855 }
856}
857
858pub fn add(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
863 unsafe {
864 let left_in: *mut bindings::VipsImage = left.ctx;
865 let right_in: *mut bindings::VipsImage = right.ctx;
866 let mut out_out: *mut bindings::VipsImage = null_mut();
867
868 let vips_op_response = bindings::vips_add(left_in, right_in, &mut out_out, NULL);
869 utils::result(
870 vips_op_response,
871 VipsImage { ctx: out_out },
872 Error::AddError,
873 )
874 }
875}
876
877pub fn subtract(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
882 unsafe {
883 let left_in: *mut bindings::VipsImage = left.ctx;
884 let right_in: *mut bindings::VipsImage = right.ctx;
885 let mut out_out: *mut bindings::VipsImage = null_mut();
886
887 let vips_op_response = bindings::vips_subtract(left_in, right_in, &mut out_out, NULL);
888 utils::result(
889 vips_op_response,
890 VipsImage { ctx: out_out },
891 Error::SubtractError,
892 )
893 }
894}
895
896pub fn multiply(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
901 unsafe {
902 let left_in: *mut bindings::VipsImage = left.ctx;
903 let right_in: *mut bindings::VipsImage = right.ctx;
904 let mut out_out: *mut bindings::VipsImage = null_mut();
905
906 let vips_op_response = bindings::vips_multiply(left_in, right_in, &mut out_out, NULL);
907 utils::result(
908 vips_op_response,
909 VipsImage { ctx: out_out },
910 Error::MultiplyError,
911 )
912 }
913}
914
915pub fn divide(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
920 unsafe {
921 let left_in: *mut bindings::VipsImage = left.ctx;
922 let right_in: *mut bindings::VipsImage = right.ctx;
923 let mut out_out: *mut bindings::VipsImage = null_mut();
924
925 let vips_op_response = bindings::vips_divide(left_in, right_in, &mut out_out, NULL);
926 utils::result(
927 vips_op_response,
928 VipsImage { ctx: out_out },
929 Error::DivideError,
930 )
931 }
932}
933
934pub fn relational(
947 left: &VipsImage,
948 right: &VipsImage,
949 relational: OperationRelational,
950) -> Result<VipsImage> {
951 unsafe {
952 let left_in: *mut bindings::VipsImage = left.ctx;
953 let right_in: *mut bindings::VipsImage = right.ctx;
954 let relational_in: i32 = relational as i32;
955 let mut out_out: *mut bindings::VipsImage = null_mut();
956
957 let vips_op_response = bindings::vips_relational(
958 left_in,
959 right_in,
960 &mut out_out,
961 relational_in.try_into().unwrap(),
962 NULL,
963 );
964 utils::result(
965 vips_op_response,
966 VipsImage { ctx: out_out },
967 Error::RelationalError,
968 )
969 }
970}
971
972pub fn remainder(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
977 unsafe {
978 let left_in: *mut bindings::VipsImage = left.ctx;
979 let right_in: *mut bindings::VipsImage = right.ctx;
980 let mut out_out: *mut bindings::VipsImage = null_mut();
981
982 let vips_op_response = bindings::vips_remainder(left_in, right_in, &mut out_out, NULL);
983 utils::result(
984 vips_op_response,
985 VipsImage { ctx: out_out },
986 Error::RemainderError,
987 )
988 }
989}
990
991pub fn boolean(
1003 left: &VipsImage,
1004 right: &VipsImage,
1005 boolean: OperationBoolean,
1006) -> Result<VipsImage> {
1007 unsafe {
1008 let left_in: *mut bindings::VipsImage = left.ctx;
1009 let right_in: *mut bindings::VipsImage = right.ctx;
1010 let boolean_in: i32 = boolean as i32;
1011 let mut out_out: *mut bindings::VipsImage = null_mut();
1012
1013 let vips_op_response = bindings::vips_boolean(
1014 left_in,
1015 right_in,
1016 &mut out_out,
1017 boolean_in.try_into().unwrap(),
1018 NULL,
1019 );
1020 utils::result(
1021 vips_op_response,
1022 VipsImage { ctx: out_out },
1023 Error::BooleanError,
1024 )
1025 }
1026}
1027
1028pub fn math_2(left: &VipsImage, right: &VipsImage, math_2: OperationMath2) -> Result<VipsImage> {
1038 unsafe {
1039 let left_in: *mut bindings::VipsImage = left.ctx;
1040 let right_in: *mut bindings::VipsImage = right.ctx;
1041 let math_2_in: i32 = math_2 as i32;
1042 let mut out_out: *mut bindings::VipsImage = null_mut();
1043
1044 let vips_op_response = bindings::vips_math2(
1045 left_in,
1046 right_in,
1047 &mut out_out,
1048 math_2_in.try_into().unwrap(),
1049 NULL,
1050 );
1051 utils::result(
1052 vips_op_response,
1053 VipsImage { ctx: out_out },
1054 Error::Math2Error,
1055 )
1056 }
1057}
1058
1059pub fn complex_2(
1067 left: &VipsImage,
1068 right: &VipsImage,
1069 cmplx: OperationComplex2,
1070) -> Result<VipsImage> {
1071 unsafe {
1072 let left_in: *mut bindings::VipsImage = left.ctx;
1073 let right_in: *mut bindings::VipsImage = right.ctx;
1074 let cmplx_in: i32 = cmplx as i32;
1075 let mut out_out: *mut bindings::VipsImage = null_mut();
1076
1077 let vips_op_response = bindings::vips_complex2(
1078 left_in,
1079 right_in,
1080 &mut out_out,
1081 cmplx_in.try_into().unwrap(),
1082 NULL,
1083 );
1084 utils::result(
1085 vips_op_response,
1086 VipsImage { ctx: out_out },
1087 Error::Complex2Error,
1088 )
1089 }
1090}
1091
1092pub fn complexform(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
1097 unsafe {
1098 let left_in: *mut bindings::VipsImage = left.ctx;
1099 let right_in: *mut bindings::VipsImage = right.ctx;
1100 let mut out_out: *mut bindings::VipsImage = null_mut();
1101
1102 let vips_op_response = bindings::vips_complexform(left_in, right_in, &mut out_out, NULL);
1103 utils::result(
1104 vips_op_response,
1105 VipsImage { ctx: out_out },
1106 Error::ComplexformError,
1107 )
1108 }
1109}
1110
1111pub fn sum(inp: &mut [VipsImage]) -> Result<VipsImage> {
1115 unsafe {
1116 let (inp_len, mut inp_in) = {
1117 let len = inp.len();
1118 let mut input = Vec::new();
1119 for img in inp {
1120 input.push(img.ctx)
1121 }
1122 (len as i32, input)
1123 };
1124 let mut out_out: *mut bindings::VipsImage = null_mut();
1125
1126 let vips_op_response = bindings::vips_sum(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
1127 utils::result(
1128 vips_op_response,
1129 VipsImage { ctx: out_out },
1130 Error::SumError,
1131 )
1132 }
1133}
1134
1135pub fn invert(inp: &VipsImage) -> Result<VipsImage> {
1139 unsafe {
1140 let inp_in: *mut bindings::VipsImage = inp.ctx;
1141 let mut out_out: *mut bindings::VipsImage = null_mut();
1142
1143 let vips_op_response = bindings::vips_invert(inp_in, &mut out_out, NULL);
1144 utils::result(
1145 vips_op_response,
1146 VipsImage { ctx: out_out },
1147 Error::InvertError,
1148 )
1149 }
1150}
1151
1152pub fn math(inp: &VipsImage, math: OperationMath) -> Result<VipsImage> {
1174 unsafe {
1175 let inp_in: *mut bindings::VipsImage = inp.ctx;
1176 let math_in: i32 = math as i32;
1177 let mut out_out: *mut bindings::VipsImage = null_mut();
1178
1179 let vips_op_response =
1180 bindings::vips_math(inp_in, &mut out_out, math_in.try_into().unwrap(), NULL);
1181 utils::result(
1182 vips_op_response,
1183 VipsImage { ctx: out_out },
1184 Error::MathError,
1185 )
1186 }
1187}
1188
1189pub fn abs(inp: &VipsImage) -> Result<VipsImage> {
1193 unsafe {
1194 let inp_in: *mut bindings::VipsImage = inp.ctx;
1195 let mut out_out: *mut bindings::VipsImage = null_mut();
1196
1197 let vips_op_response = bindings::vips_abs(inp_in, &mut out_out, NULL);
1198 utils::result(vips_op_response, VipsImage { ctx: out_out }, Error::AbError)
1199 }
1200}
1201
1202pub fn sign(inp: &VipsImage) -> Result<VipsImage> {
1206 unsafe {
1207 let inp_in: *mut bindings::VipsImage = inp.ctx;
1208 let mut out_out: *mut bindings::VipsImage = null_mut();
1209
1210 let vips_op_response = bindings::vips_sign(inp_in, &mut out_out, NULL);
1211 utils::result(
1212 vips_op_response,
1213 VipsImage { ctx: out_out },
1214 Error::SignError,
1215 )
1216 }
1217}
1218
1219pub fn round(inp: &VipsImage, round: OperationRound) -> Result<VipsImage> {
1228 unsafe {
1229 let inp_in: *mut bindings::VipsImage = inp.ctx;
1230 let round_in: i32 = round as i32;
1231 let mut out_out: *mut bindings::VipsImage = null_mut();
1232
1233 let vips_op_response =
1234 bindings::vips_round(inp_in, &mut out_out, round_in.try_into().unwrap(), NULL);
1235 utils::result(
1236 vips_op_response,
1237 VipsImage { ctx: out_out },
1238 Error::RoundError,
1239 )
1240 }
1241}
1242
1243pub fn relational_const(
1256 inp: &VipsImage,
1257 relational: OperationRelational,
1258 c: &mut [f64],
1259) -> Result<VipsImage> {
1260 unsafe {
1261 let inp_in: *mut bindings::VipsImage = inp.ctx;
1262 let relational_in: i32 = relational as i32;
1263 let c_in: *mut f64 = c.as_mut_ptr();
1264 let mut out_out: *mut bindings::VipsImage = null_mut();
1265
1266 let vips_op_response = bindings::vips_relational_const(
1267 inp_in,
1268 &mut out_out,
1269 relational_in.try_into().unwrap(),
1270 c_in,
1271 c.len() as i32,
1272 NULL,
1273 );
1274 utils::result(
1275 vips_op_response,
1276 VipsImage { ctx: out_out },
1277 Error::RelationalConstError,
1278 )
1279 }
1280}
1281
1282pub fn remainder_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
1287 unsafe {
1288 let inp_in: *mut bindings::VipsImage = inp.ctx;
1289 let c_in: *mut f64 = c.as_mut_ptr();
1290 let mut out_out: *mut bindings::VipsImage = null_mut();
1291
1292 let vips_op_response =
1293 bindings::vips_remainder_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
1294 utils::result(
1295 vips_op_response,
1296 VipsImage { ctx: out_out },
1297 Error::RemainderConstError,
1298 )
1299 }
1300}
1301
1302pub fn boolean_const(
1314 inp: &VipsImage,
1315 boolean: OperationBoolean,
1316 c: &mut [f64],
1317) -> Result<VipsImage> {
1318 unsafe {
1319 let inp_in: *mut bindings::VipsImage = inp.ctx;
1320 let boolean_in: i32 = boolean as i32;
1321 let c_in: *mut f64 = c.as_mut_ptr();
1322 let mut out_out: *mut bindings::VipsImage = null_mut();
1323
1324 let vips_op_response = bindings::vips_boolean_const(
1325 inp_in,
1326 &mut out_out,
1327 boolean_in.try_into().unwrap(),
1328 c_in,
1329 c.len() as i32,
1330 NULL,
1331 );
1332 utils::result(
1333 vips_op_response,
1334 VipsImage { ctx: out_out },
1335 Error::BooleanConstError,
1336 )
1337 }
1338}
1339
1340pub fn math_2_const(inp: &VipsImage, math_2: OperationMath2, c: &mut [f64]) -> Result<VipsImage> {
1350 unsafe {
1351 let inp_in: *mut bindings::VipsImage = inp.ctx;
1352 let math_2_in: i32 = math_2 as i32;
1353 let c_in: *mut f64 = c.as_mut_ptr();
1354 let mut out_out: *mut bindings::VipsImage = null_mut();
1355
1356 let vips_op_response = bindings::vips_math2_const(
1357 inp_in,
1358 &mut out_out,
1359 math_2_in.try_into().unwrap(),
1360 c_in,
1361 c.len() as i32,
1362 NULL,
1363 );
1364 utils::result(
1365 vips_op_response,
1366 VipsImage { ctx: out_out },
1367 Error::Math2ConstError,
1368 )
1369 }
1370}
1371
1372pub fn complex(inp: &VipsImage, cmplx: OperationComplex) -> Result<VipsImage> {
1381 unsafe {
1382 let inp_in: *mut bindings::VipsImage = inp.ctx;
1383 let cmplx_in: i32 = cmplx as i32;
1384 let mut out_out: *mut bindings::VipsImage = null_mut();
1385
1386 let vips_op_response =
1387 bindings::vips_complex(inp_in, &mut out_out, cmplx_in.try_into().unwrap(), NULL);
1388 utils::result(
1389 vips_op_response,
1390 VipsImage { ctx: out_out },
1391 Error::ComplexError,
1392 )
1393 }
1394}
1395
1396pub fn complexget(inp: &VipsImage, get: OperationComplexget) -> Result<VipsImage> {
1404 unsafe {
1405 let inp_in: *mut bindings::VipsImage = inp.ctx;
1406 let get_in: i32 = get as i32;
1407 let mut out_out: *mut bindings::VipsImage = null_mut();
1408
1409 let vips_op_response =
1410 bindings::vips_complexget(inp_in, &mut out_out, get_in.try_into().unwrap(), NULL);
1411 utils::result(
1412 vips_op_response,
1413 VipsImage { ctx: out_out },
1414 Error::ComplexgetError,
1415 )
1416 }
1417}
1418
1419pub fn avg(inp: &VipsImage) -> Result<f64> {
1423 unsafe {
1424 let inp_in: *mut bindings::VipsImage = inp.ctx;
1425 let mut out_out: f64 = f64::from(0);
1426
1427 let vips_op_response = bindings::vips_avg(inp_in, &mut out_out, NULL);
1428 utils::result(vips_op_response, out_out, Error::AvgError)
1429 }
1430}
1431
1432pub fn min(inp: &VipsImage) -> Result<f64> {
1436 unsafe {
1437 let inp_in: *mut bindings::VipsImage = inp.ctx;
1438 let mut out_out: f64 = f64::from(0);
1439
1440 let vips_op_response = bindings::vips_min(inp_in, &mut out_out, NULL);
1441 utils::result(vips_op_response, out_out, Error::MinError)
1442 }
1443}
1444
1445#[derive(Clone, Debug)]
1447pub struct MinOptions {
1448 pub x: i32,
1451 pub y: i32,
1454 pub size: i32,
1457 pub out_array: Vec<f64>,
1459 pub x_array: Vec<i32>,
1461 pub y_array: Vec<i32>,
1463}
1464
1465impl std::default::Default for MinOptions {
1466 fn default() -> Self {
1467 MinOptions {
1468 x: i32::from(0),
1469 y: i32::from(0),
1470 size: i32::from(10),
1471 out_array: Vec::new(),
1472 x_array: Vec::new(),
1473 y_array: Vec::new(),
1474 }
1475 }
1476}
1477
1478pub fn min_with_opts(inp: &VipsImage, min_options: &MinOptions) -> Result<f64> {
1483 unsafe {
1484 let inp_in: *mut bindings::VipsImage = inp.ctx;
1485 let mut out_out: f64 = f64::from(0);
1486
1487 let x_in: i32 = min_options.x;
1488 let x_in_name = utils::new_c_string("x")?;
1489
1490 let y_in: i32 = min_options.y;
1491 let y_in_name = utils::new_c_string("y")?;
1492
1493 let size_in: i32 = min_options.size;
1494 let size_in_name = utils::new_c_string("size")?;
1495
1496 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&min_options.out_array[..]);
1497 let out_array_in = out_array_wrapper.ctx;
1498 let out_array_in_name = utils::new_c_string("out-array")?;
1499
1500 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.x_array[..]);
1501 let x_array_in = x_array_wrapper.ctx;
1502 let x_array_in_name = utils::new_c_string("x-array")?;
1503
1504 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&min_options.y_array[..]);
1505 let y_array_in = y_array_wrapper.ctx;
1506 let y_array_in_name = utils::new_c_string("y-array")?;
1507
1508 let vips_op_response = bindings::vips_min(
1509 inp_in,
1510 &mut out_out,
1511 x_in_name.as_ptr(),
1512 x_in,
1513 y_in_name.as_ptr(),
1514 y_in,
1515 size_in_name.as_ptr(),
1516 size_in,
1517 out_array_in_name.as_ptr(),
1518 out_array_in,
1519 x_array_in_name.as_ptr(),
1520 x_array_in,
1521 y_array_in_name.as_ptr(),
1522 y_array_in,
1523 NULL,
1524 );
1525 utils::result(vips_op_response, out_out, Error::MinError)
1526 }
1527}
1528
1529pub fn max(inp: &VipsImage) -> Result<f64> {
1533 unsafe {
1534 let inp_in: *mut bindings::VipsImage = inp.ctx;
1535 let mut out_out: f64 = f64::from(0);
1536
1537 let vips_op_response = bindings::vips_max(inp_in, &mut out_out, NULL);
1538 utils::result(vips_op_response, out_out, Error::MaxError)
1539 }
1540}
1541
1542#[derive(Clone, Debug)]
1544pub struct MaxOptions {
1545 pub x: i32,
1548 pub y: i32,
1551 pub size: i32,
1554 pub out_array: Vec<f64>,
1556 pub x_array: Vec<i32>,
1558 pub y_array: Vec<i32>,
1560}
1561
1562impl std::default::Default for MaxOptions {
1563 fn default() -> Self {
1564 MaxOptions {
1565 x: i32::from(0),
1566 y: i32::from(0),
1567 size: i32::from(10),
1568 out_array: Vec::new(),
1569 x_array: Vec::new(),
1570 y_array: Vec::new(),
1571 }
1572 }
1573}
1574
1575pub fn max_with_opts(inp: &VipsImage, max_options: &MaxOptions) -> Result<f64> {
1580 unsafe {
1581 let inp_in: *mut bindings::VipsImage = inp.ctx;
1582 let mut out_out: f64 = f64::from(0);
1583
1584 let x_in: i32 = max_options.x;
1585 let x_in_name = utils::new_c_string("x")?;
1586
1587 let y_in: i32 = max_options.y;
1588 let y_in_name = utils::new_c_string("y")?;
1589
1590 let size_in: i32 = max_options.size;
1591 let size_in_name = utils::new_c_string("size")?;
1592
1593 let out_array_wrapper = utils::VipsArrayDoubleWrapper::from(&max_options.out_array[..]);
1594 let out_array_in = out_array_wrapper.ctx;
1595 let out_array_in_name = utils::new_c_string("out-array")?;
1596
1597 let x_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.x_array[..]);
1598 let x_array_in = x_array_wrapper.ctx;
1599 let x_array_in_name = utils::new_c_string("x-array")?;
1600
1601 let y_array_wrapper = utils::VipsArrayIntWrapper::from(&max_options.y_array[..]);
1602 let y_array_in = y_array_wrapper.ctx;
1603 let y_array_in_name = utils::new_c_string("y-array")?;
1604
1605 let vips_op_response = bindings::vips_max(
1606 inp_in,
1607 &mut out_out,
1608 x_in_name.as_ptr(),
1609 x_in,
1610 y_in_name.as_ptr(),
1611 y_in,
1612 size_in_name.as_ptr(),
1613 size_in,
1614 out_array_in_name.as_ptr(),
1615 out_array_in,
1616 x_array_in_name.as_ptr(),
1617 x_array_in,
1618 y_array_in_name.as_ptr(),
1619 y_array_in,
1620 NULL,
1621 );
1622 utils::result(vips_op_response, out_out, Error::MaxError)
1623 }
1624}
1625
1626pub fn deviate(inp: &VipsImage) -> Result<f64> {
1630 unsafe {
1631 let inp_in: *mut bindings::VipsImage = inp.ctx;
1632 let mut out_out: f64 = f64::from(0);
1633
1634 let vips_op_response = bindings::vips_deviate(inp_in, &mut out_out, NULL);
1635 utils::result(vips_op_response, out_out, Error::DeviateError)
1636 }
1637}
1638
1639pub fn stats(inp: &VipsImage) -> Result<VipsImage> {
1643 unsafe {
1644 let inp_in: *mut bindings::VipsImage = inp.ctx;
1645 let mut out_out: *mut bindings::VipsImage = null_mut();
1646
1647 let vips_op_response = bindings::vips_stats(inp_in, &mut out_out, NULL);
1648 utils::result(
1649 vips_op_response,
1650 VipsImage { ctx: out_out },
1651 Error::StatError,
1652 )
1653 }
1654}
1655
1656pub fn hist_find(inp: &VipsImage) -> Result<VipsImage> {
1660 unsafe {
1661 let inp_in: *mut bindings::VipsImage = inp.ctx;
1662 let mut out_out: *mut bindings::VipsImage = null_mut();
1663
1664 let vips_op_response = bindings::vips_hist_find(inp_in, &mut out_out, NULL);
1665 utils::result(
1666 vips_op_response,
1667 VipsImage { ctx: out_out },
1668 Error::HistFindError,
1669 )
1670 }
1671}
1672
1673#[derive(Clone, Debug)]
1675pub struct HistFindOptions {
1676 pub band: i32,
1679}
1680
1681impl std::default::Default for HistFindOptions {
1682 fn default() -> Self {
1683 HistFindOptions {
1684 band: i32::from(-1),
1685 }
1686 }
1687}
1688
1689pub fn hist_find_with_opts(
1694 inp: &VipsImage,
1695 hist_find_options: &HistFindOptions,
1696) -> Result<VipsImage> {
1697 unsafe {
1698 let inp_in: *mut bindings::VipsImage = inp.ctx;
1699 let mut out_out: *mut bindings::VipsImage = null_mut();
1700
1701 let band_in: i32 = hist_find_options.band;
1702 let band_in_name = utils::new_c_string("band")?;
1703
1704 let vips_op_response =
1705 bindings::vips_hist_find(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
1706 utils::result(
1707 vips_op_response,
1708 VipsImage { ctx: out_out },
1709 Error::HistFindError,
1710 )
1711 }
1712}
1713
1714pub fn hist_find_ndim(inp: &VipsImage) -> Result<VipsImage> {
1718 unsafe {
1719 let inp_in: *mut bindings::VipsImage = inp.ctx;
1720 let mut out_out: *mut bindings::VipsImage = null_mut();
1721
1722 let vips_op_response = bindings::vips_hist_find_ndim(inp_in, &mut out_out, NULL);
1723 utils::result(
1724 vips_op_response,
1725 VipsImage { ctx: out_out },
1726 Error::HistFindNdimError,
1727 )
1728 }
1729}
1730
1731#[derive(Clone, Debug)]
1733pub struct HistFindNdimOptions {
1734 pub bins: i32,
1737}
1738
1739impl std::default::Default for HistFindNdimOptions {
1740 fn default() -> Self {
1741 HistFindNdimOptions {
1742 bins: i32::from(10),
1743 }
1744 }
1745}
1746
1747pub fn hist_find_ndim_with_opts(
1752 inp: &VipsImage,
1753 hist_find_ndim_options: &HistFindNdimOptions,
1754) -> Result<VipsImage> {
1755 unsafe {
1756 let inp_in: *mut bindings::VipsImage = inp.ctx;
1757 let mut out_out: *mut bindings::VipsImage = null_mut();
1758
1759 let bins_in: i32 = hist_find_ndim_options.bins;
1760 let bins_in_name = utils::new_c_string("bins")?;
1761
1762 let vips_op_response = bindings::vips_hist_find_ndim(
1763 inp_in,
1764 &mut out_out,
1765 bins_in_name.as_ptr(),
1766 bins_in,
1767 NULL,
1768 );
1769 utils::result(
1770 vips_op_response,
1771 VipsImage { ctx: out_out },
1772 Error::HistFindNdimError,
1773 )
1774 }
1775}
1776
1777pub fn hist_find_indexed(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
1782 unsafe {
1783 let inp_in: *mut bindings::VipsImage = inp.ctx;
1784 let index_in: *mut bindings::VipsImage = index.ctx;
1785 let mut out_out: *mut bindings::VipsImage = null_mut();
1786
1787 let vips_op_response =
1788 bindings::vips_hist_find_indexed(inp_in, index_in, &mut out_out, NULL);
1789 utils::result(
1790 vips_op_response,
1791 VipsImage { ctx: out_out },
1792 Error::HistFindIndexedError,
1793 )
1794 }
1795}
1796
1797#[derive(Clone, Debug)]
1799pub struct HistFindIndexedOptions {
1800 pub combine: Combine,
1806}
1807
1808impl std::default::Default for HistFindIndexedOptions {
1809 fn default() -> Self {
1810 HistFindIndexedOptions {
1811 combine: Combine::Sum,
1812 }
1813 }
1814}
1815
1816pub fn hist_find_indexed_with_opts(
1822 inp: &VipsImage,
1823 index: &VipsImage,
1824 hist_find_indexed_options: &HistFindIndexedOptions,
1825) -> Result<VipsImage> {
1826 unsafe {
1827 let inp_in: *mut bindings::VipsImage = inp.ctx;
1828 let index_in: *mut bindings::VipsImage = index.ctx;
1829 let mut out_out: *mut bindings::VipsImage = null_mut();
1830
1831 let combine_in: i32 = hist_find_indexed_options.combine as i32;
1832 let combine_in_name = utils::new_c_string("combine")?;
1833
1834 let vips_op_response = bindings::vips_hist_find_indexed(
1835 inp_in,
1836 index_in,
1837 &mut out_out,
1838 combine_in_name.as_ptr(),
1839 combine_in,
1840 NULL,
1841 );
1842 utils::result(
1843 vips_op_response,
1844 VipsImage { ctx: out_out },
1845 Error::HistFindIndexedError,
1846 )
1847 }
1848}
1849
1850pub fn hough_line(inp: &VipsImage) -> Result<VipsImage> {
1854 unsafe {
1855 let inp_in: *mut bindings::VipsImage = inp.ctx;
1856 let mut out_out: *mut bindings::VipsImage = null_mut();
1857
1858 let vips_op_response = bindings::vips_hough_line(inp_in, &mut out_out, NULL);
1859 utils::result(
1860 vips_op_response,
1861 VipsImage { ctx: out_out },
1862 Error::HoughLineError,
1863 )
1864 }
1865}
1866
1867#[derive(Clone, Debug)]
1869pub struct HoughLineOptions {
1870 pub width: i32,
1873 pub height: i32,
1876}
1877
1878impl std::default::Default for HoughLineOptions {
1879 fn default() -> Self {
1880 HoughLineOptions {
1881 width: i32::from(256),
1882 height: i32::from(256),
1883 }
1884 }
1885}
1886
1887pub fn hough_line_with_opts(
1892 inp: &VipsImage,
1893 hough_line_options: &HoughLineOptions,
1894) -> Result<VipsImage> {
1895 unsafe {
1896 let inp_in: *mut bindings::VipsImage = inp.ctx;
1897 let mut out_out: *mut bindings::VipsImage = null_mut();
1898
1899 let width_in: i32 = hough_line_options.width;
1900 let width_in_name = utils::new_c_string("width")?;
1901
1902 let height_in: i32 = hough_line_options.height;
1903 let height_in_name = utils::new_c_string("height")?;
1904
1905 let vips_op_response = bindings::vips_hough_line(
1906 inp_in,
1907 &mut out_out,
1908 width_in_name.as_ptr(),
1909 width_in,
1910 height_in_name.as_ptr(),
1911 height_in,
1912 NULL,
1913 );
1914 utils::result(
1915 vips_op_response,
1916 VipsImage { ctx: out_out },
1917 Error::HoughLineError,
1918 )
1919 }
1920}
1921
1922pub fn hough_circle(inp: &VipsImage) -> Result<VipsImage> {
1926 unsafe {
1927 let inp_in: *mut bindings::VipsImage = inp.ctx;
1928 let mut out_out: *mut bindings::VipsImage = null_mut();
1929
1930 let vips_op_response = bindings::vips_hough_circle(inp_in, &mut out_out, NULL);
1931 utils::result(
1932 vips_op_response,
1933 VipsImage { ctx: out_out },
1934 Error::HoughCircleError,
1935 )
1936 }
1937}
1938
1939#[derive(Clone, Debug)]
1941pub struct HoughCircleOptions {
1942 pub scale: i32,
1945 pub min_radius: i32,
1948 pub max_radius: i32,
1951}
1952
1953impl std::default::Default for HoughCircleOptions {
1954 fn default() -> Self {
1955 HoughCircleOptions {
1956 scale: i32::from(3),
1957 min_radius: i32::from(10),
1958 max_radius: i32::from(20),
1959 }
1960 }
1961}
1962
1963pub fn hough_circle_with_opts(
1968 inp: &VipsImage,
1969 hough_circle_options: &HoughCircleOptions,
1970) -> Result<VipsImage> {
1971 unsafe {
1972 let inp_in: *mut bindings::VipsImage = inp.ctx;
1973 let mut out_out: *mut bindings::VipsImage = null_mut();
1974
1975 let scale_in: i32 = hough_circle_options.scale;
1976 let scale_in_name = utils::new_c_string("scale")?;
1977
1978 let min_radius_in: i32 = hough_circle_options.min_radius;
1979 let min_radius_in_name = utils::new_c_string("min-radius")?;
1980
1981 let max_radius_in: i32 = hough_circle_options.max_radius;
1982 let max_radius_in_name = utils::new_c_string("max-radius")?;
1983
1984 let vips_op_response = bindings::vips_hough_circle(
1985 inp_in,
1986 &mut out_out,
1987 scale_in_name.as_ptr(),
1988 scale_in,
1989 min_radius_in_name.as_ptr(),
1990 min_radius_in,
1991 max_radius_in_name.as_ptr(),
1992 max_radius_in,
1993 NULL,
1994 );
1995 utils::result(
1996 vips_op_response,
1997 VipsImage { ctx: out_out },
1998 Error::HoughCircleError,
1999 )
2000 }
2001}
2002
2003pub fn project(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2010 unsafe {
2011 let inp_in: *mut bindings::VipsImage = inp.ctx;
2012 let mut columns_out: *mut bindings::VipsImage = null_mut();
2013 let mut rows_out: *mut bindings::VipsImage = null_mut();
2014
2015 let vips_op_response =
2016 bindings::vips_project(inp_in, &mut columns_out, &mut rows_out, NULL);
2017 utils::result(
2018 vips_op_response,
2019 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2020 Error::ProjectError,
2021 )
2022 }
2023}
2024
2025pub fn profile(inp: &VipsImage) -> Result<(VipsImage, VipsImage)> {
2032 unsafe {
2033 let inp_in: *mut bindings::VipsImage = inp.ctx;
2034 let mut columns_out: *mut bindings::VipsImage = null_mut();
2035 let mut rows_out: *mut bindings::VipsImage = null_mut();
2036
2037 let vips_op_response =
2038 bindings::vips_profile(inp_in, &mut columns_out, &mut rows_out, NULL);
2039 utils::result(
2040 vips_op_response,
2041 (VipsImage { ctx: columns_out }, VipsImage { ctx: rows_out }),
2042 Error::ProfileError,
2043 )
2044 }
2045}
2046
2047pub fn measure(inp: &VipsImage, h: i32, v: i32) -> Result<VipsImage> {
2055 unsafe {
2056 let inp_in: *mut bindings::VipsImage = inp.ctx;
2057 let h_in: i32 = h;
2058 let v_in: i32 = v;
2059 let mut out_out: *mut bindings::VipsImage = null_mut();
2060
2061 let vips_op_response = bindings::vips_measure(inp_in, &mut out_out, h_in, v_in, NULL);
2062 utils::result(
2063 vips_op_response,
2064 VipsImage { ctx: out_out },
2065 Error::MeasureError,
2066 )
2067 }
2068}
2069
2070#[derive(Clone, Debug)]
2072pub struct MeasureOptions {
2073 pub left: i32,
2076 pub top: i32,
2079 pub width: i32,
2082 pub height: i32,
2085}
2086
2087impl std::default::Default for MeasureOptions {
2088 fn default() -> Self {
2089 MeasureOptions {
2090 left: i32::from(0),
2091 top: i32::from(0),
2092 width: i32::from(1),
2093 height: i32::from(1),
2094 }
2095 }
2096}
2097
2098pub fn measure_with_opts(
2107 inp: &VipsImage,
2108 h: i32,
2109 v: i32,
2110 measure_options: &MeasureOptions,
2111) -> Result<VipsImage> {
2112 unsafe {
2113 let inp_in: *mut bindings::VipsImage = inp.ctx;
2114 let h_in: i32 = h;
2115 let v_in: i32 = v;
2116 let mut out_out: *mut bindings::VipsImage = null_mut();
2117
2118 let left_in: i32 = measure_options.left;
2119 let left_in_name = utils::new_c_string("left")?;
2120
2121 let top_in: i32 = measure_options.top;
2122 let top_in_name = utils::new_c_string("top")?;
2123
2124 let width_in: i32 = measure_options.width;
2125 let width_in_name = utils::new_c_string("width")?;
2126
2127 let height_in: i32 = measure_options.height;
2128 let height_in_name = utils::new_c_string("height")?;
2129
2130 let vips_op_response = bindings::vips_measure(
2131 inp_in,
2132 &mut out_out,
2133 h_in,
2134 v_in,
2135 left_in_name.as_ptr(),
2136 left_in,
2137 top_in_name.as_ptr(),
2138 top_in,
2139 width_in_name.as_ptr(),
2140 width_in,
2141 height_in_name.as_ptr(),
2142 height_in,
2143 NULL,
2144 );
2145 utils::result(
2146 vips_op_response,
2147 VipsImage { ctx: out_out },
2148 Error::MeasureError,
2149 )
2150 }
2151}
2152
2153pub fn find_trim(inp: &VipsImage) -> Result<(i32, i32, i32, i32)> {
2162 unsafe {
2163 let inp_in: *mut bindings::VipsImage = inp.ctx;
2164 let mut left_out: i32 = i32::from(1);
2165 let mut top_out: i32 = i32::from(0);
2166 let mut width_out: i32 = i32::from(1);
2167 let mut height_out: i32 = i32::from(1);
2168
2169 let vips_op_response = bindings::vips_find_trim(
2170 inp_in,
2171 &mut left_out,
2172 &mut top_out,
2173 &mut width_out,
2174 &mut height_out,
2175 NULL,
2176 );
2177 utils::result(
2178 vips_op_response,
2179 (left_out, top_out, width_out, height_out),
2180 Error::FindTrimError,
2181 )
2182 }
2183}
2184
2185#[derive(Clone, Debug)]
2187pub struct FindTrimOptions {
2188 pub threshold: f64,
2191 pub background: Vec<f64>,
2193 pub line_art: bool,
2196}
2197
2198impl std::default::Default for FindTrimOptions {
2199 fn default() -> Self {
2200 FindTrimOptions {
2201 threshold: f64::from(10),
2202 background: Vec::new(),
2203 line_art: false,
2204 }
2205 }
2206}
2207
2208pub fn find_trim_with_opts(
2218 inp: &VipsImage,
2219 find_trim_options: &FindTrimOptions,
2220) -> Result<(i32, i32, i32, i32)> {
2221 unsafe {
2222 let inp_in: *mut bindings::VipsImage = inp.ctx;
2223 let mut left_out: i32 = i32::from(1);
2224 let mut top_out: i32 = i32::from(0);
2225 let mut width_out: i32 = i32::from(1);
2226 let mut height_out: i32 = i32::from(1);
2227
2228 let threshold_in: f64 = find_trim_options.threshold;
2229 let threshold_in_name = utils::new_c_string("threshold")?;
2230
2231 let background_wrapper =
2232 utils::VipsArrayDoubleWrapper::from(&find_trim_options.background[..]);
2233 let background_in = background_wrapper.ctx;
2234 let background_in_name = utils::new_c_string("background")?;
2235
2236 let line_art_in: i32 = if find_trim_options.line_art { 1 } else { 0 };
2237 let line_art_in_name = utils::new_c_string("line-art")?;
2238
2239 let vips_op_response = bindings::vips_find_trim(
2240 inp_in,
2241 &mut left_out,
2242 &mut top_out,
2243 &mut width_out,
2244 &mut height_out,
2245 threshold_in_name.as_ptr(),
2246 threshold_in,
2247 background_in_name.as_ptr(),
2248 background_in,
2249 line_art_in_name.as_ptr(),
2250 line_art_in,
2251 NULL,
2252 );
2253 utils::result(
2254 vips_op_response,
2255 (left_out, top_out, width_out, height_out),
2256 Error::FindTrimError,
2257 )
2258 }
2259}
2260
2261pub fn copy(inp: &VipsImage) -> Result<VipsImage> {
2265 unsafe {
2266 let inp_in: *mut bindings::VipsImage = inp.ctx;
2267 let mut out_out: *mut bindings::VipsImage = null_mut();
2268
2269 let vips_op_response = bindings::vips_copy(inp_in, &mut out_out, NULL);
2270 utils::result(
2271 vips_op_response,
2272 VipsImage { ctx: out_out },
2273 Error::CopyError,
2274 )
2275 }
2276}
2277
2278#[derive(Clone, Debug)]
2280pub struct CopyOptions {
2281 pub width: i32,
2284 pub height: i32,
2287 pub bands: i32,
2290 pub format: BandFormat,
2304 pub coding: Coding,
2311 pub interpretation: Interpretation,
2334 pub xres: f64,
2337 pub yres: f64,
2340 pub xoffset: i32,
2343 pub yoffset: i32,
2346}
2347
2348impl std::default::Default for CopyOptions {
2349 fn default() -> Self {
2350 CopyOptions {
2351 width: i32::from(0),
2352 height: i32::from(0),
2353 bands: i32::from(0),
2354 format: BandFormat::Uchar,
2355 coding: Coding::None,
2356 interpretation: Interpretation::Multiband,
2357 xres: f64::from(0),
2358 yres: f64::from(0),
2359 xoffset: i32::from(0),
2360 yoffset: i32::from(0),
2361 }
2362 }
2363}
2364
2365pub fn copy_with_opts(inp: &VipsImage, copy_options: &CopyOptions) -> Result<VipsImage> {
2370 unsafe {
2371 let inp_in: *mut bindings::VipsImage = inp.ctx;
2372 let mut out_out: *mut bindings::VipsImage = null_mut();
2373
2374 let width_in: i32 = copy_options.width;
2375 let width_in_name = utils::new_c_string("width")?;
2376
2377 let height_in: i32 = copy_options.height;
2378 let height_in_name = utils::new_c_string("height")?;
2379
2380 let bands_in: i32 = copy_options.bands;
2381 let bands_in_name = utils::new_c_string("bands")?;
2382
2383 let format_in: i32 = copy_options.format as i32;
2384 let format_in_name = utils::new_c_string("format")?;
2385
2386 let coding_in: i32 = copy_options.coding as i32;
2387 let coding_in_name = utils::new_c_string("coding")?;
2388
2389 let interpretation_in: i32 = copy_options.interpretation as i32;
2390 let interpretation_in_name = utils::new_c_string("interpretation")?;
2391
2392 let xres_in: f64 = copy_options.xres;
2393 let xres_in_name = utils::new_c_string("xres")?;
2394
2395 let yres_in: f64 = copy_options.yres;
2396 let yres_in_name = utils::new_c_string("yres")?;
2397
2398 let xoffset_in: i32 = copy_options.xoffset;
2399 let xoffset_in_name = utils::new_c_string("xoffset")?;
2400
2401 let yoffset_in: i32 = copy_options.yoffset;
2402 let yoffset_in_name = utils::new_c_string("yoffset")?;
2403
2404 let vips_op_response = bindings::vips_copy(
2405 inp_in,
2406 &mut out_out,
2407 width_in_name.as_ptr(),
2408 width_in,
2409 height_in_name.as_ptr(),
2410 height_in,
2411 bands_in_name.as_ptr(),
2412 bands_in,
2413 format_in_name.as_ptr(),
2414 format_in,
2415 coding_in_name.as_ptr(),
2416 coding_in,
2417 interpretation_in_name.as_ptr(),
2418 interpretation_in,
2419 xres_in_name.as_ptr(),
2420 xres_in,
2421 yres_in_name.as_ptr(),
2422 yres_in,
2423 xoffset_in_name.as_ptr(),
2424 xoffset_in,
2425 yoffset_in_name.as_ptr(),
2426 yoffset_in,
2427 NULL,
2428 );
2429 utils::result(
2430 vips_op_response,
2431 VipsImage { ctx: out_out },
2432 Error::CopyError,
2433 )
2434 }
2435}
2436
2437pub fn tilecache(inp: &VipsImage) -> Result<VipsImage> {
2441 unsafe {
2442 let inp_in: *mut bindings::VipsImage = inp.ctx;
2443 let mut out_out: *mut bindings::VipsImage = null_mut();
2444
2445 let vips_op_response = bindings::vips_tilecache(inp_in, &mut out_out, NULL);
2446 utils::result(
2447 vips_op_response,
2448 VipsImage { ctx: out_out },
2449 Error::TilecacheError,
2450 )
2451 }
2452}
2453
2454#[derive(Clone, Debug)]
2456pub struct TilecacheOptions {
2457 pub tile_width: i32,
2460 pub tile_height: i32,
2463 pub max_tiles: i32,
2466 pub access: Access,
2472 pub threaded: bool,
2475 pub persistent: bool,
2478}
2479
2480impl std::default::Default for TilecacheOptions {
2481 fn default() -> Self {
2482 TilecacheOptions {
2483 tile_width: i32::from(128),
2484 tile_height: i32::from(128),
2485 max_tiles: i32::from(1000),
2486 access: Access::Random,
2487 threaded: false,
2488 persistent: false,
2489 }
2490 }
2491}
2492
2493pub fn tilecache_with_opts(
2498 inp: &VipsImage,
2499 tilecache_options: &TilecacheOptions,
2500) -> Result<VipsImage> {
2501 unsafe {
2502 let inp_in: *mut bindings::VipsImage = inp.ctx;
2503 let mut out_out: *mut bindings::VipsImage = null_mut();
2504
2505 let tile_width_in: i32 = tilecache_options.tile_width;
2506 let tile_width_in_name = utils::new_c_string("tile-width")?;
2507
2508 let tile_height_in: i32 = tilecache_options.tile_height;
2509 let tile_height_in_name = utils::new_c_string("tile-height")?;
2510
2511 let max_tiles_in: i32 = tilecache_options.max_tiles;
2512 let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2513
2514 let access_in: i32 = tilecache_options.access as i32;
2515 let access_in_name = utils::new_c_string("access")?;
2516
2517 let threaded_in: i32 = if tilecache_options.threaded { 1 } else { 0 };
2518 let threaded_in_name = utils::new_c_string("threaded")?;
2519
2520 let persistent_in: i32 = if tilecache_options.persistent { 1 } else { 0 };
2521 let persistent_in_name = utils::new_c_string("persistent")?;
2522
2523 let vips_op_response = bindings::vips_tilecache(
2524 inp_in,
2525 &mut out_out,
2526 tile_width_in_name.as_ptr(),
2527 tile_width_in,
2528 tile_height_in_name.as_ptr(),
2529 tile_height_in,
2530 max_tiles_in_name.as_ptr(),
2531 max_tiles_in,
2532 access_in_name.as_ptr(),
2533 access_in,
2534 threaded_in_name.as_ptr(),
2535 threaded_in,
2536 persistent_in_name.as_ptr(),
2537 persistent_in,
2538 NULL,
2539 );
2540 utils::result(
2541 vips_op_response,
2542 VipsImage { ctx: out_out },
2543 Error::TilecacheError,
2544 )
2545 }
2546}
2547
2548pub fn linecache(inp: &VipsImage) -> Result<VipsImage> {
2552 unsafe {
2553 let inp_in: *mut bindings::VipsImage = inp.ctx;
2554 let mut out_out: *mut bindings::VipsImage = null_mut();
2555
2556 let vips_op_response = bindings::vips_linecache(inp_in, &mut out_out, NULL);
2557 utils::result(
2558 vips_op_response,
2559 VipsImage { ctx: out_out },
2560 Error::LinecacheError,
2561 )
2562 }
2563}
2564
2565#[derive(Clone, Debug)]
2567pub struct LinecacheOptions {
2568 pub tile_height: i32,
2571 pub access: Access,
2577 pub threaded: bool,
2580 pub persistent: bool,
2583}
2584
2585impl std::default::Default for LinecacheOptions {
2586 fn default() -> Self {
2587 LinecacheOptions {
2588 tile_height: i32::from(128),
2589 access: Access::Random,
2590 threaded: false,
2591 persistent: false,
2592 }
2593 }
2594}
2595
2596pub fn linecache_with_opts(
2601 inp: &VipsImage,
2602 linecache_options: &LinecacheOptions,
2603) -> Result<VipsImage> {
2604 unsafe {
2605 let inp_in: *mut bindings::VipsImage = inp.ctx;
2606 let mut out_out: *mut bindings::VipsImage = null_mut();
2607
2608 let tile_height_in: i32 = linecache_options.tile_height;
2609 let tile_height_in_name = utils::new_c_string("tile-height")?;
2610
2611 let access_in: i32 = linecache_options.access as i32;
2612 let access_in_name = utils::new_c_string("access")?;
2613
2614 let threaded_in: i32 = if linecache_options.threaded { 1 } else { 0 };
2615 let threaded_in_name = utils::new_c_string("threaded")?;
2616
2617 let persistent_in: i32 = if linecache_options.persistent { 1 } else { 0 };
2618 let persistent_in_name = utils::new_c_string("persistent")?;
2619
2620 let vips_op_response = bindings::vips_linecache(
2621 inp_in,
2622 &mut out_out,
2623 tile_height_in_name.as_ptr(),
2624 tile_height_in,
2625 access_in_name.as_ptr(),
2626 access_in,
2627 threaded_in_name.as_ptr(),
2628 threaded_in,
2629 persistent_in_name.as_ptr(),
2630 persistent_in,
2631 NULL,
2632 );
2633 utils::result(
2634 vips_op_response,
2635 VipsImage { ctx: out_out },
2636 Error::LinecacheError,
2637 )
2638 }
2639}
2640
2641pub fn sequential(inp: &VipsImage) -> Result<VipsImage> {
2645 unsafe {
2646 let inp_in: *mut bindings::VipsImage = inp.ctx;
2647 let mut out_out: *mut bindings::VipsImage = null_mut();
2648
2649 let vips_op_response = bindings::vips_sequential(inp_in, &mut out_out, NULL);
2650 utils::result(
2651 vips_op_response,
2652 VipsImage { ctx: out_out },
2653 Error::SequentialError,
2654 )
2655 }
2656}
2657
2658#[derive(Clone, Debug)]
2660pub struct SequentialOptions {
2661 pub tile_height: i32,
2664}
2665
2666impl std::default::Default for SequentialOptions {
2667 fn default() -> Self {
2668 SequentialOptions {
2669 tile_height: i32::from(1),
2670 }
2671 }
2672}
2673
2674pub fn sequential_with_opts(
2679 inp: &VipsImage,
2680 sequential_options: &SequentialOptions,
2681) -> Result<VipsImage> {
2682 unsafe {
2683 let inp_in: *mut bindings::VipsImage = inp.ctx;
2684 let mut out_out: *mut bindings::VipsImage = null_mut();
2685
2686 let tile_height_in: i32 = sequential_options.tile_height;
2687 let tile_height_in_name = utils::new_c_string("tile-height")?;
2688
2689 let vips_op_response = bindings::vips_sequential(
2690 inp_in,
2691 &mut out_out,
2692 tile_height_in_name.as_ptr(),
2693 tile_height_in,
2694 NULL,
2695 );
2696 utils::result(
2697 vips_op_response,
2698 VipsImage { ctx: out_out },
2699 Error::SequentialError,
2700 )
2701 }
2702}
2703
2704pub fn cache(inp: &VipsImage) -> Result<VipsImage> {
2708 unsafe {
2709 let inp_in: *mut bindings::VipsImage = inp.ctx;
2710 let mut out_out: *mut bindings::VipsImage = null_mut();
2711
2712 let vips_op_response = bindings::vips_cache(inp_in, &mut out_out, NULL);
2713 utils::result(
2714 vips_op_response,
2715 VipsImage { ctx: out_out },
2716 Error::CacheError,
2717 )
2718 }
2719}
2720
2721#[derive(Clone, Debug)]
2723pub struct CacheOptions {
2724 pub max_tiles: i32,
2727 pub tile_height: i32,
2730 pub tile_width: i32,
2733}
2734
2735impl std::default::Default for CacheOptions {
2736 fn default() -> Self {
2737 CacheOptions {
2738 max_tiles: i32::from(1000),
2739 tile_height: i32::from(128),
2740 tile_width: i32::from(128),
2741 }
2742 }
2743}
2744
2745pub fn cache_with_opts(inp: &VipsImage, cache_options: &CacheOptions) -> Result<VipsImage> {
2750 unsafe {
2751 let inp_in: *mut bindings::VipsImage = inp.ctx;
2752 let mut out_out: *mut bindings::VipsImage = null_mut();
2753
2754 let max_tiles_in: i32 = cache_options.max_tiles;
2755 let max_tiles_in_name = utils::new_c_string("max-tiles")?;
2756
2757 let tile_height_in: i32 = cache_options.tile_height;
2758 let tile_height_in_name = utils::new_c_string("tile-height")?;
2759
2760 let tile_width_in: i32 = cache_options.tile_width;
2761 let tile_width_in_name = utils::new_c_string("tile-width")?;
2762
2763 let vips_op_response = bindings::vips_cache(
2764 inp_in,
2765 &mut out_out,
2766 max_tiles_in_name.as_ptr(),
2767 max_tiles_in,
2768 tile_height_in_name.as_ptr(),
2769 tile_height_in,
2770 tile_width_in_name.as_ptr(),
2771 tile_width_in,
2772 NULL,
2773 );
2774 utils::result(
2775 vips_op_response,
2776 VipsImage { ctx: out_out },
2777 Error::CacheError,
2778 )
2779 }
2780}
2781
2782pub fn embed(inp: &VipsImage, x: i32, y: i32, width: i32, height: i32) -> Result<VipsImage> {
2794 unsafe {
2795 let inp_in: *mut bindings::VipsImage = inp.ctx;
2796 let x_in: i32 = x;
2797 let y_in: i32 = y;
2798 let width_in: i32 = width;
2799 let height_in: i32 = height;
2800 let mut out_out: *mut bindings::VipsImage = null_mut();
2801
2802 let vips_op_response =
2803 bindings::vips_embed(inp_in, &mut out_out, x_in, y_in, width_in, height_in, NULL);
2804 utils::result(
2805 vips_op_response,
2806 VipsImage { ctx: out_out },
2807 Error::EmbedError,
2808 )
2809 }
2810}
2811
2812#[derive(Clone, Debug)]
2814pub struct EmbedOptions {
2815 pub extend: Extend,
2824 pub background: Vec<f64>,
2826}
2827
2828impl std::default::Default for EmbedOptions {
2829 fn default() -> Self {
2830 EmbedOptions {
2831 extend: Extend::Black,
2832 background: Vec::new(),
2833 }
2834 }
2835}
2836
2837pub fn embed_with_opts(
2850 inp: &VipsImage,
2851 x: i32,
2852 y: i32,
2853 width: i32,
2854 height: i32,
2855 embed_options: &EmbedOptions,
2856) -> Result<VipsImage> {
2857 unsafe {
2858 let inp_in: *mut bindings::VipsImage = inp.ctx;
2859 let x_in: i32 = x;
2860 let y_in: i32 = y;
2861 let width_in: i32 = width;
2862 let height_in: i32 = height;
2863 let mut out_out: *mut bindings::VipsImage = null_mut();
2864
2865 let extend_in: i32 = embed_options.extend as i32;
2866 let extend_in_name = utils::new_c_string("extend")?;
2867
2868 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&embed_options.background[..]);
2869 let background_in = background_wrapper.ctx;
2870 let background_in_name = utils::new_c_string("background")?;
2871
2872 let vips_op_response = bindings::vips_embed(
2873 inp_in,
2874 &mut out_out,
2875 x_in,
2876 y_in,
2877 width_in,
2878 height_in,
2879 extend_in_name.as_ptr(),
2880 extend_in,
2881 background_in_name.as_ptr(),
2882 background_in,
2883 NULL,
2884 );
2885 utils::result(
2886 vips_op_response,
2887 VipsImage { ctx: out_out },
2888 Error::EmbedError,
2889 )
2890 }
2891}
2892
2893pub fn gravity(
2912 inp: &VipsImage,
2913 direction: CompassDirection,
2914 width: i32,
2915 height: i32,
2916) -> Result<VipsImage> {
2917 unsafe {
2918 let inp_in: *mut bindings::VipsImage = inp.ctx;
2919 let direction_in: i32 = direction as i32;
2920 let width_in: i32 = width;
2921 let height_in: i32 = height;
2922 let mut out_out: *mut bindings::VipsImage = null_mut();
2923
2924 let vips_op_response = bindings::vips_gravity(
2925 inp_in,
2926 &mut out_out,
2927 direction_in.try_into().unwrap(),
2928 width_in,
2929 height_in,
2930 NULL,
2931 );
2932 utils::result(
2933 vips_op_response,
2934 VipsImage { ctx: out_out },
2935 Error::GravityError,
2936 )
2937 }
2938}
2939
2940#[derive(Clone, Debug)]
2942pub struct GravityOptions {
2943 pub extend: Extend,
2952 pub background: Vec<f64>,
2954}
2955
2956impl std::default::Default for GravityOptions {
2957 fn default() -> Self {
2958 GravityOptions {
2959 extend: Extend::Black,
2960 background: Vec::new(),
2961 }
2962 }
2963}
2964
2965pub fn gravity_with_opts(
2985 inp: &VipsImage,
2986 direction: CompassDirection,
2987 width: i32,
2988 height: i32,
2989 gravity_options: &GravityOptions,
2990) -> Result<VipsImage> {
2991 unsafe {
2992 let inp_in: *mut bindings::VipsImage = inp.ctx;
2993 let direction_in: i32 = direction as i32;
2994 let width_in: i32 = width;
2995 let height_in: i32 = height;
2996 let mut out_out: *mut bindings::VipsImage = null_mut();
2997
2998 let extend_in: i32 = gravity_options.extend as i32;
2999 let extend_in_name = utils::new_c_string("extend")?;
3000
3001 let background_wrapper =
3002 utils::VipsArrayDoubleWrapper::from(&gravity_options.background[..]);
3003 let background_in = background_wrapper.ctx;
3004 let background_in_name = utils::new_c_string("background")?;
3005
3006 let vips_op_response = bindings::vips_gravity(
3007 inp_in,
3008 &mut out_out,
3009 direction_in.try_into().unwrap(),
3010 width_in,
3011 height_in,
3012 extend_in_name.as_ptr(),
3013 extend_in,
3014 background_in_name.as_ptr(),
3015 background_in,
3016 NULL,
3017 );
3018 utils::result(
3019 vips_op_response,
3020 VipsImage { ctx: out_out },
3021 Error::GravityError,
3022 )
3023 }
3024}
3025
3026pub fn flip(inp: &VipsImage, direction: Direction) -> Result<VipsImage> {
3034 unsafe {
3035 let inp_in: *mut bindings::VipsImage = inp.ctx;
3036 let direction_in: i32 = direction as i32;
3037 let mut out_out: *mut bindings::VipsImage = null_mut();
3038
3039 let vips_op_response =
3040 bindings::vips_flip(inp_in, &mut out_out, direction_in.try_into().unwrap(), NULL);
3041 utils::result(
3042 vips_op_response,
3043 VipsImage { ctx: out_out },
3044 Error::FlipError,
3045 )
3046 }
3047}
3048
3049pub fn insert(main: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<VipsImage> {
3058 unsafe {
3059 let main_in: *mut bindings::VipsImage = main.ctx;
3060 let sub_in: *mut bindings::VipsImage = sub.ctx;
3061 let x_in: i32 = x;
3062 let y_in: i32 = y;
3063 let mut out_out: *mut bindings::VipsImage = null_mut();
3064
3065 let vips_op_response =
3066 bindings::vips_insert(main_in, sub_in, &mut out_out, x_in, y_in, NULL);
3067 utils::result(
3068 vips_op_response,
3069 VipsImage { ctx: out_out },
3070 Error::InsertError,
3071 )
3072 }
3073}
3074
3075#[derive(Clone, Debug)]
3077pub struct InsertOptions {
3078 pub expand: bool,
3081 pub background: Vec<f64>,
3083}
3084
3085impl std::default::Default for InsertOptions {
3086 fn default() -> Self {
3087 InsertOptions {
3088 expand: false,
3089 background: Vec::new(),
3090 }
3091 }
3092}
3093
3094pub fn insert_with_opts(
3104 main: &VipsImage,
3105 sub: &VipsImage,
3106 x: i32,
3107 y: i32,
3108 insert_options: &InsertOptions,
3109) -> Result<VipsImage> {
3110 unsafe {
3111 let main_in: *mut bindings::VipsImage = main.ctx;
3112 let sub_in: *mut bindings::VipsImage = sub.ctx;
3113 let x_in: i32 = x;
3114 let y_in: i32 = y;
3115 let mut out_out: *mut bindings::VipsImage = null_mut();
3116
3117 let expand_in: i32 = if insert_options.expand { 1 } else { 0 };
3118 let expand_in_name = utils::new_c_string("expand")?;
3119
3120 let background_wrapper =
3121 utils::VipsArrayDoubleWrapper::from(&insert_options.background[..]);
3122 let background_in = background_wrapper.ctx;
3123 let background_in_name = utils::new_c_string("background")?;
3124
3125 let vips_op_response = bindings::vips_insert(
3126 main_in,
3127 sub_in,
3128 &mut out_out,
3129 x_in,
3130 y_in,
3131 expand_in_name.as_ptr(),
3132 expand_in,
3133 background_in_name.as_ptr(),
3134 background_in,
3135 NULL,
3136 );
3137 utils::result(
3138 vips_op_response,
3139 VipsImage { ctx: out_out },
3140 Error::InsertError,
3141 )
3142 }
3143}
3144
3145pub fn join(in_1: &VipsImage, in_2: &VipsImage, direction: Direction) -> Result<VipsImage> {
3154 unsafe {
3155 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3156 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3157 let direction_in: i32 = direction as i32;
3158 let mut out_out: *mut bindings::VipsImage = null_mut();
3159
3160 let vips_op_response = bindings::vips_join(
3161 in_1_in,
3162 in_2_in,
3163 &mut out_out,
3164 direction_in.try_into().unwrap(),
3165 NULL,
3166 );
3167 utils::result(
3168 vips_op_response,
3169 VipsImage { ctx: out_out },
3170 Error::JoinError,
3171 )
3172 }
3173}
3174
3175#[derive(Clone, Debug)]
3177pub struct JoinOptions {
3178 pub expand: bool,
3181 pub shim: i32,
3184 pub background: Vec<f64>,
3186 pub align: Align,
3192}
3193
3194impl std::default::Default for JoinOptions {
3195 fn default() -> Self {
3196 JoinOptions {
3197 expand: false,
3198 shim: i32::from(0),
3199 background: Vec::new(),
3200 align: Align::Low,
3201 }
3202 }
3203}
3204
3205pub fn join_with_opts(
3215 in_1: &VipsImage,
3216 in_2: &VipsImage,
3217 direction: Direction,
3218 join_options: &JoinOptions,
3219) -> Result<VipsImage> {
3220 unsafe {
3221 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
3222 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
3223 let direction_in: i32 = direction as i32;
3224 let mut out_out: *mut bindings::VipsImage = null_mut();
3225
3226 let expand_in: i32 = if join_options.expand { 1 } else { 0 };
3227 let expand_in_name = utils::new_c_string("expand")?;
3228
3229 let shim_in: i32 = join_options.shim;
3230 let shim_in_name = utils::new_c_string("shim")?;
3231
3232 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&join_options.background[..]);
3233 let background_in = background_wrapper.ctx;
3234 let background_in_name = utils::new_c_string("background")?;
3235
3236 let align_in: i32 = join_options.align as i32;
3237 let align_in_name = utils::new_c_string("align")?;
3238
3239 let vips_op_response = bindings::vips_join(
3240 in_1_in,
3241 in_2_in,
3242 &mut out_out,
3243 direction_in.try_into().unwrap(),
3244 expand_in_name.as_ptr(),
3245 expand_in,
3246 shim_in_name.as_ptr(),
3247 shim_in,
3248 background_in_name.as_ptr(),
3249 background_in,
3250 align_in_name.as_ptr(),
3251 align_in,
3252 NULL,
3253 );
3254 utils::result(
3255 vips_op_response,
3256 VipsImage { ctx: out_out },
3257 Error::JoinError,
3258 )
3259 }
3260}
3261
3262pub fn arrayjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3266 unsafe {
3267 let (inp_len, mut inp_in) = {
3268 let len = inp.len();
3269 let mut input = Vec::new();
3270 for img in inp {
3271 input.push(img.ctx)
3272 }
3273 (len as i32, input)
3274 };
3275 let mut out_out: *mut bindings::VipsImage = null_mut();
3276
3277 let vips_op_response =
3278 bindings::vips_arrayjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3279 utils::result(
3280 vips_op_response,
3281 VipsImage { ctx: out_out },
3282 Error::ArrayjoinError,
3283 )
3284 }
3285}
3286
3287#[derive(Clone, Debug)]
3289pub struct ArrayjoinOptions {
3290 pub across: i32,
3293 pub shim: i32,
3296 pub background: Vec<f64>,
3298 pub halign: Align,
3304 pub valign: Align,
3310 pub hspacing: i32,
3313 pub vspacing: i32,
3316}
3317
3318impl std::default::Default for ArrayjoinOptions {
3319 fn default() -> Self {
3320 ArrayjoinOptions {
3321 across: i32::from(1),
3322 shim: i32::from(0),
3323 background: Vec::new(),
3324 halign: Align::Low,
3325 valign: Align::Low,
3326 hspacing: i32::from(1),
3327 vspacing: i32::from(1),
3328 }
3329 }
3330}
3331
3332pub fn arrayjoin_with_opts(
3337 inp: &mut [VipsImage],
3338 arrayjoin_options: &ArrayjoinOptions,
3339) -> Result<VipsImage> {
3340 unsafe {
3341 let (inp_len, mut inp_in) = {
3342 let len = inp.len();
3343 let mut input = Vec::new();
3344 for img in inp {
3345 input.push(img.ctx)
3346 }
3347 (len as i32, input)
3348 };
3349 let mut out_out: *mut bindings::VipsImage = null_mut();
3350
3351 let across_in: i32 = arrayjoin_options.across;
3352 let across_in_name = utils::new_c_string("across")?;
3353
3354 let shim_in: i32 = arrayjoin_options.shim;
3355 let shim_in_name = utils::new_c_string("shim")?;
3356
3357 let background_wrapper =
3358 utils::VipsArrayDoubleWrapper::from(&arrayjoin_options.background[..]);
3359 let background_in = background_wrapper.ctx;
3360 let background_in_name = utils::new_c_string("background")?;
3361
3362 let halign_in: i32 = arrayjoin_options.halign as i32;
3363 let halign_in_name = utils::new_c_string("halign")?;
3364
3365 let valign_in: i32 = arrayjoin_options.valign as i32;
3366 let valign_in_name = utils::new_c_string("valign")?;
3367
3368 let hspacing_in: i32 = arrayjoin_options.hspacing;
3369 let hspacing_in_name = utils::new_c_string("hspacing")?;
3370
3371 let vspacing_in: i32 = arrayjoin_options.vspacing;
3372 let vspacing_in_name = utils::new_c_string("vspacing")?;
3373
3374 let vips_op_response = bindings::vips_arrayjoin(
3375 inp_in.as_mut_ptr(),
3376 &mut out_out,
3377 inp_len,
3378 across_in_name.as_ptr(),
3379 across_in,
3380 shim_in_name.as_ptr(),
3381 shim_in,
3382 background_in_name.as_ptr(),
3383 background_in,
3384 halign_in_name.as_ptr(),
3385 halign_in,
3386 valign_in_name.as_ptr(),
3387 valign_in,
3388 hspacing_in_name.as_ptr(),
3389 hspacing_in,
3390 vspacing_in_name.as_ptr(),
3391 vspacing_in,
3392 NULL,
3393 );
3394 utils::result(
3395 vips_op_response,
3396 VipsImage { ctx: out_out },
3397 Error::ArrayjoinError,
3398 )
3399 }
3400}
3401
3402pub fn extract_area(
3414 input: &VipsImage,
3415 left: i32,
3416 top: i32,
3417 width: i32,
3418 height: i32,
3419) -> Result<VipsImage> {
3420 unsafe {
3421 let input_in: *mut bindings::VipsImage = input.ctx;
3422 let left_in: i32 = left;
3423 let top_in: i32 = top;
3424 let width_in: i32 = width;
3425 let height_in: i32 = height;
3426 let mut out_out: *mut bindings::VipsImage = null_mut();
3427
3428 let vips_op_response = bindings::vips_extract_area(
3429 input_in,
3430 &mut out_out,
3431 left_in,
3432 top_in,
3433 width_in,
3434 height_in,
3435 NULL,
3436 );
3437 utils::result(
3438 vips_op_response,
3439 VipsImage { ctx: out_out },
3440 Error::ExtractAreaError,
3441 )
3442 }
3443}
3444
3445pub fn smartcrop(input: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
3453 unsafe {
3454 let input_in: *mut bindings::VipsImage = input.ctx;
3455 let width_in: i32 = width;
3456 let height_in: i32 = height;
3457 let mut out_out: *mut bindings::VipsImage = null_mut();
3458
3459 let vips_op_response =
3460 bindings::vips_smartcrop(input_in, &mut out_out, width_in, height_in, NULL);
3461 utils::result(
3462 vips_op_response,
3463 VipsImage { ctx: out_out },
3464 Error::SmartcropError,
3465 )
3466 }
3467}
3468
3469#[derive(Clone, Debug)]
3471pub struct SmartcropOptions {
3472 pub attention_x: i32,
3475 pub attention_y: i32,
3478 pub interesting: Interesting,
3488 pub premultiplied: bool,
3491}
3492
3493impl std::default::Default for SmartcropOptions {
3494 fn default() -> Self {
3495 SmartcropOptions {
3496 attention_x: i32::from(0),
3497 attention_y: i32::from(0),
3498 interesting: Interesting::Attention,
3499 premultiplied: false,
3500 }
3501 }
3502}
3503
3504pub fn smartcrop_with_opts(
3513 input: &VipsImage,
3514 width: i32,
3515 height: i32,
3516 smartcrop_options: &SmartcropOptions,
3517) -> Result<VipsImage> {
3518 unsafe {
3519 let input_in: *mut bindings::VipsImage = input.ctx;
3520 let width_in: i32 = width;
3521 let height_in: i32 = height;
3522 let mut out_out: *mut bindings::VipsImage = null_mut();
3523
3524 let attention_x_in: i32 = smartcrop_options.attention_x;
3525 let attention_x_in_name = utils::new_c_string("attention-x")?;
3526
3527 let attention_y_in: i32 = smartcrop_options.attention_y;
3528 let attention_y_in_name = utils::new_c_string("attention-y")?;
3529
3530 let interesting_in: i32 = smartcrop_options.interesting as i32;
3531 let interesting_in_name = utils::new_c_string("interesting")?;
3532
3533 let premultiplied_in: i32 = if smartcrop_options.premultiplied {
3534 1
3535 } else {
3536 0
3537 };
3538 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
3539
3540 let vips_op_response = bindings::vips_smartcrop(
3541 input_in,
3542 &mut out_out,
3543 width_in,
3544 height_in,
3545 attention_x_in_name.as_ptr(),
3546 attention_x_in,
3547 attention_y_in_name.as_ptr(),
3548 attention_y_in,
3549 interesting_in_name.as_ptr(),
3550 interesting_in,
3551 premultiplied_in_name.as_ptr(),
3552 premultiplied_in,
3553 NULL,
3554 );
3555 utils::result(
3556 vips_op_response,
3557 VipsImage { ctx: out_out },
3558 Error::SmartcropError,
3559 )
3560 }
3561}
3562
3563pub fn extract_band(inp: &VipsImage, band: i32) -> Result<VipsImage> {
3569 unsafe {
3570 let inp_in: *mut bindings::VipsImage = inp.ctx;
3571 let band_in: i32 = band;
3572 let mut out_out: *mut bindings::VipsImage = null_mut();
3573
3574 let vips_op_response = bindings::vips_extract_band(inp_in, &mut out_out, band_in, NULL);
3575 utils::result(
3576 vips_op_response,
3577 VipsImage { ctx: out_out },
3578 Error::ExtractBandError,
3579 )
3580 }
3581}
3582
3583#[derive(Clone, Debug)]
3585pub struct ExtractBandOptions {
3586 pub n: i32,
3589}
3590
3591impl std::default::Default for ExtractBandOptions {
3592 fn default() -> Self {
3593 ExtractBandOptions { n: i32::from(1) }
3594 }
3595}
3596
3597pub fn extract_band_with_opts(
3604 inp: &VipsImage,
3605 band: i32,
3606 extract_band_options: &ExtractBandOptions,
3607) -> Result<VipsImage> {
3608 unsafe {
3609 let inp_in: *mut bindings::VipsImage = inp.ctx;
3610 let band_in: i32 = band;
3611 let mut out_out: *mut bindings::VipsImage = null_mut();
3612
3613 let n_in: i32 = extract_band_options.n;
3614 let n_in_name = utils::new_c_string("n")?;
3615
3616 let vips_op_response = bindings::vips_extract_band(
3617 inp_in,
3618 &mut out_out,
3619 band_in,
3620 n_in_name.as_ptr(),
3621 n_in,
3622 NULL,
3623 );
3624 utils::result(
3625 vips_op_response,
3626 VipsImage { ctx: out_out },
3627 Error::ExtractBandError,
3628 )
3629 }
3630}
3631
3632pub fn bandjoin(inp: &mut [VipsImage]) -> Result<VipsImage> {
3636 unsafe {
3637 let (inp_len, mut inp_in) = {
3638 let len = inp.len();
3639 let mut input = Vec::new();
3640 for img in inp {
3641 input.push(img.ctx)
3642 }
3643 (len as i32, input)
3644 };
3645 let mut out_out: *mut bindings::VipsImage = null_mut();
3646
3647 let vips_op_response =
3648 bindings::vips_bandjoin(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3649 utils::result(
3650 vips_op_response,
3651 VipsImage { ctx: out_out },
3652 Error::BandjoinError,
3653 )
3654 }
3655}
3656
3657pub fn bandjoin_const(inp: &VipsImage, c: &mut [f64]) -> Result<VipsImage> {
3662 unsafe {
3663 let inp_in: *mut bindings::VipsImage = inp.ctx;
3664 let c_in: *mut f64 = c.as_mut_ptr();
3665 let mut out_out: *mut bindings::VipsImage = null_mut();
3666
3667 let vips_op_response =
3668 bindings::vips_bandjoin_const(inp_in, &mut out_out, c_in, c.len() as i32, NULL);
3669 utils::result(
3670 vips_op_response,
3671 VipsImage { ctx: out_out },
3672 Error::BandjoinConstError,
3673 )
3674 }
3675}
3676
3677pub fn bandrank(inp: &mut [VipsImage]) -> Result<VipsImage> {
3681 unsafe {
3682 let (inp_len, mut inp_in) = {
3683 let len = inp.len();
3684 let mut input = Vec::new();
3685 for img in inp {
3686 input.push(img.ctx)
3687 }
3688 (len as i32, input)
3689 };
3690 let mut out_out: *mut bindings::VipsImage = null_mut();
3691
3692 let vips_op_response =
3693 bindings::vips_bandrank(inp_in.as_mut_ptr(), &mut out_out, inp_len, NULL);
3694 utils::result(
3695 vips_op_response,
3696 VipsImage { ctx: out_out },
3697 Error::BandrankError,
3698 )
3699 }
3700}
3701
3702#[derive(Clone, Debug)]
3704pub struct BandrankOptions {
3705 pub index: i32,
3708}
3709
3710impl std::default::Default for BandrankOptions {
3711 fn default() -> Self {
3712 BandrankOptions {
3713 index: i32::from(-1),
3714 }
3715 }
3716}
3717
3718pub fn bandrank_with_opts(
3723 inp: &mut [VipsImage],
3724 bandrank_options: &BandrankOptions,
3725) -> Result<VipsImage> {
3726 unsafe {
3727 let (inp_len, mut inp_in) = {
3728 let len = inp.len();
3729 let mut input = Vec::new();
3730 for img in inp {
3731 input.push(img.ctx)
3732 }
3733 (len as i32, input)
3734 };
3735 let mut out_out: *mut bindings::VipsImage = null_mut();
3736
3737 let index_in: i32 = bandrank_options.index;
3738 let index_in_name = utils::new_c_string("index")?;
3739
3740 let vips_op_response = bindings::vips_bandrank(
3741 inp_in.as_mut_ptr(),
3742 &mut out_out,
3743 inp_len,
3744 index_in_name.as_ptr(),
3745 index_in,
3746 NULL,
3747 );
3748 utils::result(
3749 vips_op_response,
3750 VipsImage { ctx: out_out },
3751 Error::BandrankError,
3752 )
3753 }
3754}
3755
3756pub fn bandmean(inp: &VipsImage) -> Result<VipsImage> {
3760 unsafe {
3761 let inp_in: *mut bindings::VipsImage = inp.ctx;
3762 let mut out_out: *mut bindings::VipsImage = null_mut();
3763
3764 let vips_op_response = bindings::vips_bandmean(inp_in, &mut out_out, NULL);
3765 utils::result(
3766 vips_op_response,
3767 VipsImage { ctx: out_out },
3768 Error::BandmeanError,
3769 )
3770 }
3771}
3772
3773pub fn bandbool(inp: &VipsImage, boolean: OperationBoolean) -> Result<VipsImage> {
3784 unsafe {
3785 let inp_in: *mut bindings::VipsImage = inp.ctx;
3786 let boolean_in: i32 = boolean as i32;
3787 let mut out_out: *mut bindings::VipsImage = null_mut();
3788
3789 let vips_op_response =
3790 bindings::vips_bandbool(inp_in, &mut out_out, boolean_in.try_into().unwrap(), NULL);
3791 utils::result(
3792 vips_op_response,
3793 VipsImage { ctx: out_out },
3794 Error::BandboolError,
3795 )
3796 }
3797}
3798
3799pub fn replicate(inp: &VipsImage, across: i32, down: i32) -> Result<VipsImage> {
3807 unsafe {
3808 let inp_in: *mut bindings::VipsImage = inp.ctx;
3809 let across_in: i32 = across;
3810 let down_in: i32 = down;
3811 let mut out_out: *mut bindings::VipsImage = null_mut();
3812
3813 let vips_op_response =
3814 bindings::vips_replicate(inp_in, &mut out_out, across_in, down_in, NULL);
3815 utils::result(
3816 vips_op_response,
3817 VipsImage { ctx: out_out },
3818 Error::ReplicateError,
3819 )
3820 }
3821}
3822
3823pub fn cast(inp: &VipsImage, format: BandFormat) -> Result<VipsImage> {
3840 unsafe {
3841 let inp_in: *mut bindings::VipsImage = inp.ctx;
3842 let format_in: i32 = format as i32;
3843 let mut out_out: *mut bindings::VipsImage = null_mut();
3844
3845 let vips_op_response =
3846 bindings::vips_cast(inp_in, &mut out_out, format_in.try_into().unwrap(), NULL);
3847 utils::result(
3848 vips_op_response,
3849 VipsImage { ctx: out_out },
3850 Error::CastError,
3851 )
3852 }
3853}
3854
3855#[derive(Clone, Debug)]
3857pub struct CastOptions {
3858 pub shift: bool,
3861}
3862
3863impl std::default::Default for CastOptions {
3864 fn default() -> Self {
3865 CastOptions { shift: false }
3866 }
3867}
3868
3869pub fn cast_with_opts(
3887 inp: &VipsImage,
3888 format: BandFormat,
3889 cast_options: &CastOptions,
3890) -> Result<VipsImage> {
3891 unsafe {
3892 let inp_in: *mut bindings::VipsImage = inp.ctx;
3893 let format_in: i32 = format as i32;
3894 let mut out_out: *mut bindings::VipsImage = null_mut();
3895
3896 let shift_in: i32 = if cast_options.shift { 1 } else { 0 };
3897 let shift_in_name = utils::new_c_string("shift")?;
3898
3899 let vips_op_response = bindings::vips_cast(
3900 inp_in,
3901 &mut out_out,
3902 format_in.try_into().unwrap(),
3903 shift_in_name.as_ptr(),
3904 shift_in,
3905 NULL,
3906 );
3907 utils::result(
3908 vips_op_response,
3909 VipsImage { ctx: out_out },
3910 Error::CastError,
3911 )
3912 }
3913}
3914
3915pub fn rot(inp: &VipsImage, angle: Angle) -> Result<VipsImage> {
3925 unsafe {
3926 let inp_in: *mut bindings::VipsImage = inp.ctx;
3927 let angle_in: i32 = angle as i32;
3928 let mut out_out: *mut bindings::VipsImage = null_mut();
3929
3930 let vips_op_response =
3931 bindings::vips_rot(inp_in, &mut out_out, angle_in.try_into().unwrap(), NULL);
3932 utils::result(
3933 vips_op_response,
3934 VipsImage { ctx: out_out },
3935 Error::RotError,
3936 )
3937 }
3938}
3939
3940pub fn rot_45(inp: &VipsImage) -> Result<VipsImage> {
3944 unsafe {
3945 let inp_in: *mut bindings::VipsImage = inp.ctx;
3946 let mut out_out: *mut bindings::VipsImage = null_mut();
3947
3948 let vips_op_response = bindings::vips_rot45(inp_in, &mut out_out, NULL);
3949 utils::result(
3950 vips_op_response,
3951 VipsImage { ctx: out_out },
3952 Error::Rot45Error,
3953 )
3954 }
3955}
3956
3957#[derive(Clone, Debug)]
3959pub struct Rot45Options {
3960 pub angle: Angle45,
3971}
3972
3973impl std::default::Default for Rot45Options {
3974 fn default() -> Self {
3975 Rot45Options {
3976 angle: Angle45::D45,
3977 }
3978 }
3979}
3980
3981pub fn rot_45_with_opts(inp: &VipsImage, rot_45_options: &Rot45Options) -> Result<VipsImage> {
3986 unsafe {
3987 let inp_in: *mut bindings::VipsImage = inp.ctx;
3988 let mut out_out: *mut bindings::VipsImage = null_mut();
3989
3990 let angle_in: i32 = rot_45_options.angle as i32;
3991 let angle_in_name = utils::new_c_string("angle")?;
3992
3993 let vips_op_response =
3994 bindings::vips_rot45(inp_in, &mut out_out, angle_in_name.as_ptr(), angle_in, NULL);
3995 utils::result(
3996 vips_op_response,
3997 VipsImage { ctx: out_out },
3998 Error::Rot45Error,
3999 )
4000 }
4001}
4002
4003pub fn autorot(inp: &VipsImage) -> Result<VipsImage> {
4007 unsafe {
4008 let inp_in: *mut bindings::VipsImage = inp.ctx;
4009 let mut out_out: *mut bindings::VipsImage = null_mut();
4010
4011 let vips_op_response = bindings::vips_autorot(inp_in, &mut out_out, NULL);
4012 utils::result(
4013 vips_op_response,
4014 VipsImage { ctx: out_out },
4015 Error::AutorotError,
4016 )
4017 }
4018}
4019
4020#[derive(Clone, Debug)]
4022pub struct AutorotOptions {
4023 pub angle: Angle,
4030 pub flip: bool,
4033}
4034
4035impl std::default::Default for AutorotOptions {
4036 fn default() -> Self {
4037 AutorotOptions {
4038 angle: Angle::D0,
4039 flip: false,
4040 }
4041 }
4042}
4043
4044pub fn autorot_with_opts(inp: &VipsImage, autorot_options: &AutorotOptions) -> Result<VipsImage> {
4049 unsafe {
4050 let inp_in: *mut bindings::VipsImage = inp.ctx;
4051 let mut out_out: *mut bindings::VipsImage = null_mut();
4052
4053 let angle_in: i32 = autorot_options.angle as i32;
4054 let angle_in_name = utils::new_c_string("angle")?;
4055
4056 let flip_in: i32 = if autorot_options.flip { 1 } else { 0 };
4057 let flip_in_name = utils::new_c_string("flip")?;
4058
4059 let vips_op_response = bindings::vips_autorot(
4060 inp_in,
4061 &mut out_out,
4062 angle_in_name.as_ptr(),
4063 angle_in,
4064 flip_in_name.as_ptr(),
4065 flip_in,
4066 NULL,
4067 );
4068 utils::result(
4069 vips_op_response,
4070 VipsImage { ctx: out_out },
4071 Error::AutorotError,
4072 )
4073 }
4074}
4075
4076pub fn ifthenelse(cond: &VipsImage, in_1: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
4082 unsafe {
4083 let cond_in: *mut bindings::VipsImage = cond.ctx;
4084 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4085 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4086 let mut out_out: *mut bindings::VipsImage = null_mut();
4087
4088 let vips_op_response =
4089 bindings::vips_ifthenelse(cond_in, in_1_in, in_2_in, &mut out_out, NULL);
4090 utils::result(
4091 vips_op_response,
4092 VipsImage { ctx: out_out },
4093 Error::IfthenelseError,
4094 )
4095 }
4096}
4097
4098#[derive(Clone, Debug)]
4100pub struct IfthenelseOptions {
4101 pub blend: bool,
4104}
4105
4106impl std::default::Default for IfthenelseOptions {
4107 fn default() -> Self {
4108 IfthenelseOptions { blend: false }
4109 }
4110}
4111
4112pub fn ifthenelse_with_opts(
4119 cond: &VipsImage,
4120 in_1: &VipsImage,
4121 in_2: &VipsImage,
4122 ifthenelse_options: &IfthenelseOptions,
4123) -> Result<VipsImage> {
4124 unsafe {
4125 let cond_in: *mut bindings::VipsImage = cond.ctx;
4126 let in_1_in: *mut bindings::VipsImage = in_1.ctx;
4127 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
4128 let mut out_out: *mut bindings::VipsImage = null_mut();
4129
4130 let blend_in: i32 = if ifthenelse_options.blend { 1 } else { 0 };
4131 let blend_in_name = utils::new_c_string("blend")?;
4132
4133 let vips_op_response = bindings::vips_ifthenelse(
4134 cond_in,
4135 in_1_in,
4136 in_2_in,
4137 &mut out_out,
4138 blend_in_name.as_ptr(),
4139 blend_in,
4140 NULL,
4141 );
4142 utils::result(
4143 vips_op_response,
4144 VipsImage { ctx: out_out },
4145 Error::IfthenelseError,
4146 )
4147 }
4148}
4149
4150pub fn recomb(inp: &VipsImage, m: &VipsImage) -> Result<VipsImage> {
4155 unsafe {
4156 let inp_in: *mut bindings::VipsImage = inp.ctx;
4157 let m_in: *mut bindings::VipsImage = m.ctx;
4158 let mut out_out: *mut bindings::VipsImage = null_mut();
4159
4160 let vips_op_response = bindings::vips_recomb(inp_in, &mut out_out, m_in, NULL);
4161 utils::result(
4162 vips_op_response,
4163 VipsImage { ctx: out_out },
4164 Error::RecombError,
4165 )
4166 }
4167}
4168
4169pub fn bandfold(inp: &VipsImage) -> Result<VipsImage> {
4173 unsafe {
4174 let inp_in: *mut bindings::VipsImage = inp.ctx;
4175 let mut out_out: *mut bindings::VipsImage = null_mut();
4176
4177 let vips_op_response = bindings::vips_bandfold(inp_in, &mut out_out, NULL);
4178 utils::result(
4179 vips_op_response,
4180 VipsImage { ctx: out_out },
4181 Error::BandfoldError,
4182 )
4183 }
4184}
4185
4186#[derive(Clone, Debug)]
4188pub struct BandfoldOptions {
4189 pub factor: i32,
4192}
4193
4194impl std::default::Default for BandfoldOptions {
4195 fn default() -> Self {
4196 BandfoldOptions {
4197 factor: i32::from(0),
4198 }
4199 }
4200}
4201
4202pub fn bandfold_with_opts(
4207 inp: &VipsImage,
4208 bandfold_options: &BandfoldOptions,
4209) -> Result<VipsImage> {
4210 unsafe {
4211 let inp_in: *mut bindings::VipsImage = inp.ctx;
4212 let mut out_out: *mut bindings::VipsImage = null_mut();
4213
4214 let factor_in: i32 = bandfold_options.factor;
4215 let factor_in_name = utils::new_c_string("factor")?;
4216
4217 let vips_op_response = bindings::vips_bandfold(
4218 inp_in,
4219 &mut out_out,
4220 factor_in_name.as_ptr(),
4221 factor_in,
4222 NULL,
4223 );
4224 utils::result(
4225 vips_op_response,
4226 VipsImage { ctx: out_out },
4227 Error::BandfoldError,
4228 )
4229 }
4230}
4231
4232pub fn bandunfold(inp: &VipsImage) -> Result<VipsImage> {
4236 unsafe {
4237 let inp_in: *mut bindings::VipsImage = inp.ctx;
4238 let mut out_out: *mut bindings::VipsImage = null_mut();
4239
4240 let vips_op_response = bindings::vips_bandunfold(inp_in, &mut out_out, NULL);
4241 utils::result(
4242 vips_op_response,
4243 VipsImage { ctx: out_out },
4244 Error::BandunfoldError,
4245 )
4246 }
4247}
4248
4249#[derive(Clone, Debug)]
4251pub struct BandunfoldOptions {
4252 pub factor: i32,
4255}
4256
4257impl std::default::Default for BandunfoldOptions {
4258 fn default() -> Self {
4259 BandunfoldOptions {
4260 factor: i32::from(0),
4261 }
4262 }
4263}
4264
4265pub fn bandunfold_with_opts(
4270 inp: &VipsImage,
4271 bandunfold_options: &BandunfoldOptions,
4272) -> Result<VipsImage> {
4273 unsafe {
4274 let inp_in: *mut bindings::VipsImage = inp.ctx;
4275 let mut out_out: *mut bindings::VipsImage = null_mut();
4276
4277 let factor_in: i32 = bandunfold_options.factor;
4278 let factor_in_name = utils::new_c_string("factor")?;
4279
4280 let vips_op_response = bindings::vips_bandunfold(
4281 inp_in,
4282 &mut out_out,
4283 factor_in_name.as_ptr(),
4284 factor_in,
4285 NULL,
4286 );
4287 utils::result(
4288 vips_op_response,
4289 VipsImage { ctx: out_out },
4290 Error::BandunfoldError,
4291 )
4292 }
4293}
4294
4295pub fn flatten(inp: &VipsImage) -> Result<VipsImage> {
4299 unsafe {
4300 let inp_in: *mut bindings::VipsImage = inp.ctx;
4301 let mut out_out: *mut bindings::VipsImage = null_mut();
4302
4303 let vips_op_response = bindings::vips_flatten(inp_in, &mut out_out, NULL);
4304 utils::result(
4305 vips_op_response,
4306 VipsImage { ctx: out_out },
4307 Error::FlattenError,
4308 )
4309 }
4310}
4311
4312#[derive(Clone, Debug)]
4314pub struct FlattenOptions {
4315 pub background: Vec<f64>,
4317 pub max_alpha: f64,
4320}
4321
4322impl std::default::Default for FlattenOptions {
4323 fn default() -> Self {
4324 FlattenOptions {
4325 background: Vec::new(),
4326 max_alpha: f64::from(255),
4327 }
4328 }
4329}
4330
4331pub fn flatten_with_opts(inp: &VipsImage, flatten_options: &FlattenOptions) -> Result<VipsImage> {
4336 unsafe {
4337 let inp_in: *mut bindings::VipsImage = inp.ctx;
4338 let mut out_out: *mut bindings::VipsImage = null_mut();
4339
4340 let background_wrapper =
4341 utils::VipsArrayDoubleWrapper::from(&flatten_options.background[..]);
4342 let background_in = background_wrapper.ctx;
4343 let background_in_name = utils::new_c_string("background")?;
4344
4345 let max_alpha_in: f64 = flatten_options.max_alpha;
4346 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4347
4348 let vips_op_response = bindings::vips_flatten(
4349 inp_in,
4350 &mut out_out,
4351 background_in_name.as_ptr(),
4352 background_in,
4353 max_alpha_in_name.as_ptr(),
4354 max_alpha_in,
4355 NULL,
4356 );
4357 utils::result(
4358 vips_op_response,
4359 VipsImage { ctx: out_out },
4360 Error::FlattenError,
4361 )
4362 }
4363}
4364
4365pub fn premultiply(inp: &VipsImage) -> Result<VipsImage> {
4369 unsafe {
4370 let inp_in: *mut bindings::VipsImage = inp.ctx;
4371 let mut out_out: *mut bindings::VipsImage = null_mut();
4372
4373 let vips_op_response = bindings::vips_premultiply(inp_in, &mut out_out, NULL);
4374 utils::result(
4375 vips_op_response,
4376 VipsImage { ctx: out_out },
4377 Error::PremultiplyError,
4378 )
4379 }
4380}
4381
4382#[derive(Clone, Debug)]
4384pub struct PremultiplyOptions {
4385 pub max_alpha: f64,
4388}
4389
4390impl std::default::Default for PremultiplyOptions {
4391 fn default() -> Self {
4392 PremultiplyOptions {
4393 max_alpha: f64::from(255),
4394 }
4395 }
4396}
4397
4398pub fn premultiply_with_opts(
4403 inp: &VipsImage,
4404 premultiply_options: &PremultiplyOptions,
4405) -> Result<VipsImage> {
4406 unsafe {
4407 let inp_in: *mut bindings::VipsImage = inp.ctx;
4408 let mut out_out: *mut bindings::VipsImage = null_mut();
4409
4410 let max_alpha_in: f64 = premultiply_options.max_alpha;
4411 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4412
4413 let vips_op_response = bindings::vips_premultiply(
4414 inp_in,
4415 &mut out_out,
4416 max_alpha_in_name.as_ptr(),
4417 max_alpha_in,
4418 NULL,
4419 );
4420 utils::result(
4421 vips_op_response,
4422 VipsImage { ctx: out_out },
4423 Error::PremultiplyError,
4424 )
4425 }
4426}
4427
4428pub fn unpremultiply(inp: &VipsImage) -> Result<VipsImage> {
4432 unsafe {
4433 let inp_in: *mut bindings::VipsImage = inp.ctx;
4434 let mut out_out: *mut bindings::VipsImage = null_mut();
4435
4436 let vips_op_response = bindings::vips_unpremultiply(inp_in, &mut out_out, NULL);
4437 utils::result(
4438 vips_op_response,
4439 VipsImage { ctx: out_out },
4440 Error::UnpremultiplyError,
4441 )
4442 }
4443}
4444
4445#[derive(Clone, Debug)]
4447pub struct UnpremultiplyOptions {
4448 pub max_alpha: f64,
4451 pub alpha_band: i32,
4454}
4455
4456impl std::default::Default for UnpremultiplyOptions {
4457 fn default() -> Self {
4458 UnpremultiplyOptions {
4459 max_alpha: f64::from(255),
4460 alpha_band: i32::from(3),
4461 }
4462 }
4463}
4464
4465pub fn unpremultiply_with_opts(
4470 inp: &VipsImage,
4471 unpremultiply_options: &UnpremultiplyOptions,
4472) -> Result<VipsImage> {
4473 unsafe {
4474 let inp_in: *mut bindings::VipsImage = inp.ctx;
4475 let mut out_out: *mut bindings::VipsImage = null_mut();
4476
4477 let max_alpha_in: f64 = unpremultiply_options.max_alpha;
4478 let max_alpha_in_name = utils::new_c_string("max-alpha")?;
4479
4480 let alpha_band_in: i32 = unpremultiply_options.alpha_band;
4481 let alpha_band_in_name = utils::new_c_string("alpha-band")?;
4482
4483 let vips_op_response = bindings::vips_unpremultiply(
4484 inp_in,
4485 &mut out_out,
4486 max_alpha_in_name.as_ptr(),
4487 max_alpha_in,
4488 alpha_band_in_name.as_ptr(),
4489 alpha_band_in,
4490 NULL,
4491 );
4492 utils::result(
4493 vips_op_response,
4494 VipsImage { ctx: out_out },
4495 Error::UnpremultiplyError,
4496 )
4497 }
4498}
4499
4500pub fn grid(inp: &VipsImage, tile_height: i32, across: i32, down: i32) -> Result<VipsImage> {
4510 unsafe {
4511 let inp_in: *mut bindings::VipsImage = inp.ctx;
4512 let tile_height_in: i32 = tile_height;
4513 let across_in: i32 = across;
4514 let down_in: i32 = down;
4515 let mut out_out: *mut bindings::VipsImage = null_mut();
4516
4517 let vips_op_response = bindings::vips_grid(
4518 inp_in,
4519 &mut out_out,
4520 tile_height_in,
4521 across_in,
4522 down_in,
4523 NULL,
4524 );
4525 utils::result(
4526 vips_op_response,
4527 VipsImage { ctx: out_out },
4528 Error::GridError,
4529 )
4530 }
4531}
4532
4533pub fn transpose_3d(inp: &VipsImage) -> Result<VipsImage> {
4537 unsafe {
4538 let inp_in: *mut bindings::VipsImage = inp.ctx;
4539 let mut out_out: *mut bindings::VipsImage = null_mut();
4540
4541 let vips_op_response = bindings::vips_transpose3d(inp_in, &mut out_out, NULL);
4542 utils::result(
4543 vips_op_response,
4544 VipsImage { ctx: out_out },
4545 Error::Transpose3DError,
4546 )
4547 }
4548}
4549
4550#[derive(Clone, Debug)]
4552pub struct Transpose3DOptions {
4553 pub page_height: i32,
4556}
4557
4558impl std::default::Default for Transpose3DOptions {
4559 fn default() -> Self {
4560 Transpose3DOptions {
4561 page_height: i32::from(0),
4562 }
4563 }
4564}
4565
4566pub fn transpose_3d_with_opts(
4571 inp: &VipsImage,
4572 transpose_3d_options: &Transpose3DOptions,
4573) -> Result<VipsImage> {
4574 unsafe {
4575 let inp_in: *mut bindings::VipsImage = inp.ctx;
4576 let mut out_out: *mut bindings::VipsImage = null_mut();
4577
4578 let page_height_in: i32 = transpose_3d_options.page_height;
4579 let page_height_in_name = utils::new_c_string("page-height")?;
4580
4581 let vips_op_response = bindings::vips_transpose3d(
4582 inp_in,
4583 &mut out_out,
4584 page_height_in_name.as_ptr(),
4585 page_height_in,
4586 NULL,
4587 );
4588 utils::result(
4589 vips_op_response,
4590 VipsImage { ctx: out_out },
4591 Error::Transpose3DError,
4592 )
4593 }
4594}
4595
4596pub fn scale(inp: &VipsImage) -> Result<VipsImage> {
4600 unsafe {
4601 let inp_in: *mut bindings::VipsImage = inp.ctx;
4602 let mut out_out: *mut bindings::VipsImage = null_mut();
4603
4604 let vips_op_response = bindings::vips_scale(inp_in, &mut out_out, NULL);
4605 utils::result(
4606 vips_op_response,
4607 VipsImage { ctx: out_out },
4608 Error::ScaleError,
4609 )
4610 }
4611}
4612
4613#[derive(Clone, Debug)]
4615pub struct ScaleOptions {
4616 pub exp: f64,
4619 pub log: bool,
4622}
4623
4624impl std::default::Default for ScaleOptions {
4625 fn default() -> Self {
4626 ScaleOptions {
4627 exp: f64::from(0.25),
4628 log: false,
4629 }
4630 }
4631}
4632
4633pub fn scale_with_opts(inp: &VipsImage, scale_options: &ScaleOptions) -> Result<VipsImage> {
4638 unsafe {
4639 let inp_in: *mut bindings::VipsImage = inp.ctx;
4640 let mut out_out: *mut bindings::VipsImage = null_mut();
4641
4642 let exp_in: f64 = scale_options.exp;
4643 let exp_in_name = utils::new_c_string("exp")?;
4644
4645 let log_in: i32 = if scale_options.log { 1 } else { 0 };
4646 let log_in_name = utils::new_c_string("log")?;
4647
4648 let vips_op_response = bindings::vips_scale(
4649 inp_in,
4650 &mut out_out,
4651 exp_in_name.as_ptr(),
4652 exp_in,
4653 log_in_name.as_ptr(),
4654 log_in,
4655 NULL,
4656 );
4657 utils::result(
4658 vips_op_response,
4659 VipsImage { ctx: out_out },
4660 Error::ScaleError,
4661 )
4662 }
4663}
4664
4665pub fn wrap(inp: &VipsImage) -> Result<VipsImage> {
4669 unsafe {
4670 let inp_in: *mut bindings::VipsImage = inp.ctx;
4671 let mut out_out: *mut bindings::VipsImage = null_mut();
4672
4673 let vips_op_response = bindings::vips_wrap(inp_in, &mut out_out, NULL);
4674 utils::result(
4675 vips_op_response,
4676 VipsImage { ctx: out_out },
4677 Error::WrapError,
4678 )
4679 }
4680}
4681
4682#[derive(Clone, Debug)]
4684pub struct WrapOptions {
4685 pub x: i32,
4688 pub y: i32,
4691}
4692
4693impl std::default::Default for WrapOptions {
4694 fn default() -> Self {
4695 WrapOptions {
4696 x: i32::from(0),
4697 y: i32::from(0),
4698 }
4699 }
4700}
4701
4702pub fn wrap_with_opts(inp: &VipsImage, wrap_options: &WrapOptions) -> Result<VipsImage> {
4707 unsafe {
4708 let inp_in: *mut bindings::VipsImage = inp.ctx;
4709 let mut out_out: *mut bindings::VipsImage = null_mut();
4710
4711 let x_in: i32 = wrap_options.x;
4712 let x_in_name = utils::new_c_string("x")?;
4713
4714 let y_in: i32 = wrap_options.y;
4715 let y_in_name = utils::new_c_string("y")?;
4716
4717 let vips_op_response = bindings::vips_wrap(
4718 inp_in,
4719 &mut out_out,
4720 x_in_name.as_ptr(),
4721 x_in,
4722 y_in_name.as_ptr(),
4723 y_in,
4724 NULL,
4725 );
4726 utils::result(
4727 vips_op_response,
4728 VipsImage { ctx: out_out },
4729 Error::WrapError,
4730 )
4731 }
4732}
4733
4734pub fn zoom(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4742 unsafe {
4743 let input_in: *mut bindings::VipsImage = input.ctx;
4744 let xfac_in: i32 = xfac;
4745 let yfac_in: i32 = yfac;
4746 let mut out_out: *mut bindings::VipsImage = null_mut();
4747
4748 let vips_op_response = bindings::vips_zoom(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4749 utils::result(
4750 vips_op_response,
4751 VipsImage { ctx: out_out },
4752 Error::ZoomError,
4753 )
4754 }
4755}
4756
4757pub fn subsample(input: &VipsImage, xfac: i32, yfac: i32) -> Result<VipsImage> {
4765 unsafe {
4766 let input_in: *mut bindings::VipsImage = input.ctx;
4767 let xfac_in: i32 = xfac;
4768 let yfac_in: i32 = yfac;
4769 let mut out_out: *mut bindings::VipsImage = null_mut();
4770
4771 let vips_op_response =
4772 bindings::vips_subsample(input_in, &mut out_out, xfac_in, yfac_in, NULL);
4773 utils::result(
4774 vips_op_response,
4775 VipsImage { ctx: out_out },
4776 Error::SubsampleError,
4777 )
4778 }
4779}
4780
4781#[derive(Clone, Debug)]
4783pub struct SubsampleOptions {
4784 pub point: bool,
4787}
4788
4789impl std::default::Default for SubsampleOptions {
4790 fn default() -> Self {
4791 SubsampleOptions { point: false }
4792 }
4793}
4794
4795pub fn subsample_with_opts(
4804 input: &VipsImage,
4805 xfac: i32,
4806 yfac: i32,
4807 subsample_options: &SubsampleOptions,
4808) -> Result<VipsImage> {
4809 unsafe {
4810 let input_in: *mut bindings::VipsImage = input.ctx;
4811 let xfac_in: i32 = xfac;
4812 let yfac_in: i32 = yfac;
4813 let mut out_out: *mut bindings::VipsImage = null_mut();
4814
4815 let point_in: i32 = if subsample_options.point { 1 } else { 0 };
4816 let point_in_name = utils::new_c_string("point")?;
4817
4818 let vips_op_response = bindings::vips_subsample(
4819 input_in,
4820 &mut out_out,
4821 xfac_in,
4822 yfac_in,
4823 point_in_name.as_ptr(),
4824 point_in,
4825 NULL,
4826 );
4827 utils::result(
4828 vips_op_response,
4829 VipsImage { ctx: out_out },
4830 Error::SubsampleError,
4831 )
4832 }
4833}
4834
4835pub fn msb(inp: &VipsImage) -> Result<VipsImage> {
4839 unsafe {
4840 let inp_in: *mut bindings::VipsImage = inp.ctx;
4841 let mut out_out: *mut bindings::VipsImage = null_mut();
4842
4843 let vips_op_response = bindings::vips_msb(inp_in, &mut out_out, NULL);
4844 utils::result(
4845 vips_op_response,
4846 VipsImage { ctx: out_out },
4847 Error::MsbError,
4848 )
4849 }
4850}
4851
4852#[derive(Clone, Debug)]
4854pub struct MsbOptions {
4855 pub band: i32,
4858}
4859
4860impl std::default::Default for MsbOptions {
4861 fn default() -> Self {
4862 MsbOptions { band: i32::from(0) }
4863 }
4864}
4865
4866pub fn msb_with_opts(inp: &VipsImage, msb_options: &MsbOptions) -> Result<VipsImage> {
4871 unsafe {
4872 let inp_in: *mut bindings::VipsImage = inp.ctx;
4873 let mut out_out: *mut bindings::VipsImage = null_mut();
4874
4875 let band_in: i32 = msb_options.band;
4876 let band_in_name = utils::new_c_string("band")?;
4877
4878 let vips_op_response =
4879 bindings::vips_msb(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
4880 utils::result(
4881 vips_op_response,
4882 VipsImage { ctx: out_out },
4883 Error::MsbError,
4884 )
4885 }
4886}
4887
4888pub fn byteswap(inp: &VipsImage) -> Result<VipsImage> {
4892 unsafe {
4893 let inp_in: *mut bindings::VipsImage = inp.ctx;
4894 let mut out_out: *mut bindings::VipsImage = null_mut();
4895
4896 let vips_op_response = bindings::vips_byteswap(inp_in, &mut out_out, NULL);
4897 utils::result(
4898 vips_op_response,
4899 VipsImage { ctx: out_out },
4900 Error::ByteswapError,
4901 )
4902 }
4903}
4904
4905pub fn falsecolour(inp: &VipsImage) -> Result<VipsImage> {
4909 unsafe {
4910 let inp_in: *mut bindings::VipsImage = inp.ctx;
4911 let mut out_out: *mut bindings::VipsImage = null_mut();
4912
4913 let vips_op_response = bindings::vips_falsecolour(inp_in, &mut out_out, NULL);
4914 utils::result(
4915 vips_op_response,
4916 VipsImage { ctx: out_out },
4917 Error::FalsecolourError,
4918 )
4919 }
4920}
4921
4922pub fn gamma(inp: &VipsImage) -> Result<VipsImage> {
4926 unsafe {
4927 let inp_in: *mut bindings::VipsImage = inp.ctx;
4928 let mut out_out: *mut bindings::VipsImage = null_mut();
4929
4930 let vips_op_response = bindings::vips_gamma(inp_in, &mut out_out, NULL);
4931 utils::result(
4932 vips_op_response,
4933 VipsImage { ctx: out_out },
4934 Error::GammaError,
4935 )
4936 }
4937}
4938
4939#[derive(Clone, Debug)]
4941pub struct GammaOptions {
4942 pub exponent: f64,
4945}
4946
4947impl std::default::Default for GammaOptions {
4948 fn default() -> Self {
4949 GammaOptions {
4950 exponent: f64::from(2.4),
4951 }
4952 }
4953}
4954
4955pub fn gamma_with_opts(inp: &VipsImage, gamma_options: &GammaOptions) -> Result<VipsImage> {
4960 unsafe {
4961 let inp_in: *mut bindings::VipsImage = inp.ctx;
4962 let mut out_out: *mut bindings::VipsImage = null_mut();
4963
4964 let exponent_in: f64 = gamma_options.exponent;
4965 let exponent_in_name = utils::new_c_string("exponent")?;
4966
4967 let vips_op_response = bindings::vips_gamma(
4968 inp_in,
4969 &mut out_out,
4970 exponent_in_name.as_ptr(),
4971 exponent_in,
4972 NULL,
4973 );
4974 utils::result(
4975 vips_op_response,
4976 VipsImage { ctx: out_out },
4977 Error::GammaError,
4978 )
4979 }
4980}
4981
4982pub fn composite(inp: &mut [VipsImage], mode: &mut [i32]) -> Result<VipsImage> {
4987 unsafe {
4988 let (inp_len, mut inp_in) = {
4989 let len = inp.len();
4990 let mut input = Vec::new();
4991 for img in inp {
4992 input.push(img.ctx)
4993 }
4994 (len as i32, input)
4995 };
4996 let mode_in: *mut i32 = mode.as_mut_ptr();
4997 let mut out_out: *mut bindings::VipsImage = null_mut();
4998
4999 let vips_op_response = bindings::vips_composite(
5000 inp_in.as_mut_ptr(),
5001 &mut out_out,
5002 inp_len,
5003 mode_in,
5004 mode.len() as i32,
5005 NULL,
5006 );
5007 utils::result(
5008 vips_op_response,
5009 VipsImage { ctx: out_out },
5010 Error::CompositeError,
5011 )
5012 }
5013}
5014
5015#[derive(Clone, Debug)]
5017pub struct CompositeOptions {
5018 pub x: Vec<i32>,
5020 pub y: Vec<i32>,
5022 pub compositing_space: Interpretation,
5045 pub premultiplied: bool,
5048}
5049
5050impl std::default::Default for CompositeOptions {
5051 fn default() -> Self {
5052 CompositeOptions {
5053 x: Vec::new(),
5054 y: Vec::new(),
5055 compositing_space: Interpretation::Srgb,
5056 premultiplied: false,
5057 }
5058 }
5059}
5060
5061pub fn composite_with_opts(
5067 inp: &mut [VipsImage],
5068 mode: &mut [i32],
5069 composite_options: &CompositeOptions,
5070) -> Result<VipsImage> {
5071 unsafe {
5072 let (inp_len, mut inp_in) = {
5073 let len = inp.len();
5074 let mut input = Vec::new();
5075 for img in inp {
5076 input.push(img.ctx)
5077 }
5078 (len as i32, input)
5079 };
5080 let mode_in: *mut i32 = mode.as_mut_ptr();
5081 let mut out_out: *mut bindings::VipsImage = null_mut();
5082
5083 let x_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.x[..]);
5084 let x_in = x_wrapper.ctx;
5085 let x_in_name = utils::new_c_string("x")?;
5086
5087 let y_wrapper = utils::VipsArrayIntWrapper::from(&composite_options.y[..]);
5088 let y_in = y_wrapper.ctx;
5089 let y_in_name = utils::new_c_string("y")?;
5090
5091 let compositing_space_in: i32 = composite_options.compositing_space as i32;
5092 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5093
5094 let premultiplied_in: i32 = if composite_options.premultiplied {
5095 1
5096 } else {
5097 0
5098 };
5099 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5100
5101 let vips_op_response = bindings::vips_composite(
5102 inp_in.as_mut_ptr(),
5103 &mut out_out,
5104 inp_len,
5105 mode_in,
5106 mode.len() as i32,
5107 x_in_name.as_ptr(),
5108 x_in,
5109 y_in_name.as_ptr(),
5110 y_in,
5111 compositing_space_in_name.as_ptr(),
5112 compositing_space_in,
5113 premultiplied_in_name.as_ptr(),
5114 premultiplied_in,
5115 NULL,
5116 );
5117 utils::result(
5118 vips_op_response,
5119 VipsImage { ctx: out_out },
5120 Error::CompositeError,
5121 )
5122 }
5123}
5124
5125pub fn composite_2(base: &VipsImage, overlay: &VipsImage, mode: BlendMode) -> Result<VipsImage> {
5157 unsafe {
5158 let base_in: *mut bindings::VipsImage = base.ctx;
5159 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5160 let mode_in: i32 = mode as i32;
5161 let mut out_out: *mut bindings::VipsImage = null_mut();
5162
5163 let vips_op_response = bindings::vips_composite2(
5164 base_in,
5165 overlay_in,
5166 &mut out_out,
5167 mode_in.try_into().unwrap(),
5168 NULL,
5169 );
5170 utils::result(
5171 vips_op_response,
5172 VipsImage { ctx: out_out },
5173 Error::Composite2Error,
5174 )
5175 }
5176}
5177
5178#[derive(Clone, Debug)]
5180pub struct Composite2Options {
5181 pub x: i32,
5184 pub y: i32,
5187 pub compositing_space: Interpretation,
5210 pub premultiplied: bool,
5213}
5214
5215impl std::default::Default for Composite2Options {
5216 fn default() -> Self {
5217 Composite2Options {
5218 x: i32::from(0),
5219 y: i32::from(0),
5220 compositing_space: Interpretation::Srgb,
5221 premultiplied: false,
5222 }
5223 }
5224}
5225
5226pub fn composite_2_with_opts(
5259 base: &VipsImage,
5260 overlay: &VipsImage,
5261 mode: BlendMode,
5262 composite_2_options: &Composite2Options,
5263) -> Result<VipsImage> {
5264 unsafe {
5265 let base_in: *mut bindings::VipsImage = base.ctx;
5266 let overlay_in: *mut bindings::VipsImage = overlay.ctx;
5267 let mode_in: i32 = mode as i32;
5268 let mut out_out: *mut bindings::VipsImage = null_mut();
5269
5270 let x_in: i32 = composite_2_options.x;
5271 let x_in_name = utils::new_c_string("x")?;
5272
5273 let y_in: i32 = composite_2_options.y;
5274 let y_in_name = utils::new_c_string("y")?;
5275
5276 let compositing_space_in: i32 = composite_2_options.compositing_space as i32;
5277 let compositing_space_in_name = utils::new_c_string("compositing-space")?;
5278
5279 let premultiplied_in: i32 = if composite_2_options.premultiplied {
5280 1
5281 } else {
5282 0
5283 };
5284 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
5285
5286 let vips_op_response = bindings::vips_composite2(
5287 base_in,
5288 overlay_in,
5289 &mut out_out,
5290 mode_in.try_into().unwrap(),
5291 x_in_name.as_ptr(),
5292 x_in,
5293 y_in_name.as_ptr(),
5294 y_in,
5295 compositing_space_in_name.as_ptr(),
5296 compositing_space_in,
5297 premultiplied_in_name.as_ptr(),
5298 premultiplied_in,
5299 NULL,
5300 );
5301 utils::result(
5302 vips_op_response,
5303 VipsImage { ctx: out_out },
5304 Error::Composite2Error,
5305 )
5306 }
5307}
5308
5309pub fn black(width: i32, height: i32) -> Result<VipsImage> {
5316 unsafe {
5317 let width_in: i32 = width;
5318 let height_in: i32 = height;
5319 let mut out_out: *mut bindings::VipsImage = null_mut();
5320
5321 let vips_op_response = bindings::vips_black(&mut out_out, width_in, height_in, NULL);
5322 utils::result(
5323 vips_op_response,
5324 VipsImage { ctx: out_out },
5325 Error::BlackError,
5326 )
5327 }
5328}
5329
5330#[derive(Clone, Debug)]
5332pub struct BlackOptions {
5333 pub bands: i32,
5336}
5337
5338impl std::default::Default for BlackOptions {
5339 fn default() -> Self {
5340 BlackOptions {
5341 bands: i32::from(1),
5342 }
5343 }
5344}
5345
5346pub fn black_with_opts(width: i32, height: i32, black_options: &BlackOptions) -> Result<VipsImage> {
5354 unsafe {
5355 let width_in: i32 = width;
5356 let height_in: i32 = height;
5357 let mut out_out: *mut bindings::VipsImage = null_mut();
5358
5359 let bands_in: i32 = black_options.bands;
5360 let bands_in_name = utils::new_c_string("bands")?;
5361
5362 let vips_op_response = bindings::vips_black(
5363 &mut out_out,
5364 width_in,
5365 height_in,
5366 bands_in_name.as_ptr(),
5367 bands_in,
5368 NULL,
5369 );
5370 utils::result(
5371 vips_op_response,
5372 VipsImage { ctx: out_out },
5373 Error::BlackError,
5374 )
5375 }
5376}
5377
5378pub fn gaussnoise(width: i32, height: i32) -> Result<VipsImage> {
5385 unsafe {
5386 let width_in: i32 = width;
5387 let height_in: i32 = height;
5388 let mut out_out: *mut bindings::VipsImage = null_mut();
5389
5390 let vips_op_response = bindings::vips_gaussnoise(&mut out_out, width_in, height_in, NULL);
5391 utils::result(
5392 vips_op_response,
5393 VipsImage { ctx: out_out },
5394 Error::GaussnoiseError,
5395 )
5396 }
5397}
5398
5399#[derive(Clone, Debug)]
5401pub struct GaussnoiseOptions {
5402 pub sigma: f64,
5405 pub mean: f64,
5408 pub seed: i32,
5411}
5412
5413impl std::default::Default for GaussnoiseOptions {
5414 fn default() -> Self {
5415 GaussnoiseOptions {
5416 sigma: f64::from(30),
5417 mean: f64::from(128),
5418 seed: i32::from(0),
5419 }
5420 }
5421}
5422
5423pub fn gaussnoise_with_opts(
5431 width: i32,
5432 height: i32,
5433 gaussnoise_options: &GaussnoiseOptions,
5434) -> Result<VipsImage> {
5435 unsafe {
5436 let width_in: i32 = width;
5437 let height_in: i32 = height;
5438 let mut out_out: *mut bindings::VipsImage = null_mut();
5439
5440 let sigma_in: f64 = gaussnoise_options.sigma;
5441 let sigma_in_name = utils::new_c_string("sigma")?;
5442
5443 let mean_in: f64 = gaussnoise_options.mean;
5444 let mean_in_name = utils::new_c_string("mean")?;
5445
5446 let seed_in: i32 = gaussnoise_options.seed;
5447 let seed_in_name = utils::new_c_string("seed")?;
5448
5449 let vips_op_response = bindings::vips_gaussnoise(
5450 &mut out_out,
5451 width_in,
5452 height_in,
5453 sigma_in_name.as_ptr(),
5454 sigma_in,
5455 mean_in_name.as_ptr(),
5456 mean_in,
5457 seed_in_name.as_ptr(),
5458 seed_in,
5459 NULL,
5460 );
5461 utils::result(
5462 vips_op_response,
5463 VipsImage { ctx: out_out },
5464 Error::GaussnoiseError,
5465 )
5466 }
5467}
5468
5469pub fn xyz(width: i32, height: i32) -> Result<VipsImage> {
5476 unsafe {
5477 let width_in: i32 = width;
5478 let height_in: i32 = height;
5479 let mut out_out: *mut bindings::VipsImage = null_mut();
5480
5481 let vips_op_response = bindings::vips_xyz(&mut out_out, width_in, height_in, NULL);
5482 utils::result(
5483 vips_op_response,
5484 VipsImage { ctx: out_out },
5485 Error::XyzError,
5486 )
5487 }
5488}
5489
5490#[derive(Clone, Debug)]
5492pub struct XyzOptions {
5493 pub csize: i32,
5496 pub dsize: i32,
5499 pub esize: i32,
5502}
5503
5504impl std::default::Default for XyzOptions {
5505 fn default() -> Self {
5506 XyzOptions {
5507 csize: i32::from(1),
5508 dsize: i32::from(1),
5509 esize: i32::from(1),
5510 }
5511 }
5512}
5513
5514pub fn xyz_with_opts(width: i32, height: i32, xyz_options: &XyzOptions) -> Result<VipsImage> {
5522 unsafe {
5523 let width_in: i32 = width;
5524 let height_in: i32 = height;
5525 let mut out_out: *mut bindings::VipsImage = null_mut();
5526
5527 let csize_in: i32 = xyz_options.csize;
5528 let csize_in_name = utils::new_c_string("csize")?;
5529
5530 let dsize_in: i32 = xyz_options.dsize;
5531 let dsize_in_name = utils::new_c_string("dsize")?;
5532
5533 let esize_in: i32 = xyz_options.esize;
5534 let esize_in_name = utils::new_c_string("esize")?;
5535
5536 let vips_op_response = bindings::vips_xyz(
5537 &mut out_out,
5538 width_in,
5539 height_in,
5540 csize_in_name.as_ptr(),
5541 csize_in,
5542 dsize_in_name.as_ptr(),
5543 dsize_in,
5544 esize_in_name.as_ptr(),
5545 esize_in,
5546 NULL,
5547 );
5548 utils::result(
5549 vips_op_response,
5550 VipsImage { ctx: out_out },
5551 Error::XyzError,
5552 )
5553 }
5554}
5555
5556pub fn gaussmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5563 unsafe {
5564 let sigma_in: f64 = sigma;
5565 let min_ampl_in: f64 = min_ampl;
5566 let mut out_out: *mut bindings::VipsImage = null_mut();
5567
5568 let vips_op_response = bindings::vips_gaussmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5569 utils::result(
5570 vips_op_response,
5571 VipsImage { ctx: out_out },
5572 Error::GaussmatError,
5573 )
5574 }
5575}
5576
5577#[derive(Clone, Debug)]
5579pub struct GaussmatOptions {
5580 pub separable: bool,
5583 pub precision: Precision,
5589}
5590
5591impl std::default::Default for GaussmatOptions {
5592 fn default() -> Self {
5593 GaussmatOptions {
5594 separable: false,
5595 precision: Precision::Integer,
5596 }
5597 }
5598}
5599
5600pub fn gaussmat_with_opts(
5608 sigma: f64,
5609 min_ampl: f64,
5610 gaussmat_options: &GaussmatOptions,
5611) -> Result<VipsImage> {
5612 unsafe {
5613 let sigma_in: f64 = sigma;
5614 let min_ampl_in: f64 = min_ampl;
5615 let mut out_out: *mut bindings::VipsImage = null_mut();
5616
5617 let separable_in: i32 = if gaussmat_options.separable { 1 } else { 0 };
5618 let separable_in_name = utils::new_c_string("separable")?;
5619
5620 let precision_in: i32 = gaussmat_options.precision as i32;
5621 let precision_in_name = utils::new_c_string("precision")?;
5622
5623 let vips_op_response = bindings::vips_gaussmat(
5624 &mut out_out,
5625 sigma_in,
5626 min_ampl_in,
5627 separable_in_name.as_ptr(),
5628 separable_in,
5629 precision_in_name.as_ptr(),
5630 precision_in,
5631 NULL,
5632 );
5633 utils::result(
5634 vips_op_response,
5635 VipsImage { ctx: out_out },
5636 Error::GaussmatError,
5637 )
5638 }
5639}
5640
5641pub fn logmat(sigma: f64, min_ampl: f64) -> Result<VipsImage> {
5648 unsafe {
5649 let sigma_in: f64 = sigma;
5650 let min_ampl_in: f64 = min_ampl;
5651 let mut out_out: *mut bindings::VipsImage = null_mut();
5652
5653 let vips_op_response = bindings::vips_logmat(&mut out_out, sigma_in, min_ampl_in, NULL);
5654 utils::result(
5655 vips_op_response,
5656 VipsImage { ctx: out_out },
5657 Error::LogmatError,
5658 )
5659 }
5660}
5661
5662#[derive(Clone, Debug)]
5664pub struct LogmatOptions {
5665 pub separable: bool,
5668 pub precision: Precision,
5674}
5675
5676impl std::default::Default for LogmatOptions {
5677 fn default() -> Self {
5678 LogmatOptions {
5679 separable: false,
5680 precision: Precision::Integer,
5681 }
5682 }
5683}
5684
5685pub fn logmat_with_opts(
5693 sigma: f64,
5694 min_ampl: f64,
5695 logmat_options: &LogmatOptions,
5696) -> Result<VipsImage> {
5697 unsafe {
5698 let sigma_in: f64 = sigma;
5699 let min_ampl_in: f64 = min_ampl;
5700 let mut out_out: *mut bindings::VipsImage = null_mut();
5701
5702 let separable_in: i32 = if logmat_options.separable { 1 } else { 0 };
5703 let separable_in_name = utils::new_c_string("separable")?;
5704
5705 let precision_in: i32 = logmat_options.precision as i32;
5706 let precision_in_name = utils::new_c_string("precision")?;
5707
5708 let vips_op_response = bindings::vips_logmat(
5709 &mut out_out,
5710 sigma_in,
5711 min_ampl_in,
5712 separable_in_name.as_ptr(),
5713 separable_in,
5714 precision_in_name.as_ptr(),
5715 precision_in,
5716 NULL,
5717 );
5718 utils::result(
5719 vips_op_response,
5720 VipsImage { ctx: out_out },
5721 Error::LogmatError,
5722 )
5723 }
5724}
5725
5726pub fn text(text: &str) -> Result<VipsImage> {
5730 unsafe {
5731 let text_in: CString = utils::new_c_string(text)?;
5732 let mut out_out: *mut bindings::VipsImage = null_mut();
5733
5734 let vips_op_response = bindings::vips_text(&mut out_out, text_in.as_ptr(), NULL);
5735 utils::result(
5736 vips_op_response,
5737 VipsImage { ctx: out_out },
5738 Error::TextError,
5739 )
5740 }
5741}
5742
5743#[derive(Clone, Debug)]
5745pub struct TextOptions {
5746 pub font: String,
5748 pub width: i32,
5751 pub height: i32,
5754 pub align: Align,
5760 pub justify: bool,
5763 pub dpi: i32,
5766 pub autofit_dpi: i32,
5769 pub spacing: i32,
5772 pub fontfile: String,
5774 pub rgba: bool,
5777 pub wrap: TextWrap,
5784}
5785
5786impl std::default::Default for TextOptions {
5787 fn default() -> Self {
5788 TextOptions {
5789 font: String::new(),
5790 width: i32::from(0),
5791 height: i32::from(0),
5792 align: Align::Low,
5793 justify: false,
5794 dpi: i32::from(72),
5795 autofit_dpi: i32::from(72),
5796 spacing: i32::from(0),
5797 fontfile: String::new(),
5798 rgba: false,
5799 wrap: TextWrap::Word,
5800 }
5801 }
5802}
5803
5804pub fn text_with_opts(text: &str, text_options: &TextOptions) -> Result<VipsImage> {
5809 unsafe {
5810 let text_in: CString = utils::new_c_string(text)?;
5811 let mut out_out: *mut bindings::VipsImage = null_mut();
5812
5813 let font_in: CString = utils::new_c_string(&text_options.font)?;
5814 let font_in_name = utils::new_c_string("font")?;
5815
5816 let width_in: i32 = text_options.width;
5817 let width_in_name = utils::new_c_string("width")?;
5818
5819 let height_in: i32 = text_options.height;
5820 let height_in_name = utils::new_c_string("height")?;
5821
5822 let align_in: i32 = text_options.align as i32;
5823 let align_in_name = utils::new_c_string("align")?;
5824
5825 let justify_in: i32 = if text_options.justify { 1 } else { 0 };
5826 let justify_in_name = utils::new_c_string("justify")?;
5827
5828 let dpi_in: i32 = text_options.dpi;
5829 let dpi_in_name = utils::new_c_string("dpi")?;
5830
5831 let autofit_dpi_in: i32 = text_options.autofit_dpi;
5832 let autofit_dpi_in_name = utils::new_c_string("autofit-dpi")?;
5833
5834 let spacing_in: i32 = text_options.spacing;
5835 let spacing_in_name = utils::new_c_string("spacing")?;
5836
5837 let fontfile_in: CString = utils::new_c_string(&text_options.fontfile)?;
5838 let fontfile_in_name = utils::new_c_string("fontfile")?;
5839
5840 let rgba_in: i32 = if text_options.rgba { 1 } else { 0 };
5841 let rgba_in_name = utils::new_c_string("rgba")?;
5842
5843 let wrap_in: i32 = text_options.wrap as i32;
5844 let wrap_in_name = utils::new_c_string("wrap")?;
5845
5846 let vips_op_response = bindings::vips_text(
5847 &mut out_out,
5848 text_in.as_ptr(),
5849 font_in_name.as_ptr(),
5850 font_in.as_ptr(),
5851 width_in_name.as_ptr(),
5852 width_in,
5853 height_in_name.as_ptr(),
5854 height_in,
5855 align_in_name.as_ptr(),
5856 align_in,
5857 justify_in_name.as_ptr(),
5858 justify_in,
5859 dpi_in_name.as_ptr(),
5860 dpi_in,
5861 autofit_dpi_in_name.as_ptr(),
5862 autofit_dpi_in,
5863 spacing_in_name.as_ptr(),
5864 spacing_in,
5865 fontfile_in_name.as_ptr(),
5866 fontfile_in.as_ptr(),
5867 rgba_in_name.as_ptr(),
5868 rgba_in,
5869 wrap_in_name.as_ptr(),
5870 wrap_in,
5871 NULL,
5872 );
5873 utils::result(
5874 vips_op_response,
5875 VipsImage { ctx: out_out },
5876 Error::TextError,
5877 )
5878 }
5879}
5880
5881pub fn eye(width: i32, height: i32) -> Result<VipsImage> {
5888 unsafe {
5889 let width_in: i32 = width;
5890 let height_in: i32 = height;
5891 let mut out_out: *mut bindings::VipsImage = null_mut();
5892
5893 let vips_op_response = bindings::vips_eye(&mut out_out, width_in, height_in, NULL);
5894 utils::result(
5895 vips_op_response,
5896 VipsImage { ctx: out_out },
5897 Error::EyeError,
5898 )
5899 }
5900}
5901
5902#[derive(Clone, Debug)]
5904pub struct EyeOptions {
5905 pub uchar: bool,
5908 pub factor: f64,
5911}
5912
5913impl std::default::Default for EyeOptions {
5914 fn default() -> Self {
5915 EyeOptions {
5916 uchar: false,
5917 factor: f64::from(0.5),
5918 }
5919 }
5920}
5921
5922pub fn eye_with_opts(width: i32, height: i32, eye_options: &EyeOptions) -> Result<VipsImage> {
5930 unsafe {
5931 let width_in: i32 = width;
5932 let height_in: i32 = height;
5933 let mut out_out: *mut bindings::VipsImage = null_mut();
5934
5935 let uchar_in: i32 = if eye_options.uchar { 1 } else { 0 };
5936 let uchar_in_name = utils::new_c_string("uchar")?;
5937
5938 let factor_in: f64 = eye_options.factor;
5939 let factor_in_name = utils::new_c_string("factor")?;
5940
5941 let vips_op_response = bindings::vips_eye(
5942 &mut out_out,
5943 width_in,
5944 height_in,
5945 uchar_in_name.as_ptr(),
5946 uchar_in,
5947 factor_in_name.as_ptr(),
5948 factor_in,
5949 NULL,
5950 );
5951 utils::result(
5952 vips_op_response,
5953 VipsImage { ctx: out_out },
5954 Error::EyeError,
5955 )
5956 }
5957}
5958
5959pub fn grey(width: i32, height: i32) -> Result<VipsImage> {
5966 unsafe {
5967 let width_in: i32 = width;
5968 let height_in: i32 = height;
5969 let mut out_out: *mut bindings::VipsImage = null_mut();
5970
5971 let vips_op_response = bindings::vips_grey(&mut out_out, width_in, height_in, NULL);
5972 utils::result(
5973 vips_op_response,
5974 VipsImage { ctx: out_out },
5975 Error::GreyError,
5976 )
5977 }
5978}
5979
5980#[derive(Clone, Debug)]
5982pub struct GreyOptions {
5983 pub uchar: bool,
5986}
5987
5988impl std::default::Default for GreyOptions {
5989 fn default() -> Self {
5990 GreyOptions { uchar: false }
5991 }
5992}
5993
5994pub fn grey_with_opts(width: i32, height: i32, grey_options: &GreyOptions) -> Result<VipsImage> {
6002 unsafe {
6003 let width_in: i32 = width;
6004 let height_in: i32 = height;
6005 let mut out_out: *mut bindings::VipsImage = null_mut();
6006
6007 let uchar_in: i32 = if grey_options.uchar { 1 } else { 0 };
6008 let uchar_in_name = utils::new_c_string("uchar")?;
6009
6010 let vips_op_response = bindings::vips_grey(
6011 &mut out_out,
6012 width_in,
6013 height_in,
6014 uchar_in_name.as_ptr(),
6015 uchar_in,
6016 NULL,
6017 );
6018 utils::result(
6019 vips_op_response,
6020 VipsImage { ctx: out_out },
6021 Error::GreyError,
6022 )
6023 }
6024}
6025
6026pub fn zone(width: i32, height: i32) -> Result<VipsImage> {
6033 unsafe {
6034 let width_in: i32 = width;
6035 let height_in: i32 = height;
6036 let mut out_out: *mut bindings::VipsImage = null_mut();
6037
6038 let vips_op_response = bindings::vips_zone(&mut out_out, width_in, height_in, NULL);
6039 utils::result(
6040 vips_op_response,
6041 VipsImage { ctx: out_out },
6042 Error::ZoneError,
6043 )
6044 }
6045}
6046
6047#[derive(Clone, Debug)]
6049pub struct ZoneOptions {
6050 pub uchar: bool,
6053}
6054
6055impl std::default::Default for ZoneOptions {
6056 fn default() -> Self {
6057 ZoneOptions { uchar: false }
6058 }
6059}
6060
6061pub fn zone_with_opts(width: i32, height: i32, zone_options: &ZoneOptions) -> Result<VipsImage> {
6069 unsafe {
6070 let width_in: i32 = width;
6071 let height_in: i32 = height;
6072 let mut out_out: *mut bindings::VipsImage = null_mut();
6073
6074 let uchar_in: i32 = if zone_options.uchar { 1 } else { 0 };
6075 let uchar_in_name = utils::new_c_string("uchar")?;
6076
6077 let vips_op_response = bindings::vips_zone(
6078 &mut out_out,
6079 width_in,
6080 height_in,
6081 uchar_in_name.as_ptr(),
6082 uchar_in,
6083 NULL,
6084 );
6085 utils::result(
6086 vips_op_response,
6087 VipsImage { ctx: out_out },
6088 Error::ZoneError,
6089 )
6090 }
6091}
6092
6093pub fn sines(width: i32, height: i32) -> Result<VipsImage> {
6100 unsafe {
6101 let width_in: i32 = width;
6102 let height_in: i32 = height;
6103 let mut out_out: *mut bindings::VipsImage = null_mut();
6104
6105 let vips_op_response = bindings::vips_sines(&mut out_out, width_in, height_in, NULL);
6106 utils::result(
6107 vips_op_response,
6108 VipsImage { ctx: out_out },
6109 Error::SineError,
6110 )
6111 }
6112}
6113
6114#[derive(Clone, Debug)]
6116pub struct SineOptions {
6117 pub uchar: bool,
6120 pub hfreq: f64,
6123 pub vfreq: f64,
6126}
6127
6128impl std::default::Default for SineOptions {
6129 fn default() -> Self {
6130 SineOptions {
6131 uchar: false,
6132 hfreq: f64::from(0.5),
6133 vfreq: f64::from(0.5),
6134 }
6135 }
6136}
6137
6138pub fn sines_with_opts(width: i32, height: i32, sines_options: &SineOptions) -> Result<VipsImage> {
6146 unsafe {
6147 let width_in: i32 = width;
6148 let height_in: i32 = height;
6149 let mut out_out: *mut bindings::VipsImage = null_mut();
6150
6151 let uchar_in: i32 = if sines_options.uchar { 1 } else { 0 };
6152 let uchar_in_name = utils::new_c_string("uchar")?;
6153
6154 let hfreq_in: f64 = sines_options.hfreq;
6155 let hfreq_in_name = utils::new_c_string("hfreq")?;
6156
6157 let vfreq_in: f64 = sines_options.vfreq;
6158 let vfreq_in_name = utils::new_c_string("vfreq")?;
6159
6160 let vips_op_response = bindings::vips_sines(
6161 &mut out_out,
6162 width_in,
6163 height_in,
6164 uchar_in_name.as_ptr(),
6165 uchar_in,
6166 hfreq_in_name.as_ptr(),
6167 hfreq_in,
6168 vfreq_in_name.as_ptr(),
6169 vfreq_in,
6170 NULL,
6171 );
6172 utils::result(
6173 vips_op_response,
6174 VipsImage { ctx: out_out },
6175 Error::SineError,
6176 )
6177 }
6178}
6179
6180pub fn mask_ideal(width: i32, height: i32, frequency_cutoff: f64) -> Result<VipsImage> {
6189 unsafe {
6190 let width_in: i32 = width;
6191 let height_in: i32 = height;
6192 let frequency_cutoff_in: f64 = frequency_cutoff;
6193 let mut out_out: *mut bindings::VipsImage = null_mut();
6194
6195 let vips_op_response =
6196 bindings::vips_mask_ideal(&mut out_out, width_in, height_in, frequency_cutoff_in, NULL);
6197 utils::result(
6198 vips_op_response,
6199 VipsImage { ctx: out_out },
6200 Error::MaskIdealError,
6201 )
6202 }
6203}
6204
6205#[derive(Clone, Debug)]
6207pub struct MaskIdealOptions {
6208 pub uchar: bool,
6211 pub nodc: bool,
6214 pub reject: bool,
6217 pub optical: bool,
6220}
6221
6222impl std::default::Default for MaskIdealOptions {
6223 fn default() -> Self {
6224 MaskIdealOptions {
6225 uchar: false,
6226 nodc: false,
6227 reject: false,
6228 optical: false,
6229 }
6230 }
6231}
6232
6233pub fn mask_ideal_with_opts(
6243 width: i32,
6244 height: i32,
6245 frequency_cutoff: f64,
6246 mask_ideal_options: &MaskIdealOptions,
6247) -> Result<VipsImage> {
6248 unsafe {
6249 let width_in: i32 = width;
6250 let height_in: i32 = height;
6251 let frequency_cutoff_in: f64 = frequency_cutoff;
6252 let mut out_out: *mut bindings::VipsImage = null_mut();
6253
6254 let uchar_in: i32 = if mask_ideal_options.uchar { 1 } else { 0 };
6255 let uchar_in_name = utils::new_c_string("uchar")?;
6256
6257 let nodc_in: i32 = if mask_ideal_options.nodc { 1 } else { 0 };
6258 let nodc_in_name = utils::new_c_string("nodc")?;
6259
6260 let reject_in: i32 = if mask_ideal_options.reject { 1 } else { 0 };
6261 let reject_in_name = utils::new_c_string("reject")?;
6262
6263 let optical_in: i32 = if mask_ideal_options.optical { 1 } else { 0 };
6264 let optical_in_name = utils::new_c_string("optical")?;
6265
6266 let vips_op_response = bindings::vips_mask_ideal(
6267 &mut out_out,
6268 width_in,
6269 height_in,
6270 frequency_cutoff_in,
6271 uchar_in_name.as_ptr(),
6272 uchar_in,
6273 nodc_in_name.as_ptr(),
6274 nodc_in,
6275 reject_in_name.as_ptr(),
6276 reject_in,
6277 optical_in_name.as_ptr(),
6278 optical_in,
6279 NULL,
6280 );
6281 utils::result(
6282 vips_op_response,
6283 VipsImage { ctx: out_out },
6284 Error::MaskIdealError,
6285 )
6286 }
6287}
6288
6289pub fn mask_ideal_ring(
6300 width: i32,
6301 height: i32,
6302 frequency_cutoff: f64,
6303 ringwidth: f64,
6304) -> Result<VipsImage> {
6305 unsafe {
6306 let width_in: i32 = width;
6307 let height_in: i32 = height;
6308 let frequency_cutoff_in: f64 = frequency_cutoff;
6309 let ringwidth_in: f64 = ringwidth;
6310 let mut out_out: *mut bindings::VipsImage = null_mut();
6311
6312 let vips_op_response = bindings::vips_mask_ideal_ring(
6313 &mut out_out,
6314 width_in,
6315 height_in,
6316 frequency_cutoff_in,
6317 ringwidth_in,
6318 NULL,
6319 );
6320 utils::result(
6321 vips_op_response,
6322 VipsImage { ctx: out_out },
6323 Error::MaskIdealRingError,
6324 )
6325 }
6326}
6327
6328#[derive(Clone, Debug)]
6330pub struct MaskIdealRingOptions {
6331 pub uchar: bool,
6334 pub nodc: bool,
6337 pub reject: bool,
6340 pub optical: bool,
6343}
6344
6345impl std::default::Default for MaskIdealRingOptions {
6346 fn default() -> Self {
6347 MaskIdealRingOptions {
6348 uchar: false,
6349 nodc: false,
6350 reject: false,
6351 optical: false,
6352 }
6353 }
6354}
6355
6356pub fn mask_ideal_ring_with_opts(
6368 width: i32,
6369 height: i32,
6370 frequency_cutoff: f64,
6371 ringwidth: f64,
6372 mask_ideal_ring_options: &MaskIdealRingOptions,
6373) -> Result<VipsImage> {
6374 unsafe {
6375 let width_in: i32 = width;
6376 let height_in: i32 = height;
6377 let frequency_cutoff_in: f64 = frequency_cutoff;
6378 let ringwidth_in: f64 = ringwidth;
6379 let mut out_out: *mut bindings::VipsImage = null_mut();
6380
6381 let uchar_in: i32 = if mask_ideal_ring_options.uchar { 1 } else { 0 };
6382 let uchar_in_name = utils::new_c_string("uchar")?;
6383
6384 let nodc_in: i32 = if mask_ideal_ring_options.nodc { 1 } else { 0 };
6385 let nodc_in_name = utils::new_c_string("nodc")?;
6386
6387 let reject_in: i32 = if mask_ideal_ring_options.reject { 1 } else { 0 };
6388 let reject_in_name = utils::new_c_string("reject")?;
6389
6390 let optical_in: i32 = if mask_ideal_ring_options.optical {
6391 1
6392 } else {
6393 0
6394 };
6395 let optical_in_name = utils::new_c_string("optical")?;
6396
6397 let vips_op_response = bindings::vips_mask_ideal_ring(
6398 &mut out_out,
6399 width_in,
6400 height_in,
6401 frequency_cutoff_in,
6402 ringwidth_in,
6403 uchar_in_name.as_ptr(),
6404 uchar_in,
6405 nodc_in_name.as_ptr(),
6406 nodc_in,
6407 reject_in_name.as_ptr(),
6408 reject_in,
6409 optical_in_name.as_ptr(),
6410 optical_in,
6411 NULL,
6412 );
6413 utils::result(
6414 vips_op_response,
6415 VipsImage { ctx: out_out },
6416 Error::MaskIdealRingError,
6417 )
6418 }
6419}
6420
6421pub fn mask_ideal_band(
6434 width: i32,
6435 height: i32,
6436 frequency_cutoff_x: f64,
6437 frequency_cutoff_y: f64,
6438 radius: f64,
6439) -> Result<VipsImage> {
6440 unsafe {
6441 let width_in: i32 = width;
6442 let height_in: i32 = height;
6443 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6444 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6445 let radius_in: f64 = radius;
6446 let mut out_out: *mut bindings::VipsImage = null_mut();
6447
6448 let vips_op_response = bindings::vips_mask_ideal_band(
6449 &mut out_out,
6450 width_in,
6451 height_in,
6452 frequency_cutoff_x_in,
6453 frequency_cutoff_y_in,
6454 radius_in,
6455 NULL,
6456 );
6457 utils::result(
6458 vips_op_response,
6459 VipsImage { ctx: out_out },
6460 Error::MaskIdealBandError,
6461 )
6462 }
6463}
6464
6465#[derive(Clone, Debug)]
6467pub struct MaskIdealBandOptions {
6468 pub uchar: bool,
6471 pub nodc: bool,
6474 pub reject: bool,
6477 pub optical: bool,
6480}
6481
6482impl std::default::Default for MaskIdealBandOptions {
6483 fn default() -> Self {
6484 MaskIdealBandOptions {
6485 uchar: false,
6486 nodc: false,
6487 reject: false,
6488 optical: false,
6489 }
6490 }
6491}
6492
6493pub fn mask_ideal_band_with_opts(
6507 width: i32,
6508 height: i32,
6509 frequency_cutoff_x: f64,
6510 frequency_cutoff_y: f64,
6511 radius: f64,
6512 mask_ideal_band_options: &MaskIdealBandOptions,
6513) -> Result<VipsImage> {
6514 unsafe {
6515 let width_in: i32 = width;
6516 let height_in: i32 = height;
6517 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6518 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6519 let radius_in: f64 = radius;
6520 let mut out_out: *mut bindings::VipsImage = null_mut();
6521
6522 let uchar_in: i32 = if mask_ideal_band_options.uchar { 1 } else { 0 };
6523 let uchar_in_name = utils::new_c_string("uchar")?;
6524
6525 let nodc_in: i32 = if mask_ideal_band_options.nodc { 1 } else { 0 };
6526 let nodc_in_name = utils::new_c_string("nodc")?;
6527
6528 let reject_in: i32 = if mask_ideal_band_options.reject { 1 } else { 0 };
6529 let reject_in_name = utils::new_c_string("reject")?;
6530
6531 let optical_in: i32 = if mask_ideal_band_options.optical {
6532 1
6533 } else {
6534 0
6535 };
6536 let optical_in_name = utils::new_c_string("optical")?;
6537
6538 let vips_op_response = bindings::vips_mask_ideal_band(
6539 &mut out_out,
6540 width_in,
6541 height_in,
6542 frequency_cutoff_x_in,
6543 frequency_cutoff_y_in,
6544 radius_in,
6545 uchar_in_name.as_ptr(),
6546 uchar_in,
6547 nodc_in_name.as_ptr(),
6548 nodc_in,
6549 reject_in_name.as_ptr(),
6550 reject_in,
6551 optical_in_name.as_ptr(),
6552 optical_in,
6553 NULL,
6554 );
6555 utils::result(
6556 vips_op_response,
6557 VipsImage { ctx: out_out },
6558 Error::MaskIdealBandError,
6559 )
6560 }
6561}
6562
6563pub fn mask_butterworth(
6576 width: i32,
6577 height: i32,
6578 order: f64,
6579 frequency_cutoff: f64,
6580 amplitude_cutoff: f64,
6581) -> Result<VipsImage> {
6582 unsafe {
6583 let width_in: i32 = width;
6584 let height_in: i32 = height;
6585 let order_in: f64 = order;
6586 let frequency_cutoff_in: f64 = frequency_cutoff;
6587 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6588 let mut out_out: *mut bindings::VipsImage = null_mut();
6589
6590 let vips_op_response = bindings::vips_mask_butterworth(
6591 &mut out_out,
6592 width_in,
6593 height_in,
6594 order_in,
6595 frequency_cutoff_in,
6596 amplitude_cutoff_in,
6597 NULL,
6598 );
6599 utils::result(
6600 vips_op_response,
6601 VipsImage { ctx: out_out },
6602 Error::MaskButterworthError,
6603 )
6604 }
6605}
6606
6607#[derive(Clone, Debug)]
6609pub struct MaskButterworthOptions {
6610 pub uchar: bool,
6613 pub nodc: bool,
6616 pub reject: bool,
6619 pub optical: bool,
6622}
6623
6624impl std::default::Default for MaskButterworthOptions {
6625 fn default() -> Self {
6626 MaskButterworthOptions {
6627 uchar: false,
6628 nodc: false,
6629 reject: false,
6630 optical: false,
6631 }
6632 }
6633}
6634
6635pub fn mask_butterworth_with_opts(
6649 width: i32,
6650 height: i32,
6651 order: f64,
6652 frequency_cutoff: f64,
6653 amplitude_cutoff: f64,
6654 mask_butterworth_options: &MaskButterworthOptions,
6655) -> Result<VipsImage> {
6656 unsafe {
6657 let width_in: i32 = width;
6658 let height_in: i32 = height;
6659 let order_in: f64 = order;
6660 let frequency_cutoff_in: f64 = frequency_cutoff;
6661 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6662 let mut out_out: *mut bindings::VipsImage = null_mut();
6663
6664 let uchar_in: i32 = if mask_butterworth_options.uchar { 1 } else { 0 };
6665 let uchar_in_name = utils::new_c_string("uchar")?;
6666
6667 let nodc_in: i32 = if mask_butterworth_options.nodc { 1 } else { 0 };
6668 let nodc_in_name = utils::new_c_string("nodc")?;
6669
6670 let reject_in: i32 = if mask_butterworth_options.reject {
6671 1
6672 } else {
6673 0
6674 };
6675 let reject_in_name = utils::new_c_string("reject")?;
6676
6677 let optical_in: i32 = if mask_butterworth_options.optical {
6678 1
6679 } else {
6680 0
6681 };
6682 let optical_in_name = utils::new_c_string("optical")?;
6683
6684 let vips_op_response = bindings::vips_mask_butterworth(
6685 &mut out_out,
6686 width_in,
6687 height_in,
6688 order_in,
6689 frequency_cutoff_in,
6690 amplitude_cutoff_in,
6691 uchar_in_name.as_ptr(),
6692 uchar_in,
6693 nodc_in_name.as_ptr(),
6694 nodc_in,
6695 reject_in_name.as_ptr(),
6696 reject_in,
6697 optical_in_name.as_ptr(),
6698 optical_in,
6699 NULL,
6700 );
6701 utils::result(
6702 vips_op_response,
6703 VipsImage { ctx: out_out },
6704 Error::MaskButterworthError,
6705 )
6706 }
6707}
6708
6709pub fn mask_butterworth_ring(
6724 width: i32,
6725 height: i32,
6726 order: f64,
6727 frequency_cutoff: f64,
6728 amplitude_cutoff: f64,
6729 ringwidth: f64,
6730) -> Result<VipsImage> {
6731 unsafe {
6732 let width_in: i32 = width;
6733 let height_in: i32 = height;
6734 let order_in: f64 = order;
6735 let frequency_cutoff_in: f64 = frequency_cutoff;
6736 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6737 let ringwidth_in: f64 = ringwidth;
6738 let mut out_out: *mut bindings::VipsImage = null_mut();
6739
6740 let vips_op_response = bindings::vips_mask_butterworth_ring(
6741 &mut out_out,
6742 width_in,
6743 height_in,
6744 order_in,
6745 frequency_cutoff_in,
6746 amplitude_cutoff_in,
6747 ringwidth_in,
6748 NULL,
6749 );
6750 utils::result(
6751 vips_op_response,
6752 VipsImage { ctx: out_out },
6753 Error::MaskButterworthRingError,
6754 )
6755 }
6756}
6757
6758#[derive(Clone, Debug)]
6760pub struct MaskButterworthRingOptions {
6761 pub uchar: bool,
6764 pub nodc: bool,
6767 pub reject: bool,
6770 pub optical: bool,
6773}
6774
6775impl std::default::Default for MaskButterworthRingOptions {
6776 fn default() -> Self {
6777 MaskButterworthRingOptions {
6778 uchar: false,
6779 nodc: false,
6780 reject: false,
6781 optical: false,
6782 }
6783 }
6784}
6785
6786pub fn mask_butterworth_ring_with_opts(
6802 width: i32,
6803 height: i32,
6804 order: f64,
6805 frequency_cutoff: f64,
6806 amplitude_cutoff: f64,
6807 ringwidth: f64,
6808 mask_butterworth_ring_options: &MaskButterworthRingOptions,
6809) -> Result<VipsImage> {
6810 unsafe {
6811 let width_in: i32 = width;
6812 let height_in: i32 = height;
6813 let order_in: f64 = order;
6814 let frequency_cutoff_in: f64 = frequency_cutoff;
6815 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6816 let ringwidth_in: f64 = ringwidth;
6817 let mut out_out: *mut bindings::VipsImage = null_mut();
6818
6819 let uchar_in: i32 = if mask_butterworth_ring_options.uchar {
6820 1
6821 } else {
6822 0
6823 };
6824 let uchar_in_name = utils::new_c_string("uchar")?;
6825
6826 let nodc_in: i32 = if mask_butterworth_ring_options.nodc {
6827 1
6828 } else {
6829 0
6830 };
6831 let nodc_in_name = utils::new_c_string("nodc")?;
6832
6833 let reject_in: i32 = if mask_butterworth_ring_options.reject {
6834 1
6835 } else {
6836 0
6837 };
6838 let reject_in_name = utils::new_c_string("reject")?;
6839
6840 let optical_in: i32 = if mask_butterworth_ring_options.optical {
6841 1
6842 } else {
6843 0
6844 };
6845 let optical_in_name = utils::new_c_string("optical")?;
6846
6847 let vips_op_response = bindings::vips_mask_butterworth_ring(
6848 &mut out_out,
6849 width_in,
6850 height_in,
6851 order_in,
6852 frequency_cutoff_in,
6853 amplitude_cutoff_in,
6854 ringwidth_in,
6855 uchar_in_name.as_ptr(),
6856 uchar_in,
6857 nodc_in_name.as_ptr(),
6858 nodc_in,
6859 reject_in_name.as_ptr(),
6860 reject_in,
6861 optical_in_name.as_ptr(),
6862 optical_in,
6863 NULL,
6864 );
6865 utils::result(
6866 vips_op_response,
6867 VipsImage { ctx: out_out },
6868 Error::MaskButterworthRingError,
6869 )
6870 }
6871}
6872
6873pub fn mask_butterworth_band(
6890 width: i32,
6891 height: i32,
6892 order: f64,
6893 frequency_cutoff_x: f64,
6894 frequency_cutoff_y: f64,
6895 radius: f64,
6896 amplitude_cutoff: f64,
6897) -> Result<VipsImage> {
6898 unsafe {
6899 let width_in: i32 = width;
6900 let height_in: i32 = height;
6901 let order_in: f64 = order;
6902 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6903 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6904 let radius_in: f64 = radius;
6905 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6906 let mut out_out: *mut bindings::VipsImage = null_mut();
6907
6908 let vips_op_response = bindings::vips_mask_butterworth_band(
6909 &mut out_out,
6910 width_in,
6911 height_in,
6912 order_in,
6913 frequency_cutoff_x_in,
6914 frequency_cutoff_y_in,
6915 radius_in,
6916 amplitude_cutoff_in,
6917 NULL,
6918 );
6919 utils::result(
6920 vips_op_response,
6921 VipsImage { ctx: out_out },
6922 Error::MaskButterworthBandError,
6923 )
6924 }
6925}
6926
6927#[derive(Clone, Debug)]
6929pub struct MaskButterworthBandOptions {
6930 pub uchar: bool,
6933 pub nodc: bool,
6936 pub reject: bool,
6939 pub optical: bool,
6942}
6943
6944impl std::default::Default for MaskButterworthBandOptions {
6945 fn default() -> Self {
6946 MaskButterworthBandOptions {
6947 uchar: false,
6948 nodc: false,
6949 reject: false,
6950 optical: false,
6951 }
6952 }
6953}
6954
6955pub fn mask_butterworth_band_with_opts(
6973 width: i32,
6974 height: i32,
6975 order: f64,
6976 frequency_cutoff_x: f64,
6977 frequency_cutoff_y: f64,
6978 radius: f64,
6979 amplitude_cutoff: f64,
6980 mask_butterworth_band_options: &MaskButterworthBandOptions,
6981) -> Result<VipsImage> {
6982 unsafe {
6983 let width_in: i32 = width;
6984 let height_in: i32 = height;
6985 let order_in: f64 = order;
6986 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
6987 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
6988 let radius_in: f64 = radius;
6989 let amplitude_cutoff_in: f64 = amplitude_cutoff;
6990 let mut out_out: *mut bindings::VipsImage = null_mut();
6991
6992 let uchar_in: i32 = if mask_butterworth_band_options.uchar {
6993 1
6994 } else {
6995 0
6996 };
6997 let uchar_in_name = utils::new_c_string("uchar")?;
6998
6999 let nodc_in: i32 = if mask_butterworth_band_options.nodc {
7000 1
7001 } else {
7002 0
7003 };
7004 let nodc_in_name = utils::new_c_string("nodc")?;
7005
7006 let reject_in: i32 = if mask_butterworth_band_options.reject {
7007 1
7008 } else {
7009 0
7010 };
7011 let reject_in_name = utils::new_c_string("reject")?;
7012
7013 let optical_in: i32 = if mask_butterworth_band_options.optical {
7014 1
7015 } else {
7016 0
7017 };
7018 let optical_in_name = utils::new_c_string("optical")?;
7019
7020 let vips_op_response = bindings::vips_mask_butterworth_band(
7021 &mut out_out,
7022 width_in,
7023 height_in,
7024 order_in,
7025 frequency_cutoff_x_in,
7026 frequency_cutoff_y_in,
7027 radius_in,
7028 amplitude_cutoff_in,
7029 uchar_in_name.as_ptr(),
7030 uchar_in,
7031 nodc_in_name.as_ptr(),
7032 nodc_in,
7033 reject_in_name.as_ptr(),
7034 reject_in,
7035 optical_in_name.as_ptr(),
7036 optical_in,
7037 NULL,
7038 );
7039 utils::result(
7040 vips_op_response,
7041 VipsImage { ctx: out_out },
7042 Error::MaskButterworthBandError,
7043 )
7044 }
7045}
7046
7047pub fn mask_gaussian(
7058 width: i32,
7059 height: i32,
7060 frequency_cutoff: f64,
7061 amplitude_cutoff: f64,
7062) -> Result<VipsImage> {
7063 unsafe {
7064 let width_in: i32 = width;
7065 let height_in: i32 = height;
7066 let frequency_cutoff_in: f64 = frequency_cutoff;
7067 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7068 let mut out_out: *mut bindings::VipsImage = null_mut();
7069
7070 let vips_op_response = bindings::vips_mask_gaussian(
7071 &mut out_out,
7072 width_in,
7073 height_in,
7074 frequency_cutoff_in,
7075 amplitude_cutoff_in,
7076 NULL,
7077 );
7078 utils::result(
7079 vips_op_response,
7080 VipsImage { ctx: out_out },
7081 Error::MaskGaussianError,
7082 )
7083 }
7084}
7085
7086#[derive(Clone, Debug)]
7088pub struct MaskGaussianOptions {
7089 pub uchar: bool,
7092 pub nodc: bool,
7095 pub reject: bool,
7098 pub optical: bool,
7101}
7102
7103impl std::default::Default for MaskGaussianOptions {
7104 fn default() -> Self {
7105 MaskGaussianOptions {
7106 uchar: false,
7107 nodc: false,
7108 reject: false,
7109 optical: false,
7110 }
7111 }
7112}
7113
7114pub fn mask_gaussian_with_opts(
7126 width: i32,
7127 height: i32,
7128 frequency_cutoff: f64,
7129 amplitude_cutoff: f64,
7130 mask_gaussian_options: &MaskGaussianOptions,
7131) -> Result<VipsImage> {
7132 unsafe {
7133 let width_in: i32 = width;
7134 let height_in: i32 = height;
7135 let frequency_cutoff_in: f64 = frequency_cutoff;
7136 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7137 let mut out_out: *mut bindings::VipsImage = null_mut();
7138
7139 let uchar_in: i32 = if mask_gaussian_options.uchar { 1 } else { 0 };
7140 let uchar_in_name = utils::new_c_string("uchar")?;
7141
7142 let nodc_in: i32 = if mask_gaussian_options.nodc { 1 } else { 0 };
7143 let nodc_in_name = utils::new_c_string("nodc")?;
7144
7145 let reject_in: i32 = if mask_gaussian_options.reject { 1 } else { 0 };
7146 let reject_in_name = utils::new_c_string("reject")?;
7147
7148 let optical_in: i32 = if mask_gaussian_options.optical { 1 } else { 0 };
7149 let optical_in_name = utils::new_c_string("optical")?;
7150
7151 let vips_op_response = bindings::vips_mask_gaussian(
7152 &mut out_out,
7153 width_in,
7154 height_in,
7155 frequency_cutoff_in,
7156 amplitude_cutoff_in,
7157 uchar_in_name.as_ptr(),
7158 uchar_in,
7159 nodc_in_name.as_ptr(),
7160 nodc_in,
7161 reject_in_name.as_ptr(),
7162 reject_in,
7163 optical_in_name.as_ptr(),
7164 optical_in,
7165 NULL,
7166 );
7167 utils::result(
7168 vips_op_response,
7169 VipsImage { ctx: out_out },
7170 Error::MaskGaussianError,
7171 )
7172 }
7173}
7174
7175pub fn mask_gaussian_ring(
7188 width: i32,
7189 height: i32,
7190 frequency_cutoff: f64,
7191 amplitude_cutoff: f64,
7192 ringwidth: f64,
7193) -> Result<VipsImage> {
7194 unsafe {
7195 let width_in: i32 = width;
7196 let height_in: i32 = height;
7197 let frequency_cutoff_in: f64 = frequency_cutoff;
7198 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7199 let ringwidth_in: f64 = ringwidth;
7200 let mut out_out: *mut bindings::VipsImage = null_mut();
7201
7202 let vips_op_response = bindings::vips_mask_gaussian_ring(
7203 &mut out_out,
7204 width_in,
7205 height_in,
7206 frequency_cutoff_in,
7207 amplitude_cutoff_in,
7208 ringwidth_in,
7209 NULL,
7210 );
7211 utils::result(
7212 vips_op_response,
7213 VipsImage { ctx: out_out },
7214 Error::MaskGaussianRingError,
7215 )
7216 }
7217}
7218
7219#[derive(Clone, Debug)]
7221pub struct MaskGaussianRingOptions {
7222 pub uchar: bool,
7225 pub nodc: bool,
7228 pub reject: bool,
7231 pub optical: bool,
7234}
7235
7236impl std::default::Default for MaskGaussianRingOptions {
7237 fn default() -> Self {
7238 MaskGaussianRingOptions {
7239 uchar: false,
7240 nodc: false,
7241 reject: false,
7242 optical: false,
7243 }
7244 }
7245}
7246
7247pub fn mask_gaussian_ring_with_opts(
7261 width: i32,
7262 height: i32,
7263 frequency_cutoff: f64,
7264 amplitude_cutoff: f64,
7265 ringwidth: f64,
7266 mask_gaussian_ring_options: &MaskGaussianRingOptions,
7267) -> Result<VipsImage> {
7268 unsafe {
7269 let width_in: i32 = width;
7270 let height_in: i32 = height;
7271 let frequency_cutoff_in: f64 = frequency_cutoff;
7272 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7273 let ringwidth_in: f64 = ringwidth;
7274 let mut out_out: *mut bindings::VipsImage = null_mut();
7275
7276 let uchar_in: i32 = if mask_gaussian_ring_options.uchar {
7277 1
7278 } else {
7279 0
7280 };
7281 let uchar_in_name = utils::new_c_string("uchar")?;
7282
7283 let nodc_in: i32 = if mask_gaussian_ring_options.nodc {
7284 1
7285 } else {
7286 0
7287 };
7288 let nodc_in_name = utils::new_c_string("nodc")?;
7289
7290 let reject_in: i32 = if mask_gaussian_ring_options.reject {
7291 1
7292 } else {
7293 0
7294 };
7295 let reject_in_name = utils::new_c_string("reject")?;
7296
7297 let optical_in: i32 = if mask_gaussian_ring_options.optical {
7298 1
7299 } else {
7300 0
7301 };
7302 let optical_in_name = utils::new_c_string("optical")?;
7303
7304 let vips_op_response = bindings::vips_mask_gaussian_ring(
7305 &mut out_out,
7306 width_in,
7307 height_in,
7308 frequency_cutoff_in,
7309 amplitude_cutoff_in,
7310 ringwidth_in,
7311 uchar_in_name.as_ptr(),
7312 uchar_in,
7313 nodc_in_name.as_ptr(),
7314 nodc_in,
7315 reject_in_name.as_ptr(),
7316 reject_in,
7317 optical_in_name.as_ptr(),
7318 optical_in,
7319 NULL,
7320 );
7321 utils::result(
7322 vips_op_response,
7323 VipsImage { ctx: out_out },
7324 Error::MaskGaussianRingError,
7325 )
7326 }
7327}
7328
7329pub fn mask_gaussian_band(
7344 width: i32,
7345 height: i32,
7346 frequency_cutoff_x: f64,
7347 frequency_cutoff_y: f64,
7348 radius: f64,
7349 amplitude_cutoff: f64,
7350) -> Result<VipsImage> {
7351 unsafe {
7352 let width_in: i32 = width;
7353 let height_in: i32 = height;
7354 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7355 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7356 let radius_in: f64 = radius;
7357 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7358 let mut out_out: *mut bindings::VipsImage = null_mut();
7359
7360 let vips_op_response = bindings::vips_mask_gaussian_band(
7361 &mut out_out,
7362 width_in,
7363 height_in,
7364 frequency_cutoff_x_in,
7365 frequency_cutoff_y_in,
7366 radius_in,
7367 amplitude_cutoff_in,
7368 NULL,
7369 );
7370 utils::result(
7371 vips_op_response,
7372 VipsImage { ctx: out_out },
7373 Error::MaskGaussianBandError,
7374 )
7375 }
7376}
7377
7378#[derive(Clone, Debug)]
7380pub struct MaskGaussianBandOptions {
7381 pub uchar: bool,
7384 pub nodc: bool,
7387 pub reject: bool,
7390 pub optical: bool,
7393}
7394
7395impl std::default::Default for MaskGaussianBandOptions {
7396 fn default() -> Self {
7397 MaskGaussianBandOptions {
7398 uchar: false,
7399 nodc: false,
7400 reject: false,
7401 optical: false,
7402 }
7403 }
7404}
7405
7406pub fn mask_gaussian_band_with_opts(
7422 width: i32,
7423 height: i32,
7424 frequency_cutoff_x: f64,
7425 frequency_cutoff_y: f64,
7426 radius: f64,
7427 amplitude_cutoff: f64,
7428 mask_gaussian_band_options: &MaskGaussianBandOptions,
7429) -> Result<VipsImage> {
7430 unsafe {
7431 let width_in: i32 = width;
7432 let height_in: i32 = height;
7433 let frequency_cutoff_x_in: f64 = frequency_cutoff_x;
7434 let frequency_cutoff_y_in: f64 = frequency_cutoff_y;
7435 let radius_in: f64 = radius;
7436 let amplitude_cutoff_in: f64 = amplitude_cutoff;
7437 let mut out_out: *mut bindings::VipsImage = null_mut();
7438
7439 let uchar_in: i32 = if mask_gaussian_band_options.uchar {
7440 1
7441 } else {
7442 0
7443 };
7444 let uchar_in_name = utils::new_c_string("uchar")?;
7445
7446 let nodc_in: i32 = if mask_gaussian_band_options.nodc {
7447 1
7448 } else {
7449 0
7450 };
7451 let nodc_in_name = utils::new_c_string("nodc")?;
7452
7453 let reject_in: i32 = if mask_gaussian_band_options.reject {
7454 1
7455 } else {
7456 0
7457 };
7458 let reject_in_name = utils::new_c_string("reject")?;
7459
7460 let optical_in: i32 = if mask_gaussian_band_options.optical {
7461 1
7462 } else {
7463 0
7464 };
7465 let optical_in_name = utils::new_c_string("optical")?;
7466
7467 let vips_op_response = bindings::vips_mask_gaussian_band(
7468 &mut out_out,
7469 width_in,
7470 height_in,
7471 frequency_cutoff_x_in,
7472 frequency_cutoff_y_in,
7473 radius_in,
7474 amplitude_cutoff_in,
7475 uchar_in_name.as_ptr(),
7476 uchar_in,
7477 nodc_in_name.as_ptr(),
7478 nodc_in,
7479 reject_in_name.as_ptr(),
7480 reject_in,
7481 optical_in_name.as_ptr(),
7482 optical_in,
7483 NULL,
7484 );
7485 utils::result(
7486 vips_op_response,
7487 VipsImage { ctx: out_out },
7488 Error::MaskGaussianBandError,
7489 )
7490 }
7491}
7492
7493pub fn mask_fractal(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7502 unsafe {
7503 let width_in: i32 = width;
7504 let height_in: i32 = height;
7505 let fractal_dimension_in: f64 = fractal_dimension;
7506 let mut out_out: *mut bindings::VipsImage = null_mut();
7507
7508 let vips_op_response = bindings::vips_mask_fractal(
7509 &mut out_out,
7510 width_in,
7511 height_in,
7512 fractal_dimension_in,
7513 NULL,
7514 );
7515 utils::result(
7516 vips_op_response,
7517 VipsImage { ctx: out_out },
7518 Error::MaskFractalError,
7519 )
7520 }
7521}
7522
7523#[derive(Clone, Debug)]
7525pub struct MaskFractalOptions {
7526 pub uchar: bool,
7529 pub nodc: bool,
7532 pub reject: bool,
7535 pub optical: bool,
7538}
7539
7540impl std::default::Default for MaskFractalOptions {
7541 fn default() -> Self {
7542 MaskFractalOptions {
7543 uchar: false,
7544 nodc: false,
7545 reject: false,
7546 optical: false,
7547 }
7548 }
7549}
7550
7551pub fn mask_fractal_with_opts(
7561 width: i32,
7562 height: i32,
7563 fractal_dimension: f64,
7564 mask_fractal_options: &MaskFractalOptions,
7565) -> Result<VipsImage> {
7566 unsafe {
7567 let width_in: i32 = width;
7568 let height_in: i32 = height;
7569 let fractal_dimension_in: f64 = fractal_dimension;
7570 let mut out_out: *mut bindings::VipsImage = null_mut();
7571
7572 let uchar_in: i32 = if mask_fractal_options.uchar { 1 } else { 0 };
7573 let uchar_in_name = utils::new_c_string("uchar")?;
7574
7575 let nodc_in: i32 = if mask_fractal_options.nodc { 1 } else { 0 };
7576 let nodc_in_name = utils::new_c_string("nodc")?;
7577
7578 let reject_in: i32 = if mask_fractal_options.reject { 1 } else { 0 };
7579 let reject_in_name = utils::new_c_string("reject")?;
7580
7581 let optical_in: i32 = if mask_fractal_options.optical { 1 } else { 0 };
7582 let optical_in_name = utils::new_c_string("optical")?;
7583
7584 let vips_op_response = bindings::vips_mask_fractal(
7585 &mut out_out,
7586 width_in,
7587 height_in,
7588 fractal_dimension_in,
7589 uchar_in_name.as_ptr(),
7590 uchar_in,
7591 nodc_in_name.as_ptr(),
7592 nodc_in,
7593 reject_in_name.as_ptr(),
7594 reject_in,
7595 optical_in_name.as_ptr(),
7596 optical_in,
7597 NULL,
7598 );
7599 utils::result(
7600 vips_op_response,
7601 VipsImage { ctx: out_out },
7602 Error::MaskFractalError,
7603 )
7604 }
7605}
7606
7607pub fn buildlut(inp: &VipsImage) -> Result<VipsImage> {
7611 unsafe {
7612 let inp_in: *mut bindings::VipsImage = inp.ctx;
7613 let mut out_out: *mut bindings::VipsImage = null_mut();
7614
7615 let vips_op_response = bindings::vips_buildlut(inp_in, &mut out_out, NULL);
7616 utils::result(
7617 vips_op_response,
7618 VipsImage { ctx: out_out },
7619 Error::BuildlutError,
7620 )
7621 }
7622}
7623
7624pub fn invertlut(inp: &VipsImage) -> Result<VipsImage> {
7628 unsafe {
7629 let inp_in: *mut bindings::VipsImage = inp.ctx;
7630 let mut out_out: *mut bindings::VipsImage = null_mut();
7631
7632 let vips_op_response = bindings::vips_invertlut(inp_in, &mut out_out, NULL);
7633 utils::result(
7634 vips_op_response,
7635 VipsImage { ctx: out_out },
7636 Error::InvertlutError,
7637 )
7638 }
7639}
7640
7641#[derive(Clone, Debug)]
7643pub struct InvertlutOptions {
7644 pub size: i32,
7647}
7648
7649impl std::default::Default for InvertlutOptions {
7650 fn default() -> Self {
7651 InvertlutOptions {
7652 size: i32::from(256),
7653 }
7654 }
7655}
7656
7657pub fn invertlut_with_opts(
7662 inp: &VipsImage,
7663 invertlut_options: &InvertlutOptions,
7664) -> Result<VipsImage> {
7665 unsafe {
7666 let inp_in: *mut bindings::VipsImage = inp.ctx;
7667 let mut out_out: *mut bindings::VipsImage = null_mut();
7668
7669 let size_in: i32 = invertlut_options.size;
7670 let size_in_name = utils::new_c_string("size")?;
7671
7672 let vips_op_response =
7673 bindings::vips_invertlut(inp_in, &mut out_out, size_in_name.as_ptr(), size_in, NULL);
7674 utils::result(
7675 vips_op_response,
7676 VipsImage { ctx: out_out },
7677 Error::InvertlutError,
7678 )
7679 }
7680}
7681
7682pub fn tonelut() -> Result<VipsImage> {
7686 unsafe {
7687 let mut out_out: *mut bindings::VipsImage = null_mut();
7688
7689 let vips_op_response = bindings::vips_tonelut(&mut out_out, NULL);
7690 utils::result(
7691 vips_op_response,
7692 VipsImage { ctx: out_out },
7693 Error::TonelutError,
7694 )
7695 }
7696}
7697
7698#[derive(Clone, Debug)]
7700pub struct TonelutOptions {
7701 pub in_max: i32,
7704 pub out_max: i32,
7707 pub lb: f64,
7710 pub lw: f64,
7713 pub ps: f64,
7716 pub pm: f64,
7719 pub ph: f64,
7722 pub s: f64,
7725 pub m: f64,
7728 pub h: f64,
7731}
7732
7733impl std::default::Default for TonelutOptions {
7734 fn default() -> Self {
7735 TonelutOptions {
7736 in_max: i32::from(32767),
7737 out_max: i32::from(32767),
7738 lb: f64::from(0),
7739 lw: f64::from(100),
7740 ps: f64::from(0.2),
7741 pm: f64::from(0.5),
7742 ph: f64::from(0.8),
7743 s: f64::from(0),
7744 m: f64::from(0),
7745 h: f64::from(0),
7746 }
7747 }
7748}
7749
7750pub fn tonelut_with_opts(tonelut_options: &TonelutOptions) -> Result<VipsImage> {
7755 unsafe {
7756 let mut out_out: *mut bindings::VipsImage = null_mut();
7757
7758 let in_max_in: i32 = tonelut_options.in_max;
7759 let in_max_in_name = utils::new_c_string("in-max")?;
7760
7761 let out_max_in: i32 = tonelut_options.out_max;
7762 let out_max_in_name = utils::new_c_string("out-max")?;
7763
7764 let lb_in: f64 = tonelut_options.lb;
7765 let lb_in_name = utils::new_c_string("Lb")?;
7766
7767 let lw_in: f64 = tonelut_options.lw;
7768 let lw_in_name = utils::new_c_string("Lw")?;
7769
7770 let ps_in: f64 = tonelut_options.ps;
7771 let ps_in_name = utils::new_c_string("Ps")?;
7772
7773 let pm_in: f64 = tonelut_options.pm;
7774 let pm_in_name = utils::new_c_string("Pm")?;
7775
7776 let ph_in: f64 = tonelut_options.ph;
7777 let ph_in_name = utils::new_c_string("Ph")?;
7778
7779 let s_in: f64 = tonelut_options.s;
7780 let s_in_name = utils::new_c_string("S")?;
7781
7782 let m_in: f64 = tonelut_options.m;
7783 let m_in_name = utils::new_c_string("M")?;
7784
7785 let h_in: f64 = tonelut_options.h;
7786 let h_in_name = utils::new_c_string("H")?;
7787
7788 let vips_op_response = bindings::vips_tonelut(
7789 &mut out_out,
7790 in_max_in_name.as_ptr(),
7791 in_max_in,
7792 out_max_in_name.as_ptr(),
7793 out_max_in,
7794 lb_in_name.as_ptr(),
7795 lb_in,
7796 lw_in_name.as_ptr(),
7797 lw_in,
7798 ps_in_name.as_ptr(),
7799 ps_in,
7800 pm_in_name.as_ptr(),
7801 pm_in,
7802 ph_in_name.as_ptr(),
7803 ph_in,
7804 s_in_name.as_ptr(),
7805 s_in,
7806 m_in_name.as_ptr(),
7807 m_in,
7808 h_in_name.as_ptr(),
7809 h_in,
7810 NULL,
7811 );
7812 utils::result(
7813 vips_op_response,
7814 VipsImage { ctx: out_out },
7815 Error::TonelutError,
7816 )
7817 }
7818}
7819
7820pub fn identity() -> Result<VipsImage> {
7824 unsafe {
7825 let mut out_out: *mut bindings::VipsImage = null_mut();
7826
7827 let vips_op_response = bindings::vips_identity(&mut out_out, NULL);
7828 utils::result(
7829 vips_op_response,
7830 VipsImage { ctx: out_out },
7831 Error::IdentityError,
7832 )
7833 }
7834}
7835
7836#[derive(Clone, Debug)]
7838pub struct IdentityOptions {
7839 pub bands: i32,
7842 pub ushort: bool,
7845 pub size: i32,
7848}
7849
7850impl std::default::Default for IdentityOptions {
7851 fn default() -> Self {
7852 IdentityOptions {
7853 bands: i32::from(1),
7854 ushort: false,
7855 size: i32::from(65536),
7856 }
7857 }
7858}
7859
7860pub fn identity_with_opts(identity_options: &IdentityOptions) -> Result<VipsImage> {
7865 unsafe {
7866 let mut out_out: *mut bindings::VipsImage = null_mut();
7867
7868 let bands_in: i32 = identity_options.bands;
7869 let bands_in_name = utils::new_c_string("bands")?;
7870
7871 let ushort_in: i32 = if identity_options.ushort { 1 } else { 0 };
7872 let ushort_in_name = utils::new_c_string("ushort")?;
7873
7874 let size_in: i32 = identity_options.size;
7875 let size_in_name = utils::new_c_string("size")?;
7876
7877 let vips_op_response = bindings::vips_identity(
7878 &mut out_out,
7879 bands_in_name.as_ptr(),
7880 bands_in,
7881 ushort_in_name.as_ptr(),
7882 ushort_in,
7883 size_in_name.as_ptr(),
7884 size_in,
7885 NULL,
7886 );
7887 utils::result(
7888 vips_op_response,
7889 VipsImage { ctx: out_out },
7890 Error::IdentityError,
7891 )
7892 }
7893}
7894
7895pub fn fractsurf(width: i32, height: i32, fractal_dimension: f64) -> Result<VipsImage> {
7904 unsafe {
7905 let width_in: i32 = width;
7906 let height_in: i32 = height;
7907 let fractal_dimension_in: f64 = fractal_dimension;
7908 let mut out_out: *mut bindings::VipsImage = null_mut();
7909
7910 let vips_op_response = bindings::vips_fractsurf(
7911 &mut out_out,
7912 width_in,
7913 height_in,
7914 fractal_dimension_in,
7915 NULL,
7916 );
7917 utils::result(
7918 vips_op_response,
7919 VipsImage { ctx: out_out },
7920 Error::FractsurfError,
7921 )
7922 }
7923}
7924
7925pub fn worley(width: i32, height: i32) -> Result<VipsImage> {
7932 unsafe {
7933 let width_in: i32 = width;
7934 let height_in: i32 = height;
7935 let mut out_out: *mut bindings::VipsImage = null_mut();
7936
7937 let vips_op_response = bindings::vips_worley(&mut out_out, width_in, height_in, NULL);
7938 utils::result(
7939 vips_op_response,
7940 VipsImage { ctx: out_out },
7941 Error::WorleyError,
7942 )
7943 }
7944}
7945
7946#[derive(Clone, Debug)]
7948pub struct WorleyOptions {
7949 pub cell_size: i32,
7952 pub seed: i32,
7955}
7956
7957impl std::default::Default for WorleyOptions {
7958 fn default() -> Self {
7959 WorleyOptions {
7960 cell_size: i32::from(256),
7961 seed: i32::from(0),
7962 }
7963 }
7964}
7965
7966pub fn worley_with_opts(
7974 width: i32,
7975 height: i32,
7976 worley_options: &WorleyOptions,
7977) -> Result<VipsImage> {
7978 unsafe {
7979 let width_in: i32 = width;
7980 let height_in: i32 = height;
7981 let mut out_out: *mut bindings::VipsImage = null_mut();
7982
7983 let cell_size_in: i32 = worley_options.cell_size;
7984 let cell_size_in_name = utils::new_c_string("cell-size")?;
7985
7986 let seed_in: i32 = worley_options.seed;
7987 let seed_in_name = utils::new_c_string("seed")?;
7988
7989 let vips_op_response = bindings::vips_worley(
7990 &mut out_out,
7991 width_in,
7992 height_in,
7993 cell_size_in_name.as_ptr(),
7994 cell_size_in,
7995 seed_in_name.as_ptr(),
7996 seed_in,
7997 NULL,
7998 );
7999 utils::result(
8000 vips_op_response,
8001 VipsImage { ctx: out_out },
8002 Error::WorleyError,
8003 )
8004 }
8005}
8006
8007pub fn perlin(width: i32, height: i32) -> Result<VipsImage> {
8014 unsafe {
8015 let width_in: i32 = width;
8016 let height_in: i32 = height;
8017 let mut out_out: *mut bindings::VipsImage = null_mut();
8018
8019 let vips_op_response = bindings::vips_perlin(&mut out_out, width_in, height_in, NULL);
8020 utils::result(
8021 vips_op_response,
8022 VipsImage { ctx: out_out },
8023 Error::PerlinError,
8024 )
8025 }
8026}
8027
8028#[derive(Clone, Debug)]
8030pub struct PerlinOptions {
8031 pub cell_size: i32,
8034 pub uchar: bool,
8037 pub seed: i32,
8040}
8041
8042impl std::default::Default for PerlinOptions {
8043 fn default() -> Self {
8044 PerlinOptions {
8045 cell_size: i32::from(256),
8046 uchar: false,
8047 seed: i32::from(0),
8048 }
8049 }
8050}
8051
8052pub fn perlin_with_opts(
8060 width: i32,
8061 height: i32,
8062 perlin_options: &PerlinOptions,
8063) -> Result<VipsImage> {
8064 unsafe {
8065 let width_in: i32 = width;
8066 let height_in: i32 = height;
8067 let mut out_out: *mut bindings::VipsImage = null_mut();
8068
8069 let cell_size_in: i32 = perlin_options.cell_size;
8070 let cell_size_in_name = utils::new_c_string("cell-size")?;
8071
8072 let uchar_in: i32 = if perlin_options.uchar { 1 } else { 0 };
8073 let uchar_in_name = utils::new_c_string("uchar")?;
8074
8075 let seed_in: i32 = perlin_options.seed;
8076 let seed_in_name = utils::new_c_string("seed")?;
8077
8078 let vips_op_response = bindings::vips_perlin(
8079 &mut out_out,
8080 width_in,
8081 height_in,
8082 cell_size_in_name.as_ptr(),
8083 cell_size_in,
8084 uchar_in_name.as_ptr(),
8085 uchar_in,
8086 seed_in_name.as_ptr(),
8087 seed_in,
8088 NULL,
8089 );
8090 utils::result(
8091 vips_op_response,
8092 VipsImage { ctx: out_out },
8093 Error::PerlinError,
8094 )
8095 }
8096}
8097
8098pub fn switch(tests: &mut [VipsImage]) -> Result<VipsImage> {
8102 unsafe {
8103 let (tests_len, mut tests_in) = {
8104 let len = tests.len();
8105 let mut input = Vec::new();
8106 for img in tests {
8107 input.push(img.ctx)
8108 }
8109 (len as i32, input)
8110 };
8111 let mut out_out: *mut bindings::VipsImage = null_mut();
8112
8113 let vips_op_response =
8114 bindings::vips_switch(tests_in.as_mut_ptr(), &mut out_out, tests_len, NULL);
8115 utils::result(
8116 vips_op_response,
8117 VipsImage { ctx: out_out },
8118 Error::SwitchError,
8119 )
8120 }
8121}
8122
8123pub fn csvload(filename: &str) -> Result<VipsImage> {
8127 unsafe {
8128 let filename_in: CString = utils::new_c_string(filename)?;
8129 let mut out_out: *mut bindings::VipsImage = null_mut();
8130
8131 let vips_op_response = bindings::vips_csvload(filename_in.as_ptr(), &mut out_out, NULL);
8132 utils::result(
8133 vips_op_response,
8134 VipsImage { ctx: out_out },
8135 Error::CsvloadError,
8136 )
8137 }
8138}
8139
8140#[derive(Clone, Debug)]
8142pub struct CsvloadOptions {
8143 pub skip: i32,
8146 pub lines: i32,
8149 pub whitespace: String,
8151 pub separator: String,
8153 pub flags: ForeignFlags,
8160 pub memory: bool,
8163 pub access: Access,
8169 pub fail_on: FailOn,
8176 pub revalidate: bool,
8179}
8180
8181impl std::default::Default for CsvloadOptions {
8182 fn default() -> Self {
8183 CsvloadOptions {
8184 skip: i32::from(0),
8185 lines: i32::from(0),
8186 whitespace: String::new(),
8187 separator: String::new(),
8188 flags: ForeignFlags::None,
8189 memory: false,
8190 access: Access::Random,
8191 fail_on: FailOn::None,
8192 revalidate: false,
8193 }
8194 }
8195}
8196
8197pub fn csvload_with_opts(filename: &str, csvload_options: &CsvloadOptions) -> Result<VipsImage> {
8202 unsafe {
8203 let filename_in: CString = utils::new_c_string(filename)?;
8204 let mut out_out: *mut bindings::VipsImage = null_mut();
8205
8206 let skip_in: i32 = csvload_options.skip;
8207 let skip_in_name = utils::new_c_string("skip")?;
8208
8209 let lines_in: i32 = csvload_options.lines;
8210 let lines_in_name = utils::new_c_string("lines")?;
8211
8212 let whitespace_in: CString = utils::new_c_string(&csvload_options.whitespace)?;
8213 let whitespace_in_name = utils::new_c_string("whitespace")?;
8214
8215 let separator_in: CString = utils::new_c_string(&csvload_options.separator)?;
8216 let separator_in_name = utils::new_c_string("separator")?;
8217
8218 let flags_in: i32 = csvload_options.flags as i32;
8219 let flags_in_name = utils::new_c_string("flags")?;
8220
8221 let memory_in: i32 = if csvload_options.memory { 1 } else { 0 };
8222 let memory_in_name = utils::new_c_string("memory")?;
8223
8224 let access_in: i32 = csvload_options.access as i32;
8225 let access_in_name = utils::new_c_string("access")?;
8226
8227 let fail_on_in: i32 = csvload_options.fail_on as i32;
8228 let fail_on_in_name = utils::new_c_string("fail-on")?;
8229
8230 let revalidate_in: i32 = if csvload_options.revalidate { 1 } else { 0 };
8231 let revalidate_in_name = utils::new_c_string("revalidate")?;
8232
8233 let vips_op_response = bindings::vips_csvload(
8234 filename_in.as_ptr(),
8235 &mut out_out,
8236 skip_in_name.as_ptr(),
8237 skip_in,
8238 lines_in_name.as_ptr(),
8239 lines_in,
8240 whitespace_in_name.as_ptr(),
8241 whitespace_in.as_ptr(),
8242 separator_in_name.as_ptr(),
8243 separator_in.as_ptr(),
8244 flags_in_name.as_ptr(),
8245 flags_in,
8246 memory_in_name.as_ptr(),
8247 memory_in,
8248 access_in_name.as_ptr(),
8249 access_in,
8250 fail_on_in_name.as_ptr(),
8251 fail_on_in,
8252 revalidate_in_name.as_ptr(),
8253 revalidate_in,
8254 NULL,
8255 );
8256 utils::result(
8257 vips_op_response,
8258 VipsImage { ctx: out_out },
8259 Error::CsvloadError,
8260 )
8261 }
8262}
8263
8264pub fn csvload_source(source: &VipsSource) -> Result<VipsImage> {
8268 unsafe {
8269 let source_in: *mut bindings::VipsSource = source.ctx;
8270 let mut out_out: *mut bindings::VipsImage = null_mut();
8271
8272 let vips_op_response = bindings::vips_csvload_source(source_in, &mut out_out, NULL);
8273 utils::result(
8274 vips_op_response,
8275 VipsImage { ctx: out_out },
8276 Error::CsvloadSourceError,
8277 )
8278 }
8279}
8280
8281#[derive(Clone, Debug)]
8283pub struct CsvloadSourceOptions {
8284 pub skip: i32,
8287 pub lines: i32,
8290 pub whitespace: String,
8292 pub separator: String,
8294 pub flags: ForeignFlags,
8301 pub memory: bool,
8304 pub access: Access,
8310 pub fail_on: FailOn,
8317 pub revalidate: bool,
8320}
8321
8322impl std::default::Default for CsvloadSourceOptions {
8323 fn default() -> Self {
8324 CsvloadSourceOptions {
8325 skip: i32::from(0),
8326 lines: i32::from(0),
8327 whitespace: String::new(),
8328 separator: String::new(),
8329 flags: ForeignFlags::None,
8330 memory: false,
8331 access: Access::Random,
8332 fail_on: FailOn::None,
8333 revalidate: false,
8334 }
8335 }
8336}
8337
8338pub fn csvload_source_with_opts(
8343 source: &VipsSource,
8344 csvload_source_options: &CsvloadSourceOptions,
8345) -> Result<VipsImage> {
8346 unsafe {
8347 let source_in: *mut bindings::VipsSource = source.ctx;
8348 let mut out_out: *mut bindings::VipsImage = null_mut();
8349
8350 let skip_in: i32 = csvload_source_options.skip;
8351 let skip_in_name = utils::new_c_string("skip")?;
8352
8353 let lines_in: i32 = csvload_source_options.lines;
8354 let lines_in_name = utils::new_c_string("lines")?;
8355
8356 let whitespace_in: CString = utils::new_c_string(&csvload_source_options.whitespace)?;
8357 let whitespace_in_name = utils::new_c_string("whitespace")?;
8358
8359 let separator_in: CString = utils::new_c_string(&csvload_source_options.separator)?;
8360 let separator_in_name = utils::new_c_string("separator")?;
8361
8362 let flags_in: i32 = csvload_source_options.flags as i32;
8363 let flags_in_name = utils::new_c_string("flags")?;
8364
8365 let memory_in: i32 = if csvload_source_options.memory { 1 } else { 0 };
8366 let memory_in_name = utils::new_c_string("memory")?;
8367
8368 let access_in: i32 = csvload_source_options.access as i32;
8369 let access_in_name = utils::new_c_string("access")?;
8370
8371 let fail_on_in: i32 = csvload_source_options.fail_on as i32;
8372 let fail_on_in_name = utils::new_c_string("fail-on")?;
8373
8374 let revalidate_in: i32 = if csvload_source_options.revalidate {
8375 1
8376 } else {
8377 0
8378 };
8379 let revalidate_in_name = utils::new_c_string("revalidate")?;
8380
8381 let vips_op_response = bindings::vips_csvload_source(
8382 source_in,
8383 &mut out_out,
8384 skip_in_name.as_ptr(),
8385 skip_in,
8386 lines_in_name.as_ptr(),
8387 lines_in,
8388 whitespace_in_name.as_ptr(),
8389 whitespace_in.as_ptr(),
8390 separator_in_name.as_ptr(),
8391 separator_in.as_ptr(),
8392 flags_in_name.as_ptr(),
8393 flags_in,
8394 memory_in_name.as_ptr(),
8395 memory_in,
8396 access_in_name.as_ptr(),
8397 access_in,
8398 fail_on_in_name.as_ptr(),
8399 fail_on_in,
8400 revalidate_in_name.as_ptr(),
8401 revalidate_in,
8402 NULL,
8403 );
8404 utils::result(
8405 vips_op_response,
8406 VipsImage { ctx: out_out },
8407 Error::CsvloadSourceError,
8408 )
8409 }
8410}
8411
8412pub fn matrixload(filename: &str) -> Result<VipsImage> {
8416 unsafe {
8417 let filename_in: CString = utils::new_c_string(filename)?;
8418 let mut out_out: *mut bindings::VipsImage = null_mut();
8419
8420 let vips_op_response = bindings::vips_matrixload(filename_in.as_ptr(), &mut out_out, NULL);
8421 utils::result(
8422 vips_op_response,
8423 VipsImage { ctx: out_out },
8424 Error::MatrixloadError,
8425 )
8426 }
8427}
8428
8429#[derive(Clone, Debug)]
8431pub struct MatrixloadOptions {
8432 pub flags: ForeignFlags,
8439 pub memory: bool,
8442 pub access: Access,
8448 pub fail_on: FailOn,
8455 pub revalidate: bool,
8458}
8459
8460impl std::default::Default for MatrixloadOptions {
8461 fn default() -> Self {
8462 MatrixloadOptions {
8463 flags: ForeignFlags::None,
8464 memory: false,
8465 access: Access::Random,
8466 fail_on: FailOn::None,
8467 revalidate: false,
8468 }
8469 }
8470}
8471
8472pub fn matrixload_with_opts(
8477 filename: &str,
8478 matrixload_options: &MatrixloadOptions,
8479) -> Result<VipsImage> {
8480 unsafe {
8481 let filename_in: CString = utils::new_c_string(filename)?;
8482 let mut out_out: *mut bindings::VipsImage = null_mut();
8483
8484 let flags_in: i32 = matrixload_options.flags as i32;
8485 let flags_in_name = utils::new_c_string("flags")?;
8486
8487 let memory_in: i32 = if matrixload_options.memory { 1 } else { 0 };
8488 let memory_in_name = utils::new_c_string("memory")?;
8489
8490 let access_in: i32 = matrixload_options.access as i32;
8491 let access_in_name = utils::new_c_string("access")?;
8492
8493 let fail_on_in: i32 = matrixload_options.fail_on as i32;
8494 let fail_on_in_name = utils::new_c_string("fail-on")?;
8495
8496 let revalidate_in: i32 = if matrixload_options.revalidate { 1 } else { 0 };
8497 let revalidate_in_name = utils::new_c_string("revalidate")?;
8498
8499 let vips_op_response = bindings::vips_matrixload(
8500 filename_in.as_ptr(),
8501 &mut out_out,
8502 flags_in_name.as_ptr(),
8503 flags_in,
8504 memory_in_name.as_ptr(),
8505 memory_in,
8506 access_in_name.as_ptr(),
8507 access_in,
8508 fail_on_in_name.as_ptr(),
8509 fail_on_in,
8510 revalidate_in_name.as_ptr(),
8511 revalidate_in,
8512 NULL,
8513 );
8514 utils::result(
8515 vips_op_response,
8516 VipsImage { ctx: out_out },
8517 Error::MatrixloadError,
8518 )
8519 }
8520}
8521
8522pub fn matrixload_source(source: &VipsSource) -> Result<VipsImage> {
8526 unsafe {
8527 let source_in: *mut bindings::VipsSource = source.ctx;
8528 let mut out_out: *mut bindings::VipsImage = null_mut();
8529
8530 let vips_op_response = bindings::vips_matrixload_source(source_in, &mut out_out, NULL);
8531 utils::result(
8532 vips_op_response,
8533 VipsImage { ctx: out_out },
8534 Error::MatrixloadSourceError,
8535 )
8536 }
8537}
8538
8539#[derive(Clone, Debug)]
8541pub struct MatrixloadSourceOptions {
8542 pub flags: ForeignFlags,
8549 pub memory: bool,
8552 pub access: Access,
8558 pub fail_on: FailOn,
8565 pub revalidate: bool,
8568}
8569
8570impl std::default::Default for MatrixloadSourceOptions {
8571 fn default() -> Self {
8572 MatrixloadSourceOptions {
8573 flags: ForeignFlags::None,
8574 memory: false,
8575 access: Access::Random,
8576 fail_on: FailOn::None,
8577 revalidate: false,
8578 }
8579 }
8580}
8581
8582pub fn matrixload_source_with_opts(
8587 source: &VipsSource,
8588 matrixload_source_options: &MatrixloadSourceOptions,
8589) -> Result<VipsImage> {
8590 unsafe {
8591 let source_in: *mut bindings::VipsSource = source.ctx;
8592 let mut out_out: *mut bindings::VipsImage = null_mut();
8593
8594 let flags_in: i32 = matrixload_source_options.flags as i32;
8595 let flags_in_name = utils::new_c_string("flags")?;
8596
8597 let memory_in: i32 = if matrixload_source_options.memory {
8598 1
8599 } else {
8600 0
8601 };
8602 let memory_in_name = utils::new_c_string("memory")?;
8603
8604 let access_in: i32 = matrixload_source_options.access as i32;
8605 let access_in_name = utils::new_c_string("access")?;
8606
8607 let fail_on_in: i32 = matrixload_source_options.fail_on as i32;
8608 let fail_on_in_name = utils::new_c_string("fail-on")?;
8609
8610 let revalidate_in: i32 = if matrixload_source_options.revalidate {
8611 1
8612 } else {
8613 0
8614 };
8615 let revalidate_in_name = utils::new_c_string("revalidate")?;
8616
8617 let vips_op_response = bindings::vips_matrixload_source(
8618 source_in,
8619 &mut out_out,
8620 flags_in_name.as_ptr(),
8621 flags_in,
8622 memory_in_name.as_ptr(),
8623 memory_in,
8624 access_in_name.as_ptr(),
8625 access_in,
8626 fail_on_in_name.as_ptr(),
8627 fail_on_in,
8628 revalidate_in_name.as_ptr(),
8629 revalidate_in,
8630 NULL,
8631 );
8632 utils::result(
8633 vips_op_response,
8634 VipsImage { ctx: out_out },
8635 Error::MatrixloadSourceError,
8636 )
8637 }
8638}
8639
8640pub fn rawload(filename: &str, width: i32, height: i32, bands: i32) -> Result<VipsImage> {
8650 unsafe {
8651 let filename_in: CString = utils::new_c_string(filename)?;
8652 let width_in: i32 = width;
8653 let height_in: i32 = height;
8654 let bands_in: i32 = bands;
8655 let mut out_out: *mut bindings::VipsImage = null_mut();
8656
8657 let vips_op_response = bindings::vips_rawload(
8658 filename_in.as_ptr(),
8659 &mut out_out,
8660 width_in,
8661 height_in,
8662 bands_in,
8663 NULL,
8664 );
8665 utils::result(
8666 vips_op_response,
8667 VipsImage { ctx: out_out },
8668 Error::RawloadError,
8669 )
8670 }
8671}
8672
8673#[derive(Clone, Debug)]
8675pub struct RawloadOptions {
8676 pub offset: u64,
8679 pub format: BandFormat,
8693 pub interpretation: Interpretation,
8716 pub flags: ForeignFlags,
8723 pub memory: bool,
8726 pub access: Access,
8732 pub fail_on: FailOn,
8739 pub revalidate: bool,
8742}
8743
8744impl std::default::Default for RawloadOptions {
8745 fn default() -> Self {
8746 RawloadOptions {
8747 offset: 0,
8748 format: BandFormat::Uchar,
8749 interpretation: Interpretation::Multiband,
8750 flags: ForeignFlags::None,
8751 memory: false,
8752 access: Access::Random,
8753 fail_on: FailOn::None,
8754 revalidate: false,
8755 }
8756 }
8757}
8758
8759pub fn rawload_with_opts(
8770 filename: &str,
8771 width: i32,
8772 height: i32,
8773 bands: i32,
8774 rawload_options: &RawloadOptions,
8775) -> Result<VipsImage> {
8776 unsafe {
8777 let filename_in: CString = utils::new_c_string(filename)?;
8778 let width_in: i32 = width;
8779 let height_in: i32 = height;
8780 let bands_in: i32 = bands;
8781 let mut out_out: *mut bindings::VipsImage = null_mut();
8782
8783 let offset_in: u64 = rawload_options.offset;
8784 let offset_in_name = utils::new_c_string("offset")?;
8785
8786 let format_in: i32 = rawload_options.format as i32;
8787 let format_in_name = utils::new_c_string("format")?;
8788
8789 let interpretation_in: i32 = rawload_options.interpretation as i32;
8790 let interpretation_in_name = utils::new_c_string("interpretation")?;
8791
8792 let flags_in: i32 = rawload_options.flags as i32;
8793 let flags_in_name = utils::new_c_string("flags")?;
8794
8795 let memory_in: i32 = if rawload_options.memory { 1 } else { 0 };
8796 let memory_in_name = utils::new_c_string("memory")?;
8797
8798 let access_in: i32 = rawload_options.access as i32;
8799 let access_in_name = utils::new_c_string("access")?;
8800
8801 let fail_on_in: i32 = rawload_options.fail_on as i32;
8802 let fail_on_in_name = utils::new_c_string("fail-on")?;
8803
8804 let revalidate_in: i32 = if rawload_options.revalidate { 1 } else { 0 };
8805 let revalidate_in_name = utils::new_c_string("revalidate")?;
8806
8807 let vips_op_response = bindings::vips_rawload(
8808 filename_in.as_ptr(),
8809 &mut out_out,
8810 width_in,
8811 height_in,
8812 bands_in,
8813 offset_in_name.as_ptr(),
8814 offset_in,
8815 format_in_name.as_ptr(),
8816 format_in,
8817 interpretation_in_name.as_ptr(),
8818 interpretation_in,
8819 flags_in_name.as_ptr(),
8820 flags_in,
8821 memory_in_name.as_ptr(),
8822 memory_in,
8823 access_in_name.as_ptr(),
8824 access_in,
8825 fail_on_in_name.as_ptr(),
8826 fail_on_in,
8827 revalidate_in_name.as_ptr(),
8828 revalidate_in,
8829 NULL,
8830 );
8831 utils::result(
8832 vips_op_response,
8833 VipsImage { ctx: out_out },
8834 Error::RawloadError,
8835 )
8836 }
8837}
8838
8839pub fn vipsload(filename: &str) -> Result<VipsImage> {
8843 unsafe {
8844 let filename_in: CString = utils::new_c_string(filename)?;
8845 let mut out_out: *mut bindings::VipsImage = null_mut();
8846
8847 let vips_op_response = bindings::vips_vipsload(filename_in.as_ptr(), &mut out_out, NULL);
8848 utils::result(
8849 vips_op_response,
8850 VipsImage { ctx: out_out },
8851 Error::VipsloadError,
8852 )
8853 }
8854}
8855
8856#[derive(Clone, Debug)]
8858pub struct VipsloadOptions {
8859 pub flags: ForeignFlags,
8866 pub memory: bool,
8869 pub access: Access,
8875 pub fail_on: FailOn,
8882 pub revalidate: bool,
8885}
8886
8887impl std::default::Default for VipsloadOptions {
8888 fn default() -> Self {
8889 VipsloadOptions {
8890 flags: ForeignFlags::None,
8891 memory: false,
8892 access: Access::Random,
8893 fail_on: FailOn::None,
8894 revalidate: false,
8895 }
8896 }
8897}
8898
8899pub fn vipsload_with_opts(filename: &str, vipsload_options: &VipsloadOptions) -> Result<VipsImage> {
8904 unsafe {
8905 let filename_in: CString = utils::new_c_string(filename)?;
8906 let mut out_out: *mut bindings::VipsImage = null_mut();
8907
8908 let flags_in: i32 = vipsload_options.flags as i32;
8909 let flags_in_name = utils::new_c_string("flags")?;
8910
8911 let memory_in: i32 = if vipsload_options.memory { 1 } else { 0 };
8912 let memory_in_name = utils::new_c_string("memory")?;
8913
8914 let access_in: i32 = vipsload_options.access as i32;
8915 let access_in_name = utils::new_c_string("access")?;
8916
8917 let fail_on_in: i32 = vipsload_options.fail_on as i32;
8918 let fail_on_in_name = utils::new_c_string("fail-on")?;
8919
8920 let revalidate_in: i32 = if vipsload_options.revalidate { 1 } else { 0 };
8921 let revalidate_in_name = utils::new_c_string("revalidate")?;
8922
8923 let vips_op_response = bindings::vips_vipsload(
8924 filename_in.as_ptr(),
8925 &mut out_out,
8926 flags_in_name.as_ptr(),
8927 flags_in,
8928 memory_in_name.as_ptr(),
8929 memory_in,
8930 access_in_name.as_ptr(),
8931 access_in,
8932 fail_on_in_name.as_ptr(),
8933 fail_on_in,
8934 revalidate_in_name.as_ptr(),
8935 revalidate_in,
8936 NULL,
8937 );
8938 utils::result(
8939 vips_op_response,
8940 VipsImage { ctx: out_out },
8941 Error::VipsloadError,
8942 )
8943 }
8944}
8945
8946pub fn vipsload_source(source: &VipsSource) -> Result<VipsImage> {
8950 unsafe {
8951 let source_in: *mut bindings::VipsSource = source.ctx;
8952 let mut out_out: *mut bindings::VipsImage = null_mut();
8953
8954 let vips_op_response = bindings::vips_vipsload_source(source_in, &mut out_out, NULL);
8955 utils::result(
8956 vips_op_response,
8957 VipsImage { ctx: out_out },
8958 Error::VipsloadSourceError,
8959 )
8960 }
8961}
8962
8963#[derive(Clone, Debug)]
8965pub struct VipsloadSourceOptions {
8966 pub flags: ForeignFlags,
8973 pub memory: bool,
8976 pub access: Access,
8982 pub fail_on: FailOn,
8989 pub revalidate: bool,
8992}
8993
8994impl std::default::Default for VipsloadSourceOptions {
8995 fn default() -> Self {
8996 VipsloadSourceOptions {
8997 flags: ForeignFlags::None,
8998 memory: false,
8999 access: Access::Random,
9000 fail_on: FailOn::None,
9001 revalidate: false,
9002 }
9003 }
9004}
9005
9006pub fn vipsload_source_with_opts(
9011 source: &VipsSource,
9012 vipsload_source_options: &VipsloadSourceOptions,
9013) -> Result<VipsImage> {
9014 unsafe {
9015 let source_in: *mut bindings::VipsSource = source.ctx;
9016 let mut out_out: *mut bindings::VipsImage = null_mut();
9017
9018 let flags_in: i32 = vipsload_source_options.flags as i32;
9019 let flags_in_name = utils::new_c_string("flags")?;
9020
9021 let memory_in: i32 = if vipsload_source_options.memory { 1 } else { 0 };
9022 let memory_in_name = utils::new_c_string("memory")?;
9023
9024 let access_in: i32 = vipsload_source_options.access as i32;
9025 let access_in_name = utils::new_c_string("access")?;
9026
9027 let fail_on_in: i32 = vipsload_source_options.fail_on as i32;
9028 let fail_on_in_name = utils::new_c_string("fail-on")?;
9029
9030 let revalidate_in: i32 = if vipsload_source_options.revalidate {
9031 1
9032 } else {
9033 0
9034 };
9035 let revalidate_in_name = utils::new_c_string("revalidate")?;
9036
9037 let vips_op_response = bindings::vips_vipsload_source(
9038 source_in,
9039 &mut out_out,
9040 flags_in_name.as_ptr(),
9041 flags_in,
9042 memory_in_name.as_ptr(),
9043 memory_in,
9044 access_in_name.as_ptr(),
9045 access_in,
9046 fail_on_in_name.as_ptr(),
9047 fail_on_in,
9048 revalidate_in_name.as_ptr(),
9049 revalidate_in,
9050 NULL,
9051 );
9052 utils::result(
9053 vips_op_response,
9054 VipsImage { ctx: out_out },
9055 Error::VipsloadSourceError,
9056 )
9057 }
9058}
9059
9060pub fn analyzeload(filename: &str) -> Result<VipsImage> {
9064 unsafe {
9065 let filename_in: CString = utils::new_c_string(filename)?;
9066 let mut out_out: *mut bindings::VipsImage = null_mut();
9067
9068 let vips_op_response = bindings::vips_analyzeload(filename_in.as_ptr(), &mut out_out, NULL);
9069 utils::result(
9070 vips_op_response,
9071 VipsImage { ctx: out_out },
9072 Error::AnalyzeloadError,
9073 )
9074 }
9075}
9076
9077#[derive(Clone, Debug)]
9079pub struct AnalyzeloadOptions {
9080 pub flags: ForeignFlags,
9087 pub memory: bool,
9090 pub access: Access,
9096 pub fail_on: FailOn,
9103 pub revalidate: bool,
9106}
9107
9108impl std::default::Default for AnalyzeloadOptions {
9109 fn default() -> Self {
9110 AnalyzeloadOptions {
9111 flags: ForeignFlags::None,
9112 memory: false,
9113 access: Access::Random,
9114 fail_on: FailOn::None,
9115 revalidate: false,
9116 }
9117 }
9118}
9119
9120pub fn analyzeload_with_opts(
9125 filename: &str,
9126 analyzeload_options: &AnalyzeloadOptions,
9127) -> Result<VipsImage> {
9128 unsafe {
9129 let filename_in: CString = utils::new_c_string(filename)?;
9130 let mut out_out: *mut bindings::VipsImage = null_mut();
9131
9132 let flags_in: i32 = analyzeload_options.flags as i32;
9133 let flags_in_name = utils::new_c_string("flags")?;
9134
9135 let memory_in: i32 = if analyzeload_options.memory { 1 } else { 0 };
9136 let memory_in_name = utils::new_c_string("memory")?;
9137
9138 let access_in: i32 = analyzeload_options.access as i32;
9139 let access_in_name = utils::new_c_string("access")?;
9140
9141 let fail_on_in: i32 = analyzeload_options.fail_on as i32;
9142 let fail_on_in_name = utils::new_c_string("fail-on")?;
9143
9144 let revalidate_in: i32 = if analyzeload_options.revalidate { 1 } else { 0 };
9145 let revalidate_in_name = utils::new_c_string("revalidate")?;
9146
9147 let vips_op_response = bindings::vips_analyzeload(
9148 filename_in.as_ptr(),
9149 &mut out_out,
9150 flags_in_name.as_ptr(),
9151 flags_in,
9152 memory_in_name.as_ptr(),
9153 memory_in,
9154 access_in_name.as_ptr(),
9155 access_in,
9156 fail_on_in_name.as_ptr(),
9157 fail_on_in,
9158 revalidate_in_name.as_ptr(),
9159 revalidate_in,
9160 NULL,
9161 );
9162 utils::result(
9163 vips_op_response,
9164 VipsImage { ctx: out_out },
9165 Error::AnalyzeloadError,
9166 )
9167 }
9168}
9169
9170pub fn ppmload(filename: &str) -> Result<VipsImage> {
9174 unsafe {
9175 let filename_in: CString = utils::new_c_string(filename)?;
9176 let mut out_out: *mut bindings::VipsImage = null_mut();
9177
9178 let vips_op_response = bindings::vips_ppmload(filename_in.as_ptr(), &mut out_out, NULL);
9179 utils::result(
9180 vips_op_response,
9181 VipsImage { ctx: out_out },
9182 Error::PpmloadError,
9183 )
9184 }
9185}
9186
9187#[derive(Clone, Debug)]
9189pub struct PpmloadOptions {
9190 pub flags: ForeignFlags,
9197 pub memory: bool,
9200 pub access: Access,
9206 pub fail_on: FailOn,
9213 pub revalidate: bool,
9216}
9217
9218impl std::default::Default for PpmloadOptions {
9219 fn default() -> Self {
9220 PpmloadOptions {
9221 flags: ForeignFlags::None,
9222 memory: false,
9223 access: Access::Random,
9224 fail_on: FailOn::None,
9225 revalidate: false,
9226 }
9227 }
9228}
9229
9230pub fn ppmload_with_opts(filename: &str, ppmload_options: &PpmloadOptions) -> Result<VipsImage> {
9235 unsafe {
9236 let filename_in: CString = utils::new_c_string(filename)?;
9237 let mut out_out: *mut bindings::VipsImage = null_mut();
9238
9239 let flags_in: i32 = ppmload_options.flags as i32;
9240 let flags_in_name = utils::new_c_string("flags")?;
9241
9242 let memory_in: i32 = if ppmload_options.memory { 1 } else { 0 };
9243 let memory_in_name = utils::new_c_string("memory")?;
9244
9245 let access_in: i32 = ppmload_options.access as i32;
9246 let access_in_name = utils::new_c_string("access")?;
9247
9248 let fail_on_in: i32 = ppmload_options.fail_on as i32;
9249 let fail_on_in_name = utils::new_c_string("fail-on")?;
9250
9251 let revalidate_in: i32 = if ppmload_options.revalidate { 1 } else { 0 };
9252 let revalidate_in_name = utils::new_c_string("revalidate")?;
9253
9254 let vips_op_response = bindings::vips_ppmload(
9255 filename_in.as_ptr(),
9256 &mut out_out,
9257 flags_in_name.as_ptr(),
9258 flags_in,
9259 memory_in_name.as_ptr(),
9260 memory_in,
9261 access_in_name.as_ptr(),
9262 access_in,
9263 fail_on_in_name.as_ptr(),
9264 fail_on_in,
9265 revalidate_in_name.as_ptr(),
9266 revalidate_in,
9267 NULL,
9268 );
9269 utils::result(
9270 vips_op_response,
9271 VipsImage { ctx: out_out },
9272 Error::PpmloadError,
9273 )
9274 }
9275}
9276
9277pub fn ppmload_source(source: &VipsSource) -> Result<VipsImage> {
9281 unsafe {
9282 let source_in: *mut bindings::VipsSource = source.ctx;
9283 let mut out_out: *mut bindings::VipsImage = null_mut();
9284
9285 let vips_op_response = bindings::vips_ppmload_source(source_in, &mut out_out, NULL);
9286 utils::result(
9287 vips_op_response,
9288 VipsImage { ctx: out_out },
9289 Error::PpmloadSourceError,
9290 )
9291 }
9292}
9293
9294#[derive(Clone, Debug)]
9296pub struct PpmloadSourceOptions {
9297 pub flags: ForeignFlags,
9304 pub memory: bool,
9307 pub access: Access,
9313 pub fail_on: FailOn,
9320 pub revalidate: bool,
9323}
9324
9325impl std::default::Default for PpmloadSourceOptions {
9326 fn default() -> Self {
9327 PpmloadSourceOptions {
9328 flags: ForeignFlags::None,
9329 memory: false,
9330 access: Access::Random,
9331 fail_on: FailOn::None,
9332 revalidate: false,
9333 }
9334 }
9335}
9336
9337pub fn ppmload_source_with_opts(
9342 source: &VipsSource,
9343 ppmload_source_options: &PpmloadSourceOptions,
9344) -> Result<VipsImage> {
9345 unsafe {
9346 let source_in: *mut bindings::VipsSource = source.ctx;
9347 let mut out_out: *mut bindings::VipsImage = null_mut();
9348
9349 let flags_in: i32 = ppmload_source_options.flags as i32;
9350 let flags_in_name = utils::new_c_string("flags")?;
9351
9352 let memory_in: i32 = if ppmload_source_options.memory { 1 } else { 0 };
9353 let memory_in_name = utils::new_c_string("memory")?;
9354
9355 let access_in: i32 = ppmload_source_options.access as i32;
9356 let access_in_name = utils::new_c_string("access")?;
9357
9358 let fail_on_in: i32 = ppmload_source_options.fail_on as i32;
9359 let fail_on_in_name = utils::new_c_string("fail-on")?;
9360
9361 let revalidate_in: i32 = if ppmload_source_options.revalidate {
9362 1
9363 } else {
9364 0
9365 };
9366 let revalidate_in_name = utils::new_c_string("revalidate")?;
9367
9368 let vips_op_response = bindings::vips_ppmload_source(
9369 source_in,
9370 &mut out_out,
9371 flags_in_name.as_ptr(),
9372 flags_in,
9373 memory_in_name.as_ptr(),
9374 memory_in,
9375 access_in_name.as_ptr(),
9376 access_in,
9377 fail_on_in_name.as_ptr(),
9378 fail_on_in,
9379 revalidate_in_name.as_ptr(),
9380 revalidate_in,
9381 NULL,
9382 );
9383 utils::result(
9384 vips_op_response,
9385 VipsImage { ctx: out_out },
9386 Error::PpmloadSourceError,
9387 )
9388 }
9389}
9390
9391pub fn radload(filename: &str) -> Result<VipsImage> {
9395 unsafe {
9396 let filename_in: CString = utils::new_c_string(filename)?;
9397 let mut out_out: *mut bindings::VipsImage = null_mut();
9398
9399 let vips_op_response = bindings::vips_radload(filename_in.as_ptr(), &mut out_out, NULL);
9400 utils::result(
9401 vips_op_response,
9402 VipsImage { ctx: out_out },
9403 Error::RadloadError,
9404 )
9405 }
9406}
9407
9408#[derive(Clone, Debug)]
9410pub struct RadloadOptions {
9411 pub flags: ForeignFlags,
9418 pub memory: bool,
9421 pub access: Access,
9427 pub fail_on: FailOn,
9434 pub revalidate: bool,
9437}
9438
9439impl std::default::Default for RadloadOptions {
9440 fn default() -> Self {
9441 RadloadOptions {
9442 flags: ForeignFlags::None,
9443 memory: false,
9444 access: Access::Random,
9445 fail_on: FailOn::None,
9446 revalidate: false,
9447 }
9448 }
9449}
9450
9451pub fn radload_with_opts(filename: &str, radload_options: &RadloadOptions) -> Result<VipsImage> {
9456 unsafe {
9457 let filename_in: CString = utils::new_c_string(filename)?;
9458 let mut out_out: *mut bindings::VipsImage = null_mut();
9459
9460 let flags_in: i32 = radload_options.flags as i32;
9461 let flags_in_name = utils::new_c_string("flags")?;
9462
9463 let memory_in: i32 = if radload_options.memory { 1 } else { 0 };
9464 let memory_in_name = utils::new_c_string("memory")?;
9465
9466 let access_in: i32 = radload_options.access as i32;
9467 let access_in_name = utils::new_c_string("access")?;
9468
9469 let fail_on_in: i32 = radload_options.fail_on as i32;
9470 let fail_on_in_name = utils::new_c_string("fail-on")?;
9471
9472 let revalidate_in: i32 = if radload_options.revalidate { 1 } else { 0 };
9473 let revalidate_in_name = utils::new_c_string("revalidate")?;
9474
9475 let vips_op_response = bindings::vips_radload(
9476 filename_in.as_ptr(),
9477 &mut out_out,
9478 flags_in_name.as_ptr(),
9479 flags_in,
9480 memory_in_name.as_ptr(),
9481 memory_in,
9482 access_in_name.as_ptr(),
9483 access_in,
9484 fail_on_in_name.as_ptr(),
9485 fail_on_in,
9486 revalidate_in_name.as_ptr(),
9487 revalidate_in,
9488 NULL,
9489 );
9490 utils::result(
9491 vips_op_response,
9492 VipsImage { ctx: out_out },
9493 Error::RadloadError,
9494 )
9495 }
9496}
9497
9498pub fn radload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9502 unsafe {
9503 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9504 let mut out_out: *mut bindings::VipsImage = null_mut();
9505
9506 let vips_op_response =
9507 bindings::vips_radload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9508 utils::result(
9509 vips_op_response,
9510 VipsImage { ctx: out_out },
9511 Error::RadloadBufferError,
9512 )
9513 }
9514}
9515
9516#[derive(Clone, Debug)]
9518pub struct RadloadBufferOptions {
9519 pub flags: ForeignFlags,
9526 pub memory: bool,
9529 pub access: Access,
9535 pub fail_on: FailOn,
9542 pub revalidate: bool,
9545}
9546
9547impl std::default::Default for RadloadBufferOptions {
9548 fn default() -> Self {
9549 RadloadBufferOptions {
9550 flags: ForeignFlags::None,
9551 memory: false,
9552 access: Access::Random,
9553 fail_on: FailOn::None,
9554 revalidate: false,
9555 }
9556 }
9557}
9558
9559pub fn radload_buffer_with_opts(
9564 buffer: &[u8],
9565 radload_buffer_options: &RadloadBufferOptions,
9566) -> Result<VipsImage> {
9567 unsafe {
9568 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9569 let mut out_out: *mut bindings::VipsImage = null_mut();
9570
9571 let flags_in: i32 = radload_buffer_options.flags as i32;
9572 let flags_in_name = utils::new_c_string("flags")?;
9573
9574 let memory_in: i32 = if radload_buffer_options.memory { 1 } else { 0 };
9575 let memory_in_name = utils::new_c_string("memory")?;
9576
9577 let access_in: i32 = radload_buffer_options.access as i32;
9578 let access_in_name = utils::new_c_string("access")?;
9579
9580 let fail_on_in: i32 = radload_buffer_options.fail_on as i32;
9581 let fail_on_in_name = utils::new_c_string("fail-on")?;
9582
9583 let revalidate_in: i32 = if radload_buffer_options.revalidate {
9584 1
9585 } else {
9586 0
9587 };
9588 let revalidate_in_name = utils::new_c_string("revalidate")?;
9589
9590 let vips_op_response = bindings::vips_radload_buffer(
9591 buffer_in,
9592 buffer.len() as u64,
9593 &mut out_out,
9594 flags_in_name.as_ptr(),
9595 flags_in,
9596 memory_in_name.as_ptr(),
9597 memory_in,
9598 access_in_name.as_ptr(),
9599 access_in,
9600 fail_on_in_name.as_ptr(),
9601 fail_on_in,
9602 revalidate_in_name.as_ptr(),
9603 revalidate_in,
9604 NULL,
9605 );
9606 utils::result(
9607 vips_op_response,
9608 VipsImage { ctx: out_out },
9609 Error::RadloadBufferError,
9610 )
9611 }
9612}
9613
9614pub fn radload_source(source: &VipsSource) -> Result<VipsImage> {
9618 unsafe {
9619 let source_in: *mut bindings::VipsSource = source.ctx;
9620 let mut out_out: *mut bindings::VipsImage = null_mut();
9621
9622 let vips_op_response = bindings::vips_radload_source(source_in, &mut out_out, NULL);
9623 utils::result(
9624 vips_op_response,
9625 VipsImage { ctx: out_out },
9626 Error::RadloadSourceError,
9627 )
9628 }
9629}
9630
9631#[derive(Clone, Debug)]
9633pub struct RadloadSourceOptions {
9634 pub flags: ForeignFlags,
9641 pub memory: bool,
9644 pub access: Access,
9650 pub fail_on: FailOn,
9657 pub revalidate: bool,
9660}
9661
9662impl std::default::Default for RadloadSourceOptions {
9663 fn default() -> Self {
9664 RadloadSourceOptions {
9665 flags: ForeignFlags::None,
9666 memory: false,
9667 access: Access::Random,
9668 fail_on: FailOn::None,
9669 revalidate: false,
9670 }
9671 }
9672}
9673
9674pub fn radload_source_with_opts(
9679 source: &VipsSource,
9680 radload_source_options: &RadloadSourceOptions,
9681) -> Result<VipsImage> {
9682 unsafe {
9683 let source_in: *mut bindings::VipsSource = source.ctx;
9684 let mut out_out: *mut bindings::VipsImage = null_mut();
9685
9686 let flags_in: i32 = radload_source_options.flags as i32;
9687 let flags_in_name = utils::new_c_string("flags")?;
9688
9689 let memory_in: i32 = if radload_source_options.memory { 1 } else { 0 };
9690 let memory_in_name = utils::new_c_string("memory")?;
9691
9692 let access_in: i32 = radload_source_options.access as i32;
9693 let access_in_name = utils::new_c_string("access")?;
9694
9695 let fail_on_in: i32 = radload_source_options.fail_on as i32;
9696 let fail_on_in_name = utils::new_c_string("fail-on")?;
9697
9698 let revalidate_in: i32 = if radload_source_options.revalidate {
9699 1
9700 } else {
9701 0
9702 };
9703 let revalidate_in_name = utils::new_c_string("revalidate")?;
9704
9705 let vips_op_response = bindings::vips_radload_source(
9706 source_in,
9707 &mut out_out,
9708 flags_in_name.as_ptr(),
9709 flags_in,
9710 memory_in_name.as_ptr(),
9711 memory_in,
9712 access_in_name.as_ptr(),
9713 access_in,
9714 fail_on_in_name.as_ptr(),
9715 fail_on_in,
9716 revalidate_in_name.as_ptr(),
9717 revalidate_in,
9718 NULL,
9719 );
9720 utils::result(
9721 vips_op_response,
9722 VipsImage { ctx: out_out },
9723 Error::RadloadSourceError,
9724 )
9725 }
9726}
9727
9728pub fn svgload(filename: &str) -> Result<VipsImage> {
9732 unsafe {
9733 let filename_in: CString = utils::new_c_string(filename)?;
9734 let mut out_out: *mut bindings::VipsImage = null_mut();
9735
9736 let vips_op_response = bindings::vips_svgload(filename_in.as_ptr(), &mut out_out, NULL);
9737 utils::result(
9738 vips_op_response,
9739 VipsImage { ctx: out_out },
9740 Error::SvgloadError,
9741 )
9742 }
9743}
9744
9745#[derive(Clone, Debug)]
9747pub struct SvgloadOptions {
9748 pub dpi: f64,
9751 pub scale: f64,
9754 pub unlimited: bool,
9757 pub flags: ForeignFlags,
9764 pub memory: bool,
9767 pub access: Access,
9773 pub fail_on: FailOn,
9780 pub revalidate: bool,
9783}
9784
9785impl std::default::Default for SvgloadOptions {
9786 fn default() -> Self {
9787 SvgloadOptions {
9788 dpi: f64::from(72),
9789 scale: f64::from(1),
9790 unlimited: false,
9791 flags: ForeignFlags::None,
9792 memory: false,
9793 access: Access::Random,
9794 fail_on: FailOn::None,
9795 revalidate: false,
9796 }
9797 }
9798}
9799
9800pub fn svgload_with_opts(filename: &str, svgload_options: &SvgloadOptions) -> Result<VipsImage> {
9805 unsafe {
9806 let filename_in: CString = utils::new_c_string(filename)?;
9807 let mut out_out: *mut bindings::VipsImage = null_mut();
9808
9809 let dpi_in: f64 = svgload_options.dpi;
9810 let dpi_in_name = utils::new_c_string("dpi")?;
9811
9812 let scale_in: f64 = svgload_options.scale;
9813 let scale_in_name = utils::new_c_string("scale")?;
9814
9815 let unlimited_in: i32 = if svgload_options.unlimited { 1 } else { 0 };
9816 let unlimited_in_name = utils::new_c_string("unlimited")?;
9817
9818 let flags_in: i32 = svgload_options.flags as i32;
9819 let flags_in_name = utils::new_c_string("flags")?;
9820
9821 let memory_in: i32 = if svgload_options.memory { 1 } else { 0 };
9822 let memory_in_name = utils::new_c_string("memory")?;
9823
9824 let access_in: i32 = svgload_options.access as i32;
9825 let access_in_name = utils::new_c_string("access")?;
9826
9827 let fail_on_in: i32 = svgload_options.fail_on as i32;
9828 let fail_on_in_name = utils::new_c_string("fail-on")?;
9829
9830 let revalidate_in: i32 = if svgload_options.revalidate { 1 } else { 0 };
9831 let revalidate_in_name = utils::new_c_string("revalidate")?;
9832
9833 let vips_op_response = bindings::vips_svgload(
9834 filename_in.as_ptr(),
9835 &mut out_out,
9836 dpi_in_name.as_ptr(),
9837 dpi_in,
9838 scale_in_name.as_ptr(),
9839 scale_in,
9840 unlimited_in_name.as_ptr(),
9841 unlimited_in,
9842 flags_in_name.as_ptr(),
9843 flags_in,
9844 memory_in_name.as_ptr(),
9845 memory_in,
9846 access_in_name.as_ptr(),
9847 access_in,
9848 fail_on_in_name.as_ptr(),
9849 fail_on_in,
9850 revalidate_in_name.as_ptr(),
9851 revalidate_in,
9852 NULL,
9853 );
9854 utils::result(
9855 vips_op_response,
9856 VipsImage { ctx: out_out },
9857 Error::SvgloadError,
9858 )
9859 }
9860}
9861
9862pub fn svgload_buffer(buffer: &[u8]) -> Result<VipsImage> {
9866 unsafe {
9867 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9868 let mut out_out: *mut bindings::VipsImage = null_mut();
9869
9870 let vips_op_response =
9871 bindings::vips_svgload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
9872 utils::result(
9873 vips_op_response,
9874 VipsImage { ctx: out_out },
9875 Error::SvgloadBufferError,
9876 )
9877 }
9878}
9879
9880#[derive(Clone, Debug)]
9882pub struct SvgloadBufferOptions {
9883 pub dpi: f64,
9886 pub scale: f64,
9889 pub unlimited: bool,
9892 pub flags: ForeignFlags,
9899 pub memory: bool,
9902 pub access: Access,
9908 pub fail_on: FailOn,
9915 pub revalidate: bool,
9918}
9919
9920impl std::default::Default for SvgloadBufferOptions {
9921 fn default() -> Self {
9922 SvgloadBufferOptions {
9923 dpi: f64::from(72),
9924 scale: f64::from(1),
9925 unlimited: false,
9926 flags: ForeignFlags::None,
9927 memory: false,
9928 access: Access::Random,
9929 fail_on: FailOn::None,
9930 revalidate: false,
9931 }
9932 }
9933}
9934
9935pub fn svgload_buffer_with_opts(
9940 buffer: &[u8],
9941 svgload_buffer_options: &SvgloadBufferOptions,
9942) -> Result<VipsImage> {
9943 unsafe {
9944 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
9945 let mut out_out: *mut bindings::VipsImage = null_mut();
9946
9947 let dpi_in: f64 = svgload_buffer_options.dpi;
9948 let dpi_in_name = utils::new_c_string("dpi")?;
9949
9950 let scale_in: f64 = svgload_buffer_options.scale;
9951 let scale_in_name = utils::new_c_string("scale")?;
9952
9953 let unlimited_in: i32 = if svgload_buffer_options.unlimited {
9954 1
9955 } else {
9956 0
9957 };
9958 let unlimited_in_name = utils::new_c_string("unlimited")?;
9959
9960 let flags_in: i32 = svgload_buffer_options.flags as i32;
9961 let flags_in_name = utils::new_c_string("flags")?;
9962
9963 let memory_in: i32 = if svgload_buffer_options.memory { 1 } else { 0 };
9964 let memory_in_name = utils::new_c_string("memory")?;
9965
9966 let access_in: i32 = svgload_buffer_options.access as i32;
9967 let access_in_name = utils::new_c_string("access")?;
9968
9969 let fail_on_in: i32 = svgload_buffer_options.fail_on as i32;
9970 let fail_on_in_name = utils::new_c_string("fail-on")?;
9971
9972 let revalidate_in: i32 = if svgload_buffer_options.revalidate {
9973 1
9974 } else {
9975 0
9976 };
9977 let revalidate_in_name = utils::new_c_string("revalidate")?;
9978
9979 let vips_op_response = bindings::vips_svgload_buffer(
9980 buffer_in,
9981 buffer.len() as u64,
9982 &mut out_out,
9983 dpi_in_name.as_ptr(),
9984 dpi_in,
9985 scale_in_name.as_ptr(),
9986 scale_in,
9987 unlimited_in_name.as_ptr(),
9988 unlimited_in,
9989 flags_in_name.as_ptr(),
9990 flags_in,
9991 memory_in_name.as_ptr(),
9992 memory_in,
9993 access_in_name.as_ptr(),
9994 access_in,
9995 fail_on_in_name.as_ptr(),
9996 fail_on_in,
9997 revalidate_in_name.as_ptr(),
9998 revalidate_in,
9999 NULL,
10000 );
10001 utils::result(
10002 vips_op_response,
10003 VipsImage { ctx: out_out },
10004 Error::SvgloadBufferError,
10005 )
10006 }
10007}
10008
10009pub fn svgload_source(source: &VipsSource) -> Result<VipsImage> {
10013 unsafe {
10014 let source_in: *mut bindings::VipsSource = source.ctx;
10015 let mut out_out: *mut bindings::VipsImage = null_mut();
10016
10017 let vips_op_response = bindings::vips_svgload_source(source_in, &mut out_out, NULL);
10018 utils::result(
10019 vips_op_response,
10020 VipsImage { ctx: out_out },
10021 Error::SvgloadSourceError,
10022 )
10023 }
10024}
10025
10026#[derive(Clone, Debug)]
10028pub struct SvgloadSourceOptions {
10029 pub dpi: f64,
10032 pub scale: f64,
10035 pub unlimited: bool,
10038 pub flags: ForeignFlags,
10045 pub memory: bool,
10048 pub access: Access,
10054 pub fail_on: FailOn,
10061 pub revalidate: bool,
10064}
10065
10066impl std::default::Default for SvgloadSourceOptions {
10067 fn default() -> Self {
10068 SvgloadSourceOptions {
10069 dpi: f64::from(72),
10070 scale: f64::from(1),
10071 unlimited: false,
10072 flags: ForeignFlags::None,
10073 memory: false,
10074 access: Access::Random,
10075 fail_on: FailOn::None,
10076 revalidate: false,
10077 }
10078 }
10079}
10080
10081pub fn svgload_source_with_opts(
10086 source: &VipsSource,
10087 svgload_source_options: &SvgloadSourceOptions,
10088) -> Result<VipsImage> {
10089 unsafe {
10090 let source_in: *mut bindings::VipsSource = source.ctx;
10091 let mut out_out: *mut bindings::VipsImage = null_mut();
10092
10093 let dpi_in: f64 = svgload_source_options.dpi;
10094 let dpi_in_name = utils::new_c_string("dpi")?;
10095
10096 let scale_in: f64 = svgload_source_options.scale;
10097 let scale_in_name = utils::new_c_string("scale")?;
10098
10099 let unlimited_in: i32 = if svgload_source_options.unlimited {
10100 1
10101 } else {
10102 0
10103 };
10104 let unlimited_in_name = utils::new_c_string("unlimited")?;
10105
10106 let flags_in: i32 = svgload_source_options.flags as i32;
10107 let flags_in_name = utils::new_c_string("flags")?;
10108
10109 let memory_in: i32 = if svgload_source_options.memory { 1 } else { 0 };
10110 let memory_in_name = utils::new_c_string("memory")?;
10111
10112 let access_in: i32 = svgload_source_options.access as i32;
10113 let access_in_name = utils::new_c_string("access")?;
10114
10115 let fail_on_in: i32 = svgload_source_options.fail_on as i32;
10116 let fail_on_in_name = utils::new_c_string("fail-on")?;
10117
10118 let revalidate_in: i32 = if svgload_source_options.revalidate {
10119 1
10120 } else {
10121 0
10122 };
10123 let revalidate_in_name = utils::new_c_string("revalidate")?;
10124
10125 let vips_op_response = bindings::vips_svgload_source(
10126 source_in,
10127 &mut out_out,
10128 dpi_in_name.as_ptr(),
10129 dpi_in,
10130 scale_in_name.as_ptr(),
10131 scale_in,
10132 unlimited_in_name.as_ptr(),
10133 unlimited_in,
10134 flags_in_name.as_ptr(),
10135 flags_in,
10136 memory_in_name.as_ptr(),
10137 memory_in,
10138 access_in_name.as_ptr(),
10139 access_in,
10140 fail_on_in_name.as_ptr(),
10141 fail_on_in,
10142 revalidate_in_name.as_ptr(),
10143 revalidate_in,
10144 NULL,
10145 );
10146 utils::result(
10147 vips_op_response,
10148 VipsImage { ctx: out_out },
10149 Error::SvgloadSourceError,
10150 )
10151 }
10152}
10153
10154pub fn jp_2kload(filename: &str) -> Result<VipsImage> {
10158 unsafe {
10159 let filename_in: CString = utils::new_c_string(filename)?;
10160 let mut out_out: *mut bindings::VipsImage = null_mut();
10161
10162 let vips_op_response = bindings::vips_jp2kload(filename_in.as_ptr(), &mut out_out, NULL);
10163 utils::result(
10164 vips_op_response,
10165 VipsImage { ctx: out_out },
10166 Error::Jp2KloadError,
10167 )
10168 }
10169}
10170
10171#[derive(Clone, Debug)]
10173pub struct Jp2KloadOptions {
10174 pub page: i32,
10177 pub flags: ForeignFlags,
10184 pub memory: bool,
10187 pub access: Access,
10193 pub fail_on: FailOn,
10200 pub revalidate: bool,
10203}
10204
10205impl std::default::Default for Jp2KloadOptions {
10206 fn default() -> Self {
10207 Jp2KloadOptions {
10208 page: i32::from(0),
10209 flags: ForeignFlags::None,
10210 memory: false,
10211 access: Access::Random,
10212 fail_on: FailOn::None,
10213 revalidate: false,
10214 }
10215 }
10216}
10217
10218pub fn jp_2kload_with_opts(
10223 filename: &str,
10224 jp_2kload_options: &Jp2KloadOptions,
10225) -> Result<VipsImage> {
10226 unsafe {
10227 let filename_in: CString = utils::new_c_string(filename)?;
10228 let mut out_out: *mut bindings::VipsImage = null_mut();
10229
10230 let page_in: i32 = jp_2kload_options.page;
10231 let page_in_name = utils::new_c_string("page")?;
10232
10233 let flags_in: i32 = jp_2kload_options.flags as i32;
10234 let flags_in_name = utils::new_c_string("flags")?;
10235
10236 let memory_in: i32 = if jp_2kload_options.memory { 1 } else { 0 };
10237 let memory_in_name = utils::new_c_string("memory")?;
10238
10239 let access_in: i32 = jp_2kload_options.access as i32;
10240 let access_in_name = utils::new_c_string("access")?;
10241
10242 let fail_on_in: i32 = jp_2kload_options.fail_on as i32;
10243 let fail_on_in_name = utils::new_c_string("fail-on")?;
10244
10245 let revalidate_in: i32 = if jp_2kload_options.revalidate { 1 } else { 0 };
10246 let revalidate_in_name = utils::new_c_string("revalidate")?;
10247
10248 let vips_op_response = bindings::vips_jp2kload(
10249 filename_in.as_ptr(),
10250 &mut out_out,
10251 page_in_name.as_ptr(),
10252 page_in,
10253 flags_in_name.as_ptr(),
10254 flags_in,
10255 memory_in_name.as_ptr(),
10256 memory_in,
10257 access_in_name.as_ptr(),
10258 access_in,
10259 fail_on_in_name.as_ptr(),
10260 fail_on_in,
10261 revalidate_in_name.as_ptr(),
10262 revalidate_in,
10263 NULL,
10264 );
10265 utils::result(
10266 vips_op_response,
10267 VipsImage { ctx: out_out },
10268 Error::Jp2KloadError,
10269 )
10270 }
10271}
10272
10273pub fn jp_2kload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10277 unsafe {
10278 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10279 let mut out_out: *mut bindings::VipsImage = null_mut();
10280
10281 let vips_op_response =
10282 bindings::vips_jp2kload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10283 utils::result(
10284 vips_op_response,
10285 VipsImage { ctx: out_out },
10286 Error::Jp2KloadBufferError,
10287 )
10288 }
10289}
10290
10291#[derive(Clone, Debug)]
10293pub struct Jp2KloadBufferOptions {
10294 pub page: i32,
10297 pub flags: ForeignFlags,
10304 pub memory: bool,
10307 pub access: Access,
10313 pub fail_on: FailOn,
10320 pub revalidate: bool,
10323}
10324
10325impl std::default::Default for Jp2KloadBufferOptions {
10326 fn default() -> Self {
10327 Jp2KloadBufferOptions {
10328 page: i32::from(0),
10329 flags: ForeignFlags::None,
10330 memory: false,
10331 access: Access::Random,
10332 fail_on: FailOn::None,
10333 revalidate: false,
10334 }
10335 }
10336}
10337
10338pub fn jp_2kload_buffer_with_opts(
10343 buffer: &[u8],
10344 jp_2kload_buffer_options: &Jp2KloadBufferOptions,
10345) -> Result<VipsImage> {
10346 unsafe {
10347 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10348 let mut out_out: *mut bindings::VipsImage = null_mut();
10349
10350 let page_in: i32 = jp_2kload_buffer_options.page;
10351 let page_in_name = utils::new_c_string("page")?;
10352
10353 let flags_in: i32 = jp_2kload_buffer_options.flags as i32;
10354 let flags_in_name = utils::new_c_string("flags")?;
10355
10356 let memory_in: i32 = if jp_2kload_buffer_options.memory {
10357 1
10358 } else {
10359 0
10360 };
10361 let memory_in_name = utils::new_c_string("memory")?;
10362
10363 let access_in: i32 = jp_2kload_buffer_options.access as i32;
10364 let access_in_name = utils::new_c_string("access")?;
10365
10366 let fail_on_in: i32 = jp_2kload_buffer_options.fail_on as i32;
10367 let fail_on_in_name = utils::new_c_string("fail-on")?;
10368
10369 let revalidate_in: i32 = if jp_2kload_buffer_options.revalidate {
10370 1
10371 } else {
10372 0
10373 };
10374 let revalidate_in_name = utils::new_c_string("revalidate")?;
10375
10376 let vips_op_response = bindings::vips_jp2kload_buffer(
10377 buffer_in,
10378 buffer.len() as u64,
10379 &mut out_out,
10380 page_in_name.as_ptr(),
10381 page_in,
10382 flags_in_name.as_ptr(),
10383 flags_in,
10384 memory_in_name.as_ptr(),
10385 memory_in,
10386 access_in_name.as_ptr(),
10387 access_in,
10388 fail_on_in_name.as_ptr(),
10389 fail_on_in,
10390 revalidate_in_name.as_ptr(),
10391 revalidate_in,
10392 NULL,
10393 );
10394 utils::result(
10395 vips_op_response,
10396 VipsImage { ctx: out_out },
10397 Error::Jp2KloadBufferError,
10398 )
10399 }
10400}
10401
10402pub fn jp_2kload_source(source: &VipsSource) -> Result<VipsImage> {
10406 unsafe {
10407 let source_in: *mut bindings::VipsSource = source.ctx;
10408 let mut out_out: *mut bindings::VipsImage = null_mut();
10409
10410 let vips_op_response = bindings::vips_jp2kload_source(source_in, &mut out_out, NULL);
10411 utils::result(
10412 vips_op_response,
10413 VipsImage { ctx: out_out },
10414 Error::Jp2KloadSourceError,
10415 )
10416 }
10417}
10418
10419#[derive(Clone, Debug)]
10421pub struct Jp2KloadSourceOptions {
10422 pub page: i32,
10425 pub flags: ForeignFlags,
10432 pub memory: bool,
10435 pub access: Access,
10441 pub fail_on: FailOn,
10448 pub revalidate: bool,
10451}
10452
10453impl std::default::Default for Jp2KloadSourceOptions {
10454 fn default() -> Self {
10455 Jp2KloadSourceOptions {
10456 page: i32::from(0),
10457 flags: ForeignFlags::None,
10458 memory: false,
10459 access: Access::Random,
10460 fail_on: FailOn::None,
10461 revalidate: false,
10462 }
10463 }
10464}
10465
10466pub fn jp_2kload_source_with_opts(
10471 source: &VipsSource,
10472 jp_2kload_source_options: &Jp2KloadSourceOptions,
10473) -> Result<VipsImage> {
10474 unsafe {
10475 let source_in: *mut bindings::VipsSource = source.ctx;
10476 let mut out_out: *mut bindings::VipsImage = null_mut();
10477
10478 let page_in: i32 = jp_2kload_source_options.page;
10479 let page_in_name = utils::new_c_string("page")?;
10480
10481 let flags_in: i32 = jp_2kload_source_options.flags as i32;
10482 let flags_in_name = utils::new_c_string("flags")?;
10483
10484 let memory_in: i32 = if jp_2kload_source_options.memory {
10485 1
10486 } else {
10487 0
10488 };
10489 let memory_in_name = utils::new_c_string("memory")?;
10490
10491 let access_in: i32 = jp_2kload_source_options.access as i32;
10492 let access_in_name = utils::new_c_string("access")?;
10493
10494 let fail_on_in: i32 = jp_2kload_source_options.fail_on as i32;
10495 let fail_on_in_name = utils::new_c_string("fail-on")?;
10496
10497 let revalidate_in: i32 = if jp_2kload_source_options.revalidate {
10498 1
10499 } else {
10500 0
10501 };
10502 let revalidate_in_name = utils::new_c_string("revalidate")?;
10503
10504 let vips_op_response = bindings::vips_jp2kload_source(
10505 source_in,
10506 &mut out_out,
10507 page_in_name.as_ptr(),
10508 page_in,
10509 flags_in_name.as_ptr(),
10510 flags_in,
10511 memory_in_name.as_ptr(),
10512 memory_in,
10513 access_in_name.as_ptr(),
10514 access_in,
10515 fail_on_in_name.as_ptr(),
10516 fail_on_in,
10517 revalidate_in_name.as_ptr(),
10518 revalidate_in,
10519 NULL,
10520 );
10521 utils::result(
10522 vips_op_response,
10523 VipsImage { ctx: out_out },
10524 Error::Jp2KloadSourceError,
10525 )
10526 }
10527}
10528
10529pub fn gifload(filename: &str) -> Result<VipsImage> {
10533 unsafe {
10534 let filename_in: CString = utils::new_c_string(filename)?;
10535 let mut out_out: *mut bindings::VipsImage = null_mut();
10536
10537 let vips_op_response = bindings::vips_gifload(filename_in.as_ptr(), &mut out_out, NULL);
10538 utils::result(
10539 vips_op_response,
10540 VipsImage { ctx: out_out },
10541 Error::GifloadError,
10542 )
10543 }
10544}
10545
10546#[derive(Clone, Debug)]
10548pub struct GifloadOptions {
10549 pub n: i32,
10552 pub page: i32,
10555 pub flags: ForeignFlags,
10562 pub memory: bool,
10565 pub access: Access,
10571 pub fail_on: FailOn,
10578 pub revalidate: bool,
10581}
10582
10583impl std::default::Default for GifloadOptions {
10584 fn default() -> Self {
10585 GifloadOptions {
10586 n: i32::from(1),
10587 page: i32::from(0),
10588 flags: ForeignFlags::None,
10589 memory: false,
10590 access: Access::Random,
10591 fail_on: FailOn::None,
10592 revalidate: false,
10593 }
10594 }
10595}
10596
10597pub fn gifload_with_opts(filename: &str, gifload_options: &GifloadOptions) -> Result<VipsImage> {
10602 unsafe {
10603 let filename_in: CString = utils::new_c_string(filename)?;
10604 let mut out_out: *mut bindings::VipsImage = null_mut();
10605
10606 let n_in: i32 = gifload_options.n;
10607 let n_in_name = utils::new_c_string("n")?;
10608
10609 let page_in: i32 = gifload_options.page;
10610 let page_in_name = utils::new_c_string("page")?;
10611
10612 let flags_in: i32 = gifload_options.flags as i32;
10613 let flags_in_name = utils::new_c_string("flags")?;
10614
10615 let memory_in: i32 = if gifload_options.memory { 1 } else { 0 };
10616 let memory_in_name = utils::new_c_string("memory")?;
10617
10618 let access_in: i32 = gifload_options.access as i32;
10619 let access_in_name = utils::new_c_string("access")?;
10620
10621 let fail_on_in: i32 = gifload_options.fail_on as i32;
10622 let fail_on_in_name = utils::new_c_string("fail-on")?;
10623
10624 let revalidate_in: i32 = if gifload_options.revalidate { 1 } else { 0 };
10625 let revalidate_in_name = utils::new_c_string("revalidate")?;
10626
10627 let vips_op_response = bindings::vips_gifload(
10628 filename_in.as_ptr(),
10629 &mut out_out,
10630 n_in_name.as_ptr(),
10631 n_in,
10632 page_in_name.as_ptr(),
10633 page_in,
10634 flags_in_name.as_ptr(),
10635 flags_in,
10636 memory_in_name.as_ptr(),
10637 memory_in,
10638 access_in_name.as_ptr(),
10639 access_in,
10640 fail_on_in_name.as_ptr(),
10641 fail_on_in,
10642 revalidate_in_name.as_ptr(),
10643 revalidate_in,
10644 NULL,
10645 );
10646 utils::result(
10647 vips_op_response,
10648 VipsImage { ctx: out_out },
10649 Error::GifloadError,
10650 )
10651 }
10652}
10653
10654pub fn gifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
10658 unsafe {
10659 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10660 let mut out_out: *mut bindings::VipsImage = null_mut();
10661
10662 let vips_op_response =
10663 bindings::vips_gifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
10664 utils::result(
10665 vips_op_response,
10666 VipsImage { ctx: out_out },
10667 Error::GifloadBufferError,
10668 )
10669 }
10670}
10671
10672#[derive(Clone, Debug)]
10674pub struct GifloadBufferOptions {
10675 pub n: i32,
10678 pub page: i32,
10681 pub flags: ForeignFlags,
10688 pub memory: bool,
10691 pub access: Access,
10697 pub fail_on: FailOn,
10704 pub revalidate: bool,
10707}
10708
10709impl std::default::Default for GifloadBufferOptions {
10710 fn default() -> Self {
10711 GifloadBufferOptions {
10712 n: i32::from(1),
10713 page: i32::from(0),
10714 flags: ForeignFlags::None,
10715 memory: false,
10716 access: Access::Random,
10717 fail_on: FailOn::None,
10718 revalidate: false,
10719 }
10720 }
10721}
10722
10723pub fn gifload_buffer_with_opts(
10728 buffer: &[u8],
10729 gifload_buffer_options: &GifloadBufferOptions,
10730) -> Result<VipsImage> {
10731 unsafe {
10732 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
10733 let mut out_out: *mut bindings::VipsImage = null_mut();
10734
10735 let n_in: i32 = gifload_buffer_options.n;
10736 let n_in_name = utils::new_c_string("n")?;
10737
10738 let page_in: i32 = gifload_buffer_options.page;
10739 let page_in_name = utils::new_c_string("page")?;
10740
10741 let flags_in: i32 = gifload_buffer_options.flags as i32;
10742 let flags_in_name = utils::new_c_string("flags")?;
10743
10744 let memory_in: i32 = if gifload_buffer_options.memory { 1 } else { 0 };
10745 let memory_in_name = utils::new_c_string("memory")?;
10746
10747 let access_in: i32 = gifload_buffer_options.access as i32;
10748 let access_in_name = utils::new_c_string("access")?;
10749
10750 let fail_on_in: i32 = gifload_buffer_options.fail_on as i32;
10751 let fail_on_in_name = utils::new_c_string("fail-on")?;
10752
10753 let revalidate_in: i32 = if gifload_buffer_options.revalidate {
10754 1
10755 } else {
10756 0
10757 };
10758 let revalidate_in_name = utils::new_c_string("revalidate")?;
10759
10760 let vips_op_response = bindings::vips_gifload_buffer(
10761 buffer_in,
10762 buffer.len() as u64,
10763 &mut out_out,
10764 n_in_name.as_ptr(),
10765 n_in,
10766 page_in_name.as_ptr(),
10767 page_in,
10768 flags_in_name.as_ptr(),
10769 flags_in,
10770 memory_in_name.as_ptr(),
10771 memory_in,
10772 access_in_name.as_ptr(),
10773 access_in,
10774 fail_on_in_name.as_ptr(),
10775 fail_on_in,
10776 revalidate_in_name.as_ptr(),
10777 revalidate_in,
10778 NULL,
10779 );
10780 utils::result(
10781 vips_op_response,
10782 VipsImage { ctx: out_out },
10783 Error::GifloadBufferError,
10784 )
10785 }
10786}
10787
10788pub fn gifload_source(source: &VipsSource) -> Result<VipsImage> {
10792 unsafe {
10793 let source_in: *mut bindings::VipsSource = source.ctx;
10794 let mut out_out: *mut bindings::VipsImage = null_mut();
10795
10796 let vips_op_response = bindings::vips_gifload_source(source_in, &mut out_out, NULL);
10797 utils::result(
10798 vips_op_response,
10799 VipsImage { ctx: out_out },
10800 Error::GifloadSourceError,
10801 )
10802 }
10803}
10804
10805#[derive(Clone, Debug)]
10807pub struct GifloadSourceOptions {
10808 pub n: i32,
10811 pub page: i32,
10814 pub flags: ForeignFlags,
10821 pub memory: bool,
10824 pub access: Access,
10830 pub fail_on: FailOn,
10837 pub revalidate: bool,
10840}
10841
10842impl std::default::Default for GifloadSourceOptions {
10843 fn default() -> Self {
10844 GifloadSourceOptions {
10845 n: i32::from(1),
10846 page: i32::from(0),
10847 flags: ForeignFlags::None,
10848 memory: false,
10849 access: Access::Random,
10850 fail_on: FailOn::None,
10851 revalidate: false,
10852 }
10853 }
10854}
10855
10856pub fn gifload_source_with_opts(
10861 source: &VipsSource,
10862 gifload_source_options: &GifloadSourceOptions,
10863) -> Result<VipsImage> {
10864 unsafe {
10865 let source_in: *mut bindings::VipsSource = source.ctx;
10866 let mut out_out: *mut bindings::VipsImage = null_mut();
10867
10868 let n_in: i32 = gifload_source_options.n;
10869 let n_in_name = utils::new_c_string("n")?;
10870
10871 let page_in: i32 = gifload_source_options.page;
10872 let page_in_name = utils::new_c_string("page")?;
10873
10874 let flags_in: i32 = gifload_source_options.flags as i32;
10875 let flags_in_name = utils::new_c_string("flags")?;
10876
10877 let memory_in: i32 = if gifload_source_options.memory { 1 } else { 0 };
10878 let memory_in_name = utils::new_c_string("memory")?;
10879
10880 let access_in: i32 = gifload_source_options.access as i32;
10881 let access_in_name = utils::new_c_string("access")?;
10882
10883 let fail_on_in: i32 = gifload_source_options.fail_on as i32;
10884 let fail_on_in_name = utils::new_c_string("fail-on")?;
10885
10886 let revalidate_in: i32 = if gifload_source_options.revalidate {
10887 1
10888 } else {
10889 0
10890 };
10891 let revalidate_in_name = utils::new_c_string("revalidate")?;
10892
10893 let vips_op_response = bindings::vips_gifload_source(
10894 source_in,
10895 &mut out_out,
10896 n_in_name.as_ptr(),
10897 n_in,
10898 page_in_name.as_ptr(),
10899 page_in,
10900 flags_in_name.as_ptr(),
10901 flags_in,
10902 memory_in_name.as_ptr(),
10903 memory_in,
10904 access_in_name.as_ptr(),
10905 access_in,
10906 fail_on_in_name.as_ptr(),
10907 fail_on_in,
10908 revalidate_in_name.as_ptr(),
10909 revalidate_in,
10910 NULL,
10911 );
10912 utils::result(
10913 vips_op_response,
10914 VipsImage { ctx: out_out },
10915 Error::GifloadSourceError,
10916 )
10917 }
10918}
10919
10920pub fn pngload(filename: &str) -> Result<VipsImage> {
10924 unsafe {
10925 let filename_in: CString = utils::new_c_string(filename)?;
10926 let mut out_out: *mut bindings::VipsImage = null_mut();
10927
10928 let vips_op_response = bindings::vips_pngload(filename_in.as_ptr(), &mut out_out, NULL);
10929 utils::result(
10930 vips_op_response,
10931 VipsImage { ctx: out_out },
10932 Error::PngloadError,
10933 )
10934 }
10935}
10936
10937#[derive(Clone, Debug)]
10939pub struct PngloadOptions {
10940 pub unlimited: bool,
10943 pub flags: ForeignFlags,
10950 pub memory: bool,
10953 pub access: Access,
10959 pub fail_on: FailOn,
10966 pub revalidate: bool,
10969}
10970
10971impl std::default::Default for PngloadOptions {
10972 fn default() -> Self {
10973 PngloadOptions {
10974 unlimited: false,
10975 flags: ForeignFlags::None,
10976 memory: false,
10977 access: Access::Random,
10978 fail_on: FailOn::None,
10979 revalidate: false,
10980 }
10981 }
10982}
10983
10984pub fn pngload_with_opts(filename: &str, pngload_options: &PngloadOptions) -> Result<VipsImage> {
10989 unsafe {
10990 let filename_in: CString = utils::new_c_string(filename)?;
10991 let mut out_out: *mut bindings::VipsImage = null_mut();
10992
10993 let unlimited_in: i32 = if pngload_options.unlimited { 1 } else { 0 };
10994 let unlimited_in_name = utils::new_c_string("unlimited")?;
10995
10996 let flags_in: i32 = pngload_options.flags as i32;
10997 let flags_in_name = utils::new_c_string("flags")?;
10998
10999 let memory_in: i32 = if pngload_options.memory { 1 } else { 0 };
11000 let memory_in_name = utils::new_c_string("memory")?;
11001
11002 let access_in: i32 = pngload_options.access as i32;
11003 let access_in_name = utils::new_c_string("access")?;
11004
11005 let fail_on_in: i32 = pngload_options.fail_on as i32;
11006 let fail_on_in_name = utils::new_c_string("fail-on")?;
11007
11008 let revalidate_in: i32 = if pngload_options.revalidate { 1 } else { 0 };
11009 let revalidate_in_name = utils::new_c_string("revalidate")?;
11010
11011 let vips_op_response = bindings::vips_pngload(
11012 filename_in.as_ptr(),
11013 &mut out_out,
11014 unlimited_in_name.as_ptr(),
11015 unlimited_in,
11016 flags_in_name.as_ptr(),
11017 flags_in,
11018 memory_in_name.as_ptr(),
11019 memory_in,
11020 access_in_name.as_ptr(),
11021 access_in,
11022 fail_on_in_name.as_ptr(),
11023 fail_on_in,
11024 revalidate_in_name.as_ptr(),
11025 revalidate_in,
11026 NULL,
11027 );
11028 utils::result(
11029 vips_op_response,
11030 VipsImage { ctx: out_out },
11031 Error::PngloadError,
11032 )
11033 }
11034}
11035
11036pub fn pngload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11040 unsafe {
11041 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11042 let mut out_out: *mut bindings::VipsImage = null_mut();
11043
11044 let vips_op_response =
11045 bindings::vips_pngload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11046 utils::result(
11047 vips_op_response,
11048 VipsImage { ctx: out_out },
11049 Error::PngloadBufferError,
11050 )
11051 }
11052}
11053
11054#[derive(Clone, Debug)]
11056pub struct PngloadBufferOptions {
11057 pub unlimited: bool,
11060 pub flags: ForeignFlags,
11067 pub memory: bool,
11070 pub access: Access,
11076 pub fail_on: FailOn,
11083 pub revalidate: bool,
11086}
11087
11088impl std::default::Default for PngloadBufferOptions {
11089 fn default() -> Self {
11090 PngloadBufferOptions {
11091 unlimited: false,
11092 flags: ForeignFlags::None,
11093 memory: false,
11094 access: Access::Random,
11095 fail_on: FailOn::None,
11096 revalidate: false,
11097 }
11098 }
11099}
11100
11101pub fn pngload_buffer_with_opts(
11106 buffer: &[u8],
11107 pngload_buffer_options: &PngloadBufferOptions,
11108) -> Result<VipsImage> {
11109 unsafe {
11110 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11111 let mut out_out: *mut bindings::VipsImage = null_mut();
11112
11113 let unlimited_in: i32 = if pngload_buffer_options.unlimited {
11114 1
11115 } else {
11116 0
11117 };
11118 let unlimited_in_name = utils::new_c_string("unlimited")?;
11119
11120 let flags_in: i32 = pngload_buffer_options.flags as i32;
11121 let flags_in_name = utils::new_c_string("flags")?;
11122
11123 let memory_in: i32 = if pngload_buffer_options.memory { 1 } else { 0 };
11124 let memory_in_name = utils::new_c_string("memory")?;
11125
11126 let access_in: i32 = pngload_buffer_options.access as i32;
11127 let access_in_name = utils::new_c_string("access")?;
11128
11129 let fail_on_in: i32 = pngload_buffer_options.fail_on as i32;
11130 let fail_on_in_name = utils::new_c_string("fail-on")?;
11131
11132 let revalidate_in: i32 = if pngload_buffer_options.revalidate {
11133 1
11134 } else {
11135 0
11136 };
11137 let revalidate_in_name = utils::new_c_string("revalidate")?;
11138
11139 let vips_op_response = bindings::vips_pngload_buffer(
11140 buffer_in,
11141 buffer.len() as u64,
11142 &mut out_out,
11143 unlimited_in_name.as_ptr(),
11144 unlimited_in,
11145 flags_in_name.as_ptr(),
11146 flags_in,
11147 memory_in_name.as_ptr(),
11148 memory_in,
11149 access_in_name.as_ptr(),
11150 access_in,
11151 fail_on_in_name.as_ptr(),
11152 fail_on_in,
11153 revalidate_in_name.as_ptr(),
11154 revalidate_in,
11155 NULL,
11156 );
11157 utils::result(
11158 vips_op_response,
11159 VipsImage { ctx: out_out },
11160 Error::PngloadBufferError,
11161 )
11162 }
11163}
11164
11165pub fn pngload_source(source: &VipsSource) -> Result<VipsImage> {
11169 unsafe {
11170 let source_in: *mut bindings::VipsSource = source.ctx;
11171 let mut out_out: *mut bindings::VipsImage = null_mut();
11172
11173 let vips_op_response = bindings::vips_pngload_source(source_in, &mut out_out, NULL);
11174 utils::result(
11175 vips_op_response,
11176 VipsImage { ctx: out_out },
11177 Error::PngloadSourceError,
11178 )
11179 }
11180}
11181
11182#[derive(Clone, Debug)]
11184pub struct PngloadSourceOptions {
11185 pub unlimited: bool,
11188 pub flags: ForeignFlags,
11195 pub memory: bool,
11198 pub access: Access,
11204 pub fail_on: FailOn,
11211 pub revalidate: bool,
11214}
11215
11216impl std::default::Default for PngloadSourceOptions {
11217 fn default() -> Self {
11218 PngloadSourceOptions {
11219 unlimited: false,
11220 flags: ForeignFlags::None,
11221 memory: false,
11222 access: Access::Random,
11223 fail_on: FailOn::None,
11224 revalidate: false,
11225 }
11226 }
11227}
11228
11229pub fn pngload_source_with_opts(
11234 source: &VipsSource,
11235 pngload_source_options: &PngloadSourceOptions,
11236) -> Result<VipsImage> {
11237 unsafe {
11238 let source_in: *mut bindings::VipsSource = source.ctx;
11239 let mut out_out: *mut bindings::VipsImage = null_mut();
11240
11241 let unlimited_in: i32 = if pngload_source_options.unlimited {
11242 1
11243 } else {
11244 0
11245 };
11246 let unlimited_in_name = utils::new_c_string("unlimited")?;
11247
11248 let flags_in: i32 = pngload_source_options.flags as i32;
11249 let flags_in_name = utils::new_c_string("flags")?;
11250
11251 let memory_in: i32 = if pngload_source_options.memory { 1 } else { 0 };
11252 let memory_in_name = utils::new_c_string("memory")?;
11253
11254 let access_in: i32 = pngload_source_options.access as i32;
11255 let access_in_name = utils::new_c_string("access")?;
11256
11257 let fail_on_in: i32 = pngload_source_options.fail_on as i32;
11258 let fail_on_in_name = utils::new_c_string("fail-on")?;
11259
11260 let revalidate_in: i32 = if pngload_source_options.revalidate {
11261 1
11262 } else {
11263 0
11264 };
11265 let revalidate_in_name = utils::new_c_string("revalidate")?;
11266
11267 let vips_op_response = bindings::vips_pngload_source(
11268 source_in,
11269 &mut out_out,
11270 unlimited_in_name.as_ptr(),
11271 unlimited_in,
11272 flags_in_name.as_ptr(),
11273 flags_in,
11274 memory_in_name.as_ptr(),
11275 memory_in,
11276 access_in_name.as_ptr(),
11277 access_in,
11278 fail_on_in_name.as_ptr(),
11279 fail_on_in,
11280 revalidate_in_name.as_ptr(),
11281 revalidate_in,
11282 NULL,
11283 );
11284 utils::result(
11285 vips_op_response,
11286 VipsImage { ctx: out_out },
11287 Error::PngloadSourceError,
11288 )
11289 }
11290}
11291
11292pub fn matload(filename: &str) -> Result<VipsImage> {
11296 unsafe {
11297 let filename_in: CString = utils::new_c_string(filename)?;
11298 let mut out_out: *mut bindings::VipsImage = null_mut();
11299
11300 let vips_op_response = bindings::vips_matload(filename_in.as_ptr(), &mut out_out, NULL);
11301 utils::result(
11302 vips_op_response,
11303 VipsImage { ctx: out_out },
11304 Error::MatloadError,
11305 )
11306 }
11307}
11308
11309#[derive(Clone, Debug)]
11311pub struct MatloadOptions {
11312 pub flags: ForeignFlags,
11319 pub memory: bool,
11322 pub access: Access,
11328 pub fail_on: FailOn,
11335 pub revalidate: bool,
11338}
11339
11340impl std::default::Default for MatloadOptions {
11341 fn default() -> Self {
11342 MatloadOptions {
11343 flags: ForeignFlags::None,
11344 memory: false,
11345 access: Access::Random,
11346 fail_on: FailOn::None,
11347 revalidate: false,
11348 }
11349 }
11350}
11351
11352pub fn matload_with_opts(filename: &str, matload_options: &MatloadOptions) -> Result<VipsImage> {
11357 unsafe {
11358 let filename_in: CString = utils::new_c_string(filename)?;
11359 let mut out_out: *mut bindings::VipsImage = null_mut();
11360
11361 let flags_in: i32 = matload_options.flags as i32;
11362 let flags_in_name = utils::new_c_string("flags")?;
11363
11364 let memory_in: i32 = if matload_options.memory { 1 } else { 0 };
11365 let memory_in_name = utils::new_c_string("memory")?;
11366
11367 let access_in: i32 = matload_options.access as i32;
11368 let access_in_name = utils::new_c_string("access")?;
11369
11370 let fail_on_in: i32 = matload_options.fail_on as i32;
11371 let fail_on_in_name = utils::new_c_string("fail-on")?;
11372
11373 let revalidate_in: i32 = if matload_options.revalidate { 1 } else { 0 };
11374 let revalidate_in_name = utils::new_c_string("revalidate")?;
11375
11376 let vips_op_response = bindings::vips_matload(
11377 filename_in.as_ptr(),
11378 &mut out_out,
11379 flags_in_name.as_ptr(),
11380 flags_in,
11381 memory_in_name.as_ptr(),
11382 memory_in,
11383 access_in_name.as_ptr(),
11384 access_in,
11385 fail_on_in_name.as_ptr(),
11386 fail_on_in,
11387 revalidate_in_name.as_ptr(),
11388 revalidate_in,
11389 NULL,
11390 );
11391 utils::result(
11392 vips_op_response,
11393 VipsImage { ctx: out_out },
11394 Error::MatloadError,
11395 )
11396 }
11397}
11398
11399pub fn jpegload(filename: &str) -> Result<VipsImage> {
11403 unsafe {
11404 let filename_in: CString = utils::new_c_string(filename)?;
11405 let mut out_out: *mut bindings::VipsImage = null_mut();
11406
11407 let vips_op_response = bindings::vips_jpegload(filename_in.as_ptr(), &mut out_out, NULL);
11408 utils::result(
11409 vips_op_response,
11410 VipsImage { ctx: out_out },
11411 Error::JpegloadError,
11412 )
11413 }
11414}
11415
11416#[derive(Clone, Debug)]
11418pub struct JpegloadOptions {
11419 pub shrink: i32,
11422 pub autorotate: bool,
11425 pub unlimited: bool,
11428 pub flags: ForeignFlags,
11435 pub memory: bool,
11438 pub access: Access,
11444 pub fail_on: FailOn,
11451 pub revalidate: bool,
11454}
11455
11456impl std::default::Default for JpegloadOptions {
11457 fn default() -> Self {
11458 JpegloadOptions {
11459 shrink: i32::from(1),
11460 autorotate: false,
11461 unlimited: false,
11462 flags: ForeignFlags::None,
11463 memory: false,
11464 access: Access::Random,
11465 fail_on: FailOn::None,
11466 revalidate: false,
11467 }
11468 }
11469}
11470
11471pub fn jpegload_with_opts(filename: &str, jpegload_options: &JpegloadOptions) -> Result<VipsImage> {
11476 unsafe {
11477 let filename_in: CString = utils::new_c_string(filename)?;
11478 let mut out_out: *mut bindings::VipsImage = null_mut();
11479
11480 let shrink_in: i32 = jpegload_options.shrink;
11481 let shrink_in_name = utils::new_c_string("shrink")?;
11482
11483 let autorotate_in: i32 = if jpegload_options.autorotate { 1 } else { 0 };
11484 let autorotate_in_name = utils::new_c_string("autorotate")?;
11485
11486 let unlimited_in: i32 = if jpegload_options.unlimited { 1 } else { 0 };
11487 let unlimited_in_name = utils::new_c_string("unlimited")?;
11488
11489 let flags_in: i32 = jpegload_options.flags as i32;
11490 let flags_in_name = utils::new_c_string("flags")?;
11491
11492 let memory_in: i32 = if jpegload_options.memory { 1 } else { 0 };
11493 let memory_in_name = utils::new_c_string("memory")?;
11494
11495 let access_in: i32 = jpegload_options.access as i32;
11496 let access_in_name = utils::new_c_string("access")?;
11497
11498 let fail_on_in: i32 = jpegload_options.fail_on as i32;
11499 let fail_on_in_name = utils::new_c_string("fail-on")?;
11500
11501 let revalidate_in: i32 = if jpegload_options.revalidate { 1 } else { 0 };
11502 let revalidate_in_name = utils::new_c_string("revalidate")?;
11503
11504 let vips_op_response = bindings::vips_jpegload(
11505 filename_in.as_ptr(),
11506 &mut out_out,
11507 shrink_in_name.as_ptr(),
11508 shrink_in,
11509 autorotate_in_name.as_ptr(),
11510 autorotate_in,
11511 unlimited_in_name.as_ptr(),
11512 unlimited_in,
11513 flags_in_name.as_ptr(),
11514 flags_in,
11515 memory_in_name.as_ptr(),
11516 memory_in,
11517 access_in_name.as_ptr(),
11518 access_in,
11519 fail_on_in_name.as_ptr(),
11520 fail_on_in,
11521 revalidate_in_name.as_ptr(),
11522 revalidate_in,
11523 NULL,
11524 );
11525 utils::result(
11526 vips_op_response,
11527 VipsImage { ctx: out_out },
11528 Error::JpegloadError,
11529 )
11530 }
11531}
11532
11533pub fn jpegload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11537 unsafe {
11538 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11539 let mut out_out: *mut bindings::VipsImage = null_mut();
11540
11541 let vips_op_response =
11542 bindings::vips_jpegload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11543 utils::result(
11544 vips_op_response,
11545 VipsImage { ctx: out_out },
11546 Error::JpegloadBufferError,
11547 )
11548 }
11549}
11550
11551#[derive(Clone, Debug)]
11553pub struct JpegloadBufferOptions {
11554 pub shrink: i32,
11557 pub autorotate: bool,
11560 pub unlimited: bool,
11563 pub flags: ForeignFlags,
11570 pub memory: bool,
11573 pub access: Access,
11579 pub fail_on: FailOn,
11586 pub revalidate: bool,
11589}
11590
11591impl std::default::Default for JpegloadBufferOptions {
11592 fn default() -> Self {
11593 JpegloadBufferOptions {
11594 shrink: i32::from(1),
11595 autorotate: false,
11596 unlimited: false,
11597 flags: ForeignFlags::None,
11598 memory: false,
11599 access: Access::Random,
11600 fail_on: FailOn::None,
11601 revalidate: false,
11602 }
11603 }
11604}
11605
11606pub fn jpegload_buffer_with_opts(
11611 buffer: &[u8],
11612 jpegload_buffer_options: &JpegloadBufferOptions,
11613) -> Result<VipsImage> {
11614 unsafe {
11615 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11616 let mut out_out: *mut bindings::VipsImage = null_mut();
11617
11618 let shrink_in: i32 = jpegload_buffer_options.shrink;
11619 let shrink_in_name = utils::new_c_string("shrink")?;
11620
11621 let autorotate_in: i32 = if jpegload_buffer_options.autorotate {
11622 1
11623 } else {
11624 0
11625 };
11626 let autorotate_in_name = utils::new_c_string("autorotate")?;
11627
11628 let unlimited_in: i32 = if jpegload_buffer_options.unlimited {
11629 1
11630 } else {
11631 0
11632 };
11633 let unlimited_in_name = utils::new_c_string("unlimited")?;
11634
11635 let flags_in: i32 = jpegload_buffer_options.flags as i32;
11636 let flags_in_name = utils::new_c_string("flags")?;
11637
11638 let memory_in: i32 = if jpegload_buffer_options.memory { 1 } else { 0 };
11639 let memory_in_name = utils::new_c_string("memory")?;
11640
11641 let access_in: i32 = jpegload_buffer_options.access as i32;
11642 let access_in_name = utils::new_c_string("access")?;
11643
11644 let fail_on_in: i32 = jpegload_buffer_options.fail_on as i32;
11645 let fail_on_in_name = utils::new_c_string("fail-on")?;
11646
11647 let revalidate_in: i32 = if jpegload_buffer_options.revalidate {
11648 1
11649 } else {
11650 0
11651 };
11652 let revalidate_in_name = utils::new_c_string("revalidate")?;
11653
11654 let vips_op_response = bindings::vips_jpegload_buffer(
11655 buffer_in,
11656 buffer.len() as u64,
11657 &mut out_out,
11658 shrink_in_name.as_ptr(),
11659 shrink_in,
11660 autorotate_in_name.as_ptr(),
11661 autorotate_in,
11662 unlimited_in_name.as_ptr(),
11663 unlimited_in,
11664 flags_in_name.as_ptr(),
11665 flags_in,
11666 memory_in_name.as_ptr(),
11667 memory_in,
11668 access_in_name.as_ptr(),
11669 access_in,
11670 fail_on_in_name.as_ptr(),
11671 fail_on_in,
11672 revalidate_in_name.as_ptr(),
11673 revalidate_in,
11674 NULL,
11675 );
11676 utils::result(
11677 vips_op_response,
11678 VipsImage { ctx: out_out },
11679 Error::JpegloadBufferError,
11680 )
11681 }
11682}
11683
11684pub fn jpegload_source(source: &VipsSource) -> Result<VipsImage> {
11688 unsafe {
11689 let source_in: *mut bindings::VipsSource = source.ctx;
11690 let mut out_out: *mut bindings::VipsImage = null_mut();
11691
11692 let vips_op_response = bindings::vips_jpegload_source(source_in, &mut out_out, NULL);
11693 utils::result(
11694 vips_op_response,
11695 VipsImage { ctx: out_out },
11696 Error::JpegloadSourceError,
11697 )
11698 }
11699}
11700
11701#[derive(Clone, Debug)]
11703pub struct JpegloadSourceOptions {
11704 pub shrink: i32,
11707 pub autorotate: bool,
11710 pub unlimited: bool,
11713 pub flags: ForeignFlags,
11720 pub memory: bool,
11723 pub access: Access,
11729 pub fail_on: FailOn,
11736 pub revalidate: bool,
11739}
11740
11741impl std::default::Default for JpegloadSourceOptions {
11742 fn default() -> Self {
11743 JpegloadSourceOptions {
11744 shrink: i32::from(1),
11745 autorotate: false,
11746 unlimited: false,
11747 flags: ForeignFlags::None,
11748 memory: false,
11749 access: Access::Random,
11750 fail_on: FailOn::None,
11751 revalidate: false,
11752 }
11753 }
11754}
11755
11756pub fn jpegload_source_with_opts(
11761 source: &VipsSource,
11762 jpegload_source_options: &JpegloadSourceOptions,
11763) -> Result<VipsImage> {
11764 unsafe {
11765 let source_in: *mut bindings::VipsSource = source.ctx;
11766 let mut out_out: *mut bindings::VipsImage = null_mut();
11767
11768 let shrink_in: i32 = jpegload_source_options.shrink;
11769 let shrink_in_name = utils::new_c_string("shrink")?;
11770
11771 let autorotate_in: i32 = if jpegload_source_options.autorotate {
11772 1
11773 } else {
11774 0
11775 };
11776 let autorotate_in_name = utils::new_c_string("autorotate")?;
11777
11778 let unlimited_in: i32 = if jpegload_source_options.unlimited {
11779 1
11780 } else {
11781 0
11782 };
11783 let unlimited_in_name = utils::new_c_string("unlimited")?;
11784
11785 let flags_in: i32 = jpegload_source_options.flags as i32;
11786 let flags_in_name = utils::new_c_string("flags")?;
11787
11788 let memory_in: i32 = if jpegload_source_options.memory { 1 } else { 0 };
11789 let memory_in_name = utils::new_c_string("memory")?;
11790
11791 let access_in: i32 = jpegload_source_options.access as i32;
11792 let access_in_name = utils::new_c_string("access")?;
11793
11794 let fail_on_in: i32 = jpegload_source_options.fail_on as i32;
11795 let fail_on_in_name = utils::new_c_string("fail-on")?;
11796
11797 let revalidate_in: i32 = if jpegload_source_options.revalidate {
11798 1
11799 } else {
11800 0
11801 };
11802 let revalidate_in_name = utils::new_c_string("revalidate")?;
11803
11804 let vips_op_response = bindings::vips_jpegload_source(
11805 source_in,
11806 &mut out_out,
11807 shrink_in_name.as_ptr(),
11808 shrink_in,
11809 autorotate_in_name.as_ptr(),
11810 autorotate_in,
11811 unlimited_in_name.as_ptr(),
11812 unlimited_in,
11813 flags_in_name.as_ptr(),
11814 flags_in,
11815 memory_in_name.as_ptr(),
11816 memory_in,
11817 access_in_name.as_ptr(),
11818 access_in,
11819 fail_on_in_name.as_ptr(),
11820 fail_on_in,
11821 revalidate_in_name.as_ptr(),
11822 revalidate_in,
11823 NULL,
11824 );
11825 utils::result(
11826 vips_op_response,
11827 VipsImage { ctx: out_out },
11828 Error::JpegloadSourceError,
11829 )
11830 }
11831}
11832
11833pub fn webpload(filename: &str) -> Result<VipsImage> {
11837 unsafe {
11838 let filename_in: CString = utils::new_c_string(filename)?;
11839 let mut out_out: *mut bindings::VipsImage = null_mut();
11840
11841 let vips_op_response = bindings::vips_webpload(filename_in.as_ptr(), &mut out_out, NULL);
11842 utils::result(
11843 vips_op_response,
11844 VipsImage { ctx: out_out },
11845 Error::WebploadError,
11846 )
11847 }
11848}
11849
11850#[derive(Clone, Debug)]
11852pub struct WebploadOptions {
11853 pub page: i32,
11856 pub n: i32,
11859 pub scale: f64,
11862 pub flags: ForeignFlags,
11869 pub memory: bool,
11872 pub access: Access,
11878 pub fail_on: FailOn,
11885 pub revalidate: bool,
11888}
11889
11890impl std::default::Default for WebploadOptions {
11891 fn default() -> Self {
11892 WebploadOptions {
11893 page: i32::from(0),
11894 n: i32::from(1),
11895 scale: f64::from(1),
11896 flags: ForeignFlags::None,
11897 memory: false,
11898 access: Access::Random,
11899 fail_on: FailOn::None,
11900 revalidate: false,
11901 }
11902 }
11903}
11904
11905pub fn webpload_with_opts(filename: &str, webpload_options: &WebploadOptions) -> Result<VipsImage> {
11910 unsafe {
11911 let filename_in: CString = utils::new_c_string(filename)?;
11912 let mut out_out: *mut bindings::VipsImage = null_mut();
11913
11914 let page_in: i32 = webpload_options.page;
11915 let page_in_name = utils::new_c_string("page")?;
11916
11917 let n_in: i32 = webpload_options.n;
11918 let n_in_name = utils::new_c_string("n")?;
11919
11920 let scale_in: f64 = webpload_options.scale;
11921 let scale_in_name = utils::new_c_string("scale")?;
11922
11923 let flags_in: i32 = webpload_options.flags as i32;
11924 let flags_in_name = utils::new_c_string("flags")?;
11925
11926 let memory_in: i32 = if webpload_options.memory { 1 } else { 0 };
11927 let memory_in_name = utils::new_c_string("memory")?;
11928
11929 let access_in: i32 = webpload_options.access as i32;
11930 let access_in_name = utils::new_c_string("access")?;
11931
11932 let fail_on_in: i32 = webpload_options.fail_on as i32;
11933 let fail_on_in_name = utils::new_c_string("fail-on")?;
11934
11935 let revalidate_in: i32 = if webpload_options.revalidate { 1 } else { 0 };
11936 let revalidate_in_name = utils::new_c_string("revalidate")?;
11937
11938 let vips_op_response = bindings::vips_webpload(
11939 filename_in.as_ptr(),
11940 &mut out_out,
11941 page_in_name.as_ptr(),
11942 page_in,
11943 n_in_name.as_ptr(),
11944 n_in,
11945 scale_in_name.as_ptr(),
11946 scale_in,
11947 flags_in_name.as_ptr(),
11948 flags_in,
11949 memory_in_name.as_ptr(),
11950 memory_in,
11951 access_in_name.as_ptr(),
11952 access_in,
11953 fail_on_in_name.as_ptr(),
11954 fail_on_in,
11955 revalidate_in_name.as_ptr(),
11956 revalidate_in,
11957 NULL,
11958 );
11959 utils::result(
11960 vips_op_response,
11961 VipsImage { ctx: out_out },
11962 Error::WebploadError,
11963 )
11964 }
11965}
11966
11967pub fn webpload_buffer(buffer: &[u8]) -> Result<VipsImage> {
11971 unsafe {
11972 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
11973 let mut out_out: *mut bindings::VipsImage = null_mut();
11974
11975 let vips_op_response =
11976 bindings::vips_webpload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
11977 utils::result(
11978 vips_op_response,
11979 VipsImage { ctx: out_out },
11980 Error::WebploadBufferError,
11981 )
11982 }
11983}
11984
11985#[derive(Clone, Debug)]
11987pub struct WebploadBufferOptions {
11988 pub page: i32,
11991 pub n: i32,
11994 pub scale: f64,
11997 pub flags: ForeignFlags,
12004 pub memory: bool,
12007 pub access: Access,
12013 pub fail_on: FailOn,
12020 pub revalidate: bool,
12023}
12024
12025impl std::default::Default for WebploadBufferOptions {
12026 fn default() -> Self {
12027 WebploadBufferOptions {
12028 page: i32::from(0),
12029 n: i32::from(1),
12030 scale: f64::from(1),
12031 flags: ForeignFlags::None,
12032 memory: false,
12033 access: Access::Random,
12034 fail_on: FailOn::None,
12035 revalidate: false,
12036 }
12037 }
12038}
12039
12040pub fn webpload_buffer_with_opts(
12045 buffer: &[u8],
12046 webpload_buffer_options: &WebploadBufferOptions,
12047) -> Result<VipsImage> {
12048 unsafe {
12049 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12050 let mut out_out: *mut bindings::VipsImage = null_mut();
12051
12052 let page_in: i32 = webpload_buffer_options.page;
12053 let page_in_name = utils::new_c_string("page")?;
12054
12055 let n_in: i32 = webpload_buffer_options.n;
12056 let n_in_name = utils::new_c_string("n")?;
12057
12058 let scale_in: f64 = webpload_buffer_options.scale;
12059 let scale_in_name = utils::new_c_string("scale")?;
12060
12061 let flags_in: i32 = webpload_buffer_options.flags as i32;
12062 let flags_in_name = utils::new_c_string("flags")?;
12063
12064 let memory_in: i32 = if webpload_buffer_options.memory { 1 } else { 0 };
12065 let memory_in_name = utils::new_c_string("memory")?;
12066
12067 let access_in: i32 = webpload_buffer_options.access as i32;
12068 let access_in_name = utils::new_c_string("access")?;
12069
12070 let fail_on_in: i32 = webpload_buffer_options.fail_on as i32;
12071 let fail_on_in_name = utils::new_c_string("fail-on")?;
12072
12073 let revalidate_in: i32 = if webpload_buffer_options.revalidate {
12074 1
12075 } else {
12076 0
12077 };
12078 let revalidate_in_name = utils::new_c_string("revalidate")?;
12079
12080 let vips_op_response = bindings::vips_webpload_buffer(
12081 buffer_in,
12082 buffer.len() as u64,
12083 &mut out_out,
12084 page_in_name.as_ptr(),
12085 page_in,
12086 n_in_name.as_ptr(),
12087 n_in,
12088 scale_in_name.as_ptr(),
12089 scale_in,
12090 flags_in_name.as_ptr(),
12091 flags_in,
12092 memory_in_name.as_ptr(),
12093 memory_in,
12094 access_in_name.as_ptr(),
12095 access_in,
12096 fail_on_in_name.as_ptr(),
12097 fail_on_in,
12098 revalidate_in_name.as_ptr(),
12099 revalidate_in,
12100 NULL,
12101 );
12102 utils::result(
12103 vips_op_response,
12104 VipsImage { ctx: out_out },
12105 Error::WebploadBufferError,
12106 )
12107 }
12108}
12109
12110pub fn webpload_source(source: &VipsSource) -> Result<VipsImage> {
12114 unsafe {
12115 let source_in: *mut bindings::VipsSource = source.ctx;
12116 let mut out_out: *mut bindings::VipsImage = null_mut();
12117
12118 let vips_op_response = bindings::vips_webpload_source(source_in, &mut out_out, NULL);
12119 utils::result(
12120 vips_op_response,
12121 VipsImage { ctx: out_out },
12122 Error::WebploadSourceError,
12123 )
12124 }
12125}
12126
12127#[derive(Clone, Debug)]
12129pub struct WebploadSourceOptions {
12130 pub page: i32,
12133 pub n: i32,
12136 pub scale: f64,
12139 pub flags: ForeignFlags,
12146 pub memory: bool,
12149 pub access: Access,
12155 pub fail_on: FailOn,
12162 pub revalidate: bool,
12165}
12166
12167impl std::default::Default for WebploadSourceOptions {
12168 fn default() -> Self {
12169 WebploadSourceOptions {
12170 page: i32::from(0),
12171 n: i32::from(1),
12172 scale: f64::from(1),
12173 flags: ForeignFlags::None,
12174 memory: false,
12175 access: Access::Random,
12176 fail_on: FailOn::None,
12177 revalidate: false,
12178 }
12179 }
12180}
12181
12182pub fn webpload_source_with_opts(
12187 source: &VipsSource,
12188 webpload_source_options: &WebploadSourceOptions,
12189) -> Result<VipsImage> {
12190 unsafe {
12191 let source_in: *mut bindings::VipsSource = source.ctx;
12192 let mut out_out: *mut bindings::VipsImage = null_mut();
12193
12194 let page_in: i32 = webpload_source_options.page;
12195 let page_in_name = utils::new_c_string("page")?;
12196
12197 let n_in: i32 = webpload_source_options.n;
12198 let n_in_name = utils::new_c_string("n")?;
12199
12200 let scale_in: f64 = webpload_source_options.scale;
12201 let scale_in_name = utils::new_c_string("scale")?;
12202
12203 let flags_in: i32 = webpload_source_options.flags as i32;
12204 let flags_in_name = utils::new_c_string("flags")?;
12205
12206 let memory_in: i32 = if webpload_source_options.memory { 1 } else { 0 };
12207 let memory_in_name = utils::new_c_string("memory")?;
12208
12209 let access_in: i32 = webpload_source_options.access as i32;
12210 let access_in_name = utils::new_c_string("access")?;
12211
12212 let fail_on_in: i32 = webpload_source_options.fail_on as i32;
12213 let fail_on_in_name = utils::new_c_string("fail-on")?;
12214
12215 let revalidate_in: i32 = if webpload_source_options.revalidate {
12216 1
12217 } else {
12218 0
12219 };
12220 let revalidate_in_name = utils::new_c_string("revalidate")?;
12221
12222 let vips_op_response = bindings::vips_webpload_source(
12223 source_in,
12224 &mut out_out,
12225 page_in_name.as_ptr(),
12226 page_in,
12227 n_in_name.as_ptr(),
12228 n_in,
12229 scale_in_name.as_ptr(),
12230 scale_in,
12231 flags_in_name.as_ptr(),
12232 flags_in,
12233 memory_in_name.as_ptr(),
12234 memory_in,
12235 access_in_name.as_ptr(),
12236 access_in,
12237 fail_on_in_name.as_ptr(),
12238 fail_on_in,
12239 revalidate_in_name.as_ptr(),
12240 revalidate_in,
12241 NULL,
12242 );
12243 utils::result(
12244 vips_op_response,
12245 VipsImage { ctx: out_out },
12246 Error::WebploadSourceError,
12247 )
12248 }
12249}
12250
12251pub fn tiffload(filename: &str) -> Result<VipsImage> {
12255 unsafe {
12256 let filename_in: CString = utils::new_c_string(filename)?;
12257 let mut out_out: *mut bindings::VipsImage = null_mut();
12258
12259 let vips_op_response = bindings::vips_tiffload(filename_in.as_ptr(), &mut out_out, NULL);
12260 utils::result(
12261 vips_op_response,
12262 VipsImage { ctx: out_out },
12263 Error::TiffloadError,
12264 )
12265 }
12266}
12267
12268#[derive(Clone, Debug)]
12270pub struct TiffloadOptions {
12271 pub page: i32,
12274 pub subifd: i32,
12277 pub n: i32,
12280 pub autorotate: bool,
12283 pub flags: ForeignFlags,
12290 pub memory: bool,
12293 pub access: Access,
12299 pub fail_on: FailOn,
12306 pub revalidate: bool,
12309}
12310
12311impl std::default::Default for TiffloadOptions {
12312 fn default() -> Self {
12313 TiffloadOptions {
12314 page: i32::from(0),
12315 subifd: i32::from(-1),
12316 n: i32::from(1),
12317 autorotate: false,
12318 flags: ForeignFlags::None,
12319 memory: false,
12320 access: Access::Random,
12321 fail_on: FailOn::None,
12322 revalidate: false,
12323 }
12324 }
12325}
12326
12327pub fn tiffload_with_opts(filename: &str, tiffload_options: &TiffloadOptions) -> Result<VipsImage> {
12332 unsafe {
12333 let filename_in: CString = utils::new_c_string(filename)?;
12334 let mut out_out: *mut bindings::VipsImage = null_mut();
12335
12336 let page_in: i32 = tiffload_options.page;
12337 let page_in_name = utils::new_c_string("page")?;
12338
12339 let subifd_in: i32 = tiffload_options.subifd;
12340 let subifd_in_name = utils::new_c_string("subifd")?;
12341
12342 let n_in: i32 = tiffload_options.n;
12343 let n_in_name = utils::new_c_string("n")?;
12344
12345 let autorotate_in: i32 = if tiffload_options.autorotate { 1 } else { 0 };
12346 let autorotate_in_name = utils::new_c_string("autorotate")?;
12347
12348 let flags_in: i32 = tiffload_options.flags as i32;
12349 let flags_in_name = utils::new_c_string("flags")?;
12350
12351 let memory_in: i32 = if tiffload_options.memory { 1 } else { 0 };
12352 let memory_in_name = utils::new_c_string("memory")?;
12353
12354 let access_in: i32 = tiffload_options.access as i32;
12355 let access_in_name = utils::new_c_string("access")?;
12356
12357 let fail_on_in: i32 = tiffload_options.fail_on as i32;
12358 let fail_on_in_name = utils::new_c_string("fail-on")?;
12359
12360 let revalidate_in: i32 = if tiffload_options.revalidate { 1 } else { 0 };
12361 let revalidate_in_name = utils::new_c_string("revalidate")?;
12362
12363 let vips_op_response = bindings::vips_tiffload(
12364 filename_in.as_ptr(),
12365 &mut out_out,
12366 page_in_name.as_ptr(),
12367 page_in,
12368 subifd_in_name.as_ptr(),
12369 subifd_in,
12370 n_in_name.as_ptr(),
12371 n_in,
12372 autorotate_in_name.as_ptr(),
12373 autorotate_in,
12374 flags_in_name.as_ptr(),
12375 flags_in,
12376 memory_in_name.as_ptr(),
12377 memory_in,
12378 access_in_name.as_ptr(),
12379 access_in,
12380 fail_on_in_name.as_ptr(),
12381 fail_on_in,
12382 revalidate_in_name.as_ptr(),
12383 revalidate_in,
12384 NULL,
12385 );
12386 utils::result(
12387 vips_op_response,
12388 VipsImage { ctx: out_out },
12389 Error::TiffloadError,
12390 )
12391 }
12392}
12393
12394pub fn tiffload_buffer(buffer: &[u8]) -> Result<VipsImage> {
12398 unsafe {
12399 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12400 let mut out_out: *mut bindings::VipsImage = null_mut();
12401
12402 let vips_op_response =
12403 bindings::vips_tiffload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
12404 utils::result(
12405 vips_op_response,
12406 VipsImage { ctx: out_out },
12407 Error::TiffloadBufferError,
12408 )
12409 }
12410}
12411
12412#[derive(Clone, Debug)]
12414pub struct TiffloadBufferOptions {
12415 pub page: i32,
12418 pub subifd: i32,
12421 pub n: i32,
12424 pub autorotate: bool,
12427 pub flags: ForeignFlags,
12434 pub memory: bool,
12437 pub access: Access,
12443 pub fail_on: FailOn,
12450 pub revalidate: bool,
12453}
12454
12455impl std::default::Default for TiffloadBufferOptions {
12456 fn default() -> Self {
12457 TiffloadBufferOptions {
12458 page: i32::from(0),
12459 subifd: i32::from(-1),
12460 n: i32::from(1),
12461 autorotate: false,
12462 flags: ForeignFlags::None,
12463 memory: false,
12464 access: Access::Random,
12465 fail_on: FailOn::None,
12466 revalidate: false,
12467 }
12468 }
12469}
12470
12471pub fn tiffload_buffer_with_opts(
12476 buffer: &[u8],
12477 tiffload_buffer_options: &TiffloadBufferOptions,
12478) -> Result<VipsImage> {
12479 unsafe {
12480 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
12481 let mut out_out: *mut bindings::VipsImage = null_mut();
12482
12483 let page_in: i32 = tiffload_buffer_options.page;
12484 let page_in_name = utils::new_c_string("page")?;
12485
12486 let subifd_in: i32 = tiffload_buffer_options.subifd;
12487 let subifd_in_name = utils::new_c_string("subifd")?;
12488
12489 let n_in: i32 = tiffload_buffer_options.n;
12490 let n_in_name = utils::new_c_string("n")?;
12491
12492 let autorotate_in: i32 = if tiffload_buffer_options.autorotate {
12493 1
12494 } else {
12495 0
12496 };
12497 let autorotate_in_name = utils::new_c_string("autorotate")?;
12498
12499 let flags_in: i32 = tiffload_buffer_options.flags as i32;
12500 let flags_in_name = utils::new_c_string("flags")?;
12501
12502 let memory_in: i32 = if tiffload_buffer_options.memory { 1 } else { 0 };
12503 let memory_in_name = utils::new_c_string("memory")?;
12504
12505 let access_in: i32 = tiffload_buffer_options.access as i32;
12506 let access_in_name = utils::new_c_string("access")?;
12507
12508 let fail_on_in: i32 = tiffload_buffer_options.fail_on as i32;
12509 let fail_on_in_name = utils::new_c_string("fail-on")?;
12510
12511 let revalidate_in: i32 = if tiffload_buffer_options.revalidate {
12512 1
12513 } else {
12514 0
12515 };
12516 let revalidate_in_name = utils::new_c_string("revalidate")?;
12517
12518 let vips_op_response = bindings::vips_tiffload_buffer(
12519 buffer_in,
12520 buffer.len() as u64,
12521 &mut out_out,
12522 page_in_name.as_ptr(),
12523 page_in,
12524 subifd_in_name.as_ptr(),
12525 subifd_in,
12526 n_in_name.as_ptr(),
12527 n_in,
12528 autorotate_in_name.as_ptr(),
12529 autorotate_in,
12530 flags_in_name.as_ptr(),
12531 flags_in,
12532 memory_in_name.as_ptr(),
12533 memory_in,
12534 access_in_name.as_ptr(),
12535 access_in,
12536 fail_on_in_name.as_ptr(),
12537 fail_on_in,
12538 revalidate_in_name.as_ptr(),
12539 revalidate_in,
12540 NULL,
12541 );
12542 utils::result(
12543 vips_op_response,
12544 VipsImage { ctx: out_out },
12545 Error::TiffloadBufferError,
12546 )
12547 }
12548}
12549
12550pub fn tiffload_source(source: &VipsSource) -> Result<VipsImage> {
12554 unsafe {
12555 let source_in: *mut bindings::VipsSource = source.ctx;
12556 let mut out_out: *mut bindings::VipsImage = null_mut();
12557
12558 let vips_op_response = bindings::vips_tiffload_source(source_in, &mut out_out, NULL);
12559 utils::result(
12560 vips_op_response,
12561 VipsImage { ctx: out_out },
12562 Error::TiffloadSourceError,
12563 )
12564 }
12565}
12566
12567#[derive(Clone, Debug)]
12569pub struct TiffloadSourceOptions {
12570 pub page: i32,
12573 pub subifd: i32,
12576 pub n: i32,
12579 pub autorotate: bool,
12582 pub flags: ForeignFlags,
12589 pub memory: bool,
12592 pub access: Access,
12598 pub fail_on: FailOn,
12605 pub revalidate: bool,
12608}
12609
12610impl std::default::Default for TiffloadSourceOptions {
12611 fn default() -> Self {
12612 TiffloadSourceOptions {
12613 page: i32::from(0),
12614 subifd: i32::from(-1),
12615 n: i32::from(1),
12616 autorotate: false,
12617 flags: ForeignFlags::None,
12618 memory: false,
12619 access: Access::Random,
12620 fail_on: FailOn::None,
12621 revalidate: false,
12622 }
12623 }
12624}
12625
12626pub fn tiffload_source_with_opts(
12631 source: &VipsSource,
12632 tiffload_source_options: &TiffloadSourceOptions,
12633) -> Result<VipsImage> {
12634 unsafe {
12635 let source_in: *mut bindings::VipsSource = source.ctx;
12636 let mut out_out: *mut bindings::VipsImage = null_mut();
12637
12638 let page_in: i32 = tiffload_source_options.page;
12639 let page_in_name = utils::new_c_string("page")?;
12640
12641 let subifd_in: i32 = tiffload_source_options.subifd;
12642 let subifd_in_name = utils::new_c_string("subifd")?;
12643
12644 let n_in: i32 = tiffload_source_options.n;
12645 let n_in_name = utils::new_c_string("n")?;
12646
12647 let autorotate_in: i32 = if tiffload_source_options.autorotate {
12648 1
12649 } else {
12650 0
12651 };
12652 let autorotate_in_name = utils::new_c_string("autorotate")?;
12653
12654 let flags_in: i32 = tiffload_source_options.flags as i32;
12655 let flags_in_name = utils::new_c_string("flags")?;
12656
12657 let memory_in: i32 = if tiffload_source_options.memory { 1 } else { 0 };
12658 let memory_in_name = utils::new_c_string("memory")?;
12659
12660 let access_in: i32 = tiffload_source_options.access as i32;
12661 let access_in_name = utils::new_c_string("access")?;
12662
12663 let fail_on_in: i32 = tiffload_source_options.fail_on as i32;
12664 let fail_on_in_name = utils::new_c_string("fail-on")?;
12665
12666 let revalidate_in: i32 = if tiffload_source_options.revalidate {
12667 1
12668 } else {
12669 0
12670 };
12671 let revalidate_in_name = utils::new_c_string("revalidate")?;
12672
12673 let vips_op_response = bindings::vips_tiffload_source(
12674 source_in,
12675 &mut out_out,
12676 page_in_name.as_ptr(),
12677 page_in,
12678 subifd_in_name.as_ptr(),
12679 subifd_in,
12680 n_in_name.as_ptr(),
12681 n_in,
12682 autorotate_in_name.as_ptr(),
12683 autorotate_in,
12684 flags_in_name.as_ptr(),
12685 flags_in,
12686 memory_in_name.as_ptr(),
12687 memory_in,
12688 access_in_name.as_ptr(),
12689 access_in,
12690 fail_on_in_name.as_ptr(),
12691 fail_on_in,
12692 revalidate_in_name.as_ptr(),
12693 revalidate_in,
12694 NULL,
12695 );
12696 utils::result(
12697 vips_op_response,
12698 VipsImage { ctx: out_out },
12699 Error::TiffloadSourceError,
12700 )
12701 }
12702}
12703
12704pub fn fitsload(filename: &str) -> Result<VipsImage> {
12708 unsafe {
12709 let filename_in: CString = utils::new_c_string(filename)?;
12710 let mut out_out: *mut bindings::VipsImage = null_mut();
12711
12712 let vips_op_response = bindings::vips_fitsload(filename_in.as_ptr(), &mut out_out, NULL);
12713 utils::result(
12714 vips_op_response,
12715 VipsImage { ctx: out_out },
12716 Error::FitsloadError,
12717 )
12718 }
12719}
12720
12721#[derive(Clone, Debug)]
12723pub struct FitsloadOptions {
12724 pub flags: ForeignFlags,
12731 pub memory: bool,
12734 pub access: Access,
12740 pub fail_on: FailOn,
12747 pub revalidate: bool,
12750}
12751
12752impl std::default::Default for FitsloadOptions {
12753 fn default() -> Self {
12754 FitsloadOptions {
12755 flags: ForeignFlags::None,
12756 memory: false,
12757 access: Access::Random,
12758 fail_on: FailOn::None,
12759 revalidate: false,
12760 }
12761 }
12762}
12763
12764pub fn fitsload_with_opts(filename: &str, fitsload_options: &FitsloadOptions) -> Result<VipsImage> {
12769 unsafe {
12770 let filename_in: CString = utils::new_c_string(filename)?;
12771 let mut out_out: *mut bindings::VipsImage = null_mut();
12772
12773 let flags_in: i32 = fitsload_options.flags as i32;
12774 let flags_in_name = utils::new_c_string("flags")?;
12775
12776 let memory_in: i32 = if fitsload_options.memory { 1 } else { 0 };
12777 let memory_in_name = utils::new_c_string("memory")?;
12778
12779 let access_in: i32 = fitsload_options.access as i32;
12780 let access_in_name = utils::new_c_string("access")?;
12781
12782 let fail_on_in: i32 = fitsload_options.fail_on as i32;
12783 let fail_on_in_name = utils::new_c_string("fail-on")?;
12784
12785 let revalidate_in: i32 = if fitsload_options.revalidate { 1 } else { 0 };
12786 let revalidate_in_name = utils::new_c_string("revalidate")?;
12787
12788 let vips_op_response = bindings::vips_fitsload(
12789 filename_in.as_ptr(),
12790 &mut out_out,
12791 flags_in_name.as_ptr(),
12792 flags_in,
12793 memory_in_name.as_ptr(),
12794 memory_in,
12795 access_in_name.as_ptr(),
12796 access_in,
12797 fail_on_in_name.as_ptr(),
12798 fail_on_in,
12799 revalidate_in_name.as_ptr(),
12800 revalidate_in,
12801 NULL,
12802 );
12803 utils::result(
12804 vips_op_response,
12805 VipsImage { ctx: out_out },
12806 Error::FitsloadError,
12807 )
12808 }
12809}
12810
12811pub fn openexrload(filename: &str) -> Result<VipsImage> {
12815 unsafe {
12816 let filename_in: CString = utils::new_c_string(filename)?;
12817 let mut out_out: *mut bindings::VipsImage = null_mut();
12818
12819 let vips_op_response = bindings::vips_openexrload(filename_in.as_ptr(), &mut out_out, NULL);
12820 utils::result(
12821 vips_op_response,
12822 VipsImage { ctx: out_out },
12823 Error::OpenexrloadError,
12824 )
12825 }
12826}
12827
12828#[derive(Clone, Debug)]
12830pub struct OpenexrloadOptions {
12831 pub flags: ForeignFlags,
12838 pub memory: bool,
12841 pub access: Access,
12847 pub fail_on: FailOn,
12854 pub revalidate: bool,
12857}
12858
12859impl std::default::Default for OpenexrloadOptions {
12860 fn default() -> Self {
12861 OpenexrloadOptions {
12862 flags: ForeignFlags::None,
12863 memory: false,
12864 access: Access::Random,
12865 fail_on: FailOn::None,
12866 revalidate: false,
12867 }
12868 }
12869}
12870
12871pub fn openexrload_with_opts(
12876 filename: &str,
12877 openexrload_options: &OpenexrloadOptions,
12878) -> Result<VipsImage> {
12879 unsafe {
12880 let filename_in: CString = utils::new_c_string(filename)?;
12881 let mut out_out: *mut bindings::VipsImage = null_mut();
12882
12883 let flags_in: i32 = openexrload_options.flags as i32;
12884 let flags_in_name = utils::new_c_string("flags")?;
12885
12886 let memory_in: i32 = if openexrload_options.memory { 1 } else { 0 };
12887 let memory_in_name = utils::new_c_string("memory")?;
12888
12889 let access_in: i32 = openexrload_options.access as i32;
12890 let access_in_name = utils::new_c_string("access")?;
12891
12892 let fail_on_in: i32 = openexrload_options.fail_on as i32;
12893 let fail_on_in_name = utils::new_c_string("fail-on")?;
12894
12895 let revalidate_in: i32 = if openexrload_options.revalidate { 1 } else { 0 };
12896 let revalidate_in_name = utils::new_c_string("revalidate")?;
12897
12898 let vips_op_response = bindings::vips_openexrload(
12899 filename_in.as_ptr(),
12900 &mut out_out,
12901 flags_in_name.as_ptr(),
12902 flags_in,
12903 memory_in_name.as_ptr(),
12904 memory_in,
12905 access_in_name.as_ptr(),
12906 access_in,
12907 fail_on_in_name.as_ptr(),
12908 fail_on_in,
12909 revalidate_in_name.as_ptr(),
12910 revalidate_in,
12911 NULL,
12912 );
12913 utils::result(
12914 vips_op_response,
12915 VipsImage { ctx: out_out },
12916 Error::OpenexrloadError,
12917 )
12918 }
12919}
12920
12921pub fn heifload(filename: &str) -> Result<VipsImage> {
12925 unsafe {
12926 let filename_in: CString = utils::new_c_string(filename)?;
12927 let mut out_out: *mut bindings::VipsImage = null_mut();
12928
12929 let vips_op_response = bindings::vips_heifload(filename_in.as_ptr(), &mut out_out, NULL);
12930 utils::result(
12931 vips_op_response,
12932 VipsImage { ctx: out_out },
12933 Error::HeifloadError,
12934 )
12935 }
12936}
12937
12938#[derive(Clone, Debug)]
12940pub struct HeifloadOptions {
12941 pub page: i32,
12944 pub n: i32,
12947 pub thumbnail: bool,
12950 pub unlimited: bool,
12953 pub flags: ForeignFlags,
12960 pub memory: bool,
12963 pub access: Access,
12969 pub fail_on: FailOn,
12976 pub revalidate: bool,
12979}
12980
12981impl std::default::Default for HeifloadOptions {
12982 fn default() -> Self {
12983 HeifloadOptions {
12984 page: i32::from(0),
12985 n: i32::from(1),
12986 thumbnail: false,
12987 unlimited: false,
12988 flags: ForeignFlags::None,
12989 memory: false,
12990 access: Access::Random,
12991 fail_on: FailOn::None,
12992 revalidate: false,
12993 }
12994 }
12995}
12996
12997pub fn heifload_with_opts(filename: &str, heifload_options: &HeifloadOptions) -> Result<VipsImage> {
13002 unsafe {
13003 let filename_in: CString = utils::new_c_string(filename)?;
13004 let mut out_out: *mut bindings::VipsImage = null_mut();
13005
13006 let page_in: i32 = heifload_options.page;
13007 let page_in_name = utils::new_c_string("page")?;
13008
13009 let n_in: i32 = heifload_options.n;
13010 let n_in_name = utils::new_c_string("n")?;
13011
13012 let thumbnail_in: i32 = if heifload_options.thumbnail { 1 } else { 0 };
13013 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13014
13015 let unlimited_in: i32 = if heifload_options.unlimited { 1 } else { 0 };
13016 let unlimited_in_name = utils::new_c_string("unlimited")?;
13017
13018 let flags_in: i32 = heifload_options.flags as i32;
13019 let flags_in_name = utils::new_c_string("flags")?;
13020
13021 let memory_in: i32 = if heifload_options.memory { 1 } else { 0 };
13022 let memory_in_name = utils::new_c_string("memory")?;
13023
13024 let access_in: i32 = heifload_options.access as i32;
13025 let access_in_name = utils::new_c_string("access")?;
13026
13027 let fail_on_in: i32 = heifload_options.fail_on as i32;
13028 let fail_on_in_name = utils::new_c_string("fail-on")?;
13029
13030 let revalidate_in: i32 = if heifload_options.revalidate { 1 } else { 0 };
13031 let revalidate_in_name = utils::new_c_string("revalidate")?;
13032
13033 let vips_op_response = bindings::vips_heifload(
13034 filename_in.as_ptr(),
13035 &mut out_out,
13036 page_in_name.as_ptr(),
13037 page_in,
13038 n_in_name.as_ptr(),
13039 n_in,
13040 thumbnail_in_name.as_ptr(),
13041 thumbnail_in,
13042 unlimited_in_name.as_ptr(),
13043 unlimited_in,
13044 flags_in_name.as_ptr(),
13045 flags_in,
13046 memory_in_name.as_ptr(),
13047 memory_in,
13048 access_in_name.as_ptr(),
13049 access_in,
13050 fail_on_in_name.as_ptr(),
13051 fail_on_in,
13052 revalidate_in_name.as_ptr(),
13053 revalidate_in,
13054 NULL,
13055 );
13056 utils::result(
13057 vips_op_response,
13058 VipsImage { ctx: out_out },
13059 Error::HeifloadError,
13060 )
13061 }
13062}
13063
13064pub fn heifload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13068 unsafe {
13069 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13070 let mut out_out: *mut bindings::VipsImage = null_mut();
13071
13072 let vips_op_response =
13073 bindings::vips_heifload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13074 utils::result(
13075 vips_op_response,
13076 VipsImage { ctx: out_out },
13077 Error::HeifloadBufferError,
13078 )
13079 }
13080}
13081
13082#[derive(Clone, Debug)]
13084pub struct HeifloadBufferOptions {
13085 pub page: i32,
13088 pub n: i32,
13091 pub thumbnail: bool,
13094 pub unlimited: bool,
13097 pub flags: ForeignFlags,
13104 pub memory: bool,
13107 pub access: Access,
13113 pub fail_on: FailOn,
13120 pub revalidate: bool,
13123}
13124
13125impl std::default::Default for HeifloadBufferOptions {
13126 fn default() -> Self {
13127 HeifloadBufferOptions {
13128 page: i32::from(0),
13129 n: i32::from(1),
13130 thumbnail: false,
13131 unlimited: false,
13132 flags: ForeignFlags::None,
13133 memory: false,
13134 access: Access::Random,
13135 fail_on: FailOn::None,
13136 revalidate: false,
13137 }
13138 }
13139}
13140
13141pub fn heifload_buffer_with_opts(
13146 buffer: &[u8],
13147 heifload_buffer_options: &HeifloadBufferOptions,
13148) -> Result<VipsImage> {
13149 unsafe {
13150 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13151 let mut out_out: *mut bindings::VipsImage = null_mut();
13152
13153 let page_in: i32 = heifload_buffer_options.page;
13154 let page_in_name = utils::new_c_string("page")?;
13155
13156 let n_in: i32 = heifload_buffer_options.n;
13157 let n_in_name = utils::new_c_string("n")?;
13158
13159 let thumbnail_in: i32 = if heifload_buffer_options.thumbnail {
13160 1
13161 } else {
13162 0
13163 };
13164 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13165
13166 let unlimited_in: i32 = if heifload_buffer_options.unlimited {
13167 1
13168 } else {
13169 0
13170 };
13171 let unlimited_in_name = utils::new_c_string("unlimited")?;
13172
13173 let flags_in: i32 = heifload_buffer_options.flags as i32;
13174 let flags_in_name = utils::new_c_string("flags")?;
13175
13176 let memory_in: i32 = if heifload_buffer_options.memory { 1 } else { 0 };
13177 let memory_in_name = utils::new_c_string("memory")?;
13178
13179 let access_in: i32 = heifload_buffer_options.access as i32;
13180 let access_in_name = utils::new_c_string("access")?;
13181
13182 let fail_on_in: i32 = heifload_buffer_options.fail_on as i32;
13183 let fail_on_in_name = utils::new_c_string("fail-on")?;
13184
13185 let revalidate_in: i32 = if heifload_buffer_options.revalidate {
13186 1
13187 } else {
13188 0
13189 };
13190 let revalidate_in_name = utils::new_c_string("revalidate")?;
13191
13192 let vips_op_response = bindings::vips_heifload_buffer(
13193 buffer_in,
13194 buffer.len() as u64,
13195 &mut out_out,
13196 page_in_name.as_ptr(),
13197 page_in,
13198 n_in_name.as_ptr(),
13199 n_in,
13200 thumbnail_in_name.as_ptr(),
13201 thumbnail_in,
13202 unlimited_in_name.as_ptr(),
13203 unlimited_in,
13204 flags_in_name.as_ptr(),
13205 flags_in,
13206 memory_in_name.as_ptr(),
13207 memory_in,
13208 access_in_name.as_ptr(),
13209 access_in,
13210 fail_on_in_name.as_ptr(),
13211 fail_on_in,
13212 revalidate_in_name.as_ptr(),
13213 revalidate_in,
13214 NULL,
13215 );
13216 utils::result(
13217 vips_op_response,
13218 VipsImage { ctx: out_out },
13219 Error::HeifloadBufferError,
13220 )
13221 }
13222}
13223
13224pub fn heifload_source(source: &VipsSource) -> Result<VipsImage> {
13228 unsafe {
13229 let source_in: *mut bindings::VipsSource = source.ctx;
13230 let mut out_out: *mut bindings::VipsImage = null_mut();
13231
13232 let vips_op_response = bindings::vips_heifload_source(source_in, &mut out_out, NULL);
13233 utils::result(
13234 vips_op_response,
13235 VipsImage { ctx: out_out },
13236 Error::HeifloadSourceError,
13237 )
13238 }
13239}
13240
13241#[derive(Clone, Debug)]
13243pub struct HeifloadSourceOptions {
13244 pub page: i32,
13247 pub n: i32,
13250 pub thumbnail: bool,
13253 pub unlimited: bool,
13256 pub flags: ForeignFlags,
13263 pub memory: bool,
13266 pub access: Access,
13272 pub fail_on: FailOn,
13279 pub revalidate: bool,
13282}
13283
13284impl std::default::Default for HeifloadSourceOptions {
13285 fn default() -> Self {
13286 HeifloadSourceOptions {
13287 page: i32::from(0),
13288 n: i32::from(1),
13289 thumbnail: false,
13290 unlimited: false,
13291 flags: ForeignFlags::None,
13292 memory: false,
13293 access: Access::Random,
13294 fail_on: FailOn::None,
13295 revalidate: false,
13296 }
13297 }
13298}
13299
13300pub fn heifload_source_with_opts(
13305 source: &VipsSource,
13306 heifload_source_options: &HeifloadSourceOptions,
13307) -> Result<VipsImage> {
13308 unsafe {
13309 let source_in: *mut bindings::VipsSource = source.ctx;
13310 let mut out_out: *mut bindings::VipsImage = null_mut();
13311
13312 let page_in: i32 = heifload_source_options.page;
13313 let page_in_name = utils::new_c_string("page")?;
13314
13315 let n_in: i32 = heifload_source_options.n;
13316 let n_in_name = utils::new_c_string("n")?;
13317
13318 let thumbnail_in: i32 = if heifload_source_options.thumbnail {
13319 1
13320 } else {
13321 0
13322 };
13323 let thumbnail_in_name = utils::new_c_string("thumbnail")?;
13324
13325 let unlimited_in: i32 = if heifload_source_options.unlimited {
13326 1
13327 } else {
13328 0
13329 };
13330 let unlimited_in_name = utils::new_c_string("unlimited")?;
13331
13332 let flags_in: i32 = heifload_source_options.flags as i32;
13333 let flags_in_name = utils::new_c_string("flags")?;
13334
13335 let memory_in: i32 = if heifload_source_options.memory { 1 } else { 0 };
13336 let memory_in_name = utils::new_c_string("memory")?;
13337
13338 let access_in: i32 = heifload_source_options.access as i32;
13339 let access_in_name = utils::new_c_string("access")?;
13340
13341 let fail_on_in: i32 = heifload_source_options.fail_on as i32;
13342 let fail_on_in_name = utils::new_c_string("fail-on")?;
13343
13344 let revalidate_in: i32 = if heifload_source_options.revalidate {
13345 1
13346 } else {
13347 0
13348 };
13349 let revalidate_in_name = utils::new_c_string("revalidate")?;
13350
13351 let vips_op_response = bindings::vips_heifload_source(
13352 source_in,
13353 &mut out_out,
13354 page_in_name.as_ptr(),
13355 page_in,
13356 n_in_name.as_ptr(),
13357 n_in,
13358 thumbnail_in_name.as_ptr(),
13359 thumbnail_in,
13360 unlimited_in_name.as_ptr(),
13361 unlimited_in,
13362 flags_in_name.as_ptr(),
13363 flags_in,
13364 memory_in_name.as_ptr(),
13365 memory_in,
13366 access_in_name.as_ptr(),
13367 access_in,
13368 fail_on_in_name.as_ptr(),
13369 fail_on_in,
13370 revalidate_in_name.as_ptr(),
13371 revalidate_in,
13372 NULL,
13373 );
13374 utils::result(
13375 vips_op_response,
13376 VipsImage { ctx: out_out },
13377 Error::HeifloadSourceError,
13378 )
13379 }
13380}
13381
13382pub fn magickload(filename: &str) -> Result<VipsImage> {
13386 unsafe {
13387 let filename_in: CString = utils::new_c_string(filename)?;
13388 let mut out_out: *mut bindings::VipsImage = null_mut();
13389
13390 let vips_op_response = bindings::vips_magickload(filename_in.as_ptr(), &mut out_out, NULL);
13391 utils::result(
13392 vips_op_response,
13393 VipsImage { ctx: out_out },
13394 Error::MagickloadError,
13395 )
13396 }
13397}
13398
13399#[derive(Clone, Debug)]
13401pub struct MagickloadOptions {
13402 pub density: String,
13404 pub page: i32,
13407 pub n: i32,
13410 pub flags: ForeignFlags,
13417 pub memory: bool,
13420 pub access: Access,
13426 pub fail_on: FailOn,
13433 pub revalidate: bool,
13436}
13437
13438impl std::default::Default for MagickloadOptions {
13439 fn default() -> Self {
13440 MagickloadOptions {
13441 density: String::new(),
13442 page: i32::from(0),
13443 n: i32::from(1),
13444 flags: ForeignFlags::None,
13445 memory: false,
13446 access: Access::Random,
13447 fail_on: FailOn::None,
13448 revalidate: false,
13449 }
13450 }
13451}
13452
13453pub fn magickload_with_opts(
13458 filename: &str,
13459 magickload_options: &MagickloadOptions,
13460) -> Result<VipsImage> {
13461 unsafe {
13462 let filename_in: CString = utils::new_c_string(filename)?;
13463 let mut out_out: *mut bindings::VipsImage = null_mut();
13464
13465 let density_in: CString = utils::new_c_string(&magickload_options.density)?;
13466 let density_in_name = utils::new_c_string("density")?;
13467
13468 let page_in: i32 = magickload_options.page;
13469 let page_in_name = utils::new_c_string("page")?;
13470
13471 let n_in: i32 = magickload_options.n;
13472 let n_in_name = utils::new_c_string("n")?;
13473
13474 let flags_in: i32 = magickload_options.flags as i32;
13475 let flags_in_name = utils::new_c_string("flags")?;
13476
13477 let memory_in: i32 = if magickload_options.memory { 1 } else { 0 };
13478 let memory_in_name = utils::new_c_string("memory")?;
13479
13480 let access_in: i32 = magickload_options.access as i32;
13481 let access_in_name = utils::new_c_string("access")?;
13482
13483 let fail_on_in: i32 = magickload_options.fail_on as i32;
13484 let fail_on_in_name = utils::new_c_string("fail-on")?;
13485
13486 let revalidate_in: i32 = if magickload_options.revalidate { 1 } else { 0 };
13487 let revalidate_in_name = utils::new_c_string("revalidate")?;
13488
13489 let vips_op_response = bindings::vips_magickload(
13490 filename_in.as_ptr(),
13491 &mut out_out,
13492 density_in_name.as_ptr(),
13493 density_in.as_ptr(),
13494 page_in_name.as_ptr(),
13495 page_in,
13496 n_in_name.as_ptr(),
13497 n_in,
13498 flags_in_name.as_ptr(),
13499 flags_in,
13500 memory_in_name.as_ptr(),
13501 memory_in,
13502 access_in_name.as_ptr(),
13503 access_in,
13504 fail_on_in_name.as_ptr(),
13505 fail_on_in,
13506 revalidate_in_name.as_ptr(),
13507 revalidate_in,
13508 NULL,
13509 );
13510 utils::result(
13511 vips_op_response,
13512 VipsImage { ctx: out_out },
13513 Error::MagickloadError,
13514 )
13515 }
13516}
13517
13518pub fn magickload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13522 unsafe {
13523 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13524 let mut out_out: *mut bindings::VipsImage = null_mut();
13525
13526 let vips_op_response =
13527 bindings::vips_magickload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13528 utils::result(
13529 vips_op_response,
13530 VipsImage { ctx: out_out },
13531 Error::MagickloadBufferError,
13532 )
13533 }
13534}
13535
13536#[derive(Clone, Debug)]
13538pub struct MagickloadBufferOptions {
13539 pub density: String,
13541 pub page: i32,
13544 pub n: i32,
13547 pub flags: ForeignFlags,
13554 pub memory: bool,
13557 pub access: Access,
13563 pub fail_on: FailOn,
13570 pub revalidate: bool,
13573}
13574
13575impl std::default::Default for MagickloadBufferOptions {
13576 fn default() -> Self {
13577 MagickloadBufferOptions {
13578 density: String::new(),
13579 page: i32::from(0),
13580 n: i32::from(1),
13581 flags: ForeignFlags::None,
13582 memory: false,
13583 access: Access::Random,
13584 fail_on: FailOn::None,
13585 revalidate: false,
13586 }
13587 }
13588}
13589
13590pub fn magickload_buffer_with_opts(
13595 buffer: &[u8],
13596 magickload_buffer_options: &MagickloadBufferOptions,
13597) -> Result<VipsImage> {
13598 unsafe {
13599 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13600 let mut out_out: *mut bindings::VipsImage = null_mut();
13601
13602 let density_in: CString = utils::new_c_string(&magickload_buffer_options.density)?;
13603 let density_in_name = utils::new_c_string("density")?;
13604
13605 let page_in: i32 = magickload_buffer_options.page;
13606 let page_in_name = utils::new_c_string("page")?;
13607
13608 let n_in: i32 = magickload_buffer_options.n;
13609 let n_in_name = utils::new_c_string("n")?;
13610
13611 let flags_in: i32 = magickload_buffer_options.flags as i32;
13612 let flags_in_name = utils::new_c_string("flags")?;
13613
13614 let memory_in: i32 = if magickload_buffer_options.memory {
13615 1
13616 } else {
13617 0
13618 };
13619 let memory_in_name = utils::new_c_string("memory")?;
13620
13621 let access_in: i32 = magickload_buffer_options.access as i32;
13622 let access_in_name = utils::new_c_string("access")?;
13623
13624 let fail_on_in: i32 = magickload_buffer_options.fail_on as i32;
13625 let fail_on_in_name = utils::new_c_string("fail-on")?;
13626
13627 let revalidate_in: i32 = if magickload_buffer_options.revalidate {
13628 1
13629 } else {
13630 0
13631 };
13632 let revalidate_in_name = utils::new_c_string("revalidate")?;
13633
13634 let vips_op_response = bindings::vips_magickload_buffer(
13635 buffer_in,
13636 buffer.len() as u64,
13637 &mut out_out,
13638 density_in_name.as_ptr(),
13639 density_in.as_ptr(),
13640 page_in_name.as_ptr(),
13641 page_in,
13642 n_in_name.as_ptr(),
13643 n_in,
13644 flags_in_name.as_ptr(),
13645 flags_in,
13646 memory_in_name.as_ptr(),
13647 memory_in,
13648 access_in_name.as_ptr(),
13649 access_in,
13650 fail_on_in_name.as_ptr(),
13651 fail_on_in,
13652 revalidate_in_name.as_ptr(),
13653 revalidate_in,
13654 NULL,
13655 );
13656 utils::result(
13657 vips_op_response,
13658 VipsImage { ctx: out_out },
13659 Error::MagickloadBufferError,
13660 )
13661 }
13662}
13663
13664pub fn pdfload(filename: &str) -> Result<VipsImage> {
13668 unsafe {
13669 let filename_in: CString = utils::new_c_string(filename)?;
13670 let mut out_out: *mut bindings::VipsImage = null_mut();
13671
13672 let vips_op_response = bindings::vips_pdfload(filename_in.as_ptr(), &mut out_out, NULL);
13673 utils::result(
13674 vips_op_response,
13675 VipsImage { ctx: out_out },
13676 Error::PdfloadError,
13677 )
13678 }
13679}
13680
13681#[derive(Clone, Debug)]
13683pub struct PdfloadOptions {
13684 pub page: i32,
13687 pub n: i32,
13690 pub dpi: f64,
13693 pub scale: f64,
13696 pub background: Vec<f64>,
13698 pub password: String,
13700 pub flags: ForeignFlags,
13707 pub memory: bool,
13710 pub access: Access,
13716 pub fail_on: FailOn,
13723 pub revalidate: bool,
13726}
13727
13728impl std::default::Default for PdfloadOptions {
13729 fn default() -> Self {
13730 PdfloadOptions {
13731 page: i32::from(0),
13732 n: i32::from(1),
13733 dpi: f64::from(72),
13734 scale: f64::from(1),
13735 background: Vec::new(),
13736 password: String::new(),
13737 flags: ForeignFlags::None,
13738 memory: false,
13739 access: Access::Random,
13740 fail_on: FailOn::None,
13741 revalidate: false,
13742 }
13743 }
13744}
13745
13746pub fn pdfload_with_opts(filename: &str, pdfload_options: &PdfloadOptions) -> Result<VipsImage> {
13751 unsafe {
13752 let filename_in: CString = utils::new_c_string(filename)?;
13753 let mut out_out: *mut bindings::VipsImage = null_mut();
13754
13755 let page_in: i32 = pdfload_options.page;
13756 let page_in_name = utils::new_c_string("page")?;
13757
13758 let n_in: i32 = pdfload_options.n;
13759 let n_in_name = utils::new_c_string("n")?;
13760
13761 let dpi_in: f64 = pdfload_options.dpi;
13762 let dpi_in_name = utils::new_c_string("dpi")?;
13763
13764 let scale_in: f64 = pdfload_options.scale;
13765 let scale_in_name = utils::new_c_string("scale")?;
13766
13767 let background_wrapper =
13768 utils::VipsArrayDoubleWrapper::from(&pdfload_options.background[..]);
13769 let background_in = background_wrapper.ctx;
13770 let background_in_name = utils::new_c_string("background")?;
13771
13772 let password_in: CString = utils::new_c_string(&pdfload_options.password)?;
13773 let password_in_name = utils::new_c_string("password")?;
13774
13775 let flags_in: i32 = pdfload_options.flags as i32;
13776 let flags_in_name = utils::new_c_string("flags")?;
13777
13778 let memory_in: i32 = if pdfload_options.memory { 1 } else { 0 };
13779 let memory_in_name = utils::new_c_string("memory")?;
13780
13781 let access_in: i32 = pdfload_options.access as i32;
13782 let access_in_name = utils::new_c_string("access")?;
13783
13784 let fail_on_in: i32 = pdfload_options.fail_on as i32;
13785 let fail_on_in_name = utils::new_c_string("fail-on")?;
13786
13787 let revalidate_in: i32 = if pdfload_options.revalidate { 1 } else { 0 };
13788 let revalidate_in_name = utils::new_c_string("revalidate")?;
13789
13790 let vips_op_response = bindings::vips_pdfload(
13791 filename_in.as_ptr(),
13792 &mut out_out,
13793 page_in_name.as_ptr(),
13794 page_in,
13795 n_in_name.as_ptr(),
13796 n_in,
13797 dpi_in_name.as_ptr(),
13798 dpi_in,
13799 scale_in_name.as_ptr(),
13800 scale_in,
13801 background_in_name.as_ptr(),
13802 background_in,
13803 password_in_name.as_ptr(),
13804 password_in.as_ptr(),
13805 flags_in_name.as_ptr(),
13806 flags_in,
13807 memory_in_name.as_ptr(),
13808 memory_in,
13809 access_in_name.as_ptr(),
13810 access_in,
13811 fail_on_in_name.as_ptr(),
13812 fail_on_in,
13813 revalidate_in_name.as_ptr(),
13814 revalidate_in,
13815 NULL,
13816 );
13817 utils::result(
13818 vips_op_response,
13819 VipsImage { ctx: out_out },
13820 Error::PdfloadError,
13821 )
13822 }
13823}
13824
13825pub fn pdfload_buffer(buffer: &[u8]) -> Result<VipsImage> {
13829 unsafe {
13830 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13831 let mut out_out: *mut bindings::VipsImage = null_mut();
13832
13833 let vips_op_response =
13834 bindings::vips_pdfload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
13835 utils::result(
13836 vips_op_response,
13837 VipsImage { ctx: out_out },
13838 Error::PdfloadBufferError,
13839 )
13840 }
13841}
13842
13843#[derive(Clone, Debug)]
13845pub struct PdfloadBufferOptions {
13846 pub page: i32,
13849 pub n: i32,
13852 pub dpi: f64,
13855 pub scale: f64,
13858 pub background: Vec<f64>,
13860 pub password: String,
13862 pub flags: ForeignFlags,
13869 pub memory: bool,
13872 pub access: Access,
13878 pub fail_on: FailOn,
13885 pub revalidate: bool,
13888}
13889
13890impl std::default::Default for PdfloadBufferOptions {
13891 fn default() -> Self {
13892 PdfloadBufferOptions {
13893 page: i32::from(0),
13894 n: i32::from(1),
13895 dpi: f64::from(72),
13896 scale: f64::from(1),
13897 background: Vec::new(),
13898 password: String::new(),
13899 flags: ForeignFlags::None,
13900 memory: false,
13901 access: Access::Random,
13902 fail_on: FailOn::None,
13903 revalidate: false,
13904 }
13905 }
13906}
13907
13908pub fn pdfload_buffer_with_opts(
13913 buffer: &[u8],
13914 pdfload_buffer_options: &PdfloadBufferOptions,
13915) -> Result<VipsImage> {
13916 unsafe {
13917 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
13918 let mut out_out: *mut bindings::VipsImage = null_mut();
13919
13920 let page_in: i32 = pdfload_buffer_options.page;
13921 let page_in_name = utils::new_c_string("page")?;
13922
13923 let n_in: i32 = pdfload_buffer_options.n;
13924 let n_in_name = utils::new_c_string("n")?;
13925
13926 let dpi_in: f64 = pdfload_buffer_options.dpi;
13927 let dpi_in_name = utils::new_c_string("dpi")?;
13928
13929 let scale_in: f64 = pdfload_buffer_options.scale;
13930 let scale_in_name = utils::new_c_string("scale")?;
13931
13932 let background_wrapper =
13933 utils::VipsArrayDoubleWrapper::from(&pdfload_buffer_options.background[..]);
13934 let background_in = background_wrapper.ctx;
13935 let background_in_name = utils::new_c_string("background")?;
13936
13937 let password_in: CString = utils::new_c_string(&pdfload_buffer_options.password)?;
13938 let password_in_name = utils::new_c_string("password")?;
13939
13940 let flags_in: i32 = pdfload_buffer_options.flags as i32;
13941 let flags_in_name = utils::new_c_string("flags")?;
13942
13943 let memory_in: i32 = if pdfload_buffer_options.memory { 1 } else { 0 };
13944 let memory_in_name = utils::new_c_string("memory")?;
13945
13946 let access_in: i32 = pdfload_buffer_options.access as i32;
13947 let access_in_name = utils::new_c_string("access")?;
13948
13949 let fail_on_in: i32 = pdfload_buffer_options.fail_on as i32;
13950 let fail_on_in_name = utils::new_c_string("fail-on")?;
13951
13952 let revalidate_in: i32 = if pdfload_buffer_options.revalidate {
13953 1
13954 } else {
13955 0
13956 };
13957 let revalidate_in_name = utils::new_c_string("revalidate")?;
13958
13959 let vips_op_response = bindings::vips_pdfload_buffer(
13960 buffer_in,
13961 buffer.len() as u64,
13962 &mut out_out,
13963 page_in_name.as_ptr(),
13964 page_in,
13965 n_in_name.as_ptr(),
13966 n_in,
13967 dpi_in_name.as_ptr(),
13968 dpi_in,
13969 scale_in_name.as_ptr(),
13970 scale_in,
13971 background_in_name.as_ptr(),
13972 background_in,
13973 password_in_name.as_ptr(),
13974 password_in.as_ptr(),
13975 flags_in_name.as_ptr(),
13976 flags_in,
13977 memory_in_name.as_ptr(),
13978 memory_in,
13979 access_in_name.as_ptr(),
13980 access_in,
13981 fail_on_in_name.as_ptr(),
13982 fail_on_in,
13983 revalidate_in_name.as_ptr(),
13984 revalidate_in,
13985 NULL,
13986 );
13987 utils::result(
13988 vips_op_response,
13989 VipsImage { ctx: out_out },
13990 Error::PdfloadBufferError,
13991 )
13992 }
13993}
13994
13995pub fn pdfload_source(source: &VipsSource) -> Result<VipsImage> {
13999 unsafe {
14000 let source_in: *mut bindings::VipsSource = source.ctx;
14001 let mut out_out: *mut bindings::VipsImage = null_mut();
14002
14003 let vips_op_response = bindings::vips_pdfload_source(source_in, &mut out_out, NULL);
14004 utils::result(
14005 vips_op_response,
14006 VipsImage { ctx: out_out },
14007 Error::PdfloadSourceError,
14008 )
14009 }
14010}
14011
14012#[derive(Clone, Debug)]
14014pub struct PdfloadSourceOptions {
14015 pub page: i32,
14018 pub n: i32,
14021 pub dpi: f64,
14024 pub scale: f64,
14027 pub background: Vec<f64>,
14029 pub password: String,
14031 pub flags: ForeignFlags,
14038 pub memory: bool,
14041 pub access: Access,
14047 pub fail_on: FailOn,
14054 pub revalidate: bool,
14057}
14058
14059impl std::default::Default for PdfloadSourceOptions {
14060 fn default() -> Self {
14061 PdfloadSourceOptions {
14062 page: i32::from(0),
14063 n: i32::from(1),
14064 dpi: f64::from(72),
14065 scale: f64::from(1),
14066 background: Vec::new(),
14067 password: String::new(),
14068 flags: ForeignFlags::None,
14069 memory: false,
14070 access: Access::Random,
14071 fail_on: FailOn::None,
14072 revalidate: false,
14073 }
14074 }
14075}
14076
14077pub fn pdfload_source_with_opts(
14082 source: &VipsSource,
14083 pdfload_source_options: &PdfloadSourceOptions,
14084) -> Result<VipsImage> {
14085 unsafe {
14086 let source_in: *mut bindings::VipsSource = source.ctx;
14087 let mut out_out: *mut bindings::VipsImage = null_mut();
14088
14089 let page_in: i32 = pdfload_source_options.page;
14090 let page_in_name = utils::new_c_string("page")?;
14091
14092 let n_in: i32 = pdfload_source_options.n;
14093 let n_in_name = utils::new_c_string("n")?;
14094
14095 let dpi_in: f64 = pdfload_source_options.dpi;
14096 let dpi_in_name = utils::new_c_string("dpi")?;
14097
14098 let scale_in: f64 = pdfload_source_options.scale;
14099 let scale_in_name = utils::new_c_string("scale")?;
14100
14101 let background_wrapper =
14102 utils::VipsArrayDoubleWrapper::from(&pdfload_source_options.background[..]);
14103 let background_in = background_wrapper.ctx;
14104 let background_in_name = utils::new_c_string("background")?;
14105
14106 let password_in: CString = utils::new_c_string(&pdfload_source_options.password)?;
14107 let password_in_name = utils::new_c_string("password")?;
14108
14109 let flags_in: i32 = pdfload_source_options.flags as i32;
14110 let flags_in_name = utils::new_c_string("flags")?;
14111
14112 let memory_in: i32 = if pdfload_source_options.memory { 1 } else { 0 };
14113 let memory_in_name = utils::new_c_string("memory")?;
14114
14115 let access_in: i32 = pdfload_source_options.access as i32;
14116 let access_in_name = utils::new_c_string("access")?;
14117
14118 let fail_on_in: i32 = pdfload_source_options.fail_on as i32;
14119 let fail_on_in_name = utils::new_c_string("fail-on")?;
14120
14121 let revalidate_in: i32 = if pdfload_source_options.revalidate {
14122 1
14123 } else {
14124 0
14125 };
14126 let revalidate_in_name = utils::new_c_string("revalidate")?;
14127
14128 let vips_op_response = bindings::vips_pdfload_source(
14129 source_in,
14130 &mut out_out,
14131 page_in_name.as_ptr(),
14132 page_in,
14133 n_in_name.as_ptr(),
14134 n_in,
14135 dpi_in_name.as_ptr(),
14136 dpi_in,
14137 scale_in_name.as_ptr(),
14138 scale_in,
14139 background_in_name.as_ptr(),
14140 background_in,
14141 password_in_name.as_ptr(),
14142 password_in.as_ptr(),
14143 flags_in_name.as_ptr(),
14144 flags_in,
14145 memory_in_name.as_ptr(),
14146 memory_in,
14147 access_in_name.as_ptr(),
14148 access_in,
14149 fail_on_in_name.as_ptr(),
14150 fail_on_in,
14151 revalidate_in_name.as_ptr(),
14152 revalidate_in,
14153 NULL,
14154 );
14155 utils::result(
14156 vips_op_response,
14157 VipsImage { ctx: out_out },
14158 Error::PdfloadSourceError,
14159 )
14160 }
14161}
14162
14163pub fn openslideload(filename: &str) -> Result<VipsImage> {
14167 unsafe {
14168 let filename_in: CString = utils::new_c_string(filename)?;
14169 let mut out_out: *mut bindings::VipsImage = null_mut();
14170
14171 let vips_op_response =
14172 bindings::vips_openslideload(filename_in.as_ptr(), &mut out_out, NULL);
14173 utils::result(
14174 vips_op_response,
14175 VipsImage { ctx: out_out },
14176 Error::OpenslideloadError,
14177 )
14178 }
14179}
14180
14181#[derive(Clone, Debug)]
14183pub struct OpenslideloadOptions {
14184 pub level: i32,
14187 pub autocrop: bool,
14190 pub associated: String,
14192 pub attach_associated: bool,
14195 pub rgb: bool,
14198 pub flags: ForeignFlags,
14205 pub memory: bool,
14208 pub access: Access,
14214 pub fail_on: FailOn,
14221 pub revalidate: bool,
14224}
14225
14226impl std::default::Default for OpenslideloadOptions {
14227 fn default() -> Self {
14228 OpenslideloadOptions {
14229 level: i32::from(0),
14230 autocrop: false,
14231 associated: String::new(),
14232 attach_associated: false,
14233 rgb: false,
14234 flags: ForeignFlags::None,
14235 memory: false,
14236 access: Access::Random,
14237 fail_on: FailOn::None,
14238 revalidate: false,
14239 }
14240 }
14241}
14242
14243pub fn openslideload_with_opts(
14248 filename: &str,
14249 openslideload_options: &OpenslideloadOptions,
14250) -> Result<VipsImage> {
14251 unsafe {
14252 let filename_in: CString = utils::new_c_string(filename)?;
14253 let mut out_out: *mut bindings::VipsImage = null_mut();
14254
14255 let level_in: i32 = openslideload_options.level;
14256 let level_in_name = utils::new_c_string("level")?;
14257
14258 let autocrop_in: i32 = if openslideload_options.autocrop { 1 } else { 0 };
14259 let autocrop_in_name = utils::new_c_string("autocrop")?;
14260
14261 let associated_in: CString = utils::new_c_string(&openslideload_options.associated)?;
14262 let associated_in_name = utils::new_c_string("associated")?;
14263
14264 let attach_associated_in: i32 = if openslideload_options.attach_associated {
14265 1
14266 } else {
14267 0
14268 };
14269 let attach_associated_in_name = utils::new_c_string("attach-associated")?;
14270
14271 let rgb_in: i32 = if openslideload_options.rgb { 1 } else { 0 };
14272 let rgb_in_name = utils::new_c_string("rgb")?;
14273
14274 let flags_in: i32 = openslideload_options.flags as i32;
14275 let flags_in_name = utils::new_c_string("flags")?;
14276
14277 let memory_in: i32 = if openslideload_options.memory { 1 } else { 0 };
14278 let memory_in_name = utils::new_c_string("memory")?;
14279
14280 let access_in: i32 = openslideload_options.access as i32;
14281 let access_in_name = utils::new_c_string("access")?;
14282
14283 let fail_on_in: i32 = openslideload_options.fail_on as i32;
14284 let fail_on_in_name = utils::new_c_string("fail-on")?;
14285
14286 let revalidate_in: i32 = if openslideload_options.revalidate {
14287 1
14288 } else {
14289 0
14290 };
14291 let revalidate_in_name = utils::new_c_string("revalidate")?;
14292
14293 let vips_op_response = bindings::vips_openslideload(
14294 filename_in.as_ptr(),
14295 &mut out_out,
14296 level_in_name.as_ptr(),
14297 level_in,
14298 autocrop_in_name.as_ptr(),
14299 autocrop_in,
14300 associated_in_name.as_ptr(),
14301 associated_in.as_ptr(),
14302 attach_associated_in_name.as_ptr(),
14303 attach_associated_in,
14304 rgb_in_name.as_ptr(),
14305 rgb_in,
14306 flags_in_name.as_ptr(),
14307 flags_in,
14308 memory_in_name.as_ptr(),
14309 memory_in,
14310 access_in_name.as_ptr(),
14311 access_in,
14312 fail_on_in_name.as_ptr(),
14313 fail_on_in,
14314 revalidate_in_name.as_ptr(),
14315 revalidate_in,
14316 NULL,
14317 );
14318 utils::result(
14319 vips_op_response,
14320 VipsImage { ctx: out_out },
14321 Error::OpenslideloadError,
14322 )
14323 }
14324}
14325
14326pub fn openslideload_source(source: &VipsSource) -> Result<VipsImage> {
14330 unsafe {
14331 let source_in: *mut bindings::VipsSource = source.ctx;
14332 let mut out_out: *mut bindings::VipsImage = null_mut();
14333
14334 let vips_op_response = bindings::vips_openslideload_source(source_in, &mut out_out, NULL);
14335 utils::result(
14336 vips_op_response,
14337 VipsImage { ctx: out_out },
14338 Error::OpenslideloadSourceError,
14339 )
14340 }
14341}
14342
14343#[derive(Clone, Debug)]
14345pub struct OpenslideloadSourceOptions {
14346 pub level: i32,
14349 pub autocrop: bool,
14352 pub associated: String,
14354 pub attach_associated: bool,
14357 pub rgb: bool,
14360 pub flags: ForeignFlags,
14367 pub memory: bool,
14370 pub access: Access,
14376 pub fail_on: FailOn,
14383 pub revalidate: bool,
14386}
14387
14388impl std::default::Default for OpenslideloadSourceOptions {
14389 fn default() -> Self {
14390 OpenslideloadSourceOptions {
14391 level: i32::from(0),
14392 autocrop: false,
14393 associated: String::new(),
14394 attach_associated: false,
14395 rgb: false,
14396 flags: ForeignFlags::None,
14397 memory: false,
14398 access: Access::Random,
14399 fail_on: FailOn::None,
14400 revalidate: false,
14401 }
14402 }
14403}
14404
14405pub fn openslideload_source_with_opts(
14410 source: &VipsSource,
14411 openslideload_source_options: &OpenslideloadSourceOptions,
14412) -> Result<VipsImage> {
14413 unsafe {
14414 let source_in: *mut bindings::VipsSource = source.ctx;
14415 let mut out_out: *mut bindings::VipsImage = null_mut();
14416
14417 let level_in: i32 = openslideload_source_options.level;
14418 let level_in_name = utils::new_c_string("level")?;
14419
14420 let autocrop_in: i32 = if openslideload_source_options.autocrop {
14421 1
14422 } else {
14423 0
14424 };
14425 let autocrop_in_name = utils::new_c_string("autocrop")?;
14426
14427 let associated_in: CString = utils::new_c_string(&openslideload_source_options.associated)?;
14428 let associated_in_name = utils::new_c_string("associated")?;
14429
14430 let attach_associated_in: i32 = if openslideload_source_options.attach_associated {
14431 1
14432 } else {
14433 0
14434 };
14435 let attach_associated_in_name = utils::new_c_string("attach-associated")?;
14436
14437 let rgb_in: i32 = if openslideload_source_options.rgb {
14438 1
14439 } else {
14440 0
14441 };
14442 let rgb_in_name = utils::new_c_string("rgb")?;
14443
14444 let flags_in: i32 = openslideload_source_options.flags as i32;
14445 let flags_in_name = utils::new_c_string("flags")?;
14446
14447 let memory_in: i32 = if openslideload_source_options.memory {
14448 1
14449 } else {
14450 0
14451 };
14452 let memory_in_name = utils::new_c_string("memory")?;
14453
14454 let access_in: i32 = openslideload_source_options.access as i32;
14455 let access_in_name = utils::new_c_string("access")?;
14456
14457 let fail_on_in: i32 = openslideload_source_options.fail_on as i32;
14458 let fail_on_in_name = utils::new_c_string("fail-on")?;
14459
14460 let revalidate_in: i32 = if openslideload_source_options.revalidate {
14461 1
14462 } else {
14463 0
14464 };
14465 let revalidate_in_name = utils::new_c_string("revalidate")?;
14466
14467 let vips_op_response = bindings::vips_openslideload_source(
14468 source_in,
14469 &mut out_out,
14470 level_in_name.as_ptr(),
14471 level_in,
14472 autocrop_in_name.as_ptr(),
14473 autocrop_in,
14474 associated_in_name.as_ptr(),
14475 associated_in.as_ptr(),
14476 attach_associated_in_name.as_ptr(),
14477 attach_associated_in,
14478 rgb_in_name.as_ptr(),
14479 rgb_in,
14480 flags_in_name.as_ptr(),
14481 flags_in,
14482 memory_in_name.as_ptr(),
14483 memory_in,
14484 access_in_name.as_ptr(),
14485 access_in,
14486 fail_on_in_name.as_ptr(),
14487 fail_on_in,
14488 revalidate_in_name.as_ptr(),
14489 revalidate_in,
14490 NULL,
14491 );
14492 utils::result(
14493 vips_op_response,
14494 VipsImage { ctx: out_out },
14495 Error::OpenslideloadSourceError,
14496 )
14497 }
14498}
14499
14500pub fn jxlload(filename: &str) -> Result<VipsImage> {
14504 unsafe {
14505 let filename_in: CString = utils::new_c_string(filename)?;
14506 let mut out_out: *mut bindings::VipsImage = null_mut();
14507
14508 let vips_op_response = bindings::vips_jxlload(filename_in.as_ptr(), &mut out_out, NULL);
14509 utils::result(
14510 vips_op_response,
14511 VipsImage { ctx: out_out },
14512 Error::JxlloadError,
14513 )
14514 }
14515}
14516
14517#[derive(Clone, Debug)]
14519pub struct JxlloadOptions {
14520 pub flags: ForeignFlags,
14527 pub memory: bool,
14530 pub access: Access,
14536 pub fail_on: FailOn,
14543 pub revalidate: bool,
14546}
14547
14548impl std::default::Default for JxlloadOptions {
14549 fn default() -> Self {
14550 JxlloadOptions {
14551 flags: ForeignFlags::None,
14552 memory: false,
14553 access: Access::Random,
14554 fail_on: FailOn::None,
14555 revalidate: false,
14556 }
14557 }
14558}
14559
14560pub fn jxlload_with_opts(filename: &str, jxlload_options: &JxlloadOptions) -> Result<VipsImage> {
14565 unsafe {
14566 let filename_in: CString = utils::new_c_string(filename)?;
14567 let mut out_out: *mut bindings::VipsImage = null_mut();
14568
14569 let flags_in: i32 = jxlload_options.flags as i32;
14570 let flags_in_name = utils::new_c_string("flags")?;
14571
14572 let memory_in: i32 = if jxlload_options.memory { 1 } else { 0 };
14573 let memory_in_name = utils::new_c_string("memory")?;
14574
14575 let access_in: i32 = jxlload_options.access as i32;
14576 let access_in_name = utils::new_c_string("access")?;
14577
14578 let fail_on_in: i32 = jxlload_options.fail_on as i32;
14579 let fail_on_in_name = utils::new_c_string("fail-on")?;
14580
14581 let revalidate_in: i32 = if jxlload_options.revalidate { 1 } else { 0 };
14582 let revalidate_in_name = utils::new_c_string("revalidate")?;
14583
14584 let vips_op_response = bindings::vips_jxlload(
14585 filename_in.as_ptr(),
14586 &mut out_out,
14587 flags_in_name.as_ptr(),
14588 flags_in,
14589 memory_in_name.as_ptr(),
14590 memory_in,
14591 access_in_name.as_ptr(),
14592 access_in,
14593 fail_on_in_name.as_ptr(),
14594 fail_on_in,
14595 revalidate_in_name.as_ptr(),
14596 revalidate_in,
14597 NULL,
14598 );
14599 utils::result(
14600 vips_op_response,
14601 VipsImage { ctx: out_out },
14602 Error::JxlloadError,
14603 )
14604 }
14605}
14606
14607pub fn jxlload_buffer(buffer: &[u8]) -> Result<VipsImage> {
14611 unsafe {
14612 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
14613 let mut out_out: *mut bindings::VipsImage = null_mut();
14614
14615 let vips_op_response =
14616 bindings::vips_jxlload_buffer(buffer_in, buffer.len() as u64, &mut out_out, NULL);
14617 utils::result(
14618 vips_op_response,
14619 VipsImage { ctx: out_out },
14620 Error::JxlloadBufferError,
14621 )
14622 }
14623}
14624
14625#[derive(Clone, Debug)]
14627pub struct JxlloadBufferOptions {
14628 pub flags: ForeignFlags,
14635 pub memory: bool,
14638 pub access: Access,
14644 pub fail_on: FailOn,
14651 pub revalidate: bool,
14654}
14655
14656impl std::default::Default for JxlloadBufferOptions {
14657 fn default() -> Self {
14658 JxlloadBufferOptions {
14659 flags: ForeignFlags::None,
14660 memory: false,
14661 access: Access::Random,
14662 fail_on: FailOn::None,
14663 revalidate: false,
14664 }
14665 }
14666}
14667
14668pub fn jxlload_buffer_with_opts(
14673 buffer: &[u8],
14674 jxlload_buffer_options: &JxlloadBufferOptions,
14675) -> Result<VipsImage> {
14676 unsafe {
14677 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
14678 let mut out_out: *mut bindings::VipsImage = null_mut();
14679
14680 let flags_in: i32 = jxlload_buffer_options.flags as i32;
14681 let flags_in_name = utils::new_c_string("flags")?;
14682
14683 let memory_in: i32 = if jxlload_buffer_options.memory { 1 } else { 0 };
14684 let memory_in_name = utils::new_c_string("memory")?;
14685
14686 let access_in: i32 = jxlload_buffer_options.access as i32;
14687 let access_in_name = utils::new_c_string("access")?;
14688
14689 let fail_on_in: i32 = jxlload_buffer_options.fail_on as i32;
14690 let fail_on_in_name = utils::new_c_string("fail-on")?;
14691
14692 let revalidate_in: i32 = if jxlload_buffer_options.revalidate {
14693 1
14694 } else {
14695 0
14696 };
14697 let revalidate_in_name = utils::new_c_string("revalidate")?;
14698
14699 let vips_op_response = bindings::vips_jxlload_buffer(
14700 buffer_in,
14701 buffer.len() as u64,
14702 &mut out_out,
14703 flags_in_name.as_ptr(),
14704 flags_in,
14705 memory_in_name.as_ptr(),
14706 memory_in,
14707 access_in_name.as_ptr(),
14708 access_in,
14709 fail_on_in_name.as_ptr(),
14710 fail_on_in,
14711 revalidate_in_name.as_ptr(),
14712 revalidate_in,
14713 NULL,
14714 );
14715 utils::result(
14716 vips_op_response,
14717 VipsImage { ctx: out_out },
14718 Error::JxlloadBufferError,
14719 )
14720 }
14721}
14722
14723pub fn jxlload_source(source: &VipsSource) -> Result<VipsImage> {
14727 unsafe {
14728 let source_in: *mut bindings::VipsSource = source.ctx;
14729 let mut out_out: *mut bindings::VipsImage = null_mut();
14730
14731 let vips_op_response = bindings::vips_jxlload_source(source_in, &mut out_out, NULL);
14732 utils::result(
14733 vips_op_response,
14734 VipsImage { ctx: out_out },
14735 Error::JxlloadSourceError,
14736 )
14737 }
14738}
14739
14740#[derive(Clone, Debug)]
14742pub struct JxlloadSourceOptions {
14743 pub flags: ForeignFlags,
14750 pub memory: bool,
14753 pub access: Access,
14759 pub fail_on: FailOn,
14766 pub revalidate: bool,
14769}
14770
14771impl std::default::Default for JxlloadSourceOptions {
14772 fn default() -> Self {
14773 JxlloadSourceOptions {
14774 flags: ForeignFlags::None,
14775 memory: false,
14776 access: Access::Random,
14777 fail_on: FailOn::None,
14778 revalidate: false,
14779 }
14780 }
14781}
14782
14783pub fn jxlload_source_with_opts(
14788 source: &VipsSource,
14789 jxlload_source_options: &JxlloadSourceOptions,
14790) -> Result<VipsImage> {
14791 unsafe {
14792 let source_in: *mut bindings::VipsSource = source.ctx;
14793 let mut out_out: *mut bindings::VipsImage = null_mut();
14794
14795 let flags_in: i32 = jxlload_source_options.flags as i32;
14796 let flags_in_name = utils::new_c_string("flags")?;
14797
14798 let memory_in: i32 = if jxlload_source_options.memory { 1 } else { 0 };
14799 let memory_in_name = utils::new_c_string("memory")?;
14800
14801 let access_in: i32 = jxlload_source_options.access as i32;
14802 let access_in_name = utils::new_c_string("access")?;
14803
14804 let fail_on_in: i32 = jxlload_source_options.fail_on as i32;
14805 let fail_on_in_name = utils::new_c_string("fail-on")?;
14806
14807 let revalidate_in: i32 = if jxlload_source_options.revalidate {
14808 1
14809 } else {
14810 0
14811 };
14812 let revalidate_in_name = utils::new_c_string("revalidate")?;
14813
14814 let vips_op_response = bindings::vips_jxlload_source(
14815 source_in,
14816 &mut out_out,
14817 flags_in_name.as_ptr(),
14818 flags_in,
14819 memory_in_name.as_ptr(),
14820 memory_in,
14821 access_in_name.as_ptr(),
14822 access_in,
14823 fail_on_in_name.as_ptr(),
14824 fail_on_in,
14825 revalidate_in_name.as_ptr(),
14826 revalidate_in,
14827 NULL,
14828 );
14829 utils::result(
14830 vips_op_response,
14831 VipsImage { ctx: out_out },
14832 Error::JxlloadSourceError,
14833 )
14834 }
14835}
14836
14837pub fn csvsave(inp: &VipsImage, filename: &str) -> Result<()> {
14842 unsafe {
14843 let inp_in: *mut bindings::VipsImage = inp.ctx;
14844 let filename_in: CString = utils::new_c_string(filename)?;
14845
14846 let vips_op_response = bindings::vips_csvsave(inp_in, filename_in.as_ptr(), NULL);
14847 utils::result(vips_op_response, (), Error::CsvsaveError)
14848 }
14849}
14850
14851#[derive(Clone, Debug)]
14853pub struct CsvsaveOptions {
14854 pub separator: String,
14856 pub keep: ForeignKeep,
14865 pub background: Vec<f64>,
14867 pub page_height: i32,
14870 pub profile: String,
14872}
14873
14874impl std::default::Default for CsvsaveOptions {
14875 fn default() -> Self {
14876 CsvsaveOptions {
14877 separator: String::new(),
14878 keep: ForeignKeep::All,
14879 background: Vec::new(),
14880 page_height: i32::from(0),
14881 profile: String::from("sRGB"),
14882 }
14883 }
14884}
14885
14886pub fn csvsave_with_opts(
14892 inp: &VipsImage,
14893 filename: &str,
14894 csvsave_options: &CsvsaveOptions,
14895) -> Result<()> {
14896 unsafe {
14897 let inp_in: *mut bindings::VipsImage = inp.ctx;
14898 let filename_in: CString = utils::new_c_string(filename)?;
14899
14900 let separator_in: CString = utils::new_c_string(&csvsave_options.separator)?;
14901 let separator_in_name = utils::new_c_string("separator")?;
14902
14903 let keep_in: i32 = csvsave_options.keep as i32;
14904 let keep_in_name = utils::new_c_string("keep")?;
14905
14906 let background_wrapper =
14907 utils::VipsArrayDoubleWrapper::from(&csvsave_options.background[..]);
14908 let background_in = background_wrapper.ctx;
14909 let background_in_name = utils::new_c_string("background")?;
14910
14911 let page_height_in: i32 = csvsave_options.page_height;
14912 let page_height_in_name = utils::new_c_string("page-height")?;
14913
14914 let profile_in: CString = utils::new_c_string(&csvsave_options.profile)?;
14915 let profile_in_name = utils::new_c_string("profile")?;
14916
14917 let vips_op_response = bindings::vips_csvsave(
14918 inp_in,
14919 filename_in.as_ptr(),
14920 separator_in_name.as_ptr(),
14921 separator_in.as_ptr(),
14922 keep_in_name.as_ptr(),
14923 keep_in,
14924 background_in_name.as_ptr(),
14925 background_in,
14926 page_height_in_name.as_ptr(),
14927 page_height_in,
14928 profile_in_name.as_ptr(),
14929 profile_in.as_ptr(),
14930 NULL,
14931 );
14932 utils::result(vips_op_response, (), Error::CsvsaveError)
14933 }
14934}
14935
14936pub fn csvsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
14941 unsafe {
14942 let inp_in: *mut bindings::VipsImage = inp.ctx;
14943 let target_in: *mut bindings::VipsTarget = target.ctx;
14944
14945 let vips_op_response = bindings::vips_csvsave_target(inp_in, target_in, NULL);
14946 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
14947 }
14948}
14949
14950#[derive(Clone, Debug)]
14952pub struct CsvsaveTargetOptions {
14953 pub separator: String,
14955 pub keep: ForeignKeep,
14964 pub background: Vec<f64>,
14966 pub page_height: i32,
14969 pub profile: String,
14971}
14972
14973impl std::default::Default for CsvsaveTargetOptions {
14974 fn default() -> Self {
14975 CsvsaveTargetOptions {
14976 separator: String::new(),
14977 keep: ForeignKeep::All,
14978 background: Vec::new(),
14979 page_height: i32::from(0),
14980 profile: String::from("sRGB"),
14981 }
14982 }
14983}
14984
14985pub fn csvsave_target_with_opts(
14991 inp: &VipsImage,
14992 target: &VipsTarget,
14993 csvsave_target_options: &CsvsaveTargetOptions,
14994) -> Result<()> {
14995 unsafe {
14996 let inp_in: *mut bindings::VipsImage = inp.ctx;
14997 let target_in: *mut bindings::VipsTarget = target.ctx;
14998
14999 let separator_in: CString = utils::new_c_string(&csvsave_target_options.separator)?;
15000 let separator_in_name = utils::new_c_string("separator")?;
15001
15002 let keep_in: i32 = csvsave_target_options.keep as i32;
15003 let keep_in_name = utils::new_c_string("keep")?;
15004
15005 let background_wrapper =
15006 utils::VipsArrayDoubleWrapper::from(&csvsave_target_options.background[..]);
15007 let background_in = background_wrapper.ctx;
15008 let background_in_name = utils::new_c_string("background")?;
15009
15010 let page_height_in: i32 = csvsave_target_options.page_height;
15011 let page_height_in_name = utils::new_c_string("page-height")?;
15012
15013 let profile_in: CString = utils::new_c_string(&csvsave_target_options.profile)?;
15014 let profile_in_name = utils::new_c_string("profile")?;
15015
15016 let vips_op_response = bindings::vips_csvsave_target(
15017 inp_in,
15018 target_in,
15019 separator_in_name.as_ptr(),
15020 separator_in.as_ptr(),
15021 keep_in_name.as_ptr(),
15022 keep_in,
15023 background_in_name.as_ptr(),
15024 background_in,
15025 page_height_in_name.as_ptr(),
15026 page_height_in,
15027 profile_in_name.as_ptr(),
15028 profile_in.as_ptr(),
15029 NULL,
15030 );
15031 utils::result(vips_op_response, (), Error::CsvsaveTargetError)
15032 }
15033}
15034
15035pub fn matrixsave(inp: &VipsImage, filename: &str) -> Result<()> {
15040 unsafe {
15041 let inp_in: *mut bindings::VipsImage = inp.ctx;
15042 let filename_in: CString = utils::new_c_string(filename)?;
15043
15044 let vips_op_response = bindings::vips_matrixsave(inp_in, filename_in.as_ptr(), NULL);
15045 utils::result(vips_op_response, (), Error::MatrixsaveError)
15046 }
15047}
15048
15049#[derive(Clone, Debug)]
15051pub struct MatrixsaveOptions {
15052 pub keep: ForeignKeep,
15061 pub background: Vec<f64>,
15063 pub page_height: i32,
15066 pub profile: String,
15068}
15069
15070impl std::default::Default for MatrixsaveOptions {
15071 fn default() -> Self {
15072 MatrixsaveOptions {
15073 keep: ForeignKeep::All,
15074 background: Vec::new(),
15075 page_height: i32::from(0),
15076 profile: String::from("sRGB"),
15077 }
15078 }
15079}
15080
15081pub fn matrixsave_with_opts(
15087 inp: &VipsImage,
15088 filename: &str,
15089 matrixsave_options: &MatrixsaveOptions,
15090) -> Result<()> {
15091 unsafe {
15092 let inp_in: *mut bindings::VipsImage = inp.ctx;
15093 let filename_in: CString = utils::new_c_string(filename)?;
15094
15095 let keep_in: i32 = matrixsave_options.keep as i32;
15096 let keep_in_name = utils::new_c_string("keep")?;
15097
15098 let background_wrapper =
15099 utils::VipsArrayDoubleWrapper::from(&matrixsave_options.background[..]);
15100 let background_in = background_wrapper.ctx;
15101 let background_in_name = utils::new_c_string("background")?;
15102
15103 let page_height_in: i32 = matrixsave_options.page_height;
15104 let page_height_in_name = utils::new_c_string("page-height")?;
15105
15106 let profile_in: CString = utils::new_c_string(&matrixsave_options.profile)?;
15107 let profile_in_name = utils::new_c_string("profile")?;
15108
15109 let vips_op_response = bindings::vips_matrixsave(
15110 inp_in,
15111 filename_in.as_ptr(),
15112 keep_in_name.as_ptr(),
15113 keep_in,
15114 background_in_name.as_ptr(),
15115 background_in,
15116 page_height_in_name.as_ptr(),
15117 page_height_in,
15118 profile_in_name.as_ptr(),
15119 profile_in.as_ptr(),
15120 NULL,
15121 );
15122 utils::result(vips_op_response, (), Error::MatrixsaveError)
15123 }
15124}
15125
15126pub fn matrixsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15131 unsafe {
15132 let inp_in: *mut bindings::VipsImage = inp.ctx;
15133 let target_in: *mut bindings::VipsTarget = target.ctx;
15134
15135 let vips_op_response = bindings::vips_matrixsave_target(inp_in, target_in, NULL);
15136 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
15137 }
15138}
15139
15140#[derive(Clone, Debug)]
15142pub struct MatrixsaveTargetOptions {
15143 pub keep: ForeignKeep,
15152 pub background: Vec<f64>,
15154 pub page_height: i32,
15157 pub profile: String,
15159}
15160
15161impl std::default::Default for MatrixsaveTargetOptions {
15162 fn default() -> Self {
15163 MatrixsaveTargetOptions {
15164 keep: ForeignKeep::All,
15165 background: Vec::new(),
15166 page_height: i32::from(0),
15167 profile: String::from("sRGB"),
15168 }
15169 }
15170}
15171
15172pub fn matrixsave_target_with_opts(
15178 inp: &VipsImage,
15179 target: &VipsTarget,
15180 matrixsave_target_options: &MatrixsaveTargetOptions,
15181) -> Result<()> {
15182 unsafe {
15183 let inp_in: *mut bindings::VipsImage = inp.ctx;
15184 let target_in: *mut bindings::VipsTarget = target.ctx;
15185
15186 let keep_in: i32 = matrixsave_target_options.keep as i32;
15187 let keep_in_name = utils::new_c_string("keep")?;
15188
15189 let background_wrapper =
15190 utils::VipsArrayDoubleWrapper::from(&matrixsave_target_options.background[..]);
15191 let background_in = background_wrapper.ctx;
15192 let background_in_name = utils::new_c_string("background")?;
15193
15194 let page_height_in: i32 = matrixsave_target_options.page_height;
15195 let page_height_in_name = utils::new_c_string("page-height")?;
15196
15197 let profile_in: CString = utils::new_c_string(&matrixsave_target_options.profile)?;
15198 let profile_in_name = utils::new_c_string("profile")?;
15199
15200 let vips_op_response = bindings::vips_matrixsave_target(
15201 inp_in,
15202 target_in,
15203 keep_in_name.as_ptr(),
15204 keep_in,
15205 background_in_name.as_ptr(),
15206 background_in,
15207 page_height_in_name.as_ptr(),
15208 page_height_in,
15209 profile_in_name.as_ptr(),
15210 profile_in.as_ptr(),
15211 NULL,
15212 );
15213 utils::result(vips_op_response, (), Error::MatrixsaveTargetError)
15214 }
15215}
15216
15217pub fn matrixprint(inp: &VipsImage) -> Result<()> {
15221 unsafe {
15222 let inp_in: *mut bindings::VipsImage = inp.ctx;
15223
15224 let vips_op_response = bindings::vips_matrixprint(inp_in, NULL);
15225 utils::result(vips_op_response, (), Error::MatrixprintError)
15226 }
15227}
15228
15229#[derive(Clone, Debug)]
15231pub struct MatrixprintOptions {
15232 pub keep: ForeignKeep,
15241 pub background: Vec<f64>,
15243 pub page_height: i32,
15246 pub profile: String,
15248}
15249
15250impl std::default::Default for MatrixprintOptions {
15251 fn default() -> Self {
15252 MatrixprintOptions {
15253 keep: ForeignKeep::All,
15254 background: Vec::new(),
15255 page_height: i32::from(0),
15256 profile: String::from("sRGB"),
15257 }
15258 }
15259}
15260
15261pub fn matrixprint_with_opts(
15266 inp: &VipsImage,
15267 matrixprint_options: &MatrixprintOptions,
15268) -> Result<()> {
15269 unsafe {
15270 let inp_in: *mut bindings::VipsImage = inp.ctx;
15271
15272 let keep_in: i32 = matrixprint_options.keep as i32;
15273 let keep_in_name = utils::new_c_string("keep")?;
15274
15275 let background_wrapper =
15276 utils::VipsArrayDoubleWrapper::from(&matrixprint_options.background[..]);
15277 let background_in = background_wrapper.ctx;
15278 let background_in_name = utils::new_c_string("background")?;
15279
15280 let page_height_in: i32 = matrixprint_options.page_height;
15281 let page_height_in_name = utils::new_c_string("page-height")?;
15282
15283 let profile_in: CString = utils::new_c_string(&matrixprint_options.profile)?;
15284 let profile_in_name = utils::new_c_string("profile")?;
15285
15286 let vips_op_response = bindings::vips_matrixprint(
15287 inp_in,
15288 keep_in_name.as_ptr(),
15289 keep_in,
15290 background_in_name.as_ptr(),
15291 background_in,
15292 page_height_in_name.as_ptr(),
15293 page_height_in,
15294 profile_in_name.as_ptr(),
15295 profile_in.as_ptr(),
15296 NULL,
15297 );
15298 utils::result(vips_op_response, (), Error::MatrixprintError)
15299 }
15300}
15301
15302pub fn rawsave(inp: &VipsImage, filename: &str) -> Result<()> {
15307 unsafe {
15308 let inp_in: *mut bindings::VipsImage = inp.ctx;
15309 let filename_in: CString = utils::new_c_string(filename)?;
15310
15311 let vips_op_response = bindings::vips_rawsave(inp_in, filename_in.as_ptr(), NULL);
15312 utils::result(vips_op_response, (), Error::RawsaveError)
15313 }
15314}
15315
15316#[derive(Clone, Debug)]
15318pub struct RawsaveOptions {
15319 pub keep: ForeignKeep,
15328 pub background: Vec<f64>,
15330 pub page_height: i32,
15333 pub profile: String,
15335}
15336
15337impl std::default::Default for RawsaveOptions {
15338 fn default() -> Self {
15339 RawsaveOptions {
15340 keep: ForeignKeep::All,
15341 background: Vec::new(),
15342 page_height: i32::from(0),
15343 profile: String::from("sRGB"),
15344 }
15345 }
15346}
15347
15348pub fn rawsave_with_opts(
15354 inp: &VipsImage,
15355 filename: &str,
15356 rawsave_options: &RawsaveOptions,
15357) -> Result<()> {
15358 unsafe {
15359 let inp_in: *mut bindings::VipsImage = inp.ctx;
15360 let filename_in: CString = utils::new_c_string(filename)?;
15361
15362 let keep_in: i32 = rawsave_options.keep as i32;
15363 let keep_in_name = utils::new_c_string("keep")?;
15364
15365 let background_wrapper =
15366 utils::VipsArrayDoubleWrapper::from(&rawsave_options.background[..]);
15367 let background_in = background_wrapper.ctx;
15368 let background_in_name = utils::new_c_string("background")?;
15369
15370 let page_height_in: i32 = rawsave_options.page_height;
15371 let page_height_in_name = utils::new_c_string("page-height")?;
15372
15373 let profile_in: CString = utils::new_c_string(&rawsave_options.profile)?;
15374 let profile_in_name = utils::new_c_string("profile")?;
15375
15376 let vips_op_response = bindings::vips_rawsave(
15377 inp_in,
15378 filename_in.as_ptr(),
15379 keep_in_name.as_ptr(),
15380 keep_in,
15381 background_in_name.as_ptr(),
15382 background_in,
15383 page_height_in_name.as_ptr(),
15384 page_height_in,
15385 profile_in_name.as_ptr(),
15386 profile_in.as_ptr(),
15387 NULL,
15388 );
15389 utils::result(vips_op_response, (), Error::RawsaveError)
15390 }
15391}
15392
15393pub fn rawsave_fd(inp: &VipsImage, fd: i32) -> Result<()> {
15399 unsafe {
15400 let inp_in: *mut bindings::VipsImage = inp.ctx;
15401 let fd_in: i32 = fd;
15402
15403 let vips_op_response = bindings::vips_rawsave_fd(inp_in, fd_in, NULL);
15404 utils::result(vips_op_response, (), Error::RawsaveFdError)
15405 }
15406}
15407
15408#[derive(Clone, Debug)]
15410pub struct RawsaveFdOptions {
15411 pub keep: ForeignKeep,
15420 pub background: Vec<f64>,
15422 pub page_height: i32,
15425 pub profile: String,
15427}
15428
15429impl std::default::Default for RawsaveFdOptions {
15430 fn default() -> Self {
15431 RawsaveFdOptions {
15432 keep: ForeignKeep::All,
15433 background: Vec::new(),
15434 page_height: i32::from(0),
15435 profile: String::from("sRGB"),
15436 }
15437 }
15438}
15439
15440pub fn rawsave_fd_with_opts(
15447 inp: &VipsImage,
15448 fd: i32,
15449 rawsave_fd_options: &RawsaveFdOptions,
15450) -> Result<()> {
15451 unsafe {
15452 let inp_in: *mut bindings::VipsImage = inp.ctx;
15453 let fd_in: i32 = fd;
15454
15455 let keep_in: i32 = rawsave_fd_options.keep as i32;
15456 let keep_in_name = utils::new_c_string("keep")?;
15457
15458 let background_wrapper =
15459 utils::VipsArrayDoubleWrapper::from(&rawsave_fd_options.background[..]);
15460 let background_in = background_wrapper.ctx;
15461 let background_in_name = utils::new_c_string("background")?;
15462
15463 let page_height_in: i32 = rawsave_fd_options.page_height;
15464 let page_height_in_name = utils::new_c_string("page-height")?;
15465
15466 let profile_in: CString = utils::new_c_string(&rawsave_fd_options.profile)?;
15467 let profile_in_name = utils::new_c_string("profile")?;
15468
15469 let vips_op_response = bindings::vips_rawsave_fd(
15470 inp_in,
15471 fd_in,
15472 keep_in_name.as_ptr(),
15473 keep_in,
15474 background_in_name.as_ptr(),
15475 background_in,
15476 page_height_in_name.as_ptr(),
15477 page_height_in,
15478 profile_in_name.as_ptr(),
15479 profile_in.as_ptr(),
15480 NULL,
15481 );
15482 utils::result(vips_op_response, (), Error::RawsaveFdError)
15483 }
15484}
15485
15486pub fn vipssave(inp: &VipsImage, filename: &str) -> Result<()> {
15491 unsafe {
15492 let inp_in: *mut bindings::VipsImage = inp.ctx;
15493 let filename_in: CString = utils::new_c_string(filename)?;
15494
15495 let vips_op_response = bindings::vips_vipssave(inp_in, filename_in.as_ptr(), NULL);
15496 utils::result(vips_op_response, (), Error::VipssaveError)
15497 }
15498}
15499
15500#[derive(Clone, Debug)]
15502pub struct VipssaveOptions {
15503 pub keep: ForeignKeep,
15512 pub background: Vec<f64>,
15514 pub page_height: i32,
15517 pub profile: String,
15519}
15520
15521impl std::default::Default for VipssaveOptions {
15522 fn default() -> Self {
15523 VipssaveOptions {
15524 keep: ForeignKeep::All,
15525 background: Vec::new(),
15526 page_height: i32::from(0),
15527 profile: String::from("sRGB"),
15528 }
15529 }
15530}
15531
15532pub fn vipssave_with_opts(
15538 inp: &VipsImage,
15539 filename: &str,
15540 vipssave_options: &VipssaveOptions,
15541) -> Result<()> {
15542 unsafe {
15543 let inp_in: *mut bindings::VipsImage = inp.ctx;
15544 let filename_in: CString = utils::new_c_string(filename)?;
15545
15546 let keep_in: i32 = vipssave_options.keep as i32;
15547 let keep_in_name = utils::new_c_string("keep")?;
15548
15549 let background_wrapper =
15550 utils::VipsArrayDoubleWrapper::from(&vipssave_options.background[..]);
15551 let background_in = background_wrapper.ctx;
15552 let background_in_name = utils::new_c_string("background")?;
15553
15554 let page_height_in: i32 = vipssave_options.page_height;
15555 let page_height_in_name = utils::new_c_string("page-height")?;
15556
15557 let profile_in: CString = utils::new_c_string(&vipssave_options.profile)?;
15558 let profile_in_name = utils::new_c_string("profile")?;
15559
15560 let vips_op_response = bindings::vips_vipssave(
15561 inp_in,
15562 filename_in.as_ptr(),
15563 keep_in_name.as_ptr(),
15564 keep_in,
15565 background_in_name.as_ptr(),
15566 background_in,
15567 page_height_in_name.as_ptr(),
15568 page_height_in,
15569 profile_in_name.as_ptr(),
15570 profile_in.as_ptr(),
15571 NULL,
15572 );
15573 utils::result(vips_op_response, (), Error::VipssaveError)
15574 }
15575}
15576
15577pub fn vipssave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15582 unsafe {
15583 let inp_in: *mut bindings::VipsImage = inp.ctx;
15584 let target_in: *mut bindings::VipsTarget = target.ctx;
15585
15586 let vips_op_response = bindings::vips_vipssave_target(inp_in, target_in, NULL);
15587 utils::result(vips_op_response, (), Error::VipssaveTargetError)
15588 }
15589}
15590
15591#[derive(Clone, Debug)]
15593pub struct VipssaveTargetOptions {
15594 pub keep: ForeignKeep,
15603 pub background: Vec<f64>,
15605 pub page_height: i32,
15608 pub profile: String,
15610}
15611
15612impl std::default::Default for VipssaveTargetOptions {
15613 fn default() -> Self {
15614 VipssaveTargetOptions {
15615 keep: ForeignKeep::All,
15616 background: Vec::new(),
15617 page_height: i32::from(0),
15618 profile: String::from("sRGB"),
15619 }
15620 }
15621}
15622
15623pub fn vipssave_target_with_opts(
15629 inp: &VipsImage,
15630 target: &VipsTarget,
15631 vipssave_target_options: &VipssaveTargetOptions,
15632) -> Result<()> {
15633 unsafe {
15634 let inp_in: *mut bindings::VipsImage = inp.ctx;
15635 let target_in: *mut bindings::VipsTarget = target.ctx;
15636
15637 let keep_in: i32 = vipssave_target_options.keep as i32;
15638 let keep_in_name = utils::new_c_string("keep")?;
15639
15640 let background_wrapper =
15641 utils::VipsArrayDoubleWrapper::from(&vipssave_target_options.background[..]);
15642 let background_in = background_wrapper.ctx;
15643 let background_in_name = utils::new_c_string("background")?;
15644
15645 let page_height_in: i32 = vipssave_target_options.page_height;
15646 let page_height_in_name = utils::new_c_string("page-height")?;
15647
15648 let profile_in: CString = utils::new_c_string(&vipssave_target_options.profile)?;
15649 let profile_in_name = utils::new_c_string("profile")?;
15650
15651 let vips_op_response = bindings::vips_vipssave_target(
15652 inp_in,
15653 target_in,
15654 keep_in_name.as_ptr(),
15655 keep_in,
15656 background_in_name.as_ptr(),
15657 background_in,
15658 page_height_in_name.as_ptr(),
15659 page_height_in,
15660 profile_in_name.as_ptr(),
15661 profile_in.as_ptr(),
15662 NULL,
15663 );
15664 utils::result(vips_op_response, (), Error::VipssaveTargetError)
15665 }
15666}
15667
15668pub fn ppmsave(inp: &VipsImage, filename: &str) -> Result<()> {
15673 unsafe {
15674 let inp_in: *mut bindings::VipsImage = inp.ctx;
15675 let filename_in: CString = utils::new_c_string(filename)?;
15676
15677 let vips_op_response = bindings::vips_ppmsave(inp_in, filename_in.as_ptr(), NULL);
15678 utils::result(vips_op_response, (), Error::PpmsaveError)
15679 }
15680}
15681
15682#[derive(Clone, Debug)]
15684pub struct PpmsaveOptions {
15685 pub format: ForeignPpmFormat,
15693 pub ascii: bool,
15696 pub bitdepth: i32,
15699 pub keep: ForeignKeep,
15708 pub background: Vec<f64>,
15710 pub page_height: i32,
15713 pub profile: String,
15715}
15716
15717impl std::default::Default for PpmsaveOptions {
15718 fn default() -> Self {
15719 PpmsaveOptions {
15720 format: ForeignPpmFormat::Ppm,
15721 ascii: false,
15722 bitdepth: i32::from(0),
15723 keep: ForeignKeep::All,
15724 background: Vec::new(),
15725 page_height: i32::from(0),
15726 profile: String::from("sRGB"),
15727 }
15728 }
15729}
15730
15731pub fn ppmsave_with_opts(
15737 inp: &VipsImage,
15738 filename: &str,
15739 ppmsave_options: &PpmsaveOptions,
15740) -> Result<()> {
15741 unsafe {
15742 let inp_in: *mut bindings::VipsImage = inp.ctx;
15743 let filename_in: CString = utils::new_c_string(filename)?;
15744
15745 let format_in: i32 = ppmsave_options.format as i32;
15746 let format_in_name = utils::new_c_string("format")?;
15747
15748 let ascii_in: i32 = if ppmsave_options.ascii { 1 } else { 0 };
15749 let ascii_in_name = utils::new_c_string("ascii")?;
15750
15751 let bitdepth_in: i32 = ppmsave_options.bitdepth;
15752 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15753
15754 let keep_in: i32 = ppmsave_options.keep as i32;
15755 let keep_in_name = utils::new_c_string("keep")?;
15756
15757 let background_wrapper =
15758 utils::VipsArrayDoubleWrapper::from(&ppmsave_options.background[..]);
15759 let background_in = background_wrapper.ctx;
15760 let background_in_name = utils::new_c_string("background")?;
15761
15762 let page_height_in: i32 = ppmsave_options.page_height;
15763 let page_height_in_name = utils::new_c_string("page-height")?;
15764
15765 let profile_in: CString = utils::new_c_string(&ppmsave_options.profile)?;
15766 let profile_in_name = utils::new_c_string("profile")?;
15767
15768 let vips_op_response = bindings::vips_ppmsave(
15769 inp_in,
15770 filename_in.as_ptr(),
15771 format_in_name.as_ptr(),
15772 format_in,
15773 ascii_in_name.as_ptr(),
15774 ascii_in,
15775 bitdepth_in_name.as_ptr(),
15776 bitdepth_in,
15777 keep_in_name.as_ptr(),
15778 keep_in,
15779 background_in_name.as_ptr(),
15780 background_in,
15781 page_height_in_name.as_ptr(),
15782 page_height_in,
15783 profile_in_name.as_ptr(),
15784 profile_in.as_ptr(),
15785 NULL,
15786 );
15787 utils::result(vips_op_response, (), Error::PpmsaveError)
15788 }
15789}
15790
15791pub fn ppmsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
15796 unsafe {
15797 let inp_in: *mut bindings::VipsImage = inp.ctx;
15798 let target_in: *mut bindings::VipsTarget = target.ctx;
15799
15800 let vips_op_response = bindings::vips_ppmsave_target(inp_in, target_in, NULL);
15801 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
15802 }
15803}
15804
15805#[derive(Clone, Debug)]
15807pub struct PpmsaveTargetOptions {
15808 pub format: ForeignPpmFormat,
15816 pub ascii: bool,
15819 pub bitdepth: i32,
15822 pub keep: ForeignKeep,
15831 pub background: Vec<f64>,
15833 pub page_height: i32,
15836 pub profile: String,
15838}
15839
15840impl std::default::Default for PpmsaveTargetOptions {
15841 fn default() -> Self {
15842 PpmsaveTargetOptions {
15843 format: ForeignPpmFormat::Ppm,
15844 ascii: false,
15845 bitdepth: i32::from(0),
15846 keep: ForeignKeep::All,
15847 background: Vec::new(),
15848 page_height: i32::from(0),
15849 profile: String::from("sRGB"),
15850 }
15851 }
15852}
15853
15854pub fn ppmsave_target_with_opts(
15860 inp: &VipsImage,
15861 target: &VipsTarget,
15862 ppmsave_target_options: &PpmsaveTargetOptions,
15863) -> Result<()> {
15864 unsafe {
15865 let inp_in: *mut bindings::VipsImage = inp.ctx;
15866 let target_in: *mut bindings::VipsTarget = target.ctx;
15867
15868 let format_in: i32 = ppmsave_target_options.format as i32;
15869 let format_in_name = utils::new_c_string("format")?;
15870
15871 let ascii_in: i32 = if ppmsave_target_options.ascii { 1 } else { 0 };
15872 let ascii_in_name = utils::new_c_string("ascii")?;
15873
15874 let bitdepth_in: i32 = ppmsave_target_options.bitdepth;
15875 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
15876
15877 let keep_in: i32 = ppmsave_target_options.keep as i32;
15878 let keep_in_name = utils::new_c_string("keep")?;
15879
15880 let background_wrapper =
15881 utils::VipsArrayDoubleWrapper::from(&ppmsave_target_options.background[..]);
15882 let background_in = background_wrapper.ctx;
15883 let background_in_name = utils::new_c_string("background")?;
15884
15885 let page_height_in: i32 = ppmsave_target_options.page_height;
15886 let page_height_in_name = utils::new_c_string("page-height")?;
15887
15888 let profile_in: CString = utils::new_c_string(&ppmsave_target_options.profile)?;
15889 let profile_in_name = utils::new_c_string("profile")?;
15890
15891 let vips_op_response = bindings::vips_ppmsave_target(
15892 inp_in,
15893 target_in,
15894 format_in_name.as_ptr(),
15895 format_in,
15896 ascii_in_name.as_ptr(),
15897 ascii_in,
15898 bitdepth_in_name.as_ptr(),
15899 bitdepth_in,
15900 keep_in_name.as_ptr(),
15901 keep_in,
15902 background_in_name.as_ptr(),
15903 background_in,
15904 page_height_in_name.as_ptr(),
15905 page_height_in,
15906 profile_in_name.as_ptr(),
15907 profile_in.as_ptr(),
15908 NULL,
15909 );
15910 utils::result(vips_op_response, (), Error::PpmsaveTargetError)
15911 }
15912}
15913
15914pub fn radsave(inp: &VipsImage, filename: &str) -> Result<()> {
15919 unsafe {
15920 let inp_in: *mut bindings::VipsImage = inp.ctx;
15921 let filename_in: CString = utils::new_c_string(filename)?;
15922
15923 let vips_op_response = bindings::vips_radsave(inp_in, filename_in.as_ptr(), NULL);
15924 utils::result(vips_op_response, (), Error::RadsaveError)
15925 }
15926}
15927
15928#[derive(Clone, Debug)]
15930pub struct RadsaveOptions {
15931 pub keep: ForeignKeep,
15940 pub background: Vec<f64>,
15942 pub page_height: i32,
15945 pub profile: String,
15947}
15948
15949impl std::default::Default for RadsaveOptions {
15950 fn default() -> Self {
15951 RadsaveOptions {
15952 keep: ForeignKeep::All,
15953 background: Vec::new(),
15954 page_height: i32::from(0),
15955 profile: String::from("sRGB"),
15956 }
15957 }
15958}
15959
15960pub fn radsave_with_opts(
15966 inp: &VipsImage,
15967 filename: &str,
15968 radsave_options: &RadsaveOptions,
15969) -> Result<()> {
15970 unsafe {
15971 let inp_in: *mut bindings::VipsImage = inp.ctx;
15972 let filename_in: CString = utils::new_c_string(filename)?;
15973
15974 let keep_in: i32 = radsave_options.keep as i32;
15975 let keep_in_name = utils::new_c_string("keep")?;
15976
15977 let background_wrapper =
15978 utils::VipsArrayDoubleWrapper::from(&radsave_options.background[..]);
15979 let background_in = background_wrapper.ctx;
15980 let background_in_name = utils::new_c_string("background")?;
15981
15982 let page_height_in: i32 = radsave_options.page_height;
15983 let page_height_in_name = utils::new_c_string("page-height")?;
15984
15985 let profile_in: CString = utils::new_c_string(&radsave_options.profile)?;
15986 let profile_in_name = utils::new_c_string("profile")?;
15987
15988 let vips_op_response = bindings::vips_radsave(
15989 inp_in,
15990 filename_in.as_ptr(),
15991 keep_in_name.as_ptr(),
15992 keep_in,
15993 background_in_name.as_ptr(),
15994 background_in,
15995 page_height_in_name.as_ptr(),
15996 page_height_in,
15997 profile_in_name.as_ptr(),
15998 profile_in.as_ptr(),
15999 NULL,
16000 );
16001 utils::result(vips_op_response, (), Error::RadsaveError)
16002 }
16003}
16004
16005pub fn radsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16009 unsafe {
16010 let inp_in: *mut bindings::VipsImage = inp.ctx;
16011 let mut buffer_buf_size: u64 = 0;
16012 let mut buffer_out: *mut c_void = null_mut();
16013
16014 let vips_op_response =
16015 bindings::vips_radsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16016 utils::result(
16017 vips_op_response,
16018 utils::new_byte_array(buffer_out, buffer_buf_size),
16019 Error::RadsaveBufferError,
16020 )
16021 }
16022}
16023
16024#[derive(Clone, Debug)]
16026pub struct RadsaveBufferOptions {
16027 pub keep: ForeignKeep,
16036 pub background: Vec<f64>,
16038 pub page_height: i32,
16041 pub profile: String,
16043}
16044
16045impl std::default::Default for RadsaveBufferOptions {
16046 fn default() -> Self {
16047 RadsaveBufferOptions {
16048 keep: ForeignKeep::All,
16049 background: Vec::new(),
16050 page_height: i32::from(0),
16051 profile: String::from("sRGB"),
16052 }
16053 }
16054}
16055
16056pub fn radsave_buffer_with_opts(
16061 inp: &VipsImage,
16062 radsave_buffer_options: &RadsaveBufferOptions,
16063) -> Result<Vec<u8>> {
16064 unsafe {
16065 let inp_in: *mut bindings::VipsImage = inp.ctx;
16066 let mut buffer_buf_size: u64 = 0;
16067 let mut buffer_out: *mut c_void = null_mut();
16068
16069 let keep_in: i32 = radsave_buffer_options.keep as i32;
16070 let keep_in_name = utils::new_c_string("keep")?;
16071
16072 let background_wrapper =
16073 utils::VipsArrayDoubleWrapper::from(&radsave_buffer_options.background[..]);
16074 let background_in = background_wrapper.ctx;
16075 let background_in_name = utils::new_c_string("background")?;
16076
16077 let page_height_in: i32 = radsave_buffer_options.page_height;
16078 let page_height_in_name = utils::new_c_string("page-height")?;
16079
16080 let profile_in: CString = utils::new_c_string(&radsave_buffer_options.profile)?;
16081 let profile_in_name = utils::new_c_string("profile")?;
16082
16083 let vips_op_response = bindings::vips_radsave_buffer(
16084 inp_in,
16085 &mut buffer_out,
16086 &mut buffer_buf_size,
16087 keep_in_name.as_ptr(),
16088 keep_in,
16089 background_in_name.as_ptr(),
16090 background_in,
16091 page_height_in_name.as_ptr(),
16092 page_height_in,
16093 profile_in_name.as_ptr(),
16094 profile_in.as_ptr(),
16095 NULL,
16096 );
16097 utils::result(
16098 vips_op_response,
16099 utils::new_byte_array(buffer_out, buffer_buf_size),
16100 Error::RadsaveBufferError,
16101 )
16102 }
16103}
16104
16105pub fn radsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16110 unsafe {
16111 let inp_in: *mut bindings::VipsImage = inp.ctx;
16112 let target_in: *mut bindings::VipsTarget = target.ctx;
16113
16114 let vips_op_response = bindings::vips_radsave_target(inp_in, target_in, NULL);
16115 utils::result(vips_op_response, (), Error::RadsaveTargetError)
16116 }
16117}
16118
16119#[derive(Clone, Debug)]
16121pub struct RadsaveTargetOptions {
16122 pub keep: ForeignKeep,
16131 pub background: Vec<f64>,
16133 pub page_height: i32,
16136 pub profile: String,
16138}
16139
16140impl std::default::Default for RadsaveTargetOptions {
16141 fn default() -> Self {
16142 RadsaveTargetOptions {
16143 keep: ForeignKeep::All,
16144 background: Vec::new(),
16145 page_height: i32::from(0),
16146 profile: String::from("sRGB"),
16147 }
16148 }
16149}
16150
16151pub fn radsave_target_with_opts(
16157 inp: &VipsImage,
16158 target: &VipsTarget,
16159 radsave_target_options: &RadsaveTargetOptions,
16160) -> Result<()> {
16161 unsafe {
16162 let inp_in: *mut bindings::VipsImage = inp.ctx;
16163 let target_in: *mut bindings::VipsTarget = target.ctx;
16164
16165 let keep_in: i32 = radsave_target_options.keep as i32;
16166 let keep_in_name = utils::new_c_string("keep")?;
16167
16168 let background_wrapper =
16169 utils::VipsArrayDoubleWrapper::from(&radsave_target_options.background[..]);
16170 let background_in = background_wrapper.ctx;
16171 let background_in_name = utils::new_c_string("background")?;
16172
16173 let page_height_in: i32 = radsave_target_options.page_height;
16174 let page_height_in_name = utils::new_c_string("page-height")?;
16175
16176 let profile_in: CString = utils::new_c_string(&radsave_target_options.profile)?;
16177 let profile_in_name = utils::new_c_string("profile")?;
16178
16179 let vips_op_response = bindings::vips_radsave_target(
16180 inp_in,
16181 target_in,
16182 keep_in_name.as_ptr(),
16183 keep_in,
16184 background_in_name.as_ptr(),
16185 background_in,
16186 page_height_in_name.as_ptr(),
16187 page_height_in,
16188 profile_in_name.as_ptr(),
16189 profile_in.as_ptr(),
16190 NULL,
16191 );
16192 utils::result(vips_op_response, (), Error::RadsaveTargetError)
16193 }
16194}
16195
16196pub fn jp_2ksave(inp: &VipsImage, filename: &str) -> Result<()> {
16201 unsafe {
16202 let inp_in: *mut bindings::VipsImage = inp.ctx;
16203 let filename_in: CString = utils::new_c_string(filename)?;
16204
16205 let vips_op_response = bindings::vips_jp2ksave(inp_in, filename_in.as_ptr(), NULL);
16206 utils::result(vips_op_response, (), Error::Jp2KsaveError)
16207 }
16208}
16209
16210#[derive(Clone, Debug)]
16212pub struct Jp2KsaveOptions {
16213 pub tile_width: i32,
16216 pub tile_height: i32,
16219 pub lossless: bool,
16222 pub q: i32,
16225 pub subsample_mode: ForeignSubsample,
16231 pub keep: ForeignKeep,
16240 pub background: Vec<f64>,
16242 pub page_height: i32,
16245 pub profile: String,
16247}
16248
16249impl std::default::Default for Jp2KsaveOptions {
16250 fn default() -> Self {
16251 Jp2KsaveOptions {
16252 tile_width: i32::from(512),
16253 tile_height: i32::from(512),
16254 lossless: false,
16255 q: i32::from(48),
16256 subsample_mode: ForeignSubsample::Off,
16257 keep: ForeignKeep::All,
16258 background: Vec::new(),
16259 page_height: i32::from(0),
16260 profile: String::from("sRGB"),
16261 }
16262 }
16263}
16264
16265pub fn jp_2ksave_with_opts(
16271 inp: &VipsImage,
16272 filename: &str,
16273 jp_2ksave_options: &Jp2KsaveOptions,
16274) -> Result<()> {
16275 unsafe {
16276 let inp_in: *mut bindings::VipsImage = inp.ctx;
16277 let filename_in: CString = utils::new_c_string(filename)?;
16278
16279 let tile_width_in: i32 = jp_2ksave_options.tile_width;
16280 let tile_width_in_name = utils::new_c_string("tile-width")?;
16281
16282 let tile_height_in: i32 = jp_2ksave_options.tile_height;
16283 let tile_height_in_name = utils::new_c_string("tile-height")?;
16284
16285 let lossless_in: i32 = if jp_2ksave_options.lossless { 1 } else { 0 };
16286 let lossless_in_name = utils::new_c_string("lossless")?;
16287
16288 let q_in: i32 = jp_2ksave_options.q;
16289 let q_in_name = utils::new_c_string("Q")?;
16290
16291 let subsample_mode_in: i32 = jp_2ksave_options.subsample_mode as i32;
16292 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16293
16294 let keep_in: i32 = jp_2ksave_options.keep as i32;
16295 let keep_in_name = utils::new_c_string("keep")?;
16296
16297 let background_wrapper =
16298 utils::VipsArrayDoubleWrapper::from(&jp_2ksave_options.background[..]);
16299 let background_in = background_wrapper.ctx;
16300 let background_in_name = utils::new_c_string("background")?;
16301
16302 let page_height_in: i32 = jp_2ksave_options.page_height;
16303 let page_height_in_name = utils::new_c_string("page-height")?;
16304
16305 let profile_in: CString = utils::new_c_string(&jp_2ksave_options.profile)?;
16306 let profile_in_name = utils::new_c_string("profile")?;
16307
16308 let vips_op_response = bindings::vips_jp2ksave(
16309 inp_in,
16310 filename_in.as_ptr(),
16311 tile_width_in_name.as_ptr(),
16312 tile_width_in,
16313 tile_height_in_name.as_ptr(),
16314 tile_height_in,
16315 lossless_in_name.as_ptr(),
16316 lossless_in,
16317 q_in_name.as_ptr(),
16318 q_in,
16319 subsample_mode_in_name.as_ptr(),
16320 subsample_mode_in,
16321 keep_in_name.as_ptr(),
16322 keep_in,
16323 background_in_name.as_ptr(),
16324 background_in,
16325 page_height_in_name.as_ptr(),
16326 page_height_in,
16327 profile_in_name.as_ptr(),
16328 profile_in.as_ptr(),
16329 NULL,
16330 );
16331 utils::result(vips_op_response, (), Error::Jp2KsaveError)
16332 }
16333}
16334
16335pub fn jp_2ksave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16339 unsafe {
16340 let inp_in: *mut bindings::VipsImage = inp.ctx;
16341 let mut buffer_buf_size: u64 = 0;
16342 let mut buffer_out: *mut c_void = null_mut();
16343
16344 let vips_op_response =
16345 bindings::vips_jp2ksave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16346 utils::result(
16347 vips_op_response,
16348 utils::new_byte_array(buffer_out, buffer_buf_size),
16349 Error::Jp2KsaveBufferError,
16350 )
16351 }
16352}
16353
16354#[derive(Clone, Debug)]
16356pub struct Jp2KsaveBufferOptions {
16357 pub tile_width: i32,
16360 pub tile_height: i32,
16363 pub lossless: bool,
16366 pub q: i32,
16369 pub subsample_mode: ForeignSubsample,
16375 pub keep: ForeignKeep,
16384 pub background: Vec<f64>,
16386 pub page_height: i32,
16389 pub profile: String,
16391}
16392
16393impl std::default::Default for Jp2KsaveBufferOptions {
16394 fn default() -> Self {
16395 Jp2KsaveBufferOptions {
16396 tile_width: i32::from(512),
16397 tile_height: i32::from(512),
16398 lossless: false,
16399 q: i32::from(48),
16400 subsample_mode: ForeignSubsample::Off,
16401 keep: ForeignKeep::All,
16402 background: Vec::new(),
16403 page_height: i32::from(0),
16404 profile: String::from("sRGB"),
16405 }
16406 }
16407}
16408
16409pub fn jp_2ksave_buffer_with_opts(
16414 inp: &VipsImage,
16415 jp_2ksave_buffer_options: &Jp2KsaveBufferOptions,
16416) -> Result<Vec<u8>> {
16417 unsafe {
16418 let inp_in: *mut bindings::VipsImage = inp.ctx;
16419 let mut buffer_buf_size: u64 = 0;
16420 let mut buffer_out: *mut c_void = null_mut();
16421
16422 let tile_width_in: i32 = jp_2ksave_buffer_options.tile_width;
16423 let tile_width_in_name = utils::new_c_string("tile-width")?;
16424
16425 let tile_height_in: i32 = jp_2ksave_buffer_options.tile_height;
16426 let tile_height_in_name = utils::new_c_string("tile-height")?;
16427
16428 let lossless_in: i32 = if jp_2ksave_buffer_options.lossless {
16429 1
16430 } else {
16431 0
16432 };
16433 let lossless_in_name = utils::new_c_string("lossless")?;
16434
16435 let q_in: i32 = jp_2ksave_buffer_options.q;
16436 let q_in_name = utils::new_c_string("Q")?;
16437
16438 let subsample_mode_in: i32 = jp_2ksave_buffer_options.subsample_mode as i32;
16439 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16440
16441 let keep_in: i32 = jp_2ksave_buffer_options.keep as i32;
16442 let keep_in_name = utils::new_c_string("keep")?;
16443
16444 let background_wrapper =
16445 utils::VipsArrayDoubleWrapper::from(&jp_2ksave_buffer_options.background[..]);
16446 let background_in = background_wrapper.ctx;
16447 let background_in_name = utils::new_c_string("background")?;
16448
16449 let page_height_in: i32 = jp_2ksave_buffer_options.page_height;
16450 let page_height_in_name = utils::new_c_string("page-height")?;
16451
16452 let profile_in: CString = utils::new_c_string(&jp_2ksave_buffer_options.profile)?;
16453 let profile_in_name = utils::new_c_string("profile")?;
16454
16455 let vips_op_response = bindings::vips_jp2ksave_buffer(
16456 inp_in,
16457 &mut buffer_out,
16458 &mut buffer_buf_size,
16459 tile_width_in_name.as_ptr(),
16460 tile_width_in,
16461 tile_height_in_name.as_ptr(),
16462 tile_height_in,
16463 lossless_in_name.as_ptr(),
16464 lossless_in,
16465 q_in_name.as_ptr(),
16466 q_in,
16467 subsample_mode_in_name.as_ptr(),
16468 subsample_mode_in,
16469 keep_in_name.as_ptr(),
16470 keep_in,
16471 background_in_name.as_ptr(),
16472 background_in,
16473 page_height_in_name.as_ptr(),
16474 page_height_in,
16475 profile_in_name.as_ptr(),
16476 profile_in.as_ptr(),
16477 NULL,
16478 );
16479 utils::result(
16480 vips_op_response,
16481 utils::new_byte_array(buffer_out, buffer_buf_size),
16482 Error::Jp2KsaveBufferError,
16483 )
16484 }
16485}
16486
16487pub fn jp_2ksave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16492 unsafe {
16493 let inp_in: *mut bindings::VipsImage = inp.ctx;
16494 let target_in: *mut bindings::VipsTarget = target.ctx;
16495
16496 let vips_op_response = bindings::vips_jp2ksave_target(inp_in, target_in, NULL);
16497 utils::result(vips_op_response, (), Error::Jp2KsaveTargetError)
16498 }
16499}
16500
16501#[derive(Clone, Debug)]
16503pub struct Jp2KsaveTargetOptions {
16504 pub tile_width: i32,
16507 pub tile_height: i32,
16510 pub lossless: bool,
16513 pub q: i32,
16516 pub subsample_mode: ForeignSubsample,
16522 pub keep: ForeignKeep,
16531 pub background: Vec<f64>,
16533 pub page_height: i32,
16536 pub profile: String,
16538}
16539
16540impl std::default::Default for Jp2KsaveTargetOptions {
16541 fn default() -> Self {
16542 Jp2KsaveTargetOptions {
16543 tile_width: i32::from(512),
16544 tile_height: i32::from(512),
16545 lossless: false,
16546 q: i32::from(48),
16547 subsample_mode: ForeignSubsample::Off,
16548 keep: ForeignKeep::All,
16549 background: Vec::new(),
16550 page_height: i32::from(0),
16551 profile: String::from("sRGB"),
16552 }
16553 }
16554}
16555
16556pub fn jp_2ksave_target_with_opts(
16562 inp: &VipsImage,
16563 target: &VipsTarget,
16564 jp_2ksave_target_options: &Jp2KsaveTargetOptions,
16565) -> Result<()> {
16566 unsafe {
16567 let inp_in: *mut bindings::VipsImage = inp.ctx;
16568 let target_in: *mut bindings::VipsTarget = target.ctx;
16569
16570 let tile_width_in: i32 = jp_2ksave_target_options.tile_width;
16571 let tile_width_in_name = utils::new_c_string("tile-width")?;
16572
16573 let tile_height_in: i32 = jp_2ksave_target_options.tile_height;
16574 let tile_height_in_name = utils::new_c_string("tile-height")?;
16575
16576 let lossless_in: i32 = if jp_2ksave_target_options.lossless {
16577 1
16578 } else {
16579 0
16580 };
16581 let lossless_in_name = utils::new_c_string("lossless")?;
16582
16583 let q_in: i32 = jp_2ksave_target_options.q;
16584 let q_in_name = utils::new_c_string("Q")?;
16585
16586 let subsample_mode_in: i32 = jp_2ksave_target_options.subsample_mode as i32;
16587 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
16588
16589 let keep_in: i32 = jp_2ksave_target_options.keep as i32;
16590 let keep_in_name = utils::new_c_string("keep")?;
16591
16592 let background_wrapper =
16593 utils::VipsArrayDoubleWrapper::from(&jp_2ksave_target_options.background[..]);
16594 let background_in = background_wrapper.ctx;
16595 let background_in_name = utils::new_c_string("background")?;
16596
16597 let page_height_in: i32 = jp_2ksave_target_options.page_height;
16598 let page_height_in_name = utils::new_c_string("page-height")?;
16599
16600 let profile_in: CString = utils::new_c_string(&jp_2ksave_target_options.profile)?;
16601 let profile_in_name = utils::new_c_string("profile")?;
16602
16603 let vips_op_response = bindings::vips_jp2ksave_target(
16604 inp_in,
16605 target_in,
16606 tile_width_in_name.as_ptr(),
16607 tile_width_in,
16608 tile_height_in_name.as_ptr(),
16609 tile_height_in,
16610 lossless_in_name.as_ptr(),
16611 lossless_in,
16612 q_in_name.as_ptr(),
16613 q_in,
16614 subsample_mode_in_name.as_ptr(),
16615 subsample_mode_in,
16616 keep_in_name.as_ptr(),
16617 keep_in,
16618 background_in_name.as_ptr(),
16619 background_in,
16620 page_height_in_name.as_ptr(),
16621 page_height_in,
16622 profile_in_name.as_ptr(),
16623 profile_in.as_ptr(),
16624 NULL,
16625 );
16626 utils::result(vips_op_response, (), Error::Jp2KsaveTargetError)
16627 }
16628}
16629
16630pub fn gifsave(inp: &VipsImage, filename: &str) -> Result<()> {
16635 unsafe {
16636 let inp_in: *mut bindings::VipsImage = inp.ctx;
16637 let filename_in: CString = utils::new_c_string(filename)?;
16638
16639 let vips_op_response = bindings::vips_gifsave(inp_in, filename_in.as_ptr(), NULL);
16640 utils::result(vips_op_response, (), Error::GifsaveError)
16641 }
16642}
16643
16644#[derive(Clone, Debug)]
16646pub struct GifsaveOptions {
16647 pub dither: f64,
16650 pub effort: i32,
16653 pub bitdepth: i32,
16656 pub interframe_maxerror: f64,
16659 pub reuse: bool,
16662 pub interpalette_maxerror: f64,
16665 pub interlace: bool,
16668 pub keep: ForeignKeep,
16677 pub background: Vec<f64>,
16679 pub page_height: i32,
16682 pub profile: String,
16684}
16685
16686impl std::default::Default for GifsaveOptions {
16687 fn default() -> Self {
16688 GifsaveOptions {
16689 dither: f64::from(1),
16690 effort: i32::from(7),
16691 bitdepth: i32::from(8),
16692 interframe_maxerror: f64::from(0),
16693 reuse: false,
16694 interpalette_maxerror: f64::from(3),
16695 interlace: false,
16696 keep: ForeignKeep::All,
16697 background: Vec::new(),
16698 page_height: i32::from(0),
16699 profile: String::from("sRGB"),
16700 }
16701 }
16702}
16703
16704pub fn gifsave_with_opts(
16710 inp: &VipsImage,
16711 filename: &str,
16712 gifsave_options: &GifsaveOptions,
16713) -> Result<()> {
16714 unsafe {
16715 let inp_in: *mut bindings::VipsImage = inp.ctx;
16716 let filename_in: CString = utils::new_c_string(filename)?;
16717
16718 let dither_in: f64 = gifsave_options.dither;
16719 let dither_in_name = utils::new_c_string("dither")?;
16720
16721 let effort_in: i32 = gifsave_options.effort;
16722 let effort_in_name = utils::new_c_string("effort")?;
16723
16724 let bitdepth_in: i32 = gifsave_options.bitdepth;
16725 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16726
16727 let interframe_maxerror_in: f64 = gifsave_options.interframe_maxerror;
16728 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
16729
16730 let reuse_in: i32 = if gifsave_options.reuse { 1 } else { 0 };
16731 let reuse_in_name = utils::new_c_string("reuse")?;
16732
16733 let interpalette_maxerror_in: f64 = gifsave_options.interpalette_maxerror;
16734 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
16735
16736 let interlace_in: i32 = if gifsave_options.interlace { 1 } else { 0 };
16737 let interlace_in_name = utils::new_c_string("interlace")?;
16738
16739 let keep_in: i32 = gifsave_options.keep as i32;
16740 let keep_in_name = utils::new_c_string("keep")?;
16741
16742 let background_wrapper =
16743 utils::VipsArrayDoubleWrapper::from(&gifsave_options.background[..]);
16744 let background_in = background_wrapper.ctx;
16745 let background_in_name = utils::new_c_string("background")?;
16746
16747 let page_height_in: i32 = gifsave_options.page_height;
16748 let page_height_in_name = utils::new_c_string("page-height")?;
16749
16750 let profile_in: CString = utils::new_c_string(&gifsave_options.profile)?;
16751 let profile_in_name = utils::new_c_string("profile")?;
16752
16753 let vips_op_response = bindings::vips_gifsave(
16754 inp_in,
16755 filename_in.as_ptr(),
16756 dither_in_name.as_ptr(),
16757 dither_in,
16758 effort_in_name.as_ptr(),
16759 effort_in,
16760 bitdepth_in_name.as_ptr(),
16761 bitdepth_in,
16762 interframe_maxerror_in_name.as_ptr(),
16763 interframe_maxerror_in,
16764 reuse_in_name.as_ptr(),
16765 reuse_in,
16766 interpalette_maxerror_in_name.as_ptr(),
16767 interpalette_maxerror_in,
16768 interlace_in_name.as_ptr(),
16769 interlace_in,
16770 keep_in_name.as_ptr(),
16771 keep_in,
16772 background_in_name.as_ptr(),
16773 background_in,
16774 page_height_in_name.as_ptr(),
16775 page_height_in,
16776 profile_in_name.as_ptr(),
16777 profile_in.as_ptr(),
16778 NULL,
16779 );
16780 utils::result(vips_op_response, (), Error::GifsaveError)
16781 }
16782}
16783
16784pub fn gifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
16788 unsafe {
16789 let inp_in: *mut bindings::VipsImage = inp.ctx;
16790 let mut buffer_buf_size: u64 = 0;
16791 let mut buffer_out: *mut c_void = null_mut();
16792
16793 let vips_op_response =
16794 bindings::vips_gifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
16795 utils::result(
16796 vips_op_response,
16797 utils::new_byte_array(buffer_out, buffer_buf_size),
16798 Error::GifsaveBufferError,
16799 )
16800 }
16801}
16802
16803#[derive(Clone, Debug)]
16805pub struct GifsaveBufferOptions {
16806 pub dither: f64,
16809 pub effort: i32,
16812 pub bitdepth: i32,
16815 pub interframe_maxerror: f64,
16818 pub reuse: bool,
16821 pub interpalette_maxerror: f64,
16824 pub interlace: bool,
16827 pub keep: ForeignKeep,
16836 pub background: Vec<f64>,
16838 pub page_height: i32,
16841 pub profile: String,
16843}
16844
16845impl std::default::Default for GifsaveBufferOptions {
16846 fn default() -> Self {
16847 GifsaveBufferOptions {
16848 dither: f64::from(1),
16849 effort: i32::from(7),
16850 bitdepth: i32::from(8),
16851 interframe_maxerror: f64::from(0),
16852 reuse: false,
16853 interpalette_maxerror: f64::from(3),
16854 interlace: false,
16855 keep: ForeignKeep::All,
16856 background: Vec::new(),
16857 page_height: i32::from(0),
16858 profile: String::from("sRGB"),
16859 }
16860 }
16861}
16862
16863pub fn gifsave_buffer_with_opts(
16868 inp: &VipsImage,
16869 gifsave_buffer_options: &GifsaveBufferOptions,
16870) -> Result<Vec<u8>> {
16871 unsafe {
16872 let inp_in: *mut bindings::VipsImage = inp.ctx;
16873 let mut buffer_buf_size: u64 = 0;
16874 let mut buffer_out: *mut c_void = null_mut();
16875
16876 let dither_in: f64 = gifsave_buffer_options.dither;
16877 let dither_in_name = utils::new_c_string("dither")?;
16878
16879 let effort_in: i32 = gifsave_buffer_options.effort;
16880 let effort_in_name = utils::new_c_string("effort")?;
16881
16882 let bitdepth_in: i32 = gifsave_buffer_options.bitdepth;
16883 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
16884
16885 let interframe_maxerror_in: f64 = gifsave_buffer_options.interframe_maxerror;
16886 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
16887
16888 let reuse_in: i32 = if gifsave_buffer_options.reuse { 1 } else { 0 };
16889 let reuse_in_name = utils::new_c_string("reuse")?;
16890
16891 let interpalette_maxerror_in: f64 = gifsave_buffer_options.interpalette_maxerror;
16892 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
16893
16894 let interlace_in: i32 = if gifsave_buffer_options.interlace {
16895 1
16896 } else {
16897 0
16898 };
16899 let interlace_in_name = utils::new_c_string("interlace")?;
16900
16901 let keep_in: i32 = gifsave_buffer_options.keep as i32;
16902 let keep_in_name = utils::new_c_string("keep")?;
16903
16904 let background_wrapper =
16905 utils::VipsArrayDoubleWrapper::from(&gifsave_buffer_options.background[..]);
16906 let background_in = background_wrapper.ctx;
16907 let background_in_name = utils::new_c_string("background")?;
16908
16909 let page_height_in: i32 = gifsave_buffer_options.page_height;
16910 let page_height_in_name = utils::new_c_string("page-height")?;
16911
16912 let profile_in: CString = utils::new_c_string(&gifsave_buffer_options.profile)?;
16913 let profile_in_name = utils::new_c_string("profile")?;
16914
16915 let vips_op_response = bindings::vips_gifsave_buffer(
16916 inp_in,
16917 &mut buffer_out,
16918 &mut buffer_buf_size,
16919 dither_in_name.as_ptr(),
16920 dither_in,
16921 effort_in_name.as_ptr(),
16922 effort_in,
16923 bitdepth_in_name.as_ptr(),
16924 bitdepth_in,
16925 interframe_maxerror_in_name.as_ptr(),
16926 interframe_maxerror_in,
16927 reuse_in_name.as_ptr(),
16928 reuse_in,
16929 interpalette_maxerror_in_name.as_ptr(),
16930 interpalette_maxerror_in,
16931 interlace_in_name.as_ptr(),
16932 interlace_in,
16933 keep_in_name.as_ptr(),
16934 keep_in,
16935 background_in_name.as_ptr(),
16936 background_in,
16937 page_height_in_name.as_ptr(),
16938 page_height_in,
16939 profile_in_name.as_ptr(),
16940 profile_in.as_ptr(),
16941 NULL,
16942 );
16943 utils::result(
16944 vips_op_response,
16945 utils::new_byte_array(buffer_out, buffer_buf_size),
16946 Error::GifsaveBufferError,
16947 )
16948 }
16949}
16950
16951pub fn gifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
16956 unsafe {
16957 let inp_in: *mut bindings::VipsImage = inp.ctx;
16958 let target_in: *mut bindings::VipsTarget = target.ctx;
16959
16960 let vips_op_response = bindings::vips_gifsave_target(inp_in, target_in, NULL);
16961 utils::result(vips_op_response, (), Error::GifsaveTargetError)
16962 }
16963}
16964
16965#[derive(Clone, Debug)]
16967pub struct GifsaveTargetOptions {
16968 pub dither: f64,
16971 pub effort: i32,
16974 pub bitdepth: i32,
16977 pub interframe_maxerror: f64,
16980 pub reuse: bool,
16983 pub interpalette_maxerror: f64,
16986 pub interlace: bool,
16989 pub keep: ForeignKeep,
16998 pub background: Vec<f64>,
17000 pub page_height: i32,
17003 pub profile: String,
17005}
17006
17007impl std::default::Default for GifsaveTargetOptions {
17008 fn default() -> Self {
17009 GifsaveTargetOptions {
17010 dither: f64::from(1),
17011 effort: i32::from(7),
17012 bitdepth: i32::from(8),
17013 interframe_maxerror: f64::from(0),
17014 reuse: false,
17015 interpalette_maxerror: f64::from(3),
17016 interlace: false,
17017 keep: ForeignKeep::All,
17018 background: Vec::new(),
17019 page_height: i32::from(0),
17020 profile: String::from("sRGB"),
17021 }
17022 }
17023}
17024
17025pub fn gifsave_target_with_opts(
17031 inp: &VipsImage,
17032 target: &VipsTarget,
17033 gifsave_target_options: &GifsaveTargetOptions,
17034) -> Result<()> {
17035 unsafe {
17036 let inp_in: *mut bindings::VipsImage = inp.ctx;
17037 let target_in: *mut bindings::VipsTarget = target.ctx;
17038
17039 let dither_in: f64 = gifsave_target_options.dither;
17040 let dither_in_name = utils::new_c_string("dither")?;
17041
17042 let effort_in: i32 = gifsave_target_options.effort;
17043 let effort_in_name = utils::new_c_string("effort")?;
17044
17045 let bitdepth_in: i32 = gifsave_target_options.bitdepth;
17046 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17047
17048 let interframe_maxerror_in: f64 = gifsave_target_options.interframe_maxerror;
17049 let interframe_maxerror_in_name = utils::new_c_string("interframe-maxerror")?;
17050
17051 let reuse_in: i32 = if gifsave_target_options.reuse { 1 } else { 0 };
17052 let reuse_in_name = utils::new_c_string("reuse")?;
17053
17054 let interpalette_maxerror_in: f64 = gifsave_target_options.interpalette_maxerror;
17055 let interpalette_maxerror_in_name = utils::new_c_string("interpalette-maxerror")?;
17056
17057 let interlace_in: i32 = if gifsave_target_options.interlace {
17058 1
17059 } else {
17060 0
17061 };
17062 let interlace_in_name = utils::new_c_string("interlace")?;
17063
17064 let keep_in: i32 = gifsave_target_options.keep as i32;
17065 let keep_in_name = utils::new_c_string("keep")?;
17066
17067 let background_wrapper =
17068 utils::VipsArrayDoubleWrapper::from(&gifsave_target_options.background[..]);
17069 let background_in = background_wrapper.ctx;
17070 let background_in_name = utils::new_c_string("background")?;
17071
17072 let page_height_in: i32 = gifsave_target_options.page_height;
17073 let page_height_in_name = utils::new_c_string("page-height")?;
17074
17075 let profile_in: CString = utils::new_c_string(&gifsave_target_options.profile)?;
17076 let profile_in_name = utils::new_c_string("profile")?;
17077
17078 let vips_op_response = bindings::vips_gifsave_target(
17079 inp_in,
17080 target_in,
17081 dither_in_name.as_ptr(),
17082 dither_in,
17083 effort_in_name.as_ptr(),
17084 effort_in,
17085 bitdepth_in_name.as_ptr(),
17086 bitdepth_in,
17087 interframe_maxerror_in_name.as_ptr(),
17088 interframe_maxerror_in,
17089 reuse_in_name.as_ptr(),
17090 reuse_in,
17091 interpalette_maxerror_in_name.as_ptr(),
17092 interpalette_maxerror_in,
17093 interlace_in_name.as_ptr(),
17094 interlace_in,
17095 keep_in_name.as_ptr(),
17096 keep_in,
17097 background_in_name.as_ptr(),
17098 background_in,
17099 page_height_in_name.as_ptr(),
17100 page_height_in,
17101 profile_in_name.as_ptr(),
17102 profile_in.as_ptr(),
17103 NULL,
17104 );
17105 utils::result(vips_op_response, (), Error::GifsaveTargetError)
17106 }
17107}
17108
17109pub fn dzsave(inp: &VipsImage, filename: &str) -> Result<()> {
17114 unsafe {
17115 let inp_in: *mut bindings::VipsImage = inp.ctx;
17116 let filename_in: CString = utils::new_c_string(filename)?;
17117
17118 let vips_op_response = bindings::vips_dzsave(inp_in, filename_in.as_ptr(), NULL);
17119 utils::result(vips_op_response, (), Error::DzsaveError)
17120 }
17121}
17122
17123#[derive(Clone, Debug)]
17125pub struct DzsaveOptions {
17126 pub imagename: String,
17128 pub layout: ForeignDzLayout,
17136 pub suffix: String,
17138 pub overlap: i32,
17141 pub tile_size: i32,
17144 pub centre: bool,
17147 pub depth: ForeignDzDepth,
17153 pub angle: Angle,
17160 pub container: ForeignDzContainer,
17166 pub compression: i32,
17169 pub region_shrink: RegionShrink,
17178 pub skip_blanks: i32,
17181 pub id: String,
17183 pub q: i32,
17186 pub keep: ForeignKeep,
17195 pub background: Vec<f64>,
17197 pub page_height: i32,
17200 pub profile: String,
17202}
17203
17204impl std::default::Default for DzsaveOptions {
17205 fn default() -> Self {
17206 DzsaveOptions {
17207 imagename: String::new(),
17208 layout: ForeignDzLayout::Dz,
17209 suffix: String::new(),
17210 overlap: i32::from(1),
17211 tile_size: i32::from(254),
17212 centre: false,
17213 depth: ForeignDzDepth::Onepixel,
17214 angle: Angle::D0,
17215 container: ForeignDzContainer::F,
17216 compression: i32::from(0),
17217 region_shrink: RegionShrink::Mean,
17218 skip_blanks: i32::from(-1),
17219 id: String::new(),
17220 q: i32::from(75),
17221 keep: ForeignKeep::All,
17222 background: Vec::new(),
17223 page_height: i32::from(0),
17224 profile: String::from("sRGB"),
17225 }
17226 }
17227}
17228
17229pub fn dzsave_with_opts(
17235 inp: &VipsImage,
17236 filename: &str,
17237 dzsave_options: &DzsaveOptions,
17238) -> Result<()> {
17239 unsafe {
17240 let inp_in: *mut bindings::VipsImage = inp.ctx;
17241 let filename_in: CString = utils::new_c_string(filename)?;
17242
17243 let imagename_in: CString = utils::new_c_string(&dzsave_options.imagename)?;
17244 let imagename_in_name = utils::new_c_string("imagename")?;
17245
17246 let layout_in: i32 = dzsave_options.layout as i32;
17247 let layout_in_name = utils::new_c_string("layout")?;
17248
17249 let suffix_in: CString = utils::new_c_string(&dzsave_options.suffix)?;
17250 let suffix_in_name = utils::new_c_string("suffix")?;
17251
17252 let overlap_in: i32 = dzsave_options.overlap;
17253 let overlap_in_name = utils::new_c_string("overlap")?;
17254
17255 let tile_size_in: i32 = dzsave_options.tile_size;
17256 let tile_size_in_name = utils::new_c_string("tile-size")?;
17257
17258 let centre_in: i32 = if dzsave_options.centre { 1 } else { 0 };
17259 let centre_in_name = utils::new_c_string("centre")?;
17260
17261 let depth_in: i32 = dzsave_options.depth as i32;
17262 let depth_in_name = utils::new_c_string("depth")?;
17263
17264 let angle_in: i32 = dzsave_options.angle as i32;
17265 let angle_in_name = utils::new_c_string("angle")?;
17266
17267 let container_in: i32 = dzsave_options.container as i32;
17268 let container_in_name = utils::new_c_string("container")?;
17269
17270 let compression_in: i32 = dzsave_options.compression;
17271 let compression_in_name = utils::new_c_string("compression")?;
17272
17273 let region_shrink_in: i32 = dzsave_options.region_shrink as i32;
17274 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17275
17276 let skip_blanks_in: i32 = dzsave_options.skip_blanks;
17277 let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17278
17279 let id_in: CString = utils::new_c_string(&dzsave_options.id)?;
17280 let id_in_name = utils::new_c_string("id")?;
17281
17282 let q_in: i32 = dzsave_options.q;
17283 let q_in_name = utils::new_c_string("Q")?;
17284
17285 let keep_in: i32 = dzsave_options.keep as i32;
17286 let keep_in_name = utils::new_c_string("keep")?;
17287
17288 let background_wrapper =
17289 utils::VipsArrayDoubleWrapper::from(&dzsave_options.background[..]);
17290 let background_in = background_wrapper.ctx;
17291 let background_in_name = utils::new_c_string("background")?;
17292
17293 let page_height_in: i32 = dzsave_options.page_height;
17294 let page_height_in_name = utils::new_c_string("page-height")?;
17295
17296 let profile_in: CString = utils::new_c_string(&dzsave_options.profile)?;
17297 let profile_in_name = utils::new_c_string("profile")?;
17298
17299 let vips_op_response = bindings::vips_dzsave(
17300 inp_in,
17301 filename_in.as_ptr(),
17302 imagename_in_name.as_ptr(),
17303 imagename_in.as_ptr(),
17304 layout_in_name.as_ptr(),
17305 layout_in,
17306 suffix_in_name.as_ptr(),
17307 suffix_in.as_ptr(),
17308 overlap_in_name.as_ptr(),
17309 overlap_in,
17310 tile_size_in_name.as_ptr(),
17311 tile_size_in,
17312 centre_in_name.as_ptr(),
17313 centre_in,
17314 depth_in_name.as_ptr(),
17315 depth_in,
17316 angle_in_name.as_ptr(),
17317 angle_in,
17318 container_in_name.as_ptr(),
17319 container_in,
17320 compression_in_name.as_ptr(),
17321 compression_in,
17322 region_shrink_in_name.as_ptr(),
17323 region_shrink_in,
17324 skip_blanks_in_name.as_ptr(),
17325 skip_blanks_in,
17326 id_in_name.as_ptr(),
17327 id_in.as_ptr(),
17328 q_in_name.as_ptr(),
17329 q_in,
17330 keep_in_name.as_ptr(),
17331 keep_in,
17332 background_in_name.as_ptr(),
17333 background_in,
17334 page_height_in_name.as_ptr(),
17335 page_height_in,
17336 profile_in_name.as_ptr(),
17337 profile_in.as_ptr(),
17338 NULL,
17339 );
17340 utils::result(vips_op_response, (), Error::DzsaveError)
17341 }
17342}
17343
17344pub fn dzsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17348 unsafe {
17349 let inp_in: *mut bindings::VipsImage = inp.ctx;
17350 let mut buffer_buf_size: u64 = 0;
17351 let mut buffer_out: *mut c_void = null_mut();
17352
17353 let vips_op_response =
17354 bindings::vips_dzsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
17355 utils::result(
17356 vips_op_response,
17357 utils::new_byte_array(buffer_out, buffer_buf_size),
17358 Error::DzsaveBufferError,
17359 )
17360 }
17361}
17362
17363#[derive(Clone, Debug)]
17365pub struct DzsaveBufferOptions {
17366 pub imagename: String,
17368 pub layout: ForeignDzLayout,
17376 pub suffix: String,
17378 pub overlap: i32,
17381 pub tile_size: i32,
17384 pub centre: bool,
17387 pub depth: ForeignDzDepth,
17393 pub angle: Angle,
17400 pub container: ForeignDzContainer,
17406 pub compression: i32,
17409 pub region_shrink: RegionShrink,
17418 pub skip_blanks: i32,
17421 pub id: String,
17423 pub q: i32,
17426 pub keep: ForeignKeep,
17435 pub background: Vec<f64>,
17437 pub page_height: i32,
17440 pub profile: String,
17442}
17443
17444impl std::default::Default for DzsaveBufferOptions {
17445 fn default() -> Self {
17446 DzsaveBufferOptions {
17447 imagename: String::new(),
17448 layout: ForeignDzLayout::Dz,
17449 suffix: String::new(),
17450 overlap: i32::from(1),
17451 tile_size: i32::from(254),
17452 centre: false,
17453 depth: ForeignDzDepth::Onepixel,
17454 angle: Angle::D0,
17455 container: ForeignDzContainer::F,
17456 compression: i32::from(0),
17457 region_shrink: RegionShrink::Mean,
17458 skip_blanks: i32::from(-1),
17459 id: String::new(),
17460 q: i32::from(75),
17461 keep: ForeignKeep::All,
17462 background: Vec::new(),
17463 page_height: i32::from(0),
17464 profile: String::from("sRGB"),
17465 }
17466 }
17467}
17468
17469pub fn dzsave_buffer_with_opts(
17474 inp: &VipsImage,
17475 dzsave_buffer_options: &DzsaveBufferOptions,
17476) -> Result<Vec<u8>> {
17477 unsafe {
17478 let inp_in: *mut bindings::VipsImage = inp.ctx;
17479 let mut buffer_buf_size: u64 = 0;
17480 let mut buffer_out: *mut c_void = null_mut();
17481
17482 let imagename_in: CString = utils::new_c_string(&dzsave_buffer_options.imagename)?;
17483 let imagename_in_name = utils::new_c_string("imagename")?;
17484
17485 let layout_in: i32 = dzsave_buffer_options.layout as i32;
17486 let layout_in_name = utils::new_c_string("layout")?;
17487
17488 let suffix_in: CString = utils::new_c_string(&dzsave_buffer_options.suffix)?;
17489 let suffix_in_name = utils::new_c_string("suffix")?;
17490
17491 let overlap_in: i32 = dzsave_buffer_options.overlap;
17492 let overlap_in_name = utils::new_c_string("overlap")?;
17493
17494 let tile_size_in: i32 = dzsave_buffer_options.tile_size;
17495 let tile_size_in_name = utils::new_c_string("tile-size")?;
17496
17497 let centre_in: i32 = if dzsave_buffer_options.centre { 1 } else { 0 };
17498 let centre_in_name = utils::new_c_string("centre")?;
17499
17500 let depth_in: i32 = dzsave_buffer_options.depth as i32;
17501 let depth_in_name = utils::new_c_string("depth")?;
17502
17503 let angle_in: i32 = dzsave_buffer_options.angle as i32;
17504 let angle_in_name = utils::new_c_string("angle")?;
17505
17506 let container_in: i32 = dzsave_buffer_options.container as i32;
17507 let container_in_name = utils::new_c_string("container")?;
17508
17509 let compression_in: i32 = dzsave_buffer_options.compression;
17510 let compression_in_name = utils::new_c_string("compression")?;
17511
17512 let region_shrink_in: i32 = dzsave_buffer_options.region_shrink as i32;
17513 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17514
17515 let skip_blanks_in: i32 = dzsave_buffer_options.skip_blanks;
17516 let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17517
17518 let id_in: CString = utils::new_c_string(&dzsave_buffer_options.id)?;
17519 let id_in_name = utils::new_c_string("id")?;
17520
17521 let q_in: i32 = dzsave_buffer_options.q;
17522 let q_in_name = utils::new_c_string("Q")?;
17523
17524 let keep_in: i32 = dzsave_buffer_options.keep as i32;
17525 let keep_in_name = utils::new_c_string("keep")?;
17526
17527 let background_wrapper =
17528 utils::VipsArrayDoubleWrapper::from(&dzsave_buffer_options.background[..]);
17529 let background_in = background_wrapper.ctx;
17530 let background_in_name = utils::new_c_string("background")?;
17531
17532 let page_height_in: i32 = dzsave_buffer_options.page_height;
17533 let page_height_in_name = utils::new_c_string("page-height")?;
17534
17535 let profile_in: CString = utils::new_c_string(&dzsave_buffer_options.profile)?;
17536 let profile_in_name = utils::new_c_string("profile")?;
17537
17538 let vips_op_response = bindings::vips_dzsave_buffer(
17539 inp_in,
17540 &mut buffer_out,
17541 &mut buffer_buf_size,
17542 imagename_in_name.as_ptr(),
17543 imagename_in.as_ptr(),
17544 layout_in_name.as_ptr(),
17545 layout_in,
17546 suffix_in_name.as_ptr(),
17547 suffix_in.as_ptr(),
17548 overlap_in_name.as_ptr(),
17549 overlap_in,
17550 tile_size_in_name.as_ptr(),
17551 tile_size_in,
17552 centre_in_name.as_ptr(),
17553 centre_in,
17554 depth_in_name.as_ptr(),
17555 depth_in,
17556 angle_in_name.as_ptr(),
17557 angle_in,
17558 container_in_name.as_ptr(),
17559 container_in,
17560 compression_in_name.as_ptr(),
17561 compression_in,
17562 region_shrink_in_name.as_ptr(),
17563 region_shrink_in,
17564 skip_blanks_in_name.as_ptr(),
17565 skip_blanks_in,
17566 id_in_name.as_ptr(),
17567 id_in.as_ptr(),
17568 q_in_name.as_ptr(),
17569 q_in,
17570 keep_in_name.as_ptr(),
17571 keep_in,
17572 background_in_name.as_ptr(),
17573 background_in,
17574 page_height_in_name.as_ptr(),
17575 page_height_in,
17576 profile_in_name.as_ptr(),
17577 profile_in.as_ptr(),
17578 NULL,
17579 );
17580 utils::result(
17581 vips_op_response,
17582 utils::new_byte_array(buffer_out, buffer_buf_size),
17583 Error::DzsaveBufferError,
17584 )
17585 }
17586}
17587
17588pub fn dzsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
17593 unsafe {
17594 let inp_in: *mut bindings::VipsImage = inp.ctx;
17595 let target_in: *mut bindings::VipsTarget = target.ctx;
17596
17597 let vips_op_response = bindings::vips_dzsave_target(inp_in, target_in, NULL);
17598 utils::result(vips_op_response, (), Error::DzsaveTargetError)
17599 }
17600}
17601
17602#[derive(Clone, Debug)]
17604pub struct DzsaveTargetOptions {
17605 pub imagename: String,
17607 pub layout: ForeignDzLayout,
17615 pub suffix: String,
17617 pub overlap: i32,
17620 pub tile_size: i32,
17623 pub centre: bool,
17626 pub depth: ForeignDzDepth,
17632 pub angle: Angle,
17639 pub container: ForeignDzContainer,
17645 pub compression: i32,
17648 pub region_shrink: RegionShrink,
17657 pub skip_blanks: i32,
17660 pub id: String,
17662 pub q: i32,
17665 pub keep: ForeignKeep,
17674 pub background: Vec<f64>,
17676 pub page_height: i32,
17679 pub profile: String,
17681}
17682
17683impl std::default::Default for DzsaveTargetOptions {
17684 fn default() -> Self {
17685 DzsaveTargetOptions {
17686 imagename: String::new(),
17687 layout: ForeignDzLayout::Dz,
17688 suffix: String::new(),
17689 overlap: i32::from(1),
17690 tile_size: i32::from(254),
17691 centre: false,
17692 depth: ForeignDzDepth::Onepixel,
17693 angle: Angle::D0,
17694 container: ForeignDzContainer::F,
17695 compression: i32::from(0),
17696 region_shrink: RegionShrink::Mean,
17697 skip_blanks: i32::from(-1),
17698 id: String::new(),
17699 q: i32::from(75),
17700 keep: ForeignKeep::All,
17701 background: Vec::new(),
17702 page_height: i32::from(0),
17703 profile: String::from("sRGB"),
17704 }
17705 }
17706}
17707
17708pub fn dzsave_target_with_opts(
17714 inp: &VipsImage,
17715 target: &VipsTarget,
17716 dzsave_target_options: &DzsaveTargetOptions,
17717) -> Result<()> {
17718 unsafe {
17719 let inp_in: *mut bindings::VipsImage = inp.ctx;
17720 let target_in: *mut bindings::VipsTarget = target.ctx;
17721
17722 let imagename_in: CString = utils::new_c_string(&dzsave_target_options.imagename)?;
17723 let imagename_in_name = utils::new_c_string("imagename")?;
17724
17725 let layout_in: i32 = dzsave_target_options.layout as i32;
17726 let layout_in_name = utils::new_c_string("layout")?;
17727
17728 let suffix_in: CString = utils::new_c_string(&dzsave_target_options.suffix)?;
17729 let suffix_in_name = utils::new_c_string("suffix")?;
17730
17731 let overlap_in: i32 = dzsave_target_options.overlap;
17732 let overlap_in_name = utils::new_c_string("overlap")?;
17733
17734 let tile_size_in: i32 = dzsave_target_options.tile_size;
17735 let tile_size_in_name = utils::new_c_string("tile-size")?;
17736
17737 let centre_in: i32 = if dzsave_target_options.centre { 1 } else { 0 };
17738 let centre_in_name = utils::new_c_string("centre")?;
17739
17740 let depth_in: i32 = dzsave_target_options.depth as i32;
17741 let depth_in_name = utils::new_c_string("depth")?;
17742
17743 let angle_in: i32 = dzsave_target_options.angle as i32;
17744 let angle_in_name = utils::new_c_string("angle")?;
17745
17746 let container_in: i32 = dzsave_target_options.container as i32;
17747 let container_in_name = utils::new_c_string("container")?;
17748
17749 let compression_in: i32 = dzsave_target_options.compression;
17750 let compression_in_name = utils::new_c_string("compression")?;
17751
17752 let region_shrink_in: i32 = dzsave_target_options.region_shrink as i32;
17753 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
17754
17755 let skip_blanks_in: i32 = dzsave_target_options.skip_blanks;
17756 let skip_blanks_in_name = utils::new_c_string("skip-blanks")?;
17757
17758 let id_in: CString = utils::new_c_string(&dzsave_target_options.id)?;
17759 let id_in_name = utils::new_c_string("id")?;
17760
17761 let q_in: i32 = dzsave_target_options.q;
17762 let q_in_name = utils::new_c_string("Q")?;
17763
17764 let keep_in: i32 = dzsave_target_options.keep as i32;
17765 let keep_in_name = utils::new_c_string("keep")?;
17766
17767 let background_wrapper =
17768 utils::VipsArrayDoubleWrapper::from(&dzsave_target_options.background[..]);
17769 let background_in = background_wrapper.ctx;
17770 let background_in_name = utils::new_c_string("background")?;
17771
17772 let page_height_in: i32 = dzsave_target_options.page_height;
17773 let page_height_in_name = utils::new_c_string("page-height")?;
17774
17775 let profile_in: CString = utils::new_c_string(&dzsave_target_options.profile)?;
17776 let profile_in_name = utils::new_c_string("profile")?;
17777
17778 let vips_op_response = bindings::vips_dzsave_target(
17779 inp_in,
17780 target_in,
17781 imagename_in_name.as_ptr(),
17782 imagename_in.as_ptr(),
17783 layout_in_name.as_ptr(),
17784 layout_in,
17785 suffix_in_name.as_ptr(),
17786 suffix_in.as_ptr(),
17787 overlap_in_name.as_ptr(),
17788 overlap_in,
17789 tile_size_in_name.as_ptr(),
17790 tile_size_in,
17791 centre_in_name.as_ptr(),
17792 centre_in,
17793 depth_in_name.as_ptr(),
17794 depth_in,
17795 angle_in_name.as_ptr(),
17796 angle_in,
17797 container_in_name.as_ptr(),
17798 container_in,
17799 compression_in_name.as_ptr(),
17800 compression_in,
17801 region_shrink_in_name.as_ptr(),
17802 region_shrink_in,
17803 skip_blanks_in_name.as_ptr(),
17804 skip_blanks_in,
17805 id_in_name.as_ptr(),
17806 id_in.as_ptr(),
17807 q_in_name.as_ptr(),
17808 q_in,
17809 keep_in_name.as_ptr(),
17810 keep_in,
17811 background_in_name.as_ptr(),
17812 background_in,
17813 page_height_in_name.as_ptr(),
17814 page_height_in,
17815 profile_in_name.as_ptr(),
17816 profile_in.as_ptr(),
17817 NULL,
17818 );
17819 utils::result(vips_op_response, (), Error::DzsaveTargetError)
17820 }
17821}
17822
17823pub fn pngsave(inp: &VipsImage, filename: &str) -> Result<()> {
17828 unsafe {
17829 let inp_in: *mut bindings::VipsImage = inp.ctx;
17830 let filename_in: CString = utils::new_c_string(filename)?;
17831
17832 let vips_op_response = bindings::vips_pngsave(inp_in, filename_in.as_ptr(), NULL);
17833 utils::result(vips_op_response, (), Error::PngsaveError)
17834 }
17835}
17836
17837#[derive(Clone, Debug)]
17839pub struct PngsaveOptions {
17840 pub compression: i32,
17843 pub interlace: bool,
17846 pub filter: ForeignPngFilter,
17854 pub palette: bool,
17857 pub q: i32,
17860 pub dither: f64,
17863 pub bitdepth: i32,
17866 pub effort: i32,
17869 pub keep: ForeignKeep,
17878 pub background: Vec<f64>,
17880 pub page_height: i32,
17883 pub profile: String,
17885}
17886
17887impl std::default::Default for PngsaveOptions {
17888 fn default() -> Self {
17889 PngsaveOptions {
17890 compression: i32::from(6),
17891 interlace: false,
17892 filter: ForeignPngFilter::None,
17893 palette: false,
17894 q: i32::from(100),
17895 dither: f64::from(1),
17896 bitdepth: i32::from(8),
17897 effort: i32::from(7),
17898 keep: ForeignKeep::All,
17899 background: Vec::new(),
17900 page_height: i32::from(0),
17901 profile: String::from("sRGB"),
17902 }
17903 }
17904}
17905
17906pub fn pngsave_with_opts(
17912 inp: &VipsImage,
17913 filename: &str,
17914 pngsave_options: &PngsaveOptions,
17915) -> Result<()> {
17916 unsafe {
17917 let inp_in: *mut bindings::VipsImage = inp.ctx;
17918 let filename_in: CString = utils::new_c_string(filename)?;
17919
17920 let compression_in: i32 = pngsave_options.compression;
17921 let compression_in_name = utils::new_c_string("compression")?;
17922
17923 let interlace_in: i32 = if pngsave_options.interlace { 1 } else { 0 };
17924 let interlace_in_name = utils::new_c_string("interlace")?;
17925
17926 let filter_in: i32 = pngsave_options.filter as i32;
17927 let filter_in_name = utils::new_c_string("filter")?;
17928
17929 let palette_in: i32 = if pngsave_options.palette { 1 } else { 0 };
17930 let palette_in_name = utils::new_c_string("palette")?;
17931
17932 let q_in: i32 = pngsave_options.q;
17933 let q_in_name = utils::new_c_string("Q")?;
17934
17935 let dither_in: f64 = pngsave_options.dither;
17936 let dither_in_name = utils::new_c_string("dither")?;
17937
17938 let bitdepth_in: i32 = pngsave_options.bitdepth;
17939 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
17940
17941 let effort_in: i32 = pngsave_options.effort;
17942 let effort_in_name = utils::new_c_string("effort")?;
17943
17944 let keep_in: i32 = pngsave_options.keep as i32;
17945 let keep_in_name = utils::new_c_string("keep")?;
17946
17947 let background_wrapper =
17948 utils::VipsArrayDoubleWrapper::from(&pngsave_options.background[..]);
17949 let background_in = background_wrapper.ctx;
17950 let background_in_name = utils::new_c_string("background")?;
17951
17952 let page_height_in: i32 = pngsave_options.page_height;
17953 let page_height_in_name = utils::new_c_string("page-height")?;
17954
17955 let profile_in: CString = utils::new_c_string(&pngsave_options.profile)?;
17956 let profile_in_name = utils::new_c_string("profile")?;
17957
17958 let vips_op_response = bindings::vips_pngsave(
17959 inp_in,
17960 filename_in.as_ptr(),
17961 compression_in_name.as_ptr(),
17962 compression_in,
17963 interlace_in_name.as_ptr(),
17964 interlace_in,
17965 filter_in_name.as_ptr(),
17966 filter_in,
17967 palette_in_name.as_ptr(),
17968 palette_in,
17969 q_in_name.as_ptr(),
17970 q_in,
17971 dither_in_name.as_ptr(),
17972 dither_in,
17973 bitdepth_in_name.as_ptr(),
17974 bitdepth_in,
17975 effort_in_name.as_ptr(),
17976 effort_in,
17977 keep_in_name.as_ptr(),
17978 keep_in,
17979 background_in_name.as_ptr(),
17980 background_in,
17981 page_height_in_name.as_ptr(),
17982 page_height_in,
17983 profile_in_name.as_ptr(),
17984 profile_in.as_ptr(),
17985 NULL,
17986 );
17987 utils::result(vips_op_response, (), Error::PngsaveError)
17988 }
17989}
17990
17991pub fn pngsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
17995 unsafe {
17996 let inp_in: *mut bindings::VipsImage = inp.ctx;
17997 let mut buffer_buf_size: u64 = 0;
17998 let mut buffer_out: *mut c_void = null_mut();
17999
18000 let vips_op_response =
18001 bindings::vips_pngsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18002 utils::result(
18003 vips_op_response,
18004 utils::new_byte_array(buffer_out, buffer_buf_size),
18005 Error::PngsaveBufferError,
18006 )
18007 }
18008}
18009
18010#[derive(Clone, Debug)]
18012pub struct PngsaveBufferOptions {
18013 pub compression: i32,
18016 pub interlace: bool,
18019 pub filter: ForeignPngFilter,
18027 pub palette: bool,
18030 pub q: i32,
18033 pub dither: f64,
18036 pub bitdepth: i32,
18039 pub effort: i32,
18042 pub keep: ForeignKeep,
18051 pub background: Vec<f64>,
18053 pub page_height: i32,
18056 pub profile: String,
18058}
18059
18060impl std::default::Default for PngsaveBufferOptions {
18061 fn default() -> Self {
18062 PngsaveBufferOptions {
18063 compression: i32::from(6),
18064 interlace: false,
18065 filter: ForeignPngFilter::None,
18066 palette: false,
18067 q: i32::from(100),
18068 dither: f64::from(1),
18069 bitdepth: i32::from(8),
18070 effort: i32::from(7),
18071 keep: ForeignKeep::All,
18072 background: Vec::new(),
18073 page_height: i32::from(0),
18074 profile: String::from("sRGB"),
18075 }
18076 }
18077}
18078
18079pub fn pngsave_buffer_with_opts(
18084 inp: &VipsImage,
18085 pngsave_buffer_options: &PngsaveBufferOptions,
18086) -> Result<Vec<u8>> {
18087 unsafe {
18088 let inp_in: *mut bindings::VipsImage = inp.ctx;
18089 let mut buffer_buf_size: u64 = 0;
18090 let mut buffer_out: *mut c_void = null_mut();
18091
18092 let compression_in: i32 = pngsave_buffer_options.compression;
18093 let compression_in_name = utils::new_c_string("compression")?;
18094
18095 let interlace_in: i32 = if pngsave_buffer_options.interlace {
18096 1
18097 } else {
18098 0
18099 };
18100 let interlace_in_name = utils::new_c_string("interlace")?;
18101
18102 let filter_in: i32 = pngsave_buffer_options.filter as i32;
18103 let filter_in_name = utils::new_c_string("filter")?;
18104
18105 let palette_in: i32 = if pngsave_buffer_options.palette { 1 } else { 0 };
18106 let palette_in_name = utils::new_c_string("palette")?;
18107
18108 let q_in: i32 = pngsave_buffer_options.q;
18109 let q_in_name = utils::new_c_string("Q")?;
18110
18111 let dither_in: f64 = pngsave_buffer_options.dither;
18112 let dither_in_name = utils::new_c_string("dither")?;
18113
18114 let bitdepth_in: i32 = pngsave_buffer_options.bitdepth;
18115 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18116
18117 let effort_in: i32 = pngsave_buffer_options.effort;
18118 let effort_in_name = utils::new_c_string("effort")?;
18119
18120 let keep_in: i32 = pngsave_buffer_options.keep as i32;
18121 let keep_in_name = utils::new_c_string("keep")?;
18122
18123 let background_wrapper =
18124 utils::VipsArrayDoubleWrapper::from(&pngsave_buffer_options.background[..]);
18125 let background_in = background_wrapper.ctx;
18126 let background_in_name = utils::new_c_string("background")?;
18127
18128 let page_height_in: i32 = pngsave_buffer_options.page_height;
18129 let page_height_in_name = utils::new_c_string("page-height")?;
18130
18131 let profile_in: CString = utils::new_c_string(&pngsave_buffer_options.profile)?;
18132 let profile_in_name = utils::new_c_string("profile")?;
18133
18134 let vips_op_response = bindings::vips_pngsave_buffer(
18135 inp_in,
18136 &mut buffer_out,
18137 &mut buffer_buf_size,
18138 compression_in_name.as_ptr(),
18139 compression_in,
18140 interlace_in_name.as_ptr(),
18141 interlace_in,
18142 filter_in_name.as_ptr(),
18143 filter_in,
18144 palette_in_name.as_ptr(),
18145 palette_in,
18146 q_in_name.as_ptr(),
18147 q_in,
18148 dither_in_name.as_ptr(),
18149 dither_in,
18150 bitdepth_in_name.as_ptr(),
18151 bitdepth_in,
18152 effort_in_name.as_ptr(),
18153 effort_in,
18154 keep_in_name.as_ptr(),
18155 keep_in,
18156 background_in_name.as_ptr(),
18157 background_in,
18158 page_height_in_name.as_ptr(),
18159 page_height_in,
18160 profile_in_name.as_ptr(),
18161 profile_in.as_ptr(),
18162 NULL,
18163 );
18164 utils::result(
18165 vips_op_response,
18166 utils::new_byte_array(buffer_out, buffer_buf_size),
18167 Error::PngsaveBufferError,
18168 )
18169 }
18170}
18171
18172pub fn pngsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18177 unsafe {
18178 let inp_in: *mut bindings::VipsImage = inp.ctx;
18179 let target_in: *mut bindings::VipsTarget = target.ctx;
18180
18181 let vips_op_response = bindings::vips_pngsave_target(inp_in, target_in, NULL);
18182 utils::result(vips_op_response, (), Error::PngsaveTargetError)
18183 }
18184}
18185
18186#[derive(Clone, Debug)]
18188pub struct PngsaveTargetOptions {
18189 pub compression: i32,
18192 pub interlace: bool,
18195 pub filter: ForeignPngFilter,
18203 pub palette: bool,
18206 pub q: i32,
18209 pub dither: f64,
18212 pub bitdepth: i32,
18215 pub effort: i32,
18218 pub keep: ForeignKeep,
18227 pub background: Vec<f64>,
18229 pub page_height: i32,
18232 pub profile: String,
18234}
18235
18236impl std::default::Default for PngsaveTargetOptions {
18237 fn default() -> Self {
18238 PngsaveTargetOptions {
18239 compression: i32::from(6),
18240 interlace: false,
18241 filter: ForeignPngFilter::None,
18242 palette: false,
18243 q: i32::from(100),
18244 dither: f64::from(1),
18245 bitdepth: i32::from(8),
18246 effort: i32::from(7),
18247 keep: ForeignKeep::All,
18248 background: Vec::new(),
18249 page_height: i32::from(0),
18250 profile: String::from("sRGB"),
18251 }
18252 }
18253}
18254
18255pub fn pngsave_target_with_opts(
18261 inp: &VipsImage,
18262 target: &VipsTarget,
18263 pngsave_target_options: &PngsaveTargetOptions,
18264) -> Result<()> {
18265 unsafe {
18266 let inp_in: *mut bindings::VipsImage = inp.ctx;
18267 let target_in: *mut bindings::VipsTarget = target.ctx;
18268
18269 let compression_in: i32 = pngsave_target_options.compression;
18270 let compression_in_name = utils::new_c_string("compression")?;
18271
18272 let interlace_in: i32 = if pngsave_target_options.interlace {
18273 1
18274 } else {
18275 0
18276 };
18277 let interlace_in_name = utils::new_c_string("interlace")?;
18278
18279 let filter_in: i32 = pngsave_target_options.filter as i32;
18280 let filter_in_name = utils::new_c_string("filter")?;
18281
18282 let palette_in: i32 = if pngsave_target_options.palette { 1 } else { 0 };
18283 let palette_in_name = utils::new_c_string("palette")?;
18284
18285 let q_in: i32 = pngsave_target_options.q;
18286 let q_in_name = utils::new_c_string("Q")?;
18287
18288 let dither_in: f64 = pngsave_target_options.dither;
18289 let dither_in_name = utils::new_c_string("dither")?;
18290
18291 let bitdepth_in: i32 = pngsave_target_options.bitdepth;
18292 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
18293
18294 let effort_in: i32 = pngsave_target_options.effort;
18295 let effort_in_name = utils::new_c_string("effort")?;
18296
18297 let keep_in: i32 = pngsave_target_options.keep as i32;
18298 let keep_in_name = utils::new_c_string("keep")?;
18299
18300 let background_wrapper =
18301 utils::VipsArrayDoubleWrapper::from(&pngsave_target_options.background[..]);
18302 let background_in = background_wrapper.ctx;
18303 let background_in_name = utils::new_c_string("background")?;
18304
18305 let page_height_in: i32 = pngsave_target_options.page_height;
18306 let page_height_in_name = utils::new_c_string("page-height")?;
18307
18308 let profile_in: CString = utils::new_c_string(&pngsave_target_options.profile)?;
18309 let profile_in_name = utils::new_c_string("profile")?;
18310
18311 let vips_op_response = bindings::vips_pngsave_target(
18312 inp_in,
18313 target_in,
18314 compression_in_name.as_ptr(),
18315 compression_in,
18316 interlace_in_name.as_ptr(),
18317 interlace_in,
18318 filter_in_name.as_ptr(),
18319 filter_in,
18320 palette_in_name.as_ptr(),
18321 palette_in,
18322 q_in_name.as_ptr(),
18323 q_in,
18324 dither_in_name.as_ptr(),
18325 dither_in,
18326 bitdepth_in_name.as_ptr(),
18327 bitdepth_in,
18328 effort_in_name.as_ptr(),
18329 effort_in,
18330 keep_in_name.as_ptr(),
18331 keep_in,
18332 background_in_name.as_ptr(),
18333 background_in,
18334 page_height_in_name.as_ptr(),
18335 page_height_in,
18336 profile_in_name.as_ptr(),
18337 profile_in.as_ptr(),
18338 NULL,
18339 );
18340 utils::result(vips_op_response, (), Error::PngsaveTargetError)
18341 }
18342}
18343
18344pub fn jpegsave(inp: &VipsImage, filename: &str) -> Result<()> {
18349 unsafe {
18350 let inp_in: *mut bindings::VipsImage = inp.ctx;
18351 let filename_in: CString = utils::new_c_string(filename)?;
18352
18353 let vips_op_response = bindings::vips_jpegsave(inp_in, filename_in.as_ptr(), NULL);
18354 utils::result(vips_op_response, (), Error::JpegsaveError)
18355 }
18356}
18357
18358#[derive(Clone, Debug)]
18360pub struct JpegsaveOptions {
18361 pub q: i32,
18364 pub optimize_coding: bool,
18367 pub interlace: bool,
18370 pub trellis_quant: bool,
18373 pub overshoot_deringing: bool,
18376 pub optimize_scans: bool,
18379 pub quant_table: i32,
18382 pub subsample_mode: ForeignSubsample,
18388 pub restart_interval: i32,
18391 pub keep: ForeignKeep,
18400 pub background: Vec<f64>,
18402 pub page_height: i32,
18405 pub profile: String,
18407}
18408
18409impl std::default::Default for JpegsaveOptions {
18410 fn default() -> Self {
18411 JpegsaveOptions {
18412 q: i32::from(75),
18413 optimize_coding: false,
18414 interlace: false,
18415 trellis_quant: false,
18416 overshoot_deringing: false,
18417 optimize_scans: false,
18418 quant_table: i32::from(0),
18419 subsample_mode: ForeignSubsample::Auto,
18420 restart_interval: i32::from(0),
18421 keep: ForeignKeep::All,
18422 background: Vec::new(),
18423 page_height: i32::from(0),
18424 profile: String::from("sRGB"),
18425 }
18426 }
18427}
18428
18429pub fn jpegsave_with_opts(
18435 inp: &VipsImage,
18436 filename: &str,
18437 jpegsave_options: &JpegsaveOptions,
18438) -> Result<()> {
18439 unsafe {
18440 let inp_in: *mut bindings::VipsImage = inp.ctx;
18441 let filename_in: CString = utils::new_c_string(filename)?;
18442
18443 let q_in: i32 = jpegsave_options.q;
18444 let q_in_name = utils::new_c_string("Q")?;
18445
18446 let optimize_coding_in: i32 = if jpegsave_options.optimize_coding {
18447 1
18448 } else {
18449 0
18450 };
18451 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18452
18453 let interlace_in: i32 = if jpegsave_options.interlace { 1 } else { 0 };
18454 let interlace_in_name = utils::new_c_string("interlace")?;
18455
18456 let trellis_quant_in: i32 = if jpegsave_options.trellis_quant { 1 } else { 0 };
18457 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18458
18459 let overshoot_deringing_in: i32 = if jpegsave_options.overshoot_deringing {
18460 1
18461 } else {
18462 0
18463 };
18464 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18465
18466 let optimize_scans_in: i32 = if jpegsave_options.optimize_scans {
18467 1
18468 } else {
18469 0
18470 };
18471 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18472
18473 let quant_table_in: i32 = jpegsave_options.quant_table;
18474 let quant_table_in_name = utils::new_c_string("quant-table")?;
18475
18476 let subsample_mode_in: i32 = jpegsave_options.subsample_mode as i32;
18477 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18478
18479 let restart_interval_in: i32 = jpegsave_options.restart_interval;
18480 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18481
18482 let keep_in: i32 = jpegsave_options.keep as i32;
18483 let keep_in_name = utils::new_c_string("keep")?;
18484
18485 let background_wrapper =
18486 utils::VipsArrayDoubleWrapper::from(&jpegsave_options.background[..]);
18487 let background_in = background_wrapper.ctx;
18488 let background_in_name = utils::new_c_string("background")?;
18489
18490 let page_height_in: i32 = jpegsave_options.page_height;
18491 let page_height_in_name = utils::new_c_string("page-height")?;
18492
18493 let profile_in: CString = utils::new_c_string(&jpegsave_options.profile)?;
18494 let profile_in_name = utils::new_c_string("profile")?;
18495
18496 let vips_op_response = bindings::vips_jpegsave(
18497 inp_in,
18498 filename_in.as_ptr(),
18499 q_in_name.as_ptr(),
18500 q_in,
18501 optimize_coding_in_name.as_ptr(),
18502 optimize_coding_in,
18503 interlace_in_name.as_ptr(),
18504 interlace_in,
18505 trellis_quant_in_name.as_ptr(),
18506 trellis_quant_in,
18507 overshoot_deringing_in_name.as_ptr(),
18508 overshoot_deringing_in,
18509 optimize_scans_in_name.as_ptr(),
18510 optimize_scans_in,
18511 quant_table_in_name.as_ptr(),
18512 quant_table_in,
18513 subsample_mode_in_name.as_ptr(),
18514 subsample_mode_in,
18515 restart_interval_in_name.as_ptr(),
18516 restart_interval_in,
18517 keep_in_name.as_ptr(),
18518 keep_in,
18519 background_in_name.as_ptr(),
18520 background_in,
18521 page_height_in_name.as_ptr(),
18522 page_height_in,
18523 profile_in_name.as_ptr(),
18524 profile_in.as_ptr(),
18525 NULL,
18526 );
18527 utils::result(vips_op_response, (), Error::JpegsaveError)
18528 }
18529}
18530
18531pub fn jpegsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
18535 unsafe {
18536 let inp_in: *mut bindings::VipsImage = inp.ctx;
18537 let mut buffer_buf_size: u64 = 0;
18538 let mut buffer_out: *mut c_void = null_mut();
18539
18540 let vips_op_response =
18541 bindings::vips_jpegsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
18542 utils::result(
18543 vips_op_response,
18544 utils::new_byte_array(buffer_out, buffer_buf_size),
18545 Error::JpegsaveBufferError,
18546 )
18547 }
18548}
18549
18550#[derive(Clone, Debug)]
18552pub struct JpegsaveBufferOptions {
18553 pub q: i32,
18556 pub optimize_coding: bool,
18559 pub interlace: bool,
18562 pub trellis_quant: bool,
18565 pub overshoot_deringing: bool,
18568 pub optimize_scans: bool,
18571 pub quant_table: i32,
18574 pub subsample_mode: ForeignSubsample,
18580 pub restart_interval: i32,
18583 pub keep: ForeignKeep,
18592 pub background: Vec<f64>,
18594 pub page_height: i32,
18597 pub profile: String,
18599}
18600
18601impl std::default::Default for JpegsaveBufferOptions {
18602 fn default() -> Self {
18603 JpegsaveBufferOptions {
18604 q: i32::from(75),
18605 optimize_coding: false,
18606 interlace: false,
18607 trellis_quant: false,
18608 overshoot_deringing: false,
18609 optimize_scans: false,
18610 quant_table: i32::from(0),
18611 subsample_mode: ForeignSubsample::Auto,
18612 restart_interval: i32::from(0),
18613 keep: ForeignKeep::All,
18614 background: Vec::new(),
18615 page_height: i32::from(0),
18616 profile: String::from("sRGB"),
18617 }
18618 }
18619}
18620
18621pub fn jpegsave_buffer_with_opts(
18626 inp: &VipsImage,
18627 jpegsave_buffer_options: &JpegsaveBufferOptions,
18628) -> Result<Vec<u8>> {
18629 unsafe {
18630 let inp_in: *mut bindings::VipsImage = inp.ctx;
18631 let mut buffer_buf_size: u64 = 0;
18632 let mut buffer_out: *mut c_void = null_mut();
18633
18634 let q_in: i32 = jpegsave_buffer_options.q;
18635 let q_in_name = utils::new_c_string("Q")?;
18636
18637 let optimize_coding_in: i32 = if jpegsave_buffer_options.optimize_coding {
18638 1
18639 } else {
18640 0
18641 };
18642 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18643
18644 let interlace_in: i32 = if jpegsave_buffer_options.interlace {
18645 1
18646 } else {
18647 0
18648 };
18649 let interlace_in_name = utils::new_c_string("interlace")?;
18650
18651 let trellis_quant_in: i32 = if jpegsave_buffer_options.trellis_quant {
18652 1
18653 } else {
18654 0
18655 };
18656 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18657
18658 let overshoot_deringing_in: i32 = if jpegsave_buffer_options.overshoot_deringing {
18659 1
18660 } else {
18661 0
18662 };
18663 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18664
18665 let optimize_scans_in: i32 = if jpegsave_buffer_options.optimize_scans {
18666 1
18667 } else {
18668 0
18669 };
18670 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18671
18672 let quant_table_in: i32 = jpegsave_buffer_options.quant_table;
18673 let quant_table_in_name = utils::new_c_string("quant-table")?;
18674
18675 let subsample_mode_in: i32 = jpegsave_buffer_options.subsample_mode as i32;
18676 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18677
18678 let restart_interval_in: i32 = jpegsave_buffer_options.restart_interval;
18679 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18680
18681 let keep_in: i32 = jpegsave_buffer_options.keep as i32;
18682 let keep_in_name = utils::new_c_string("keep")?;
18683
18684 let background_wrapper =
18685 utils::VipsArrayDoubleWrapper::from(&jpegsave_buffer_options.background[..]);
18686 let background_in = background_wrapper.ctx;
18687 let background_in_name = utils::new_c_string("background")?;
18688
18689 let page_height_in: i32 = jpegsave_buffer_options.page_height;
18690 let page_height_in_name = utils::new_c_string("page-height")?;
18691
18692 let profile_in: CString = utils::new_c_string(&jpegsave_buffer_options.profile)?;
18693 let profile_in_name = utils::new_c_string("profile")?;
18694
18695 let vips_op_response = bindings::vips_jpegsave_buffer(
18696 inp_in,
18697 &mut buffer_out,
18698 &mut buffer_buf_size,
18699 q_in_name.as_ptr(),
18700 q_in,
18701 optimize_coding_in_name.as_ptr(),
18702 optimize_coding_in,
18703 interlace_in_name.as_ptr(),
18704 interlace_in,
18705 trellis_quant_in_name.as_ptr(),
18706 trellis_quant_in,
18707 overshoot_deringing_in_name.as_ptr(),
18708 overshoot_deringing_in,
18709 optimize_scans_in_name.as_ptr(),
18710 optimize_scans_in,
18711 quant_table_in_name.as_ptr(),
18712 quant_table_in,
18713 subsample_mode_in_name.as_ptr(),
18714 subsample_mode_in,
18715 restart_interval_in_name.as_ptr(),
18716 restart_interval_in,
18717 keep_in_name.as_ptr(),
18718 keep_in,
18719 background_in_name.as_ptr(),
18720 background_in,
18721 page_height_in_name.as_ptr(),
18722 page_height_in,
18723 profile_in_name.as_ptr(),
18724 profile_in.as_ptr(),
18725 NULL,
18726 );
18727 utils::result(
18728 vips_op_response,
18729 utils::new_byte_array(buffer_out, buffer_buf_size),
18730 Error::JpegsaveBufferError,
18731 )
18732 }
18733}
18734
18735pub fn jpegsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
18740 unsafe {
18741 let inp_in: *mut bindings::VipsImage = inp.ctx;
18742 let target_in: *mut bindings::VipsTarget = target.ctx;
18743
18744 let vips_op_response = bindings::vips_jpegsave_target(inp_in, target_in, NULL);
18745 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
18746 }
18747}
18748
18749#[derive(Clone, Debug)]
18751pub struct JpegsaveTargetOptions {
18752 pub q: i32,
18755 pub optimize_coding: bool,
18758 pub interlace: bool,
18761 pub trellis_quant: bool,
18764 pub overshoot_deringing: bool,
18767 pub optimize_scans: bool,
18770 pub quant_table: i32,
18773 pub subsample_mode: ForeignSubsample,
18779 pub restart_interval: i32,
18782 pub keep: ForeignKeep,
18791 pub background: Vec<f64>,
18793 pub page_height: i32,
18796 pub profile: String,
18798}
18799
18800impl std::default::Default for JpegsaveTargetOptions {
18801 fn default() -> Self {
18802 JpegsaveTargetOptions {
18803 q: i32::from(75),
18804 optimize_coding: false,
18805 interlace: false,
18806 trellis_quant: false,
18807 overshoot_deringing: false,
18808 optimize_scans: false,
18809 quant_table: i32::from(0),
18810 subsample_mode: ForeignSubsample::Auto,
18811 restart_interval: i32::from(0),
18812 keep: ForeignKeep::All,
18813 background: Vec::new(),
18814 page_height: i32::from(0),
18815 profile: String::from("sRGB"),
18816 }
18817 }
18818}
18819
18820pub fn jpegsave_target_with_opts(
18826 inp: &VipsImage,
18827 target: &VipsTarget,
18828 jpegsave_target_options: &JpegsaveTargetOptions,
18829) -> Result<()> {
18830 unsafe {
18831 let inp_in: *mut bindings::VipsImage = inp.ctx;
18832 let target_in: *mut bindings::VipsTarget = target.ctx;
18833
18834 let q_in: i32 = jpegsave_target_options.q;
18835 let q_in_name = utils::new_c_string("Q")?;
18836
18837 let optimize_coding_in: i32 = if jpegsave_target_options.optimize_coding {
18838 1
18839 } else {
18840 0
18841 };
18842 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
18843
18844 let interlace_in: i32 = if jpegsave_target_options.interlace {
18845 1
18846 } else {
18847 0
18848 };
18849 let interlace_in_name = utils::new_c_string("interlace")?;
18850
18851 let trellis_quant_in: i32 = if jpegsave_target_options.trellis_quant {
18852 1
18853 } else {
18854 0
18855 };
18856 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
18857
18858 let overshoot_deringing_in: i32 = if jpegsave_target_options.overshoot_deringing {
18859 1
18860 } else {
18861 0
18862 };
18863 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
18864
18865 let optimize_scans_in: i32 = if jpegsave_target_options.optimize_scans {
18866 1
18867 } else {
18868 0
18869 };
18870 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
18871
18872 let quant_table_in: i32 = jpegsave_target_options.quant_table;
18873 let quant_table_in_name = utils::new_c_string("quant-table")?;
18874
18875 let subsample_mode_in: i32 = jpegsave_target_options.subsample_mode as i32;
18876 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
18877
18878 let restart_interval_in: i32 = jpegsave_target_options.restart_interval;
18879 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
18880
18881 let keep_in: i32 = jpegsave_target_options.keep as i32;
18882 let keep_in_name = utils::new_c_string("keep")?;
18883
18884 let background_wrapper =
18885 utils::VipsArrayDoubleWrapper::from(&jpegsave_target_options.background[..]);
18886 let background_in = background_wrapper.ctx;
18887 let background_in_name = utils::new_c_string("background")?;
18888
18889 let page_height_in: i32 = jpegsave_target_options.page_height;
18890 let page_height_in_name = utils::new_c_string("page-height")?;
18891
18892 let profile_in: CString = utils::new_c_string(&jpegsave_target_options.profile)?;
18893 let profile_in_name = utils::new_c_string("profile")?;
18894
18895 let vips_op_response = bindings::vips_jpegsave_target(
18896 inp_in,
18897 target_in,
18898 q_in_name.as_ptr(),
18899 q_in,
18900 optimize_coding_in_name.as_ptr(),
18901 optimize_coding_in,
18902 interlace_in_name.as_ptr(),
18903 interlace_in,
18904 trellis_quant_in_name.as_ptr(),
18905 trellis_quant_in,
18906 overshoot_deringing_in_name.as_ptr(),
18907 overshoot_deringing_in,
18908 optimize_scans_in_name.as_ptr(),
18909 optimize_scans_in,
18910 quant_table_in_name.as_ptr(),
18911 quant_table_in,
18912 subsample_mode_in_name.as_ptr(),
18913 subsample_mode_in,
18914 restart_interval_in_name.as_ptr(),
18915 restart_interval_in,
18916 keep_in_name.as_ptr(),
18917 keep_in,
18918 background_in_name.as_ptr(),
18919 background_in,
18920 page_height_in_name.as_ptr(),
18921 page_height_in,
18922 profile_in_name.as_ptr(),
18923 profile_in.as_ptr(),
18924 NULL,
18925 );
18926 utils::result(vips_op_response, (), Error::JpegsaveTargetError)
18927 }
18928}
18929
18930pub fn jpegsave_mime(inp: &VipsImage) -> Result<()> {
18934 unsafe {
18935 let inp_in: *mut bindings::VipsImage = inp.ctx;
18936
18937 let vips_op_response = bindings::vips_jpegsave_mime(inp_in, NULL);
18938 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
18939 }
18940}
18941
18942#[derive(Clone, Debug)]
18944pub struct JpegsaveMimeOptions {
18945 pub q: i32,
18948 pub optimize_coding: bool,
18951 pub interlace: bool,
18954 pub trellis_quant: bool,
18957 pub overshoot_deringing: bool,
18960 pub optimize_scans: bool,
18963 pub quant_table: i32,
18966 pub subsample_mode: ForeignSubsample,
18972 pub restart_interval: i32,
18975 pub keep: ForeignKeep,
18984 pub background: Vec<f64>,
18986 pub page_height: i32,
18989 pub profile: String,
18991}
18992
18993impl std::default::Default for JpegsaveMimeOptions {
18994 fn default() -> Self {
18995 JpegsaveMimeOptions {
18996 q: i32::from(75),
18997 optimize_coding: false,
18998 interlace: false,
18999 trellis_quant: false,
19000 overshoot_deringing: false,
19001 optimize_scans: false,
19002 quant_table: i32::from(0),
19003 subsample_mode: ForeignSubsample::Auto,
19004 restart_interval: i32::from(0),
19005 keep: ForeignKeep::All,
19006 background: Vec::new(),
19007 page_height: i32::from(0),
19008 profile: String::from("sRGB"),
19009 }
19010 }
19011}
19012
19013pub fn jpegsave_mime_with_opts(
19018 inp: &VipsImage,
19019 jpegsave_mime_options: &JpegsaveMimeOptions,
19020) -> Result<()> {
19021 unsafe {
19022 let inp_in: *mut bindings::VipsImage = inp.ctx;
19023
19024 let q_in: i32 = jpegsave_mime_options.q;
19025 let q_in_name = utils::new_c_string("Q")?;
19026
19027 let optimize_coding_in: i32 = if jpegsave_mime_options.optimize_coding {
19028 1
19029 } else {
19030 0
19031 };
19032 let optimize_coding_in_name = utils::new_c_string("optimize-coding")?;
19033
19034 let interlace_in: i32 = if jpegsave_mime_options.interlace {
19035 1
19036 } else {
19037 0
19038 };
19039 let interlace_in_name = utils::new_c_string("interlace")?;
19040
19041 let trellis_quant_in: i32 = if jpegsave_mime_options.trellis_quant {
19042 1
19043 } else {
19044 0
19045 };
19046 let trellis_quant_in_name = utils::new_c_string("trellis-quant")?;
19047
19048 let overshoot_deringing_in: i32 = if jpegsave_mime_options.overshoot_deringing {
19049 1
19050 } else {
19051 0
19052 };
19053 let overshoot_deringing_in_name = utils::new_c_string("overshoot-deringing")?;
19054
19055 let optimize_scans_in: i32 = if jpegsave_mime_options.optimize_scans {
19056 1
19057 } else {
19058 0
19059 };
19060 let optimize_scans_in_name = utils::new_c_string("optimize-scans")?;
19061
19062 let quant_table_in: i32 = jpegsave_mime_options.quant_table;
19063 let quant_table_in_name = utils::new_c_string("quant-table")?;
19064
19065 let subsample_mode_in: i32 = jpegsave_mime_options.subsample_mode as i32;
19066 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
19067
19068 let restart_interval_in: i32 = jpegsave_mime_options.restart_interval;
19069 let restart_interval_in_name = utils::new_c_string("restart-interval")?;
19070
19071 let keep_in: i32 = jpegsave_mime_options.keep as i32;
19072 let keep_in_name = utils::new_c_string("keep")?;
19073
19074 let background_wrapper =
19075 utils::VipsArrayDoubleWrapper::from(&jpegsave_mime_options.background[..]);
19076 let background_in = background_wrapper.ctx;
19077 let background_in_name = utils::new_c_string("background")?;
19078
19079 let page_height_in: i32 = jpegsave_mime_options.page_height;
19080 let page_height_in_name = utils::new_c_string("page-height")?;
19081
19082 let profile_in: CString = utils::new_c_string(&jpegsave_mime_options.profile)?;
19083 let profile_in_name = utils::new_c_string("profile")?;
19084
19085 let vips_op_response = bindings::vips_jpegsave_mime(
19086 inp_in,
19087 q_in_name.as_ptr(),
19088 q_in,
19089 optimize_coding_in_name.as_ptr(),
19090 optimize_coding_in,
19091 interlace_in_name.as_ptr(),
19092 interlace_in,
19093 trellis_quant_in_name.as_ptr(),
19094 trellis_quant_in,
19095 overshoot_deringing_in_name.as_ptr(),
19096 overshoot_deringing_in,
19097 optimize_scans_in_name.as_ptr(),
19098 optimize_scans_in,
19099 quant_table_in_name.as_ptr(),
19100 quant_table_in,
19101 subsample_mode_in_name.as_ptr(),
19102 subsample_mode_in,
19103 restart_interval_in_name.as_ptr(),
19104 restart_interval_in,
19105 keep_in_name.as_ptr(),
19106 keep_in,
19107 background_in_name.as_ptr(),
19108 background_in,
19109 page_height_in_name.as_ptr(),
19110 page_height_in,
19111 profile_in_name.as_ptr(),
19112 profile_in.as_ptr(),
19113 NULL,
19114 );
19115 utils::result(vips_op_response, (), Error::JpegsaveMimeError)
19116 }
19117}
19118
19119pub fn webpsave(inp: &VipsImage, filename: &str) -> Result<()> {
19124 unsafe {
19125 let inp_in: *mut bindings::VipsImage = inp.ctx;
19126 let filename_in: CString = utils::new_c_string(filename)?;
19127
19128 let vips_op_response = bindings::vips_webpsave(inp_in, filename_in.as_ptr(), NULL);
19129 utils::result(vips_op_response, (), Error::WebpsaveError)
19130 }
19131}
19132
19133#[derive(Clone, Debug)]
19135pub struct WebpsaveOptions {
19136 pub q: i32,
19139 pub lossless: bool,
19142 pub preset: ForeignWebpPreset,
19151 pub smart_subsample: bool,
19154 pub near_lossless: bool,
19157 pub alpha_q: i32,
19160 pub min_size: bool,
19163 pub kmin: i32,
19166 pub kmax: i32,
19169 pub effort: i32,
19172 pub mixed: bool,
19175 pub keep: ForeignKeep,
19184 pub background: Vec<f64>,
19186 pub page_height: i32,
19189 pub profile: String,
19191}
19192
19193impl std::default::Default for WebpsaveOptions {
19194 fn default() -> Self {
19195 WebpsaveOptions {
19196 q: i32::from(75),
19197 lossless: false,
19198 preset: ForeignWebpPreset::Default,
19199 smart_subsample: false,
19200 near_lossless: false,
19201 alpha_q: i32::from(100),
19202 min_size: false,
19203 kmin: i32::from(2147483646),
19204 kmax: i32::from(2147483647),
19205 effort: i32::from(4),
19206 mixed: false,
19207 keep: ForeignKeep::All,
19208 background: Vec::new(),
19209 page_height: i32::from(0),
19210 profile: String::from("sRGB"),
19211 }
19212 }
19213}
19214
19215pub fn webpsave_with_opts(
19221 inp: &VipsImage,
19222 filename: &str,
19223 webpsave_options: &WebpsaveOptions,
19224) -> Result<()> {
19225 unsafe {
19226 let inp_in: *mut bindings::VipsImage = inp.ctx;
19227 let filename_in: CString = utils::new_c_string(filename)?;
19228
19229 let q_in: i32 = webpsave_options.q;
19230 let q_in_name = utils::new_c_string("Q")?;
19231
19232 let lossless_in: i32 = if webpsave_options.lossless { 1 } else { 0 };
19233 let lossless_in_name = utils::new_c_string("lossless")?;
19234
19235 let preset_in: i32 = webpsave_options.preset as i32;
19236 let preset_in_name = utils::new_c_string("preset")?;
19237
19238 let smart_subsample_in: i32 = if webpsave_options.smart_subsample {
19239 1
19240 } else {
19241 0
19242 };
19243 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19244
19245 let near_lossless_in: i32 = if webpsave_options.near_lossless { 1 } else { 0 };
19246 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19247
19248 let alpha_q_in: i32 = webpsave_options.alpha_q;
19249 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19250
19251 let min_size_in: i32 = if webpsave_options.min_size { 1 } else { 0 };
19252 let min_size_in_name = utils::new_c_string("min-size")?;
19253
19254 let kmin_in: i32 = webpsave_options.kmin;
19255 let kmin_in_name = utils::new_c_string("kmin")?;
19256
19257 let kmax_in: i32 = webpsave_options.kmax;
19258 let kmax_in_name = utils::new_c_string("kmax")?;
19259
19260 let effort_in: i32 = webpsave_options.effort;
19261 let effort_in_name = utils::new_c_string("effort")?;
19262
19263 let mixed_in: i32 = if webpsave_options.mixed { 1 } else { 0 };
19264 let mixed_in_name = utils::new_c_string("mixed")?;
19265
19266 let keep_in: i32 = webpsave_options.keep as i32;
19267 let keep_in_name = utils::new_c_string("keep")?;
19268
19269 let background_wrapper =
19270 utils::VipsArrayDoubleWrapper::from(&webpsave_options.background[..]);
19271 let background_in = background_wrapper.ctx;
19272 let background_in_name = utils::new_c_string("background")?;
19273
19274 let page_height_in: i32 = webpsave_options.page_height;
19275 let page_height_in_name = utils::new_c_string("page-height")?;
19276
19277 let profile_in: CString = utils::new_c_string(&webpsave_options.profile)?;
19278 let profile_in_name = utils::new_c_string("profile")?;
19279
19280 let vips_op_response = bindings::vips_webpsave(
19281 inp_in,
19282 filename_in.as_ptr(),
19283 q_in_name.as_ptr(),
19284 q_in,
19285 lossless_in_name.as_ptr(),
19286 lossless_in,
19287 preset_in_name.as_ptr(),
19288 preset_in,
19289 smart_subsample_in_name.as_ptr(),
19290 smart_subsample_in,
19291 near_lossless_in_name.as_ptr(),
19292 near_lossless_in,
19293 alpha_q_in_name.as_ptr(),
19294 alpha_q_in,
19295 min_size_in_name.as_ptr(),
19296 min_size_in,
19297 kmin_in_name.as_ptr(),
19298 kmin_in,
19299 kmax_in_name.as_ptr(),
19300 kmax_in,
19301 effort_in_name.as_ptr(),
19302 effort_in,
19303 mixed_in_name.as_ptr(),
19304 mixed_in,
19305 keep_in_name.as_ptr(),
19306 keep_in,
19307 background_in_name.as_ptr(),
19308 background_in,
19309 page_height_in_name.as_ptr(),
19310 page_height_in,
19311 profile_in_name.as_ptr(),
19312 profile_in.as_ptr(),
19313 NULL,
19314 );
19315 utils::result(vips_op_response, (), Error::WebpsaveError)
19316 }
19317}
19318
19319pub fn webpsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
19323 unsafe {
19324 let inp_in: *mut bindings::VipsImage = inp.ctx;
19325 let mut buffer_buf_size: u64 = 0;
19326 let mut buffer_out: *mut c_void = null_mut();
19327
19328 let vips_op_response =
19329 bindings::vips_webpsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
19330 utils::result(
19331 vips_op_response,
19332 utils::new_byte_array(buffer_out, buffer_buf_size),
19333 Error::WebpsaveBufferError,
19334 )
19335 }
19336}
19337
19338#[derive(Clone, Debug)]
19340pub struct WebpsaveBufferOptions {
19341 pub q: i32,
19344 pub lossless: bool,
19347 pub preset: ForeignWebpPreset,
19356 pub smart_subsample: bool,
19359 pub near_lossless: bool,
19362 pub alpha_q: i32,
19365 pub min_size: bool,
19368 pub kmin: i32,
19371 pub kmax: i32,
19374 pub effort: i32,
19377 pub mixed: bool,
19380 pub keep: ForeignKeep,
19389 pub background: Vec<f64>,
19391 pub page_height: i32,
19394 pub profile: String,
19396}
19397
19398impl std::default::Default for WebpsaveBufferOptions {
19399 fn default() -> Self {
19400 WebpsaveBufferOptions {
19401 q: i32::from(75),
19402 lossless: false,
19403 preset: ForeignWebpPreset::Default,
19404 smart_subsample: false,
19405 near_lossless: false,
19406 alpha_q: i32::from(100),
19407 min_size: false,
19408 kmin: i32::from(2147483646),
19409 kmax: i32::from(2147483647),
19410 effort: i32::from(4),
19411 mixed: false,
19412 keep: ForeignKeep::All,
19413 background: Vec::new(),
19414 page_height: i32::from(0),
19415 profile: String::from("sRGB"),
19416 }
19417 }
19418}
19419
19420pub fn webpsave_buffer_with_opts(
19425 inp: &VipsImage,
19426 webpsave_buffer_options: &WebpsaveBufferOptions,
19427) -> Result<Vec<u8>> {
19428 unsafe {
19429 let inp_in: *mut bindings::VipsImage = inp.ctx;
19430 let mut buffer_buf_size: u64 = 0;
19431 let mut buffer_out: *mut c_void = null_mut();
19432
19433 let q_in: i32 = webpsave_buffer_options.q;
19434 let q_in_name = utils::new_c_string("Q")?;
19435
19436 let lossless_in: i32 = if webpsave_buffer_options.lossless {
19437 1
19438 } else {
19439 0
19440 };
19441 let lossless_in_name = utils::new_c_string("lossless")?;
19442
19443 let preset_in: i32 = webpsave_buffer_options.preset as i32;
19444 let preset_in_name = utils::new_c_string("preset")?;
19445
19446 let smart_subsample_in: i32 = if webpsave_buffer_options.smart_subsample {
19447 1
19448 } else {
19449 0
19450 };
19451 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19452
19453 let near_lossless_in: i32 = if webpsave_buffer_options.near_lossless {
19454 1
19455 } else {
19456 0
19457 };
19458 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19459
19460 let alpha_q_in: i32 = webpsave_buffer_options.alpha_q;
19461 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19462
19463 let min_size_in: i32 = if webpsave_buffer_options.min_size {
19464 1
19465 } else {
19466 0
19467 };
19468 let min_size_in_name = utils::new_c_string("min-size")?;
19469
19470 let kmin_in: i32 = webpsave_buffer_options.kmin;
19471 let kmin_in_name = utils::new_c_string("kmin")?;
19472
19473 let kmax_in: i32 = webpsave_buffer_options.kmax;
19474 let kmax_in_name = utils::new_c_string("kmax")?;
19475
19476 let effort_in: i32 = webpsave_buffer_options.effort;
19477 let effort_in_name = utils::new_c_string("effort")?;
19478
19479 let mixed_in: i32 = if webpsave_buffer_options.mixed { 1 } else { 0 };
19480 let mixed_in_name = utils::new_c_string("mixed")?;
19481
19482 let keep_in: i32 = webpsave_buffer_options.keep as i32;
19483 let keep_in_name = utils::new_c_string("keep")?;
19484
19485 let background_wrapper =
19486 utils::VipsArrayDoubleWrapper::from(&webpsave_buffer_options.background[..]);
19487 let background_in = background_wrapper.ctx;
19488 let background_in_name = utils::new_c_string("background")?;
19489
19490 let page_height_in: i32 = webpsave_buffer_options.page_height;
19491 let page_height_in_name = utils::new_c_string("page-height")?;
19492
19493 let profile_in: CString = utils::new_c_string(&webpsave_buffer_options.profile)?;
19494 let profile_in_name = utils::new_c_string("profile")?;
19495
19496 let vips_op_response = bindings::vips_webpsave_buffer(
19497 inp_in,
19498 &mut buffer_out,
19499 &mut buffer_buf_size,
19500 q_in_name.as_ptr(),
19501 q_in,
19502 lossless_in_name.as_ptr(),
19503 lossless_in,
19504 preset_in_name.as_ptr(),
19505 preset_in,
19506 smart_subsample_in_name.as_ptr(),
19507 smart_subsample_in,
19508 near_lossless_in_name.as_ptr(),
19509 near_lossless_in,
19510 alpha_q_in_name.as_ptr(),
19511 alpha_q_in,
19512 min_size_in_name.as_ptr(),
19513 min_size_in,
19514 kmin_in_name.as_ptr(),
19515 kmin_in,
19516 kmax_in_name.as_ptr(),
19517 kmax_in,
19518 effort_in_name.as_ptr(),
19519 effort_in,
19520 mixed_in_name.as_ptr(),
19521 mixed_in,
19522 keep_in_name.as_ptr(),
19523 keep_in,
19524 background_in_name.as_ptr(),
19525 background_in,
19526 page_height_in_name.as_ptr(),
19527 page_height_in,
19528 profile_in_name.as_ptr(),
19529 profile_in.as_ptr(),
19530 NULL,
19531 );
19532 utils::result(
19533 vips_op_response,
19534 utils::new_byte_array(buffer_out, buffer_buf_size),
19535 Error::WebpsaveBufferError,
19536 )
19537 }
19538}
19539
19540pub fn webpsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
19545 unsafe {
19546 let inp_in: *mut bindings::VipsImage = inp.ctx;
19547 let target_in: *mut bindings::VipsTarget = target.ctx;
19548
19549 let vips_op_response = bindings::vips_webpsave_target(inp_in, target_in, NULL);
19550 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
19551 }
19552}
19553
19554#[derive(Clone, Debug)]
19556pub struct WebpsaveTargetOptions {
19557 pub q: i32,
19560 pub lossless: bool,
19563 pub preset: ForeignWebpPreset,
19572 pub smart_subsample: bool,
19575 pub near_lossless: bool,
19578 pub alpha_q: i32,
19581 pub min_size: bool,
19584 pub kmin: i32,
19587 pub kmax: i32,
19590 pub effort: i32,
19593 pub mixed: bool,
19596 pub keep: ForeignKeep,
19605 pub background: Vec<f64>,
19607 pub page_height: i32,
19610 pub profile: String,
19612}
19613
19614impl std::default::Default for WebpsaveTargetOptions {
19615 fn default() -> Self {
19616 WebpsaveTargetOptions {
19617 q: i32::from(75),
19618 lossless: false,
19619 preset: ForeignWebpPreset::Default,
19620 smart_subsample: false,
19621 near_lossless: false,
19622 alpha_q: i32::from(100),
19623 min_size: false,
19624 kmin: i32::from(2147483646),
19625 kmax: i32::from(2147483647),
19626 effort: i32::from(4),
19627 mixed: false,
19628 keep: ForeignKeep::All,
19629 background: Vec::new(),
19630 page_height: i32::from(0),
19631 profile: String::from("sRGB"),
19632 }
19633 }
19634}
19635
19636pub fn webpsave_target_with_opts(
19642 inp: &VipsImage,
19643 target: &VipsTarget,
19644 webpsave_target_options: &WebpsaveTargetOptions,
19645) -> Result<()> {
19646 unsafe {
19647 let inp_in: *mut bindings::VipsImage = inp.ctx;
19648 let target_in: *mut bindings::VipsTarget = target.ctx;
19649
19650 let q_in: i32 = webpsave_target_options.q;
19651 let q_in_name = utils::new_c_string("Q")?;
19652
19653 let lossless_in: i32 = if webpsave_target_options.lossless {
19654 1
19655 } else {
19656 0
19657 };
19658 let lossless_in_name = utils::new_c_string("lossless")?;
19659
19660 let preset_in: i32 = webpsave_target_options.preset as i32;
19661 let preset_in_name = utils::new_c_string("preset")?;
19662
19663 let smart_subsample_in: i32 = if webpsave_target_options.smart_subsample {
19664 1
19665 } else {
19666 0
19667 };
19668 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19669
19670 let near_lossless_in: i32 = if webpsave_target_options.near_lossless {
19671 1
19672 } else {
19673 0
19674 };
19675 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19676
19677 let alpha_q_in: i32 = webpsave_target_options.alpha_q;
19678 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19679
19680 let min_size_in: i32 = if webpsave_target_options.min_size {
19681 1
19682 } else {
19683 0
19684 };
19685 let min_size_in_name = utils::new_c_string("min-size")?;
19686
19687 let kmin_in: i32 = webpsave_target_options.kmin;
19688 let kmin_in_name = utils::new_c_string("kmin")?;
19689
19690 let kmax_in: i32 = webpsave_target_options.kmax;
19691 let kmax_in_name = utils::new_c_string("kmax")?;
19692
19693 let effort_in: i32 = webpsave_target_options.effort;
19694 let effort_in_name = utils::new_c_string("effort")?;
19695
19696 let mixed_in: i32 = if webpsave_target_options.mixed { 1 } else { 0 };
19697 let mixed_in_name = utils::new_c_string("mixed")?;
19698
19699 let keep_in: i32 = webpsave_target_options.keep as i32;
19700 let keep_in_name = utils::new_c_string("keep")?;
19701
19702 let background_wrapper =
19703 utils::VipsArrayDoubleWrapper::from(&webpsave_target_options.background[..]);
19704 let background_in = background_wrapper.ctx;
19705 let background_in_name = utils::new_c_string("background")?;
19706
19707 let page_height_in: i32 = webpsave_target_options.page_height;
19708 let page_height_in_name = utils::new_c_string("page-height")?;
19709
19710 let profile_in: CString = utils::new_c_string(&webpsave_target_options.profile)?;
19711 let profile_in_name = utils::new_c_string("profile")?;
19712
19713 let vips_op_response = bindings::vips_webpsave_target(
19714 inp_in,
19715 target_in,
19716 q_in_name.as_ptr(),
19717 q_in,
19718 lossless_in_name.as_ptr(),
19719 lossless_in,
19720 preset_in_name.as_ptr(),
19721 preset_in,
19722 smart_subsample_in_name.as_ptr(),
19723 smart_subsample_in,
19724 near_lossless_in_name.as_ptr(),
19725 near_lossless_in,
19726 alpha_q_in_name.as_ptr(),
19727 alpha_q_in,
19728 min_size_in_name.as_ptr(),
19729 min_size_in,
19730 kmin_in_name.as_ptr(),
19731 kmin_in,
19732 kmax_in_name.as_ptr(),
19733 kmax_in,
19734 effort_in_name.as_ptr(),
19735 effort_in,
19736 mixed_in_name.as_ptr(),
19737 mixed_in,
19738 keep_in_name.as_ptr(),
19739 keep_in,
19740 background_in_name.as_ptr(),
19741 background_in,
19742 page_height_in_name.as_ptr(),
19743 page_height_in,
19744 profile_in_name.as_ptr(),
19745 profile_in.as_ptr(),
19746 NULL,
19747 );
19748 utils::result(vips_op_response, (), Error::WebpsaveTargetError)
19749 }
19750}
19751
19752pub fn webpsave_mime(inp: &VipsImage) -> Result<()> {
19756 unsafe {
19757 let inp_in: *mut bindings::VipsImage = inp.ctx;
19758
19759 let vips_op_response = bindings::vips_webpsave_mime(inp_in, NULL);
19760 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
19761 }
19762}
19763
19764#[derive(Clone, Debug)]
19766pub struct WebpsaveMimeOptions {
19767 pub q: i32,
19770 pub lossless: bool,
19773 pub preset: ForeignWebpPreset,
19782 pub smart_subsample: bool,
19785 pub near_lossless: bool,
19788 pub alpha_q: i32,
19791 pub min_size: bool,
19794 pub kmin: i32,
19797 pub kmax: i32,
19800 pub effort: i32,
19803 pub mixed: bool,
19806 pub keep: ForeignKeep,
19815 pub background: Vec<f64>,
19817 pub page_height: i32,
19820 pub profile: String,
19822}
19823
19824impl std::default::Default for WebpsaveMimeOptions {
19825 fn default() -> Self {
19826 WebpsaveMimeOptions {
19827 q: i32::from(75),
19828 lossless: false,
19829 preset: ForeignWebpPreset::Default,
19830 smart_subsample: false,
19831 near_lossless: false,
19832 alpha_q: i32::from(100),
19833 min_size: false,
19834 kmin: i32::from(2147483646),
19835 kmax: i32::from(2147483647),
19836 effort: i32::from(4),
19837 mixed: false,
19838 keep: ForeignKeep::All,
19839 background: Vec::new(),
19840 page_height: i32::from(0),
19841 profile: String::from("sRGB"),
19842 }
19843 }
19844}
19845
19846pub fn webpsave_mime_with_opts(
19851 inp: &VipsImage,
19852 webpsave_mime_options: &WebpsaveMimeOptions,
19853) -> Result<()> {
19854 unsafe {
19855 let inp_in: *mut bindings::VipsImage = inp.ctx;
19856
19857 let q_in: i32 = webpsave_mime_options.q;
19858 let q_in_name = utils::new_c_string("Q")?;
19859
19860 let lossless_in: i32 = if webpsave_mime_options.lossless { 1 } else { 0 };
19861 let lossless_in_name = utils::new_c_string("lossless")?;
19862
19863 let preset_in: i32 = webpsave_mime_options.preset as i32;
19864 let preset_in_name = utils::new_c_string("preset")?;
19865
19866 let smart_subsample_in: i32 = if webpsave_mime_options.smart_subsample {
19867 1
19868 } else {
19869 0
19870 };
19871 let smart_subsample_in_name = utils::new_c_string("smart-subsample")?;
19872
19873 let near_lossless_in: i32 = if webpsave_mime_options.near_lossless {
19874 1
19875 } else {
19876 0
19877 };
19878 let near_lossless_in_name = utils::new_c_string("near-lossless")?;
19879
19880 let alpha_q_in: i32 = webpsave_mime_options.alpha_q;
19881 let alpha_q_in_name = utils::new_c_string("alpha-q")?;
19882
19883 let min_size_in: i32 = if webpsave_mime_options.min_size { 1 } else { 0 };
19884 let min_size_in_name = utils::new_c_string("min-size")?;
19885
19886 let kmin_in: i32 = webpsave_mime_options.kmin;
19887 let kmin_in_name = utils::new_c_string("kmin")?;
19888
19889 let kmax_in: i32 = webpsave_mime_options.kmax;
19890 let kmax_in_name = utils::new_c_string("kmax")?;
19891
19892 let effort_in: i32 = webpsave_mime_options.effort;
19893 let effort_in_name = utils::new_c_string("effort")?;
19894
19895 let mixed_in: i32 = if webpsave_mime_options.mixed { 1 } else { 0 };
19896 let mixed_in_name = utils::new_c_string("mixed")?;
19897
19898 let keep_in: i32 = webpsave_mime_options.keep as i32;
19899 let keep_in_name = utils::new_c_string("keep")?;
19900
19901 let background_wrapper =
19902 utils::VipsArrayDoubleWrapper::from(&webpsave_mime_options.background[..]);
19903 let background_in = background_wrapper.ctx;
19904 let background_in_name = utils::new_c_string("background")?;
19905
19906 let page_height_in: i32 = webpsave_mime_options.page_height;
19907 let page_height_in_name = utils::new_c_string("page-height")?;
19908
19909 let profile_in: CString = utils::new_c_string(&webpsave_mime_options.profile)?;
19910 let profile_in_name = utils::new_c_string("profile")?;
19911
19912 let vips_op_response = bindings::vips_webpsave_mime(
19913 inp_in,
19914 q_in_name.as_ptr(),
19915 q_in,
19916 lossless_in_name.as_ptr(),
19917 lossless_in,
19918 preset_in_name.as_ptr(),
19919 preset_in,
19920 smart_subsample_in_name.as_ptr(),
19921 smart_subsample_in,
19922 near_lossless_in_name.as_ptr(),
19923 near_lossless_in,
19924 alpha_q_in_name.as_ptr(),
19925 alpha_q_in,
19926 min_size_in_name.as_ptr(),
19927 min_size_in,
19928 kmin_in_name.as_ptr(),
19929 kmin_in,
19930 kmax_in_name.as_ptr(),
19931 kmax_in,
19932 effort_in_name.as_ptr(),
19933 effort_in,
19934 mixed_in_name.as_ptr(),
19935 mixed_in,
19936 keep_in_name.as_ptr(),
19937 keep_in,
19938 background_in_name.as_ptr(),
19939 background_in,
19940 page_height_in_name.as_ptr(),
19941 page_height_in,
19942 profile_in_name.as_ptr(),
19943 profile_in.as_ptr(),
19944 NULL,
19945 );
19946 utils::result(vips_op_response, (), Error::WebpsaveMimeError)
19947 }
19948}
19949
19950pub fn tiffsave(inp: &VipsImage, filename: &str) -> Result<()> {
19955 unsafe {
19956 let inp_in: *mut bindings::VipsImage = inp.ctx;
19957 let filename_in: CString = utils::new_c_string(filename)?;
19958
19959 let vips_op_response = bindings::vips_tiffsave(inp_in, filename_in.as_ptr(), NULL);
19960 utils::result(vips_op_response, (), Error::TiffsaveError)
19961 }
19962}
19963
19964#[derive(Clone, Debug)]
19966pub struct TiffsaveOptions {
19967 pub compression: ForeignTiffCompression,
19979 pub q: i32,
19982 pub predictor: ForeignTiffPredictor,
19988 pub tile: bool,
19991 pub tile_width: i32,
19994 pub tile_height: i32,
19997 pub pyramid: bool,
20000 pub miniswhite: bool,
20003 pub bitdepth: i32,
20006 pub resunit: ForeignTiffResunit,
20011 pub xres: f64,
20014 pub yres: f64,
20017 pub bigtiff: bool,
20020 pub properties: bool,
20023 pub region_shrink: RegionShrink,
20032 pub level: i32,
20035 pub lossless: bool,
20038 pub depth: ForeignDzDepth,
20044 pub subifd: bool,
20047 pub premultiply: bool,
20050 pub keep: ForeignKeep,
20059 pub background: Vec<f64>,
20061 pub page_height: i32,
20064 pub profile: String,
20066}
20067
20068impl std::default::Default for TiffsaveOptions {
20069 fn default() -> Self {
20070 TiffsaveOptions {
20071 compression: ForeignTiffCompression::None,
20072 q: i32::from(75),
20073 predictor: ForeignTiffPredictor::Horizontal,
20074 tile: false,
20075 tile_width: i32::from(128),
20076 tile_height: i32::from(128),
20077 pyramid: false,
20078 miniswhite: false,
20079 bitdepth: i32::from(0),
20080 resunit: ForeignTiffResunit::Cm,
20081 xres: f64::from(1),
20082 yres: f64::from(1),
20083 bigtiff: false,
20084 properties: false,
20085 region_shrink: RegionShrink::Mean,
20086 level: i32::from(10),
20087 lossless: false,
20088 depth: ForeignDzDepth::Onetile,
20089 subifd: false,
20090 premultiply: false,
20091 keep: ForeignKeep::All,
20092 background: Vec::new(),
20093 page_height: i32::from(0),
20094 profile: String::from("sRGB"),
20095 }
20096 }
20097}
20098
20099pub fn tiffsave_with_opts(
20105 inp: &VipsImage,
20106 filename: &str,
20107 tiffsave_options: &TiffsaveOptions,
20108) -> Result<()> {
20109 unsafe {
20110 let inp_in: *mut bindings::VipsImage = inp.ctx;
20111 let filename_in: CString = utils::new_c_string(filename)?;
20112
20113 let compression_in: i32 = tiffsave_options.compression as i32;
20114 let compression_in_name = utils::new_c_string("compression")?;
20115
20116 let q_in: i32 = tiffsave_options.q;
20117 let q_in_name = utils::new_c_string("Q")?;
20118
20119 let predictor_in: i32 = tiffsave_options.predictor as i32;
20120 let predictor_in_name = utils::new_c_string("predictor")?;
20121
20122 let tile_in: i32 = if tiffsave_options.tile { 1 } else { 0 };
20123 let tile_in_name = utils::new_c_string("tile")?;
20124
20125 let tile_width_in: i32 = tiffsave_options.tile_width;
20126 let tile_width_in_name = utils::new_c_string("tile-width")?;
20127
20128 let tile_height_in: i32 = tiffsave_options.tile_height;
20129 let tile_height_in_name = utils::new_c_string("tile-height")?;
20130
20131 let pyramid_in: i32 = if tiffsave_options.pyramid { 1 } else { 0 };
20132 let pyramid_in_name = utils::new_c_string("pyramid")?;
20133
20134 let miniswhite_in: i32 = if tiffsave_options.miniswhite { 1 } else { 0 };
20135 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20136
20137 let bitdepth_in: i32 = tiffsave_options.bitdepth;
20138 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20139
20140 let resunit_in: i32 = tiffsave_options.resunit as i32;
20141 let resunit_in_name = utils::new_c_string("resunit")?;
20142
20143 let xres_in: f64 = tiffsave_options.xres;
20144 let xres_in_name = utils::new_c_string("xres")?;
20145
20146 let yres_in: f64 = tiffsave_options.yres;
20147 let yres_in_name = utils::new_c_string("yres")?;
20148
20149 let bigtiff_in: i32 = if tiffsave_options.bigtiff { 1 } else { 0 };
20150 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20151
20152 let properties_in: i32 = if tiffsave_options.properties { 1 } else { 0 };
20153 let properties_in_name = utils::new_c_string("properties")?;
20154
20155 let region_shrink_in: i32 = tiffsave_options.region_shrink as i32;
20156 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20157
20158 let level_in: i32 = tiffsave_options.level;
20159 let level_in_name = utils::new_c_string("level")?;
20160
20161 let lossless_in: i32 = if tiffsave_options.lossless { 1 } else { 0 };
20162 let lossless_in_name = utils::new_c_string("lossless")?;
20163
20164 let depth_in: i32 = tiffsave_options.depth as i32;
20165 let depth_in_name = utils::new_c_string("depth")?;
20166
20167 let subifd_in: i32 = if tiffsave_options.subifd { 1 } else { 0 };
20168 let subifd_in_name = utils::new_c_string("subifd")?;
20169
20170 let premultiply_in: i32 = if tiffsave_options.premultiply { 1 } else { 0 };
20171 let premultiply_in_name = utils::new_c_string("premultiply")?;
20172
20173 let keep_in: i32 = tiffsave_options.keep as i32;
20174 let keep_in_name = utils::new_c_string("keep")?;
20175
20176 let background_wrapper =
20177 utils::VipsArrayDoubleWrapper::from(&tiffsave_options.background[..]);
20178 let background_in = background_wrapper.ctx;
20179 let background_in_name = utils::new_c_string("background")?;
20180
20181 let page_height_in: i32 = tiffsave_options.page_height;
20182 let page_height_in_name = utils::new_c_string("page-height")?;
20183
20184 let profile_in: CString = utils::new_c_string(&tiffsave_options.profile)?;
20185 let profile_in_name = utils::new_c_string("profile")?;
20186
20187 let vips_op_response = bindings::vips_tiffsave(
20188 inp_in,
20189 filename_in.as_ptr(),
20190 compression_in_name.as_ptr(),
20191 compression_in,
20192 q_in_name.as_ptr(),
20193 q_in,
20194 predictor_in_name.as_ptr(),
20195 predictor_in,
20196 tile_in_name.as_ptr(),
20197 tile_in,
20198 tile_width_in_name.as_ptr(),
20199 tile_width_in,
20200 tile_height_in_name.as_ptr(),
20201 tile_height_in,
20202 pyramid_in_name.as_ptr(),
20203 pyramid_in,
20204 miniswhite_in_name.as_ptr(),
20205 miniswhite_in,
20206 bitdepth_in_name.as_ptr(),
20207 bitdepth_in,
20208 resunit_in_name.as_ptr(),
20209 resunit_in,
20210 xres_in_name.as_ptr(),
20211 xres_in,
20212 yres_in_name.as_ptr(),
20213 yres_in,
20214 bigtiff_in_name.as_ptr(),
20215 bigtiff_in,
20216 properties_in_name.as_ptr(),
20217 properties_in,
20218 region_shrink_in_name.as_ptr(),
20219 region_shrink_in,
20220 level_in_name.as_ptr(),
20221 level_in,
20222 lossless_in_name.as_ptr(),
20223 lossless_in,
20224 depth_in_name.as_ptr(),
20225 depth_in,
20226 subifd_in_name.as_ptr(),
20227 subifd_in,
20228 premultiply_in_name.as_ptr(),
20229 premultiply_in,
20230 keep_in_name.as_ptr(),
20231 keep_in,
20232 background_in_name.as_ptr(),
20233 background_in,
20234 page_height_in_name.as_ptr(),
20235 page_height_in,
20236 profile_in_name.as_ptr(),
20237 profile_in.as_ptr(),
20238 NULL,
20239 );
20240 utils::result(vips_op_response, (), Error::TiffsaveError)
20241 }
20242}
20243
20244pub fn tiffsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
20248 unsafe {
20249 let inp_in: *mut bindings::VipsImage = inp.ctx;
20250 let mut buffer_buf_size: u64 = 0;
20251 let mut buffer_out: *mut c_void = null_mut();
20252
20253 let vips_op_response =
20254 bindings::vips_tiffsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
20255 utils::result(
20256 vips_op_response,
20257 utils::new_byte_array(buffer_out, buffer_buf_size),
20258 Error::TiffsaveBufferError,
20259 )
20260 }
20261}
20262
20263#[derive(Clone, Debug)]
20265pub struct TiffsaveBufferOptions {
20266 pub compression: ForeignTiffCompression,
20278 pub q: i32,
20281 pub predictor: ForeignTiffPredictor,
20287 pub tile: bool,
20290 pub tile_width: i32,
20293 pub tile_height: i32,
20296 pub pyramid: bool,
20299 pub miniswhite: bool,
20302 pub bitdepth: i32,
20305 pub resunit: ForeignTiffResunit,
20310 pub xres: f64,
20313 pub yres: f64,
20316 pub bigtiff: bool,
20319 pub properties: bool,
20322 pub region_shrink: RegionShrink,
20331 pub level: i32,
20334 pub lossless: bool,
20337 pub depth: ForeignDzDepth,
20343 pub subifd: bool,
20346 pub premultiply: bool,
20349 pub keep: ForeignKeep,
20358 pub background: Vec<f64>,
20360 pub page_height: i32,
20363 pub profile: String,
20365}
20366
20367impl std::default::Default for TiffsaveBufferOptions {
20368 fn default() -> Self {
20369 TiffsaveBufferOptions {
20370 compression: ForeignTiffCompression::None,
20371 q: i32::from(75),
20372 predictor: ForeignTiffPredictor::Horizontal,
20373 tile: false,
20374 tile_width: i32::from(128),
20375 tile_height: i32::from(128),
20376 pyramid: false,
20377 miniswhite: false,
20378 bitdepth: i32::from(0),
20379 resunit: ForeignTiffResunit::Cm,
20380 xres: f64::from(1),
20381 yres: f64::from(1),
20382 bigtiff: false,
20383 properties: false,
20384 region_shrink: RegionShrink::Mean,
20385 level: i32::from(10),
20386 lossless: false,
20387 depth: ForeignDzDepth::Onetile,
20388 subifd: false,
20389 premultiply: false,
20390 keep: ForeignKeep::All,
20391 background: Vec::new(),
20392 page_height: i32::from(0),
20393 profile: String::from("sRGB"),
20394 }
20395 }
20396}
20397
20398pub fn tiffsave_buffer_with_opts(
20403 inp: &VipsImage,
20404 tiffsave_buffer_options: &TiffsaveBufferOptions,
20405) -> Result<Vec<u8>> {
20406 unsafe {
20407 let inp_in: *mut bindings::VipsImage = inp.ctx;
20408 let mut buffer_buf_size: u64 = 0;
20409 let mut buffer_out: *mut c_void = null_mut();
20410
20411 let compression_in: i32 = tiffsave_buffer_options.compression as i32;
20412 let compression_in_name = utils::new_c_string("compression")?;
20413
20414 let q_in: i32 = tiffsave_buffer_options.q;
20415 let q_in_name = utils::new_c_string("Q")?;
20416
20417 let predictor_in: i32 = tiffsave_buffer_options.predictor as i32;
20418 let predictor_in_name = utils::new_c_string("predictor")?;
20419
20420 let tile_in: i32 = if tiffsave_buffer_options.tile { 1 } else { 0 };
20421 let tile_in_name = utils::new_c_string("tile")?;
20422
20423 let tile_width_in: i32 = tiffsave_buffer_options.tile_width;
20424 let tile_width_in_name = utils::new_c_string("tile-width")?;
20425
20426 let tile_height_in: i32 = tiffsave_buffer_options.tile_height;
20427 let tile_height_in_name = utils::new_c_string("tile-height")?;
20428
20429 let pyramid_in: i32 = if tiffsave_buffer_options.pyramid {
20430 1
20431 } else {
20432 0
20433 };
20434 let pyramid_in_name = utils::new_c_string("pyramid")?;
20435
20436 let miniswhite_in: i32 = if tiffsave_buffer_options.miniswhite {
20437 1
20438 } else {
20439 0
20440 };
20441 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20442
20443 let bitdepth_in: i32 = tiffsave_buffer_options.bitdepth;
20444 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20445
20446 let resunit_in: i32 = tiffsave_buffer_options.resunit as i32;
20447 let resunit_in_name = utils::new_c_string("resunit")?;
20448
20449 let xres_in: f64 = tiffsave_buffer_options.xres;
20450 let xres_in_name = utils::new_c_string("xres")?;
20451
20452 let yres_in: f64 = tiffsave_buffer_options.yres;
20453 let yres_in_name = utils::new_c_string("yres")?;
20454
20455 let bigtiff_in: i32 = if tiffsave_buffer_options.bigtiff {
20456 1
20457 } else {
20458 0
20459 };
20460 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20461
20462 let properties_in: i32 = if tiffsave_buffer_options.properties {
20463 1
20464 } else {
20465 0
20466 };
20467 let properties_in_name = utils::new_c_string("properties")?;
20468
20469 let region_shrink_in: i32 = tiffsave_buffer_options.region_shrink as i32;
20470 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20471
20472 let level_in: i32 = tiffsave_buffer_options.level;
20473 let level_in_name = utils::new_c_string("level")?;
20474
20475 let lossless_in: i32 = if tiffsave_buffer_options.lossless {
20476 1
20477 } else {
20478 0
20479 };
20480 let lossless_in_name = utils::new_c_string("lossless")?;
20481
20482 let depth_in: i32 = tiffsave_buffer_options.depth as i32;
20483 let depth_in_name = utils::new_c_string("depth")?;
20484
20485 let subifd_in: i32 = if tiffsave_buffer_options.subifd { 1 } else { 0 };
20486 let subifd_in_name = utils::new_c_string("subifd")?;
20487
20488 let premultiply_in: i32 = if tiffsave_buffer_options.premultiply {
20489 1
20490 } else {
20491 0
20492 };
20493 let premultiply_in_name = utils::new_c_string("premultiply")?;
20494
20495 let keep_in: i32 = tiffsave_buffer_options.keep as i32;
20496 let keep_in_name = utils::new_c_string("keep")?;
20497
20498 let background_wrapper =
20499 utils::VipsArrayDoubleWrapper::from(&tiffsave_buffer_options.background[..]);
20500 let background_in = background_wrapper.ctx;
20501 let background_in_name = utils::new_c_string("background")?;
20502
20503 let page_height_in: i32 = tiffsave_buffer_options.page_height;
20504 let page_height_in_name = utils::new_c_string("page-height")?;
20505
20506 let profile_in: CString = utils::new_c_string(&tiffsave_buffer_options.profile)?;
20507 let profile_in_name = utils::new_c_string("profile")?;
20508
20509 let vips_op_response = bindings::vips_tiffsave_buffer(
20510 inp_in,
20511 &mut buffer_out,
20512 &mut buffer_buf_size,
20513 compression_in_name.as_ptr(),
20514 compression_in,
20515 q_in_name.as_ptr(),
20516 q_in,
20517 predictor_in_name.as_ptr(),
20518 predictor_in,
20519 tile_in_name.as_ptr(),
20520 tile_in,
20521 tile_width_in_name.as_ptr(),
20522 tile_width_in,
20523 tile_height_in_name.as_ptr(),
20524 tile_height_in,
20525 pyramid_in_name.as_ptr(),
20526 pyramid_in,
20527 miniswhite_in_name.as_ptr(),
20528 miniswhite_in,
20529 bitdepth_in_name.as_ptr(),
20530 bitdepth_in,
20531 resunit_in_name.as_ptr(),
20532 resunit_in,
20533 xres_in_name.as_ptr(),
20534 xres_in,
20535 yres_in_name.as_ptr(),
20536 yres_in,
20537 bigtiff_in_name.as_ptr(),
20538 bigtiff_in,
20539 properties_in_name.as_ptr(),
20540 properties_in,
20541 region_shrink_in_name.as_ptr(),
20542 region_shrink_in,
20543 level_in_name.as_ptr(),
20544 level_in,
20545 lossless_in_name.as_ptr(),
20546 lossless_in,
20547 depth_in_name.as_ptr(),
20548 depth_in,
20549 subifd_in_name.as_ptr(),
20550 subifd_in,
20551 premultiply_in_name.as_ptr(),
20552 premultiply_in,
20553 keep_in_name.as_ptr(),
20554 keep_in,
20555 background_in_name.as_ptr(),
20556 background_in,
20557 page_height_in_name.as_ptr(),
20558 page_height_in,
20559 profile_in_name.as_ptr(),
20560 profile_in.as_ptr(),
20561 NULL,
20562 );
20563 utils::result(
20564 vips_op_response,
20565 utils::new_byte_array(buffer_out, buffer_buf_size),
20566 Error::TiffsaveBufferError,
20567 )
20568 }
20569}
20570
20571pub fn tiffsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
20576 unsafe {
20577 let inp_in: *mut bindings::VipsImage = inp.ctx;
20578 let target_in: *mut bindings::VipsTarget = target.ctx;
20579
20580 let vips_op_response = bindings::vips_tiffsave_target(inp_in, target_in, NULL);
20581 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
20582 }
20583}
20584
20585#[derive(Clone, Debug)]
20587pub struct TiffsaveTargetOptions {
20588 pub compression: ForeignTiffCompression,
20600 pub q: i32,
20603 pub predictor: ForeignTiffPredictor,
20609 pub tile: bool,
20612 pub tile_width: i32,
20615 pub tile_height: i32,
20618 pub pyramid: bool,
20621 pub miniswhite: bool,
20624 pub bitdepth: i32,
20627 pub resunit: ForeignTiffResunit,
20632 pub xres: f64,
20635 pub yres: f64,
20638 pub bigtiff: bool,
20641 pub properties: bool,
20644 pub region_shrink: RegionShrink,
20653 pub level: i32,
20656 pub lossless: bool,
20659 pub depth: ForeignDzDepth,
20665 pub subifd: bool,
20668 pub premultiply: bool,
20671 pub keep: ForeignKeep,
20680 pub background: Vec<f64>,
20682 pub page_height: i32,
20685 pub profile: String,
20687}
20688
20689impl std::default::Default for TiffsaveTargetOptions {
20690 fn default() -> Self {
20691 TiffsaveTargetOptions {
20692 compression: ForeignTiffCompression::None,
20693 q: i32::from(75),
20694 predictor: ForeignTiffPredictor::Horizontal,
20695 tile: false,
20696 tile_width: i32::from(128),
20697 tile_height: i32::from(128),
20698 pyramid: false,
20699 miniswhite: false,
20700 bitdepth: i32::from(0),
20701 resunit: ForeignTiffResunit::Cm,
20702 xres: f64::from(1),
20703 yres: f64::from(1),
20704 bigtiff: false,
20705 properties: false,
20706 region_shrink: RegionShrink::Mean,
20707 level: i32::from(10),
20708 lossless: false,
20709 depth: ForeignDzDepth::Onetile,
20710 subifd: false,
20711 premultiply: false,
20712 keep: ForeignKeep::All,
20713 background: Vec::new(),
20714 page_height: i32::from(0),
20715 profile: String::from("sRGB"),
20716 }
20717 }
20718}
20719
20720pub fn tiffsave_target_with_opts(
20726 inp: &VipsImage,
20727 target: &VipsTarget,
20728 tiffsave_target_options: &TiffsaveTargetOptions,
20729) -> Result<()> {
20730 unsafe {
20731 let inp_in: *mut bindings::VipsImage = inp.ctx;
20732 let target_in: *mut bindings::VipsTarget = target.ctx;
20733
20734 let compression_in: i32 = tiffsave_target_options.compression as i32;
20735 let compression_in_name = utils::new_c_string("compression")?;
20736
20737 let q_in: i32 = tiffsave_target_options.q;
20738 let q_in_name = utils::new_c_string("Q")?;
20739
20740 let predictor_in: i32 = tiffsave_target_options.predictor as i32;
20741 let predictor_in_name = utils::new_c_string("predictor")?;
20742
20743 let tile_in: i32 = if tiffsave_target_options.tile { 1 } else { 0 };
20744 let tile_in_name = utils::new_c_string("tile")?;
20745
20746 let tile_width_in: i32 = tiffsave_target_options.tile_width;
20747 let tile_width_in_name = utils::new_c_string("tile-width")?;
20748
20749 let tile_height_in: i32 = tiffsave_target_options.tile_height;
20750 let tile_height_in_name = utils::new_c_string("tile-height")?;
20751
20752 let pyramid_in: i32 = if tiffsave_target_options.pyramid {
20753 1
20754 } else {
20755 0
20756 };
20757 let pyramid_in_name = utils::new_c_string("pyramid")?;
20758
20759 let miniswhite_in: i32 = if tiffsave_target_options.miniswhite {
20760 1
20761 } else {
20762 0
20763 };
20764 let miniswhite_in_name = utils::new_c_string("miniswhite")?;
20765
20766 let bitdepth_in: i32 = tiffsave_target_options.bitdepth;
20767 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
20768
20769 let resunit_in: i32 = tiffsave_target_options.resunit as i32;
20770 let resunit_in_name = utils::new_c_string("resunit")?;
20771
20772 let xres_in: f64 = tiffsave_target_options.xres;
20773 let xres_in_name = utils::new_c_string("xres")?;
20774
20775 let yres_in: f64 = tiffsave_target_options.yres;
20776 let yres_in_name = utils::new_c_string("yres")?;
20777
20778 let bigtiff_in: i32 = if tiffsave_target_options.bigtiff {
20779 1
20780 } else {
20781 0
20782 };
20783 let bigtiff_in_name = utils::new_c_string("bigtiff")?;
20784
20785 let properties_in: i32 = if tiffsave_target_options.properties {
20786 1
20787 } else {
20788 0
20789 };
20790 let properties_in_name = utils::new_c_string("properties")?;
20791
20792 let region_shrink_in: i32 = tiffsave_target_options.region_shrink as i32;
20793 let region_shrink_in_name = utils::new_c_string("region-shrink")?;
20794
20795 let level_in: i32 = tiffsave_target_options.level;
20796 let level_in_name = utils::new_c_string("level")?;
20797
20798 let lossless_in: i32 = if tiffsave_target_options.lossless {
20799 1
20800 } else {
20801 0
20802 };
20803 let lossless_in_name = utils::new_c_string("lossless")?;
20804
20805 let depth_in: i32 = tiffsave_target_options.depth as i32;
20806 let depth_in_name = utils::new_c_string("depth")?;
20807
20808 let subifd_in: i32 = if tiffsave_target_options.subifd { 1 } else { 0 };
20809 let subifd_in_name = utils::new_c_string("subifd")?;
20810
20811 let premultiply_in: i32 = if tiffsave_target_options.premultiply {
20812 1
20813 } else {
20814 0
20815 };
20816 let premultiply_in_name = utils::new_c_string("premultiply")?;
20817
20818 let keep_in: i32 = tiffsave_target_options.keep as i32;
20819 let keep_in_name = utils::new_c_string("keep")?;
20820
20821 let background_wrapper =
20822 utils::VipsArrayDoubleWrapper::from(&tiffsave_target_options.background[..]);
20823 let background_in = background_wrapper.ctx;
20824 let background_in_name = utils::new_c_string("background")?;
20825
20826 let page_height_in: i32 = tiffsave_target_options.page_height;
20827 let page_height_in_name = utils::new_c_string("page-height")?;
20828
20829 let profile_in: CString = utils::new_c_string(&tiffsave_target_options.profile)?;
20830 let profile_in_name = utils::new_c_string("profile")?;
20831
20832 let vips_op_response = bindings::vips_tiffsave_target(
20833 inp_in,
20834 target_in,
20835 compression_in_name.as_ptr(),
20836 compression_in,
20837 q_in_name.as_ptr(),
20838 q_in,
20839 predictor_in_name.as_ptr(),
20840 predictor_in,
20841 tile_in_name.as_ptr(),
20842 tile_in,
20843 tile_width_in_name.as_ptr(),
20844 tile_width_in,
20845 tile_height_in_name.as_ptr(),
20846 tile_height_in,
20847 pyramid_in_name.as_ptr(),
20848 pyramid_in,
20849 miniswhite_in_name.as_ptr(),
20850 miniswhite_in,
20851 bitdepth_in_name.as_ptr(),
20852 bitdepth_in,
20853 resunit_in_name.as_ptr(),
20854 resunit_in,
20855 xres_in_name.as_ptr(),
20856 xres_in,
20857 yres_in_name.as_ptr(),
20858 yres_in,
20859 bigtiff_in_name.as_ptr(),
20860 bigtiff_in,
20861 properties_in_name.as_ptr(),
20862 properties_in,
20863 region_shrink_in_name.as_ptr(),
20864 region_shrink_in,
20865 level_in_name.as_ptr(),
20866 level_in,
20867 lossless_in_name.as_ptr(),
20868 lossless_in,
20869 depth_in_name.as_ptr(),
20870 depth_in,
20871 subifd_in_name.as_ptr(),
20872 subifd_in,
20873 premultiply_in_name.as_ptr(),
20874 premultiply_in,
20875 keep_in_name.as_ptr(),
20876 keep_in,
20877 background_in_name.as_ptr(),
20878 background_in,
20879 page_height_in_name.as_ptr(),
20880 page_height_in,
20881 profile_in_name.as_ptr(),
20882 profile_in.as_ptr(),
20883 NULL,
20884 );
20885 utils::result(vips_op_response, (), Error::TiffsaveTargetError)
20886 }
20887}
20888
20889pub fn fitssave(inp: &VipsImage, filename: &str) -> Result<()> {
20894 unsafe {
20895 let inp_in: *mut bindings::VipsImage = inp.ctx;
20896 let filename_in: CString = utils::new_c_string(filename)?;
20897
20898 let vips_op_response = bindings::vips_fitssave(inp_in, filename_in.as_ptr(), NULL);
20899 utils::result(vips_op_response, (), Error::FitssaveError)
20900 }
20901}
20902
20903#[derive(Clone, Debug)]
20905pub struct FitssaveOptions {
20906 pub keep: ForeignKeep,
20915 pub background: Vec<f64>,
20917 pub page_height: i32,
20920 pub profile: String,
20922}
20923
20924impl std::default::Default for FitssaveOptions {
20925 fn default() -> Self {
20926 FitssaveOptions {
20927 keep: ForeignKeep::All,
20928 background: Vec::new(),
20929 page_height: i32::from(0),
20930 profile: String::from("sRGB"),
20931 }
20932 }
20933}
20934
20935pub fn fitssave_with_opts(
20941 inp: &VipsImage,
20942 filename: &str,
20943 fitssave_options: &FitssaveOptions,
20944) -> Result<()> {
20945 unsafe {
20946 let inp_in: *mut bindings::VipsImage = inp.ctx;
20947 let filename_in: CString = utils::new_c_string(filename)?;
20948
20949 let keep_in: i32 = fitssave_options.keep as i32;
20950 let keep_in_name = utils::new_c_string("keep")?;
20951
20952 let background_wrapper =
20953 utils::VipsArrayDoubleWrapper::from(&fitssave_options.background[..]);
20954 let background_in = background_wrapper.ctx;
20955 let background_in_name = utils::new_c_string("background")?;
20956
20957 let page_height_in: i32 = fitssave_options.page_height;
20958 let page_height_in_name = utils::new_c_string("page-height")?;
20959
20960 let profile_in: CString = utils::new_c_string(&fitssave_options.profile)?;
20961 let profile_in_name = utils::new_c_string("profile")?;
20962
20963 let vips_op_response = bindings::vips_fitssave(
20964 inp_in,
20965 filename_in.as_ptr(),
20966 keep_in_name.as_ptr(),
20967 keep_in,
20968 background_in_name.as_ptr(),
20969 background_in,
20970 page_height_in_name.as_ptr(),
20971 page_height_in,
20972 profile_in_name.as_ptr(),
20973 profile_in.as_ptr(),
20974 NULL,
20975 );
20976 utils::result(vips_op_response, (), Error::FitssaveError)
20977 }
20978}
20979
20980pub fn heifsave(inp: &VipsImage, filename: &str) -> Result<()> {
20985 unsafe {
20986 let inp_in: *mut bindings::VipsImage = inp.ctx;
20987 let filename_in: CString = utils::new_c_string(filename)?;
20988
20989 let vips_op_response = bindings::vips_heifsave(inp_in, filename_in.as_ptr(), NULL);
20990 utils::result(vips_op_response, (), Error::HeifsaveError)
20991 }
20992}
20993
20994#[derive(Clone, Debug)]
20996pub struct HeifsaveOptions {
20997 pub q: i32,
21000 pub bitdepth: i32,
21003 pub lossless: bool,
21006 pub compression: ForeignHeifCompression,
21013 pub effort: i32,
21016 pub subsample_mode: ForeignSubsample,
21022 pub encoder: ForeignHeifEncoder,
21030 pub keep: ForeignKeep,
21039 pub background: Vec<f64>,
21041 pub page_height: i32,
21044 pub profile: String,
21046}
21047
21048impl std::default::Default for HeifsaveOptions {
21049 fn default() -> Self {
21050 HeifsaveOptions {
21051 q: i32::from(50),
21052 bitdepth: i32::from(12),
21053 lossless: false,
21054 compression: ForeignHeifCompression::Hevc,
21055 effort: i32::from(4),
21056 subsample_mode: ForeignSubsample::Auto,
21057 encoder: ForeignHeifEncoder::Auto,
21058 keep: ForeignKeep::All,
21059 background: Vec::new(),
21060 page_height: i32::from(0),
21061 profile: String::from("sRGB"),
21062 }
21063 }
21064}
21065
21066pub fn heifsave_with_opts(
21072 inp: &VipsImage,
21073 filename: &str,
21074 heifsave_options: &HeifsaveOptions,
21075) -> Result<()> {
21076 unsafe {
21077 let inp_in: *mut bindings::VipsImage = inp.ctx;
21078 let filename_in: CString = utils::new_c_string(filename)?;
21079
21080 let q_in: i32 = heifsave_options.q;
21081 let q_in_name = utils::new_c_string("Q")?;
21082
21083 let bitdepth_in: i32 = heifsave_options.bitdepth;
21084 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21085
21086 let lossless_in: i32 = if heifsave_options.lossless { 1 } else { 0 };
21087 let lossless_in_name = utils::new_c_string("lossless")?;
21088
21089 let compression_in: i32 = heifsave_options.compression as i32;
21090 let compression_in_name = utils::new_c_string("compression")?;
21091
21092 let effort_in: i32 = heifsave_options.effort;
21093 let effort_in_name = utils::new_c_string("effort")?;
21094
21095 let subsample_mode_in: i32 = heifsave_options.subsample_mode as i32;
21096 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21097
21098 let encoder_in: i32 = heifsave_options.encoder as i32;
21099 let encoder_in_name = utils::new_c_string("encoder")?;
21100
21101 let keep_in: i32 = heifsave_options.keep as i32;
21102 let keep_in_name = utils::new_c_string("keep")?;
21103
21104 let background_wrapper =
21105 utils::VipsArrayDoubleWrapper::from(&heifsave_options.background[..]);
21106 let background_in = background_wrapper.ctx;
21107 let background_in_name = utils::new_c_string("background")?;
21108
21109 let page_height_in: i32 = heifsave_options.page_height;
21110 let page_height_in_name = utils::new_c_string("page-height")?;
21111
21112 let profile_in: CString = utils::new_c_string(&heifsave_options.profile)?;
21113 let profile_in_name = utils::new_c_string("profile")?;
21114
21115 let vips_op_response = bindings::vips_heifsave(
21116 inp_in,
21117 filename_in.as_ptr(),
21118 q_in_name.as_ptr(),
21119 q_in,
21120 bitdepth_in_name.as_ptr(),
21121 bitdepth_in,
21122 lossless_in_name.as_ptr(),
21123 lossless_in,
21124 compression_in_name.as_ptr(),
21125 compression_in,
21126 effort_in_name.as_ptr(),
21127 effort_in,
21128 subsample_mode_in_name.as_ptr(),
21129 subsample_mode_in,
21130 encoder_in_name.as_ptr(),
21131 encoder_in,
21132 keep_in_name.as_ptr(),
21133 keep_in,
21134 background_in_name.as_ptr(),
21135 background_in,
21136 page_height_in_name.as_ptr(),
21137 page_height_in,
21138 profile_in_name.as_ptr(),
21139 profile_in.as_ptr(),
21140 NULL,
21141 );
21142 utils::result(vips_op_response, (), Error::HeifsaveError)
21143 }
21144}
21145
21146pub fn heifsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21150 unsafe {
21151 let inp_in: *mut bindings::VipsImage = inp.ctx;
21152 let mut buffer_buf_size: u64 = 0;
21153 let mut buffer_out: *mut c_void = null_mut();
21154
21155 let vips_op_response =
21156 bindings::vips_heifsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21157 utils::result(
21158 vips_op_response,
21159 utils::new_byte_array(buffer_out, buffer_buf_size),
21160 Error::HeifsaveBufferError,
21161 )
21162 }
21163}
21164
21165#[derive(Clone, Debug)]
21167pub struct HeifsaveBufferOptions {
21168 pub q: i32,
21171 pub bitdepth: i32,
21174 pub lossless: bool,
21177 pub compression: ForeignHeifCompression,
21184 pub effort: i32,
21187 pub subsample_mode: ForeignSubsample,
21193 pub encoder: ForeignHeifEncoder,
21201 pub keep: ForeignKeep,
21210 pub background: Vec<f64>,
21212 pub page_height: i32,
21215 pub profile: String,
21217}
21218
21219impl std::default::Default for HeifsaveBufferOptions {
21220 fn default() -> Self {
21221 HeifsaveBufferOptions {
21222 q: i32::from(50),
21223 bitdepth: i32::from(12),
21224 lossless: false,
21225 compression: ForeignHeifCompression::Hevc,
21226 effort: i32::from(4),
21227 subsample_mode: ForeignSubsample::Auto,
21228 encoder: ForeignHeifEncoder::Auto,
21229 keep: ForeignKeep::All,
21230 background: Vec::new(),
21231 page_height: i32::from(0),
21232 profile: String::from("sRGB"),
21233 }
21234 }
21235}
21236
21237pub fn heifsave_buffer_with_opts(
21242 inp: &VipsImage,
21243 heifsave_buffer_options: &HeifsaveBufferOptions,
21244) -> Result<Vec<u8>> {
21245 unsafe {
21246 let inp_in: *mut bindings::VipsImage = inp.ctx;
21247 let mut buffer_buf_size: u64 = 0;
21248 let mut buffer_out: *mut c_void = null_mut();
21249
21250 let q_in: i32 = heifsave_buffer_options.q;
21251 let q_in_name = utils::new_c_string("Q")?;
21252
21253 let bitdepth_in: i32 = heifsave_buffer_options.bitdepth;
21254 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21255
21256 let lossless_in: i32 = if heifsave_buffer_options.lossless {
21257 1
21258 } else {
21259 0
21260 };
21261 let lossless_in_name = utils::new_c_string("lossless")?;
21262
21263 let compression_in: i32 = heifsave_buffer_options.compression as i32;
21264 let compression_in_name = utils::new_c_string("compression")?;
21265
21266 let effort_in: i32 = heifsave_buffer_options.effort;
21267 let effort_in_name = utils::new_c_string("effort")?;
21268
21269 let subsample_mode_in: i32 = heifsave_buffer_options.subsample_mode as i32;
21270 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21271
21272 let encoder_in: i32 = heifsave_buffer_options.encoder as i32;
21273 let encoder_in_name = utils::new_c_string("encoder")?;
21274
21275 let keep_in: i32 = heifsave_buffer_options.keep as i32;
21276 let keep_in_name = utils::new_c_string("keep")?;
21277
21278 let background_wrapper =
21279 utils::VipsArrayDoubleWrapper::from(&heifsave_buffer_options.background[..]);
21280 let background_in = background_wrapper.ctx;
21281 let background_in_name = utils::new_c_string("background")?;
21282
21283 let page_height_in: i32 = heifsave_buffer_options.page_height;
21284 let page_height_in_name = utils::new_c_string("page-height")?;
21285
21286 let profile_in: CString = utils::new_c_string(&heifsave_buffer_options.profile)?;
21287 let profile_in_name = utils::new_c_string("profile")?;
21288
21289 let vips_op_response = bindings::vips_heifsave_buffer(
21290 inp_in,
21291 &mut buffer_out,
21292 &mut buffer_buf_size,
21293 q_in_name.as_ptr(),
21294 q_in,
21295 bitdepth_in_name.as_ptr(),
21296 bitdepth_in,
21297 lossless_in_name.as_ptr(),
21298 lossless_in,
21299 compression_in_name.as_ptr(),
21300 compression_in,
21301 effort_in_name.as_ptr(),
21302 effort_in,
21303 subsample_mode_in_name.as_ptr(),
21304 subsample_mode_in,
21305 encoder_in_name.as_ptr(),
21306 encoder_in,
21307 keep_in_name.as_ptr(),
21308 keep_in,
21309 background_in_name.as_ptr(),
21310 background_in,
21311 page_height_in_name.as_ptr(),
21312 page_height_in,
21313 profile_in_name.as_ptr(),
21314 profile_in.as_ptr(),
21315 NULL,
21316 );
21317 utils::result(
21318 vips_op_response,
21319 utils::new_byte_array(buffer_out, buffer_buf_size),
21320 Error::HeifsaveBufferError,
21321 )
21322 }
21323}
21324
21325pub fn heifsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
21330 unsafe {
21331 let inp_in: *mut bindings::VipsImage = inp.ctx;
21332 let target_in: *mut bindings::VipsTarget = target.ctx;
21333
21334 let vips_op_response = bindings::vips_heifsave_target(inp_in, target_in, NULL);
21335 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
21336 }
21337}
21338
21339#[derive(Clone, Debug)]
21341pub struct HeifsaveTargetOptions {
21342 pub q: i32,
21345 pub bitdepth: i32,
21348 pub lossless: bool,
21351 pub compression: ForeignHeifCompression,
21358 pub effort: i32,
21361 pub subsample_mode: ForeignSubsample,
21367 pub encoder: ForeignHeifEncoder,
21375 pub keep: ForeignKeep,
21384 pub background: Vec<f64>,
21386 pub page_height: i32,
21389 pub profile: String,
21391}
21392
21393impl std::default::Default for HeifsaveTargetOptions {
21394 fn default() -> Self {
21395 HeifsaveTargetOptions {
21396 q: i32::from(50),
21397 bitdepth: i32::from(12),
21398 lossless: false,
21399 compression: ForeignHeifCompression::Hevc,
21400 effort: i32::from(4),
21401 subsample_mode: ForeignSubsample::Auto,
21402 encoder: ForeignHeifEncoder::Auto,
21403 keep: ForeignKeep::All,
21404 background: Vec::new(),
21405 page_height: i32::from(0),
21406 profile: String::from("sRGB"),
21407 }
21408 }
21409}
21410
21411pub fn heifsave_target_with_opts(
21417 inp: &VipsImage,
21418 target: &VipsTarget,
21419 heifsave_target_options: &HeifsaveTargetOptions,
21420) -> Result<()> {
21421 unsafe {
21422 let inp_in: *mut bindings::VipsImage = inp.ctx;
21423 let target_in: *mut bindings::VipsTarget = target.ctx;
21424
21425 let q_in: i32 = heifsave_target_options.q;
21426 let q_in_name = utils::new_c_string("Q")?;
21427
21428 let bitdepth_in: i32 = heifsave_target_options.bitdepth;
21429 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21430
21431 let lossless_in: i32 = if heifsave_target_options.lossless {
21432 1
21433 } else {
21434 0
21435 };
21436 let lossless_in_name = utils::new_c_string("lossless")?;
21437
21438 let compression_in: i32 = heifsave_target_options.compression as i32;
21439 let compression_in_name = utils::new_c_string("compression")?;
21440
21441 let effort_in: i32 = heifsave_target_options.effort;
21442 let effort_in_name = utils::new_c_string("effort")?;
21443
21444 let subsample_mode_in: i32 = heifsave_target_options.subsample_mode as i32;
21445 let subsample_mode_in_name = utils::new_c_string("subsample-mode")?;
21446
21447 let encoder_in: i32 = heifsave_target_options.encoder as i32;
21448 let encoder_in_name = utils::new_c_string("encoder")?;
21449
21450 let keep_in: i32 = heifsave_target_options.keep as i32;
21451 let keep_in_name = utils::new_c_string("keep")?;
21452
21453 let background_wrapper =
21454 utils::VipsArrayDoubleWrapper::from(&heifsave_target_options.background[..]);
21455 let background_in = background_wrapper.ctx;
21456 let background_in_name = utils::new_c_string("background")?;
21457
21458 let page_height_in: i32 = heifsave_target_options.page_height;
21459 let page_height_in_name = utils::new_c_string("page-height")?;
21460
21461 let profile_in: CString = utils::new_c_string(&heifsave_target_options.profile)?;
21462 let profile_in_name = utils::new_c_string("profile")?;
21463
21464 let vips_op_response = bindings::vips_heifsave_target(
21465 inp_in,
21466 target_in,
21467 q_in_name.as_ptr(),
21468 q_in,
21469 bitdepth_in_name.as_ptr(),
21470 bitdepth_in,
21471 lossless_in_name.as_ptr(),
21472 lossless_in,
21473 compression_in_name.as_ptr(),
21474 compression_in,
21475 effort_in_name.as_ptr(),
21476 effort_in,
21477 subsample_mode_in_name.as_ptr(),
21478 subsample_mode_in,
21479 encoder_in_name.as_ptr(),
21480 encoder_in,
21481 keep_in_name.as_ptr(),
21482 keep_in,
21483 background_in_name.as_ptr(),
21484 background_in,
21485 page_height_in_name.as_ptr(),
21486 page_height_in,
21487 profile_in_name.as_ptr(),
21488 profile_in.as_ptr(),
21489 NULL,
21490 );
21491 utils::result(vips_op_response, (), Error::HeifsaveTargetError)
21492 }
21493}
21494
21495pub fn magicksave(inp: &VipsImage, filename: &str) -> Result<()> {
21500 unsafe {
21501 let inp_in: *mut bindings::VipsImage = inp.ctx;
21502 let filename_in: CString = utils::new_c_string(filename)?;
21503
21504 let vips_op_response = bindings::vips_magicksave(inp_in, filename_in.as_ptr(), NULL);
21505 utils::result(vips_op_response, (), Error::MagicksaveError)
21506 }
21507}
21508
21509#[derive(Clone, Debug)]
21511pub struct MagicksaveOptions {
21512 pub format: String,
21514 pub quality: i32,
21517 pub optimize_gif_frames: bool,
21520 pub optimize_gif_transparency: bool,
21523 pub bitdepth: i32,
21526 pub keep: ForeignKeep,
21535 pub background: Vec<f64>,
21537 pub page_height: i32,
21540 pub profile: String,
21542}
21543
21544impl std::default::Default for MagicksaveOptions {
21545 fn default() -> Self {
21546 MagicksaveOptions {
21547 format: String::new(),
21548 quality: i32::from(0),
21549 optimize_gif_frames: false,
21550 optimize_gif_transparency: false,
21551 bitdepth: i32::from(0),
21552 keep: ForeignKeep::All,
21553 background: Vec::new(),
21554 page_height: i32::from(0),
21555 profile: String::from("sRGB"),
21556 }
21557 }
21558}
21559
21560pub fn magicksave_with_opts(
21566 inp: &VipsImage,
21567 filename: &str,
21568 magicksave_options: &MagicksaveOptions,
21569) -> Result<()> {
21570 unsafe {
21571 let inp_in: *mut bindings::VipsImage = inp.ctx;
21572 let filename_in: CString = utils::new_c_string(filename)?;
21573
21574 let format_in: CString = utils::new_c_string(&magicksave_options.format)?;
21575 let format_in_name = utils::new_c_string("format")?;
21576
21577 let quality_in: i32 = magicksave_options.quality;
21578 let quality_in_name = utils::new_c_string("quality")?;
21579
21580 let optimize_gif_frames_in: i32 = if magicksave_options.optimize_gif_frames {
21581 1
21582 } else {
21583 0
21584 };
21585 let optimize_gif_frames_in_name = utils::new_c_string("optimize-gif-frames")?;
21586
21587 let optimize_gif_transparency_in: i32 = if magicksave_options.optimize_gif_transparency {
21588 1
21589 } else {
21590 0
21591 };
21592 let optimize_gif_transparency_in_name = utils::new_c_string("optimize-gif-transparency")?;
21593
21594 let bitdepth_in: i32 = magicksave_options.bitdepth;
21595 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21596
21597 let keep_in: i32 = magicksave_options.keep as i32;
21598 let keep_in_name = utils::new_c_string("keep")?;
21599
21600 let background_wrapper =
21601 utils::VipsArrayDoubleWrapper::from(&magicksave_options.background[..]);
21602 let background_in = background_wrapper.ctx;
21603 let background_in_name = utils::new_c_string("background")?;
21604
21605 let page_height_in: i32 = magicksave_options.page_height;
21606 let page_height_in_name = utils::new_c_string("page-height")?;
21607
21608 let profile_in: CString = utils::new_c_string(&magicksave_options.profile)?;
21609 let profile_in_name = utils::new_c_string("profile")?;
21610
21611 let vips_op_response = bindings::vips_magicksave(
21612 inp_in,
21613 filename_in.as_ptr(),
21614 format_in_name.as_ptr(),
21615 format_in.as_ptr(),
21616 quality_in_name.as_ptr(),
21617 quality_in,
21618 optimize_gif_frames_in_name.as_ptr(),
21619 optimize_gif_frames_in,
21620 optimize_gif_transparency_in_name.as_ptr(),
21621 optimize_gif_transparency_in,
21622 bitdepth_in_name.as_ptr(),
21623 bitdepth_in,
21624 keep_in_name.as_ptr(),
21625 keep_in,
21626 background_in_name.as_ptr(),
21627 background_in,
21628 page_height_in_name.as_ptr(),
21629 page_height_in,
21630 profile_in_name.as_ptr(),
21631 profile_in.as_ptr(),
21632 NULL,
21633 );
21634 utils::result(vips_op_response, (), Error::MagicksaveError)
21635 }
21636}
21637
21638pub fn magicksave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21642 unsafe {
21643 let inp_in: *mut bindings::VipsImage = inp.ctx;
21644 let mut buffer_buf_size: u64 = 0;
21645 let mut buffer_out: *mut c_void = null_mut();
21646
21647 let vips_op_response =
21648 bindings::vips_magicksave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21649 utils::result(
21650 vips_op_response,
21651 utils::new_byte_array(buffer_out, buffer_buf_size),
21652 Error::MagicksaveBufferError,
21653 )
21654 }
21655}
21656
21657#[derive(Clone, Debug)]
21659pub struct MagicksaveBufferOptions {
21660 pub format: String,
21662 pub quality: i32,
21665 pub optimize_gif_frames: bool,
21668 pub optimize_gif_transparency: bool,
21671 pub bitdepth: i32,
21674 pub keep: ForeignKeep,
21683 pub background: Vec<f64>,
21685 pub page_height: i32,
21688 pub profile: String,
21690}
21691
21692impl std::default::Default for MagicksaveBufferOptions {
21693 fn default() -> Self {
21694 MagicksaveBufferOptions {
21695 format: String::new(),
21696 quality: i32::from(0),
21697 optimize_gif_frames: false,
21698 optimize_gif_transparency: false,
21699 bitdepth: i32::from(0),
21700 keep: ForeignKeep::All,
21701 background: Vec::new(),
21702 page_height: i32::from(0),
21703 profile: String::from("sRGB"),
21704 }
21705 }
21706}
21707
21708pub fn magicksave_buffer_with_opts(
21713 inp: &VipsImage,
21714 magicksave_buffer_options: &MagicksaveBufferOptions,
21715) -> Result<Vec<u8>> {
21716 unsafe {
21717 let inp_in: *mut bindings::VipsImage = inp.ctx;
21718 let mut buffer_buf_size: u64 = 0;
21719 let mut buffer_out: *mut c_void = null_mut();
21720
21721 let format_in: CString = utils::new_c_string(&magicksave_buffer_options.format)?;
21722 let format_in_name = utils::new_c_string("format")?;
21723
21724 let quality_in: i32 = magicksave_buffer_options.quality;
21725 let quality_in_name = utils::new_c_string("quality")?;
21726
21727 let optimize_gif_frames_in: i32 = if magicksave_buffer_options.optimize_gif_frames {
21728 1
21729 } else {
21730 0
21731 };
21732 let optimize_gif_frames_in_name = utils::new_c_string("optimize-gif-frames")?;
21733
21734 let optimize_gif_transparency_in: i32 =
21735 if magicksave_buffer_options.optimize_gif_transparency {
21736 1
21737 } else {
21738 0
21739 };
21740 let optimize_gif_transparency_in_name = utils::new_c_string("optimize-gif-transparency")?;
21741
21742 let bitdepth_in: i32 = magicksave_buffer_options.bitdepth;
21743 let bitdepth_in_name = utils::new_c_string("bitdepth")?;
21744
21745 let keep_in: i32 = magicksave_buffer_options.keep as i32;
21746 let keep_in_name = utils::new_c_string("keep")?;
21747
21748 let background_wrapper =
21749 utils::VipsArrayDoubleWrapper::from(&magicksave_buffer_options.background[..]);
21750 let background_in = background_wrapper.ctx;
21751 let background_in_name = utils::new_c_string("background")?;
21752
21753 let page_height_in: i32 = magicksave_buffer_options.page_height;
21754 let page_height_in_name = utils::new_c_string("page-height")?;
21755
21756 let profile_in: CString = utils::new_c_string(&magicksave_buffer_options.profile)?;
21757 let profile_in_name = utils::new_c_string("profile")?;
21758
21759 let vips_op_response = bindings::vips_magicksave_buffer(
21760 inp_in,
21761 &mut buffer_out,
21762 &mut buffer_buf_size,
21763 format_in_name.as_ptr(),
21764 format_in.as_ptr(),
21765 quality_in_name.as_ptr(),
21766 quality_in,
21767 optimize_gif_frames_in_name.as_ptr(),
21768 optimize_gif_frames_in,
21769 optimize_gif_transparency_in_name.as_ptr(),
21770 optimize_gif_transparency_in,
21771 bitdepth_in_name.as_ptr(),
21772 bitdepth_in,
21773 keep_in_name.as_ptr(),
21774 keep_in,
21775 background_in_name.as_ptr(),
21776 background_in,
21777 page_height_in_name.as_ptr(),
21778 page_height_in,
21779 profile_in_name.as_ptr(),
21780 profile_in.as_ptr(),
21781 NULL,
21782 );
21783 utils::result(
21784 vips_op_response,
21785 utils::new_byte_array(buffer_out, buffer_buf_size),
21786 Error::MagicksaveBufferError,
21787 )
21788 }
21789}
21790
21791pub fn jxlsave(inp: &VipsImage, filename: &str) -> Result<()> {
21796 unsafe {
21797 let inp_in: *mut bindings::VipsImage = inp.ctx;
21798 let filename_in: CString = utils::new_c_string(filename)?;
21799
21800 let vips_op_response = bindings::vips_jxlsave(inp_in, filename_in.as_ptr(), NULL);
21801 utils::result(vips_op_response, (), Error::JxlsaveError)
21802 }
21803}
21804
21805#[derive(Clone, Debug)]
21807pub struct JxlsaveOptions {
21808 pub tier: i32,
21811 pub distance: f64,
21814 pub effort: i32,
21817 pub lossless: bool,
21820 pub q: i32,
21823 pub keep: ForeignKeep,
21832 pub background: Vec<f64>,
21834 pub page_height: i32,
21837 pub profile: String,
21839}
21840
21841impl std::default::Default for JxlsaveOptions {
21842 fn default() -> Self {
21843 JxlsaveOptions {
21844 tier: i32::from(0),
21845 distance: f64::from(1),
21846 effort: i32::from(7),
21847 lossless: false,
21848 q: i32::from(75),
21849 keep: ForeignKeep::All,
21850 background: Vec::new(),
21851 page_height: i32::from(0),
21852 profile: String::from("sRGB"),
21853 }
21854 }
21855}
21856
21857pub fn jxlsave_with_opts(
21863 inp: &VipsImage,
21864 filename: &str,
21865 jxlsave_options: &JxlsaveOptions,
21866) -> Result<()> {
21867 unsafe {
21868 let inp_in: *mut bindings::VipsImage = inp.ctx;
21869 let filename_in: CString = utils::new_c_string(filename)?;
21870
21871 let tier_in: i32 = jxlsave_options.tier;
21872 let tier_in_name = utils::new_c_string("tier")?;
21873
21874 let distance_in: f64 = jxlsave_options.distance;
21875 let distance_in_name = utils::new_c_string("distance")?;
21876
21877 let effort_in: i32 = jxlsave_options.effort;
21878 let effort_in_name = utils::new_c_string("effort")?;
21879
21880 let lossless_in: i32 = if jxlsave_options.lossless { 1 } else { 0 };
21881 let lossless_in_name = utils::new_c_string("lossless")?;
21882
21883 let q_in: i32 = jxlsave_options.q;
21884 let q_in_name = utils::new_c_string("Q")?;
21885
21886 let keep_in: i32 = jxlsave_options.keep as i32;
21887 let keep_in_name = utils::new_c_string("keep")?;
21888
21889 let background_wrapper =
21890 utils::VipsArrayDoubleWrapper::from(&jxlsave_options.background[..]);
21891 let background_in = background_wrapper.ctx;
21892 let background_in_name = utils::new_c_string("background")?;
21893
21894 let page_height_in: i32 = jxlsave_options.page_height;
21895 let page_height_in_name = utils::new_c_string("page-height")?;
21896
21897 let profile_in: CString = utils::new_c_string(&jxlsave_options.profile)?;
21898 let profile_in_name = utils::new_c_string("profile")?;
21899
21900 let vips_op_response = bindings::vips_jxlsave(
21901 inp_in,
21902 filename_in.as_ptr(),
21903 tier_in_name.as_ptr(),
21904 tier_in,
21905 distance_in_name.as_ptr(),
21906 distance_in,
21907 effort_in_name.as_ptr(),
21908 effort_in,
21909 lossless_in_name.as_ptr(),
21910 lossless_in,
21911 q_in_name.as_ptr(),
21912 q_in,
21913 keep_in_name.as_ptr(),
21914 keep_in,
21915 background_in_name.as_ptr(),
21916 background_in,
21917 page_height_in_name.as_ptr(),
21918 page_height_in,
21919 profile_in_name.as_ptr(),
21920 profile_in.as_ptr(),
21921 NULL,
21922 );
21923 utils::result(vips_op_response, (), Error::JxlsaveError)
21924 }
21925}
21926
21927pub fn jxlsave_buffer(inp: &VipsImage) -> Result<Vec<u8>> {
21931 unsafe {
21932 let inp_in: *mut bindings::VipsImage = inp.ctx;
21933 let mut buffer_buf_size: u64 = 0;
21934 let mut buffer_out: *mut c_void = null_mut();
21935
21936 let vips_op_response =
21937 bindings::vips_jxlsave_buffer(inp_in, &mut buffer_out, &mut buffer_buf_size, NULL);
21938 utils::result(
21939 vips_op_response,
21940 utils::new_byte_array(buffer_out, buffer_buf_size),
21941 Error::JxlsaveBufferError,
21942 )
21943 }
21944}
21945
21946#[derive(Clone, Debug)]
21948pub struct JxlsaveBufferOptions {
21949 pub tier: i32,
21952 pub distance: f64,
21955 pub effort: i32,
21958 pub lossless: bool,
21961 pub q: i32,
21964 pub keep: ForeignKeep,
21973 pub background: Vec<f64>,
21975 pub page_height: i32,
21978 pub profile: String,
21980}
21981
21982impl std::default::Default for JxlsaveBufferOptions {
21983 fn default() -> Self {
21984 JxlsaveBufferOptions {
21985 tier: i32::from(0),
21986 distance: f64::from(1),
21987 effort: i32::from(7),
21988 lossless: false,
21989 q: i32::from(75),
21990 keep: ForeignKeep::All,
21991 background: Vec::new(),
21992 page_height: i32::from(0),
21993 profile: String::from("sRGB"),
21994 }
21995 }
21996}
21997
21998pub fn jxlsave_buffer_with_opts(
22003 inp: &VipsImage,
22004 jxlsave_buffer_options: &JxlsaveBufferOptions,
22005) -> Result<Vec<u8>> {
22006 unsafe {
22007 let inp_in: *mut bindings::VipsImage = inp.ctx;
22008 let mut buffer_buf_size: u64 = 0;
22009 let mut buffer_out: *mut c_void = null_mut();
22010
22011 let tier_in: i32 = jxlsave_buffer_options.tier;
22012 let tier_in_name = utils::new_c_string("tier")?;
22013
22014 let distance_in: f64 = jxlsave_buffer_options.distance;
22015 let distance_in_name = utils::new_c_string("distance")?;
22016
22017 let effort_in: i32 = jxlsave_buffer_options.effort;
22018 let effort_in_name = utils::new_c_string("effort")?;
22019
22020 let lossless_in: i32 = if jxlsave_buffer_options.lossless {
22021 1
22022 } else {
22023 0
22024 };
22025 let lossless_in_name = utils::new_c_string("lossless")?;
22026
22027 let q_in: i32 = jxlsave_buffer_options.q;
22028 let q_in_name = utils::new_c_string("Q")?;
22029
22030 let keep_in: i32 = jxlsave_buffer_options.keep as i32;
22031 let keep_in_name = utils::new_c_string("keep")?;
22032
22033 let background_wrapper =
22034 utils::VipsArrayDoubleWrapper::from(&jxlsave_buffer_options.background[..]);
22035 let background_in = background_wrapper.ctx;
22036 let background_in_name = utils::new_c_string("background")?;
22037
22038 let page_height_in: i32 = jxlsave_buffer_options.page_height;
22039 let page_height_in_name = utils::new_c_string("page-height")?;
22040
22041 let profile_in: CString = utils::new_c_string(&jxlsave_buffer_options.profile)?;
22042 let profile_in_name = utils::new_c_string("profile")?;
22043
22044 let vips_op_response = bindings::vips_jxlsave_buffer(
22045 inp_in,
22046 &mut buffer_out,
22047 &mut buffer_buf_size,
22048 tier_in_name.as_ptr(),
22049 tier_in,
22050 distance_in_name.as_ptr(),
22051 distance_in,
22052 effort_in_name.as_ptr(),
22053 effort_in,
22054 lossless_in_name.as_ptr(),
22055 lossless_in,
22056 q_in_name.as_ptr(),
22057 q_in,
22058 keep_in_name.as_ptr(),
22059 keep_in,
22060 background_in_name.as_ptr(),
22061 background_in,
22062 page_height_in_name.as_ptr(),
22063 page_height_in,
22064 profile_in_name.as_ptr(),
22065 profile_in.as_ptr(),
22066 NULL,
22067 );
22068 utils::result(
22069 vips_op_response,
22070 utils::new_byte_array(buffer_out, buffer_buf_size),
22071 Error::JxlsaveBufferError,
22072 )
22073 }
22074}
22075
22076pub fn jxlsave_target(inp: &VipsImage, target: &VipsTarget) -> Result<()> {
22081 unsafe {
22082 let inp_in: *mut bindings::VipsImage = inp.ctx;
22083 let target_in: *mut bindings::VipsTarget = target.ctx;
22084
22085 let vips_op_response = bindings::vips_jxlsave_target(inp_in, target_in, NULL);
22086 utils::result(vips_op_response, (), Error::JxlsaveTargetError)
22087 }
22088}
22089
22090#[derive(Clone, Debug)]
22092pub struct JxlsaveTargetOptions {
22093 pub tier: i32,
22096 pub distance: f64,
22099 pub effort: i32,
22102 pub lossless: bool,
22105 pub q: i32,
22108 pub keep: ForeignKeep,
22117 pub background: Vec<f64>,
22119 pub page_height: i32,
22122 pub profile: String,
22124}
22125
22126impl std::default::Default for JxlsaveTargetOptions {
22127 fn default() -> Self {
22128 JxlsaveTargetOptions {
22129 tier: i32::from(0),
22130 distance: f64::from(1),
22131 effort: i32::from(7),
22132 lossless: false,
22133 q: i32::from(75),
22134 keep: ForeignKeep::All,
22135 background: Vec::new(),
22136 page_height: i32::from(0),
22137 profile: String::from("sRGB"),
22138 }
22139 }
22140}
22141
22142pub fn jxlsave_target_with_opts(
22148 inp: &VipsImage,
22149 target: &VipsTarget,
22150 jxlsave_target_options: &JxlsaveTargetOptions,
22151) -> Result<()> {
22152 unsafe {
22153 let inp_in: *mut bindings::VipsImage = inp.ctx;
22154 let target_in: *mut bindings::VipsTarget = target.ctx;
22155
22156 let tier_in: i32 = jxlsave_target_options.tier;
22157 let tier_in_name = utils::new_c_string("tier")?;
22158
22159 let distance_in: f64 = jxlsave_target_options.distance;
22160 let distance_in_name = utils::new_c_string("distance")?;
22161
22162 let effort_in: i32 = jxlsave_target_options.effort;
22163 let effort_in_name = utils::new_c_string("effort")?;
22164
22165 let lossless_in: i32 = if jxlsave_target_options.lossless {
22166 1
22167 } else {
22168 0
22169 };
22170 let lossless_in_name = utils::new_c_string("lossless")?;
22171
22172 let q_in: i32 = jxlsave_target_options.q;
22173 let q_in_name = utils::new_c_string("Q")?;
22174
22175 let keep_in: i32 = jxlsave_target_options.keep as i32;
22176 let keep_in_name = utils::new_c_string("keep")?;
22177
22178 let background_wrapper =
22179 utils::VipsArrayDoubleWrapper::from(&jxlsave_target_options.background[..]);
22180 let background_in = background_wrapper.ctx;
22181 let background_in_name = utils::new_c_string("background")?;
22182
22183 let page_height_in: i32 = jxlsave_target_options.page_height;
22184 let page_height_in_name = utils::new_c_string("page-height")?;
22185
22186 let profile_in: CString = utils::new_c_string(&jxlsave_target_options.profile)?;
22187 let profile_in_name = utils::new_c_string("profile")?;
22188
22189 let vips_op_response = bindings::vips_jxlsave_target(
22190 inp_in,
22191 target_in,
22192 tier_in_name.as_ptr(),
22193 tier_in,
22194 distance_in_name.as_ptr(),
22195 distance_in,
22196 effort_in_name.as_ptr(),
22197 effort_in,
22198 lossless_in_name.as_ptr(),
22199 lossless_in,
22200 q_in_name.as_ptr(),
22201 q_in,
22202 keep_in_name.as_ptr(),
22203 keep_in,
22204 background_in_name.as_ptr(),
22205 background_in,
22206 page_height_in_name.as_ptr(),
22207 page_height_in,
22208 profile_in_name.as_ptr(),
22209 profile_in.as_ptr(),
22210 NULL,
22211 );
22212 utils::result(vips_op_response, (), Error::JxlsaveTargetError)
22213 }
22214}
22215
22216pub fn thumbnail(filename: &str, width: i32) -> Result<VipsImage> {
22222 unsafe {
22223 let filename_in: CString = utils::new_c_string(filename)?;
22224 let width_in: i32 = width;
22225 let mut out_out: *mut bindings::VipsImage = null_mut();
22226
22227 let vips_op_response =
22228 bindings::vips_thumbnail(filename_in.as_ptr(), &mut out_out, width_in, NULL);
22229 utils::result(
22230 vips_op_response,
22231 VipsImage { ctx: out_out },
22232 Error::ThumbnailError,
22233 )
22234 }
22235}
22236
22237#[derive(Clone, Debug)]
22239pub struct ThumbnailOptions {
22240 pub height: i32,
22243 pub size: Size,
22250 pub no_rotate: bool,
22253 pub crop: Interesting,
22263 pub linear: bool,
22266 pub import_profile: String,
22268 pub export_profile: String,
22270 pub intent: Intent,
22277 pub fail_on: FailOn,
22284}
22285
22286impl std::default::Default for ThumbnailOptions {
22287 fn default() -> Self {
22288 ThumbnailOptions {
22289 height: i32::from(1),
22290 size: Size::Both,
22291 no_rotate: false,
22292 crop: Interesting::None,
22293 linear: false,
22294 import_profile: String::new(),
22295 export_profile: String::new(),
22296 intent: Intent::Relative,
22297 fail_on: FailOn::None,
22298 }
22299 }
22300}
22301
22302pub fn thumbnail_with_opts(
22309 filename: &str,
22310 width: i32,
22311 thumbnail_options: &ThumbnailOptions,
22312) -> Result<VipsImage> {
22313 unsafe {
22314 let filename_in: CString = utils::new_c_string(filename)?;
22315 let width_in: i32 = width;
22316 let mut out_out: *mut bindings::VipsImage = null_mut();
22317
22318 let height_in: i32 = thumbnail_options.height;
22319 let height_in_name = utils::new_c_string("height")?;
22320
22321 let size_in: i32 = thumbnail_options.size as i32;
22322 let size_in_name = utils::new_c_string("size")?;
22323
22324 let no_rotate_in: i32 = if thumbnail_options.no_rotate { 1 } else { 0 };
22325 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22326
22327 let crop_in: i32 = thumbnail_options.crop as i32;
22328 let crop_in_name = utils::new_c_string("crop")?;
22329
22330 let linear_in: i32 = if thumbnail_options.linear { 1 } else { 0 };
22331 let linear_in_name = utils::new_c_string("linear")?;
22332
22333 let import_profile_in: CString = utils::new_c_string(&thumbnail_options.import_profile)?;
22334 let import_profile_in_name = utils::new_c_string("import-profile")?;
22335
22336 let export_profile_in: CString = utils::new_c_string(&thumbnail_options.export_profile)?;
22337 let export_profile_in_name = utils::new_c_string("export-profile")?;
22338
22339 let intent_in: i32 = thumbnail_options.intent as i32;
22340 let intent_in_name = utils::new_c_string("intent")?;
22341
22342 let fail_on_in: i32 = thumbnail_options.fail_on as i32;
22343 let fail_on_in_name = utils::new_c_string("fail-on")?;
22344
22345 let vips_op_response = bindings::vips_thumbnail(
22346 filename_in.as_ptr(),
22347 &mut out_out,
22348 width_in,
22349 height_in_name.as_ptr(),
22350 height_in,
22351 size_in_name.as_ptr(),
22352 size_in,
22353 no_rotate_in_name.as_ptr(),
22354 no_rotate_in,
22355 crop_in_name.as_ptr(),
22356 crop_in,
22357 linear_in_name.as_ptr(),
22358 linear_in,
22359 import_profile_in_name.as_ptr(),
22360 import_profile_in.as_ptr(),
22361 export_profile_in_name.as_ptr(),
22362 export_profile_in.as_ptr(),
22363 intent_in_name.as_ptr(),
22364 intent_in,
22365 fail_on_in_name.as_ptr(),
22366 fail_on_in,
22367 NULL,
22368 );
22369 utils::result(
22370 vips_op_response,
22371 VipsImage { ctx: out_out },
22372 Error::ThumbnailError,
22373 )
22374 }
22375}
22376
22377pub fn thumbnail_buffer(buffer: &[u8], width: i32) -> Result<VipsImage> {
22383 unsafe {
22384 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
22385 let width_in: i32 = width;
22386 let mut out_out: *mut bindings::VipsImage = null_mut();
22387
22388 let vips_op_response = bindings::vips_thumbnail_buffer(
22389 buffer_in,
22390 buffer.len() as u64,
22391 &mut out_out,
22392 width_in,
22393 NULL,
22394 );
22395 utils::result(
22396 vips_op_response,
22397 VipsImage { ctx: out_out },
22398 Error::ThumbnailBufferError,
22399 )
22400 }
22401}
22402
22403#[derive(Clone, Debug)]
22405pub struct ThumbnailBufferOptions {
22406 pub option_string: String,
22408 pub height: i32,
22411 pub size: Size,
22418 pub no_rotate: bool,
22421 pub crop: Interesting,
22431 pub linear: bool,
22434 pub import_profile: String,
22436 pub export_profile: String,
22438 pub intent: Intent,
22445 pub fail_on: FailOn,
22452}
22453
22454impl std::default::Default for ThumbnailBufferOptions {
22455 fn default() -> Self {
22456 ThumbnailBufferOptions {
22457 option_string: String::new(),
22458 height: i32::from(1),
22459 size: Size::Both,
22460 no_rotate: false,
22461 crop: Interesting::None,
22462 linear: false,
22463 import_profile: String::new(),
22464 export_profile: String::new(),
22465 intent: Intent::Relative,
22466 fail_on: FailOn::None,
22467 }
22468 }
22469}
22470
22471pub fn thumbnail_buffer_with_opts(
22478 buffer: &[u8],
22479 width: i32,
22480 thumbnail_buffer_options: &ThumbnailBufferOptions,
22481) -> Result<VipsImage> {
22482 unsafe {
22483 let buffer_in: *mut c_void = buffer.as_ptr() as *mut c_void;
22484 let width_in: i32 = width;
22485 let mut out_out: *mut bindings::VipsImage = null_mut();
22486
22487 let option_string_in: CString =
22488 utils::new_c_string(&thumbnail_buffer_options.option_string)?;
22489 let option_string_in_name = utils::new_c_string("option-string")?;
22490
22491 let height_in: i32 = thumbnail_buffer_options.height;
22492 let height_in_name = utils::new_c_string("height")?;
22493
22494 let size_in: i32 = thumbnail_buffer_options.size as i32;
22495 let size_in_name = utils::new_c_string("size")?;
22496
22497 let no_rotate_in: i32 = if thumbnail_buffer_options.no_rotate {
22498 1
22499 } else {
22500 0
22501 };
22502 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22503
22504 let crop_in: i32 = thumbnail_buffer_options.crop as i32;
22505 let crop_in_name = utils::new_c_string("crop")?;
22506
22507 let linear_in: i32 = if thumbnail_buffer_options.linear {
22508 1
22509 } else {
22510 0
22511 };
22512 let linear_in_name = utils::new_c_string("linear")?;
22513
22514 let import_profile_in: CString =
22515 utils::new_c_string(&thumbnail_buffer_options.import_profile)?;
22516 let import_profile_in_name = utils::new_c_string("import-profile")?;
22517
22518 let export_profile_in: CString =
22519 utils::new_c_string(&thumbnail_buffer_options.export_profile)?;
22520 let export_profile_in_name = utils::new_c_string("export-profile")?;
22521
22522 let intent_in: i32 = thumbnail_buffer_options.intent as i32;
22523 let intent_in_name = utils::new_c_string("intent")?;
22524
22525 let fail_on_in: i32 = thumbnail_buffer_options.fail_on as i32;
22526 let fail_on_in_name = utils::new_c_string("fail-on")?;
22527
22528 let vips_op_response = bindings::vips_thumbnail_buffer(
22529 buffer_in,
22530 buffer.len() as u64,
22531 &mut out_out,
22532 width_in,
22533 option_string_in_name.as_ptr(),
22534 option_string_in.as_ptr(),
22535 height_in_name.as_ptr(),
22536 height_in,
22537 size_in_name.as_ptr(),
22538 size_in,
22539 no_rotate_in_name.as_ptr(),
22540 no_rotate_in,
22541 crop_in_name.as_ptr(),
22542 crop_in,
22543 linear_in_name.as_ptr(),
22544 linear_in,
22545 import_profile_in_name.as_ptr(),
22546 import_profile_in.as_ptr(),
22547 export_profile_in_name.as_ptr(),
22548 export_profile_in.as_ptr(),
22549 intent_in_name.as_ptr(),
22550 intent_in,
22551 fail_on_in_name.as_ptr(),
22552 fail_on_in,
22553 NULL,
22554 );
22555 utils::result(
22556 vips_op_response,
22557 VipsImage { ctx: out_out },
22558 Error::ThumbnailBufferError,
22559 )
22560 }
22561}
22562
22563pub fn thumbnail_image(inp: &VipsImage, width: i32) -> Result<VipsImage> {
22569 unsafe {
22570 let inp_in: *mut bindings::VipsImage = inp.ctx;
22571 let width_in: i32 = width;
22572 let mut out_out: *mut bindings::VipsImage = null_mut();
22573
22574 let vips_op_response = bindings::vips_thumbnail_image(inp_in, &mut out_out, width_in, NULL);
22575 utils::result(
22576 vips_op_response,
22577 VipsImage { ctx: out_out },
22578 Error::ThumbnailImageError,
22579 )
22580 }
22581}
22582
22583#[derive(Clone, Debug)]
22585pub struct ThumbnailImageOptions {
22586 pub height: i32,
22589 pub size: Size,
22596 pub no_rotate: bool,
22599 pub crop: Interesting,
22609 pub linear: bool,
22612 pub import_profile: String,
22614 pub export_profile: String,
22616 pub intent: Intent,
22623 pub fail_on: FailOn,
22630}
22631
22632impl std::default::Default for ThumbnailImageOptions {
22633 fn default() -> Self {
22634 ThumbnailImageOptions {
22635 height: i32::from(1),
22636 size: Size::Both,
22637 no_rotate: false,
22638 crop: Interesting::None,
22639 linear: false,
22640 import_profile: String::new(),
22641 export_profile: String::new(),
22642 intent: Intent::Relative,
22643 fail_on: FailOn::None,
22644 }
22645 }
22646}
22647
22648pub fn thumbnail_image_with_opts(
22655 inp: &VipsImage,
22656 width: i32,
22657 thumbnail_image_options: &ThumbnailImageOptions,
22658) -> Result<VipsImage> {
22659 unsafe {
22660 let inp_in: *mut bindings::VipsImage = inp.ctx;
22661 let width_in: i32 = width;
22662 let mut out_out: *mut bindings::VipsImage = null_mut();
22663
22664 let height_in: i32 = thumbnail_image_options.height;
22665 let height_in_name = utils::new_c_string("height")?;
22666
22667 let size_in: i32 = thumbnail_image_options.size as i32;
22668 let size_in_name = utils::new_c_string("size")?;
22669
22670 let no_rotate_in: i32 = if thumbnail_image_options.no_rotate {
22671 1
22672 } else {
22673 0
22674 };
22675 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22676
22677 let crop_in: i32 = thumbnail_image_options.crop as i32;
22678 let crop_in_name = utils::new_c_string("crop")?;
22679
22680 let linear_in: i32 = if thumbnail_image_options.linear { 1 } else { 0 };
22681 let linear_in_name = utils::new_c_string("linear")?;
22682
22683 let import_profile_in: CString =
22684 utils::new_c_string(&thumbnail_image_options.import_profile)?;
22685 let import_profile_in_name = utils::new_c_string("import-profile")?;
22686
22687 let export_profile_in: CString =
22688 utils::new_c_string(&thumbnail_image_options.export_profile)?;
22689 let export_profile_in_name = utils::new_c_string("export-profile")?;
22690
22691 let intent_in: i32 = thumbnail_image_options.intent as i32;
22692 let intent_in_name = utils::new_c_string("intent")?;
22693
22694 let fail_on_in: i32 = thumbnail_image_options.fail_on as i32;
22695 let fail_on_in_name = utils::new_c_string("fail-on")?;
22696
22697 let vips_op_response = bindings::vips_thumbnail_image(
22698 inp_in,
22699 &mut out_out,
22700 width_in,
22701 height_in_name.as_ptr(),
22702 height_in,
22703 size_in_name.as_ptr(),
22704 size_in,
22705 no_rotate_in_name.as_ptr(),
22706 no_rotate_in,
22707 crop_in_name.as_ptr(),
22708 crop_in,
22709 linear_in_name.as_ptr(),
22710 linear_in,
22711 import_profile_in_name.as_ptr(),
22712 import_profile_in.as_ptr(),
22713 export_profile_in_name.as_ptr(),
22714 export_profile_in.as_ptr(),
22715 intent_in_name.as_ptr(),
22716 intent_in,
22717 fail_on_in_name.as_ptr(),
22718 fail_on_in,
22719 NULL,
22720 );
22721 utils::result(
22722 vips_op_response,
22723 VipsImage { ctx: out_out },
22724 Error::ThumbnailImageError,
22725 )
22726 }
22727}
22728
22729pub fn thumbnail_source(source: &VipsSource, width: i32) -> Result<VipsImage> {
22735 unsafe {
22736 let source_in: *mut bindings::VipsSource = source.ctx;
22737 let width_in: i32 = width;
22738 let mut out_out: *mut bindings::VipsImage = null_mut();
22739
22740 let vips_op_response =
22741 bindings::vips_thumbnail_source(source_in, &mut out_out, width_in, NULL);
22742 utils::result(
22743 vips_op_response,
22744 VipsImage { ctx: out_out },
22745 Error::ThumbnailSourceError,
22746 )
22747 }
22748}
22749
22750#[derive(Clone, Debug)]
22752pub struct ThumbnailSourceOptions {
22753 pub option_string: String,
22755 pub height: i32,
22758 pub size: Size,
22765 pub no_rotate: bool,
22768 pub crop: Interesting,
22778 pub linear: bool,
22781 pub import_profile: String,
22783 pub export_profile: String,
22785 pub intent: Intent,
22792 pub fail_on: FailOn,
22799}
22800
22801impl std::default::Default for ThumbnailSourceOptions {
22802 fn default() -> Self {
22803 ThumbnailSourceOptions {
22804 option_string: String::new(),
22805 height: i32::from(1),
22806 size: Size::Both,
22807 no_rotate: false,
22808 crop: Interesting::None,
22809 linear: false,
22810 import_profile: String::new(),
22811 export_profile: String::new(),
22812 intent: Intent::Relative,
22813 fail_on: FailOn::None,
22814 }
22815 }
22816}
22817
22818pub fn thumbnail_source_with_opts(
22825 source: &VipsSource,
22826 width: i32,
22827 thumbnail_source_options: &ThumbnailSourceOptions,
22828) -> Result<VipsImage> {
22829 unsafe {
22830 let source_in: *mut bindings::VipsSource = source.ctx;
22831 let width_in: i32 = width;
22832 let mut out_out: *mut bindings::VipsImage = null_mut();
22833
22834 let option_string_in: CString =
22835 utils::new_c_string(&thumbnail_source_options.option_string)?;
22836 let option_string_in_name = utils::new_c_string("option-string")?;
22837
22838 let height_in: i32 = thumbnail_source_options.height;
22839 let height_in_name = utils::new_c_string("height")?;
22840
22841 let size_in: i32 = thumbnail_source_options.size as i32;
22842 let size_in_name = utils::new_c_string("size")?;
22843
22844 let no_rotate_in: i32 = if thumbnail_source_options.no_rotate {
22845 1
22846 } else {
22847 0
22848 };
22849 let no_rotate_in_name = utils::new_c_string("no-rotate")?;
22850
22851 let crop_in: i32 = thumbnail_source_options.crop as i32;
22852 let crop_in_name = utils::new_c_string("crop")?;
22853
22854 let linear_in: i32 = if thumbnail_source_options.linear {
22855 1
22856 } else {
22857 0
22858 };
22859 let linear_in_name = utils::new_c_string("linear")?;
22860
22861 let import_profile_in: CString =
22862 utils::new_c_string(&thumbnail_source_options.import_profile)?;
22863 let import_profile_in_name = utils::new_c_string("import-profile")?;
22864
22865 let export_profile_in: CString =
22866 utils::new_c_string(&thumbnail_source_options.export_profile)?;
22867 let export_profile_in_name = utils::new_c_string("export-profile")?;
22868
22869 let intent_in: i32 = thumbnail_source_options.intent as i32;
22870 let intent_in_name = utils::new_c_string("intent")?;
22871
22872 let fail_on_in: i32 = thumbnail_source_options.fail_on as i32;
22873 let fail_on_in_name = utils::new_c_string("fail-on")?;
22874
22875 let vips_op_response = bindings::vips_thumbnail_source(
22876 source_in,
22877 &mut out_out,
22878 width_in,
22879 option_string_in_name.as_ptr(),
22880 option_string_in.as_ptr(),
22881 height_in_name.as_ptr(),
22882 height_in,
22883 size_in_name.as_ptr(),
22884 size_in,
22885 no_rotate_in_name.as_ptr(),
22886 no_rotate_in,
22887 crop_in_name.as_ptr(),
22888 crop_in,
22889 linear_in_name.as_ptr(),
22890 linear_in,
22891 import_profile_in_name.as_ptr(),
22892 import_profile_in.as_ptr(),
22893 export_profile_in_name.as_ptr(),
22894 export_profile_in.as_ptr(),
22895 intent_in_name.as_ptr(),
22896 intent_in,
22897 fail_on_in_name.as_ptr(),
22898 fail_on_in,
22899 NULL,
22900 );
22901 utils::result(
22902 vips_op_response,
22903 VipsImage { ctx: out_out },
22904 Error::ThumbnailSourceError,
22905 )
22906 }
22907}
22908
22909pub fn mapim(inp: &VipsImage, index: &VipsImage) -> Result<VipsImage> {
22914 unsafe {
22915 let inp_in: *mut bindings::VipsImage = inp.ctx;
22916 let index_in: *mut bindings::VipsImage = index.ctx;
22917 let mut out_out: *mut bindings::VipsImage = null_mut();
22918
22919 let vips_op_response = bindings::vips_mapim(inp_in, &mut out_out, index_in, NULL);
22920 utils::result(
22921 vips_op_response,
22922 VipsImage { ctx: out_out },
22923 Error::MapimError,
22924 )
22925 }
22926}
22927
22928#[derive(Clone, Debug)]
22930pub struct MapimOptions {
22931 pub interpolate: VipsInterpolate,
22933 pub background: Vec<f64>,
22935 pub premultiplied: bool,
22938 pub extend: Extend,
22947}
22948
22949impl std::default::Default for MapimOptions {
22950 fn default() -> Self {
22951 MapimOptions {
22952 interpolate: VipsInterpolate::new(),
22953 background: Vec::new(),
22954 premultiplied: false,
22955 extend: Extend::Background,
22956 }
22957 }
22958}
22959
22960pub fn mapim_with_opts(
22966 inp: &VipsImage,
22967 index: &VipsImage,
22968 mapim_options: &MapimOptions,
22969) -> Result<VipsImage> {
22970 unsafe {
22971 let inp_in: *mut bindings::VipsImage = inp.ctx;
22972 let index_in: *mut bindings::VipsImage = index.ctx;
22973 let mut out_out: *mut bindings::VipsImage = null_mut();
22974
22975 let interpolate_in: *mut bindings::VipsInterpolate = mapim_options.interpolate.ctx;
22976 let interpolate_in_name = utils::new_c_string("interpolate")?;
22977
22978 let background_wrapper = utils::VipsArrayDoubleWrapper::from(&mapim_options.background[..]);
22979 let background_in = background_wrapper.ctx;
22980 let background_in_name = utils::new_c_string("background")?;
22981
22982 let premultiplied_in: i32 = if mapim_options.premultiplied { 1 } else { 0 };
22983 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
22984
22985 let extend_in: i32 = mapim_options.extend as i32;
22986 let extend_in_name = utils::new_c_string("extend")?;
22987
22988 let vips_op_response = bindings::vips_mapim(
22989 inp_in,
22990 &mut out_out,
22991 index_in,
22992 interpolate_in_name.as_ptr(),
22993 interpolate_in,
22994 background_in_name.as_ptr(),
22995 background_in,
22996 premultiplied_in_name.as_ptr(),
22997 premultiplied_in,
22998 extend_in_name.as_ptr(),
22999 extend_in,
23000 NULL,
23001 );
23002 utils::result(
23003 vips_op_response,
23004 VipsImage { ctx: out_out },
23005 Error::MapimError,
23006 )
23007 }
23008}
23009
23010pub fn shrink(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
23018 unsafe {
23019 let inp_in: *mut bindings::VipsImage = inp.ctx;
23020 let hshrink_in: f64 = hshrink;
23021 let vshrink_in: f64 = vshrink;
23022 let mut out_out: *mut bindings::VipsImage = null_mut();
23023
23024 let vips_op_response =
23025 bindings::vips_shrink(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
23026 utils::result(
23027 vips_op_response,
23028 VipsImage { ctx: out_out },
23029 Error::ShrinkError,
23030 )
23031 }
23032}
23033
23034#[derive(Clone, Debug)]
23036pub struct ShrinkOptions {
23037 pub ceil: bool,
23040}
23041
23042impl std::default::Default for ShrinkOptions {
23043 fn default() -> Self {
23044 ShrinkOptions { ceil: false }
23045 }
23046}
23047
23048pub fn shrink_with_opts(
23057 inp: &VipsImage,
23058 hshrink: f64,
23059 vshrink: f64,
23060 shrink_options: &ShrinkOptions,
23061) -> Result<VipsImage> {
23062 unsafe {
23063 let inp_in: *mut bindings::VipsImage = inp.ctx;
23064 let hshrink_in: f64 = hshrink;
23065 let vshrink_in: f64 = vshrink;
23066 let mut out_out: *mut bindings::VipsImage = null_mut();
23067
23068 let ceil_in: i32 = if shrink_options.ceil { 1 } else { 0 };
23069 let ceil_in_name = utils::new_c_string("ceil")?;
23070
23071 let vips_op_response = bindings::vips_shrink(
23072 inp_in,
23073 &mut out_out,
23074 hshrink_in,
23075 vshrink_in,
23076 ceil_in_name.as_ptr(),
23077 ceil_in,
23078 NULL,
23079 );
23080 utils::result(
23081 vips_op_response,
23082 VipsImage { ctx: out_out },
23083 Error::ShrinkError,
23084 )
23085 }
23086}
23087
23088pub fn shrinkh(inp: &VipsImage, hshrink: i32) -> Result<VipsImage> {
23094 unsafe {
23095 let inp_in: *mut bindings::VipsImage = inp.ctx;
23096 let hshrink_in: i32 = hshrink;
23097 let mut out_out: *mut bindings::VipsImage = null_mut();
23098
23099 let vips_op_response = bindings::vips_shrinkh(inp_in, &mut out_out, hshrink_in, NULL);
23100 utils::result(
23101 vips_op_response,
23102 VipsImage { ctx: out_out },
23103 Error::ShrinkhError,
23104 )
23105 }
23106}
23107
23108#[derive(Clone, Debug)]
23110pub struct ShrinkhOptions {
23111 pub ceil: bool,
23114}
23115
23116impl std::default::Default for ShrinkhOptions {
23117 fn default() -> Self {
23118 ShrinkhOptions { ceil: false }
23119 }
23120}
23121
23122pub fn shrinkh_with_opts(
23129 inp: &VipsImage,
23130 hshrink: i32,
23131 shrinkh_options: &ShrinkhOptions,
23132) -> Result<VipsImage> {
23133 unsafe {
23134 let inp_in: *mut bindings::VipsImage = inp.ctx;
23135 let hshrink_in: i32 = hshrink;
23136 let mut out_out: *mut bindings::VipsImage = null_mut();
23137
23138 let ceil_in: i32 = if shrinkh_options.ceil { 1 } else { 0 };
23139 let ceil_in_name = utils::new_c_string("ceil")?;
23140
23141 let vips_op_response = bindings::vips_shrinkh(
23142 inp_in,
23143 &mut out_out,
23144 hshrink_in,
23145 ceil_in_name.as_ptr(),
23146 ceil_in,
23147 NULL,
23148 );
23149 utils::result(
23150 vips_op_response,
23151 VipsImage { ctx: out_out },
23152 Error::ShrinkhError,
23153 )
23154 }
23155}
23156
23157pub fn shrinkv(inp: &VipsImage, vshrink: i32) -> Result<VipsImage> {
23163 unsafe {
23164 let inp_in: *mut bindings::VipsImage = inp.ctx;
23165 let vshrink_in: i32 = vshrink;
23166 let mut out_out: *mut bindings::VipsImage = null_mut();
23167
23168 let vips_op_response = bindings::vips_shrinkv(inp_in, &mut out_out, vshrink_in, NULL);
23169 utils::result(
23170 vips_op_response,
23171 VipsImage { ctx: out_out },
23172 Error::ShrinkvError,
23173 )
23174 }
23175}
23176
23177#[derive(Clone, Debug)]
23179pub struct ShrinkvOptions {
23180 pub ceil: bool,
23183}
23184
23185impl std::default::Default for ShrinkvOptions {
23186 fn default() -> Self {
23187 ShrinkvOptions { ceil: false }
23188 }
23189}
23190
23191pub fn shrinkv_with_opts(
23198 inp: &VipsImage,
23199 vshrink: i32,
23200 shrinkv_options: &ShrinkvOptions,
23201) -> Result<VipsImage> {
23202 unsafe {
23203 let inp_in: *mut bindings::VipsImage = inp.ctx;
23204 let vshrink_in: i32 = vshrink;
23205 let mut out_out: *mut bindings::VipsImage = null_mut();
23206
23207 let ceil_in: i32 = if shrinkv_options.ceil { 1 } else { 0 };
23208 let ceil_in_name = utils::new_c_string("ceil")?;
23209
23210 let vips_op_response = bindings::vips_shrinkv(
23211 inp_in,
23212 &mut out_out,
23213 vshrink_in,
23214 ceil_in_name.as_ptr(),
23215 ceil_in,
23216 NULL,
23217 );
23218 utils::result(
23219 vips_op_response,
23220 VipsImage { ctx: out_out },
23221 Error::ShrinkvError,
23222 )
23223 }
23224}
23225
23226pub fn reduceh(inp: &VipsImage, hshrink: f64) -> Result<VipsImage> {
23232 unsafe {
23233 let inp_in: *mut bindings::VipsImage = inp.ctx;
23234 let hshrink_in: f64 = hshrink;
23235 let mut out_out: *mut bindings::VipsImage = null_mut();
23236
23237 let vips_op_response = bindings::vips_reduceh(inp_in, &mut out_out, hshrink_in, NULL);
23238 utils::result(
23239 vips_op_response,
23240 VipsImage { ctx: out_out },
23241 Error::ReducehError,
23242 )
23243 }
23244}
23245
23246#[derive(Clone, Debug)]
23248pub struct ReducehOptions {
23249 pub kernel: Kernel,
23258 pub gap: f64,
23261}
23262
23263impl std::default::Default for ReducehOptions {
23264 fn default() -> Self {
23265 ReducehOptions {
23266 kernel: Kernel::Lanczos3,
23267 gap: f64::from(0),
23268 }
23269 }
23270}
23271
23272pub fn reduceh_with_opts(
23279 inp: &VipsImage,
23280 hshrink: f64,
23281 reduceh_options: &ReducehOptions,
23282) -> Result<VipsImage> {
23283 unsafe {
23284 let inp_in: *mut bindings::VipsImage = inp.ctx;
23285 let hshrink_in: f64 = hshrink;
23286 let mut out_out: *mut bindings::VipsImage = null_mut();
23287
23288 let kernel_in: i32 = reduceh_options.kernel as i32;
23289 let kernel_in_name = utils::new_c_string("kernel")?;
23290
23291 let gap_in: f64 = reduceh_options.gap;
23292 let gap_in_name = utils::new_c_string("gap")?;
23293
23294 let vips_op_response = bindings::vips_reduceh(
23295 inp_in,
23296 &mut out_out,
23297 hshrink_in,
23298 kernel_in_name.as_ptr(),
23299 kernel_in,
23300 gap_in_name.as_ptr(),
23301 gap_in,
23302 NULL,
23303 );
23304 utils::result(
23305 vips_op_response,
23306 VipsImage { ctx: out_out },
23307 Error::ReducehError,
23308 )
23309 }
23310}
23311
23312pub fn reducev(inp: &VipsImage, vshrink: f64) -> Result<VipsImage> {
23318 unsafe {
23319 let inp_in: *mut bindings::VipsImage = inp.ctx;
23320 let vshrink_in: f64 = vshrink;
23321 let mut out_out: *mut bindings::VipsImage = null_mut();
23322
23323 let vips_op_response = bindings::vips_reducev(inp_in, &mut out_out, vshrink_in, NULL);
23324 utils::result(
23325 vips_op_response,
23326 VipsImage { ctx: out_out },
23327 Error::ReducevError,
23328 )
23329 }
23330}
23331
23332#[derive(Clone, Debug)]
23334pub struct ReducevOptions {
23335 pub kernel: Kernel,
23344 pub gap: f64,
23347}
23348
23349impl std::default::Default for ReducevOptions {
23350 fn default() -> Self {
23351 ReducevOptions {
23352 kernel: Kernel::Lanczos3,
23353 gap: f64::from(0),
23354 }
23355 }
23356}
23357
23358pub fn reducev_with_opts(
23365 inp: &VipsImage,
23366 vshrink: f64,
23367 reducev_options: &ReducevOptions,
23368) -> Result<VipsImage> {
23369 unsafe {
23370 let inp_in: *mut bindings::VipsImage = inp.ctx;
23371 let vshrink_in: f64 = vshrink;
23372 let mut out_out: *mut bindings::VipsImage = null_mut();
23373
23374 let kernel_in: i32 = reducev_options.kernel as i32;
23375 let kernel_in_name = utils::new_c_string("kernel")?;
23376
23377 let gap_in: f64 = reducev_options.gap;
23378 let gap_in_name = utils::new_c_string("gap")?;
23379
23380 let vips_op_response = bindings::vips_reducev(
23381 inp_in,
23382 &mut out_out,
23383 vshrink_in,
23384 kernel_in_name.as_ptr(),
23385 kernel_in,
23386 gap_in_name.as_ptr(),
23387 gap_in,
23388 NULL,
23389 );
23390 utils::result(
23391 vips_op_response,
23392 VipsImage { ctx: out_out },
23393 Error::ReducevError,
23394 )
23395 }
23396}
23397
23398pub fn reduce(inp: &VipsImage, hshrink: f64, vshrink: f64) -> Result<VipsImage> {
23406 unsafe {
23407 let inp_in: *mut bindings::VipsImage = inp.ctx;
23408 let hshrink_in: f64 = hshrink;
23409 let vshrink_in: f64 = vshrink;
23410 let mut out_out: *mut bindings::VipsImage = null_mut();
23411
23412 let vips_op_response =
23413 bindings::vips_reduce(inp_in, &mut out_out, hshrink_in, vshrink_in, NULL);
23414 utils::result(
23415 vips_op_response,
23416 VipsImage { ctx: out_out },
23417 Error::ReduceError,
23418 )
23419 }
23420}
23421
23422#[derive(Clone, Debug)]
23424pub struct ReduceOptions {
23425 pub kernel: Kernel,
23434 pub gap: f64,
23437}
23438
23439impl std::default::Default for ReduceOptions {
23440 fn default() -> Self {
23441 ReduceOptions {
23442 kernel: Kernel::Lanczos3,
23443 gap: f64::from(0),
23444 }
23445 }
23446}
23447
23448pub fn reduce_with_opts(
23457 inp: &VipsImage,
23458 hshrink: f64,
23459 vshrink: f64,
23460 reduce_options: &ReduceOptions,
23461) -> Result<VipsImage> {
23462 unsafe {
23463 let inp_in: *mut bindings::VipsImage = inp.ctx;
23464 let hshrink_in: f64 = hshrink;
23465 let vshrink_in: f64 = vshrink;
23466 let mut out_out: *mut bindings::VipsImage = null_mut();
23467
23468 let kernel_in: i32 = reduce_options.kernel as i32;
23469 let kernel_in_name = utils::new_c_string("kernel")?;
23470
23471 let gap_in: f64 = reduce_options.gap;
23472 let gap_in_name = utils::new_c_string("gap")?;
23473
23474 let vips_op_response = bindings::vips_reduce(
23475 inp_in,
23476 &mut out_out,
23477 hshrink_in,
23478 vshrink_in,
23479 kernel_in_name.as_ptr(),
23480 kernel_in,
23481 gap_in_name.as_ptr(),
23482 gap_in,
23483 NULL,
23484 );
23485 utils::result(
23486 vips_op_response,
23487 VipsImage { ctx: out_out },
23488 Error::ReduceError,
23489 )
23490 }
23491}
23492
23493pub fn quadratic(inp: &VipsImage, coeff: &VipsImage) -> Result<VipsImage> {
23498 unsafe {
23499 let inp_in: *mut bindings::VipsImage = inp.ctx;
23500 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
23501 let mut out_out: *mut bindings::VipsImage = null_mut();
23502
23503 let vips_op_response = bindings::vips_quadratic(inp_in, &mut out_out, coeff_in, NULL);
23504 utils::result(
23505 vips_op_response,
23506 VipsImage { ctx: out_out },
23507 Error::QuadraticError,
23508 )
23509 }
23510}
23511
23512#[derive(Clone, Debug)]
23514pub struct QuadraticOptions {
23515 pub interpolate: VipsInterpolate,
23517}
23518
23519impl std::default::Default for QuadraticOptions {
23520 fn default() -> Self {
23521 QuadraticOptions {
23522 interpolate: VipsInterpolate::new(),
23523 }
23524 }
23525}
23526
23527pub fn quadratic_with_opts(
23533 inp: &VipsImage,
23534 coeff: &VipsImage,
23535 quadratic_options: &QuadraticOptions,
23536) -> Result<VipsImage> {
23537 unsafe {
23538 let inp_in: *mut bindings::VipsImage = inp.ctx;
23539 let coeff_in: *mut bindings::VipsImage = coeff.ctx;
23540 let mut out_out: *mut bindings::VipsImage = null_mut();
23541
23542 let interpolate_in: *mut bindings::VipsInterpolate = quadratic_options.interpolate.ctx;
23543 let interpolate_in_name = utils::new_c_string("interpolate")?;
23544
23545 let vips_op_response = bindings::vips_quadratic(
23546 inp_in,
23547 &mut out_out,
23548 coeff_in,
23549 interpolate_in_name.as_ptr(),
23550 interpolate_in,
23551 NULL,
23552 );
23553 utils::result(
23554 vips_op_response,
23555 VipsImage { ctx: out_out },
23556 Error::QuadraticError,
23557 )
23558 }
23559}
23560
23561pub fn affine(inp: &VipsImage, a: f64, b: f64, c: f64, d: f64) -> Result<VipsImage> {
23573 unsafe {
23574 let inp_in: *mut bindings::VipsImage = inp.ctx;
23575 let a_in: f64 = a;
23576 let b_in: f64 = b;
23577 let c_in: f64 = c;
23578 let d_in: f64 = d;
23579 let mut out_out: *mut bindings::VipsImage = null_mut();
23580
23581 let vips_op_response =
23582 bindings::vips_affine(inp_in, &mut out_out, a_in, b_in, c_in, d_in, NULL);
23583 utils::result(
23584 vips_op_response,
23585 VipsImage { ctx: out_out },
23586 Error::AffineError,
23587 )
23588 }
23589}
23590
23591#[derive(Clone, Debug)]
23593pub struct AffineOptions {
23594 pub interpolate: VipsInterpolate,
23596 pub oarea: Vec<i32>,
23598 pub odx: f64,
23601 pub ody: f64,
23604 pub idx: f64,
23607 pub idy: f64,
23610 pub background: Vec<f64>,
23612 pub premultiplied: bool,
23615 pub extend: Extend,
23624}
23625
23626impl std::default::Default for AffineOptions {
23627 fn default() -> Self {
23628 AffineOptions {
23629 interpolate: VipsInterpolate::new(),
23630 oarea: Vec::new(),
23631 odx: f64::from(0),
23632 ody: f64::from(0),
23633 idx: f64::from(0),
23634 idy: f64::from(0),
23635 background: Vec::new(),
23636 premultiplied: false,
23637 extend: Extend::Background,
23638 }
23639 }
23640}
23641
23642pub fn affine_with_opts(
23655 inp: &VipsImage,
23656 a: f64,
23657 b: f64,
23658 c: f64,
23659 d: f64,
23660 affine_options: &AffineOptions,
23661) -> Result<VipsImage> {
23662 unsafe {
23663 let inp_in: *mut bindings::VipsImage = inp.ctx;
23664 let a_in: f64 = a;
23665 let b_in: f64 = b;
23666 let c_in: f64 = c;
23667 let d_in: f64 = d;
23668 let mut out_out: *mut bindings::VipsImage = null_mut();
23669
23670 let interpolate_in: *mut bindings::VipsInterpolate = affine_options.interpolate.ctx;
23671 let interpolate_in_name = utils::new_c_string("interpolate")?;
23672
23673 let oarea_wrapper = utils::VipsArrayIntWrapper::from(&affine_options.oarea[..]);
23674 let oarea_in = oarea_wrapper.ctx;
23675 let oarea_in_name = utils::new_c_string("oarea")?;
23676
23677 let odx_in: f64 = affine_options.odx;
23678 let odx_in_name = utils::new_c_string("odx")?;
23679
23680 let ody_in: f64 = affine_options.ody;
23681 let ody_in_name = utils::new_c_string("ody")?;
23682
23683 let idx_in: f64 = affine_options.idx;
23684 let idx_in_name = utils::new_c_string("idx")?;
23685
23686 let idy_in: f64 = affine_options.idy;
23687 let idy_in_name = utils::new_c_string("idy")?;
23688
23689 let background_wrapper =
23690 utils::VipsArrayDoubleWrapper::from(&affine_options.background[..]);
23691 let background_in = background_wrapper.ctx;
23692 let background_in_name = utils::new_c_string("background")?;
23693
23694 let premultiplied_in: i32 = if affine_options.premultiplied { 1 } else { 0 };
23695 let premultiplied_in_name = utils::new_c_string("premultiplied")?;
23696
23697 let extend_in: i32 = affine_options.extend as i32;
23698 let extend_in_name = utils::new_c_string("extend")?;
23699
23700 let vips_op_response = bindings::vips_affine(
23701 inp_in,
23702 &mut out_out,
23703 a_in,
23704 b_in,
23705 c_in,
23706 d_in,
23707 interpolate_in_name.as_ptr(),
23708 interpolate_in,
23709 oarea_in_name.as_ptr(),
23710 oarea_in,
23711 odx_in_name.as_ptr(),
23712 odx_in,
23713 ody_in_name.as_ptr(),
23714 ody_in,
23715 idx_in_name.as_ptr(),
23716 idx_in,
23717 idy_in_name.as_ptr(),
23718 idy_in,
23719 background_in_name.as_ptr(),
23720 background_in,
23721 premultiplied_in_name.as_ptr(),
23722 premultiplied_in,
23723 extend_in_name.as_ptr(),
23724 extend_in,
23725 NULL,
23726 );
23727 utils::result(
23728 vips_op_response,
23729 VipsImage { ctx: out_out },
23730 Error::AffineError,
23731 )
23732 }
23733}
23734
23735pub fn similarity(inp: &VipsImage) -> Result<VipsImage> {
23739 unsafe {
23740 let inp_in: *mut bindings::VipsImage = inp.ctx;
23741 let mut out_out: *mut bindings::VipsImage = null_mut();
23742
23743 let vips_op_response = bindings::vips_similarity(inp_in, &mut out_out, NULL);
23744 utils::result(
23745 vips_op_response,
23746 VipsImage { ctx: out_out },
23747 Error::SimilarityError,
23748 )
23749 }
23750}
23751
23752#[derive(Clone, Debug)]
23754pub struct SimilarityOptions {
23755 pub scale: f64,
23758 pub angle: f64,
23761 pub interpolate: VipsInterpolate,
23763 pub background: Vec<f64>,
23765 pub odx: f64,
23768 pub ody: f64,
23771 pub idx: f64,
23774 pub idy: f64,
23777}
23778
23779impl std::default::Default for SimilarityOptions {
23780 fn default() -> Self {
23781 SimilarityOptions {
23782 scale: f64::from(1),
23783 angle: f64::from(0),
23784 interpolate: VipsInterpolate::new(),
23785 background: Vec::new(),
23786 odx: f64::from(0),
23787 ody: f64::from(0),
23788 idx: f64::from(0),
23789 idy: f64::from(0),
23790 }
23791 }
23792}
23793
23794pub fn similarity_with_opts(
23799 inp: &VipsImage,
23800 similarity_options: &SimilarityOptions,
23801) -> Result<VipsImage> {
23802 unsafe {
23803 let inp_in: *mut bindings::VipsImage = inp.ctx;
23804 let mut out_out: *mut bindings::VipsImage = null_mut();
23805
23806 let scale_in: f64 = similarity_options.scale;
23807 let scale_in_name = utils::new_c_string("scale")?;
23808
23809 let angle_in: f64 = similarity_options.angle;
23810 let angle_in_name = utils::new_c_string("angle")?;
23811
23812 let interpolate_in: *mut bindings::VipsInterpolate = similarity_options.interpolate.ctx;
23813 let interpolate_in_name = utils::new_c_string("interpolate")?;
23814
23815 let background_wrapper =
23816 utils::VipsArrayDoubleWrapper::from(&similarity_options.background[..]);
23817 let background_in = background_wrapper.ctx;
23818 let background_in_name = utils::new_c_string("background")?;
23819
23820 let odx_in: f64 = similarity_options.odx;
23821 let odx_in_name = utils::new_c_string("odx")?;
23822
23823 let ody_in: f64 = similarity_options.ody;
23824 let ody_in_name = utils::new_c_string("ody")?;
23825
23826 let idx_in: f64 = similarity_options.idx;
23827 let idx_in_name = utils::new_c_string("idx")?;
23828
23829 let idy_in: f64 = similarity_options.idy;
23830 let idy_in_name = utils::new_c_string("idy")?;
23831
23832 let vips_op_response = bindings::vips_similarity(
23833 inp_in,
23834 &mut out_out,
23835 scale_in_name.as_ptr(),
23836 scale_in,
23837 angle_in_name.as_ptr(),
23838 angle_in,
23839 interpolate_in_name.as_ptr(),
23840 interpolate_in,
23841 background_in_name.as_ptr(),
23842 background_in,
23843 odx_in_name.as_ptr(),
23844 odx_in,
23845 ody_in_name.as_ptr(),
23846 ody_in,
23847 idx_in_name.as_ptr(),
23848 idx_in,
23849 idy_in_name.as_ptr(),
23850 idy_in,
23851 NULL,
23852 );
23853 utils::result(
23854 vips_op_response,
23855 VipsImage { ctx: out_out },
23856 Error::SimilarityError,
23857 )
23858 }
23859}
23860
23861pub fn rotate(inp: &VipsImage, angle: f64) -> Result<VipsImage> {
23867 unsafe {
23868 let inp_in: *mut bindings::VipsImage = inp.ctx;
23869 let angle_in: f64 = angle;
23870 let mut out_out: *mut bindings::VipsImage = null_mut();
23871
23872 let vips_op_response = bindings::vips_rotate(inp_in, &mut out_out, angle_in, NULL);
23873 utils::result(
23874 vips_op_response,
23875 VipsImage { ctx: out_out },
23876 Error::RotateError,
23877 )
23878 }
23879}
23880
23881#[derive(Clone, Debug)]
23883pub struct RotateOptions {
23884 pub interpolate: VipsInterpolate,
23886 pub background: Vec<f64>,
23888 pub odx: f64,
23891 pub ody: f64,
23894 pub idx: f64,
23897 pub idy: f64,
23900}
23901
23902impl std::default::Default for RotateOptions {
23903 fn default() -> Self {
23904 RotateOptions {
23905 interpolate: VipsInterpolate::new(),
23906 background: Vec::new(),
23907 odx: f64::from(0),
23908 ody: f64::from(0),
23909 idx: f64::from(0),
23910 idy: f64::from(0),
23911 }
23912 }
23913}
23914
23915pub fn rotate_with_opts(
23922 inp: &VipsImage,
23923 angle: f64,
23924 rotate_options: &RotateOptions,
23925) -> Result<VipsImage> {
23926 unsafe {
23927 let inp_in: *mut bindings::VipsImage = inp.ctx;
23928 let angle_in: f64 = angle;
23929 let mut out_out: *mut bindings::VipsImage = null_mut();
23930
23931 let interpolate_in: *mut bindings::VipsInterpolate = rotate_options.interpolate.ctx;
23932 let interpolate_in_name = utils::new_c_string("interpolate")?;
23933
23934 let background_wrapper =
23935 utils::VipsArrayDoubleWrapper::from(&rotate_options.background[..]);
23936 let background_in = background_wrapper.ctx;
23937 let background_in_name = utils::new_c_string("background")?;
23938
23939 let odx_in: f64 = rotate_options.odx;
23940 let odx_in_name = utils::new_c_string("odx")?;
23941
23942 let ody_in: f64 = rotate_options.ody;
23943 let ody_in_name = utils::new_c_string("ody")?;
23944
23945 let idx_in: f64 = rotate_options.idx;
23946 let idx_in_name = utils::new_c_string("idx")?;
23947
23948 let idy_in: f64 = rotate_options.idy;
23949 let idy_in_name = utils::new_c_string("idy")?;
23950
23951 let vips_op_response = bindings::vips_rotate(
23952 inp_in,
23953 &mut out_out,
23954 angle_in,
23955 interpolate_in_name.as_ptr(),
23956 interpolate_in,
23957 background_in_name.as_ptr(),
23958 background_in,
23959 odx_in_name.as_ptr(),
23960 odx_in,
23961 ody_in_name.as_ptr(),
23962 ody_in,
23963 idx_in_name.as_ptr(),
23964 idx_in,
23965 idy_in_name.as_ptr(),
23966 idy_in,
23967 NULL,
23968 );
23969 utils::result(
23970 vips_op_response,
23971 VipsImage { ctx: out_out },
23972 Error::RotateError,
23973 )
23974 }
23975}
23976
23977pub fn resize(inp: &VipsImage, scale: f64) -> Result<VipsImage> {
23983 unsafe {
23984 let inp_in: *mut bindings::VipsImage = inp.ctx;
23985 let scale_in: f64 = scale;
23986 let mut out_out: *mut bindings::VipsImage = null_mut();
23987
23988 let vips_op_response = bindings::vips_resize(inp_in, &mut out_out, scale_in, NULL);
23989 utils::result(
23990 vips_op_response,
23991 VipsImage { ctx: out_out },
23992 Error::ResizeError,
23993 )
23994 }
23995}
23996
23997#[derive(Clone, Debug)]
23999pub struct ResizeOptions {
24000 pub kernel: Kernel,
24009 pub gap: f64,
24012 pub vscale: f64,
24015}
24016
24017impl std::default::Default for ResizeOptions {
24018 fn default() -> Self {
24019 ResizeOptions {
24020 kernel: Kernel::Lanczos3,
24021 gap: f64::from(2),
24022 vscale: f64::from(0),
24023 }
24024 }
24025}
24026
24027pub fn resize_with_opts(
24034 inp: &VipsImage,
24035 scale: f64,
24036 resize_options: &ResizeOptions,
24037) -> Result<VipsImage> {
24038 unsafe {
24039 let inp_in: *mut bindings::VipsImage = inp.ctx;
24040 let scale_in: f64 = scale;
24041 let mut out_out: *mut bindings::VipsImage = null_mut();
24042
24043 let kernel_in: i32 = resize_options.kernel as i32;
24044 let kernel_in_name = utils::new_c_string("kernel")?;
24045
24046 let gap_in: f64 = resize_options.gap;
24047 let gap_in_name = utils::new_c_string("gap")?;
24048
24049 let vscale_in: f64 = resize_options.vscale;
24050 let vscale_in_name = utils::new_c_string("vscale")?;
24051
24052 let vips_op_response = bindings::vips_resize(
24053 inp_in,
24054 &mut out_out,
24055 scale_in,
24056 kernel_in_name.as_ptr(),
24057 kernel_in,
24058 gap_in_name.as_ptr(),
24059 gap_in,
24060 vscale_in_name.as_ptr(),
24061 vscale_in,
24062 NULL,
24063 );
24064 utils::result(
24065 vips_op_response,
24066 VipsImage { ctx: out_out },
24067 Error::ResizeError,
24068 )
24069 }
24070}
24071
24072pub fn colourspace(inp: &VipsImage, space: Interpretation) -> Result<VipsImage> {
24098 unsafe {
24099 let inp_in: *mut bindings::VipsImage = inp.ctx;
24100 let space_in: i32 = space as i32;
24101 let mut out_out: *mut bindings::VipsImage = null_mut();
24102
24103 let vips_op_response =
24104 bindings::vips_colourspace(inp_in, &mut out_out, space_in.try_into().unwrap(), NULL);
24105 utils::result(
24106 vips_op_response,
24107 VipsImage { ctx: out_out },
24108 Error::ColourspaceError,
24109 )
24110 }
24111}
24112
24113#[derive(Clone, Debug)]
24115pub struct ColourspaceOptions {
24116 pub source_space: Interpretation,
24139}
24140
24141impl std::default::Default for ColourspaceOptions {
24142 fn default() -> Self {
24143 ColourspaceOptions {
24144 source_space: Interpretation::Srgb,
24145 }
24146 }
24147}
24148
24149pub fn colourspace_with_opts(
24176 inp: &VipsImage,
24177 space: Interpretation,
24178 colourspace_options: &ColourspaceOptions,
24179) -> Result<VipsImage> {
24180 unsafe {
24181 let inp_in: *mut bindings::VipsImage = inp.ctx;
24182 let space_in: i32 = space as i32;
24183 let mut out_out: *mut bindings::VipsImage = null_mut();
24184
24185 let source_space_in: i32 = colourspace_options.source_space as i32;
24186 let source_space_in_name = utils::new_c_string("source-space")?;
24187
24188 let vips_op_response = bindings::vips_colourspace(
24189 inp_in,
24190 &mut out_out,
24191 space_in.try_into().unwrap(),
24192 source_space_in_name.as_ptr(),
24193 source_space_in,
24194 NULL,
24195 );
24196 utils::result(
24197 vips_op_response,
24198 VipsImage { ctx: out_out },
24199 Error::ColourspaceError,
24200 )
24201 }
24202}
24203
24204pub fn lab_2xyz(inp: &VipsImage) -> Result<VipsImage> {
24208 unsafe {
24209 let inp_in: *mut bindings::VipsImage = inp.ctx;
24210 let mut out_out: *mut bindings::VipsImage = null_mut();
24211
24212 let vips_op_response = bindings::vips_Lab2XYZ(inp_in, &mut out_out, NULL);
24213 utils::result(
24214 vips_op_response,
24215 VipsImage { ctx: out_out },
24216 Error::Lab2XyzError,
24217 )
24218 }
24219}
24220
24221#[derive(Clone, Debug)]
24223pub struct Lab2XyzOptions {
24224 pub temp: Vec<f64>,
24226}
24227
24228impl std::default::Default for Lab2XyzOptions {
24229 fn default() -> Self {
24230 Lab2XyzOptions { temp: Vec::new() }
24231 }
24232}
24233
24234pub fn lab_2xyz_with_opts(inp: &VipsImage, lab_2xyz_options: &Lab2XyzOptions) -> Result<VipsImage> {
24239 unsafe {
24240 let inp_in: *mut bindings::VipsImage = inp.ctx;
24241 let mut out_out: *mut bindings::VipsImage = null_mut();
24242
24243 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&lab_2xyz_options.temp[..]);
24244 let temp_in = temp_wrapper.ctx;
24245 let temp_in_name = utils::new_c_string("temp")?;
24246
24247 let vips_op_response =
24248 bindings::vips_Lab2XYZ(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
24249 utils::result(
24250 vips_op_response,
24251 VipsImage { ctx: out_out },
24252 Error::Lab2XyzError,
24253 )
24254 }
24255}
24256
24257pub fn xyz2_lab(inp: &VipsImage) -> Result<VipsImage> {
24261 unsafe {
24262 let inp_in: *mut bindings::VipsImage = inp.ctx;
24263 let mut out_out: *mut bindings::VipsImage = null_mut();
24264
24265 let vips_op_response = bindings::vips_XYZ2Lab(inp_in, &mut out_out, NULL);
24266 utils::result(
24267 vips_op_response,
24268 VipsImage { ctx: out_out },
24269 Error::Xyz2LabError,
24270 )
24271 }
24272}
24273
24274#[derive(Clone, Debug)]
24276pub struct Xyz2LabOptions {
24277 pub temp: Vec<f64>,
24279}
24280
24281impl std::default::Default for Xyz2LabOptions {
24282 fn default() -> Self {
24283 Xyz2LabOptions { temp: Vec::new() }
24284 }
24285}
24286
24287pub fn xyz2_lab_with_opts(
24292 inp: &VipsImage,
24293 xyz_2_lab_options: &Xyz2LabOptions,
24294) -> Result<VipsImage> {
24295 unsafe {
24296 let inp_in: *mut bindings::VipsImage = inp.ctx;
24297 let mut out_out: *mut bindings::VipsImage = null_mut();
24298
24299 let temp_wrapper = utils::VipsArrayDoubleWrapper::from(&xyz_2_lab_options.temp[..]);
24300 let temp_in = temp_wrapper.ctx;
24301 let temp_in_name = utils::new_c_string("temp")?;
24302
24303 let vips_op_response =
24304 bindings::vips_XYZ2Lab(inp_in, &mut out_out, temp_in_name.as_ptr(), temp_in, NULL);
24305 utils::result(
24306 vips_op_response,
24307 VipsImage { ctx: out_out },
24308 Error::Xyz2LabError,
24309 )
24310 }
24311}
24312
24313pub fn lab_2l_ch(inp: &VipsImage) -> Result<VipsImage> {
24317 unsafe {
24318 let inp_in: *mut bindings::VipsImage = inp.ctx;
24319 let mut out_out: *mut bindings::VipsImage = null_mut();
24320
24321 let vips_op_response = bindings::vips_Lab2LCh(inp_in, &mut out_out, NULL);
24322 utils::result(
24323 vips_op_response,
24324 VipsImage { ctx: out_out },
24325 Error::Lab2LChError,
24326 )
24327 }
24328}
24329
24330pub fn l_ch_2_lab(inp: &VipsImage) -> Result<VipsImage> {
24334 unsafe {
24335 let inp_in: *mut bindings::VipsImage = inp.ctx;
24336 let mut out_out: *mut bindings::VipsImage = null_mut();
24337
24338 let vips_op_response = bindings::vips_LCh2Lab(inp_in, &mut out_out, NULL);
24339 utils::result(
24340 vips_op_response,
24341 VipsImage { ctx: out_out },
24342 Error::LCh2LabError,
24343 )
24344 }
24345}
24346
24347pub fn l_ch_2cmc(inp: &VipsImage) -> Result<VipsImage> {
24351 unsafe {
24352 let inp_in: *mut bindings::VipsImage = inp.ctx;
24353 let mut out_out: *mut bindings::VipsImage = null_mut();
24354
24355 let vips_op_response = bindings::vips_LCh2CMC(inp_in, &mut out_out, NULL);
24356 utils::result(
24357 vips_op_response,
24358 VipsImage { ctx: out_out },
24359 Error::LCh2CmcError,
24360 )
24361 }
24362}
24363
24364pub fn cmc2l_ch(inp: &VipsImage) -> Result<VipsImage> {
24368 unsafe {
24369 let inp_in: *mut bindings::VipsImage = inp.ctx;
24370 let mut out_out: *mut bindings::VipsImage = null_mut();
24371
24372 let vips_op_response = bindings::vips_CMC2LCh(inp_in, &mut out_out, NULL);
24373 utils::result(
24374 vips_op_response,
24375 VipsImage { ctx: out_out },
24376 Error::Cmc2LChError,
24377 )
24378 }
24379}
24380
24381pub fn xyz2_yxy(inp: &VipsImage) -> Result<VipsImage> {
24385 unsafe {
24386 let inp_in: *mut bindings::VipsImage = inp.ctx;
24387 let mut out_out: *mut bindings::VipsImage = null_mut();
24388
24389 let vips_op_response = bindings::vips_XYZ2Yxy(inp_in, &mut out_out, NULL);
24390 utils::result(
24391 vips_op_response,
24392 VipsImage { ctx: out_out },
24393 Error::Xyz2YxyError,
24394 )
24395 }
24396}
24397
24398pub fn yxy_2xyz(inp: &VipsImage) -> Result<VipsImage> {
24402 unsafe {
24403 let inp_in: *mut bindings::VipsImage = inp.ctx;
24404 let mut out_out: *mut bindings::VipsImage = null_mut();
24405
24406 let vips_op_response = bindings::vips_Yxy2XYZ(inp_in, &mut out_out, NULL);
24407 utils::result(
24408 vips_op_response,
24409 VipsImage { ctx: out_out },
24410 Error::Yxy2XyzError,
24411 )
24412 }
24413}
24414
24415pub fn lab_q2_lab(inp: &VipsImage) -> Result<VipsImage> {
24419 unsafe {
24420 let inp_in: *mut bindings::VipsImage = inp.ctx;
24421 let mut out_out: *mut bindings::VipsImage = null_mut();
24422
24423 let vips_op_response = bindings::vips_LabQ2Lab(inp_in, &mut out_out, NULL);
24424 utils::result(
24425 vips_op_response,
24426 VipsImage { ctx: out_out },
24427 Error::LabQ2LabError,
24428 )
24429 }
24430}
24431
24432pub fn lab_2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
24436 unsafe {
24437 let inp_in: *mut bindings::VipsImage = inp.ctx;
24438 let mut out_out: *mut bindings::VipsImage = null_mut();
24439
24440 let vips_op_response = bindings::vips_Lab2LabQ(inp_in, &mut out_out, NULL);
24441 utils::result(
24442 vips_op_response,
24443 VipsImage { ctx: out_out },
24444 Error::Lab2LabQError,
24445 )
24446 }
24447}
24448
24449pub fn lab_q2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
24453 unsafe {
24454 let inp_in: *mut bindings::VipsImage = inp.ctx;
24455 let mut out_out: *mut bindings::VipsImage = null_mut();
24456
24457 let vips_op_response = bindings::vips_LabQ2LabS(inp_in, &mut out_out, NULL);
24458 utils::result(
24459 vips_op_response,
24460 VipsImage { ctx: out_out },
24461 Error::LabQ2LabSError,
24462 )
24463 }
24464}
24465
24466pub fn lab_s2_lab_q(inp: &VipsImage) -> Result<VipsImage> {
24470 unsafe {
24471 let inp_in: *mut bindings::VipsImage = inp.ctx;
24472 let mut out_out: *mut bindings::VipsImage = null_mut();
24473
24474 let vips_op_response = bindings::vips_LabS2LabQ(inp_in, &mut out_out, NULL);
24475 utils::result(
24476 vips_op_response,
24477 VipsImage { ctx: out_out },
24478 Error::LabS2LabQError,
24479 )
24480 }
24481}
24482
24483pub fn lab_s2_lab(inp: &VipsImage) -> Result<VipsImage> {
24487 unsafe {
24488 let inp_in: *mut bindings::VipsImage = inp.ctx;
24489 let mut out_out: *mut bindings::VipsImage = null_mut();
24490
24491 let vips_op_response = bindings::vips_LabS2Lab(inp_in, &mut out_out, NULL);
24492 utils::result(
24493 vips_op_response,
24494 VipsImage { ctx: out_out },
24495 Error::LabS2LabError,
24496 )
24497 }
24498}
24499
24500pub fn lab_2_lab_s(inp: &VipsImage) -> Result<VipsImage> {
24504 unsafe {
24505 let inp_in: *mut bindings::VipsImage = inp.ctx;
24506 let mut out_out: *mut bindings::VipsImage = null_mut();
24507
24508 let vips_op_response = bindings::vips_Lab2LabS(inp_in, &mut out_out, NULL);
24509 utils::result(
24510 vips_op_response,
24511 VipsImage { ctx: out_out },
24512 Error::Lab2LabSError,
24513 )
24514 }
24515}
24516
24517pub fn rad_2float(inp: &VipsImage) -> Result<VipsImage> {
24521 unsafe {
24522 let inp_in: *mut bindings::VipsImage = inp.ctx;
24523 let mut out_out: *mut bindings::VipsImage = null_mut();
24524
24525 let vips_op_response = bindings::vips_rad2float(inp_in, &mut out_out, NULL);
24526 utils::result(
24527 vips_op_response,
24528 VipsImage { ctx: out_out },
24529 Error::Rad2FloatError,
24530 )
24531 }
24532}
24533
24534pub fn float_2rad(inp: &VipsImage) -> Result<VipsImage> {
24538 unsafe {
24539 let inp_in: *mut bindings::VipsImage = inp.ctx;
24540 let mut out_out: *mut bindings::VipsImage = null_mut();
24541
24542 let vips_op_response = bindings::vips_float2rad(inp_in, &mut out_out, NULL);
24543 utils::result(
24544 vips_op_response,
24545 VipsImage { ctx: out_out },
24546 Error::Float2RadError,
24547 )
24548 }
24549}
24550
24551pub fn lab_q_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
24555 unsafe {
24556 let inp_in: *mut bindings::VipsImage = inp.ctx;
24557 let mut out_out: *mut bindings::VipsImage = null_mut();
24558
24559 let vips_op_response = bindings::vips_LabQ2sRGB(inp_in, &mut out_out, NULL);
24560 utils::result(
24561 vips_op_response,
24562 VipsImage { ctx: out_out },
24563 Error::LabQ2SRgbError,
24564 )
24565 }
24566}
24567
24568pub fn s_rgb2hsv(inp: &VipsImage) -> Result<VipsImage> {
24572 unsafe {
24573 let inp_in: *mut bindings::VipsImage = inp.ctx;
24574 let mut out_out: *mut bindings::VipsImage = null_mut();
24575
24576 let vips_op_response = bindings::vips_sRGB2HSV(inp_in, &mut out_out, NULL);
24577 utils::result(
24578 vips_op_response,
24579 VipsImage { ctx: out_out },
24580 Error::SRgb2HsvError,
24581 )
24582 }
24583}
24584
24585pub fn hsv_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
24589 unsafe {
24590 let inp_in: *mut bindings::VipsImage = inp.ctx;
24591 let mut out_out: *mut bindings::VipsImage = null_mut();
24592
24593 let vips_op_response = bindings::vips_HSV2sRGB(inp_in, &mut out_out, NULL);
24594 utils::result(
24595 vips_op_response,
24596 VipsImage { ctx: out_out },
24597 Error::Hsv2SRgbError,
24598 )
24599 }
24600}
24601
24602pub fn icc_import(inp: &VipsImage) -> Result<VipsImage> {
24606 unsafe {
24607 let inp_in: *mut bindings::VipsImage = inp.ctx;
24608 let mut out_out: *mut bindings::VipsImage = null_mut();
24609
24610 let vips_op_response = bindings::vips_icc_import(inp_in, &mut out_out, NULL);
24611 utils::result(
24612 vips_op_response,
24613 VipsImage { ctx: out_out },
24614 Error::IccImportError,
24615 )
24616 }
24617}
24618
24619#[derive(Clone, Debug)]
24621pub struct IccImportOptions {
24622 pub pcs: PCS,
24627 pub intent: Intent,
24634 pub black_point_compensation: bool,
24637 pub embedded: bool,
24640 pub input_profile: String,
24642}
24643
24644impl std::default::Default for IccImportOptions {
24645 fn default() -> Self {
24646 IccImportOptions {
24647 pcs: PCS::Lab,
24648 intent: Intent::Relative,
24649 black_point_compensation: false,
24650 embedded: false,
24651 input_profile: String::new(),
24652 }
24653 }
24654}
24655
24656pub fn icc_import_with_opts(
24661 inp: &VipsImage,
24662 icc_import_options: &IccImportOptions,
24663) -> Result<VipsImage> {
24664 unsafe {
24665 let inp_in: *mut bindings::VipsImage = inp.ctx;
24666 let mut out_out: *mut bindings::VipsImage = null_mut();
24667
24668 let pcs_in: i32 = icc_import_options.pcs as i32;
24669 let pcs_in_name = utils::new_c_string("pcs")?;
24670
24671 let intent_in: i32 = icc_import_options.intent as i32;
24672 let intent_in_name = utils::new_c_string("intent")?;
24673
24674 let black_point_compensation_in: i32 = if icc_import_options.black_point_compensation {
24675 1
24676 } else {
24677 0
24678 };
24679 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24680
24681 let embedded_in: i32 = if icc_import_options.embedded { 1 } else { 0 };
24682 let embedded_in_name = utils::new_c_string("embedded")?;
24683
24684 let input_profile_in: CString = utils::new_c_string(&icc_import_options.input_profile)?;
24685 let input_profile_in_name = utils::new_c_string("input-profile")?;
24686
24687 let vips_op_response = bindings::vips_icc_import(
24688 inp_in,
24689 &mut out_out,
24690 pcs_in_name.as_ptr(),
24691 pcs_in,
24692 intent_in_name.as_ptr(),
24693 intent_in,
24694 black_point_compensation_in_name.as_ptr(),
24695 black_point_compensation_in,
24696 embedded_in_name.as_ptr(),
24697 embedded_in,
24698 input_profile_in_name.as_ptr(),
24699 input_profile_in.as_ptr(),
24700 NULL,
24701 );
24702 utils::result(
24703 vips_op_response,
24704 VipsImage { ctx: out_out },
24705 Error::IccImportError,
24706 )
24707 }
24708}
24709
24710pub fn icc_export(inp: &VipsImage) -> Result<VipsImage> {
24714 unsafe {
24715 let inp_in: *mut bindings::VipsImage = inp.ctx;
24716 let mut out_out: *mut bindings::VipsImage = null_mut();
24717
24718 let vips_op_response = bindings::vips_icc_export(inp_in, &mut out_out, NULL);
24719 utils::result(
24720 vips_op_response,
24721 VipsImage { ctx: out_out },
24722 Error::IccExportError,
24723 )
24724 }
24725}
24726
24727#[derive(Clone, Debug)]
24729pub struct IccExportOptions {
24730 pub pcs: PCS,
24735 pub intent: Intent,
24742 pub black_point_compensation: bool,
24745 pub output_profile: String,
24747 pub depth: i32,
24750}
24751
24752impl std::default::Default for IccExportOptions {
24753 fn default() -> Self {
24754 IccExportOptions {
24755 pcs: PCS::Lab,
24756 intent: Intent::Relative,
24757 black_point_compensation: false,
24758 output_profile: String::new(),
24759 depth: i32::from(8),
24760 }
24761 }
24762}
24763
24764pub fn icc_export_with_opts(
24769 inp: &VipsImage,
24770 icc_export_options: &IccExportOptions,
24771) -> Result<VipsImage> {
24772 unsafe {
24773 let inp_in: *mut bindings::VipsImage = inp.ctx;
24774 let mut out_out: *mut bindings::VipsImage = null_mut();
24775
24776 let pcs_in: i32 = icc_export_options.pcs as i32;
24777 let pcs_in_name = utils::new_c_string("pcs")?;
24778
24779 let intent_in: i32 = icc_export_options.intent as i32;
24780 let intent_in_name = utils::new_c_string("intent")?;
24781
24782 let black_point_compensation_in: i32 = if icc_export_options.black_point_compensation {
24783 1
24784 } else {
24785 0
24786 };
24787 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24788
24789 let output_profile_in: CString = utils::new_c_string(&icc_export_options.output_profile)?;
24790 let output_profile_in_name = utils::new_c_string("output-profile")?;
24791
24792 let depth_in: i32 = icc_export_options.depth;
24793 let depth_in_name = utils::new_c_string("depth")?;
24794
24795 let vips_op_response = bindings::vips_icc_export(
24796 inp_in,
24797 &mut out_out,
24798 pcs_in_name.as_ptr(),
24799 pcs_in,
24800 intent_in_name.as_ptr(),
24801 intent_in,
24802 black_point_compensation_in_name.as_ptr(),
24803 black_point_compensation_in,
24804 output_profile_in_name.as_ptr(),
24805 output_profile_in.as_ptr(),
24806 depth_in_name.as_ptr(),
24807 depth_in,
24808 NULL,
24809 );
24810 utils::result(
24811 vips_op_response,
24812 VipsImage { ctx: out_out },
24813 Error::IccExportError,
24814 )
24815 }
24816}
24817
24818pub fn icc_transform(inp: &VipsImage, output_profile: &str) -> Result<VipsImage> {
24823 unsafe {
24824 let inp_in: *mut bindings::VipsImage = inp.ctx;
24825 let output_profile_in: CString = utils::new_c_string(output_profile)?;
24826 let mut out_out: *mut bindings::VipsImage = null_mut();
24827
24828 let vips_op_response =
24829 bindings::vips_icc_transform(inp_in, &mut out_out, output_profile_in.as_ptr(), NULL);
24830 utils::result(
24831 vips_op_response,
24832 VipsImage { ctx: out_out },
24833 Error::IccTransformError,
24834 )
24835 }
24836}
24837
24838#[derive(Clone, Debug)]
24840pub struct IccTransformOptions {
24841 pub pcs: PCS,
24846 pub intent: Intent,
24853 pub black_point_compensation: bool,
24856 pub embedded: bool,
24859 pub input_profile: String,
24861 pub depth: i32,
24864}
24865
24866impl std::default::Default for IccTransformOptions {
24867 fn default() -> Self {
24868 IccTransformOptions {
24869 pcs: PCS::Lab,
24870 intent: Intent::Relative,
24871 black_point_compensation: false,
24872 embedded: false,
24873 input_profile: String::new(),
24874 depth: i32::from(8),
24875 }
24876 }
24877}
24878
24879pub fn icc_transform_with_opts(
24885 inp: &VipsImage,
24886 output_profile: &str,
24887 icc_transform_options: &IccTransformOptions,
24888) -> Result<VipsImage> {
24889 unsafe {
24890 let inp_in: *mut bindings::VipsImage = inp.ctx;
24891 let output_profile_in: CString = utils::new_c_string(output_profile)?;
24892 let mut out_out: *mut bindings::VipsImage = null_mut();
24893
24894 let pcs_in: i32 = icc_transform_options.pcs as i32;
24895 let pcs_in_name = utils::new_c_string("pcs")?;
24896
24897 let intent_in: i32 = icc_transform_options.intent as i32;
24898 let intent_in_name = utils::new_c_string("intent")?;
24899
24900 let black_point_compensation_in: i32 = if icc_transform_options.black_point_compensation {
24901 1
24902 } else {
24903 0
24904 };
24905 let black_point_compensation_in_name = utils::new_c_string("black-point-compensation")?;
24906
24907 let embedded_in: i32 = if icc_transform_options.embedded { 1 } else { 0 };
24908 let embedded_in_name = utils::new_c_string("embedded")?;
24909
24910 let input_profile_in: CString = utils::new_c_string(&icc_transform_options.input_profile)?;
24911 let input_profile_in_name = utils::new_c_string("input-profile")?;
24912
24913 let depth_in: i32 = icc_transform_options.depth;
24914 let depth_in_name = utils::new_c_string("depth")?;
24915
24916 let vips_op_response = bindings::vips_icc_transform(
24917 inp_in,
24918 &mut out_out,
24919 output_profile_in.as_ptr(),
24920 pcs_in_name.as_ptr(),
24921 pcs_in,
24922 intent_in_name.as_ptr(),
24923 intent_in,
24924 black_point_compensation_in_name.as_ptr(),
24925 black_point_compensation_in,
24926 embedded_in_name.as_ptr(),
24927 embedded_in,
24928 input_profile_in_name.as_ptr(),
24929 input_profile_in.as_ptr(),
24930 depth_in_name.as_ptr(),
24931 depth_in,
24932 NULL,
24933 );
24934 utils::result(
24935 vips_op_response,
24936 VipsImage { ctx: out_out },
24937 Error::IccTransformError,
24938 )
24939 }
24940}
24941
24942pub fn d_e76(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24947 unsafe {
24948 let left_in: *mut bindings::VipsImage = left.ctx;
24949 let right_in: *mut bindings::VipsImage = right.ctx;
24950 let mut out_out: *mut bindings::VipsImage = null_mut();
24951
24952 let vips_op_response = bindings::vips_dE76(left_in, right_in, &mut out_out, NULL);
24953 utils::result(
24954 vips_op_response,
24955 VipsImage { ctx: out_out },
24956 Error::DE76Error,
24957 )
24958 }
24959}
24960
24961pub fn d_e00(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24966 unsafe {
24967 let left_in: *mut bindings::VipsImage = left.ctx;
24968 let right_in: *mut bindings::VipsImage = right.ctx;
24969 let mut out_out: *mut bindings::VipsImage = null_mut();
24970
24971 let vips_op_response = bindings::vips_dE00(left_in, right_in, &mut out_out, NULL);
24972 utils::result(
24973 vips_op_response,
24974 VipsImage { ctx: out_out },
24975 Error::DE00Error,
24976 )
24977 }
24978}
24979
24980pub fn d_ecmc(left: &VipsImage, right: &VipsImage) -> Result<VipsImage> {
24985 unsafe {
24986 let left_in: *mut bindings::VipsImage = left.ctx;
24987 let right_in: *mut bindings::VipsImage = right.ctx;
24988 let mut out_out: *mut bindings::VipsImage = null_mut();
24989
24990 let vips_op_response = bindings::vips_dECMC(left_in, right_in, &mut out_out, NULL);
24991 utils::result(
24992 vips_op_response,
24993 VipsImage { ctx: out_out },
24994 Error::DEcmcError,
24995 )
24996 }
24997}
24998
24999pub fn s_rgb_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
25003 unsafe {
25004 let inp_in: *mut bindings::VipsImage = inp.ctx;
25005 let mut out_out: *mut bindings::VipsImage = null_mut();
25006
25007 let vips_op_response = bindings::vips_sRGB2scRGB(inp_in, &mut out_out, NULL);
25008 utils::result(
25009 vips_op_response,
25010 VipsImage { ctx: out_out },
25011 Error::SRgb2ScRgbError,
25012 )
25013 }
25014}
25015
25016pub fn sc_rgb2xyz(inp: &VipsImage) -> Result<VipsImage> {
25020 unsafe {
25021 let inp_in: *mut bindings::VipsImage = inp.ctx;
25022 let mut out_out: *mut bindings::VipsImage = null_mut();
25023
25024 let vips_op_response = bindings::vips_scRGB2XYZ(inp_in, &mut out_out, NULL);
25025 utils::result(
25026 vips_op_response,
25027 VipsImage { ctx: out_out },
25028 Error::ScRgb2XyzError,
25029 )
25030 }
25031}
25032
25033pub fn sc_rgb2bw(inp: &VipsImage) -> Result<VipsImage> {
25037 unsafe {
25038 let inp_in: *mut bindings::VipsImage = inp.ctx;
25039 let mut out_out: *mut bindings::VipsImage = null_mut();
25040
25041 let vips_op_response = bindings::vips_scRGB2BW(inp_in, &mut out_out, NULL);
25042 utils::result(
25043 vips_op_response,
25044 VipsImage { ctx: out_out },
25045 Error::ScRgb2BwError,
25046 )
25047 }
25048}
25049
25050#[derive(Clone, Debug)]
25052pub struct ScRgb2BwOptions {
25053 pub depth: i32,
25056}
25057
25058impl std::default::Default for ScRgb2BwOptions {
25059 fn default() -> Self {
25060 ScRgb2BwOptions {
25061 depth: i32::from(8),
25062 }
25063 }
25064}
25065
25066pub fn sc_rgb2bw_with_opts(
25071 inp: &VipsImage,
25072 sc_rgb_2bw_options: &ScRgb2BwOptions,
25073) -> Result<VipsImage> {
25074 unsafe {
25075 let inp_in: *mut bindings::VipsImage = inp.ctx;
25076 let mut out_out: *mut bindings::VipsImage = null_mut();
25077
25078 let depth_in: i32 = sc_rgb_2bw_options.depth;
25079 let depth_in_name = utils::new_c_string("depth")?;
25080
25081 let vips_op_response =
25082 bindings::vips_scRGB2BW(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
25083 utils::result(
25084 vips_op_response,
25085 VipsImage { ctx: out_out },
25086 Error::ScRgb2BwError,
25087 )
25088 }
25089}
25090
25091pub fn xyz_2sc_rgb(inp: &VipsImage) -> Result<VipsImage> {
25095 unsafe {
25096 let inp_in: *mut bindings::VipsImage = inp.ctx;
25097 let mut out_out: *mut bindings::VipsImage = null_mut();
25098
25099 let vips_op_response = bindings::vips_XYZ2scRGB(inp_in, &mut out_out, NULL);
25100 utils::result(
25101 vips_op_response,
25102 VipsImage { ctx: out_out },
25103 Error::Xyz2ScRgbError,
25104 )
25105 }
25106}
25107
25108pub fn sc_rgb_2s_rgb(inp: &VipsImage) -> Result<VipsImage> {
25112 unsafe {
25113 let inp_in: *mut bindings::VipsImage = inp.ctx;
25114 let mut out_out: *mut bindings::VipsImage = null_mut();
25115
25116 let vips_op_response = bindings::vips_scRGB2sRGB(inp_in, &mut out_out, NULL);
25117 utils::result(
25118 vips_op_response,
25119 VipsImage { ctx: out_out },
25120 Error::ScRgb2SRgbError,
25121 )
25122 }
25123}
25124
25125#[derive(Clone, Debug)]
25127pub struct ScRgb2SRgbOptions {
25128 pub depth: i32,
25131}
25132
25133impl std::default::Default for ScRgb2SRgbOptions {
25134 fn default() -> Self {
25135 ScRgb2SRgbOptions {
25136 depth: i32::from(8),
25137 }
25138 }
25139}
25140
25141pub fn sc_rgb_2s_rgb_with_opts(
25146 inp: &VipsImage,
25147 sc_rgb_2s_rgb_options: &ScRgb2SRgbOptions,
25148) -> Result<VipsImage> {
25149 unsafe {
25150 let inp_in: *mut bindings::VipsImage = inp.ctx;
25151 let mut out_out: *mut bindings::VipsImage = null_mut();
25152
25153 let depth_in: i32 = sc_rgb_2s_rgb_options.depth;
25154 let depth_in_name = utils::new_c_string("depth")?;
25155
25156 let vips_op_response =
25157 bindings::vips_scRGB2sRGB(inp_in, &mut out_out, depth_in_name.as_ptr(), depth_in, NULL);
25158 utils::result(
25159 vips_op_response,
25160 VipsImage { ctx: out_out },
25161 Error::ScRgb2SRgbError,
25162 )
25163 }
25164}
25165
25166pub fn cmyk2xyz(inp: &VipsImage) -> Result<VipsImage> {
25170 unsafe {
25171 let inp_in: *mut bindings::VipsImage = inp.ctx;
25172 let mut out_out: *mut bindings::VipsImage = null_mut();
25173
25174 let vips_op_response = bindings::vips_CMYK2XYZ(inp_in, &mut out_out, NULL);
25175 utils::result(
25176 vips_op_response,
25177 VipsImage { ctx: out_out },
25178 Error::Cmyk2XyzError,
25179 )
25180 }
25181}
25182
25183pub fn xyz2cmyk(inp: &VipsImage) -> Result<VipsImage> {
25187 unsafe {
25188 let inp_in: *mut bindings::VipsImage = inp.ctx;
25189 let mut out_out: *mut bindings::VipsImage = null_mut();
25190
25191 let vips_op_response = bindings::vips_XYZ2CMYK(inp_in, &mut out_out, NULL);
25192 utils::result(
25193 vips_op_response,
25194 VipsImage { ctx: out_out },
25195 Error::Xyz2CmykError,
25196 )
25197 }
25198}
25199
25200pub fn profile_load(name: &str) -> Result<Vec<u8>> {
25204 unsafe {
25205 let name_in: CString = utils::new_c_string(name)?;
25206 let mut profile_out: *mut bindings::VipsBlob = null_mut();
25207
25208 let vips_op_response =
25209 bindings::vips_profile_load(name_in.as_ptr(), &mut profile_out, NULL);
25210 utils::result(
25211 vips_op_response,
25212 VipsBlob { ctx: profile_out }.into(),
25213 Error::ProfileLoadError,
25214 )
25215 }
25216}
25217
25218pub fn maplut(inp: &VipsImage, lut: &VipsImage) -> Result<VipsImage> {
25223 unsafe {
25224 let inp_in: *mut bindings::VipsImage = inp.ctx;
25225 let lut_in: *mut bindings::VipsImage = lut.ctx;
25226 let mut out_out: *mut bindings::VipsImage = null_mut();
25227
25228 let vips_op_response = bindings::vips_maplut(inp_in, &mut out_out, lut_in, NULL);
25229 utils::result(
25230 vips_op_response,
25231 VipsImage { ctx: out_out },
25232 Error::MaplutError,
25233 )
25234 }
25235}
25236
25237#[derive(Clone, Debug)]
25239pub struct MaplutOptions {
25240 pub band: i32,
25243}
25244
25245impl std::default::Default for MaplutOptions {
25246 fn default() -> Self {
25247 MaplutOptions {
25248 band: i32::from(-1),
25249 }
25250 }
25251}
25252
25253pub fn maplut_with_opts(
25259 inp: &VipsImage,
25260 lut: &VipsImage,
25261 maplut_options: &MaplutOptions,
25262) -> Result<VipsImage> {
25263 unsafe {
25264 let inp_in: *mut bindings::VipsImage = inp.ctx;
25265 let lut_in: *mut bindings::VipsImage = lut.ctx;
25266 let mut out_out: *mut bindings::VipsImage = null_mut();
25267
25268 let band_in: i32 = maplut_options.band;
25269 let band_in_name = utils::new_c_string("band")?;
25270
25271 let vips_op_response = bindings::vips_maplut(
25272 inp_in,
25273 &mut out_out,
25274 lut_in,
25275 band_in_name.as_ptr(),
25276 band_in,
25277 NULL,
25278 );
25279 utils::result(
25280 vips_op_response,
25281 VipsImage { ctx: out_out },
25282 Error::MaplutError,
25283 )
25284 }
25285}
25286
25287pub fn percent(inp: &VipsImage, percent: f64) -> Result<i32> {
25293 unsafe {
25294 let inp_in: *mut bindings::VipsImage = inp.ctx;
25295 let percent_in: f64 = percent;
25296 let mut threshold_out: i32 = i32::from(0);
25297
25298 let vips_op_response = bindings::vips_percent(inp_in, percent_in, &mut threshold_out, NULL);
25299 utils::result(vips_op_response, threshold_out, Error::PercentError)
25300 }
25301}
25302
25303pub fn stdif(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
25311 unsafe {
25312 let inp_in: *mut bindings::VipsImage = inp.ctx;
25313 let width_in: i32 = width;
25314 let height_in: i32 = height;
25315 let mut out_out: *mut bindings::VipsImage = null_mut();
25316
25317 let vips_op_response =
25318 bindings::vips_stdif(inp_in, &mut out_out, width_in, height_in, NULL);
25319 utils::result(
25320 vips_op_response,
25321 VipsImage { ctx: out_out },
25322 Error::StdifError,
25323 )
25324 }
25325}
25326
25327#[derive(Clone, Debug)]
25329pub struct StdifOptions {
25330 pub s_0: f64,
25333 pub b: f64,
25336 pub m_0: f64,
25339 pub a: f64,
25342}
25343
25344impl std::default::Default for StdifOptions {
25345 fn default() -> Self {
25346 StdifOptions {
25347 s_0: f64::from(50),
25348 b: f64::from(0.5),
25349 m_0: f64::from(128),
25350 a: f64::from(0.5),
25351 }
25352 }
25353}
25354
25355pub fn stdif_with_opts(
25364 inp: &VipsImage,
25365 width: i32,
25366 height: i32,
25367 stdif_options: &StdifOptions,
25368) -> Result<VipsImage> {
25369 unsafe {
25370 let inp_in: *mut bindings::VipsImage = inp.ctx;
25371 let width_in: i32 = width;
25372 let height_in: i32 = height;
25373 let mut out_out: *mut bindings::VipsImage = null_mut();
25374
25375 let s_0_in: f64 = stdif_options.s_0;
25376 let s_0_in_name = utils::new_c_string("s0")?;
25377
25378 let b_in: f64 = stdif_options.b;
25379 let b_in_name = utils::new_c_string("b")?;
25380
25381 let m_0_in: f64 = stdif_options.m_0;
25382 let m_0_in_name = utils::new_c_string("m0")?;
25383
25384 let a_in: f64 = stdif_options.a;
25385 let a_in_name = utils::new_c_string("a")?;
25386
25387 let vips_op_response = bindings::vips_stdif(
25388 inp_in,
25389 &mut out_out,
25390 width_in,
25391 height_in,
25392 s_0_in_name.as_ptr(),
25393 s_0_in,
25394 b_in_name.as_ptr(),
25395 b_in,
25396 m_0_in_name.as_ptr(),
25397 m_0_in,
25398 a_in_name.as_ptr(),
25399 a_in,
25400 NULL,
25401 );
25402 utils::result(
25403 vips_op_response,
25404 VipsImage { ctx: out_out },
25405 Error::StdifError,
25406 )
25407 }
25408}
25409
25410pub fn hist_cum(inp: &VipsImage) -> Result<VipsImage> {
25414 unsafe {
25415 let inp_in: *mut bindings::VipsImage = inp.ctx;
25416 let mut out_out: *mut bindings::VipsImage = null_mut();
25417
25418 let vips_op_response = bindings::vips_hist_cum(inp_in, &mut out_out, NULL);
25419 utils::result(
25420 vips_op_response,
25421 VipsImage { ctx: out_out },
25422 Error::HistCumError,
25423 )
25424 }
25425}
25426
25427pub fn hist_match(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
25432 unsafe {
25433 let inp_in: *mut bindings::VipsImage = inp.ctx;
25434 let refp_in: *mut bindings::VipsImage = refp.ctx;
25435 let mut out_out: *mut bindings::VipsImage = null_mut();
25436
25437 let vips_op_response = bindings::vips_hist_match(inp_in, refp_in, &mut out_out, NULL);
25438 utils::result(
25439 vips_op_response,
25440 VipsImage { ctx: out_out },
25441 Error::HistMatchError,
25442 )
25443 }
25444}
25445
25446pub fn hist_norm(inp: &VipsImage) -> Result<VipsImage> {
25450 unsafe {
25451 let inp_in: *mut bindings::VipsImage = inp.ctx;
25452 let mut out_out: *mut bindings::VipsImage = null_mut();
25453
25454 let vips_op_response = bindings::vips_hist_norm(inp_in, &mut out_out, NULL);
25455 utils::result(
25456 vips_op_response,
25457 VipsImage { ctx: out_out },
25458 Error::HistNormError,
25459 )
25460 }
25461}
25462
25463pub fn hist_equal(inp: &VipsImage) -> Result<VipsImage> {
25467 unsafe {
25468 let inp_in: *mut bindings::VipsImage = inp.ctx;
25469 let mut out_out: *mut bindings::VipsImage = null_mut();
25470
25471 let vips_op_response = bindings::vips_hist_equal(inp_in, &mut out_out, NULL);
25472 utils::result(
25473 vips_op_response,
25474 VipsImage { ctx: out_out },
25475 Error::HistEqualError,
25476 )
25477 }
25478}
25479
25480#[derive(Clone, Debug)]
25482pub struct HistEqualOptions {
25483 pub band: i32,
25486}
25487
25488impl std::default::Default for HistEqualOptions {
25489 fn default() -> Self {
25490 HistEqualOptions {
25491 band: i32::from(-1),
25492 }
25493 }
25494}
25495
25496pub fn hist_equal_with_opts(
25501 inp: &VipsImage,
25502 hist_equal_options: &HistEqualOptions,
25503) -> Result<VipsImage> {
25504 unsafe {
25505 let inp_in: *mut bindings::VipsImage = inp.ctx;
25506 let mut out_out: *mut bindings::VipsImage = null_mut();
25507
25508 let band_in: i32 = hist_equal_options.band;
25509 let band_in_name = utils::new_c_string("band")?;
25510
25511 let vips_op_response =
25512 bindings::vips_hist_equal(inp_in, &mut out_out, band_in_name.as_ptr(), band_in, NULL);
25513 utils::result(
25514 vips_op_response,
25515 VipsImage { ctx: out_out },
25516 Error::HistEqualError,
25517 )
25518 }
25519}
25520
25521pub fn hist_plot(inp: &VipsImage) -> Result<VipsImage> {
25525 unsafe {
25526 let inp_in: *mut bindings::VipsImage = inp.ctx;
25527 let mut out_out: *mut bindings::VipsImage = null_mut();
25528
25529 let vips_op_response = bindings::vips_hist_plot(inp_in, &mut out_out, NULL);
25530 utils::result(
25531 vips_op_response,
25532 VipsImage { ctx: out_out },
25533 Error::HistPlotError,
25534 )
25535 }
25536}
25537
25538pub fn hist_local(inp: &VipsImage, width: i32, height: i32) -> Result<VipsImage> {
25546 unsafe {
25547 let inp_in: *mut bindings::VipsImage = inp.ctx;
25548 let width_in: i32 = width;
25549 let height_in: i32 = height;
25550 let mut out_out: *mut bindings::VipsImage = null_mut();
25551
25552 let vips_op_response =
25553 bindings::vips_hist_local(inp_in, &mut out_out, width_in, height_in, NULL);
25554 utils::result(
25555 vips_op_response,
25556 VipsImage { ctx: out_out },
25557 Error::HistLocalError,
25558 )
25559 }
25560}
25561
25562#[derive(Clone, Debug)]
25564pub struct HistLocalOptions {
25565 pub max_slope: i32,
25568}
25569
25570impl std::default::Default for HistLocalOptions {
25571 fn default() -> Self {
25572 HistLocalOptions {
25573 max_slope: i32::from(0),
25574 }
25575 }
25576}
25577
25578pub fn hist_local_with_opts(
25587 inp: &VipsImage,
25588 width: i32,
25589 height: i32,
25590 hist_local_options: &HistLocalOptions,
25591) -> Result<VipsImage> {
25592 unsafe {
25593 let inp_in: *mut bindings::VipsImage = inp.ctx;
25594 let width_in: i32 = width;
25595 let height_in: i32 = height;
25596 let mut out_out: *mut bindings::VipsImage = null_mut();
25597
25598 let max_slope_in: i32 = hist_local_options.max_slope;
25599 let max_slope_in_name = utils::new_c_string("max-slope")?;
25600
25601 let vips_op_response = bindings::vips_hist_local(
25602 inp_in,
25603 &mut out_out,
25604 width_in,
25605 height_in,
25606 max_slope_in_name.as_ptr(),
25607 max_slope_in,
25608 NULL,
25609 );
25610 utils::result(
25611 vips_op_response,
25612 VipsImage { ctx: out_out },
25613 Error::HistLocalError,
25614 )
25615 }
25616}
25617
25618pub fn hist_ismonotonic(inp: &VipsImage) -> Result<bool> {
25622 unsafe {
25623 let inp_in: *mut bindings::VipsImage = inp.ctx;
25624 let mut monotonic_out: i32 = 0;
25625
25626 let vips_op_response = bindings::vips_hist_ismonotonic(inp_in, &mut monotonic_out, NULL);
25627 utils::result(
25628 vips_op_response,
25629 monotonic_out != 0,
25630 Error::HistIsmonotonicError,
25631 )
25632 }
25633}
25634
25635pub fn hist_entropy(inp: &VipsImage) -> Result<f64> {
25639 unsafe {
25640 let inp_in: *mut bindings::VipsImage = inp.ctx;
25641 let mut out_out: f64 = f64::from(0);
25642
25643 let vips_op_response = bindings::vips_hist_entropy(inp_in, &mut out_out, NULL);
25644 utils::result(vips_op_response, out_out, Error::HistEntropyError)
25645 }
25646}
25647
25648pub fn conv(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25653 unsafe {
25654 let inp_in: *mut bindings::VipsImage = inp.ctx;
25655 let mask_in: *mut bindings::VipsImage = mask.ctx;
25656 let mut out_out: *mut bindings::VipsImage = null_mut();
25657
25658 let vips_op_response = bindings::vips_conv(inp_in, &mut out_out, mask_in, NULL);
25659 utils::result(
25660 vips_op_response,
25661 VipsImage { ctx: out_out },
25662 Error::ConvError,
25663 )
25664 }
25665}
25666
25667#[derive(Clone, Debug)]
25669pub struct ConvOptions {
25670 pub precision: Precision,
25676 pub layers: i32,
25679 pub cluster: i32,
25682}
25683
25684impl std::default::Default for ConvOptions {
25685 fn default() -> Self {
25686 ConvOptions {
25687 precision: Precision::Float,
25688 layers: i32::from(5),
25689 cluster: i32::from(1),
25690 }
25691 }
25692}
25693
25694pub fn conv_with_opts(
25700 inp: &VipsImage,
25701 mask: &VipsImage,
25702 conv_options: &ConvOptions,
25703) -> Result<VipsImage> {
25704 unsafe {
25705 let inp_in: *mut bindings::VipsImage = inp.ctx;
25706 let mask_in: *mut bindings::VipsImage = mask.ctx;
25707 let mut out_out: *mut bindings::VipsImage = null_mut();
25708
25709 let precision_in: i32 = conv_options.precision as i32;
25710 let precision_in_name = utils::new_c_string("precision")?;
25711
25712 let layers_in: i32 = conv_options.layers;
25713 let layers_in_name = utils::new_c_string("layers")?;
25714
25715 let cluster_in: i32 = conv_options.cluster;
25716 let cluster_in_name = utils::new_c_string("cluster")?;
25717
25718 let vips_op_response = bindings::vips_conv(
25719 inp_in,
25720 &mut out_out,
25721 mask_in,
25722 precision_in_name.as_ptr(),
25723 precision_in,
25724 layers_in_name.as_ptr(),
25725 layers_in,
25726 cluster_in_name.as_ptr(),
25727 cluster_in,
25728 NULL,
25729 );
25730 utils::result(
25731 vips_op_response,
25732 VipsImage { ctx: out_out },
25733 Error::ConvError,
25734 )
25735 }
25736}
25737
25738pub fn conva(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25743 unsafe {
25744 let inp_in: *mut bindings::VipsImage = inp.ctx;
25745 let mask_in: *mut bindings::VipsImage = mask.ctx;
25746 let mut out_out: *mut bindings::VipsImage = null_mut();
25747
25748 let vips_op_response = bindings::vips_conva(inp_in, &mut out_out, mask_in, NULL);
25749 utils::result(
25750 vips_op_response,
25751 VipsImage { ctx: out_out },
25752 Error::ConvaError,
25753 )
25754 }
25755}
25756
25757#[derive(Clone, Debug)]
25759pub struct ConvaOptions {
25760 pub layers: i32,
25763 pub cluster: i32,
25766}
25767
25768impl std::default::Default for ConvaOptions {
25769 fn default() -> Self {
25770 ConvaOptions {
25771 layers: i32::from(5),
25772 cluster: i32::from(1),
25773 }
25774 }
25775}
25776
25777pub fn conva_with_opts(
25783 inp: &VipsImage,
25784 mask: &VipsImage,
25785 conva_options: &ConvaOptions,
25786) -> Result<VipsImage> {
25787 unsafe {
25788 let inp_in: *mut bindings::VipsImage = inp.ctx;
25789 let mask_in: *mut bindings::VipsImage = mask.ctx;
25790 let mut out_out: *mut bindings::VipsImage = null_mut();
25791
25792 let layers_in: i32 = conva_options.layers;
25793 let layers_in_name = utils::new_c_string("layers")?;
25794
25795 let cluster_in: i32 = conva_options.cluster;
25796 let cluster_in_name = utils::new_c_string("cluster")?;
25797
25798 let vips_op_response = bindings::vips_conva(
25799 inp_in,
25800 &mut out_out,
25801 mask_in,
25802 layers_in_name.as_ptr(),
25803 layers_in,
25804 cluster_in_name.as_ptr(),
25805 cluster_in,
25806 NULL,
25807 );
25808 utils::result(
25809 vips_op_response,
25810 VipsImage { ctx: out_out },
25811 Error::ConvaError,
25812 )
25813 }
25814}
25815
25816pub fn convf(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25821 unsafe {
25822 let inp_in: *mut bindings::VipsImage = inp.ctx;
25823 let mask_in: *mut bindings::VipsImage = mask.ctx;
25824 let mut out_out: *mut bindings::VipsImage = null_mut();
25825
25826 let vips_op_response = bindings::vips_convf(inp_in, &mut out_out, mask_in, NULL);
25827 utils::result(
25828 vips_op_response,
25829 VipsImage { ctx: out_out },
25830 Error::ConvfError,
25831 )
25832 }
25833}
25834
25835pub fn convi(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25840 unsafe {
25841 let inp_in: *mut bindings::VipsImage = inp.ctx;
25842 let mask_in: *mut bindings::VipsImage = mask.ctx;
25843 let mut out_out: *mut bindings::VipsImage = null_mut();
25844
25845 let vips_op_response = bindings::vips_convi(inp_in, &mut out_out, mask_in, NULL);
25846 utils::result(
25847 vips_op_response,
25848 VipsImage { ctx: out_out },
25849 Error::ConviError,
25850 )
25851 }
25852}
25853
25854pub fn compass(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25859 unsafe {
25860 let inp_in: *mut bindings::VipsImage = inp.ctx;
25861 let mask_in: *mut bindings::VipsImage = mask.ctx;
25862 let mut out_out: *mut bindings::VipsImage = null_mut();
25863
25864 let vips_op_response = bindings::vips_compass(inp_in, &mut out_out, mask_in, NULL);
25865 utils::result(
25866 vips_op_response,
25867 VipsImage { ctx: out_out },
25868 Error::CompassError,
25869 )
25870 }
25871}
25872
25873#[derive(Clone, Debug)]
25875pub struct CompassOptions {
25876 pub times: i32,
25879 pub angle: Angle45,
25890 pub combine: Combine,
25896 pub precision: Precision,
25902 pub layers: i32,
25905 pub cluster: i32,
25908}
25909
25910impl std::default::Default for CompassOptions {
25911 fn default() -> Self {
25912 CompassOptions {
25913 times: i32::from(2),
25914 angle: Angle45::D90,
25915 combine: Combine::Max,
25916 precision: Precision::Float,
25917 layers: i32::from(5),
25918 cluster: i32::from(1),
25919 }
25920 }
25921}
25922
25923pub fn compass_with_opts(
25929 inp: &VipsImage,
25930 mask: &VipsImage,
25931 compass_options: &CompassOptions,
25932) -> Result<VipsImage> {
25933 unsafe {
25934 let inp_in: *mut bindings::VipsImage = inp.ctx;
25935 let mask_in: *mut bindings::VipsImage = mask.ctx;
25936 let mut out_out: *mut bindings::VipsImage = null_mut();
25937
25938 let times_in: i32 = compass_options.times;
25939 let times_in_name = utils::new_c_string("times")?;
25940
25941 let angle_in: i32 = compass_options.angle as i32;
25942 let angle_in_name = utils::new_c_string("angle")?;
25943
25944 let combine_in: i32 = compass_options.combine as i32;
25945 let combine_in_name = utils::new_c_string("combine")?;
25946
25947 let precision_in: i32 = compass_options.precision as i32;
25948 let precision_in_name = utils::new_c_string("precision")?;
25949
25950 let layers_in: i32 = compass_options.layers;
25951 let layers_in_name = utils::new_c_string("layers")?;
25952
25953 let cluster_in: i32 = compass_options.cluster;
25954 let cluster_in_name = utils::new_c_string("cluster")?;
25955
25956 let vips_op_response = bindings::vips_compass(
25957 inp_in,
25958 &mut out_out,
25959 mask_in,
25960 times_in_name.as_ptr(),
25961 times_in,
25962 angle_in_name.as_ptr(),
25963 angle_in,
25964 combine_in_name.as_ptr(),
25965 combine_in,
25966 precision_in_name.as_ptr(),
25967 precision_in,
25968 layers_in_name.as_ptr(),
25969 layers_in,
25970 cluster_in_name.as_ptr(),
25971 cluster_in,
25972 NULL,
25973 );
25974 utils::result(
25975 vips_op_response,
25976 VipsImage { ctx: out_out },
25977 Error::CompassError,
25978 )
25979 }
25980}
25981
25982pub fn convsep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
25987 unsafe {
25988 let inp_in: *mut bindings::VipsImage = inp.ctx;
25989 let mask_in: *mut bindings::VipsImage = mask.ctx;
25990 let mut out_out: *mut bindings::VipsImage = null_mut();
25991
25992 let vips_op_response = bindings::vips_convsep(inp_in, &mut out_out, mask_in, NULL);
25993 utils::result(
25994 vips_op_response,
25995 VipsImage { ctx: out_out },
25996 Error::ConvsepError,
25997 )
25998 }
25999}
26000
26001#[derive(Clone, Debug)]
26003pub struct ConvsepOptions {
26004 pub precision: Precision,
26010 pub layers: i32,
26013 pub cluster: i32,
26016}
26017
26018impl std::default::Default for ConvsepOptions {
26019 fn default() -> Self {
26020 ConvsepOptions {
26021 precision: Precision::Float,
26022 layers: i32::from(5),
26023 cluster: i32::from(1),
26024 }
26025 }
26026}
26027
26028pub fn convsep_with_opts(
26034 inp: &VipsImage,
26035 mask: &VipsImage,
26036 convsep_options: &ConvsepOptions,
26037) -> Result<VipsImage> {
26038 unsafe {
26039 let inp_in: *mut bindings::VipsImage = inp.ctx;
26040 let mask_in: *mut bindings::VipsImage = mask.ctx;
26041 let mut out_out: *mut bindings::VipsImage = null_mut();
26042
26043 let precision_in: i32 = convsep_options.precision as i32;
26044 let precision_in_name = utils::new_c_string("precision")?;
26045
26046 let layers_in: i32 = convsep_options.layers;
26047 let layers_in_name = utils::new_c_string("layers")?;
26048
26049 let cluster_in: i32 = convsep_options.cluster;
26050 let cluster_in_name = utils::new_c_string("cluster")?;
26051
26052 let vips_op_response = bindings::vips_convsep(
26053 inp_in,
26054 &mut out_out,
26055 mask_in,
26056 precision_in_name.as_ptr(),
26057 precision_in,
26058 layers_in_name.as_ptr(),
26059 layers_in,
26060 cluster_in_name.as_ptr(),
26061 cluster_in,
26062 NULL,
26063 );
26064 utils::result(
26065 vips_op_response,
26066 VipsImage { ctx: out_out },
26067 Error::ConvsepError,
26068 )
26069 }
26070}
26071
26072pub fn convasep(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
26077 unsafe {
26078 let inp_in: *mut bindings::VipsImage = inp.ctx;
26079 let mask_in: *mut bindings::VipsImage = mask.ctx;
26080 let mut out_out: *mut bindings::VipsImage = null_mut();
26081
26082 let vips_op_response = bindings::vips_convasep(inp_in, &mut out_out, mask_in, NULL);
26083 utils::result(
26084 vips_op_response,
26085 VipsImage { ctx: out_out },
26086 Error::ConvasepError,
26087 )
26088 }
26089}
26090
26091#[derive(Clone, Debug)]
26093pub struct ConvasepOptions {
26094 pub layers: i32,
26097}
26098
26099impl std::default::Default for ConvasepOptions {
26100 fn default() -> Self {
26101 ConvasepOptions {
26102 layers: i32::from(5),
26103 }
26104 }
26105}
26106
26107pub fn convasep_with_opts(
26113 inp: &VipsImage,
26114 mask: &VipsImage,
26115 convasep_options: &ConvasepOptions,
26116) -> Result<VipsImage> {
26117 unsafe {
26118 let inp_in: *mut bindings::VipsImage = inp.ctx;
26119 let mask_in: *mut bindings::VipsImage = mask.ctx;
26120 let mut out_out: *mut bindings::VipsImage = null_mut();
26121
26122 let layers_in: i32 = convasep_options.layers;
26123 let layers_in_name = utils::new_c_string("layers")?;
26124
26125 let vips_op_response = bindings::vips_convasep(
26126 inp_in,
26127 &mut out_out,
26128 mask_in,
26129 layers_in_name.as_ptr(),
26130 layers_in,
26131 NULL,
26132 );
26133 utils::result(
26134 vips_op_response,
26135 VipsImage { ctx: out_out },
26136 Error::ConvasepError,
26137 )
26138 }
26139}
26140
26141pub fn fastcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
26146 unsafe {
26147 let inp_in: *mut bindings::VipsImage = inp.ctx;
26148 let refp_in: *mut bindings::VipsImage = refp.ctx;
26149 let mut out_out: *mut bindings::VipsImage = null_mut();
26150
26151 let vips_op_response = bindings::vips_fastcor(inp_in, refp_in, &mut out_out, NULL);
26152 utils::result(
26153 vips_op_response,
26154 VipsImage { ctx: out_out },
26155 Error::FastcorError,
26156 )
26157 }
26158}
26159
26160pub fn spcor(inp: &VipsImage, refp: &VipsImage) -> Result<VipsImage> {
26165 unsafe {
26166 let inp_in: *mut bindings::VipsImage = inp.ctx;
26167 let refp_in: *mut bindings::VipsImage = refp.ctx;
26168 let mut out_out: *mut bindings::VipsImage = null_mut();
26169
26170 let vips_op_response = bindings::vips_spcor(inp_in, refp_in, &mut out_out, NULL);
26171 utils::result(
26172 vips_op_response,
26173 VipsImage { ctx: out_out },
26174 Error::SpcorError,
26175 )
26176 }
26177}
26178
26179pub fn sharpen(inp: &VipsImage) -> Result<VipsImage> {
26183 unsafe {
26184 let inp_in: *mut bindings::VipsImage = inp.ctx;
26185 let mut out_out: *mut bindings::VipsImage = null_mut();
26186
26187 let vips_op_response = bindings::vips_sharpen(inp_in, &mut out_out, NULL);
26188 utils::result(
26189 vips_op_response,
26190 VipsImage { ctx: out_out },
26191 Error::SharpenError,
26192 )
26193 }
26194}
26195
26196#[derive(Clone, Debug)]
26198pub struct SharpenOptions {
26199 pub sigma: f64,
26202 pub x_1: f64,
26205 pub y_2: f64,
26208 pub y_3: f64,
26211 pub m_1: f64,
26214 pub m_2: f64,
26217}
26218
26219impl std::default::Default for SharpenOptions {
26220 fn default() -> Self {
26221 SharpenOptions {
26222 sigma: f64::from(0.5),
26223 x_1: f64::from(2),
26224 y_2: f64::from(10),
26225 y_3: f64::from(20),
26226 m_1: f64::from(0),
26227 m_2: f64::from(3),
26228 }
26229 }
26230}
26231
26232pub fn sharpen_with_opts(inp: &VipsImage, sharpen_options: &SharpenOptions) -> Result<VipsImage> {
26237 unsafe {
26238 let inp_in: *mut bindings::VipsImage = inp.ctx;
26239 let mut out_out: *mut bindings::VipsImage = null_mut();
26240
26241 let sigma_in: f64 = sharpen_options.sigma;
26242 let sigma_in_name = utils::new_c_string("sigma")?;
26243
26244 let x_1_in: f64 = sharpen_options.x_1;
26245 let x_1_in_name = utils::new_c_string("x1")?;
26246
26247 let y_2_in: f64 = sharpen_options.y_2;
26248 let y_2_in_name = utils::new_c_string("y2")?;
26249
26250 let y_3_in: f64 = sharpen_options.y_3;
26251 let y_3_in_name = utils::new_c_string("y3")?;
26252
26253 let m_1_in: f64 = sharpen_options.m_1;
26254 let m_1_in_name = utils::new_c_string("m1")?;
26255
26256 let m_2_in: f64 = sharpen_options.m_2;
26257 let m_2_in_name = utils::new_c_string("m2")?;
26258
26259 let vips_op_response = bindings::vips_sharpen(
26260 inp_in,
26261 &mut out_out,
26262 sigma_in_name.as_ptr(),
26263 sigma_in,
26264 x_1_in_name.as_ptr(),
26265 x_1_in,
26266 y_2_in_name.as_ptr(),
26267 y_2_in,
26268 y_3_in_name.as_ptr(),
26269 y_3_in,
26270 m_1_in_name.as_ptr(),
26271 m_1_in,
26272 m_2_in_name.as_ptr(),
26273 m_2_in,
26274 NULL,
26275 );
26276 utils::result(
26277 vips_op_response,
26278 VipsImage { ctx: out_out },
26279 Error::SharpenError,
26280 )
26281 }
26282}
26283
26284pub fn gaussblur(inp: &VipsImage, sigma: f64) -> Result<VipsImage> {
26290 unsafe {
26291 let inp_in: *mut bindings::VipsImage = inp.ctx;
26292 let sigma_in: f64 = sigma;
26293 let mut out_out: *mut bindings::VipsImage = null_mut();
26294
26295 let vips_op_response = bindings::vips_gaussblur(inp_in, &mut out_out, sigma_in, NULL);
26296 utils::result(
26297 vips_op_response,
26298 VipsImage { ctx: out_out },
26299 Error::GaussblurError,
26300 )
26301 }
26302}
26303
26304#[derive(Clone, Debug)]
26306pub struct GaussblurOptions {
26307 pub min_ampl: f64,
26310 pub precision: Precision,
26316}
26317
26318impl std::default::Default for GaussblurOptions {
26319 fn default() -> Self {
26320 GaussblurOptions {
26321 min_ampl: f64::from(0.2),
26322 precision: Precision::Integer,
26323 }
26324 }
26325}
26326
26327pub fn gaussblur_with_opts(
26334 inp: &VipsImage,
26335 sigma: f64,
26336 gaussblur_options: &GaussblurOptions,
26337) -> Result<VipsImage> {
26338 unsafe {
26339 let inp_in: *mut bindings::VipsImage = inp.ctx;
26340 let sigma_in: f64 = sigma;
26341 let mut out_out: *mut bindings::VipsImage = null_mut();
26342
26343 let min_ampl_in: f64 = gaussblur_options.min_ampl;
26344 let min_ampl_in_name = utils::new_c_string("min-ampl")?;
26345
26346 let precision_in: i32 = gaussblur_options.precision as i32;
26347 let precision_in_name = utils::new_c_string("precision")?;
26348
26349 let vips_op_response = bindings::vips_gaussblur(
26350 inp_in,
26351 &mut out_out,
26352 sigma_in,
26353 min_ampl_in_name.as_ptr(),
26354 min_ampl_in,
26355 precision_in_name.as_ptr(),
26356 precision_in,
26357 NULL,
26358 );
26359 utils::result(
26360 vips_op_response,
26361 VipsImage { ctx: out_out },
26362 Error::GaussblurError,
26363 )
26364 }
26365}
26366
26367pub fn sobel(inp: &VipsImage) -> Result<VipsImage> {
26371 unsafe {
26372 let inp_in: *mut bindings::VipsImage = inp.ctx;
26373 let mut out_out: *mut bindings::VipsImage = null_mut();
26374
26375 let vips_op_response = bindings::vips_sobel(inp_in, &mut out_out, NULL);
26376 utils::result(
26377 vips_op_response,
26378 VipsImage { ctx: out_out },
26379 Error::SobelError,
26380 )
26381 }
26382}
26383
26384pub fn scharr(inp: &VipsImage) -> Result<VipsImage> {
26388 unsafe {
26389 let inp_in: *mut bindings::VipsImage = inp.ctx;
26390 let mut out_out: *mut bindings::VipsImage = null_mut();
26391
26392 let vips_op_response = bindings::vips_scharr(inp_in, &mut out_out, NULL);
26393 utils::result(
26394 vips_op_response,
26395 VipsImage { ctx: out_out },
26396 Error::ScharrError,
26397 )
26398 }
26399}
26400
26401pub fn prewitt(inp: &VipsImage) -> Result<VipsImage> {
26405 unsafe {
26406 let inp_in: *mut bindings::VipsImage = inp.ctx;
26407 let mut out_out: *mut bindings::VipsImage = null_mut();
26408
26409 let vips_op_response = bindings::vips_prewitt(inp_in, &mut out_out, NULL);
26410 utils::result(
26411 vips_op_response,
26412 VipsImage { ctx: out_out },
26413 Error::PrewittError,
26414 )
26415 }
26416}
26417
26418pub fn canny(inp: &VipsImage) -> Result<VipsImage> {
26422 unsafe {
26423 let inp_in: *mut bindings::VipsImage = inp.ctx;
26424 let mut out_out: *mut bindings::VipsImage = null_mut();
26425
26426 let vips_op_response = bindings::vips_canny(inp_in, &mut out_out, NULL);
26427 utils::result(
26428 vips_op_response,
26429 VipsImage { ctx: out_out },
26430 Error::CannyError,
26431 )
26432 }
26433}
26434
26435#[derive(Clone, Debug)]
26437pub struct CannyOptions {
26438 pub sigma: f64,
26441 pub precision: Precision,
26447}
26448
26449impl std::default::Default for CannyOptions {
26450 fn default() -> Self {
26451 CannyOptions {
26452 sigma: f64::from(1.4),
26453 precision: Precision::Float,
26454 }
26455 }
26456}
26457
26458pub fn canny_with_opts(inp: &VipsImage, canny_options: &CannyOptions) -> Result<VipsImage> {
26463 unsafe {
26464 let inp_in: *mut bindings::VipsImage = inp.ctx;
26465 let mut out_out: *mut bindings::VipsImage = null_mut();
26466
26467 let sigma_in: f64 = canny_options.sigma;
26468 let sigma_in_name = utils::new_c_string("sigma")?;
26469
26470 let precision_in: i32 = canny_options.precision as i32;
26471 let precision_in_name = utils::new_c_string("precision")?;
26472
26473 let vips_op_response = bindings::vips_canny(
26474 inp_in,
26475 &mut out_out,
26476 sigma_in_name.as_ptr(),
26477 sigma_in,
26478 precision_in_name.as_ptr(),
26479 precision_in,
26480 NULL,
26481 );
26482 utils::result(
26483 vips_op_response,
26484 VipsImage { ctx: out_out },
26485 Error::CannyError,
26486 )
26487 }
26488}
26489
26490pub fn fwfft(inp: &VipsImage) -> Result<VipsImage> {
26494 unsafe {
26495 let inp_in: *mut bindings::VipsImage = inp.ctx;
26496 let mut out_out: *mut bindings::VipsImage = null_mut();
26497
26498 let vips_op_response = bindings::vips_fwfft(inp_in, &mut out_out, NULL);
26499 utils::result(
26500 vips_op_response,
26501 VipsImage { ctx: out_out },
26502 Error::FwfftError,
26503 )
26504 }
26505}
26506
26507pub fn invfft(inp: &VipsImage) -> Result<VipsImage> {
26511 unsafe {
26512 let inp_in: *mut bindings::VipsImage = inp.ctx;
26513 let mut out_out: *mut bindings::VipsImage = null_mut();
26514
26515 let vips_op_response = bindings::vips_invfft(inp_in, &mut out_out, NULL);
26516 utils::result(
26517 vips_op_response,
26518 VipsImage { ctx: out_out },
26519 Error::InvfftError,
26520 )
26521 }
26522}
26523
26524#[derive(Clone, Debug)]
26526pub struct InvfftOptions {
26527 pub real: bool,
26530}
26531
26532impl std::default::Default for InvfftOptions {
26533 fn default() -> Self {
26534 InvfftOptions { real: false }
26535 }
26536}
26537
26538pub fn invfft_with_opts(inp: &VipsImage, invfft_options: &InvfftOptions) -> Result<VipsImage> {
26543 unsafe {
26544 let inp_in: *mut bindings::VipsImage = inp.ctx;
26545 let mut out_out: *mut bindings::VipsImage = null_mut();
26546
26547 let real_in: i32 = if invfft_options.real { 1 } else { 0 };
26548 let real_in_name = utils::new_c_string("real")?;
26549
26550 let vips_op_response =
26551 bindings::vips_invfft(inp_in, &mut out_out, real_in_name.as_ptr(), real_in, NULL);
26552 utils::result(
26553 vips_op_response,
26554 VipsImage { ctx: out_out },
26555 Error::InvfftError,
26556 )
26557 }
26558}
26559
26560pub fn freqmult(inp: &VipsImage, mask: &VipsImage) -> Result<VipsImage> {
26565 unsafe {
26566 let inp_in: *mut bindings::VipsImage = inp.ctx;
26567 let mask_in: *mut bindings::VipsImage = mask.ctx;
26568 let mut out_out: *mut bindings::VipsImage = null_mut();
26569
26570 let vips_op_response = bindings::vips_freqmult(inp_in, mask_in, &mut out_out, NULL);
26571 utils::result(
26572 vips_op_response,
26573 VipsImage { ctx: out_out },
26574 Error::FreqmultError,
26575 )
26576 }
26577}
26578
26579pub fn spectrum(inp: &VipsImage) -> Result<VipsImage> {
26583 unsafe {
26584 let inp_in: *mut bindings::VipsImage = inp.ctx;
26585 let mut out_out: *mut bindings::VipsImage = null_mut();
26586
26587 let vips_op_response = bindings::vips_spectrum(inp_in, &mut out_out, NULL);
26588 utils::result(
26589 vips_op_response,
26590 VipsImage { ctx: out_out },
26591 Error::SpectrumError,
26592 )
26593 }
26594}
26595
26596pub fn phasecor(inp: &VipsImage, in_2: &VipsImage) -> Result<VipsImage> {
26601 unsafe {
26602 let inp_in: *mut bindings::VipsImage = inp.ctx;
26603 let in_2_in: *mut bindings::VipsImage = in_2.ctx;
26604 let mut out_out: *mut bindings::VipsImage = null_mut();
26605
26606 let vips_op_response = bindings::vips_phasecor(inp_in, in_2_in, &mut out_out, NULL);
26607 utils::result(
26608 vips_op_response,
26609 VipsImage { ctx: out_out },
26610 Error::PhasecorError,
26611 )
26612 }
26613}
26614
26615pub fn morph(inp: &VipsImage, mask: &VipsImage, morph: OperationMorphology) -> Result<VipsImage> {
26624 unsafe {
26625 let inp_in: *mut bindings::VipsImage = inp.ctx;
26626 let mask_in: *mut bindings::VipsImage = mask.ctx;
26627 let morph_in: i32 = morph as i32;
26628 let mut out_out: *mut bindings::VipsImage = null_mut();
26629
26630 let vips_op_response = bindings::vips_morph(
26631 inp_in,
26632 &mut out_out,
26633 mask_in,
26634 morph_in.try_into().unwrap(),
26635 NULL,
26636 );
26637 utils::result(
26638 vips_op_response,
26639 VipsImage { ctx: out_out },
26640 Error::MorphError,
26641 )
26642 }
26643}
26644
26645pub fn rank(inp: &VipsImage, width: i32, height: i32, index: i32) -> Result<VipsImage> {
26655 unsafe {
26656 let inp_in: *mut bindings::VipsImage = inp.ctx;
26657 let width_in: i32 = width;
26658 let height_in: i32 = height;
26659 let index_in: i32 = index;
26660 let mut out_out: *mut bindings::VipsImage = null_mut();
26661
26662 let vips_op_response =
26663 bindings::vips_rank(inp_in, &mut out_out, width_in, height_in, index_in, NULL);
26664 utils::result(
26665 vips_op_response,
26666 VipsImage { ctx: out_out },
26667 Error::RankError,
26668 )
26669 }
26670}
26671
26672pub fn countlines(inp: &VipsImage, direction: Direction) -> Result<f64> {
26680 unsafe {
26681 let inp_in: *mut bindings::VipsImage = inp.ctx;
26682 let direction_in: i32 = direction as i32;
26683 let mut nolines_out: f64 = f64::from(0);
26684
26685 let vips_op_response = bindings::vips_countlines(
26686 inp_in,
26687 &mut nolines_out,
26688 direction_in.try_into().unwrap(),
26689 NULL,
26690 );
26691 utils::result(vips_op_response, nolines_out, Error::CountlineError)
26692 }
26693}
26694
26695pub fn labelregions(inp: &VipsImage) -> Result<VipsImage> {
26699 unsafe {
26700 let inp_in: *mut bindings::VipsImage = inp.ctx;
26701 let mut mask_out: *mut bindings::VipsImage = null_mut();
26702
26703 let vips_op_response = bindings::vips_labelregions(inp_in, &mut mask_out, NULL);
26704 utils::result(
26705 vips_op_response,
26706 VipsImage { ctx: mask_out },
26707 Error::LabelregionError,
26708 )
26709 }
26710}
26711
26712#[derive(Clone, Debug)]
26714pub struct LabelregionOptions {
26715 pub segments: i32,
26718}
26719
26720impl std::default::Default for LabelregionOptions {
26721 fn default() -> Self {
26722 LabelregionOptions {
26723 segments: i32::from(0),
26724 }
26725 }
26726}
26727
26728pub fn labelregions_with_opts(
26733 inp: &VipsImage,
26734 labelregions_options: &LabelregionOptions,
26735) -> Result<VipsImage> {
26736 unsafe {
26737 let inp_in: *mut bindings::VipsImage = inp.ctx;
26738 let mut mask_out: *mut bindings::VipsImage = null_mut();
26739
26740 let segments_in: i32 = labelregions_options.segments;
26741 let segments_in_name = utils::new_c_string("segments")?;
26742
26743 let vips_op_response = bindings::vips_labelregions(
26744 inp_in,
26745 &mut mask_out,
26746 segments_in_name.as_ptr(),
26747 segments_in,
26748 NULL,
26749 );
26750 utils::result(
26751 vips_op_response,
26752 VipsImage { ctx: mask_out },
26753 Error::LabelregionError,
26754 )
26755 }
26756}
26757
26758pub fn fill_nearest(inp: &VipsImage) -> Result<VipsImage> {
26762 unsafe {
26763 let inp_in: *mut bindings::VipsImage = inp.ctx;
26764 let mut out_out: *mut bindings::VipsImage = null_mut();
26765
26766 let vips_op_response = bindings::vips_fill_nearest(inp_in, &mut out_out, NULL);
26767 utils::result(
26768 vips_op_response,
26769 VipsImage { ctx: out_out },
26770 Error::FillNearestError,
26771 )
26772 }
26773}
26774
26775#[derive(Clone, Debug)]
26777pub struct FillNearestOptions {
26778 pub distance: VipsImage,
26780}
26781
26782impl std::default::Default for FillNearestOptions {
26783 fn default() -> Self {
26784 FillNearestOptions {
26785 distance: VipsImage::new(),
26786 }
26787 }
26788}
26789
26790pub fn fill_nearest_with_opts(
26795 inp: &VipsImage,
26796 fill_nearest_options: &FillNearestOptions,
26797) -> Result<VipsImage> {
26798 unsafe {
26799 let inp_in: *mut bindings::VipsImage = inp.ctx;
26800 let mut out_out: *mut bindings::VipsImage = null_mut();
26801
26802 let distance_in: *mut bindings::VipsImage = fill_nearest_options.distance.ctx;
26803 let distance_in_name = utils::new_c_string("distance")?;
26804
26805 let vips_op_response = bindings::vips_fill_nearest(
26806 inp_in,
26807 &mut out_out,
26808 distance_in_name.as_ptr(),
26809 distance_in,
26810 NULL,
26811 );
26812 utils::result(
26813 vips_op_response,
26814 VipsImage { ctx: out_out },
26815 Error::FillNearestError,
26816 )
26817 }
26818}
26819
26820pub fn draw_rect(
26833 image: &VipsImage,
26834 ink: &mut [f64],
26835 left: i32,
26836 top: i32,
26837 width: i32,
26838 height: i32,
26839) -> Result<()> {
26840 unsafe {
26841 let image_in: *mut bindings::VipsImage = image.ctx;
26842 let ink_in: *mut f64 = ink.as_mut_ptr();
26843 let left_in: i32 = left;
26844 let top_in: i32 = top;
26845 let width_in: i32 = width;
26846 let height_in: i32 = height;
26847
26848 let vips_op_response = bindings::vips_draw_rect(
26849 image_in,
26850 ink_in,
26851 ink.len() as i32,
26852 left_in,
26853 top_in,
26854 width_in,
26855 height_in,
26856 NULL,
26857 );
26858 utils::result(vips_op_response, (), Error::DrawRectError)
26859 }
26860}
26861
26862#[derive(Clone, Debug)]
26864pub struct DrawRectOptions {
26865 pub fill: bool,
26868}
26869
26870impl std::default::Default for DrawRectOptions {
26871 fn default() -> Self {
26872 DrawRectOptions { fill: false }
26873 }
26874}
26875
26876pub fn draw_rect_with_opts(
26890 image: &VipsImage,
26891 ink: &mut [f64],
26892 left: i32,
26893 top: i32,
26894 width: i32,
26895 height: i32,
26896 draw_rect_options: &DrawRectOptions,
26897) -> Result<()> {
26898 unsafe {
26899 let image_in: *mut bindings::VipsImage = image.ctx;
26900 let ink_in: *mut f64 = ink.as_mut_ptr();
26901 let left_in: i32 = left;
26902 let top_in: i32 = top;
26903 let width_in: i32 = width;
26904 let height_in: i32 = height;
26905
26906 let fill_in: i32 = if draw_rect_options.fill { 1 } else { 0 };
26907 let fill_in_name = utils::new_c_string("fill")?;
26908
26909 let vips_op_response = bindings::vips_draw_rect(
26910 image_in,
26911 ink_in,
26912 ink.len() as i32,
26913 left_in,
26914 top_in,
26915 width_in,
26916 height_in,
26917 fill_in_name.as_ptr(),
26918 fill_in,
26919 NULL,
26920 );
26921 utils::result(vips_op_response, (), Error::DrawRectError)
26922 }
26923}
26924
26925pub fn draw_mask(
26935 image: &VipsImage,
26936 ink: &mut [f64],
26937 mask: &VipsImage,
26938 x: i32,
26939 y: i32,
26940) -> Result<()> {
26941 unsafe {
26942 let image_in: *mut bindings::VipsImage = image.ctx;
26943 let ink_in: *mut f64 = ink.as_mut_ptr();
26944 let mask_in: *mut bindings::VipsImage = mask.ctx;
26945 let x_in: i32 = x;
26946 let y_in: i32 = y;
26947
26948 let vips_op_response = bindings::vips_draw_mask(
26949 image_in,
26950 ink_in,
26951 ink.len() as i32,
26952 mask_in,
26953 x_in,
26954 y_in,
26955 NULL,
26956 );
26957 utils::result(vips_op_response, (), Error::DrawMaskError)
26958 }
26959}
26960
26961pub fn draw_line(
26974 image: &VipsImage,
26975 ink: &mut [f64],
26976 x_1: i32,
26977 y_1: i32,
26978 x_2: i32,
26979 y_2: i32,
26980) -> Result<()> {
26981 unsafe {
26982 let image_in: *mut bindings::VipsImage = image.ctx;
26983 let ink_in: *mut f64 = ink.as_mut_ptr();
26984 let x_1_in: i32 = x_1;
26985 let y_1_in: i32 = y_1;
26986 let x_2_in: i32 = x_2;
26987 let y_2_in: i32 = y_2;
26988
26989 let vips_op_response = bindings::vips_draw_line(
26990 image_in,
26991 ink_in,
26992 ink.len() as i32,
26993 x_1_in,
26994 y_1_in,
26995 x_2_in,
26996 y_2_in,
26997 NULL,
26998 );
26999 utils::result(vips_op_response, (), Error::DrawLineError)
27000 }
27001}
27002
27003pub fn draw_circle(
27014 image: &VipsImage,
27015 ink: &mut [f64],
27016 cx: i32,
27017 cy: i32,
27018 radius: i32,
27019) -> Result<()> {
27020 unsafe {
27021 let image_in: *mut bindings::VipsImage = image.ctx;
27022 let ink_in: *mut f64 = ink.as_mut_ptr();
27023 let cx_in: i32 = cx;
27024 let cy_in: i32 = cy;
27025 let radius_in: i32 = radius;
27026
27027 let vips_op_response = bindings::vips_draw_circle(
27028 image_in,
27029 ink_in,
27030 ink.len() as i32,
27031 cx_in,
27032 cy_in,
27033 radius_in,
27034 NULL,
27035 );
27036 utils::result(vips_op_response, (), Error::DrawCircleError)
27037 }
27038}
27039
27040#[derive(Clone, Debug)]
27042pub struct DrawCircleOptions {
27043 pub fill: bool,
27046}
27047
27048impl std::default::Default for DrawCircleOptions {
27049 fn default() -> Self {
27050 DrawCircleOptions { fill: false }
27051 }
27052}
27053
27054pub fn draw_circle_with_opts(
27066 image: &VipsImage,
27067 ink: &mut [f64],
27068 cx: i32,
27069 cy: i32,
27070 radius: i32,
27071 draw_circle_options: &DrawCircleOptions,
27072) -> Result<()> {
27073 unsafe {
27074 let image_in: *mut bindings::VipsImage = image.ctx;
27075 let ink_in: *mut f64 = ink.as_mut_ptr();
27076 let cx_in: i32 = cx;
27077 let cy_in: i32 = cy;
27078 let radius_in: i32 = radius;
27079
27080 let fill_in: i32 = if draw_circle_options.fill { 1 } else { 0 };
27081 let fill_in_name = utils::new_c_string("fill")?;
27082
27083 let vips_op_response = bindings::vips_draw_circle(
27084 image_in,
27085 ink_in,
27086 ink.len() as i32,
27087 cx_in,
27088 cy_in,
27089 radius_in,
27090 fill_in_name.as_ptr(),
27091 fill_in,
27092 NULL,
27093 );
27094 utils::result(vips_op_response, (), Error::DrawCircleError)
27095 }
27096}
27097
27098pub fn draw_flood(image: &VipsImage, ink: &mut [f64], x: i32, y: i32) -> Result<()> {
27107 unsafe {
27108 let image_in: *mut bindings::VipsImage = image.ctx;
27109 let ink_in: *mut f64 = ink.as_mut_ptr();
27110 let x_in: i32 = x;
27111 let y_in: i32 = y;
27112
27113 let vips_op_response =
27114 bindings::vips_draw_flood(image_in, ink_in, ink.len() as i32, x_in, y_in, NULL);
27115 utils::result(vips_op_response, (), Error::DrawFloodError)
27116 }
27117}
27118
27119#[derive(Clone, Debug)]
27121pub struct DrawFloodOptions {
27122 pub test: VipsImage,
27124 pub equal: bool,
27127 pub left: i32,
27130 pub top: i32,
27133 pub width: i32,
27136 pub height: i32,
27139}
27140
27141impl std::default::Default for DrawFloodOptions {
27142 fn default() -> Self {
27143 DrawFloodOptions {
27144 test: VipsImage::new(),
27145 equal: false,
27146 left: i32::from(0),
27147 top: i32::from(0),
27148 width: i32::from(0),
27149 height: i32::from(0),
27150 }
27151 }
27152}
27153
27154pub fn draw_flood_with_opts(
27164 image: &VipsImage,
27165 ink: &mut [f64],
27166 x: i32,
27167 y: i32,
27168 draw_flood_options: &DrawFloodOptions,
27169) -> Result<()> {
27170 unsafe {
27171 let image_in: *mut bindings::VipsImage = image.ctx;
27172 let ink_in: *mut f64 = ink.as_mut_ptr();
27173 let x_in: i32 = x;
27174 let y_in: i32 = y;
27175
27176 let test_in: *mut bindings::VipsImage = draw_flood_options.test.ctx;
27177 let test_in_name = utils::new_c_string("test")?;
27178
27179 let equal_in: i32 = if draw_flood_options.equal { 1 } else { 0 };
27180 let equal_in_name = utils::new_c_string("equal")?;
27181
27182 let left_in: i32 = draw_flood_options.left;
27183 let left_in_name = utils::new_c_string("left")?;
27184
27185 let top_in: i32 = draw_flood_options.top;
27186 let top_in_name = utils::new_c_string("top")?;
27187
27188 let width_in: i32 = draw_flood_options.width;
27189 let width_in_name = utils::new_c_string("width")?;
27190
27191 let height_in: i32 = draw_flood_options.height;
27192 let height_in_name = utils::new_c_string("height")?;
27193
27194 let vips_op_response = bindings::vips_draw_flood(
27195 image_in,
27196 ink_in,
27197 ink.len() as i32,
27198 x_in,
27199 y_in,
27200 test_in_name.as_ptr(),
27201 test_in,
27202 equal_in_name.as_ptr(),
27203 equal_in,
27204 left_in_name.as_ptr(),
27205 left_in,
27206 top_in_name.as_ptr(),
27207 top_in,
27208 width_in_name.as_ptr(),
27209 width_in,
27210 height_in_name.as_ptr(),
27211 height_in,
27212 NULL,
27213 );
27214 utils::result(vips_op_response, (), Error::DrawFloodError)
27215 }
27216}
27217
27218pub fn draw_image(image: &VipsImage, sub: &VipsImage, x: i32, y: i32) -> Result<()> {
27227 unsafe {
27228 let image_in: *mut bindings::VipsImage = image.ctx;
27229 let sub_in: *mut bindings::VipsImage = sub.ctx;
27230 let x_in: i32 = x;
27231 let y_in: i32 = y;
27232
27233 let vips_op_response = bindings::vips_draw_image(image_in, sub_in, x_in, y_in, NULL);
27234 utils::result(vips_op_response, (), Error::DrawImageError)
27235 }
27236}
27237
27238#[derive(Clone, Debug)]
27240pub struct DrawImageOptions {
27241 pub mode: CombineMode,
27246}
27247
27248impl std::default::Default for DrawImageOptions {
27249 fn default() -> Self {
27250 DrawImageOptions {
27251 mode: CombineMode::Set,
27252 }
27253 }
27254}
27255
27256pub fn draw_image_with_opts(
27266 image: &VipsImage,
27267 sub: &VipsImage,
27268 x: i32,
27269 y: i32,
27270 draw_image_options: &DrawImageOptions,
27271) -> Result<()> {
27272 unsafe {
27273 let image_in: *mut bindings::VipsImage = image.ctx;
27274 let sub_in: *mut bindings::VipsImage = sub.ctx;
27275 let x_in: i32 = x;
27276 let y_in: i32 = y;
27277
27278 let mode_in: i32 = draw_image_options.mode as i32;
27279 let mode_in_name = utils::new_c_string("mode")?;
27280
27281 let vips_op_response = bindings::vips_draw_image(
27282 image_in,
27283 sub_in,
27284 x_in,
27285 y_in,
27286 mode_in_name.as_ptr(),
27287 mode_in,
27288 NULL,
27289 );
27290 utils::result(vips_op_response, (), Error::DrawImageError)
27291 }
27292}
27293
27294pub fn draw_smudge(image: &VipsImage, left: i32, top: i32, width: i32, height: i32) -> Result<()> {
27306 unsafe {
27307 let image_in: *mut bindings::VipsImage = image.ctx;
27308 let left_in: i32 = left;
27309 let top_in: i32 = top;
27310 let width_in: i32 = width;
27311 let height_in: i32 = height;
27312
27313 let vips_op_response =
27314 bindings::vips_draw_smudge(image_in, left_in, top_in, width_in, height_in, NULL);
27315 utils::result(vips_op_response, (), Error::DrawSmudgeError)
27316 }
27317}
27318
27319pub fn merge(
27332 refp: &VipsImage,
27333 sec: &VipsImage,
27334 direction: Direction,
27335 dx: i32,
27336 dy: i32,
27337) -> Result<VipsImage> {
27338 unsafe {
27339 let refp_in: *mut bindings::VipsImage = refp.ctx;
27340 let sec_in: *mut bindings::VipsImage = sec.ctx;
27341 let direction_in: i32 = direction as i32;
27342 let dx_in: i32 = dx;
27343 let dy_in: i32 = dy;
27344 let mut out_out: *mut bindings::VipsImage = null_mut();
27345
27346 let vips_op_response = bindings::vips_merge(
27347 refp_in,
27348 sec_in,
27349 &mut out_out,
27350 direction_in.try_into().unwrap(),
27351 dx_in,
27352 dy_in,
27353 NULL,
27354 );
27355 utils::result(
27356 vips_op_response,
27357 VipsImage { ctx: out_out },
27358 Error::MergeError,
27359 )
27360 }
27361}
27362
27363#[derive(Clone, Debug)]
27365pub struct MergeOptions {
27366 pub mblend: i32,
27369}
27370
27371impl std::default::Default for MergeOptions {
27372 fn default() -> Self {
27373 MergeOptions {
27374 mblend: i32::from(10),
27375 }
27376 }
27377}
27378
27379pub fn merge_with_opts(
27393 refp: &VipsImage,
27394 sec: &VipsImage,
27395 direction: Direction,
27396 dx: i32,
27397 dy: i32,
27398 merge_options: &MergeOptions,
27399) -> Result<VipsImage> {
27400 unsafe {
27401 let refp_in: *mut bindings::VipsImage = refp.ctx;
27402 let sec_in: *mut bindings::VipsImage = sec.ctx;
27403 let direction_in: i32 = direction as i32;
27404 let dx_in: i32 = dx;
27405 let dy_in: i32 = dy;
27406 let mut out_out: *mut bindings::VipsImage = null_mut();
27407
27408 let mblend_in: i32 = merge_options.mblend;
27409 let mblend_in_name = utils::new_c_string("mblend")?;
27410
27411 let vips_op_response = bindings::vips_merge(
27412 refp_in,
27413 sec_in,
27414 &mut out_out,
27415 direction_in.try_into().unwrap(),
27416 dx_in,
27417 dy_in,
27418 mblend_in_name.as_ptr(),
27419 mblend_in,
27420 NULL,
27421 );
27422 utils::result(
27423 vips_op_response,
27424 VipsImage { ctx: out_out },
27425 Error::MergeError,
27426 )
27427 }
27428}
27429
27430pub fn mosaic(
27447 refp: &VipsImage,
27448 sec: &VipsImage,
27449 direction: Direction,
27450 xref: i32,
27451 yref: i32,
27452 xsec: i32,
27453 ysec: i32,
27454) -> Result<VipsImage> {
27455 unsafe {
27456 let refp_in: *mut bindings::VipsImage = refp.ctx;
27457 let sec_in: *mut bindings::VipsImage = sec.ctx;
27458 let direction_in: i32 = direction as i32;
27459 let xref_in: i32 = xref;
27460 let yref_in: i32 = yref;
27461 let xsec_in: i32 = xsec;
27462 let ysec_in: i32 = ysec;
27463 let mut out_out: *mut bindings::VipsImage = null_mut();
27464
27465 let vips_op_response = bindings::vips_mosaic(
27466 refp_in,
27467 sec_in,
27468 &mut out_out,
27469 direction_in.try_into().unwrap(),
27470 xref_in,
27471 yref_in,
27472 xsec_in,
27473 ysec_in,
27474 NULL,
27475 );
27476 utils::result(
27477 vips_op_response,
27478 VipsImage { ctx: out_out },
27479 Error::MosaicError,
27480 )
27481 }
27482}
27483
27484#[derive(Clone, Debug)]
27486pub struct MosaicOptions {
27487 pub hwindow: i32,
27490 pub harea: i32,
27493 pub mblend: i32,
27496 pub bandno: i32,
27499 pub dx_0: i32,
27502 pub dy_0: i32,
27505 pub scale_1: f64,
27508 pub angle_1: f64,
27511 pub dy_1: f64,
27514 pub dx_1: f64,
27517}
27518
27519impl std::default::Default for MosaicOptions {
27520 fn default() -> Self {
27521 MosaicOptions {
27522 hwindow: i32::from(5),
27523 harea: i32::from(15),
27524 mblend: i32::from(10),
27525 bandno: i32::from(0),
27526 dx_0: i32::from(0),
27527 dy_0: i32::from(0),
27528 scale_1: f64::from(1),
27529 angle_1: f64::from(0),
27530 dy_1: f64::from(0),
27531 dx_1: f64::from(0),
27532 }
27533 }
27534}
27535
27536pub fn mosaic_with_opts(
27554 refp: &VipsImage,
27555 sec: &VipsImage,
27556 direction: Direction,
27557 xref: i32,
27558 yref: i32,
27559 xsec: i32,
27560 ysec: i32,
27561 mosaic_options: &MosaicOptions,
27562) -> Result<VipsImage> {
27563 unsafe {
27564 let refp_in: *mut bindings::VipsImage = refp.ctx;
27565 let sec_in: *mut bindings::VipsImage = sec.ctx;
27566 let direction_in: i32 = direction as i32;
27567 let xref_in: i32 = xref;
27568 let yref_in: i32 = yref;
27569 let xsec_in: i32 = xsec;
27570 let ysec_in: i32 = ysec;
27571 let mut out_out: *mut bindings::VipsImage = null_mut();
27572
27573 let hwindow_in: i32 = mosaic_options.hwindow;
27574 let hwindow_in_name = utils::new_c_string("hwindow")?;
27575
27576 let harea_in: i32 = mosaic_options.harea;
27577 let harea_in_name = utils::new_c_string("harea")?;
27578
27579 let mblend_in: i32 = mosaic_options.mblend;
27580 let mblend_in_name = utils::new_c_string("mblend")?;
27581
27582 let bandno_in: i32 = mosaic_options.bandno;
27583 let bandno_in_name = utils::new_c_string("bandno")?;
27584
27585 let dx_0_in: i32 = mosaic_options.dx_0;
27586 let dx_0_in_name = utils::new_c_string("dx0")?;
27587
27588 let dy_0_in: i32 = mosaic_options.dy_0;
27589 let dy_0_in_name = utils::new_c_string("dy0")?;
27590
27591 let scale_1_in: f64 = mosaic_options.scale_1;
27592 let scale_1_in_name = utils::new_c_string("scale1")?;
27593
27594 let angle_1_in: f64 = mosaic_options.angle_1;
27595 let angle_1_in_name = utils::new_c_string("angle1")?;
27596
27597 let dy_1_in: f64 = mosaic_options.dy_1;
27598 let dy_1_in_name = utils::new_c_string("dy1")?;
27599
27600 let dx_1_in: f64 = mosaic_options.dx_1;
27601 let dx_1_in_name = utils::new_c_string("dx1")?;
27602
27603 let vips_op_response = bindings::vips_mosaic(
27604 refp_in,
27605 sec_in,
27606 &mut out_out,
27607 direction_in.try_into().unwrap(),
27608 xref_in,
27609 yref_in,
27610 xsec_in,
27611 ysec_in,
27612 hwindow_in_name.as_ptr(),
27613 hwindow_in,
27614 harea_in_name.as_ptr(),
27615 harea_in,
27616 mblend_in_name.as_ptr(),
27617 mblend_in,
27618 bandno_in_name.as_ptr(),
27619 bandno_in,
27620 dx_0_in_name.as_ptr(),
27621 dx_0_in,
27622 dy_0_in_name.as_ptr(),
27623 dy_0_in,
27624 scale_1_in_name.as_ptr(),
27625 scale_1_in,
27626 angle_1_in_name.as_ptr(),
27627 angle_1_in,
27628 dy_1_in_name.as_ptr(),
27629 dy_1_in,
27630 dx_1_in_name.as_ptr(),
27631 dx_1_in,
27632 NULL,
27633 );
27634 utils::result(
27635 vips_op_response,
27636 VipsImage { ctx: out_out },
27637 Error::MosaicError,
27638 )
27639 }
27640}
27641
27642pub fn mosaic_1(
27667 refp: &VipsImage,
27668 sec: &VipsImage,
27669 direction: Direction,
27670 xr_1: i32,
27671 yr_1: i32,
27672 xs_1: i32,
27673 ys_1: i32,
27674 xr_2: i32,
27675 yr_2: i32,
27676 xs_2: i32,
27677 ys_2: i32,
27678) -> Result<VipsImage> {
27679 unsafe {
27680 let refp_in: *mut bindings::VipsImage = refp.ctx;
27681 let sec_in: *mut bindings::VipsImage = sec.ctx;
27682 let direction_in: i32 = direction as i32;
27683 let xr_1_in: i32 = xr_1;
27684 let yr_1_in: i32 = yr_1;
27685 let xs_1_in: i32 = xs_1;
27686 let ys_1_in: i32 = ys_1;
27687 let xr_2_in: i32 = xr_2;
27688 let yr_2_in: i32 = yr_2;
27689 let xs_2_in: i32 = xs_2;
27690 let ys_2_in: i32 = ys_2;
27691 let mut out_out: *mut bindings::VipsImage = null_mut();
27692
27693 let vips_op_response = bindings::vips_mosaic1(
27694 refp_in,
27695 sec_in,
27696 &mut out_out,
27697 direction_in.try_into().unwrap(),
27698 xr_1_in,
27699 yr_1_in,
27700 xs_1_in,
27701 ys_1_in,
27702 xr_2_in,
27703 yr_2_in,
27704 xs_2_in,
27705 ys_2_in,
27706 NULL,
27707 );
27708 utils::result(
27709 vips_op_response,
27710 VipsImage { ctx: out_out },
27711 Error::Mosaic1Error,
27712 )
27713 }
27714}
27715
27716#[derive(Clone, Debug)]
27718pub struct Mosaic1Options {
27719 pub hwindow: i32,
27722 pub harea: i32,
27725 pub search: bool,
27728 pub interpolate: VipsInterpolate,
27730 pub mblend: i32,
27733}
27734
27735impl std::default::Default for Mosaic1Options {
27736 fn default() -> Self {
27737 Mosaic1Options {
27738 hwindow: i32::from(5),
27739 harea: i32::from(15),
27740 search: false,
27741 interpolate: VipsInterpolate::new(),
27742 mblend: i32::from(10),
27743 }
27744 }
27745}
27746
27747pub fn mosaic_1_with_opts(
27773 refp: &VipsImage,
27774 sec: &VipsImage,
27775 direction: Direction,
27776 xr_1: i32,
27777 yr_1: i32,
27778 xs_1: i32,
27779 ys_1: i32,
27780 xr_2: i32,
27781 yr_2: i32,
27782 xs_2: i32,
27783 ys_2: i32,
27784 mosaic_1_options: &Mosaic1Options,
27785) -> Result<VipsImage> {
27786 unsafe {
27787 let refp_in: *mut bindings::VipsImage = refp.ctx;
27788 let sec_in: *mut bindings::VipsImage = sec.ctx;
27789 let direction_in: i32 = direction as i32;
27790 let xr_1_in: i32 = xr_1;
27791 let yr_1_in: i32 = yr_1;
27792 let xs_1_in: i32 = xs_1;
27793 let ys_1_in: i32 = ys_1;
27794 let xr_2_in: i32 = xr_2;
27795 let yr_2_in: i32 = yr_2;
27796 let xs_2_in: i32 = xs_2;
27797 let ys_2_in: i32 = ys_2;
27798 let mut out_out: *mut bindings::VipsImage = null_mut();
27799
27800 let hwindow_in: i32 = mosaic_1_options.hwindow;
27801 let hwindow_in_name = utils::new_c_string("hwindow")?;
27802
27803 let harea_in: i32 = mosaic_1_options.harea;
27804 let harea_in_name = utils::new_c_string("harea")?;
27805
27806 let search_in: i32 = if mosaic_1_options.search { 1 } else { 0 };
27807 let search_in_name = utils::new_c_string("search")?;
27808
27809 let interpolate_in: *mut bindings::VipsInterpolate = mosaic_1_options.interpolate.ctx;
27810 let interpolate_in_name = utils::new_c_string("interpolate")?;
27811
27812 let mblend_in: i32 = mosaic_1_options.mblend;
27813 let mblend_in_name = utils::new_c_string("mblend")?;
27814
27815 let vips_op_response = bindings::vips_mosaic1(
27816 refp_in,
27817 sec_in,
27818 &mut out_out,
27819 direction_in.try_into().unwrap(),
27820 xr_1_in,
27821 yr_1_in,
27822 xs_1_in,
27823 ys_1_in,
27824 xr_2_in,
27825 yr_2_in,
27826 xs_2_in,
27827 ys_2_in,
27828 hwindow_in_name.as_ptr(),
27829 hwindow_in,
27830 harea_in_name.as_ptr(),
27831 harea_in,
27832 search_in_name.as_ptr(),
27833 search_in,
27834 interpolate_in_name.as_ptr(),
27835 interpolate_in,
27836 mblend_in_name.as_ptr(),
27837 mblend_in,
27838 NULL,
27839 );
27840 utils::result(
27841 vips_op_response,
27842 VipsImage { ctx: out_out },
27843 Error::Mosaic1Error,
27844 )
27845 }
27846}
27847
27848pub fn matrixinvert(inp: &VipsImage) -> Result<VipsImage> {
27852 unsafe {
27853 let inp_in: *mut bindings::VipsImage = inp.ctx;
27854 let mut out_out: *mut bindings::VipsImage = null_mut();
27855
27856 let vips_op_response = bindings::vips_matrixinvert(inp_in, &mut out_out, NULL);
27857 utils::result(
27858 vips_op_response,
27859 VipsImage { ctx: out_out },
27860 Error::MatrixinvertError,
27861 )
27862 }
27863}
27864
27865pub fn matches(
27886 refp: &VipsImage,
27887 sec: &VipsImage,
27888 xr_1: i32,
27889 yr_1: i32,
27890 xs_1: i32,
27891 ys_1: i32,
27892 xr_2: i32,
27893 yr_2: i32,
27894 xs_2: i32,
27895 ys_2: i32,
27896) -> Result<VipsImage> {
27897 unsafe {
27898 let refp_in: *mut bindings::VipsImage = refp.ctx;
27899 let sec_in: *mut bindings::VipsImage = sec.ctx;
27900 let xr_1_in: i32 = xr_1;
27901 let yr_1_in: i32 = yr_1;
27902 let xs_1_in: i32 = xs_1;
27903 let ys_1_in: i32 = ys_1;
27904 let xr_2_in: i32 = xr_2;
27905 let yr_2_in: i32 = yr_2;
27906 let xs_2_in: i32 = xs_2;
27907 let ys_2_in: i32 = ys_2;
27908 let mut out_out: *mut bindings::VipsImage = null_mut();
27909
27910 let vips_op_response = bindings::vips_match(
27911 refp_in,
27912 sec_in,
27913 &mut out_out,
27914 xr_1_in,
27915 yr_1_in,
27916 xs_1_in,
27917 ys_1_in,
27918 xr_2_in,
27919 yr_2_in,
27920 xs_2_in,
27921 ys_2_in,
27922 NULL,
27923 );
27924 utils::result(
27925 vips_op_response,
27926 VipsImage { ctx: out_out },
27927 Error::MatchError,
27928 )
27929 }
27930}
27931
27932#[derive(Clone, Debug)]
27934pub struct MatchOptions {
27935 pub hwindow: i32,
27938 pub harea: i32,
27941 pub search: bool,
27944 pub interpolate: VipsInterpolate,
27946}
27947
27948impl std::default::Default for MatchOptions {
27949 fn default() -> Self {
27950 MatchOptions {
27951 hwindow: i32::from(1),
27952 harea: i32::from(1),
27953 search: false,
27954 interpolate: VipsInterpolate::new(),
27955 }
27956 }
27957}
27958
27959pub fn matches_with_opts(
27981 refp: &VipsImage,
27982 sec: &VipsImage,
27983 xr_1: i32,
27984 yr_1: i32,
27985 xs_1: i32,
27986 ys_1: i32,
27987 xr_2: i32,
27988 yr_2: i32,
27989 xs_2: i32,
27990 ys_2: i32,
27991 matches_options: &MatchOptions,
27992) -> Result<VipsImage> {
27993 unsafe {
27994 let refp_in: *mut bindings::VipsImage = refp.ctx;
27995 let sec_in: *mut bindings::VipsImage = sec.ctx;
27996 let xr_1_in: i32 = xr_1;
27997 let yr_1_in: i32 = yr_1;
27998 let xs_1_in: i32 = xs_1;
27999 let ys_1_in: i32 = ys_1;
28000 let xr_2_in: i32 = xr_2;
28001 let yr_2_in: i32 = yr_2;
28002 let xs_2_in: i32 = xs_2;
28003 let ys_2_in: i32 = ys_2;
28004 let mut out_out: *mut bindings::VipsImage = null_mut();
28005
28006 let hwindow_in: i32 = matches_options.hwindow;
28007 let hwindow_in_name = utils::new_c_string("hwindow")?;
28008
28009 let harea_in: i32 = matches_options.harea;
28010 let harea_in_name = utils::new_c_string("harea")?;
28011
28012 let search_in: i32 = if matches_options.search { 1 } else { 0 };
28013 let search_in_name = utils::new_c_string("search")?;
28014
28015 let interpolate_in: *mut bindings::VipsInterpolate = matches_options.interpolate.ctx;
28016 let interpolate_in_name = utils::new_c_string("interpolate")?;
28017
28018 let vips_op_response = bindings::vips_match(
28019 refp_in,
28020 sec_in,
28021 &mut out_out,
28022 xr_1_in,
28023 yr_1_in,
28024 xs_1_in,
28025 ys_1_in,
28026 xr_2_in,
28027 yr_2_in,
28028 xs_2_in,
28029 ys_2_in,
28030 hwindow_in_name.as_ptr(),
28031 hwindow_in,
28032 harea_in_name.as_ptr(),
28033 harea_in,
28034 search_in_name.as_ptr(),
28035 search_in,
28036 interpolate_in_name.as_ptr(),
28037 interpolate_in,
28038 NULL,
28039 );
28040 utils::result(
28041 vips_op_response,
28042 VipsImage { ctx: out_out },
28043 Error::MatchError,
28044 )
28045 }
28046}
28047
28048pub fn globalbalance(inp: &VipsImage) -> Result<VipsImage> {
28052 unsafe {
28053 let inp_in: *mut bindings::VipsImage = inp.ctx;
28054 let mut out_out: *mut bindings::VipsImage = null_mut();
28055
28056 let vips_op_response = bindings::vips_globalbalance(inp_in, &mut out_out, NULL);
28057 utils::result(
28058 vips_op_response,
28059 VipsImage { ctx: out_out },
28060 Error::GlobalbalanceError,
28061 )
28062 }
28063}
28064
28065#[derive(Clone, Debug)]
28067pub struct GlobalbalanceOptions {
28068 pub gamma: f64,
28071 pub int_output: bool,
28074}
28075
28076impl std::default::Default for GlobalbalanceOptions {
28077 fn default() -> Self {
28078 GlobalbalanceOptions {
28079 gamma: f64::from(1.6),
28080 int_output: false,
28081 }
28082 }
28083}
28084
28085pub fn globalbalance_with_opts(
28090 inp: &VipsImage,
28091 globalbalance_options: &GlobalbalanceOptions,
28092) -> Result<VipsImage> {
28093 unsafe {
28094 let inp_in: *mut bindings::VipsImage = inp.ctx;
28095 let mut out_out: *mut bindings::VipsImage = null_mut();
28096
28097 let gamma_in: f64 = globalbalance_options.gamma;
28098 let gamma_in_name = utils::new_c_string("gamma")?;
28099
28100 let int_output_in: i32 = if globalbalance_options.int_output {
28101 1
28102 } else {
28103 0
28104 };
28105 let int_output_in_name = utils::new_c_string("int-output")?;
28106
28107 let vips_op_response = bindings::vips_globalbalance(
28108 inp_in,
28109 &mut out_out,
28110 gamma_in_name.as_ptr(),
28111 gamma_in,
28112 int_output_in_name.as_ptr(),
28113 int_output_in,
28114 NULL,
28115 );
28116 utils::result(
28117 vips_op_response,
28118 VipsImage { ctx: out_out },
28119 Error::GlobalbalanceError,
28120 )
28121 }
28122}