#[repr(C)]pub struct ImageRef {
pub data: *const DecodedImage,
pub copies: *const AtomicUsize,
pub id: u64,
pub run_destructor: bool,
}Fields§
§data: *const DecodedImageShared pointer to an opaque implementation of the decoded image
copies: *const AtomicUsizeHow many copies does this image have (if 0, the font data will be deleted on drop)
id: u64Process-unique, monotonically-assigned identity of the decoded image
(see ImageRefHash). Shared by shallow clones (they are the same
image), fresh for ImageRef::deep_copy and every new_* (a
different image). Unlike the old data-pointer identity this is drawn
from a never-reused counter, so freeing an image and reusing its heap
address can never make a new image collide with a stale key — the
prerequisite for image GC (see resources.rs image_ref_get_hash).
run_destructor: boolImplementations§
Source§impl ImageRef
impl ImageRef
Sourcepub fn into_inner(self) -> Option<DecodedImage>
pub fn into_inner(self) -> Option<DecodedImage>
If *copies = 1, returns the internal image data
pub const fn get_data(&self) -> &DecodedImage
pub fn get_image_callback(&self) -> Option<&CoreImageCallback>
pub fn get_image_callback_mut(&mut self) -> Option<&mut CoreImageCallback>
Sourcepub fn deep_copy(&self) -> Self
pub fn deep_copy(&self) -> Self
In difference to the default shallow copy, creates a new image ref
pub const fn is_null_image(&self) -> bool
pub const fn is_gl_texture(&self) -> bool
pub const fn is_raw_image(&self) -> bool
pub const fn is_callback(&self) -> bool
pub fn get_rawimage(&self) -> Option<RawImage>
Sourcepub fn get_bytes(&self) -> Option<&[u8]>
pub fn get_bytes(&self) -> Option<&[u8]>
Get raw bytes from the image as a slice Returns None if this is not a Raw image or if it’s an External image
Sourcepub fn get_bytes_ptr(&self) -> *const u8
pub fn get_bytes_ptr(&self) -> *const u8
Get a pointer to the raw bytes for debugging/profiling purposes
Returns a unique pointer for this ImageRef’s data
Sourcepub const fn get_size(&self) -> LogicalSize
pub const fn get_size(&self) -> LogicalSize
NOTE: returns (0, 0) for a Callback