Trait gdk4::prelude::TextureExt

source ·
pub trait TextureExt: 'static {
    // Required methods
    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

Trait containing all Texture methods.

Implementors

GLTexture, MemoryTexture, Texture

Required Methods§

source

fn height(&self) -> i32

Returns the height of the @self, in pixels.

Returns

the height of the Texture

source

fn width(&self) -> i32

Returns the width of @self, in pixels.

Returns

the width of the Texture

source

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

true if saving succeeded, false on failure.

source

fn save_to_png_bytes(&self) -> Bytes

Available on crate feature v4_6 only.
source

fn save_to_tiff(&self, filename: impl AsRef<Path>) -> Result<(), BoolError>

Available on crate feature v4_6 only.
source

fn save_to_tiff_bytes(&self) -> Bytes

Available on crate feature v4_6 only.

Implementors§