pub struct RenderImage {
pub id: ImageId,
/* private fields */
}Expand description
A cached and processed image, in BGRA format
Fields§
§id: ImageIdThe ID associated with this image
Implementations§
Source§impl RenderImage
impl RenderImage
Sourcepub fn new(data: impl Into<SmallVec<[Frame; 1]>>) -> Self
pub fn new(data: impl Into<SmallVec<[Frame; 1]>>) -> Self
Create a new image from the given data.
Sourcepub fn from_gpu(size: Size<DevicePixels>) -> Self
pub fn from_gpu(size: Size<DevicePixels>) -> Self
An atlas-backed GPU picture with no placeholder CPU pixel allocation. The host must upload its GPU tile before painting. Missing tiles are skipped, rather than falling back to an invented CPU image.
Sourcepub fn with_natural_size(self, natural: Size<DevicePixels>) -> Self
pub fn with_natural_size(self, natural: Size<DevicePixels>) -> Self
vue-native: marks this single-frame image as a smaller copy of a picture
of natural pixels. Self::size and Self::as_bytes stay the copy’s;
Self::natural_size (layout, object-fit) answers natural, so the copy
can stand in for the full decode in the asset cache
(crate::ImageSource::replace_cached).
Sourcepub fn natural_size(&self, frame_index: usize) -> Size<DevicePixels>
pub fn natural_size(&self, frame_index: usize) -> Size<DevicePixels>
vue-native: the picture’s own size in pixels: the one
Self::with_natural_size recorded, else the pixels’ size.
Sourcepub fn is_reduced(&self) -> bool
pub fn is_reduced(&self) -> bool
vue-native: are these pixels a smaller copy of the picture
(Self::with_natural_size)?
Sourcepub fn dynamic(self) -> Self
pub fn dynamic(self) -> Self
vue-native: marks this image as one frame of a moving picture, which
crate::Window::paint_image draws as it is (see dynamic).
Sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
vue-native: whether Self::dynamic marked this image.
Sourcepub fn successor(&self, data: impl Into<SmallVec<[Frame; 1]>>) -> Self
pub fn successor(&self, data: impl Into<SmallVec<[Frame; 1]>>) -> Self
vue-native: the next frame of the same picture, data under THIS image’s
id. One id is one atlas key, so
crate::Window::write_image_tile writes these pixels into the tile
this image already has, and a scene that samples that tile shows them on
its next present. Keeps Self::dynamic and the scale factor.
Sourcepub fn as_bytes(&self, frame_index: usize) -> Option<&[u8]>
pub fn as_bytes(&self, frame_index: usize) -> Option<&[u8]>
Convert this image into a byte slice.
Sourcepub fn size(&self, frame_index: usize) -> Size<DevicePixels>
pub fn size(&self, frame_index: usize) -> Size<DevicePixels>
Get the size of this image, in pixels.
Sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Get the number of frames for this image.
Trait Implementations§
Source§impl Debug for RenderImage
impl Debug for RenderImage
impl Eq for RenderImage
Auto Trait Implementations§
impl Forget for RenderImage
impl Freeze for RenderImage
impl Move for RenderImage
impl RefUnwindSafe for RenderImage
impl Send for RenderImage
impl Sync for RenderImage
impl Unpin for RenderImage
impl UnsafeUnpin for RenderImage
impl UnwindSafe for RenderImage
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<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.impl<T> ErasedDestructor for Twhere
T: 'static,
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