Struct gdk_pixbuf::Pixbuf [−][src]
pub struct Pixbuf(_);
Implementations
pub fn new(
colorspace: Colorspace,
has_alpha: bool,
bits_per_sample: i32,
width: i32,
height: i32
) -> Option<Pixbuf>
pub fn from_bytes(
data: &Bytes,
colorspace: Colorspace,
has_alpha: bool,
bits_per_sample: i32,
width: i32,
height: i32,
rowstride: i32
) -> Pixbuf
pub fn from_resource_at_scale(
resource_path: &str,
width: i32,
height: i32,
preserve_aspect_ratio: bool
) -> Result<Pixbuf, Error>
pub fn from_stream<P: IsA<InputStream>, Q: IsA<Cancellable>>(
stream: &P,
cancellable: Option<&Q>
) -> Result<Pixbuf, Error>
pub fn from_stream_at_scale<P: IsA<InputStream>, Q: IsA<Cancellable>>(
stream: &P,
width: i32,
height: i32,
preserve_aspect_ratio: bool,
cancellable: Option<&Q>
) -> Result<Pixbuf, Error>
pub fn 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
)
pub fn 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
)
pub fn 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>
pub fn copy_area(
&self,
src_x: i32,
src_y: i32,
width: i32,
height: i32,
dest_pixbuf: &Pixbuf,
dest_x: i32,
dest_y: i32
)
v2_36
only.v2_36
only.pub fn 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
)
pub fn scale_simple(
&self,
dest_width: i32,
dest_height: i32,
interp_type: InterpType
) -> Option<Pixbuf>
pub fn calculate_rowstride(
colorspace: Colorspace,
has_alpha: bool,
bits_per_sample: i32,
width: i32,
height: i32
) -> i32
v2_36_8
only.v2_40
only.pub fn from_mut_slice<T: AsMut<[u8]>>(
data: T,
colorspace: Colorspace,
has_alpha: bool,
bits_per_sample: i32,
width: i32,
height: i32,
row_stride: i32
) -> Pixbuf
Creates a Pixbuf
from a type implementing Read
(like File
).
use std::fs::File; use gdk_pixbuf::Pixbuf; let f = File::open("some_file.png").expect("failed to open image"); let pixbuf = Pixbuf::from_read(f).expect("failed to load image");
pub fn from_file_at_size<T: AsRef<Path>>(
filename: T,
width: i32,
height: i32
) -> Result<Pixbuf, Error>
pub fn from_file_at_scale<T: AsRef<Path>>(
filename: T,
width: i32,
height: i32,
preserve_aspect_ratio: bool
) -> Result<Pixbuf, Error>
pub fn from_stream_async<P: IsA<InputStream>, Q: IsA<Cancellable>, R: FnOnce(Result<Pixbuf, Error>) + Send + 'static>(
stream: &P,
cancellable: Option<&Q>,
callback: R
)
pub fn from_stream_async_future<P: IsA<InputStream> + Clone + 'static>(
stream: &P
) -> Pin<Box<dyn Future<Output = Result<Pixbuf, Error>> + 'static>>
pub fn from_stream_at_scale_async<P: IsA<InputStream>, Q: IsA<Cancellable>, R: FnOnce(Result<Pixbuf, Error>) + Send + 'static>(
stream: &P,
width: i32,
height: i32,
preserve_aspect_ratio: bool,
cancellable: Option<&Q>,
callback: R
)
pub fn from_stream_at_scale_async_future<P: IsA<InputStream> + Clone + 'static>(
stream: &P,
width: i32,
height: i32,
preserve_aspect_ratio: bool
) -> Pin<Box<dyn Future<Output = Result<Pixbuf, Error>> + 'static>>
pub fn file_info_async<P: IsA<Cancellable>, Q: FnOnce(Result<Option<(PixbufFormat, i32, i32)>, Error>) + Send + 'static, T: AsRef<Path>>(
filename: T,
cancellable: Option<&P>,
callback: Q
)
pub fn file_info_async_future<T: AsRef<Path> + Clone + 'static>(
filename: T
) -> Pin<Box<dyn Future<Output = Result<Option<(PixbufFormat, i32, i32)>, Error>> + 'static>>
pub fn save_to_streamv<P: IsA<OutputStream>, Q: IsA<Cancellable>>(
&self,
stream: &P,
type_: &str,
options: &[(&str, &str)],
cancellable: Option<&Q>
) -> Result<(), Error>
v2_36
only.pub fn save_to_streamv_async<P: IsA<OutputStream>, Q: IsA<Cancellable>, R: FnOnce(Result<(), Error>) + Send + 'static>(
&self,
stream: &P,
type_: &str,
options: &[(&str, &str)],
cancellable: Option<&Q>,
callback: R
)
v2_36
only.pub fn save_to_streamv_async_future<P: IsA<OutputStream> + Clone + 'static>(
&self,
stream: &P,
type_: &str,
options: &[(&str, &str)]
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + 'static>>
v2_36
only.Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Pixbuf
impl UnwindSafe for Pixbuf
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
pub fn load<P>(
&self,
size: i32,
cancellable: Option<&P>
) -> Result<(InputStream, GString), Error> where
P: IsA<Cancellable>,
pub fn load_async<P, Q>(&self, size: i32, cancellable: Option<&P>, callback: Q) where
P: IsA<Cancellable>,
Q: 'static + FnOnce(Result<(InputStream, GString), Error>) + Send,
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
V: ToValue,
N: Into<&'a str>,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + Send + Sync + 'static,
N: Into<&'a str>,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value> + 'static,
N: Into<&'a str>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
F: Fn(&[Value]) -> Option<Value>,
N: Into<&'a str>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Emit signal with details by signal id.
Emit signal by it’s name.
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Same as emit
but takes Value
for the arguments.
Same as emit_by_name
but takes Value
for the arguments.
Returns a SendValue
clone of self
.
impl<'a, T, C> FromValueOptional<'a> for T where
C: ValueTypeChecker<Error = ValueTypeMismatchOrNoneError>,
T: FromValue<'a, Checker = C>,