Struct slint::SharedPixelBuffer
#[repr(C)]pub struct SharedPixelBuffer<Pixel> { /* private fields */ }
Expand description
SharedPixelBuffer is a container for storing image data as pixels. It is internally reference counted and cheap to clone.
You can construct a new empty shared pixel buffer with SharedPixelBuffer::new
,
or you can clone it from an existing contiguous buffer that you might already have, using
SharedPixelBuffer::clone_from_slice
.
See the documentation for Image
for examples how to use this type to integrate
Slint with external rendering functions.
Implementations§
pub fn make_mut_slice(&mut self) -> &mut [Pixel]
pub fn make_mut_slice(&mut self) -> &mut [Pixel]
Return a mutable slice to the pixel data. If the SharedPixelBuffer was shared, this will make a copy of the buffer.
pub fn new(width: u32, height: u32) -> SharedPixelBuffer<Pixel>
pub fn new(width: u32, height: u32) -> SharedPixelBuffer<Pixel>
Creates a new SharedPixelBuffer with the given width and height. Each pixel will be initialized with the value
that Default::default()
returns for the Pixel type.
pub fn clone_from_slice<SourcePixelType>(
pixel_slice: &[SourcePixelType],
width: u32,
height: u32
) -> SharedPixelBuffer<Pixel>where
[SourcePixelType]: AsPixels<Pixel>,
pub fn clone_from_slice<SourcePixelType>( pixel_slice: &[SourcePixelType], width: u32, height: u32 ) -> SharedPixelBuffer<Pixel>where [SourcePixelType]: AsPixels<Pixel>,
Creates a new SharedPixelBuffer by cloning and converting pixels from an existing slice. This function is useful when another crate was used to allocate an image and you would like to convert it for use in Slint.
Trait Implementations§
§fn clone(&self) -> SharedPixelBuffer<Pixel>
fn clone(&self) -> SharedPixelBuffer<Pixel>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.