pub struct ViewImage(/* private fields */);Expand description
Handle to an image loading or loaded in the View Process.
The image is disposed when all clones of the handle are dropped.
Implementations§
Source§impl ViewImage
impl ViewImage
Sourcepub fn is_partially_loaded(&self) -> bool
pub fn is_partially_loaded(&self) -> bool
Returns true if the image is progressively decoding and has partially decoded.
Sourcepub fn partial_size(&self) -> PxSize
pub fn partial_size(&self) -> PxSize
Actual size of the current pixels.
Can be different from size if the image is progressively decoding.
Sourcepub fn density(&self) -> Option<PxDensity2d>
pub fn density(&self) -> Option<PxDensity2d>
Returns the pixel density metadata associated with the image, or None if not loaded or error or no
metadata provided by decoder.
Sourcepub fn partial_pixels(&self) -> Option<Vec<u8>>
pub fn partial_pixels(&self) -> Option<Vec<u8>>
Copy the partially decoded pixels if the image is progressively decoding and has not finished decoding.
Format is BGRA8 for normal images or A8 if is_mask.
Sourcepub fn pixels(&self) -> Option<IpcBytes>
pub fn pixels(&self) -> Option<IpcBytes>
Reference the decoded pixels of image.
Returns None until the image is fully loaded. Use partial_pixels to copy
partially decoded bytes.
Format is pre-multiplied BGRA8 for normal images or A8 if is_mask.
Sourcepub fn app_id(&self) -> Option<AppId>
pub fn app_id(&self) -> Option<AppId>
Returns the app that owns the view-process that is handling this image.
Sourcepub fn generation(&self) -> ViewProcessGen
pub fn generation(&self) -> ViewProcessGen
Returns the view-process generation on which the image is loaded.
Sourcepub fn downgrade(&self) -> WeakViewImage
pub fn downgrade(&self) -> WeakViewImage
Creates a WeakViewImage.
Sourcepub fn awaiter(&self) -> SignalOnce
pub fn awaiter(&self) -> SignalOnce
Returns a future that awaits until this image is loaded or encountered an error.
Sourcepub async fn encode(&self, format: Txt) -> Result<IpcBytes, EncodeError>
pub async fn encode(&self, format: Txt) -> Result<IpcBytes, EncodeError>
Tries to encode the image to the format.
The format must be one of the image_encoders supported by the view-process backend.
Trait Implementations§
impl Eq for ViewImage
Auto Trait Implementations§
impl Freeze for ViewImage
impl !RefUnwindSafe for ViewImage
impl Send for ViewImage
impl Sync for ViewImage
impl Unpin for ViewImage
impl !UnwindSafe for ViewImage
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more