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 ppi(&self) -> Option<ImagePpi>
pub fn ppi(&self) -> Option<ImagePpi>
Returns the “pixels-per-inch” 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 Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any
methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>
.source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self
equals other
.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
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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