1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use gdk_pixbuf_sys;
6 use gio;
7 use glib;
8 use glib::object::IsA;
9 use glib::object::ObjectType as ObjectType_;
10 use glib::translate::*;
11 use glib::GString;
12 use glib::StaticType;
13 use glib::Value;
14 use gobject_sys;
15 use std::fmt;
16 use std::ptr;
17 use Colorspace;
18 use InterpType;
19 use PixbufFormat;
20 use PixbufRotation;
21 
22 glib_wrapper! {
23     pub struct Pixbuf(Object<gdk_pixbuf_sys::GdkPixbuf, PixbufClass>) @implements gio::Icon, gio::LoadableIcon;
24 
25     match fn {
26         get_type => || gdk_pixbuf_sys::gdk_pixbuf_get_type(),
27     }
28 }
29 
30 impl Pixbuf {
new( colorspace: Colorspace, has_alpha: bool, bits_per_sample: i32, width: i32, height: i32, ) -> Option<Pixbuf>31     pub fn new(
32         colorspace: Colorspace,
33         has_alpha: bool,
34         bits_per_sample: i32,
35         width: i32,
36         height: i32,
37     ) -> Option<Pixbuf> {
38         unsafe {
39             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_new(
40                 colorspace.to_glib(),
41                 has_alpha.to_glib(),
42                 bits_per_sample,
43                 width,
44                 height,
45             ))
46         }
47     }
48 
49     #[cfg(any(feature = "v2_32", feature = "dox"))]
new_from_bytes( data: &glib::Bytes, colorspace: Colorspace, has_alpha: bool, bits_per_sample: i32, width: i32, height: i32, rowstride: i32, ) -> Pixbuf50     pub fn new_from_bytes(
51         data: &glib::Bytes,
52         colorspace: Colorspace,
53         has_alpha: bool,
54         bits_per_sample: i32,
55         width: i32,
56         height: i32,
57         rowstride: i32,
58     ) -> Pixbuf {
59         unsafe {
60             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_new_from_bytes(
61                 data.to_glib_none().0,
62                 colorspace.to_glib(),
63                 has_alpha.to_glib(),
64                 bits_per_sample,
65                 width,
66                 height,
67                 rowstride,
68             ))
69         }
70     }
71 
72     //pub fn new_from_data(data: &[u8], colorspace: Colorspace, has_alpha: bool, bits_per_sample: i32, width: i32, height: i32, rowstride: i32, destroy_fn: Option<Box_<dyn FnOnce(&Vec<u8>) + 'static>>) -> Pixbuf {
73     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_new_from_data() }
74     //}
75 
76     #[cfg_attr(feature = "v2_32", deprecated)]
new_from_inline(data: &[u8], copy_pixels: bool) -> Result<Pixbuf, glib::Error>77     pub fn new_from_inline(data: &[u8], copy_pixels: bool) -> Result<Pixbuf, glib::Error> {
78         let data_length = data.len() as i32;
79         unsafe {
80             let mut error = ptr::null_mut();
81             let ret = gdk_pixbuf_sys::gdk_pixbuf_new_from_inline(
82                 data_length,
83                 data.to_glib_none().0,
84                 copy_pixels.to_glib(),
85                 &mut error,
86             );
87             if error.is_null() {
88                 Ok(from_glib_full(ret))
89             } else {
90                 Err(from_glib_full(error))
91             }
92         }
93     }
94 
new_from_resource(resource_path: &str) -> Result<Pixbuf, glib::Error>95     pub fn new_from_resource(resource_path: &str) -> Result<Pixbuf, glib::Error> {
96         unsafe {
97             let mut error = ptr::null_mut();
98             let ret = gdk_pixbuf_sys::gdk_pixbuf_new_from_resource(
99                 resource_path.to_glib_none().0,
100                 &mut error,
101             );
102             if error.is_null() {
103                 Ok(from_glib_full(ret))
104             } else {
105                 Err(from_glib_full(error))
106             }
107         }
108     }
109 
new_from_resource_at_scale( resource_path: &str, width: i32, height: i32, preserve_aspect_ratio: bool, ) -> Result<Pixbuf, glib::Error>110     pub fn new_from_resource_at_scale(
111         resource_path: &str,
112         width: i32,
113         height: i32,
114         preserve_aspect_ratio: bool,
115     ) -> Result<Pixbuf, glib::Error> {
116         unsafe {
117             let mut error = ptr::null_mut();
118             let ret = gdk_pixbuf_sys::gdk_pixbuf_new_from_resource_at_scale(
119                 resource_path.to_glib_none().0,
120                 width,
121                 height,
122                 preserve_aspect_ratio.to_glib(),
123                 &mut error,
124             );
125             if error.is_null() {
126                 Ok(from_glib_full(ret))
127             } else {
128                 Err(from_glib_full(error))
129             }
130         }
131     }
132 
new_from_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>( stream: &P, cancellable: Option<&Q>, ) -> Result<Pixbuf, glib::Error>133     pub fn new_from_stream<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(
134         stream: &P,
135         cancellable: Option<&Q>,
136     ) -> Result<Pixbuf, glib::Error> {
137         unsafe {
138             let mut error = ptr::null_mut();
139             let ret = gdk_pixbuf_sys::gdk_pixbuf_new_from_stream(
140                 stream.as_ref().to_glib_none().0,
141                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
142                 &mut error,
143             );
144             if error.is_null() {
145                 Ok(from_glib_full(ret))
146             } else {
147                 Err(from_glib_full(error))
148             }
149         }
150     }
151 
new_from_stream_at_scale<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>( stream: &P, width: i32, height: i32, preserve_aspect_ratio: bool, cancellable: Option<&Q>, ) -> Result<Pixbuf, glib::Error>152     pub fn new_from_stream_at_scale<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(
153         stream: &P,
154         width: i32,
155         height: i32,
156         preserve_aspect_ratio: bool,
157         cancellable: Option<&Q>,
158     ) -> Result<Pixbuf, glib::Error> {
159         unsafe {
160             let mut error = ptr::null_mut();
161             let ret = gdk_pixbuf_sys::gdk_pixbuf_new_from_stream_at_scale(
162                 stream.as_ref().to_glib_none().0,
163                 width,
164                 height,
165                 preserve_aspect_ratio.to_glib(),
166                 cancellable.map(|p| p.as_ref()).to_glib_none().0,
167                 &mut error,
168             );
169             if error.is_null() {
170                 Ok(from_glib_full(ret))
171             } else {
172                 Err(from_glib_full(error))
173             }
174         }
175     }
176 
new_from_xpm_data(data: &[&str]) -> Pixbuf177     pub fn new_from_xpm_data(data: &[&str]) -> Pixbuf {
178         unsafe {
179             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_new_from_xpm_data(
180                 data.to_glib_none().0,
181             ))
182         }
183     }
184 
add_alpha(&self, substitute_color: bool, r: u8, g: u8, b: u8) -> Option<Pixbuf>185     pub fn add_alpha(&self, substitute_color: bool, r: u8, g: u8, b: u8) -> Option<Pixbuf> {
186         unsafe {
187             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_add_alpha(
188                 self.to_glib_none().0,
189                 substitute_color.to_glib(),
190                 r,
191                 g,
192                 b,
193             ))
194         }
195     }
196 
apply_embedded_orientation(&self) -> Option<Pixbuf>197     pub fn apply_embedded_orientation(&self) -> Option<Pixbuf> {
198         unsafe {
199             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_apply_embedded_orientation(
200                 self.to_glib_none().0,
201             ))
202         }
203     }
204 
composite( &self, dest: &Pixbuf, dest_x: i32, dest_y: i32, dest_width: i32, dest_height: i32, offset_x: f64, offset_y: f64, scale_x: f64, scale_y: f64, interp_type: InterpType, overall_alpha: i32, )205     pub fn composite(
206         &self,
207         dest: &Pixbuf,
208         dest_x: i32,
209         dest_y: i32,
210         dest_width: i32,
211         dest_height: i32,
212         offset_x: f64,
213         offset_y: f64,
214         scale_x: f64,
215         scale_y: f64,
216         interp_type: InterpType,
217         overall_alpha: i32,
218     ) {
219         unsafe {
220             gdk_pixbuf_sys::gdk_pixbuf_composite(
221                 self.to_glib_none().0,
222                 dest.to_glib_none().0,
223                 dest_x,
224                 dest_y,
225                 dest_width,
226                 dest_height,
227                 offset_x,
228                 offset_y,
229                 scale_x,
230                 scale_y,
231                 interp_type.to_glib(),
232                 overall_alpha,
233             );
234         }
235     }
236 
composite_color( &self, dest: &Pixbuf, dest_x: i32, dest_y: i32, dest_width: i32, dest_height: i32, offset_x: f64, offset_y: f64, scale_x: f64, scale_y: f64, interp_type: InterpType, overall_alpha: i32, check_x: i32, check_y: i32, check_size: i32, color1: u32, color2: u32, )237     pub fn composite_color(
238         &self,
239         dest: &Pixbuf,
240         dest_x: i32,
241         dest_y: i32,
242         dest_width: i32,
243         dest_height: i32,
244         offset_x: f64,
245         offset_y: f64,
246         scale_x: f64,
247         scale_y: f64,
248         interp_type: InterpType,
249         overall_alpha: i32,
250         check_x: i32,
251         check_y: i32,
252         check_size: i32,
253         color1: u32,
254         color2: u32,
255     ) {
256         unsafe {
257             gdk_pixbuf_sys::gdk_pixbuf_composite_color(
258                 self.to_glib_none().0,
259                 dest.to_glib_none().0,
260                 dest_x,
261                 dest_y,
262                 dest_width,
263                 dest_height,
264                 offset_x,
265                 offset_y,
266                 scale_x,
267                 scale_y,
268                 interp_type.to_glib(),
269                 overall_alpha,
270                 check_x,
271                 check_y,
272                 check_size,
273                 color1,
274                 color2,
275             );
276         }
277     }
278 
composite_color_simple( &self, dest_width: i32, dest_height: i32, interp_type: InterpType, overall_alpha: i32, check_size: i32, color1: u32, color2: u32, ) -> Option<Pixbuf>279     pub fn composite_color_simple(
280         &self,
281         dest_width: i32,
282         dest_height: i32,
283         interp_type: InterpType,
284         overall_alpha: i32,
285         check_size: i32,
286         color1: u32,
287         color2: u32,
288     ) -> Option<Pixbuf> {
289         unsafe {
290             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_composite_color_simple(
291                 self.to_glib_none().0,
292                 dest_width,
293                 dest_height,
294                 interp_type.to_glib(),
295                 overall_alpha,
296                 check_size,
297                 color1,
298                 color2,
299             ))
300         }
301     }
302 
copy(&self) -> Option<Pixbuf>303     pub fn copy(&self) -> Option<Pixbuf> {
304         unsafe { from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_copy(self.to_glib_none().0)) }
305     }
306 
copy_area( &self, src_x: i32, src_y: i32, width: i32, height: i32, dest_pixbuf: &Pixbuf, dest_x: i32, dest_y: i32, )307     pub fn copy_area(
308         &self,
309         src_x: i32,
310         src_y: i32,
311         width: i32,
312         height: i32,
313         dest_pixbuf: &Pixbuf,
314         dest_x: i32,
315         dest_y: i32,
316     ) {
317         unsafe {
318             gdk_pixbuf_sys::gdk_pixbuf_copy_area(
319                 self.to_glib_none().0,
320                 src_x,
321                 src_y,
322                 width,
323                 height,
324                 dest_pixbuf.to_glib_none().0,
325                 dest_x,
326                 dest_y,
327             );
328         }
329     }
330 
331     #[cfg(any(feature = "v2_36", feature = "dox"))]
copy_options(&self, dest_pixbuf: &Pixbuf) -> bool332     pub fn copy_options(&self, dest_pixbuf: &Pixbuf) -> bool {
333         unsafe {
334             from_glib(gdk_pixbuf_sys::gdk_pixbuf_copy_options(
335                 self.to_glib_none().0,
336                 dest_pixbuf.to_glib_none().0,
337             ))
338         }
339     }
340 
fill(&self, pixel: u32)341     pub fn fill(&self, pixel: u32) {
342         unsafe {
343             gdk_pixbuf_sys::gdk_pixbuf_fill(self.to_glib_none().0, pixel);
344         }
345     }
346 
flip(&self, horizontal: bool) -> Option<Pixbuf>347     pub fn flip(&self, horizontal: bool) -> Option<Pixbuf> {
348         unsafe {
349             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_flip(
350                 self.to_glib_none().0,
351                 horizontal.to_glib(),
352             ))
353         }
354     }
355 
get_bits_per_sample(&self) -> i32356     pub fn get_bits_per_sample(&self) -> i32 {
357         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_bits_per_sample(self.to_glib_none().0) }
358     }
359 
get_byte_length(&self) -> usize360     pub fn get_byte_length(&self) -> usize {
361         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_byte_length(self.to_glib_none().0) }
362     }
363 
get_colorspace(&self) -> Colorspace364     pub fn get_colorspace(&self) -> Colorspace {
365         unsafe {
366             from_glib(gdk_pixbuf_sys::gdk_pixbuf_get_colorspace(
367                 self.to_glib_none().0,
368             ))
369         }
370     }
371 
get_has_alpha(&self) -> bool372     pub fn get_has_alpha(&self) -> bool {
373         unsafe {
374             from_glib(gdk_pixbuf_sys::gdk_pixbuf_get_has_alpha(
375                 self.to_glib_none().0,
376             ))
377         }
378     }
379 
get_height(&self) -> i32380     pub fn get_height(&self) -> i32 {
381         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_height(self.to_glib_none().0) }
382     }
383 
get_n_channels(&self) -> i32384     pub fn get_n_channels(&self) -> i32 {
385         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_n_channels(self.to_glib_none().0) }
386     }
387 
get_option(&self, key: &str) -> Option<GString>388     pub fn get_option(&self, key: &str) -> Option<GString> {
389         unsafe {
390             from_glib_none(gdk_pixbuf_sys::gdk_pixbuf_get_option(
391                 self.to_glib_none().0,
392                 key.to_glib_none().0,
393             ))
394         }
395     }
396 
397     //#[cfg(any(feature = "v2_32", feature = "dox"))]
398     //pub fn get_options(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 } {
399     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_get_options() }
400     //}
401 
get_rowstride(&self) -> i32402     pub fn get_rowstride(&self) -> i32 {
403         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_rowstride(self.to_glib_none().0) }
404     }
405 
get_width(&self) -> i32406     pub fn get_width(&self) -> i32 {
407         unsafe { gdk_pixbuf_sys::gdk_pixbuf_get_width(self.to_glib_none().0) }
408     }
409 
new_subpixbuf(&self, src_x: i32, src_y: i32, width: i32, height: i32) -> Option<Pixbuf>410     pub fn new_subpixbuf(&self, src_x: i32, src_y: i32, width: i32, height: i32) -> Option<Pixbuf> {
411         unsafe {
412             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_new_subpixbuf(
413                 self.to_glib_none().0,
414                 src_x,
415                 src_y,
416                 width,
417                 height,
418             ))
419         }
420     }
421 
422     #[cfg(any(feature = "v2_32", feature = "dox"))]
read_pixel_bytes(&self) -> Option<glib::Bytes>423     pub fn read_pixel_bytes(&self) -> Option<glib::Bytes> {
424         unsafe {
425             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_read_pixel_bytes(
426                 self.to_glib_none().0,
427             ))
428         }
429     }
430 
431     #[cfg(any(feature = "v2_36", feature = "dox"))]
remove_option(&self, key: &str) -> bool432     pub fn remove_option(&self, key: &str) -> bool {
433         unsafe {
434             from_glib(gdk_pixbuf_sys::gdk_pixbuf_remove_option(
435                 self.to_glib_none().0,
436                 key.to_glib_none().0,
437             ))
438         }
439     }
440 
rotate_simple(&self, angle: PixbufRotation) -> Option<Pixbuf>441     pub fn rotate_simple(&self, angle: PixbufRotation) -> Option<Pixbuf> {
442         unsafe {
443             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_rotate_simple(
444                 self.to_glib_none().0,
445                 angle.to_glib(),
446             ))
447         }
448     }
449 
saturate_and_pixelate(&self, dest: &Pixbuf, saturation: f32, pixelate: bool)450     pub fn saturate_and_pixelate(&self, dest: &Pixbuf, saturation: f32, pixelate: bool) {
451         unsafe {
452             gdk_pixbuf_sys::gdk_pixbuf_saturate_and_pixelate(
453                 self.to_glib_none().0,
454                 dest.to_glib_none().0,
455                 saturation,
456                 pixelate.to_glib(),
457             );
458         }
459     }
460 
461     //pub fn save<P: AsRef<std::path::Path>>(&self, filename: P, type_: &str, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
462     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save() }
463     //}
464 
465     //pub fn save_to_buffer(&self, type_: &str, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Option<Vec<u8>> {
466     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save_to_buffer() }
467     //}
468 
469     //pub fn save_to_callback<P: FnMut(&Vec<u8>, usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
470     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save_to_callback() }
471     //}
472 
473     //pub fn save_to_callbackv<P: FnMut(&Vec<u8>, usize, &glib::Error) -> bool>(&self, save_func: P, type_: &str, option_keys: &[&str], option_values: &[&str]) -> Result<(), glib::Error> {
474     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save_to_callbackv() }
475     //}
476 
477     //pub fn save_to_stream<P: IsA<gio::OutputStream>, Q: IsA<gio::Cancellable>>(&self, stream: &P, type_: &str, cancellable: Option<&Q>, error: Option<&mut glib::Error>, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> bool {
478     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save_to_stream() }
479     //}
480 
481     //pub fn save_to_stream_async<P: IsA<gio::OutputStream>, Q: IsA<gio::Cancellable>, R: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, stream: &P, type_: &str, cancellable: Option<&Q>, callback: R, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
482     //    unsafe { TODO: call gdk_pixbuf_sys:gdk_pixbuf_save_to_stream_async() }
483     //}
484 
485     //
486     //pub fn save_to_stream_async_future<P: IsA<gio::OutputStream> + Clone + 'static>(&self, stream: &P, type_: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) -> Pin<Box_<dyn std::future::Future<Output = Result<(), glib::Error>> + 'static>> {
487 
488     //let stream = stream.clone();
489     //let type_ = String::from(type_);
490     //Box_::pin(gio::GioFuture::new(self, move |obj, send| {
491     //    let cancellable = gio::Cancellable::new();
492     //    obj.save_to_stream_async(
493     //        &stream,
494     //        &type_,
495     //        Some(&cancellable),
496     //        ,
497     //        move |res| {
498     //            send.resolve(res);
499     //        },
500     //    );
501 
502     //    cancellable
503     //}))
504     //}
505 
scale( &self, dest: &Pixbuf, dest_x: i32, dest_y: i32, dest_width: i32, dest_height: i32, offset_x: f64, offset_y: f64, scale_x: f64, scale_y: f64, interp_type: InterpType, )506     pub fn scale(
507         &self,
508         dest: &Pixbuf,
509         dest_x: i32,
510         dest_y: i32,
511         dest_width: i32,
512         dest_height: i32,
513         offset_x: f64,
514         offset_y: f64,
515         scale_x: f64,
516         scale_y: f64,
517         interp_type: InterpType,
518     ) {
519         unsafe {
520             gdk_pixbuf_sys::gdk_pixbuf_scale(
521                 self.to_glib_none().0,
522                 dest.to_glib_none().0,
523                 dest_x,
524                 dest_y,
525                 dest_width,
526                 dest_height,
527                 offset_x,
528                 offset_y,
529                 scale_x,
530                 scale_y,
531                 interp_type.to_glib(),
532             );
533         }
534     }
535 
scale_simple( &self, dest_width: i32, dest_height: i32, interp_type: InterpType, ) -> Option<Pixbuf>536     pub fn scale_simple(
537         &self,
538         dest_width: i32,
539         dest_height: i32,
540         interp_type: InterpType,
541     ) -> Option<Pixbuf> {
542         unsafe {
543             from_glib_full(gdk_pixbuf_sys::gdk_pixbuf_scale_simple(
544                 self.to_glib_none().0,
545                 dest_width,
546                 dest_height,
547                 interp_type.to_glib(),
548             ))
549         }
550     }
551 
set_option(&self, key: &str, value: &str) -> bool552     pub fn set_option(&self, key: &str, value: &str) -> bool {
553         unsafe {
554             from_glib(gdk_pixbuf_sys::gdk_pixbuf_set_option(
555                 self.to_glib_none().0,
556                 key.to_glib_none().0,
557                 value.to_glib_none().0,
558             ))
559         }
560     }
561 
get_property_pixel_bytes(&self) -> Option<glib::Bytes>562     pub fn get_property_pixel_bytes(&self) -> Option<glib::Bytes> {
563         unsafe {
564             let mut value = Value::from_type(<glib::Bytes as StaticType>::static_type());
565             gobject_sys::g_object_get_property(
566                 self.as_ptr() as *mut gobject_sys::GObject,
567                 b"pixel-bytes\0".as_ptr() as *const _,
568                 value.to_glib_none_mut().0,
569             );
570             value
571                 .get()
572                 .expect("Return Value for property `pixel-bytes` getter")
573         }
574     }
575 
576     //pub fn get_property_pixels(&self) -> /*Unimplemented*/Fundamental: Pointer {
577     //    unsafe {
578     //        let mut value = Value::from_type(</*Unknown type*/ as StaticType>::static_type());
579     //        gobject_sys::g_object_get_property(self.as_ptr() as *mut gobject_sys::GObject, b"pixels\0".as_ptr() as *const _, value.to_glib_none_mut().0);
580     //        value.get().expect("Return Value for property `pixels` getter").unwrap()
581     //    }
582     //}
583 
584     #[cfg(any(feature = "v2_36_8", feature = "dox"))]
calculate_rowstride( colorspace: Colorspace, has_alpha: bool, bits_per_sample: i32, width: i32, height: i32, ) -> i32585     pub fn calculate_rowstride(
586         colorspace: Colorspace,
587         has_alpha: bool,
588         bits_per_sample: i32,
589         width: i32,
590         height: i32,
591     ) -> i32 {
592         unsafe {
593             gdk_pixbuf_sys::gdk_pixbuf_calculate_rowstride(
594                 colorspace.to_glib(),
595                 has_alpha.to_glib(),
596                 bits_per_sample,
597                 width,
598                 height,
599             )
600         }
601     }
602 
get_formats() -> Vec<PixbufFormat>603     pub fn get_formats() -> Vec<PixbufFormat> {
604         unsafe {
605             FromGlibPtrContainer::from_glib_container(gdk_pixbuf_sys::gdk_pixbuf_get_formats())
606         }
607     }
608 
609     #[cfg(any(feature = "v2_40", feature = "dox"))]
init_modules(path: &str) -> Result<(), glib::Error>610     pub fn init_modules(path: &str) -> Result<(), glib::Error> {
611         unsafe {
612             let mut error = ptr::null_mut();
613             let _ = gdk_pixbuf_sys::gdk_pixbuf_init_modules(path.to_glib_none().0, &mut error);
614             if error.is_null() {
615                 Ok(())
616             } else {
617                 Err(from_glib_full(error))
618             }
619         }
620     }
621 }
622 
623 impl fmt::Display for Pixbuf {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result624     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
625         write!(f, "Pixbuf")
626     }
627 }
628