Struct gdk4::TextureDownloader
source · #[repr(transparent)]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 multipe 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.
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<'a>(
ptr: *const *const GdkTextureDownloader
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const GdkTextureDownloader ) -> &'a Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut *mut GdkTextureDownloader
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut GdkTextureDownloader ) -> &'a 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 format(&self) -> MemoryFormat
pub fn format(&self) -> MemoryFormat
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
§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<TextureDownloader> for TextureDownloader
impl PartialEq<TextureDownloader> for TextureDownloader
source§fn eq(&self, other: &TextureDownloader) -> bool
fn eq(&self, other: &TextureDownloader) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<TextureDownloader> for TextureDownloader
impl PartialOrd<TextureDownloader> for TextureDownloader
source§fn partial_cmp(&self, other: &TextureDownloader) -> Option<Ordering>
fn partial_cmp(&self, other: &TextureDownloader) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for TextureDownloader
impl StaticType for TextureDownloader
source§fn static_type() -> Type
fn static_type() -> Type
Self
.