Trait gdk4::prelude::TextureExt
source · pub trait TextureExt: 'static {
// Required methods
fn format(&self) -> MemoryFormat;
fn height(&self) -> i32;
fn width(&self) -> i32;
fn save_to_png(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>;
fn save_to_png_bytes(&self) -> Bytes;
fn save_to_tiff(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>;
fn save_to_tiff_bytes(&self) -> Bytes;
}
Expand description
Required Methods§
sourcefn format(&self) -> MemoryFormat
fn format(&self) -> MemoryFormat
Available on crate feature
v4_10
only.Gets the memory format most closely associated with the data of the texture.
Note that it may not be an exact match for texture data stored on the GPU or with compression.
The format can give an indication about the bit depth and opacity of the texture and is useful to determine the best format for downloading the texture.
Returns
the preferred format for the texture’s data
sourcefn save_to_png(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>
fn save_to_png(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>
Store the given @self to the @filename as a PNG file.
This is a utility function intended for debugging and testing.
If you want more control over formats, proper error handling or
want to store to a gio::File
or other location, you might want to
use save_to_png_bytes()
or look into the
gdk-pixbuf library.
filename
the filename to store to
Returns
sourcefn save_to_png_bytes(&self) -> Bytes
fn save_to_png_bytes(&self) -> Bytes
Available on crate feature
v4_6
only.sourcefn save_to_tiff(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>
fn save_to_tiff(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>
Available on crate feature
v4_6
only.sourcefn save_to_tiff_bytes(&self) -> Bytes
fn save_to_tiff_bytes(&self) -> Bytes
Available on crate feature
v4_6
only.