pub struct TextureDownloader { /* private fields */ }
v4_10
only.Expand description
The TextureDownloader
is used to download the contents of a
Texture
.
It is intended to be created as a short-term object for a single download, but can be used for multiple downloads of different textures or with different settings.
TextureDownloader
can be used to convert data between different formats.
Create a Texture
for the existing format and then download it in a
different format.
GLib type: Boxed type with copy-on-clone semantics.
Implementations§
Source§impl TextureDownloader
impl TextureDownloader
Sourcepub fn as_ptr(&self) -> *mut GdkTextureDownloader
pub fn as_ptr(&self) -> *mut GdkTextureDownloader
Return the inner pointer to the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow(ptr: &*mut GdkTextureDownloader) -> &Self
pub unsafe fn from_glib_ptr_borrow(ptr: &*mut GdkTextureDownloader) -> &Self
Borrows the underlying C value.
Sourcepub unsafe fn from_glib_ptr_borrow_mut(
ptr: &mut *mut GdkTextureDownloader,
) -> &mut Self
pub unsafe fn from_glib_ptr_borrow_mut( ptr: &mut *mut GdkTextureDownloader, ) -> &mut Self
Borrows the underlying C value mutably.
Source§impl TextureDownloader
impl TextureDownloader
Sourcepub fn new(texture: &impl IsA<Texture>) -> TextureDownloader
pub fn new(texture: &impl IsA<Texture>) -> TextureDownloader
Sourcepub fn download_bytes(&self) -> (Bytes, usize)
pub fn download_bytes(&self) -> (Bytes, usize)
Downloads the given texture pixels into a GBytes
. The rowstride will
be stored in the stride value.
This function will abort if it tries to download a large texture and
fails to allocate memory. If you think that may happen, you should handle
memory allocation yourself and use Gdk::TextureDownloader::download_into()
once allocation succeeded.
§Returns
The downloaded pixels
§out_stride
The stride of the resulting data in bytes
Sourcepub fn color_state(&self) -> ColorState
Available on crate feature v4_16
only.
pub fn color_state(&self) -> ColorState
v4_16
only.Sourcepub fn format(&self) -> MemoryFormat
pub fn format(&self) -> MemoryFormat
Sourcepub fn set_color_state(&mut self, color_state: &ColorState)
Available on crate feature v4_16
only.
pub fn set_color_state(&mut self, color_state: &ColorState)
v4_16
only.Sets the color state the downloader will convert the data to.
By default, the sRGB colorstate returned by get_srgb()
is used.
§color_state
the color state to use
Sourcepub fn set_format(&mut self, format: MemoryFormat)
pub fn set_format(&mut self, format: MemoryFormat)
Sets the format the downloader will download.
By default, GDK_MEMORY_DEFAULT is set.
§format
the format to use
Sourcepub fn set_texture(&mut self, texture: &impl IsA<Texture>)
pub fn set_texture(&mut self, texture: &impl IsA<Texture>)
Trait Implementations§
Source§impl Clone for TextureDownloader
impl Clone for TextureDownloader
Source§impl Debug for TextureDownloader
impl Debug for TextureDownloader
Source§impl From<TextureDownloader> for Value
impl From<TextureDownloader> for Value
Source§fn from(o: TextureDownloader) -> Self
fn from(o: TextureDownloader) -> Self
Source§impl HasParamSpec for TextureDownloader
impl HasParamSpec for TextureDownloader
type ParamSpec = ParamSpecBoxed
Source§type SetValue = TextureDownloader
type SetValue = TextureDownloader
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, TextureDownloader>
fn param_spec_builder() -> Self::BuilderFn
Source§impl Hash for TextureDownloader
impl Hash for TextureDownloader
Source§impl Ord for TextureDownloader
impl Ord for TextureDownloader
Source§fn cmp(&self, other: &TextureDownloader) -> Ordering
fn cmp(&self, other: &TextureDownloader) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for TextureDownloader
impl PartialEq for TextureDownloader
Source§impl PartialOrd for TextureDownloader
impl PartialOrd for TextureDownloader
Source§impl StaticType for TextureDownloader
impl StaticType for TextureDownloader
Source§fn static_type() -> Type
fn static_type() -> Type
Self
.impl Eq for TextureDownloader
impl StructuralPartialEq for TextureDownloader
Auto Trait Implementations§
impl Freeze for TextureDownloader
impl RefUnwindSafe for TextureDownloader
impl !Send for TextureDownloader
impl !Sync for TextureDownloader
impl Unpin for TextureDownloader
impl UnwindSafe for TextureDownloader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)