1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
use glib::translate::*;
glib::wrapper! {
/// A [`PixbufFormat`][crate::PixbufFormat] contains information about the image format accepted
/// by a module.
///
/// Only modules should access the fields directly, applications should
/// use the `gdk_pixbuf_format_*` family of functions.
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PixbufFormat(Boxed<ffi::GdkPixbufFormat>);
match fn {
copy => |ptr| ffi::gdk_pixbuf_format_copy(ptr),
free => |ptr| ffi::gdk_pixbuf_format_free(ptr),
type_ => || ffi::gdk_pixbuf_format_get_type(),
}
}
impl PixbufFormat {
/// Returns a description of the format.
///
/// # Returns
///
/// a description of the format.
#[doc(alias = "gdk_pixbuf_format_get_description")]
#[doc(alias = "get_description")]
pub fn description(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_description(mut_override(
self.to_glib_none().0,
)))
}
}
/// Returns the filename extensions typically used for files in the
/// given format.
///
/// # Returns
///
/// an array of
/// filename extensions
#[doc(alias = "gdk_pixbuf_format_get_extensions")]
#[doc(alias = "get_extensions")]
pub fn extensions(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gdk_pixbuf_format_get_extensions(
mut_override(self.to_glib_none().0),
))
}
}
/// Returns information about the license of the image loader for the format.
///
/// The returned string should be a shorthand for a well known license, e.g.
/// "LGPL", "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license.
///
/// # Returns
///
/// a string describing the license of the pixbuf format
#[doc(alias = "gdk_pixbuf_format_get_license")]
#[doc(alias = "get_license")]
pub fn license(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_license(mut_override(
self.to_glib_none().0,
)))
}
}
/// Returns the mime types supported by the format.
///
/// # Returns
///
/// an array of mime types
#[doc(alias = "gdk_pixbuf_format_get_mime_types")]
#[doc(alias = "get_mime_types")]
pub fn mime_types(&self) -> Vec<glib::GString> {
unsafe {
FromGlibPtrContainer::from_glib_full(ffi::gdk_pixbuf_format_get_mime_types(
mut_override(self.to_glib_none().0),
))
}
}
/// Returns the name of the format.
///
/// # Returns
///
/// the name of the format.
#[doc(alias = "gdk_pixbuf_format_get_name")]
#[doc(alias = "get_name")]
pub fn name(&self) -> Option<glib::GString> {
unsafe {
from_glib_full(ffi::gdk_pixbuf_format_get_name(mut_override(
self.to_glib_none().0,
)))
}
}
/// Returns whether this image format is disabled.
///
/// See gdk_pixbuf_format_set_disabled().
///
/// # Returns
///
/// whether this image format is disabled.
#[doc(alias = "gdk_pixbuf_format_is_disabled")]
pub fn is_disabled(&self) -> bool {
unsafe {
from_glib(ffi::gdk_pixbuf_format_is_disabled(mut_override(
self.to_glib_none().0,
)))
}
}
/// Returns `TRUE` if the save option specified by @option_key is supported when
/// saving a pixbuf using the module implementing @self.
///
/// See gdk_pixbuf_save() for more information about option keys.
/// ## `option_key`
/// the name of an option
///
/// # Returns
///
/// `TRUE` if the specified option is supported
#[doc(alias = "gdk_pixbuf_format_is_save_option_supported")]
pub fn is_save_option_supported(&self, option_key: &str) -> bool {
unsafe {
from_glib(ffi::gdk_pixbuf_format_is_save_option_supported(
mut_override(self.to_glib_none().0),
option_key.to_glib_none().0,
))
}
}
/// Returns whether this image format is scalable.
///
/// If a file is in a scalable format, it is preferable to load it at
/// the desired size, rather than loading it at the default size and
/// scaling the resulting pixbuf to the desired size.
///
/// # Returns
///
/// whether this image format is scalable.
#[doc(alias = "gdk_pixbuf_format_is_scalable")]
pub fn is_scalable(&self) -> bool {
unsafe {
from_glib(ffi::gdk_pixbuf_format_is_scalable(mut_override(
self.to_glib_none().0,
)))
}
}
/// Returns whether pixbufs can be saved in the given format.
///
/// # Returns
///
/// whether pixbufs can be saved in the given format.
#[doc(alias = "gdk_pixbuf_format_is_writable")]
pub fn is_writable(&self) -> bool {
unsafe {
from_glib(ffi::gdk_pixbuf_format_is_writable(mut_override(
self.to_glib_none().0,
)))
}
}
/// Disables or enables an image format.
///
/// If a format is disabled, GdkPixbuf won't use the image loader for
/// this format to load images.
///
/// Applications can use this to avoid using image loaders with an
/// inappropriate license, see gdk_pixbuf_format_get_license().
/// ## `disabled`
/// `TRUE` to disable the format @self
#[doc(alias = "gdk_pixbuf_format_set_disabled")]
pub fn set_disabled(&mut self, disabled: bool) {
unsafe {
ffi::gdk_pixbuf_format_set_disabled(self.to_glib_none_mut().0, disabled.into_glib());
}
}
}
unsafe impl Send for PixbufFormat {}
unsafe impl Sync for PixbufFormat {}